@codexhost/cli-linux-arm64 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +1565 -1805
- package/app/console-web.js +5786 -1600
- package/app/desktop-controller.mjs +13104 -2842
- package/app/host-runtime.mjs +50518 -51753
- package/app/plugins/antigravity/plugin.mjs +1932 -1148
- package/app/plugins/claude-code/plugin.mjs +1676 -1218
- package/app/plugins/codebuddy/plugin.mjs +1266 -850
- package/app/plugins/codex-usage/plugin.mjs +916 -737
- package/app/plugins/copilot/plugin.mjs +838 -640
- package/app/plugins/cursor-cli/plugin.mjs +1058 -747
- package/app/plugins/deepseek-harness/plugin.mjs +1302 -1070
- package/app/plugins/devin/plugin.mjs +949 -752
- package/app/plugins/grok/plugin.mjs +1132 -964
- package/app/plugins/hermes/plugin.mjs +1084 -905
- package/app/plugins/kimi-code/plugin.mjs +977 -804
- package/app/plugins/kiro-cli/plugin.mjs +951 -758
- package/app/plugins/omp/plugin.mjs +1408 -1169
- package/app/plugins/opencode/plugin.mjs +1385 -1142
- package/app/plugins/pi/plugin.mjs +1515 -1287
- package/app/plugins/qoder/plugin.mjs +861 -676
- package/app/plugins/qoder-cn/plugin.mjs +861 -676
- package/app/plugins/qwen-code/plugin.mjs +1060 -888
- package/app/plugins/workbuddy/plugin.mjs +1272 -856
- package/app/plugins/zcode/plugin.mjs +1529 -880
- package/app/renderer-extension.js +11568 -7827
- package/app/web/assets/index-CTCFIQbU.css +1 -0
- package/app/web/assets/index-IvFk9KT-.js +203 -0
- package/app/web/codexhost-settings.js +4472 -36194
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +75 -64
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +19 -16
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
- package/app/web/sw.js +8 -1
- package/app/web-modules/server.mjs +2682 -5540
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-DJW4bmyx.css +0 -1
- package/app/web/assets/index-Dyh1KzAB.js +0 -201
|
@@ -2438,10 +2438,10 @@ var require_resolve = __commonJS({
|
|
|
2438
2438
|
}
|
|
2439
2439
|
return count2;
|
|
2440
2440
|
}
|
|
2441
|
-
function getFullPath(resolver,
|
|
2441
|
+
function getFullPath(resolver, id2 = "", normalize2) {
|
|
2442
2442
|
if (normalize2 !== false)
|
|
2443
|
-
|
|
2444
|
-
const p2 = resolver.parse(
|
|
2443
|
+
id2 = normalizeId(id2);
|
|
2444
|
+
const p2 = resolver.parse(id2);
|
|
2445
2445
|
return _getFullPath(resolver, p2);
|
|
2446
2446
|
}
|
|
2447
2447
|
exports.getFullPath = getFullPath;
|
|
@@ -2451,13 +2451,13 @@ var require_resolve = __commonJS({
|
|
|
2451
2451
|
}
|
|
2452
2452
|
exports._getFullPath = _getFullPath;
|
|
2453
2453
|
var TRAILING_SLASH_HASH = /#\/?$/;
|
|
2454
|
-
function normalizeId(
|
|
2455
|
-
return
|
|
2454
|
+
function normalizeId(id2) {
|
|
2455
|
+
return id2 ? id2.replace(TRAILING_SLASH_HASH, "") : "";
|
|
2456
2456
|
}
|
|
2457
2457
|
exports.normalizeId = normalizeId;
|
|
2458
|
-
function resolveUrl(resolver, baseId,
|
|
2459
|
-
|
|
2460
|
-
return resolver.resolve(baseId,
|
|
2458
|
+
function resolveUrl(resolver, baseId, id2) {
|
|
2459
|
+
id2 = normalizeId(id2);
|
|
2460
|
+
return resolver.resolve(baseId, id2);
|
|
2461
2461
|
}
|
|
2462
2462
|
exports.resolveUrl = resolveUrl;
|
|
2463
2463
|
var ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
|
@@ -3227,8 +3227,8 @@ var require_compile = __commonJS({
|
|
|
3227
3227
|
if (Object.keys(root.schema).length > 0 && refPath === baseId) {
|
|
3228
3228
|
return getJsonPointer.call(this, p2, root);
|
|
3229
3229
|
}
|
|
3230
|
-
const
|
|
3231
|
-
const schOrRef = this.refs[
|
|
3230
|
+
const id2 = (0, resolve_1.normalizeId)(refPath);
|
|
3231
|
+
const schOrRef = this.refs[id2] || this.schemas[id2];
|
|
3232
3232
|
if (typeof schOrRef == "string") {
|
|
3233
3233
|
const sch = resolveSchema.call(this, root, schOrRef);
|
|
3234
3234
|
if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object")
|
|
@@ -3239,7 +3239,7 @@ var require_compile = __commonJS({
|
|
|
3239
3239
|
return;
|
|
3240
3240
|
if (!schOrRef.validate)
|
|
3241
3241
|
compileSchema.call(this, schOrRef);
|
|
3242
|
-
if (
|
|
3242
|
+
if (id2 === (0, resolve_1.normalizeId)(ref)) {
|
|
3243
3243
|
const { schema } = schOrRef;
|
|
3244
3244
|
const { schemaId } = this.opts;
|
|
3245
3245
|
const schId = schema[schemaId];
|
|
@@ -4362,15 +4362,15 @@ var require_core = __commonJS({
|
|
|
4362
4362
|
this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
4363
4363
|
return this;
|
|
4364
4364
|
}
|
|
4365
|
-
let
|
|
4365
|
+
let id2;
|
|
4366
4366
|
if (typeof schema === "object") {
|
|
4367
4367
|
const { schemaId } = this.opts;
|
|
4368
|
-
|
|
4369
|
-
if (
|
|
4368
|
+
id2 = schema[schemaId];
|
|
4369
|
+
if (id2 !== void 0 && typeof id2 != "string") {
|
|
4370
4370
|
throw new Error(`schema ${schemaId} must be string`);
|
|
4371
4371
|
}
|
|
4372
4372
|
}
|
|
4373
|
-
key = (0, resolve_1.normalizeId)(key ||
|
|
4373
|
+
key = (0, resolve_1.normalizeId)(key || id2);
|
|
4374
4374
|
this._checkUnique(key);
|
|
4375
4375
|
this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);
|
|
4376
4376
|
return this;
|
|
@@ -4449,11 +4449,11 @@ var require_core = __commonJS({
|
|
|
4449
4449
|
case "object": {
|
|
4450
4450
|
const cacheKey = schemaKeyRef;
|
|
4451
4451
|
this._cache.delete(cacheKey);
|
|
4452
|
-
let
|
|
4453
|
-
if (
|
|
4454
|
-
|
|
4455
|
-
delete this.schemas[
|
|
4456
|
-
delete this.refs[
|
|
4452
|
+
let id2 = schemaKeyRef[this.opts.schemaId];
|
|
4453
|
+
if (id2) {
|
|
4454
|
+
id2 = (0, resolve_1.normalizeId)(id2);
|
|
4455
|
+
delete this.schemas[id2];
|
|
4456
|
+
delete this.refs[id2];
|
|
4457
4457
|
}
|
|
4458
4458
|
return this;
|
|
4459
4459
|
}
|
|
@@ -4560,10 +4560,10 @@ var require_core = __commonJS({
|
|
|
4560
4560
|
}
|
|
4561
4561
|
}
|
|
4562
4562
|
_addSchema(schema, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
4563
|
-
let
|
|
4563
|
+
let id2;
|
|
4564
4564
|
const { schemaId } = this.opts;
|
|
4565
4565
|
if (typeof schema == "object") {
|
|
4566
|
-
|
|
4566
|
+
id2 = schema[schemaId];
|
|
4567
4567
|
} else {
|
|
4568
4568
|
if (this.opts.jtd)
|
|
4569
4569
|
throw new Error("schema must be object");
|
|
@@ -4573,7 +4573,7 @@ var require_core = __commonJS({
|
|
|
4573
4573
|
let sch = this._cache.get(schema);
|
|
4574
4574
|
if (sch !== void 0)
|
|
4575
4575
|
return sch;
|
|
4576
|
-
baseId = (0, resolve_1.normalizeId)(
|
|
4576
|
+
baseId = (0, resolve_1.normalizeId)(id2 || baseId);
|
|
4577
4577
|
const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
|
|
4578
4578
|
sch = new compile_1.SchemaEnv({ schema, schemaId, meta: meta3, baseId, localRefs });
|
|
4579
4579
|
this._cache.set(sch.schema, sch);
|
|
@@ -4586,9 +4586,9 @@ var require_core = __commonJS({
|
|
|
4586
4586
|
this.validateSchema(schema, true);
|
|
4587
4587
|
return sch;
|
|
4588
4588
|
}
|
|
4589
|
-
_checkUnique(
|
|
4590
|
-
if (this.schemas[
|
|
4591
|
-
throw new Error(`schema with key or id "${
|
|
4589
|
+
_checkUnique(id2) {
|
|
4590
|
+
if (this.schemas[id2] || this.refs[id2]) {
|
|
4591
|
+
throw new Error(`schema with key or id "${id2}" already exists`);
|
|
4592
4592
|
}
|
|
4593
4593
|
}
|
|
4594
4594
|
_compileSchemaEnv(sch) {
|
|
@@ -8152,8 +8152,8 @@ function cleanEnum(obj) {
|
|
|
8152
8152
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
8153
8153
|
}).map((el) => el[1]);
|
|
8154
8154
|
}
|
|
8155
|
-
function base64ToUint8Array(
|
|
8156
|
-
const binaryString = atob(
|
|
8155
|
+
function base64ToUint8Array(base644) {
|
|
8156
|
+
const binaryString = atob(base644);
|
|
8157
8157
|
const bytes = new Uint8Array(binaryString.length);
|
|
8158
8158
|
for (let i = 0; i < binaryString.length; i++) {
|
|
8159
8159
|
bytes[i] = binaryString.charCodeAt(i);
|
|
@@ -8168,9 +8168,9 @@ function uint8ArrayToBase64(bytes) {
|
|
|
8168
8168
|
return btoa(binaryString);
|
|
8169
8169
|
}
|
|
8170
8170
|
function base64urlToUint8Array(base64url3) {
|
|
8171
|
-
const
|
|
8172
|
-
const padding = "=".repeat((4 -
|
|
8173
|
-
return base64ToUint8Array(
|
|
8171
|
+
const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
|
|
8172
|
+
const padding = "=".repeat((4 - base644.length % 4) % 4);
|
|
8173
|
+
return base64ToUint8Array(base644 + padding);
|
|
8174
8174
|
}
|
|
8175
8175
|
function uint8ArrayToBase64url(bytes) {
|
|
8176
8176
|
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
@@ -9536,8 +9536,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
9536
9536
|
function isValidBase64URL(data) {
|
|
9537
9537
|
if (!base64url.test(data))
|
|
9538
9538
|
return false;
|
|
9539
|
-
const
|
|
9540
|
-
const padded =
|
|
9539
|
+
const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
9540
|
+
const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
|
|
9541
9541
|
return isValidBase64(padded);
|
|
9542
9542
|
}
|
|
9543
9543
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
@@ -9991,42 +9991,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
9991
9991
|
}
|
|
9992
9992
|
doc.write(`const newResult = {};`);
|
|
9993
9993
|
for (const key of normalized.keys) {
|
|
9994
|
-
const
|
|
9994
|
+
const id2 = ids[key];
|
|
9995
9995
|
const k = esc(key);
|
|
9996
9996
|
const schema = shape[key];
|
|
9997
9997
|
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
9998
9998
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
9999
|
-
doc.write(`const ${
|
|
9999
|
+
doc.write(`const ${id2} = ${parseStr(key)};`);
|
|
10000
10000
|
if (isOptionalIn && isOptionalOut) {
|
|
10001
10001
|
doc.write(`
|
|
10002
|
-
if (${
|
|
10002
|
+
if (${id2}.issues.length) {
|
|
10003
10003
|
if (${k} in input) {
|
|
10004
|
-
payload.issues = payload.issues.concat(${
|
|
10004
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
10005
10005
|
...iss,
|
|
10006
10006
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
10007
10007
|
})));
|
|
10008
10008
|
}
|
|
10009
10009
|
}
|
|
10010
10010
|
|
|
10011
|
-
if (${
|
|
10011
|
+
if (${id2}.value === undefined) {
|
|
10012
10012
|
if (${k} in input) {
|
|
10013
10013
|
newResult[${k}] = undefined;
|
|
10014
10014
|
}
|
|
10015
10015
|
} else {
|
|
10016
|
-
newResult[${k}] = ${
|
|
10016
|
+
newResult[${k}] = ${id2}.value;
|
|
10017
10017
|
}
|
|
10018
10018
|
|
|
10019
10019
|
`);
|
|
10020
10020
|
} else if (!isOptionalIn) {
|
|
10021
10021
|
doc.write(`
|
|
10022
|
-
const ${
|
|
10023
|
-
if (${
|
|
10024
|
-
payload.issues = payload.issues.concat(${
|
|
10022
|
+
const ${id2}_present = ${k} in input;
|
|
10023
|
+
if (${id2}.issues.length) {
|
|
10024
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
10025
10025
|
...iss,
|
|
10026
10026
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
10027
10027
|
})));
|
|
10028
10028
|
}
|
|
10029
|
-
if (!${
|
|
10029
|
+
if (!${id2}_present && !${id2}.issues.length) {
|
|
10030
10030
|
payload.issues.push({
|
|
10031
10031
|
code: "invalid_type",
|
|
10032
10032
|
expected: "nonoptional",
|
|
@@ -10035,30 +10035,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
10035
10035
|
});
|
|
10036
10036
|
}
|
|
10037
10037
|
|
|
10038
|
-
if (${
|
|
10039
|
-
if (${
|
|
10038
|
+
if (${id2}_present) {
|
|
10039
|
+
if (${id2}.value === undefined) {
|
|
10040
10040
|
newResult[${k}] = undefined;
|
|
10041
10041
|
} else {
|
|
10042
|
-
newResult[${k}] = ${
|
|
10042
|
+
newResult[${k}] = ${id2}.value;
|
|
10043
10043
|
}
|
|
10044
10044
|
}
|
|
10045
10045
|
|
|
10046
10046
|
`);
|
|
10047
10047
|
} else {
|
|
10048
10048
|
doc.write(`
|
|
10049
|
-
if (${
|
|
10050
|
-
payload.issues = payload.issues.concat(${
|
|
10049
|
+
if (${id2}.issues.length) {
|
|
10050
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
10051
10051
|
...iss,
|
|
10052
10052
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
10053
10053
|
})));
|
|
10054
10054
|
}
|
|
10055
10055
|
|
|
10056
|
-
if (${
|
|
10056
|
+
if (${id2}.value === undefined) {
|
|
10057
10057
|
if (${k} in input) {
|
|
10058
10058
|
newResult[${k}] = undefined;
|
|
10059
10059
|
}
|
|
10060
10060
|
} else {
|
|
10061
|
-
newResult[${k}] = ${
|
|
10061
|
+
newResult[${k}] = ${id2}.value;
|
|
10062
10062
|
}
|
|
10063
10063
|
|
|
10064
10064
|
`);
|
|
@@ -18390,26 +18390,26 @@ function extractDefs(ctx, schema) {
|
|
|
18390
18390
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
18391
18391
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
18392
18392
|
for (const entry of ctx.seen.entries()) {
|
|
18393
|
-
const
|
|
18394
|
-
if (
|
|
18395
|
-
const existing = idToSchema.get(
|
|
18393
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
18394
|
+
if (id2) {
|
|
18395
|
+
const existing = idToSchema.get(id2);
|
|
18396
18396
|
if (existing && existing !== entry[0]) {
|
|
18397
|
-
throw new Error(`Duplicate schema id "${
|
|
18397
|
+
throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
18398
18398
|
}
|
|
18399
|
-
idToSchema.set(
|
|
18399
|
+
idToSchema.set(id2, entry[0]);
|
|
18400
18400
|
}
|
|
18401
18401
|
}
|
|
18402
18402
|
const makeURI = (entry) => {
|
|
18403
18403
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
18404
18404
|
if (ctx.external) {
|
|
18405
18405
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
18406
|
-
const uriGenerator = ctx.external.uri ?? ((
|
|
18406
|
+
const uriGenerator = ctx.external.uri ?? ((id3) => id3);
|
|
18407
18407
|
if (externalId) {
|
|
18408
18408
|
return { ref: uriGenerator(externalId) };
|
|
18409
18409
|
}
|
|
18410
|
-
const
|
|
18411
|
-
entry[1].defId =
|
|
18412
|
-
return { defId:
|
|
18410
|
+
const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
18411
|
+
entry[1].defId = id2;
|
|
18412
|
+
return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
|
|
18413
18413
|
}
|
|
18414
18414
|
if (entry[1] === root) {
|
|
18415
18415
|
return { ref: "#" };
|
|
@@ -18457,8 +18457,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18457
18457
|
continue;
|
|
18458
18458
|
}
|
|
18459
18459
|
}
|
|
18460
|
-
const
|
|
18461
|
-
if (
|
|
18460
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
18461
|
+
if (id2) {
|
|
18462
18462
|
extractToDef(entry);
|
|
18463
18463
|
continue;
|
|
18464
18464
|
}
|
|
@@ -18554,10 +18554,10 @@ function finalize(ctx, schema) {
|
|
|
18554
18554
|
} else {
|
|
18555
18555
|
}
|
|
18556
18556
|
if (ctx.external?.uri) {
|
|
18557
|
-
const
|
|
18558
|
-
if (!
|
|
18557
|
+
const id2 = ctx.external.registry.get(schema)?.id;
|
|
18558
|
+
if (!id2)
|
|
18559
18559
|
throw new Error("Schema is missing an `id` property");
|
|
18560
|
-
result.$id = ctx.external.uri(
|
|
18560
|
+
result.$id = ctx.external.uri(id2);
|
|
18561
18561
|
}
|
|
18562
18562
|
Object.assign(result, root.def ?? root.schema);
|
|
18563
18563
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
@@ -18717,9 +18717,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
18717
18717
|
json2.type = "number";
|
|
18718
18718
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
18719
18719
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
18720
|
-
const
|
|
18720
|
+
const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
18721
18721
|
if (exMin) {
|
|
18722
|
-
if (
|
|
18722
|
+
if (legacy2) {
|
|
18723
18723
|
json2.minimum = exclusiveMinimum;
|
|
18724
18724
|
json2.exclusiveMinimum = true;
|
|
18725
18725
|
} else {
|
|
@@ -18729,7 +18729,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
18729
18729
|
json2.minimum = minimum;
|
|
18730
18730
|
}
|
|
18731
18731
|
if (exMax) {
|
|
18732
|
-
if (
|
|
18732
|
+
if (legacy2) {
|
|
18733
18733
|
json2.maximum = exclusiveMaximum;
|
|
18734
18734
|
json2.exclusiveMaximum = true;
|
|
18735
18735
|
} else {
|
|
@@ -19591,7 +19591,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
19591
19591
|
|
|
19592
19592
|
// ../../../node_modules/zod/v4/classic/schemas.js
|
|
19593
19593
|
var _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
19594
|
-
function _installLazyMethods(inst, group,
|
|
19594
|
+
function _installLazyMethods(inst, group, methods2) {
|
|
19595
19595
|
const proto = Object.getPrototypeOf(inst);
|
|
19596
19596
|
let installed = _installedGroups.get(proto);
|
|
19597
19597
|
if (!installed) {
|
|
@@ -19601,8 +19601,8 @@ function _installLazyMethods(inst, group, methods) {
|
|
|
19601
19601
|
if (installed.has(group))
|
|
19602
19602
|
return;
|
|
19603
19603
|
installed.add(group);
|
|
19604
|
-
for (const key in
|
|
19605
|
-
const fn =
|
|
19604
|
+
for (const key in methods2) {
|
|
19605
|
+
const fn = methods2[key];
|
|
19606
19606
|
Object.defineProperty(proto, key, {
|
|
19607
19607
|
configurable: true,
|
|
19608
19608
|
enumerable: false,
|
|
@@ -21413,87 +21413,6 @@ function date4(params) {
|
|
|
21413
21413
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
21414
21414
|
config(en_default());
|
|
21415
21415
|
|
|
21416
|
-
// ../../shared-contracts/dist/ids.js
|
|
21417
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
21418
|
-
message: "Identifier must not be empty or whitespace"
|
|
21419
|
-
});
|
|
21420
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
21421
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
21422
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
21423
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
21424
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
21425
|
-
|
|
21426
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
21427
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
21428
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
21429
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
21430
|
-
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
21431
|
-
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
21432
|
-
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
21433
|
-
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");
|
|
21434
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
21435
|
-
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
21436
|
-
var harnessInstallationGuideSchema = external_exports.object({
|
|
21437
|
-
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
21438
|
-
before: localizedTextSchema.optional(),
|
|
21439
|
-
after: localizedTextSchema.optional(),
|
|
21440
|
-
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
21441
|
-
}).strict();
|
|
21442
|
-
var pluginPresentationShape = {
|
|
21443
|
-
id: installedHarnessPluginIdSchema,
|
|
21444
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
21445
|
-
version: external_exports.string().min(1).max(128),
|
|
21446
|
-
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
21447
|
-
kind: external_exports.literal("usage").optional(),
|
|
21448
|
-
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
21449
|
-
iconStyle: external_exports.object({
|
|
21450
|
-
vector: external_exports.object({
|
|
21451
|
-
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
21452
|
-
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
21453
|
-
paths: external_exports.array(external_exports.object({
|
|
21454
|
-
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
21455
|
-
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
21456
|
-
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
21457
|
-
}).strict()).min(1).max(32)
|
|
21458
|
-
}).strict().optional(),
|
|
21459
|
-
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
21460
|
-
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
21461
|
-
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
21462
|
-
}).strict().optional(),
|
|
21463
|
-
installation: harnessInstallationGuideSchema.optional(),
|
|
21464
|
-
notice: localizedTextSchema.optional(),
|
|
21465
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
21466
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
21467
|
-
links: external_exports.object({
|
|
21468
|
-
website: documentationUrlSchema.optional(),
|
|
21469
|
-
documentation: documentationUrlSchema.optional(),
|
|
21470
|
-
installation: documentationUrlSchema.optional()
|
|
21471
|
-
}).strict().optional()
|
|
21472
|
-
};
|
|
21473
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
21474
|
-
manifestVersion: external_exports.literal(1),
|
|
21475
|
-
...pluginPresentationShape,
|
|
21476
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
21477
|
-
entry: pluginRelativeResourceSchema,
|
|
21478
|
-
icon: pluginRelativeResourceSchema.optional()
|
|
21479
|
-
}).strict();
|
|
21480
|
-
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);
|
|
21481
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
21482
|
-
...pluginPresentationShape,
|
|
21483
|
-
icon: harnessPluginIconSchema.optional()
|
|
21484
|
-
}).strict();
|
|
21485
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
21486
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
21487
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
21488
|
-
}).strict();
|
|
21489
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
21490
|
-
version: external_exports.literal(1),
|
|
21491
|
-
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
21492
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
21493
|
-
message: "Enabled plugin IDs must be unique",
|
|
21494
|
-
path: ["enabled"]
|
|
21495
|
-
});
|
|
21496
|
-
|
|
21497
21416
|
// ../../shared-contracts/dist/json-value.js
|
|
21498
21417
|
function rejectExplicitUndefined(keys) {
|
|
21499
21418
|
return (value, context) => {
|
|
@@ -21553,403 +21472,73 @@ var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
|
|
|
21553
21472
|
var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
|
|
21554
21473
|
var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
|
|
21555
21474
|
|
|
21556
|
-
// ../../shared-contracts/dist/
|
|
21557
|
-
var
|
|
21558
|
-
|
|
21559
|
-
|
|
21560
|
-
|
|
21561
|
-
|
|
21562
|
-
|
|
21563
|
-
|
|
21564
|
-
|
|
21565
|
-
|
|
21566
|
-
|
|
21567
|
-
|
|
21568
|
-
var
|
|
21569
|
-
var
|
|
21570
|
-
var
|
|
21571
|
-
|
|
21572
|
-
|
|
21573
|
-
|
|
21574
|
-
|
|
21575
|
-
|
|
21576
|
-
|
|
21577
|
-
var
|
|
21578
|
-
"
|
|
21579
|
-
|
|
21580
|
-
|
|
21581
|
-
|
|
21582
|
-
|
|
21583
|
-
|
|
21584
|
-
|
|
21585
|
-
|
|
21586
|
-
|
|
21587
|
-
|
|
21588
|
-
|
|
21589
|
-
|
|
21590
|
-
|
|
21591
|
-
|
|
21592
|
-
|
|
21593
|
-
|
|
21594
|
-
|
|
21595
|
-
|
|
21596
|
-
|
|
21475
|
+
// ../../shared-contracts/dist/errors.js
|
|
21476
|
+
var codexhostErrorSchema = external_exports.strictObject({
|
|
21477
|
+
code: external_exports.string().min(1),
|
|
21478
|
+
message: external_exports.string().min(1),
|
|
21479
|
+
retryable: external_exports.boolean(),
|
|
21480
|
+
diagnostic: external_exports.string().min(1).optional(),
|
|
21481
|
+
stage: external_exports.string().min(1).optional(),
|
|
21482
|
+
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
21483
|
+
stderrTail: external_exports.string().min(1).optional()
|
|
21484
|
+
}).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
|
|
21485
|
+
|
|
21486
|
+
// ../../shared-contracts/dist/harness-presentation.js
|
|
21487
|
+
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
21488
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text) => text.trim().length > 0);
|
|
21489
|
+
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
21490
|
+
label: displayText(256).optional(),
|
|
21491
|
+
description: displayText(1024).optional()
|
|
21492
|
+
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
21493
|
+
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");
|
|
21494
|
+
|
|
21495
|
+
// ../../shared-contracts/dist/ids.js
|
|
21496
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
21497
|
+
message: "Identifier must not be empty or whitespace"
|
|
21498
|
+
});
|
|
21499
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
21500
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
21501
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
21502
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
21503
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
21504
|
+
|
|
21505
|
+
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
21506
|
+
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
21507
|
+
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
21508
|
+
var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
|
|
21509
|
+
var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
|
|
21510
|
+
var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
21511
|
+
message: "Value must not be empty or whitespace"
|
|
21512
|
+
});
|
|
21513
|
+
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();
|
|
21514
|
+
var harnessPermissionModeSchema = external_exports.object({
|
|
21515
|
+
id: harnessPermissionModeIdSchema,
|
|
21516
|
+
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
21517
|
+
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
21518
|
+
dangerous: external_exports.boolean().optional(),
|
|
21519
|
+
localizations: harnessLocalizationsSchema.optional()
|
|
21520
|
+
}).strict();
|
|
21521
|
+
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
21522
|
+
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
21523
|
+
defaultModeId: harnessPermissionModeIdSchema
|
|
21524
|
+
}).strict().superRefine((catalog, context) => {
|
|
21525
|
+
const ids = /* @__PURE__ */ new Set();
|
|
21526
|
+
for (const [index, mode] of catalog.modes.entries()) {
|
|
21527
|
+
if (ids.has(mode.id)) {
|
|
21528
|
+
context.addIssue({
|
|
21529
|
+
code: "custom",
|
|
21530
|
+
message: "Permission Mode IDs must be unique",
|
|
21531
|
+
path: ["modes", index, "id"]
|
|
21532
|
+
});
|
|
21533
|
+
}
|
|
21534
|
+
ids.add(mode.id);
|
|
21597
21535
|
}
|
|
21598
|
-
|
|
21599
|
-
|
|
21600
|
-
|
|
21601
|
-
|
|
21602
|
-
|
|
21603
|
-
|
|
21604
|
-
return "image/svg+xml";
|
|
21605
|
-
case "woff2":
|
|
21606
|
-
return "font/woff2";
|
|
21607
|
-
case "json":
|
|
21608
|
-
return "application/json";
|
|
21609
|
-
case "css":
|
|
21610
|
-
return "text/css";
|
|
21611
|
-
default:
|
|
21612
|
-
return desktopExtensionScreenshotMimeType(resource);
|
|
21613
|
-
}
|
|
21614
|
-
}
|
|
21615
|
-
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
21616
|
-
var desktopExtensionAssetPathSchema = pluginRelativeResourceSchema.refine((resource) => hasPortableSegments(resource) && desktopExtensionAssetMimeType(resource) !== void 0, "Expected a relative Desktop extension asset path with a supported suffix");
|
|
21617
|
-
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");
|
|
21618
|
-
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) => {
|
|
21619
|
-
const { username, password } = new URL(value);
|
|
21620
|
-
return !username && !password && !/[\\\s]/u.test(value);
|
|
21621
|
-
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
21622
|
-
function localizedText(text) {
|
|
21623
|
-
return external_exports.strictObject({ en: text, "zh-CN": text });
|
|
21624
|
-
}
|
|
21625
|
-
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
21626
|
-
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
21627
|
-
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
21628
|
-
var settingField = {
|
|
21629
|
-
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
21630
|
-
label: desktopExtensionLocalizedTextSchema,
|
|
21631
|
-
description: desktopExtensionLocalizedTextSchema.optional()
|
|
21632
|
-
};
|
|
21633
|
-
var numericSetting = {
|
|
21634
|
-
...settingField,
|
|
21635
|
-
step: external_exports.number().positive().optional(),
|
|
21636
|
-
default: external_exports.number().optional()
|
|
21637
|
-
};
|
|
21638
|
-
var settingOption = external_exports.strictObject({
|
|
21639
|
-
value: external_exports.string(),
|
|
21640
|
-
label: desktopExtensionLocalizedTextSchema
|
|
21641
|
-
});
|
|
21642
|
-
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
21643
|
-
external_exports.strictObject({
|
|
21644
|
-
...settingField,
|
|
21645
|
-
type: external_exports.literal("boolean"),
|
|
21646
|
-
default: external_exports.boolean().optional()
|
|
21647
|
-
}),
|
|
21648
|
-
external_exports.strictObject({
|
|
21649
|
-
...settingField,
|
|
21650
|
-
type: external_exports.literal("string"),
|
|
21651
|
-
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
21652
|
-
default: external_exports.string().optional()
|
|
21653
|
-
}),
|
|
21654
|
-
external_exports.strictObject({
|
|
21655
|
-
...numericSetting,
|
|
21656
|
-
type: external_exports.literal("number"),
|
|
21657
|
-
min: external_exports.number().optional(),
|
|
21658
|
-
max: external_exports.number().optional()
|
|
21659
|
-
}),
|
|
21660
|
-
external_exports.strictObject({
|
|
21661
|
-
...numericSetting,
|
|
21662
|
-
type: external_exports.literal("range"),
|
|
21663
|
-
min: external_exports.number(),
|
|
21664
|
-
max: external_exports.number()
|
|
21665
|
-
}),
|
|
21666
|
-
external_exports.strictObject({
|
|
21667
|
-
...settingField,
|
|
21668
|
-
type: external_exports.literal("select"),
|
|
21669
|
-
options: external_exports.array(settingOption).min(1),
|
|
21670
|
-
default: external_exports.string().optional()
|
|
21671
|
-
})
|
|
21672
|
-
]).superRefine((field2, ctx) => {
|
|
21673
|
-
const issue2 = (path6, message) => ctx.addIssue({ code: "custom", path: [path6], message });
|
|
21674
|
-
if (field2.type === "number" || field2.type === "range") {
|
|
21675
|
-
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
21676
|
-
if (min > max)
|
|
21677
|
-
issue2("max", "Must be at least min");
|
|
21678
|
-
if (value !== void 0 && (value < min || value > max))
|
|
21679
|
-
issue2("default", "Must be within min and max");
|
|
21680
|
-
} else if (field2.type === "select") {
|
|
21681
|
-
const values = new Set(field2.options.map(({ value }) => value));
|
|
21682
|
-
if (values.size !== field2.options.length)
|
|
21683
|
-
issue2("options", "Duplicate option values");
|
|
21684
|
-
if (field2.default !== void 0 && !values.has(field2.default))
|
|
21685
|
-
issue2("default", "Must match an option value");
|
|
21686
|
-
}
|
|
21687
|
-
});
|
|
21688
|
-
var manifestHeader = external_exports.object({
|
|
21689
|
-
manifestVersion: external_exports.int().positive(),
|
|
21690
|
-
id: desktopExtensionIdSchema,
|
|
21691
|
-
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
21692
|
-
version: external_exports.string().min(1).max(128),
|
|
21693
|
-
desktopApi: external_exports.int().positive()
|
|
21694
|
-
}).passthrough();
|
|
21695
|
-
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
21696
|
-
manifestVersion: external_exports.literal(1),
|
|
21697
|
-
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
21698
|
-
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
21699
|
-
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
21700
|
-
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
21701
|
-
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
21702
|
-
icon: imagePathSchema.optional(),
|
|
21703
|
-
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
21704
|
-
desktop: external_exports.strictObject({
|
|
21705
|
-
script: pluginRelativeResourceSchema,
|
|
21706
|
-
style: pluginRelativeResourceSchema.optional()
|
|
21707
|
-
}).optional(),
|
|
21708
|
-
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
21709
|
-
slots: slotsSchema.default(() => []),
|
|
21710
|
-
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
21711
|
-
categories: categoriesSchema.optional()
|
|
21712
|
-
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
21713
|
-
var desktopExtensionConfigurationSchema = external_exports.strictObject({
|
|
21714
|
-
version: external_exports.literal(1),
|
|
21715
|
-
revision: external_exports.int().nonnegative(),
|
|
21716
|
-
enabled: external_exports.array(desktopExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs"),
|
|
21717
|
-
reloadToken: external_exports.uuid().optional()
|
|
21718
|
-
});
|
|
21719
|
-
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
21720
|
-
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
21721
|
-
state: external_exports.enum([
|
|
21722
|
-
"running",
|
|
21723
|
-
"disabled",
|
|
21724
|
-
"invalid",
|
|
21725
|
-
"incompatible",
|
|
21726
|
-
"conflict",
|
|
21727
|
-
"failed",
|
|
21728
|
-
"waiting"
|
|
21729
|
-
]),
|
|
21730
|
-
hash: desktopExtensionHashSchema.optional(),
|
|
21731
|
-
error: external_exports.string().optional(),
|
|
21732
|
-
conflictWith: desktopExtensionIdSchema.optional()
|
|
21733
|
-
});
|
|
21734
|
-
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
21735
|
-
controllerPid: external_exports.int().positive(),
|
|
21736
|
-
targetId: external_exports.string().nullable(),
|
|
21737
|
-
updatedAt: external_exports.iso.datetime(),
|
|
21738
|
-
handledReloadToken: external_exports.uuid().optional(),
|
|
21739
|
-
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema)
|
|
21740
|
-
});
|
|
21741
|
-
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
21742
|
-
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
21743
|
-
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
21744
|
-
}
|
|
21745
|
-
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
21746
|
-
const url2 = new URL(input);
|
|
21747
|
-
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);
|
|
21748
|
-
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
21749
|
-
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
21750
|
-
id: desktopExtensionIdSchema,
|
|
21751
|
-
version: external_exports.string().trim().min(1).max(128),
|
|
21752
|
-
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
21753
|
-
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
21754
|
-
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
21755
|
-
author: external_exports.string().trim().min(1).max(128),
|
|
21756
|
-
repository: desktopExtensionHttpUrlSchema,
|
|
21757
|
-
stars: external_exports.number().int().min(0).optional(),
|
|
21758
|
-
downloads: external_exports.number().int().min(0).optional(),
|
|
21759
|
-
categories: categoriesSchema.optional(),
|
|
21760
|
-
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
21761
|
-
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
21762
|
-
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
21763
|
-
downloadUrl: desktopExtensionZipUrlSchema,
|
|
21764
|
-
sha256: desktopExtensionHashSchema,
|
|
21765
|
-
slots: slotsSchema.optional(),
|
|
21766
|
-
publishedAt: external_exports.string().optional(),
|
|
21767
|
-
updatedAt: external_exports.string().optional(),
|
|
21768
|
-
minCodexHostVersion: external_exports.string().optional()
|
|
21769
|
-
});
|
|
21770
|
-
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
21771
|
-
schemaVersion: external_exports.literal(1),
|
|
21772
|
-
generatedAt: external_exports.string(),
|
|
21773
|
-
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, "Duplicate extension IDs")
|
|
21774
|
-
});
|
|
21775
|
-
var DESKTOP_EXTENSIONS_ASSET_METHOD = "codexhost/desktop/extensions/asset";
|
|
21776
|
-
var DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD = "codexhost/desktop/extensions/settings/get";
|
|
21777
|
-
var DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD = "codexhost/desktop/extensions/settings/set";
|
|
21778
|
-
var DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD = "codexhost/desktop/extensions/backend/invoke";
|
|
21779
|
-
var extensionIdParams = { id: desktopExtensionIdSchema };
|
|
21780
|
-
var desktopExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
21781
|
-
...extensionIdParams,
|
|
21782
|
-
path: desktopExtensionAssetPathSchema
|
|
21783
|
-
});
|
|
21784
|
-
var desktopExtensionsAssetResultSchema = external_exports.strictObject({
|
|
21785
|
-
mimeType: external_exports.string(),
|
|
21786
|
-
dataUrl: external_exports.string()
|
|
21787
|
-
});
|
|
21788
|
-
var desktopExtensionsSettingsGetParamsSchema = external_exports.strictObject(extensionIdParams);
|
|
21789
|
-
var desktopExtensionsSettingsSetParamsSchema = external_exports.strictObject({
|
|
21790
|
-
...extensionIdParams,
|
|
21791
|
-
values: jsonObjectSchema
|
|
21792
|
-
});
|
|
21793
|
-
var desktopExtensionsSettingsResultSchema = external_exports.strictObject({ values: jsonObjectSchema });
|
|
21794
|
-
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
21795
|
-
var desktopExtensionsBackendInvokeParamsSchema = external_exports.strictObject({
|
|
21796
|
-
...extensionIdParams,
|
|
21797
|
-
method: desktopExtensionBackendMethodSchema,
|
|
21798
|
-
params: jsonValueSchema.optional()
|
|
21799
|
-
});
|
|
21800
|
-
var desktopExtensionsBackendInvokeResultSchema = external_exports.strictObject({
|
|
21801
|
-
result: jsonValueSchema
|
|
21802
|
-
});
|
|
21803
|
-
|
|
21804
|
-
// ../../shared-contracts/dist/desktop-extension-management.js
|
|
21805
|
-
var DESKTOP_EXTENSIONS_LIST_METHOD = "codexhost/desktop/extensions/list";
|
|
21806
|
-
var DESKTOP_EXTENSIONS_ENABLE_METHOD = "codexhost/desktop/extensions/enable";
|
|
21807
|
-
var DESKTOP_EXTENSIONS_DISABLE_METHOD = "codexhost/desktop/extensions/disable";
|
|
21808
|
-
var DESKTOP_EXTENSIONS_CATALOG_METHOD = "codexhost/desktop/extensions/catalog";
|
|
21809
|
-
var DESKTOP_EXTENSIONS_INSTALL_METHOD = "codexhost/desktop/extensions/install";
|
|
21810
|
-
var DESKTOP_EXTENSIONS_UNINSTALL_METHOD = "codexhost/desktop/extensions/uninstall";
|
|
21811
|
-
var DESKTOP_EXTENSIONS_RECOVER_METHOD = "codexhost/desktop/extensions/disable-all-and-reload";
|
|
21812
|
-
var DESKTOP_EXTENSION_MANAGEMENT_METHODS = [
|
|
21813
|
-
DESKTOP_EXTENSIONS_LIST_METHOD,
|
|
21814
|
-
DESKTOP_EXTENSIONS_ENABLE_METHOD,
|
|
21815
|
-
DESKTOP_EXTENSIONS_DISABLE_METHOD,
|
|
21816
|
-
DESKTOP_EXTENSIONS_RECOVER_METHOD,
|
|
21817
|
-
DESKTOP_EXTENSIONS_CATALOG_METHOD,
|
|
21818
|
-
DESKTOP_EXTENSIONS_INSTALL_METHOD,
|
|
21819
|
-
DESKTOP_EXTENSIONS_UNINSTALL_METHOD,
|
|
21820
|
-
DESKTOP_EXTENSIONS_ASSET_METHOD,
|
|
21821
|
-
DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD,
|
|
21822
|
-
DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD,
|
|
21823
|
-
DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD
|
|
21824
|
-
];
|
|
21825
|
-
var revisionSchema = external_exports.int().nonnegative();
|
|
21826
|
-
var desktopExtensionsListParamsSchema = external_exports.strictObject({});
|
|
21827
|
-
var desktopExtensionSelectionParamsSchema = external_exports.strictObject({
|
|
21828
|
-
id: desktopExtensionIdSchema,
|
|
21829
|
-
expectedRevision: revisionSchema
|
|
21830
|
-
});
|
|
21831
|
-
var desktopExtensionsRecoveryParamsSchema = external_exports.strictObject({
|
|
21832
|
-
expectedRevision: revisionSchema.optional()
|
|
21833
|
-
});
|
|
21834
|
-
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);
|
|
21835
|
-
var desktopExtensionListItemSchema = external_exports.strictObject({
|
|
21836
|
-
// An invalid discovery can have a directory name that isn't a valid extension ID.
|
|
21837
|
-
id: external_exports.string().min(1),
|
|
21838
|
-
manifest: desktopExtensionManifestSchema.optional(),
|
|
21839
|
-
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
21840
|
-
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
21841
|
-
enabled: external_exports.boolean(),
|
|
21842
|
-
status: desktopExtensionStatusSchema
|
|
21843
|
-
});
|
|
21844
|
-
var desktopExtensionsListResultSchema = external_exports.strictObject({
|
|
21845
|
-
configuration: desktopExtensionConfigurationSchema,
|
|
21846
|
-
desktopConnected: external_exports.boolean(),
|
|
21847
|
-
diagnostics: external_exports.array(external_exports.string()),
|
|
21848
|
-
extensions: external_exports.array(desktopExtensionListItemSchema)
|
|
21849
|
-
});
|
|
21850
|
-
var desktopExtensionsCatalogParamsSchema = external_exports.strictObject({
|
|
21851
|
-
forceRefresh: external_exports.boolean().optional()
|
|
21852
|
-
});
|
|
21853
|
-
var desktopExtensionsCatalogResultSchema = external_exports.strictObject({
|
|
21854
|
-
catalogUrl: external_exports.string(),
|
|
21855
|
-
source: external_exports.enum(["remote", "fallback"]),
|
|
21856
|
-
fetchedAt: external_exports.string(),
|
|
21857
|
-
cached: external_exports.boolean(),
|
|
21858
|
-
extensions: desktopExtensionCatalogSchema.shape.extensions,
|
|
21859
|
-
error: external_exports.string().optional()
|
|
21860
|
-
});
|
|
21861
|
-
var desktopExtensionsInstallParamsSchema = external_exports.strictObject({
|
|
21862
|
-
source: external_exports.discriminatedUnion("type", [
|
|
21863
|
-
external_exports.strictObject({ type: external_exports.literal("catalog"), id: desktopExtensionIdSchema }),
|
|
21864
|
-
external_exports.strictObject({
|
|
21865
|
-
type: external_exports.literal("url"),
|
|
21866
|
-
url: desktopExtensionHttpUrlSchema,
|
|
21867
|
-
expectedSha256: desktopExtensionHashSchema.optional()
|
|
21868
|
-
}),
|
|
21869
|
-
external_exports.strictObject({
|
|
21870
|
-
type: external_exports.literal("zip-base64"),
|
|
21871
|
-
fileName: external_exports.string().trim().min(1).max(255),
|
|
21872
|
-
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")
|
|
21873
|
-
})
|
|
21874
|
-
])
|
|
21875
|
-
});
|
|
21876
|
-
var desktopExtensionsInstallResultSchema = external_exports.strictObject({
|
|
21877
|
-
extensionId: desktopExtensionIdSchema,
|
|
21878
|
-
version: external_exports.string().min(1),
|
|
21879
|
-
replaced: external_exports.boolean(),
|
|
21880
|
-
installedPath: external_exports.string(),
|
|
21881
|
-
list: desktopExtensionsListResultSchema
|
|
21882
|
-
});
|
|
21883
|
-
var desktopExtensionsUninstallParamsSchema = external_exports.strictObject({
|
|
21884
|
-
id: desktopExtensionIdSchema
|
|
21885
|
-
});
|
|
21886
|
-
var desktopExtensionsUninstallResultSchema = external_exports.strictObject({
|
|
21887
|
-
removedId: desktopExtensionIdSchema,
|
|
21888
|
-
list: desktopExtensionsListResultSchema
|
|
21889
|
-
});
|
|
21890
|
-
var desktopExtensionMutationResultSchema = external_exports.discriminatedUnion("state", [
|
|
21891
|
-
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: desktopExtensionConfigurationSchema }),
|
|
21892
|
-
external_exports.strictObject({ state: external_exports.literal("slot-conflict"), conflictWith: desktopExtensionIdSchema }),
|
|
21893
|
-
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: revisionSchema })
|
|
21894
|
-
]);
|
|
21895
|
-
|
|
21896
|
-
// ../../shared-contracts/dist/errors.js
|
|
21897
|
-
var codexhostErrorSchema = external_exports.strictObject({
|
|
21898
|
-
code: external_exports.string().min(1),
|
|
21899
|
-
message: external_exports.string().min(1),
|
|
21900
|
-
retryable: external_exports.boolean(),
|
|
21901
|
-
diagnostic: external_exports.string().min(1).optional(),
|
|
21902
|
-
stage: external_exports.string().min(1).optional(),
|
|
21903
|
-
durationMs: external_exports.number().int().nonnegative().optional(),
|
|
21904
|
-
stderrTail: external_exports.string().min(1).optional()
|
|
21905
|
-
}).superRefine(rejectExplicitUndefined(["diagnostic", "stage", "durationMs", "stderrTail"]));
|
|
21906
|
-
|
|
21907
|
-
// ../../shared-contracts/dist/harness-presentation.js
|
|
21908
|
-
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
21909
|
-
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text) => text.trim().length > 0);
|
|
21910
|
-
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
21911
|
-
label: displayText(256).optional(),
|
|
21912
|
-
description: displayText(1024).optional()
|
|
21913
|
-
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
21914
|
-
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");
|
|
21915
|
-
|
|
21916
|
-
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
21917
|
-
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
21918
|
-
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
21919
|
-
var HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH = 1024;
|
|
21920
|
-
var HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH = 32;
|
|
21921
|
-
var nonBlankTextSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
21922
|
-
message: "Value must not be empty or whitespace"
|
|
21923
|
-
});
|
|
21924
|
-
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();
|
|
21925
|
-
var harnessPermissionModeSchema = external_exports.object({
|
|
21926
|
-
id: harnessPermissionModeIdSchema,
|
|
21927
|
-
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
21928
|
-
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
21929
|
-
dangerous: external_exports.boolean().optional(),
|
|
21930
|
-
localizations: harnessLocalizationsSchema.optional()
|
|
21931
|
-
}).strict();
|
|
21932
|
-
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
21933
|
-
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
21934
|
-
defaultModeId: harnessPermissionModeIdSchema
|
|
21935
|
-
}).strict().superRefine((catalog, context) => {
|
|
21936
|
-
const ids = /* @__PURE__ */ new Set();
|
|
21937
|
-
for (const [index, mode] of catalog.modes.entries()) {
|
|
21938
|
-
if (ids.has(mode.id)) {
|
|
21939
|
-
context.addIssue({
|
|
21940
|
-
code: "custom",
|
|
21941
|
-
message: "Permission Mode IDs must be unique",
|
|
21942
|
-
path: ["modes", index, "id"]
|
|
21943
|
-
});
|
|
21944
|
-
}
|
|
21945
|
-
ids.add(mode.id);
|
|
21946
|
-
}
|
|
21947
|
-
if (!ids.has(catalog.defaultModeId)) {
|
|
21948
|
-
context.addIssue({
|
|
21949
|
-
code: "custom",
|
|
21950
|
-
message: "Default Permission Mode must exist in the catalog",
|
|
21951
|
-
path: ["defaultModeId"]
|
|
21952
|
-
});
|
|
21536
|
+
if (!ids.has(catalog.defaultModeId)) {
|
|
21537
|
+
context.addIssue({
|
|
21538
|
+
code: "custom",
|
|
21539
|
+
message: "Default Permission Mode must exist in the catalog",
|
|
21540
|
+
path: ["defaultModeId"]
|
|
21541
|
+
});
|
|
21953
21542
|
}
|
|
21954
21543
|
});
|
|
21955
21544
|
var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
@@ -21957,6 +21546,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
|
21957
21546
|
permissionModeId: harnessPermissionModeIdSchema
|
|
21958
21547
|
}).strict();
|
|
21959
21548
|
|
|
21549
|
+
// ../../shared-contracts/dist/harness-route-limit.js
|
|
21550
|
+
var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
|
|
21551
|
+
|
|
21960
21552
|
// ../../shared-contracts/dist/thread-usage.js
|
|
21961
21553
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
21962
21554
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -21989,7 +21581,7 @@ var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
|
21989
21581
|
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
21990
21582
|
label: indicatorTextSchema(256).optional(),
|
|
21991
21583
|
tooltip: indicatorTextSchema(1024).optional()
|
|
21992
|
-
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) =>
|
|
21584
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
|
|
21993
21585
|
message: "Composer indicator IDs must be unique"
|
|
21994
21586
|
});
|
|
21995
21587
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
@@ -22015,6 +21607,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
22015
21607
|
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
22016
21608
|
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
22017
21609
|
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
21610
|
+
latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
22018
21611
|
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
22019
21612
|
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
22020
21613
|
}).strict().superRefine((usage, context) => {
|
|
@@ -22142,10 +21735,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
|
22142
21735
|
var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
22143
21736
|
message: "Value must not be empty or whitespace"
|
|
22144
21737
|
});
|
|
22145
|
-
var harnessModelRefIdSchema =
|
|
21738
|
+
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();
|
|
21739
|
+
var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
|
|
22146
21740
|
var harnessModelRefSchema = external_exports.object({
|
|
22147
|
-
id: harnessModelRefIdSchema
|
|
21741
|
+
id: harnessModelRefIdSchema,
|
|
21742
|
+
serviceTier: harnessModelServiceTierSchema.optional()
|
|
22148
21743
|
}).strict();
|
|
21744
|
+
function sameHarnessModelRef(left, right) {
|
|
21745
|
+
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
21746
|
+
}
|
|
22149
21747
|
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();
|
|
22150
21748
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
22151
21749
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
@@ -22159,7 +21757,15 @@ var harnessModelSchema = external_exports.object({
|
|
|
22159
21757
|
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
22160
21758
|
fastModel: harnessModelRefSchema.optional(),
|
|
22161
21759
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
22162
|
-
}).strict()
|
|
21760
|
+
}).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
|
|
21761
|
+
path: ["fastModel", "id"],
|
|
21762
|
+
message: "A tiered Fast Model must share the base Model ID"
|
|
21763
|
+
});
|
|
21764
|
+
function catalogModelForRef(catalog, ref) {
|
|
21765
|
+
if (!ref)
|
|
21766
|
+
return void 0;
|
|
21767
|
+
return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
|
|
21768
|
+
}
|
|
22163
21769
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
22164
21770
|
const ids = /* @__PURE__ */ new Set();
|
|
22165
21771
|
for (const [index, option] of options.entries()) {
|
|
@@ -22179,26 +21785,26 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
22179
21785
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
22180
21786
|
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
22181
21787
|
}).strict().superRefine((catalog, context) => {
|
|
22182
|
-
const refs =
|
|
22183
|
-
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) =>
|
|
21788
|
+
const refs = [];
|
|
21789
|
+
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
|
|
22184
21790
|
for (const [index, model2] of catalog.models.entries()) {
|
|
22185
|
-
if (refs.
|
|
21791
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
|
|
22186
21792
|
context.addIssue({
|
|
22187
21793
|
code: "custom",
|
|
22188
21794
|
message: "Model Catalog refs must be unique",
|
|
22189
21795
|
path: ["models", index, "ref", "id"]
|
|
22190
21796
|
});
|
|
22191
21797
|
}
|
|
22192
|
-
refs.
|
|
21798
|
+
refs.push(model2.ref);
|
|
22193
21799
|
if (model2.fastModel) {
|
|
22194
|
-
if (refs.
|
|
21800
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
|
|
22195
21801
|
context.addIssue({
|
|
22196
21802
|
code: "custom",
|
|
22197
21803
|
message: "Fast Model refs must be distinct and unique",
|
|
22198
21804
|
path: ["models", index, "fastModel"]
|
|
22199
21805
|
});
|
|
22200
21806
|
}
|
|
22201
|
-
refs.
|
|
21807
|
+
refs.push(model2.fastModel);
|
|
22202
21808
|
}
|
|
22203
21809
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
22204
21810
|
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
@@ -22219,7 +21825,7 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
22219
21825
|
}
|
|
22220
21826
|
}
|
|
22221
21827
|
}
|
|
22222
|
-
if (catalog.defaultModel && !
|
|
21828
|
+
if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
|
|
22223
21829
|
context.addIssue({
|
|
22224
21830
|
code: "custom",
|
|
22225
21831
|
message: "Default Model must exist in the Model Catalog",
|
|
@@ -22242,184 +21848,735 @@ var harnessHistoryCapabilitiesSchema = external_exports.object({
|
|
|
22242
21848
|
path: ["forkAcrossCwd"],
|
|
22243
21849
|
message: "Cross-cwd Fork requires exact history Fork support"
|
|
22244
21850
|
});
|
|
22245
|
-
var harnessPermissionModeScopeSchema = external_exports.enum(["live", "atCreate"]);
|
|
22246
|
-
var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
22247
|
-
configuration: external_exports.object({
|
|
22248
|
-
selectModel: external_exports.boolean(),
|
|
22249
|
-
selectThinkingOption: external_exports.boolean(),
|
|
22250
|
-
selectPermissionMode: external_exports.boolean(),
|
|
22251
|
-
permissionModeScope: harnessPermissionModeScopeSchema.default("live")
|
|
22252
|
-
}).strict(),
|
|
22253
|
-
history: harnessHistoryCapabilitiesSchema,
|
|
22254
|
-
subagents: external_exports.object({
|
|
22255
|
-
observe: external_exports.boolean(),
|
|
22256
|
-
readTranscript: external_exports.boolean()
|
|
22257
|
-
}).strict().optional(),
|
|
22258
|
-
autonomousTurns: external_exports.object({
|
|
22259
|
-
observe: external_exports.boolean()
|
|
22260
|
-
}).strict().optional(),
|
|
22261
|
-
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
22262
|
-
steer: external_exports.boolean().optional()
|
|
22263
|
-
|
|
22264
|
-
|
|
22265
|
-
|
|
22266
|
-
|
|
22267
|
-
|
|
22268
|
-
|
|
22269
|
-
|
|
22270
|
-
|
|
22271
|
-
|
|
22272
|
-
|
|
22273
|
-
|
|
22274
|
-
|
|
22275
|
-
|
|
22276
|
-
|
|
22277
|
-
|
|
21851
|
+
var harnessPermissionModeScopeSchema = external_exports.enum(["live", "atCreate"]);
|
|
21852
|
+
var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
21853
|
+
configuration: external_exports.object({
|
|
21854
|
+
selectModel: external_exports.boolean(),
|
|
21855
|
+
selectThinkingOption: external_exports.boolean(),
|
|
21856
|
+
selectPermissionMode: external_exports.boolean(),
|
|
21857
|
+
permissionModeScope: harnessPermissionModeScopeSchema.default("live")
|
|
21858
|
+
}).strict(),
|
|
21859
|
+
history: harnessHistoryCapabilitiesSchema,
|
|
21860
|
+
subagents: external_exports.object({
|
|
21861
|
+
observe: external_exports.boolean(),
|
|
21862
|
+
readTranscript: external_exports.boolean()
|
|
21863
|
+
}).strict().optional(),
|
|
21864
|
+
autonomousTurns: external_exports.object({
|
|
21865
|
+
observe: external_exports.boolean()
|
|
21866
|
+
}).strict().optional(),
|
|
21867
|
+
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
21868
|
+
steer: external_exports.boolean().optional(),
|
|
21869
|
+
/**
|
|
21870
|
+
* True when the native plan (task list) outlives the Turn that changed it, so a reopened
|
|
21871
|
+
* Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
|
|
21872
|
+
*/
|
|
21873
|
+
persistentPlan: external_exports.boolean().optional()
|
|
21874
|
+
}).strict();
|
|
21875
|
+
var harnessConfigurationStateSchema = external_exports.object({
|
|
21876
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
21877
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
21878
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
21879
|
+
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
21880
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
21881
|
+
}).strict().superRefine((state, context) => {
|
|
21882
|
+
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
|
|
21883
|
+
context.addIssue({
|
|
21884
|
+
code: "custom",
|
|
21885
|
+
message: "Effective Thinking option must be currently available",
|
|
21886
|
+
path: ["effectiveThinkingOptionId"]
|
|
21887
|
+
});
|
|
21888
|
+
}
|
|
21889
|
+
});
|
|
21890
|
+
var harnessWebUiCapabilitySchema = external_exports.object({
|
|
21891
|
+
open: external_exports.literal(true)
|
|
21892
|
+
}).strict();
|
|
21893
|
+
var readyHarnessInspectionSchema = external_exports.object({
|
|
21894
|
+
status: external_exports.literal("ready"),
|
|
21895
|
+
catalog: harnessModelCatalogSchema,
|
|
21896
|
+
permissionModes: harnessPermissionModeCatalogSchema.optional(),
|
|
21897
|
+
capabilities: harnessSessionCapabilitiesSchema,
|
|
21898
|
+
webUi: harnessWebUiCapabilitySchema.optional()
|
|
21899
|
+
}).strict().superRefine((inspection, context) => {
|
|
21900
|
+
const selectable = inspection.capabilities.configuration.selectPermissionMode;
|
|
21901
|
+
if (selectable !== Boolean(inspection.permissionModes)) {
|
|
21902
|
+
context.addIssue({
|
|
21903
|
+
code: "custom",
|
|
21904
|
+
message: "Permission Mode catalog and capability must agree",
|
|
21905
|
+
path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
|
|
21906
|
+
});
|
|
21907
|
+
}
|
|
21908
|
+
});
|
|
21909
|
+
var failedHarnessInspectionSchema = external_exports.object({
|
|
21910
|
+
status: external_exports.enum(["notInstalled", "unavailable", "error"]),
|
|
21911
|
+
error: codexhostErrorSchema
|
|
21912
|
+
}).strict();
|
|
21913
|
+
var harnessInspectionSchema = external_exports.union([
|
|
21914
|
+
readyHarnessInspectionSchema,
|
|
21915
|
+
failedHarnessInspectionSchema
|
|
21916
|
+
]);
|
|
21917
|
+
var harnessInspectParamsSchema = external_exports.object({
|
|
21918
|
+
harnessId: harnessIdSchema,
|
|
21919
|
+
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
21920
|
+
refresh: external_exports.boolean().optional(),
|
|
21921
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
21922
|
+
purpose: external_exports.literal("availability").optional(),
|
|
21923
|
+
credentialAccess: external_exports.enum(["allow", "retry"]).optional()
|
|
21924
|
+
}).strict();
|
|
21925
|
+
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
21926
|
+
harnessId: harnessIdSchema
|
|
21927
|
+
}).strict();
|
|
21928
|
+
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
21929
|
+
var threadModelSelectParamsSchema = external_exports.object({
|
|
21930
|
+
threadId: hostThreadIdSchema,
|
|
21931
|
+
model: harnessModelRefSchema
|
|
21932
|
+
}).strict();
|
|
21933
|
+
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
21934
|
+
threadId: hostThreadIdSchema,
|
|
21935
|
+
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
21936
|
+
}).strict();
|
|
21937
|
+
var threadInspectionParamsSchema = external_exports.object({
|
|
21938
|
+
threadId: hostThreadIdSchema,
|
|
21939
|
+
includeReferenceCapability: external_exports.boolean().optional()
|
|
21940
|
+
}).strict();
|
|
21941
|
+
var codexThreadInspectionSchema = external_exports.object({
|
|
21942
|
+
owner: external_exports.literal("codex"),
|
|
21943
|
+
locked: external_exports.boolean(),
|
|
21944
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
21945
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
21946
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
21947
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
21948
|
+
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
21949
|
+
supportsThreadReferences: external_exports.literal(true).optional()
|
|
21950
|
+
}).strict();
|
|
21951
|
+
var externalThreadInspectionSchema = external_exports.object({
|
|
21952
|
+
owner: external_exports.literal("external"),
|
|
21953
|
+
harnessId: nonBlankTextSchema2.max(256),
|
|
21954
|
+
transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
|
|
21955
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
21956
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
21957
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
21958
|
+
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
21959
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
21960
|
+
history: harnessHistoryCapabilitiesSchema,
|
|
21961
|
+
usage: threadUsageSnapshotSchema.optional(),
|
|
21962
|
+
locked: external_exports.literal(true)
|
|
21963
|
+
}).strict();
|
|
21964
|
+
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
21965
|
+
codexThreadInspectionSchema,
|
|
21966
|
+
externalThreadInspectionSchema
|
|
21967
|
+
]);
|
|
21968
|
+
var threadOwnershipListParamsSchema = external_exports.object({
|
|
21969
|
+
threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
21970
|
+
}).strict().superRefine(({ threadIds }, context) => {
|
|
21971
|
+
const seen = /* @__PURE__ */ new Set();
|
|
21972
|
+
for (const [index, threadId] of threadIds.entries()) {
|
|
21973
|
+
if (seen.has(threadId)) {
|
|
21974
|
+
context.addIssue({
|
|
21975
|
+
code: "custom",
|
|
21976
|
+
message: "Thread ownership-list IDs must be unique",
|
|
21977
|
+
path: ["threadIds", index]
|
|
21978
|
+
});
|
|
21979
|
+
}
|
|
21980
|
+
seen.add(threadId);
|
|
21981
|
+
}
|
|
21982
|
+
});
|
|
21983
|
+
var codexThreadOwnershipSchema = external_exports.object({
|
|
21984
|
+
threadId: hostThreadIdSchema,
|
|
21985
|
+
owner: external_exports.literal("codex")
|
|
21986
|
+
}).strict();
|
|
21987
|
+
var externalThreadOwnershipSchema = external_exports.object({
|
|
21988
|
+
threadId: hostThreadIdSchema,
|
|
21989
|
+
owner: external_exports.literal("external"),
|
|
21990
|
+
harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
|
|
21991
|
+
}).strict();
|
|
21992
|
+
var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
|
|
21993
|
+
codexThreadOwnershipSchema,
|
|
21994
|
+
externalThreadOwnershipSchema
|
|
21995
|
+
]);
|
|
21996
|
+
var threadOwnershipListResultSchema = external_exports.object({
|
|
21997
|
+
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
21998
|
+
}).strict().superRefine(({ threads }, context) => {
|
|
21999
|
+
const seen = /* @__PURE__ */ new Set();
|
|
22000
|
+
for (const [index, thread2] of threads.entries()) {
|
|
22001
|
+
if (seen.has(thread2.threadId)) {
|
|
22002
|
+
context.addIssue({
|
|
22003
|
+
code: "custom",
|
|
22004
|
+
message: "Thread ownership-list results must be unique",
|
|
22005
|
+
path: ["threads", index, "threadId"]
|
|
22006
|
+
});
|
|
22007
|
+
}
|
|
22008
|
+
seen.add(thread2.threadId);
|
|
22009
|
+
}
|
|
22010
|
+
});
|
|
22011
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
22012
|
+
threadId: hostThreadIdSchema,
|
|
22013
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
22014
|
+
text: external_exports.string().optional()
|
|
22015
|
+
}).strict();
|
|
22016
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
22017
|
+
kind: external_exports.literal("application"),
|
|
22018
|
+
value: external_exports.string().transform((text, context) => {
|
|
22019
|
+
try {
|
|
22020
|
+
return JSON.parse(text);
|
|
22021
|
+
} catch {
|
|
22022
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
22023
|
+
return external_exports.NEVER;
|
|
22024
|
+
}
|
|
22025
|
+
}).pipe(external_exports.object({
|
|
22026
|
+
expectedTurnId: hostTurnIdSchema,
|
|
22027
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
22028
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
22029
|
+
}).strict())
|
|
22030
|
+
}).strict().transform((context) => context.value);
|
|
22031
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
22032
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
22033
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
22034
|
+
}).strict();
|
|
22035
|
+
|
|
22036
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
22037
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
22038
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
22039
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
22040
|
+
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
22041
|
+
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
22042
|
+
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
|
|
22043
|
+
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");
|
|
22044
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
22045
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
22046
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
22047
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
22048
|
+
before: localizedTextSchema.optional(),
|
|
22049
|
+
after: localizedTextSchema.optional(),
|
|
22050
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
22051
|
+
}).strict();
|
|
22052
|
+
var pluginPresentationShape = {
|
|
22053
|
+
id: installedHarnessPluginIdSchema,
|
|
22054
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
22055
|
+
version: external_exports.string().min(1).max(128),
|
|
22056
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
22057
|
+
kind: external_exports.literal("usage").optional(),
|
|
22058
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
22059
|
+
iconStyle: external_exports.object({
|
|
22060
|
+
vector: external_exports.object({
|
|
22061
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
22062
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
22063
|
+
paths: external_exports.array(external_exports.object({
|
|
22064
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
22065
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
22066
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
22067
|
+
}).strict()).min(1).max(32)
|
|
22068
|
+
}).strict().optional(),
|
|
22069
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
22070
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
22071
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
22072
|
+
}).strict().optional(),
|
|
22073
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
22074
|
+
notice: localizedTextSchema.optional(),
|
|
22075
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
22076
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
22077
|
+
links: external_exports.object({
|
|
22078
|
+
website: documentationUrlSchema.optional(),
|
|
22079
|
+
documentation: documentationUrlSchema.optional(),
|
|
22080
|
+
installation: documentationUrlSchema.optional()
|
|
22081
|
+
}).strict().optional()
|
|
22082
|
+
};
|
|
22083
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
22084
|
+
manifestVersion: external_exports.literal(1),
|
|
22085
|
+
...pluginPresentationShape,
|
|
22086
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
22087
|
+
entry: pluginRelativeResourceSchema,
|
|
22088
|
+
icon: pluginRelativeResourceSchema.optional()
|
|
22089
|
+
}).strict();
|
|
22090
|
+
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);
|
|
22091
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
22092
|
+
...pluginPresentationShape,
|
|
22093
|
+
icon: harnessPluginIconSchema.optional()
|
|
22094
|
+
}).strict();
|
|
22095
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
22096
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
22097
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
22098
|
+
}).strict();
|
|
22099
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
22100
|
+
version: external_exports.literal(1),
|
|
22101
|
+
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
22102
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
22103
|
+
message: "Enabled plugin IDs must be unique",
|
|
22104
|
+
path: ["enabled"]
|
|
22105
|
+
});
|
|
22106
|
+
|
|
22107
|
+
// ../../shared-contracts/dist/desktop-extensions.js
|
|
22108
|
+
var DESKTOP_EXTENSION_API_VERSION = 1;
|
|
22109
|
+
var DESKTOP_EXTENSION_LIMIT = 64;
|
|
22110
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
|
|
22111
|
+
var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
|
|
22112
|
+
var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
|
|
22113
|
+
var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
|
|
22114
|
+
var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
|
|
22115
|
+
var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
|
|
22116
|
+
var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
|
|
22117
|
+
var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
|
|
22118
|
+
var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
22119
|
+
var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
|
|
22120
|
+
var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
|
|
22121
|
+
var desktopExtensionIdSchema = installedPluginIdSchema;
|
|
22122
|
+
var desktopExtensionSlotSchema = external_exports.enum([
|
|
22123
|
+
"sidebar.thread-layout",
|
|
22124
|
+
"sidebar.thread-badge",
|
|
22125
|
+
"appearance.theme"
|
|
22126
|
+
]);
|
|
22127
|
+
var desktopExtensionCategorySchema = external_exports.enum([
|
|
22128
|
+
"appearance",
|
|
22129
|
+
"interface",
|
|
22130
|
+
"workflow",
|
|
22131
|
+
"analytics",
|
|
22132
|
+
"integrations",
|
|
22133
|
+
"tools"
|
|
22134
|
+
]);
|
|
22135
|
+
var extensionName = external_exports.string().trim().min(1).max(128);
|
|
22136
|
+
function desktopExtensionScreenshotMimeType(resource) {
|
|
22137
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
22138
|
+
case "png":
|
|
22139
|
+
return "image/png";
|
|
22140
|
+
case "jpg":
|
|
22141
|
+
case "jpeg":
|
|
22142
|
+
return "image/jpeg";
|
|
22143
|
+
case "webp":
|
|
22144
|
+
return "image/webp";
|
|
22145
|
+
default:
|
|
22146
|
+
return void 0;
|
|
22147
|
+
}
|
|
22148
|
+
}
|
|
22149
|
+
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
22150
|
+
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");
|
|
22151
|
+
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) => {
|
|
22152
|
+
const { username, password } = new URL(value);
|
|
22153
|
+
return !username && !password && !/[\\\s]/u.test(value);
|
|
22154
|
+
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
22155
|
+
function localizedText(text) {
|
|
22156
|
+
return external_exports.strictObject({ en: text, "zh-CN": text });
|
|
22157
|
+
}
|
|
22158
|
+
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
22159
|
+
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
22160
|
+
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
22161
|
+
var settingField = {
|
|
22162
|
+
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
22163
|
+
label: desktopExtensionLocalizedTextSchema,
|
|
22164
|
+
description: desktopExtensionLocalizedTextSchema.optional()
|
|
22165
|
+
};
|
|
22166
|
+
var numericSetting = {
|
|
22167
|
+
...settingField,
|
|
22168
|
+
step: external_exports.number().positive().optional(),
|
|
22169
|
+
default: external_exports.number().optional()
|
|
22170
|
+
};
|
|
22171
|
+
var settingOption = external_exports.strictObject({
|
|
22172
|
+
value: external_exports.string(),
|
|
22173
|
+
label: desktopExtensionLocalizedTextSchema
|
|
22174
|
+
});
|
|
22175
|
+
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
22176
|
+
external_exports.strictObject({
|
|
22177
|
+
...settingField,
|
|
22178
|
+
type: external_exports.literal("boolean"),
|
|
22179
|
+
default: external_exports.boolean().optional()
|
|
22180
|
+
}),
|
|
22181
|
+
external_exports.strictObject({
|
|
22182
|
+
...settingField,
|
|
22183
|
+
type: external_exports.literal("string"),
|
|
22184
|
+
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
22185
|
+
default: external_exports.string().optional()
|
|
22186
|
+
}),
|
|
22187
|
+
external_exports.strictObject({
|
|
22188
|
+
...numericSetting,
|
|
22189
|
+
type: external_exports.literal("number"),
|
|
22190
|
+
min: external_exports.number().optional(),
|
|
22191
|
+
max: external_exports.number().optional()
|
|
22192
|
+
}),
|
|
22193
|
+
external_exports.strictObject({
|
|
22194
|
+
...numericSetting,
|
|
22195
|
+
type: external_exports.literal("range"),
|
|
22196
|
+
min: external_exports.number(),
|
|
22197
|
+
max: external_exports.number()
|
|
22198
|
+
}),
|
|
22199
|
+
external_exports.strictObject({
|
|
22200
|
+
...settingField,
|
|
22201
|
+
type: external_exports.literal("select"),
|
|
22202
|
+
options: external_exports.array(settingOption).min(1),
|
|
22203
|
+
default: external_exports.string().optional()
|
|
22204
|
+
})
|
|
22205
|
+
]).superRefine((field2, ctx) => {
|
|
22206
|
+
const issue2 = (path6, message) => ctx.addIssue({ code: "custom", path: [path6], message });
|
|
22207
|
+
if (field2.type === "number" || field2.type === "range") {
|
|
22208
|
+
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
22209
|
+
if (min > max)
|
|
22210
|
+
issue2("max", "Must be at least min");
|
|
22211
|
+
if (value !== void 0 && (value < min || value > max))
|
|
22212
|
+
issue2("default", "Must be within min and max");
|
|
22213
|
+
} else if (field2.type === "select") {
|
|
22214
|
+
const values = new Set(field2.options.map(({ value }) => value));
|
|
22215
|
+
if (values.size !== field2.options.length)
|
|
22216
|
+
issue2("options", "Duplicate option values");
|
|
22217
|
+
if (field2.default !== void 0 && !values.has(field2.default))
|
|
22218
|
+
issue2("default", "Must match an option value");
|
|
22219
|
+
}
|
|
22220
|
+
});
|
|
22221
|
+
var manifestHeader = external_exports.object({
|
|
22222
|
+
manifestVersion: external_exports.int().positive(),
|
|
22223
|
+
id: desktopExtensionIdSchema,
|
|
22224
|
+
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
22225
|
+
version: external_exports.string().min(1).max(128),
|
|
22226
|
+
desktopApi: external_exports.int().positive()
|
|
22227
|
+
}).passthrough();
|
|
22228
|
+
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
22229
|
+
manifestVersion: external_exports.literal(1),
|
|
22230
|
+
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
22231
|
+
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
22232
|
+
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
22233
|
+
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
22234
|
+
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
22235
|
+
icon: imagePathSchema.optional(),
|
|
22236
|
+
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
22237
|
+
desktop: external_exports.strictObject({
|
|
22238
|
+
script: pluginRelativeResourceSchema,
|
|
22239
|
+
style: pluginRelativeResourceSchema.optional()
|
|
22240
|
+
}).optional(),
|
|
22241
|
+
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
22242
|
+
slots: slotsSchema.default(() => []),
|
|
22243
|
+
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
22244
|
+
categories: categoriesSchema.optional()
|
|
22245
|
+
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
22246
|
+
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
22247
|
+
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
22248
|
+
state: external_exports.enum([
|
|
22249
|
+
"running",
|
|
22250
|
+
"disabled",
|
|
22251
|
+
"invalid",
|
|
22252
|
+
"incompatible",
|
|
22253
|
+
"conflict",
|
|
22254
|
+
"failed",
|
|
22255
|
+
"waiting"
|
|
22256
|
+
]),
|
|
22257
|
+
hash: desktopExtensionHashSchema.optional(),
|
|
22258
|
+
error: external_exports.string().optional(),
|
|
22259
|
+
conflictWith: desktopExtensionIdSchema.optional()
|
|
22260
|
+
});
|
|
22261
|
+
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
22262
|
+
controllerPid: external_exports.int().positive(),
|
|
22263
|
+
targetId: external_exports.string().nullable(),
|
|
22264
|
+
updatedAt: external_exports.iso.datetime(),
|
|
22265
|
+
handledReloadToken: external_exports.uuid().optional(),
|
|
22266
|
+
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
|
|
22267
|
+
surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
|
|
22278
22268
|
});
|
|
22279
|
-
var
|
|
22280
|
-
|
|
22281
|
-
|
|
22282
|
-
|
|
22283
|
-
|
|
22284
|
-
|
|
22285
|
-
|
|
22286
|
-
|
|
22287
|
-
|
|
22288
|
-
|
|
22289
|
-
|
|
22290
|
-
|
|
22291
|
-
|
|
22292
|
-
|
|
22293
|
-
|
|
22294
|
-
|
|
22295
|
-
|
|
22296
|
-
|
|
22269
|
+
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
22270
|
+
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
22271
|
+
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
22272
|
+
}
|
|
22273
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
22274
|
+
const url2 = new URL(input);
|
|
22275
|
+
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);
|
|
22276
|
+
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
22277
|
+
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
22278
|
+
id: desktopExtensionIdSchema,
|
|
22279
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
22280
|
+
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
22281
|
+
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
22282
|
+
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
22283
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
22284
|
+
repository: desktopExtensionHttpUrlSchema,
|
|
22285
|
+
stars: external_exports.number().int().min(0).optional(),
|
|
22286
|
+
downloads: external_exports.number().int().min(0).optional(),
|
|
22287
|
+
categories: categoriesSchema.optional(),
|
|
22288
|
+
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
22289
|
+
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
22290
|
+
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
22291
|
+
downloadUrl: desktopExtensionZipUrlSchema,
|
|
22292
|
+
sha256: desktopExtensionHashSchema,
|
|
22293
|
+
slots: slotsSchema.optional(),
|
|
22294
|
+
publishedAt: external_exports.string().optional(),
|
|
22295
|
+
updatedAt: external_exports.string().optional(),
|
|
22296
|
+
minCodexHostVersion: external_exports.string().optional()
|
|
22297
22297
|
});
|
|
22298
|
-
var
|
|
22299
|
-
|
|
22300
|
-
|
|
22301
|
-
|
|
22302
|
-
|
|
22303
|
-
|
|
22304
|
-
|
|
22298
|
+
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
22299
|
+
schemaVersion: external_exports.literal(1),
|
|
22300
|
+
generatedAt: external_exports.string(),
|
|
22301
|
+
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
22302
|
+
});
|
|
22303
|
+
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
22304
|
+
|
|
22305
|
+
// ../../shared-contracts/dist/host-extensions.js
|
|
22306
|
+
var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
|
|
22307
|
+
var HOST_EXTENSION_PAGE_API_VERSION = 1;
|
|
22308
|
+
var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
|
|
22309
|
+
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
22310
|
+
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
22311
|
+
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
22312
|
+
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((path6) => path6.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
22313
|
+
var legacy = desktopExtensionManifestSchema.shape;
|
|
22314
|
+
var localized = (max, min = 0) => external_exports.strictObject({
|
|
22315
|
+
en: external_exports.string().trim().min(min).max(max),
|
|
22316
|
+
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
22317
|
+
});
|
|
22318
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path6) => path6.endsWith(suffix), `Expected a ${suffix} file`);
|
|
22319
|
+
var moduleEntry = resourceWithSuffix(".mjs");
|
|
22320
|
+
var style = resourceWithSuffix(".css").optional();
|
|
22321
|
+
var hostExtensionCanonicalPath = (path6) => path6.normalize("NFC").toLowerCase();
|
|
22322
|
+
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
22323
|
+
manifestVersion: external_exports.literal(2),
|
|
22324
|
+
id: hostExtensionIdSchema,
|
|
22325
|
+
name: localized(128, 1),
|
|
22326
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
22327
|
+
description: localized(4096),
|
|
22328
|
+
details: localized(16384).optional(),
|
|
22329
|
+
author: legacy.author,
|
|
22330
|
+
repository: legacy.repository,
|
|
22331
|
+
icon: legacy.icon.refine((path6) => path6 === void 0 || hostExtensionResourcePathSchema.safeParse(path6).success),
|
|
22332
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path6) => hostExtensionResourcePathSchema.safeParse(path6).success)),
|
|
22333
|
+
categories: legacy.categories,
|
|
22334
|
+
settingsSchema: legacy.settingsSchema,
|
|
22335
|
+
slots: legacy.slots.removeDefault().optional(),
|
|
22336
|
+
page: external_exports.strictObject({
|
|
22337
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
22338
|
+
entry: moduleEntry,
|
|
22339
|
+
style,
|
|
22340
|
+
title: localized(128, 1).optional()
|
|
22341
|
+
}).optional(),
|
|
22342
|
+
widget: external_exports.strictObject({
|
|
22343
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
22344
|
+
entry: moduleEntry,
|
|
22345
|
+
style
|
|
22346
|
+
}).optional(),
|
|
22347
|
+
desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
|
|
22348
|
+
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(),
|
|
22349
|
+
backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
|
|
22350
|
+
}).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" });
|
|
22351
|
+
function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
|
|
22352
|
+
if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
|
|
22353
|
+
return ["desktop", "web"];
|
|
22354
|
+
const targets = [];
|
|
22355
|
+
if (hasDesktop)
|
|
22356
|
+
targets.push("desktop");
|
|
22357
|
+
if (hasWeb)
|
|
22358
|
+
targets.push("web");
|
|
22359
|
+
return targets;
|
|
22360
|
+
}
|
|
22361
|
+
var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
22362
|
+
|
|
22363
|
+
// ../../shared-contracts/dist/host-extension-management.js
|
|
22364
|
+
var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
|
|
22365
|
+
var hostExtensionRevisionSchema = external_exports.int().nonnegative();
|
|
22366
|
+
var hostExtensionConfigurationSchema = external_exports.strictObject({
|
|
22367
|
+
revision: hostExtensionRevisionSchema,
|
|
22368
|
+
enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
|
|
22369
|
+
});
|
|
22370
|
+
var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
|
|
22371
|
+
var hostExtensionCatalogEntrySchema = external_exports.object({
|
|
22372
|
+
...catalogMetadata,
|
|
22373
|
+
id: hostExtensionIdSchema,
|
|
22374
|
+
format: external_exports.literal("codexhost"),
|
|
22375
|
+
targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
|
|
22376
|
+
apis: external_exports.strictObject({
|
|
22377
|
+
page: external_exports.int().positive().optional(),
|
|
22378
|
+
widget: external_exports.int().positive().optional(),
|
|
22379
|
+
desktop: external_exports.int().positive().optional(),
|
|
22380
|
+
web: external_exports.int().positive().optional(),
|
|
22381
|
+
backend: external_exports.int().positive().optional()
|
|
22382
|
+
}),
|
|
22383
|
+
downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
|
|
22384
|
+
}).refine(({ targets, apis }) => {
|
|
22385
|
+
const derived = targetsForCapabilities({
|
|
22386
|
+
hasPage: Boolean(apis.page),
|
|
22387
|
+
hasWidget: Boolean(apis.widget),
|
|
22388
|
+
hasDesktop: Boolean(apis.desktop),
|
|
22389
|
+
hasWeb: Boolean(apis.web),
|
|
22390
|
+
hasBackend: Boolean(apis.backend)
|
|
22391
|
+
});
|
|
22392
|
+
return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
|
|
22393
|
+
}, "Catalog targets must match the declared APIs");
|
|
22394
|
+
var hostExtensionCatalogSchema = external_exports.object({
|
|
22395
|
+
schemaVersion: external_exports.literal(2),
|
|
22396
|
+
generatedAt: external_exports.string().min(1),
|
|
22397
|
+
extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
22398
|
+
});
|
|
22399
|
+
var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
|
|
22400
|
+
catalogUrl: desktopExtensionHttpUrlSchema,
|
|
22401
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
22402
|
+
cached: external_exports.boolean()
|
|
22403
|
+
});
|
|
22404
|
+
var id = { id: hostExtensionIdSchema };
|
|
22405
|
+
var active = {
|
|
22406
|
+
...id,
|
|
22407
|
+
activationId: hostExtensionActivationIdSchema,
|
|
22408
|
+
digest: hostExtensionDigestSchema
|
|
22409
|
+
};
|
|
22410
|
+
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
22411
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path6) => /^(?:\/|[a-z]:[/\\])/iu.test(path6) && !path6.includes("\0") && !path6.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
22412
|
+
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");
|
|
22413
|
+
function base643(maxBytes) {
|
|
22414
|
+
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
22415
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
22416
|
+
return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
|
|
22417
|
+
}, "Expected bounded standard padded base64");
|
|
22418
|
+
}
|
|
22419
|
+
var hostExtensionGitHubSourceSchema = external_exports.strictObject({
|
|
22420
|
+
type: external_exports.literal("github"),
|
|
22421
|
+
repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
|
|
22422
|
+
ref: gitRef.optional(),
|
|
22423
|
+
tag: gitRef.optional(),
|
|
22424
|
+
asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
|
|
22425
|
+
subpath: hostExtensionResourcePathSchema.optional()
|
|
22426
|
+
}).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
|
|
22427
|
+
var hostExtensionInstallSourceSchema = external_exports.union([
|
|
22428
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
22429
|
+
hostExtensionGitHubSourceSchema,
|
|
22430
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
|
|
22431
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
|
|
22432
|
+
external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
|
|
22305
22433
|
]);
|
|
22306
|
-
var
|
|
22307
|
-
|
|
22308
|
-
|
|
22309
|
-
|
|
22310
|
-
|
|
22311
|
-
purpose: external_exports.literal("availability").optional()
|
|
22312
|
-
}).strict();
|
|
22313
|
-
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
22314
|
-
harnessId: harnessIdSchema
|
|
22315
|
-
}).strict();
|
|
22316
|
-
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
22317
|
-
var threadModelSelectParamsSchema = external_exports.object({
|
|
22318
|
-
threadId: hostThreadIdSchema,
|
|
22319
|
-
model: harnessModelRefSchema
|
|
22320
|
-
}).strict();
|
|
22321
|
-
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
22322
|
-
threadId: hostThreadIdSchema,
|
|
22323
|
-
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
22324
|
-
}).strict();
|
|
22325
|
-
var threadInspectionParamsSchema = external_exports.object({
|
|
22326
|
-
threadId: hostThreadIdSchema,
|
|
22327
|
-
includeReferenceCapability: external_exports.boolean().optional()
|
|
22328
|
-
}).strict();
|
|
22329
|
-
var codexThreadInspectionSchema = external_exports.object({
|
|
22330
|
-
owner: external_exports.literal("codex"),
|
|
22331
|
-
locked: external_exports.boolean(),
|
|
22332
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
22333
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
22334
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
22335
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
22336
|
-
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
22337
|
-
supportsThreadReferences: external_exports.literal(true).optional()
|
|
22338
|
-
}).strict();
|
|
22339
|
-
var externalThreadInspectionSchema = external_exports.object({
|
|
22340
|
-
owner: external_exports.literal("external"),
|
|
22341
|
-
harnessId: nonBlankTextSchema2.max(256),
|
|
22342
|
-
transportModelId: nonBlankTextSchema2.max(1024),
|
|
22343
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
22344
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
22345
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
22346
|
-
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
22347
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
22348
|
-
history: harnessHistoryCapabilitiesSchema,
|
|
22349
|
-
usage: threadUsageSnapshotSchema.optional(),
|
|
22350
|
-
locked: external_exports.literal(true)
|
|
22351
|
-
}).strict();
|
|
22352
|
-
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
22353
|
-
codexThreadInspectionSchema,
|
|
22354
|
-
externalThreadInspectionSchema
|
|
22434
|
+
var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
|
|
22435
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
22436
|
+
hostExtensionGitHubSourceSchema,
|
|
22437
|
+
external_exports.strictObject({ type: external_exports.literal("zip") }),
|
|
22438
|
+
external_exports.strictObject({ type: external_exports.literal("localDir") })
|
|
22355
22439
|
]);
|
|
22356
|
-
var
|
|
22357
|
-
|
|
22358
|
-
|
|
22359
|
-
|
|
22360
|
-
|
|
22361
|
-
if (seen.has(threadId)) {
|
|
22362
|
-
context.addIssue({
|
|
22363
|
-
code: "custom",
|
|
22364
|
-
message: "Thread ownership-list IDs must be unique",
|
|
22365
|
-
path: ["threadIds", index]
|
|
22366
|
-
});
|
|
22367
|
-
}
|
|
22368
|
-
seen.add(threadId);
|
|
22369
|
-
}
|
|
22440
|
+
var hostExtensionInstallationSchema = external_exports.strictObject({
|
|
22441
|
+
...active,
|
|
22442
|
+
manifest: hostExtensionManifestV2Schema,
|
|
22443
|
+
installedAt: external_exports.iso.datetime(),
|
|
22444
|
+
source: hostExtensionProvenanceSchema.optional()
|
|
22370
22445
|
});
|
|
22371
|
-
var
|
|
22372
|
-
|
|
22373
|
-
|
|
22374
|
-
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
|
|
22446
|
+
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);
|
|
22447
|
+
var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
|
|
22448
|
+
var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
|
|
22449
|
+
var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
|
|
22450
|
+
hostExtensionInstallationSchema.extend({
|
|
22451
|
+
state: external_exports.literal("valid"),
|
|
22452
|
+
enabled: external_exports.boolean(),
|
|
22453
|
+
...desktopConflict,
|
|
22454
|
+
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
22455
|
+
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
22456
|
+
backendState: backendState.optional(),
|
|
22457
|
+
backendError: external_exports.string().optional()
|
|
22458
|
+
}),
|
|
22459
|
+
external_exports.strictObject({
|
|
22460
|
+
state: external_exports.enum(["invalid", "incompatible"]),
|
|
22461
|
+
id: external_exports.string().min(1),
|
|
22462
|
+
enabled: external_exports.boolean(),
|
|
22463
|
+
error: external_exports.string()
|
|
22464
|
+
})
|
|
22383
22465
|
]);
|
|
22384
|
-
var
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
|
|
22388
|
-
|
|
22389
|
-
|
|
22390
|
-
|
|
22391
|
-
|
|
22392
|
-
|
|
22393
|
-
|
|
22394
|
-
|
|
22395
|
-
|
|
22396
|
-
|
|
22397
|
-
|
|
22466
|
+
var hostExtensionsListResultSchema = external_exports.strictObject({
|
|
22467
|
+
revision: hostExtensionRevisionSchema,
|
|
22468
|
+
configuration: hostExtensionConfigurationSchema,
|
|
22469
|
+
diagnostics: external_exports.array(external_exports.string()),
|
|
22470
|
+
extensions: external_exports.array(hostExtensionListItemSchema)
|
|
22471
|
+
});
|
|
22472
|
+
var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
|
|
22473
|
+
...desktopConflict,
|
|
22474
|
+
settingsRevision: hostExtensionRevisionSchema
|
|
22475
|
+
});
|
|
22476
|
+
var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
|
|
22477
|
+
/** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
|
|
22478
|
+
revision: hostExtensionRevisionSchema,
|
|
22479
|
+
// Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
|
|
22480
|
+
extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
|
|
22481
|
+
});
|
|
22482
|
+
var HOST_EXTENSIONS_RPC = {
|
|
22483
|
+
list: "codexhost/extensions/list",
|
|
22484
|
+
snapshot: "codexhost/extensions/snapshot",
|
|
22485
|
+
catalog: "codexhost/extensions/catalog",
|
|
22486
|
+
install: "codexhost/extensions/install",
|
|
22487
|
+
update: "codexhost/extensions/update",
|
|
22488
|
+
enable: "codexhost/extensions/enable",
|
|
22489
|
+
disable: "codexhost/extensions/disable",
|
|
22490
|
+
uninstall: "codexhost/extensions/uninstall",
|
|
22491
|
+
recover: "codexhost/extensions/recover",
|
|
22492
|
+
asset: "codexhost/extensions/asset",
|
|
22493
|
+
settingsGet: "codexhost/extensions/settings/get",
|
|
22494
|
+
settingsSet: "codexhost/extensions/settings/set",
|
|
22495
|
+
backendInvoke: "codexhost/extensions/backend/invoke"
|
|
22496
|
+
};
|
|
22497
|
+
var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
|
|
22498
|
+
var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
|
|
22499
|
+
var noParams = external_exports.strictObject({});
|
|
22500
|
+
var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
|
|
22501
|
+
var selection = external_exports.strictObject({ ...id, ...expectedRevision });
|
|
22502
|
+
var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
|
|
22503
|
+
var mutationResult = external_exports.discriminatedUnion("state", [
|
|
22504
|
+
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
|
|
22505
|
+
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
|
|
22506
|
+
]);
|
|
22507
|
+
var hostExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
22508
|
+
...optionalActivation,
|
|
22509
|
+
digest: active.digest.optional(),
|
|
22510
|
+
path: hostExtensionResourcePathSchema
|
|
22511
|
+
});
|
|
22512
|
+
var hostExtensionsAssetResultSchema = external_exports.strictObject({
|
|
22513
|
+
mimeType: external_exports.string().min(1),
|
|
22514
|
+
base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
|
|
22515
|
+
digest: active.digest
|
|
22516
|
+
});
|
|
22517
|
+
var hostExtensionSettingsSchema = external_exports.strictObject({
|
|
22518
|
+
settingsRevision: hostExtensionRevisionSchema,
|
|
22519
|
+
values: jsonObjectSchema
|
|
22398
22520
|
});
|
|
22399
|
-
var
|
|
22400
|
-
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
|
|
22404
|
-
|
|
22405
|
-
|
|
22406
|
-
|
|
22407
|
-
|
|
22408
|
-
|
|
22409
|
-
|
|
22410
|
-
|
|
22411
|
-
|
|
22412
|
-
|
|
22413
|
-
|
|
22414
|
-
|
|
22415
|
-
|
|
22416
|
-
|
|
22417
|
-
|
|
22418
|
-
}
|
|
22419
|
-
|
|
22420
|
-
|
|
22421
|
-
|
|
22422
|
-
|
|
22521
|
+
var hostExtensionsRpcSchemas = {
|
|
22522
|
+
[HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
|
|
22523
|
+
[HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
|
|
22524
|
+
[HOST_EXTENSIONS_RPC.catalog]: {
|
|
22525
|
+
params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
|
|
22526
|
+
result: hostExtensionsCatalogResultSchema
|
|
22527
|
+
},
|
|
22528
|
+
[HOST_EXTENSIONS_RPC.install]: {
|
|
22529
|
+
params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
|
|
22530
|
+
result: installationResult
|
|
22531
|
+
},
|
|
22532
|
+
[HOST_EXTENSIONS_RPC.update]: {
|
|
22533
|
+
params: external_exports.strictObject({
|
|
22534
|
+
...id,
|
|
22535
|
+
expectedDigest: active.digest,
|
|
22536
|
+
expectedActivationId: active.activationId.optional(),
|
|
22537
|
+
source: hostExtensionInstallSourceSchema.optional()
|
|
22538
|
+
}),
|
|
22539
|
+
result: installationResult
|
|
22540
|
+
},
|
|
22541
|
+
[HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
|
|
22542
|
+
[HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
|
|
22543
|
+
[HOST_EXTENSIONS_RPC.uninstall]: {
|
|
22544
|
+
params: external_exports.strictObject({
|
|
22545
|
+
...id,
|
|
22546
|
+
removeData: external_exports.boolean().optional(),
|
|
22547
|
+
expectedDigest: active.digest.optional()
|
|
22548
|
+
}),
|
|
22549
|
+
result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
|
|
22550
|
+
},
|
|
22551
|
+
[HOST_EXTENSIONS_RPC.recover]: {
|
|
22552
|
+
params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
|
|
22553
|
+
result: mutationResult
|
|
22554
|
+
},
|
|
22555
|
+
[HOST_EXTENSIONS_RPC.asset]: {
|
|
22556
|
+
params: hostExtensionsAssetParamsSchema,
|
|
22557
|
+
result: hostExtensionsAssetResultSchema
|
|
22558
|
+
},
|
|
22559
|
+
[HOST_EXTENSIONS_RPC.settingsGet]: {
|
|
22560
|
+
params: external_exports.strictObject(optionalActivation),
|
|
22561
|
+
result: hostExtensionSettingsSchema
|
|
22562
|
+
},
|
|
22563
|
+
[HOST_EXTENSIONS_RPC.settingsSet]: {
|
|
22564
|
+
params: external_exports.strictObject({
|
|
22565
|
+
...optionalActivation,
|
|
22566
|
+
expectedSettingsRevision: hostExtensionRevisionSchema,
|
|
22567
|
+
values: jsonObjectSchema
|
|
22568
|
+
}),
|
|
22569
|
+
result: hostExtensionSettingsSchema
|
|
22570
|
+
},
|
|
22571
|
+
[HOST_EXTENSIONS_RPC.backendInvoke]: {
|
|
22572
|
+
params: external_exports.strictObject({
|
|
22573
|
+
...optionalActivation,
|
|
22574
|
+
method: hostExtensionBackendMethodSchema,
|
|
22575
|
+
params: jsonValueSchema.optional()
|
|
22576
|
+
}),
|
|
22577
|
+
result: external_exports.strictObject({ result: jsonValueSchema })
|
|
22578
|
+
}
|
|
22579
|
+
};
|
|
22423
22580
|
|
|
22424
22581
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
22425
22582
|
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
@@ -22482,7 +22639,7 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
22482
22639
|
"codexhost/harness/session-import/list",
|
|
22483
22640
|
"codexhost/harness/session-import/import",
|
|
22484
22641
|
// Host settings shared across Desktop and Web.
|
|
22485
|
-
...
|
|
22642
|
+
...HOST_EXTENSION_MANAGEMENT_METHODS,
|
|
22486
22643
|
"codexhost/harness/installation",
|
|
22487
22644
|
"codexhost/harness/installation/start",
|
|
22488
22645
|
"codexhost/harness/installation/status",
|
|
@@ -22543,6 +22700,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
22543
22700
|
cursor: clientChannelCursorSchema,
|
|
22544
22701
|
revision: external_exports.number().int().nonnegative()
|
|
22545
22702
|
}),
|
|
22703
|
+
external_exports.object({
|
|
22704
|
+
type: external_exports.literal("extensions-changed"),
|
|
22705
|
+
cursor: clientChannelCursorSchema,
|
|
22706
|
+
revision: hostExtensionRevisionSchema
|
|
22707
|
+
}),
|
|
22546
22708
|
external_exports.object({
|
|
22547
22709
|
type: external_exports.literal("hello"),
|
|
22548
22710
|
version: external_exports.literal(1),
|
|
@@ -22979,7 +23141,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
|
22979
23141
|
|
|
22980
23142
|
// ../../shared-contracts/dist/harness-preferences.js
|
|
22981
23143
|
var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
|
|
22982
|
-
var preferenceHarnessKey = harnessIdSchema.transform((
|
|
23144
|
+
var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
|
|
22983
23145
|
var harnessDefaultConfigurationSchema = external_exports.strictObject({
|
|
22984
23146
|
model: harnessModelRefSchema.optional(),
|
|
22985
23147
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -22989,11 +23151,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
|
|
|
22989
23151
|
lastHarness: harnessIdSchema.optional(),
|
|
22990
23152
|
byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
|
|
22991
23153
|
});
|
|
23154
|
+
var harnessDelegationDefaultSchema = external_exports.strictObject({
|
|
23155
|
+
model: harnessModelRefSchema.optional(),
|
|
23156
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
23157
|
+
}).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
|
|
23158
|
+
var delegationDefaultsSchema = external_exports.strictObject({
|
|
23159
|
+
byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
|
|
23160
|
+
});
|
|
22992
23161
|
var modelId = external_exports.string().min(1).max(1024);
|
|
22993
23162
|
var harnessPreferenceValuesSchema = external_exports.strictObject({
|
|
22994
23163
|
idleRelease: idleReleaseSettingsSchema.optional(),
|
|
22995
23164
|
favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
|
|
22996
|
-
newThread: newThreadDefaultsSchema.optional()
|
|
23165
|
+
newThread: newThreadDefaultsSchema.optional(),
|
|
23166
|
+
delegation: delegationDefaultsSchema.optional()
|
|
22997
23167
|
});
|
|
22998
23168
|
var harnessPreferenceSnapshotSchema = external_exports.strictObject({
|
|
22999
23169
|
scope: harnessPreferenceScopeSchema,
|
|
@@ -23021,6 +23191,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
|
|
|
23021
23191
|
lastHarness: harnessIdSchema.optional(),
|
|
23022
23192
|
harnessId: harnessIdSchema.optional(),
|
|
23023
23193
|
configuration: harnessDefaultConfigurationSchema.optional()
|
|
23194
|
+
}),
|
|
23195
|
+
external_exports.strictObject({
|
|
23196
|
+
kind: external_exports.literal("delegation"),
|
|
23197
|
+
harnessId: harnessIdSchema,
|
|
23198
|
+
configuration: harnessDelegationDefaultSchema.nullable()
|
|
23024
23199
|
})
|
|
23025
23200
|
]);
|
|
23026
23201
|
var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
@@ -23842,9 +24017,12 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23842
24017
|
...thread,
|
|
23843
24018
|
epoch: identity,
|
|
23844
24019
|
modelId: identity.optional(),
|
|
24020
|
+
serviceTier: harnessModelServiceTierSchema.optional(),
|
|
23845
24021
|
thinkingOptionId: identity.optional(),
|
|
23846
24022
|
permissionModeId: identity.optional()
|
|
23847
|
-
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
|
|
24023
|
+
}).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, {
|
|
24024
|
+
message: "A service tier requires a Model ID"
|
|
24025
|
+
}),
|
|
23848
24026
|
external_exports.strictObject({
|
|
23849
24027
|
kind: external_exports.literal("prompt"),
|
|
23850
24028
|
...thread,
|
|
@@ -23894,7 +24072,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
23894
24072
|
external_exports.strictObject({ action: external_exports.literal("catalog") }),
|
|
23895
24073
|
external_exports.strictObject({
|
|
23896
24074
|
action: external_exports.literal("read-thread"),
|
|
23897
|
-
hostId: hostId.refine((
|
|
24075
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
23898
24076
|
input: delegationReadParamsSchema
|
|
23899
24077
|
}),
|
|
23900
24078
|
external_exports.strictObject({
|
|
@@ -23908,7 +24086,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
23908
24086
|
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
23909
24087
|
external_exports.strictObject({
|
|
23910
24088
|
action: external_exports.literal("update"),
|
|
23911
|
-
hostId: hostId.refine((
|
|
24089
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
23912
24090
|
version: remoteUpdateParamsSchema.shape.version
|
|
23913
24091
|
})
|
|
23914
24092
|
]);
|
|
@@ -23972,7 +24150,7 @@ function invalidRequest(message) {
|
|
|
23972
24150
|
return { code: "invalidRequest", message, retryable: false };
|
|
23973
24151
|
}
|
|
23974
24152
|
function validateHostApprovalResponse(interaction, response) {
|
|
23975
|
-
return interaction.actions.some(({ id }) =>
|
|
24153
|
+
return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
|
|
23976
24154
|
}
|
|
23977
24155
|
|
|
23978
24156
|
// ../../harness-adapter/dist/question.js
|
|
@@ -23980,7 +24158,7 @@ function invalidRequest2(message) {
|
|
|
23980
24158
|
return { code: "invalidRequest", message, retryable: false };
|
|
23981
24159
|
}
|
|
23982
24160
|
function validateHostQuestionResponse(interaction, response) {
|
|
23983
|
-
const questionIds = new Set(interaction.questions.map(({ id }) =>
|
|
24161
|
+
const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
|
|
23984
24162
|
if (response.cancelled) {
|
|
23985
24163
|
return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
|
|
23986
24164
|
}
|
|
@@ -24086,7 +24264,8 @@ var tokenFields = [
|
|
|
24086
24264
|
var safeIntegerFields = [
|
|
24087
24265
|
"planFiveHourResetsAtUnix",
|
|
24088
24266
|
"planSevenDayResetsAtUnix",
|
|
24089
|
-
"timeToFirstOutputMs"
|
|
24267
|
+
"timeToFirstOutputMs",
|
|
24268
|
+
"latestRequestTimeToFirstOutputMs"
|
|
24090
24269
|
];
|
|
24091
24270
|
var percentFields = [
|
|
24092
24271
|
"cacheHitRatePercent",
|
|
@@ -28302,10 +28481,10 @@ function executableExtensions(command, platform, environment) {
|
|
|
28302
28481
|
return [""];
|
|
28303
28482
|
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
28304
28483
|
}
|
|
28305
|
-
function isExecutableFile(
|
|
28484
|
+
function isExecutableFile(filePath2, platform) {
|
|
28306
28485
|
try {
|
|
28307
|
-
fs.accessSync(
|
|
28308
|
-
return fs.statSync(
|
|
28486
|
+
fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
28487
|
+
return fs.statSync(filePath2).isFile();
|
|
28309
28488
|
} catch {
|
|
28310
28489
|
return false;
|
|
28311
28490
|
}
|
|
@@ -28904,9 +29083,9 @@ var QwenCodeSdkTransport = class {
|
|
|
28904
29083
|
this.#abortController = null;
|
|
28905
29084
|
const input = this.#input;
|
|
28906
29085
|
this.#input = null;
|
|
28907
|
-
const
|
|
29086
|
+
const active2 = this.#active;
|
|
28908
29087
|
this.#active = null;
|
|
28909
|
-
|
|
29088
|
+
active2?.resolve({ status: "cancelled" });
|
|
28910
29089
|
await query?.close().catch(() => void 0);
|
|
28911
29090
|
abortController?.abort();
|
|
28912
29091
|
input?.fail(new Error("Qwen Code SDK input closed"));
|
|
@@ -28972,10 +29151,10 @@ var QwenCodeSdkTransport = class {
|
|
|
28972
29151
|
return Object.fromEntries(Object.entries(environment).filter((entry) => typeof entry[1] === "string"));
|
|
28973
29152
|
}
|
|
28974
29153
|
#canUseTool = async (toolName, input) => {
|
|
28975
|
-
const
|
|
28976
|
-
if (!
|
|
29154
|
+
const active2 = this.#active;
|
|
29155
|
+
if (!active2)
|
|
28977
29156
|
return { behavior: "deny", message: "No active codexhost Turn" };
|
|
28978
|
-
const response = await
|
|
29157
|
+
const response = await active2.onPermission({ toolName, input });
|
|
28979
29158
|
if (response.behavior === "allow") {
|
|
28980
29159
|
return {
|
|
28981
29160
|
behavior: "allow",
|
|
@@ -29037,32 +29216,32 @@ var QwenCodeSdkTransport = class {
|
|
|
29037
29216
|
return;
|
|
29038
29217
|
}
|
|
29039
29218
|
if (nn(message)) {
|
|
29040
|
-
const
|
|
29219
|
+
const active3 = this.#active;
|
|
29041
29220
|
const errorMessage = typeof message.error === "string" ? message.error : typeof message.error === "object" && message.error !== null && "message" in message.error && typeof message.error.message === "string" ? message.error.message : `Qwen Code SDK returned ${message.subtype}`;
|
|
29042
29221
|
const error51 = message.is_error ? classifyError(errorMessage, "turn") : void 0;
|
|
29043
|
-
if (!
|
|
29222
|
+
if (!active3) {
|
|
29044
29223
|
if (error51)
|
|
29045
29224
|
this.#fault(error51);
|
|
29046
29225
|
return;
|
|
29047
29226
|
}
|
|
29048
|
-
|
|
29227
|
+
active3.onEvent({ type: "usage", metadata: { usage: message.usage } });
|
|
29049
29228
|
this.#active = null;
|
|
29050
|
-
|
|
29229
|
+
active3.resolve({
|
|
29051
29230
|
status: message.is_error ? "failed" : "succeeded",
|
|
29052
29231
|
...error51 ? { error: error51 } : {}
|
|
29053
29232
|
});
|
|
29054
29233
|
return;
|
|
29055
29234
|
}
|
|
29056
|
-
const
|
|
29057
|
-
if (!
|
|
29235
|
+
const active2 = this.#active;
|
|
29236
|
+
if (!active2)
|
|
29058
29237
|
return;
|
|
29059
29238
|
if (on(message)) {
|
|
29060
29239
|
if (message.event.type !== "content_block_delta")
|
|
29061
29240
|
return;
|
|
29062
29241
|
if (message.event.delta.type === "text_delta" && message.event.delta.text.length > 0) {
|
|
29063
|
-
|
|
29242
|
+
active2.onEvent({ type: "agent.text", text: message.event.delta.text });
|
|
29064
29243
|
} else if (message.event.delta.type === "thinking_delta" && message.event.delta.thinking.length > 0) {
|
|
29065
|
-
|
|
29244
|
+
active2.onEvent({ type: "agent.thought", text: message.event.delta.thinking });
|
|
29066
29245
|
}
|
|
29067
29246
|
return;
|
|
29068
29247
|
}
|
|
@@ -29071,7 +29250,7 @@ var QwenCodeSdkTransport = class {
|
|
|
29071
29250
|
if (block.type !== "tool_use")
|
|
29072
29251
|
continue;
|
|
29073
29252
|
const kind = qwenCodeToolKind(block.name);
|
|
29074
|
-
|
|
29253
|
+
active2.onEvent({
|
|
29075
29254
|
type: "tool.call",
|
|
29076
29255
|
callId: block.id,
|
|
29077
29256
|
title: block.name,
|
|
@@ -29086,7 +29265,7 @@ var QwenCodeSdkTransport = class {
|
|
|
29086
29265
|
for (const block of typeof message.message.content === "string" ? [] : message.message.content) {
|
|
29087
29266
|
if (block.type !== "tool_result")
|
|
29088
29267
|
continue;
|
|
29089
|
-
|
|
29268
|
+
active2.onEvent({
|
|
29090
29269
|
type: "tool.update",
|
|
29091
29270
|
callId: block.tool_use_id,
|
|
29092
29271
|
status: block.is_error ? "failed" : "completed",
|
|
@@ -29100,9 +29279,9 @@ var QwenCodeSdkTransport = class {
|
|
|
29100
29279
|
if (this.#closed || this.#failure)
|
|
29101
29280
|
return;
|
|
29102
29281
|
this.#failure = error51;
|
|
29103
|
-
const
|
|
29282
|
+
const active2 = this.#active;
|
|
29104
29283
|
this.#active = null;
|
|
29105
|
-
|
|
29284
|
+
active2?.reject(error51);
|
|
29106
29285
|
this.#options.onFault?.(error51);
|
|
29107
29286
|
}
|
|
29108
29287
|
};
|
|
@@ -29114,40 +29293,33 @@ function isRecord4(value) {
|
|
|
29114
29293
|
function nonBlank(value) {
|
|
29115
29294
|
return typeof value === "string" && value.trim().length > 0;
|
|
29116
29295
|
}
|
|
29117
|
-
function
|
|
29118
|
-
|
|
29119
|
-
|
|
29120
|
-
|
|
29121
|
-
|
|
29122
|
-
|
|
29123
|
-
|
|
29124
|
-
return
|
|
29296
|
+
function legacyAliasBase(id2) {
|
|
29297
|
+
return id2.replace(/[^A-Za-z0-9._~-]/gu, "-").replace(/^-+|-+$/gu, "") || "qwen-model";
|
|
29298
|
+
}
|
|
29299
|
+
function normalizeStoredQwenCodeModelRef(ref, catalog) {
|
|
29300
|
+
if (ref.serviceTier)
|
|
29301
|
+
return void 0;
|
|
29302
|
+
const matches = catalog.models.filter(({ ref: candidate }) => !candidate.serviceTier && legacyAliasBase(candidate.id) === ref.id);
|
|
29303
|
+
return matches.length === 1 ? matches[0]?.ref : void 0;
|
|
29125
29304
|
}
|
|
29126
29305
|
function parseQwenCodeModelState(value) {
|
|
29127
|
-
if (!isRecord4(value) ||
|
|
29306
|
+
if (!isRecord4(value) || typeof value.currentModelId !== "string" || !Array.isArray(value.availableModels)) {
|
|
29128
29307
|
return null;
|
|
29129
29308
|
}
|
|
29130
|
-
const nativeModelIdByRef = /* @__PURE__ */ new Map();
|
|
29131
29309
|
const contextWindowTokensByModel = /* @__PURE__ */ new Map();
|
|
29132
29310
|
const models = [];
|
|
29133
|
-
const takenRefs = /* @__PURE__ */ new Set();
|
|
29134
29311
|
const seenNativeModelIds = /* @__PURE__ */ new Set();
|
|
29135
29312
|
let currentModel = null;
|
|
29136
29313
|
for (const candidate of value.availableModels) {
|
|
29137
|
-
if (!isRecord4(candidate) || !nonBlank(candidate.
|
|
29138
|
-
continue;
|
|
29139
|
-
if (seenNativeModelIds.has(candidate.modelId))
|
|
29314
|
+
if (!isRecord4(candidate) || !nonBlank(candidate.name))
|
|
29140
29315
|
continue;
|
|
29141
|
-
const
|
|
29142
|
-
|
|
29143
|
-
if (!ref.success)
|
|
29316
|
+
const ref = harnessModelRefSchema.safeParse({ id: candidate.modelId });
|
|
29317
|
+
if (!ref.success || seenNativeModelIds.has(ref.data.id))
|
|
29144
29318
|
continue;
|
|
29145
|
-
|
|
29146
|
-
seenNativeModelIds.add(candidate.modelId);
|
|
29147
|
-
nativeModelIdByRef.set(refId, candidate.modelId);
|
|
29319
|
+
seenNativeModelIds.add(ref.data.id);
|
|
29148
29320
|
const metadata = isRecord4(candidate._meta) ? candidate._meta : {};
|
|
29149
29321
|
if (typeof metadata.contextLimit === "number" && Number.isSafeInteger(metadata.contextLimit) && metadata.contextLimit > 0) {
|
|
29150
|
-
contextWindowTokensByModel.set(
|
|
29322
|
+
contextWindowTokensByModel.set(ref.data.id, metadata.contextLimit);
|
|
29151
29323
|
}
|
|
29152
29324
|
const model2 = { ref: ref.data, label: candidate.name };
|
|
29153
29325
|
models.push(model2);
|
|
@@ -29159,7 +29331,6 @@ function parseQwenCodeModelState(value) {
|
|
|
29159
29331
|
return null;
|
|
29160
29332
|
return {
|
|
29161
29333
|
currentModel,
|
|
29162
|
-
nativeModelIdByRef,
|
|
29163
29334
|
contextWindowTokensByModel,
|
|
29164
29335
|
catalog: {
|
|
29165
29336
|
models,
|
|
@@ -29168,9 +29339,6 @@ function parseQwenCodeModelState(value) {
|
|
|
29168
29339
|
}
|
|
29169
29340
|
};
|
|
29170
29341
|
}
|
|
29171
|
-
function nativeModelIdForRef(modelState, model2) {
|
|
29172
|
-
return modelState.nativeModelIdByRef.get(model2.id);
|
|
29173
|
-
}
|
|
29174
29342
|
function stateForQwenCodeModel(modelState, nativeState, model2 = modelState.currentModel, permissionModeId) {
|
|
29175
29343
|
return {
|
|
29176
29344
|
...nativeState,
|
|
@@ -29231,11 +29399,11 @@ function toolCall(part) {
|
|
|
29231
29399
|
const call = isRecord5(part.functionCall) ? part.functionCall : part.tool_use;
|
|
29232
29400
|
if (!isRecord5(call))
|
|
29233
29401
|
return null;
|
|
29234
|
-
const
|
|
29402
|
+
const id2 = typeof call.id === "string" ? call.id : typeof call.callId === "string" ? call.callId : null;
|
|
29235
29403
|
const name = typeof call.name === "string" ? call.name : null;
|
|
29236
|
-
if (!
|
|
29404
|
+
if (!id2 || !name)
|
|
29237
29405
|
return null;
|
|
29238
|
-
return { id, name, input: call.args ?? call.input ?? {} };
|
|
29406
|
+
return { id: id2, name, input: call.args ?? call.input ?? {} };
|
|
29239
29407
|
}
|
|
29240
29408
|
function toolResult(record3) {
|
|
29241
29409
|
const result = isRecord5(record3.toolCallResult) ? record3.toolCallResult : null;
|
|
@@ -29244,14 +29412,14 @@ function toolResult(record3) {
|
|
|
29244
29412
|
const source = result ?? (isRecord5(response) ? response : null);
|
|
29245
29413
|
if (!source)
|
|
29246
29414
|
return null;
|
|
29247
|
-
const
|
|
29248
|
-
if (!
|
|
29415
|
+
const id2 = typeof source.callId === "string" ? source.callId : typeof source.id === "string" ? source.id : typeof source.tool_use_id === "string" ? source.tool_use_id : null;
|
|
29416
|
+
if (!id2)
|
|
29249
29417
|
return null;
|
|
29250
29418
|
const statuses = [source.status, source.executionStatus].filter((value) => typeof value === "string").map((value) => value.toLowerCase());
|
|
29251
29419
|
const cancelled = statuses.some((value) => value === "cancelled" || value === "canceled");
|
|
29252
29420
|
const failed = source.error === true || source.is_error === true || source.error !== void 0 && source.error !== null && source.error !== false || statuses.some((value) => value === "error" || value === "failed" || value === "failure");
|
|
29253
29421
|
return {
|
|
29254
|
-
id,
|
|
29422
|
+
id: id2,
|
|
29255
29423
|
output: source.resultDisplay ?? source.response ?? source.result ?? source.content ?? "",
|
|
29256
29424
|
status: cancelled ? "cancelled" : failed ? "failed" : "succeeded"
|
|
29257
29425
|
};
|
|
@@ -29444,10 +29612,10 @@ async function readQwenCodeHistory(cwd, harnessId, sessionId, knownTurnRefs = []
|
|
|
29444
29612
|
path4.join(projectDir, "archive", `${sessionId}.jsonl`)
|
|
29445
29613
|
];
|
|
29446
29614
|
let lastReadError;
|
|
29447
|
-
for (const
|
|
29615
|
+
for (const filePath2 of paths) {
|
|
29448
29616
|
let content;
|
|
29449
29617
|
try {
|
|
29450
|
-
content = await readFile(
|
|
29618
|
+
content = await readFile(filePath2, "utf8");
|
|
29451
29619
|
} catch (error51) {
|
|
29452
29620
|
lastReadError = error51;
|
|
29453
29621
|
continue;
|
|
@@ -29699,7 +29867,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29699
29867
|
const completion = new Promise((resolve2) => {
|
|
29700
29868
|
resolveCompletion = resolve2;
|
|
29701
29869
|
});
|
|
29702
|
-
const
|
|
29870
|
+
const active2 = {
|
|
29703
29871
|
command,
|
|
29704
29872
|
agent: null,
|
|
29705
29873
|
reasoning: null,
|
|
@@ -29710,14 +29878,13 @@ var QwenCodeHarnessSession = class {
|
|
|
29710
29878
|
completion,
|
|
29711
29879
|
resolveCompletion
|
|
29712
29880
|
};
|
|
29713
|
-
this.#active =
|
|
29881
|
+
this.#active = active2;
|
|
29714
29882
|
this.#event({ type: "turn.started", turnId: command.turnId });
|
|
29715
|
-
void this.#transport.runTurn(text, (event) => this.#handleEvent(
|
|
29883
|
+
void this.#transport.runTurn(text, (event) => this.#handleEvent(active2, event), (request) => this.#requestPermission(active2, request)).then((response) => this.#finish(active2, terminalOutcome(response, active2.cancellationRequested)), (error51) => this.#finish(active2, { status: "failed", error: normalizeError(error51, "nativeFailure") }));
|
|
29716
29884
|
return { ok: true, value: { turnId: command.turnId } };
|
|
29717
29885
|
}
|
|
29718
29886
|
async #selectModel(command) {
|
|
29719
|
-
|
|
29720
|
-
if (!nativeModelId) {
|
|
29887
|
+
if (!catalogModelForRef(this.#modelState.catalog, command.model)) {
|
|
29721
29888
|
return {
|
|
29722
29889
|
ok: false,
|
|
29723
29890
|
error: {
|
|
@@ -29739,7 +29906,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29739
29906
|
}
|
|
29740
29907
|
this.#configuring = true;
|
|
29741
29908
|
try {
|
|
29742
|
-
await this.#transport.setModel(
|
|
29909
|
+
await this.#transport.setModel(command.model.id);
|
|
29743
29910
|
this.#modelState = { ...this.#modelState, currentModel: command.model };
|
|
29744
29911
|
this.#state = stateForQwenCodeModel(this.#modelState, { nativeRef: nativeRef(this.#transport.sessionId) }, command.model, this.#state.effectivePermissionModeId);
|
|
29745
29912
|
this.#event({ type: "session.state.changed", state: this.#state });
|
|
@@ -29789,17 +29956,17 @@ var QwenCodeHarnessSession = class {
|
|
|
29789
29956
|
}
|
|
29790
29957
|
}
|
|
29791
29958
|
async #cancel(command) {
|
|
29792
|
-
const
|
|
29793
|
-
if (!
|
|
29959
|
+
const active2 = this.#active;
|
|
29960
|
+
if (!active2 || active2.command.turnId !== command.turnId) {
|
|
29794
29961
|
return {
|
|
29795
29962
|
ok: false,
|
|
29796
29963
|
error: invalidState("Qwen Code Turn Cancel must reference the active Turn")
|
|
29797
29964
|
};
|
|
29798
29965
|
}
|
|
29799
|
-
if (
|
|
29966
|
+
if (active2.cancellationRequested)
|
|
29800
29967
|
return { ok: true, value: { cancellationRequested: true } };
|
|
29801
|
-
|
|
29802
|
-
for (const approval of
|
|
29968
|
+
active2.cancellationRequested = true;
|
|
29969
|
+
for (const approval of active2.approvals.values()) {
|
|
29803
29970
|
approval.resolve({ behavior: "deny" });
|
|
29804
29971
|
}
|
|
29805
29972
|
try {
|
|
@@ -29810,9 +29977,9 @@ var QwenCodeHarnessSession = class {
|
|
|
29810
29977
|
}
|
|
29811
29978
|
}
|
|
29812
29979
|
async #respond(command) {
|
|
29813
|
-
const
|
|
29814
|
-
const pending =
|
|
29815
|
-
if (!
|
|
29980
|
+
const active2 = this.#active;
|
|
29981
|
+
const pending = active2?.approvals.get(command.interactionId);
|
|
29982
|
+
if (!active2 || !pending)
|
|
29816
29983
|
return { ok: false, error: invalidState("Qwen Code interaction is not pending") };
|
|
29817
29984
|
if (pending.interaction.type === "question") {
|
|
29818
29985
|
if (command.response.type !== "question")
|
|
@@ -29823,7 +29990,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29823
29990
|
const validation = validateHostQuestionResponse(pending.interaction, command.response);
|
|
29824
29991
|
if (validation)
|
|
29825
29992
|
return { ok: false, error: validation };
|
|
29826
|
-
|
|
29993
|
+
active2.approvals.delete(command.interactionId);
|
|
29827
29994
|
if (command.response.cancelled)
|
|
29828
29995
|
pending.resolve({ behavior: "deny" });
|
|
29829
29996
|
else {
|
|
@@ -29843,7 +30010,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29843
30010
|
return { ok: false, error: validation };
|
|
29844
30011
|
if (command.response.actionId !== "allow" && command.response.actionId !== "deny")
|
|
29845
30012
|
return { ok: false, error: invalidState("Qwen Code Approval action is unavailable") };
|
|
29846
|
-
|
|
30013
|
+
active2.approvals.delete(command.interactionId);
|
|
29847
30014
|
const behavior = command.response.actionId;
|
|
29848
30015
|
pending.resolve({
|
|
29849
30016
|
behavior,
|
|
@@ -29853,20 +30020,20 @@ var QwenCodeHarnessSession = class {
|
|
|
29853
30020
|
this.#event({
|
|
29854
30021
|
type: "interaction.closed",
|
|
29855
30022
|
interactionId: command.interactionId,
|
|
29856
|
-
turnId:
|
|
30023
|
+
turnId: active2.command.turnId,
|
|
29857
30024
|
reason: "responded"
|
|
29858
30025
|
});
|
|
29859
30026
|
return { ok: true, value: { accepted: true } };
|
|
29860
30027
|
}
|
|
29861
|
-
#requestPermission(
|
|
29862
|
-
if (this.#active !==
|
|
30028
|
+
#requestPermission(active2, request) {
|
|
30029
|
+
if (this.#active !== active2 || active2.cancellationRequested)
|
|
29863
30030
|
return Promise.resolve({ behavior: "deny" });
|
|
29864
30031
|
const interactionId = hostInteractionIdSchema.parse(this.#randomUUID());
|
|
29865
30032
|
const questions = request.toolName === "ask_user_question" ? qwenQuestions(request.input) : null;
|
|
29866
30033
|
const interaction = questions ? {
|
|
29867
30034
|
type: "question",
|
|
29868
30035
|
interactionId,
|
|
29869
|
-
turnId:
|
|
30036
|
+
turnId: active2.command.turnId,
|
|
29870
30037
|
...questions.length === 1 && questions[0]?.header ? { title: questions[0].header } : { title: "Qwen Code" },
|
|
29871
30038
|
questions: questions.map((question, index) => ({
|
|
29872
30039
|
id: `question-${index}`,
|
|
@@ -29884,7 +30051,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29884
30051
|
} : {
|
|
29885
30052
|
type: "approval",
|
|
29886
30053
|
interactionId,
|
|
29887
|
-
turnId:
|
|
30054
|
+
turnId: active2.command.turnId,
|
|
29888
30055
|
title: request.toolName,
|
|
29889
30056
|
subject: { type: "nativeAction" },
|
|
29890
30057
|
actions: [
|
|
@@ -29893,66 +30060,66 @@ var QwenCodeHarnessSession = class {
|
|
|
29893
30060
|
]
|
|
29894
30061
|
};
|
|
29895
30062
|
return new Promise((resolve2) => {
|
|
29896
|
-
|
|
30063
|
+
active2.approvals.set(interactionId, { interaction, request, resolve: resolve2 });
|
|
29897
30064
|
this.#channel.emit({ kind: "interaction", interaction });
|
|
29898
30065
|
});
|
|
29899
30066
|
}
|
|
29900
|
-
#handleEvent(
|
|
29901
|
-
if (this.#active !==
|
|
30067
|
+
#handleEvent(active2, event) {
|
|
30068
|
+
if (this.#active !== active2 || this.#phase !== "open")
|
|
29902
30069
|
return;
|
|
29903
30070
|
if (event.type === "usage") {
|
|
29904
30071
|
const usage = usageFromMetadata(event.metadata);
|
|
29905
30072
|
if (usage)
|
|
29906
|
-
this.#publishUsage(usage,
|
|
30073
|
+
this.#publishUsage(usage, active2.command.turnId);
|
|
29907
30074
|
return;
|
|
29908
30075
|
}
|
|
29909
30076
|
if (event.type === "agent.text")
|
|
29910
|
-
this.#appendAgent(
|
|
30077
|
+
this.#appendAgent(active2, event.text);
|
|
29911
30078
|
else if (event.type === "agent.thought")
|
|
29912
|
-
this.#appendReasoning(
|
|
30079
|
+
this.#appendReasoning(active2, event.text);
|
|
29913
30080
|
else if (event.type === "tool.call")
|
|
29914
|
-
this.#startTool(
|
|
30081
|
+
this.#startTool(active2, event);
|
|
29915
30082
|
else if (event.type === "tool.update")
|
|
29916
|
-
this.#updateTool(
|
|
30083
|
+
this.#updateTool(active2, event);
|
|
29917
30084
|
}
|
|
29918
|
-
#appendAgent(
|
|
29919
|
-
if (!
|
|
29920
|
-
this.#completeReasoning(
|
|
29921
|
-
|
|
30085
|
+
#appendAgent(active2, text) {
|
|
30086
|
+
if (!active2.agent) {
|
|
30087
|
+
this.#completeReasoning(active2, { status: "succeeded" });
|
|
30088
|
+
active2.agent = {
|
|
29922
30089
|
type: "agentMessage",
|
|
29923
30090
|
itemId: hostItemIdSchema.parse(this.#randomUUID()),
|
|
29924
30091
|
text: ""
|
|
29925
30092
|
};
|
|
29926
|
-
this.#event({ type: "item.started", turnId:
|
|
30093
|
+
this.#event({ type: "item.started", turnId: active2.command.turnId, item: active2.agent });
|
|
29927
30094
|
}
|
|
29928
|
-
|
|
30095
|
+
active2.agent = { ...active2.agent, text: active2.agent.text + text };
|
|
29929
30096
|
this.#event({
|
|
29930
30097
|
type: "item.updated",
|
|
29931
|
-
turnId:
|
|
29932
|
-
itemId:
|
|
30098
|
+
turnId: active2.command.turnId,
|
|
30099
|
+
itemId: active2.agent.itemId,
|
|
29933
30100
|
update: { type: "text.append", text }
|
|
29934
30101
|
});
|
|
29935
30102
|
}
|
|
29936
|
-
#appendReasoning(
|
|
29937
|
-
if (!
|
|
29938
|
-
|
|
30103
|
+
#appendReasoning(active2, text) {
|
|
30104
|
+
if (!active2.reasoning) {
|
|
30105
|
+
active2.reasoning = {
|
|
29939
30106
|
type: "reasoning",
|
|
29940
30107
|
itemId: hostItemIdSchema.parse(this.#randomUUID()),
|
|
29941
30108
|
text: ""
|
|
29942
30109
|
};
|
|
29943
|
-
this.#event({ type: "item.started", turnId:
|
|
30110
|
+
this.#event({ type: "item.started", turnId: active2.command.turnId, item: active2.reasoning });
|
|
29944
30111
|
}
|
|
29945
|
-
|
|
30112
|
+
active2.reasoning = { ...active2.reasoning, text: active2.reasoning.text + text };
|
|
29946
30113
|
this.#event({
|
|
29947
30114
|
type: "item.updated",
|
|
29948
|
-
turnId:
|
|
29949
|
-
itemId:
|
|
30115
|
+
turnId: active2.command.turnId,
|
|
30116
|
+
itemId: active2.reasoning.itemId,
|
|
29950
30117
|
update: { type: "text.append", text }
|
|
29951
30118
|
});
|
|
29952
30119
|
}
|
|
29953
|
-
#startTool(
|
|
29954
|
-
this.#completeReasoning(
|
|
29955
|
-
this.#completeAgent(
|
|
30120
|
+
#startTool(active2, event) {
|
|
30121
|
+
this.#completeReasoning(active2, { status: "succeeded" });
|
|
30122
|
+
this.#completeAgent(active2, { status: "succeeded" });
|
|
29956
30123
|
let item = startQwenCodeToolItem({
|
|
29957
30124
|
itemId: hostItemIdSchema.parse(this.#randomUUID()),
|
|
29958
30125
|
name: event.name,
|
|
@@ -29964,18 +30131,18 @@ var QwenCodeHarnessSession = class {
|
|
|
29964
30131
|
const projection = projectQwenCodeToolOutput(event.content, event.rawOutput, this.#toolOutputLimit);
|
|
29965
30132
|
if (hasQwenCodeToolProjection(projection))
|
|
29966
30133
|
item = applyQwenCodeToolProjection(item, projection);
|
|
29967
|
-
|
|
30134
|
+
active2.tools.set(event.callId, {
|
|
29968
30135
|
item,
|
|
29969
30136
|
rawInput: event.rawInput,
|
|
29970
30137
|
...event.status ? { status: event.status } : {}
|
|
29971
30138
|
});
|
|
29972
|
-
this.#event({ type: "item.started", turnId:
|
|
30139
|
+
this.#event({ type: "item.started", turnId: active2.command.turnId, item });
|
|
29973
30140
|
if (event.status === "completed" || event.status === "failed") {
|
|
29974
|
-
this.#completeTool(
|
|
30141
|
+
this.#completeTool(active2, event.callId, event.status, event.content, event.rawOutput);
|
|
29975
30142
|
}
|
|
29976
30143
|
}
|
|
29977
|
-
#updateTool(
|
|
29978
|
-
const tool =
|
|
30144
|
+
#updateTool(active2, event) {
|
|
30145
|
+
const tool = active2.tools.get(event.callId);
|
|
29979
30146
|
if (!tool)
|
|
29980
30147
|
return;
|
|
29981
30148
|
if (event.rawInput !== void 0)
|
|
@@ -29991,7 +30158,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29991
30158
|
if (delta.length > 0) {
|
|
29992
30159
|
this.#event({
|
|
29993
30160
|
type: "item.updated",
|
|
29994
|
-
turnId:
|
|
30161
|
+
turnId: active2.command.turnId,
|
|
29995
30162
|
itemId: tool.item.itemId,
|
|
29996
30163
|
update: { type: "output.append", text: delta }
|
|
29997
30164
|
});
|
|
@@ -30000,7 +30167,7 @@ var QwenCodeHarnessSession = class {
|
|
|
30000
30167
|
} else if (tool.item.type === "toolExecution" && projection.output) {
|
|
30001
30168
|
this.#event({
|
|
30002
30169
|
type: "item.updated",
|
|
30003
|
-
turnId:
|
|
30170
|
+
turnId: active2.command.turnId,
|
|
30004
30171
|
itemId: tool.item.itemId,
|
|
30005
30172
|
update: { type: "output.replace", output: projection.output }
|
|
30006
30173
|
});
|
|
@@ -30009,14 +30176,14 @@ var QwenCodeHarnessSession = class {
|
|
|
30009
30176
|
if (event.status)
|
|
30010
30177
|
tool.status = event.status;
|
|
30011
30178
|
if (event.status === "completed" || event.status === "failed") {
|
|
30012
|
-
this.#completeTool(
|
|
30179
|
+
this.#completeTool(active2, event.callId, event.status, event.content, event.rawOutput);
|
|
30013
30180
|
}
|
|
30014
30181
|
}
|
|
30015
|
-
#completeTool(
|
|
30016
|
-
const tool =
|
|
30182
|
+
#completeTool(active2, callId, status, content, rawOutput) {
|
|
30183
|
+
const tool = active2.tools.get(callId);
|
|
30017
30184
|
if (!tool)
|
|
30018
30185
|
return;
|
|
30019
|
-
|
|
30186
|
+
active2.tools.delete(callId);
|
|
30020
30187
|
const projection = projectQwenCodeToolOutput(content, rawOutput, this.#toolOutputLimit);
|
|
30021
30188
|
if (hasQwenCodeToolProjection(projection)) {
|
|
30022
30189
|
tool.item = applyQwenCodeToolProjection(tool.item, projection);
|
|
@@ -30029,45 +30196,45 @@ var QwenCodeHarnessSession = class {
|
|
|
30029
30196
|
retryable: false
|
|
30030
30197
|
}
|
|
30031
30198
|
} : { status: "succeeded" };
|
|
30032
|
-
this.#completeItem(
|
|
30199
|
+
this.#completeItem(active2, tool.item, outcome);
|
|
30033
30200
|
}
|
|
30034
|
-
#completeAgent(
|
|
30035
|
-
const item =
|
|
30036
|
-
|
|
30201
|
+
#completeAgent(active2, outcome) {
|
|
30202
|
+
const item = active2.agent;
|
|
30203
|
+
active2.agent = null;
|
|
30037
30204
|
if (item)
|
|
30038
|
-
this.#completeItem(
|
|
30205
|
+
this.#completeItem(active2, item, outcome);
|
|
30039
30206
|
}
|
|
30040
|
-
#completeReasoning(
|
|
30041
|
-
const item =
|
|
30042
|
-
|
|
30207
|
+
#completeReasoning(active2, outcome) {
|
|
30208
|
+
const item = active2.reasoning;
|
|
30209
|
+
active2.reasoning = null;
|
|
30043
30210
|
if (item)
|
|
30044
|
-
this.#completeItem(
|
|
30211
|
+
this.#completeItem(active2, item, outcome);
|
|
30045
30212
|
}
|
|
30046
|
-
#completeItem(
|
|
30213
|
+
#completeItem(active2, item, outcome) {
|
|
30047
30214
|
const snapshot = { item, outcome };
|
|
30048
|
-
|
|
30215
|
+
active2.completedItems.push(snapshot);
|
|
30049
30216
|
this.#event({
|
|
30050
30217
|
type: "item.completed",
|
|
30051
|
-
turnId:
|
|
30218
|
+
turnId: active2.command.turnId,
|
|
30052
30219
|
snapshot
|
|
30053
30220
|
});
|
|
30054
30221
|
}
|
|
30055
|
-
#finish(
|
|
30056
|
-
if (this.#active !==
|
|
30222
|
+
#finish(active2, outcome) {
|
|
30223
|
+
if (this.#active !== active2)
|
|
30057
30224
|
return;
|
|
30058
30225
|
const itemOutcome = outcome;
|
|
30059
|
-
this.#completeReasoning(
|
|
30060
|
-
this.#completeAgent(
|
|
30061
|
-
for (const tool of
|
|
30062
|
-
this.#completeItem(
|
|
30063
|
-
|
|
30064
|
-
for (const [interactionId, pending] of
|
|
30065
|
-
|
|
30226
|
+
this.#completeReasoning(active2, itemOutcome);
|
|
30227
|
+
this.#completeAgent(active2, itemOutcome);
|
|
30228
|
+
for (const tool of active2.tools.values())
|
|
30229
|
+
this.#completeItem(active2, tool.item, itemOutcome);
|
|
30230
|
+
active2.tools.clear();
|
|
30231
|
+
for (const [interactionId, pending] of active2.approvals) {
|
|
30232
|
+
active2.approvals.delete(interactionId);
|
|
30066
30233
|
pending.resolve({ behavior: "deny" });
|
|
30067
30234
|
this.#event({
|
|
30068
30235
|
type: "interaction.closed",
|
|
30069
30236
|
interactionId,
|
|
30070
|
-
turnId:
|
|
30237
|
+
turnId: active2.command.turnId,
|
|
30071
30238
|
reason: "cancelled"
|
|
30072
30239
|
});
|
|
30073
30240
|
}
|
|
@@ -30081,18 +30248,18 @@ var QwenCodeHarnessSession = class {
|
|
|
30081
30248
|
this.#nextTurnOrdinal += 1;
|
|
30082
30249
|
const turn = {
|
|
30083
30250
|
nativeTurnRef,
|
|
30084
|
-
input:
|
|
30085
|
-
items:
|
|
30251
|
+
input: active2.command.input,
|
|
30252
|
+
items: active2.completedItems,
|
|
30086
30253
|
outcome
|
|
30087
30254
|
};
|
|
30088
30255
|
this.#snapshot.turns = [...this.#snapshot.turns, turn];
|
|
30089
30256
|
this.#event({
|
|
30090
30257
|
type: "turn.completed",
|
|
30091
|
-
turnId:
|
|
30258
|
+
turnId: active2.command.turnId,
|
|
30092
30259
|
nativeTurnRef,
|
|
30093
30260
|
outcome
|
|
30094
30261
|
});
|
|
30095
|
-
|
|
30262
|
+
active2.resolveCompletion();
|
|
30096
30263
|
}
|
|
30097
30264
|
#publishUsage(usage, observedForTurnId) {
|
|
30098
30265
|
const merged = combineUsage(this.#usage, usage);
|
|
@@ -30117,10 +30284,10 @@ var QwenCodeHarnessSession = class {
|
|
|
30117
30284
|
if (this.#phase === "closed")
|
|
30118
30285
|
return;
|
|
30119
30286
|
this.#phase = "closing";
|
|
30120
|
-
const
|
|
30121
|
-
if (
|
|
30122
|
-
|
|
30123
|
-
for (const approval of
|
|
30287
|
+
const active2 = this.#active;
|
|
30288
|
+
if (active2) {
|
|
30289
|
+
active2.cancellationRequested = true;
|
|
30290
|
+
for (const approval of active2.approvals.values())
|
|
30124
30291
|
approval.resolve({ behavior: "deny" });
|
|
30125
30292
|
const { promise: deadline, resolve: resolve2 } = Promise.withResolvers();
|
|
30126
30293
|
const timeout = setTimeout(() => resolve2(void 0), this.#closeTimeoutMs);
|
|
@@ -30128,7 +30295,7 @@ var QwenCodeHarnessSession = class {
|
|
|
30128
30295
|
await Promise.race([
|
|
30129
30296
|
(async () => {
|
|
30130
30297
|
await this.#transport.cancel().catch(() => void 0);
|
|
30131
|
-
await
|
|
30298
|
+
await active2.completion;
|
|
30132
30299
|
})(),
|
|
30133
30300
|
deadline
|
|
30134
30301
|
]);
|
|
@@ -30163,11 +30330,13 @@ var QwenCodeHarnessSession = class {
|
|
|
30163
30330
|
}
|
|
30164
30331
|
};
|
|
30165
30332
|
var QwenCodeAdapter = class {
|
|
30333
|
+
normalizeStoredModelRef = normalizeStoredQwenCodeModelRef;
|
|
30166
30334
|
harnessId = qwenCodeHarnessId;
|
|
30167
30335
|
#closeTimeoutMs;
|
|
30168
30336
|
#dependencies;
|
|
30169
30337
|
#environment;
|
|
30170
30338
|
#inspectionCache = /* @__PURE__ */ new Map();
|
|
30339
|
+
#inspectionGeneration = 0;
|
|
30171
30340
|
#sessions = /* @__PURE__ */ new Set();
|
|
30172
30341
|
#toolOutputLimit;
|
|
30173
30342
|
#closePromise = null;
|
|
@@ -30185,11 +30354,14 @@ var QwenCodeAdapter = class {
|
|
|
30185
30354
|
return { status: "unavailable", error: invalidState("Qwen Code Adapter is closed") };
|
|
30186
30355
|
}
|
|
30187
30356
|
const cwd = path5.resolve(input.cwd ?? process.cwd());
|
|
30188
|
-
if (
|
|
30189
|
-
|
|
30190
|
-
|
|
30191
|
-
return cached2;
|
|
30357
|
+
if (input.refresh) {
|
|
30358
|
+
this.#inspectionCache.clear();
|
|
30359
|
+
this.#inspectionGeneration++;
|
|
30192
30360
|
}
|
|
30361
|
+
const cached2 = this.#inspectionCache.get(cwd);
|
|
30362
|
+
if (cached2)
|
|
30363
|
+
return cached2;
|
|
30364
|
+
const generation = this.#inspectionGeneration;
|
|
30193
30365
|
let transport = null;
|
|
30194
30366
|
const startedAt = Date.now();
|
|
30195
30367
|
let stage = "spawn";
|
|
@@ -30212,7 +30384,8 @@ var QwenCodeAdapter = class {
|
|
|
30212
30384
|
permissionModes: QWEN_CODE_PERMISSION_MODE_CATALOG,
|
|
30213
30385
|
capabilities: capabilitiesForModels(modelState)
|
|
30214
30386
|
};
|
|
30215
|
-
this.#
|
|
30387
|
+
if (!this.#closePromise && generation === this.#inspectionGeneration)
|
|
30388
|
+
this.#inspectionCache.set(cwd, ready);
|
|
30216
30389
|
return ready;
|
|
30217
30390
|
} catch (error51) {
|
|
30218
30391
|
await transport?.close().catch(() => void 0);
|
|
@@ -30340,11 +30513,10 @@ var QwenCodeAdapter = class {
|
|
|
30340
30513
|
throw new QwenCodeTransportError("protocolError", "Qwen Code returned an invalid Model catalog");
|
|
30341
30514
|
}
|
|
30342
30515
|
const selectedModel = input.kind === "create" ? input.model ?? modelState.currentModel : modelState.currentModel;
|
|
30343
|
-
|
|
30344
|
-
if (!nativeModelId) {
|
|
30516
|
+
if (!catalogModelForRef(modelState.catalog, selectedModel)) {
|
|
30345
30517
|
throw new QwenCodeTransportError("protocolError", "Requested Qwen Code Model is unavailable");
|
|
30346
30518
|
}
|
|
30347
|
-
await transport.setModel(
|
|
30519
|
+
await transport.setModel(selectedModel.id);
|
|
30348
30520
|
modelState.currentModel = selectedModel;
|
|
30349
30521
|
const history = input.kind === "resume" ? (await readQwenCodeHistory(cwd, this.harnessId, opened.sessionId, input.knownTurnRefs, this.#toolOutputLimit, sessionEnvironment)).turns : [];
|
|
30350
30522
|
const initialUsage = null;
|