@codexhost/cli-darwin-x64 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +1565 -1805
- package/app/console-web.js +5786 -1600
- package/app/desktop-controller.mjs +13104 -2842
- package/app/host-runtime.mjs +50518 -51753
- package/app/plugins/antigravity/plugin.mjs +1932 -1148
- package/app/plugins/claude-code/plugin.mjs +1676 -1218
- package/app/plugins/codebuddy/plugin.mjs +1266 -850
- package/app/plugins/codex-usage/plugin.mjs +916 -737
- package/app/plugins/copilot/plugin.mjs +838 -640
- package/app/plugins/cursor-cli/plugin.mjs +1058 -747
- package/app/plugins/deepseek-harness/plugin.mjs +1302 -1070
- package/app/plugins/devin/plugin.mjs +949 -752
- package/app/plugins/grok/plugin.mjs +1132 -964
- package/app/plugins/hermes/plugin.mjs +1084 -905
- package/app/plugins/kimi-code/plugin.mjs +977 -804
- package/app/plugins/kiro-cli/plugin.mjs +951 -758
- package/app/plugins/omp/plugin.mjs +1408 -1169
- package/app/plugins/opencode/plugin.mjs +1385 -1142
- package/app/plugins/pi/plugin.mjs +1515 -1287
- package/app/plugins/qoder/plugin.mjs +861 -676
- package/app/plugins/qoder-cn/plugin.mjs +861 -676
- package/app/plugins/qwen-code/plugin.mjs +1060 -888
- package/app/plugins/workbuddy/plugin.mjs +1272 -856
- package/app/plugins/zcode/plugin.mjs +1529 -880
- package/app/renderer-extension.js +11568 -7827
- package/app/web/assets/index-CTCFIQbU.css +1 -0
- package/app/web/assets/index-IvFk9KT-.js +203 -0
- package/app/web/codexhost-settings.js +4472 -36194
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +75 -64
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +19 -16
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
- package/app/web/sw.js +8 -1
- package/app/web-modules/server.mjs +2682 -5540
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-DJW4bmyx.css +0 -1
- package/app/web/assets/index-Dyh1KzAB.js +0 -201
|
@@ -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
|
}
|
|
@@ -1625,8 +1625,8 @@ function cleanEnum(obj) {
|
|
|
1625
1625
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
1626
1626
|
}).map((el) => el[1]);
|
|
1627
1627
|
}
|
|
1628
|
-
function base64ToUint8Array(
|
|
1629
|
-
const binaryString = atob(
|
|
1628
|
+
function base64ToUint8Array(base644) {
|
|
1629
|
+
const binaryString = atob(base644);
|
|
1630
1630
|
const bytes = new Uint8Array(binaryString.length);
|
|
1631
1631
|
for (let i = 0; i < binaryString.length; i++) {
|
|
1632
1632
|
bytes[i] = binaryString.charCodeAt(i);
|
|
@@ -1641,9 +1641,9 @@ function uint8ArrayToBase64(bytes) {
|
|
|
1641
1641
|
return btoa(binaryString);
|
|
1642
1642
|
}
|
|
1643
1643
|
function base64urlToUint8Array(base64url3) {
|
|
1644
|
-
const
|
|
1645
|
-
const padding = "=".repeat((4 -
|
|
1646
|
-
return base64ToUint8Array(
|
|
1644
|
+
const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
|
|
1645
|
+
const padding = "=".repeat((4 - base644.length % 4) % 4);
|
|
1646
|
+
return base64ToUint8Array(base644 + padding);
|
|
1647
1647
|
}
|
|
1648
1648
|
function uint8ArrayToBase64url(bytes) {
|
|
1649
1649
|
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
@@ -3009,8 +3009,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
3009
3009
|
function isValidBase64URL(data) {
|
|
3010
3010
|
if (!base64url.test(data))
|
|
3011
3011
|
return false;
|
|
3012
|
-
const
|
|
3013
|
-
const padded =
|
|
3012
|
+
const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
3013
|
+
const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
|
|
3014
3014
|
return isValidBase64(padded);
|
|
3015
3015
|
}
|
|
3016
3016
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
@@ -3464,42 +3464,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3464
3464
|
}
|
|
3465
3465
|
doc.write(`const newResult = {};`);
|
|
3466
3466
|
for (const key of normalized.keys) {
|
|
3467
|
-
const
|
|
3467
|
+
const id2 = ids[key];
|
|
3468
3468
|
const k = esc(key);
|
|
3469
3469
|
const schema = shape[key];
|
|
3470
3470
|
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
3471
3471
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
3472
|
-
doc.write(`const ${
|
|
3472
|
+
doc.write(`const ${id2} = ${parseStr(key)};`);
|
|
3473
3473
|
if (isOptionalIn && isOptionalOut) {
|
|
3474
3474
|
doc.write(`
|
|
3475
|
-
if (${
|
|
3475
|
+
if (${id2}.issues.length) {
|
|
3476
3476
|
if (${k} in input) {
|
|
3477
|
-
payload.issues = payload.issues.concat(${
|
|
3477
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3478
3478
|
...iss,
|
|
3479
3479
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3480
3480
|
})));
|
|
3481
3481
|
}
|
|
3482
3482
|
}
|
|
3483
3483
|
|
|
3484
|
-
if (${
|
|
3484
|
+
if (${id2}.value === undefined) {
|
|
3485
3485
|
if (${k} in input) {
|
|
3486
3486
|
newResult[${k}] = undefined;
|
|
3487
3487
|
}
|
|
3488
3488
|
} else {
|
|
3489
|
-
newResult[${k}] = ${
|
|
3489
|
+
newResult[${k}] = ${id2}.value;
|
|
3490
3490
|
}
|
|
3491
3491
|
|
|
3492
3492
|
`);
|
|
3493
3493
|
} else if (!isOptionalIn) {
|
|
3494
3494
|
doc.write(`
|
|
3495
|
-
const ${
|
|
3496
|
-
if (${
|
|
3497
|
-
payload.issues = payload.issues.concat(${
|
|
3495
|
+
const ${id2}_present = ${k} in input;
|
|
3496
|
+
if (${id2}.issues.length) {
|
|
3497
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3498
3498
|
...iss,
|
|
3499
3499
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3500
3500
|
})));
|
|
3501
3501
|
}
|
|
3502
|
-
if (!${
|
|
3502
|
+
if (!${id2}_present && !${id2}.issues.length) {
|
|
3503
3503
|
payload.issues.push({
|
|
3504
3504
|
code: "invalid_type",
|
|
3505
3505
|
expected: "nonoptional",
|
|
@@ -3508,30 +3508,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3508
3508
|
});
|
|
3509
3509
|
}
|
|
3510
3510
|
|
|
3511
|
-
if (${
|
|
3512
|
-
if (${
|
|
3511
|
+
if (${id2}_present) {
|
|
3512
|
+
if (${id2}.value === undefined) {
|
|
3513
3513
|
newResult[${k}] = undefined;
|
|
3514
3514
|
} else {
|
|
3515
|
-
newResult[${k}] = ${
|
|
3515
|
+
newResult[${k}] = ${id2}.value;
|
|
3516
3516
|
}
|
|
3517
3517
|
}
|
|
3518
3518
|
|
|
3519
3519
|
`);
|
|
3520
3520
|
} else {
|
|
3521
3521
|
doc.write(`
|
|
3522
|
-
if (${
|
|
3523
|
-
payload.issues = payload.issues.concat(${
|
|
3522
|
+
if (${id2}.issues.length) {
|
|
3523
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
3524
3524
|
...iss,
|
|
3525
3525
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3526
3526
|
})));
|
|
3527
3527
|
}
|
|
3528
3528
|
|
|
3529
|
-
if (${
|
|
3529
|
+
if (${id2}.value === undefined) {
|
|
3530
3530
|
if (${k} in input) {
|
|
3531
3531
|
newResult[${k}] = undefined;
|
|
3532
3532
|
}
|
|
3533
3533
|
} else {
|
|
3534
|
-
newResult[${k}] = ${
|
|
3534
|
+
newResult[${k}] = ${id2}.value;
|
|
3535
3535
|
}
|
|
3536
3536
|
|
|
3537
3537
|
`);
|
|
@@ -11863,26 +11863,26 @@ function extractDefs(ctx, schema) {
|
|
|
11863
11863
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
11864
11864
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
11865
11865
|
for (const entry of ctx.seen.entries()) {
|
|
11866
|
-
const
|
|
11867
|
-
if (
|
|
11868
|
-
const existing = idToSchema.get(
|
|
11866
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11867
|
+
if (id2) {
|
|
11868
|
+
const existing = idToSchema.get(id2);
|
|
11869
11869
|
if (existing && existing !== entry[0]) {
|
|
11870
|
-
throw new Error(`Duplicate schema id "${
|
|
11870
|
+
throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
11871
11871
|
}
|
|
11872
|
-
idToSchema.set(
|
|
11872
|
+
idToSchema.set(id2, entry[0]);
|
|
11873
11873
|
}
|
|
11874
11874
|
}
|
|
11875
11875
|
const makeURI = (entry) => {
|
|
11876
11876
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
11877
11877
|
if (ctx.external) {
|
|
11878
11878
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
11879
|
-
const uriGenerator = ctx.external.uri ?? ((
|
|
11879
|
+
const uriGenerator = ctx.external.uri ?? ((id3) => id3);
|
|
11880
11880
|
if (externalId) {
|
|
11881
11881
|
return { ref: uriGenerator(externalId) };
|
|
11882
11882
|
}
|
|
11883
|
-
const
|
|
11884
|
-
entry[1].defId =
|
|
11885
|
-
return { defId:
|
|
11883
|
+
const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
11884
|
+
entry[1].defId = id2;
|
|
11885
|
+
return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
|
|
11886
11886
|
}
|
|
11887
11887
|
if (entry[1] === root) {
|
|
11888
11888
|
return { ref: "#" };
|
|
@@ -11930,8 +11930,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11930
11930
|
continue;
|
|
11931
11931
|
}
|
|
11932
11932
|
}
|
|
11933
|
-
const
|
|
11934
|
-
if (
|
|
11933
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
11934
|
+
if (id2) {
|
|
11935
11935
|
extractToDef(entry);
|
|
11936
11936
|
continue;
|
|
11937
11937
|
}
|
|
@@ -12027,10 +12027,10 @@ function finalize(ctx, schema) {
|
|
|
12027
12027
|
} else {
|
|
12028
12028
|
}
|
|
12029
12029
|
if (ctx.external?.uri) {
|
|
12030
|
-
const
|
|
12031
|
-
if (!
|
|
12030
|
+
const id2 = ctx.external.registry.get(schema)?.id;
|
|
12031
|
+
if (!id2)
|
|
12032
12032
|
throw new Error("Schema is missing an `id` property");
|
|
12033
|
-
result.$id = ctx.external.uri(
|
|
12033
|
+
result.$id = ctx.external.uri(id2);
|
|
12034
12034
|
}
|
|
12035
12035
|
Object.assign(result, root.def ?? root.schema);
|
|
12036
12036
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
@@ -12190,9 +12190,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
12190
12190
|
json2.type = "number";
|
|
12191
12191
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
12192
12192
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
12193
|
-
const
|
|
12193
|
+
const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
12194
12194
|
if (exMin) {
|
|
12195
|
-
if (
|
|
12195
|
+
if (legacy2) {
|
|
12196
12196
|
json2.minimum = exclusiveMinimum;
|
|
12197
12197
|
json2.exclusiveMinimum = true;
|
|
12198
12198
|
} else {
|
|
@@ -12202,7 +12202,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
12202
12202
|
json2.minimum = minimum;
|
|
12203
12203
|
}
|
|
12204
12204
|
if (exMax) {
|
|
12205
|
-
if (
|
|
12205
|
+
if (legacy2) {
|
|
12206
12206
|
json2.maximum = exclusiveMaximum;
|
|
12207
12207
|
json2.exclusiveMaximum = true;
|
|
12208
12208
|
} else {
|
|
@@ -13064,7 +13064,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
13064
13064
|
|
|
13065
13065
|
// ../../../node_modules/zod/v4/classic/schemas.js
|
|
13066
13066
|
var _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
13067
|
-
function _installLazyMethods(inst, group,
|
|
13067
|
+
function _installLazyMethods(inst, group, methods2) {
|
|
13068
13068
|
const proto = Object.getPrototypeOf(inst);
|
|
13069
13069
|
let installed = _installedGroups.get(proto);
|
|
13070
13070
|
if (!installed) {
|
|
@@ -13074,8 +13074,8 @@ function _installLazyMethods(inst, group, methods) {
|
|
|
13074
13074
|
if (installed.has(group))
|
|
13075
13075
|
return;
|
|
13076
13076
|
installed.add(group);
|
|
13077
|
-
for (const key in
|
|
13078
|
-
const fn =
|
|
13077
|
+
for (const key in methods2) {
|
|
13078
|
+
const fn = methods2[key];
|
|
13079
13079
|
Object.defineProperty(proto, key, {
|
|
13080
13080
|
configurable: true,
|
|
13081
13081
|
enumerable: false,
|
|
@@ -14886,87 +14886,6 @@ function date4(params) {
|
|
|
14886
14886
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
14887
14887
|
config(en_default());
|
|
14888
14888
|
|
|
14889
|
-
// ../../shared-contracts/dist/ids.js
|
|
14890
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
14891
|
-
message: "Identifier must not be empty or whitespace"
|
|
14892
|
-
});
|
|
14893
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
14894
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
14895
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
14896
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
14897
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
14898
|
-
|
|
14899
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
14900
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
14901
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
14902
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
14903
|
-
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
14904
|
-
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
14905
|
-
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
14906
|
-
var pluginRelativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
14907
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
14908
|
-
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
14909
|
-
var harnessInstallationGuideSchema = external_exports.object({
|
|
14910
|
-
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
14911
|
-
before: localizedTextSchema.optional(),
|
|
14912
|
-
after: localizedTextSchema.optional(),
|
|
14913
|
-
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
14914
|
-
}).strict();
|
|
14915
|
-
var pluginPresentationShape = {
|
|
14916
|
-
id: installedHarnessPluginIdSchema,
|
|
14917
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
14918
|
-
version: external_exports.string().min(1).max(128),
|
|
14919
|
-
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
14920
|
-
kind: external_exports.literal("usage").optional(),
|
|
14921
|
-
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
14922
|
-
iconStyle: external_exports.object({
|
|
14923
|
-
vector: external_exports.object({
|
|
14924
|
-
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
14925
|
-
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
14926
|
-
paths: external_exports.array(external_exports.object({
|
|
14927
|
-
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
14928
|
-
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
14929
|
-
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
14930
|
-
}).strict()).min(1).max(32)
|
|
14931
|
-
}).strict().optional(),
|
|
14932
|
-
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
14933
|
-
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
14934
|
-
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
14935
|
-
}).strict().optional(),
|
|
14936
|
-
installation: harnessInstallationGuideSchema.optional(),
|
|
14937
|
-
notice: localizedTextSchema.optional(),
|
|
14938
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
14939
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
14940
|
-
links: external_exports.object({
|
|
14941
|
-
website: documentationUrlSchema.optional(),
|
|
14942
|
-
documentation: documentationUrlSchema.optional(),
|
|
14943
|
-
installation: documentationUrlSchema.optional()
|
|
14944
|
-
}).strict().optional()
|
|
14945
|
-
};
|
|
14946
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
14947
|
-
manifestVersion: external_exports.literal(1),
|
|
14948
|
-
...pluginPresentationShape,
|
|
14949
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
14950
|
-
entry: pluginRelativeResourceSchema,
|
|
14951
|
-
icon: pluginRelativeResourceSchema.optional()
|
|
14952
|
-
}).strict();
|
|
14953
|
-
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
14954
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
14955
|
-
...pluginPresentationShape,
|
|
14956
|
-
icon: harnessPluginIconSchema.optional()
|
|
14957
|
-
}).strict();
|
|
14958
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
14959
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
14960
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
14961
|
-
}).strict();
|
|
14962
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
14963
|
-
version: external_exports.literal(1),
|
|
14964
|
-
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
14965
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
14966
|
-
message: "Enabled plugin IDs must be unique",
|
|
14967
|
-
path: ["enabled"]
|
|
14968
|
-
});
|
|
14969
|
-
|
|
14970
14889
|
// ../../shared-contracts/dist/json-value.js
|
|
14971
14890
|
function rejectExplicitUndefined(keys) {
|
|
14972
14891
|
return (value, context) => {
|
|
@@ -15026,403 +14945,73 @@ var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
|
|
|
15026
14945
|
var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
|
|
15027
14946
|
var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
|
|
15028
14947
|
|
|
15029
|
-
// ../../shared-contracts/dist/
|
|
15030
|
-
var
|
|
15031
|
-
|
|
15032
|
-
|
|
15033
|
-
|
|
15034
|
-
|
|
15035
|
-
|
|
15036
|
-
|
|
15037
|
-
|
|
15038
|
-
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
var
|
|
15042
|
-
var
|
|
15043
|
-
var
|
|
15044
|
-
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
var
|
|
15051
|
-
"
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
|
|
15055
|
-
|
|
15056
|
-
|
|
15057
|
-
|
|
15058
|
-
|
|
15059
|
-
|
|
15060
|
-
|
|
15061
|
-
|
|
15062
|
-
|
|
15063
|
-
|
|
15064
|
-
|
|
15065
|
-
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
|
|
15069
|
-
|
|
14948
|
+
// ../../shared-contracts/dist/errors.js
|
|
14949
|
+
var codexhostErrorSchema = external_exports.strictObject({
|
|
14950
|
+
code: external_exports.string().min(1),
|
|
14951
|
+
message: external_exports.string().min(1),
|
|
14952
|
+
retryable: external_exports.boolean(),
|
|
14953
|
+
diagnostic: external_exports.string().min(1).optional(),
|
|
14954
|
+
stage: external_exports.string().min(1).optional(),
|
|
14955
|
+
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
14956
|
+
stderrTail: external_exports.string().min(1).optional()
|
|
14957
|
+
}).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
|
|
14958
|
+
|
|
14959
|
+
// ../../shared-contracts/dist/harness-presentation.js
|
|
14960
|
+
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
14961
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
|
|
14962
|
+
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
14963
|
+
label: displayText(256).optional(),
|
|
14964
|
+
description: displayText(1024).optional()
|
|
14965
|
+
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
14966
|
+
var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
14967
|
+
|
|
14968
|
+
// ../../shared-contracts/dist/ids.js
|
|
14969
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
14970
|
+
message: "Identifier must not be empty or whitespace"
|
|
14971
|
+
});
|
|
14972
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
14973
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
14974
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
14975
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
14976
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
14977
|
+
|
|
14978
|
+
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
14979
|
+
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
14980
|
+
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
14981
|
+
var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
|
|
14982
|
+
var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
|
|
14983
|
+
var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
14984
|
+
message: "Value must not be empty or whitespace"
|
|
14985
|
+
});
|
|
14986
|
+
var harnessPermissionModeIdSchema = nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~:-]+$/u, "Permission Mode ID must use transport-safe characters").brand();
|
|
14987
|
+
var harnessPermissionModeSchema = external_exports.object({
|
|
14988
|
+
id: harnessPermissionModeIdSchema,
|
|
14989
|
+
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
14990
|
+
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
14991
|
+
dangerous: external_exports.boolean().optional(),
|
|
14992
|
+
localizations: harnessLocalizationsSchema.optional()
|
|
14993
|
+
}).strict();
|
|
14994
|
+
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
14995
|
+
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
14996
|
+
defaultModeId: harnessPermissionModeIdSchema
|
|
14997
|
+
}).strict().superRefine((catalog, context) => {
|
|
14998
|
+
const ids = /* @__PURE__ */ new Set();
|
|
14999
|
+
for (const [index, mode] of catalog.modes.entries()) {
|
|
15000
|
+
if (ids.has(mode.id)) {
|
|
15001
|
+
context.addIssue({
|
|
15002
|
+
code: "custom",
|
|
15003
|
+
message: "Permission Mode IDs must be unique",
|
|
15004
|
+
path: ["modes", index, "id"]
|
|
15005
|
+
});
|
|
15006
|
+
}
|
|
15007
|
+
ids.add(mode.id);
|
|
15070
15008
|
}
|
|
15071
|
-
|
|
15072
|
-
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
|
|
15077
|
-
return "image/svg+xml";
|
|
15078
|
-
case "woff2":
|
|
15079
|
-
return "font/woff2";
|
|
15080
|
-
case "json":
|
|
15081
|
-
return "application/json";
|
|
15082
|
-
case "css":
|
|
15083
|
-
return "text/css";
|
|
15084
|
-
default:
|
|
15085
|
-
return desktopExtensionScreenshotMimeType(resource);
|
|
15086
|
-
}
|
|
15087
|
-
}
|
|
15088
|
-
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
15089
|
-
var desktopExtensionAssetPathSchema = pluginRelativeResourceSchema.refine((resource) => hasPortableSegments(resource) && desktopExtensionAssetMimeType(resource) !== void 0, "Expected a relative Desktop extension asset path with a supported suffix");
|
|
15090
|
-
var imagePathSchema = pluginRelativeResourceSchema.refine((resource) => desktopExtensionScreenshotMimeType(resource) !== void 0 && hasPortableSegments(resource), "Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space");
|
|
15091
|
-
var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu, "Expected an HTTP(S) URL").pipe(external_exports.url({ protocol: /^https?$/u })).refine((value) => {
|
|
15092
|
-
const { username, password } = new URL(value);
|
|
15093
|
-
return !username && !password && !/[\\\s]/u.test(value);
|
|
15094
|
-
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15095
|
-
function localizedText(text2) {
|
|
15096
|
-
return external_exports.strictObject({ en: text2, "zh-CN": text2 });
|
|
15097
|
-
}
|
|
15098
|
-
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15099
|
-
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
15100
|
-
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
15101
|
-
var settingField = {
|
|
15102
|
-
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
15103
|
-
label: desktopExtensionLocalizedTextSchema,
|
|
15104
|
-
description: desktopExtensionLocalizedTextSchema.optional()
|
|
15105
|
-
};
|
|
15106
|
-
var numericSetting = {
|
|
15107
|
-
...settingField,
|
|
15108
|
-
step: external_exports.number().positive().optional(),
|
|
15109
|
-
default: external_exports.number().optional()
|
|
15110
|
-
};
|
|
15111
|
-
var settingOption = external_exports.strictObject({
|
|
15112
|
-
value: external_exports.string(),
|
|
15113
|
-
label: desktopExtensionLocalizedTextSchema
|
|
15114
|
-
});
|
|
15115
|
-
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
15116
|
-
external_exports.strictObject({
|
|
15117
|
-
...settingField,
|
|
15118
|
-
type: external_exports.literal("boolean"),
|
|
15119
|
-
default: external_exports.boolean().optional()
|
|
15120
|
-
}),
|
|
15121
|
-
external_exports.strictObject({
|
|
15122
|
-
...settingField,
|
|
15123
|
-
type: external_exports.literal("string"),
|
|
15124
|
-
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
15125
|
-
default: external_exports.string().optional()
|
|
15126
|
-
}),
|
|
15127
|
-
external_exports.strictObject({
|
|
15128
|
-
...numericSetting,
|
|
15129
|
-
type: external_exports.literal("number"),
|
|
15130
|
-
min: external_exports.number().optional(),
|
|
15131
|
-
max: external_exports.number().optional()
|
|
15132
|
-
}),
|
|
15133
|
-
external_exports.strictObject({
|
|
15134
|
-
...numericSetting,
|
|
15135
|
-
type: external_exports.literal("range"),
|
|
15136
|
-
min: external_exports.number(),
|
|
15137
|
-
max: external_exports.number()
|
|
15138
|
-
}),
|
|
15139
|
-
external_exports.strictObject({
|
|
15140
|
-
...settingField,
|
|
15141
|
-
type: external_exports.literal("select"),
|
|
15142
|
-
options: external_exports.array(settingOption).min(1),
|
|
15143
|
-
default: external_exports.string().optional()
|
|
15144
|
-
})
|
|
15145
|
-
]).superRefine((field2, ctx) => {
|
|
15146
|
-
const issue2 = (path8, message) => ctx.addIssue({ code: "custom", path: [path8], message });
|
|
15147
|
-
if (field2.type === "number" || field2.type === "range") {
|
|
15148
|
-
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
15149
|
-
if (min > max)
|
|
15150
|
-
issue2("max", "Must be at least min");
|
|
15151
|
-
if (value !== void 0 && (value < min || value > max))
|
|
15152
|
-
issue2("default", "Must be within min and max");
|
|
15153
|
-
} else if (field2.type === "select") {
|
|
15154
|
-
const values = new Set(field2.options.map(({ value }) => value));
|
|
15155
|
-
if (values.size !== field2.options.length)
|
|
15156
|
-
issue2("options", "Duplicate option values");
|
|
15157
|
-
if (field2.default !== void 0 && !values.has(field2.default))
|
|
15158
|
-
issue2("default", "Must match an option value");
|
|
15159
|
-
}
|
|
15160
|
-
});
|
|
15161
|
-
var manifestHeader = external_exports.object({
|
|
15162
|
-
manifestVersion: external_exports.int().positive(),
|
|
15163
|
-
id: desktopExtensionIdSchema,
|
|
15164
|
-
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
15165
|
-
version: external_exports.string().min(1).max(128),
|
|
15166
|
-
desktopApi: external_exports.int().positive()
|
|
15167
|
-
}).passthrough();
|
|
15168
|
-
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
15169
|
-
manifestVersion: external_exports.literal(1),
|
|
15170
|
-
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
15171
|
-
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
15172
|
-
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
15173
|
-
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
15174
|
-
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
15175
|
-
icon: imagePathSchema.optional(),
|
|
15176
|
-
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
15177
|
-
desktop: external_exports.strictObject({
|
|
15178
|
-
script: pluginRelativeResourceSchema,
|
|
15179
|
-
style: pluginRelativeResourceSchema.optional()
|
|
15180
|
-
}).optional(),
|
|
15181
|
-
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
15182
|
-
slots: slotsSchema.default(() => []),
|
|
15183
|
-
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
15184
|
-
categories: categoriesSchema.optional()
|
|
15185
|
-
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
15186
|
-
var desktopExtensionConfigurationSchema = external_exports.strictObject({
|
|
15187
|
-
version: external_exports.literal(1),
|
|
15188
|
-
revision: external_exports.int().nonnegative(),
|
|
15189
|
-
enabled: external_exports.array(desktopExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs"),
|
|
15190
|
-
reloadToken: external_exports.uuid().optional()
|
|
15191
|
-
});
|
|
15192
|
-
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
15193
|
-
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
15194
|
-
state: external_exports.enum([
|
|
15195
|
-
"running",
|
|
15196
|
-
"disabled",
|
|
15197
|
-
"invalid",
|
|
15198
|
-
"incompatible",
|
|
15199
|
-
"conflict",
|
|
15200
|
-
"failed",
|
|
15201
|
-
"waiting"
|
|
15202
|
-
]),
|
|
15203
|
-
hash: desktopExtensionHashSchema.optional(),
|
|
15204
|
-
error: external_exports.string().optional(),
|
|
15205
|
-
conflictWith: desktopExtensionIdSchema.optional()
|
|
15206
|
-
});
|
|
15207
|
-
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
15208
|
-
controllerPid: external_exports.int().positive(),
|
|
15209
|
-
targetId: external_exports.string().nullable(),
|
|
15210
|
-
updatedAt: external_exports.iso.datetime(),
|
|
15211
|
-
handledReloadToken: external_exports.uuid().optional(),
|
|
15212
|
-
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema)
|
|
15213
|
-
});
|
|
15214
|
-
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
15215
|
-
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15216
|
-
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15217
|
-
}
|
|
15218
|
-
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
15219
|
-
const url2 = new URL(input);
|
|
15220
|
-
return /\.zip$/iu.test(url2.pathname) || isGitHubDesktopExtensionZipballUrl(url2) || url2.origin === "https://github.com" && /^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(url2.pathname) || url2.origin === "https://codeload.github.com" && /^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(url2.pathname);
|
|
15221
|
-
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15222
|
-
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
15223
|
-
id: desktopExtensionIdSchema,
|
|
15224
|
-
version: external_exports.string().trim().min(1).max(128),
|
|
15225
|
-
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
15226
|
-
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
15227
|
-
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
15228
|
-
author: external_exports.string().trim().min(1).max(128),
|
|
15229
|
-
repository: desktopExtensionHttpUrlSchema,
|
|
15230
|
-
stars: external_exports.number().int().min(0).optional(),
|
|
15231
|
-
downloads: external_exports.number().int().min(0).optional(),
|
|
15232
|
-
categories: categoriesSchema.optional(),
|
|
15233
|
-
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
15234
|
-
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
15235
|
-
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15236
|
-
downloadUrl: desktopExtensionZipUrlSchema,
|
|
15237
|
-
sha256: desktopExtensionHashSchema,
|
|
15238
|
-
slots: slotsSchema.optional(),
|
|
15239
|
-
publishedAt: external_exports.string().optional(),
|
|
15240
|
-
updatedAt: external_exports.string().optional(),
|
|
15241
|
-
minCodexHostVersion: external_exports.string().optional()
|
|
15242
|
-
});
|
|
15243
|
-
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
15244
|
-
schemaVersion: external_exports.literal(1),
|
|
15245
|
-
generatedAt: external_exports.string(),
|
|
15246
|
-
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, "Duplicate extension IDs")
|
|
15247
|
-
});
|
|
15248
|
-
var DESKTOP_EXTENSIONS_ASSET_METHOD = "codexhost/desktop/extensions/asset";
|
|
15249
|
-
var DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD = "codexhost/desktop/extensions/settings/get";
|
|
15250
|
-
var DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD = "codexhost/desktop/extensions/settings/set";
|
|
15251
|
-
var DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD = "codexhost/desktop/extensions/backend/invoke";
|
|
15252
|
-
var extensionIdParams = { id: desktopExtensionIdSchema };
|
|
15253
|
-
var desktopExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
15254
|
-
...extensionIdParams,
|
|
15255
|
-
path: desktopExtensionAssetPathSchema
|
|
15256
|
-
});
|
|
15257
|
-
var desktopExtensionsAssetResultSchema = external_exports.strictObject({
|
|
15258
|
-
mimeType: external_exports.string(),
|
|
15259
|
-
dataUrl: external_exports.string()
|
|
15260
|
-
});
|
|
15261
|
-
var desktopExtensionsSettingsGetParamsSchema = external_exports.strictObject(extensionIdParams);
|
|
15262
|
-
var desktopExtensionsSettingsSetParamsSchema = external_exports.strictObject({
|
|
15263
|
-
...extensionIdParams,
|
|
15264
|
-
values: jsonObjectSchema
|
|
15265
|
-
});
|
|
15266
|
-
var desktopExtensionsSettingsResultSchema = external_exports.strictObject({ values: jsonObjectSchema });
|
|
15267
|
-
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
15268
|
-
var desktopExtensionsBackendInvokeParamsSchema = external_exports.strictObject({
|
|
15269
|
-
...extensionIdParams,
|
|
15270
|
-
method: desktopExtensionBackendMethodSchema,
|
|
15271
|
-
params: jsonValueSchema.optional()
|
|
15272
|
-
});
|
|
15273
|
-
var desktopExtensionsBackendInvokeResultSchema = external_exports.strictObject({
|
|
15274
|
-
result: jsonValueSchema
|
|
15275
|
-
});
|
|
15276
|
-
|
|
15277
|
-
// ../../shared-contracts/dist/desktop-extension-management.js
|
|
15278
|
-
var DESKTOP_EXTENSIONS_LIST_METHOD = "codexhost/desktop/extensions/list";
|
|
15279
|
-
var DESKTOP_EXTENSIONS_ENABLE_METHOD = "codexhost/desktop/extensions/enable";
|
|
15280
|
-
var DESKTOP_EXTENSIONS_DISABLE_METHOD = "codexhost/desktop/extensions/disable";
|
|
15281
|
-
var DESKTOP_EXTENSIONS_CATALOG_METHOD = "codexhost/desktop/extensions/catalog";
|
|
15282
|
-
var DESKTOP_EXTENSIONS_INSTALL_METHOD = "codexhost/desktop/extensions/install";
|
|
15283
|
-
var DESKTOP_EXTENSIONS_UNINSTALL_METHOD = "codexhost/desktop/extensions/uninstall";
|
|
15284
|
-
var DESKTOP_EXTENSIONS_RECOVER_METHOD = "codexhost/desktop/extensions/disable-all-and-reload";
|
|
15285
|
-
var DESKTOP_EXTENSION_MANAGEMENT_METHODS = [
|
|
15286
|
-
DESKTOP_EXTENSIONS_LIST_METHOD,
|
|
15287
|
-
DESKTOP_EXTENSIONS_ENABLE_METHOD,
|
|
15288
|
-
DESKTOP_EXTENSIONS_DISABLE_METHOD,
|
|
15289
|
-
DESKTOP_EXTENSIONS_RECOVER_METHOD,
|
|
15290
|
-
DESKTOP_EXTENSIONS_CATALOG_METHOD,
|
|
15291
|
-
DESKTOP_EXTENSIONS_INSTALL_METHOD,
|
|
15292
|
-
DESKTOP_EXTENSIONS_UNINSTALL_METHOD,
|
|
15293
|
-
DESKTOP_EXTENSIONS_ASSET_METHOD,
|
|
15294
|
-
DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD,
|
|
15295
|
-
DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD,
|
|
15296
|
-
DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD
|
|
15297
|
-
];
|
|
15298
|
-
var revisionSchema = external_exports.int().nonnegative();
|
|
15299
|
-
var desktopExtensionsListParamsSchema = external_exports.strictObject({});
|
|
15300
|
-
var desktopExtensionSelectionParamsSchema = external_exports.strictObject({
|
|
15301
|
-
id: desktopExtensionIdSchema,
|
|
15302
|
-
expectedRevision: revisionSchema
|
|
15303
|
-
});
|
|
15304
|
-
var desktopExtensionsRecoveryParamsSchema = external_exports.strictObject({
|
|
15305
|
-
expectedRevision: revisionSchema.optional()
|
|
15306
|
-
});
|
|
15307
|
-
var rasterDataUrlSchema = (maxBytes) => external_exports.string().max("data:image/jpeg;base64,".length + 4 * Math.ceil(maxBytes / 3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
15308
|
-
var desktopExtensionListItemSchema = external_exports.strictObject({
|
|
15309
|
-
// An invalid discovery can have a directory name that isn't a valid extension ID.
|
|
15310
|
-
id: external_exports.string().min(1),
|
|
15311
|
-
manifest: desktopExtensionManifestSchema.optional(),
|
|
15312
|
-
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
15313
|
-
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15314
|
-
enabled: external_exports.boolean(),
|
|
15315
|
-
status: desktopExtensionStatusSchema
|
|
15316
|
-
});
|
|
15317
|
-
var desktopExtensionsListResultSchema = external_exports.strictObject({
|
|
15318
|
-
configuration: desktopExtensionConfigurationSchema,
|
|
15319
|
-
desktopConnected: external_exports.boolean(),
|
|
15320
|
-
diagnostics: external_exports.array(external_exports.string()),
|
|
15321
|
-
extensions: external_exports.array(desktopExtensionListItemSchema)
|
|
15322
|
-
});
|
|
15323
|
-
var desktopExtensionsCatalogParamsSchema = external_exports.strictObject({
|
|
15324
|
-
forceRefresh: external_exports.boolean().optional()
|
|
15325
|
-
});
|
|
15326
|
-
var desktopExtensionsCatalogResultSchema = external_exports.strictObject({
|
|
15327
|
-
catalogUrl: external_exports.string(),
|
|
15328
|
-
source: external_exports.enum(["remote", "fallback"]),
|
|
15329
|
-
fetchedAt: external_exports.string(),
|
|
15330
|
-
cached: external_exports.boolean(),
|
|
15331
|
-
extensions: desktopExtensionCatalogSchema.shape.extensions,
|
|
15332
|
-
error: external_exports.string().optional()
|
|
15333
|
-
});
|
|
15334
|
-
var desktopExtensionsInstallParamsSchema = external_exports.strictObject({
|
|
15335
|
-
source: external_exports.discriminatedUnion("type", [
|
|
15336
|
-
external_exports.strictObject({ type: external_exports.literal("catalog"), id: desktopExtensionIdSchema }),
|
|
15337
|
-
external_exports.strictObject({
|
|
15338
|
-
type: external_exports.literal("url"),
|
|
15339
|
-
url: desktopExtensionHttpUrlSchema,
|
|
15340
|
-
expectedSha256: desktopExtensionHashSchema.optional()
|
|
15341
|
-
}),
|
|
15342
|
-
external_exports.strictObject({
|
|
15343
|
-
type: external_exports.literal("zip-base64"),
|
|
15344
|
-
fileName: external_exports.string().trim().min(1).max(255),
|
|
15345
|
-
contentBase64: external_exports.string().min(4).max(DESKTOP_EXTENSION_ZIP_MAX_BASE64_LENGTH).refine((value) => value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/u.test(value), "Expected standard padded base64")
|
|
15346
|
-
})
|
|
15347
|
-
])
|
|
15348
|
-
});
|
|
15349
|
-
var desktopExtensionsInstallResultSchema = external_exports.strictObject({
|
|
15350
|
-
extensionId: desktopExtensionIdSchema,
|
|
15351
|
-
version: external_exports.string().min(1),
|
|
15352
|
-
replaced: external_exports.boolean(),
|
|
15353
|
-
installedPath: external_exports.string(),
|
|
15354
|
-
list: desktopExtensionsListResultSchema
|
|
15355
|
-
});
|
|
15356
|
-
var desktopExtensionsUninstallParamsSchema = external_exports.strictObject({
|
|
15357
|
-
id: desktopExtensionIdSchema
|
|
15358
|
-
});
|
|
15359
|
-
var desktopExtensionsUninstallResultSchema = external_exports.strictObject({
|
|
15360
|
-
removedId: desktopExtensionIdSchema,
|
|
15361
|
-
list: desktopExtensionsListResultSchema
|
|
15362
|
-
});
|
|
15363
|
-
var desktopExtensionMutationResultSchema = external_exports.discriminatedUnion("state", [
|
|
15364
|
-
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: desktopExtensionConfigurationSchema }),
|
|
15365
|
-
external_exports.strictObject({ state: external_exports.literal("slot-conflict"), conflictWith: desktopExtensionIdSchema }),
|
|
15366
|
-
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: revisionSchema })
|
|
15367
|
-
]);
|
|
15368
|
-
|
|
15369
|
-
// ../../shared-contracts/dist/errors.js
|
|
15370
|
-
var codexhostErrorSchema = external_exports.strictObject({
|
|
15371
|
-
code: external_exports.string().min(1),
|
|
15372
|
-
message: external_exports.string().min(1),
|
|
15373
|
-
retryable: external_exports.boolean(),
|
|
15374
|
-
diagnostic: external_exports.string().min(1).optional(),
|
|
15375
|
-
stage: external_exports.string().min(1).optional(),
|
|
15376
|
-
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
15377
|
-
stderrTail: external_exports.string().min(1).optional()
|
|
15378
|
-
}).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
|
|
15379
|
-
|
|
15380
|
-
// ../../shared-contracts/dist/harness-presentation.js
|
|
15381
|
-
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
15382
|
-
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
|
|
15383
|
-
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
15384
|
-
label: displayText(256).optional(),
|
|
15385
|
-
description: displayText(1024).optional()
|
|
15386
|
-
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15387
|
-
var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15388
|
-
|
|
15389
|
-
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
15390
|
-
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
15391
|
-
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
15392
|
-
var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
|
|
15393
|
-
var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
|
|
15394
|
-
var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15395
|
-
message: "Value must not be empty or whitespace"
|
|
15396
|
-
});
|
|
15397
|
-
var harnessPermissionModeIdSchema = nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~:-]+$/u, "Permission Mode ID must use transport-safe characters").brand();
|
|
15398
|
-
var harnessPermissionModeSchema = external_exports.object({
|
|
15399
|
-
id: harnessPermissionModeIdSchema,
|
|
15400
|
-
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
15401
|
-
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
15402
|
-
dangerous: external_exports.boolean().optional(),
|
|
15403
|
-
localizations: harnessLocalizationsSchema.optional()
|
|
15404
|
-
}).strict();
|
|
15405
|
-
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
15406
|
-
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
15407
|
-
defaultModeId: harnessPermissionModeIdSchema
|
|
15408
|
-
}).strict().superRefine((catalog, context) => {
|
|
15409
|
-
const ids = /* @__PURE__ */ new Set();
|
|
15410
|
-
for (const [index, mode] of catalog.modes.entries()) {
|
|
15411
|
-
if (ids.has(mode.id)) {
|
|
15412
|
-
context.addIssue({
|
|
15413
|
-
code: "custom",
|
|
15414
|
-
message: "Permission Mode IDs must be unique",
|
|
15415
|
-
path: ["modes", index, "id"]
|
|
15416
|
-
});
|
|
15417
|
-
}
|
|
15418
|
-
ids.add(mode.id);
|
|
15419
|
-
}
|
|
15420
|
-
if (!ids.has(catalog.defaultModeId)) {
|
|
15421
|
-
context.addIssue({
|
|
15422
|
-
code: "custom",
|
|
15423
|
-
message: "Default Permission Mode must exist in the catalog",
|
|
15424
|
-
path: ["defaultModeId"]
|
|
15425
|
-
});
|
|
15009
|
+
if (!ids.has(catalog.defaultModeId)) {
|
|
15010
|
+
context.addIssue({
|
|
15011
|
+
code: "custom",
|
|
15012
|
+
message: "Default Permission Mode must exist in the catalog",
|
|
15013
|
+
path: ["defaultModeId"]
|
|
15014
|
+
});
|
|
15426
15015
|
}
|
|
15427
15016
|
});
|
|
15428
15017
|
var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
@@ -15430,6 +15019,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
|
15430
15019
|
permissionModeId: harnessPermissionModeIdSchema
|
|
15431
15020
|
}).strict();
|
|
15432
15021
|
|
|
15022
|
+
// ../../shared-contracts/dist/harness-route-limit.js
|
|
15023
|
+
var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
|
|
15024
|
+
|
|
15433
15025
|
// ../../shared-contracts/dist/thread-usage.js
|
|
15434
15026
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15435
15027
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -15462,7 +15054,7 @@ var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
|
15462
15054
|
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
15463
15055
|
label: indicatorTextSchema(256).optional(),
|
|
15464
15056
|
tooltip: indicatorTextSchema(1024).optional()
|
|
15465
|
-
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) =>
|
|
15057
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
|
|
15466
15058
|
message: "Composer indicator IDs must be unique"
|
|
15467
15059
|
});
|
|
15468
15060
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
@@ -15488,6 +15080,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
15488
15080
|
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
15489
15081
|
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
15490
15082
|
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15083
|
+
latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15491
15084
|
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
15492
15085
|
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
15493
15086
|
}).strict().superRefine((usage, context) => {
|
|
@@ -15615,10 +15208,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
|
15615
15208
|
var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15616
15209
|
message: "Value must not be empty or whitespace"
|
|
15617
15210
|
});
|
|
15618
|
-
var harnessModelRefIdSchema =
|
|
15211
|
+
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();
|
|
15212
|
+
var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
|
|
15619
15213
|
var harnessModelRefSchema = external_exports.object({
|
|
15620
|
-
id: harnessModelRefIdSchema
|
|
15214
|
+
id: harnessModelRefIdSchema,
|
|
15215
|
+
serviceTier: harnessModelServiceTierSchema.optional()
|
|
15621
15216
|
}).strict();
|
|
15217
|
+
function sameHarnessModelRef(left, right) {
|
|
15218
|
+
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
15219
|
+
}
|
|
15622
15220
|
var harnessThinkingOptionIdSchema = nonBlankTextSchema2.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
|
|
15623
15221
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
15624
15222
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
@@ -15632,7 +15230,15 @@ var harnessModelSchema = external_exports.object({
|
|
|
15632
15230
|
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
15633
15231
|
fastModel: harnessModelRefSchema.optional(),
|
|
15634
15232
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
15635
|
-
}).strict()
|
|
15233
|
+
}).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
|
|
15234
|
+
path: ["fastModel", "id"],
|
|
15235
|
+
message: "A tiered Fast Model must share the base Model ID"
|
|
15236
|
+
});
|
|
15237
|
+
function catalogModelForRef(catalog, ref) {
|
|
15238
|
+
if (!ref)
|
|
15239
|
+
return void 0;
|
|
15240
|
+
return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
|
|
15241
|
+
}
|
|
15636
15242
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
15637
15243
|
const ids = /* @__PURE__ */ new Set();
|
|
15638
15244
|
for (const [index, option] of options.entries()) {
|
|
@@ -15652,26 +15258,26 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15652
15258
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
15653
15259
|
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
15654
15260
|
}).strict().superRefine((catalog, context) => {
|
|
15655
|
-
const refs =
|
|
15656
|
-
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) =>
|
|
15261
|
+
const refs = [];
|
|
15262
|
+
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
|
|
15657
15263
|
for (const [index, model2] of catalog.models.entries()) {
|
|
15658
|
-
if (refs.
|
|
15264
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
|
|
15659
15265
|
context.addIssue({
|
|
15660
15266
|
code: "custom",
|
|
15661
15267
|
message: "Model Catalog refs must be unique",
|
|
15662
15268
|
path: ["models", index, "ref", "id"]
|
|
15663
15269
|
});
|
|
15664
15270
|
}
|
|
15665
|
-
refs.
|
|
15271
|
+
refs.push(model2.ref);
|
|
15666
15272
|
if (model2.fastModel) {
|
|
15667
|
-
if (refs.
|
|
15273
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
|
|
15668
15274
|
context.addIssue({
|
|
15669
15275
|
code: "custom",
|
|
15670
15276
|
message: "Fast Model refs must be distinct and unique",
|
|
15671
15277
|
path: ["models", index, "fastModel"]
|
|
15672
15278
|
});
|
|
15673
15279
|
}
|
|
15674
|
-
refs.
|
|
15280
|
+
refs.push(model2.fastModel);
|
|
15675
15281
|
}
|
|
15676
15282
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
15677
15283
|
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
@@ -15692,7 +15298,7 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15692
15298
|
}
|
|
15693
15299
|
}
|
|
15694
15300
|
}
|
|
15695
|
-
if (catalog.defaultModel && !
|
|
15301
|
+
if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
|
|
15696
15302
|
context.addIssue({
|
|
15697
15303
|
code: "custom",
|
|
15698
15304
|
message: "Default Model must exist in the Model Catalog",
|
|
@@ -15715,184 +15321,735 @@ var harnessHistoryCapabilitiesSchema = external_exports.object({
|
|
|
15715
15321
|
path: ["forkAcrossCwd"],
|
|
15716
15322
|
message: "Cross-cwd Fork requires exact history Fork support"
|
|
15717
15323
|
});
|
|
15718
|
-
var harnessPermissionModeScopeSchema = external_exports.enum(["live", "atCreate"]);
|
|
15719
|
-
var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
15720
|
-
configuration: external_exports.object({
|
|
15721
|
-
selectModel: external_exports.boolean(),
|
|
15722
|
-
selectThinkingOption: external_exports.boolean(),
|
|
15723
|
-
selectPermissionMode: external_exports.boolean(),
|
|
15724
|
-
permissionModeScope: harnessPermissionModeScopeSchema.default("live")
|
|
15725
|
-
}).strict(),
|
|
15726
|
-
history: harnessHistoryCapabilitiesSchema,
|
|
15727
|
-
subagents: external_exports.object({
|
|
15728
|
-
observe: external_exports.boolean(),
|
|
15729
|
-
readTranscript: external_exports.boolean()
|
|
15730
|
-
}).strict().optional(),
|
|
15731
|
-
autonomousTurns: external_exports.object({
|
|
15732
|
-
observe: external_exports.boolean()
|
|
15733
|
-
}).strict().optional(),
|
|
15734
|
-
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15735
|
-
steer: external_exports.boolean().optional()
|
|
15736
|
-
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
15324
|
+
var harnessPermissionModeScopeSchema = external_exports.enum(["live", "atCreate"]);
|
|
15325
|
+
var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
15326
|
+
configuration: external_exports.object({
|
|
15327
|
+
selectModel: external_exports.boolean(),
|
|
15328
|
+
selectThinkingOption: external_exports.boolean(),
|
|
15329
|
+
selectPermissionMode: external_exports.boolean(),
|
|
15330
|
+
permissionModeScope: harnessPermissionModeScopeSchema.default("live")
|
|
15331
|
+
}).strict(),
|
|
15332
|
+
history: harnessHistoryCapabilitiesSchema,
|
|
15333
|
+
subagents: external_exports.object({
|
|
15334
|
+
observe: external_exports.boolean(),
|
|
15335
|
+
readTranscript: external_exports.boolean()
|
|
15336
|
+
}).strict().optional(),
|
|
15337
|
+
autonomousTurns: external_exports.object({
|
|
15338
|
+
observe: external_exports.boolean()
|
|
15339
|
+
}).strict().optional(),
|
|
15340
|
+
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15341
|
+
steer: external_exports.boolean().optional(),
|
|
15342
|
+
/**
|
|
15343
|
+
* True when the native plan (task list) outlives the Turn that changed it, so a reopened
|
|
15344
|
+
* Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
|
|
15345
|
+
*/
|
|
15346
|
+
persistentPlan: external_exports.boolean().optional()
|
|
15347
|
+
}).strict();
|
|
15348
|
+
var harnessConfigurationStateSchema = external_exports.object({
|
|
15349
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
15350
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15351
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15352
|
+
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15353
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
15354
|
+
}).strict().superRefine((state, context) => {
|
|
15355
|
+
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
|
|
15356
|
+
context.addIssue({
|
|
15357
|
+
code: "custom",
|
|
15358
|
+
message: "Effective Thinking option must be currently available",
|
|
15359
|
+
path: ["effectiveThinkingOptionId"]
|
|
15360
|
+
});
|
|
15361
|
+
}
|
|
15362
|
+
});
|
|
15363
|
+
var harnessWebUiCapabilitySchema = external_exports.object({
|
|
15364
|
+
open: external_exports.literal(true)
|
|
15365
|
+
}).strict();
|
|
15366
|
+
var readyHarnessInspectionSchema = external_exports.object({
|
|
15367
|
+
status: external_exports.literal("ready"),
|
|
15368
|
+
catalog: harnessModelCatalogSchema,
|
|
15369
|
+
permissionModes: harnessPermissionModeCatalogSchema.optional(),
|
|
15370
|
+
capabilities: harnessSessionCapabilitiesSchema,
|
|
15371
|
+
webUi: harnessWebUiCapabilitySchema.optional()
|
|
15372
|
+
}).strict().superRefine((inspection, context) => {
|
|
15373
|
+
const selectable = inspection.capabilities.configuration.selectPermissionMode;
|
|
15374
|
+
if (selectable !== Boolean(inspection.permissionModes)) {
|
|
15375
|
+
context.addIssue({
|
|
15376
|
+
code: "custom",
|
|
15377
|
+
message: "Permission Mode catalog and capability must agree",
|
|
15378
|
+
path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
|
|
15379
|
+
});
|
|
15380
|
+
}
|
|
15381
|
+
});
|
|
15382
|
+
var failedHarnessInspectionSchema = external_exports.object({
|
|
15383
|
+
status: external_exports.enum(["notInstalled", "unavailable", "error"]),
|
|
15384
|
+
error: codexhostErrorSchema
|
|
15385
|
+
}).strict();
|
|
15386
|
+
var harnessInspectionSchema = external_exports.union([
|
|
15387
|
+
readyHarnessInspectionSchema,
|
|
15388
|
+
failedHarnessInspectionSchema
|
|
15389
|
+
]);
|
|
15390
|
+
var harnessInspectParamsSchema = external_exports.object({
|
|
15391
|
+
harnessId: harnessIdSchema,
|
|
15392
|
+
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
15393
|
+
refresh: external_exports.boolean().optional(),
|
|
15394
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
15395
|
+
purpose: external_exports.literal("availability").optional(),
|
|
15396
|
+
credentialAccess: external_exports.enum(["allow", "retry"]).optional()
|
|
15397
|
+
}).strict();
|
|
15398
|
+
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15399
|
+
harnessId: harnessIdSchema
|
|
15400
|
+
}).strict();
|
|
15401
|
+
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
15402
|
+
var threadModelSelectParamsSchema = external_exports.object({
|
|
15403
|
+
threadId: hostThreadIdSchema,
|
|
15404
|
+
model: harnessModelRefSchema
|
|
15405
|
+
}).strict();
|
|
15406
|
+
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
15407
|
+
threadId: hostThreadIdSchema,
|
|
15408
|
+
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15409
|
+
}).strict();
|
|
15410
|
+
var threadInspectionParamsSchema = external_exports.object({
|
|
15411
|
+
threadId: hostThreadIdSchema,
|
|
15412
|
+
includeReferenceCapability: external_exports.boolean().optional()
|
|
15413
|
+
}).strict();
|
|
15414
|
+
var codexThreadInspectionSchema = external_exports.object({
|
|
15415
|
+
owner: external_exports.literal("codex"),
|
|
15416
|
+
locked: external_exports.boolean(),
|
|
15417
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
15418
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15419
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15420
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15421
|
+
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
15422
|
+
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15423
|
+
}).strict();
|
|
15424
|
+
var externalThreadInspectionSchema = external_exports.object({
|
|
15425
|
+
owner: external_exports.literal("external"),
|
|
15426
|
+
harnessId: nonBlankTextSchema2.max(256),
|
|
15427
|
+
transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
|
|
15428
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
15429
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15430
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15431
|
+
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15432
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15433
|
+
history: harnessHistoryCapabilitiesSchema,
|
|
15434
|
+
usage: threadUsageSnapshotSchema.optional(),
|
|
15435
|
+
locked: external_exports.literal(true)
|
|
15436
|
+
}).strict();
|
|
15437
|
+
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
15438
|
+
codexThreadInspectionSchema,
|
|
15439
|
+
externalThreadInspectionSchema
|
|
15440
|
+
]);
|
|
15441
|
+
var threadOwnershipListParamsSchema = external_exports.object({
|
|
15442
|
+
threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15443
|
+
}).strict().superRefine(({ threadIds }, context) => {
|
|
15444
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15445
|
+
for (const [index, threadId] of threadIds.entries()) {
|
|
15446
|
+
if (seen.has(threadId)) {
|
|
15447
|
+
context.addIssue({
|
|
15448
|
+
code: "custom",
|
|
15449
|
+
message: "Thread ownership-list IDs must be unique",
|
|
15450
|
+
path: ["threadIds", index]
|
|
15451
|
+
});
|
|
15452
|
+
}
|
|
15453
|
+
seen.add(threadId);
|
|
15454
|
+
}
|
|
15455
|
+
});
|
|
15456
|
+
var codexThreadOwnershipSchema = external_exports.object({
|
|
15457
|
+
threadId: hostThreadIdSchema,
|
|
15458
|
+
owner: external_exports.literal("codex")
|
|
15459
|
+
}).strict();
|
|
15460
|
+
var externalThreadOwnershipSchema = external_exports.object({
|
|
15461
|
+
threadId: hostThreadIdSchema,
|
|
15462
|
+
owner: external_exports.literal("external"),
|
|
15463
|
+
harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
|
|
15464
|
+
}).strict();
|
|
15465
|
+
var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
|
|
15466
|
+
codexThreadOwnershipSchema,
|
|
15467
|
+
externalThreadOwnershipSchema
|
|
15468
|
+
]);
|
|
15469
|
+
var threadOwnershipListResultSchema = external_exports.object({
|
|
15470
|
+
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15471
|
+
}).strict().superRefine(({ threads }, context) => {
|
|
15472
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15473
|
+
for (const [index, thread2] of threads.entries()) {
|
|
15474
|
+
if (seen.has(thread2.threadId)) {
|
|
15475
|
+
context.addIssue({
|
|
15476
|
+
code: "custom",
|
|
15477
|
+
message: "Thread ownership-list results must be unique",
|
|
15478
|
+
path: ["threads", index, "threadId"]
|
|
15479
|
+
});
|
|
15480
|
+
}
|
|
15481
|
+
seen.add(thread2.threadId);
|
|
15482
|
+
}
|
|
15483
|
+
});
|
|
15484
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
15485
|
+
threadId: hostThreadIdSchema,
|
|
15486
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15487
|
+
text: external_exports.string().optional()
|
|
15488
|
+
}).strict();
|
|
15489
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15490
|
+
kind: external_exports.literal("application"),
|
|
15491
|
+
value: external_exports.string().transform((text2, context) => {
|
|
15492
|
+
try {
|
|
15493
|
+
return JSON.parse(text2);
|
|
15494
|
+
} catch {
|
|
15495
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15496
|
+
return external_exports.NEVER;
|
|
15497
|
+
}
|
|
15498
|
+
}).pipe(external_exports.object({
|
|
15499
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15500
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15501
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15502
|
+
}).strict())
|
|
15503
|
+
}).strict().transform((context) => context.value);
|
|
15504
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15505
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15506
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15507
|
+
}).strict();
|
|
15508
|
+
|
|
15509
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
15510
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15511
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
15512
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
15513
|
+
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
15514
|
+
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
15515
|
+
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
|
|
15516
|
+
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");
|
|
15517
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
15518
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
15519
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
15520
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
15521
|
+
before: localizedTextSchema.optional(),
|
|
15522
|
+
after: localizedTextSchema.optional(),
|
|
15523
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
15524
|
+
}).strict();
|
|
15525
|
+
var pluginPresentationShape = {
|
|
15526
|
+
id: installedHarnessPluginIdSchema,
|
|
15527
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
15528
|
+
version: external_exports.string().min(1).max(128),
|
|
15529
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
15530
|
+
kind: external_exports.literal("usage").optional(),
|
|
15531
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
15532
|
+
iconStyle: external_exports.object({
|
|
15533
|
+
vector: external_exports.object({
|
|
15534
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
15535
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
15536
|
+
paths: external_exports.array(external_exports.object({
|
|
15537
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
15538
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
15539
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
15540
|
+
}).strict()).min(1).max(32)
|
|
15541
|
+
}).strict().optional(),
|
|
15542
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
15543
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
15544
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
15545
|
+
}).strict().optional(),
|
|
15546
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
15547
|
+
notice: localizedTextSchema.optional(),
|
|
15548
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
15549
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
15550
|
+
links: external_exports.object({
|
|
15551
|
+
website: documentationUrlSchema.optional(),
|
|
15552
|
+
documentation: documentationUrlSchema.optional(),
|
|
15553
|
+
installation: documentationUrlSchema.optional()
|
|
15554
|
+
}).strict().optional()
|
|
15555
|
+
};
|
|
15556
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
15557
|
+
manifestVersion: external_exports.literal(1),
|
|
15558
|
+
...pluginPresentationShape,
|
|
15559
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
15560
|
+
entry: pluginRelativeResourceSchema,
|
|
15561
|
+
icon: pluginRelativeResourceSchema.optional()
|
|
15562
|
+
}).strict();
|
|
15563
|
+
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);
|
|
15564
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
15565
|
+
...pluginPresentationShape,
|
|
15566
|
+
icon: harnessPluginIconSchema.optional()
|
|
15567
|
+
}).strict();
|
|
15568
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
15569
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
15570
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
15571
|
+
}).strict();
|
|
15572
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
15573
|
+
version: external_exports.literal(1),
|
|
15574
|
+
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15575
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
15576
|
+
message: "Enabled plugin IDs must be unique",
|
|
15577
|
+
path: ["enabled"]
|
|
15578
|
+
});
|
|
15579
|
+
|
|
15580
|
+
// ../../shared-contracts/dist/desktop-extensions.js
|
|
15581
|
+
var DESKTOP_EXTENSION_API_VERSION = 1;
|
|
15582
|
+
var DESKTOP_EXTENSION_LIMIT = 64;
|
|
15583
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
|
|
15584
|
+
var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
|
|
15585
|
+
var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
|
|
15586
|
+
var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
|
|
15587
|
+
var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
|
|
15588
|
+
var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
|
|
15589
|
+
var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
|
|
15590
|
+
var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
|
|
15591
|
+
var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
15592
|
+
var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
|
|
15593
|
+
var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
|
|
15594
|
+
var desktopExtensionIdSchema = installedPluginIdSchema;
|
|
15595
|
+
var desktopExtensionSlotSchema = external_exports.enum([
|
|
15596
|
+
"sidebar.thread-layout",
|
|
15597
|
+
"sidebar.thread-badge",
|
|
15598
|
+
"appearance.theme"
|
|
15599
|
+
]);
|
|
15600
|
+
var desktopExtensionCategorySchema = external_exports.enum([
|
|
15601
|
+
"appearance",
|
|
15602
|
+
"interface",
|
|
15603
|
+
"workflow",
|
|
15604
|
+
"analytics",
|
|
15605
|
+
"integrations",
|
|
15606
|
+
"tools"
|
|
15607
|
+
]);
|
|
15608
|
+
var extensionName = external_exports.string().trim().min(1).max(128);
|
|
15609
|
+
function desktopExtensionScreenshotMimeType(resource) {
|
|
15610
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
15611
|
+
case "png":
|
|
15612
|
+
return "image/png";
|
|
15613
|
+
case "jpg":
|
|
15614
|
+
case "jpeg":
|
|
15615
|
+
return "image/jpeg";
|
|
15616
|
+
case "webp":
|
|
15617
|
+
return "image/webp";
|
|
15618
|
+
default:
|
|
15619
|
+
return void 0;
|
|
15620
|
+
}
|
|
15621
|
+
}
|
|
15622
|
+
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
15623
|
+
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");
|
|
15624
|
+
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) => {
|
|
15625
|
+
const { username, password } = new URL(value);
|
|
15626
|
+
return !username && !password && !/[\\\s]/u.test(value);
|
|
15627
|
+
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15628
|
+
function localizedText(text2) {
|
|
15629
|
+
return external_exports.strictObject({ en: text2, "zh-CN": text2 });
|
|
15630
|
+
}
|
|
15631
|
+
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15632
|
+
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
15633
|
+
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
15634
|
+
var settingField = {
|
|
15635
|
+
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
15636
|
+
label: desktopExtensionLocalizedTextSchema,
|
|
15637
|
+
description: desktopExtensionLocalizedTextSchema.optional()
|
|
15638
|
+
};
|
|
15639
|
+
var numericSetting = {
|
|
15640
|
+
...settingField,
|
|
15641
|
+
step: external_exports.number().positive().optional(),
|
|
15642
|
+
default: external_exports.number().optional()
|
|
15643
|
+
};
|
|
15644
|
+
var settingOption = external_exports.strictObject({
|
|
15645
|
+
value: external_exports.string(),
|
|
15646
|
+
label: desktopExtensionLocalizedTextSchema
|
|
15647
|
+
});
|
|
15648
|
+
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
15649
|
+
external_exports.strictObject({
|
|
15650
|
+
...settingField,
|
|
15651
|
+
type: external_exports.literal("boolean"),
|
|
15652
|
+
default: external_exports.boolean().optional()
|
|
15653
|
+
}),
|
|
15654
|
+
external_exports.strictObject({
|
|
15655
|
+
...settingField,
|
|
15656
|
+
type: external_exports.literal("string"),
|
|
15657
|
+
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
15658
|
+
default: external_exports.string().optional()
|
|
15659
|
+
}),
|
|
15660
|
+
external_exports.strictObject({
|
|
15661
|
+
...numericSetting,
|
|
15662
|
+
type: external_exports.literal("number"),
|
|
15663
|
+
min: external_exports.number().optional(),
|
|
15664
|
+
max: external_exports.number().optional()
|
|
15665
|
+
}),
|
|
15666
|
+
external_exports.strictObject({
|
|
15667
|
+
...numericSetting,
|
|
15668
|
+
type: external_exports.literal("range"),
|
|
15669
|
+
min: external_exports.number(),
|
|
15670
|
+
max: external_exports.number()
|
|
15671
|
+
}),
|
|
15672
|
+
external_exports.strictObject({
|
|
15673
|
+
...settingField,
|
|
15674
|
+
type: external_exports.literal("select"),
|
|
15675
|
+
options: external_exports.array(settingOption).min(1),
|
|
15676
|
+
default: external_exports.string().optional()
|
|
15677
|
+
})
|
|
15678
|
+
]).superRefine((field2, ctx) => {
|
|
15679
|
+
const issue2 = (path8, message) => ctx.addIssue({ code: "custom", path: [path8], message });
|
|
15680
|
+
if (field2.type === "number" || field2.type === "range") {
|
|
15681
|
+
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
15682
|
+
if (min > max)
|
|
15683
|
+
issue2("max", "Must be at least min");
|
|
15684
|
+
if (value !== void 0 && (value < min || value > max))
|
|
15685
|
+
issue2("default", "Must be within min and max");
|
|
15686
|
+
} else if (field2.type === "select") {
|
|
15687
|
+
const values = new Set(field2.options.map(({ value }) => value));
|
|
15688
|
+
if (values.size !== field2.options.length)
|
|
15689
|
+
issue2("options", "Duplicate option values");
|
|
15690
|
+
if (field2.default !== void 0 && !values.has(field2.default))
|
|
15691
|
+
issue2("default", "Must match an option value");
|
|
15692
|
+
}
|
|
15693
|
+
});
|
|
15694
|
+
var manifestHeader = external_exports.object({
|
|
15695
|
+
manifestVersion: external_exports.int().positive(),
|
|
15696
|
+
id: desktopExtensionIdSchema,
|
|
15697
|
+
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
15698
|
+
version: external_exports.string().min(1).max(128),
|
|
15699
|
+
desktopApi: external_exports.int().positive()
|
|
15700
|
+
}).passthrough();
|
|
15701
|
+
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
15702
|
+
manifestVersion: external_exports.literal(1),
|
|
15703
|
+
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
15704
|
+
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
15705
|
+
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
15706
|
+
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
15707
|
+
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
15708
|
+
icon: imagePathSchema.optional(),
|
|
15709
|
+
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
15710
|
+
desktop: external_exports.strictObject({
|
|
15711
|
+
script: pluginRelativeResourceSchema,
|
|
15712
|
+
style: pluginRelativeResourceSchema.optional()
|
|
15713
|
+
}).optional(),
|
|
15714
|
+
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
15715
|
+
slots: slotsSchema.default(() => []),
|
|
15716
|
+
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
15717
|
+
categories: categoriesSchema.optional()
|
|
15718
|
+
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
15719
|
+
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
15720
|
+
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
15721
|
+
state: external_exports.enum([
|
|
15722
|
+
"running",
|
|
15723
|
+
"disabled",
|
|
15724
|
+
"invalid",
|
|
15725
|
+
"incompatible",
|
|
15726
|
+
"conflict",
|
|
15727
|
+
"failed",
|
|
15728
|
+
"waiting"
|
|
15729
|
+
]),
|
|
15730
|
+
hash: desktopExtensionHashSchema.optional(),
|
|
15731
|
+
error: external_exports.string().optional(),
|
|
15732
|
+
conflictWith: desktopExtensionIdSchema.optional()
|
|
15733
|
+
});
|
|
15734
|
+
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
15735
|
+
controllerPid: external_exports.int().positive(),
|
|
15736
|
+
targetId: external_exports.string().nullable(),
|
|
15737
|
+
updatedAt: external_exports.iso.datetime(),
|
|
15738
|
+
handledReloadToken: external_exports.uuid().optional(),
|
|
15739
|
+
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
|
|
15740
|
+
surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
|
|
15741
|
+
});
|
|
15742
|
+
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
15743
|
+
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15744
|
+
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15745
|
+
}
|
|
15746
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
15747
|
+
const url2 = new URL(input);
|
|
15748
|
+
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);
|
|
15749
|
+
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15750
|
+
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
15751
|
+
id: desktopExtensionIdSchema,
|
|
15752
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15753
|
+
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
15754
|
+
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
15755
|
+
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
15756
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
15757
|
+
repository: desktopExtensionHttpUrlSchema,
|
|
15758
|
+
stars: external_exports.number().int().min(0).optional(),
|
|
15759
|
+
downloads: external_exports.number().int().min(0).optional(),
|
|
15760
|
+
categories: categoriesSchema.optional(),
|
|
15761
|
+
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
15762
|
+
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
15763
|
+
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15764
|
+
downloadUrl: desktopExtensionZipUrlSchema,
|
|
15765
|
+
sha256: desktopExtensionHashSchema,
|
|
15766
|
+
slots: slotsSchema.optional(),
|
|
15767
|
+
publishedAt: external_exports.string().optional(),
|
|
15768
|
+
updatedAt: external_exports.string().optional(),
|
|
15769
|
+
minCodexHostVersion: external_exports.string().optional()
|
|
15751
15770
|
});
|
|
15752
|
-
var
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
|
|
15756
|
-
status: external_exports.literal("ready"),
|
|
15757
|
-
catalog: harnessModelCatalogSchema,
|
|
15758
|
-
permissionModes: harnessPermissionModeCatalogSchema.optional(),
|
|
15759
|
-
capabilities: harnessSessionCapabilitiesSchema,
|
|
15760
|
-
webUi: harnessWebUiCapabilitySchema.optional()
|
|
15761
|
-
}).strict().superRefine((inspection, context) => {
|
|
15762
|
-
const selectable = inspection.capabilities.configuration.selectPermissionMode;
|
|
15763
|
-
if (selectable !== Boolean(inspection.permissionModes)) {
|
|
15764
|
-
context.addIssue({
|
|
15765
|
-
code: "custom",
|
|
15766
|
-
message: "Permission Mode catalog and capability must agree",
|
|
15767
|
-
path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
|
|
15768
|
-
});
|
|
15769
|
-
}
|
|
15771
|
+
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
15772
|
+
schemaVersion: external_exports.literal(1),
|
|
15773
|
+
generatedAt: external_exports.string(),
|
|
15774
|
+
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
15770
15775
|
});
|
|
15771
|
-
var
|
|
15772
|
-
|
|
15773
|
-
|
|
15774
|
-
|
|
15775
|
-
var
|
|
15776
|
-
|
|
15777
|
-
|
|
15776
|
+
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
15777
|
+
|
|
15778
|
+
// ../../shared-contracts/dist/host-extensions.js
|
|
15779
|
+
var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
|
|
15780
|
+
var HOST_EXTENSION_PAGE_API_VERSION = 1;
|
|
15781
|
+
var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
|
|
15782
|
+
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
15783
|
+
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
15784
|
+
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
15785
|
+
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((path8) => path8.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
15786
|
+
var legacy = desktopExtensionManifestSchema.shape;
|
|
15787
|
+
var localized = (max, min = 0) => external_exports.strictObject({
|
|
15788
|
+
en: external_exports.string().trim().min(min).max(max),
|
|
15789
|
+
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
15790
|
+
});
|
|
15791
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path8) => path8.endsWith(suffix), `Expected a ${suffix} file`);
|
|
15792
|
+
var moduleEntry = resourceWithSuffix(".mjs");
|
|
15793
|
+
var style = resourceWithSuffix(".css").optional();
|
|
15794
|
+
var hostExtensionCanonicalPath = (path8) => path8.normalize("NFC").toLowerCase();
|
|
15795
|
+
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
15796
|
+
manifestVersion: external_exports.literal(2),
|
|
15797
|
+
id: hostExtensionIdSchema,
|
|
15798
|
+
name: localized(128, 1),
|
|
15799
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15800
|
+
description: localized(4096),
|
|
15801
|
+
details: localized(16384).optional(),
|
|
15802
|
+
author: legacy.author,
|
|
15803
|
+
repository: legacy.repository,
|
|
15804
|
+
icon: legacy.icon.refine((path8) => path8 === void 0 || hostExtensionResourcePathSchema.safeParse(path8).success),
|
|
15805
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path8) => hostExtensionResourcePathSchema.safeParse(path8).success)),
|
|
15806
|
+
categories: legacy.categories,
|
|
15807
|
+
settingsSchema: legacy.settingsSchema,
|
|
15808
|
+
slots: legacy.slots.removeDefault().optional(),
|
|
15809
|
+
page: external_exports.strictObject({
|
|
15810
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
15811
|
+
entry: moduleEntry,
|
|
15812
|
+
style,
|
|
15813
|
+
title: localized(128, 1).optional()
|
|
15814
|
+
}).optional(),
|
|
15815
|
+
widget: external_exports.strictObject({
|
|
15816
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
15817
|
+
entry: moduleEntry,
|
|
15818
|
+
style
|
|
15819
|
+
}).optional(),
|
|
15820
|
+
desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
|
|
15821
|
+
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(),
|
|
15822
|
+
backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
|
|
15823
|
+
}).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" });
|
|
15824
|
+
function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
|
|
15825
|
+
if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
|
|
15826
|
+
return ["desktop", "web"];
|
|
15827
|
+
const targets = [];
|
|
15828
|
+
if (hasDesktop)
|
|
15829
|
+
targets.push("desktop");
|
|
15830
|
+
if (hasWeb)
|
|
15831
|
+
targets.push("web");
|
|
15832
|
+
return targets;
|
|
15833
|
+
}
|
|
15834
|
+
var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
15835
|
+
|
|
15836
|
+
// ../../shared-contracts/dist/host-extension-management.js
|
|
15837
|
+
var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
|
|
15838
|
+
var hostExtensionRevisionSchema = external_exports.int().nonnegative();
|
|
15839
|
+
var hostExtensionConfigurationSchema = external_exports.strictObject({
|
|
15840
|
+
revision: hostExtensionRevisionSchema,
|
|
15841
|
+
enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
|
|
15842
|
+
});
|
|
15843
|
+
var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
|
|
15844
|
+
var hostExtensionCatalogEntrySchema = external_exports.object({
|
|
15845
|
+
...catalogMetadata,
|
|
15846
|
+
id: hostExtensionIdSchema,
|
|
15847
|
+
format: external_exports.literal("codexhost"),
|
|
15848
|
+
targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
|
|
15849
|
+
apis: external_exports.strictObject({
|
|
15850
|
+
page: external_exports.int().positive().optional(),
|
|
15851
|
+
widget: external_exports.int().positive().optional(),
|
|
15852
|
+
desktop: external_exports.int().positive().optional(),
|
|
15853
|
+
web: external_exports.int().positive().optional(),
|
|
15854
|
+
backend: external_exports.int().positive().optional()
|
|
15855
|
+
}),
|
|
15856
|
+
downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
|
|
15857
|
+
}).refine(({ targets, apis }) => {
|
|
15858
|
+
const derived = targetsForCapabilities({
|
|
15859
|
+
hasPage: Boolean(apis.page),
|
|
15860
|
+
hasWidget: Boolean(apis.widget),
|
|
15861
|
+
hasDesktop: Boolean(apis.desktop),
|
|
15862
|
+
hasWeb: Boolean(apis.web),
|
|
15863
|
+
hasBackend: Boolean(apis.backend)
|
|
15864
|
+
});
|
|
15865
|
+
return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
|
|
15866
|
+
}, "Catalog targets must match the declared APIs");
|
|
15867
|
+
var hostExtensionCatalogSchema = external_exports.object({
|
|
15868
|
+
schemaVersion: external_exports.literal(2),
|
|
15869
|
+
generatedAt: external_exports.string().min(1),
|
|
15870
|
+
extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
15871
|
+
});
|
|
15872
|
+
var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
|
|
15873
|
+
catalogUrl: desktopExtensionHttpUrlSchema,
|
|
15874
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
15875
|
+
cached: external_exports.boolean()
|
|
15876
|
+
});
|
|
15877
|
+
var id = { id: hostExtensionIdSchema };
|
|
15878
|
+
var active = {
|
|
15879
|
+
...id,
|
|
15880
|
+
activationId: hostExtensionActivationIdSchema,
|
|
15881
|
+
digest: hostExtensionDigestSchema
|
|
15882
|
+
};
|
|
15883
|
+
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
15884
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path8) => /^(?:\/|[a-z]:[/\\])/iu.test(path8) && !path8.includes("\0") && !path8.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
15885
|
+
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");
|
|
15886
|
+
function base643(maxBytes) {
|
|
15887
|
+
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
15888
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
15889
|
+
return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
|
|
15890
|
+
}, "Expected bounded standard padded base64");
|
|
15891
|
+
}
|
|
15892
|
+
var hostExtensionGitHubSourceSchema = external_exports.strictObject({
|
|
15893
|
+
type: external_exports.literal("github"),
|
|
15894
|
+
repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
|
|
15895
|
+
ref: gitRef.optional(),
|
|
15896
|
+
tag: gitRef.optional(),
|
|
15897
|
+
asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
|
|
15898
|
+
subpath: hostExtensionResourcePathSchema.optional()
|
|
15899
|
+
}).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
|
|
15900
|
+
var hostExtensionInstallSourceSchema = external_exports.union([
|
|
15901
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
15902
|
+
hostExtensionGitHubSourceSchema,
|
|
15903
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
|
|
15904
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
|
|
15905
|
+
external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
|
|
15778
15906
|
]);
|
|
15779
|
-
var
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
|
|
15783
|
-
|
|
15784
|
-
purpose: external_exports.literal("availability").optional()
|
|
15785
|
-
}).strict();
|
|
15786
|
-
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15787
|
-
harnessId: harnessIdSchema
|
|
15788
|
-
}).strict();
|
|
15789
|
-
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
15790
|
-
var threadModelSelectParamsSchema = external_exports.object({
|
|
15791
|
-
threadId: hostThreadIdSchema,
|
|
15792
|
-
model: harnessModelRefSchema
|
|
15793
|
-
}).strict();
|
|
15794
|
-
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
15795
|
-
threadId: hostThreadIdSchema,
|
|
15796
|
-
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15797
|
-
}).strict();
|
|
15798
|
-
var threadInspectionParamsSchema = external_exports.object({
|
|
15799
|
-
threadId: hostThreadIdSchema,
|
|
15800
|
-
includeReferenceCapability: external_exports.boolean().optional()
|
|
15801
|
-
}).strict();
|
|
15802
|
-
var codexThreadInspectionSchema = external_exports.object({
|
|
15803
|
-
owner: external_exports.literal("codex"),
|
|
15804
|
-
locked: external_exports.boolean(),
|
|
15805
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
15806
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15807
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15808
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15809
|
-
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
15810
|
-
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15811
|
-
}).strict();
|
|
15812
|
-
var externalThreadInspectionSchema = external_exports.object({
|
|
15813
|
-
owner: external_exports.literal("external"),
|
|
15814
|
-
harnessId: nonBlankTextSchema2.max(256),
|
|
15815
|
-
transportModelId: nonBlankTextSchema2.max(1024),
|
|
15816
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
15817
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15818
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15819
|
-
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15820
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15821
|
-
history: harnessHistoryCapabilitiesSchema,
|
|
15822
|
-
usage: threadUsageSnapshotSchema.optional(),
|
|
15823
|
-
locked: external_exports.literal(true)
|
|
15824
|
-
}).strict();
|
|
15825
|
-
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
15826
|
-
codexThreadInspectionSchema,
|
|
15827
|
-
externalThreadInspectionSchema
|
|
15907
|
+
var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
|
|
15908
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
15909
|
+
hostExtensionGitHubSourceSchema,
|
|
15910
|
+
external_exports.strictObject({ type: external_exports.literal("zip") }),
|
|
15911
|
+
external_exports.strictObject({ type: external_exports.literal("localDir") })
|
|
15828
15912
|
]);
|
|
15829
|
-
var
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
if (seen.has(threadId)) {
|
|
15835
|
-
context.addIssue({
|
|
15836
|
-
code: "custom",
|
|
15837
|
-
message: "Thread ownership-list IDs must be unique",
|
|
15838
|
-
path: ["threadIds", index]
|
|
15839
|
-
});
|
|
15840
|
-
}
|
|
15841
|
-
seen.add(threadId);
|
|
15842
|
-
}
|
|
15913
|
+
var hostExtensionInstallationSchema = external_exports.strictObject({
|
|
15914
|
+
...active,
|
|
15915
|
+
manifest: hostExtensionManifestV2Schema,
|
|
15916
|
+
installedAt: external_exports.iso.datetime(),
|
|
15917
|
+
source: hostExtensionProvenanceSchema.optional()
|
|
15843
15918
|
});
|
|
15844
|
-
var
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
|
|
15850
|
-
|
|
15851
|
-
|
|
15852
|
-
|
|
15853
|
-
|
|
15854
|
-
|
|
15855
|
-
|
|
15919
|
+
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);
|
|
15920
|
+
var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
|
|
15921
|
+
var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
|
|
15922
|
+
var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
|
|
15923
|
+
hostExtensionInstallationSchema.extend({
|
|
15924
|
+
state: external_exports.literal("valid"),
|
|
15925
|
+
enabled: external_exports.boolean(),
|
|
15926
|
+
...desktopConflict,
|
|
15927
|
+
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
15928
|
+
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15929
|
+
backendState: backendState.optional(),
|
|
15930
|
+
backendError: external_exports.string().optional()
|
|
15931
|
+
}),
|
|
15932
|
+
external_exports.strictObject({
|
|
15933
|
+
state: external_exports.enum(["invalid", "incompatible"]),
|
|
15934
|
+
id: external_exports.string().min(1),
|
|
15935
|
+
enabled: external_exports.boolean(),
|
|
15936
|
+
error: external_exports.string()
|
|
15937
|
+
})
|
|
15856
15938
|
]);
|
|
15857
|
-
var
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15939
|
+
var hostExtensionsListResultSchema = external_exports.strictObject({
|
|
15940
|
+
revision: hostExtensionRevisionSchema,
|
|
15941
|
+
configuration: hostExtensionConfigurationSchema,
|
|
15942
|
+
diagnostics: external_exports.array(external_exports.string()),
|
|
15943
|
+
extensions: external_exports.array(hostExtensionListItemSchema)
|
|
15944
|
+
});
|
|
15945
|
+
var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
|
|
15946
|
+
...desktopConflict,
|
|
15947
|
+
settingsRevision: hostExtensionRevisionSchema
|
|
15948
|
+
});
|
|
15949
|
+
var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
|
|
15950
|
+
/** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
|
|
15951
|
+
revision: hostExtensionRevisionSchema,
|
|
15952
|
+
// Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
|
|
15953
|
+
extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
|
|
15954
|
+
});
|
|
15955
|
+
var HOST_EXTENSIONS_RPC = {
|
|
15956
|
+
list: "codexhost/extensions/list",
|
|
15957
|
+
snapshot: "codexhost/extensions/snapshot",
|
|
15958
|
+
catalog: "codexhost/extensions/catalog",
|
|
15959
|
+
install: "codexhost/extensions/install",
|
|
15960
|
+
update: "codexhost/extensions/update",
|
|
15961
|
+
enable: "codexhost/extensions/enable",
|
|
15962
|
+
disable: "codexhost/extensions/disable",
|
|
15963
|
+
uninstall: "codexhost/extensions/uninstall",
|
|
15964
|
+
recover: "codexhost/extensions/recover",
|
|
15965
|
+
asset: "codexhost/extensions/asset",
|
|
15966
|
+
settingsGet: "codexhost/extensions/settings/get",
|
|
15967
|
+
settingsSet: "codexhost/extensions/settings/set",
|
|
15968
|
+
backendInvoke: "codexhost/extensions/backend/invoke"
|
|
15969
|
+
};
|
|
15970
|
+
var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
|
|
15971
|
+
var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
|
|
15972
|
+
var noParams = external_exports.strictObject({});
|
|
15973
|
+
var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
|
|
15974
|
+
var selection = external_exports.strictObject({ ...id, ...expectedRevision });
|
|
15975
|
+
var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
|
|
15976
|
+
var mutationResult = external_exports.discriminatedUnion("state", [
|
|
15977
|
+
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
|
|
15978
|
+
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
|
|
15979
|
+
]);
|
|
15980
|
+
var hostExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
15981
|
+
...optionalActivation,
|
|
15982
|
+
digest: active.digest.optional(),
|
|
15983
|
+
path: hostExtensionResourcePathSchema
|
|
15984
|
+
});
|
|
15985
|
+
var hostExtensionsAssetResultSchema = external_exports.strictObject({
|
|
15986
|
+
mimeType: external_exports.string().min(1),
|
|
15987
|
+
base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
|
|
15988
|
+
digest: active.digest
|
|
15989
|
+
});
|
|
15990
|
+
var hostExtensionSettingsSchema = external_exports.strictObject({
|
|
15991
|
+
settingsRevision: hostExtensionRevisionSchema,
|
|
15992
|
+
values: jsonObjectSchema
|
|
15871
15993
|
});
|
|
15872
|
-
var
|
|
15873
|
-
|
|
15874
|
-
|
|
15875
|
-
|
|
15876
|
-
|
|
15877
|
-
|
|
15878
|
-
|
|
15879
|
-
|
|
15880
|
-
|
|
15881
|
-
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
}
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15994
|
+
var hostExtensionsRpcSchemas = {
|
|
15995
|
+
[HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
|
|
15996
|
+
[HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
|
|
15997
|
+
[HOST_EXTENSIONS_RPC.catalog]: {
|
|
15998
|
+
params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
|
|
15999
|
+
result: hostExtensionsCatalogResultSchema
|
|
16000
|
+
},
|
|
16001
|
+
[HOST_EXTENSIONS_RPC.install]: {
|
|
16002
|
+
params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
|
|
16003
|
+
result: installationResult
|
|
16004
|
+
},
|
|
16005
|
+
[HOST_EXTENSIONS_RPC.update]: {
|
|
16006
|
+
params: external_exports.strictObject({
|
|
16007
|
+
...id,
|
|
16008
|
+
expectedDigest: active.digest,
|
|
16009
|
+
expectedActivationId: active.activationId.optional(),
|
|
16010
|
+
source: hostExtensionInstallSourceSchema.optional()
|
|
16011
|
+
}),
|
|
16012
|
+
result: installationResult
|
|
16013
|
+
},
|
|
16014
|
+
[HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
|
|
16015
|
+
[HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
|
|
16016
|
+
[HOST_EXTENSIONS_RPC.uninstall]: {
|
|
16017
|
+
params: external_exports.strictObject({
|
|
16018
|
+
...id,
|
|
16019
|
+
removeData: external_exports.boolean().optional(),
|
|
16020
|
+
expectedDigest: active.digest.optional()
|
|
16021
|
+
}),
|
|
16022
|
+
result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
|
|
16023
|
+
},
|
|
16024
|
+
[HOST_EXTENSIONS_RPC.recover]: {
|
|
16025
|
+
params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
|
|
16026
|
+
result: mutationResult
|
|
16027
|
+
},
|
|
16028
|
+
[HOST_EXTENSIONS_RPC.asset]: {
|
|
16029
|
+
params: hostExtensionsAssetParamsSchema,
|
|
16030
|
+
result: hostExtensionsAssetResultSchema
|
|
16031
|
+
},
|
|
16032
|
+
[HOST_EXTENSIONS_RPC.settingsGet]: {
|
|
16033
|
+
params: external_exports.strictObject(optionalActivation),
|
|
16034
|
+
result: hostExtensionSettingsSchema
|
|
16035
|
+
},
|
|
16036
|
+
[HOST_EXTENSIONS_RPC.settingsSet]: {
|
|
16037
|
+
params: external_exports.strictObject({
|
|
16038
|
+
...optionalActivation,
|
|
16039
|
+
expectedSettingsRevision: hostExtensionRevisionSchema,
|
|
16040
|
+
values: jsonObjectSchema
|
|
16041
|
+
}),
|
|
16042
|
+
result: hostExtensionSettingsSchema
|
|
16043
|
+
},
|
|
16044
|
+
[HOST_EXTENSIONS_RPC.backendInvoke]: {
|
|
16045
|
+
params: external_exports.strictObject({
|
|
16046
|
+
...optionalActivation,
|
|
16047
|
+
method: hostExtensionBackendMethodSchema,
|
|
16048
|
+
params: jsonValueSchema.optional()
|
|
16049
|
+
}),
|
|
16050
|
+
result: external_exports.strictObject({ result: jsonValueSchema })
|
|
16051
|
+
}
|
|
16052
|
+
};
|
|
15896
16053
|
|
|
15897
16054
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
15898
16055
|
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
@@ -15955,7 +16112,7 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
15955
16112
|
"codexhost/harness/session-import/list",
|
|
15956
16113
|
"codexhost/harness/session-import/import",
|
|
15957
16114
|
// Host settings shared across Desktop and Web.
|
|
15958
|
-
...
|
|
16115
|
+
...HOST_EXTENSION_MANAGEMENT_METHODS,
|
|
15959
16116
|
"codexhost/harness/installation",
|
|
15960
16117
|
"codexhost/harness/installation/start",
|
|
15961
16118
|
"codexhost/harness/installation/status",
|
|
@@ -16016,6 +16173,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
16016
16173
|
cursor: clientChannelCursorSchema,
|
|
16017
16174
|
revision: external_exports.number().int().nonnegative()
|
|
16018
16175
|
}),
|
|
16176
|
+
external_exports.object({
|
|
16177
|
+
type: external_exports.literal("extensions-changed"),
|
|
16178
|
+
cursor: clientChannelCursorSchema,
|
|
16179
|
+
revision: hostExtensionRevisionSchema
|
|
16180
|
+
}),
|
|
16019
16181
|
external_exports.object({
|
|
16020
16182
|
type: external_exports.literal("hello"),
|
|
16021
16183
|
version: external_exports.literal(1),
|
|
@@ -16452,7 +16614,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
|
16452
16614
|
|
|
16453
16615
|
// ../../shared-contracts/dist/harness-preferences.js
|
|
16454
16616
|
var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
|
|
16455
|
-
var preferenceHarnessKey = harnessIdSchema.transform((
|
|
16617
|
+
var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
|
|
16456
16618
|
var harnessDefaultConfigurationSchema = external_exports.strictObject({
|
|
16457
16619
|
model: harnessModelRefSchema.optional(),
|
|
16458
16620
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -16462,11 +16624,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
|
|
|
16462
16624
|
lastHarness: harnessIdSchema.optional(),
|
|
16463
16625
|
byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
|
|
16464
16626
|
});
|
|
16627
|
+
var harnessDelegationDefaultSchema = external_exports.strictObject({
|
|
16628
|
+
model: harnessModelRefSchema.optional(),
|
|
16629
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
16630
|
+
}).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
|
|
16631
|
+
var delegationDefaultsSchema = external_exports.strictObject({
|
|
16632
|
+
byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
|
|
16633
|
+
});
|
|
16465
16634
|
var modelId = external_exports.string().min(1).max(1024);
|
|
16466
16635
|
var harnessPreferenceValuesSchema = external_exports.strictObject({
|
|
16467
16636
|
idleRelease: idleReleaseSettingsSchema.optional(),
|
|
16468
16637
|
favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
|
|
16469
|
-
newThread: newThreadDefaultsSchema.optional()
|
|
16638
|
+
newThread: newThreadDefaultsSchema.optional(),
|
|
16639
|
+
delegation: delegationDefaultsSchema.optional()
|
|
16470
16640
|
});
|
|
16471
16641
|
var harnessPreferenceSnapshotSchema = external_exports.strictObject({
|
|
16472
16642
|
scope: harnessPreferenceScopeSchema,
|
|
@@ -16494,6 +16664,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
|
|
|
16494
16664
|
lastHarness: harnessIdSchema.optional(),
|
|
16495
16665
|
harnessId: harnessIdSchema.optional(),
|
|
16496
16666
|
configuration: harnessDefaultConfigurationSchema.optional()
|
|
16667
|
+
}),
|
|
16668
|
+
external_exports.strictObject({
|
|
16669
|
+
kind: external_exports.literal("delegation"),
|
|
16670
|
+
harnessId: harnessIdSchema,
|
|
16671
|
+
configuration: harnessDelegationDefaultSchema.nullable()
|
|
16497
16672
|
})
|
|
16498
16673
|
]);
|
|
16499
16674
|
var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
@@ -17317,9 +17492,12 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
17317
17492
|
...thread,
|
|
17318
17493
|
epoch: identity,
|
|
17319
17494
|
modelId: identity.optional(),
|
|
17495
|
+
serviceTier: harnessModelServiceTierSchema.optional(),
|
|
17320
17496
|
thinkingOptionId: identity.optional(),
|
|
17321
17497
|
permissionModeId: identity.optional()
|
|
17322
|
-
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
|
|
17498
|
+
}).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, {
|
|
17499
|
+
message: "A service tier requires a Model ID"
|
|
17500
|
+
}),
|
|
17323
17501
|
external_exports.strictObject({
|
|
17324
17502
|
kind: external_exports.literal("prompt"),
|
|
17325
17503
|
...thread,
|
|
@@ -17369,7 +17547,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
17369
17547
|
external_exports.strictObject({ action: external_exports.literal("catalog") }),
|
|
17370
17548
|
external_exports.strictObject({
|
|
17371
17549
|
action: external_exports.literal("read-thread"),
|
|
17372
|
-
hostId: hostId.refine((
|
|
17550
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
17373
17551
|
input: delegationReadParamsSchema
|
|
17374
17552
|
}),
|
|
17375
17553
|
external_exports.strictObject({
|
|
@@ -17383,7 +17561,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
17383
17561
|
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
17384
17562
|
external_exports.strictObject({
|
|
17385
17563
|
action: external_exports.literal("update"),
|
|
17386
|
-
hostId: hostId.refine((
|
|
17564
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
17387
17565
|
version: remoteUpdateParamsSchema.shape.version
|
|
17388
17566
|
})
|
|
17389
17567
|
]);
|
|
@@ -17447,7 +17625,7 @@ function invalidRequest(message) {
|
|
|
17447
17625
|
return { code: "invalidRequest", message, retryable: false };
|
|
17448
17626
|
}
|
|
17449
17627
|
function validateHostApprovalResponse(interaction, response) {
|
|
17450
|
-
return interaction.actions.some(({ id }) =>
|
|
17628
|
+
return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
|
|
17451
17629
|
}
|
|
17452
17630
|
|
|
17453
17631
|
// ../../harness-adapter/dist/question.js
|
|
@@ -17455,7 +17633,7 @@ function invalidRequest2(message) {
|
|
|
17455
17633
|
return { code: "invalidRequest", message, retryable: false };
|
|
17456
17634
|
}
|
|
17457
17635
|
function validateHostQuestionResponse(interaction, response) {
|
|
17458
|
-
const questionIds = new Set(interaction.questions.map(({ id }) =>
|
|
17636
|
+
const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
|
|
17459
17637
|
if (response.cancelled) {
|
|
17460
17638
|
return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
|
|
17461
17639
|
}
|
|
@@ -17486,6 +17664,18 @@ function validateHostQuestionResponse(interaction, response) {
|
|
|
17486
17664
|
return null;
|
|
17487
17665
|
}
|
|
17488
17666
|
|
|
17667
|
+
// ../../harness-adapter/dist/legacy-model-ref.js
|
|
17668
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
17669
|
+
function normalizeLegacyBase64ModelRef(ref, catalog, prefix) {
|
|
17670
|
+
if (ref.serviceTier || !ref.id.startsWith(prefix))
|
|
17671
|
+
return void 0;
|
|
17672
|
+
const encoded = ref.id.slice(prefix.length);
|
|
17673
|
+
const id2 = Buffer2.from(encoded, "base64url").toString("utf8");
|
|
17674
|
+
if (Buffer2.from(id2).toString("base64url") !== encoded)
|
|
17675
|
+
return void 0;
|
|
17676
|
+
return catalog.models.find(({ ref: ref2 }) => ref2.id === id2 && !ref2.serviceTier)?.ref;
|
|
17677
|
+
}
|
|
17678
|
+
|
|
17489
17679
|
// ../../harness-adapter/dist/output-channel.js
|
|
17490
17680
|
var HarnessOutputChannel = class {
|
|
17491
17681
|
outputs;
|
|
@@ -17570,7 +17760,8 @@ var tokenFields = [
|
|
|
17570
17760
|
var safeIntegerFields = [
|
|
17571
17761
|
"planFiveHourResetsAtUnix",
|
|
17572
17762
|
"planSevenDayResetsAtUnix",
|
|
17573
|
-
"timeToFirstOutputMs"
|
|
17763
|
+
"timeToFirstOutputMs",
|
|
17764
|
+
"latestRequestTimeToFirstOutputMs"
|
|
17574
17765
|
];
|
|
17575
17766
|
var percentFields = [
|
|
17576
17767
|
"cacheHitRatePercent",
|
|
@@ -17780,21 +17971,11 @@ async function hermesPythonCommand(runtime, script, environment, timeoutMs = 2e4
|
|
|
17780
17971
|
function isHermesModeId(value) {
|
|
17781
17972
|
return value === "default" || value === "dont_ask";
|
|
17782
17973
|
}
|
|
17783
|
-
function
|
|
17784
|
-
|
|
17785
|
-
id: Buffer.from(modelId2, "utf8").toString("base64url")
|
|
17786
|
-
});
|
|
17787
|
-
return ref.success ? ref.data : null;
|
|
17974
|
+
function hermesModelRef(id2) {
|
|
17975
|
+
return harnessModelRefSchema.safeParse({ id: id2 }).data ?? null;
|
|
17788
17976
|
}
|
|
17789
|
-
function
|
|
17790
|
-
|
|
17791
|
-
return null;
|
|
17792
|
-
try {
|
|
17793
|
-
const decoded = Buffer.from(modelRefId, "base64url").toString("utf8");
|
|
17794
|
-
return decoded.length > 0 ? decoded : null;
|
|
17795
|
-
} catch {
|
|
17796
|
-
return null;
|
|
17797
|
-
}
|
|
17977
|
+
function normalizeStoredHermesModelRef(ref, catalog) {
|
|
17978
|
+
return normalizeLegacyBase64ModelRef(ref, catalog, "");
|
|
17798
17979
|
}
|
|
17799
17980
|
function catalogAlignedModelLabel(name) {
|
|
17800
17981
|
return name.replace(/\s+·\s+/g, " / ");
|
|
@@ -17807,7 +17988,7 @@ function projectHermesModelState(models) {
|
|
|
17807
17988
|
if (!current)
|
|
17808
17989
|
return { effectiveModel: null, resolvedModelLabel: null };
|
|
17809
17990
|
return {
|
|
17810
|
-
effectiveModel:
|
|
17991
|
+
effectiveModel: hermesModelRef(current.modelId),
|
|
17811
17992
|
resolvedModelLabel: catalogAlignedModelLabel(current.name)
|
|
17812
17993
|
};
|
|
17813
17994
|
}
|
|
@@ -18052,7 +18233,7 @@ function catalogModelsFromInventory(inventory) {
|
|
|
18052
18233
|
if (model2.available === false)
|
|
18053
18234
|
continue;
|
|
18054
18235
|
const nativeModelId = model2.modelId;
|
|
18055
|
-
const ref =
|
|
18236
|
+
const ref = hermesModelRef(nativeModelId);
|
|
18056
18237
|
if (!ref)
|
|
18057
18238
|
continue;
|
|
18058
18239
|
if (inventory.currentModelId && (model2.modelId === inventory.currentModelId || nativeModelId === inventory.currentModelId || model2.modelIdAliases?.includes(inventory.currentModelId))) {
|
|
@@ -18310,7 +18491,7 @@ var HermesGatewayTransport = class _HermesGatewayTransport {
|
|
|
18310
18491
|
environment;
|
|
18311
18492
|
timeoutMs;
|
|
18312
18493
|
onEvent = () => void 0;
|
|
18313
|
-
onRequest = (
|
|
18494
|
+
onRequest = (id2) => this.rejectRequest(id2);
|
|
18314
18495
|
onFault = () => void 0;
|
|
18315
18496
|
#child = null;
|
|
18316
18497
|
#nextId = 0;
|
|
@@ -18457,10 +18638,10 @@ var HermesGatewayTransport = class _HermesGatewayTransport {
|
|
|
18457
18638
|
async request(method, params, timeoutMs = this.timeoutMs, fatalOnTimeout = true) {
|
|
18458
18639
|
if (this.#closed || !this.#child)
|
|
18459
18640
|
throw new Error("Hermes gateway is closed");
|
|
18460
|
-
const
|
|
18641
|
+
const id2 = `codexhost-${++this.#nextId}`;
|
|
18461
18642
|
const response = new Promise((resolve, reject) => {
|
|
18462
|
-
this.#pending.set(
|
|
18463
|
-
this.#send({ jsonrpc: "2.0", id, method, params });
|
|
18643
|
+
this.#pending.set(id2, { resolve, reject });
|
|
18644
|
+
this.#send({ jsonrpc: "2.0", id: id2, method, params });
|
|
18464
18645
|
});
|
|
18465
18646
|
try {
|
|
18466
18647
|
return await withTimeout(response, timeoutMs, `Hermes ${method}`);
|
|
@@ -18469,16 +18650,16 @@ var HermesGatewayTransport = class _HermesGatewayTransport {
|
|
|
18469
18650
|
this.#fault(error51);
|
|
18470
18651
|
throw error51;
|
|
18471
18652
|
} finally {
|
|
18472
|
-
this.#pending.delete(
|
|
18653
|
+
this.#pending.delete(id2);
|
|
18473
18654
|
}
|
|
18474
18655
|
}
|
|
18475
|
-
respond(
|
|
18476
|
-
this.#send({ jsonrpc: "2.0", id, result });
|
|
18656
|
+
respond(id2, result) {
|
|
18657
|
+
this.#send({ jsonrpc: "2.0", id: id2, result });
|
|
18477
18658
|
}
|
|
18478
|
-
rejectRequest(
|
|
18659
|
+
rejectRequest(id2) {
|
|
18479
18660
|
this.#send({
|
|
18480
18661
|
jsonrpc: "2.0",
|
|
18481
|
-
id,
|
|
18662
|
+
id: id2,
|
|
18482
18663
|
error: { code: -32601, message: "Unsupported Host interaction" }
|
|
18483
18664
|
});
|
|
18484
18665
|
}
|
|
@@ -18507,11 +18688,11 @@ var HermesGatewayTransport = class _HermesGatewayTransport {
|
|
|
18507
18688
|
this.onRequest(frame.id, frame.method, gatewayRecord(frame.params));
|
|
18508
18689
|
return;
|
|
18509
18690
|
}
|
|
18510
|
-
const
|
|
18511
|
-
const pending = this.#pending.get(
|
|
18691
|
+
const id2 = gatewayString(frame.id);
|
|
18692
|
+
const pending = this.#pending.get(id2);
|
|
18512
18693
|
if (!pending)
|
|
18513
18694
|
return;
|
|
18514
|
-
this.#pending.delete(
|
|
18695
|
+
this.#pending.delete(id2);
|
|
18515
18696
|
if (frame.error)
|
|
18516
18697
|
pending.reject(new Error(gatewayString(gatewayRecord(frame.error).message) || "Hermes gateway request failed"));
|
|
18517
18698
|
else
|
|
@@ -19145,7 +19326,7 @@ function projectGatewayHistory(sessionId, data) {
|
|
|
19145
19326
|
for (const row of data.rows) {
|
|
19146
19327
|
if (!Number.isSafeInteger(row.id) || !Number.isSafeInteger(row.original_id))
|
|
19147
19328
|
throw new Error("Hermes history has no durable message identity");
|
|
19148
|
-
const
|
|
19329
|
+
const id2 = String(row.original_id);
|
|
19149
19330
|
if (row.role === "user") {
|
|
19150
19331
|
if (typeof row.user_text !== "string")
|
|
19151
19332
|
continue;
|
|
@@ -19155,7 +19336,7 @@ function projectGatewayHistory(sessionId, data) {
|
|
|
19155
19336
|
nativeTurnRef: nativeTurnRefSchema.parse({
|
|
19156
19337
|
harnessId: "hermes",
|
|
19157
19338
|
nativeSessionId: sessionId,
|
|
19158
|
-
nativeTurnKey:
|
|
19339
|
+
nativeTurnKey: id2,
|
|
19159
19340
|
formatVersion: 1
|
|
19160
19341
|
}),
|
|
19161
19342
|
...boundary ? {
|
|
@@ -19180,7 +19361,7 @@ function projectGatewayHistory(sessionId, data) {
|
|
|
19180
19361
|
}
|
|
19181
19362
|
if (!turn)
|
|
19182
19363
|
continue;
|
|
19183
|
-
const itemId = (suffix) => hostItemIdSchema.parse(`hermes:${
|
|
19364
|
+
const itemId = (suffix) => hostItemIdSchema.parse(`hermes:${id2}:${suffix}`);
|
|
19184
19365
|
if (row.role === "assistant") {
|
|
19185
19366
|
const reasoning = row.display_visible === false ? "" : text(row.reasoning_content) || text(row.reasoning);
|
|
19186
19367
|
if (reasoning)
|
|
@@ -19417,22 +19598,22 @@ var hermesGatewayThinkingOptions = [
|
|
|
19417
19598
|
"xhigh",
|
|
19418
19599
|
"max",
|
|
19419
19600
|
"ultra"
|
|
19420
|
-
].map((
|
|
19601
|
+
].map((id2) => ({ id: harnessThinkingOptionIdSchema.parse(id2), label: id2 }));
|
|
19421
19602
|
function question(entry, fallbackId) {
|
|
19422
|
-
const
|
|
19603
|
+
const id2 = gatewayString(entry.qid) || fallbackId;
|
|
19423
19604
|
const prompt = gatewayString(entry.question);
|
|
19424
19605
|
if (!prompt)
|
|
19425
19606
|
throw new Error("Hermes clarify request has no question");
|
|
19426
19607
|
const choices = Array.isArray(entry.choices) ? entry.choices.filter((choice) => typeof choice === "string") : [];
|
|
19427
19608
|
return choices.length ? {
|
|
19428
|
-
id,
|
|
19609
|
+
id: id2,
|
|
19429
19610
|
type: "choice",
|
|
19430
19611
|
prompt,
|
|
19431
19612
|
options: choices.map((value) => ({ value, label: value })),
|
|
19432
19613
|
multiple: entry.multi_select === true,
|
|
19433
19614
|
allowOther: true,
|
|
19434
19615
|
optional: false
|
|
19435
|
-
} : { id, type: "text", prompt, multiline: true, secret: false, optional: false };
|
|
19616
|
+
} : { id: id2, type: "text", prompt, multiline: true, secret: false, optional: false };
|
|
19436
19617
|
}
|
|
19437
19618
|
function gatewayDiff(text2) {
|
|
19438
19619
|
if (!text2 || text2.length > 1024 * 1024)
|
|
@@ -19554,8 +19735,8 @@ var HermesGatewaySessionTransport = class {
|
|
|
19554
19735
|
nativeSessionId
|
|
19555
19736
|
});
|
|
19556
19737
|
transport.onEvent = (event) => this.#event(event);
|
|
19557
|
-
transport.onRequest = (
|
|
19558
|
-
void this.#request(
|
|
19738
|
+
transport.onRequest = (id2, method, params) => {
|
|
19739
|
+
void this.#request(id2, method, params).catch((error51) => this.#fault(error51));
|
|
19559
19740
|
};
|
|
19560
19741
|
transport.onFault = (error51) => this.#fault(error51);
|
|
19561
19742
|
}
|
|
@@ -19586,7 +19767,7 @@ var HermesGatewaySessionTransport = class {
|
|
|
19586
19767
|
]
|
|
19587
19768
|
},
|
|
19588
19769
|
thinkingOptions: hermesGatewayThinkingOptions,
|
|
19589
|
-
...hermesGatewayThinkingOptions.some(({ id }) =>
|
|
19770
|
+
...hermesGatewayThinkingOptions.some(({ id: id2 }) => id2 === currentThinkingOptionId) ? { currentThinkingOptionId } : {}
|
|
19590
19771
|
}
|
|
19591
19772
|
};
|
|
19592
19773
|
}
|
|
@@ -19594,7 +19775,7 @@ var HermesGatewaySessionTransport = class {
|
|
|
19594
19775
|
return this.history.readSnapshot();
|
|
19595
19776
|
}
|
|
19596
19777
|
async setThinking(optionId) {
|
|
19597
|
-
if (!hermesGatewayThinkingOptions.some(({ id }) =>
|
|
19778
|
+
if (!hermesGatewayThinkingOptions.some(({ id: id2 }) => id2 === optionId))
|
|
19598
19779
|
throw new Error("Unsupported Hermes reasoning effort");
|
|
19599
19780
|
const result = await this.transport.request("config.set", {
|
|
19600
19781
|
key: "reasoning",
|
|
@@ -19653,7 +19834,7 @@ var HermesGatewaySessionTransport = class {
|
|
|
19653
19834
|
rejectResult = reject;
|
|
19654
19835
|
});
|
|
19655
19836
|
void result.catch(() => void 0);
|
|
19656
|
-
const
|
|
19837
|
+
const active2 = {
|
|
19657
19838
|
emit,
|
|
19658
19839
|
permission,
|
|
19659
19840
|
...question2 ? { question: question2 } : {},
|
|
@@ -19664,8 +19845,8 @@ var HermesGatewaySessionTransport = class {
|
|
|
19664
19845
|
toolIds: /* @__PURE__ */ new Set(),
|
|
19665
19846
|
admissionId: null
|
|
19666
19847
|
};
|
|
19667
|
-
this.#active =
|
|
19668
|
-
void this.#adoptedPrompts.splice(0).map((prompt) => void this.#respondAdoptedApproval(prompt,
|
|
19848
|
+
this.#active = active2;
|
|
19849
|
+
void this.#adoptedPrompts.splice(0).map((prompt) => void this.#respondAdoptedApproval(prompt, active2).catch(() => void 0));
|
|
19669
19850
|
const commandText = text2.trim();
|
|
19670
19851
|
const nativeCommand = this.nativeCommandName(text2);
|
|
19671
19852
|
try {
|
|
@@ -19683,7 +19864,7 @@ var HermesGatewaySessionTransport = class {
|
|
|
19683
19864
|
throw new Error("Hermes returned an unrecognized compression outcome");
|
|
19684
19865
|
this.#usage(gatewayRecord(compact.usage));
|
|
19685
19866
|
const succeeded = compact.status === "compressed" && summary.noop !== true;
|
|
19686
|
-
|
|
19867
|
+
active2.resolve({
|
|
19687
19868
|
stopReason: "end_turn",
|
|
19688
19869
|
compactionOutcome: compact.status === "aborted" || summary.aborted === true ? {
|
|
19689
19870
|
status: "failed",
|
|
@@ -19702,7 +19883,7 @@ var HermesGatewaySessionTransport = class {
|
|
|
19702
19883
|
if (typeof response.output !== "string")
|
|
19703
19884
|
throw new HermesTransportError("protocolError", "Hermes slash.exec did not return terminal command output");
|
|
19704
19885
|
emit({ type: "agent.text", text: response.output });
|
|
19705
|
-
|
|
19886
|
+
active2.resolve({ stopReason: "end_turn" });
|
|
19706
19887
|
} else {
|
|
19707
19888
|
const guidance = this.#delegationGuidance;
|
|
19708
19889
|
this.#delegationGuidance = null;
|
|
@@ -19717,16 +19898,16 @@ ${text2}` } : {}
|
|
|
19717
19898
|
});
|
|
19718
19899
|
if (submitted.status !== "queued" && submitted.status !== "started")
|
|
19719
19900
|
this.#fault(new Error(`Hermes did not accept the turn (${String(submitted.status)})`));
|
|
19720
|
-
else if (
|
|
19721
|
-
|
|
19901
|
+
else if (active2.admissionId === null && typeof submitted.admission_id === "string")
|
|
19902
|
+
active2.admissionId = submitted.admission_id;
|
|
19722
19903
|
}
|
|
19723
19904
|
} catch (error51) {
|
|
19724
|
-
|
|
19905
|
+
active2.reject(error51 instanceof Error ? error51 : new Error(String(error51)));
|
|
19725
19906
|
}
|
|
19726
19907
|
try {
|
|
19727
19908
|
return await result;
|
|
19728
19909
|
} finally {
|
|
19729
|
-
if (this.#active ===
|
|
19910
|
+
if (this.#active === active2)
|
|
19730
19911
|
this.#active = null;
|
|
19731
19912
|
for (const controller of this.#requests.values())
|
|
19732
19913
|
controller.abort("cancelled");
|
|
@@ -19792,46 +19973,46 @@ ${text2}` } : {}
|
|
|
19792
19973
|
return;
|
|
19793
19974
|
}
|
|
19794
19975
|
if (event.type === "approval.cancelled") {
|
|
19795
|
-
const ids = Array.isArray(payload.request_ids) ? payload.request_ids.filter((
|
|
19796
|
-
for (const
|
|
19797
|
-
this.#approvalRequests.get(
|
|
19798
|
-
this.#approvalRequests.delete(
|
|
19976
|
+
const ids = Array.isArray(payload.request_ids) ? payload.request_ids.filter((id2) => typeof id2 === "string") : [];
|
|
19977
|
+
for (const id2 of ids) {
|
|
19978
|
+
this.#approvalRequests.get(id2)?.abort("cancelled");
|
|
19979
|
+
this.#approvalRequests.delete(id2);
|
|
19799
19980
|
}
|
|
19800
19981
|
return;
|
|
19801
19982
|
}
|
|
19802
|
-
const
|
|
19803
|
-
if (!
|
|
19983
|
+
const active2 = this.#active;
|
|
19984
|
+
if (!active2) {
|
|
19804
19985
|
if (event.type === "error")
|
|
19805
19986
|
this.#fault(new Error(gatewayString(payload.message)));
|
|
19806
19987
|
return;
|
|
19807
19988
|
}
|
|
19808
19989
|
const eventAdmission = gatewayString(event.admission_id);
|
|
19809
19990
|
const eventType = gatewayString(event.type);
|
|
19810
|
-
if (eventAdmission &&
|
|
19991
|
+
if (eventAdmission && active2.admissionId && eventAdmission !== active2.admissionId) {
|
|
19811
19992
|
if (eventType.startsWith("message.") || eventType.startsWith("reasoning."))
|
|
19812
19993
|
return;
|
|
19813
19994
|
}
|
|
19814
19995
|
const text2 = gatewayString(payload.text);
|
|
19815
19996
|
if (event.type === "message.delta") {
|
|
19816
|
-
|
|
19817
|
-
|
|
19997
|
+
active2.streamed += text2;
|
|
19998
|
+
active2.emit({ type: "agent.text", text: text2 });
|
|
19818
19999
|
} else if (event.type === "reasoning.delta" || event.type === "reasoning.available") {
|
|
19819
|
-
if (event.type === "reasoning.delta" || !
|
|
19820
|
-
|
|
19821
|
-
|
|
20000
|
+
if (event.type === "reasoning.delta" || !active2.reasoning) {
|
|
20001
|
+
active2.reasoning += text2;
|
|
20002
|
+
active2.emit({ type: "agent.thought", text: text2 });
|
|
19822
20003
|
}
|
|
19823
20004
|
} else if (event.type === "message.interim") {
|
|
19824
20005
|
if (payload.already_streamed !== true)
|
|
19825
|
-
|
|
19826
|
-
|
|
19827
|
-
|
|
20006
|
+
active2.emit({ type: "agent.text", text: text2 });
|
|
20007
|
+
active2.streamed = "";
|
|
20008
|
+
active2.reasoning = "";
|
|
19828
20009
|
} else if (event.type === "status.update") {
|
|
19829
20010
|
if (payload.kind === "compacting")
|
|
19830
|
-
|
|
20011
|
+
active2.emit({ type: "compaction.started", text: text2 });
|
|
19831
20012
|
else if (payload.kind === "compacted")
|
|
19832
|
-
|
|
20013
|
+
active2.emit({ type: "compaction.finished", text: text2 });
|
|
19833
20014
|
else if (payload.kind === "warning")
|
|
19834
|
-
|
|
20015
|
+
active2.emit({ type: "status.warning", text: text2 });
|
|
19835
20016
|
} else if (event.type === "tool.start" || event.type === "tool.complete") {
|
|
19836
20017
|
const toolCallId = gatewayString(payload.tool_id);
|
|
19837
20018
|
if (!toolCallId)
|
|
@@ -19842,8 +20023,8 @@ ${text2}` } : {}
|
|
|
19842
20023
|
...output ? [{ type: "content", content: { type: "text", text: output } }] : [],
|
|
19843
20024
|
...gatewayDiff(gatewayString(payload.inline_diff))
|
|
19844
20025
|
];
|
|
19845
|
-
if (event.type === "tool.complete" && !
|
|
19846
|
-
|
|
20026
|
+
if (event.type === "tool.complete" && !active2.toolIds.has(toolCallId))
|
|
20027
|
+
active2.emit({
|
|
19847
20028
|
type: "tool.call",
|
|
19848
20029
|
toolCallId,
|
|
19849
20030
|
update: {
|
|
@@ -19853,8 +20034,8 @@ ${text2}` } : {}
|
|
|
19853
20034
|
status: "in_progress"
|
|
19854
20035
|
}
|
|
19855
20036
|
});
|
|
19856
|
-
|
|
19857
|
-
|
|
20037
|
+
active2.toolIds.add(toolCallId);
|
|
20038
|
+
active2.emit(event.type === "tool.start" ? {
|
|
19858
20039
|
type: "tool.call",
|
|
19859
20040
|
toolCallId,
|
|
19860
20041
|
update: {
|
|
@@ -19873,28 +20054,28 @@ ${text2}` } : {}
|
|
|
19873
20054
|
}
|
|
19874
20055
|
});
|
|
19875
20056
|
} else if (event.type === "message.complete") {
|
|
19876
|
-
if (!
|
|
19877
|
-
|
|
19878
|
-
else if (text2.startsWith(
|
|
19879
|
-
|
|
20057
|
+
if (!active2.streamed)
|
|
20058
|
+
active2.emit({ type: "agent.text", text: text2 });
|
|
20059
|
+
else if (text2.startsWith(active2.streamed) && text2.length > active2.streamed.length)
|
|
20060
|
+
active2.emit({ type: "agent.text", text: text2.slice(active2.streamed.length) });
|
|
19880
20061
|
const reasoning = gatewayString(payload.reasoning);
|
|
19881
|
-
if (reasoning && !
|
|
19882
|
-
|
|
19883
|
-
else if (reasoning.startsWith(
|
|
19884
|
-
|
|
20062
|
+
if (reasoning && !active2.reasoning)
|
|
20063
|
+
active2.emit({ type: "agent.thought", text: reasoning });
|
|
20064
|
+
else if (reasoning.startsWith(active2.reasoning) && reasoning.length > active2.reasoning.length)
|
|
20065
|
+
active2.emit({ type: "agent.thought", text: reasoning.slice(active2.reasoning.length) });
|
|
19885
20066
|
const usage = gatewayRecord(payload.usage);
|
|
19886
20067
|
const terminalUsage = projectGatewayUsage(usage);
|
|
19887
20068
|
this.#usage(usage);
|
|
19888
20069
|
if (payload.status === "error")
|
|
19889
|
-
|
|
20070
|
+
active2.reject(new Error(gatewayString(payload.error) || gatewayString(payload.failure_reason) || "Hermes turn failed"));
|
|
19890
20071
|
else
|
|
19891
|
-
|
|
20072
|
+
active2.resolve({
|
|
19892
20073
|
stopReason: payload.status === "interrupted" ? "cancelled" : "end_turn",
|
|
19893
20074
|
...payload.status === "complete" && text2.trim() ? { finalAnswerText: text2 } : {},
|
|
19894
20075
|
...terminalUsage ? { usage: terminalUsage } : {}
|
|
19895
20076
|
});
|
|
19896
20077
|
} else if (event.type === "error")
|
|
19897
|
-
|
|
20078
|
+
active2.reject(new Error(gatewayString(payload.message) || "Hermes gateway failed"));
|
|
19898
20079
|
}
|
|
19899
20080
|
#usage(usage) {
|
|
19900
20081
|
const projected = projectGatewayUsage(usage);
|
|
@@ -19905,19 +20086,19 @@ ${text2}` } : {}
|
|
|
19905
20086
|
else
|
|
19906
20087
|
this.onUsage?.(projected);
|
|
19907
20088
|
}
|
|
19908
|
-
async #request(
|
|
19909
|
-
const
|
|
19910
|
-
if (!
|
|
19911
|
-
this.transport.rejectRequest(
|
|
20089
|
+
async #request(id2, method, params) {
|
|
20090
|
+
const active2 = this.#active;
|
|
20091
|
+
if (!active2 || params.session_id !== this.sessionId || !["clarify", "approval"].includes(method)) {
|
|
20092
|
+
this.transport.rejectRequest(id2);
|
|
19912
20093
|
return;
|
|
19913
20094
|
}
|
|
19914
20095
|
const controller = new AbortController();
|
|
19915
|
-
this.#requests.set(
|
|
20096
|
+
this.#requests.set(id2, controller);
|
|
19916
20097
|
try {
|
|
19917
|
-
if (method === "clarify" &&
|
|
20098
|
+
if (method === "clarify" && active2.question) {
|
|
19918
20099
|
const batch = Array.isArray(params.questions);
|
|
19919
20100
|
const questions = batch ? params.questions.map((value, index) => question(gatewayRecord(value), String(index))) : [question(params, "answer")];
|
|
19920
|
-
const response = await
|
|
20101
|
+
const response = await active2.question({
|
|
19921
20102
|
title: "Hermes",
|
|
19922
20103
|
questions,
|
|
19923
20104
|
signal: controller.signal
|
|
@@ -19930,7 +20111,7 @@ ${text2}` } : {}
|
|
|
19930
20111
|
q?.type === "choice" && q.multiple ? JSON.stringify(values) : values[0] ?? ""
|
|
19931
20112
|
];
|
|
19932
20113
|
}));
|
|
19933
|
-
this.transport.respond(
|
|
20114
|
+
this.transport.respond(id2, response.cancelled ? {} : batch ? { answers } : { answer: answers.answer ?? "" });
|
|
19934
20115
|
}
|
|
19935
20116
|
} else if (method === "approval") {
|
|
19936
20117
|
const choices = Array.isArray(params.choices) ? params.choices : ["once", "deny"];
|
|
@@ -19945,14 +20126,14 @@ ${text2}` } : {}
|
|
|
19945
20126
|
if (payloadRequestId)
|
|
19946
20127
|
this.#approvalRequests.set(payloadRequestId, controller);
|
|
19947
20128
|
try {
|
|
19948
|
-
const response = await
|
|
20129
|
+
const response = await active2.permission({
|
|
19949
20130
|
signal: controller.signal,
|
|
19950
20131
|
title: gatewayString(params.description) || gatewayString(params.command),
|
|
19951
20132
|
description: gatewayString(params.command) || gatewayString(params.description),
|
|
19952
20133
|
options
|
|
19953
20134
|
});
|
|
19954
20135
|
if (!controller.signal.aborted)
|
|
19955
|
-
this.transport.respond(
|
|
20136
|
+
this.transport.respond(id2, {
|
|
19956
20137
|
choice: response ?? "deny"
|
|
19957
20138
|
});
|
|
19958
20139
|
} finally {
|
|
@@ -19960,9 +20141,9 @@ ${text2}` } : {}
|
|
|
19960
20141
|
this.#approvalRequests.delete(payloadRequestId);
|
|
19961
20142
|
}
|
|
19962
20143
|
} else
|
|
19963
|
-
this.transport.rejectRequest(
|
|
20144
|
+
this.transport.rejectRequest(id2);
|
|
19964
20145
|
} finally {
|
|
19965
|
-
this.#requests.delete(
|
|
20146
|
+
this.#requests.delete(id2);
|
|
19966
20147
|
}
|
|
19967
20148
|
}
|
|
19968
20149
|
/** Keep approval prompts from the create/resume snapshot for the next turn. */
|
|
@@ -19981,7 +20162,7 @@ ${text2}` } : {}
|
|
|
19981
20162
|
* question is served by the `clarify` server request (batch mode), and the
|
|
19982
20163
|
* gateway re-issues still-open server requests to an attaching client.
|
|
19983
20164
|
*/
|
|
19984
|
-
async #respondAdoptedApproval(prompt,
|
|
20165
|
+
async #respondAdoptedApproval(prompt, active2) {
|
|
19985
20166
|
if (this.#closed)
|
|
19986
20167
|
return;
|
|
19987
20168
|
const promptId = gatewayString(prompt.prompt_id);
|
|
@@ -19994,7 +20175,7 @@ ${text2}` } : {}
|
|
|
19994
20175
|
label: choice === "session" ? "Allow for this session" : "Always allow"
|
|
19995
20176
|
}
|
|
19996
20177
|
] : choice === "deny" ? [{ id: "deny", effect: "deny", label: "Deny" }] : []);
|
|
19997
|
-
const response = await
|
|
20178
|
+
const response = await active2.permission({
|
|
19998
20179
|
signal: new AbortController().signal,
|
|
19999
20180
|
title: gatewayString(prompt.description) || gatewayString(prompt.command) || "Hermes approval requested before this Session attached",
|
|
20000
20181
|
description: gatewayString(prompt.command) || gatewayString(prompt.description),
|
|
@@ -20098,7 +20279,7 @@ function hermesUsageEntry(row) {
|
|
|
20098
20279
|
if (apiCalls === 0 && input === 0 && output === 0 && cacheRead === 0 && cacheWrite === 0) {
|
|
20099
20280
|
return null;
|
|
20100
20281
|
}
|
|
20101
|
-
const
|
|
20282
|
+
const id2 = typeof row.id === "string" && row.id.length > 0 ? row.id : null;
|
|
20102
20283
|
const epochSeconds = (value) => {
|
|
20103
20284
|
if (typeof value !== "number" || !Number.isFinite(value))
|
|
20104
20285
|
return null;
|
|
@@ -20106,10 +20287,10 @@ function hermesUsageEntry(row) {
|
|
|
20106
20287
|
return Number.isSafeInteger(ms) && !Number.isNaN(new Date(ms).getTime()) ? ms : null;
|
|
20107
20288
|
};
|
|
20108
20289
|
const at = epochSeconds(row.last_activity_at) ?? epochSeconds(row.started_at);
|
|
20109
|
-
if (
|
|
20290
|
+
if (id2 === null || at === null)
|
|
20110
20291
|
return null;
|
|
20111
20292
|
const request = {
|
|
20112
|
-
requestId:
|
|
20293
|
+
requestId: id2,
|
|
20113
20294
|
...typeof row.model === "string" && row.model.length > 0 ? { model: row.model } : {},
|
|
20114
20295
|
inputTokens: input + cacheRead + cacheWrite,
|
|
20115
20296
|
outputTokens: output,
|
|
@@ -20121,7 +20302,7 @@ function hermesUsageEntry(row) {
|
|
|
20121
20302
|
if (!entry)
|
|
20122
20303
|
return null;
|
|
20123
20304
|
return withUsageSession(entry, {
|
|
20124
|
-
sessionId:
|
|
20305
|
+
sessionId: id2,
|
|
20125
20306
|
cwd: typeof row.cwd === "string" ? row.cwd : void 0,
|
|
20126
20307
|
title: usageSessionTitle(row.title ?? row.display_name)
|
|
20127
20308
|
});
|
|
@@ -20153,7 +20334,7 @@ function createHermesUsageStatistics(environment) {
|
|
|
20153
20334
|
const stamp = await fingerprint(file2);
|
|
20154
20335
|
return stamp ? [{ id: file2, fingerprint: stamp }] : [];
|
|
20155
20336
|
},
|
|
20156
|
-
readSource: (
|
|
20337
|
+
readSource: (id2) => readHermesUsage(id2)
|
|
20157
20338
|
});
|
|
20158
20339
|
}
|
|
20159
20340
|
|
|
@@ -20213,15 +20394,15 @@ var HermesQuestions = class {
|
|
|
20213
20394
|
return { ok: true, value: { accepted: true } };
|
|
20214
20395
|
}
|
|
20215
20396
|
cancel(turnId) {
|
|
20216
|
-
for (const [
|
|
20397
|
+
for (const [id2, waiter] of this.#waiters)
|
|
20217
20398
|
if (!turnId || waiter.interaction.turnId === turnId)
|
|
20218
|
-
this.#cancel(
|
|
20399
|
+
this.#cancel(id2, "cancelled");
|
|
20219
20400
|
}
|
|
20220
|
-
#cancel(
|
|
20221
|
-
const waiter = this.#waiters.get(
|
|
20401
|
+
#cancel(id2, reason) {
|
|
20402
|
+
const waiter = this.#waiters.get(id2);
|
|
20222
20403
|
if (!waiter)
|
|
20223
20404
|
return;
|
|
20224
|
-
this.#waiters.delete(
|
|
20405
|
+
this.#waiters.delete(id2);
|
|
20225
20406
|
waiter.resolve({ type: "question", answers: {}, cancelled: true });
|
|
20226
20407
|
this.emit({
|
|
20227
20408
|
kind: "event",
|
|
@@ -21115,27 +21296,27 @@ var HermesSession = class {
|
|
|
21115
21296
|
if (requireNativeCommand && !nativeCommand)
|
|
21116
21297
|
return err("unsupported", "Hermes no longer advertises this command");
|
|
21117
21298
|
const isNativeCommand = nativeCommand != null;
|
|
21118
|
-
const
|
|
21119
|
-
this.#activeTurn =
|
|
21120
|
-
this.#activeTurnId =
|
|
21121
|
-
void this.#runTurn(
|
|
21122
|
-
return ok({ turnId:
|
|
21123
|
-
}
|
|
21124
|
-
async #runTurn(
|
|
21125
|
-
this.#emit({ type: "turn.started", turnId:
|
|
21126
|
-
if (
|
|
21127
|
-
this.#emit({ type: "item.started", turnId:
|
|
21299
|
+
const active2 = new ActiveTurn(command.turnId, turnKey, command.input, !isNativeCommand, isNativeCommand && nativeCommand === "compress");
|
|
21300
|
+
this.#activeTurn = active2;
|
|
21301
|
+
this.#activeTurnId = active2.turnId;
|
|
21302
|
+
void this.#runTurn(active2, text2);
|
|
21303
|
+
return ok({ turnId: active2.turnId });
|
|
21304
|
+
}
|
|
21305
|
+
async #runTurn(active2, text2) {
|
|
21306
|
+
this.#emit({ type: "turn.started", turnId: active2.turnId });
|
|
21307
|
+
if (active2.compactionItem)
|
|
21308
|
+
this.#emit({ type: "item.started", turnId: active2.turnId, item: active2.compactionItem });
|
|
21128
21309
|
let promptResponse = null;
|
|
21129
21310
|
let failure2 = null;
|
|
21130
21311
|
let previousNativeTurnKey;
|
|
21131
21312
|
try {
|
|
21132
|
-
if (
|
|
21313
|
+
if (active2.persistsHistory && this.#transport.readNativeSnapshot)
|
|
21133
21314
|
previousNativeTurnKey = (await this.#transport.readNativeSnapshot()).turns.at(-1)?.nativeTurnRef.nativeTurnKey;
|
|
21134
|
-
promptResponse = await this.#transport.runTurn(text2, (event) => this.#handleTransportEvent(
|
|
21315
|
+
promptResponse = await this.#transport.runTurn(text2, (event) => this.#handleTransportEvent(active2, event), (request) => this.#handlePermissionRequest(active2, request), (request) => this.#handleQuestionRequest(active2, request));
|
|
21135
21316
|
} catch (error51) {
|
|
21136
21317
|
failure2 = error51 instanceof HermesTransportError ? transportErrorToHarness(error51) : harnessError("nativeFailure", error51 instanceof Error ? error51.message : String(error51));
|
|
21137
21318
|
}
|
|
21138
|
-
if (this.#activeTurn !==
|
|
21319
|
+
if (this.#activeTurn !== active2) {
|
|
21139
21320
|
return;
|
|
21140
21321
|
}
|
|
21141
21322
|
let outcome;
|
|
@@ -21151,12 +21332,12 @@ var HermesSession = class {
|
|
|
21151
21332
|
} else {
|
|
21152
21333
|
outcome = { status: "succeeded" };
|
|
21153
21334
|
}
|
|
21154
|
-
|
|
21155
|
-
if (
|
|
21335
|
+
active2.nativeCompactionOutcome = promptResponse?.compactionOutcome;
|
|
21336
|
+
if (active2.persistsHistory && this.#transport.readNativeSnapshot) {
|
|
21156
21337
|
try {
|
|
21157
21338
|
const latest = (await this.#transport.readNativeSnapshot()).turns.at(-1);
|
|
21158
21339
|
if (latest?.nativeTurnRef.nativeTurnKey !== previousNativeTurnKey)
|
|
21159
|
-
|
|
21340
|
+
active2.nativeTurnSnapshot = latest;
|
|
21160
21341
|
} catch (error51) {
|
|
21161
21342
|
outcome = {
|
|
21162
21343
|
status: "failed",
|
|
@@ -21166,72 +21347,72 @@ var HermesSession = class {
|
|
|
21166
21347
|
}
|
|
21167
21348
|
const terminalUsage = promptResponse?.usage ?? null;
|
|
21168
21349
|
const usage = terminalUsage ? this.#usage.merge(terminalUsage) : null;
|
|
21169
|
-
this.#completeActiveTurn(
|
|
21350
|
+
this.#completeActiveTurn(active2, outcome, usage, promptResponse?.finalAnswerText);
|
|
21170
21351
|
}
|
|
21171
|
-
#completeActiveTurn(
|
|
21172
|
-
if (this.#activeTurn !==
|
|
21352
|
+
#completeActiveTurn(active2, outcome, usage = null, finalAnswerText) {
|
|
21353
|
+
if (this.#activeTurn !== active2)
|
|
21173
21354
|
return;
|
|
21174
21355
|
this.#cancelApprovalWaiters();
|
|
21175
21356
|
this.#activeTurn = null;
|
|
21176
21357
|
this.#activeTurnId = null;
|
|
21177
|
-
this.#finishCompactionActivity(
|
|
21178
|
-
|
|
21179
|
-
const compactionOutcome =
|
|
21358
|
+
this.#finishCompactionActivity(active2, "当前 Turn 已结束;原生未确认自动压缩终态,提交结果未知。");
|
|
21359
|
+
active2.finish(outcome.status === "succeeded" ? finalAnswerText : void 0);
|
|
21360
|
+
const compactionOutcome = active2.finishCompaction(outcome);
|
|
21180
21361
|
if (outcome.status === "succeeded" && compactionOutcome?.status === "failed") {
|
|
21181
21362
|
outcome = { status: "failed", error: compactionOutcome.error };
|
|
21182
21363
|
}
|
|
21183
|
-
if (
|
|
21184
|
-
outcome = { ...outcome, checkpoint:
|
|
21185
|
-
const nativeTurnRef =
|
|
21364
|
+
if (active2.nativeTurnSnapshot?.checkpoint)
|
|
21365
|
+
outcome = { ...outcome, checkpoint: active2.nativeTurnSnapshot.checkpoint };
|
|
21366
|
+
const nativeTurnRef = active2.nativeTurnSnapshot?.nativeTurnRef ?? nativeTurnRefSchema.parse({
|
|
21186
21367
|
harnessId: this.#nativeRef.harnessId,
|
|
21187
21368
|
nativeSessionId: this.#nativeRef.nativeSessionId,
|
|
21188
|
-
nativeTurnKey:
|
|
21369
|
+
nativeTurnKey: active2.turnKey,
|
|
21189
21370
|
formatVersion: 1
|
|
21190
21371
|
});
|
|
21191
|
-
const turnSnapshot =
|
|
21192
|
-
for (const pending of
|
|
21193
|
-
this.#emit({ type: "item.completed", turnId:
|
|
21372
|
+
const turnSnapshot = active2.toSnapshot(nativeTurnRef, outcome, true);
|
|
21373
|
+
for (const pending of active2.drainPendingItems()) {
|
|
21374
|
+
this.#emit({ type: "item.completed", turnId: active2.turnId, snapshot: pending });
|
|
21194
21375
|
}
|
|
21195
21376
|
if (usage) {
|
|
21196
|
-
this.#emit({ type: "session.usage.changed", usage, observedForTurnId:
|
|
21377
|
+
this.#emit({ type: "session.usage.changed", usage, observedForTurnId: active2.turnId });
|
|
21197
21378
|
}
|
|
21198
21379
|
this.#emit({
|
|
21199
21380
|
type: "turn.completed",
|
|
21200
|
-
turnId:
|
|
21201
|
-
...
|
|
21381
|
+
turnId: active2.turnId,
|
|
21382
|
+
...active2.persistsHistory && (!this.#transport.readNativeSnapshot || active2.nativeTurnSnapshot) ? { nativeTurnRef } : {},
|
|
21202
21383
|
outcome
|
|
21203
21384
|
});
|
|
21204
|
-
if (
|
|
21385
|
+
if (active2.persistsHistory)
|
|
21205
21386
|
this.#completedTurns.push(turnSnapshot);
|
|
21206
21387
|
void this.#usage.refresh(true);
|
|
21207
21388
|
}
|
|
21208
|
-
#handleTransportEvent(
|
|
21209
|
-
if (this.#activeTurn !==
|
|
21389
|
+
#handleTransportEvent(active2, event) {
|
|
21390
|
+
if (this.#activeTurn !== active2)
|
|
21210
21391
|
return;
|
|
21211
21392
|
switch (event.type) {
|
|
21212
21393
|
case "usage":
|
|
21213
21394
|
this.#usage.observe(event.usage);
|
|
21214
21395
|
return;
|
|
21215
21396
|
case "status.warning": {
|
|
21216
|
-
const notice =
|
|
21397
|
+
const notice = active2.compactionActivity.appendNotice(event.text);
|
|
21217
21398
|
if (notice)
|
|
21218
21399
|
this.#emit({
|
|
21219
21400
|
type: "item.updated",
|
|
21220
|
-
turnId:
|
|
21401
|
+
turnId: active2.turnId,
|
|
21221
21402
|
itemId: notice.itemId,
|
|
21222
21403
|
update: { type: "text.append", text: notice.text }
|
|
21223
21404
|
});
|
|
21224
21405
|
return;
|
|
21225
21406
|
}
|
|
21226
21407
|
case "compaction.started": {
|
|
21227
|
-
if (
|
|
21408
|
+
if (active2.compactionItem)
|
|
21228
21409
|
return;
|
|
21229
|
-
const item =
|
|
21410
|
+
const item = active2.compactionActivity.start(event.text);
|
|
21230
21411
|
if (item) {
|
|
21231
|
-
this.#emit({ type: "item.started", turnId:
|
|
21412
|
+
this.#emit({ type: "item.started", turnId: active2.turnId, item: { ...item, text: "" } });
|
|
21232
21413
|
this.#emit({
|
|
21233
21414
|
type: "item.updated",
|
|
21234
|
-
turnId:
|
|
21415
|
+
turnId: active2.turnId,
|
|
21235
21416
|
itemId: item.itemId,
|
|
21236
21417
|
update: { type: "text.append", text: item.text }
|
|
21237
21418
|
});
|
|
@@ -21239,62 +21420,62 @@ var HermesSession = class {
|
|
|
21239
21420
|
return;
|
|
21240
21421
|
}
|
|
21241
21422
|
case "compaction.finished": {
|
|
21242
|
-
if (this.#finishCompactionActivity(
|
|
21423
|
+
if (this.#finishCompactionActivity(active2, "原生自动压缩阶段已结束;未提供压缩提交结果。"))
|
|
21243
21424
|
void this.#usage.refresh(true);
|
|
21244
21425
|
return;
|
|
21245
21426
|
}
|
|
21246
21427
|
case "agent.thought":
|
|
21247
|
-
this.#appendTextItem(
|
|
21428
|
+
this.#appendTextItem(active2, "reasoning", event.text);
|
|
21248
21429
|
return;
|
|
21249
21430
|
case "agent.text":
|
|
21250
|
-
this.#appendTextItem(
|
|
21431
|
+
this.#appendTextItem(active2, "agentMessage", event.text);
|
|
21251
21432
|
return;
|
|
21252
21433
|
case "tool.call": {
|
|
21253
21434
|
const update = event.update;
|
|
21254
|
-
this.#startToolItem(
|
|
21255
|
-
this.#updateToolItem(
|
|
21435
|
+
this.#startToolItem(active2, event.toolCallId, typeof update.title === "string" ? update.title : null, typeof update.name === "string" ? update.name : null, update.rawInput);
|
|
21436
|
+
this.#updateToolItem(active2, update);
|
|
21256
21437
|
return;
|
|
21257
21438
|
}
|
|
21258
21439
|
case "tool.update":
|
|
21259
|
-
this.#updateToolItem(
|
|
21440
|
+
this.#updateToolItem(active2, event.update);
|
|
21260
21441
|
return;
|
|
21261
21442
|
default:
|
|
21262
21443
|
return;
|
|
21263
21444
|
}
|
|
21264
21445
|
}
|
|
21265
|
-
#finishCompactionActivity(
|
|
21266
|
-
const snapshot =
|
|
21446
|
+
#finishCompactionActivity(active2, reason) {
|
|
21447
|
+
const snapshot = active2.compactionActivity.finish(reason);
|
|
21267
21448
|
if (!snapshot)
|
|
21268
21449
|
return false;
|
|
21269
|
-
|
|
21450
|
+
active2.rememberActivity(snapshot);
|
|
21270
21451
|
this.#emit({
|
|
21271
21452
|
type: "item.updated",
|
|
21272
|
-
turnId:
|
|
21453
|
+
turnId: active2.turnId,
|
|
21273
21454
|
itemId: snapshot.item.itemId,
|
|
21274
21455
|
update: { type: "text.append", text: `
|
|
21275
21456
|
${reason}` }
|
|
21276
21457
|
});
|
|
21277
|
-
this.#emit({ type: "item.completed", turnId:
|
|
21458
|
+
this.#emit({ type: "item.completed", turnId: active2.turnId, snapshot });
|
|
21278
21459
|
return true;
|
|
21279
21460
|
}
|
|
21280
|
-
#appendTextItem(
|
|
21281
|
-
const appended =
|
|
21461
|
+
#appendTextItem(active2, kind, text2) {
|
|
21462
|
+
const appended = active2.appendText(kind, text2);
|
|
21282
21463
|
if (!appended)
|
|
21283
21464
|
return;
|
|
21284
21465
|
if (appended.startedItem) {
|
|
21285
|
-
this.#emit({ type: "item.started", turnId:
|
|
21466
|
+
this.#emit({ type: "item.started", turnId: active2.turnId, item: appended.startedItem });
|
|
21286
21467
|
}
|
|
21287
21468
|
this.#emit({
|
|
21288
21469
|
type: "item.updated",
|
|
21289
|
-
turnId:
|
|
21470
|
+
turnId: active2.turnId,
|
|
21290
21471
|
itemId: appended.item.itemId,
|
|
21291
21472
|
update: { type: "text.append", text: text2 }
|
|
21292
21473
|
});
|
|
21293
21474
|
}
|
|
21294
|
-
#startToolItem(
|
|
21295
|
-
const completedText =
|
|
21475
|
+
#startToolItem(active2, toolCallId, title, name, rawInput) {
|
|
21476
|
+
const completedText = active2.completeCurrentText();
|
|
21296
21477
|
if (completedText) {
|
|
21297
|
-
this.#emit({ type: "item.completed", turnId:
|
|
21478
|
+
this.#emit({ type: "item.completed", turnId: active2.turnId, snapshot: completedText });
|
|
21298
21479
|
}
|
|
21299
21480
|
const item = {
|
|
21300
21481
|
type: "toolExecution",
|
|
@@ -21302,39 +21483,39 @@ ${reason}` }
|
|
|
21302
21483
|
toolName: (name ?? title ?? "").trim() || toolCallId,
|
|
21303
21484
|
arguments: isPlainObjectOrArray(rawInput) ? rawInput : null
|
|
21304
21485
|
};
|
|
21305
|
-
|
|
21306
|
-
this.#emit({ type: "item.started", turnId:
|
|
21486
|
+
active2.addToolItem(toolCallId, { item, startedAt: Date.now() });
|
|
21487
|
+
this.#emit({ type: "item.started", turnId: active2.turnId, item });
|
|
21307
21488
|
}
|
|
21308
|
-
#updateToolItem(
|
|
21309
|
-
const entry =
|
|
21489
|
+
#updateToolItem(active2, update) {
|
|
21490
|
+
const entry = active2.getToolItem(update.toolCallId);
|
|
21310
21491
|
if (!entry)
|
|
21311
21492
|
return;
|
|
21312
|
-
|
|
21493
|
+
active2.rememberFileChanges(update.toolCallId, update);
|
|
21313
21494
|
const output = hermesToolOutput(update);
|
|
21314
21495
|
if (output && output.content.length > 0) {
|
|
21315
|
-
|
|
21496
|
+
active2.updateToolOutput(update.toolCallId, output);
|
|
21316
21497
|
this.#emit({
|
|
21317
21498
|
type: "item.updated",
|
|
21318
|
-
turnId:
|
|
21499
|
+
turnId: active2.turnId,
|
|
21319
21500
|
itemId: entry.item.itemId,
|
|
21320
21501
|
update: { type: "output.replace", output }
|
|
21321
21502
|
});
|
|
21322
21503
|
}
|
|
21323
21504
|
if (update.status === "completed" || update.status === "failed") {
|
|
21324
|
-
const completed =
|
|
21505
|
+
const completed = active2.completeToolItem(update.toolCallId, output, update.status === "failed");
|
|
21325
21506
|
if (completed) {
|
|
21326
|
-
this.#emit({ type: "item.completed", turnId:
|
|
21507
|
+
this.#emit({ type: "item.completed", turnId: active2.turnId, snapshot: completed });
|
|
21327
21508
|
if (update.status === "completed") {
|
|
21328
|
-
const fileChange =
|
|
21509
|
+
const fileChange = active2.completeFileChanges(update.toolCallId, completed.item.itemId);
|
|
21329
21510
|
if (fileChange) {
|
|
21330
|
-
this.#emit({ type: "item.started", turnId:
|
|
21331
|
-
this.#emit({ type: "item.completed", turnId:
|
|
21511
|
+
this.#emit({ type: "item.started", turnId: active2.turnId, item: fileChange.item });
|
|
21512
|
+
this.#emit({ type: "item.completed", turnId: active2.turnId, snapshot: fileChange });
|
|
21332
21513
|
}
|
|
21333
21514
|
}
|
|
21334
21515
|
}
|
|
21335
21516
|
}
|
|
21336
21517
|
}
|
|
21337
|
-
#handlePermissionRequest(
|
|
21518
|
+
#handlePermissionRequest(active2, request) {
|
|
21338
21519
|
if (request.options.length === 0) {
|
|
21339
21520
|
return Promise.resolve(null);
|
|
21340
21521
|
}
|
|
@@ -21342,7 +21523,7 @@ ${reason}` }
|
|
|
21342
21523
|
const interaction = {
|
|
21343
21524
|
type: "approval",
|
|
21344
21525
|
interactionId,
|
|
21345
|
-
turnId:
|
|
21526
|
+
turnId: active2.turnId,
|
|
21346
21527
|
title: request.title?.slice(0, 200) || "Hermes 请求批准",
|
|
21347
21528
|
...request.description ? { description: request.description } : {},
|
|
21348
21529
|
subject: { type: "nativeAction" },
|
|
@@ -21354,7 +21535,7 @@ ${reason}` }
|
|
|
21354
21535
|
const pending = new Promise((resolve) => {
|
|
21355
21536
|
this.#approvalWaiters.set(interactionId, {
|
|
21356
21537
|
interaction,
|
|
21357
|
-
turnId:
|
|
21538
|
+
turnId: active2.turnId,
|
|
21358
21539
|
resolve
|
|
21359
21540
|
});
|
|
21360
21541
|
abort = () => {
|
|
@@ -21364,7 +21545,7 @@ ${reason}` }
|
|
|
21364
21545
|
this.#emit({
|
|
21365
21546
|
type: "interaction.closed",
|
|
21366
21547
|
interactionId,
|
|
21367
|
-
turnId:
|
|
21548
|
+
turnId: active2.turnId,
|
|
21368
21549
|
reason: request.signal?.reason === "expired" ? "expired" : "cancelled"
|
|
21369
21550
|
});
|
|
21370
21551
|
};
|
|
@@ -21427,15 +21608,15 @@ ${reason}` }
|
|
|
21427
21608
|
return { ok: false, error: failure2 };
|
|
21428
21609
|
}
|
|
21429
21610
|
}
|
|
21430
|
-
#handleQuestionRequest(
|
|
21431
|
-
if (this.#activeTurn !==
|
|
21611
|
+
#handleQuestionRequest(active2, request) {
|
|
21612
|
+
if (this.#activeTurn !== active2)
|
|
21432
21613
|
return Promise.resolve({ type: "question", answers: {}, cancelled: true });
|
|
21433
|
-
return this.#questions.open(
|
|
21614
|
+
return this.#questions.open(active2.turnId, request);
|
|
21434
21615
|
}
|
|
21435
21616
|
async #selectThinking(command) {
|
|
21436
21617
|
if (!this.#transport.setThinking)
|
|
21437
21618
|
return err("unsupported", "Hermes does not expose Thinking options");
|
|
21438
|
-
if (!this.#state.availableThinkingOptions?.some(({ id }) =>
|
|
21619
|
+
if (!this.#state.availableThinkingOptions?.some(({ id: id2 }) => id2 === command.thinkingOptionId))
|
|
21439
21620
|
return err("invalidRequest", "Unknown Hermes Thinking option");
|
|
21440
21621
|
try {
|
|
21441
21622
|
const selected = await this.#transport.setThinking(command.thinkingOptionId);
|
|
@@ -21450,10 +21631,7 @@ ${reason}` }
|
|
|
21450
21631
|
}
|
|
21451
21632
|
}
|
|
21452
21633
|
async #selectModel(command) {
|
|
21453
|
-
const native =
|
|
21454
|
-
if (!native) {
|
|
21455
|
-
return err("invalidRequest", "Model Ref does not belong to Hermes");
|
|
21456
|
-
}
|
|
21634
|
+
const native = command.model.id;
|
|
21457
21635
|
try {
|
|
21458
21636
|
await this.#transport.setModel(native);
|
|
21459
21637
|
} catch (error51) {
|
|
@@ -21563,7 +21741,7 @@ async function openGatewaySession(input, transport, onSettle, inheritedPermissio
|
|
|
21563
21741
|
throw new HermesGatewayHistoryError("unsupported", "Hermes gateway supports only native approval policy and session YOLO");
|
|
21564
21742
|
if (input.kind === "create" && input.executionPolicy === "unattended-full-access" && mode && mode !== "dont_ask")
|
|
21565
21743
|
throw new HermesGatewayHistoryError("invalidRequest", "unattended-full-access requires dont_ask");
|
|
21566
|
-
const model2 = input.kind !== "fork"
|
|
21744
|
+
const model2 = input.kind !== "fork" ? input.model?.id : void 0;
|
|
21567
21745
|
if (input.kind !== "fork" && input.model && !model2)
|
|
21568
21746
|
throw new HermesGatewayHistoryError("invalidRequest", "Model Ref does not belong to Hermes");
|
|
21569
21747
|
if (source && gatewayRecord(source.locator).cwd && !await sameDirectory(String(gatewayRecord(source?.locator).cwd), input.cwd))
|
|
@@ -21646,6 +21824,7 @@ async function openGatewaySession(input, transport, onSettle, inheritedPermissio
|
|
|
21646
21824
|
var hermesHarnessId = harnessIdSchema.parse("hermes");
|
|
21647
21825
|
var IMPORT_TIMEOUT_MS = 2e4;
|
|
21648
21826
|
var HermesAdapter = class {
|
|
21827
|
+
normalizeStoredModelRef = normalizeStoredHermesModelRef;
|
|
21649
21828
|
commandCatalog = HERMES_COMMAND_CATALOG;
|
|
21650
21829
|
liveCommandCatalog = true;
|
|
21651
21830
|
harnessId = hermesHarnessId;
|
|
@@ -21773,7 +21952,7 @@ var HermesAdapter = class {
|
|
|
21773
21952
|
if (source?.busy)
|
|
21774
21953
|
return failure("sessionBusy", "Cannot derive a Hermes Session while its source Turn is active", true);
|
|
21775
21954
|
}
|
|
21776
|
-
const owned = (
|
|
21955
|
+
const owned = (id2) => this.#openingNativeIds.has(id2) || [...this.#sessions].some((session) => session.initialState.nativeRef?.nativeSessionId === id2);
|
|
21777
21956
|
if (ref && owned(ref.nativeSessionId))
|
|
21778
21957
|
return failure("sessionBusy", "This Hermes Session already has an owner", true);
|
|
21779
21958
|
if (ref)
|