@codexhost/cli-linux-arm64 0.22.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 +3117 -274
- package/app/console-web.js +15645 -4413
- package/app/desktop-controller.mjs +14057 -969
- package/app/host-runtime.mjs +11518 -8277
- package/app/plugins/antigravity/plugin.mjs +2030 -678
- package/app/plugins/claude-code/plugin.mjs +2116 -929
- package/app/plugins/codebuddy/plugin.mjs +1247 -353
- package/app/plugins/codex-usage/plugin.mjs +786 -163
- package/app/plugins/copilot/plugin.mjs +938 -296
- package/app/plugins/cursor-cli/plugin.mjs +1021 -232
- package/app/plugins/deepseek-harness/plugin.mjs +1552 -664
- package/app/plugins/devin/plugin.mjs +826 -185
- package/app/plugins/grok/plugin.mjs +1083 -424
- package/app/plugins/hermes/plugin.mjs +961 -338
- package/app/plugins/kimi-code/plugin.mjs +854 -237
- package/app/plugins/kiro-cli/plugin.mjs +821 -184
- package/app/plugins/omp/plugin.mjs +1316 -633
- package/app/plugins/opencode/plugin.mjs +1293 -606
- package/app/plugins/pi/plugin.mjs +1540 -867
- package/app/plugins/qoder/plugin.mjs +961 -332
- package/app/plugins/qoder-cn/plugin.mjs +961 -332
- package/app/plugins/qwen-code/plugin.mjs +937 -321
- package/app/plugins/workbuddy/plugin.mjs +1311 -370
- package/app/plugins/zcode/plugin.mjs +1516 -423
- package/app/renderer-extension.js +21297 -9060
- package/app/web/assets/index-CTCFIQbU.css +1 -0
- package/app/web/assets/index-IvFk9KT-.js +203 -0
- package/app/web/codexhost-settings.js +6753 -31616
- 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 +14 -14
- 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 +94 -91
- 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-browser/client.js +1 -1
- 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 +79 -79
- 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/licenses/werift-NOTICES.txt +123 -0
- package/app/web-modules/licenses/werift-libwebrtc-NOTICES.txt +58 -0
- package/app/web-modules/server.mjs +40416 -11283
- 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-CN4a4sj0.js +0 -201
- package/app/web/assets/index-DJW4bmyx.css +0 -1
|
@@ -32,10 +32,10 @@ function executableExtensions(command, platform, environment) {
|
|
|
32
32
|
return [""];
|
|
33
33
|
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
34
34
|
}
|
|
35
|
-
function isExecutableFile(
|
|
35
|
+
function isExecutableFile(filePath2, platform) {
|
|
36
36
|
try {
|
|
37
|
-
fs.accessSync(
|
|
38
|
-
return fs.statSync(
|
|
37
|
+
fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
38
|
+
return fs.statSync(filePath2).isFile();
|
|
39
39
|
} catch {
|
|
40
40
|
return false;
|
|
41
41
|
}
|
|
@@ -1740,8 +1740,8 @@ function cleanEnum(obj) {
|
|
|
1740
1740
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
1741
1741
|
}).map((el) => el[1]);
|
|
1742
1742
|
}
|
|
1743
|
-
function base64ToUint8Array(
|
|
1744
|
-
const binaryString = atob(
|
|
1743
|
+
function base64ToUint8Array(base644) {
|
|
1744
|
+
const binaryString = atob(base644);
|
|
1745
1745
|
const bytes = new Uint8Array(binaryString.length);
|
|
1746
1746
|
for (let i = 0; i < binaryString.length; i++) {
|
|
1747
1747
|
bytes[i] = binaryString.charCodeAt(i);
|
|
@@ -1756,9 +1756,9 @@ function uint8ArrayToBase64(bytes) {
|
|
|
1756
1756
|
return btoa(binaryString);
|
|
1757
1757
|
}
|
|
1758
1758
|
function base64urlToUint8Array(base64url3) {
|
|
1759
|
-
const
|
|
1760
|
-
const padding = "=".repeat((4 -
|
|
1761
|
-
return base64ToUint8Array(
|
|
1759
|
+
const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
|
|
1760
|
+
const padding = "=".repeat((4 - base644.length % 4) % 4);
|
|
1761
|
+
return base64ToUint8Array(base644 + padding);
|
|
1762
1762
|
}
|
|
1763
1763
|
function uint8ArrayToBase64url(bytes) {
|
|
1764
1764
|
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
@@ -3124,8 +3124,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
3124
3124
|
function isValidBase64URL(data) {
|
|
3125
3125
|
if (!base64url.test(data))
|
|
3126
3126
|
return false;
|
|
3127
|
-
const
|
|
3128
|
-
const padded =
|
|
3127
|
+
const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
3128
|
+
const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
|
|
3129
3129
|
return isValidBase64(padded);
|
|
3130
3130
|
}
|
|
3131
3131
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
@@ -3579,42 +3579,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3579
3579
|
}
|
|
3580
3580
|
doc.write(`const newResult = {};`);
|
|
3581
3581
|
for (const key of normalized.keys) {
|
|
3582
|
-
const
|
|
3582
|
+
const id2 = ids[key];
|
|
3583
3583
|
const k = esc(key);
|
|
3584
3584
|
const schema = shape[key];
|
|
3585
3585
|
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
3586
3586
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
3587
|
-
doc.write(`const ${
|
|
3587
|
+
doc.write(`const ${id2} = ${parseStr(key)};`);
|
|
3588
3588
|
if (isOptionalIn && isOptionalOut) {
|
|
3589
3589
|
doc.write(`
|
|
3590
|
-
if (${
|
|
3590
|
+
if (${id2}.issues.length) {
|
|
3591
3591
|
if (${k} in input) {
|
|
3592
|
-
payload.issues = payload.issues.concat(${
|
|
3592
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3593
3593
|
...iss,
|
|
3594
3594
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3595
3595
|
})));
|
|
3596
3596
|
}
|
|
3597
3597
|
}
|
|
3598
3598
|
|
|
3599
|
-
if (${
|
|
3599
|
+
if (${id2}.value === undefined) {
|
|
3600
3600
|
if (${k} in input) {
|
|
3601
3601
|
newResult[${k}] = undefined;
|
|
3602
3602
|
}
|
|
3603
3603
|
} else {
|
|
3604
|
-
newResult[${k}] = ${
|
|
3604
|
+
newResult[${k}] = ${id2}.value;
|
|
3605
3605
|
}
|
|
3606
3606
|
|
|
3607
3607
|
`);
|
|
3608
3608
|
} else if (!isOptionalIn) {
|
|
3609
3609
|
doc.write(`
|
|
3610
|
-
const ${
|
|
3611
|
-
if (${
|
|
3612
|
-
payload.issues = payload.issues.concat(${
|
|
3610
|
+
const ${id2}_present = ${k} in input;
|
|
3611
|
+
if (${id2}.issues.length) {
|
|
3612
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3613
3613
|
...iss,
|
|
3614
3614
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3615
3615
|
})));
|
|
3616
3616
|
}
|
|
3617
|
-
if (!${
|
|
3617
|
+
if (!${id2}_present && !${id2}.issues.length) {
|
|
3618
3618
|
payload.issues.push({
|
|
3619
3619
|
code: "invalid_type",
|
|
3620
3620
|
expected: "nonoptional",
|
|
@@ -3623,30 +3623,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3623
3623
|
});
|
|
3624
3624
|
}
|
|
3625
3625
|
|
|
3626
|
-
if (${
|
|
3627
|
-
if (${
|
|
3626
|
+
if (${id2}_present) {
|
|
3627
|
+
if (${id2}.value === undefined) {
|
|
3628
3628
|
newResult[${k}] = undefined;
|
|
3629
3629
|
} else {
|
|
3630
|
-
newResult[${k}] = ${
|
|
3630
|
+
newResult[${k}] = ${id2}.value;
|
|
3631
3631
|
}
|
|
3632
3632
|
}
|
|
3633
3633
|
|
|
3634
3634
|
`);
|
|
3635
3635
|
} else {
|
|
3636
3636
|
doc.write(`
|
|
3637
|
-
if (${
|
|
3638
|
-
payload.issues = payload.issues.concat(${
|
|
3637
|
+
if (${id2}.issues.length) {
|
|
3638
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3639
3639
|
...iss,
|
|
3640
3640
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3641
3641
|
})));
|
|
3642
3642
|
}
|
|
3643
3643
|
|
|
3644
|
-
if (${
|
|
3644
|
+
if (${id2}.value === undefined) {
|
|
3645
3645
|
if (${k} in input) {
|
|
3646
3646
|
newResult[${k}] = undefined;
|
|
3647
3647
|
}
|
|
3648
3648
|
} else {
|
|
3649
|
-
newResult[${k}] = ${
|
|
3649
|
+
newResult[${k}] = ${id2}.value;
|
|
3650
3650
|
}
|
|
3651
3651
|
|
|
3652
3652
|
`);
|
|
@@ -11978,26 +11978,26 @@ function extractDefs(ctx, schema) {
|
|
|
11978
11978
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
11979
11979
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
11980
11980
|
for (const entry of ctx.seen.entries()) {
|
|
11981
|
-
const
|
|
11982
|
-
if (
|
|
11983
|
-
const existing = idToSchema.get(
|
|
11981
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11982
|
+
if (id2) {
|
|
11983
|
+
const existing = idToSchema.get(id2);
|
|
11984
11984
|
if (existing && existing !== entry[0]) {
|
|
11985
|
-
throw new Error(`Duplicate schema id "${
|
|
11985
|
+
throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
11986
11986
|
}
|
|
11987
|
-
idToSchema.set(
|
|
11987
|
+
idToSchema.set(id2, entry[0]);
|
|
11988
11988
|
}
|
|
11989
11989
|
}
|
|
11990
11990
|
const makeURI = (entry) => {
|
|
11991
11991
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
11992
11992
|
if (ctx.external) {
|
|
11993
11993
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
11994
|
-
const uriGenerator = ctx.external.uri ?? ((
|
|
11994
|
+
const uriGenerator = ctx.external.uri ?? ((id3) => id3);
|
|
11995
11995
|
if (externalId) {
|
|
11996
11996
|
return { ref: uriGenerator(externalId) };
|
|
11997
11997
|
}
|
|
11998
|
-
const
|
|
11999
|
-
entry[1].defId =
|
|
12000
|
-
return { defId:
|
|
11998
|
+
const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
11999
|
+
entry[1].defId = id2;
|
|
12000
|
+
return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
|
|
12001
12001
|
}
|
|
12002
12002
|
if (entry[1] === root) {
|
|
12003
12003
|
return { ref: "#" };
|
|
@@ -12045,8 +12045,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12045
12045
|
continue;
|
|
12046
12046
|
}
|
|
12047
12047
|
}
|
|
12048
|
-
const
|
|
12049
|
-
if (
|
|
12048
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
12049
|
+
if (id2) {
|
|
12050
12050
|
extractToDef(entry);
|
|
12051
12051
|
continue;
|
|
12052
12052
|
}
|
|
@@ -12142,10 +12142,10 @@ function finalize(ctx, schema) {
|
|
|
12142
12142
|
} else {
|
|
12143
12143
|
}
|
|
12144
12144
|
if (ctx.external?.uri) {
|
|
12145
|
-
const
|
|
12146
|
-
if (!
|
|
12145
|
+
const id2 = ctx.external.registry.get(schema)?.id;
|
|
12146
|
+
if (!id2)
|
|
12147
12147
|
throw new Error("Schema is missing an `id` property");
|
|
12148
|
-
result.$id = ctx.external.uri(
|
|
12148
|
+
result.$id = ctx.external.uri(id2);
|
|
12149
12149
|
}
|
|
12150
12150
|
Object.assign(result, root.def ?? root.schema);
|
|
12151
12151
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
@@ -12305,9 +12305,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
12305
12305
|
json2.type = "number";
|
|
12306
12306
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
12307
12307
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
12308
|
-
const
|
|
12308
|
+
const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
12309
12309
|
if (exMin) {
|
|
12310
|
-
if (
|
|
12310
|
+
if (legacy2) {
|
|
12311
12311
|
json2.minimum = exclusiveMinimum;
|
|
12312
12312
|
json2.exclusiveMinimum = true;
|
|
12313
12313
|
} else {
|
|
@@ -12317,7 +12317,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
12317
12317
|
json2.minimum = minimum;
|
|
12318
12318
|
}
|
|
12319
12319
|
if (exMax) {
|
|
12320
|
-
if (
|
|
12320
|
+
if (legacy2) {
|
|
12321
12321
|
json2.maximum = exclusiveMaximum;
|
|
12322
12322
|
json2.exclusiveMaximum = true;
|
|
12323
12323
|
} else {
|
|
@@ -13179,7 +13179,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
13179
13179
|
|
|
13180
13180
|
// ../../../node_modules/zod/v4/classic/schemas.js
|
|
13181
13181
|
var _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
13182
|
-
function _installLazyMethods(inst, group,
|
|
13182
|
+
function _installLazyMethods(inst, group, methods3) {
|
|
13183
13183
|
const proto = Object.getPrototypeOf(inst);
|
|
13184
13184
|
let installed = _installedGroups.get(proto);
|
|
13185
13185
|
if (!installed) {
|
|
@@ -13189,8 +13189,8 @@ function _installLazyMethods(inst, group, methods2) {
|
|
|
13189
13189
|
if (installed.has(group))
|
|
13190
13190
|
return;
|
|
13191
13191
|
installed.add(group);
|
|
13192
|
-
for (const key in
|
|
13193
|
-
const fn =
|
|
13192
|
+
for (const key in methods3) {
|
|
13193
|
+
const fn = methods3[key];
|
|
13194
13194
|
Object.defineProperty(proto, key, {
|
|
13195
13195
|
configurable: true,
|
|
13196
13196
|
enumerable: false,
|
|
@@ -15134,6 +15134,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
|
15134
15134
|
permissionModeId: harnessPermissionModeIdSchema
|
|
15135
15135
|
}).strict();
|
|
15136
15136
|
|
|
15137
|
+
// ../../shared-contracts/dist/harness-route-limit.js
|
|
15138
|
+
var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
|
|
15139
|
+
|
|
15137
15140
|
// ../../shared-contracts/dist/thread-usage.js
|
|
15138
15141
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15139
15142
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -15166,7 +15169,7 @@ var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
|
15166
15169
|
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
15167
15170
|
label: indicatorTextSchema(256).optional(),
|
|
15168
15171
|
tooltip: indicatorTextSchema(1024).optional()
|
|
15169
|
-
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) =>
|
|
15172
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
|
|
15170
15173
|
message: "Composer indicator IDs must be unique"
|
|
15171
15174
|
});
|
|
15172
15175
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
@@ -15192,6 +15195,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
15192
15195
|
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
15193
15196
|
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
15194
15197
|
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15198
|
+
latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15195
15199
|
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
15196
15200
|
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
15197
15201
|
}).strict().superRefine((usage, context) => {
|
|
@@ -15289,6 +15293,13 @@ var accountCreditsSnapshotSchema = external_exports.object({
|
|
|
15289
15293
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
15290
15294
|
resetCredits: accountResetCreditsSchema.optional()
|
|
15291
15295
|
}).strict();
|
|
15296
|
+
var accountBalanceSnapshotSchema = external_exports.object({
|
|
15297
|
+
amount: external_exports.number().finite().nonnegative(),
|
|
15298
|
+
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
15299
|
+
currency: external_exports.string().trim().min(1).max(8),
|
|
15300
|
+
/** Native label when the Harness exposes several Billing Sources. */
|
|
15301
|
+
label: external_exports.string().trim().min(1).max(128).optional()
|
|
15302
|
+
}).strict();
|
|
15292
15303
|
var threadUsageInspectionParamsSchema = external_exports.object({
|
|
15293
15304
|
threadId: hostThreadIdSchema,
|
|
15294
15305
|
refresh: external_exports.literal("exact").optional()
|
|
@@ -15297,7 +15308,10 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
15297
15308
|
threadId: hostThreadIdSchema,
|
|
15298
15309
|
usage: threadUsageSnapshotSchema.nullable(),
|
|
15299
15310
|
accountCredits: accountCreditsSnapshotSchema.optional(),
|
|
15300
|
-
/**
|
|
15311
|
+
/** Prepaid funds for the Thread's Billing Source; shown only when no percentage quota exists. */
|
|
15312
|
+
accountBalance: accountBalanceSnapshotSchema.optional(),
|
|
15313
|
+
/** Whether this source can provide cached account quota (credits or a prepaid balance)
|
|
15314
|
+
* independently of usage. */
|
|
15301
15315
|
accountCreditsSupported: external_exports.boolean().optional()
|
|
15302
15316
|
}).strict();
|
|
15303
15317
|
|
|
@@ -15309,10 +15323,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
|
15309
15323
|
var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15310
15324
|
message: "Value must not be empty or whitespace"
|
|
15311
15325
|
});
|
|
15312
|
-
var harnessModelRefIdSchema =
|
|
15326
|
+
var harnessModelRefIdSchema = external_exports.string().min(1).max(HARNESS_MODEL_REF_MAX_LENGTH).refine((id2) => !new RegExp("\\p{Cc}", "u").test(id2), "Model Ref must not contain control characters").brand();
|
|
15327
|
+
var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
|
|
15313
15328
|
var harnessModelRefSchema = external_exports.object({
|
|
15314
|
-
id: harnessModelRefIdSchema
|
|
15329
|
+
id: harnessModelRefIdSchema,
|
|
15330
|
+
serviceTier: harnessModelServiceTierSchema.optional()
|
|
15315
15331
|
}).strict();
|
|
15332
|
+
function sameHarnessModelRef(left, right) {
|
|
15333
|
+
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
15334
|
+
}
|
|
15316
15335
|
var harnessThinkingOptionIdSchema = nonBlankTextSchema2.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
|
|
15317
15336
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
15318
15337
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
@@ -15326,7 +15345,15 @@ var harnessModelSchema = external_exports.object({
|
|
|
15326
15345
|
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
15327
15346
|
fastModel: harnessModelRefSchema.optional(),
|
|
15328
15347
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
15329
|
-
}).strict()
|
|
15348
|
+
}).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
|
|
15349
|
+
path: ["fastModel", "id"],
|
|
15350
|
+
message: "A tiered Fast Model must share the base Model ID"
|
|
15351
|
+
});
|
|
15352
|
+
function catalogModelForRef(catalog, ref) {
|
|
15353
|
+
if (!ref)
|
|
15354
|
+
return void 0;
|
|
15355
|
+
return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
|
|
15356
|
+
}
|
|
15330
15357
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
15331
15358
|
const ids = /* @__PURE__ */ new Set();
|
|
15332
15359
|
for (const [index, option] of options.entries()) {
|
|
@@ -15346,26 +15373,26 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15346
15373
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
15347
15374
|
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
15348
15375
|
}).strict().superRefine((catalog, context) => {
|
|
15349
|
-
const refs =
|
|
15350
|
-
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) =>
|
|
15376
|
+
const refs = [];
|
|
15377
|
+
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
|
|
15351
15378
|
for (const [index, model2] of catalog.models.entries()) {
|
|
15352
|
-
if (refs.
|
|
15379
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
|
|
15353
15380
|
context.addIssue({
|
|
15354
15381
|
code: "custom",
|
|
15355
15382
|
message: "Model Catalog refs must be unique",
|
|
15356
15383
|
path: ["models", index, "ref", "id"]
|
|
15357
15384
|
});
|
|
15358
15385
|
}
|
|
15359
|
-
refs.
|
|
15386
|
+
refs.push(model2.ref);
|
|
15360
15387
|
if (model2.fastModel) {
|
|
15361
|
-
if (refs.
|
|
15388
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
|
|
15362
15389
|
context.addIssue({
|
|
15363
15390
|
code: "custom",
|
|
15364
15391
|
message: "Fast Model refs must be distinct and unique",
|
|
15365
15392
|
path: ["models", index, "fastModel"]
|
|
15366
15393
|
});
|
|
15367
15394
|
}
|
|
15368
|
-
refs.
|
|
15395
|
+
refs.push(model2.fastModel);
|
|
15369
15396
|
}
|
|
15370
15397
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
15371
15398
|
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
@@ -15386,7 +15413,7 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15386
15413
|
}
|
|
15387
15414
|
}
|
|
15388
15415
|
}
|
|
15389
|
-
if (catalog.defaultModel && !
|
|
15416
|
+
if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
|
|
15390
15417
|
context.addIssue({
|
|
15391
15418
|
code: "custom",
|
|
15392
15419
|
message: "Default Model must exist in the Model Catalog",
|
|
@@ -15426,7 +15453,12 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
15426
15453
|
observe: external_exports.boolean()
|
|
15427
15454
|
}).strict().optional(),
|
|
15428
15455
|
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15429
|
-
steer: external_exports.boolean().optional()
|
|
15456
|
+
steer: external_exports.boolean().optional(),
|
|
15457
|
+
/**
|
|
15458
|
+
* True when the native plan (task list) outlives the Turn that changed it, so a reopened
|
|
15459
|
+
* Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
|
|
15460
|
+
*/
|
|
15461
|
+
persistentPlan: external_exports.boolean().optional()
|
|
15430
15462
|
}).strict();
|
|
15431
15463
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
15432
15464
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -15435,7 +15467,7 @@ var harnessConfigurationStateSchema = external_exports.object({
|
|
|
15435
15467
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15436
15468
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
15437
15469
|
}).strict().superRefine((state, context) => {
|
|
15438
|
-
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) =>
|
|
15470
|
+
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
|
|
15439
15471
|
context.addIssue({
|
|
15440
15472
|
code: "custom",
|
|
15441
15473
|
message: "Effective Thinking option must be currently available",
|
|
@@ -15475,7 +15507,8 @@ var harnessInspectParamsSchema = external_exports.object({
|
|
|
15475
15507
|
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
15476
15508
|
refresh: external_exports.boolean().optional(),
|
|
15477
15509
|
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
15478
|
-
purpose: external_exports.literal("availability").optional()
|
|
15510
|
+
purpose: external_exports.literal("availability").optional(),
|
|
15511
|
+
credentialAccess: external_exports.enum(["allow", "retry"]).optional()
|
|
15479
15512
|
}).strict();
|
|
15480
15513
|
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15481
15514
|
harnessId: harnessIdSchema
|
|
@@ -15506,7 +15539,7 @@ var codexThreadInspectionSchema = external_exports.object({
|
|
|
15506
15539
|
var externalThreadInspectionSchema = external_exports.object({
|
|
15507
15540
|
owner: external_exports.literal("external"),
|
|
15508
15541
|
harnessId: nonBlankTextSchema2.max(256),
|
|
15509
|
-
transportModelId: nonBlankTextSchema2.max(
|
|
15542
|
+
transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
|
|
15510
15543
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
15511
15544
|
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15512
15545
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -15588,13 +15621,635 @@ var threadSteeringInspectResultSchema = external_exports.object({
|
|
|
15588
15621
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15589
15622
|
}).strict();
|
|
15590
15623
|
|
|
15624
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
15625
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15626
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
15627
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
15628
|
+
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
15629
|
+
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
15630
|
+
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
|
|
15631
|
+
var pluginRelativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
15632
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
15633
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
15634
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
15635
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
15636
|
+
before: localizedTextSchema.optional(),
|
|
15637
|
+
after: localizedTextSchema.optional(),
|
|
15638
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
15639
|
+
}).strict();
|
|
15640
|
+
var pluginPresentationShape = {
|
|
15641
|
+
id: installedHarnessPluginIdSchema,
|
|
15642
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
15643
|
+
version: external_exports.string().min(1).max(128),
|
|
15644
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
15645
|
+
kind: external_exports.literal("usage").optional(),
|
|
15646
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
15647
|
+
iconStyle: external_exports.object({
|
|
15648
|
+
vector: external_exports.object({
|
|
15649
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
15650
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
15651
|
+
paths: external_exports.array(external_exports.object({
|
|
15652
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
15653
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
15654
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
15655
|
+
}).strict()).min(1).max(32)
|
|
15656
|
+
}).strict().optional(),
|
|
15657
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
15658
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
15659
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
15660
|
+
}).strict().optional(),
|
|
15661
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
15662
|
+
notice: localizedTextSchema.optional(),
|
|
15663
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
15664
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
15665
|
+
links: external_exports.object({
|
|
15666
|
+
website: documentationUrlSchema.optional(),
|
|
15667
|
+
documentation: documentationUrlSchema.optional(),
|
|
15668
|
+
installation: documentationUrlSchema.optional()
|
|
15669
|
+
}).strict().optional()
|
|
15670
|
+
};
|
|
15671
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
15672
|
+
manifestVersion: external_exports.literal(1),
|
|
15673
|
+
...pluginPresentationShape,
|
|
15674
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
15675
|
+
entry: pluginRelativeResourceSchema,
|
|
15676
|
+
icon: pluginRelativeResourceSchema.optional()
|
|
15677
|
+
}).strict();
|
|
15678
|
+
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
15679
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
15680
|
+
...pluginPresentationShape,
|
|
15681
|
+
icon: harnessPluginIconSchema.optional()
|
|
15682
|
+
}).strict();
|
|
15683
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
15684
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
15685
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
15686
|
+
}).strict();
|
|
15687
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
15688
|
+
version: external_exports.literal(1),
|
|
15689
|
+
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15690
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
15691
|
+
message: "Enabled plugin IDs must be unique",
|
|
15692
|
+
path: ["enabled"]
|
|
15693
|
+
});
|
|
15694
|
+
|
|
15695
|
+
// ../../shared-contracts/dist/desktop-extensions.js
|
|
15696
|
+
var DESKTOP_EXTENSION_API_VERSION = 1;
|
|
15697
|
+
var DESKTOP_EXTENSION_LIMIT = 64;
|
|
15698
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
|
|
15699
|
+
var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
|
|
15700
|
+
var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
|
|
15701
|
+
var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
|
|
15702
|
+
var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
|
|
15703
|
+
var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
|
|
15704
|
+
var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
|
|
15705
|
+
var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
|
|
15706
|
+
var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
15707
|
+
var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
|
|
15708
|
+
var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
|
|
15709
|
+
var desktopExtensionIdSchema = installedPluginIdSchema;
|
|
15710
|
+
var desktopExtensionSlotSchema = external_exports.enum([
|
|
15711
|
+
"sidebar.thread-layout",
|
|
15712
|
+
"sidebar.thread-badge",
|
|
15713
|
+
"appearance.theme"
|
|
15714
|
+
]);
|
|
15715
|
+
var desktopExtensionCategorySchema = external_exports.enum([
|
|
15716
|
+
"appearance",
|
|
15717
|
+
"interface",
|
|
15718
|
+
"workflow",
|
|
15719
|
+
"analytics",
|
|
15720
|
+
"integrations",
|
|
15721
|
+
"tools"
|
|
15722
|
+
]);
|
|
15723
|
+
var extensionName = external_exports.string().trim().min(1).max(128);
|
|
15724
|
+
function desktopExtensionScreenshotMimeType(resource) {
|
|
15725
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
15726
|
+
case "png":
|
|
15727
|
+
return "image/png";
|
|
15728
|
+
case "jpg":
|
|
15729
|
+
case "jpeg":
|
|
15730
|
+
return "image/jpeg";
|
|
15731
|
+
case "webp":
|
|
15732
|
+
return "image/webp";
|
|
15733
|
+
default:
|
|
15734
|
+
return void 0;
|
|
15735
|
+
}
|
|
15736
|
+
}
|
|
15737
|
+
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
15738
|
+
var imagePathSchema = pluginRelativeResourceSchema.refine((resource) => desktopExtensionScreenshotMimeType(resource) !== void 0 && hasPortableSegments(resource), "Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space");
|
|
15739
|
+
var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu, "Expected an HTTP(S) URL").pipe(external_exports.url({ protocol: /^https?$/u })).refine((value) => {
|
|
15740
|
+
const { username, password } = new URL(value);
|
|
15741
|
+
return !username && !password && !/[\\\s]/u.test(value);
|
|
15742
|
+
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15743
|
+
function localizedText(text2) {
|
|
15744
|
+
return external_exports.strictObject({ en: text2, "zh-CN": text2 });
|
|
15745
|
+
}
|
|
15746
|
+
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15747
|
+
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
15748
|
+
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
15749
|
+
var settingField = {
|
|
15750
|
+
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
15751
|
+
label: desktopExtensionLocalizedTextSchema,
|
|
15752
|
+
description: desktopExtensionLocalizedTextSchema.optional()
|
|
15753
|
+
};
|
|
15754
|
+
var numericSetting = {
|
|
15755
|
+
...settingField,
|
|
15756
|
+
step: external_exports.number().positive().optional(),
|
|
15757
|
+
default: external_exports.number().optional()
|
|
15758
|
+
};
|
|
15759
|
+
var settingOption = external_exports.strictObject({
|
|
15760
|
+
value: external_exports.string(),
|
|
15761
|
+
label: desktopExtensionLocalizedTextSchema
|
|
15762
|
+
});
|
|
15763
|
+
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
15764
|
+
external_exports.strictObject({
|
|
15765
|
+
...settingField,
|
|
15766
|
+
type: external_exports.literal("boolean"),
|
|
15767
|
+
default: external_exports.boolean().optional()
|
|
15768
|
+
}),
|
|
15769
|
+
external_exports.strictObject({
|
|
15770
|
+
...settingField,
|
|
15771
|
+
type: external_exports.literal("string"),
|
|
15772
|
+
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
15773
|
+
default: external_exports.string().optional()
|
|
15774
|
+
}),
|
|
15775
|
+
external_exports.strictObject({
|
|
15776
|
+
...numericSetting,
|
|
15777
|
+
type: external_exports.literal("number"),
|
|
15778
|
+
min: external_exports.number().optional(),
|
|
15779
|
+
max: external_exports.number().optional()
|
|
15780
|
+
}),
|
|
15781
|
+
external_exports.strictObject({
|
|
15782
|
+
...numericSetting,
|
|
15783
|
+
type: external_exports.literal("range"),
|
|
15784
|
+
min: external_exports.number(),
|
|
15785
|
+
max: external_exports.number()
|
|
15786
|
+
}),
|
|
15787
|
+
external_exports.strictObject({
|
|
15788
|
+
...settingField,
|
|
15789
|
+
type: external_exports.literal("select"),
|
|
15790
|
+
options: external_exports.array(settingOption).min(1),
|
|
15791
|
+
default: external_exports.string().optional()
|
|
15792
|
+
})
|
|
15793
|
+
]).superRefine((field2, ctx) => {
|
|
15794
|
+
const issue2 = (path12, message) => ctx.addIssue({ code: "custom", path: [path12], message });
|
|
15795
|
+
if (field2.type === "number" || field2.type === "range") {
|
|
15796
|
+
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
15797
|
+
if (min > max)
|
|
15798
|
+
issue2("max", "Must be at least min");
|
|
15799
|
+
if (value !== void 0 && (value < min || value > max))
|
|
15800
|
+
issue2("default", "Must be within min and max");
|
|
15801
|
+
} else if (field2.type === "select") {
|
|
15802
|
+
const values = new Set(field2.options.map(({ value }) => value));
|
|
15803
|
+
if (values.size !== field2.options.length)
|
|
15804
|
+
issue2("options", "Duplicate option values");
|
|
15805
|
+
if (field2.default !== void 0 && !values.has(field2.default))
|
|
15806
|
+
issue2("default", "Must match an option value");
|
|
15807
|
+
}
|
|
15808
|
+
});
|
|
15809
|
+
var manifestHeader = external_exports.object({
|
|
15810
|
+
manifestVersion: external_exports.int().positive(),
|
|
15811
|
+
id: desktopExtensionIdSchema,
|
|
15812
|
+
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
15813
|
+
version: external_exports.string().min(1).max(128),
|
|
15814
|
+
desktopApi: external_exports.int().positive()
|
|
15815
|
+
}).passthrough();
|
|
15816
|
+
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
15817
|
+
manifestVersion: external_exports.literal(1),
|
|
15818
|
+
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
15819
|
+
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
15820
|
+
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
15821
|
+
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
15822
|
+
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
15823
|
+
icon: imagePathSchema.optional(),
|
|
15824
|
+
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
15825
|
+
desktop: external_exports.strictObject({
|
|
15826
|
+
script: pluginRelativeResourceSchema,
|
|
15827
|
+
style: pluginRelativeResourceSchema.optional()
|
|
15828
|
+
}).optional(),
|
|
15829
|
+
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
15830
|
+
slots: slotsSchema.default(() => []),
|
|
15831
|
+
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
15832
|
+
categories: categoriesSchema.optional()
|
|
15833
|
+
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
15834
|
+
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
15835
|
+
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
15836
|
+
state: external_exports.enum([
|
|
15837
|
+
"running",
|
|
15838
|
+
"disabled",
|
|
15839
|
+
"invalid",
|
|
15840
|
+
"incompatible",
|
|
15841
|
+
"conflict",
|
|
15842
|
+
"failed",
|
|
15843
|
+
"waiting"
|
|
15844
|
+
]),
|
|
15845
|
+
hash: desktopExtensionHashSchema.optional(),
|
|
15846
|
+
error: external_exports.string().optional(),
|
|
15847
|
+
conflictWith: desktopExtensionIdSchema.optional()
|
|
15848
|
+
});
|
|
15849
|
+
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
15850
|
+
controllerPid: external_exports.int().positive(),
|
|
15851
|
+
targetId: external_exports.string().nullable(),
|
|
15852
|
+
updatedAt: external_exports.iso.datetime(),
|
|
15853
|
+
handledReloadToken: external_exports.uuid().optional(),
|
|
15854
|
+
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
|
|
15855
|
+
surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
|
|
15856
|
+
});
|
|
15857
|
+
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
15858
|
+
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15859
|
+
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15860
|
+
}
|
|
15861
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
15862
|
+
const url2 = new URL(input);
|
|
15863
|
+
return /\.zip$/iu.test(url2.pathname) || isGitHubDesktopExtensionZipballUrl(url2) || url2.origin === "https://github.com" && /^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(url2.pathname) || url2.origin === "https://codeload.github.com" && /^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(url2.pathname);
|
|
15864
|
+
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15865
|
+
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
15866
|
+
id: desktopExtensionIdSchema,
|
|
15867
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15868
|
+
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
15869
|
+
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
15870
|
+
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
15871
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
15872
|
+
repository: desktopExtensionHttpUrlSchema,
|
|
15873
|
+
stars: external_exports.number().int().min(0).optional(),
|
|
15874
|
+
downloads: external_exports.number().int().min(0).optional(),
|
|
15875
|
+
categories: categoriesSchema.optional(),
|
|
15876
|
+
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
15877
|
+
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
15878
|
+
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15879
|
+
downloadUrl: desktopExtensionZipUrlSchema,
|
|
15880
|
+
sha256: desktopExtensionHashSchema,
|
|
15881
|
+
slots: slotsSchema.optional(),
|
|
15882
|
+
publishedAt: external_exports.string().optional(),
|
|
15883
|
+
updatedAt: external_exports.string().optional(),
|
|
15884
|
+
minCodexHostVersion: external_exports.string().optional()
|
|
15885
|
+
});
|
|
15886
|
+
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
15887
|
+
schemaVersion: external_exports.literal(1),
|
|
15888
|
+
generatedAt: external_exports.string(),
|
|
15889
|
+
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
15890
|
+
});
|
|
15891
|
+
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
15892
|
+
|
|
15893
|
+
// ../../shared-contracts/dist/host-extensions.js
|
|
15894
|
+
var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
|
|
15895
|
+
var HOST_EXTENSION_PAGE_API_VERSION = 1;
|
|
15896
|
+
var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
|
|
15897
|
+
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
15898
|
+
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
15899
|
+
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
15900
|
+
var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((path12) => path12.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
15901
|
+
var legacy = desktopExtensionManifestSchema.shape;
|
|
15902
|
+
var localized = (max, min = 0) => external_exports.strictObject({
|
|
15903
|
+
en: external_exports.string().trim().min(min).max(max),
|
|
15904
|
+
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
15905
|
+
});
|
|
15906
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path12) => path12.endsWith(suffix), `Expected a ${suffix} file`);
|
|
15907
|
+
var moduleEntry = resourceWithSuffix(".mjs");
|
|
15908
|
+
var style = resourceWithSuffix(".css").optional();
|
|
15909
|
+
var hostExtensionCanonicalPath = (path12) => path12.normalize("NFC").toLowerCase();
|
|
15910
|
+
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
15911
|
+
manifestVersion: external_exports.literal(2),
|
|
15912
|
+
id: hostExtensionIdSchema,
|
|
15913
|
+
name: localized(128, 1),
|
|
15914
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15915
|
+
description: localized(4096),
|
|
15916
|
+
details: localized(16384).optional(),
|
|
15917
|
+
author: legacy.author,
|
|
15918
|
+
repository: legacy.repository,
|
|
15919
|
+
icon: legacy.icon.refine((path12) => path12 === void 0 || hostExtensionResourcePathSchema.safeParse(path12).success),
|
|
15920
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path12) => hostExtensionResourcePathSchema.safeParse(path12).success)),
|
|
15921
|
+
categories: legacy.categories,
|
|
15922
|
+
settingsSchema: legacy.settingsSchema,
|
|
15923
|
+
slots: legacy.slots.removeDefault().optional(),
|
|
15924
|
+
page: external_exports.strictObject({
|
|
15925
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
15926
|
+
entry: moduleEntry,
|
|
15927
|
+
style,
|
|
15928
|
+
title: localized(128, 1).optional()
|
|
15929
|
+
}).optional(),
|
|
15930
|
+
widget: external_exports.strictObject({
|
|
15931
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
15932
|
+
entry: moduleEntry,
|
|
15933
|
+
style
|
|
15934
|
+
}).optional(),
|
|
15935
|
+
desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
|
|
15936
|
+
web: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry.optional(), style }).refine(({ entry, style: style2 }) => entry !== void 0 || style2 !== void 0, "Expected a Web entry or style").optional(),
|
|
15937
|
+
backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
|
|
15938
|
+
}).refine(({ page, widget, desktop, web, backend }) => Boolean(page || widget || desktop || web || backend), "Expected at least one page, widget, desktop, web, or backend entry").refine(({ page, widget, web, backend }) => !backend || [page?.entry, widget?.entry, web?.entry].every((entry) => entry === void 0 || hostExtensionCanonicalPath(entry) !== hostExtensionCanonicalPath(backend.entry)), { path: ["backend", "entry"], message: "A backend entry cannot also be a frontend entry" });
|
|
15939
|
+
function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
|
|
15940
|
+
if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
|
|
15941
|
+
return ["desktop", "web"];
|
|
15942
|
+
const targets = [];
|
|
15943
|
+
if (hasDesktop)
|
|
15944
|
+
targets.push("desktop");
|
|
15945
|
+
if (hasWeb)
|
|
15946
|
+
targets.push("web");
|
|
15947
|
+
return targets;
|
|
15948
|
+
}
|
|
15949
|
+
var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
15950
|
+
|
|
15951
|
+
// ../../shared-contracts/dist/host-extension-management.js
|
|
15952
|
+
var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
|
|
15953
|
+
var hostExtensionRevisionSchema = external_exports.int().nonnegative();
|
|
15954
|
+
var hostExtensionConfigurationSchema = external_exports.strictObject({
|
|
15955
|
+
revision: hostExtensionRevisionSchema,
|
|
15956
|
+
enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
|
|
15957
|
+
});
|
|
15958
|
+
var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
|
|
15959
|
+
var hostExtensionCatalogEntrySchema = external_exports.object({
|
|
15960
|
+
...catalogMetadata,
|
|
15961
|
+
id: hostExtensionIdSchema,
|
|
15962
|
+
format: external_exports.literal("codexhost"),
|
|
15963
|
+
targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
|
|
15964
|
+
apis: external_exports.strictObject({
|
|
15965
|
+
page: external_exports.int().positive().optional(),
|
|
15966
|
+
widget: external_exports.int().positive().optional(),
|
|
15967
|
+
desktop: external_exports.int().positive().optional(),
|
|
15968
|
+
web: external_exports.int().positive().optional(),
|
|
15969
|
+
backend: external_exports.int().positive().optional()
|
|
15970
|
+
}),
|
|
15971
|
+
downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
|
|
15972
|
+
}).refine(({ targets, apis }) => {
|
|
15973
|
+
const derived = targetsForCapabilities({
|
|
15974
|
+
hasPage: Boolean(apis.page),
|
|
15975
|
+
hasWidget: Boolean(apis.widget),
|
|
15976
|
+
hasDesktop: Boolean(apis.desktop),
|
|
15977
|
+
hasWeb: Boolean(apis.web),
|
|
15978
|
+
hasBackend: Boolean(apis.backend)
|
|
15979
|
+
});
|
|
15980
|
+
return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
|
|
15981
|
+
}, "Catalog targets must match the declared APIs");
|
|
15982
|
+
var hostExtensionCatalogSchema = external_exports.object({
|
|
15983
|
+
schemaVersion: external_exports.literal(2),
|
|
15984
|
+
generatedAt: external_exports.string().min(1),
|
|
15985
|
+
extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
15986
|
+
});
|
|
15987
|
+
var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
|
|
15988
|
+
catalogUrl: desktopExtensionHttpUrlSchema,
|
|
15989
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
15990
|
+
cached: external_exports.boolean()
|
|
15991
|
+
});
|
|
15992
|
+
var id = { id: hostExtensionIdSchema };
|
|
15993
|
+
var active = {
|
|
15994
|
+
...id,
|
|
15995
|
+
activationId: hostExtensionActivationIdSchema,
|
|
15996
|
+
digest: hostExtensionDigestSchema
|
|
15997
|
+
};
|
|
15998
|
+
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
15999
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path12) => /^(?:\/|[a-z]:[/\\])/iu.test(path12) && !path12.includes("\0") && !path12.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
16000
|
+
var gitRef = external_exports.string().min(1).max(256).refine((ref) => ref.split("/").every((part) => part && /^[a-z0-9_.-]+$/iu.test(part) && part !== "." && part !== ".."), "Invalid GitHub ref");
|
|
16001
|
+
function base643(maxBytes) {
|
|
16002
|
+
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
16003
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
16004
|
+
return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
|
|
16005
|
+
}, "Expected bounded standard padded base64");
|
|
16006
|
+
}
|
|
16007
|
+
var hostExtensionGitHubSourceSchema = external_exports.strictObject({
|
|
16008
|
+
type: external_exports.literal("github"),
|
|
16009
|
+
repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
|
|
16010
|
+
ref: gitRef.optional(),
|
|
16011
|
+
tag: gitRef.optional(),
|
|
16012
|
+
asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
|
|
16013
|
+
subpath: hostExtensionResourcePathSchema.optional()
|
|
16014
|
+
}).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
|
|
16015
|
+
var hostExtensionInstallSourceSchema = external_exports.union([
|
|
16016
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
16017
|
+
hostExtensionGitHubSourceSchema,
|
|
16018
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
|
|
16019
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
|
|
16020
|
+
external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
|
|
16021
|
+
]);
|
|
16022
|
+
var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
|
|
16023
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
16024
|
+
hostExtensionGitHubSourceSchema,
|
|
16025
|
+
external_exports.strictObject({ type: external_exports.literal("zip") }),
|
|
16026
|
+
external_exports.strictObject({ type: external_exports.literal("localDir") })
|
|
16027
|
+
]);
|
|
16028
|
+
var hostExtensionInstallationSchema = external_exports.strictObject({
|
|
16029
|
+
...active,
|
|
16030
|
+
manifest: hostExtensionManifestV2Schema,
|
|
16031
|
+
installedAt: external_exports.iso.datetime(),
|
|
16032
|
+
source: hostExtensionProvenanceSchema.optional()
|
|
16033
|
+
});
|
|
16034
|
+
var rasterDataUrlSchema = (maxBytes) => external_exports.string().max("data:image/jpeg;base64,".length + 4 * Math.ceil(maxBytes / 3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
16035
|
+
var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
|
|
16036
|
+
var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
|
|
16037
|
+
var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
|
|
16038
|
+
hostExtensionInstallationSchema.extend({
|
|
16039
|
+
state: external_exports.literal("valid"),
|
|
16040
|
+
enabled: external_exports.boolean(),
|
|
16041
|
+
...desktopConflict,
|
|
16042
|
+
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
16043
|
+
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
16044
|
+
backendState: backendState.optional(),
|
|
16045
|
+
backendError: external_exports.string().optional()
|
|
16046
|
+
}),
|
|
16047
|
+
external_exports.strictObject({
|
|
16048
|
+
state: external_exports.enum(["invalid", "incompatible"]),
|
|
16049
|
+
id: external_exports.string().min(1),
|
|
16050
|
+
enabled: external_exports.boolean(),
|
|
16051
|
+
error: external_exports.string()
|
|
16052
|
+
})
|
|
16053
|
+
]);
|
|
16054
|
+
var hostExtensionsListResultSchema = external_exports.strictObject({
|
|
16055
|
+
revision: hostExtensionRevisionSchema,
|
|
16056
|
+
configuration: hostExtensionConfigurationSchema,
|
|
16057
|
+
diagnostics: external_exports.array(external_exports.string()),
|
|
16058
|
+
extensions: external_exports.array(hostExtensionListItemSchema)
|
|
16059
|
+
});
|
|
16060
|
+
var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
|
|
16061
|
+
...desktopConflict,
|
|
16062
|
+
settingsRevision: hostExtensionRevisionSchema
|
|
16063
|
+
});
|
|
16064
|
+
var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
|
|
16065
|
+
/** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
|
|
16066
|
+
revision: hostExtensionRevisionSchema,
|
|
16067
|
+
// Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
|
|
16068
|
+
extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
|
|
16069
|
+
});
|
|
16070
|
+
var HOST_EXTENSIONS_RPC = {
|
|
16071
|
+
list: "codexhost/extensions/list",
|
|
16072
|
+
snapshot: "codexhost/extensions/snapshot",
|
|
16073
|
+
catalog: "codexhost/extensions/catalog",
|
|
16074
|
+
install: "codexhost/extensions/install",
|
|
16075
|
+
update: "codexhost/extensions/update",
|
|
16076
|
+
enable: "codexhost/extensions/enable",
|
|
16077
|
+
disable: "codexhost/extensions/disable",
|
|
16078
|
+
uninstall: "codexhost/extensions/uninstall",
|
|
16079
|
+
recover: "codexhost/extensions/recover",
|
|
16080
|
+
asset: "codexhost/extensions/asset",
|
|
16081
|
+
settingsGet: "codexhost/extensions/settings/get",
|
|
16082
|
+
settingsSet: "codexhost/extensions/settings/set",
|
|
16083
|
+
backendInvoke: "codexhost/extensions/backend/invoke"
|
|
16084
|
+
};
|
|
16085
|
+
var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
|
|
16086
|
+
var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
|
|
16087
|
+
var noParams = external_exports.strictObject({});
|
|
16088
|
+
var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
|
|
16089
|
+
var selection = external_exports.strictObject({ ...id, ...expectedRevision });
|
|
16090
|
+
var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
|
|
16091
|
+
var mutationResult = external_exports.discriminatedUnion("state", [
|
|
16092
|
+
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
|
|
16093
|
+
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
|
|
16094
|
+
]);
|
|
16095
|
+
var hostExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
16096
|
+
...optionalActivation,
|
|
16097
|
+
digest: active.digest.optional(),
|
|
16098
|
+
path: hostExtensionResourcePathSchema
|
|
16099
|
+
});
|
|
16100
|
+
var hostExtensionsAssetResultSchema = external_exports.strictObject({
|
|
16101
|
+
mimeType: external_exports.string().min(1),
|
|
16102
|
+
base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
|
|
16103
|
+
digest: active.digest
|
|
16104
|
+
});
|
|
16105
|
+
var hostExtensionSettingsSchema = external_exports.strictObject({
|
|
16106
|
+
settingsRevision: hostExtensionRevisionSchema,
|
|
16107
|
+
values: jsonObjectSchema
|
|
16108
|
+
});
|
|
16109
|
+
var hostExtensionsRpcSchemas = {
|
|
16110
|
+
[HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
|
|
16111
|
+
[HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
|
|
16112
|
+
[HOST_EXTENSIONS_RPC.catalog]: {
|
|
16113
|
+
params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
|
|
16114
|
+
result: hostExtensionsCatalogResultSchema
|
|
16115
|
+
},
|
|
16116
|
+
[HOST_EXTENSIONS_RPC.install]: {
|
|
16117
|
+
params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
|
|
16118
|
+
result: installationResult
|
|
16119
|
+
},
|
|
16120
|
+
[HOST_EXTENSIONS_RPC.update]: {
|
|
16121
|
+
params: external_exports.strictObject({
|
|
16122
|
+
...id,
|
|
16123
|
+
expectedDigest: active.digest,
|
|
16124
|
+
expectedActivationId: active.activationId.optional(),
|
|
16125
|
+
source: hostExtensionInstallSourceSchema.optional()
|
|
16126
|
+
}),
|
|
16127
|
+
result: installationResult
|
|
16128
|
+
},
|
|
16129
|
+
[HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
|
|
16130
|
+
[HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
|
|
16131
|
+
[HOST_EXTENSIONS_RPC.uninstall]: {
|
|
16132
|
+
params: external_exports.strictObject({
|
|
16133
|
+
...id,
|
|
16134
|
+
removeData: external_exports.boolean().optional(),
|
|
16135
|
+
expectedDigest: active.digest.optional()
|
|
16136
|
+
}),
|
|
16137
|
+
result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
|
|
16138
|
+
},
|
|
16139
|
+
[HOST_EXTENSIONS_RPC.recover]: {
|
|
16140
|
+
params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
|
|
16141
|
+
result: mutationResult
|
|
16142
|
+
},
|
|
16143
|
+
[HOST_EXTENSIONS_RPC.asset]: {
|
|
16144
|
+
params: hostExtensionsAssetParamsSchema,
|
|
16145
|
+
result: hostExtensionsAssetResultSchema
|
|
16146
|
+
},
|
|
16147
|
+
[HOST_EXTENSIONS_RPC.settingsGet]: {
|
|
16148
|
+
params: external_exports.strictObject(optionalActivation),
|
|
16149
|
+
result: hostExtensionSettingsSchema
|
|
16150
|
+
},
|
|
16151
|
+
[HOST_EXTENSIONS_RPC.settingsSet]: {
|
|
16152
|
+
params: external_exports.strictObject({
|
|
16153
|
+
...optionalActivation,
|
|
16154
|
+
expectedSettingsRevision: hostExtensionRevisionSchema,
|
|
16155
|
+
values: jsonObjectSchema
|
|
16156
|
+
}),
|
|
16157
|
+
result: hostExtensionSettingsSchema
|
|
16158
|
+
},
|
|
16159
|
+
[HOST_EXTENSIONS_RPC.backendInvoke]: {
|
|
16160
|
+
params: external_exports.strictObject({
|
|
16161
|
+
...optionalActivation,
|
|
16162
|
+
method: hostExtensionBackendMethodSchema,
|
|
16163
|
+
params: jsonValueSchema.optional()
|
|
16164
|
+
}),
|
|
16165
|
+
result: external_exports.strictObject({ result: jsonValueSchema })
|
|
16166
|
+
}
|
|
16167
|
+
};
|
|
16168
|
+
|
|
15591
16169
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
16170
|
+
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
15592
16171
|
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
15593
16172
|
var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
15594
16173
|
|
|
15595
16174
|
// ../../shared-contracts/dist/client-channel.js
|
|
15596
16175
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
15597
16176
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
16177
|
+
var CLIENT_CHANNEL_METHODS = [
|
|
16178
|
+
"codexhost/skills/list",
|
|
16179
|
+
"codexhost/voice/status",
|
|
16180
|
+
"codexhost/voice/transcribe",
|
|
16181
|
+
"codexhost/harness/display-settings/get",
|
|
16182
|
+
"codexhost/harness/display-settings/set",
|
|
16183
|
+
"codexhost/harness/display-settings/capabilities",
|
|
16184
|
+
"codexhost/harness/preferences/get",
|
|
16185
|
+
"codexhost/harness/preferences/patch",
|
|
16186
|
+
"thread/list",
|
|
16187
|
+
"codexhost/thread/catalog/read",
|
|
16188
|
+
"thread/read",
|
|
16189
|
+
"thread/resume",
|
|
16190
|
+
"thread/fork",
|
|
16191
|
+
"thread/turns/list",
|
|
16192
|
+
"thread/revert",
|
|
16193
|
+
"thread/items/list",
|
|
16194
|
+
"thread/start",
|
|
16195
|
+
"thread/name/set",
|
|
16196
|
+
"codexhost/thread/title/generate",
|
|
16197
|
+
"thread/archive",
|
|
16198
|
+
THREAD_ARCHIVE_CONFIRM_METHOD,
|
|
16199
|
+
"thread/unarchive",
|
|
16200
|
+
"turn/start",
|
|
16201
|
+
"turn/interrupt",
|
|
16202
|
+
"turn/steer",
|
|
16203
|
+
"thread/queue/list",
|
|
16204
|
+
"thread/queue/add",
|
|
16205
|
+
"thread/queue/update",
|
|
16206
|
+
"thread/queue/delete",
|
|
16207
|
+
"thread/queue/reorder",
|
|
16208
|
+
"thread/queue/start",
|
|
16209
|
+
"codexhost/thread/queue/send-now",
|
|
16210
|
+
"codexhost/workspace/read",
|
|
16211
|
+
"codexhost/thread/tree/read",
|
|
16212
|
+
"codexhost/thread/pins/list",
|
|
16213
|
+
"codexhost/thread/pins/set",
|
|
16214
|
+
"codexhost/harness/plugins/list",
|
|
16215
|
+
"codexhost/harness/inspect",
|
|
16216
|
+
"codexhost/thread/inspect",
|
|
16217
|
+
"codexhost/thread/usage/inspect",
|
|
16218
|
+
"codexhost/thread/ownership/list",
|
|
16219
|
+
"codexhost/thread/model/select",
|
|
16220
|
+
"codexhost/thread/thinking/select",
|
|
16221
|
+
"codexhost/thread/permission-mode/select",
|
|
16222
|
+
"codexhost/thread/commands/inspect",
|
|
16223
|
+
"codexhost/harness/commands/inspect",
|
|
16224
|
+
"codexhost/thread/command/execute",
|
|
16225
|
+
"codexhost/thread/fork",
|
|
16226
|
+
"codexhost/harness/session-import/sources",
|
|
16227
|
+
"codexhost/harness/session-import/list",
|
|
16228
|
+
"codexhost/harness/session-import/import",
|
|
16229
|
+
// Host settings shared across Desktop and Web.
|
|
16230
|
+
...HOST_EXTENSION_MANAGEMENT_METHODS,
|
|
16231
|
+
"codexhost/harness/installation",
|
|
16232
|
+
"codexhost/harness/installation/start",
|
|
16233
|
+
"codexhost/harness/installation/status",
|
|
16234
|
+
"codexhost/harness/launch-settings/get",
|
|
16235
|
+
"codexhost/harness/launch-settings/set",
|
|
16236
|
+
"codexhost/harness/web-ui/open",
|
|
16237
|
+
"codexhost/harness/accounts/sources",
|
|
16238
|
+
"codexhost/harness/accounts/list",
|
|
16239
|
+
"codexhost/harness/accounts/inspect",
|
|
16240
|
+
"codexhost/harness/credential-imports",
|
|
16241
|
+
"codexhost/account/list",
|
|
16242
|
+
"codexhost/account/refresh",
|
|
16243
|
+
"codexhost/account/usage/inspect",
|
|
16244
|
+
"codexhost/usage/model-prices/get",
|
|
16245
|
+
"codexhost/usage/model-prices/set",
|
|
16246
|
+
"codexhost/usage/model-prices/default",
|
|
16247
|
+
"codexhost/usage/statistics/get",
|
|
16248
|
+
"codexhost/update/check",
|
|
16249
|
+
"codexhost/update/start",
|
|
16250
|
+
"codexhost/update/status",
|
|
16251
|
+
"codexhost/sessions/loaded/list"
|
|
16252
|
+
];
|
|
15598
16253
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
15599
16254
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
15600
16255
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -15633,6 +16288,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
15633
16288
|
cursor: clientChannelCursorSchema,
|
|
15634
16289
|
revision: external_exports.number().int().nonnegative()
|
|
15635
16290
|
}),
|
|
16291
|
+
external_exports.object({
|
|
16292
|
+
type: external_exports.literal("extensions-changed"),
|
|
16293
|
+
cursor: clientChannelCursorSchema,
|
|
16294
|
+
revision: hostExtensionRevisionSchema
|
|
16295
|
+
}),
|
|
15636
16296
|
external_exports.object({
|
|
15637
16297
|
type: external_exports.literal("hello"),
|
|
15638
16298
|
version: external_exports.literal(1),
|
|
@@ -15808,6 +16468,29 @@ var threadCatalogReadResultSchema = external_exports.object({
|
|
|
15808
16468
|
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
15809
16469
|
}).strict();
|
|
15810
16470
|
|
|
16471
|
+
// ../../shared-contracts/dist/thread-tree-watch.js
|
|
16472
|
+
var THREAD_TREE_MAX_NODES = 5e3;
|
|
16473
|
+
var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
|
|
16474
|
+
var threadTreeNodeSchema = external_exports.strictObject({
|
|
16475
|
+
harnessId: harnessIdSchema,
|
|
16476
|
+
title: external_exports.string().optional(),
|
|
16477
|
+
status: threadTreeStatusSchema,
|
|
16478
|
+
archived: external_exports.boolean()
|
|
16479
|
+
});
|
|
16480
|
+
var threadTreeSnapshotSchema = external_exports.strictObject({
|
|
16481
|
+
revision: external_exports.int().nonnegative(),
|
|
16482
|
+
parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
|
|
16483
|
+
nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
|
|
16484
|
+
truncated: external_exports.boolean()
|
|
16485
|
+
}).refine((snapshot) => Object.keys(snapshot.nodes).length <= THREAD_TREE_MAX_NODES, "Too many Thread tree nodes").refine(({ parents, nodes }) => Object.entries(parents).every(([child, parent]) => Object.hasOwn(nodes, child) && Object.hasOwn(nodes, parent)), "Missing Thread tree node");
|
|
16486
|
+
var subscriptionId = external_exports.string().min(1).max(128);
|
|
16487
|
+
var threadTreeWatchParamsSchema = external_exports.strictObject({});
|
|
16488
|
+
var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
|
|
16489
|
+
var threadTreeUnwatchResultSchema = external_exports.strictObject({});
|
|
16490
|
+
var threadTreeWatchResultSchema = threadTreeUnwatchParamsSchema.extend({
|
|
16491
|
+
snapshot: threadTreeSnapshotSchema
|
|
16492
|
+
});
|
|
16493
|
+
|
|
15811
16494
|
// ../../shared-contracts/dist/voice.js
|
|
15812
16495
|
var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
|
|
15813
16496
|
var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
|
|
@@ -16046,7 +16729,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
|
16046
16729
|
|
|
16047
16730
|
// ../../shared-contracts/dist/harness-preferences.js
|
|
16048
16731
|
var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
|
|
16049
|
-
var preferenceHarnessKey = harnessIdSchema.transform((
|
|
16732
|
+
var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
|
|
16050
16733
|
var harnessDefaultConfigurationSchema = external_exports.strictObject({
|
|
16051
16734
|
model: harnessModelRefSchema.optional(),
|
|
16052
16735
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -16056,11 +16739,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
|
|
|
16056
16739
|
lastHarness: harnessIdSchema.optional(),
|
|
16057
16740
|
byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
|
|
16058
16741
|
});
|
|
16742
|
+
var harnessDelegationDefaultSchema = external_exports.strictObject({
|
|
16743
|
+
model: harnessModelRefSchema.optional(),
|
|
16744
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
16745
|
+
}).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
|
|
16746
|
+
var delegationDefaultsSchema = external_exports.strictObject({
|
|
16747
|
+
byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
|
|
16748
|
+
});
|
|
16059
16749
|
var modelId = external_exports.string().min(1).max(1024);
|
|
16060
16750
|
var harnessPreferenceValuesSchema = external_exports.strictObject({
|
|
16061
16751
|
idleRelease: idleReleaseSettingsSchema.optional(),
|
|
16062
16752
|
favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
|
|
16063
|
-
newThread: newThreadDefaultsSchema.optional()
|
|
16753
|
+
newThread: newThreadDefaultsSchema.optional(),
|
|
16754
|
+
delegation: delegationDefaultsSchema.optional()
|
|
16064
16755
|
});
|
|
16065
16756
|
var harnessPreferenceSnapshotSchema = external_exports.strictObject({
|
|
16066
16757
|
scope: harnessPreferenceScopeSchema,
|
|
@@ -16088,6 +16779,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
|
|
|
16088
16779
|
lastHarness: harnessIdSchema.optional(),
|
|
16089
16780
|
harnessId: harnessIdSchema.optional(),
|
|
16090
16781
|
configuration: harnessDefaultConfigurationSchema.optional()
|
|
16782
|
+
}),
|
|
16783
|
+
external_exports.strictObject({
|
|
16784
|
+
kind: external_exports.literal("delegation"),
|
|
16785
|
+
harnessId: harnessIdSchema,
|
|
16786
|
+
configuration: harnessDelegationDefaultSchema.nullable()
|
|
16091
16787
|
})
|
|
16092
16788
|
]);
|
|
16093
16789
|
var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
@@ -16438,13 +17134,6 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
16438
17134
|
});
|
|
16439
17135
|
|
|
16440
17136
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
16441
|
-
var accountBalanceSnapshotSchema = external_exports.object({
|
|
16442
|
-
amount: external_exports.number().finite().nonnegative(),
|
|
16443
|
-
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
16444
|
-
currency: external_exports.string().trim().min(1).max(8),
|
|
16445
|
-
/** Native label when the Harness exposes several Billing Sources. */
|
|
16446
|
-
label: external_exports.string().trim().min(1).max(128).optional()
|
|
16447
|
-
}).strict();
|
|
16448
17137
|
var harnessAccountSnapshotObject = external_exports.object({
|
|
16449
17138
|
email: external_exports.string().trim().min(1).max(320).optional(),
|
|
16450
17139
|
label: external_exports.string().trim().min(1).max(256).optional(),
|
|
@@ -16478,76 +17167,6 @@ var harnessAccountListResultSchema = external_exports.object({
|
|
|
16478
17167
|
accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
|
|
16479
17168
|
}).strict();
|
|
16480
17169
|
|
|
16481
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
16482
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
16483
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
16484
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
16485
|
-
var installedHarnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(harnessIdSchema);
|
|
16486
|
-
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
16487
|
-
var relativeResourceSchema = 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");
|
|
16488
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
16489
|
-
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
16490
|
-
var harnessInstallationGuideSchema = external_exports.object({
|
|
16491
|
-
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
16492
|
-
before: localizedTextSchema.optional(),
|
|
16493
|
-
after: localizedTextSchema.optional(),
|
|
16494
|
-
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
16495
|
-
}).strict();
|
|
16496
|
-
var pluginPresentationShape = {
|
|
16497
|
-
id: installedHarnessPluginIdSchema,
|
|
16498
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
16499
|
-
version: external_exports.string().min(1).max(128),
|
|
16500
|
-
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
16501
|
-
kind: external_exports.literal("usage").optional(),
|
|
16502
|
-
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
16503
|
-
iconStyle: external_exports.object({
|
|
16504
|
-
vector: external_exports.object({
|
|
16505
|
-
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
16506
|
-
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
16507
|
-
paths: external_exports.array(external_exports.object({
|
|
16508
|
-
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
16509
|
-
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
16510
|
-
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
16511
|
-
}).strict()).min(1).max(32)
|
|
16512
|
-
}).strict().optional(),
|
|
16513
|
-
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
16514
|
-
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
16515
|
-
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
16516
|
-
}).strict().optional(),
|
|
16517
|
-
installation: harnessInstallationGuideSchema.optional(),
|
|
16518
|
-
notice: localizedTextSchema.optional(),
|
|
16519
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
16520
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
16521
|
-
links: external_exports.object({
|
|
16522
|
-
website: documentationUrlSchema.optional(),
|
|
16523
|
-
documentation: documentationUrlSchema.optional(),
|
|
16524
|
-
installation: documentationUrlSchema.optional()
|
|
16525
|
-
}).strict().optional()
|
|
16526
|
-
};
|
|
16527
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
16528
|
-
manifestVersion: external_exports.literal(1),
|
|
16529
|
-
...pluginPresentationShape,
|
|
16530
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
16531
|
-
entry: relativeResourceSchema,
|
|
16532
|
-
icon: relativeResourceSchema.optional()
|
|
16533
|
-
}).strict();
|
|
16534
|
-
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);
|
|
16535
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
16536
|
-
...pluginPresentationShape,
|
|
16537
|
-
icon: harnessPluginIconSchema.optional()
|
|
16538
|
-
}).strict();
|
|
16539
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
16540
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
16541
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
16542
|
-
}).strict();
|
|
16543
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
16544
|
-
version: external_exports.literal(1),
|
|
16545
|
-
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
16546
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
16547
|
-
message: "Enabled plugin IDs must be unique",
|
|
16548
|
-
path: ["enabled"]
|
|
16549
|
-
});
|
|
16550
|
-
|
|
16551
17170
|
// ../../shared-contracts/dist/harness-route.js
|
|
16552
17171
|
var harnessPluginRouteSchema = external_exports.object({
|
|
16553
17172
|
harnessId: harnessPluginIdSchema,
|
|
@@ -16988,9 +17607,12 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16988
17607
|
...thread,
|
|
16989
17608
|
epoch: identity,
|
|
16990
17609
|
modelId: identity.optional(),
|
|
17610
|
+
serviceTier: harnessModelServiceTierSchema.optional(),
|
|
16991
17611
|
thinkingOptionId: identity.optional(),
|
|
16992
17612
|
permissionModeId: identity.optional()
|
|
16993
|
-
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
|
|
17613
|
+
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting").refine((value) => value.serviceTier === void 0 || value.modelId !== void 0, {
|
|
17614
|
+
message: "A service tier requires a Model ID"
|
|
17615
|
+
}),
|
|
16994
17616
|
external_exports.strictObject({
|
|
16995
17617
|
kind: external_exports.literal("prompt"),
|
|
16996
17618
|
...thread,
|
|
@@ -17040,7 +17662,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
17040
17662
|
external_exports.strictObject({ action: external_exports.literal("catalog") }),
|
|
17041
17663
|
external_exports.strictObject({
|
|
17042
17664
|
action: external_exports.literal("read-thread"),
|
|
17043
|
-
hostId: hostId.refine((
|
|
17665
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
17044
17666
|
input: delegationReadParamsSchema
|
|
17045
17667
|
}),
|
|
17046
17668
|
external_exports.strictObject({
|
|
@@ -17054,7 +17676,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
17054
17676
|
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
17055
17677
|
external_exports.strictObject({
|
|
17056
17678
|
action: external_exports.literal("update"),
|
|
17057
|
-
hostId: hostId.refine((
|
|
17679
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
17058
17680
|
version: remoteUpdateParamsSchema.shape.version
|
|
17059
17681
|
})
|
|
17060
17682
|
]);
|
|
@@ -17118,7 +17740,7 @@ function invalidRequest(message) {
|
|
|
17118
17740
|
return { code: "invalidRequest", message, retryable: false };
|
|
17119
17741
|
}
|
|
17120
17742
|
function validateHostApprovalResponse(interaction, response) {
|
|
17121
|
-
return interaction.actions.some(({ id }) =>
|
|
17743
|
+
return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
|
|
17122
17744
|
}
|
|
17123
17745
|
|
|
17124
17746
|
// ../../harness-adapter/dist/question.js
|
|
@@ -17126,7 +17748,7 @@ function invalidRequest2(message) {
|
|
|
17126
17748
|
return { code: "invalidRequest", message, retryable: false };
|
|
17127
17749
|
}
|
|
17128
17750
|
function validateHostQuestionResponse(interaction, response) {
|
|
17129
|
-
const questionIds = new Set(interaction.questions.map(({ id }) =>
|
|
17751
|
+
const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
|
|
17130
17752
|
if (response.cancelled) {
|
|
17131
17753
|
return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
|
|
17132
17754
|
}
|
|
@@ -17174,6 +17796,18 @@ function validateHostInteractionResponse(interaction, response) {
|
|
|
17174
17796
|
return response.type === "approval" ? validateHostApprovalResponse(interaction, response) : invalidRequest3("Interaction Response type does not match the pending Interaction");
|
|
17175
17797
|
}
|
|
17176
17798
|
|
|
17799
|
+
// ../../harness-adapter/dist/legacy-model-ref.js
|
|
17800
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
17801
|
+
function normalizeLegacyBase64ModelRef(ref, catalog, prefix) {
|
|
17802
|
+
if (ref.serviceTier || !ref.id.startsWith(prefix))
|
|
17803
|
+
return void 0;
|
|
17804
|
+
const encoded = ref.id.slice(prefix.length);
|
|
17805
|
+
const id2 = Buffer2.from(encoded, "base64url").toString("utf8");
|
|
17806
|
+
if (Buffer2.from(id2).toString("base64url") !== encoded)
|
|
17807
|
+
return void 0;
|
|
17808
|
+
return catalog.models.find(({ ref: ref2 }) => ref2.id === id2 && !ref2.serviceTier)?.ref;
|
|
17809
|
+
}
|
|
17810
|
+
|
|
17177
17811
|
// ../../harness-adapter/dist/output-channel.js
|
|
17178
17812
|
var HarnessOutputChannel = class {
|
|
17179
17813
|
outputs;
|
|
@@ -17258,7 +17892,8 @@ var tokenFields = [
|
|
|
17258
17892
|
var safeIntegerFields = [
|
|
17259
17893
|
"planFiveHourResetsAtUnix",
|
|
17260
17894
|
"planSevenDayResetsAtUnix",
|
|
17261
|
-
"timeToFirstOutputMs"
|
|
17895
|
+
"timeToFirstOutputMs",
|
|
17896
|
+
"latestRequestTimeToFirstOutputMs"
|
|
17262
17897
|
];
|
|
17263
17898
|
var percentFields = [
|
|
17264
17899
|
"cacheHitRatePercent",
|
|
@@ -17939,17 +18574,14 @@ function capabilitiesForProfile(profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
|
17939
18574
|
};
|
|
17940
18575
|
}
|
|
17941
18576
|
function modelRef(modelId2) {
|
|
17942
|
-
return harnessModelRefSchema.parse({ id:
|
|
18577
|
+
return harnessModelRefSchema.parse({ id: modelId2 });
|
|
17943
18578
|
}
|
|
17944
|
-
function
|
|
17945
|
-
|
|
17946
|
-
if (!value || !ref.id.startsWith("cb.") || modelRef(value).id !== ref.id)
|
|
17947
|
-
throw new CodeBuddyError("invalidRequest", "Invalid native Model Ref");
|
|
17948
|
-
return value;
|
|
18579
|
+
function normalizeStoredCodeBuddyModelRef(ref, catalog) {
|
|
18580
|
+
return normalizeLegacyBase64ModelRef(ref, catalog, "cb.");
|
|
17949
18581
|
}
|
|
17950
18582
|
function configuration(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
17951
18583
|
const options = rows(value);
|
|
17952
|
-
const get = (
|
|
18584
|
+
const get = (id2) => options.find((option) => option.id === id2) ?? {};
|
|
17953
18585
|
const model2 = get("model"), mode = get("mode"), thought = get("thought_level");
|
|
17954
18586
|
const thinkingOptions = rows(thought.options).map((option) => harnessThinkingOptionSchema.parse({ id: option.value, label: option.name }));
|
|
17955
18587
|
const currentThinking = thinkingOptions.find((option) => option.id === thought.currentValue);
|
|
@@ -17993,10 +18625,34 @@ function configuration(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
|
17993
18625
|
};
|
|
17994
18626
|
return { catalog, permissionModes, state, options };
|
|
17995
18627
|
}
|
|
17996
|
-
function
|
|
18628
|
+
async function selectConfiguration(config2, id2, value, profile, request) {
|
|
18629
|
+
const option = config2?.options.find((option2) => option2.id === id2);
|
|
18630
|
+
const listed = rows(option?.options).some((option2) => option2.value === value);
|
|
18631
|
+
if (!listed && !(id2 === "model" && profile.allowUnlistedModelSelection))
|
|
18632
|
+
throw new CodeBuddyError("invalidRequest", `Unavailable ${profile.displayName} ${id2} selection`);
|
|
18633
|
+
return confirmedConfiguration(await request(id2, value), id2, value, profile);
|
|
18634
|
+
}
|
|
18635
|
+
async function restoreConfiguration(config2, saved, profile, request) {
|
|
18636
|
+
const selections = [
|
|
18637
|
+
["model", saved.effectiveModel?.id],
|
|
18638
|
+
["thought_level", saved.effectiveThinkingOptionId],
|
|
18639
|
+
["mode", saved.effectivePermissionModeId]
|
|
18640
|
+
];
|
|
18641
|
+
const matches = (id2, value) => config2.options.some((option) => option.id === id2 && option.currentValue === value);
|
|
18642
|
+
for (const [id2, value] of selections) {
|
|
18643
|
+
if (value && !matches(id2, value))
|
|
18644
|
+
config2 = await selectConfiguration(config2, id2, value, profile, request);
|
|
18645
|
+
}
|
|
18646
|
+
for (const [id2, value] of selections) {
|
|
18647
|
+
if (value && !matches(id2, value))
|
|
18648
|
+
throw new CodeBuddyError("protocolError", `ACP did not restore ${id2}`);
|
|
18649
|
+
}
|
|
18650
|
+
return config2;
|
|
18651
|
+
}
|
|
18652
|
+
function confirmedConfiguration(response, id2, value, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
17997
18653
|
const result = configuration(record3(response).configOptions, profile);
|
|
17998
|
-
if (result.options.find((option) => option.id ===
|
|
17999
|
-
throw new CodeBuddyError("protocolError", `ACP did not confirm ${
|
|
18654
|
+
if (result.options.find((option) => option.id === id2)?.currentValue !== value) {
|
|
18655
|
+
throw new CodeBuddyError("protocolError", `ACP did not confirm ${id2}`);
|
|
18000
18656
|
}
|
|
18001
18657
|
return result;
|
|
18002
18658
|
}
|
|
@@ -18552,8 +19208,8 @@ var CodeBuddyTurnOutput = class {
|
|
|
18552
19208
|
this.#textItems.set(type, item2);
|
|
18553
19209
|
this.#start(item2);
|
|
18554
19210
|
}
|
|
18555
|
-
const
|
|
18556
|
-
if (this.#finished.has(
|
|
19211
|
+
const id3 = item2.itemId;
|
|
19212
|
+
if (this.#finished.has(id3))
|
|
18557
19213
|
throw new CodeBuddyError("protocolError", "Text arrived after Item completion");
|
|
18558
19214
|
if (item2.text.length + delta.length > 2e6)
|
|
18559
19215
|
throw new CodeBuddyError("protocolError", "Agent output exceeded the supported Item size");
|
|
@@ -18561,7 +19217,7 @@ var CodeBuddyTurnOutput = class {
|
|
|
18561
19217
|
this.emit({
|
|
18562
19218
|
type: "item.updated",
|
|
18563
19219
|
turnId: this.turnId,
|
|
18564
|
-
itemId:
|
|
19220
|
+
itemId: id3,
|
|
18565
19221
|
update: { type: "text.append", text: delta }
|
|
18566
19222
|
});
|
|
18567
19223
|
return;
|
|
@@ -18582,8 +19238,8 @@ var CodeBuddyTurnOutput = class {
|
|
|
18582
19238
|
if (!terminal && !record3(merged._meta)["codebuddy.ai/toolArgumentsComplete"])
|
|
18583
19239
|
return;
|
|
18584
19240
|
const name = text(record3(merged._meta)["codebuddy.ai/toolName"]) || text(merged.title) || `${this.profile.displayName} tool`;
|
|
18585
|
-
const
|
|
18586
|
-
let item = this.#items.get(
|
|
19241
|
+
const id2 = `tool-${callId}`;
|
|
19242
|
+
let item = this.#items.get(id2)?.item;
|
|
18587
19243
|
if (!item) {
|
|
18588
19244
|
this.completeMessage();
|
|
18589
19245
|
item = toolItem(callId, name, merged.rawInput, this.cwd);
|
|
@@ -18657,13 +19313,13 @@ var CodeBuddyTurnOutput = class {
|
|
|
18657
19313
|
};
|
|
18658
19314
|
|
|
18659
19315
|
// dist/subagent-tool.js
|
|
18660
|
-
var validCodeBuddyChildId = (
|
|
19316
|
+
var validCodeBuddyChildId = (id2) => /^agent-[a-zA-Z0-9_-]{1,100}$/u.test(id2);
|
|
18661
19317
|
function codeBuddyChildId(value) {
|
|
18662
19318
|
const row = record3(value);
|
|
18663
19319
|
const structured = text(record3(record3(record3(row.providerData).toolResult).subAgent).sessionId);
|
|
18664
19320
|
const body = contentText(row.rawOutput ?? row.output);
|
|
18665
|
-
const
|
|
18666
|
-
return
|
|
19321
|
+
const id2 = structured || /\[Agent ID: (agent-[a-zA-Z0-9_-]+)\]\s*$/u.exec(body)?.[1];
|
|
19322
|
+
return id2 && validCodeBuddyChildId(id2) ? id2 : void 0;
|
|
18667
19323
|
}
|
|
18668
19324
|
function codeBuddyDelegation(callId, input, status, childId, displayName = "CodeBuddy") {
|
|
18669
19325
|
const args = record3(input);
|
|
@@ -18841,10 +19497,10 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
|
|
|
18841
19497
|
const checkedDirectories = /* @__PURE__ */ new Set();
|
|
18842
19498
|
const inheritedRows = /* @__PURE__ */ new Map();
|
|
18843
19499
|
for (const row of transaction?.inheritedContents ? parseRows(transaction.inheritedContents) : []) {
|
|
18844
|
-
const
|
|
18845
|
-
const candidates2 = inheritedRows.get(
|
|
19500
|
+
const id2 = text(row.id);
|
|
19501
|
+
const candidates2 = inheritedRows.get(id2) ?? [];
|
|
18846
19502
|
candidates2.push(row);
|
|
18847
|
-
inheritedRows.set(
|
|
19503
|
+
inheritedRows.set(id2, candidates2);
|
|
18848
19504
|
}
|
|
18849
19505
|
const inherited = (row) => inheritedRows.get(text(row.id))?.some((candidate) => isDeepStrictEqual(candidate, row)) === true;
|
|
18850
19506
|
if (transaction) {
|
|
@@ -18866,15 +19522,15 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
|
|
|
18866
19522
|
} else if (provenance) {
|
|
18867
19523
|
if (!await sameCwd(provenance.boundCwd, cwd) || provenance.targetProjectSlug !== slug || path6.resolve(file2) !== path6.resolve(primary))
|
|
18868
19524
|
throw new CodeBuddyError("invalidRequest", "Derived Native Session target binding changed");
|
|
18869
|
-
const
|
|
18870
|
-
if (provenance.inheritedPrefixRows >
|
|
19525
|
+
const active2 = nativeHistoryRows(parsed.contents);
|
|
19526
|
+
if (provenance.inheritedPrefixRows > active2.length || nativeRowsDigest(active2.slice(0, provenance.inheritedPrefixRows)) !== provenance.inheritedPrefixSha256)
|
|
18871
19527
|
throw new CodeBuddyError("protocolError", "Derived Native Session prefix verification failed");
|
|
18872
19528
|
const marker = parsed.rows.find((row) => text(row.id) === provenance.bindingMarkerId);
|
|
18873
19529
|
if (!marker || marker.sessionId !== ref.nativeSessionId || typeof marker.cwd !== "string" || !await sameCwd(marker.cwd, cwd))
|
|
18874
19530
|
throw new CodeBuddyError("protocolError", "Derived Native Session target marker is missing");
|
|
18875
19531
|
checkedDirectories.add(cwd);
|
|
18876
19532
|
const verifiedSuffixCwds = /* @__PURE__ */ new Set();
|
|
18877
|
-
for (const row of
|
|
19533
|
+
for (const row of active2.slice(provenance.inheritedPrefixRows)) {
|
|
18878
19534
|
if (row.sessionId && row.sessionId !== ref.nativeSessionId)
|
|
18879
19535
|
throw new CodeBuddyError("protocolError", "Derived Native Session appended foreign history");
|
|
18880
19536
|
if (typeof row.cwd === "string" && !verifiedSuffixCwds.has(row.cwd)) {
|
|
@@ -19291,14 +19947,14 @@ async function readCodeBuddyUsage(file2, signal) {
|
|
|
19291
19947
|
sessionId ??= row.sessionId;
|
|
19292
19948
|
cwd ??= row.cwd;
|
|
19293
19949
|
const data = record4(row.providerData);
|
|
19294
|
-
const
|
|
19295
|
-
if (!
|
|
19950
|
+
const id2 = typeof data.messageId === "string" ? data.messageId : "";
|
|
19951
|
+
if (!id2 || Object.keys(record4(data.rawUsage)).length === 0)
|
|
19296
19952
|
continue;
|
|
19297
|
-
messages.set(
|
|
19953
|
+
messages.set(id2, { data, at: messages.get(id2)?.at ?? nativeTimeMs(row.timestamp) });
|
|
19298
19954
|
}
|
|
19299
19955
|
const entries = [];
|
|
19300
|
-
for (const [
|
|
19301
|
-
const request = providerUsageRequest(
|
|
19956
|
+
for (const [id2, { data, at }] of messages) {
|
|
19957
|
+
const request = providerUsageRequest(id2, data, false);
|
|
19302
19958
|
const entry = request && at !== null && usageEntryFromRequest(request, at);
|
|
19303
19959
|
if (entry) {
|
|
19304
19960
|
const credits = record4(data.rawUsage).credit;
|
|
@@ -19318,7 +19974,7 @@ function createCodeBuddyUsageStatistics(environment, profile) {
|
|
|
19318
19974
|
return Object.freeze({
|
|
19319
19975
|
// projects/<project>/<session>.jsonl and <session>/subagents/*.jsonl
|
|
19320
19976
|
listSources: (signal) => jsonlUsageSources(path7.join(codeBuddyConfigRoot(environment, profile), "projects"), 3, signal),
|
|
19321
|
-
readSource: (
|
|
19977
|
+
readSource: (id2, signal) => readCodeBuddyUsage(id2, signal)
|
|
19322
19978
|
});
|
|
19323
19979
|
}
|
|
19324
19980
|
|
|
@@ -21181,8 +21837,8 @@ var RequestResponder = class {
|
|
|
21181
21837
|
signal;
|
|
21182
21838
|
finishRequest;
|
|
21183
21839
|
didRespond = false;
|
|
21184
|
-
constructor(
|
|
21185
|
-
this.id =
|
|
21840
|
+
constructor(id2, sendResult, signal = new AbortController().signal, finishRequest) {
|
|
21841
|
+
this.id = id2;
|
|
21186
21842
|
this.sendResult = sendResult;
|
|
21187
21843
|
this.signal = signal;
|
|
21188
21844
|
this.finishRequest = finishRequest;
|
|
@@ -21473,7 +22129,7 @@ var Connection = class {
|
|
|
21473
22129
|
return this.sendWireMessage({ jsonrpc: "2.0", method, params });
|
|
21474
22130
|
}
|
|
21475
22131
|
prepareRequest(method, params, mapResponse, options = {}) {
|
|
21476
|
-
const
|
|
22132
|
+
const id2 = this.nextRequestId++;
|
|
21477
22133
|
let cancel = () => {
|
|
21478
22134
|
};
|
|
21479
22135
|
const response = new Promise((resolve, reject) => {
|
|
@@ -21493,7 +22149,7 @@ var Connection = class {
|
|
|
21493
22149
|
}
|
|
21494
22150
|
pendingResponse.cancellationSent = true;
|
|
21495
22151
|
pendingResponse.cleanup?.();
|
|
21496
|
-
void this.sendCancelRequest(
|
|
22152
|
+
void this.sendCancelRequest(id2).catch(() => {
|
|
21497
22153
|
});
|
|
21498
22154
|
};
|
|
21499
22155
|
options.cancellationSignal?.addEventListener("abort", cancel, {
|
|
@@ -21502,12 +22158,12 @@ var Connection = class {
|
|
|
21502
22158
|
pendingResponse.cleanup = () => {
|
|
21503
22159
|
options.cancellationSignal?.removeEventListener("abort", cancel);
|
|
21504
22160
|
};
|
|
21505
|
-
this.pendingResponses.set(
|
|
22161
|
+
this.pendingResponses.set(id2, pendingResponse);
|
|
21506
22162
|
});
|
|
21507
22163
|
response.catch(() => {
|
|
21508
22164
|
});
|
|
21509
22165
|
return {
|
|
21510
|
-
message: { jsonrpc: "2.0", id, method, params },
|
|
22166
|
+
message: { jsonrpc: "2.0", id: id2, method, params },
|
|
21511
22167
|
response,
|
|
21512
22168
|
cancel: () => cancel()
|
|
21513
22169
|
};
|
|
@@ -22144,7 +22800,7 @@ function memoryStreamPair() {
|
|
|
22144
22800
|
}
|
|
22145
22801
|
];
|
|
22146
22802
|
}
|
|
22147
|
-
var
|
|
22803
|
+
var methods2 = {
|
|
22148
22804
|
agent: {
|
|
22149
22805
|
initialize: AGENT_METHODS.initialize,
|
|
22150
22806
|
authenticate: AGENT_METHODS.authenticate,
|
|
@@ -24186,12 +24842,12 @@ function referencedChildren(rows2) {
|
|
|
24186
24842
|
function assertChildRanges(rows2, child) {
|
|
24187
24843
|
const positions = /* @__PURE__ */ new Map();
|
|
24188
24844
|
for (const [index, row] of rows2.entries()) {
|
|
24189
|
-
const
|
|
24190
|
-
if (!
|
|
24845
|
+
const id2 = text(row.id);
|
|
24846
|
+
if (!id2)
|
|
24191
24847
|
continue;
|
|
24192
|
-
const matches = positions.get(
|
|
24848
|
+
const matches = positions.get(id2) ?? [];
|
|
24193
24849
|
matches.push(index);
|
|
24194
|
-
positions.set(
|
|
24850
|
+
positions.set(id2, matches);
|
|
24195
24851
|
}
|
|
24196
24852
|
let previous = -1;
|
|
24197
24853
|
for (const range of child.ranges) {
|
|
@@ -24729,13 +25385,13 @@ var CodeBuddySessionImport = class {
|
|
|
24729
25385
|
}
|
|
24730
25386
|
listCandidates() {
|
|
24731
25387
|
return this.#scope.read(async (signal) => {
|
|
24732
|
-
const
|
|
25388
|
+
const active2 = await this.#activeSessions(signal);
|
|
24733
25389
|
const candidates = [];
|
|
24734
25390
|
for (const [nativeSessionId, files] of await this.#sessionFiles(signal)) {
|
|
24735
25391
|
if (files.length !== 1 || !files[0])
|
|
24736
25392
|
continue;
|
|
24737
25393
|
try {
|
|
24738
|
-
const source = await this.#source(nativeSessionId, files[0],
|
|
25394
|
+
const source = await this.#source(nativeSessionId, files[0], active2, signal);
|
|
24739
25395
|
if (source)
|
|
24740
25396
|
candidates.push(source.candidate);
|
|
24741
25397
|
} catch (error51) {
|
|
@@ -24762,7 +25418,7 @@ var CodeBuddySessionImport = class {
|
|
|
24762
25418
|
}
|
|
24763
25419
|
/** IDs a live native process registered in `<config>/sessions/<pid>.json`. */
|
|
24764
25420
|
async #activeSessions(signal) {
|
|
24765
|
-
const
|
|
25421
|
+
const active2 = /* @__PURE__ */ new Set();
|
|
24766
25422
|
const directory = path9.join(this.#root(), "sessions");
|
|
24767
25423
|
const markers = await opendir2(directory).catch((error51) => {
|
|
24768
25424
|
if (isMissingFileError(error51) || record3(error51).code === "ENOTDIR")
|
|
@@ -24770,7 +25426,7 @@ var CodeBuddySessionImport = class {
|
|
|
24770
25426
|
throw error51;
|
|
24771
25427
|
});
|
|
24772
25428
|
if (!markers)
|
|
24773
|
-
return
|
|
25429
|
+
return active2;
|
|
24774
25430
|
for await (const marker of markers) {
|
|
24775
25431
|
signal.throwIfAborted();
|
|
24776
25432
|
if (!marker.isFile() || !marker.name.endsWith(".json"))
|
|
@@ -24781,14 +25437,14 @@ var CodeBuddySessionImport = class {
|
|
|
24781
25437
|
continue;
|
|
24782
25438
|
const entry = record3(JSON.parse(await readFile4(file2, { encoding: "utf8", signal })));
|
|
24783
25439
|
if (typeof entry.sessionId === "string" && processAlive(entry.pid))
|
|
24784
|
-
|
|
25440
|
+
active2.add(entry.sessionId);
|
|
24785
25441
|
} catch (error51) {
|
|
24786
25442
|
signal.throwIfAborted();
|
|
24787
25443
|
if (isStorageAccessError(error51))
|
|
24788
25444
|
throw error51;
|
|
24789
25445
|
}
|
|
24790
25446
|
}
|
|
24791
|
-
return
|
|
25447
|
+
return active2;
|
|
24792
25448
|
}
|
|
24793
25449
|
/** Session ID to every project file claiming it. Enumerated links are not followed. */
|
|
24794
25450
|
async #sessionFiles(signal) {
|
|
@@ -24823,7 +25479,7 @@ var CodeBuddySessionImport = class {
|
|
|
24823
25479
|
}
|
|
24824
25480
|
return found;
|
|
24825
25481
|
}
|
|
24826
|
-
async #source(nativeSessionId, file2,
|
|
25482
|
+
async #source(nativeSessionId, file2, active2, signal) {
|
|
24827
25483
|
signal.throwIfAborted();
|
|
24828
25484
|
return readStableFiles([file2], async ([info]) => {
|
|
24829
25485
|
if (!info?.isFile() || info.size === 0 || info.size > MAX_HISTORY_BYTES)
|
|
@@ -24850,7 +25506,7 @@ var CodeBuddySessionImport = class {
|
|
|
24850
25506
|
title: facts.title,
|
|
24851
25507
|
updatedAt: facts.updatedAt ?? info.mtimeMs,
|
|
24852
25508
|
// A registered live process holds the Session. Absence is not proof of idleness.
|
|
24853
|
-
running:
|
|
25509
|
+
running: active2.has(nativeSessionId) ? true : null
|
|
24854
25510
|
});
|
|
24855
25511
|
return candidate ? { candidate, nativeRef } : null;
|
|
24856
25512
|
} catch (error51) {
|
|
@@ -25120,10 +25776,10 @@ var CodeBuddyChildObserver = class {
|
|
|
25120
25776
|
throw new CodeBuddyError("unsupported", "Too many native Subagent transcripts");
|
|
25121
25777
|
const matches = [];
|
|
25122
25778
|
for (const file2 of files) {
|
|
25123
|
-
const
|
|
25779
|
+
const id2 = file2.name.slice(0, -6), data = await this.#child(directory, id2);
|
|
25124
25780
|
const first = data.entries.find((row) => row.type === "message" && row.role === "user");
|
|
25125
25781
|
if (record3(first?.providerData).conversationRequestId === requestId)
|
|
25126
|
-
matches.push(
|
|
25782
|
+
matches.push(id2);
|
|
25127
25783
|
}
|
|
25128
25784
|
if (matches.length > 1)
|
|
25129
25785
|
throw new CodeBuddyError("protocolError", "Ambiguous native Subagent correlation");
|
|
@@ -25194,8 +25850,8 @@ var CodeBuddySubagents = class {
|
|
|
25194
25850
|
hasItem(itemId) {
|
|
25195
25851
|
return [...this.#calls.values()].some((call) => call.turnId === this.#turnId && call.item.itemId === itemId);
|
|
25196
25852
|
}
|
|
25197
|
-
state(
|
|
25198
|
-
return [...this.#calls.values()].map((call) => call.item.subagents[0]).findLast((child) => child?.nativeSubagentId ===
|
|
25853
|
+
state(id2) {
|
|
25854
|
+
return [...this.#calls.values()].map((call) => call.item.subagents[0]).findLast((child) => child?.nativeSubagentId === id2);
|
|
25199
25855
|
}
|
|
25200
25856
|
project(snapshot) {
|
|
25201
25857
|
for (const turn of snapshot.turns)
|
|
@@ -25269,9 +25925,9 @@ var CodeBuddySubagents = class {
|
|
|
25269
25925
|
}
|
|
25270
25926
|
});
|
|
25271
25927
|
}
|
|
25272
|
-
const
|
|
25273
|
-
if (
|
|
25274
|
-
this.options.emit({ type: "subagent.transcript.changed", nativeSubagentId:
|
|
25928
|
+
const id2 = call.item.subagents[0]?.nativeSubagentId;
|
|
25929
|
+
if (id2)
|
|
25930
|
+
this.options.emit({ type: "subagent.transcript.changed", nativeSubagentId: id2 });
|
|
25275
25931
|
}
|
|
25276
25932
|
return true;
|
|
25277
25933
|
}
|
|
@@ -25320,25 +25976,25 @@ var CodeBuddySubagents = class {
|
|
|
25320
25976
|
if (call.observationDone)
|
|
25321
25977
|
continue;
|
|
25322
25978
|
try {
|
|
25323
|
-
const
|
|
25324
|
-
if (!
|
|
25979
|
+
const id2 = call.item.subagents[0]?.nativeSubagentId ?? (call.requestId ? await (this.options.locate ? this.options.locate(parent, this.options.cwd, this.options.environment, call.requestId, this.profile) : this.#observer.locate(call.requestId)) : void 0);
|
|
25980
|
+
if (!id2 || this.#closed || call.observationDone)
|
|
25325
25981
|
continue;
|
|
25326
25982
|
if (!call.item.subagents[0]?.nativeSubagentId)
|
|
25327
|
-
this.#update(call, { nativeSubagentId:
|
|
25328
|
-
const snapshot = await (this.options.read ? this.options.read(parent,
|
|
25983
|
+
this.#update(call, { nativeSubagentId: id2, subagentId: id2 });
|
|
25984
|
+
const snapshot = await (this.options.read ? this.options.read(parent, id2, this.options.cwd, this.options.environment, "running", this.profile) : this.#observer.read(id2, "running"));
|
|
25329
25985
|
if (this.#closed || call.observationDone)
|
|
25330
25986
|
continue;
|
|
25331
25987
|
const observedModel = snapshot.turns.at(-1)?.model ?? snapshot.state?.effectiveModel;
|
|
25332
25988
|
const reasoningEffort = snapshot.state?.effectiveThinkingOptionId;
|
|
25333
25989
|
if (observedModel || reasoningEffort)
|
|
25334
25990
|
this.#update(call, {
|
|
25335
|
-
...observedModel ? { model:
|
|
25991
|
+
...observedModel ? { model: observedModel.id } : {},
|
|
25336
25992
|
...reasoningEffort ? { reasoningEffort } : {}
|
|
25337
25993
|
});
|
|
25338
25994
|
const signature = JSON.stringify(snapshot);
|
|
25339
25995
|
if (signature !== call.signature) {
|
|
25340
25996
|
call.signature = signature;
|
|
25341
|
-
this.options.emit({ type: "subagent.transcript.changed", nativeSubagentId:
|
|
25997
|
+
this.options.emit({ type: "subagent.transcript.changed", nativeSubagentId: id2 });
|
|
25342
25998
|
}
|
|
25343
25999
|
} catch {
|
|
25344
26000
|
}
|
|
@@ -25398,7 +26054,8 @@ var CodeBuddySession = class {
|
|
|
25398
26054
|
subagents;
|
|
25399
26055
|
#client;
|
|
25400
26056
|
#generation = 0;
|
|
25401
|
-
#
|
|
26057
|
+
#needsResume = false;
|
|
26058
|
+
#replay;
|
|
25402
26059
|
#interactions;
|
|
25403
26060
|
#config;
|
|
25404
26061
|
#ref;
|
|
@@ -25450,22 +26107,31 @@ var CodeBuddySession = class {
|
|
|
25450
26107
|
ephemeral: false,
|
|
25451
26108
|
handlers: {
|
|
25452
26109
|
fault: (error51) => {
|
|
25453
|
-
if (generation
|
|
26110
|
+
if (generation !== this.#generation || this.#closed)
|
|
26111
|
+
return;
|
|
26112
|
+
if (this.#replay)
|
|
26113
|
+
this.#replay.fault ??= { error: error51 };
|
|
26114
|
+
else
|
|
25454
26115
|
this.#onFault(error51);
|
|
25455
26116
|
},
|
|
25456
26117
|
update: (notification) => {
|
|
25457
|
-
if (generation !== this.#generation || this.#closed)
|
|
26118
|
+
if (generation !== this.#generation || this.#closed || this.#fault)
|
|
25458
26119
|
return;
|
|
25459
26120
|
if (this.#ref && notification.sessionId !== this.#ref.nativeSessionId)
|
|
25460
26121
|
return;
|
|
25461
26122
|
try {
|
|
25462
26123
|
const update = record3(notification.update);
|
|
25463
26124
|
if (nativeCommandsEnabled(this.profile) && update.sessionUpdate === "available_commands_update") {
|
|
25464
|
-
if (!this.profile.staticCommandCatalog)
|
|
25465
|
-
|
|
26125
|
+
if (!this.profile.staticCommandCatalog) {
|
|
26126
|
+
const commands = commandCatalog(update.availableCommands, this.profile);
|
|
26127
|
+
if (this.#replay)
|
|
26128
|
+
this.#replay.commands = commands;
|
|
26129
|
+
else
|
|
26130
|
+
this.#commands = commands;
|
|
26131
|
+
}
|
|
25466
26132
|
return;
|
|
25467
26133
|
}
|
|
25468
|
-
if (this.#
|
|
26134
|
+
if (this.#replay)
|
|
25469
26135
|
return;
|
|
25470
26136
|
if ((text(record3(update._meta)["codebuddy.ai/parentToolCallId"]) || !this.#active?.output.hasItem(`tool-${text(update.toolCallId)}`)) && this.subagents.update(update))
|
|
25471
26137
|
return;
|
|
@@ -25482,19 +26148,31 @@ var CodeBuddySession = class {
|
|
|
25482
26148
|
}
|
|
25483
26149
|
this.#active?.output.update(update);
|
|
25484
26150
|
} catch (error51) {
|
|
25485
|
-
this.#
|
|
26151
|
+
if (this.#replay)
|
|
26152
|
+
this.#replay.fault ??= { error: error51 };
|
|
26153
|
+
else
|
|
26154
|
+
this.#onFault(error51);
|
|
25486
26155
|
}
|
|
25487
26156
|
},
|
|
25488
|
-
permission: (request) => generation === this.#generation && !this.#
|
|
25489
|
-
question: (params) => generation === this.#generation && !this.#
|
|
26157
|
+
permission: (request) => generation === this.#generation && !this.#closed && !this.#fault && !this.#replay && this.#active && !this.#active.cancelled && request.sessionId === this.#ref?.nativeSessionId ? this.#interactions.permission(this.#active.command.turnId, request) : Promise.resolve({ outcome: { outcome: "cancelled" } }),
|
|
26158
|
+
question: (params) => generation === this.#generation && !this.#closed && !this.#fault && !this.#replay && this.#active && !this.#active.cancelled && params.sessionId === this.#ref?.nativeSessionId ? this.#interactions.question(this.#active.command.turnId, params) : Promise.resolve({ outcome: "cancelled" })
|
|
25490
26159
|
}
|
|
25491
26160
|
});
|
|
25492
26161
|
}
|
|
26162
|
+
#assertClient(generation) {
|
|
26163
|
+
if (this.#closed || this.#fault || generation !== this.#generation)
|
|
26164
|
+
throw new CodeBuddyError("invalidState", "ACP client is no longer current");
|
|
26165
|
+
if (this.#replay?.fault)
|
|
26166
|
+
throw this.#replay.fault.error;
|
|
26167
|
+
}
|
|
25493
26168
|
/** Every fresh process must restore an unanchored rewind before it can accept prompts. */
|
|
25494
26169
|
async #openClient() {
|
|
26170
|
+
const client2 = this.#client;
|
|
26171
|
+
const generation = this.#generation;
|
|
25495
26172
|
let rewind;
|
|
25496
26173
|
if (this.#ref) {
|
|
25497
|
-
const history = await this
|
|
26174
|
+
const history = await this.#history(this.#ref);
|
|
26175
|
+
this.#assertClient(generation);
|
|
25498
26176
|
this.#hasTurn = snapshotFromHistory(history, this.#ref, this.input.cwd, this.profile).turns.length > 0;
|
|
25499
26177
|
this.#usage = historyUsage(history);
|
|
25500
26178
|
this.#meterHistory(history, true);
|
|
@@ -25502,15 +26180,19 @@ var CodeBuddySession = class {
|
|
|
25502
26180
|
} else {
|
|
25503
26181
|
this.#emit({ type: "usage.history", complete: true });
|
|
25504
26182
|
}
|
|
25505
|
-
|
|
25506
|
-
|
|
26183
|
+
this.#assertClient(generation);
|
|
26184
|
+
await client2.initialize();
|
|
26185
|
+
this.#assertClient(generation);
|
|
26186
|
+
const opened = await client2.open(this.input.cwd, this.#ref?.nativeSessionId);
|
|
26187
|
+
this.#assertClient(generation);
|
|
25507
26188
|
const sessionId = this.#ref?.nativeSessionId ?? text(opened.sessionId);
|
|
25508
26189
|
if (!sessionId || opened.sessionId && opened.sessionId !== sessionId)
|
|
25509
26190
|
throw new CodeBuddyError("protocolError", "ACP returned a different Native Session identity");
|
|
25510
26191
|
if (rewind) {
|
|
25511
|
-
if (!
|
|
26192
|
+
if (!client2.rollback)
|
|
25512
26193
|
throw new CodeBuddyError("unsupported", "Native history rewind is unavailable");
|
|
25513
|
-
const result = await
|
|
26194
|
+
const result = await client2.rollback(sessionId, rewind.forkPointId);
|
|
26195
|
+
this.#assertClient(generation);
|
|
25514
26196
|
if (result.applied !== true || (result.actualForkPointId ?? null) !== rewind.forkPointId)
|
|
25515
26197
|
throw new CodeBuddyError("nativeFailure", "Native history rewind was not confirmed");
|
|
25516
26198
|
}
|
|
@@ -25538,7 +26220,7 @@ var CodeBuddySession = class {
|
|
|
25538
26220
|
} else if (this.input.permissionModeId || text(saved.mode))
|
|
25539
26221
|
await this.#configure("mode", this.input.permissionModeId ?? text(saved.mode));
|
|
25540
26222
|
if (this.input.model || text(saved.model))
|
|
25541
|
-
await this.#configure("model", this.input.model
|
|
26223
|
+
await this.#configure("model", this.input.model?.id ?? text(saved.model));
|
|
25542
26224
|
if (this.input.thinkingOptionId || text(saved.thinking))
|
|
25543
26225
|
await this.#configure("thought_level", this.input.thinkingOptionId ?? text(saved.thinking));
|
|
25544
26226
|
if (this.#fault || this.#closed)
|
|
@@ -25581,7 +26263,7 @@ var CodeBuddySession = class {
|
|
|
25581
26263
|
locator: {
|
|
25582
26264
|
...record3(this.#ref.locator),
|
|
25583
26265
|
configuration: {
|
|
25584
|
-
model: config2.state.effectiveModel
|
|
26266
|
+
model: config2.state.effectiveModel?.id ?? "",
|
|
25585
26267
|
mode: config2.state.effectivePermissionModeId ?? "",
|
|
25586
26268
|
thinking: config2.state.effectiveThinkingOptionId ?? ""
|
|
25587
26269
|
}
|
|
@@ -25591,45 +26273,57 @@ var CodeBuddySession = class {
|
|
|
25591
26273
|
if (emit)
|
|
25592
26274
|
this.#emit({ type: "session.state.changed", state: this.#state });
|
|
25593
26275
|
}
|
|
25594
|
-
|
|
25595
|
-
const
|
|
25596
|
-
const
|
|
25597
|
-
const
|
|
25598
|
-
if (!
|
|
25599
|
-
throw new CodeBuddyError("invalidRequest", `Unavailable ${this.profile.displayName} ${id} selection`);
|
|
25600
|
-
if (!this.#ref)
|
|
26276
|
+
#configurationRequest() {
|
|
26277
|
+
const generation = this.#generation;
|
|
26278
|
+
const client2 = this.#client;
|
|
26279
|
+
const sessionId = this.#ref?.nativeSessionId;
|
|
26280
|
+
if (!sessionId)
|
|
25601
26281
|
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
25602
|
-
|
|
25603
|
-
|
|
25604
|
-
|
|
25605
|
-
|
|
26282
|
+
return async (id2, value) => {
|
|
26283
|
+
this.#assertClient(generation);
|
|
26284
|
+
const result = await client2.configure(sessionId, id2, value);
|
|
26285
|
+
this.#assertClient(generation);
|
|
26286
|
+
return result;
|
|
26287
|
+
};
|
|
25606
26288
|
}
|
|
25607
|
-
async #
|
|
25608
|
-
|
|
25609
|
-
|
|
26289
|
+
async #configure(id2, value) {
|
|
26290
|
+
const generation = this.#generation;
|
|
26291
|
+
const confirmed = await selectConfiguration(this.#config, id2, value, this.profile, this.#configurationRequest());
|
|
26292
|
+
this.#assertClient(generation);
|
|
26293
|
+
this.#apply(confirmed);
|
|
26294
|
+
}
|
|
26295
|
+
async #history(ref) {
|
|
25610
26296
|
try {
|
|
25611
|
-
|
|
25612
|
-
this.#usage = historyUsage(history);
|
|
25613
|
-
this.#meterHistory(history, false);
|
|
25614
|
-
return {
|
|
25615
|
-
...this.subagents.project(snapshotFromHistory(history, this.#ref, this.input.cwd, this.profile)),
|
|
25616
|
-
state: this.#state
|
|
25617
|
-
};
|
|
26297
|
+
return await this.readHistory(this.input.cwd, ref, this.environment, this.profile);
|
|
25618
26298
|
} catch (error51) {
|
|
25619
26299
|
if (!this.#hasTurn && this.input.kind === "create" && error51 instanceof CodeBuddyError && error51.code === "sessionNotFound")
|
|
25620
|
-
return
|
|
26300
|
+
return "";
|
|
25621
26301
|
throw error51;
|
|
25622
26302
|
}
|
|
25623
26303
|
}
|
|
26304
|
+
async #snapshot(historyTimeout) {
|
|
26305
|
+
if (!this.#ref)
|
|
26306
|
+
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
26307
|
+
const read = this.#history(this.#ref);
|
|
26308
|
+
const history = historyTimeout ? await bounded(read, historyTimeout, "Native Turn history read") : await read;
|
|
26309
|
+
if (this.#closed || this.#fault)
|
|
26310
|
+
throw new CodeBuddyError("invalidState", "Session closed during history read");
|
|
26311
|
+
const snapshot = snapshotFromHistory(history, this.#ref, this.input.cwd, this.profile);
|
|
26312
|
+
if (snapshot.turns.length)
|
|
26313
|
+
this.#hasTurn = true;
|
|
26314
|
+
this.#usage = historyUsage(history);
|
|
26315
|
+
this.#meterHistory(history, false);
|
|
26316
|
+
return { ...this.subagents.project(snapshot), state: this.#state };
|
|
26317
|
+
}
|
|
25624
26318
|
/** Read persisted request usage without waiting for the ACP prompt (including tool waits). */
|
|
25625
26319
|
async refreshUsage() {
|
|
25626
|
-
if (this.#refreshingUsage || this.#closed || this.#fault || this.#
|
|
26320
|
+
if (this.#refreshingUsage || this.#closed || this.#fault || this.#replay || !this.#ref)
|
|
25627
26321
|
return;
|
|
25628
26322
|
this.#refreshingUsage = true;
|
|
25629
|
-
const
|
|
26323
|
+
const active2 = this.#active, generation = this.#generation;
|
|
25630
26324
|
try {
|
|
25631
26325
|
const history = await this.readHistory(this.input.cwd, this.#ref, this.environment, this.profile);
|
|
25632
|
-
if (this.#closed || this.#fault || this.#active !==
|
|
26326
|
+
if (this.#closed || this.#fault || this.#active !== active2 || this.#generation !== generation)
|
|
25633
26327
|
return;
|
|
25634
26328
|
this.#usage = historyUsage(history);
|
|
25635
26329
|
this.#meterHistory(history, false);
|
|
@@ -25641,7 +26335,7 @@ var CodeBuddySession = class {
|
|
|
25641
26335
|
}
|
|
25642
26336
|
#subagentConfiguration() {
|
|
25643
26337
|
const state = this.#state;
|
|
25644
|
-
const model2 = state.effectiveModel
|
|
26338
|
+
const model2 = state.effectiveModel?.id;
|
|
25645
26339
|
return {
|
|
25646
26340
|
...model2 ? { model: model2 } : {},
|
|
25647
26341
|
...state.effectiveThinkingOptionId ? { reasoningEffort: state.effectiveThinkingOptionId } : {}
|
|
@@ -25666,19 +26360,16 @@ var CodeBuddySession = class {
|
|
|
25666
26360
|
}
|
|
25667
26361
|
}
|
|
25668
26362
|
async #executeCommand(command) {
|
|
25669
|
-
const
|
|
25670
|
-
if (!parsed.ok)
|
|
25671
|
-
return parsed;
|
|
25672
|
-
const result = await this.#execute({ type: "turn.start", turnId: command.turnId, input: [{ type: "text", text: parsed.value }] }, true);
|
|
26363
|
+
const result = await this.#execute({ ...command, type: "command.execute" });
|
|
25673
26364
|
return result.ok ? { ok: true, value: { turnId: command.turnId } } : result;
|
|
25674
26365
|
}
|
|
25675
26366
|
async execute(command) {
|
|
25676
26367
|
const invocation = command.type === "turn.start" ? command.input.map((item) => item.text).join("\n").trim().split(/\s/u)[0] : void 0;
|
|
25677
26368
|
if (nativeCommandsEnabled(this.profile) && isExcludedInvocation(invocation))
|
|
25678
26369
|
return failure("unsupported", "Command is not available in this Session", this.profile);
|
|
25679
|
-
return this.#execute(command,
|
|
26370
|
+
return this.#execute(command, invocation);
|
|
25680
26371
|
}
|
|
25681
|
-
async #execute(command,
|
|
26372
|
+
async #execute(command, invocation) {
|
|
25682
26373
|
if (this.#closed || this.#fault)
|
|
25683
26374
|
return failure("invalidState", "Session is closed or faulted", this.profile);
|
|
25684
26375
|
if (command.type === "turn.steer")
|
|
@@ -25686,35 +26377,58 @@ var CodeBuddySession = class {
|
|
|
25686
26377
|
if (command.type === "interaction.respond")
|
|
25687
26378
|
return this.#interactions.respond(command);
|
|
25688
26379
|
if (command.type === "turn.cancel") {
|
|
25689
|
-
const
|
|
25690
|
-
if (!
|
|
26380
|
+
const active2 = this.#active;
|
|
26381
|
+
if (!active2 || active2.command.turnId !== command.turnId || !this.#ref)
|
|
25691
26382
|
return failure("invalidRequest", "Turn is not active", this.profile);
|
|
25692
|
-
if (!
|
|
25693
|
-
|
|
26383
|
+
if (!active2.cancelled) {
|
|
26384
|
+
active2.cancelled = true;
|
|
26385
|
+
const generation = this.#generation;
|
|
25694
26386
|
try {
|
|
25695
|
-
|
|
26387
|
+
const requested = this.#client.cancel(this.#ref.nativeSessionId);
|
|
26388
|
+
this.#interactions.close();
|
|
26389
|
+
await requested;
|
|
25696
26390
|
} catch (error51) {
|
|
25697
|
-
this.#
|
|
25698
|
-
|
|
26391
|
+
if (generation === this.#generation) {
|
|
26392
|
+
if (this.#active === active2)
|
|
26393
|
+
this.#onFault(error51);
|
|
26394
|
+
return { ok: false, error: nativeError(error51, this.profile) };
|
|
26395
|
+
}
|
|
26396
|
+
}
|
|
26397
|
+
if (this.#active === active2 && !this.#closed) {
|
|
26398
|
+
void bounded(active2.completion, 3e4, "ACP cancel acknowledgement").catch((error51) => {
|
|
26399
|
+
if (this.#active === active2 && !this.#needsResume)
|
|
26400
|
+
this.#onFault(error51);
|
|
26401
|
+
});
|
|
25699
26402
|
}
|
|
25700
|
-
this.#interactions.close();
|
|
25701
|
-
void bounded(active.completion, 3e4, "ACP cancel acknowledgement").catch((error51) => this.#onFault(error51));
|
|
25702
26403
|
}
|
|
25703
26404
|
return { ok: true, value: { cancellationRequested: true } };
|
|
25704
26405
|
}
|
|
25705
|
-
if (this.#busy || this.#active && command.type !== "model.select" && command.type !== "thinking.select")
|
|
26406
|
+
if (this.#busy || this.#active && (this.#active.cancelled || command.type !== "model.select" && command.type !== "thinking.select"))
|
|
25706
26407
|
return failure("sessionBusy", "Session is executing an operation", this.profile);
|
|
25707
26408
|
this.#busy = true;
|
|
25708
26409
|
try {
|
|
25709
|
-
if (command.type === "turn.start") {
|
|
25710
|
-
if (!command.turnId.trim() || !command.input.length || command.input.some((item) => item.type !== "text") || !command.input.map((item) => item.text).join("").trim())
|
|
26410
|
+
if (command.type === "turn.start" || command.type === "command.execute") {
|
|
26411
|
+
if (!command.turnId.trim() || command.type === "turn.start" && (!command.input.length || command.input.some((item) => item.type !== "text") || !command.input.map((item) => item.text).join("").trim()))
|
|
25711
26412
|
return failure("invalidRequest", "A nonempty text prompt is required", this.profile);
|
|
26413
|
+
if (this.#needsResume)
|
|
26414
|
+
await this.#resumeClient();
|
|
26415
|
+
const nativeCommand = command.type === "command.execute" || nativeCommandsEnabled(this.profile) && this.#commands.commands.some((entry) => entry.invocation === invocation);
|
|
26416
|
+
if (command.type === "command.execute") {
|
|
26417
|
+
const parsed = commandPrompt(command, this.#commands, this.profile);
|
|
26418
|
+
if (!parsed.ok)
|
|
26419
|
+
return parsed;
|
|
26420
|
+
command = {
|
|
26421
|
+
type: "turn.start",
|
|
26422
|
+
turnId: command.turnId,
|
|
26423
|
+
input: [{ type: "text", text: parsed.value }]
|
|
26424
|
+
};
|
|
26425
|
+
}
|
|
25712
26426
|
const snapshot = await this.#snapshot();
|
|
25713
26427
|
const before = new Set(snapshot.turns.map((turn) => turn.nativeTurnRef.nativeTurnKey));
|
|
25714
26428
|
const beforeItems = new Set(snapshot.turns.flatMap((turn) => turn.items.map((snapshot2) => snapshot2.item.itemId)));
|
|
25715
26429
|
if (this.#closed || this.#fault)
|
|
25716
26430
|
return failure("invalidState", "Session closed before Turn start", this.profile);
|
|
25717
|
-
const
|
|
26431
|
+
const active2 = {
|
|
25718
26432
|
command,
|
|
25719
26433
|
before,
|
|
25720
26434
|
beforeItems,
|
|
@@ -25724,15 +26438,15 @@ var CodeBuddySession = class {
|
|
|
25724
26438
|
done: false,
|
|
25725
26439
|
completion: Promise.resolve()
|
|
25726
26440
|
};
|
|
25727
|
-
this.#active =
|
|
26441
|
+
this.#active = active2;
|
|
25728
26442
|
this.subagents.begin(command.turnId);
|
|
25729
|
-
if (!nativeCommand)
|
|
25730
|
-
this.#hasTurn = true;
|
|
25731
26443
|
this.#emit({ type: "turn.started", turnId: command.turnId });
|
|
25732
|
-
|
|
26444
|
+
active2.completion = this.#run(active2);
|
|
25733
26445
|
return { ok: true, value: { turnId: command.turnId } };
|
|
25734
26446
|
}
|
|
25735
|
-
|
|
26447
|
+
if (this.#needsResume)
|
|
26448
|
+
await this.#resumeClient();
|
|
26449
|
+
await this.#configure(command.type === "model.select" ? "model" : command.type === "thinking.select" ? "thought_level" : "mode", command.type === "model.select" ? command.model.id : command.type === "thinking.select" ? command.thinkingOptionId : command.permissionModeId);
|
|
25736
26450
|
return { ok: true, value: { completed: true } };
|
|
25737
26451
|
} catch (error51) {
|
|
25738
26452
|
return { ok: false, error: nativeError(error51, this.profile) };
|
|
@@ -25740,12 +26454,13 @@ var CodeBuddySession = class {
|
|
|
25740
26454
|
this.#busy = false;
|
|
25741
26455
|
}
|
|
25742
26456
|
}
|
|
25743
|
-
async #run(
|
|
26457
|
+
async #run(active2) {
|
|
26458
|
+
let cancellationConfirmed = false;
|
|
25744
26459
|
try {
|
|
25745
26460
|
if (!this.#ref)
|
|
25746
26461
|
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
25747
|
-
const response = await this.#client.prompt(this.#ref.nativeSessionId,
|
|
25748
|
-
if (
|
|
26462
|
+
const response = await this.#client.prompt(this.#ref.nativeSessionId, active2.command.input.map((item) => item.text).join("\n"));
|
|
26463
|
+
if (active2.done || this.#closed)
|
|
25749
26464
|
return;
|
|
25750
26465
|
const stop = response.stopReason, meta3 = record3(response._meta);
|
|
25751
26466
|
const outcome = stop === "cancelled" || meta3["codebuddy.ai/outcome"] === "CANCELLED" ? { status: "cancelled" } : stop === "end_turn" && // Native PARTIAL_SUCCESS means a final answer with recorded model/tool errors.
|
|
@@ -25754,77 +26469,90 @@ var CodeBuddySession = class {
|
|
|
25754
26469
|
status: "failed",
|
|
25755
26470
|
error: nativeTurnError(stop, meta3, this.profile)
|
|
25756
26471
|
};
|
|
25757
|
-
|
|
25758
|
-
|
|
25759
|
-
|
|
26472
|
+
if (outcome.status === "cancelled") {
|
|
26473
|
+
active2.cancelled = true;
|
|
26474
|
+
++this.#generation;
|
|
26475
|
+
this.#interactions.close();
|
|
26476
|
+
try {
|
|
26477
|
+
await this.#client.close();
|
|
26478
|
+
} catch (error51) {
|
|
26479
|
+
this.#onFault(error51);
|
|
26480
|
+
return;
|
|
26481
|
+
}
|
|
26482
|
+
if (active2.done || this.#closed)
|
|
26483
|
+
return;
|
|
26484
|
+
this.#needsResume = true;
|
|
26485
|
+
cancellationConfirmed = true;
|
|
26486
|
+
}
|
|
26487
|
+
const snapshot = await this.#snapshot(cancellationConfirmed ? 1e3 : void 0);
|
|
26488
|
+
if (active2.done || this.#closed)
|
|
26489
|
+
return;
|
|
26490
|
+
const added = snapshot.turns.filter((turn) => !active2.before.has(turn.nativeTurnRef.nativeTurnKey));
|
|
26491
|
+
if (added.length > 1 || !active2.nativeCommand && outcome.status === "succeeded" && added.length !== 1)
|
|
25760
26492
|
throw new CodeBuddyError("protocolError", "Could not identify exactly one persisted Native Turn");
|
|
25761
|
-
active.output.confirmCompaction(snapshot.turns.flatMap((turn) => turn.items).filter((snapshot2) => !active.beforeItems.has(snapshot2.item.itemId)));
|
|
25762
|
-
if (active.nativeCommand)
|
|
25763
|
-
active.output.replayCommandResult((added[0]?.items ?? []).filter(({ item }) => !this.subagents.hasItem(item.itemId)));
|
|
25764
26493
|
const nativeTurnRef = added[0]?.nativeTurnRef;
|
|
25765
|
-
if (nativeTurnRef)
|
|
25766
|
-
this.#hasTurn = true;
|
|
25767
26494
|
if (response.userMessageId && nativeTurnRef?.nativeTurnKey !== response.userMessageId)
|
|
25768
26495
|
throw new CodeBuddyError("protocolError", "ACP terminal and native history disagree on Turn identity");
|
|
25769
|
-
|
|
25770
|
-
|
|
25771
|
-
|
|
26496
|
+
active2.output.confirmCompaction(snapshot.turns.flatMap((turn) => turn.items).filter((snapshot2) => !active2.beforeItems.has(snapshot2.item.itemId)));
|
|
26497
|
+
if (active2.nativeCommand)
|
|
26498
|
+
active2.output.replayCommandResult((added[0]?.items ?? []).filter(({ item }) => !this.subagents.hasItem(item.itemId)));
|
|
26499
|
+
const compactCommand = outcome.status !== "cancelled" && active2.nativeCommand && /^\/compact(?:\s|$)/u.test(active2.command.input.map((item) => item.text).join("\n").trim());
|
|
25772
26500
|
const persisted = compactCommand ? added[0]?.outcome : void 0;
|
|
25773
26501
|
if (compactCommand && (!persisted || persisted.status === "unknown"))
|
|
25774
26502
|
throw new CodeBuddyError("protocolError", "Native compaction terminal outcome was not persisted");
|
|
25775
26503
|
const terminalOutcome = persisted && persisted.status !== "unknown" ? persisted : outcome;
|
|
25776
|
-
this.#finish(
|
|
26504
|
+
this.#finish(active2, {
|
|
25777
26505
|
...terminalOutcome,
|
|
25778
26506
|
...added[0]?.checkpoint ? { checkpoint: added[0].checkpoint } : {}
|
|
25779
26507
|
}, nativeTurnRef);
|
|
25780
26508
|
if (this.#usage)
|
|
25781
26509
|
this.#emitUsage();
|
|
25782
26510
|
} catch (error51) {
|
|
25783
|
-
if (!
|
|
25784
|
-
this.#finish(
|
|
26511
|
+
if (!active2.done && !this.#closed)
|
|
26512
|
+
this.#finish(active2, cancellationConfirmed ? { status: "cancelled" } : { status: "failed", error: nativeError(error51, this.profile) });
|
|
25785
26513
|
}
|
|
25786
26514
|
}
|
|
25787
|
-
|
|
25788
|
-
|
|
25789
|
-
|
|
25790
|
-
|
|
25791
|
-
|
|
25792
|
-
this.#replaying = true;
|
|
25793
|
-
++this.#generation;
|
|
26515
|
+
/** Runs only under the native operation gate, after the old process has exited. */
|
|
26516
|
+
async #resumeClient() {
|
|
26517
|
+
const replay = {};
|
|
26518
|
+
this.#replay = replay;
|
|
26519
|
+
let candidate;
|
|
25794
26520
|
try {
|
|
25795
|
-
|
|
25796
|
-
|
|
25797
|
-
return;
|
|
25798
|
-
this.#client = this.#createClient();
|
|
26521
|
+
this.#client = candidate = this.#createClient();
|
|
26522
|
+
const generation = this.#generation;
|
|
25799
26523
|
const loaded = await this.#openClient();
|
|
25800
|
-
|
|
25801
|
-
|
|
25802
|
-
|
|
25803
|
-
if (
|
|
25804
|
-
|
|
25805
|
-
|
|
25806
|
-
await this.#configure("mode", saved.effectivePermissionModeId);
|
|
26524
|
+
const restored = await restoreConfiguration(configuration(loaded.configOptions, this.profile), this.#state, this.profile, this.#configurationRequest());
|
|
26525
|
+
this.#assertClient(generation);
|
|
26526
|
+
this.#apply(restored);
|
|
26527
|
+
if (!this.profile.staticCommandCatalog)
|
|
26528
|
+
this.#commands = replay.commands ?? { commands: [] };
|
|
26529
|
+
this.#needsResume = false;
|
|
25807
26530
|
} catch (error51) {
|
|
25808
|
-
this.#
|
|
26531
|
+
++this.#generation;
|
|
26532
|
+
try {
|
|
26533
|
+
await candidate?.close();
|
|
26534
|
+
} catch (closeError) {
|
|
26535
|
+
this.#onFault(closeError);
|
|
26536
|
+
}
|
|
25809
26537
|
throw error51;
|
|
25810
26538
|
} finally {
|
|
25811
|
-
this.#
|
|
26539
|
+
this.#replay = void 0;
|
|
25812
26540
|
}
|
|
25813
26541
|
}
|
|
25814
|
-
#finish(
|
|
25815
|
-
if (
|
|
26542
|
+
#finish(active2, outcome, nativeTurnRef) {
|
|
26543
|
+
if (active2.done)
|
|
25816
26544
|
return;
|
|
25817
|
-
|
|
26545
|
+
active2.done = true;
|
|
25818
26546
|
this.subagents.finish(outcome);
|
|
25819
26547
|
this.#interactions.close();
|
|
25820
|
-
|
|
26548
|
+
active2.output.finish(outcome.status, outcome.status === "failed" ? outcome.error : void 0);
|
|
25821
26549
|
this.#emit({
|
|
25822
26550
|
type: "turn.completed",
|
|
25823
|
-
turnId:
|
|
26551
|
+
turnId: active2.command.turnId,
|
|
25824
26552
|
outcome,
|
|
25825
26553
|
...nativeTurnRef ? { nativeTurnRef } : {}
|
|
25826
26554
|
});
|
|
25827
|
-
if (this.#active ===
|
|
26555
|
+
if (this.#active === active2)
|
|
25828
26556
|
this.#active = void 0;
|
|
25829
26557
|
}
|
|
25830
26558
|
#onFault(error51) {
|
|
@@ -25845,13 +26573,17 @@ var CodeBuddySession = class {
|
|
|
25845
26573
|
}
|
|
25846
26574
|
async #close() {
|
|
25847
26575
|
this.#closed = true;
|
|
25848
|
-
this.subagents.close();
|
|
25849
|
-
if (this.#active)
|
|
25850
|
-
this.#finish(this.#active, { status: "cancelled", reason: "Session closed" });
|
|
25851
26576
|
this.#interactions.close();
|
|
25852
26577
|
try {
|
|
25853
26578
|
await this.#client.close();
|
|
26579
|
+
if (this.#active)
|
|
26580
|
+
this.#finish(this.#active, { status: "cancelled", reason: "Session closed" });
|
|
26581
|
+
} catch (error51) {
|
|
26582
|
+
if (this.#active)
|
|
26583
|
+
this.#finish(this.#active, { status: "failed", error: nativeError(error51, this.profile) });
|
|
26584
|
+
throw error51;
|
|
25854
26585
|
} finally {
|
|
26586
|
+
this.subagents.close();
|
|
25855
26587
|
this.#channel.end();
|
|
25856
26588
|
this.onClose();
|
|
25857
26589
|
}
|
|
@@ -25861,6 +26593,7 @@ var CodeBuddySession = class {
|
|
|
25861
26593
|
// dist/codebuddy-adapter.js
|
|
25862
26594
|
var CodeBuddyAdapter = class {
|
|
25863
26595
|
options;
|
|
26596
|
+
normalizeStoredModelRef = normalizeStoredCodeBuddyModelRef;
|
|
25864
26597
|
harnessId;
|
|
25865
26598
|
commandCatalog;
|
|
25866
26599
|
liveCommandCatalog = true;
|
|
@@ -25907,7 +26640,7 @@ var CodeBuddyAdapter = class {
|
|
|
25907
26640
|
inspect(input = {}) {
|
|
25908
26641
|
const cwd = input.cwd ?? process.cwd();
|
|
25909
26642
|
if (input.refresh)
|
|
25910
|
-
this.#cache.
|
|
26643
|
+
this.#cache.clear();
|
|
25911
26644
|
let inspection = this.#cache.get(cwd);
|
|
25912
26645
|
if (!inspection) {
|
|
25913
26646
|
inspection = this.#inspect(cwd);
|
|
@@ -26085,6 +26818,7 @@ import net, {} from "node:net";
|
|
|
26085
26818
|
// ../../harness-broker/dist/protocol.js
|
|
26086
26819
|
var HARNESS_BROKER_PROTOCOL_VERSION = 1;
|
|
26087
26820
|
var HARNESS_BROKER_MAX_FRAME_BYTES = 8 * 1024 * 1024;
|
|
26821
|
+
var HARNESS_BROKER_MAX_RESPONSE_BYTES = 32 * 1024 * 1024;
|
|
26088
26822
|
var HARNESS_BROKER_MAX_PENDING_REQUESTS = 32;
|
|
26089
26823
|
var HARNESS_BROKER_REQUEST_TIMEOUT_MS = 15e3;
|
|
26090
26824
|
var HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE = 100;
|
|
@@ -26092,6 +26826,7 @@ var HARNESS_BROKER_IDLE_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
|
26092
26826
|
var HARNESS_BROKER_RETIRING_ERROR_CODE = "brokerRetiring";
|
|
26093
26827
|
var harnessBrokerMethodSchema = external_exports.enum([
|
|
26094
26828
|
"adapter.inspect",
|
|
26829
|
+
"adapter.normalizeStoredModelRef",
|
|
26095
26830
|
"adapter.inspectAccount",
|
|
26096
26831
|
"adapter.credits",
|
|
26097
26832
|
"adapter.open",
|
|
@@ -26112,7 +26847,9 @@ var harnessBrokerHelloSchema = external_exports.object({
|
|
|
26112
26847
|
generation: external_exports.string().uuid(),
|
|
26113
26848
|
sequence: external_exports.literal(1),
|
|
26114
26849
|
kind: external_exports.literal("hello"),
|
|
26115
|
-
token: external_exports.string().regex(/^[a-f0-9]{64}$/u)
|
|
26850
|
+
token: external_exports.string().regex(/^[a-f0-9]{64}$/u),
|
|
26851
|
+
// A declared limit must leave room for the hello and frame-size error responses.
|
|
26852
|
+
maxResponseBytes: external_exports.number().int().min(512).max(Number.MAX_SAFE_INTEGER).optional()
|
|
26116
26853
|
}).strict();
|
|
26117
26854
|
var harnessBrokerRequestSchema = external_exports.object({
|
|
26118
26855
|
version: external_exports.literal(HARNESS_BROKER_PROTOCOL_VERSION),
|
|
@@ -26161,40 +26898,63 @@ var harnessBrokerDescriptorSchema = external_exports.object({
|
|
|
26161
26898
|
}).strict();
|
|
26162
26899
|
|
|
26163
26900
|
// ../../harness-broker/dist/framing.js
|
|
26164
|
-
function writeBrokerFrame(socket, value) {
|
|
26901
|
+
function writeBrokerFrame(socket, value, maxBytes = HARNESS_BROKER_MAX_FRAME_BYTES) {
|
|
26165
26902
|
const frame = `${JSON.stringify(value)}
|
|
26166
26903
|
`;
|
|
26167
|
-
if (Buffer.byteLength(frame) >
|
|
26168
|
-
|
|
26904
|
+
if (Buffer.byteLength(frame) > maxBytes) {
|
|
26905
|
+
throw new Error("Harness broker frame exceeds the maximum size");
|
|
26169
26906
|
}
|
|
26170
26907
|
return new Promise((resolve, reject) => {
|
|
26171
26908
|
socket.write(frame, (error51) => error51 ? reject(error51) : resolve());
|
|
26172
26909
|
});
|
|
26173
26910
|
}
|
|
26174
|
-
function consumeBrokerFrames(socket, onFrame, onError) {
|
|
26911
|
+
function consumeBrokerFrames(socket, onFrame, onError, maxBytes = HARNESS_BROKER_MAX_FRAME_BYTES) {
|
|
26175
26912
|
let buffered = Buffer.alloc(0);
|
|
26913
|
+
let bufferedBytes = 0;
|
|
26914
|
+
let stopped = false;
|
|
26915
|
+
const fail = (error51) => {
|
|
26916
|
+
stopped = true;
|
|
26917
|
+
buffered = Buffer.alloc(0);
|
|
26918
|
+
bufferedBytes = 0;
|
|
26919
|
+
onError(error51);
|
|
26920
|
+
socket.destroy();
|
|
26921
|
+
};
|
|
26176
26922
|
socket.on("data", (chunk) => {
|
|
26177
|
-
|
|
26178
|
-
if (buffered.length > HARNESS_BROKER_MAX_FRAME_BYTES) {
|
|
26179
|
-
onError(new Error("Harness broker frame exceeds the maximum size"));
|
|
26180
|
-
socket.destroy();
|
|
26923
|
+
if (stopped)
|
|
26181
26924
|
return;
|
|
26182
|
-
|
|
26183
|
-
|
|
26184
|
-
|
|
26185
|
-
const
|
|
26186
|
-
|
|
26187
|
-
if (
|
|
26925
|
+
let start = 0;
|
|
26926
|
+
while (start < chunk.length) {
|
|
26927
|
+
const newline2 = chunk.indexOf(10, start);
|
|
26928
|
+
const part = chunk.subarray(start, newline2 < 0 ? chunk.length : newline2);
|
|
26929
|
+
const required2 = bufferedBytes + part.length;
|
|
26930
|
+
if (required2 + (newline2 < 0 ? 0 : 1) > maxBytes) {
|
|
26931
|
+
fail(new Error("Harness broker frame exceeds the maximum size"));
|
|
26932
|
+
return;
|
|
26933
|
+
}
|
|
26934
|
+
if (required2 > buffered.length) {
|
|
26935
|
+
const capacity = Math.min(maxBytes, Math.max(required2, 4096, buffered.length * 2));
|
|
26936
|
+
const next = Buffer.allocUnsafe(capacity);
|
|
26937
|
+
buffered.copy(next, 0, 0, bufferedBytes);
|
|
26938
|
+
buffered = next;
|
|
26939
|
+
}
|
|
26940
|
+
part.copy(buffered, bufferedBytes);
|
|
26941
|
+
bufferedBytes = required2;
|
|
26942
|
+
if (newline2 < 0)
|
|
26943
|
+
return;
|
|
26944
|
+
const text2 = buffered.toString("utf8", 0, bufferedBytes);
|
|
26945
|
+
bufferedBytes = 0;
|
|
26946
|
+
if (buffered.length > 64 * 1024)
|
|
26947
|
+
buffered = Buffer.alloc(0);
|
|
26948
|
+
if (text2.length > 0) {
|
|
26188
26949
|
try {
|
|
26189
|
-
const value = JSON.parse(
|
|
26950
|
+
const value = JSON.parse(text2);
|
|
26190
26951
|
onFrame(value);
|
|
26191
26952
|
} catch (error51) {
|
|
26192
|
-
|
|
26193
|
-
socket.destroy();
|
|
26953
|
+
fail(error51 instanceof SyntaxError ? new Error("Harness broker received invalid JSON") : error51 instanceof Error ? error51 : new Error(String(error51)));
|
|
26194
26954
|
return;
|
|
26195
26955
|
}
|
|
26196
26956
|
}
|
|
26197
|
-
|
|
26957
|
+
start = newline2 + 1;
|
|
26198
26958
|
}
|
|
26199
26959
|
});
|
|
26200
26960
|
}
|
|
@@ -26254,6 +27014,10 @@ var brokerInspectInputSchema = external_exports.object({
|
|
|
26254
27014
|
refresh: external_exports.boolean().optional(),
|
|
26255
27015
|
purpose: external_exports.literal("availability").optional()
|
|
26256
27016
|
}).strict();
|
|
27017
|
+
var brokerNormalizeStoredModelRefSchema = external_exports.strictObject({
|
|
27018
|
+
ref: harnessModelRefSchema,
|
|
27019
|
+
catalog: harnessModelCatalogSchema
|
|
27020
|
+
});
|
|
26257
27021
|
var brokerSessionImportListParamsSchema = external_exports.object({
|
|
26258
27022
|
offset: external_exports.number().int().nonnegative().safe(),
|
|
26259
27023
|
limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
|
|
@@ -26382,15 +27146,18 @@ var eventKeys = /* @__PURE__ */ new Map([
|
|
|
26382
27146
|
["session.state.changed", /* @__PURE__ */ new Set(["type", "state"])],
|
|
26383
27147
|
["session.usage.changed", /* @__PURE__ */ new Set(["type", "usage", "observedForTurnId"])],
|
|
26384
27148
|
["usage.request", /* @__PURE__ */ new Set(["type", "request"])],
|
|
27149
|
+
["usage.request.timing", /* @__PURE__ */ new Set(["type", "turnId", "timing"])],
|
|
26385
27150
|
["usage.history", /* @__PURE__ */ new Set(["type", "complete"])],
|
|
26386
27151
|
["subagent.state.changed", /* @__PURE__ */ new Set(["type", "nativeSubagentId", "status", "resultSummary"])],
|
|
26387
27152
|
["subagent.transcript.changed", /* @__PURE__ */ new Set(["type", "nativeSubagentId"])],
|
|
26388
27153
|
["turn.started", /* @__PURE__ */ new Set(["type", "turnId"])],
|
|
26389
27154
|
["turn.autonomous.started", /* @__PURE__ */ new Set(["type", "turnId", "input"])],
|
|
27155
|
+
["turn.autonomous.completed", /* @__PURE__ */ new Set(["type", "snapshot"])],
|
|
26390
27156
|
["item.started", /* @__PURE__ */ new Set(["type", "turnId", "item"])],
|
|
26391
27157
|
["item.updated", /* @__PURE__ */ new Set(["type", "turnId", "itemId", "update"])],
|
|
26392
27158
|
["item.completed", /* @__PURE__ */ new Set(["type", "turnId", "snapshot"])],
|
|
26393
27159
|
["item.detached", /* @__PURE__ */ new Set(["type", "turnId", "itemId"])],
|
|
27160
|
+
["item.background.started", /* @__PURE__ */ new Set(["type", "turnId", "item"])],
|
|
26394
27161
|
["interaction.closed", /* @__PURE__ */ new Set(["type", "interactionId", "turnId", "reason"])],
|
|
26395
27162
|
["turn.completed", /* @__PURE__ */ new Set(["type", "turnId", "nativeTurnRef", "outcome"])],
|
|
26396
27163
|
["session.faulted", /* @__PURE__ */ new Set(["type", "error"])]
|
|
@@ -26417,6 +27184,118 @@ var interactionKeys = /* @__PURE__ */ new Map([
|
|
|
26417
27184
|
function strictKeys(value, allowed) {
|
|
26418
27185
|
return Boolean(allowed && value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).every((key) => allowed.has(key)));
|
|
26419
27186
|
}
|
|
27187
|
+
var nonNegativeSafeIntegerSchema2 = external_exports.int().nonnegative();
|
|
27188
|
+
var toolOutputSchema = external_exports.strictObject({
|
|
27189
|
+
content: external_exports.array(external_exports.discriminatedUnion("type", [
|
|
27190
|
+
textInputSchema,
|
|
27191
|
+
external_exports.strictObject({ type: external_exports.literal("image"), mimeType: external_exports.string(), base64Data: external_exports.string() })
|
|
27192
|
+
])),
|
|
27193
|
+
truncated: external_exports.boolean().optional()
|
|
27194
|
+
});
|
|
27195
|
+
var fileChangeSchema = external_exports.strictObject({
|
|
27196
|
+
path: external_exports.string(),
|
|
27197
|
+
kind: external_exports.enum(["add", "update", "delete"]),
|
|
27198
|
+
unifiedDiff: external_exports.string(),
|
|
27199
|
+
diffScope: external_exports.literal("fragment").optional()
|
|
27200
|
+
});
|
|
27201
|
+
var subagentStateSchema = external_exports.strictObject({
|
|
27202
|
+
subagentId: external_exports.string().min(1),
|
|
27203
|
+
nativeSubagentId: external_exports.string().min(1).optional(),
|
|
27204
|
+
description: external_exports.string(),
|
|
27205
|
+
role: external_exports.string().optional(),
|
|
27206
|
+
model: external_exports.string().optional(),
|
|
27207
|
+
reasoningEffort: external_exports.string().optional(),
|
|
27208
|
+
background: external_exports.boolean(),
|
|
27209
|
+
status: external_exports.enum(["pending", "running", "completed", "failed", "interrupted"]),
|
|
27210
|
+
resultSummary: external_exports.string().optional()
|
|
27211
|
+
});
|
|
27212
|
+
var itemBase = { itemId: hostItemIdSchema };
|
|
27213
|
+
var toolFields = {
|
|
27214
|
+
...itemBase,
|
|
27215
|
+
toolName: external_exports.string(),
|
|
27216
|
+
arguments: jsonValueSchema,
|
|
27217
|
+
output: toolOutputSchema.optional(),
|
|
27218
|
+
durationMs: external_exports.number().nonnegative().optional()
|
|
27219
|
+
};
|
|
27220
|
+
var snapshotItemSchema = external_exports.discriminatedUnion("type", [
|
|
27221
|
+
external_exports.strictObject({
|
|
27222
|
+
...itemBase,
|
|
27223
|
+
type: external_exports.literal("agentMessage"),
|
|
27224
|
+
text: external_exports.string(),
|
|
27225
|
+
phase: external_exports.enum(["commentary", "final_answer"]).optional()
|
|
27226
|
+
}),
|
|
27227
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("userMessage"), input: external_exports.array(textInputSchema) }),
|
|
27228
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("reasoning"), text: external_exports.string() }),
|
|
27229
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("contextCompaction") }),
|
|
27230
|
+
external_exports.strictObject({
|
|
27231
|
+
...itemBase,
|
|
27232
|
+
type: external_exports.literal("commandExecution"),
|
|
27233
|
+
command: external_exports.string(),
|
|
27234
|
+
cwd: cwdSchema.optional(),
|
|
27235
|
+
output: external_exports.string().optional(),
|
|
27236
|
+
outputTruncated: external_exports.boolean().optional(),
|
|
27237
|
+
exitCode: external_exports.int().nullable().optional(),
|
|
27238
|
+
durationMs: external_exports.number().nonnegative().optional()
|
|
27239
|
+
}),
|
|
27240
|
+
external_exports.strictObject({
|
|
27241
|
+
...toolFields,
|
|
27242
|
+
type: external_exports.literal("toolExecution"),
|
|
27243
|
+
namespace: external_exports.string().optional()
|
|
27244
|
+
}),
|
|
27245
|
+
external_exports.strictObject({ ...toolFields, type: external_exports.literal("mcpToolCall"), server: external_exports.string() }),
|
|
27246
|
+
external_exports.strictObject({ ...itemBase, type: external_exports.literal("webSearch"), query: external_exports.string() }),
|
|
27247
|
+
external_exports.strictObject({
|
|
27248
|
+
...itemBase,
|
|
27249
|
+
type: external_exports.literal("fileChange"),
|
|
27250
|
+
changes: external_exports.array(fileChangeSchema),
|
|
27251
|
+
sourceItemIds: external_exports.array(hostItemIdSchema).optional()
|
|
27252
|
+
}),
|
|
27253
|
+
external_exports.strictObject({
|
|
27254
|
+
...itemBase,
|
|
27255
|
+
type: external_exports.literal("subagentDelegation"),
|
|
27256
|
+
operation: external_exports.enum(["spawn", "send"]),
|
|
27257
|
+
prompt: external_exports.string().optional(),
|
|
27258
|
+
subagents: external_exports.array(subagentStateSchema)
|
|
27259
|
+
})
|
|
27260
|
+
]);
|
|
27261
|
+
var terminalOutcomes = [
|
|
27262
|
+
external_exports.strictObject({ status: external_exports.literal("succeeded") }),
|
|
27263
|
+
external_exports.strictObject({ status: external_exports.literal("failed"), error: harnessErrorSchema }),
|
|
27264
|
+
external_exports.strictObject({ status: external_exports.literal("cancelled"), reason: external_exports.string().optional() })
|
|
27265
|
+
];
|
|
27266
|
+
var autonomousSnapshotSchema = external_exports.strictObject({
|
|
27267
|
+
nativeTurnRef: nativeTurnRefSchema,
|
|
27268
|
+
checkpoint: nativeCheckpointRefSchema.optional(),
|
|
27269
|
+
input: external_exports.array(textInputSchema),
|
|
27270
|
+
items: external_exports.array(external_exports.strictObject({
|
|
27271
|
+
item: snapshotItemSchema,
|
|
27272
|
+
outcome: external_exports.discriminatedUnion("status", terminalOutcomes)
|
|
27273
|
+
})),
|
|
27274
|
+
outcome: external_exports.discriminatedUnion("status", [
|
|
27275
|
+
...terminalOutcomes,
|
|
27276
|
+
external_exports.strictObject({ status: external_exports.literal("unknown"), reason: external_exports.string() })
|
|
27277
|
+
]),
|
|
27278
|
+
model: harnessModelRefSchema.optional(),
|
|
27279
|
+
startedAtMs: nonNegativeSafeIntegerSchema2.optional(),
|
|
27280
|
+
completedAtMs: nonNegativeSafeIntegerSchema2.optional()
|
|
27281
|
+
}).refine(({ checkpoint, nativeTurnRef }) => !checkpoint || checkpoint.harnessId === nativeTurnRef.harnessId && checkpoint.nativeSessionId === nativeTurnRef.nativeSessionId, { path: ["checkpoint"], message: "Checkpoint must belong to the native Turn's Session" }).refine(({ startedAtMs, completedAtMs }) => startedAtMs === void 0 || completedAtMs === void 0 || completedAtMs >= startedAtMs, { path: ["completedAtMs"], message: "Turn cannot complete before it starts" }).refine(({ items }) => new Set(items.map(({ item }) => item.itemId)).size === items.length, {
|
|
27282
|
+
path: ["items"],
|
|
27283
|
+
message: "Item IDs must be unique within the Turn"
|
|
27284
|
+
});
|
|
27285
|
+
var usageOutputIntervalSchema = external_exports.strictObject({
|
|
27286
|
+
startedAtMs: nonNegativeSafeIntegerSchema2,
|
|
27287
|
+
completedAtMs: nonNegativeSafeIntegerSchema2,
|
|
27288
|
+
outputTokens: nonNegativeSafeIntegerSchema2
|
|
27289
|
+
}).refine(({ startedAtMs, completedAtMs }) => completedAtMs > startedAtMs);
|
|
27290
|
+
var usageRequestTimingSchema = external_exports.union([
|
|
27291
|
+
external_exports.strictObject({
|
|
27292
|
+
requestId: external_exports.string().min(1),
|
|
27293
|
+
requestStartedAtMs: nonNegativeSafeIntegerSchema2,
|
|
27294
|
+
timeToFirstOutputMs: nonNegativeSafeIntegerSchema2,
|
|
27295
|
+
output: usageOutputIntervalSchema.optional()
|
|
27296
|
+
}),
|
|
27297
|
+
external_exports.strictObject({ requestId: external_exports.string().min(1), output: usageOutputIntervalSchema })
|
|
27298
|
+
]);
|
|
26420
27299
|
var harnessOutputSchema = external_exports.custom((value) => {
|
|
26421
27300
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
26422
27301
|
return false;
|
|
@@ -26429,10 +27308,20 @@ var harnessOutputSchema = external_exports.custom((value) => {
|
|
|
26429
27308
|
return false;
|
|
26430
27309
|
if (event.type === "session.state.changed")
|
|
26431
27310
|
return harnessSessionStateSchema.safeParse(event.state).success;
|
|
27311
|
+
if (event.type === "item.background.started")
|
|
27312
|
+
return hostTurnIdSchema.safeParse(event.turnId).success && external_exports.object({
|
|
27313
|
+
type: external_exports.enum(["agentMessage", "reasoning"]),
|
|
27314
|
+
itemId: hostItemIdSchema,
|
|
27315
|
+
text: external_exports.string()
|
|
27316
|
+
}).strict().safeParse(event.item).success;
|
|
27317
|
+
if (event.type === "turn.autonomous.completed")
|
|
27318
|
+
return autonomousSnapshotSchema.safeParse(event.snapshot).success;
|
|
26432
27319
|
if (event.type === "session.faulted")
|
|
26433
27320
|
return harnessErrorSchema.safeParse(event.error).success;
|
|
26434
27321
|
if (event.type === "usage.history")
|
|
26435
27322
|
return typeof event.complete === "boolean";
|
|
27323
|
+
if (event.type === "usage.request.timing")
|
|
27324
|
+
return hostTurnIdSchema.safeParse(event.turnId).success && usageRequestTimingSchema.safeParse(event.timing).success;
|
|
26436
27325
|
return true;
|
|
26437
27326
|
}
|
|
26438
27327
|
if (output.kind === "interaction") {
|
|
@@ -26706,7 +27595,7 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
26706
27595
|
constructor(descriptor, socket) {
|
|
26707
27596
|
this.#descriptor = descriptor;
|
|
26708
27597
|
this.#socket = socket;
|
|
26709
|
-
consumeBrokerFrames(socket, (raw) => this.#frame(raw), (error51) => this.#fail(error51));
|
|
27598
|
+
consumeBrokerFrames(socket, (raw) => this.#frame(raw), (error51) => this.#fail(error51), HARNESS_BROKER_MAX_RESPONSE_BYTES);
|
|
26710
27599
|
socket.once("close", () => this.#fail(new Error("Aqua Harness broker connection closed")));
|
|
26711
27600
|
socket.once("error", (error51) => this.#fail(error51));
|
|
26712
27601
|
}
|
|
@@ -26743,19 +27632,20 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
26743
27632
|
generation: descriptor.generation,
|
|
26744
27633
|
sequence: 1,
|
|
26745
27634
|
kind: "hello",
|
|
26746
|
-
token: descriptor.token
|
|
27635
|
+
token: descriptor.token,
|
|
27636
|
+
maxResponseBytes: HARNESS_BROKER_MAX_RESPONSE_BYTES
|
|
26747
27637
|
});
|
|
26748
27638
|
await hello;
|
|
26749
27639
|
return connection;
|
|
26750
27640
|
}
|
|
26751
27641
|
#waitForHello() {
|
|
26752
27642
|
return new Promise((resolve, reject) => {
|
|
26753
|
-
const
|
|
27643
|
+
const id2 = "__hello__";
|
|
26754
27644
|
const timeout = setTimeout(() => {
|
|
26755
|
-
this.#pending.delete(
|
|
27645
|
+
this.#pending.delete(id2);
|
|
26756
27646
|
reject(new Error("Aqua Harness broker authentication timed out"));
|
|
26757
27647
|
}, HARNESS_BROKER_REQUEST_TIMEOUT_MS);
|
|
26758
|
-
this.#pending.set(
|
|
27648
|
+
this.#pending.set(id2, { resolve: () => resolve(), reject, timeout });
|
|
26759
27649
|
});
|
|
26760
27650
|
}
|
|
26761
27651
|
register(session) {
|
|
@@ -26780,13 +27670,13 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
26780
27670
|
throw new Error("Aqua Harness broker request limit exceeded");
|
|
26781
27671
|
}
|
|
26782
27672
|
this.#inputSequence += 1;
|
|
26783
|
-
const
|
|
27673
|
+
const id2 = randomUUID3();
|
|
26784
27674
|
const response = new Promise((resolve, reject) => {
|
|
26785
27675
|
const timeout = setTimeout(() => {
|
|
26786
|
-
this.#pending.delete(
|
|
27676
|
+
this.#pending.delete(id2);
|
|
26787
27677
|
reject(new Error(`Aqua Harness broker ${method} timed out`));
|
|
26788
27678
|
}, HARNESS_BROKER_REQUEST_TIMEOUT_MS);
|
|
26789
|
-
this.#pending.set(
|
|
27679
|
+
this.#pending.set(id2, { resolve, reject, timeout });
|
|
26790
27680
|
});
|
|
26791
27681
|
try {
|
|
26792
27682
|
await writeBrokerFrame(this.#socket, {
|
|
@@ -26794,15 +27684,15 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
26794
27684
|
generation: this.#descriptor.generation,
|
|
26795
27685
|
sequence: this.#inputSequence,
|
|
26796
27686
|
kind: "request",
|
|
26797
|
-
id,
|
|
27687
|
+
id: id2,
|
|
26798
27688
|
method,
|
|
26799
27689
|
params
|
|
26800
27690
|
});
|
|
26801
27691
|
} catch (error51) {
|
|
26802
|
-
const pending = this.#pending.get(
|
|
27692
|
+
const pending = this.#pending.get(id2);
|
|
26803
27693
|
if (pending)
|
|
26804
27694
|
clearTimeout(pending.timeout);
|
|
26805
|
-
this.#pending.delete(
|
|
27695
|
+
this.#pending.delete(id2);
|
|
26806
27696
|
response.catch(() => void 0);
|
|
26807
27697
|
throw new BrokerRequestNotDeliveredError(error51 instanceof Error ? error51.message : String(error51));
|
|
26808
27698
|
}
|
|
@@ -27169,6 +28059,10 @@ var BrokeredHarnessAdapter = class {
|
|
|
27169
28059
|
return failedInspection(describeBrokerFailure(error51, this.harnessId));
|
|
27170
28060
|
}
|
|
27171
28061
|
}
|
|
28062
|
+
async normalizeStoredModelRef(ref, catalog) {
|
|
28063
|
+
const result = await this.#request("adapter.normalizeStoredModelRef", { ref, catalog }, true);
|
|
28064
|
+
return harnessModelRefSchema.nullable().parse(result) ?? void 0;
|
|
28065
|
+
}
|
|
27172
28066
|
async open(input) {
|
|
27173
28067
|
if (this.#closed)
|
|
27174
28068
|
return { ok: false, error: unavailable("Aqua Harness broker adapter is closed", false) };
|