@codexhost/cli-linux-arm64 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +3117 -274
- package/app/console-web.js +15645 -4413
- package/app/desktop-controller.mjs +14057 -969
- package/app/host-runtime.mjs +11518 -8277
- package/app/plugins/antigravity/plugin.mjs +2030 -678
- package/app/plugins/claude-code/plugin.mjs +2116 -929
- package/app/plugins/codebuddy/plugin.mjs +1247 -353
- package/app/plugins/codex-usage/plugin.mjs +786 -163
- package/app/plugins/copilot/plugin.mjs +938 -296
- package/app/plugins/cursor-cli/plugin.mjs +1021 -232
- package/app/plugins/deepseek-harness/plugin.mjs +1552 -664
- package/app/plugins/devin/plugin.mjs +826 -185
- package/app/plugins/grok/plugin.mjs +1083 -424
- package/app/plugins/hermes/plugin.mjs +961 -338
- package/app/plugins/kimi-code/plugin.mjs +854 -237
- package/app/plugins/kiro-cli/plugin.mjs +821 -184
- package/app/plugins/omp/plugin.mjs +1316 -633
- package/app/plugins/opencode/plugin.mjs +1293 -606
- package/app/plugins/pi/plugin.mjs +1540 -867
- package/app/plugins/qoder/plugin.mjs +961 -332
- package/app/plugins/qoder-cn/plugin.mjs +961 -332
- package/app/plugins/qwen-code/plugin.mjs +937 -321
- package/app/plugins/workbuddy/plugin.mjs +1311 -370
- package/app/plugins/zcode/plugin.mjs +1516 -423
- package/app/renderer-extension.js +21297 -9060
- package/app/web/assets/index-CTCFIQbU.css +1 -0
- package/app/web/assets/index-IvFk9KT-.js +203 -0
- package/app/web/codexhost-settings.js +6753 -31616
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +14 -14
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +75 -64
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +94 -91
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-browser/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +79 -79
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
- package/app/web/sw.js +8 -1
- package/app/web-modules/licenses/werift-NOTICES.txt +123 -0
- package/app/web-modules/licenses/werift-libwebrtc-NOTICES.txt +58 -0
- package/app/web-modules/server.mjs +40416 -11283
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-CN4a4sj0.js +0 -201
- package/app/web/assets/index-DJW4bmyx.css +0 -1
|
@@ -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,
|
|
@@ -21546,6 +21546,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
|
21546
21546
|
permissionModeId: harnessPermissionModeIdSchema
|
|
21547
21547
|
}).strict();
|
|
21548
21548
|
|
|
21549
|
+
// ../../shared-contracts/dist/harness-route-limit.js
|
|
21550
|
+
var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
|
|
21551
|
+
|
|
21549
21552
|
// ../../shared-contracts/dist/thread-usage.js
|
|
21550
21553
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
21551
21554
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -21578,7 +21581,7 @@ var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
|
21578
21581
|
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
21579
21582
|
label: indicatorTextSchema(256).optional(),
|
|
21580
21583
|
tooltip: indicatorTextSchema(1024).optional()
|
|
21581
|
-
}).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, {
|
|
21582
21585
|
message: "Composer indicator IDs must be unique"
|
|
21583
21586
|
});
|
|
21584
21587
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
@@ -21604,6 +21607,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
21604
21607
|
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
21605
21608
|
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
21606
21609
|
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
21610
|
+
latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
21607
21611
|
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
21608
21612
|
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
21609
21613
|
}).strict().superRefine((usage, context) => {
|
|
@@ -21701,6 +21705,13 @@ var accountCreditsSnapshotSchema = external_exports.object({
|
|
|
21701
21705
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
21702
21706
|
resetCredits: accountResetCreditsSchema.optional()
|
|
21703
21707
|
}).strict();
|
|
21708
|
+
var accountBalanceSnapshotSchema = external_exports.object({
|
|
21709
|
+
amount: external_exports.number().finite().nonnegative(),
|
|
21710
|
+
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
21711
|
+
currency: external_exports.string().trim().min(1).max(8),
|
|
21712
|
+
/** Native label when the Harness exposes several Billing Sources. */
|
|
21713
|
+
label: external_exports.string().trim().min(1).max(128).optional()
|
|
21714
|
+
}).strict();
|
|
21704
21715
|
var threadUsageInspectionParamsSchema = external_exports.object({
|
|
21705
21716
|
threadId: hostThreadIdSchema,
|
|
21706
21717
|
refresh: external_exports.literal("exact").optional()
|
|
@@ -21709,7 +21720,10 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
21709
21720
|
threadId: hostThreadIdSchema,
|
|
21710
21721
|
usage: threadUsageSnapshotSchema.nullable(),
|
|
21711
21722
|
accountCredits: accountCreditsSnapshotSchema.optional(),
|
|
21712
|
-
/**
|
|
21723
|
+
/** Prepaid funds for the Thread's Billing Source; shown only when no percentage quota exists. */
|
|
21724
|
+
accountBalance: accountBalanceSnapshotSchema.optional(),
|
|
21725
|
+
/** Whether this source can provide cached account quota (credits or a prepaid balance)
|
|
21726
|
+
* independently of usage. */
|
|
21713
21727
|
accountCreditsSupported: external_exports.boolean().optional()
|
|
21714
21728
|
}).strict();
|
|
21715
21729
|
|
|
@@ -21721,10 +21735,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
|
21721
21735
|
var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
21722
21736
|
message: "Value must not be empty or whitespace"
|
|
21723
21737
|
});
|
|
21724
|
-
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"]);
|
|
21725
21740
|
var harnessModelRefSchema = external_exports.object({
|
|
21726
|
-
id: harnessModelRefIdSchema
|
|
21741
|
+
id: harnessModelRefIdSchema,
|
|
21742
|
+
serviceTier: harnessModelServiceTierSchema.optional()
|
|
21727
21743
|
}).strict();
|
|
21744
|
+
function sameHarnessModelRef(left, right) {
|
|
21745
|
+
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
21746
|
+
}
|
|
21728
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();
|
|
21729
21748
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
21730
21749
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
@@ -21738,7 +21757,15 @@ var harnessModelSchema = external_exports.object({
|
|
|
21738
21757
|
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
21739
21758
|
fastModel: harnessModelRefSchema.optional(),
|
|
21740
21759
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
21741
|
-
}).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
|
+
}
|
|
21742
21769
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
21743
21770
|
const ids = /* @__PURE__ */ new Set();
|
|
21744
21771
|
for (const [index, option] of options.entries()) {
|
|
@@ -21758,26 +21785,26 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
21758
21785
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
21759
21786
|
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
21760
21787
|
}).strict().superRefine((catalog, context) => {
|
|
21761
|
-
const refs =
|
|
21762
|
-
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) =>
|
|
21788
|
+
const refs = [];
|
|
21789
|
+
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
|
|
21763
21790
|
for (const [index, model2] of catalog.models.entries()) {
|
|
21764
|
-
if (refs.
|
|
21791
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
|
|
21765
21792
|
context.addIssue({
|
|
21766
21793
|
code: "custom",
|
|
21767
21794
|
message: "Model Catalog refs must be unique",
|
|
21768
21795
|
path: ["models", index, "ref", "id"]
|
|
21769
21796
|
});
|
|
21770
21797
|
}
|
|
21771
|
-
refs.
|
|
21798
|
+
refs.push(model2.ref);
|
|
21772
21799
|
if (model2.fastModel) {
|
|
21773
|
-
if (refs.
|
|
21800
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
|
|
21774
21801
|
context.addIssue({
|
|
21775
21802
|
code: "custom",
|
|
21776
21803
|
message: "Fast Model refs must be distinct and unique",
|
|
21777
21804
|
path: ["models", index, "fastModel"]
|
|
21778
21805
|
});
|
|
21779
21806
|
}
|
|
21780
|
-
refs.
|
|
21807
|
+
refs.push(model2.fastModel);
|
|
21781
21808
|
}
|
|
21782
21809
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
21783
21810
|
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
@@ -21798,7 +21825,7 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
21798
21825
|
}
|
|
21799
21826
|
}
|
|
21800
21827
|
}
|
|
21801
|
-
if (catalog.defaultModel && !
|
|
21828
|
+
if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
|
|
21802
21829
|
context.addIssue({
|
|
21803
21830
|
code: "custom",
|
|
21804
21831
|
message: "Default Model must exist in the Model Catalog",
|
|
@@ -21838,7 +21865,12 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
21838
21865
|
observe: external_exports.boolean()
|
|
21839
21866
|
}).strict().optional(),
|
|
21840
21867
|
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
21841
|
-
steer: external_exports.boolean().optional()
|
|
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()
|
|
21842
21874
|
}).strict();
|
|
21843
21875
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
21844
21876
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -21847,7 +21879,7 @@ var harnessConfigurationStateSchema = external_exports.object({
|
|
|
21847
21879
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
21848
21880
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
21849
21881
|
}).strict().superRefine((state, context) => {
|
|
21850
|
-
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) =>
|
|
21882
|
+
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
|
|
21851
21883
|
context.addIssue({
|
|
21852
21884
|
code: "custom",
|
|
21853
21885
|
message: "Effective Thinking option must be currently available",
|
|
@@ -21887,7 +21919,8 @@ var harnessInspectParamsSchema = external_exports.object({
|
|
|
21887
21919
|
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
21888
21920
|
refresh: external_exports.boolean().optional(),
|
|
21889
21921
|
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
21890
|
-
purpose: external_exports.literal("availability").optional()
|
|
21922
|
+
purpose: external_exports.literal("availability").optional(),
|
|
21923
|
+
credentialAccess: external_exports.enum(["allow", "retry"]).optional()
|
|
21891
21924
|
}).strict();
|
|
21892
21925
|
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
21893
21926
|
harnessId: harnessIdSchema
|
|
@@ -21918,7 +21951,7 @@ var codexThreadInspectionSchema = external_exports.object({
|
|
|
21918
21951
|
var externalThreadInspectionSchema = external_exports.object({
|
|
21919
21952
|
owner: external_exports.literal("external"),
|
|
21920
21953
|
harnessId: nonBlankTextSchema2.max(256),
|
|
21921
|
-
transportModelId: nonBlankTextSchema2.max(
|
|
21954
|
+
transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
|
|
21922
21955
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
21923
21956
|
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
21924
21957
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -22000,13 +22033,635 @@ var threadSteeringInspectResultSchema = external_exports.object({
|
|
|
22000
22033
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
22001
22034
|
}).strict();
|
|
22002
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()
|
|
22268
|
+
});
|
|
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
|
+
});
|
|
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 })
|
|
22433
|
+
]);
|
|
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") })
|
|
22439
|
+
]);
|
|
22440
|
+
var hostExtensionInstallationSchema = external_exports.strictObject({
|
|
22441
|
+
...active,
|
|
22442
|
+
manifest: hostExtensionManifestV2Schema,
|
|
22443
|
+
installedAt: external_exports.iso.datetime(),
|
|
22444
|
+
source: hostExtensionProvenanceSchema.optional()
|
|
22445
|
+
});
|
|
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
|
+
})
|
|
22465
|
+
]);
|
|
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
|
|
22520
|
+
});
|
|
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
|
+
};
|
|
22580
|
+
|
|
22003
22581
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
22582
|
+
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
22004
22583
|
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
22005
22584
|
var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
22006
22585
|
|
|
22007
22586
|
// ../../shared-contracts/dist/client-channel.js
|
|
22008
22587
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
22009
22588
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
22589
|
+
var CLIENT_CHANNEL_METHODS = [
|
|
22590
|
+
"codexhost/skills/list",
|
|
22591
|
+
"codexhost/voice/status",
|
|
22592
|
+
"codexhost/voice/transcribe",
|
|
22593
|
+
"codexhost/harness/display-settings/get",
|
|
22594
|
+
"codexhost/harness/display-settings/set",
|
|
22595
|
+
"codexhost/harness/display-settings/capabilities",
|
|
22596
|
+
"codexhost/harness/preferences/get",
|
|
22597
|
+
"codexhost/harness/preferences/patch",
|
|
22598
|
+
"thread/list",
|
|
22599
|
+
"codexhost/thread/catalog/read",
|
|
22600
|
+
"thread/read",
|
|
22601
|
+
"thread/resume",
|
|
22602
|
+
"thread/fork",
|
|
22603
|
+
"thread/turns/list",
|
|
22604
|
+
"thread/revert",
|
|
22605
|
+
"thread/items/list",
|
|
22606
|
+
"thread/start",
|
|
22607
|
+
"thread/name/set",
|
|
22608
|
+
"codexhost/thread/title/generate",
|
|
22609
|
+
"thread/archive",
|
|
22610
|
+
THREAD_ARCHIVE_CONFIRM_METHOD,
|
|
22611
|
+
"thread/unarchive",
|
|
22612
|
+
"turn/start",
|
|
22613
|
+
"turn/interrupt",
|
|
22614
|
+
"turn/steer",
|
|
22615
|
+
"thread/queue/list",
|
|
22616
|
+
"thread/queue/add",
|
|
22617
|
+
"thread/queue/update",
|
|
22618
|
+
"thread/queue/delete",
|
|
22619
|
+
"thread/queue/reorder",
|
|
22620
|
+
"thread/queue/start",
|
|
22621
|
+
"codexhost/thread/queue/send-now",
|
|
22622
|
+
"codexhost/workspace/read",
|
|
22623
|
+
"codexhost/thread/tree/read",
|
|
22624
|
+
"codexhost/thread/pins/list",
|
|
22625
|
+
"codexhost/thread/pins/set",
|
|
22626
|
+
"codexhost/harness/plugins/list",
|
|
22627
|
+
"codexhost/harness/inspect",
|
|
22628
|
+
"codexhost/thread/inspect",
|
|
22629
|
+
"codexhost/thread/usage/inspect",
|
|
22630
|
+
"codexhost/thread/ownership/list",
|
|
22631
|
+
"codexhost/thread/model/select",
|
|
22632
|
+
"codexhost/thread/thinking/select",
|
|
22633
|
+
"codexhost/thread/permission-mode/select",
|
|
22634
|
+
"codexhost/thread/commands/inspect",
|
|
22635
|
+
"codexhost/harness/commands/inspect",
|
|
22636
|
+
"codexhost/thread/command/execute",
|
|
22637
|
+
"codexhost/thread/fork",
|
|
22638
|
+
"codexhost/harness/session-import/sources",
|
|
22639
|
+
"codexhost/harness/session-import/list",
|
|
22640
|
+
"codexhost/harness/session-import/import",
|
|
22641
|
+
// Host settings shared across Desktop and Web.
|
|
22642
|
+
...HOST_EXTENSION_MANAGEMENT_METHODS,
|
|
22643
|
+
"codexhost/harness/installation",
|
|
22644
|
+
"codexhost/harness/installation/start",
|
|
22645
|
+
"codexhost/harness/installation/status",
|
|
22646
|
+
"codexhost/harness/launch-settings/get",
|
|
22647
|
+
"codexhost/harness/launch-settings/set",
|
|
22648
|
+
"codexhost/harness/web-ui/open",
|
|
22649
|
+
"codexhost/harness/accounts/sources",
|
|
22650
|
+
"codexhost/harness/accounts/list",
|
|
22651
|
+
"codexhost/harness/accounts/inspect",
|
|
22652
|
+
"codexhost/harness/credential-imports",
|
|
22653
|
+
"codexhost/account/list",
|
|
22654
|
+
"codexhost/account/refresh",
|
|
22655
|
+
"codexhost/account/usage/inspect",
|
|
22656
|
+
"codexhost/usage/model-prices/get",
|
|
22657
|
+
"codexhost/usage/model-prices/set",
|
|
22658
|
+
"codexhost/usage/model-prices/default",
|
|
22659
|
+
"codexhost/usage/statistics/get",
|
|
22660
|
+
"codexhost/update/check",
|
|
22661
|
+
"codexhost/update/start",
|
|
22662
|
+
"codexhost/update/status",
|
|
22663
|
+
"codexhost/sessions/loaded/list"
|
|
22664
|
+
];
|
|
22010
22665
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
22011
22666
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
22012
22667
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -22045,6 +22700,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
22045
22700
|
cursor: clientChannelCursorSchema,
|
|
22046
22701
|
revision: external_exports.number().int().nonnegative()
|
|
22047
22702
|
}),
|
|
22703
|
+
external_exports.object({
|
|
22704
|
+
type: external_exports.literal("extensions-changed"),
|
|
22705
|
+
cursor: clientChannelCursorSchema,
|
|
22706
|
+
revision: hostExtensionRevisionSchema
|
|
22707
|
+
}),
|
|
22048
22708
|
external_exports.object({
|
|
22049
22709
|
type: external_exports.literal("hello"),
|
|
22050
22710
|
version: external_exports.literal(1),
|
|
@@ -22220,6 +22880,29 @@ var threadCatalogReadResultSchema = external_exports.object({
|
|
|
22220
22880
|
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
22221
22881
|
}).strict();
|
|
22222
22882
|
|
|
22883
|
+
// ../../shared-contracts/dist/thread-tree-watch.js
|
|
22884
|
+
var THREAD_TREE_MAX_NODES = 5e3;
|
|
22885
|
+
var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
|
|
22886
|
+
var threadTreeNodeSchema = external_exports.strictObject({
|
|
22887
|
+
harnessId: harnessIdSchema,
|
|
22888
|
+
title: external_exports.string().optional(),
|
|
22889
|
+
status: threadTreeStatusSchema,
|
|
22890
|
+
archived: external_exports.boolean()
|
|
22891
|
+
});
|
|
22892
|
+
var threadTreeSnapshotSchema = external_exports.strictObject({
|
|
22893
|
+
revision: external_exports.int().nonnegative(),
|
|
22894
|
+
parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
|
|
22895
|
+
nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
|
|
22896
|
+
truncated: external_exports.boolean()
|
|
22897
|
+
}).refine((snapshot) => Object.keys(snapshot.nodes).length <= THREAD_TREE_MAX_NODES, "Too many Thread tree nodes").refine(({ parents, nodes }) => Object.entries(parents).every(([child, parent]) => Object.hasOwn(nodes, child) && Object.hasOwn(nodes, parent)), "Missing Thread tree node");
|
|
22898
|
+
var subscriptionId = external_exports.string().min(1).max(128);
|
|
22899
|
+
var threadTreeWatchParamsSchema = external_exports.strictObject({});
|
|
22900
|
+
var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
|
|
22901
|
+
var threadTreeUnwatchResultSchema = external_exports.strictObject({});
|
|
22902
|
+
var threadTreeWatchResultSchema = threadTreeUnwatchParamsSchema.extend({
|
|
22903
|
+
snapshot: threadTreeSnapshotSchema
|
|
22904
|
+
});
|
|
22905
|
+
|
|
22223
22906
|
// ../../shared-contracts/dist/voice.js
|
|
22224
22907
|
var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
|
|
22225
22908
|
var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
|
|
@@ -22458,7 +23141,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
|
22458
23141
|
|
|
22459
23142
|
// ../../shared-contracts/dist/harness-preferences.js
|
|
22460
23143
|
var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
|
|
22461
|
-
var preferenceHarnessKey = harnessIdSchema.transform((
|
|
23144
|
+
var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
|
|
22462
23145
|
var harnessDefaultConfigurationSchema = external_exports.strictObject({
|
|
22463
23146
|
model: harnessModelRefSchema.optional(),
|
|
22464
23147
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -22468,11 +23151,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
|
|
|
22468
23151
|
lastHarness: harnessIdSchema.optional(),
|
|
22469
23152
|
byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
|
|
22470
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
|
+
});
|
|
22471
23161
|
var modelId = external_exports.string().min(1).max(1024);
|
|
22472
23162
|
var harnessPreferenceValuesSchema = external_exports.strictObject({
|
|
22473
23163
|
idleRelease: idleReleaseSettingsSchema.optional(),
|
|
22474
23164
|
favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
|
|
22475
|
-
newThread: newThreadDefaultsSchema.optional()
|
|
23165
|
+
newThread: newThreadDefaultsSchema.optional(),
|
|
23166
|
+
delegation: delegationDefaultsSchema.optional()
|
|
22476
23167
|
});
|
|
22477
23168
|
var harnessPreferenceSnapshotSchema = external_exports.strictObject({
|
|
22478
23169
|
scope: harnessPreferenceScopeSchema,
|
|
@@ -22500,6 +23191,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
|
|
|
22500
23191
|
lastHarness: harnessIdSchema.optional(),
|
|
22501
23192
|
harnessId: harnessIdSchema.optional(),
|
|
22502
23193
|
configuration: harnessDefaultConfigurationSchema.optional()
|
|
23194
|
+
}),
|
|
23195
|
+
external_exports.strictObject({
|
|
23196
|
+
kind: external_exports.literal("delegation"),
|
|
23197
|
+
harnessId: harnessIdSchema,
|
|
23198
|
+
configuration: harnessDelegationDefaultSchema.nullable()
|
|
22503
23199
|
})
|
|
22504
23200
|
]);
|
|
22505
23201
|
var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
@@ -22850,13 +23546,6 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
22850
23546
|
});
|
|
22851
23547
|
|
|
22852
23548
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
22853
|
-
var accountBalanceSnapshotSchema = external_exports.object({
|
|
22854
|
-
amount: external_exports.number().finite().nonnegative(),
|
|
22855
|
-
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
22856
|
-
currency: external_exports.string().trim().min(1).max(8),
|
|
22857
|
-
/** Native label when the Harness exposes several Billing Sources. */
|
|
22858
|
-
label: external_exports.string().trim().min(1).max(128).optional()
|
|
22859
|
-
}).strict();
|
|
22860
23549
|
var harnessAccountSnapshotObject = external_exports.object({
|
|
22861
23550
|
email: external_exports.string().trim().min(1).max(320).optional(),
|
|
22862
23551
|
label: external_exports.string().trim().min(1).max(256).optional(),
|
|
@@ -22890,76 +23579,6 @@ var harnessAccountListResultSchema = external_exports.object({
|
|
|
22890
23579
|
accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
|
|
22891
23580
|
}).strict();
|
|
22892
23581
|
|
|
22893
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
22894
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
22895
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
22896
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
22897
|
-
var installedHarnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(harnessIdSchema);
|
|
22898
|
-
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
22899
|
-
var relativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
22900
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
22901
|
-
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
22902
|
-
var harnessInstallationGuideSchema = external_exports.object({
|
|
22903
|
-
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
22904
|
-
before: localizedTextSchema.optional(),
|
|
22905
|
-
after: localizedTextSchema.optional(),
|
|
22906
|
-
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
22907
|
-
}).strict();
|
|
22908
|
-
var pluginPresentationShape = {
|
|
22909
|
-
id: installedHarnessPluginIdSchema,
|
|
22910
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
22911
|
-
version: external_exports.string().min(1).max(128),
|
|
22912
|
-
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
22913
|
-
kind: external_exports.literal("usage").optional(),
|
|
22914
|
-
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
22915
|
-
iconStyle: external_exports.object({
|
|
22916
|
-
vector: external_exports.object({
|
|
22917
|
-
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
22918
|
-
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
22919
|
-
paths: external_exports.array(external_exports.object({
|
|
22920
|
-
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
22921
|
-
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
22922
|
-
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
22923
|
-
}).strict()).min(1).max(32)
|
|
22924
|
-
}).strict().optional(),
|
|
22925
|
-
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
22926
|
-
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
22927
|
-
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
22928
|
-
}).strict().optional(),
|
|
22929
|
-
installation: harnessInstallationGuideSchema.optional(),
|
|
22930
|
-
notice: localizedTextSchema.optional(),
|
|
22931
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
22932
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
22933
|
-
links: external_exports.object({
|
|
22934
|
-
website: documentationUrlSchema.optional(),
|
|
22935
|
-
documentation: documentationUrlSchema.optional(),
|
|
22936
|
-
installation: documentationUrlSchema.optional()
|
|
22937
|
-
}).strict().optional()
|
|
22938
|
-
};
|
|
22939
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
22940
|
-
manifestVersion: external_exports.literal(1),
|
|
22941
|
-
...pluginPresentationShape,
|
|
22942
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
22943
|
-
entry: relativeResourceSchema,
|
|
22944
|
-
icon: relativeResourceSchema.optional()
|
|
22945
|
-
}).strict();
|
|
22946
|
-
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);
|
|
22947
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
22948
|
-
...pluginPresentationShape,
|
|
22949
|
-
icon: harnessPluginIconSchema.optional()
|
|
22950
|
-
}).strict();
|
|
22951
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
22952
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
22953
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
22954
|
-
}).strict();
|
|
22955
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
22956
|
-
version: external_exports.literal(1),
|
|
22957
|
-
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
22958
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
22959
|
-
message: "Enabled plugin IDs must be unique",
|
|
22960
|
-
path: ["enabled"]
|
|
22961
|
-
});
|
|
22962
|
-
|
|
22963
23582
|
// ../../shared-contracts/dist/harness-route.js
|
|
22964
23583
|
var harnessPluginRouteSchema = external_exports.object({
|
|
22965
23584
|
harnessId: harnessPluginIdSchema,
|
|
@@ -23398,9 +24017,12 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23398
24017
|
...thread,
|
|
23399
24018
|
epoch: identity,
|
|
23400
24019
|
modelId: identity.optional(),
|
|
24020
|
+
serviceTier: harnessModelServiceTierSchema.optional(),
|
|
23401
24021
|
thinkingOptionId: identity.optional(),
|
|
23402
24022
|
permissionModeId: identity.optional()
|
|
23403
|
-
}).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
|
+
}),
|
|
23404
24026
|
external_exports.strictObject({
|
|
23405
24027
|
kind: external_exports.literal("prompt"),
|
|
23406
24028
|
...thread,
|
|
@@ -23450,7 +24072,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
23450
24072
|
external_exports.strictObject({ action: external_exports.literal("catalog") }),
|
|
23451
24073
|
external_exports.strictObject({
|
|
23452
24074
|
action: external_exports.literal("read-thread"),
|
|
23453
|
-
hostId: hostId.refine((
|
|
24075
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
23454
24076
|
input: delegationReadParamsSchema
|
|
23455
24077
|
}),
|
|
23456
24078
|
external_exports.strictObject({
|
|
@@ -23464,7 +24086,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
23464
24086
|
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
23465
24087
|
external_exports.strictObject({
|
|
23466
24088
|
action: external_exports.literal("update"),
|
|
23467
|
-
hostId: hostId.refine((
|
|
24089
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
23468
24090
|
version: remoteUpdateParamsSchema.shape.version
|
|
23469
24091
|
})
|
|
23470
24092
|
]);
|
|
@@ -23528,7 +24150,7 @@ function invalidRequest(message) {
|
|
|
23528
24150
|
return { code: "invalidRequest", message, retryable: false };
|
|
23529
24151
|
}
|
|
23530
24152
|
function validateHostApprovalResponse(interaction, response) {
|
|
23531
|
-
return interaction.actions.some(({ id }) =>
|
|
24153
|
+
return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
|
|
23532
24154
|
}
|
|
23533
24155
|
|
|
23534
24156
|
// ../../harness-adapter/dist/question.js
|
|
@@ -23536,7 +24158,7 @@ function invalidRequest2(message) {
|
|
|
23536
24158
|
return { code: "invalidRequest", message, retryable: false };
|
|
23537
24159
|
}
|
|
23538
24160
|
function validateHostQuestionResponse(interaction, response) {
|
|
23539
|
-
const questionIds = new Set(interaction.questions.map(({ id }) =>
|
|
24161
|
+
const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
|
|
23540
24162
|
if (response.cancelled) {
|
|
23541
24163
|
return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
|
|
23542
24164
|
}
|
|
@@ -23642,7 +24264,8 @@ var tokenFields = [
|
|
|
23642
24264
|
var safeIntegerFields = [
|
|
23643
24265
|
"planFiveHourResetsAtUnix",
|
|
23644
24266
|
"planSevenDayResetsAtUnix",
|
|
23645
|
-
"timeToFirstOutputMs"
|
|
24267
|
+
"timeToFirstOutputMs",
|
|
24268
|
+
"latestRequestTimeToFirstOutputMs"
|
|
23646
24269
|
];
|
|
23647
24270
|
var percentFields = [
|
|
23648
24271
|
"cacheHitRatePercent",
|
|
@@ -27858,10 +28481,10 @@ function executableExtensions(command, platform, environment) {
|
|
|
27858
28481
|
return [""];
|
|
27859
28482
|
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
27860
28483
|
}
|
|
27861
|
-
function isExecutableFile(
|
|
28484
|
+
function isExecutableFile(filePath2, platform) {
|
|
27862
28485
|
try {
|
|
27863
|
-
fs.accessSync(
|
|
27864
|
-
return fs.statSync(
|
|
28486
|
+
fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
28487
|
+
return fs.statSync(filePath2).isFile();
|
|
27865
28488
|
} catch {
|
|
27866
28489
|
return false;
|
|
27867
28490
|
}
|
|
@@ -28460,9 +29083,9 @@ var QwenCodeSdkTransport = class {
|
|
|
28460
29083
|
this.#abortController = null;
|
|
28461
29084
|
const input = this.#input;
|
|
28462
29085
|
this.#input = null;
|
|
28463
|
-
const
|
|
29086
|
+
const active2 = this.#active;
|
|
28464
29087
|
this.#active = null;
|
|
28465
|
-
|
|
29088
|
+
active2?.resolve({ status: "cancelled" });
|
|
28466
29089
|
await query?.close().catch(() => void 0);
|
|
28467
29090
|
abortController?.abort();
|
|
28468
29091
|
input?.fail(new Error("Qwen Code SDK input closed"));
|
|
@@ -28528,10 +29151,10 @@ var QwenCodeSdkTransport = class {
|
|
|
28528
29151
|
return Object.fromEntries(Object.entries(environment).filter((entry) => typeof entry[1] === "string"));
|
|
28529
29152
|
}
|
|
28530
29153
|
#canUseTool = async (toolName, input) => {
|
|
28531
|
-
const
|
|
28532
|
-
if (!
|
|
29154
|
+
const active2 = this.#active;
|
|
29155
|
+
if (!active2)
|
|
28533
29156
|
return { behavior: "deny", message: "No active codexhost Turn" };
|
|
28534
|
-
const response = await
|
|
29157
|
+
const response = await active2.onPermission({ toolName, input });
|
|
28535
29158
|
if (response.behavior === "allow") {
|
|
28536
29159
|
return {
|
|
28537
29160
|
behavior: "allow",
|
|
@@ -28593,32 +29216,32 @@ var QwenCodeSdkTransport = class {
|
|
|
28593
29216
|
return;
|
|
28594
29217
|
}
|
|
28595
29218
|
if (nn(message)) {
|
|
28596
|
-
const
|
|
29219
|
+
const active3 = this.#active;
|
|
28597
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}`;
|
|
28598
29221
|
const error51 = message.is_error ? classifyError(errorMessage, "turn") : void 0;
|
|
28599
|
-
if (!
|
|
29222
|
+
if (!active3) {
|
|
28600
29223
|
if (error51)
|
|
28601
29224
|
this.#fault(error51);
|
|
28602
29225
|
return;
|
|
28603
29226
|
}
|
|
28604
|
-
|
|
29227
|
+
active3.onEvent({ type: "usage", metadata: { usage: message.usage } });
|
|
28605
29228
|
this.#active = null;
|
|
28606
|
-
|
|
29229
|
+
active3.resolve({
|
|
28607
29230
|
status: message.is_error ? "failed" : "succeeded",
|
|
28608
29231
|
...error51 ? { error: error51 } : {}
|
|
28609
29232
|
});
|
|
28610
29233
|
return;
|
|
28611
29234
|
}
|
|
28612
|
-
const
|
|
28613
|
-
if (!
|
|
29235
|
+
const active2 = this.#active;
|
|
29236
|
+
if (!active2)
|
|
28614
29237
|
return;
|
|
28615
29238
|
if (on(message)) {
|
|
28616
29239
|
if (message.event.type !== "content_block_delta")
|
|
28617
29240
|
return;
|
|
28618
29241
|
if (message.event.delta.type === "text_delta" && message.event.delta.text.length > 0) {
|
|
28619
|
-
|
|
29242
|
+
active2.onEvent({ type: "agent.text", text: message.event.delta.text });
|
|
28620
29243
|
} else if (message.event.delta.type === "thinking_delta" && message.event.delta.thinking.length > 0) {
|
|
28621
|
-
|
|
29244
|
+
active2.onEvent({ type: "agent.thought", text: message.event.delta.thinking });
|
|
28622
29245
|
}
|
|
28623
29246
|
return;
|
|
28624
29247
|
}
|
|
@@ -28627,7 +29250,7 @@ var QwenCodeSdkTransport = class {
|
|
|
28627
29250
|
if (block.type !== "tool_use")
|
|
28628
29251
|
continue;
|
|
28629
29252
|
const kind = qwenCodeToolKind(block.name);
|
|
28630
|
-
|
|
29253
|
+
active2.onEvent({
|
|
28631
29254
|
type: "tool.call",
|
|
28632
29255
|
callId: block.id,
|
|
28633
29256
|
title: block.name,
|
|
@@ -28642,7 +29265,7 @@ var QwenCodeSdkTransport = class {
|
|
|
28642
29265
|
for (const block of typeof message.message.content === "string" ? [] : message.message.content) {
|
|
28643
29266
|
if (block.type !== "tool_result")
|
|
28644
29267
|
continue;
|
|
28645
|
-
|
|
29268
|
+
active2.onEvent({
|
|
28646
29269
|
type: "tool.update",
|
|
28647
29270
|
callId: block.tool_use_id,
|
|
28648
29271
|
status: block.is_error ? "failed" : "completed",
|
|
@@ -28656,9 +29279,9 @@ var QwenCodeSdkTransport = class {
|
|
|
28656
29279
|
if (this.#closed || this.#failure)
|
|
28657
29280
|
return;
|
|
28658
29281
|
this.#failure = error51;
|
|
28659
|
-
const
|
|
29282
|
+
const active2 = this.#active;
|
|
28660
29283
|
this.#active = null;
|
|
28661
|
-
|
|
29284
|
+
active2?.reject(error51);
|
|
28662
29285
|
this.#options.onFault?.(error51);
|
|
28663
29286
|
}
|
|
28664
29287
|
};
|
|
@@ -28670,40 +29293,33 @@ function isRecord4(value) {
|
|
|
28670
29293
|
function nonBlank(value) {
|
|
28671
29294
|
return typeof value === "string" && value.trim().length > 0;
|
|
28672
29295
|
}
|
|
28673
|
-
function
|
|
28674
|
-
|
|
28675
|
-
|
|
28676
|
-
|
|
28677
|
-
|
|
28678
|
-
|
|
28679
|
-
|
|
28680
|
-
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;
|
|
28681
29304
|
}
|
|
28682
29305
|
function parseQwenCodeModelState(value) {
|
|
28683
|
-
if (!isRecord4(value) ||
|
|
29306
|
+
if (!isRecord4(value) || typeof value.currentModelId !== "string" || !Array.isArray(value.availableModels)) {
|
|
28684
29307
|
return null;
|
|
28685
29308
|
}
|
|
28686
|
-
const nativeModelIdByRef = /* @__PURE__ */ new Map();
|
|
28687
29309
|
const contextWindowTokensByModel = /* @__PURE__ */ new Map();
|
|
28688
29310
|
const models = [];
|
|
28689
|
-
const takenRefs = /* @__PURE__ */ new Set();
|
|
28690
29311
|
const seenNativeModelIds = /* @__PURE__ */ new Set();
|
|
28691
29312
|
let currentModel = null;
|
|
28692
29313
|
for (const candidate of value.availableModels) {
|
|
28693
|
-
if (!isRecord4(candidate) || !nonBlank(candidate.
|
|
29314
|
+
if (!isRecord4(candidate) || !nonBlank(candidate.name))
|
|
28694
29315
|
continue;
|
|
28695
|
-
|
|
29316
|
+
const ref = harnessModelRefSchema.safeParse({ id: candidate.modelId });
|
|
29317
|
+
if (!ref.success || seenNativeModelIds.has(ref.data.id))
|
|
28696
29318
|
continue;
|
|
28697
|
-
|
|
28698
|
-
const ref = harnessModelRefSchema.safeParse({ id: refId });
|
|
28699
|
-
if (!ref.success)
|
|
28700
|
-
continue;
|
|
28701
|
-
takenRefs.add(refId);
|
|
28702
|
-
seenNativeModelIds.add(candidate.modelId);
|
|
28703
|
-
nativeModelIdByRef.set(refId, candidate.modelId);
|
|
29319
|
+
seenNativeModelIds.add(ref.data.id);
|
|
28704
29320
|
const metadata = isRecord4(candidate._meta) ? candidate._meta : {};
|
|
28705
29321
|
if (typeof metadata.contextLimit === "number" && Number.isSafeInteger(metadata.contextLimit) && metadata.contextLimit > 0) {
|
|
28706
|
-
contextWindowTokensByModel.set(
|
|
29322
|
+
contextWindowTokensByModel.set(ref.data.id, metadata.contextLimit);
|
|
28707
29323
|
}
|
|
28708
29324
|
const model2 = { ref: ref.data, label: candidate.name };
|
|
28709
29325
|
models.push(model2);
|
|
@@ -28715,7 +29331,6 @@ function parseQwenCodeModelState(value) {
|
|
|
28715
29331
|
return null;
|
|
28716
29332
|
return {
|
|
28717
29333
|
currentModel,
|
|
28718
|
-
nativeModelIdByRef,
|
|
28719
29334
|
contextWindowTokensByModel,
|
|
28720
29335
|
catalog: {
|
|
28721
29336
|
models,
|
|
@@ -28724,9 +29339,6 @@ function parseQwenCodeModelState(value) {
|
|
|
28724
29339
|
}
|
|
28725
29340
|
};
|
|
28726
29341
|
}
|
|
28727
|
-
function nativeModelIdForRef(modelState, model2) {
|
|
28728
|
-
return modelState.nativeModelIdByRef.get(model2.id);
|
|
28729
|
-
}
|
|
28730
29342
|
function stateForQwenCodeModel(modelState, nativeState, model2 = modelState.currentModel, permissionModeId) {
|
|
28731
29343
|
return {
|
|
28732
29344
|
...nativeState,
|
|
@@ -28787,11 +29399,11 @@ function toolCall(part) {
|
|
|
28787
29399
|
const call = isRecord5(part.functionCall) ? part.functionCall : part.tool_use;
|
|
28788
29400
|
if (!isRecord5(call))
|
|
28789
29401
|
return null;
|
|
28790
|
-
const
|
|
29402
|
+
const id2 = typeof call.id === "string" ? call.id : typeof call.callId === "string" ? call.callId : null;
|
|
28791
29403
|
const name = typeof call.name === "string" ? call.name : null;
|
|
28792
|
-
if (!
|
|
29404
|
+
if (!id2 || !name)
|
|
28793
29405
|
return null;
|
|
28794
|
-
return { id, name, input: call.args ?? call.input ?? {} };
|
|
29406
|
+
return { id: id2, name, input: call.args ?? call.input ?? {} };
|
|
28795
29407
|
}
|
|
28796
29408
|
function toolResult(record3) {
|
|
28797
29409
|
const result = isRecord5(record3.toolCallResult) ? record3.toolCallResult : null;
|
|
@@ -28800,14 +29412,14 @@ function toolResult(record3) {
|
|
|
28800
29412
|
const source = result ?? (isRecord5(response) ? response : null);
|
|
28801
29413
|
if (!source)
|
|
28802
29414
|
return null;
|
|
28803
|
-
const
|
|
28804
|
-
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)
|
|
28805
29417
|
return null;
|
|
28806
29418
|
const statuses = [source.status, source.executionStatus].filter((value) => typeof value === "string").map((value) => value.toLowerCase());
|
|
28807
29419
|
const cancelled = statuses.some((value) => value === "cancelled" || value === "canceled");
|
|
28808
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");
|
|
28809
29421
|
return {
|
|
28810
|
-
id,
|
|
29422
|
+
id: id2,
|
|
28811
29423
|
output: source.resultDisplay ?? source.response ?? source.result ?? source.content ?? "",
|
|
28812
29424
|
status: cancelled ? "cancelled" : failed ? "failed" : "succeeded"
|
|
28813
29425
|
};
|
|
@@ -29000,10 +29612,10 @@ async function readQwenCodeHistory(cwd, harnessId, sessionId, knownTurnRefs = []
|
|
|
29000
29612
|
path4.join(projectDir, "archive", `${sessionId}.jsonl`)
|
|
29001
29613
|
];
|
|
29002
29614
|
let lastReadError;
|
|
29003
|
-
for (const
|
|
29615
|
+
for (const filePath2 of paths) {
|
|
29004
29616
|
let content;
|
|
29005
29617
|
try {
|
|
29006
|
-
content = await readFile(
|
|
29618
|
+
content = await readFile(filePath2, "utf8");
|
|
29007
29619
|
} catch (error51) {
|
|
29008
29620
|
lastReadError = error51;
|
|
29009
29621
|
continue;
|
|
@@ -29255,7 +29867,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29255
29867
|
const completion = new Promise((resolve2) => {
|
|
29256
29868
|
resolveCompletion = resolve2;
|
|
29257
29869
|
});
|
|
29258
|
-
const
|
|
29870
|
+
const active2 = {
|
|
29259
29871
|
command,
|
|
29260
29872
|
agent: null,
|
|
29261
29873
|
reasoning: null,
|
|
@@ -29266,14 +29878,13 @@ var QwenCodeHarnessSession = class {
|
|
|
29266
29878
|
completion,
|
|
29267
29879
|
resolveCompletion
|
|
29268
29880
|
};
|
|
29269
|
-
this.#active =
|
|
29881
|
+
this.#active = active2;
|
|
29270
29882
|
this.#event({ type: "turn.started", turnId: command.turnId });
|
|
29271
|
-
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") }));
|
|
29272
29884
|
return { ok: true, value: { turnId: command.turnId } };
|
|
29273
29885
|
}
|
|
29274
29886
|
async #selectModel(command) {
|
|
29275
|
-
|
|
29276
|
-
if (!nativeModelId) {
|
|
29887
|
+
if (!catalogModelForRef(this.#modelState.catalog, command.model)) {
|
|
29277
29888
|
return {
|
|
29278
29889
|
ok: false,
|
|
29279
29890
|
error: {
|
|
@@ -29295,7 +29906,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29295
29906
|
}
|
|
29296
29907
|
this.#configuring = true;
|
|
29297
29908
|
try {
|
|
29298
|
-
await this.#transport.setModel(
|
|
29909
|
+
await this.#transport.setModel(command.model.id);
|
|
29299
29910
|
this.#modelState = { ...this.#modelState, currentModel: command.model };
|
|
29300
29911
|
this.#state = stateForQwenCodeModel(this.#modelState, { nativeRef: nativeRef(this.#transport.sessionId) }, command.model, this.#state.effectivePermissionModeId);
|
|
29301
29912
|
this.#event({ type: "session.state.changed", state: this.#state });
|
|
@@ -29345,17 +29956,17 @@ var QwenCodeHarnessSession = class {
|
|
|
29345
29956
|
}
|
|
29346
29957
|
}
|
|
29347
29958
|
async #cancel(command) {
|
|
29348
|
-
const
|
|
29349
|
-
if (!
|
|
29959
|
+
const active2 = this.#active;
|
|
29960
|
+
if (!active2 || active2.command.turnId !== command.turnId) {
|
|
29350
29961
|
return {
|
|
29351
29962
|
ok: false,
|
|
29352
29963
|
error: invalidState("Qwen Code Turn Cancel must reference the active Turn")
|
|
29353
29964
|
};
|
|
29354
29965
|
}
|
|
29355
|
-
if (
|
|
29966
|
+
if (active2.cancellationRequested)
|
|
29356
29967
|
return { ok: true, value: { cancellationRequested: true } };
|
|
29357
|
-
|
|
29358
|
-
for (const approval of
|
|
29968
|
+
active2.cancellationRequested = true;
|
|
29969
|
+
for (const approval of active2.approvals.values()) {
|
|
29359
29970
|
approval.resolve({ behavior: "deny" });
|
|
29360
29971
|
}
|
|
29361
29972
|
try {
|
|
@@ -29366,9 +29977,9 @@ var QwenCodeHarnessSession = class {
|
|
|
29366
29977
|
}
|
|
29367
29978
|
}
|
|
29368
29979
|
async #respond(command) {
|
|
29369
|
-
const
|
|
29370
|
-
const pending =
|
|
29371
|
-
if (!
|
|
29980
|
+
const active2 = this.#active;
|
|
29981
|
+
const pending = active2?.approvals.get(command.interactionId);
|
|
29982
|
+
if (!active2 || !pending)
|
|
29372
29983
|
return { ok: false, error: invalidState("Qwen Code interaction is not pending") };
|
|
29373
29984
|
if (pending.interaction.type === "question") {
|
|
29374
29985
|
if (command.response.type !== "question")
|
|
@@ -29379,7 +29990,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29379
29990
|
const validation = validateHostQuestionResponse(pending.interaction, command.response);
|
|
29380
29991
|
if (validation)
|
|
29381
29992
|
return { ok: false, error: validation };
|
|
29382
|
-
|
|
29993
|
+
active2.approvals.delete(command.interactionId);
|
|
29383
29994
|
if (command.response.cancelled)
|
|
29384
29995
|
pending.resolve({ behavior: "deny" });
|
|
29385
29996
|
else {
|
|
@@ -29399,7 +30010,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29399
30010
|
return { ok: false, error: validation };
|
|
29400
30011
|
if (command.response.actionId !== "allow" && command.response.actionId !== "deny")
|
|
29401
30012
|
return { ok: false, error: invalidState("Qwen Code Approval action is unavailable") };
|
|
29402
|
-
|
|
30013
|
+
active2.approvals.delete(command.interactionId);
|
|
29403
30014
|
const behavior = command.response.actionId;
|
|
29404
30015
|
pending.resolve({
|
|
29405
30016
|
behavior,
|
|
@@ -29409,20 +30020,20 @@ var QwenCodeHarnessSession = class {
|
|
|
29409
30020
|
this.#event({
|
|
29410
30021
|
type: "interaction.closed",
|
|
29411
30022
|
interactionId: command.interactionId,
|
|
29412
|
-
turnId:
|
|
30023
|
+
turnId: active2.command.turnId,
|
|
29413
30024
|
reason: "responded"
|
|
29414
30025
|
});
|
|
29415
30026
|
return { ok: true, value: { accepted: true } };
|
|
29416
30027
|
}
|
|
29417
|
-
#requestPermission(
|
|
29418
|
-
if (this.#active !==
|
|
30028
|
+
#requestPermission(active2, request) {
|
|
30029
|
+
if (this.#active !== active2 || active2.cancellationRequested)
|
|
29419
30030
|
return Promise.resolve({ behavior: "deny" });
|
|
29420
30031
|
const interactionId = hostInteractionIdSchema.parse(this.#randomUUID());
|
|
29421
30032
|
const questions = request.toolName === "ask_user_question" ? qwenQuestions(request.input) : null;
|
|
29422
30033
|
const interaction = questions ? {
|
|
29423
30034
|
type: "question",
|
|
29424
30035
|
interactionId,
|
|
29425
|
-
turnId:
|
|
30036
|
+
turnId: active2.command.turnId,
|
|
29426
30037
|
...questions.length === 1 && questions[0]?.header ? { title: questions[0].header } : { title: "Qwen Code" },
|
|
29427
30038
|
questions: questions.map((question, index) => ({
|
|
29428
30039
|
id: `question-${index}`,
|
|
@@ -29440,7 +30051,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29440
30051
|
} : {
|
|
29441
30052
|
type: "approval",
|
|
29442
30053
|
interactionId,
|
|
29443
|
-
turnId:
|
|
30054
|
+
turnId: active2.command.turnId,
|
|
29444
30055
|
title: request.toolName,
|
|
29445
30056
|
subject: { type: "nativeAction" },
|
|
29446
30057
|
actions: [
|
|
@@ -29449,66 +30060,66 @@ var QwenCodeHarnessSession = class {
|
|
|
29449
30060
|
]
|
|
29450
30061
|
};
|
|
29451
30062
|
return new Promise((resolve2) => {
|
|
29452
|
-
|
|
30063
|
+
active2.approvals.set(interactionId, { interaction, request, resolve: resolve2 });
|
|
29453
30064
|
this.#channel.emit({ kind: "interaction", interaction });
|
|
29454
30065
|
});
|
|
29455
30066
|
}
|
|
29456
|
-
#handleEvent(
|
|
29457
|
-
if (this.#active !==
|
|
30067
|
+
#handleEvent(active2, event) {
|
|
30068
|
+
if (this.#active !== active2 || this.#phase !== "open")
|
|
29458
30069
|
return;
|
|
29459
30070
|
if (event.type === "usage") {
|
|
29460
30071
|
const usage = usageFromMetadata(event.metadata);
|
|
29461
30072
|
if (usage)
|
|
29462
|
-
this.#publishUsage(usage,
|
|
30073
|
+
this.#publishUsage(usage, active2.command.turnId);
|
|
29463
30074
|
return;
|
|
29464
30075
|
}
|
|
29465
30076
|
if (event.type === "agent.text")
|
|
29466
|
-
this.#appendAgent(
|
|
30077
|
+
this.#appendAgent(active2, event.text);
|
|
29467
30078
|
else if (event.type === "agent.thought")
|
|
29468
|
-
this.#appendReasoning(
|
|
30079
|
+
this.#appendReasoning(active2, event.text);
|
|
29469
30080
|
else if (event.type === "tool.call")
|
|
29470
|
-
this.#startTool(
|
|
30081
|
+
this.#startTool(active2, event);
|
|
29471
30082
|
else if (event.type === "tool.update")
|
|
29472
|
-
this.#updateTool(
|
|
30083
|
+
this.#updateTool(active2, event);
|
|
29473
30084
|
}
|
|
29474
|
-
#appendAgent(
|
|
29475
|
-
if (!
|
|
29476
|
-
this.#completeReasoning(
|
|
29477
|
-
|
|
30085
|
+
#appendAgent(active2, text) {
|
|
30086
|
+
if (!active2.agent) {
|
|
30087
|
+
this.#completeReasoning(active2, { status: "succeeded" });
|
|
30088
|
+
active2.agent = {
|
|
29478
30089
|
type: "agentMessage",
|
|
29479
30090
|
itemId: hostItemIdSchema.parse(this.#randomUUID()),
|
|
29480
30091
|
text: ""
|
|
29481
30092
|
};
|
|
29482
|
-
this.#event({ type: "item.started", turnId:
|
|
30093
|
+
this.#event({ type: "item.started", turnId: active2.command.turnId, item: active2.agent });
|
|
29483
30094
|
}
|
|
29484
|
-
|
|
30095
|
+
active2.agent = { ...active2.agent, text: active2.agent.text + text };
|
|
29485
30096
|
this.#event({
|
|
29486
30097
|
type: "item.updated",
|
|
29487
|
-
turnId:
|
|
29488
|
-
itemId:
|
|
30098
|
+
turnId: active2.command.turnId,
|
|
30099
|
+
itemId: active2.agent.itemId,
|
|
29489
30100
|
update: { type: "text.append", text }
|
|
29490
30101
|
});
|
|
29491
30102
|
}
|
|
29492
|
-
#appendReasoning(
|
|
29493
|
-
if (!
|
|
29494
|
-
|
|
30103
|
+
#appendReasoning(active2, text) {
|
|
30104
|
+
if (!active2.reasoning) {
|
|
30105
|
+
active2.reasoning = {
|
|
29495
30106
|
type: "reasoning",
|
|
29496
30107
|
itemId: hostItemIdSchema.parse(this.#randomUUID()),
|
|
29497
30108
|
text: ""
|
|
29498
30109
|
};
|
|
29499
|
-
this.#event({ type: "item.started", turnId:
|
|
30110
|
+
this.#event({ type: "item.started", turnId: active2.command.turnId, item: active2.reasoning });
|
|
29500
30111
|
}
|
|
29501
|
-
|
|
30112
|
+
active2.reasoning = { ...active2.reasoning, text: active2.reasoning.text + text };
|
|
29502
30113
|
this.#event({
|
|
29503
30114
|
type: "item.updated",
|
|
29504
|
-
turnId:
|
|
29505
|
-
itemId:
|
|
30115
|
+
turnId: active2.command.turnId,
|
|
30116
|
+
itemId: active2.reasoning.itemId,
|
|
29506
30117
|
update: { type: "text.append", text }
|
|
29507
30118
|
});
|
|
29508
30119
|
}
|
|
29509
|
-
#startTool(
|
|
29510
|
-
this.#completeReasoning(
|
|
29511
|
-
this.#completeAgent(
|
|
30120
|
+
#startTool(active2, event) {
|
|
30121
|
+
this.#completeReasoning(active2, { status: "succeeded" });
|
|
30122
|
+
this.#completeAgent(active2, { status: "succeeded" });
|
|
29512
30123
|
let item = startQwenCodeToolItem({
|
|
29513
30124
|
itemId: hostItemIdSchema.parse(this.#randomUUID()),
|
|
29514
30125
|
name: event.name,
|
|
@@ -29520,18 +30131,18 @@ var QwenCodeHarnessSession = class {
|
|
|
29520
30131
|
const projection = projectQwenCodeToolOutput(event.content, event.rawOutput, this.#toolOutputLimit);
|
|
29521
30132
|
if (hasQwenCodeToolProjection(projection))
|
|
29522
30133
|
item = applyQwenCodeToolProjection(item, projection);
|
|
29523
|
-
|
|
30134
|
+
active2.tools.set(event.callId, {
|
|
29524
30135
|
item,
|
|
29525
30136
|
rawInput: event.rawInput,
|
|
29526
30137
|
...event.status ? { status: event.status } : {}
|
|
29527
30138
|
});
|
|
29528
|
-
this.#event({ type: "item.started", turnId:
|
|
30139
|
+
this.#event({ type: "item.started", turnId: active2.command.turnId, item });
|
|
29529
30140
|
if (event.status === "completed" || event.status === "failed") {
|
|
29530
|
-
this.#completeTool(
|
|
30141
|
+
this.#completeTool(active2, event.callId, event.status, event.content, event.rawOutput);
|
|
29531
30142
|
}
|
|
29532
30143
|
}
|
|
29533
|
-
#updateTool(
|
|
29534
|
-
const tool =
|
|
30144
|
+
#updateTool(active2, event) {
|
|
30145
|
+
const tool = active2.tools.get(event.callId);
|
|
29535
30146
|
if (!tool)
|
|
29536
30147
|
return;
|
|
29537
30148
|
if (event.rawInput !== void 0)
|
|
@@ -29547,7 +30158,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29547
30158
|
if (delta.length > 0) {
|
|
29548
30159
|
this.#event({
|
|
29549
30160
|
type: "item.updated",
|
|
29550
|
-
turnId:
|
|
30161
|
+
turnId: active2.command.turnId,
|
|
29551
30162
|
itemId: tool.item.itemId,
|
|
29552
30163
|
update: { type: "output.append", text: delta }
|
|
29553
30164
|
});
|
|
@@ -29556,7 +30167,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29556
30167
|
} else if (tool.item.type === "toolExecution" && projection.output) {
|
|
29557
30168
|
this.#event({
|
|
29558
30169
|
type: "item.updated",
|
|
29559
|
-
turnId:
|
|
30170
|
+
turnId: active2.command.turnId,
|
|
29560
30171
|
itemId: tool.item.itemId,
|
|
29561
30172
|
update: { type: "output.replace", output: projection.output }
|
|
29562
30173
|
});
|
|
@@ -29565,14 +30176,14 @@ var QwenCodeHarnessSession = class {
|
|
|
29565
30176
|
if (event.status)
|
|
29566
30177
|
tool.status = event.status;
|
|
29567
30178
|
if (event.status === "completed" || event.status === "failed") {
|
|
29568
|
-
this.#completeTool(
|
|
30179
|
+
this.#completeTool(active2, event.callId, event.status, event.content, event.rawOutput);
|
|
29569
30180
|
}
|
|
29570
30181
|
}
|
|
29571
|
-
#completeTool(
|
|
29572
|
-
const tool =
|
|
30182
|
+
#completeTool(active2, callId, status, content, rawOutput) {
|
|
30183
|
+
const tool = active2.tools.get(callId);
|
|
29573
30184
|
if (!tool)
|
|
29574
30185
|
return;
|
|
29575
|
-
|
|
30186
|
+
active2.tools.delete(callId);
|
|
29576
30187
|
const projection = projectQwenCodeToolOutput(content, rawOutput, this.#toolOutputLimit);
|
|
29577
30188
|
if (hasQwenCodeToolProjection(projection)) {
|
|
29578
30189
|
tool.item = applyQwenCodeToolProjection(tool.item, projection);
|
|
@@ -29585,45 +30196,45 @@ var QwenCodeHarnessSession = class {
|
|
|
29585
30196
|
retryable: false
|
|
29586
30197
|
}
|
|
29587
30198
|
} : { status: "succeeded" };
|
|
29588
|
-
this.#completeItem(
|
|
30199
|
+
this.#completeItem(active2, tool.item, outcome);
|
|
29589
30200
|
}
|
|
29590
|
-
#completeAgent(
|
|
29591
|
-
const item =
|
|
29592
|
-
|
|
30201
|
+
#completeAgent(active2, outcome) {
|
|
30202
|
+
const item = active2.agent;
|
|
30203
|
+
active2.agent = null;
|
|
29593
30204
|
if (item)
|
|
29594
|
-
this.#completeItem(
|
|
30205
|
+
this.#completeItem(active2, item, outcome);
|
|
29595
30206
|
}
|
|
29596
|
-
#completeReasoning(
|
|
29597
|
-
const item =
|
|
29598
|
-
|
|
30207
|
+
#completeReasoning(active2, outcome) {
|
|
30208
|
+
const item = active2.reasoning;
|
|
30209
|
+
active2.reasoning = null;
|
|
29599
30210
|
if (item)
|
|
29600
|
-
this.#completeItem(
|
|
30211
|
+
this.#completeItem(active2, item, outcome);
|
|
29601
30212
|
}
|
|
29602
|
-
#completeItem(
|
|
30213
|
+
#completeItem(active2, item, outcome) {
|
|
29603
30214
|
const snapshot = { item, outcome };
|
|
29604
|
-
|
|
30215
|
+
active2.completedItems.push(snapshot);
|
|
29605
30216
|
this.#event({
|
|
29606
30217
|
type: "item.completed",
|
|
29607
|
-
turnId:
|
|
30218
|
+
turnId: active2.command.turnId,
|
|
29608
30219
|
snapshot
|
|
29609
30220
|
});
|
|
29610
30221
|
}
|
|
29611
|
-
#finish(
|
|
29612
|
-
if (this.#active !==
|
|
30222
|
+
#finish(active2, outcome) {
|
|
30223
|
+
if (this.#active !== active2)
|
|
29613
30224
|
return;
|
|
29614
30225
|
const itemOutcome = outcome;
|
|
29615
|
-
this.#completeReasoning(
|
|
29616
|
-
this.#completeAgent(
|
|
29617
|
-
for (const tool of
|
|
29618
|
-
this.#completeItem(
|
|
29619
|
-
|
|
29620
|
-
for (const [interactionId, pending] of
|
|
29621
|
-
|
|
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);
|
|
29622
30233
|
pending.resolve({ behavior: "deny" });
|
|
29623
30234
|
this.#event({
|
|
29624
30235
|
type: "interaction.closed",
|
|
29625
30236
|
interactionId,
|
|
29626
|
-
turnId:
|
|
30237
|
+
turnId: active2.command.turnId,
|
|
29627
30238
|
reason: "cancelled"
|
|
29628
30239
|
});
|
|
29629
30240
|
}
|
|
@@ -29637,18 +30248,18 @@ var QwenCodeHarnessSession = class {
|
|
|
29637
30248
|
this.#nextTurnOrdinal += 1;
|
|
29638
30249
|
const turn = {
|
|
29639
30250
|
nativeTurnRef,
|
|
29640
|
-
input:
|
|
29641
|
-
items:
|
|
30251
|
+
input: active2.command.input,
|
|
30252
|
+
items: active2.completedItems,
|
|
29642
30253
|
outcome
|
|
29643
30254
|
};
|
|
29644
30255
|
this.#snapshot.turns = [...this.#snapshot.turns, turn];
|
|
29645
30256
|
this.#event({
|
|
29646
30257
|
type: "turn.completed",
|
|
29647
|
-
turnId:
|
|
30258
|
+
turnId: active2.command.turnId,
|
|
29648
30259
|
nativeTurnRef,
|
|
29649
30260
|
outcome
|
|
29650
30261
|
});
|
|
29651
|
-
|
|
30262
|
+
active2.resolveCompletion();
|
|
29652
30263
|
}
|
|
29653
30264
|
#publishUsage(usage, observedForTurnId) {
|
|
29654
30265
|
const merged = combineUsage(this.#usage, usage);
|
|
@@ -29673,10 +30284,10 @@ var QwenCodeHarnessSession = class {
|
|
|
29673
30284
|
if (this.#phase === "closed")
|
|
29674
30285
|
return;
|
|
29675
30286
|
this.#phase = "closing";
|
|
29676
|
-
const
|
|
29677
|
-
if (
|
|
29678
|
-
|
|
29679
|
-
for (const approval of
|
|
30287
|
+
const active2 = this.#active;
|
|
30288
|
+
if (active2) {
|
|
30289
|
+
active2.cancellationRequested = true;
|
|
30290
|
+
for (const approval of active2.approvals.values())
|
|
29680
30291
|
approval.resolve({ behavior: "deny" });
|
|
29681
30292
|
const { promise: deadline, resolve: resolve2 } = Promise.withResolvers();
|
|
29682
30293
|
const timeout = setTimeout(() => resolve2(void 0), this.#closeTimeoutMs);
|
|
@@ -29684,7 +30295,7 @@ var QwenCodeHarnessSession = class {
|
|
|
29684
30295
|
await Promise.race([
|
|
29685
30296
|
(async () => {
|
|
29686
30297
|
await this.#transport.cancel().catch(() => void 0);
|
|
29687
|
-
await
|
|
30298
|
+
await active2.completion;
|
|
29688
30299
|
})(),
|
|
29689
30300
|
deadline
|
|
29690
30301
|
]);
|
|
@@ -29719,11 +30330,13 @@ var QwenCodeHarnessSession = class {
|
|
|
29719
30330
|
}
|
|
29720
30331
|
};
|
|
29721
30332
|
var QwenCodeAdapter = class {
|
|
30333
|
+
normalizeStoredModelRef = normalizeStoredQwenCodeModelRef;
|
|
29722
30334
|
harnessId = qwenCodeHarnessId;
|
|
29723
30335
|
#closeTimeoutMs;
|
|
29724
30336
|
#dependencies;
|
|
29725
30337
|
#environment;
|
|
29726
30338
|
#inspectionCache = /* @__PURE__ */ new Map();
|
|
30339
|
+
#inspectionGeneration = 0;
|
|
29727
30340
|
#sessions = /* @__PURE__ */ new Set();
|
|
29728
30341
|
#toolOutputLimit;
|
|
29729
30342
|
#closePromise = null;
|
|
@@ -29741,11 +30354,14 @@ var QwenCodeAdapter = class {
|
|
|
29741
30354
|
return { status: "unavailable", error: invalidState("Qwen Code Adapter is closed") };
|
|
29742
30355
|
}
|
|
29743
30356
|
const cwd = path5.resolve(input.cwd ?? process.cwd());
|
|
29744
|
-
if (
|
|
29745
|
-
|
|
29746
|
-
|
|
29747
|
-
return cached2;
|
|
30357
|
+
if (input.refresh) {
|
|
30358
|
+
this.#inspectionCache.clear();
|
|
30359
|
+
this.#inspectionGeneration++;
|
|
29748
30360
|
}
|
|
30361
|
+
const cached2 = this.#inspectionCache.get(cwd);
|
|
30362
|
+
if (cached2)
|
|
30363
|
+
return cached2;
|
|
30364
|
+
const generation = this.#inspectionGeneration;
|
|
29749
30365
|
let transport = null;
|
|
29750
30366
|
const startedAt = Date.now();
|
|
29751
30367
|
let stage = "spawn";
|
|
@@ -29768,7 +30384,8 @@ var QwenCodeAdapter = class {
|
|
|
29768
30384
|
permissionModes: QWEN_CODE_PERMISSION_MODE_CATALOG,
|
|
29769
30385
|
capabilities: capabilitiesForModels(modelState)
|
|
29770
30386
|
};
|
|
29771
|
-
this.#
|
|
30387
|
+
if (!this.#closePromise && generation === this.#inspectionGeneration)
|
|
30388
|
+
this.#inspectionCache.set(cwd, ready);
|
|
29772
30389
|
return ready;
|
|
29773
30390
|
} catch (error51) {
|
|
29774
30391
|
await transport?.close().catch(() => void 0);
|
|
@@ -29896,11 +30513,10 @@ var QwenCodeAdapter = class {
|
|
|
29896
30513
|
throw new QwenCodeTransportError("protocolError", "Qwen Code returned an invalid Model catalog");
|
|
29897
30514
|
}
|
|
29898
30515
|
const selectedModel = input.kind === "create" ? input.model ?? modelState.currentModel : modelState.currentModel;
|
|
29899
|
-
|
|
29900
|
-
if (!nativeModelId) {
|
|
30516
|
+
if (!catalogModelForRef(modelState.catalog, selectedModel)) {
|
|
29901
30517
|
throw new QwenCodeTransportError("protocolError", "Requested Qwen Code Model is unavailable");
|
|
29902
30518
|
}
|
|
29903
|
-
await transport.setModel(
|
|
30519
|
+
await transport.setModel(selectedModel.id);
|
|
29904
30520
|
modelState.currentModel = selectedModel;
|
|
29905
30521
|
const history = input.kind === "resume" ? (await readQwenCodeHistory(cwd, this.harnessId, opened.sessionId, input.knownTurnRefs, this.#toolOutputLimit, sessionEnvironment)).turns : [];
|
|
29906
30522
|
const initialUsage = null;
|