@codexhost/cli-darwin-x64 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
|
@@ -1264,8 +1264,8 @@ function cleanEnum(obj) {
|
|
|
1264
1264
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
1265
1265
|
}).map((el) => el[1]);
|
|
1266
1266
|
}
|
|
1267
|
-
function base64ToUint8Array(
|
|
1268
|
-
const binaryString = atob(
|
|
1267
|
+
function base64ToUint8Array(base644) {
|
|
1268
|
+
const binaryString = atob(base644);
|
|
1269
1269
|
const bytes = new Uint8Array(binaryString.length);
|
|
1270
1270
|
for (let i = 0; i < binaryString.length; i++) {
|
|
1271
1271
|
bytes[i] = binaryString.charCodeAt(i);
|
|
@@ -1280,9 +1280,9 @@ function uint8ArrayToBase64(bytes) {
|
|
|
1280
1280
|
return btoa(binaryString);
|
|
1281
1281
|
}
|
|
1282
1282
|
function base64urlToUint8Array(base64url3) {
|
|
1283
|
-
const
|
|
1284
|
-
const padding = "=".repeat((4 -
|
|
1285
|
-
return base64ToUint8Array(
|
|
1283
|
+
const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
|
|
1284
|
+
const padding = "=".repeat((4 - base644.length % 4) % 4);
|
|
1285
|
+
return base64ToUint8Array(base644 + padding);
|
|
1286
1286
|
}
|
|
1287
1287
|
function uint8ArrayToBase64url(bytes) {
|
|
1288
1288
|
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
@@ -2648,8 +2648,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
2648
2648
|
function isValidBase64URL(data) {
|
|
2649
2649
|
if (!base64url.test(data))
|
|
2650
2650
|
return false;
|
|
2651
|
-
const
|
|
2652
|
-
const padded =
|
|
2651
|
+
const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
2652
|
+
const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
|
|
2653
2653
|
return isValidBase64(padded);
|
|
2654
2654
|
}
|
|
2655
2655
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
@@ -3103,42 +3103,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3103
3103
|
}
|
|
3104
3104
|
doc.write(`const newResult = {};`);
|
|
3105
3105
|
for (const key of normalized.keys) {
|
|
3106
|
-
const
|
|
3106
|
+
const id2 = ids[key];
|
|
3107
3107
|
const k = esc(key);
|
|
3108
3108
|
const schema = shape[key];
|
|
3109
3109
|
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
3110
3110
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
3111
|
-
doc.write(`const ${
|
|
3111
|
+
doc.write(`const ${id2} = ${parseStr(key)};`);
|
|
3112
3112
|
if (isOptionalIn && isOptionalOut) {
|
|
3113
3113
|
doc.write(`
|
|
3114
|
-
if (${
|
|
3114
|
+
if (${id2}.issues.length) {
|
|
3115
3115
|
if (${k} in input) {
|
|
3116
|
-
payload.issues = payload.issues.concat(${
|
|
3116
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3117
3117
|
...iss,
|
|
3118
3118
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3119
3119
|
})));
|
|
3120
3120
|
}
|
|
3121
3121
|
}
|
|
3122
3122
|
|
|
3123
|
-
if (${
|
|
3123
|
+
if (${id2}.value === undefined) {
|
|
3124
3124
|
if (${k} in input) {
|
|
3125
3125
|
newResult[${k}] = undefined;
|
|
3126
3126
|
}
|
|
3127
3127
|
} else {
|
|
3128
|
-
newResult[${k}] = ${
|
|
3128
|
+
newResult[${k}] = ${id2}.value;
|
|
3129
3129
|
}
|
|
3130
3130
|
|
|
3131
3131
|
`);
|
|
3132
3132
|
} else if (!isOptionalIn) {
|
|
3133
3133
|
doc.write(`
|
|
3134
|
-
const ${
|
|
3135
|
-
if (${
|
|
3136
|
-
payload.issues = payload.issues.concat(${
|
|
3134
|
+
const ${id2}_present = ${k} in input;
|
|
3135
|
+
if (${id2}.issues.length) {
|
|
3136
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3137
3137
|
...iss,
|
|
3138
3138
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3139
3139
|
})));
|
|
3140
3140
|
}
|
|
3141
|
-
if (!${
|
|
3141
|
+
if (!${id2}_present && !${id2}.issues.length) {
|
|
3142
3142
|
payload.issues.push({
|
|
3143
3143
|
code: "invalid_type",
|
|
3144
3144
|
expected: "nonoptional",
|
|
@@ -3147,30 +3147,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3147
3147
|
});
|
|
3148
3148
|
}
|
|
3149
3149
|
|
|
3150
|
-
if (${
|
|
3151
|
-
if (${
|
|
3150
|
+
if (${id2}_present) {
|
|
3151
|
+
if (${id2}.value === undefined) {
|
|
3152
3152
|
newResult[${k}] = undefined;
|
|
3153
3153
|
} else {
|
|
3154
|
-
newResult[${k}] = ${
|
|
3154
|
+
newResult[${k}] = ${id2}.value;
|
|
3155
3155
|
}
|
|
3156
3156
|
}
|
|
3157
3157
|
|
|
3158
3158
|
`);
|
|
3159
3159
|
} else {
|
|
3160
3160
|
doc.write(`
|
|
3161
|
-
if (${
|
|
3162
|
-
payload.issues = payload.issues.concat(${
|
|
3161
|
+
if (${id2}.issues.length) {
|
|
3162
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3163
3163
|
...iss,
|
|
3164
3164
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3165
3165
|
})));
|
|
3166
3166
|
}
|
|
3167
3167
|
|
|
3168
|
-
if (${
|
|
3168
|
+
if (${id2}.value === undefined) {
|
|
3169
3169
|
if (${k} in input) {
|
|
3170
3170
|
newResult[${k}] = undefined;
|
|
3171
3171
|
}
|
|
3172
3172
|
} else {
|
|
3173
|
-
newResult[${k}] = ${
|
|
3173
|
+
newResult[${k}] = ${id2}.value;
|
|
3174
3174
|
}
|
|
3175
3175
|
|
|
3176
3176
|
`);
|
|
@@ -11502,26 +11502,26 @@ function extractDefs(ctx, schema) {
|
|
|
11502
11502
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
11503
11503
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
11504
11504
|
for (const entry of ctx.seen.entries()) {
|
|
11505
|
-
const
|
|
11506
|
-
if (
|
|
11507
|
-
const existing = idToSchema.get(
|
|
11505
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11506
|
+
if (id2) {
|
|
11507
|
+
const existing = idToSchema.get(id2);
|
|
11508
11508
|
if (existing && existing !== entry[0]) {
|
|
11509
|
-
throw new Error(`Duplicate schema id "${
|
|
11509
|
+
throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
11510
11510
|
}
|
|
11511
|
-
idToSchema.set(
|
|
11511
|
+
idToSchema.set(id2, entry[0]);
|
|
11512
11512
|
}
|
|
11513
11513
|
}
|
|
11514
11514
|
const makeURI = (entry) => {
|
|
11515
11515
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
11516
11516
|
if (ctx.external) {
|
|
11517
11517
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
11518
|
-
const uriGenerator = ctx.external.uri ?? ((
|
|
11518
|
+
const uriGenerator = ctx.external.uri ?? ((id3) => id3);
|
|
11519
11519
|
if (externalId) {
|
|
11520
11520
|
return { ref: uriGenerator(externalId) };
|
|
11521
11521
|
}
|
|
11522
|
-
const
|
|
11523
|
-
entry[1].defId =
|
|
11524
|
-
return { defId:
|
|
11522
|
+
const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
11523
|
+
entry[1].defId = id2;
|
|
11524
|
+
return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
|
|
11525
11525
|
}
|
|
11526
11526
|
if (entry[1] === root) {
|
|
11527
11527
|
return { ref: "#" };
|
|
@@ -11569,8 +11569,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11569
11569
|
continue;
|
|
11570
11570
|
}
|
|
11571
11571
|
}
|
|
11572
|
-
const
|
|
11573
|
-
if (
|
|
11572
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11573
|
+
if (id2) {
|
|
11574
11574
|
extractToDef(entry);
|
|
11575
11575
|
continue;
|
|
11576
11576
|
}
|
|
@@ -11666,10 +11666,10 @@ function finalize(ctx, schema) {
|
|
|
11666
11666
|
} else {
|
|
11667
11667
|
}
|
|
11668
11668
|
if (ctx.external?.uri) {
|
|
11669
|
-
const
|
|
11670
|
-
if (!
|
|
11669
|
+
const id2 = ctx.external.registry.get(schema)?.id;
|
|
11670
|
+
if (!id2)
|
|
11671
11671
|
throw new Error("Schema is missing an `id` property");
|
|
11672
|
-
result.$id = ctx.external.uri(
|
|
11672
|
+
result.$id = ctx.external.uri(id2);
|
|
11673
11673
|
}
|
|
11674
11674
|
Object.assign(result, root.def ?? root.schema);
|
|
11675
11675
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
@@ -11829,9 +11829,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
11829
11829
|
json2.type = "number";
|
|
11830
11830
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
11831
11831
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
11832
|
-
const
|
|
11832
|
+
const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
11833
11833
|
if (exMin) {
|
|
11834
|
-
if (
|
|
11834
|
+
if (legacy2) {
|
|
11835
11835
|
json2.minimum = exclusiveMinimum;
|
|
11836
11836
|
json2.exclusiveMinimum = true;
|
|
11837
11837
|
} else {
|
|
@@ -11841,7 +11841,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
11841
11841
|
json2.minimum = minimum;
|
|
11842
11842
|
}
|
|
11843
11843
|
if (exMax) {
|
|
11844
|
-
if (
|
|
11844
|
+
if (legacy2) {
|
|
11845
11845
|
json2.maximum = exclusiveMaximum;
|
|
11846
11846
|
json2.exclusiveMaximum = true;
|
|
11847
11847
|
} else {
|
|
@@ -12703,7 +12703,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
12703
12703
|
|
|
12704
12704
|
// ../../../node_modules/zod/v4/classic/schemas.js
|
|
12705
12705
|
var _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
12706
|
-
function _installLazyMethods(inst, group,
|
|
12706
|
+
function _installLazyMethods(inst, group, methods3) {
|
|
12707
12707
|
const proto = Object.getPrototypeOf(inst);
|
|
12708
12708
|
let installed = _installedGroups.get(proto);
|
|
12709
12709
|
if (!installed) {
|
|
@@ -12713,8 +12713,8 @@ function _installLazyMethods(inst, group, methods2) {
|
|
|
12713
12713
|
if (installed.has(group))
|
|
12714
12714
|
return;
|
|
12715
12715
|
installed.add(group);
|
|
12716
|
-
for (const key in
|
|
12717
|
-
const fn =
|
|
12716
|
+
for (const key in methods3) {
|
|
12717
|
+
const fn = methods3[key];
|
|
12718
12718
|
Object.defineProperty(proto, key, {
|
|
12719
12719
|
configurable: true,
|
|
12720
12720
|
enumerable: false,
|
|
@@ -14525,87 +14525,6 @@ function date4(params) {
|
|
|
14525
14525
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
14526
14526
|
config(en_default());
|
|
14527
14527
|
|
|
14528
|
-
// ../../shared-contracts/dist/ids.js
|
|
14529
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
14530
|
-
message: "Identifier must not be empty or whitespace"
|
|
14531
|
-
});
|
|
14532
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
14533
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
14534
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
14535
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
14536
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
14537
|
-
|
|
14538
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
14539
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
14540
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
14541
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
14542
|
-
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
14543
|
-
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
14544
|
-
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
14545
|
-
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");
|
|
14546
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
14547
|
-
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
14548
|
-
var harnessInstallationGuideSchema = external_exports.object({
|
|
14549
|
-
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
14550
|
-
before: localizedTextSchema.optional(),
|
|
14551
|
-
after: localizedTextSchema.optional(),
|
|
14552
|
-
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
14553
|
-
}).strict();
|
|
14554
|
-
var pluginPresentationShape = {
|
|
14555
|
-
id: installedHarnessPluginIdSchema,
|
|
14556
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
14557
|
-
version: external_exports.string().min(1).max(128),
|
|
14558
|
-
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
14559
|
-
kind: external_exports.literal("usage").optional(),
|
|
14560
|
-
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
14561
|
-
iconStyle: external_exports.object({
|
|
14562
|
-
vector: external_exports.object({
|
|
14563
|
-
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
14564
|
-
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
14565
|
-
paths: external_exports.array(external_exports.object({
|
|
14566
|
-
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
14567
|
-
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
14568
|
-
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
14569
|
-
}).strict()).min(1).max(32)
|
|
14570
|
-
}).strict().optional(),
|
|
14571
|
-
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
14572
|
-
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
14573
|
-
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
14574
|
-
}).strict().optional(),
|
|
14575
|
-
installation: harnessInstallationGuideSchema.optional(),
|
|
14576
|
-
notice: localizedTextSchema.optional(),
|
|
14577
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
14578
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
14579
|
-
links: external_exports.object({
|
|
14580
|
-
website: documentationUrlSchema.optional(),
|
|
14581
|
-
documentation: documentationUrlSchema.optional(),
|
|
14582
|
-
installation: documentationUrlSchema.optional()
|
|
14583
|
-
}).strict().optional()
|
|
14584
|
-
};
|
|
14585
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
14586
|
-
manifestVersion: external_exports.literal(1),
|
|
14587
|
-
...pluginPresentationShape,
|
|
14588
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
14589
|
-
entry: pluginRelativeResourceSchema,
|
|
14590
|
-
icon: pluginRelativeResourceSchema.optional()
|
|
14591
|
-
}).strict();
|
|
14592
|
-
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);
|
|
14593
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
14594
|
-
...pluginPresentationShape,
|
|
14595
|
-
icon: harnessPluginIconSchema.optional()
|
|
14596
|
-
}).strict();
|
|
14597
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
14598
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
14599
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
14600
|
-
}).strict();
|
|
14601
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
14602
|
-
version: external_exports.literal(1),
|
|
14603
|
-
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
14604
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
14605
|
-
message: "Enabled plugin IDs must be unique",
|
|
14606
|
-
path: ["enabled"]
|
|
14607
|
-
});
|
|
14608
|
-
|
|
14609
14528
|
// ../../shared-contracts/dist/json-value.js
|
|
14610
14529
|
function rejectExplicitUndefined(keys) {
|
|
14611
14530
|
return (value, context) => {
|
|
@@ -14665,403 +14584,73 @@ var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
|
|
|
14665
14584
|
var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
|
|
14666
14585
|
var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
|
|
14667
14586
|
|
|
14668
|
-
// ../../shared-contracts/dist/
|
|
14669
|
-
var
|
|
14670
|
-
|
|
14671
|
-
|
|
14672
|
-
|
|
14673
|
-
|
|
14674
|
-
|
|
14675
|
-
|
|
14676
|
-
|
|
14677
|
-
|
|
14678
|
-
|
|
14679
|
-
|
|
14680
|
-
var
|
|
14681
|
-
var
|
|
14682
|
-
var
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
|
|
14686
|
-
|
|
14687
|
-
|
|
14688
|
-
|
|
14689
|
-
var
|
|
14690
|
-
"
|
|
14691
|
-
|
|
14692
|
-
|
|
14693
|
-
|
|
14694
|
-
|
|
14695
|
-
|
|
14696
|
-
|
|
14697
|
-
|
|
14698
|
-
|
|
14699
|
-
|
|
14700
|
-
|
|
14701
|
-
|
|
14702
|
-
|
|
14703
|
-
|
|
14704
|
-
|
|
14705
|
-
|
|
14706
|
-
|
|
14707
|
-
|
|
14708
|
-
|
|
14587
|
+
// ../../shared-contracts/dist/errors.js
|
|
14588
|
+
var codexhostErrorSchema = external_exports.strictObject({
|
|
14589
|
+
code: external_exports.string().min(1),
|
|
14590
|
+
message: external_exports.string().min(1),
|
|
14591
|
+
retryable: external_exports.boolean(),
|
|
14592
|
+
diagnostic: external_exports.string().min(1).optional(),
|
|
14593
|
+
stage: external_exports.string().min(1).optional(),
|
|
14594
|
+
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
14595
|
+
stderrTail: external_exports.string().min(1).optional()
|
|
14596
|
+
}).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
|
|
14597
|
+
|
|
14598
|
+
// ../../shared-contracts/dist/harness-presentation.js
|
|
14599
|
+
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
14600
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
|
|
14601
|
+
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
14602
|
+
label: displayText(256).optional(),
|
|
14603
|
+
description: displayText(1024).optional()
|
|
14604
|
+
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
14605
|
+
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");
|
|
14606
|
+
|
|
14607
|
+
// ../../shared-contracts/dist/ids.js
|
|
14608
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
14609
|
+
message: "Identifier must not be empty or whitespace"
|
|
14610
|
+
});
|
|
14611
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
14612
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
14613
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
14614
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
14615
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
14616
|
+
|
|
14617
|
+
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
14618
|
+
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
14619
|
+
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
14620
|
+
var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
|
|
14621
|
+
var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
|
|
14622
|
+
var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
14623
|
+
message: "Value must not be empty or whitespace"
|
|
14624
|
+
});
|
|
14625
|
+
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();
|
|
14626
|
+
var harnessPermissionModeSchema = external_exports.object({
|
|
14627
|
+
id: harnessPermissionModeIdSchema,
|
|
14628
|
+
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
14629
|
+
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
14630
|
+
dangerous: external_exports.boolean().optional(),
|
|
14631
|
+
localizations: harnessLocalizationsSchema.optional()
|
|
14632
|
+
}).strict();
|
|
14633
|
+
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
14634
|
+
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
14635
|
+
defaultModeId: harnessPermissionModeIdSchema
|
|
14636
|
+
}).strict().superRefine((catalog, context) => {
|
|
14637
|
+
const ids = /* @__PURE__ */ new Set();
|
|
14638
|
+
for (const [index, mode] of catalog.modes.entries()) {
|
|
14639
|
+
if (ids.has(mode.id)) {
|
|
14640
|
+
context.addIssue({
|
|
14641
|
+
code: "custom",
|
|
14642
|
+
message: "Permission Mode IDs must be unique",
|
|
14643
|
+
path: ["modes", index, "id"]
|
|
14644
|
+
});
|
|
14645
|
+
}
|
|
14646
|
+
ids.add(mode.id);
|
|
14709
14647
|
}
|
|
14710
|
-
|
|
14711
|
-
|
|
14712
|
-
|
|
14713
|
-
|
|
14714
|
-
|
|
14715
|
-
|
|
14716
|
-
return "image/svg+xml";
|
|
14717
|
-
case "woff2":
|
|
14718
|
-
return "font/woff2";
|
|
14719
|
-
case "json":
|
|
14720
|
-
return "application/json";
|
|
14721
|
-
case "css":
|
|
14722
|
-
return "text/css";
|
|
14723
|
-
default:
|
|
14724
|
-
return desktopExtensionScreenshotMimeType(resource);
|
|
14725
|
-
}
|
|
14726
|
-
}
|
|
14727
|
-
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
14728
|
-
var desktopExtensionAssetPathSchema = pluginRelativeResourceSchema.refine((resource) => hasPortableSegments(resource) && desktopExtensionAssetMimeType(resource) !== void 0, "Expected a relative Desktop extension asset path with a supported suffix");
|
|
14729
|
-
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");
|
|
14730
|
-
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) => {
|
|
14731
|
-
const { username, password } = new URL(value);
|
|
14732
|
-
return !username && !password && !/[\\\s]/u.test(value);
|
|
14733
|
-
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
14734
|
-
function localizedText(text2) {
|
|
14735
|
-
return external_exports.strictObject({ en: text2, "zh-CN": text2 });
|
|
14736
|
-
}
|
|
14737
|
-
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
14738
|
-
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
14739
|
-
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
14740
|
-
var settingField = {
|
|
14741
|
-
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
14742
|
-
label: desktopExtensionLocalizedTextSchema,
|
|
14743
|
-
description: desktopExtensionLocalizedTextSchema.optional()
|
|
14744
|
-
};
|
|
14745
|
-
var numericSetting = {
|
|
14746
|
-
...settingField,
|
|
14747
|
-
step: external_exports.number().positive().optional(),
|
|
14748
|
-
default: external_exports.number().optional()
|
|
14749
|
-
};
|
|
14750
|
-
var settingOption = external_exports.strictObject({
|
|
14751
|
-
value: external_exports.string(),
|
|
14752
|
-
label: desktopExtensionLocalizedTextSchema
|
|
14753
|
-
});
|
|
14754
|
-
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
14755
|
-
external_exports.strictObject({
|
|
14756
|
-
...settingField,
|
|
14757
|
-
type: external_exports.literal("boolean"),
|
|
14758
|
-
default: external_exports.boolean().optional()
|
|
14759
|
-
}),
|
|
14760
|
-
external_exports.strictObject({
|
|
14761
|
-
...settingField,
|
|
14762
|
-
type: external_exports.literal("string"),
|
|
14763
|
-
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
14764
|
-
default: external_exports.string().optional()
|
|
14765
|
-
}),
|
|
14766
|
-
external_exports.strictObject({
|
|
14767
|
-
...numericSetting,
|
|
14768
|
-
type: external_exports.literal("number"),
|
|
14769
|
-
min: external_exports.number().optional(),
|
|
14770
|
-
max: external_exports.number().optional()
|
|
14771
|
-
}),
|
|
14772
|
-
external_exports.strictObject({
|
|
14773
|
-
...numericSetting,
|
|
14774
|
-
type: external_exports.literal("range"),
|
|
14775
|
-
min: external_exports.number(),
|
|
14776
|
-
max: external_exports.number()
|
|
14777
|
-
}),
|
|
14778
|
-
external_exports.strictObject({
|
|
14779
|
-
...settingField,
|
|
14780
|
-
type: external_exports.literal("select"),
|
|
14781
|
-
options: external_exports.array(settingOption).min(1),
|
|
14782
|
-
default: external_exports.string().optional()
|
|
14783
|
-
})
|
|
14784
|
-
]).superRefine((field2, ctx) => {
|
|
14785
|
-
const issue2 = (path12, message) => ctx.addIssue({ code: "custom", path: [path12], message });
|
|
14786
|
-
if (field2.type === "number" || field2.type === "range") {
|
|
14787
|
-
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
14788
|
-
if (min > max)
|
|
14789
|
-
issue2("max", "Must be at least min");
|
|
14790
|
-
if (value !== void 0 && (value < min || value > max))
|
|
14791
|
-
issue2("default", "Must be within min and max");
|
|
14792
|
-
} else if (field2.type === "select") {
|
|
14793
|
-
const values = new Set(field2.options.map(({ value }) => value));
|
|
14794
|
-
if (values.size !== field2.options.length)
|
|
14795
|
-
issue2("options", "Duplicate option values");
|
|
14796
|
-
if (field2.default !== void 0 && !values.has(field2.default))
|
|
14797
|
-
issue2("default", "Must match an option value");
|
|
14798
|
-
}
|
|
14799
|
-
});
|
|
14800
|
-
var manifestHeader = external_exports.object({
|
|
14801
|
-
manifestVersion: external_exports.int().positive(),
|
|
14802
|
-
id: desktopExtensionIdSchema,
|
|
14803
|
-
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
14804
|
-
version: external_exports.string().min(1).max(128),
|
|
14805
|
-
desktopApi: external_exports.int().positive()
|
|
14806
|
-
}).passthrough();
|
|
14807
|
-
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
14808
|
-
manifestVersion: external_exports.literal(1),
|
|
14809
|
-
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
14810
|
-
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
14811
|
-
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
14812
|
-
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
14813
|
-
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
14814
|
-
icon: imagePathSchema.optional(),
|
|
14815
|
-
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
14816
|
-
desktop: external_exports.strictObject({
|
|
14817
|
-
script: pluginRelativeResourceSchema,
|
|
14818
|
-
style: pluginRelativeResourceSchema.optional()
|
|
14819
|
-
}).optional(),
|
|
14820
|
-
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
14821
|
-
slots: slotsSchema.default(() => []),
|
|
14822
|
-
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
14823
|
-
categories: categoriesSchema.optional()
|
|
14824
|
-
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
14825
|
-
var desktopExtensionConfigurationSchema = external_exports.strictObject({
|
|
14826
|
-
version: external_exports.literal(1),
|
|
14827
|
-
revision: external_exports.int().nonnegative(),
|
|
14828
|
-
enabled: external_exports.array(desktopExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs"),
|
|
14829
|
-
reloadToken: external_exports.uuid().optional()
|
|
14830
|
-
});
|
|
14831
|
-
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
14832
|
-
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
14833
|
-
state: external_exports.enum([
|
|
14834
|
-
"running",
|
|
14835
|
-
"disabled",
|
|
14836
|
-
"invalid",
|
|
14837
|
-
"incompatible",
|
|
14838
|
-
"conflict",
|
|
14839
|
-
"failed",
|
|
14840
|
-
"waiting"
|
|
14841
|
-
]),
|
|
14842
|
-
hash: desktopExtensionHashSchema.optional(),
|
|
14843
|
-
error: external_exports.string().optional(),
|
|
14844
|
-
conflictWith: desktopExtensionIdSchema.optional()
|
|
14845
|
-
});
|
|
14846
|
-
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
14847
|
-
controllerPid: external_exports.int().positive(),
|
|
14848
|
-
targetId: external_exports.string().nullable(),
|
|
14849
|
-
updatedAt: external_exports.iso.datetime(),
|
|
14850
|
-
handledReloadToken: external_exports.uuid().optional(),
|
|
14851
|
-
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema)
|
|
14852
|
-
});
|
|
14853
|
-
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
14854
|
-
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
14855
|
-
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
14856
|
-
}
|
|
14857
|
-
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
14858
|
-
const url2 = new URL(input);
|
|
14859
|
-
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);
|
|
14860
|
-
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
14861
|
-
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
14862
|
-
id: desktopExtensionIdSchema,
|
|
14863
|
-
version: external_exports.string().trim().min(1).max(128),
|
|
14864
|
-
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
14865
|
-
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
14866
|
-
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
14867
|
-
author: external_exports.string().trim().min(1).max(128),
|
|
14868
|
-
repository: desktopExtensionHttpUrlSchema,
|
|
14869
|
-
stars: external_exports.number().int().min(0).optional(),
|
|
14870
|
-
downloads: external_exports.number().int().min(0).optional(),
|
|
14871
|
-
categories: categoriesSchema.optional(),
|
|
14872
|
-
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
14873
|
-
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
14874
|
-
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
14875
|
-
downloadUrl: desktopExtensionZipUrlSchema,
|
|
14876
|
-
sha256: desktopExtensionHashSchema,
|
|
14877
|
-
slots: slotsSchema.optional(),
|
|
14878
|
-
publishedAt: external_exports.string().optional(),
|
|
14879
|
-
updatedAt: external_exports.string().optional(),
|
|
14880
|
-
minCodexHostVersion: external_exports.string().optional()
|
|
14881
|
-
});
|
|
14882
|
-
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
14883
|
-
schemaVersion: external_exports.literal(1),
|
|
14884
|
-
generatedAt: external_exports.string(),
|
|
14885
|
-
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, "Duplicate extension IDs")
|
|
14886
|
-
});
|
|
14887
|
-
var DESKTOP_EXTENSIONS_ASSET_METHOD = "codexhost/desktop/extensions/asset";
|
|
14888
|
-
var DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD = "codexhost/desktop/extensions/settings/get";
|
|
14889
|
-
var DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD = "codexhost/desktop/extensions/settings/set";
|
|
14890
|
-
var DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD = "codexhost/desktop/extensions/backend/invoke";
|
|
14891
|
-
var extensionIdParams = { id: desktopExtensionIdSchema };
|
|
14892
|
-
var desktopExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
14893
|
-
...extensionIdParams,
|
|
14894
|
-
path: desktopExtensionAssetPathSchema
|
|
14895
|
-
});
|
|
14896
|
-
var desktopExtensionsAssetResultSchema = external_exports.strictObject({
|
|
14897
|
-
mimeType: external_exports.string(),
|
|
14898
|
-
dataUrl: external_exports.string()
|
|
14899
|
-
});
|
|
14900
|
-
var desktopExtensionsSettingsGetParamsSchema = external_exports.strictObject(extensionIdParams);
|
|
14901
|
-
var desktopExtensionsSettingsSetParamsSchema = external_exports.strictObject({
|
|
14902
|
-
...extensionIdParams,
|
|
14903
|
-
values: jsonObjectSchema
|
|
14904
|
-
});
|
|
14905
|
-
var desktopExtensionsSettingsResultSchema = external_exports.strictObject({ values: jsonObjectSchema });
|
|
14906
|
-
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
14907
|
-
var desktopExtensionsBackendInvokeParamsSchema = external_exports.strictObject({
|
|
14908
|
-
...extensionIdParams,
|
|
14909
|
-
method: desktopExtensionBackendMethodSchema,
|
|
14910
|
-
params: jsonValueSchema.optional()
|
|
14911
|
-
});
|
|
14912
|
-
var desktopExtensionsBackendInvokeResultSchema = external_exports.strictObject({
|
|
14913
|
-
result: jsonValueSchema
|
|
14914
|
-
});
|
|
14915
|
-
|
|
14916
|
-
// ../../shared-contracts/dist/desktop-extension-management.js
|
|
14917
|
-
var DESKTOP_EXTENSIONS_LIST_METHOD = "codexhost/desktop/extensions/list";
|
|
14918
|
-
var DESKTOP_EXTENSIONS_ENABLE_METHOD = "codexhost/desktop/extensions/enable";
|
|
14919
|
-
var DESKTOP_EXTENSIONS_DISABLE_METHOD = "codexhost/desktop/extensions/disable";
|
|
14920
|
-
var DESKTOP_EXTENSIONS_CATALOG_METHOD = "codexhost/desktop/extensions/catalog";
|
|
14921
|
-
var DESKTOP_EXTENSIONS_INSTALL_METHOD = "codexhost/desktop/extensions/install";
|
|
14922
|
-
var DESKTOP_EXTENSIONS_UNINSTALL_METHOD = "codexhost/desktop/extensions/uninstall";
|
|
14923
|
-
var DESKTOP_EXTENSIONS_RECOVER_METHOD = "codexhost/desktop/extensions/disable-all-and-reload";
|
|
14924
|
-
var DESKTOP_EXTENSION_MANAGEMENT_METHODS = [
|
|
14925
|
-
DESKTOP_EXTENSIONS_LIST_METHOD,
|
|
14926
|
-
DESKTOP_EXTENSIONS_ENABLE_METHOD,
|
|
14927
|
-
DESKTOP_EXTENSIONS_DISABLE_METHOD,
|
|
14928
|
-
DESKTOP_EXTENSIONS_RECOVER_METHOD,
|
|
14929
|
-
DESKTOP_EXTENSIONS_CATALOG_METHOD,
|
|
14930
|
-
DESKTOP_EXTENSIONS_INSTALL_METHOD,
|
|
14931
|
-
DESKTOP_EXTENSIONS_UNINSTALL_METHOD,
|
|
14932
|
-
DESKTOP_EXTENSIONS_ASSET_METHOD,
|
|
14933
|
-
DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD,
|
|
14934
|
-
DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD,
|
|
14935
|
-
DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD
|
|
14936
|
-
];
|
|
14937
|
-
var revisionSchema = external_exports.int().nonnegative();
|
|
14938
|
-
var desktopExtensionsListParamsSchema = external_exports.strictObject({});
|
|
14939
|
-
var desktopExtensionSelectionParamsSchema = external_exports.strictObject({
|
|
14940
|
-
id: desktopExtensionIdSchema,
|
|
14941
|
-
expectedRevision: revisionSchema
|
|
14942
|
-
});
|
|
14943
|
-
var desktopExtensionsRecoveryParamsSchema = external_exports.strictObject({
|
|
14944
|
-
expectedRevision: revisionSchema.optional()
|
|
14945
|
-
});
|
|
14946
|
-
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);
|
|
14947
|
-
var desktopExtensionListItemSchema = external_exports.strictObject({
|
|
14948
|
-
// An invalid discovery can have a directory name that isn't a valid extension ID.
|
|
14949
|
-
id: external_exports.string().min(1),
|
|
14950
|
-
manifest: desktopExtensionManifestSchema.optional(),
|
|
14951
|
-
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
14952
|
-
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
14953
|
-
enabled: external_exports.boolean(),
|
|
14954
|
-
status: desktopExtensionStatusSchema
|
|
14955
|
-
});
|
|
14956
|
-
var desktopExtensionsListResultSchema = external_exports.strictObject({
|
|
14957
|
-
configuration: desktopExtensionConfigurationSchema,
|
|
14958
|
-
desktopConnected: external_exports.boolean(),
|
|
14959
|
-
diagnostics: external_exports.array(external_exports.string()),
|
|
14960
|
-
extensions: external_exports.array(desktopExtensionListItemSchema)
|
|
14961
|
-
});
|
|
14962
|
-
var desktopExtensionsCatalogParamsSchema = external_exports.strictObject({
|
|
14963
|
-
forceRefresh: external_exports.boolean().optional()
|
|
14964
|
-
});
|
|
14965
|
-
var desktopExtensionsCatalogResultSchema = external_exports.strictObject({
|
|
14966
|
-
catalogUrl: external_exports.string(),
|
|
14967
|
-
source: external_exports.enum(["remote", "fallback"]),
|
|
14968
|
-
fetchedAt: external_exports.string(),
|
|
14969
|
-
cached: external_exports.boolean(),
|
|
14970
|
-
extensions: desktopExtensionCatalogSchema.shape.extensions,
|
|
14971
|
-
error: external_exports.string().optional()
|
|
14972
|
-
});
|
|
14973
|
-
var desktopExtensionsInstallParamsSchema = external_exports.strictObject({
|
|
14974
|
-
source: external_exports.discriminatedUnion("type", [
|
|
14975
|
-
external_exports.strictObject({ type: external_exports.literal("catalog"), id: desktopExtensionIdSchema }),
|
|
14976
|
-
external_exports.strictObject({
|
|
14977
|
-
type: external_exports.literal("url"),
|
|
14978
|
-
url: desktopExtensionHttpUrlSchema,
|
|
14979
|
-
expectedSha256: desktopExtensionHashSchema.optional()
|
|
14980
|
-
}),
|
|
14981
|
-
external_exports.strictObject({
|
|
14982
|
-
type: external_exports.literal("zip-base64"),
|
|
14983
|
-
fileName: external_exports.string().trim().min(1).max(255),
|
|
14984
|
-
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")
|
|
14985
|
-
})
|
|
14986
|
-
])
|
|
14987
|
-
});
|
|
14988
|
-
var desktopExtensionsInstallResultSchema = external_exports.strictObject({
|
|
14989
|
-
extensionId: desktopExtensionIdSchema,
|
|
14990
|
-
version: external_exports.string().min(1),
|
|
14991
|
-
replaced: external_exports.boolean(),
|
|
14992
|
-
installedPath: external_exports.string(),
|
|
14993
|
-
list: desktopExtensionsListResultSchema
|
|
14994
|
-
});
|
|
14995
|
-
var desktopExtensionsUninstallParamsSchema = external_exports.strictObject({
|
|
14996
|
-
id: desktopExtensionIdSchema
|
|
14997
|
-
});
|
|
14998
|
-
var desktopExtensionsUninstallResultSchema = external_exports.strictObject({
|
|
14999
|
-
removedId: desktopExtensionIdSchema,
|
|
15000
|
-
list: desktopExtensionsListResultSchema
|
|
15001
|
-
});
|
|
15002
|
-
var desktopExtensionMutationResultSchema = external_exports.discriminatedUnion("state", [
|
|
15003
|
-
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: desktopExtensionConfigurationSchema }),
|
|
15004
|
-
external_exports.strictObject({ state: external_exports.literal("slot-conflict"), conflictWith: desktopExtensionIdSchema }),
|
|
15005
|
-
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: revisionSchema })
|
|
15006
|
-
]);
|
|
15007
|
-
|
|
15008
|
-
// ../../shared-contracts/dist/errors.js
|
|
15009
|
-
var codexhostErrorSchema = external_exports.strictObject({
|
|
15010
|
-
code: external_exports.string().min(1),
|
|
15011
|
-
message: external_exports.string().min(1),
|
|
15012
|
-
retryable: external_exports.boolean(),
|
|
15013
|
-
diagnostic: external_exports.string().min(1).optional(),
|
|
15014
|
-
stage: external_exports.string().min(1).optional(),
|
|
15015
|
-
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
15016
|
-
stderrTail: external_exports.string().min(1).optional()
|
|
15017
|
-
}).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
|
|
15018
|
-
|
|
15019
|
-
// ../../shared-contracts/dist/harness-presentation.js
|
|
15020
|
-
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
15021
|
-
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
|
|
15022
|
-
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
15023
|
-
label: displayText(256).optional(),
|
|
15024
|
-
description: displayText(1024).optional()
|
|
15025
|
-
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15026
|
-
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");
|
|
15027
|
-
|
|
15028
|
-
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
15029
|
-
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
15030
|
-
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
15031
|
-
var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
|
|
15032
|
-
var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
|
|
15033
|
-
var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15034
|
-
message: "Value must not be empty or whitespace"
|
|
15035
|
-
});
|
|
15036
|
-
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();
|
|
15037
|
-
var harnessPermissionModeSchema = external_exports.object({
|
|
15038
|
-
id: harnessPermissionModeIdSchema,
|
|
15039
|
-
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
15040
|
-
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
15041
|
-
dangerous: external_exports.boolean().optional(),
|
|
15042
|
-
localizations: harnessLocalizationsSchema.optional()
|
|
15043
|
-
}).strict();
|
|
15044
|
-
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
15045
|
-
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
15046
|
-
defaultModeId: harnessPermissionModeIdSchema
|
|
15047
|
-
}).strict().superRefine((catalog, context) => {
|
|
15048
|
-
const ids = /* @__PURE__ */ new Set();
|
|
15049
|
-
for (const [index, mode] of catalog.modes.entries()) {
|
|
15050
|
-
if (ids.has(mode.id)) {
|
|
15051
|
-
context.addIssue({
|
|
15052
|
-
code: "custom",
|
|
15053
|
-
message: "Permission Mode IDs must be unique",
|
|
15054
|
-
path: ["modes", index, "id"]
|
|
15055
|
-
});
|
|
15056
|
-
}
|
|
15057
|
-
ids.add(mode.id);
|
|
15058
|
-
}
|
|
15059
|
-
if (!ids.has(catalog.defaultModeId)) {
|
|
15060
|
-
context.addIssue({
|
|
15061
|
-
code: "custom",
|
|
15062
|
-
message: "Default Permission Mode must exist in the catalog",
|
|
15063
|
-
path: ["defaultModeId"]
|
|
15064
|
-
});
|
|
14648
|
+
if (!ids.has(catalog.defaultModeId)) {
|
|
14649
|
+
context.addIssue({
|
|
14650
|
+
code: "custom",
|
|
14651
|
+
message: "Default Permission Mode must exist in the catalog",
|
|
14652
|
+
path: ["defaultModeId"]
|
|
14653
|
+
});
|
|
15065
14654
|
}
|
|
15066
14655
|
});
|
|
15067
14656
|
var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
@@ -15069,6 +14658,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
|
15069
14658
|
permissionModeId: harnessPermissionModeIdSchema
|
|
15070
14659
|
}).strict();
|
|
15071
14660
|
|
|
14661
|
+
// ../../shared-contracts/dist/harness-route-limit.js
|
|
14662
|
+
var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
|
|
14663
|
+
|
|
15072
14664
|
// ../../shared-contracts/dist/thread-usage.js
|
|
15073
14665
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15074
14666
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -15101,7 +14693,7 @@ var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
|
15101
14693
|
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
15102
14694
|
label: indicatorTextSchema(256).optional(),
|
|
15103
14695
|
tooltip: indicatorTextSchema(1024).optional()
|
|
15104
|
-
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) =>
|
|
14696
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
|
|
15105
14697
|
message: "Composer indicator IDs must be unique"
|
|
15106
14698
|
});
|
|
15107
14699
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
@@ -15127,6 +14719,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
15127
14719
|
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
15128
14720
|
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
15129
14721
|
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
14722
|
+
latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15130
14723
|
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
15131
14724
|
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
15132
14725
|
}).strict().superRefine((usage, context) => {
|
|
@@ -15254,10 +14847,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
|
15254
14847
|
var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15255
14848
|
message: "Value must not be empty or whitespace"
|
|
15256
14849
|
});
|
|
15257
|
-
var harnessModelRefIdSchema =
|
|
14850
|
+
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();
|
|
14851
|
+
var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
|
|
15258
14852
|
var harnessModelRefSchema = external_exports.object({
|
|
15259
|
-
id: harnessModelRefIdSchema
|
|
14853
|
+
id: harnessModelRefIdSchema,
|
|
14854
|
+
serviceTier: harnessModelServiceTierSchema.optional()
|
|
15260
14855
|
}).strict();
|
|
14856
|
+
function sameHarnessModelRef(left, right) {
|
|
14857
|
+
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
14858
|
+
}
|
|
15261
14859
|
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();
|
|
15262
14860
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
15263
14861
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
@@ -15271,7 +14869,15 @@ var harnessModelSchema = external_exports.object({
|
|
|
15271
14869
|
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
15272
14870
|
fastModel: harnessModelRefSchema.optional(),
|
|
15273
14871
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
15274
|
-
}).strict()
|
|
14872
|
+
}).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
|
|
14873
|
+
path: ["fastModel", "id"],
|
|
14874
|
+
message: "A tiered Fast Model must share the base Model ID"
|
|
14875
|
+
});
|
|
14876
|
+
function catalogModelForRef(catalog, ref) {
|
|
14877
|
+
if (!ref)
|
|
14878
|
+
return void 0;
|
|
14879
|
+
return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
|
|
14880
|
+
}
|
|
15275
14881
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
15276
14882
|
const ids = /* @__PURE__ */ new Set();
|
|
15277
14883
|
for (const [index, option] of options.entries()) {
|
|
@@ -15291,26 +14897,26 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15291
14897
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
15292
14898
|
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
15293
14899
|
}).strict().superRefine((catalog, context) => {
|
|
15294
|
-
const refs =
|
|
15295
|
-
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) =>
|
|
14900
|
+
const refs = [];
|
|
14901
|
+
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
|
|
15296
14902
|
for (const [index, model2] of catalog.models.entries()) {
|
|
15297
|
-
if (refs.
|
|
14903
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
|
|
15298
14904
|
context.addIssue({
|
|
15299
14905
|
code: "custom",
|
|
15300
14906
|
message: "Model Catalog refs must be unique",
|
|
15301
14907
|
path: ["models", index, "ref", "id"]
|
|
15302
14908
|
});
|
|
15303
14909
|
}
|
|
15304
|
-
refs.
|
|
14910
|
+
refs.push(model2.ref);
|
|
15305
14911
|
if (model2.fastModel) {
|
|
15306
|
-
if (refs.
|
|
14912
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
|
|
15307
14913
|
context.addIssue({
|
|
15308
14914
|
code: "custom",
|
|
15309
14915
|
message: "Fast Model refs must be distinct and unique",
|
|
15310
14916
|
path: ["models", index, "fastModel"]
|
|
15311
14917
|
});
|
|
15312
14918
|
}
|
|
15313
|
-
refs.
|
|
14919
|
+
refs.push(model2.fastModel);
|
|
15314
14920
|
}
|
|
15315
14921
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
15316
14922
|
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
@@ -15331,7 +14937,7 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15331
14937
|
}
|
|
15332
14938
|
}
|
|
15333
14939
|
}
|
|
15334
|
-
if (catalog.defaultModel && !
|
|
14940
|
+
if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
|
|
15335
14941
|
context.addIssue({
|
|
15336
14942
|
code: "custom",
|
|
15337
14943
|
message: "Default Model must exist in the Model Catalog",
|
|
@@ -15371,7 +14977,12 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
15371
14977
|
observe: external_exports.boolean()
|
|
15372
14978
|
}).strict().optional(),
|
|
15373
14979
|
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15374
|
-
steer: external_exports.boolean().optional()
|
|
14980
|
+
steer: external_exports.boolean().optional(),
|
|
14981
|
+
/**
|
|
14982
|
+
* True when the native plan (task list) outlives the Turn that changed it, so a reopened
|
|
14983
|
+
* Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
|
|
14984
|
+
*/
|
|
14985
|
+
persistentPlan: external_exports.boolean().optional()
|
|
15375
14986
|
}).strict();
|
|
15376
14987
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
15377
14988
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -15380,7 +14991,7 @@ var harnessConfigurationStateSchema = external_exports.object({
|
|
|
15380
14991
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15381
14992
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
15382
14993
|
}).strict().superRefine((state, context) => {
|
|
15383
|
-
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) =>
|
|
14994
|
+
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
|
|
15384
14995
|
context.addIssue({
|
|
15385
14996
|
code: "custom",
|
|
15386
14997
|
message: "Effective Thinking option must be currently available",
|
|
@@ -15407,131 +15018,677 @@ var readyHarnessInspectionSchema = external_exports.object({
|
|
|
15407
15018
|
});
|
|
15408
15019
|
}
|
|
15409
15020
|
});
|
|
15410
|
-
var failedHarnessInspectionSchema = external_exports.object({
|
|
15411
|
-
status: external_exports.enum(["notInstalled", "unavailable", "error"]),
|
|
15412
|
-
error: codexhostErrorSchema
|
|
15413
|
-
}).strict();
|
|
15414
|
-
var harnessInspectionSchema = external_exports.union([
|
|
15415
|
-
readyHarnessInspectionSchema,
|
|
15416
|
-
failedHarnessInspectionSchema
|
|
15021
|
+
var failedHarnessInspectionSchema = external_exports.object({
|
|
15022
|
+
status: external_exports.enum(["notInstalled", "unavailable", "error"]),
|
|
15023
|
+
error: codexhostErrorSchema
|
|
15024
|
+
}).strict();
|
|
15025
|
+
var harnessInspectionSchema = external_exports.union([
|
|
15026
|
+
readyHarnessInspectionSchema,
|
|
15027
|
+
failedHarnessInspectionSchema
|
|
15028
|
+
]);
|
|
15029
|
+
var harnessInspectParamsSchema = external_exports.object({
|
|
15030
|
+
harnessId: harnessIdSchema,
|
|
15031
|
+
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
15032
|
+
refresh: external_exports.boolean().optional(),
|
|
15033
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
15034
|
+
purpose: external_exports.literal("availability").optional(),
|
|
15035
|
+
credentialAccess: external_exports.enum(["allow", "retry"]).optional()
|
|
15036
|
+
}).strict();
|
|
15037
|
+
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15038
|
+
harnessId: harnessIdSchema
|
|
15039
|
+
}).strict();
|
|
15040
|
+
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
15041
|
+
var threadModelSelectParamsSchema = external_exports.object({
|
|
15042
|
+
threadId: hostThreadIdSchema,
|
|
15043
|
+
model: harnessModelRefSchema
|
|
15044
|
+
}).strict();
|
|
15045
|
+
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
15046
|
+
threadId: hostThreadIdSchema,
|
|
15047
|
+
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15048
|
+
}).strict();
|
|
15049
|
+
var threadInspectionParamsSchema = external_exports.object({
|
|
15050
|
+
threadId: hostThreadIdSchema,
|
|
15051
|
+
includeReferenceCapability: external_exports.boolean().optional()
|
|
15052
|
+
}).strict();
|
|
15053
|
+
var codexThreadInspectionSchema = external_exports.object({
|
|
15054
|
+
owner: external_exports.literal("codex"),
|
|
15055
|
+
locked: external_exports.boolean(),
|
|
15056
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
15057
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15058
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15059
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15060
|
+
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
15061
|
+
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15062
|
+
}).strict();
|
|
15063
|
+
var externalThreadInspectionSchema = external_exports.object({
|
|
15064
|
+
owner: external_exports.literal("external"),
|
|
15065
|
+
harnessId: nonBlankTextSchema2.max(256),
|
|
15066
|
+
transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
|
|
15067
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
15068
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15069
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15070
|
+
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15071
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15072
|
+
history: harnessHistoryCapabilitiesSchema,
|
|
15073
|
+
usage: threadUsageSnapshotSchema.optional(),
|
|
15074
|
+
locked: external_exports.literal(true)
|
|
15075
|
+
}).strict();
|
|
15076
|
+
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
15077
|
+
codexThreadInspectionSchema,
|
|
15078
|
+
externalThreadInspectionSchema
|
|
15079
|
+
]);
|
|
15080
|
+
var threadOwnershipListParamsSchema = external_exports.object({
|
|
15081
|
+
threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15082
|
+
}).strict().superRefine(({ threadIds }, context) => {
|
|
15083
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15084
|
+
for (const [index, threadId] of threadIds.entries()) {
|
|
15085
|
+
if (seen.has(threadId)) {
|
|
15086
|
+
context.addIssue({
|
|
15087
|
+
code: "custom",
|
|
15088
|
+
message: "Thread ownership-list IDs must be unique",
|
|
15089
|
+
path: ["threadIds", index]
|
|
15090
|
+
});
|
|
15091
|
+
}
|
|
15092
|
+
seen.add(threadId);
|
|
15093
|
+
}
|
|
15094
|
+
});
|
|
15095
|
+
var codexThreadOwnershipSchema = external_exports.object({
|
|
15096
|
+
threadId: hostThreadIdSchema,
|
|
15097
|
+
owner: external_exports.literal("codex")
|
|
15098
|
+
}).strict();
|
|
15099
|
+
var externalThreadOwnershipSchema = external_exports.object({
|
|
15100
|
+
threadId: hostThreadIdSchema,
|
|
15101
|
+
owner: external_exports.literal("external"),
|
|
15102
|
+
harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
|
|
15103
|
+
}).strict();
|
|
15104
|
+
var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
|
|
15105
|
+
codexThreadOwnershipSchema,
|
|
15106
|
+
externalThreadOwnershipSchema
|
|
15107
|
+
]);
|
|
15108
|
+
var threadOwnershipListResultSchema = external_exports.object({
|
|
15109
|
+
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15110
|
+
}).strict().superRefine(({ threads }, context) => {
|
|
15111
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15112
|
+
for (const [index, thread2] of threads.entries()) {
|
|
15113
|
+
if (seen.has(thread2.threadId)) {
|
|
15114
|
+
context.addIssue({
|
|
15115
|
+
code: "custom",
|
|
15116
|
+
message: "Thread ownership-list results must be unique",
|
|
15117
|
+
path: ["threads", index, "threadId"]
|
|
15118
|
+
});
|
|
15119
|
+
}
|
|
15120
|
+
seen.add(thread2.threadId);
|
|
15121
|
+
}
|
|
15122
|
+
});
|
|
15123
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
15124
|
+
threadId: hostThreadIdSchema,
|
|
15125
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15126
|
+
text: external_exports.string().optional()
|
|
15127
|
+
}).strict();
|
|
15128
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15129
|
+
kind: external_exports.literal("application"),
|
|
15130
|
+
value: external_exports.string().transform((text2, context) => {
|
|
15131
|
+
try {
|
|
15132
|
+
return JSON.parse(text2);
|
|
15133
|
+
} catch {
|
|
15134
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15135
|
+
return external_exports.NEVER;
|
|
15136
|
+
}
|
|
15137
|
+
}).pipe(external_exports.object({
|
|
15138
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15139
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15140
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15141
|
+
}).strict())
|
|
15142
|
+
}).strict().transform((context) => context.value);
|
|
15143
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15144
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15145
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15146
|
+
}).strict();
|
|
15147
|
+
|
|
15148
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
15149
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15150
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
15151
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
15152
|
+
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
15153
|
+
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
15154
|
+
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
|
|
15155
|
+
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");
|
|
15156
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
15157
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
15158
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
15159
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
15160
|
+
before: localizedTextSchema.optional(),
|
|
15161
|
+
after: localizedTextSchema.optional(),
|
|
15162
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
15163
|
+
}).strict();
|
|
15164
|
+
var pluginPresentationShape = {
|
|
15165
|
+
id: installedHarnessPluginIdSchema,
|
|
15166
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
15167
|
+
version: external_exports.string().min(1).max(128),
|
|
15168
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
15169
|
+
kind: external_exports.literal("usage").optional(),
|
|
15170
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
15171
|
+
iconStyle: external_exports.object({
|
|
15172
|
+
vector: external_exports.object({
|
|
15173
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
15174
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
15175
|
+
paths: external_exports.array(external_exports.object({
|
|
15176
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
15177
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
15178
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
15179
|
+
}).strict()).min(1).max(32)
|
|
15180
|
+
}).strict().optional(),
|
|
15181
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
15182
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
15183
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
15184
|
+
}).strict().optional(),
|
|
15185
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
15186
|
+
notice: localizedTextSchema.optional(),
|
|
15187
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
15188
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
15189
|
+
links: external_exports.object({
|
|
15190
|
+
website: documentationUrlSchema.optional(),
|
|
15191
|
+
documentation: documentationUrlSchema.optional(),
|
|
15192
|
+
installation: documentationUrlSchema.optional()
|
|
15193
|
+
}).strict().optional()
|
|
15194
|
+
};
|
|
15195
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
15196
|
+
manifestVersion: external_exports.literal(1),
|
|
15197
|
+
...pluginPresentationShape,
|
|
15198
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
15199
|
+
entry: pluginRelativeResourceSchema,
|
|
15200
|
+
icon: pluginRelativeResourceSchema.optional()
|
|
15201
|
+
}).strict();
|
|
15202
|
+
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);
|
|
15203
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
15204
|
+
...pluginPresentationShape,
|
|
15205
|
+
icon: harnessPluginIconSchema.optional()
|
|
15206
|
+
}).strict();
|
|
15207
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
15208
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
15209
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
15210
|
+
}).strict();
|
|
15211
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
15212
|
+
version: external_exports.literal(1),
|
|
15213
|
+
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15214
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
15215
|
+
message: "Enabled plugin IDs must be unique",
|
|
15216
|
+
path: ["enabled"]
|
|
15217
|
+
});
|
|
15218
|
+
|
|
15219
|
+
// ../../shared-contracts/dist/desktop-extensions.js
|
|
15220
|
+
var DESKTOP_EXTENSION_API_VERSION = 1;
|
|
15221
|
+
var DESKTOP_EXTENSION_LIMIT = 64;
|
|
15222
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
|
|
15223
|
+
var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
|
|
15224
|
+
var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
|
|
15225
|
+
var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
|
|
15226
|
+
var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
|
|
15227
|
+
var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
|
|
15228
|
+
var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
|
|
15229
|
+
var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
|
|
15230
|
+
var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
15231
|
+
var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
|
|
15232
|
+
var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
|
|
15233
|
+
var desktopExtensionIdSchema = installedPluginIdSchema;
|
|
15234
|
+
var desktopExtensionSlotSchema = external_exports.enum([
|
|
15235
|
+
"sidebar.thread-layout",
|
|
15236
|
+
"sidebar.thread-badge",
|
|
15237
|
+
"appearance.theme"
|
|
15238
|
+
]);
|
|
15239
|
+
var desktopExtensionCategorySchema = external_exports.enum([
|
|
15240
|
+
"appearance",
|
|
15241
|
+
"interface",
|
|
15242
|
+
"workflow",
|
|
15243
|
+
"analytics",
|
|
15244
|
+
"integrations",
|
|
15245
|
+
"tools"
|
|
15246
|
+
]);
|
|
15247
|
+
var extensionName = external_exports.string().trim().min(1).max(128);
|
|
15248
|
+
function desktopExtensionScreenshotMimeType(resource) {
|
|
15249
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
15250
|
+
case "png":
|
|
15251
|
+
return "image/png";
|
|
15252
|
+
case "jpg":
|
|
15253
|
+
case "jpeg":
|
|
15254
|
+
return "image/jpeg";
|
|
15255
|
+
case "webp":
|
|
15256
|
+
return "image/webp";
|
|
15257
|
+
default:
|
|
15258
|
+
return void 0;
|
|
15259
|
+
}
|
|
15260
|
+
}
|
|
15261
|
+
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
15262
|
+
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");
|
|
15263
|
+
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) => {
|
|
15264
|
+
const { username, password } = new URL(value);
|
|
15265
|
+
return !username && !password && !/[\\\s]/u.test(value);
|
|
15266
|
+
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15267
|
+
function localizedText(text2) {
|
|
15268
|
+
return external_exports.strictObject({ en: text2, "zh-CN": text2 });
|
|
15269
|
+
}
|
|
15270
|
+
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15271
|
+
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
15272
|
+
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
15273
|
+
var settingField = {
|
|
15274
|
+
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
15275
|
+
label: desktopExtensionLocalizedTextSchema,
|
|
15276
|
+
description: desktopExtensionLocalizedTextSchema.optional()
|
|
15277
|
+
};
|
|
15278
|
+
var numericSetting = {
|
|
15279
|
+
...settingField,
|
|
15280
|
+
step: external_exports.number().positive().optional(),
|
|
15281
|
+
default: external_exports.number().optional()
|
|
15282
|
+
};
|
|
15283
|
+
var settingOption = external_exports.strictObject({
|
|
15284
|
+
value: external_exports.string(),
|
|
15285
|
+
label: desktopExtensionLocalizedTextSchema
|
|
15286
|
+
});
|
|
15287
|
+
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
15288
|
+
external_exports.strictObject({
|
|
15289
|
+
...settingField,
|
|
15290
|
+
type: external_exports.literal("boolean"),
|
|
15291
|
+
default: external_exports.boolean().optional()
|
|
15292
|
+
}),
|
|
15293
|
+
external_exports.strictObject({
|
|
15294
|
+
...settingField,
|
|
15295
|
+
type: external_exports.literal("string"),
|
|
15296
|
+
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
15297
|
+
default: external_exports.string().optional()
|
|
15298
|
+
}),
|
|
15299
|
+
external_exports.strictObject({
|
|
15300
|
+
...numericSetting,
|
|
15301
|
+
type: external_exports.literal("number"),
|
|
15302
|
+
min: external_exports.number().optional(),
|
|
15303
|
+
max: external_exports.number().optional()
|
|
15304
|
+
}),
|
|
15305
|
+
external_exports.strictObject({
|
|
15306
|
+
...numericSetting,
|
|
15307
|
+
type: external_exports.literal("range"),
|
|
15308
|
+
min: external_exports.number(),
|
|
15309
|
+
max: external_exports.number()
|
|
15310
|
+
}),
|
|
15311
|
+
external_exports.strictObject({
|
|
15312
|
+
...settingField,
|
|
15313
|
+
type: external_exports.literal("select"),
|
|
15314
|
+
options: external_exports.array(settingOption).min(1),
|
|
15315
|
+
default: external_exports.string().optional()
|
|
15316
|
+
})
|
|
15317
|
+
]).superRefine((field2, ctx) => {
|
|
15318
|
+
const issue2 = (path12, message) => ctx.addIssue({ code: "custom", path: [path12], message });
|
|
15319
|
+
if (field2.type === "number" || field2.type === "range") {
|
|
15320
|
+
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
15321
|
+
if (min > max)
|
|
15322
|
+
issue2("max", "Must be at least min");
|
|
15323
|
+
if (value !== void 0 && (value < min || value > max))
|
|
15324
|
+
issue2("default", "Must be within min and max");
|
|
15325
|
+
} else if (field2.type === "select") {
|
|
15326
|
+
const values = new Set(field2.options.map(({ value }) => value));
|
|
15327
|
+
if (values.size !== field2.options.length)
|
|
15328
|
+
issue2("options", "Duplicate option values");
|
|
15329
|
+
if (field2.default !== void 0 && !values.has(field2.default))
|
|
15330
|
+
issue2("default", "Must match an option value");
|
|
15331
|
+
}
|
|
15332
|
+
});
|
|
15333
|
+
var manifestHeader = external_exports.object({
|
|
15334
|
+
manifestVersion: external_exports.int().positive(),
|
|
15335
|
+
id: desktopExtensionIdSchema,
|
|
15336
|
+
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
15337
|
+
version: external_exports.string().min(1).max(128),
|
|
15338
|
+
desktopApi: external_exports.int().positive()
|
|
15339
|
+
}).passthrough();
|
|
15340
|
+
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
15341
|
+
manifestVersion: external_exports.literal(1),
|
|
15342
|
+
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
15343
|
+
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
15344
|
+
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
15345
|
+
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
15346
|
+
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
15347
|
+
icon: imagePathSchema.optional(),
|
|
15348
|
+
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
15349
|
+
desktop: external_exports.strictObject({
|
|
15350
|
+
script: pluginRelativeResourceSchema,
|
|
15351
|
+
style: pluginRelativeResourceSchema.optional()
|
|
15352
|
+
}).optional(),
|
|
15353
|
+
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
15354
|
+
slots: slotsSchema.default(() => []),
|
|
15355
|
+
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
15356
|
+
categories: categoriesSchema.optional()
|
|
15357
|
+
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
15358
|
+
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
15359
|
+
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
15360
|
+
state: external_exports.enum([
|
|
15361
|
+
"running",
|
|
15362
|
+
"disabled",
|
|
15363
|
+
"invalid",
|
|
15364
|
+
"incompatible",
|
|
15365
|
+
"conflict",
|
|
15366
|
+
"failed",
|
|
15367
|
+
"waiting"
|
|
15368
|
+
]),
|
|
15369
|
+
hash: desktopExtensionHashSchema.optional(),
|
|
15370
|
+
error: external_exports.string().optional(),
|
|
15371
|
+
conflictWith: desktopExtensionIdSchema.optional()
|
|
15372
|
+
});
|
|
15373
|
+
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
15374
|
+
controllerPid: external_exports.int().positive(),
|
|
15375
|
+
targetId: external_exports.string().nullable(),
|
|
15376
|
+
updatedAt: external_exports.iso.datetime(),
|
|
15377
|
+
handledReloadToken: external_exports.uuid().optional(),
|
|
15378
|
+
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
|
|
15379
|
+
surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
|
|
15380
|
+
});
|
|
15381
|
+
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
15382
|
+
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15383
|
+
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15384
|
+
}
|
|
15385
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
15386
|
+
const url2 = new URL(input);
|
|
15387
|
+
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);
|
|
15388
|
+
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15389
|
+
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
15390
|
+
id: desktopExtensionIdSchema,
|
|
15391
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15392
|
+
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
15393
|
+
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
15394
|
+
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
15395
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
15396
|
+
repository: desktopExtensionHttpUrlSchema,
|
|
15397
|
+
stars: external_exports.number().int().min(0).optional(),
|
|
15398
|
+
downloads: external_exports.number().int().min(0).optional(),
|
|
15399
|
+
categories: categoriesSchema.optional(),
|
|
15400
|
+
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
15401
|
+
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
15402
|
+
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15403
|
+
downloadUrl: desktopExtensionZipUrlSchema,
|
|
15404
|
+
sha256: desktopExtensionHashSchema,
|
|
15405
|
+
slots: slotsSchema.optional(),
|
|
15406
|
+
publishedAt: external_exports.string().optional(),
|
|
15407
|
+
updatedAt: external_exports.string().optional(),
|
|
15408
|
+
minCodexHostVersion: external_exports.string().optional()
|
|
15409
|
+
});
|
|
15410
|
+
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
15411
|
+
schemaVersion: external_exports.literal(1),
|
|
15412
|
+
generatedAt: external_exports.string(),
|
|
15413
|
+
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
15414
|
+
});
|
|
15415
|
+
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
15416
|
+
|
|
15417
|
+
// ../../shared-contracts/dist/host-extensions.js
|
|
15418
|
+
var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
|
|
15419
|
+
var HOST_EXTENSION_PAGE_API_VERSION = 1;
|
|
15420
|
+
var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
|
|
15421
|
+
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
15422
|
+
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
15423
|
+
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
15424
|
+
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");
|
|
15425
|
+
var legacy = desktopExtensionManifestSchema.shape;
|
|
15426
|
+
var localized = (max, min = 0) => external_exports.strictObject({
|
|
15427
|
+
en: external_exports.string().trim().min(min).max(max),
|
|
15428
|
+
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
15429
|
+
});
|
|
15430
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path12) => path12.endsWith(suffix), `Expected a ${suffix} file`);
|
|
15431
|
+
var moduleEntry = resourceWithSuffix(".mjs");
|
|
15432
|
+
var style = resourceWithSuffix(".css").optional();
|
|
15433
|
+
var hostExtensionCanonicalPath = (path12) => path12.normalize("NFC").toLowerCase();
|
|
15434
|
+
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
15435
|
+
manifestVersion: external_exports.literal(2),
|
|
15436
|
+
id: hostExtensionIdSchema,
|
|
15437
|
+
name: localized(128, 1),
|
|
15438
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15439
|
+
description: localized(4096),
|
|
15440
|
+
details: localized(16384).optional(),
|
|
15441
|
+
author: legacy.author,
|
|
15442
|
+
repository: legacy.repository,
|
|
15443
|
+
icon: legacy.icon.refine((path12) => path12 === void 0 || hostExtensionResourcePathSchema.safeParse(path12).success),
|
|
15444
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path12) => hostExtensionResourcePathSchema.safeParse(path12).success)),
|
|
15445
|
+
categories: legacy.categories,
|
|
15446
|
+
settingsSchema: legacy.settingsSchema,
|
|
15447
|
+
slots: legacy.slots.removeDefault().optional(),
|
|
15448
|
+
page: external_exports.strictObject({
|
|
15449
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
15450
|
+
entry: moduleEntry,
|
|
15451
|
+
style,
|
|
15452
|
+
title: localized(128, 1).optional()
|
|
15453
|
+
}).optional(),
|
|
15454
|
+
widget: external_exports.strictObject({
|
|
15455
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
15456
|
+
entry: moduleEntry,
|
|
15457
|
+
style
|
|
15458
|
+
}).optional(),
|
|
15459
|
+
desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
|
|
15460
|
+
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(),
|
|
15461
|
+
backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
|
|
15462
|
+
}).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" });
|
|
15463
|
+
function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
|
|
15464
|
+
if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
|
|
15465
|
+
return ["desktop", "web"];
|
|
15466
|
+
const targets = [];
|
|
15467
|
+
if (hasDesktop)
|
|
15468
|
+
targets.push("desktop");
|
|
15469
|
+
if (hasWeb)
|
|
15470
|
+
targets.push("web");
|
|
15471
|
+
return targets;
|
|
15472
|
+
}
|
|
15473
|
+
var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
15474
|
+
|
|
15475
|
+
// ../../shared-contracts/dist/host-extension-management.js
|
|
15476
|
+
var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
|
|
15477
|
+
var hostExtensionRevisionSchema = external_exports.int().nonnegative();
|
|
15478
|
+
var hostExtensionConfigurationSchema = external_exports.strictObject({
|
|
15479
|
+
revision: hostExtensionRevisionSchema,
|
|
15480
|
+
enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
|
|
15481
|
+
});
|
|
15482
|
+
var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
|
|
15483
|
+
var hostExtensionCatalogEntrySchema = external_exports.object({
|
|
15484
|
+
...catalogMetadata,
|
|
15485
|
+
id: hostExtensionIdSchema,
|
|
15486
|
+
format: external_exports.literal("codexhost"),
|
|
15487
|
+
targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
|
|
15488
|
+
apis: external_exports.strictObject({
|
|
15489
|
+
page: external_exports.int().positive().optional(),
|
|
15490
|
+
widget: external_exports.int().positive().optional(),
|
|
15491
|
+
desktop: external_exports.int().positive().optional(),
|
|
15492
|
+
web: external_exports.int().positive().optional(),
|
|
15493
|
+
backend: external_exports.int().positive().optional()
|
|
15494
|
+
}),
|
|
15495
|
+
downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
|
|
15496
|
+
}).refine(({ targets, apis }) => {
|
|
15497
|
+
const derived = targetsForCapabilities({
|
|
15498
|
+
hasPage: Boolean(apis.page),
|
|
15499
|
+
hasWidget: Boolean(apis.widget),
|
|
15500
|
+
hasDesktop: Boolean(apis.desktop),
|
|
15501
|
+
hasWeb: Boolean(apis.web),
|
|
15502
|
+
hasBackend: Boolean(apis.backend)
|
|
15503
|
+
});
|
|
15504
|
+
return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
|
|
15505
|
+
}, "Catalog targets must match the declared APIs");
|
|
15506
|
+
var hostExtensionCatalogSchema = external_exports.object({
|
|
15507
|
+
schemaVersion: external_exports.literal(2),
|
|
15508
|
+
generatedAt: external_exports.string().min(1),
|
|
15509
|
+
extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
15510
|
+
});
|
|
15511
|
+
var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
|
|
15512
|
+
catalogUrl: desktopExtensionHttpUrlSchema,
|
|
15513
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
15514
|
+
cached: external_exports.boolean()
|
|
15515
|
+
});
|
|
15516
|
+
var id = { id: hostExtensionIdSchema };
|
|
15517
|
+
var active = {
|
|
15518
|
+
...id,
|
|
15519
|
+
activationId: hostExtensionActivationIdSchema,
|
|
15520
|
+
digest: hostExtensionDigestSchema
|
|
15521
|
+
};
|
|
15522
|
+
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
15523
|
+
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");
|
|
15524
|
+
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");
|
|
15525
|
+
function base643(maxBytes) {
|
|
15526
|
+
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
15527
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
15528
|
+
return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
|
|
15529
|
+
}, "Expected bounded standard padded base64");
|
|
15530
|
+
}
|
|
15531
|
+
var hostExtensionGitHubSourceSchema = external_exports.strictObject({
|
|
15532
|
+
type: external_exports.literal("github"),
|
|
15533
|
+
repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
|
|
15534
|
+
ref: gitRef.optional(),
|
|
15535
|
+
tag: gitRef.optional(),
|
|
15536
|
+
asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
|
|
15537
|
+
subpath: hostExtensionResourcePathSchema.optional()
|
|
15538
|
+
}).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
|
|
15539
|
+
var hostExtensionInstallSourceSchema = external_exports.union([
|
|
15540
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
15541
|
+
hostExtensionGitHubSourceSchema,
|
|
15542
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
|
|
15543
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
|
|
15544
|
+
external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
|
|
15417
15545
|
]);
|
|
15418
|
-
var
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
purpose: external_exports.literal("availability").optional()
|
|
15424
|
-
}).strict();
|
|
15425
|
-
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15426
|
-
harnessId: harnessIdSchema
|
|
15427
|
-
}).strict();
|
|
15428
|
-
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
15429
|
-
var threadModelSelectParamsSchema = external_exports.object({
|
|
15430
|
-
threadId: hostThreadIdSchema,
|
|
15431
|
-
model: harnessModelRefSchema
|
|
15432
|
-
}).strict();
|
|
15433
|
-
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
15434
|
-
threadId: hostThreadIdSchema,
|
|
15435
|
-
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15436
|
-
}).strict();
|
|
15437
|
-
var threadInspectionParamsSchema = external_exports.object({
|
|
15438
|
-
threadId: hostThreadIdSchema,
|
|
15439
|
-
includeReferenceCapability: external_exports.boolean().optional()
|
|
15440
|
-
}).strict();
|
|
15441
|
-
var codexThreadInspectionSchema = external_exports.object({
|
|
15442
|
-
owner: external_exports.literal("codex"),
|
|
15443
|
-
locked: external_exports.boolean(),
|
|
15444
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
15445
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15446
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15447
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15448
|
-
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
15449
|
-
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15450
|
-
}).strict();
|
|
15451
|
-
var externalThreadInspectionSchema = external_exports.object({
|
|
15452
|
-
owner: external_exports.literal("external"),
|
|
15453
|
-
harnessId: nonBlankTextSchema2.max(256),
|
|
15454
|
-
transportModelId: nonBlankTextSchema2.max(1024),
|
|
15455
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
15456
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15457
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15458
|
-
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15459
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15460
|
-
history: harnessHistoryCapabilitiesSchema,
|
|
15461
|
-
usage: threadUsageSnapshotSchema.optional(),
|
|
15462
|
-
locked: external_exports.literal(true)
|
|
15463
|
-
}).strict();
|
|
15464
|
-
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
15465
|
-
codexThreadInspectionSchema,
|
|
15466
|
-
externalThreadInspectionSchema
|
|
15546
|
+
var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
|
|
15547
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
15548
|
+
hostExtensionGitHubSourceSchema,
|
|
15549
|
+
external_exports.strictObject({ type: external_exports.literal("zip") }),
|
|
15550
|
+
external_exports.strictObject({ type: external_exports.literal("localDir") })
|
|
15467
15551
|
]);
|
|
15468
|
-
var
|
|
15469
|
-
|
|
15470
|
-
|
|
15471
|
-
|
|
15472
|
-
|
|
15473
|
-
if (seen.has(threadId)) {
|
|
15474
|
-
context.addIssue({
|
|
15475
|
-
code: "custom",
|
|
15476
|
-
message: "Thread ownership-list IDs must be unique",
|
|
15477
|
-
path: ["threadIds", index]
|
|
15478
|
-
});
|
|
15479
|
-
}
|
|
15480
|
-
seen.add(threadId);
|
|
15481
|
-
}
|
|
15552
|
+
var hostExtensionInstallationSchema = external_exports.strictObject({
|
|
15553
|
+
...active,
|
|
15554
|
+
manifest: hostExtensionManifestV2Schema,
|
|
15555
|
+
installedAt: external_exports.iso.datetime(),
|
|
15556
|
+
source: hostExtensionProvenanceSchema.optional()
|
|
15482
15557
|
});
|
|
15483
|
-
var
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
|
|
15558
|
+
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);
|
|
15559
|
+
var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
|
|
15560
|
+
var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
|
|
15561
|
+
var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
|
|
15562
|
+
hostExtensionInstallationSchema.extend({
|
|
15563
|
+
state: external_exports.literal("valid"),
|
|
15564
|
+
enabled: external_exports.boolean(),
|
|
15565
|
+
...desktopConflict,
|
|
15566
|
+
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
15567
|
+
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15568
|
+
backendState: backendState.optional(),
|
|
15569
|
+
backendError: external_exports.string().optional()
|
|
15570
|
+
}),
|
|
15571
|
+
external_exports.strictObject({
|
|
15572
|
+
state: external_exports.enum(["invalid", "incompatible"]),
|
|
15573
|
+
id: external_exports.string().min(1),
|
|
15574
|
+
enabled: external_exports.boolean(),
|
|
15575
|
+
error: external_exports.string()
|
|
15576
|
+
})
|
|
15495
15577
|
]);
|
|
15496
|
-
var
|
|
15497
|
-
|
|
15498
|
-
|
|
15499
|
-
|
|
15500
|
-
|
|
15501
|
-
|
|
15502
|
-
|
|
15503
|
-
|
|
15504
|
-
|
|
15505
|
-
|
|
15506
|
-
|
|
15507
|
-
|
|
15508
|
-
|
|
15509
|
-
|
|
15578
|
+
var hostExtensionsListResultSchema = external_exports.strictObject({
|
|
15579
|
+
revision: hostExtensionRevisionSchema,
|
|
15580
|
+
configuration: hostExtensionConfigurationSchema,
|
|
15581
|
+
diagnostics: external_exports.array(external_exports.string()),
|
|
15582
|
+
extensions: external_exports.array(hostExtensionListItemSchema)
|
|
15583
|
+
});
|
|
15584
|
+
var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
|
|
15585
|
+
...desktopConflict,
|
|
15586
|
+
settingsRevision: hostExtensionRevisionSchema
|
|
15587
|
+
});
|
|
15588
|
+
var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
|
|
15589
|
+
/** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
|
|
15590
|
+
revision: hostExtensionRevisionSchema,
|
|
15591
|
+
// Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
|
|
15592
|
+
extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
|
|
15593
|
+
});
|
|
15594
|
+
var HOST_EXTENSIONS_RPC = {
|
|
15595
|
+
list: "codexhost/extensions/list",
|
|
15596
|
+
snapshot: "codexhost/extensions/snapshot",
|
|
15597
|
+
catalog: "codexhost/extensions/catalog",
|
|
15598
|
+
install: "codexhost/extensions/install",
|
|
15599
|
+
update: "codexhost/extensions/update",
|
|
15600
|
+
enable: "codexhost/extensions/enable",
|
|
15601
|
+
disable: "codexhost/extensions/disable",
|
|
15602
|
+
uninstall: "codexhost/extensions/uninstall",
|
|
15603
|
+
recover: "codexhost/extensions/recover",
|
|
15604
|
+
asset: "codexhost/extensions/asset",
|
|
15605
|
+
settingsGet: "codexhost/extensions/settings/get",
|
|
15606
|
+
settingsSet: "codexhost/extensions/settings/set",
|
|
15607
|
+
backendInvoke: "codexhost/extensions/backend/invoke"
|
|
15608
|
+
};
|
|
15609
|
+
var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
|
|
15610
|
+
var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
|
|
15611
|
+
var noParams = external_exports.strictObject({});
|
|
15612
|
+
var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
|
|
15613
|
+
var selection = external_exports.strictObject({ ...id, ...expectedRevision });
|
|
15614
|
+
var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
|
|
15615
|
+
var mutationResult = external_exports.discriminatedUnion("state", [
|
|
15616
|
+
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
|
|
15617
|
+
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
|
|
15618
|
+
]);
|
|
15619
|
+
var hostExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
15620
|
+
...optionalActivation,
|
|
15621
|
+
digest: active.digest.optional(),
|
|
15622
|
+
path: hostExtensionResourcePathSchema
|
|
15623
|
+
});
|
|
15624
|
+
var hostExtensionsAssetResultSchema = external_exports.strictObject({
|
|
15625
|
+
mimeType: external_exports.string().min(1),
|
|
15626
|
+
base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
|
|
15627
|
+
digest: active.digest
|
|
15628
|
+
});
|
|
15629
|
+
var hostExtensionSettingsSchema = external_exports.strictObject({
|
|
15630
|
+
settingsRevision: hostExtensionRevisionSchema,
|
|
15631
|
+
values: jsonObjectSchema
|
|
15510
15632
|
});
|
|
15511
|
-
var
|
|
15512
|
-
|
|
15513
|
-
|
|
15514
|
-
|
|
15515
|
-
|
|
15516
|
-
|
|
15517
|
-
|
|
15518
|
-
|
|
15519
|
-
|
|
15520
|
-
|
|
15521
|
-
|
|
15522
|
-
|
|
15523
|
-
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
}
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15633
|
+
var hostExtensionsRpcSchemas = {
|
|
15634
|
+
[HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
|
|
15635
|
+
[HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
|
|
15636
|
+
[HOST_EXTENSIONS_RPC.catalog]: {
|
|
15637
|
+
params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
|
|
15638
|
+
result: hostExtensionsCatalogResultSchema
|
|
15639
|
+
},
|
|
15640
|
+
[HOST_EXTENSIONS_RPC.install]: {
|
|
15641
|
+
params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
|
|
15642
|
+
result: installationResult
|
|
15643
|
+
},
|
|
15644
|
+
[HOST_EXTENSIONS_RPC.update]: {
|
|
15645
|
+
params: external_exports.strictObject({
|
|
15646
|
+
...id,
|
|
15647
|
+
expectedDigest: active.digest,
|
|
15648
|
+
expectedActivationId: active.activationId.optional(),
|
|
15649
|
+
source: hostExtensionInstallSourceSchema.optional()
|
|
15650
|
+
}),
|
|
15651
|
+
result: installationResult
|
|
15652
|
+
},
|
|
15653
|
+
[HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
|
|
15654
|
+
[HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
|
|
15655
|
+
[HOST_EXTENSIONS_RPC.uninstall]: {
|
|
15656
|
+
params: external_exports.strictObject({
|
|
15657
|
+
...id,
|
|
15658
|
+
removeData: external_exports.boolean().optional(),
|
|
15659
|
+
expectedDigest: active.digest.optional()
|
|
15660
|
+
}),
|
|
15661
|
+
result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
|
|
15662
|
+
},
|
|
15663
|
+
[HOST_EXTENSIONS_RPC.recover]: {
|
|
15664
|
+
params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
|
|
15665
|
+
result: mutationResult
|
|
15666
|
+
},
|
|
15667
|
+
[HOST_EXTENSIONS_RPC.asset]: {
|
|
15668
|
+
params: hostExtensionsAssetParamsSchema,
|
|
15669
|
+
result: hostExtensionsAssetResultSchema
|
|
15670
|
+
},
|
|
15671
|
+
[HOST_EXTENSIONS_RPC.settingsGet]: {
|
|
15672
|
+
params: external_exports.strictObject(optionalActivation),
|
|
15673
|
+
result: hostExtensionSettingsSchema
|
|
15674
|
+
},
|
|
15675
|
+
[HOST_EXTENSIONS_RPC.settingsSet]: {
|
|
15676
|
+
params: external_exports.strictObject({
|
|
15677
|
+
...optionalActivation,
|
|
15678
|
+
expectedSettingsRevision: hostExtensionRevisionSchema,
|
|
15679
|
+
values: jsonObjectSchema
|
|
15680
|
+
}),
|
|
15681
|
+
result: hostExtensionSettingsSchema
|
|
15682
|
+
},
|
|
15683
|
+
[HOST_EXTENSIONS_RPC.backendInvoke]: {
|
|
15684
|
+
params: external_exports.strictObject({
|
|
15685
|
+
...optionalActivation,
|
|
15686
|
+
method: hostExtensionBackendMethodSchema,
|
|
15687
|
+
params: jsonValueSchema.optional()
|
|
15688
|
+
}),
|
|
15689
|
+
result: external_exports.strictObject({ result: jsonValueSchema })
|
|
15690
|
+
}
|
|
15691
|
+
};
|
|
15535
15692
|
|
|
15536
15693
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
15537
15694
|
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
@@ -15594,7 +15751,7 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
15594
15751
|
"codexhost/harness/session-import/list",
|
|
15595
15752
|
"codexhost/harness/session-import/import",
|
|
15596
15753
|
// Host settings shared across Desktop and Web.
|
|
15597
|
-
...
|
|
15754
|
+
...HOST_EXTENSION_MANAGEMENT_METHODS,
|
|
15598
15755
|
"codexhost/harness/installation",
|
|
15599
15756
|
"codexhost/harness/installation/start",
|
|
15600
15757
|
"codexhost/harness/installation/status",
|
|
@@ -15655,6 +15812,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
15655
15812
|
cursor: clientChannelCursorSchema,
|
|
15656
15813
|
revision: external_exports.number().int().nonnegative()
|
|
15657
15814
|
}),
|
|
15815
|
+
external_exports.object({
|
|
15816
|
+
type: external_exports.literal("extensions-changed"),
|
|
15817
|
+
cursor: clientChannelCursorSchema,
|
|
15818
|
+
revision: hostExtensionRevisionSchema
|
|
15819
|
+
}),
|
|
15658
15820
|
external_exports.object({
|
|
15659
15821
|
type: external_exports.literal("hello"),
|
|
15660
15822
|
version: external_exports.literal(1),
|
|
@@ -16091,7 +16253,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
|
16091
16253
|
|
|
16092
16254
|
// ../../shared-contracts/dist/harness-preferences.js
|
|
16093
16255
|
var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
|
|
16094
|
-
var preferenceHarnessKey = harnessIdSchema.transform((
|
|
16256
|
+
var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
|
|
16095
16257
|
var harnessDefaultConfigurationSchema = external_exports.strictObject({
|
|
16096
16258
|
model: harnessModelRefSchema.optional(),
|
|
16097
16259
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -16101,11 +16263,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
|
|
|
16101
16263
|
lastHarness: harnessIdSchema.optional(),
|
|
16102
16264
|
byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
|
|
16103
16265
|
});
|
|
16266
|
+
var harnessDelegationDefaultSchema = external_exports.strictObject({
|
|
16267
|
+
model: harnessModelRefSchema.optional(),
|
|
16268
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
16269
|
+
}).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
|
|
16270
|
+
var delegationDefaultsSchema = external_exports.strictObject({
|
|
16271
|
+
byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
|
|
16272
|
+
});
|
|
16104
16273
|
var modelId = external_exports.string().min(1).max(1024);
|
|
16105
16274
|
var harnessPreferenceValuesSchema = external_exports.strictObject({
|
|
16106
16275
|
idleRelease: idleReleaseSettingsSchema.optional(),
|
|
16107
16276
|
favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
|
|
16108
|
-
newThread: newThreadDefaultsSchema.optional()
|
|
16277
|
+
newThread: newThreadDefaultsSchema.optional(),
|
|
16278
|
+
delegation: delegationDefaultsSchema.optional()
|
|
16109
16279
|
});
|
|
16110
16280
|
var harnessPreferenceSnapshotSchema = external_exports.strictObject({
|
|
16111
16281
|
scope: harnessPreferenceScopeSchema,
|
|
@@ -16133,6 +16303,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
|
|
|
16133
16303
|
lastHarness: harnessIdSchema.optional(),
|
|
16134
16304
|
harnessId: harnessIdSchema.optional(),
|
|
16135
16305
|
configuration: harnessDefaultConfigurationSchema.optional()
|
|
16306
|
+
}),
|
|
16307
|
+
external_exports.strictObject({
|
|
16308
|
+
kind: external_exports.literal("delegation"),
|
|
16309
|
+
harnessId: harnessIdSchema,
|
|
16310
|
+
configuration: harnessDelegationDefaultSchema.nullable()
|
|
16136
16311
|
})
|
|
16137
16312
|
]);
|
|
16138
16313
|
var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
@@ -16956,9 +17131,12 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16956
17131
|
...thread,
|
|
16957
17132
|
epoch: identity,
|
|
16958
17133
|
modelId: identity.optional(),
|
|
17134
|
+
serviceTier: harnessModelServiceTierSchema.optional(),
|
|
16959
17135
|
thinkingOptionId: identity.optional(),
|
|
16960
17136
|
permissionModeId: identity.optional()
|
|
16961
|
-
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
|
|
17137
|
+
}).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, {
|
|
17138
|
+
message: "A service tier requires a Model ID"
|
|
17139
|
+
}),
|
|
16962
17140
|
external_exports.strictObject({
|
|
16963
17141
|
kind: external_exports.literal("prompt"),
|
|
16964
17142
|
...thread,
|
|
@@ -17008,7 +17186,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
17008
17186
|
external_exports.strictObject({ action: external_exports.literal("catalog") }),
|
|
17009
17187
|
external_exports.strictObject({
|
|
17010
17188
|
action: external_exports.literal("read-thread"),
|
|
17011
|
-
hostId: hostId.refine((
|
|
17189
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
17012
17190
|
input: delegationReadParamsSchema
|
|
17013
17191
|
}),
|
|
17014
17192
|
external_exports.strictObject({
|
|
@@ -17022,7 +17200,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
17022
17200
|
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
17023
17201
|
external_exports.strictObject({
|
|
17024
17202
|
action: external_exports.literal("update"),
|
|
17025
|
-
hostId: hostId.refine((
|
|
17203
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
17026
17204
|
version: remoteUpdateParamsSchema.shape.version
|
|
17027
17205
|
})
|
|
17028
17206
|
]);
|
|
@@ -17086,7 +17264,7 @@ function invalidRequest(message) {
|
|
|
17086
17264
|
return { code: "invalidRequest", message, retryable: false };
|
|
17087
17265
|
}
|
|
17088
17266
|
function validateHostApprovalResponse(interaction, response) {
|
|
17089
|
-
return interaction.actions.some(({ id }) =>
|
|
17267
|
+
return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
|
|
17090
17268
|
}
|
|
17091
17269
|
|
|
17092
17270
|
// ../../harness-adapter/dist/question.js
|
|
@@ -17094,7 +17272,7 @@ function invalidRequest2(message) {
|
|
|
17094
17272
|
return { code: "invalidRequest", message, retryable: false };
|
|
17095
17273
|
}
|
|
17096
17274
|
function validateHostQuestionResponse(interaction, response) {
|
|
17097
|
-
const questionIds = new Set(interaction.questions.map(({ id }) =>
|
|
17275
|
+
const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
|
|
17098
17276
|
if (response.cancelled) {
|
|
17099
17277
|
return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
|
|
17100
17278
|
}
|
|
@@ -17142,6 +17320,18 @@ function validateHostInteractionResponse(interaction, response) {
|
|
|
17142
17320
|
return response.type === "approval" ? validateHostApprovalResponse(interaction, response) : invalidRequest3("Interaction Response type does not match the pending Interaction");
|
|
17143
17321
|
}
|
|
17144
17322
|
|
|
17323
|
+
// ../../harness-adapter/dist/legacy-model-ref.js
|
|
17324
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
17325
|
+
function normalizeLegacyBase64ModelRef(ref, catalog, prefix) {
|
|
17326
|
+
if (ref.serviceTier || !ref.id.startsWith(prefix))
|
|
17327
|
+
return void 0;
|
|
17328
|
+
const encoded = ref.id.slice(prefix.length);
|
|
17329
|
+
const id2 = Buffer2.from(encoded, "base64url").toString("utf8");
|
|
17330
|
+
if (Buffer2.from(id2).toString("base64url") !== encoded)
|
|
17331
|
+
return void 0;
|
|
17332
|
+
return catalog.models.find(({ ref: ref2 }) => ref2.id === id2 && !ref2.serviceTier)?.ref;
|
|
17333
|
+
}
|
|
17334
|
+
|
|
17145
17335
|
// ../../harness-adapter/dist/output-channel.js
|
|
17146
17336
|
var HarnessOutputChannel = class {
|
|
17147
17337
|
outputs;
|
|
@@ -17226,7 +17416,8 @@ var tokenFields = [
|
|
|
17226
17416
|
var safeIntegerFields = [
|
|
17227
17417
|
"planFiveHourResetsAtUnix",
|
|
17228
17418
|
"planSevenDayResetsAtUnix",
|
|
17229
|
-
"timeToFirstOutputMs"
|
|
17419
|
+
"timeToFirstOutputMs",
|
|
17420
|
+
"latestRequestTimeToFirstOutputMs"
|
|
17230
17421
|
];
|
|
17231
17422
|
var percentFields = [
|
|
17232
17423
|
"cacheHitRatePercent",
|
|
@@ -17552,6 +17743,7 @@ var HARNESS_BROKER_IDLE_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
|
17552
17743
|
var HARNESS_BROKER_RETIRING_ERROR_CODE = "brokerRetiring";
|
|
17553
17744
|
var harnessBrokerMethodSchema = external_exports.enum([
|
|
17554
17745
|
"adapter.inspect",
|
|
17746
|
+
"adapter.normalizeStoredModelRef",
|
|
17555
17747
|
"adapter.inspectAccount",
|
|
17556
17748
|
"adapter.credits",
|
|
17557
17749
|
"adapter.open",
|
|
@@ -17739,6 +17931,10 @@ var brokerInspectInputSchema = external_exports.object({
|
|
|
17739
17931
|
refresh: external_exports.boolean().optional(),
|
|
17740
17932
|
purpose: external_exports.literal("availability").optional()
|
|
17741
17933
|
}).strict();
|
|
17934
|
+
var brokerNormalizeStoredModelRefSchema = external_exports.strictObject({
|
|
17935
|
+
ref: harnessModelRefSchema,
|
|
17936
|
+
catalog: harnessModelCatalogSchema
|
|
17937
|
+
});
|
|
17742
17938
|
var brokerSessionImportListParamsSchema = external_exports.object({
|
|
17743
17939
|
offset: external_exports.number().int().nonnegative().safe(),
|
|
17744
17940
|
limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
|
|
@@ -17867,11 +18063,13 @@ var eventKeys = /* @__PURE__ */ new Map([
|
|
|
17867
18063
|
["session.state.changed", /* @__PURE__ */ new Set(["type", "state"])],
|
|
17868
18064
|
["session.usage.changed", /* @__PURE__ */ new Set(["type", "usage", "observedForTurnId"])],
|
|
17869
18065
|
["usage.request", /* @__PURE__ */ new Set(["type", "request"])],
|
|
18066
|
+
["usage.request.timing", /* @__PURE__ */ new Set(["type", "turnId", "timing"])],
|
|
17870
18067
|
["usage.history", /* @__PURE__ */ new Set(["type", "complete"])],
|
|
17871
18068
|
["subagent.state.changed", /* @__PURE__ */ new Set(["type", "nativeSubagentId", "status", "resultSummary"])],
|
|
17872
18069
|
["subagent.transcript.changed", /* @__PURE__ */ new Set(["type", "nativeSubagentId"])],
|
|
17873
18070
|
["turn.started", /* @__PURE__ */ new Set(["type", "turnId"])],
|
|
17874
18071
|
["turn.autonomous.started", /* @__PURE__ */ new Set(["type", "turnId", "input"])],
|
|
18072
|
+
["turn.autonomous.completed", /* @__PURE__ */ new Set(["type", "snapshot"])],
|
|
17875
18073
|
["item.started", /* @__PURE__ */ new Set(["type", "turnId", "item"])],
|
|
17876
18074
|
["item.updated", /* @__PURE__ */ new Set(["type", "turnId", "itemId", "update"])],
|
|
17877
18075
|
["item.completed", /* @__PURE__ */ new Set(["type", "turnId", "snapshot"])],
|
|
@@ -17903,6 +18101,118 @@ var interactionKeys = /* @__PURE__ */ new Map([
|
|
|
17903
18101
|
function strictKeys(value, allowed) {
|
|
17904
18102
|
return Boolean(allowed && value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).every((key) => allowed.has(key)));
|
|
17905
18103
|
}
|
|
18104
|
+
var nonNegativeSafeIntegerSchema2 = external_exports.int().nonnegative();
|
|
18105
|
+
var toolOutputSchema = external_exports.strictObject({
|
|
18106
|
+
content: external_exports.array(external_exports.discriminatedUnion("type", [
|
|
18107
|
+
textInputSchema,
|
|
18108
|
+
external_exports.strictObject({ type: external_exports.literal("image"), mimeType: external_exports.string(), base64Data: external_exports.string() })
|
|
18109
|
+
])),
|
|
18110
|
+
truncated: external_exports.boolean().optional()
|
|
18111
|
+
});
|
|
18112
|
+
var fileChangeSchema = external_exports.strictObject({
|
|
18113
|
+
path: external_exports.string(),
|
|
18114
|
+
kind: external_exports.enum(["add", "update", "delete"]),
|
|
18115
|
+
unifiedDiff: external_exports.string(),
|
|
18116
|
+
diffScope: external_exports.literal("fragment").optional()
|
|
18117
|
+
});
|
|
18118
|
+
var subagentStateSchema = external_exports.strictObject({
|
|
18119
|
+
subagentId: external_exports.string().min(1),
|
|
18120
|
+
nativeSubagentId: external_exports.string().min(1).optional(),
|
|
18121
|
+
description: external_exports.string(),
|
|
18122
|
+
role: external_exports.string().optional(),
|
|
18123
|
+
model: external_exports.string().optional(),
|
|
18124
|
+
reasoningEffort: external_exports.string().optional(),
|
|
18125
|
+
background: external_exports.boolean(),
|
|
18126
|
+
status: external_exports.enum(["pending", "running", "completed", "failed", "interrupted"]),
|
|
18127
|
+
resultSummary: external_exports.string().optional()
|
|
18128
|
+
});
|
|
18129
|
+
var itemBase = { itemId: hostItemIdSchema };
|
|
18130
|
+
var toolFields = {
|
|
18131
|
+
...itemBase,
|
|
18132
|
+
toolName: external_exports.string(),
|
|
18133
|
+
arguments: jsonValueSchema,
|
|
18134
|
+
output: toolOutputSchema.optional(),
|
|
18135
|
+
durationMs: external_exports.number().nonnegative().optional()
|
|
18136
|
+
};
|
|
18137
|
+
var snapshotItemSchema = external_exports.discriminatedUnion("type", [
|
|
18138
|
+
external_exports.strictObject({
|
|
18139
|
+
...itemBase,
|
|
18140
|
+
type: external_exports.literal("agentMessage"),
|
|
18141
|
+
text: external_exports.string(),
|
|
18142
|
+
phase: external_exports.enum(["commentary", "final_answer"]).optional()
|
|
18143
|
+
}),
|
|
18144
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("userMessage"), input: external_exports.array(textInputSchema) }),
|
|
18145
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("reasoning"), text: external_exports.string() }),
|
|
18146
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("contextCompaction") }),
|
|
18147
|
+
external_exports.strictObject({
|
|
18148
|
+
...itemBase,
|
|
18149
|
+
type: external_exports.literal("commandExecution"),
|
|
18150
|
+
command: external_exports.string(),
|
|
18151
|
+
cwd: cwdSchema.optional(),
|
|
18152
|
+
output: external_exports.string().optional(),
|
|
18153
|
+
outputTruncated: external_exports.boolean().optional(),
|
|
18154
|
+
exitCode: external_exports.int().nullable().optional(),
|
|
18155
|
+
durationMs: external_exports.number().nonnegative().optional()
|
|
18156
|
+
}),
|
|
18157
|
+
external_exports.strictObject({
|
|
18158
|
+
...toolFields,
|
|
18159
|
+
type: external_exports.literal("toolExecution"),
|
|
18160
|
+
namespace: external_exports.string().optional()
|
|
18161
|
+
}),
|
|
18162
|
+
external_exports.strictObject({ ...toolFields, type: external_exports.literal("mcpToolCall"), server: external_exports.string() }),
|
|
18163
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("webSearch"), query: external_exports.string() }),
|
|
18164
|
+
external_exports.strictObject({
|
|
18165
|
+
...itemBase,
|
|
18166
|
+
type: external_exports.literal("fileChange"),
|
|
18167
|
+
changes: external_exports.array(fileChangeSchema),
|
|
18168
|
+
sourceItemIds: external_exports.array(hostItemIdSchema).optional()
|
|
18169
|
+
}),
|
|
18170
|
+
external_exports.strictObject({
|
|
18171
|
+
...itemBase,
|
|
18172
|
+
type: external_exports.literal("subagentDelegation"),
|
|
18173
|
+
operation: external_exports.enum(["spawn", "send"]),
|
|
18174
|
+
prompt: external_exports.string().optional(),
|
|
18175
|
+
subagents: external_exports.array(subagentStateSchema)
|
|
18176
|
+
})
|
|
18177
|
+
]);
|
|
18178
|
+
var terminalOutcomes = [
|
|
18179
|
+
external_exports.strictObject({ status: external_exports.literal("succeeded") }),
|
|
18180
|
+
external_exports.strictObject({ status: external_exports.literal("failed"), error: harnessErrorSchema }),
|
|
18181
|
+
external_exports.strictObject({ status: external_exports.literal("cancelled"), reason: external_exports.string().optional() })
|
|
18182
|
+
];
|
|
18183
|
+
var autonomousSnapshotSchema = external_exports.strictObject({
|
|
18184
|
+
nativeTurnRef: nativeTurnRefSchema,
|
|
18185
|
+
checkpoint: nativeCheckpointRefSchema.optional(),
|
|
18186
|
+
input: external_exports.array(textInputSchema),
|
|
18187
|
+
items: external_exports.array(external_exports.strictObject({
|
|
18188
|
+
item: snapshotItemSchema,
|
|
18189
|
+
outcome: external_exports.discriminatedUnion("status", terminalOutcomes)
|
|
18190
|
+
})),
|
|
18191
|
+
outcome: external_exports.discriminatedUnion("status", [
|
|
18192
|
+
...terminalOutcomes,
|
|
18193
|
+
external_exports.strictObject({ status: external_exports.literal("unknown"), reason: external_exports.string() })
|
|
18194
|
+
]),
|
|
18195
|
+
model: harnessModelRefSchema.optional(),
|
|
18196
|
+
startedAtMs: nonNegativeSafeIntegerSchema2.optional(),
|
|
18197
|
+
completedAtMs: nonNegativeSafeIntegerSchema2.optional()
|
|
18198
|
+
}).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, {
|
|
18199
|
+
path: ["items"],
|
|
18200
|
+
message: "Item IDs must be unique within the Turn"
|
|
18201
|
+
});
|
|
18202
|
+
var usageOutputIntervalSchema = external_exports.strictObject({
|
|
18203
|
+
startedAtMs: nonNegativeSafeIntegerSchema2,
|
|
18204
|
+
completedAtMs: nonNegativeSafeIntegerSchema2,
|
|
18205
|
+
outputTokens: nonNegativeSafeIntegerSchema2
|
|
18206
|
+
}).refine(({ startedAtMs, completedAtMs }) => completedAtMs > startedAtMs);
|
|
18207
|
+
var usageRequestTimingSchema = external_exports.union([
|
|
18208
|
+
external_exports.strictObject({
|
|
18209
|
+
requestId: external_exports.string().min(1),
|
|
18210
|
+
requestStartedAtMs: nonNegativeSafeIntegerSchema2,
|
|
18211
|
+
timeToFirstOutputMs: nonNegativeSafeIntegerSchema2,
|
|
18212
|
+
output: usageOutputIntervalSchema.optional()
|
|
18213
|
+
}),
|
|
18214
|
+
external_exports.strictObject({ requestId: external_exports.string().min(1), output: usageOutputIntervalSchema })
|
|
18215
|
+
]);
|
|
17906
18216
|
var harnessOutputSchema = external_exports.custom((value) => {
|
|
17907
18217
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
17908
18218
|
return false;
|
|
@@ -17921,10 +18231,14 @@ var harnessOutputSchema = external_exports.custom((value) => {
|
|
|
17921
18231
|
itemId: hostItemIdSchema,
|
|
17922
18232
|
text: external_exports.string()
|
|
17923
18233
|
}).strict().safeParse(event.item).success;
|
|
18234
|
+
if (event.type === "turn.autonomous.completed")
|
|
18235
|
+
return autonomousSnapshotSchema.safeParse(event.snapshot).success;
|
|
17924
18236
|
if (event.type === "session.faulted")
|
|
17925
18237
|
return harnessErrorSchema.safeParse(event.error).success;
|
|
17926
18238
|
if (event.type === "usage.history")
|
|
17927
18239
|
return typeof event.complete === "boolean";
|
|
18240
|
+
if (event.type === "usage.request.timing")
|
|
18241
|
+
return hostTurnIdSchema.safeParse(event.turnId).success && usageRequestTimingSchema.safeParse(event.timing).success;
|
|
17928
18242
|
return true;
|
|
17929
18243
|
}
|
|
17930
18244
|
if (output.kind === "interaction") {
|
|
@@ -18243,12 +18557,12 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
18243
18557
|
}
|
|
18244
18558
|
#waitForHello() {
|
|
18245
18559
|
return new Promise((resolve, reject) => {
|
|
18246
|
-
const
|
|
18560
|
+
const id2 = "__hello__";
|
|
18247
18561
|
const timeout = setTimeout(() => {
|
|
18248
|
-
this.#pending.delete(
|
|
18562
|
+
this.#pending.delete(id2);
|
|
18249
18563
|
reject(new Error("Aqua Harness broker authentication timed out"));
|
|
18250
18564
|
}, HARNESS_BROKER_REQUEST_TIMEOUT_MS);
|
|
18251
|
-
this.#pending.set(
|
|
18565
|
+
this.#pending.set(id2, { resolve: () => resolve(), reject, timeout });
|
|
18252
18566
|
});
|
|
18253
18567
|
}
|
|
18254
18568
|
register(session) {
|
|
@@ -18273,13 +18587,13 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
18273
18587
|
throw new Error("Aqua Harness broker request limit exceeded");
|
|
18274
18588
|
}
|
|
18275
18589
|
this.#inputSequence += 1;
|
|
18276
|
-
const
|
|
18590
|
+
const id2 = randomUUID();
|
|
18277
18591
|
const response = new Promise((resolve, reject) => {
|
|
18278
18592
|
const timeout = setTimeout(() => {
|
|
18279
|
-
this.#pending.delete(
|
|
18593
|
+
this.#pending.delete(id2);
|
|
18280
18594
|
reject(new Error(`Aqua Harness broker ${method} timed out`));
|
|
18281
18595
|
}, HARNESS_BROKER_REQUEST_TIMEOUT_MS);
|
|
18282
|
-
this.#pending.set(
|
|
18596
|
+
this.#pending.set(id2, { resolve, reject, timeout });
|
|
18283
18597
|
});
|
|
18284
18598
|
try {
|
|
18285
18599
|
await writeBrokerFrame(this.#socket, {
|
|
@@ -18287,15 +18601,15 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
18287
18601
|
generation: this.#descriptor.generation,
|
|
18288
18602
|
sequence: this.#inputSequence,
|
|
18289
18603
|
kind: "request",
|
|
18290
|
-
id,
|
|
18604
|
+
id: id2,
|
|
18291
18605
|
method,
|
|
18292
18606
|
params
|
|
18293
18607
|
});
|
|
18294
18608
|
} catch (error51) {
|
|
18295
|
-
const pending = this.#pending.get(
|
|
18609
|
+
const pending = this.#pending.get(id2);
|
|
18296
18610
|
if (pending)
|
|
18297
18611
|
clearTimeout(pending.timeout);
|
|
18298
|
-
this.#pending.delete(
|
|
18612
|
+
this.#pending.delete(id2);
|
|
18299
18613
|
response.catch(() => void 0);
|
|
18300
18614
|
throw new BrokerRequestNotDeliveredError(error51 instanceof Error ? error51.message : String(error51));
|
|
18301
18615
|
}
|
|
@@ -18662,6 +18976,10 @@ var BrokeredHarnessAdapter = class {
|
|
|
18662
18976
|
return failedInspection(describeBrokerFailure(error51, this.harnessId));
|
|
18663
18977
|
}
|
|
18664
18978
|
}
|
|
18979
|
+
async normalizeStoredModelRef(ref, catalog) {
|
|
18980
|
+
const result = await this.#request("adapter.normalizeStoredModelRef", { ref, catalog }, true);
|
|
18981
|
+
return harnessModelRefSchema.nullable().parse(result) ?? void 0;
|
|
18982
|
+
}
|
|
18665
18983
|
async open(input) {
|
|
18666
18984
|
if (this.#closed)
|
|
18667
18985
|
return { ok: false, error: unavailable("Aqua Harness broker adapter is closed", false) };
|
|
@@ -19035,17 +19353,14 @@ function capabilitiesForProfile(profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
|
19035
19353
|
};
|
|
19036
19354
|
}
|
|
19037
19355
|
function modelRef(modelId2) {
|
|
19038
|
-
return harnessModelRefSchema.parse({ id:
|
|
19356
|
+
return harnessModelRefSchema.parse({ id: modelId2 });
|
|
19039
19357
|
}
|
|
19040
|
-
function
|
|
19041
|
-
|
|
19042
|
-
if (!value || !ref.id.startsWith("cb.") || modelRef(value).id !== ref.id)
|
|
19043
|
-
throw new CodeBuddyError("invalidRequest", "Invalid native Model Ref");
|
|
19044
|
-
return value;
|
|
19358
|
+
function normalizeStoredCodeBuddyModelRef(ref, catalog) {
|
|
19359
|
+
return normalizeLegacyBase64ModelRef(ref, catalog, "cb.");
|
|
19045
19360
|
}
|
|
19046
19361
|
function configuration(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
19047
19362
|
const options = rows(value);
|
|
19048
|
-
const get = (
|
|
19363
|
+
const get = (id2) => options.find((option) => option.id === id2) ?? {};
|
|
19049
19364
|
const model2 = get("model"), mode = get("mode"), thought = get("thought_level");
|
|
19050
19365
|
const thinkingOptions = rows(thought.options).map((option) => harnessThinkingOptionSchema.parse({ id: option.value, label: option.name }));
|
|
19051
19366
|
const currentThinking = thinkingOptions.find((option) => option.id === thought.currentValue);
|
|
@@ -19089,10 +19404,34 @@ function configuration(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
|
19089
19404
|
};
|
|
19090
19405
|
return { catalog, permissionModes, state, options };
|
|
19091
19406
|
}
|
|
19092
|
-
function
|
|
19407
|
+
async function selectConfiguration(config2, id2, value, profile, request) {
|
|
19408
|
+
const option = config2?.options.find((option2) => option2.id === id2);
|
|
19409
|
+
const listed = rows(option?.options).some((option2) => option2.value === value);
|
|
19410
|
+
if (!listed && !(id2 === "model" && profile.allowUnlistedModelSelection))
|
|
19411
|
+
throw new CodeBuddyError("invalidRequest", `Unavailable ${profile.displayName} ${id2} selection`);
|
|
19412
|
+
return confirmedConfiguration(await request(id2, value), id2, value, profile);
|
|
19413
|
+
}
|
|
19414
|
+
async function restoreConfiguration(config2, saved, profile, request) {
|
|
19415
|
+
const selections = [
|
|
19416
|
+
["model", saved.effectiveModel?.id],
|
|
19417
|
+
["thought_level", saved.effectiveThinkingOptionId],
|
|
19418
|
+
["mode", saved.effectivePermissionModeId]
|
|
19419
|
+
];
|
|
19420
|
+
const matches = (id2, value) => config2.options.some((option) => option.id === id2 && option.currentValue === value);
|
|
19421
|
+
for (const [id2, value] of selections) {
|
|
19422
|
+
if (value && !matches(id2, value))
|
|
19423
|
+
config2 = await selectConfiguration(config2, id2, value, profile, request);
|
|
19424
|
+
}
|
|
19425
|
+
for (const [id2, value] of selections) {
|
|
19426
|
+
if (value && !matches(id2, value))
|
|
19427
|
+
throw new CodeBuddyError("protocolError", `ACP did not restore ${id2}`);
|
|
19428
|
+
}
|
|
19429
|
+
return config2;
|
|
19430
|
+
}
|
|
19431
|
+
function confirmedConfiguration(response, id2, value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
19093
19432
|
const result = configuration(record3(response).configOptions, profile);
|
|
19094
|
-
if (result.options.find((option) => option.id ===
|
|
19095
|
-
throw new CodeBuddyError("protocolError", `ACP did not confirm ${
|
|
19433
|
+
if (result.options.find((option) => option.id === id2)?.currentValue !== value) {
|
|
19434
|
+
throw new CodeBuddyError("protocolError", `ACP did not confirm ${id2}`);
|
|
19096
19435
|
}
|
|
19097
19436
|
return result;
|
|
19098
19437
|
}
|
|
@@ -19728,8 +20067,8 @@ var CodeBuddyTurnOutput = class {
|
|
|
19728
20067
|
this.#textItems.set(type, item2);
|
|
19729
20068
|
this.#start(item2);
|
|
19730
20069
|
}
|
|
19731
|
-
const
|
|
19732
|
-
if (this.#finished.has(
|
|
20070
|
+
const id3 = item2.itemId;
|
|
20071
|
+
if (this.#finished.has(id3))
|
|
19733
20072
|
throw new CodeBuddyError("protocolError", "Text arrived after Item completion");
|
|
19734
20073
|
if (item2.text.length + delta.length > 2e6)
|
|
19735
20074
|
throw new CodeBuddyError("protocolError", "Agent output exceeded the supported Item size");
|
|
@@ -19737,7 +20076,7 @@ var CodeBuddyTurnOutput = class {
|
|
|
19737
20076
|
this.emit({
|
|
19738
20077
|
type: "item.updated",
|
|
19739
20078
|
turnId: this.turnId,
|
|
19740
|
-
itemId:
|
|
20079
|
+
itemId: id3,
|
|
19741
20080
|
update: { type: "text.append", text: delta }
|
|
19742
20081
|
});
|
|
19743
20082
|
return;
|
|
@@ -19758,8 +20097,8 @@ var CodeBuddyTurnOutput = class {
|
|
|
19758
20097
|
if (!terminal && !record3(merged._meta)["codebuddy.ai/toolArgumentsComplete"])
|
|
19759
20098
|
return;
|
|
19760
20099
|
const name = text(record3(merged._meta)["codebuddy.ai/toolName"]) || text(merged.title) || `${this.profile.displayName} tool`;
|
|
19761
|
-
const
|
|
19762
|
-
let item = this.#items.get(
|
|
20100
|
+
const id2 = `tool-${callId}`;
|
|
20101
|
+
let item = this.#items.get(id2)?.item;
|
|
19763
20102
|
if (!item) {
|
|
19764
20103
|
this.completeMessage();
|
|
19765
20104
|
item = toolItem(callId, name, merged.rawInput, this.cwd);
|
|
@@ -19833,13 +20172,13 @@ var CodeBuddyTurnOutput = class {
|
|
|
19833
20172
|
};
|
|
19834
20173
|
|
|
19835
20174
|
// ../codebuddy/dist/subagent-tool.js
|
|
19836
|
-
var validCodeBuddyChildId = (
|
|
20175
|
+
var validCodeBuddyChildId = (id2) => /^agent-[a-zA-Z0-9_-]{1,100}$/u.test(id2);
|
|
19837
20176
|
function codeBuddyChildId(value) {
|
|
19838
20177
|
const row = record3(value);
|
|
19839
20178
|
const structured = text(record3(record3(record3(row.providerData).toolResult).subAgent).sessionId);
|
|
19840
20179
|
const body = contentText(row.rawOutput ?? row.output);
|
|
19841
|
-
const
|
|
19842
|
-
return
|
|
20180
|
+
const id2 = structured || /\[Agent ID: (agent-[a-zA-Z0-9_-]+)\]\s*$/u.exec(body)?.[1];
|
|
20181
|
+
return id2 && validCodeBuddyChildId(id2) ? id2 : void 0;
|
|
19843
20182
|
}
|
|
19844
20183
|
function codeBuddyDelegation(callId, input, status, childId, displayName = "CodeBuddy") {
|
|
19845
20184
|
const args = record3(input);
|
|
@@ -20017,10 +20356,10 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
|
|
|
20017
20356
|
const checkedDirectories = /* @__PURE__ */ new Set();
|
|
20018
20357
|
const inheritedRows = /* @__PURE__ */ new Map();
|
|
20019
20358
|
for (const row of transaction?.inheritedContents ? parseRows(transaction.inheritedContents) : []) {
|
|
20020
|
-
const
|
|
20021
|
-
const candidates2 = inheritedRows.get(
|
|
20359
|
+
const id2 = text(row.id);
|
|
20360
|
+
const candidates2 = inheritedRows.get(id2) ?? [];
|
|
20022
20361
|
candidates2.push(row);
|
|
20023
|
-
inheritedRows.set(
|
|
20362
|
+
inheritedRows.set(id2, candidates2);
|
|
20024
20363
|
}
|
|
20025
20364
|
const inherited = (row) => inheritedRows.get(text(row.id))?.some((candidate) => isDeepStrictEqual(candidate, row)) === true;
|
|
20026
20365
|
if (transaction) {
|
|
@@ -20042,15 +20381,15 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
|
|
|
20042
20381
|
} else if (provenance) {
|
|
20043
20382
|
if (!await sameCwd(provenance.boundCwd, cwd) || provenance.targetProjectSlug !== slug || path3.resolve(file2) !== path3.resolve(primary))
|
|
20044
20383
|
throw new CodeBuddyError("invalidRequest", "Derived Native Session target binding changed");
|
|
20045
|
-
const
|
|
20046
|
-
if (provenance.inheritedPrefixRows >
|
|
20384
|
+
const active2 = nativeHistoryRows(parsed.contents);
|
|
20385
|
+
if (provenance.inheritedPrefixRows > active2.length || nativeRowsDigest(active2.slice(0, provenance.inheritedPrefixRows)) !== provenance.inheritedPrefixSha256)
|
|
20047
20386
|
throw new CodeBuddyError("protocolError", "Derived Native Session prefix verification failed");
|
|
20048
20387
|
const marker = parsed.rows.find((row) => text(row.id) === provenance.bindingMarkerId);
|
|
20049
20388
|
if (!marker || marker.sessionId !== ref.nativeSessionId || typeof marker.cwd !== "string" || !await sameCwd(marker.cwd, cwd))
|
|
20050
20389
|
throw new CodeBuddyError("protocolError", "Derived Native Session target marker is missing");
|
|
20051
20390
|
checkedDirectories.add(cwd);
|
|
20052
20391
|
const verifiedSuffixCwds = /* @__PURE__ */ new Set();
|
|
20053
|
-
for (const row of
|
|
20392
|
+
for (const row of active2.slice(provenance.inheritedPrefixRows)) {
|
|
20054
20393
|
if (row.sessionId && row.sessionId !== ref.nativeSessionId)
|
|
20055
20394
|
throw new CodeBuddyError("protocolError", "Derived Native Session appended foreign history");
|
|
20056
20395
|
if (typeof row.cwd === "string" && !verifiedSuffixCwds.has(row.cwd)) {
|
|
@@ -20467,14 +20806,14 @@ async function readCodeBuddyUsage(file2, signal) {
|
|
|
20467
20806
|
sessionId ??= row.sessionId;
|
|
20468
20807
|
cwd ??= row.cwd;
|
|
20469
20808
|
const data = record4(row.providerData);
|
|
20470
|
-
const
|
|
20471
|
-
if (!
|
|
20809
|
+
const id2 = typeof data.messageId === "string" ? data.messageId : "";
|
|
20810
|
+
if (!id2 || Object.keys(record4(data.rawUsage)).length === 0)
|
|
20472
20811
|
continue;
|
|
20473
|
-
messages.set(
|
|
20812
|
+
messages.set(id2, { data, at: messages.get(id2)?.at ?? nativeTimeMs(row.timestamp) });
|
|
20474
20813
|
}
|
|
20475
20814
|
const entries = [];
|
|
20476
|
-
for (const [
|
|
20477
|
-
const request = providerUsageRequest(
|
|
20815
|
+
for (const [id2, { data, at }] of messages) {
|
|
20816
|
+
const request = providerUsageRequest(id2, data, false);
|
|
20478
20817
|
const entry = request && at !== null && usageEntryFromRequest(request, at);
|
|
20479
20818
|
if (entry) {
|
|
20480
20819
|
const credits = record4(data.rawUsage).credit;
|
|
@@ -20494,7 +20833,7 @@ function createCodeBuddyUsageStatistics(environment, profile) {
|
|
|
20494
20833
|
return Object.freeze({
|
|
20495
20834
|
// projects/<project>/<session>.jsonl and <session>/subagents/*.jsonl
|
|
20496
20835
|
listSources: (signal) => jsonlUsageSources(path4.join(codeBuddyConfigRoot(environment, profile), "projects"), 3, signal),
|
|
20497
|
-
readSource: (
|
|
20836
|
+
readSource: (id2, signal) => readCodeBuddyUsage(id2, signal)
|
|
20498
20837
|
});
|
|
20499
20838
|
}
|
|
20500
20839
|
|
|
@@ -22357,8 +22696,8 @@ var RequestResponder = class {
|
|
|
22357
22696
|
signal;
|
|
22358
22697
|
finishRequest;
|
|
22359
22698
|
didRespond = false;
|
|
22360
|
-
constructor(
|
|
22361
|
-
this.id =
|
|
22699
|
+
constructor(id2, sendResult, signal = new AbortController().signal, finishRequest) {
|
|
22700
|
+
this.id = id2;
|
|
22362
22701
|
this.sendResult = sendResult;
|
|
22363
22702
|
this.signal = signal;
|
|
22364
22703
|
this.finishRequest = finishRequest;
|
|
@@ -22649,7 +22988,7 @@ var Connection = class {
|
|
|
22649
22988
|
return this.sendWireMessage({ jsonrpc: "2.0", method, params });
|
|
22650
22989
|
}
|
|
22651
22990
|
prepareRequest(method, params, mapResponse, options = {}) {
|
|
22652
|
-
const
|
|
22991
|
+
const id2 = this.nextRequestId++;
|
|
22653
22992
|
let cancel = () => {
|
|
22654
22993
|
};
|
|
22655
22994
|
const response = new Promise((resolve, reject) => {
|
|
@@ -22669,7 +23008,7 @@ var Connection = class {
|
|
|
22669
23008
|
}
|
|
22670
23009
|
pendingResponse.cancellationSent = true;
|
|
22671
23010
|
pendingResponse.cleanup?.();
|
|
22672
|
-
void this.sendCancelRequest(
|
|
23011
|
+
void this.sendCancelRequest(id2).catch(() => {
|
|
22673
23012
|
});
|
|
22674
23013
|
};
|
|
22675
23014
|
options.cancellationSignal?.addEventListener("abort", cancel, {
|
|
@@ -22678,12 +23017,12 @@ var Connection = class {
|
|
|
22678
23017
|
pendingResponse.cleanup = () => {
|
|
22679
23018
|
options.cancellationSignal?.removeEventListener("abort", cancel);
|
|
22680
23019
|
};
|
|
22681
|
-
this.pendingResponses.set(
|
|
23020
|
+
this.pendingResponses.set(id2, pendingResponse);
|
|
22682
23021
|
});
|
|
22683
23022
|
response.catch(() => {
|
|
22684
23023
|
});
|
|
22685
23024
|
return {
|
|
22686
|
-
message: { jsonrpc: "2.0", id, method, params },
|
|
23025
|
+
message: { jsonrpc: "2.0", id: id2, method, params },
|
|
22687
23026
|
response,
|
|
22688
23027
|
cancel: () => cancel()
|
|
22689
23028
|
};
|
|
@@ -23320,7 +23659,7 @@ function memoryStreamPair() {
|
|
|
23320
23659
|
}
|
|
23321
23660
|
];
|
|
23322
23661
|
}
|
|
23323
|
-
var
|
|
23662
|
+
var methods2 = {
|
|
23324
23663
|
agent: {
|
|
23325
23664
|
initialize: AGENT_METHODS.initialize,
|
|
23326
23665
|
authenticate: AGENT_METHODS.authenticate,
|
|
@@ -24763,10 +25102,10 @@ function executableExtensions(command, platform, environment) {
|
|
|
24763
25102
|
return [""];
|
|
24764
25103
|
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
24765
25104
|
}
|
|
24766
|
-
function isExecutableFile(
|
|
25105
|
+
function isExecutableFile(filePath2, platform) {
|
|
24767
25106
|
try {
|
|
24768
|
-
fs.accessSync(
|
|
24769
|
-
return fs.statSync(
|
|
25107
|
+
fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
25108
|
+
return fs.statSync(filePath2).isFile();
|
|
24770
25109
|
} catch {
|
|
24771
25110
|
return false;
|
|
24772
25111
|
}
|
|
@@ -25728,12 +26067,12 @@ function referencedChildren(rows2) {
|
|
|
25728
26067
|
function assertChildRanges(rows2, child) {
|
|
25729
26068
|
const positions = /* @__PURE__ */ new Map();
|
|
25730
26069
|
for (const [index, row] of rows2.entries()) {
|
|
25731
|
-
const
|
|
25732
|
-
if (!
|
|
26070
|
+
const id2 = text(row.id);
|
|
26071
|
+
if (!id2)
|
|
25733
26072
|
continue;
|
|
25734
|
-
const matches = positions.get(
|
|
26073
|
+
const matches = positions.get(id2) ?? [];
|
|
25735
26074
|
matches.push(index);
|
|
25736
|
-
positions.set(
|
|
26075
|
+
positions.set(id2, matches);
|
|
25737
26076
|
}
|
|
25738
26077
|
let previous = -1;
|
|
25739
26078
|
for (const range of child.ranges) {
|
|
@@ -26271,13 +26610,13 @@ var CodeBuddySessionImport = class {
|
|
|
26271
26610
|
}
|
|
26272
26611
|
listCandidates() {
|
|
26273
26612
|
return this.#scope.read(async (signal) => {
|
|
26274
|
-
const
|
|
26613
|
+
const active2 = await this.#activeSessions(signal);
|
|
26275
26614
|
const candidates = [];
|
|
26276
26615
|
for (const [nativeSessionId, files] of await this.#sessionFiles(signal)) {
|
|
26277
26616
|
if (files.length !== 1 || !files[0])
|
|
26278
26617
|
continue;
|
|
26279
26618
|
try {
|
|
26280
|
-
const source = await this.#source(nativeSessionId, files[0],
|
|
26619
|
+
const source = await this.#source(nativeSessionId, files[0], active2, signal);
|
|
26281
26620
|
if (source)
|
|
26282
26621
|
candidates.push(source.candidate);
|
|
26283
26622
|
} catch (error51) {
|
|
@@ -26304,7 +26643,7 @@ var CodeBuddySessionImport = class {
|
|
|
26304
26643
|
}
|
|
26305
26644
|
/** IDs a live native process registered in `<config>/sessions/<pid>.json`. */
|
|
26306
26645
|
async #activeSessions(signal) {
|
|
26307
|
-
const
|
|
26646
|
+
const active2 = /* @__PURE__ */ new Set();
|
|
26308
26647
|
const directory = path9.join(this.#root(), "sessions");
|
|
26309
26648
|
const markers = await opendir2(directory).catch((error51) => {
|
|
26310
26649
|
if (isMissingFileError(error51) || record3(error51).code === "ENOTDIR")
|
|
@@ -26312,7 +26651,7 @@ var CodeBuddySessionImport = class {
|
|
|
26312
26651
|
throw error51;
|
|
26313
26652
|
});
|
|
26314
26653
|
if (!markers)
|
|
26315
|
-
return
|
|
26654
|
+
return active2;
|
|
26316
26655
|
for await (const marker of markers) {
|
|
26317
26656
|
signal.throwIfAborted();
|
|
26318
26657
|
if (!marker.isFile() || !marker.name.endsWith(".json"))
|
|
@@ -26323,14 +26662,14 @@ var CodeBuddySessionImport = class {
|
|
|
26323
26662
|
continue;
|
|
26324
26663
|
const entry = record3(JSON.parse(await readFile4(file2, { encoding: "utf8", signal })));
|
|
26325
26664
|
if (typeof entry.sessionId === "string" && processAlive(entry.pid))
|
|
26326
|
-
|
|
26665
|
+
active2.add(entry.sessionId);
|
|
26327
26666
|
} catch (error51) {
|
|
26328
26667
|
signal.throwIfAborted();
|
|
26329
26668
|
if (isStorageAccessError(error51))
|
|
26330
26669
|
throw error51;
|
|
26331
26670
|
}
|
|
26332
26671
|
}
|
|
26333
|
-
return
|
|
26672
|
+
return active2;
|
|
26334
26673
|
}
|
|
26335
26674
|
/** Session ID to every project file claiming it. Enumerated links are not followed. */
|
|
26336
26675
|
async #sessionFiles(signal) {
|
|
@@ -26365,7 +26704,7 @@ var CodeBuddySessionImport = class {
|
|
|
26365
26704
|
}
|
|
26366
26705
|
return found;
|
|
26367
26706
|
}
|
|
26368
|
-
async #source(nativeSessionId, file2,
|
|
26707
|
+
async #source(nativeSessionId, file2, active2, signal) {
|
|
26369
26708
|
signal.throwIfAborted();
|
|
26370
26709
|
return readStableFiles([file2], async ([info]) => {
|
|
26371
26710
|
if (!info?.isFile() || info.size === 0 || info.size > MAX_HISTORY_BYTES)
|
|
@@ -26392,7 +26731,7 @@ var CodeBuddySessionImport = class {
|
|
|
26392
26731
|
title: facts.title,
|
|
26393
26732
|
updatedAt: facts.updatedAt ?? info.mtimeMs,
|
|
26394
26733
|
// A registered live process holds the Session. Absence is not proof of idleness.
|
|
26395
|
-
running:
|
|
26734
|
+
running: active2.has(nativeSessionId) ? true : null
|
|
26396
26735
|
});
|
|
26397
26736
|
return candidate ? { candidate, nativeRef } : null;
|
|
26398
26737
|
} catch (error51) {
|
|
@@ -26662,10 +27001,10 @@ var CodeBuddyChildObserver = class {
|
|
|
26662
27001
|
throw new CodeBuddyError("unsupported", "Too many native Subagent transcripts");
|
|
26663
27002
|
const matches = [];
|
|
26664
27003
|
for (const file2 of files) {
|
|
26665
|
-
const
|
|
27004
|
+
const id2 = file2.name.slice(0, -6), data = await this.#child(directory, id2);
|
|
26666
27005
|
const first = data.entries.find((row) => row.type === "message" && row.role === "user");
|
|
26667
27006
|
if (record3(first?.providerData).conversationRequestId === requestId)
|
|
26668
|
-
matches.push(
|
|
27007
|
+
matches.push(id2);
|
|
26669
27008
|
}
|
|
26670
27009
|
if (matches.length > 1)
|
|
26671
27010
|
throw new CodeBuddyError("protocolError", "Ambiguous native Subagent correlation");
|
|
@@ -26736,8 +27075,8 @@ var CodeBuddySubagents = class {
|
|
|
26736
27075
|
hasItem(itemId) {
|
|
26737
27076
|
return [...this.#calls.values()].some((call) => call.turnId === this.#turnId && call.item.itemId === itemId);
|
|
26738
27077
|
}
|
|
26739
|
-
state(
|
|
26740
|
-
return [...this.#calls.values()].map((call) => call.item.subagents[0]).findLast((child) => child?.nativeSubagentId ===
|
|
27078
|
+
state(id2) {
|
|
27079
|
+
return [...this.#calls.values()].map((call) => call.item.subagents[0]).findLast((child) => child?.nativeSubagentId === id2);
|
|
26741
27080
|
}
|
|
26742
27081
|
project(snapshot) {
|
|
26743
27082
|
for (const turn of snapshot.turns)
|
|
@@ -26811,9 +27150,9 @@ var CodeBuddySubagents = class {
|
|
|
26811
27150
|
}
|
|
26812
27151
|
});
|
|
26813
27152
|
}
|
|
26814
|
-
const
|
|
26815
|
-
if (
|
|
26816
|
-
this.options.emit({ type: "subagent.transcript.changed", nativeSubagentId:
|
|
27153
|
+
const id2 = call.item.subagents[0]?.nativeSubagentId;
|
|
27154
|
+
if (id2)
|
|
27155
|
+
this.options.emit({ type: "subagent.transcript.changed", nativeSubagentId: id2 });
|
|
26817
27156
|
}
|
|
26818
27157
|
return true;
|
|
26819
27158
|
}
|
|
@@ -26862,25 +27201,25 @@ var CodeBuddySubagents = class {
|
|
|
26862
27201
|
if (call.observationDone)
|
|
26863
27202
|
continue;
|
|
26864
27203
|
try {
|
|
26865
|
-
const
|
|
26866
|
-
if (!
|
|
27204
|
+
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);
|
|
27205
|
+
if (!id2 || this.#closed || call.observationDone)
|
|
26867
27206
|
continue;
|
|
26868
27207
|
if (!call.item.subagents[0]?.nativeSubagentId)
|
|
26869
|
-
this.#update(call, { nativeSubagentId:
|
|
26870
|
-
const snapshot = await (this.options.read ? this.options.read(parent,
|
|
27208
|
+
this.#update(call, { nativeSubagentId: id2, subagentId: id2 });
|
|
27209
|
+
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"));
|
|
26871
27210
|
if (this.#closed || call.observationDone)
|
|
26872
27211
|
continue;
|
|
26873
27212
|
const observedModel = snapshot.turns.at(-1)?.model ?? snapshot.state?.effectiveModel;
|
|
26874
27213
|
const reasoningEffort = snapshot.state?.effectiveThinkingOptionId;
|
|
26875
27214
|
if (observedModel || reasoningEffort)
|
|
26876
27215
|
this.#update(call, {
|
|
26877
|
-
...observedModel ? { model:
|
|
27216
|
+
...observedModel ? { model: observedModel.id } : {},
|
|
26878
27217
|
...reasoningEffort ? { reasoningEffort } : {}
|
|
26879
27218
|
});
|
|
26880
27219
|
const signature = JSON.stringify(snapshot);
|
|
26881
27220
|
if (signature !== call.signature) {
|
|
26882
27221
|
call.signature = signature;
|
|
26883
|
-
this.options.emit({ type: "subagent.transcript.changed", nativeSubagentId:
|
|
27222
|
+
this.options.emit({ type: "subagent.transcript.changed", nativeSubagentId: id2 });
|
|
26884
27223
|
}
|
|
26885
27224
|
} catch {
|
|
26886
27225
|
}
|
|
@@ -26940,7 +27279,8 @@ var CodeBuddySession = class {
|
|
|
26940
27279
|
subagents;
|
|
26941
27280
|
#client;
|
|
26942
27281
|
#generation = 0;
|
|
26943
|
-
#
|
|
27282
|
+
#needsResume = false;
|
|
27283
|
+
#replay;
|
|
26944
27284
|
#interactions;
|
|
26945
27285
|
#config;
|
|
26946
27286
|
#ref;
|
|
@@ -26992,22 +27332,31 @@ var CodeBuddySession = class {
|
|
|
26992
27332
|
ephemeral: false,
|
|
26993
27333
|
handlers: {
|
|
26994
27334
|
fault: (error51) => {
|
|
26995
|
-
if (generation
|
|
27335
|
+
if (generation !== this.#generation || this.#closed)
|
|
27336
|
+
return;
|
|
27337
|
+
if (this.#replay)
|
|
27338
|
+
this.#replay.fault ??= { error: error51 };
|
|
27339
|
+
else
|
|
26996
27340
|
this.#onFault(error51);
|
|
26997
27341
|
},
|
|
26998
27342
|
update: (notification) => {
|
|
26999
|
-
if (generation !== this.#generation || this.#closed)
|
|
27343
|
+
if (generation !== this.#generation || this.#closed || this.#fault)
|
|
27000
27344
|
return;
|
|
27001
27345
|
if (this.#ref && notification.sessionId !== this.#ref.nativeSessionId)
|
|
27002
27346
|
return;
|
|
27003
27347
|
try {
|
|
27004
27348
|
const update = record3(notification.update);
|
|
27005
27349
|
if (nativeCommandsEnabled(this.profile) && update.sessionUpdate === "available_commands_update") {
|
|
27006
|
-
if (!this.profile.staticCommandCatalog)
|
|
27007
|
-
|
|
27350
|
+
if (!this.profile.staticCommandCatalog) {
|
|
27351
|
+
const commands = commandCatalog(update.availableCommands, this.profile);
|
|
27352
|
+
if (this.#replay)
|
|
27353
|
+
this.#replay.commands = commands;
|
|
27354
|
+
else
|
|
27355
|
+
this.#commands = commands;
|
|
27356
|
+
}
|
|
27008
27357
|
return;
|
|
27009
27358
|
}
|
|
27010
|
-
if (this.#
|
|
27359
|
+
if (this.#replay)
|
|
27011
27360
|
return;
|
|
27012
27361
|
if ((text(record3(update._meta)["codebuddy.ai/parentToolCallId"]) || !this.#active?.output.hasItem(`tool-${text(update.toolCallId)}`)) && this.subagents.update(update))
|
|
27013
27362
|
return;
|
|
@@ -27024,19 +27373,31 @@ var CodeBuddySession = class {
|
|
|
27024
27373
|
}
|
|
27025
27374
|
this.#active?.output.update(update);
|
|
27026
27375
|
} catch (error51) {
|
|
27027
|
-
this.#
|
|
27376
|
+
if (this.#replay)
|
|
27377
|
+
this.#replay.fault ??= { error: error51 };
|
|
27378
|
+
else
|
|
27379
|
+
this.#onFault(error51);
|
|
27028
27380
|
}
|
|
27029
27381
|
},
|
|
27030
|
-
permission: (request) => generation === this.#generation && !this.#
|
|
27031
|
-
question: (params) => generation === this.#generation && !this.#
|
|
27382
|
+
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" } }),
|
|
27383
|
+
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" })
|
|
27032
27384
|
}
|
|
27033
27385
|
});
|
|
27034
27386
|
}
|
|
27387
|
+
#assertClient(generation) {
|
|
27388
|
+
if (this.#closed || this.#fault || generation !== this.#generation)
|
|
27389
|
+
throw new CodeBuddyError("invalidState", "ACP client is no longer current");
|
|
27390
|
+
if (this.#replay?.fault)
|
|
27391
|
+
throw this.#replay.fault.error;
|
|
27392
|
+
}
|
|
27035
27393
|
/** Every fresh process must restore an unanchored rewind before it can accept prompts. */
|
|
27036
27394
|
async #openClient() {
|
|
27395
|
+
const client2 = this.#client;
|
|
27396
|
+
const generation = this.#generation;
|
|
27037
27397
|
let rewind;
|
|
27038
27398
|
if (this.#ref) {
|
|
27039
|
-
const history = await this
|
|
27399
|
+
const history = await this.#history(this.#ref);
|
|
27400
|
+
this.#assertClient(generation);
|
|
27040
27401
|
this.#hasTurn = snapshotFromHistory(history, this.#ref, this.input.cwd, this.profile).turns.length > 0;
|
|
27041
27402
|
this.#usage = historyUsage(history);
|
|
27042
27403
|
this.#meterHistory(history, true);
|
|
@@ -27044,15 +27405,19 @@ var CodeBuddySession = class {
|
|
|
27044
27405
|
} else {
|
|
27045
27406
|
this.#emit({ type: "usage.history", complete: true });
|
|
27046
27407
|
}
|
|
27047
|
-
|
|
27048
|
-
|
|
27408
|
+
this.#assertClient(generation);
|
|
27409
|
+
await client2.initialize();
|
|
27410
|
+
this.#assertClient(generation);
|
|
27411
|
+
const opened = await client2.open(this.input.cwd, this.#ref?.nativeSessionId);
|
|
27412
|
+
this.#assertClient(generation);
|
|
27049
27413
|
const sessionId = this.#ref?.nativeSessionId ?? text(opened.sessionId);
|
|
27050
27414
|
if (!sessionId || opened.sessionId && opened.sessionId !== sessionId)
|
|
27051
27415
|
throw new CodeBuddyError("protocolError", "ACP returned a different Native Session identity");
|
|
27052
27416
|
if (rewind) {
|
|
27053
|
-
if (!
|
|
27417
|
+
if (!client2.rollback)
|
|
27054
27418
|
throw new CodeBuddyError("unsupported", "Native history rewind is unavailable");
|
|
27055
|
-
const result = await
|
|
27419
|
+
const result = await client2.rollback(sessionId, rewind.forkPointId);
|
|
27420
|
+
this.#assertClient(generation);
|
|
27056
27421
|
if (result.applied !== true || (result.actualForkPointId ?? null) !== rewind.forkPointId)
|
|
27057
27422
|
throw new CodeBuddyError("nativeFailure", "Native history rewind was not confirmed");
|
|
27058
27423
|
}
|
|
@@ -27080,7 +27445,7 @@ var CodeBuddySession = class {
|
|
|
27080
27445
|
} else if (this.input.permissionModeId || text(saved.mode))
|
|
27081
27446
|
await this.#configure("mode", this.input.permissionModeId ?? text(saved.mode));
|
|
27082
27447
|
if (this.input.model || text(saved.model))
|
|
27083
|
-
await this.#configure("model", this.input.model
|
|
27448
|
+
await this.#configure("model", this.input.model?.id ?? text(saved.model));
|
|
27084
27449
|
if (this.input.thinkingOptionId || text(saved.thinking))
|
|
27085
27450
|
await this.#configure("thought_level", this.input.thinkingOptionId ?? text(saved.thinking));
|
|
27086
27451
|
if (this.#fault || this.#closed)
|
|
@@ -27123,7 +27488,7 @@ var CodeBuddySession = class {
|
|
|
27123
27488
|
locator: {
|
|
27124
27489
|
...record3(this.#ref.locator),
|
|
27125
27490
|
configuration: {
|
|
27126
|
-
model: config2.state.effectiveModel
|
|
27491
|
+
model: config2.state.effectiveModel?.id ?? "",
|
|
27127
27492
|
mode: config2.state.effectivePermissionModeId ?? "",
|
|
27128
27493
|
thinking: config2.state.effectiveThinkingOptionId ?? ""
|
|
27129
27494
|
}
|
|
@@ -27133,45 +27498,57 @@ var CodeBuddySession = class {
|
|
|
27133
27498
|
if (emit)
|
|
27134
27499
|
this.#emit({ type: "session.state.changed", state: this.#state });
|
|
27135
27500
|
}
|
|
27136
|
-
|
|
27137
|
-
const
|
|
27138
|
-
const
|
|
27139
|
-
const
|
|
27140
|
-
if (!
|
|
27141
|
-
throw new CodeBuddyError("invalidRequest", `Unavailable ${this.profile.displayName} ${id} selection`);
|
|
27142
|
-
if (!this.#ref)
|
|
27501
|
+
#configurationRequest() {
|
|
27502
|
+
const generation = this.#generation;
|
|
27503
|
+
const client2 = this.#client;
|
|
27504
|
+
const sessionId = this.#ref?.nativeSessionId;
|
|
27505
|
+
if (!sessionId)
|
|
27143
27506
|
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
27144
|
-
|
|
27145
|
-
|
|
27146
|
-
|
|
27147
|
-
|
|
27507
|
+
return async (id2, value) => {
|
|
27508
|
+
this.#assertClient(generation);
|
|
27509
|
+
const result = await client2.configure(sessionId, id2, value);
|
|
27510
|
+
this.#assertClient(generation);
|
|
27511
|
+
return result;
|
|
27512
|
+
};
|
|
27148
27513
|
}
|
|
27149
|
-
async #
|
|
27150
|
-
|
|
27151
|
-
|
|
27514
|
+
async #configure(id2, value) {
|
|
27515
|
+
const generation = this.#generation;
|
|
27516
|
+
const confirmed = await selectConfiguration(this.#config, id2, value, this.profile, this.#configurationRequest());
|
|
27517
|
+
this.#assertClient(generation);
|
|
27518
|
+
this.#apply(confirmed);
|
|
27519
|
+
}
|
|
27520
|
+
async #history(ref) {
|
|
27152
27521
|
try {
|
|
27153
|
-
|
|
27154
|
-
this.#usage = historyUsage(history);
|
|
27155
|
-
this.#meterHistory(history, false);
|
|
27156
|
-
return {
|
|
27157
|
-
...this.subagents.project(snapshotFromHistory(history, this.#ref, this.input.cwd, this.profile)),
|
|
27158
|
-
state: this.#state
|
|
27159
|
-
};
|
|
27522
|
+
return await this.readHistory(this.input.cwd, ref, this.environment, this.profile);
|
|
27160
27523
|
} catch (error51) {
|
|
27161
27524
|
if (!this.#hasTurn && this.input.kind === "create" && error51 instanceof CodeBuddyError && error51.code === "sessionNotFound")
|
|
27162
|
-
return
|
|
27525
|
+
return "";
|
|
27163
27526
|
throw error51;
|
|
27164
27527
|
}
|
|
27165
27528
|
}
|
|
27529
|
+
async #snapshot(historyTimeout) {
|
|
27530
|
+
if (!this.#ref)
|
|
27531
|
+
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
27532
|
+
const read = this.#history(this.#ref);
|
|
27533
|
+
const history = historyTimeout ? await bounded(read, historyTimeout, "Native Turn history read") : await read;
|
|
27534
|
+
if (this.#closed || this.#fault)
|
|
27535
|
+
throw new CodeBuddyError("invalidState", "Session closed during history read");
|
|
27536
|
+
const snapshot = snapshotFromHistory(history, this.#ref, this.input.cwd, this.profile);
|
|
27537
|
+
if (snapshot.turns.length)
|
|
27538
|
+
this.#hasTurn = true;
|
|
27539
|
+
this.#usage = historyUsage(history);
|
|
27540
|
+
this.#meterHistory(history, false);
|
|
27541
|
+
return { ...this.subagents.project(snapshot), state: this.#state };
|
|
27542
|
+
}
|
|
27166
27543
|
/** Read persisted request usage without waiting for the ACP prompt (including tool waits). */
|
|
27167
27544
|
async refreshUsage() {
|
|
27168
|
-
if (this.#refreshingUsage || this.#closed || this.#fault || this.#
|
|
27545
|
+
if (this.#refreshingUsage || this.#closed || this.#fault || this.#replay || !this.#ref)
|
|
27169
27546
|
return;
|
|
27170
27547
|
this.#refreshingUsage = true;
|
|
27171
|
-
const
|
|
27548
|
+
const active2 = this.#active, generation = this.#generation;
|
|
27172
27549
|
try {
|
|
27173
27550
|
const history = await this.readHistory(this.input.cwd, this.#ref, this.environment, this.profile);
|
|
27174
|
-
if (this.#closed || this.#fault || this.#active !==
|
|
27551
|
+
if (this.#closed || this.#fault || this.#active !== active2 || this.#generation !== generation)
|
|
27175
27552
|
return;
|
|
27176
27553
|
this.#usage = historyUsage(history);
|
|
27177
27554
|
this.#meterHistory(history, false);
|
|
@@ -27183,7 +27560,7 @@ var CodeBuddySession = class {
|
|
|
27183
27560
|
}
|
|
27184
27561
|
#subagentConfiguration() {
|
|
27185
27562
|
const state = this.#state;
|
|
27186
|
-
const model2 = state.effectiveModel
|
|
27563
|
+
const model2 = state.effectiveModel?.id;
|
|
27187
27564
|
return {
|
|
27188
27565
|
...model2 ? { model: model2 } : {},
|
|
27189
27566
|
...state.effectiveThinkingOptionId ? { reasoningEffort: state.effectiveThinkingOptionId } : {}
|
|
@@ -27208,19 +27585,16 @@ var CodeBuddySession = class {
|
|
|
27208
27585
|
}
|
|
27209
27586
|
}
|
|
27210
27587
|
async #executeCommand(command) {
|
|
27211
|
-
const
|
|
27212
|
-
if (!parsed.ok)
|
|
27213
|
-
return parsed;
|
|
27214
|
-
const result = await this.#execute({ type: "turn.start", turnId: command.turnId, input: [{ type: "text", text: parsed.value }] }, true);
|
|
27588
|
+
const result = await this.#execute({ ...command, type: "command.execute" });
|
|
27215
27589
|
return result.ok ? { ok: true, value: { turnId: command.turnId } } : result;
|
|
27216
27590
|
}
|
|
27217
27591
|
async execute(command) {
|
|
27218
27592
|
const invocation = command.type === "turn.start" ? command.input.map((item) => item.text).join("\n").trim().split(/\s/u)[0] : void 0;
|
|
27219
27593
|
if (nativeCommandsEnabled(this.profile) && isExcludedInvocation(invocation))
|
|
27220
27594
|
return failure("unsupported", "Command is not available in this Session", this.profile);
|
|
27221
|
-
return this.#execute(command,
|
|
27595
|
+
return this.#execute(command, invocation);
|
|
27222
27596
|
}
|
|
27223
|
-
async #execute(command,
|
|
27597
|
+
async #execute(command, invocation) {
|
|
27224
27598
|
if (this.#closed || this.#fault)
|
|
27225
27599
|
return failure("invalidState", "Session is closed or faulted", this.profile);
|
|
27226
27600
|
if (command.type === "turn.steer")
|
|
@@ -27228,35 +27602,58 @@ var CodeBuddySession = class {
|
|
|
27228
27602
|
if (command.type === "interaction.respond")
|
|
27229
27603
|
return this.#interactions.respond(command);
|
|
27230
27604
|
if (command.type === "turn.cancel") {
|
|
27231
|
-
const
|
|
27232
|
-
if (!
|
|
27605
|
+
const active2 = this.#active;
|
|
27606
|
+
if (!active2 || active2.command.turnId !== command.turnId || !this.#ref)
|
|
27233
27607
|
return failure("invalidRequest", "Turn is not active", this.profile);
|
|
27234
|
-
if (!
|
|
27235
|
-
|
|
27608
|
+
if (!active2.cancelled) {
|
|
27609
|
+
active2.cancelled = true;
|
|
27610
|
+
const generation = this.#generation;
|
|
27236
27611
|
try {
|
|
27237
|
-
|
|
27612
|
+
const requested = this.#client.cancel(this.#ref.nativeSessionId);
|
|
27613
|
+
this.#interactions.close();
|
|
27614
|
+
await requested;
|
|
27238
27615
|
} catch (error51) {
|
|
27239
|
-
this.#
|
|
27240
|
-
|
|
27616
|
+
if (generation === this.#generation) {
|
|
27617
|
+
if (this.#active === active2)
|
|
27618
|
+
this.#onFault(error51);
|
|
27619
|
+
return { ok: false, error: nativeError(error51, this.profile) };
|
|
27620
|
+
}
|
|
27621
|
+
}
|
|
27622
|
+
if (this.#active === active2 && !this.#closed) {
|
|
27623
|
+
void bounded(active2.completion, 3e4, "ACP cancel acknowledgement").catch((error51) => {
|
|
27624
|
+
if (this.#active === active2 && !this.#needsResume)
|
|
27625
|
+
this.#onFault(error51);
|
|
27626
|
+
});
|
|
27241
27627
|
}
|
|
27242
|
-
this.#interactions.close();
|
|
27243
|
-
void bounded(active.completion, 3e4, "ACP cancel acknowledgement").catch((error51) => this.#onFault(error51));
|
|
27244
27628
|
}
|
|
27245
27629
|
return { ok: true, value: { cancellationRequested: true } };
|
|
27246
27630
|
}
|
|
27247
|
-
if (this.#busy || this.#active && command.type !== "model.select" && command.type !== "thinking.select")
|
|
27631
|
+
if (this.#busy || this.#active && (this.#active.cancelled || command.type !== "model.select" && command.type !== "thinking.select"))
|
|
27248
27632
|
return failure("sessionBusy", "Session is executing an operation", this.profile);
|
|
27249
27633
|
this.#busy = true;
|
|
27250
27634
|
try {
|
|
27251
|
-
if (command.type === "turn.start") {
|
|
27252
|
-
if (!command.turnId.trim() || !command.input.length || command.input.some((item) => item.type !== "text") || !command.input.map((item) => item.text).join("").trim())
|
|
27635
|
+
if (command.type === "turn.start" || command.type === "command.execute") {
|
|
27636
|
+
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()))
|
|
27253
27637
|
return failure("invalidRequest", "A nonempty text prompt is required", this.profile);
|
|
27638
|
+
if (this.#needsResume)
|
|
27639
|
+
await this.#resumeClient();
|
|
27640
|
+
const nativeCommand = command.type === "command.execute" || nativeCommandsEnabled(this.profile) && this.#commands.commands.some((entry) => entry.invocation === invocation);
|
|
27641
|
+
if (command.type === "command.execute") {
|
|
27642
|
+
const parsed = commandPrompt(command, this.#commands, this.profile);
|
|
27643
|
+
if (!parsed.ok)
|
|
27644
|
+
return parsed;
|
|
27645
|
+
command = {
|
|
27646
|
+
type: "turn.start",
|
|
27647
|
+
turnId: command.turnId,
|
|
27648
|
+
input: [{ type: "text", text: parsed.value }]
|
|
27649
|
+
};
|
|
27650
|
+
}
|
|
27254
27651
|
const snapshot = await this.#snapshot();
|
|
27255
27652
|
const before = new Set(snapshot.turns.map((turn) => turn.nativeTurnRef.nativeTurnKey));
|
|
27256
27653
|
const beforeItems = new Set(snapshot.turns.flatMap((turn) => turn.items.map((snapshot2) => snapshot2.item.itemId)));
|
|
27257
27654
|
if (this.#closed || this.#fault)
|
|
27258
27655
|
return failure("invalidState", "Session closed before Turn start", this.profile);
|
|
27259
|
-
const
|
|
27656
|
+
const active2 = {
|
|
27260
27657
|
command,
|
|
27261
27658
|
before,
|
|
27262
27659
|
beforeItems,
|
|
@@ -27266,15 +27663,15 @@ var CodeBuddySession = class {
|
|
|
27266
27663
|
done: false,
|
|
27267
27664
|
completion: Promise.resolve()
|
|
27268
27665
|
};
|
|
27269
|
-
this.#active =
|
|
27666
|
+
this.#active = active2;
|
|
27270
27667
|
this.subagents.begin(command.turnId);
|
|
27271
|
-
if (!nativeCommand)
|
|
27272
|
-
this.#hasTurn = true;
|
|
27273
27668
|
this.#emit({ type: "turn.started", turnId: command.turnId });
|
|
27274
|
-
|
|
27669
|
+
active2.completion = this.#run(active2);
|
|
27275
27670
|
return { ok: true, value: { turnId: command.turnId } };
|
|
27276
27671
|
}
|
|
27277
|
-
|
|
27672
|
+
if (this.#needsResume)
|
|
27673
|
+
await this.#resumeClient();
|
|
27674
|
+
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);
|
|
27278
27675
|
return { ok: true, value: { completed: true } };
|
|
27279
27676
|
} catch (error51) {
|
|
27280
27677
|
return { ok: false, error: nativeError(error51, this.profile) };
|
|
@@ -27282,12 +27679,13 @@ var CodeBuddySession = class {
|
|
|
27282
27679
|
this.#busy = false;
|
|
27283
27680
|
}
|
|
27284
27681
|
}
|
|
27285
|
-
async #run(
|
|
27682
|
+
async #run(active2) {
|
|
27683
|
+
let cancellationConfirmed = false;
|
|
27286
27684
|
try {
|
|
27287
27685
|
if (!this.#ref)
|
|
27288
27686
|
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
27289
|
-
const response = await this.#client.prompt(this.#ref.nativeSessionId,
|
|
27290
|
-
if (
|
|
27687
|
+
const response = await this.#client.prompt(this.#ref.nativeSessionId, active2.command.input.map((item) => item.text).join("\n"));
|
|
27688
|
+
if (active2.done || this.#closed)
|
|
27291
27689
|
return;
|
|
27292
27690
|
const stop = response.stopReason, meta3 = record3(response._meta);
|
|
27293
27691
|
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.
|
|
@@ -27296,77 +27694,90 @@ var CodeBuddySession = class {
|
|
|
27296
27694
|
status: "failed",
|
|
27297
27695
|
error: nativeTurnError(stop, meta3, this.profile)
|
|
27298
27696
|
};
|
|
27299
|
-
|
|
27300
|
-
|
|
27301
|
-
|
|
27697
|
+
if (outcome.status === "cancelled") {
|
|
27698
|
+
active2.cancelled = true;
|
|
27699
|
+
++this.#generation;
|
|
27700
|
+
this.#interactions.close();
|
|
27701
|
+
try {
|
|
27702
|
+
await this.#client.close();
|
|
27703
|
+
} catch (error51) {
|
|
27704
|
+
this.#onFault(error51);
|
|
27705
|
+
return;
|
|
27706
|
+
}
|
|
27707
|
+
if (active2.done || this.#closed)
|
|
27708
|
+
return;
|
|
27709
|
+
this.#needsResume = true;
|
|
27710
|
+
cancellationConfirmed = true;
|
|
27711
|
+
}
|
|
27712
|
+
const snapshot = await this.#snapshot(cancellationConfirmed ? 1e3 : void 0);
|
|
27713
|
+
if (active2.done || this.#closed)
|
|
27714
|
+
return;
|
|
27715
|
+
const added = snapshot.turns.filter((turn) => !active2.before.has(turn.nativeTurnRef.nativeTurnKey));
|
|
27716
|
+
if (added.length > 1 || !active2.nativeCommand && outcome.status === "succeeded" && added.length !== 1)
|
|
27302
27717
|
throw new CodeBuddyError("protocolError", "Could not identify exactly one persisted Native Turn");
|
|
27303
|
-
active.output.confirmCompaction(snapshot.turns.flatMap((turn) => turn.items).filter((snapshot2) => !active.beforeItems.has(snapshot2.item.itemId)));
|
|
27304
|
-
if (active.nativeCommand)
|
|
27305
|
-
active.output.replayCommandResult((added[0]?.items ?? []).filter(({ item }) => !this.subagents.hasItem(item.itemId)));
|
|
27306
27718
|
const nativeTurnRef = added[0]?.nativeTurnRef;
|
|
27307
|
-
if (nativeTurnRef)
|
|
27308
|
-
this.#hasTurn = true;
|
|
27309
27719
|
if (response.userMessageId && nativeTurnRef?.nativeTurnKey !== response.userMessageId)
|
|
27310
27720
|
throw new CodeBuddyError("protocolError", "ACP terminal and native history disagree on Turn identity");
|
|
27311
|
-
|
|
27312
|
-
|
|
27313
|
-
|
|
27721
|
+
active2.output.confirmCompaction(snapshot.turns.flatMap((turn) => turn.items).filter((snapshot2) => !active2.beforeItems.has(snapshot2.item.itemId)));
|
|
27722
|
+
if (active2.nativeCommand)
|
|
27723
|
+
active2.output.replayCommandResult((added[0]?.items ?? []).filter(({ item }) => !this.subagents.hasItem(item.itemId)));
|
|
27724
|
+
const compactCommand = outcome.status !== "cancelled" && active2.nativeCommand && /^\/compact(?:\s|$)/u.test(active2.command.input.map((item) => item.text).join("\n").trim());
|
|
27314
27725
|
const persisted = compactCommand ? added[0]?.outcome : void 0;
|
|
27315
27726
|
if (compactCommand && (!persisted || persisted.status === "unknown"))
|
|
27316
27727
|
throw new CodeBuddyError("protocolError", "Native compaction terminal outcome was not persisted");
|
|
27317
27728
|
const terminalOutcome = persisted && persisted.status !== "unknown" ? persisted : outcome;
|
|
27318
|
-
this.#finish(
|
|
27729
|
+
this.#finish(active2, {
|
|
27319
27730
|
...terminalOutcome,
|
|
27320
27731
|
...added[0]?.checkpoint ? { checkpoint: added[0].checkpoint } : {}
|
|
27321
27732
|
}, nativeTurnRef);
|
|
27322
27733
|
if (this.#usage)
|
|
27323
27734
|
this.#emitUsage();
|
|
27324
27735
|
} catch (error51) {
|
|
27325
|
-
if (!
|
|
27326
|
-
this.#finish(
|
|
27736
|
+
if (!active2.done && !this.#closed)
|
|
27737
|
+
this.#finish(active2, cancellationConfirmed ? { status: "cancelled" } : { status: "failed", error: nativeError(error51, this.profile) });
|
|
27327
27738
|
}
|
|
27328
27739
|
}
|
|
27329
|
-
|
|
27330
|
-
|
|
27331
|
-
|
|
27332
|
-
|
|
27333
|
-
|
|
27334
|
-
this.#replaying = true;
|
|
27335
|
-
++this.#generation;
|
|
27740
|
+
/** Runs only under the native operation gate, after the old process has exited. */
|
|
27741
|
+
async #resumeClient() {
|
|
27742
|
+
const replay = {};
|
|
27743
|
+
this.#replay = replay;
|
|
27744
|
+
let candidate;
|
|
27336
27745
|
try {
|
|
27337
|
-
|
|
27338
|
-
|
|
27339
|
-
return;
|
|
27340
|
-
this.#client = this.#createClient();
|
|
27746
|
+
this.#client = candidate = this.#createClient();
|
|
27747
|
+
const generation = this.#generation;
|
|
27341
27748
|
const loaded = await this.#openClient();
|
|
27342
|
-
|
|
27343
|
-
|
|
27344
|
-
|
|
27345
|
-
if (
|
|
27346
|
-
|
|
27347
|
-
|
|
27348
|
-
await this.#configure("mode", saved.effectivePermissionModeId);
|
|
27749
|
+
const restored = await restoreConfiguration(configuration(loaded.configOptions, this.profile), this.#state, this.profile, this.#configurationRequest());
|
|
27750
|
+
this.#assertClient(generation);
|
|
27751
|
+
this.#apply(restored);
|
|
27752
|
+
if (!this.profile.staticCommandCatalog)
|
|
27753
|
+
this.#commands = replay.commands ?? { commands: [] };
|
|
27754
|
+
this.#needsResume = false;
|
|
27349
27755
|
} catch (error51) {
|
|
27350
|
-
this.#
|
|
27756
|
+
++this.#generation;
|
|
27757
|
+
try {
|
|
27758
|
+
await candidate?.close();
|
|
27759
|
+
} catch (closeError) {
|
|
27760
|
+
this.#onFault(closeError);
|
|
27761
|
+
}
|
|
27351
27762
|
throw error51;
|
|
27352
27763
|
} finally {
|
|
27353
|
-
this.#
|
|
27764
|
+
this.#replay = void 0;
|
|
27354
27765
|
}
|
|
27355
27766
|
}
|
|
27356
|
-
#finish(
|
|
27357
|
-
if (
|
|
27767
|
+
#finish(active2, outcome, nativeTurnRef) {
|
|
27768
|
+
if (active2.done)
|
|
27358
27769
|
return;
|
|
27359
|
-
|
|
27770
|
+
active2.done = true;
|
|
27360
27771
|
this.subagents.finish(outcome);
|
|
27361
27772
|
this.#interactions.close();
|
|
27362
|
-
|
|
27773
|
+
active2.output.finish(outcome.status, outcome.status === "failed" ? outcome.error : void 0);
|
|
27363
27774
|
this.#emit({
|
|
27364
27775
|
type: "turn.completed",
|
|
27365
|
-
turnId:
|
|
27776
|
+
turnId: active2.command.turnId,
|
|
27366
27777
|
outcome,
|
|
27367
27778
|
...nativeTurnRef ? { nativeTurnRef } : {}
|
|
27368
27779
|
});
|
|
27369
|
-
if (this.#active ===
|
|
27780
|
+
if (this.#active === active2)
|
|
27370
27781
|
this.#active = void 0;
|
|
27371
27782
|
}
|
|
27372
27783
|
#onFault(error51) {
|
|
@@ -27387,13 +27798,17 @@ var CodeBuddySession = class {
|
|
|
27387
27798
|
}
|
|
27388
27799
|
async #close() {
|
|
27389
27800
|
this.#closed = true;
|
|
27390
|
-
this.subagents.close();
|
|
27391
|
-
if (this.#active)
|
|
27392
|
-
this.#finish(this.#active, { status: "cancelled", reason: "Session closed" });
|
|
27393
27801
|
this.#interactions.close();
|
|
27394
27802
|
try {
|
|
27395
27803
|
await this.#client.close();
|
|
27804
|
+
if (this.#active)
|
|
27805
|
+
this.#finish(this.#active, { status: "cancelled", reason: "Session closed" });
|
|
27806
|
+
} catch (error51) {
|
|
27807
|
+
if (this.#active)
|
|
27808
|
+
this.#finish(this.#active, { status: "failed", error: nativeError(error51, this.profile) });
|
|
27809
|
+
throw error51;
|
|
27396
27810
|
} finally {
|
|
27811
|
+
this.subagents.close();
|
|
27397
27812
|
this.#channel.end();
|
|
27398
27813
|
this.onClose();
|
|
27399
27814
|
}
|
|
@@ -27403,6 +27818,7 @@ var CodeBuddySession = class {
|
|
|
27403
27818
|
// ../codebuddy/dist/codebuddy-adapter.js
|
|
27404
27819
|
var CodeBuddyAdapter = class {
|
|
27405
27820
|
options;
|
|
27821
|
+
normalizeStoredModelRef = normalizeStoredCodeBuddyModelRef;
|
|
27406
27822
|
harnessId;
|
|
27407
27823
|
commandCatalog;
|
|
27408
27824
|
liveCommandCatalog = true;
|
|
@@ -27449,7 +27865,7 @@ var CodeBuddyAdapter = class {
|
|
|
27449
27865
|
inspect(input = {}) {
|
|
27450
27866
|
const cwd = input.cwd ?? process.cwd();
|
|
27451
27867
|
if (input.refresh)
|
|
27452
|
-
this.#cache.
|
|
27868
|
+
this.#cache.clear();
|
|
27453
27869
|
let inspection = this.#cache.get(cwd);
|
|
27454
27870
|
if (!inspection) {
|
|
27455
27871
|
inspection = this.#inspect(cwd);
|
|
@@ -28056,26 +28472,26 @@ function parseWorkBuddyProductModels(value) {
|
|
|
28056
28472
|
const cli = agents.map(record5).find((agent) => nonBlank(agent.name) === "cli");
|
|
28057
28473
|
if (!Array.isArray(cli?.models))
|
|
28058
28474
|
return [];
|
|
28059
|
-
const configuredIds = new Set(cli.models
|
|
28475
|
+
const configuredIds = new Set(cli.models);
|
|
28060
28476
|
const parsed = [];
|
|
28061
28477
|
const ids = /* @__PURE__ */ new Set();
|
|
28062
28478
|
for (const value2 of models) {
|
|
28063
28479
|
const source = record5(value2);
|
|
28064
|
-
const
|
|
28480
|
+
const id2 = source.id;
|
|
28065
28481
|
const name = nonBlank(source.name);
|
|
28066
|
-
if (
|
|
28482
|
+
if (typeof id2 !== "string" || !name || !configuredIds.has(id2) || ids.has(id2))
|
|
28067
28483
|
continue;
|
|
28068
28484
|
try {
|
|
28069
|
-
modelRef(
|
|
28485
|
+
modelRef(id2);
|
|
28070
28486
|
} catch {
|
|
28071
28487
|
continue;
|
|
28072
28488
|
}
|
|
28073
|
-
ids.add(
|
|
28489
|
+
ids.add(id2);
|
|
28074
28490
|
if (name.length > HARNESS_MODEL_LABEL_MAX_LENGTH)
|
|
28075
28491
|
continue;
|
|
28076
28492
|
const credits = nonBlank(source.credits);
|
|
28077
28493
|
parsed.push({
|
|
28078
|
-
id,
|
|
28494
|
+
id: id2,
|
|
28079
28495
|
name,
|
|
28080
28496
|
...credits && credits.length <= 64 ? { credits } : {}
|
|
28081
28497
|
});
|