@codexhost/cli-darwin-x64 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
|
@@ -2131,7 +2131,7 @@ var require_extension = __commonJS({
|
|
|
2131
2131
|
let mustUnescape = false;
|
|
2132
2132
|
let isEscaping = false;
|
|
2133
2133
|
let inQuotes = false;
|
|
2134
|
-
let
|
|
2134
|
+
let extensionName2;
|
|
2135
2135
|
let paramName;
|
|
2136
2136
|
let start = -1;
|
|
2137
2137
|
let code = -1;
|
|
@@ -2139,7 +2139,7 @@ var require_extension = __commonJS({
|
|
|
2139
2139
|
let i = 0;
|
|
2140
2140
|
for (; i < header.length; i++) {
|
|
2141
2141
|
code = header.charCodeAt(i);
|
|
2142
|
-
if (
|
|
2142
|
+
if (extensionName2 === void 0) {
|
|
2143
2143
|
if (end === -1 && tokenChars[code] === 1) {
|
|
2144
2144
|
if (start === -1) start = i;
|
|
2145
2145
|
} else if (i !== 0 && (code === 32 || code === 9)) {
|
|
@@ -2154,7 +2154,7 @@ var require_extension = __commonJS({
|
|
|
2154
2154
|
push(offers, name, params);
|
|
2155
2155
|
params = /* @__PURE__ */ Object.create(null);
|
|
2156
2156
|
} else {
|
|
2157
|
-
|
|
2157
|
+
extensionName2 = name;
|
|
2158
2158
|
}
|
|
2159
2159
|
start = end = -1;
|
|
2160
2160
|
} else {
|
|
@@ -2172,9 +2172,9 @@ var require_extension = __commonJS({
|
|
|
2172
2172
|
if (end === -1) end = i;
|
|
2173
2173
|
push(params, header.slice(start, end), true);
|
|
2174
2174
|
if (code === 44) {
|
|
2175
|
-
push(offers,
|
|
2175
|
+
push(offers, extensionName2, params);
|
|
2176
2176
|
params = /* @__PURE__ */ Object.create(null);
|
|
2177
|
-
|
|
2177
|
+
extensionName2 = void 0;
|
|
2178
2178
|
}
|
|
2179
2179
|
start = end = -1;
|
|
2180
2180
|
} else if (code === 61 && start !== -1 && end === -1) {
|
|
@@ -2220,9 +2220,9 @@ var require_extension = __commonJS({
|
|
|
2220
2220
|
}
|
|
2221
2221
|
push(params, paramName, value);
|
|
2222
2222
|
if (code === 44) {
|
|
2223
|
-
push(offers,
|
|
2223
|
+
push(offers, extensionName2, params);
|
|
2224
2224
|
params = /* @__PURE__ */ Object.create(null);
|
|
2225
|
-
|
|
2225
|
+
extensionName2 = void 0;
|
|
2226
2226
|
}
|
|
2227
2227
|
paramName = void 0;
|
|
2228
2228
|
start = end = -1;
|
|
@@ -2236,7 +2236,7 @@ var require_extension = __commonJS({
|
|
|
2236
2236
|
}
|
|
2237
2237
|
if (end === -1) end = i;
|
|
2238
2238
|
const token = header.slice(start, end);
|
|
2239
|
-
if (
|
|
2239
|
+
if (extensionName2 === void 0) {
|
|
2240
2240
|
push(offers, token, params);
|
|
2241
2241
|
} else {
|
|
2242
2242
|
if (paramName === void 0) {
|
|
@@ -2246,7 +2246,7 @@ var require_extension = __commonJS({
|
|
|
2246
2246
|
} else {
|
|
2247
2247
|
push(params, paramName, token);
|
|
2248
2248
|
}
|
|
2249
|
-
push(offers,
|
|
2249
|
+
push(offers, extensionName2, params);
|
|
2250
2250
|
}
|
|
2251
2251
|
return offers;
|
|
2252
2252
|
}
|
|
@@ -3736,10 +3736,10 @@ function executableExtensions(command, platform, environment) {
|
|
|
3736
3736
|
return [""];
|
|
3737
3737
|
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension2) => extension2.trim()).filter(Boolean);
|
|
3738
3738
|
}
|
|
3739
|
-
function isExecutableFile(
|
|
3739
|
+
function isExecutableFile(filePath2, platform) {
|
|
3740
3740
|
try {
|
|
3741
|
-
fs.accessSync(
|
|
3742
|
-
return fs.statSync(
|
|
3741
|
+
fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
3742
|
+
return fs.statSync(filePath2).isFile();
|
|
3743
3743
|
} catch {
|
|
3744
3744
|
return false;
|
|
3745
3745
|
}
|
|
@@ -4191,66 +4191,11 @@ function createHarnessInstaller(environment, source) {
|
|
|
4191
4191
|
};
|
|
4192
4192
|
}
|
|
4193
4193
|
|
|
4194
|
-
// dist/
|
|
4194
|
+
// dist/account-balance.js
|
|
4195
|
+
import { readFile as readFile2, stat } from "node:fs/promises";
|
|
4195
4196
|
import os2 from "node:os";
|
|
4196
4197
|
import path5 from "node:path";
|
|
4197
|
-
import {
|
|
4198
|
-
import { zstdDecompressSync } from "node:zlib";
|
|
4199
|
-
|
|
4200
|
-
// ../../harness-adapter/dist/usage-statistics.js
|
|
4201
|
-
var MAX_SESSION_ID_LENGTH = 512;
|
|
4202
|
-
var MAX_CWD_LENGTH = 4096;
|
|
4203
|
-
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
4204
|
-
function usageSessionTitle(value) {
|
|
4205
|
-
if (typeof value !== "string")
|
|
4206
|
-
return void 0;
|
|
4207
|
-
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
4208
|
-
if (!normalized)
|
|
4209
|
-
return void 0;
|
|
4210
|
-
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
4211
|
-
return normalized;
|
|
4212
|
-
let title = "";
|
|
4213
|
-
for (const character of normalized) {
|
|
4214
|
-
if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
|
|
4215
|
-
break;
|
|
4216
|
-
title += character;
|
|
4217
|
-
}
|
|
4218
|
-
return `${title.trimEnd()}…`;
|
|
4219
|
-
}
|
|
4220
|
-
function sessionIdOk(value) {
|
|
4221
|
-
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
4222
|
-
}
|
|
4223
|
-
function cwdOk(value) {
|
|
4224
|
-
return typeof value === "string" && value.length > 0 && value.length <= MAX_CWD_LENGTH && !value.includes("\0") && (value.startsWith("/") || /^[A-Za-z]:[\\/]/u.test(value) || value.startsWith("\\\\"));
|
|
4225
|
-
}
|
|
4226
|
-
function withUsageSession(entry, session) {
|
|
4227
|
-
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
4228
|
-
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
4229
|
-
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
4230
|
-
if (sessionId === void 0 && cwd === void 0)
|
|
4231
|
-
return entry;
|
|
4232
|
-
return {
|
|
4233
|
-
...entry,
|
|
4234
|
-
...sessionId !== void 0 ? { sessionId } : {},
|
|
4235
|
-
...cwd !== void 0 ? { cwd } : {},
|
|
4236
|
-
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
4237
|
-
};
|
|
4238
|
-
}
|
|
4239
|
-
function usageEntryFromRequest(request, occurredAtMs) {
|
|
4240
|
-
if (!Number.isSafeInteger(occurredAtMs) || occurredAtMs <= 0)
|
|
4241
|
-
return null;
|
|
4242
|
-
return {
|
|
4243
|
-
id: request.requestId,
|
|
4244
|
-
occurredAtMs,
|
|
4245
|
-
...request.model !== void 0 ? { model: request.model } : {},
|
|
4246
|
-
inputTokens: request.inputTokens,
|
|
4247
|
-
...request.cachedInputTokens !== void 0 ? { cachedInputTokens: request.cachedInputTokens } : {},
|
|
4248
|
-
...request.cacheWriteInputTokens !== void 0 ? { cacheWriteInputTokens: request.cacheWriteInputTokens } : {},
|
|
4249
|
-
...request.cacheWrite1hInputTokens !== void 0 ? { cacheWrite1hInputTokens: request.cacheWrite1hInputTokens } : {},
|
|
4250
|
-
outputTokens: request.outputTokens,
|
|
4251
|
-
...request.reasoningOutputTokens !== void 0 ? { reasoningOutputTokens: request.reasoningOutputTokens } : {}
|
|
4252
|
-
};
|
|
4253
|
-
}
|
|
4198
|
+
import { parseEnv } from "node:util";
|
|
4254
4199
|
|
|
4255
4200
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
4256
4201
|
var external_exports = {};
|
|
@@ -5018,10 +4963,10 @@ function mergeDefs(...defs) {
|
|
|
5018
4963
|
function cloneDef(schema) {
|
|
5019
4964
|
return mergeDefs(schema._zod.def);
|
|
5020
4965
|
}
|
|
5021
|
-
function getElementAtPath(obj,
|
|
5022
|
-
if (!
|
|
4966
|
+
function getElementAtPath(obj, path12) {
|
|
4967
|
+
if (!path12)
|
|
5023
4968
|
return obj;
|
|
5024
|
-
return
|
|
4969
|
+
return path12.reduce((acc, key) => acc?.[key], obj);
|
|
5025
4970
|
}
|
|
5026
4971
|
function promiseAllObject(promisesObj) {
|
|
5027
4972
|
const keys = Object.keys(promisesObj);
|
|
@@ -5430,11 +5375,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
5430
5375
|
}
|
|
5431
5376
|
return false;
|
|
5432
5377
|
}
|
|
5433
|
-
function prefixIssues(
|
|
5378
|
+
function prefixIssues(path12, issues) {
|
|
5434
5379
|
return issues.map((iss) => {
|
|
5435
5380
|
var _a3;
|
|
5436
5381
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
5437
|
-
iss.path.unshift(
|
|
5382
|
+
iss.path.unshift(path12);
|
|
5438
5383
|
return iss;
|
|
5439
5384
|
});
|
|
5440
5385
|
}
|
|
@@ -5505,8 +5450,8 @@ function cleanEnum(obj) {
|
|
|
5505
5450
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
5506
5451
|
}).map((el) => el[1]);
|
|
5507
5452
|
}
|
|
5508
|
-
function base64ToUint8Array(
|
|
5509
|
-
const binaryString = atob(
|
|
5453
|
+
function base64ToUint8Array(base644) {
|
|
5454
|
+
const binaryString = atob(base644);
|
|
5510
5455
|
const bytes = new Uint8Array(binaryString.length);
|
|
5511
5456
|
for (let i = 0; i < binaryString.length; i++) {
|
|
5512
5457
|
bytes[i] = binaryString.charCodeAt(i);
|
|
@@ -5521,9 +5466,9 @@ function uint8ArrayToBase64(bytes) {
|
|
|
5521
5466
|
return btoa(binaryString);
|
|
5522
5467
|
}
|
|
5523
5468
|
function base64urlToUint8Array(base64url3) {
|
|
5524
|
-
const
|
|
5525
|
-
const padding = "=".repeat((4 -
|
|
5526
|
-
return base64ToUint8Array(
|
|
5469
|
+
const base644 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
|
|
5470
|
+
const padding = "=".repeat((4 - base644.length % 4) % 4);
|
|
5471
|
+
return base64ToUint8Array(base644 + padding);
|
|
5527
5472
|
}
|
|
5528
5473
|
function uint8ArrayToBase64url(bytes) {
|
|
5529
5474
|
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
@@ -5581,16 +5526,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5581
5526
|
}
|
|
5582
5527
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
5583
5528
|
const fieldErrors = { _errors: [] };
|
|
5584
|
-
const processError = (error52,
|
|
5529
|
+
const processError = (error52, path12 = []) => {
|
|
5585
5530
|
for (const issue2 of error52.issues) {
|
|
5586
5531
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5587
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5532
|
+
issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
|
|
5588
5533
|
} else if (issue2.code === "invalid_key") {
|
|
5589
|
-
processError({ issues: issue2.issues }, [...
|
|
5534
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
5590
5535
|
} else if (issue2.code === "invalid_element") {
|
|
5591
|
-
processError({ issues: issue2.issues }, [...
|
|
5536
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
5592
5537
|
} else {
|
|
5593
|
-
const fullpath = [...
|
|
5538
|
+
const fullpath = [...path12, ...issue2.path];
|
|
5594
5539
|
if (fullpath.length === 0) {
|
|
5595
5540
|
fieldErrors._errors.push(mapper(issue2));
|
|
5596
5541
|
} else {
|
|
@@ -5617,17 +5562,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5617
5562
|
}
|
|
5618
5563
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
5619
5564
|
const result = { errors: [] };
|
|
5620
|
-
const processError = (error52,
|
|
5565
|
+
const processError = (error52, path12 = []) => {
|
|
5621
5566
|
var _a3, _b;
|
|
5622
5567
|
for (const issue2 of error52.issues) {
|
|
5623
5568
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5624
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5569
|
+
issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
|
|
5625
5570
|
} else if (issue2.code === "invalid_key") {
|
|
5626
|
-
processError({ issues: issue2.issues }, [...
|
|
5571
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
5627
5572
|
} else if (issue2.code === "invalid_element") {
|
|
5628
|
-
processError({ issues: issue2.issues }, [...
|
|
5573
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
5629
5574
|
} else {
|
|
5630
|
-
const fullpath = [...
|
|
5575
|
+
const fullpath = [...path12, ...issue2.path];
|
|
5631
5576
|
if (fullpath.length === 0) {
|
|
5632
5577
|
result.errors.push(mapper(issue2));
|
|
5633
5578
|
continue;
|
|
@@ -5659,8 +5604,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5659
5604
|
}
|
|
5660
5605
|
function toDotPath(_path) {
|
|
5661
5606
|
const segs = [];
|
|
5662
|
-
const
|
|
5663
|
-
for (const seg of
|
|
5607
|
+
const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
5608
|
+
for (const seg of path12) {
|
|
5664
5609
|
if (typeof seg === "number")
|
|
5665
5610
|
segs.push(`[${seg}]`);
|
|
5666
5611
|
else if (typeof seg === "symbol")
|
|
@@ -6889,8 +6834,8 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
6889
6834
|
function isValidBase64URL(data) {
|
|
6890
6835
|
if (!base64url.test(data))
|
|
6891
6836
|
return false;
|
|
6892
|
-
const
|
|
6893
|
-
const padded =
|
|
6837
|
+
const base644 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
6838
|
+
const padded = base644.padEnd(Math.ceil(base644.length / 4) * 4, "=");
|
|
6894
6839
|
return isValidBase64(padded);
|
|
6895
6840
|
}
|
|
6896
6841
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
@@ -7344,42 +7289,42 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
7344
7289
|
}
|
|
7345
7290
|
doc.write(`const newResult = {};`);
|
|
7346
7291
|
for (const key of normalized.keys) {
|
|
7347
|
-
const
|
|
7292
|
+
const id2 = ids[key];
|
|
7348
7293
|
const k = esc(key);
|
|
7349
7294
|
const schema = shape[key];
|
|
7350
7295
|
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
7351
7296
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
7352
|
-
doc.write(`const ${
|
|
7297
|
+
doc.write(`const ${id2} = ${parseStr(key)};`);
|
|
7353
7298
|
if (isOptionalIn && isOptionalOut) {
|
|
7354
7299
|
doc.write(`
|
|
7355
|
-
if (${
|
|
7300
|
+
if (${id2}.issues.length) {
|
|
7356
7301
|
if (${k} in input) {
|
|
7357
|
-
payload.issues = payload.issues.concat(${
|
|
7302
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
7358
7303
|
...iss,
|
|
7359
7304
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
7360
7305
|
})));
|
|
7361
7306
|
}
|
|
7362
7307
|
}
|
|
7363
7308
|
|
|
7364
|
-
if (${
|
|
7309
|
+
if (${id2}.value === undefined) {
|
|
7365
7310
|
if (${k} in input) {
|
|
7366
7311
|
newResult[${k}] = undefined;
|
|
7367
7312
|
}
|
|
7368
7313
|
} else {
|
|
7369
|
-
newResult[${k}] = ${
|
|
7314
|
+
newResult[${k}] = ${id2}.value;
|
|
7370
7315
|
}
|
|
7371
7316
|
|
|
7372
7317
|
`);
|
|
7373
7318
|
} else if (!isOptionalIn) {
|
|
7374
7319
|
doc.write(`
|
|
7375
|
-
const ${
|
|
7376
|
-
if (${
|
|
7377
|
-
payload.issues = payload.issues.concat(${
|
|
7320
|
+
const ${id2}_present = ${k} in input;
|
|
7321
|
+
if (${id2}.issues.length) {
|
|
7322
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
7378
7323
|
...iss,
|
|
7379
7324
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
7380
7325
|
})));
|
|
7381
7326
|
}
|
|
7382
|
-
if (!${
|
|
7327
|
+
if (!${id2}_present && !${id2}.issues.length) {
|
|
7383
7328
|
payload.issues.push({
|
|
7384
7329
|
code: "invalid_type",
|
|
7385
7330
|
expected: "nonoptional",
|
|
@@ -7388,30 +7333,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
7388
7333
|
});
|
|
7389
7334
|
}
|
|
7390
7335
|
|
|
7391
|
-
if (${
|
|
7392
|
-
if (${
|
|
7336
|
+
if (${id2}_present) {
|
|
7337
|
+
if (${id2}.value === undefined) {
|
|
7393
7338
|
newResult[${k}] = undefined;
|
|
7394
7339
|
} else {
|
|
7395
|
-
newResult[${k}] = ${
|
|
7340
|
+
newResult[${k}] = ${id2}.value;
|
|
7396
7341
|
}
|
|
7397
7342
|
}
|
|
7398
7343
|
|
|
7399
7344
|
`);
|
|
7400
7345
|
} else {
|
|
7401
7346
|
doc.write(`
|
|
7402
|
-
if (${
|
|
7403
|
-
payload.issues = payload.issues.concat(${
|
|
7347
|
+
if (${id2}.issues.length) {
|
|
7348
|
+
payload.issues = payload.issues.concat(${id2}.issues.map(iss => ({
|
|
7404
7349
|
...iss,
|
|
7405
7350
|
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
7406
7351
|
})));
|
|
7407
7352
|
}
|
|
7408
7353
|
|
|
7409
|
-
if (${
|
|
7354
|
+
if (${id2}.value === undefined) {
|
|
7410
7355
|
if (${k} in input) {
|
|
7411
7356
|
newResult[${k}] = undefined;
|
|
7412
7357
|
}
|
|
7413
7358
|
} else {
|
|
7414
|
-
newResult[${k}] = ${
|
|
7359
|
+
newResult[${k}] = ${id2}.value;
|
|
7415
7360
|
}
|
|
7416
7361
|
|
|
7417
7362
|
`);
|
|
@@ -15743,26 +15688,26 @@ function extractDefs(ctx, schema) {
|
|
|
15743
15688
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
15744
15689
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
15745
15690
|
for (const entry of ctx.seen.entries()) {
|
|
15746
|
-
const
|
|
15747
|
-
if (
|
|
15748
|
-
const existing = idToSchema.get(
|
|
15691
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
15692
|
+
if (id2) {
|
|
15693
|
+
const existing = idToSchema.get(id2);
|
|
15749
15694
|
if (existing && existing !== entry[0]) {
|
|
15750
|
-
throw new Error(`Duplicate schema id "${
|
|
15695
|
+
throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
15751
15696
|
}
|
|
15752
|
-
idToSchema.set(
|
|
15697
|
+
idToSchema.set(id2, entry[0]);
|
|
15753
15698
|
}
|
|
15754
15699
|
}
|
|
15755
15700
|
const makeURI = (entry) => {
|
|
15756
15701
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
15757
15702
|
if (ctx.external) {
|
|
15758
15703
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
15759
|
-
const uriGenerator = ctx.external.uri ?? ((
|
|
15704
|
+
const uriGenerator = ctx.external.uri ?? ((id3) => id3);
|
|
15760
15705
|
if (externalId) {
|
|
15761
15706
|
return { ref: uriGenerator(externalId) };
|
|
15762
15707
|
}
|
|
15763
|
-
const
|
|
15764
|
-
entry[1].defId =
|
|
15765
|
-
return { defId:
|
|
15708
|
+
const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
15709
|
+
entry[1].defId = id2;
|
|
15710
|
+
return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id2}` };
|
|
15766
15711
|
}
|
|
15767
15712
|
if (entry[1] === root) {
|
|
15768
15713
|
return { ref: "#" };
|
|
@@ -15810,8 +15755,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15810
15755
|
continue;
|
|
15811
15756
|
}
|
|
15812
15757
|
}
|
|
15813
|
-
const
|
|
15814
|
-
if (
|
|
15758
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
15759
|
+
if (id2) {
|
|
15815
15760
|
extractToDef(entry);
|
|
15816
15761
|
continue;
|
|
15817
15762
|
}
|
|
@@ -15907,10 +15852,10 @@ function finalize(ctx, schema) {
|
|
|
15907
15852
|
} else {
|
|
15908
15853
|
}
|
|
15909
15854
|
if (ctx.external?.uri) {
|
|
15910
|
-
const
|
|
15911
|
-
if (!
|
|
15855
|
+
const id2 = ctx.external.registry.get(schema)?.id;
|
|
15856
|
+
if (!id2)
|
|
15912
15857
|
throw new Error("Schema is missing an `id` property");
|
|
15913
|
-
result.$id = ctx.external.uri(
|
|
15858
|
+
result.$id = ctx.external.uri(id2);
|
|
15914
15859
|
}
|
|
15915
15860
|
Object.assign(result, root.def ?? root.schema);
|
|
15916
15861
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
@@ -16070,9 +16015,9 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
16070
16015
|
json2.type = "number";
|
|
16071
16016
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
16072
16017
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
16073
|
-
const
|
|
16018
|
+
const legacy2 = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
16074
16019
|
if (exMin) {
|
|
16075
|
-
if (
|
|
16020
|
+
if (legacy2) {
|
|
16076
16021
|
json2.minimum = exclusiveMinimum;
|
|
16077
16022
|
json2.exclusiveMinimum = true;
|
|
16078
16023
|
} else {
|
|
@@ -16082,7 +16027,7 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
16082
16027
|
json2.minimum = minimum;
|
|
16083
16028
|
}
|
|
16084
16029
|
if (exMax) {
|
|
16085
|
-
if (
|
|
16030
|
+
if (legacy2) {
|
|
16086
16031
|
json2.maximum = exclusiveMaximum;
|
|
16087
16032
|
json2.exclusiveMaximum = true;
|
|
16088
16033
|
} else {
|
|
@@ -16944,7 +16889,7 @@ var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
16944
16889
|
|
|
16945
16890
|
// ../../../node_modules/zod/v4/classic/schemas.js
|
|
16946
16891
|
var _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
16947
|
-
function _installLazyMethods(inst, group,
|
|
16892
|
+
function _installLazyMethods(inst, group, methods2) {
|
|
16948
16893
|
const proto = Object.getPrototypeOf(inst);
|
|
16949
16894
|
let installed = _installedGroups.get(proto);
|
|
16950
16895
|
if (!installed) {
|
|
@@ -16954,8 +16899,8 @@ function _installLazyMethods(inst, group, methods) {
|
|
|
16954
16899
|
if (installed.has(group))
|
|
16955
16900
|
return;
|
|
16956
16901
|
installed.add(group);
|
|
16957
|
-
for (const key in
|
|
16958
|
-
const fn =
|
|
16902
|
+
for (const key in methods2) {
|
|
16903
|
+
const fn = methods2[key];
|
|
16959
16904
|
Object.defineProperty(proto, key, {
|
|
16960
16905
|
configurable: true,
|
|
16961
16906
|
enumerable: false,
|
|
@@ -18352,13 +18297,13 @@ function resolveRef(ref, ctx) {
|
|
|
18352
18297
|
if (!ref.startsWith("#")) {
|
|
18353
18298
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
18354
18299
|
}
|
|
18355
|
-
const
|
|
18356
|
-
if (
|
|
18300
|
+
const path12 = ref.slice(1).split("/").filter(Boolean);
|
|
18301
|
+
if (path12.length === 0) {
|
|
18357
18302
|
return ctx.rootSchema;
|
|
18358
18303
|
}
|
|
18359
18304
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
18360
|
-
if (
|
|
18361
|
-
const key =
|
|
18305
|
+
if (path12[0] === defsKey) {
|
|
18306
|
+
const key = path12[1];
|
|
18362
18307
|
if (!key || !ctx.defs[key]) {
|
|
18363
18308
|
throw new Error(`Reference not found: ${ref}`);
|
|
18364
18309
|
}
|
|
@@ -18899,6 +18844,9 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
|
18899
18844
|
permissionModeId: harnessPermissionModeIdSchema
|
|
18900
18845
|
}).strict();
|
|
18901
18846
|
|
|
18847
|
+
// ../../shared-contracts/dist/harness-route-limit.js
|
|
18848
|
+
var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
|
|
18849
|
+
|
|
18902
18850
|
// ../../shared-contracts/dist/thread-usage.js
|
|
18903
18851
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
18904
18852
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -18931,7 +18879,7 @@ var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
|
18931
18879
|
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
18932
18880
|
label: indicatorTextSchema(256).optional(),
|
|
18933
18881
|
tooltip: indicatorTextSchema(1024).optional()
|
|
18934
|
-
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) =>
|
|
18882
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
|
|
18935
18883
|
message: "Composer indicator IDs must be unique"
|
|
18936
18884
|
});
|
|
18937
18885
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
@@ -18957,6 +18905,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
18957
18905
|
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
18958
18906
|
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
18959
18907
|
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
18908
|
+
latestRequestTimeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
18960
18909
|
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
18961
18910
|
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
18962
18911
|
}).strict().superRefine((usage, context) => {
|
|
@@ -19054,6 +19003,13 @@ var accountCreditsSnapshotSchema = external_exports.object({
|
|
|
19054
19003
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
19055
19004
|
resetCredits: accountResetCreditsSchema.optional()
|
|
19056
19005
|
}).strict();
|
|
19006
|
+
var accountBalanceSnapshotSchema = external_exports.object({
|
|
19007
|
+
amount: external_exports.number().finite().nonnegative(),
|
|
19008
|
+
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
19009
|
+
currency: external_exports.string().trim().min(1).max(8),
|
|
19010
|
+
/** Native label when the Harness exposes several Billing Sources. */
|
|
19011
|
+
label: external_exports.string().trim().min(1).max(128).optional()
|
|
19012
|
+
}).strict();
|
|
19057
19013
|
var threadUsageInspectionParamsSchema = external_exports.object({
|
|
19058
19014
|
threadId: hostThreadIdSchema,
|
|
19059
19015
|
refresh: external_exports.literal("exact").optional()
|
|
@@ -19062,7 +19018,10 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
19062
19018
|
threadId: hostThreadIdSchema,
|
|
19063
19019
|
usage: threadUsageSnapshotSchema.nullable(),
|
|
19064
19020
|
accountCredits: accountCreditsSnapshotSchema.optional(),
|
|
19065
|
-
/**
|
|
19021
|
+
/** Prepaid funds for the Thread's Billing Source; shown only when no percentage quota exists. */
|
|
19022
|
+
accountBalance: accountBalanceSnapshotSchema.optional(),
|
|
19023
|
+
/** Whether this source can provide cached account quota (credits or a prepaid balance)
|
|
19024
|
+
* independently of usage. */
|
|
19066
19025
|
accountCreditsSupported: external_exports.boolean().optional()
|
|
19067
19026
|
}).strict();
|
|
19068
19027
|
|
|
@@ -19074,10 +19033,15 @@ var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
|
19074
19033
|
var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
19075
19034
|
message: "Value must not be empty or whitespace"
|
|
19076
19035
|
});
|
|
19077
|
-
var harnessModelRefIdSchema =
|
|
19036
|
+
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();
|
|
19037
|
+
var harnessModelServiceTierSchema = external_exports.enum(["priority", "ultrafast"]);
|
|
19078
19038
|
var harnessModelRefSchema = external_exports.object({
|
|
19079
|
-
id: harnessModelRefIdSchema
|
|
19039
|
+
id: harnessModelRefIdSchema,
|
|
19040
|
+
serviceTier: harnessModelServiceTierSchema.optional()
|
|
19080
19041
|
}).strict();
|
|
19042
|
+
function sameHarnessModelRef(left, right) {
|
|
19043
|
+
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
19044
|
+
}
|
|
19081
19045
|
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();
|
|
19082
19046
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
19083
19047
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
@@ -19091,7 +19055,15 @@ var harnessModelSchema = external_exports.object({
|
|
|
19091
19055
|
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
19092
19056
|
fastModel: harnessModelRefSchema.optional(),
|
|
19093
19057
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
19094
|
-
}).strict()
|
|
19058
|
+
}).strict().refine((model2) => model2.fastModel?.serviceTier === void 0 || model2.fastModel.id === model2.ref.id, {
|
|
19059
|
+
path: ["fastModel", "id"],
|
|
19060
|
+
message: "A tiered Fast Model must share the base Model ID"
|
|
19061
|
+
});
|
|
19062
|
+
function catalogModelForRef(catalog, ref) {
|
|
19063
|
+
if (!ref)
|
|
19064
|
+
return void 0;
|
|
19065
|
+
return catalog?.models.find((model2) => sameHarnessModelRef(model2.ref, ref) || sameHarnessModelRef(model2.fastModel, ref));
|
|
19066
|
+
}
|
|
19095
19067
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
19096
19068
|
const ids = /* @__PURE__ */ new Set();
|
|
19097
19069
|
for (const [index, option] of options.entries()) {
|
|
@@ -19111,26 +19083,26 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
19111
19083
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
19112
19084
|
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
19113
19085
|
}).strict().superRefine((catalog, context) => {
|
|
19114
|
-
const refs =
|
|
19115
|
-
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) =>
|
|
19086
|
+
const refs = [];
|
|
19087
|
+
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
|
|
19116
19088
|
for (const [index, model2] of catalog.models.entries()) {
|
|
19117
|
-
if (refs.
|
|
19089
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.ref))) {
|
|
19118
19090
|
context.addIssue({
|
|
19119
19091
|
code: "custom",
|
|
19120
19092
|
message: "Model Catalog refs must be unique",
|
|
19121
19093
|
path: ["models", index, "ref", "id"]
|
|
19122
19094
|
});
|
|
19123
19095
|
}
|
|
19124
|
-
refs.
|
|
19096
|
+
refs.push(model2.ref);
|
|
19125
19097
|
if (model2.fastModel) {
|
|
19126
|
-
if (refs.
|
|
19098
|
+
if (refs.some((ref) => sameHarnessModelRef(ref, model2.fastModel))) {
|
|
19127
19099
|
context.addIssue({
|
|
19128
19100
|
code: "custom",
|
|
19129
19101
|
message: "Fast Model refs must be distinct and unique",
|
|
19130
19102
|
path: ["models", index, "fastModel"]
|
|
19131
19103
|
});
|
|
19132
19104
|
}
|
|
19133
|
-
refs.
|
|
19105
|
+
refs.push(model2.fastModel);
|
|
19134
19106
|
}
|
|
19135
19107
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
19136
19108
|
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
@@ -19151,7 +19123,7 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
19151
19123
|
}
|
|
19152
19124
|
}
|
|
19153
19125
|
}
|
|
19154
|
-
if (catalog.defaultModel && !
|
|
19126
|
+
if (catalog.defaultModel && !catalogModelForRef(catalog, catalog.defaultModel)) {
|
|
19155
19127
|
context.addIssue({
|
|
19156
19128
|
code: "custom",
|
|
19157
19129
|
message: "Default Model must exist in the Model Catalog",
|
|
@@ -19191,7 +19163,12 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
19191
19163
|
observe: external_exports.boolean()
|
|
19192
19164
|
}).strict().optional(),
|
|
19193
19165
|
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
19194
|
-
steer: external_exports.boolean().optional()
|
|
19166
|
+
steer: external_exports.boolean().optional(),
|
|
19167
|
+
/**
|
|
19168
|
+
* True when the native plan (task list) outlives the Turn that changed it, so a reopened
|
|
19169
|
+
* Thread gets its latest plan again. Otherwise a plan stays with the Turn that made it.
|
|
19170
|
+
*/
|
|
19171
|
+
persistentPlan: external_exports.boolean().optional()
|
|
19195
19172
|
}).strict();
|
|
19196
19173
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
19197
19174
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -19200,7 +19177,7 @@ var harnessConfigurationStateSchema = external_exports.object({
|
|
|
19200
19177
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
19201
19178
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
19202
19179
|
}).strict().superRefine((state, context) => {
|
|
19203
|
-
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) =>
|
|
19180
|
+
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id: id2 }) => id2 === state.effectiveThinkingOptionId)) {
|
|
19204
19181
|
context.addIssue({
|
|
19205
19182
|
code: "custom",
|
|
19206
19183
|
message: "Effective Thinking option must be currently available",
|
|
@@ -19240,7 +19217,8 @@ var harnessInspectParamsSchema = external_exports.object({
|
|
|
19240
19217
|
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
19241
19218
|
refresh: external_exports.boolean().optional(),
|
|
19242
19219
|
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
19243
|
-
purpose: external_exports.literal("availability").optional()
|
|
19220
|
+
purpose: external_exports.literal("availability").optional(),
|
|
19221
|
+
credentialAccess: external_exports.enum(["allow", "retry"]).optional()
|
|
19244
19222
|
}).strict();
|
|
19245
19223
|
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
19246
19224
|
harnessId: harnessIdSchema
|
|
@@ -19271,7 +19249,7 @@ var codexThreadInspectionSchema = external_exports.object({
|
|
|
19271
19249
|
var externalThreadInspectionSchema = external_exports.object({
|
|
19272
19250
|
owner: external_exports.literal("external"),
|
|
19273
19251
|
harnessId: nonBlankTextSchema2.max(256),
|
|
19274
|
-
transportModelId: nonBlankTextSchema2.max(
|
|
19252
|
+
transportModelId: nonBlankTextSchema2.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
|
|
19275
19253
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
19276
19254
|
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
19277
19255
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -19353,13 +19331,635 @@ var threadSteeringInspectResultSchema = external_exports.object({
|
|
|
19353
19331
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
19354
19332
|
}).strict();
|
|
19355
19333
|
|
|
19334
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
19335
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
19336
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
19337
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
19338
|
+
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
19339
|
+
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
19340
|
+
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id2) => id2 !== "codex", "The official Codex identity is reserved");
|
|
19341
|
+
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");
|
|
19342
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
19343
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
19344
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
19345
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
19346
|
+
before: localizedTextSchema.optional(),
|
|
19347
|
+
after: localizedTextSchema.optional(),
|
|
19348
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
19349
|
+
}).strict();
|
|
19350
|
+
var pluginPresentationShape = {
|
|
19351
|
+
id: installedHarnessPluginIdSchema,
|
|
19352
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
19353
|
+
version: external_exports.string().min(1).max(128),
|
|
19354
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
19355
|
+
kind: external_exports.literal("usage").optional(),
|
|
19356
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
19357
|
+
iconStyle: external_exports.object({
|
|
19358
|
+
vector: external_exports.object({
|
|
19359
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
19360
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
19361
|
+
paths: external_exports.array(external_exports.object({
|
|
19362
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
19363
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
19364
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
19365
|
+
}).strict()).min(1).max(32)
|
|
19366
|
+
}).strict().optional(),
|
|
19367
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
19368
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
19369
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
19370
|
+
}).strict().optional(),
|
|
19371
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
19372
|
+
notice: localizedTextSchema.optional(),
|
|
19373
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
19374
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
19375
|
+
links: external_exports.object({
|
|
19376
|
+
website: documentationUrlSchema.optional(),
|
|
19377
|
+
documentation: documentationUrlSchema.optional(),
|
|
19378
|
+
installation: documentationUrlSchema.optional()
|
|
19379
|
+
}).strict().optional()
|
|
19380
|
+
};
|
|
19381
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
19382
|
+
manifestVersion: external_exports.literal(1),
|
|
19383
|
+
...pluginPresentationShape,
|
|
19384
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
19385
|
+
entry: pluginRelativeResourceSchema,
|
|
19386
|
+
icon: pluginRelativeResourceSchema.optional()
|
|
19387
|
+
}).strict();
|
|
19388
|
+
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);
|
|
19389
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
19390
|
+
...pluginPresentationShape,
|
|
19391
|
+
icon: harnessPluginIconSchema.optional()
|
|
19392
|
+
}).strict();
|
|
19393
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
19394
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
19395
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
19396
|
+
}).strict();
|
|
19397
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
19398
|
+
version: external_exports.literal(1),
|
|
19399
|
+
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
19400
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
19401
|
+
message: "Enabled plugin IDs must be unique",
|
|
19402
|
+
path: ["enabled"]
|
|
19403
|
+
});
|
|
19404
|
+
|
|
19405
|
+
// ../../shared-contracts/dist/desktop-extensions.js
|
|
19406
|
+
var DESKTOP_EXTENSION_API_VERSION = 1;
|
|
19407
|
+
var DESKTOP_EXTENSION_LIMIT = 64;
|
|
19408
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
|
|
19409
|
+
var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
|
|
19410
|
+
var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
|
|
19411
|
+
var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
|
|
19412
|
+
var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
|
|
19413
|
+
var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
|
|
19414
|
+
var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
|
|
19415
|
+
var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
|
|
19416
|
+
var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
19417
|
+
var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
|
|
19418
|
+
var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
|
|
19419
|
+
var desktopExtensionIdSchema = installedPluginIdSchema;
|
|
19420
|
+
var desktopExtensionSlotSchema = external_exports.enum([
|
|
19421
|
+
"sidebar.thread-layout",
|
|
19422
|
+
"sidebar.thread-badge",
|
|
19423
|
+
"appearance.theme"
|
|
19424
|
+
]);
|
|
19425
|
+
var desktopExtensionCategorySchema = external_exports.enum([
|
|
19426
|
+
"appearance",
|
|
19427
|
+
"interface",
|
|
19428
|
+
"workflow",
|
|
19429
|
+
"analytics",
|
|
19430
|
+
"integrations",
|
|
19431
|
+
"tools"
|
|
19432
|
+
]);
|
|
19433
|
+
var extensionName = external_exports.string().trim().min(1).max(128);
|
|
19434
|
+
function desktopExtensionScreenshotMimeType(resource) {
|
|
19435
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
19436
|
+
case "png":
|
|
19437
|
+
return "image/png";
|
|
19438
|
+
case "jpg":
|
|
19439
|
+
case "jpeg":
|
|
19440
|
+
return "image/jpeg";
|
|
19441
|
+
case "webp":
|
|
19442
|
+
return "image/webp";
|
|
19443
|
+
default:
|
|
19444
|
+
return void 0;
|
|
19445
|
+
}
|
|
19446
|
+
}
|
|
19447
|
+
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
19448
|
+
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");
|
|
19449
|
+
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) => {
|
|
19450
|
+
const { username, password } = new URL(value);
|
|
19451
|
+
return !username && !password && !/[\\\s]/u.test(value);
|
|
19452
|
+
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
19453
|
+
function localizedText(text) {
|
|
19454
|
+
return external_exports.strictObject({ en: text, "zh-CN": text });
|
|
19455
|
+
}
|
|
19456
|
+
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
19457
|
+
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
19458
|
+
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
19459
|
+
var settingField = {
|
|
19460
|
+
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
19461
|
+
label: desktopExtensionLocalizedTextSchema,
|
|
19462
|
+
description: desktopExtensionLocalizedTextSchema.optional()
|
|
19463
|
+
};
|
|
19464
|
+
var numericSetting = {
|
|
19465
|
+
...settingField,
|
|
19466
|
+
step: external_exports.number().positive().optional(),
|
|
19467
|
+
default: external_exports.number().optional()
|
|
19468
|
+
};
|
|
19469
|
+
var settingOption = external_exports.strictObject({
|
|
19470
|
+
value: external_exports.string(),
|
|
19471
|
+
label: desktopExtensionLocalizedTextSchema
|
|
19472
|
+
});
|
|
19473
|
+
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
19474
|
+
external_exports.strictObject({
|
|
19475
|
+
...settingField,
|
|
19476
|
+
type: external_exports.literal("boolean"),
|
|
19477
|
+
default: external_exports.boolean().optional()
|
|
19478
|
+
}),
|
|
19479
|
+
external_exports.strictObject({
|
|
19480
|
+
...settingField,
|
|
19481
|
+
type: external_exports.literal("string"),
|
|
19482
|
+
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
19483
|
+
default: external_exports.string().optional()
|
|
19484
|
+
}),
|
|
19485
|
+
external_exports.strictObject({
|
|
19486
|
+
...numericSetting,
|
|
19487
|
+
type: external_exports.literal("number"),
|
|
19488
|
+
min: external_exports.number().optional(),
|
|
19489
|
+
max: external_exports.number().optional()
|
|
19490
|
+
}),
|
|
19491
|
+
external_exports.strictObject({
|
|
19492
|
+
...numericSetting,
|
|
19493
|
+
type: external_exports.literal("range"),
|
|
19494
|
+
min: external_exports.number(),
|
|
19495
|
+
max: external_exports.number()
|
|
19496
|
+
}),
|
|
19497
|
+
external_exports.strictObject({
|
|
19498
|
+
...settingField,
|
|
19499
|
+
type: external_exports.literal("select"),
|
|
19500
|
+
options: external_exports.array(settingOption).min(1),
|
|
19501
|
+
default: external_exports.string().optional()
|
|
19502
|
+
})
|
|
19503
|
+
]).superRefine((field2, ctx) => {
|
|
19504
|
+
const issue2 = (path12, message) => ctx.addIssue({ code: "custom", path: [path12], message });
|
|
19505
|
+
if (field2.type === "number" || field2.type === "range") {
|
|
19506
|
+
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
19507
|
+
if (min > max)
|
|
19508
|
+
issue2("max", "Must be at least min");
|
|
19509
|
+
if (value !== void 0 && (value < min || value > max))
|
|
19510
|
+
issue2("default", "Must be within min and max");
|
|
19511
|
+
} else if (field2.type === "select") {
|
|
19512
|
+
const values = new Set(field2.options.map(({ value }) => value));
|
|
19513
|
+
if (values.size !== field2.options.length)
|
|
19514
|
+
issue2("options", "Duplicate option values");
|
|
19515
|
+
if (field2.default !== void 0 && !values.has(field2.default))
|
|
19516
|
+
issue2("default", "Must match an option value");
|
|
19517
|
+
}
|
|
19518
|
+
});
|
|
19519
|
+
var manifestHeader = external_exports.object({
|
|
19520
|
+
manifestVersion: external_exports.int().positive(),
|
|
19521
|
+
id: desktopExtensionIdSchema,
|
|
19522
|
+
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
19523
|
+
version: external_exports.string().min(1).max(128),
|
|
19524
|
+
desktopApi: external_exports.int().positive()
|
|
19525
|
+
}).passthrough();
|
|
19526
|
+
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
19527
|
+
manifestVersion: external_exports.literal(1),
|
|
19528
|
+
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
19529
|
+
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
19530
|
+
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
19531
|
+
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
19532
|
+
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
19533
|
+
icon: imagePathSchema.optional(),
|
|
19534
|
+
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
19535
|
+
desktop: external_exports.strictObject({
|
|
19536
|
+
script: pluginRelativeResourceSchema,
|
|
19537
|
+
style: pluginRelativeResourceSchema.optional()
|
|
19538
|
+
}).optional(),
|
|
19539
|
+
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
19540
|
+
slots: slotsSchema.default(() => []),
|
|
19541
|
+
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
19542
|
+
categories: categoriesSchema.optional()
|
|
19543
|
+
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
19544
|
+
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
19545
|
+
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
19546
|
+
state: external_exports.enum([
|
|
19547
|
+
"running",
|
|
19548
|
+
"disabled",
|
|
19549
|
+
"invalid",
|
|
19550
|
+
"incompatible",
|
|
19551
|
+
"conflict",
|
|
19552
|
+
"failed",
|
|
19553
|
+
"waiting"
|
|
19554
|
+
]),
|
|
19555
|
+
hash: desktopExtensionHashSchema.optional(),
|
|
19556
|
+
error: external_exports.string().optional(),
|
|
19557
|
+
conflictWith: desktopExtensionIdSchema.optional()
|
|
19558
|
+
});
|
|
19559
|
+
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
19560
|
+
controllerPid: external_exports.int().positive(),
|
|
19561
|
+
targetId: external_exports.string().nullable(),
|
|
19562
|
+
updatedAt: external_exports.iso.datetime(),
|
|
19563
|
+
handledReloadToken: external_exports.uuid().optional(),
|
|
19564
|
+
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema),
|
|
19565
|
+
surfaces: external_exports.record(external_exports.string(), desktopExtensionStatusSchema).optional()
|
|
19566
|
+
});
|
|
19567
|
+
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
19568
|
+
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
19569
|
+
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
19570
|
+
}
|
|
19571
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
19572
|
+
const url2 = new URL(input);
|
|
19573
|
+
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);
|
|
19574
|
+
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
19575
|
+
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
19576
|
+
id: desktopExtensionIdSchema,
|
|
19577
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
19578
|
+
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
19579
|
+
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
19580
|
+
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
19581
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
19582
|
+
repository: desktopExtensionHttpUrlSchema,
|
|
19583
|
+
stars: external_exports.number().int().min(0).optional(),
|
|
19584
|
+
downloads: external_exports.number().int().min(0).optional(),
|
|
19585
|
+
categories: categoriesSchema.optional(),
|
|
19586
|
+
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
19587
|
+
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
19588
|
+
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
19589
|
+
downloadUrl: desktopExtensionZipUrlSchema,
|
|
19590
|
+
sha256: desktopExtensionHashSchema,
|
|
19591
|
+
slots: slotsSchema.optional(),
|
|
19592
|
+
publishedAt: external_exports.string().optional(),
|
|
19593
|
+
updatedAt: external_exports.string().optional(),
|
|
19594
|
+
minCodexHostVersion: external_exports.string().optional()
|
|
19595
|
+
});
|
|
19596
|
+
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
19597
|
+
schemaVersion: external_exports.literal(1),
|
|
19598
|
+
generatedAt: external_exports.string(),
|
|
19599
|
+
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
19600
|
+
});
|
|
19601
|
+
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
19602
|
+
|
|
19603
|
+
// ../../shared-contracts/dist/host-extensions.js
|
|
19604
|
+
var reservedName = /^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu;
|
|
19605
|
+
var HOST_EXTENSION_PAGE_API_VERSION = 1;
|
|
19606
|
+
var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedName.test(id2), "Reserved extension ID");
|
|
19607
|
+
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
19608
|
+
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
19609
|
+
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
19610
|
+
var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((path12) => path12.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
19611
|
+
var legacy = desktopExtensionManifestSchema.shape;
|
|
19612
|
+
var localized = (max, min = 0) => external_exports.strictObject({
|
|
19613
|
+
en: external_exports.string().trim().min(min).max(max),
|
|
19614
|
+
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
19615
|
+
});
|
|
19616
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path12) => path12.endsWith(suffix), `Expected a ${suffix} file`);
|
|
19617
|
+
var moduleEntry = resourceWithSuffix(".mjs");
|
|
19618
|
+
var style = resourceWithSuffix(".css").optional();
|
|
19619
|
+
var hostExtensionCanonicalPath = (path12) => path12.normalize("NFC").toLowerCase();
|
|
19620
|
+
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
19621
|
+
manifestVersion: external_exports.literal(2),
|
|
19622
|
+
id: hostExtensionIdSchema,
|
|
19623
|
+
name: localized(128, 1),
|
|
19624
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
19625
|
+
description: localized(4096),
|
|
19626
|
+
details: localized(16384).optional(),
|
|
19627
|
+
author: legacy.author,
|
|
19628
|
+
repository: legacy.repository,
|
|
19629
|
+
icon: legacy.icon.refine((path12) => path12 === void 0 || hostExtensionResourcePathSchema.safeParse(path12).success),
|
|
19630
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path12) => hostExtensionResourcePathSchema.safeParse(path12).success)),
|
|
19631
|
+
categories: legacy.categories,
|
|
19632
|
+
settingsSchema: legacy.settingsSchema,
|
|
19633
|
+
slots: legacy.slots.removeDefault().optional(),
|
|
19634
|
+
page: external_exports.strictObject({
|
|
19635
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
19636
|
+
entry: moduleEntry,
|
|
19637
|
+
style,
|
|
19638
|
+
title: localized(128, 1).optional()
|
|
19639
|
+
}).optional(),
|
|
19640
|
+
widget: external_exports.strictObject({
|
|
19641
|
+
apiVersion: external_exports.literal(HOST_EXTENSION_PAGE_API_VERSION),
|
|
19642
|
+
entry: moduleEntry,
|
|
19643
|
+
style
|
|
19644
|
+
}).optional(),
|
|
19645
|
+
desktop: external_exports.strictObject({ apiVersion: external_exports.literal(1), script: resourceWithSuffix(".js"), style }).optional(),
|
|
19646
|
+
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(),
|
|
19647
|
+
backend: external_exports.strictObject({ apiVersion: external_exports.literal(1), entry: moduleEntry }).optional()
|
|
19648
|
+
}).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" });
|
|
19649
|
+
function targetsForCapabilities({ hasPage, hasWidget, hasDesktop, hasWeb, hasBackend }) {
|
|
19650
|
+
if (hasPage || hasWidget || hasBackend && !hasDesktop && !hasWeb)
|
|
19651
|
+
return ["desktop", "web"];
|
|
19652
|
+
const targets = [];
|
|
19653
|
+
if (hasDesktop)
|
|
19654
|
+
targets.push("desktop");
|
|
19655
|
+
if (hasWeb)
|
|
19656
|
+
targets.push("web");
|
|
19657
|
+
return targets;
|
|
19658
|
+
}
|
|
19659
|
+
var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
19660
|
+
|
|
19661
|
+
// ../../shared-contracts/dist/host-extension-management.js
|
|
19662
|
+
var HOST_EXTENSION_ZIP_MAX_BYTES = DESKTOP_EXTENSION_ZIP_MAX_BYTES;
|
|
19663
|
+
var hostExtensionRevisionSchema = external_exports.int().nonnegative();
|
|
19664
|
+
var hostExtensionConfigurationSchema = external_exports.strictObject({
|
|
19665
|
+
revision: hostExtensionRevisionSchema,
|
|
19666
|
+
enabled: external_exports.array(hostExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs")
|
|
19667
|
+
});
|
|
19668
|
+
var { downloadUrl, ...catalogMetadata } = desktopExtensionCatalogEntrySchema.shape;
|
|
19669
|
+
var hostExtensionCatalogEntrySchema = external_exports.object({
|
|
19670
|
+
...catalogMetadata,
|
|
19671
|
+
id: hostExtensionIdSchema,
|
|
19672
|
+
format: external_exports.literal("codexhost"),
|
|
19673
|
+
targets: external_exports.array(hostExtensionTargetSchema).min(1).max(2).refine((targets) => new Set(targets).size === targets.length, "Duplicate targets"),
|
|
19674
|
+
apis: external_exports.strictObject({
|
|
19675
|
+
page: external_exports.int().positive().optional(),
|
|
19676
|
+
widget: external_exports.int().positive().optional(),
|
|
19677
|
+
desktop: external_exports.int().positive().optional(),
|
|
19678
|
+
web: external_exports.int().positive().optional(),
|
|
19679
|
+
backend: external_exports.int().positive().optional()
|
|
19680
|
+
}),
|
|
19681
|
+
downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS")
|
|
19682
|
+
}).refine(({ targets, apis }) => {
|
|
19683
|
+
const derived = targetsForCapabilities({
|
|
19684
|
+
hasPage: Boolean(apis.page),
|
|
19685
|
+
hasWidget: Boolean(apis.widget),
|
|
19686
|
+
hasDesktop: Boolean(apis.desktop),
|
|
19687
|
+
hasWeb: Boolean(apis.web),
|
|
19688
|
+
hasBackend: Boolean(apis.backend)
|
|
19689
|
+
});
|
|
19690
|
+
return targets.length === derived.length && derived.every((target2) => targets.includes(target2));
|
|
19691
|
+
}, "Catalog targets must match the declared APIs");
|
|
19692
|
+
var hostExtensionCatalogSchema = external_exports.object({
|
|
19693
|
+
schemaVersion: external_exports.literal(2),
|
|
19694
|
+
generatedAt: external_exports.string().min(1),
|
|
19695
|
+
extensions: external_exports.array(hostExtensionCatalogEntrySchema).max(1e4).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, "Duplicate extension IDs")
|
|
19696
|
+
});
|
|
19697
|
+
var hostExtensionsCatalogResultSchema = hostExtensionCatalogSchema.extend({
|
|
19698
|
+
catalogUrl: desktopExtensionHttpUrlSchema,
|
|
19699
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
19700
|
+
cached: external_exports.boolean()
|
|
19701
|
+
});
|
|
19702
|
+
var id = { id: hostExtensionIdSchema };
|
|
19703
|
+
var active = {
|
|
19704
|
+
...id,
|
|
19705
|
+
activationId: hostExtensionActivationIdSchema,
|
|
19706
|
+
digest: hostExtensionDigestSchema
|
|
19707
|
+
};
|
|
19708
|
+
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
19709
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path12) => /^(?:\/|[a-z]:[/\\])/iu.test(path12) && !path12.includes("\0") && !path12.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
19710
|
+
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");
|
|
19711
|
+
function base643(maxBytes) {
|
|
19712
|
+
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
19713
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
19714
|
+
return value.length % 4 === 0 && value.length * 3 / 4 - padding <= maxBytes && /^[A-Za-z0-9+/]*={0,2}$/u.test(value);
|
|
19715
|
+
}, "Expected bounded standard padded base64");
|
|
19716
|
+
}
|
|
19717
|
+
var hostExtensionGitHubSourceSchema = external_exports.strictObject({
|
|
19718
|
+
type: external_exports.literal("github"),
|
|
19719
|
+
repository: external_exports.string().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),
|
|
19720
|
+
ref: gitRef.optional(),
|
|
19721
|
+
tag: gitRef.optional(),
|
|
19722
|
+
asset: external_exports.string().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),
|
|
19723
|
+
subpath: hostExtensionResourcePathSchema.optional()
|
|
19724
|
+
}).refine(({ ref, tag, asset }) => !ref || !tag && !asset, "Use either a zipball ref or a release tag/asset");
|
|
19725
|
+
var hostExtensionInstallSourceSchema = external_exports.union([
|
|
19726
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
19727
|
+
hostExtensionGitHubSourceSchema,
|
|
19728
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), base64: base643(HOST_EXTENSION_ZIP_MAX_BYTES).min(4) }),
|
|
19729
|
+
external_exports.strictObject({ type: external_exports.literal("zip"), localZipPath: filePath }),
|
|
19730
|
+
external_exports.strictObject({ type: external_exports.literal("localDir"), localDir: filePath })
|
|
19731
|
+
]);
|
|
19732
|
+
var hostExtensionProvenanceSchema = external_exports.discriminatedUnion("type", [
|
|
19733
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), ...id }),
|
|
19734
|
+
hostExtensionGitHubSourceSchema,
|
|
19735
|
+
external_exports.strictObject({ type: external_exports.literal("zip") }),
|
|
19736
|
+
external_exports.strictObject({ type: external_exports.literal("localDir") })
|
|
19737
|
+
]);
|
|
19738
|
+
var hostExtensionInstallationSchema = external_exports.strictObject({
|
|
19739
|
+
...active,
|
|
19740
|
+
manifest: hostExtensionManifestV2Schema,
|
|
19741
|
+
installedAt: external_exports.iso.datetime(),
|
|
19742
|
+
source: hostExtensionProvenanceSchema.optional()
|
|
19743
|
+
});
|
|
19744
|
+
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);
|
|
19745
|
+
var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
|
|
19746
|
+
var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
|
|
19747
|
+
var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
|
|
19748
|
+
hostExtensionInstallationSchema.extend({
|
|
19749
|
+
state: external_exports.literal("valid"),
|
|
19750
|
+
enabled: external_exports.boolean(),
|
|
19751
|
+
...desktopConflict,
|
|
19752
|
+
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
19753
|
+
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
19754
|
+
backendState: backendState.optional(),
|
|
19755
|
+
backendError: external_exports.string().optional()
|
|
19756
|
+
}),
|
|
19757
|
+
external_exports.strictObject({
|
|
19758
|
+
state: external_exports.enum(["invalid", "incompatible"]),
|
|
19759
|
+
id: external_exports.string().min(1),
|
|
19760
|
+
enabled: external_exports.boolean(),
|
|
19761
|
+
error: external_exports.string()
|
|
19762
|
+
})
|
|
19763
|
+
]);
|
|
19764
|
+
var hostExtensionsListResultSchema = external_exports.strictObject({
|
|
19765
|
+
revision: hostExtensionRevisionSchema,
|
|
19766
|
+
configuration: hostExtensionConfigurationSchema,
|
|
19767
|
+
diagnostics: external_exports.array(external_exports.string()),
|
|
19768
|
+
extensions: external_exports.array(hostExtensionListItemSchema)
|
|
19769
|
+
});
|
|
19770
|
+
var hostExtensionRuntimeEntrySchema = hostExtensionInstallationSchema.extend({
|
|
19771
|
+
...desktopConflict,
|
|
19772
|
+
settingsRevision: hostExtensionRevisionSchema
|
|
19773
|
+
});
|
|
19774
|
+
var hostExtensionsSnapshotResultSchema = external_exports.strictObject({
|
|
19775
|
+
/** The Host publishes this revision in extensions-changed, independent of enabled.json's revision. */
|
|
19776
|
+
revision: hostExtensionRevisionSchema,
|
|
19777
|
+
// Enabled, valid activations only. A Desktop conflict does not hide other capabilities.
|
|
19778
|
+
extensions: external_exports.array(hostExtensionRuntimeEntrySchema).max(DESKTOP_EXTENSION_LIMIT)
|
|
19779
|
+
});
|
|
19780
|
+
var HOST_EXTENSIONS_RPC = {
|
|
19781
|
+
list: "codexhost/extensions/list",
|
|
19782
|
+
snapshot: "codexhost/extensions/snapshot",
|
|
19783
|
+
catalog: "codexhost/extensions/catalog",
|
|
19784
|
+
install: "codexhost/extensions/install",
|
|
19785
|
+
update: "codexhost/extensions/update",
|
|
19786
|
+
enable: "codexhost/extensions/enable",
|
|
19787
|
+
disable: "codexhost/extensions/disable",
|
|
19788
|
+
uninstall: "codexhost/extensions/uninstall",
|
|
19789
|
+
recover: "codexhost/extensions/recover",
|
|
19790
|
+
asset: "codexhost/extensions/asset",
|
|
19791
|
+
settingsGet: "codexhost/extensions/settings/get",
|
|
19792
|
+
settingsSet: "codexhost/extensions/settings/set",
|
|
19793
|
+
backendInvoke: "codexhost/extensions/backend/invoke"
|
|
19794
|
+
};
|
|
19795
|
+
var HOST_EXTENSION_MANAGEMENT_METHODS = Object.freeze(Object.values(HOST_EXTENSIONS_RPC));
|
|
19796
|
+
var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
|
|
19797
|
+
var noParams = external_exports.strictObject({});
|
|
19798
|
+
var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
|
|
19799
|
+
var selection = external_exports.strictObject({ ...id, ...expectedRevision });
|
|
19800
|
+
var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
|
|
19801
|
+
var mutationResult = external_exports.discriminatedUnion("state", [
|
|
19802
|
+
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
|
|
19803
|
+
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
|
|
19804
|
+
]);
|
|
19805
|
+
var hostExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
19806
|
+
...optionalActivation,
|
|
19807
|
+
digest: active.digest.optional(),
|
|
19808
|
+
path: hostExtensionResourcePathSchema
|
|
19809
|
+
});
|
|
19810
|
+
var hostExtensionsAssetResultSchema = external_exports.strictObject({
|
|
19811
|
+
mimeType: external_exports.string().min(1),
|
|
19812
|
+
base64: base643(DESKTOP_EXTENSION_ASSET_MAX_BYTES),
|
|
19813
|
+
digest: active.digest
|
|
19814
|
+
});
|
|
19815
|
+
var hostExtensionSettingsSchema = external_exports.strictObject({
|
|
19816
|
+
settingsRevision: hostExtensionRevisionSchema,
|
|
19817
|
+
values: jsonObjectSchema
|
|
19818
|
+
});
|
|
19819
|
+
var hostExtensionsRpcSchemas = {
|
|
19820
|
+
[HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
|
|
19821
|
+
[HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
|
|
19822
|
+
[HOST_EXTENSIONS_RPC.catalog]: {
|
|
19823
|
+
params: external_exports.strictObject({ forceRefresh: external_exports.boolean().optional() }),
|
|
19824
|
+
result: hostExtensionsCatalogResultSchema
|
|
19825
|
+
},
|
|
19826
|
+
[HOST_EXTENSIONS_RPC.install]: {
|
|
19827
|
+
params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
|
|
19828
|
+
result: installationResult
|
|
19829
|
+
},
|
|
19830
|
+
[HOST_EXTENSIONS_RPC.update]: {
|
|
19831
|
+
params: external_exports.strictObject({
|
|
19832
|
+
...id,
|
|
19833
|
+
expectedDigest: active.digest,
|
|
19834
|
+
expectedActivationId: active.activationId.optional(),
|
|
19835
|
+
source: hostExtensionInstallSourceSchema.optional()
|
|
19836
|
+
}),
|
|
19837
|
+
result: installationResult
|
|
19838
|
+
},
|
|
19839
|
+
[HOST_EXTENSIONS_RPC.enable]: { params: selection, result: mutationResult },
|
|
19840
|
+
[HOST_EXTENSIONS_RPC.disable]: { params: selection, result: mutationResult },
|
|
19841
|
+
[HOST_EXTENSIONS_RPC.uninstall]: {
|
|
19842
|
+
params: external_exports.strictObject({
|
|
19843
|
+
...id,
|
|
19844
|
+
removeData: external_exports.boolean().optional(),
|
|
19845
|
+
expectedDigest: active.digest.optional()
|
|
19846
|
+
}),
|
|
19847
|
+
result: external_exports.strictObject({ ...id, removed: external_exports.boolean() })
|
|
19848
|
+
},
|
|
19849
|
+
[HOST_EXTENSIONS_RPC.recover]: {
|
|
19850
|
+
params: external_exports.strictObject({ expectedRevision: expectedRevision.expectedRevision.optional() }),
|
|
19851
|
+
result: mutationResult
|
|
19852
|
+
},
|
|
19853
|
+
[HOST_EXTENSIONS_RPC.asset]: {
|
|
19854
|
+
params: hostExtensionsAssetParamsSchema,
|
|
19855
|
+
result: hostExtensionsAssetResultSchema
|
|
19856
|
+
},
|
|
19857
|
+
[HOST_EXTENSIONS_RPC.settingsGet]: {
|
|
19858
|
+
params: external_exports.strictObject(optionalActivation),
|
|
19859
|
+
result: hostExtensionSettingsSchema
|
|
19860
|
+
},
|
|
19861
|
+
[HOST_EXTENSIONS_RPC.settingsSet]: {
|
|
19862
|
+
params: external_exports.strictObject({
|
|
19863
|
+
...optionalActivation,
|
|
19864
|
+
expectedSettingsRevision: hostExtensionRevisionSchema,
|
|
19865
|
+
values: jsonObjectSchema
|
|
19866
|
+
}),
|
|
19867
|
+
result: hostExtensionSettingsSchema
|
|
19868
|
+
},
|
|
19869
|
+
[HOST_EXTENSIONS_RPC.backendInvoke]: {
|
|
19870
|
+
params: external_exports.strictObject({
|
|
19871
|
+
...optionalActivation,
|
|
19872
|
+
method: hostExtensionBackendMethodSchema,
|
|
19873
|
+
params: jsonValueSchema.optional()
|
|
19874
|
+
}),
|
|
19875
|
+
result: external_exports.strictObject({ result: jsonValueSchema })
|
|
19876
|
+
}
|
|
19877
|
+
};
|
|
19878
|
+
|
|
19356
19879
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
19880
|
+
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
19357
19881
|
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
19358
19882
|
var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
19359
19883
|
|
|
19360
19884
|
// ../../shared-contracts/dist/client-channel.js
|
|
19361
19885
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
19362
19886
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
19887
|
+
var CLIENT_CHANNEL_METHODS = [
|
|
19888
|
+
"codexhost/skills/list",
|
|
19889
|
+
"codexhost/voice/status",
|
|
19890
|
+
"codexhost/voice/transcribe",
|
|
19891
|
+
"codexhost/harness/display-settings/get",
|
|
19892
|
+
"codexhost/harness/display-settings/set",
|
|
19893
|
+
"codexhost/harness/display-settings/capabilities",
|
|
19894
|
+
"codexhost/harness/preferences/get",
|
|
19895
|
+
"codexhost/harness/preferences/patch",
|
|
19896
|
+
"thread/list",
|
|
19897
|
+
"codexhost/thread/catalog/read",
|
|
19898
|
+
"thread/read",
|
|
19899
|
+
"thread/resume",
|
|
19900
|
+
"thread/fork",
|
|
19901
|
+
"thread/turns/list",
|
|
19902
|
+
"thread/revert",
|
|
19903
|
+
"thread/items/list",
|
|
19904
|
+
"thread/start",
|
|
19905
|
+
"thread/name/set",
|
|
19906
|
+
"codexhost/thread/title/generate",
|
|
19907
|
+
"thread/archive",
|
|
19908
|
+
THREAD_ARCHIVE_CONFIRM_METHOD,
|
|
19909
|
+
"thread/unarchive",
|
|
19910
|
+
"turn/start",
|
|
19911
|
+
"turn/interrupt",
|
|
19912
|
+
"turn/steer",
|
|
19913
|
+
"thread/queue/list",
|
|
19914
|
+
"thread/queue/add",
|
|
19915
|
+
"thread/queue/update",
|
|
19916
|
+
"thread/queue/delete",
|
|
19917
|
+
"thread/queue/reorder",
|
|
19918
|
+
"thread/queue/start",
|
|
19919
|
+
"codexhost/thread/queue/send-now",
|
|
19920
|
+
"codexhost/workspace/read",
|
|
19921
|
+
"codexhost/thread/tree/read",
|
|
19922
|
+
"codexhost/thread/pins/list",
|
|
19923
|
+
"codexhost/thread/pins/set",
|
|
19924
|
+
"codexhost/harness/plugins/list",
|
|
19925
|
+
"codexhost/harness/inspect",
|
|
19926
|
+
"codexhost/thread/inspect",
|
|
19927
|
+
"codexhost/thread/usage/inspect",
|
|
19928
|
+
"codexhost/thread/ownership/list",
|
|
19929
|
+
"codexhost/thread/model/select",
|
|
19930
|
+
"codexhost/thread/thinking/select",
|
|
19931
|
+
"codexhost/thread/permission-mode/select",
|
|
19932
|
+
"codexhost/thread/commands/inspect",
|
|
19933
|
+
"codexhost/harness/commands/inspect",
|
|
19934
|
+
"codexhost/thread/command/execute",
|
|
19935
|
+
"codexhost/thread/fork",
|
|
19936
|
+
"codexhost/harness/session-import/sources",
|
|
19937
|
+
"codexhost/harness/session-import/list",
|
|
19938
|
+
"codexhost/harness/session-import/import",
|
|
19939
|
+
// Host settings shared across Desktop and Web.
|
|
19940
|
+
...HOST_EXTENSION_MANAGEMENT_METHODS,
|
|
19941
|
+
"codexhost/harness/installation",
|
|
19942
|
+
"codexhost/harness/installation/start",
|
|
19943
|
+
"codexhost/harness/installation/status",
|
|
19944
|
+
"codexhost/harness/launch-settings/get",
|
|
19945
|
+
"codexhost/harness/launch-settings/set",
|
|
19946
|
+
"codexhost/harness/web-ui/open",
|
|
19947
|
+
"codexhost/harness/accounts/sources",
|
|
19948
|
+
"codexhost/harness/accounts/list",
|
|
19949
|
+
"codexhost/harness/accounts/inspect",
|
|
19950
|
+
"codexhost/harness/credential-imports",
|
|
19951
|
+
"codexhost/account/list",
|
|
19952
|
+
"codexhost/account/refresh",
|
|
19953
|
+
"codexhost/account/usage/inspect",
|
|
19954
|
+
"codexhost/usage/model-prices/get",
|
|
19955
|
+
"codexhost/usage/model-prices/set",
|
|
19956
|
+
"codexhost/usage/model-prices/default",
|
|
19957
|
+
"codexhost/usage/statistics/get",
|
|
19958
|
+
"codexhost/update/check",
|
|
19959
|
+
"codexhost/update/start",
|
|
19960
|
+
"codexhost/update/status",
|
|
19961
|
+
"codexhost/sessions/loaded/list"
|
|
19962
|
+
];
|
|
19363
19963
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
19364
19964
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
19365
19965
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -19398,6 +19998,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
19398
19998
|
cursor: clientChannelCursorSchema,
|
|
19399
19999
|
revision: external_exports.number().int().nonnegative()
|
|
19400
20000
|
}),
|
|
20001
|
+
external_exports.object({
|
|
20002
|
+
type: external_exports.literal("extensions-changed"),
|
|
20003
|
+
cursor: clientChannelCursorSchema,
|
|
20004
|
+
revision: hostExtensionRevisionSchema
|
|
20005
|
+
}),
|
|
19401
20006
|
external_exports.object({
|
|
19402
20007
|
type: external_exports.literal("hello"),
|
|
19403
20008
|
version: external_exports.literal(1),
|
|
@@ -19573,6 +20178,29 @@ var threadCatalogReadResultSchema = external_exports.object({
|
|
|
19573
20178
|
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
19574
20179
|
}).strict();
|
|
19575
20180
|
|
|
20181
|
+
// ../../shared-contracts/dist/thread-tree-watch.js
|
|
20182
|
+
var THREAD_TREE_MAX_NODES = 5e3;
|
|
20183
|
+
var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
|
|
20184
|
+
var threadTreeNodeSchema = external_exports.strictObject({
|
|
20185
|
+
harnessId: harnessIdSchema,
|
|
20186
|
+
title: external_exports.string().optional(),
|
|
20187
|
+
status: threadTreeStatusSchema,
|
|
20188
|
+
archived: external_exports.boolean()
|
|
20189
|
+
});
|
|
20190
|
+
var threadTreeSnapshotSchema = external_exports.strictObject({
|
|
20191
|
+
revision: external_exports.int().nonnegative(),
|
|
20192
|
+
parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
|
|
20193
|
+
nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
|
|
20194
|
+
truncated: external_exports.boolean()
|
|
20195
|
+
}).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");
|
|
20196
|
+
var subscriptionId = external_exports.string().min(1).max(128);
|
|
20197
|
+
var threadTreeWatchParamsSchema = external_exports.strictObject({});
|
|
20198
|
+
var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
|
|
20199
|
+
var threadTreeUnwatchResultSchema = external_exports.strictObject({});
|
|
20200
|
+
var threadTreeWatchResultSchema = threadTreeUnwatchParamsSchema.extend({
|
|
20201
|
+
snapshot: threadTreeSnapshotSchema
|
|
20202
|
+
});
|
|
20203
|
+
|
|
19576
20204
|
// ../../shared-contracts/dist/voice.js
|
|
19577
20205
|
var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
|
|
19578
20206
|
var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
|
|
@@ -19811,7 +20439,7 @@ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
|
19811
20439
|
|
|
19812
20440
|
// ../../shared-contracts/dist/harness-preferences.js
|
|
19813
20441
|
var harnessPreferenceScopeSchema = external_exports.string().regex(/^external$/u);
|
|
19814
|
-
var preferenceHarnessKey = harnessIdSchema.transform((
|
|
20442
|
+
var preferenceHarnessKey = harnessIdSchema.transform((id2) => String(id2));
|
|
19815
20443
|
var harnessDefaultConfigurationSchema = external_exports.strictObject({
|
|
19816
20444
|
model: harnessModelRefSchema.optional(),
|
|
19817
20445
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -19821,11 +20449,19 @@ var newThreadDefaultsSchema = external_exports.strictObject({
|
|
|
19821
20449
|
lastHarness: harnessIdSchema.optional(),
|
|
19822
20450
|
byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
|
|
19823
20451
|
});
|
|
20452
|
+
var harnessDelegationDefaultSchema = external_exports.strictObject({
|
|
20453
|
+
model: harnessModelRefSchema.optional(),
|
|
20454
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
20455
|
+
}).refine((value) => Boolean(value.model || value.thinkingOptionId), "A delegation default must contain a Model or Thinking option");
|
|
20456
|
+
var delegationDefaultsSchema = external_exports.strictObject({
|
|
20457
|
+
byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
|
|
20458
|
+
});
|
|
19824
20459
|
var modelId = external_exports.string().min(1).max(1024);
|
|
19825
20460
|
var harnessPreferenceValuesSchema = external_exports.strictObject({
|
|
19826
20461
|
idleRelease: idleReleaseSettingsSchema.optional(),
|
|
19827
20462
|
favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
|
|
19828
|
-
newThread: newThreadDefaultsSchema.optional()
|
|
20463
|
+
newThread: newThreadDefaultsSchema.optional(),
|
|
20464
|
+
delegation: delegationDefaultsSchema.optional()
|
|
19829
20465
|
});
|
|
19830
20466
|
var harnessPreferenceSnapshotSchema = external_exports.strictObject({
|
|
19831
20467
|
scope: harnessPreferenceScopeSchema,
|
|
@@ -19853,6 +20489,11 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
|
|
|
19853
20489
|
lastHarness: harnessIdSchema.optional(),
|
|
19854
20490
|
harnessId: harnessIdSchema.optional(),
|
|
19855
20491
|
configuration: harnessDefaultConfigurationSchema.optional()
|
|
20492
|
+
}),
|
|
20493
|
+
external_exports.strictObject({
|
|
20494
|
+
kind: external_exports.literal("delegation"),
|
|
20495
|
+
harnessId: harnessIdSchema,
|
|
20496
|
+
configuration: harnessDelegationDefaultSchema.nullable()
|
|
19856
20497
|
})
|
|
19857
20498
|
]);
|
|
19858
20499
|
var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
@@ -20203,13 +20844,6 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
20203
20844
|
});
|
|
20204
20845
|
|
|
20205
20846
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
20206
|
-
var accountBalanceSnapshotSchema = external_exports.object({
|
|
20207
|
-
amount: external_exports.number().finite().nonnegative(),
|
|
20208
|
-
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
20209
|
-
currency: external_exports.string().trim().min(1).max(8),
|
|
20210
|
-
/** Native label when the Harness exposes several Billing Sources. */
|
|
20211
|
-
label: external_exports.string().trim().min(1).max(128).optional()
|
|
20212
|
-
}).strict();
|
|
20213
20847
|
var harnessAccountSnapshotObject = external_exports.object({
|
|
20214
20848
|
email: external_exports.string().trim().min(1).max(320).optional(),
|
|
20215
20849
|
label: external_exports.string().trim().min(1).max(256).optional(),
|
|
@@ -20243,76 +20877,6 @@ var harnessAccountListResultSchema = external_exports.object({
|
|
|
20243
20877
|
accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
|
|
20244
20878
|
}).strict();
|
|
20245
20879
|
|
|
20246
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
20247
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
20248
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
20249
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
20250
|
-
var installedHarnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(harnessIdSchema);
|
|
20251
|
-
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
20252
|
-
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");
|
|
20253
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
20254
|
-
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
20255
|
-
var harnessInstallationGuideSchema = external_exports.object({
|
|
20256
|
-
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
20257
|
-
before: localizedTextSchema.optional(),
|
|
20258
|
-
after: localizedTextSchema.optional(),
|
|
20259
|
-
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
20260
|
-
}).strict();
|
|
20261
|
-
var pluginPresentationShape = {
|
|
20262
|
-
id: installedHarnessPluginIdSchema,
|
|
20263
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
20264
|
-
version: external_exports.string().min(1).max(128),
|
|
20265
|
-
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
20266
|
-
kind: external_exports.literal("usage").optional(),
|
|
20267
|
-
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
20268
|
-
iconStyle: external_exports.object({
|
|
20269
|
-
vector: external_exports.object({
|
|
20270
|
-
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
20271
|
-
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
20272
|
-
paths: external_exports.array(external_exports.object({
|
|
20273
|
-
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
20274
|
-
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
20275
|
-
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
20276
|
-
}).strict()).min(1).max(32)
|
|
20277
|
-
}).strict().optional(),
|
|
20278
|
-
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
20279
|
-
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
20280
|
-
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
20281
|
-
}).strict().optional(),
|
|
20282
|
-
installation: harnessInstallationGuideSchema.optional(),
|
|
20283
|
-
notice: localizedTextSchema.optional(),
|
|
20284
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
20285
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
20286
|
-
links: external_exports.object({
|
|
20287
|
-
website: documentationUrlSchema.optional(),
|
|
20288
|
-
documentation: documentationUrlSchema.optional(),
|
|
20289
|
-
installation: documentationUrlSchema.optional()
|
|
20290
|
-
}).strict().optional()
|
|
20291
|
-
};
|
|
20292
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
20293
|
-
manifestVersion: external_exports.literal(1),
|
|
20294
|
-
...pluginPresentationShape,
|
|
20295
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
20296
|
-
entry: relativeResourceSchema,
|
|
20297
|
-
icon: relativeResourceSchema.optional()
|
|
20298
|
-
}).strict();
|
|
20299
|
-
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);
|
|
20300
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
20301
|
-
...pluginPresentationShape,
|
|
20302
|
-
icon: harnessPluginIconSchema.optional()
|
|
20303
|
-
}).strict();
|
|
20304
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
20305
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
20306
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
20307
|
-
}).strict();
|
|
20308
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
20309
|
-
version: external_exports.literal(1),
|
|
20310
|
-
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
20311
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
20312
|
-
message: "Enabled plugin IDs must be unique",
|
|
20313
|
-
path: ["enabled"]
|
|
20314
|
-
});
|
|
20315
|
-
|
|
20316
20880
|
// ../../shared-contracts/dist/harness-route.js
|
|
20317
20881
|
var harnessPluginRouteSchema = external_exports.object({
|
|
20318
20882
|
harnessId: harnessPluginIdSchema,
|
|
@@ -20757,9 +21321,12 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
20757
21321
|
...thread,
|
|
20758
21322
|
epoch: identity,
|
|
20759
21323
|
modelId: identity.optional(),
|
|
21324
|
+
serviceTier: harnessModelServiceTierSchema.optional(),
|
|
20760
21325
|
thinkingOptionId: identity.optional(),
|
|
20761
21326
|
permissionModeId: identity.optional()
|
|
20762
|
-
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
|
|
21327
|
+
}).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, {
|
|
21328
|
+
message: "A service tier requires a Model ID"
|
|
21329
|
+
}),
|
|
20763
21330
|
external_exports.strictObject({
|
|
20764
21331
|
kind: external_exports.literal("prompt"),
|
|
20765
21332
|
...thread,
|
|
@@ -20809,7 +21376,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
20809
21376
|
external_exports.strictObject({ action: external_exports.literal("catalog") }),
|
|
20810
21377
|
external_exports.strictObject({
|
|
20811
21378
|
action: external_exports.literal("read-thread"),
|
|
20812
|
-
hostId: hostId.refine((
|
|
21379
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
20813
21380
|
input: delegationReadParamsSchema
|
|
20814
21381
|
}),
|
|
20815
21382
|
external_exports.strictObject({
|
|
@@ -20823,7 +21390,7 @@ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action
|
|
|
20823
21390
|
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
20824
21391
|
external_exports.strictObject({
|
|
20825
21392
|
action: external_exports.literal("update"),
|
|
20826
|
-
hostId: hostId.refine((
|
|
21393
|
+
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
20827
21394
|
version: remoteUpdateParamsSchema.shape.version
|
|
20828
21395
|
})
|
|
20829
21396
|
]);
|
|
@@ -20882,12 +21449,254 @@ var webUiExtensionRemoveSchema = external_exports.object({ id: webUiExtensionIdS
|
|
|
20882
21449
|
// ../../shared-contracts/dist/index.js
|
|
20883
21450
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
20884
21451
|
|
|
21452
|
+
// dist/account-balance.js
|
|
21453
|
+
var DEEPSEEK_BALANCE_ENDPOINT = "https://api.deepseek.com/user/balance";
|
|
21454
|
+
var DEEPSEEK_API_KEY_REF = "DEEPSEEK_API_KEY";
|
|
21455
|
+
var REQUEST_TIMEOUT_MS = 1e4;
|
|
21456
|
+
var MAX_BALANCE_ACCOUNTS = 4;
|
|
21457
|
+
function dshHome(environment) {
|
|
21458
|
+
const configured = environment.DSH_HOME?.trim();
|
|
21459
|
+
if (configured)
|
|
21460
|
+
return configured;
|
|
21461
|
+
return path5.join(environment.HOME || environment.USERPROFILE || os2.homedir(), ".dsh");
|
|
21462
|
+
}
|
|
21463
|
+
function unquote(value) {
|
|
21464
|
+
const trimmed = value.trim();
|
|
21465
|
+
const quoted = /^(["'])(.*?)\1\s*(?:#.*)?$/u.exec(trimmed);
|
|
21466
|
+
if (quoted)
|
|
21467
|
+
return (quoted[2] ?? "").trim();
|
|
21468
|
+
return trimmed.replace(/(?:^|\s+)#.*$/u, "").trim();
|
|
21469
|
+
}
|
|
21470
|
+
function readCredentialRef(text, name) {
|
|
21471
|
+
const lines = text.split(/\r?\n/u);
|
|
21472
|
+
const entry = new RegExp(`^(\\s*)${name}\\s*:(.*)$`, "u");
|
|
21473
|
+
let inRefs = false;
|
|
21474
|
+
let refsIndent = -1;
|
|
21475
|
+
const versioned = lines.some((line) => /^version\s*:/u.test(line));
|
|
21476
|
+
for (const line of lines) {
|
|
21477
|
+
if (!line.trim() || line.trimStart().startsWith("#"))
|
|
21478
|
+
continue;
|
|
21479
|
+
const indent = line.length - line.trimStart().length;
|
|
21480
|
+
if (indent === 0) {
|
|
21481
|
+
inRefs = /^refs\s*:\s*(?:#.*)?$/u.test(line);
|
|
21482
|
+
refsIndent = -1;
|
|
21483
|
+
if (!versioned) {
|
|
21484
|
+
const flat = entry.exec(line);
|
|
21485
|
+
if (flat)
|
|
21486
|
+
return unquote(flat[2] ?? "") || void 0;
|
|
21487
|
+
}
|
|
21488
|
+
continue;
|
|
21489
|
+
}
|
|
21490
|
+
if (!inRefs)
|
|
21491
|
+
continue;
|
|
21492
|
+
if (refsIndent === -1)
|
|
21493
|
+
refsIndent = indent;
|
|
21494
|
+
if (indent !== refsIndent)
|
|
21495
|
+
continue;
|
|
21496
|
+
const match = entry.exec(line);
|
|
21497
|
+
if (match)
|
|
21498
|
+
return unquote(match[2] ?? "") || void 0;
|
|
21499
|
+
}
|
|
21500
|
+
return void 0;
|
|
21501
|
+
}
|
|
21502
|
+
async function readOptional(file2, signal) {
|
|
21503
|
+
try {
|
|
21504
|
+
signal?.throwIfAborted();
|
|
21505
|
+
if (!(await stat(file2)).isFile())
|
|
21506
|
+
throw new Error("Expected a regular DSH configuration file");
|
|
21507
|
+
return await readFile2(file2, { encoding: "utf8", ...signal ? { signal } : {} });
|
|
21508
|
+
} catch (error51) {
|
|
21509
|
+
if (error51.code === "ENOENT")
|
|
21510
|
+
return void 0;
|
|
21511
|
+
throw error51;
|
|
21512
|
+
}
|
|
21513
|
+
}
|
|
21514
|
+
async function readDeepSeekApiKey(environment, signal) {
|
|
21515
|
+
const home = dshHome(environment);
|
|
21516
|
+
const dotEnv = parseEnv(await readOptional(path5.join(home, ".env"), signal) ?? "");
|
|
21517
|
+
const baseUrl = environment.DEEPSEEK_BASE_URL ?? dotEnv.DEEPSEEK_BASE_URL;
|
|
21518
|
+
if (baseUrl !== void 0) {
|
|
21519
|
+
const endpoint = URL.parse(baseUrl);
|
|
21520
|
+
if (endpoint?.protocol !== "https:" || endpoint.origin !== new URL(DEEPSEEK_BALANCE_ENDPOINT).origin) {
|
|
21521
|
+
return void 0;
|
|
21522
|
+
}
|
|
21523
|
+
}
|
|
21524
|
+
for (const directory of [home, path5.join(home, "profiles", "web")]) {
|
|
21525
|
+
const patch = await readOptional(path5.join(directory, "cordis.patch.yml"), signal);
|
|
21526
|
+
if (patch !== void 0 && patch.trim() !== "[]")
|
|
21527
|
+
return void 0;
|
|
21528
|
+
}
|
|
21529
|
+
const credentials = await readOptional(path5.join(home, ".credentials.yaml"), signal);
|
|
21530
|
+
const fromCredentials = credentials ? readCredentialRef(credentials, DEEPSEEK_API_KEY_REF) : void 0;
|
|
21531
|
+
return fromCredentials || environment[DEEPSEEK_API_KEY_REF]?.trim() || dotEnv[DEEPSEEK_API_KEY_REF]?.trim() || void 0;
|
|
21532
|
+
}
|
|
21533
|
+
function record3(value) {
|
|
21534
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
21535
|
+
}
|
|
21536
|
+
function finiteAmount(value) {
|
|
21537
|
+
const amount = typeof value === "number" ? value : typeof value === "string" && value.trim() ? Number(value) : Number.NaN;
|
|
21538
|
+
return Number.isFinite(amount) && amount >= 0 ? amount : null;
|
|
21539
|
+
}
|
|
21540
|
+
function projectDeepSeekBalances(payload) {
|
|
21541
|
+
const data = record3(payload);
|
|
21542
|
+
if (!Array.isArray(data.balance_infos))
|
|
21543
|
+
return [];
|
|
21544
|
+
const entries = data.balance_infos.flatMap((value) => {
|
|
21545
|
+
const info = record3(value);
|
|
21546
|
+
const amount = finiteAmount(info.total_balance);
|
|
21547
|
+
const currency = typeof info.currency === "string" ? info.currency.trim() : "";
|
|
21548
|
+
return amount === null || !currency ? [] : [{ amount, currency }];
|
|
21549
|
+
});
|
|
21550
|
+
const funded = entries.filter((entry) => entry.amount > 0);
|
|
21551
|
+
const shown = (funded.length > 0 ? funded : entries.slice(0, 1)).slice(0, MAX_BALANCE_ACCOUNTS);
|
|
21552
|
+
return shown.flatMap(({ amount, currency }) => {
|
|
21553
|
+
const parsed = harnessAccountSnapshotSchema.safeParse({
|
|
21554
|
+
label: shown.length > 1 ? `DeepSeek API (${currency})` : "DeepSeek API",
|
|
21555
|
+
balance: { amount, currency, label: "DeepSeek API" }
|
|
21556
|
+
});
|
|
21557
|
+
return parsed.success ? [parsed.data] : [];
|
|
21558
|
+
});
|
|
21559
|
+
}
|
|
21560
|
+
async function fetchDeepSeekBalances(input = {}) {
|
|
21561
|
+
try {
|
|
21562
|
+
const timeout = AbortSignal.timeout(REQUEST_TIMEOUT_MS);
|
|
21563
|
+
const signal = input.signal ? AbortSignal.any([input.signal, timeout]) : timeout;
|
|
21564
|
+
signal.throwIfAborted();
|
|
21565
|
+
const environment = input.environment ?? process.env;
|
|
21566
|
+
const key = await (input.readApiKey ? input.readApiKey() : readDeepSeekApiKey(environment, signal));
|
|
21567
|
+
if (!key)
|
|
21568
|
+
return [];
|
|
21569
|
+
signal.throwIfAborted();
|
|
21570
|
+
const response = await (input.fetch ?? fetch)(DEEPSEEK_BALANCE_ENDPOINT, {
|
|
21571
|
+
headers: { Authorization: `Bearer ${key}`, Accept: "application/json" },
|
|
21572
|
+
redirect: "error",
|
|
21573
|
+
signal
|
|
21574
|
+
});
|
|
21575
|
+
if (!response.ok) {
|
|
21576
|
+
void response.body?.cancel().catch(() => {
|
|
21577
|
+
});
|
|
21578
|
+
return [];
|
|
21579
|
+
}
|
|
21580
|
+
const payload = await response.json();
|
|
21581
|
+
signal.throwIfAborted();
|
|
21582
|
+
return projectDeepSeekBalances(payload);
|
|
21583
|
+
} catch {
|
|
21584
|
+
return [];
|
|
21585
|
+
}
|
|
21586
|
+
}
|
|
21587
|
+
var BALANCE_REFRESH_INTERVAL_MS = 3e4;
|
|
21588
|
+
var DeepSeekBalanceCache = class {
|
|
21589
|
+
fetchBalances;
|
|
21590
|
+
now;
|
|
21591
|
+
intervalMs;
|
|
21592
|
+
#value = null;
|
|
21593
|
+
#fetchedAt = Number.NEGATIVE_INFINITY;
|
|
21594
|
+
#flight;
|
|
21595
|
+
#closed = false;
|
|
21596
|
+
constructor(fetchBalances, now = Date.now, intervalMs = BALANCE_REFRESH_INTERVAL_MS) {
|
|
21597
|
+
this.fetchBalances = fetchBalances;
|
|
21598
|
+
this.now = now;
|
|
21599
|
+
this.intervalMs = intervalMs;
|
|
21600
|
+
}
|
|
21601
|
+
read() {
|
|
21602
|
+
return this.#closed ? null : this.#value;
|
|
21603
|
+
}
|
|
21604
|
+
/** Fresh rows for the settings page; also updates the composer value. */
|
|
21605
|
+
inspect() {
|
|
21606
|
+
if (this.#closed)
|
|
21607
|
+
return Promise.resolve([]);
|
|
21608
|
+
this.#flight ??= this.fetchBalances().catch(() => []).then((accounts) => {
|
|
21609
|
+
if (this.#closed)
|
|
21610
|
+
return [];
|
|
21611
|
+
this.#value = accounts[0]?.balance ?? null;
|
|
21612
|
+
this.#fetchedAt = this.now();
|
|
21613
|
+
return accounts;
|
|
21614
|
+
}).finally(() => {
|
|
21615
|
+
this.#flight = void 0;
|
|
21616
|
+
});
|
|
21617
|
+
return this.#flight;
|
|
21618
|
+
}
|
|
21619
|
+
async refresh() {
|
|
21620
|
+
if (this.#closed)
|
|
21621
|
+
return null;
|
|
21622
|
+
if (!this.#flight && this.now() - this.#fetchedAt < this.intervalMs)
|
|
21623
|
+
return this.#value;
|
|
21624
|
+
await this.inspect();
|
|
21625
|
+
return this.read();
|
|
21626
|
+
}
|
|
21627
|
+
close() {
|
|
21628
|
+
this.#closed = true;
|
|
21629
|
+
this.#value = null;
|
|
21630
|
+
}
|
|
21631
|
+
};
|
|
21632
|
+
|
|
21633
|
+
// dist/modern/usage-statistics.js
|
|
21634
|
+
import os3 from "node:os";
|
|
21635
|
+
import path6 from "node:path";
|
|
21636
|
+
import { lstat, readFile as readFile3, readdir } from "node:fs/promises";
|
|
21637
|
+
import { zstdDecompressSync } from "node:zlib";
|
|
21638
|
+
|
|
21639
|
+
// ../../harness-adapter/dist/usage-statistics.js
|
|
21640
|
+
var MAX_SESSION_ID_LENGTH = 512;
|
|
21641
|
+
var MAX_CWD_LENGTH = 4096;
|
|
21642
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
21643
|
+
function usageSessionTitle(value) {
|
|
21644
|
+
if (typeof value !== "string")
|
|
21645
|
+
return void 0;
|
|
21646
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
21647
|
+
if (!normalized)
|
|
21648
|
+
return void 0;
|
|
21649
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
21650
|
+
return normalized;
|
|
21651
|
+
let title = "";
|
|
21652
|
+
for (const character of normalized) {
|
|
21653
|
+
if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
|
|
21654
|
+
break;
|
|
21655
|
+
title += character;
|
|
21656
|
+
}
|
|
21657
|
+
return `${title.trimEnd()}…`;
|
|
21658
|
+
}
|
|
21659
|
+
function sessionIdOk(value) {
|
|
21660
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
21661
|
+
}
|
|
21662
|
+
function cwdOk(value) {
|
|
21663
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_CWD_LENGTH && !value.includes("\0") && (value.startsWith("/") || /^[A-Za-z]:[\\/]/u.test(value) || value.startsWith("\\\\"));
|
|
21664
|
+
}
|
|
21665
|
+
function withUsageSession(entry, session) {
|
|
21666
|
+
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
21667
|
+
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
21668
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
21669
|
+
if (sessionId === void 0 && cwd === void 0)
|
|
21670
|
+
return entry;
|
|
21671
|
+
return {
|
|
21672
|
+
...entry,
|
|
21673
|
+
...sessionId !== void 0 ? { sessionId } : {},
|
|
21674
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
21675
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
21676
|
+
};
|
|
21677
|
+
}
|
|
21678
|
+
function usageEntryFromRequest(request, occurredAtMs) {
|
|
21679
|
+
if (!Number.isSafeInteger(occurredAtMs) || occurredAtMs <= 0)
|
|
21680
|
+
return null;
|
|
21681
|
+
return {
|
|
21682
|
+
id: request.requestId,
|
|
21683
|
+
occurredAtMs,
|
|
21684
|
+
...request.model !== void 0 ? { model: request.model } : {},
|
|
21685
|
+
inputTokens: request.inputTokens,
|
|
21686
|
+
...request.cachedInputTokens !== void 0 ? { cachedInputTokens: request.cachedInputTokens } : {},
|
|
21687
|
+
...request.cacheWriteInputTokens !== void 0 ? { cacheWriteInputTokens: request.cacheWriteInputTokens } : {},
|
|
21688
|
+
...request.cacheWrite1hInputTokens !== void 0 ? { cacheWrite1hInputTokens: request.cacheWrite1hInputTokens } : {},
|
|
21689
|
+
outputTokens: request.outputTokens,
|
|
21690
|
+
...request.reasoningOutputTokens !== void 0 ? { reasoningOutputTokens: request.reasoningOutputTokens } : {}
|
|
21691
|
+
};
|
|
21692
|
+
}
|
|
21693
|
+
|
|
20885
21694
|
// ../../harness-adapter/dist/approval.js
|
|
20886
21695
|
function invalidRequest(message) {
|
|
20887
21696
|
return { code: "invalidRequest", message, retryable: false };
|
|
20888
21697
|
}
|
|
20889
21698
|
function validateHostApprovalResponse(interaction, response) {
|
|
20890
|
-
return interaction.actions.some(({ id }) =>
|
|
21699
|
+
return interaction.actions.some(({ id: id2 }) => id2 === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
|
|
20891
21700
|
}
|
|
20892
21701
|
|
|
20893
21702
|
// ../../harness-adapter/dist/question.js
|
|
@@ -20895,7 +21704,7 @@ function invalidRequest2(message) {
|
|
|
20895
21704
|
return { code: "invalidRequest", message, retryable: false };
|
|
20896
21705
|
}
|
|
20897
21706
|
function validateHostQuestionResponse(interaction, response) {
|
|
20898
|
-
const questionIds = new Set(interaction.questions.map(({ id }) =>
|
|
21707
|
+
const questionIds = new Set(interaction.questions.map(({ id: id2 }) => id2));
|
|
20899
21708
|
if (response.cancelled) {
|
|
20900
21709
|
return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
|
|
20901
21710
|
}
|
|
@@ -20943,6 +21752,21 @@ function validateHostInteractionResponse(interaction, response) {
|
|
|
20943
21752
|
return response.type === "approval" ? validateHostApprovalResponse(interaction, response) : invalidRequest3("Interaction Response type does not match the pending Interaction");
|
|
20944
21753
|
}
|
|
20945
21754
|
|
|
21755
|
+
// ../../harness-adapter/dist/composite-model-ref.js
|
|
21756
|
+
function compositeModelRefIds(entries, fallbackId) {
|
|
21757
|
+
const counts = /* @__PURE__ */ new Map();
|
|
21758
|
+
for (const entry of entries) {
|
|
21759
|
+
const id2 = `${entry.provider}/${entry.model}`;
|
|
21760
|
+
counts.set(id2, (counts.get(id2) ?? 0) + 1);
|
|
21761
|
+
}
|
|
21762
|
+
const ids = /* @__PURE__ */ new Map();
|
|
21763
|
+
for (const entry of entries) {
|
|
21764
|
+
const id2 = `${entry.provider}/${entry.model}`;
|
|
21765
|
+
ids.set(counts.get(id2) === 1 ? id2 : fallbackId(entry), entry);
|
|
21766
|
+
}
|
|
21767
|
+
return ids;
|
|
21768
|
+
}
|
|
21769
|
+
|
|
20946
21770
|
// ../../harness-adapter/dist/output-channel.js
|
|
20947
21771
|
var HarnessOutputChannel = class {
|
|
20948
21772
|
outputs;
|
|
@@ -21032,7 +21856,8 @@ var tokenFields = [
|
|
|
21032
21856
|
var safeIntegerFields = [
|
|
21033
21857
|
"planFiveHourResetsAtUnix",
|
|
21034
21858
|
"planSevenDayResetsAtUnix",
|
|
21035
|
-
"timeToFirstOutputMs"
|
|
21859
|
+
"timeToFirstOutputMs",
|
|
21860
|
+
"latestRequestTimeToFirstOutputMs"
|
|
21036
21861
|
];
|
|
21037
21862
|
var percentFields = [
|
|
21038
21863
|
"cacheHitRatePercent",
|
|
@@ -21593,16 +22418,16 @@ var Diff = class {
|
|
|
21593
22418
|
}
|
|
21594
22419
|
}
|
|
21595
22420
|
}
|
|
21596
|
-
addToPath(
|
|
21597
|
-
const last =
|
|
22421
|
+
addToPath(path12, added, removed, oldPosInc, options) {
|
|
22422
|
+
const last = path12.lastComponent;
|
|
21598
22423
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
21599
22424
|
return {
|
|
21600
|
-
oldPos:
|
|
22425
|
+
oldPos: path12.oldPos + oldPosInc,
|
|
21601
22426
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
21602
22427
|
};
|
|
21603
22428
|
} else {
|
|
21604
22429
|
return {
|
|
21605
|
-
oldPos:
|
|
22430
|
+
oldPos: path12.oldPos + oldPosInc,
|
|
21606
22431
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
21607
22432
|
};
|
|
21608
22433
|
}
|
|
@@ -22339,7 +23164,7 @@ function expandAssistantStream(value) {
|
|
|
22339
23164
|
if (gaps.length !== members.length - 1)
|
|
22340
23165
|
throw invalid("assistant stream dt length");
|
|
22341
23166
|
const index = nonNegativeInteger2(candidate.index, "assistant stream block index");
|
|
22342
|
-
const
|
|
23167
|
+
const id2 = tool ? identifier(candidate.id, "assistant stream tool id") : void 0;
|
|
22343
23168
|
const name = withName ? identifier(candidate.name, "assistant stream tool name") : void 0;
|
|
22344
23169
|
let time3 = safeInteger(candidate.time0, "assistant stream first time");
|
|
22345
23170
|
for (const [memberIndex, member] of members.entries()) {
|
|
@@ -22348,7 +23173,7 @@ function expandAssistantStream(value) {
|
|
|
22348
23173
|
const chunk = tool ? {
|
|
22349
23174
|
type: "tool-call-delta",
|
|
22350
23175
|
index,
|
|
22351
|
-
id,
|
|
23176
|
+
id: id2,
|
|
22352
23177
|
...withName ? { name } : {},
|
|
22353
23178
|
argumentsDelta: member
|
|
22354
23179
|
} : {
|
|
@@ -22899,10 +23724,10 @@ function deepSeekUsageHistory(events) {
|
|
|
22899
23724
|
const requests = /* @__PURE__ */ new Map();
|
|
22900
23725
|
let complete = true;
|
|
22901
23726
|
for (const event of events) {
|
|
22902
|
-
const
|
|
22903
|
-
if (
|
|
22904
|
-
requests.set(
|
|
22905
|
-
else if (
|
|
23727
|
+
const record4 = deepSeekUsageRecord(event, true);
|
|
23728
|
+
if (record4.kind === "request")
|
|
23729
|
+
requests.set(record4.request.requestId, record4.request);
|
|
23730
|
+
else if (record4.kind === "missing")
|
|
22906
23731
|
complete = false;
|
|
22907
23732
|
}
|
|
22908
23733
|
return { requests: [...requests.values()], complete };
|
|
@@ -22911,8 +23736,8 @@ function deepSeekUsageHistory(events) {
|
|
|
22911
23736
|
// dist/modern/usage-statistics.js
|
|
22912
23737
|
var SESSION_FILE = /^session(?:\.v(\d+))?\.jsonl(\.zstd)?$/u;
|
|
22913
23738
|
var ZSTD_MAGIC = 4247762216;
|
|
22914
|
-
function
|
|
22915
|
-
return environment.DSH_HOME ||
|
|
23739
|
+
function dshHome2(environment) {
|
|
23740
|
+
return environment.DSH_HOME || path6.join(environment.HOME || os3.homedir(), ".dsh");
|
|
22916
23741
|
}
|
|
22917
23742
|
function zstdFrames(buffer) {
|
|
22918
23743
|
const frames = [];
|
|
@@ -22951,7 +23776,7 @@ function zstdFrames(buffer) {
|
|
|
22951
23776
|
return frames;
|
|
22952
23777
|
}
|
|
22953
23778
|
async function readDshUsage(file2) {
|
|
22954
|
-
const buffer = await
|
|
23779
|
+
const buffer = await readFile3(file2);
|
|
22955
23780
|
const text = file2.endsWith(".zstd") ? zstdFrames(buffer).map((frame) => zstdDecompressSync(frame).toString("utf8")).join("") : buffer.toString("utf8");
|
|
22956
23781
|
const entries = [];
|
|
22957
23782
|
let session = {};
|
|
@@ -22977,8 +23802,8 @@ async function readDshUsage(file2) {
|
|
|
22977
23802
|
} catch {
|
|
22978
23803
|
continue;
|
|
22979
23804
|
}
|
|
22980
|
-
const
|
|
22981
|
-
const entry =
|
|
23805
|
+
const record4 = deepSeekUsageRecord(event, true);
|
|
23806
|
+
const entry = record4.kind === "request" && usageEntryFromRequest(record4.request, event.time);
|
|
22982
23807
|
if (entry)
|
|
22983
23808
|
entries.push(withUsageSession(entry, session));
|
|
22984
23809
|
}
|
|
@@ -22987,16 +23812,16 @@ async function readDshUsage(file2) {
|
|
|
22987
23812
|
function createDshUsageStatistics(environment) {
|
|
22988
23813
|
return Object.freeze({
|
|
22989
23814
|
async listSources(signal) {
|
|
22990
|
-
const root =
|
|
23815
|
+
const root = path6.join(dshHome2(environment), "sessions");
|
|
22991
23816
|
const sources = [];
|
|
22992
23817
|
for (const project2 of await readdir(root).catch(() => [])) {
|
|
22993
|
-
for (const session of await readdir(
|
|
23818
|
+
for (const session of await readdir(path6.join(root, project2)).catch(() => [])) {
|
|
22994
23819
|
signal.throwIfAborted();
|
|
22995
|
-
const directory =
|
|
23820
|
+
const directory = path6.join(root, project2, session);
|
|
22996
23821
|
const latest = (await readdir(directory).catch(() => [])).map((name) => ({ name, version: Number(SESSION_FILE.exec(name)?.[1] ?? 1) })).filter(({ name }) => SESSION_FILE.test(name)).sort((left, right) => right.version - left.version)[0];
|
|
22997
23822
|
if (!latest)
|
|
22998
23823
|
continue;
|
|
22999
|
-
const file2 =
|
|
23824
|
+
const file2 = path6.join(directory, latest.name);
|
|
23000
23825
|
const info = await lstat(file2).catch(() => null);
|
|
23001
23826
|
if (info?.isFile() && info.size > 0) {
|
|
23002
23827
|
sources.push({ id: file2, fingerprint: `${info.ino}:${info.size}:${info.mtimeMs}` });
|
|
@@ -23005,7 +23830,7 @@ function createDshUsageStatistics(environment) {
|
|
|
23005
23830
|
}
|
|
23006
23831
|
return sources;
|
|
23007
23832
|
},
|
|
23008
|
-
readSource: (
|
|
23833
|
+
readSource: (id2) => readDshUsage(id2)
|
|
23009
23834
|
});
|
|
23010
23835
|
}
|
|
23011
23836
|
|
|
@@ -23046,7 +23871,7 @@ function deepSeekHarnessCommandCatalog() {
|
|
|
23046
23871
|
});
|
|
23047
23872
|
}
|
|
23048
23873
|
function parseDeepSeekHarnessCommand(command) {
|
|
23049
|
-
const definition = commandDefinitions.find(({ id }) =>
|
|
23874
|
+
const definition = commandDefinitions.find(({ id: id2 }) => id2 === command.commandId);
|
|
23050
23875
|
if (!definition) {
|
|
23051
23876
|
return {
|
|
23052
23877
|
ok: false,
|
|
@@ -23087,12 +23912,12 @@ import { spawn } from "node:child_process";
|
|
|
23087
23912
|
// dist/executable.js
|
|
23088
23913
|
import { spawnSync } from "node:child_process";
|
|
23089
23914
|
import { accessSync, constants, statSync } from "node:fs";
|
|
23090
|
-
import
|
|
23915
|
+
import path7 from "node:path";
|
|
23091
23916
|
function environmentValue2(environment, name) {
|
|
23092
23917
|
return Object.entries(environment).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
|
|
23093
23918
|
}
|
|
23094
23919
|
function executableCandidates(command, environment) {
|
|
23095
|
-
const targetPath2 = process.platform === "win32" ?
|
|
23920
|
+
const targetPath2 = process.platform === "win32" ? path7.win32 : path7.posix;
|
|
23096
23921
|
if (targetPath2.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
23097
23922
|
return [command];
|
|
23098
23923
|
}
|
|
@@ -23127,7 +23952,7 @@ function resolveDeepSeekCommand(configured, environment) {
|
|
|
23127
23952
|
} : null;
|
|
23128
23953
|
}
|
|
23129
23954
|
function deepSeekProcessInvocation(command, arguments_, environment, platform = process.platform) {
|
|
23130
|
-
const extension2 =
|
|
23955
|
+
const extension2 = path7.win32.extname(command).toLowerCase();
|
|
23131
23956
|
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension2)) {
|
|
23132
23957
|
return { command, arguments: arguments_, windowsVerbatimArguments: false };
|
|
23133
23958
|
}
|
|
@@ -23144,7 +23969,7 @@ function resolveWindowsTaskkillPath(environment) {
|
|
|
23144
23969
|
if (!systemRoot || !/^[A-Za-z]:[\\/]/u.test(systemRoot)) {
|
|
23145
23970
|
throw new Error("Windows SystemRoot is unavailable or invalid");
|
|
23146
23971
|
}
|
|
23147
|
-
return
|
|
23972
|
+
return path7.win32.join(systemRoot, "System32", "taskkill.exe");
|
|
23148
23973
|
}
|
|
23149
23974
|
function killDeepSeekProcessTree(child, platform, timeoutMs) {
|
|
23150
23975
|
if (!child.pid) {
|
|
@@ -23550,46 +24375,60 @@ async function probeDeepSeekExecutableGeneration(options = {}, dependencies = {
|
|
|
23550
24375
|
|
|
23551
24376
|
// dist/modern/deepseek-harness-adapter.js
|
|
23552
24377
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
23553
|
-
import
|
|
23554
|
-
|
|
23555
|
-
// dist/modern/catalog.js
|
|
23556
|
-
import { Buffer as Buffer3 } from "node:buffer";
|
|
24378
|
+
import path11 from "node:path";
|
|
24379
|
+
import { isDeepStrictEqual as isDeepStrictEqual7 } from "node:util";
|
|
23557
24380
|
|
|
23558
24381
|
// dist/model-catalog.js
|
|
23559
24382
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
23560
24383
|
var MODEL_REF_PREFIX = "deepseek-harness-model-v2.";
|
|
23561
|
-
function
|
|
23562
|
-
|
|
23563
|
-
|
|
23564
|
-
|
|
24384
|
+
function readableId({ provider, model: model2 }) {
|
|
24385
|
+
return `${provider}/${model2}`;
|
|
24386
|
+
}
|
|
24387
|
+
function legacyId({ provider, model: model2 }) {
|
|
24388
|
+
return MODEL_REF_PREFIX + Buffer2.from(JSON.stringify([provider, model2])).toString("base64url");
|
|
24389
|
+
}
|
|
24390
|
+
function sameModel(a, b) {
|
|
24391
|
+
return a.provider === b.provider && a.model === b.model;
|
|
24392
|
+
}
|
|
24393
|
+
function modelIndex(models) {
|
|
24394
|
+
const ids = compositeModelRefIds([...new Map(models.map((model2) => [legacyId(model2), model2])).values()], legacyId);
|
|
24395
|
+
const readable = new Set(models.map(readableId));
|
|
24396
|
+
const byIdentity = /* @__PURE__ */ new Map();
|
|
24397
|
+
const byLegacy = /* @__PURE__ */ new Map();
|
|
24398
|
+
for (const [id2, model2] of ids) {
|
|
24399
|
+
const ref = harnessModelRefSchema.parse({ id: id2 });
|
|
24400
|
+
byIdentity.set(legacyId(model2), ref);
|
|
24401
|
+
const oldId = legacyId({ provider: model2.provider.trim(), model: model2.model.trim() });
|
|
24402
|
+
const other = byLegacy.get(oldId);
|
|
24403
|
+
byLegacy.set(oldId, other === void 0 ? ref : null);
|
|
24404
|
+
}
|
|
24405
|
+
const encode3 = (model2) => {
|
|
24406
|
+
if (!model2.provider.trim() || !model2.model.trim()) {
|
|
24407
|
+
throw new Error("DeepSeek Harness Model identity must not be empty");
|
|
24408
|
+
}
|
|
24409
|
+
const id2 = readableId(model2);
|
|
24410
|
+
return byIdentity.get(legacyId(model2)) ?? harnessModelRefSchema.parse({
|
|
24411
|
+
id: readable.has(id2) ? legacyId(model2) : id2
|
|
24412
|
+
});
|
|
24413
|
+
};
|
|
24414
|
+
return { encode: encode3, ids, byLegacy };
|
|
24415
|
+
}
|
|
24416
|
+
function encodeDeepSeekHarnessModelRef(model2, index) {
|
|
24417
|
+
if (index)
|
|
24418
|
+
return index.encode(model2);
|
|
24419
|
+
if (!model2.provider.trim() || !model2.model.trim()) {
|
|
23565
24420
|
throw new Error("DeepSeek Harness Model identity must not be empty");
|
|
23566
|
-
const encoded = Buffer2.from(JSON.stringify([provider, modelId2]), "utf8").toString("base64url");
|
|
23567
|
-
const id = `${MODEL_REF_PREFIX}${encoded}`;
|
|
23568
|
-
if (id.length > HARNESS_MODEL_REF_MAX_LENGTH) {
|
|
23569
|
-
throw new Error("DeepSeek Harness Model is too long for a Model Ref");
|
|
23570
24421
|
}
|
|
23571
|
-
return harnessModelRefSchema.parse({ id });
|
|
24422
|
+
return harnessModelRefSchema.parse({ id: readableId(model2) });
|
|
23572
24423
|
}
|
|
23573
|
-
function decodeDeepSeekHarnessModelRef(ref) {
|
|
23574
|
-
const
|
|
23575
|
-
if (!
|
|
23576
|
-
throw new Error("DeepSeek Harness Model
|
|
23577
|
-
|
|
23578
|
-
|
|
23579
|
-
|
|
23580
|
-
|
|
23581
|
-
decoded = JSON.parse(Buffer2.from(encoded, "base64url").toString("utf8"));
|
|
23582
|
-
} catch {
|
|
23583
|
-
throw new Error("DeepSeek Harness Model Ref is invalid");
|
|
23584
|
-
}
|
|
23585
|
-
if (!Array.isArray(decoded) || decoded.length !== 2 || typeof decoded[0] !== "string" || typeof decoded[1] !== "string") {
|
|
23586
|
-
throw new Error("DeepSeek Harness Model Ref is invalid");
|
|
23587
|
-
}
|
|
23588
|
-
const native = { provider: decoded[0], model: decoded[1] };
|
|
23589
|
-
if (encodeDeepSeekHarnessModelRef(native).id !== parsed.id) {
|
|
23590
|
-
throw new Error("DeepSeek Harness Model Ref is not canonical");
|
|
23591
|
-
}
|
|
23592
|
-
return native;
|
|
24424
|
+
function decodeDeepSeekHarnessModelRef(ref, index) {
|
|
24425
|
+
const model2 = !ref.serviceTier && index.ids.get(ref.id);
|
|
24426
|
+
if (!model2)
|
|
24427
|
+
throw new Error("DeepSeek Harness Model is unavailable");
|
|
24428
|
+
return model2;
|
|
24429
|
+
}
|
|
24430
|
+
function normalizeStoredDeepSeekModelRef(ref, index) {
|
|
24431
|
+
return ref.serviceTier ? void 0 : index.byLegacy.get(ref.id) ?? void 0;
|
|
23593
24432
|
}
|
|
23594
24433
|
function parseDeepSeekThinkingOptionId(value) {
|
|
23595
24434
|
if (value === void 0)
|
|
@@ -23605,7 +24444,7 @@ function normalizeDeepSeekThinkingOptions(models) {
|
|
|
23605
24444
|
return parsedId.success ? [{ id: parsedId.data, label: effort.name }] : [];
|
|
23606
24445
|
});
|
|
23607
24446
|
}
|
|
23608
|
-
function normalizeDeepSeekModelCatalog(groups2,
|
|
24447
|
+
function normalizeDeepSeekModelCatalog(groups2, selection3) {
|
|
23609
24448
|
const thinkingOptions = [];
|
|
23610
24449
|
const knownEffortIds = /* @__PURE__ */ new Set();
|
|
23611
24450
|
for (const group of groups2) {
|
|
@@ -23621,25 +24460,34 @@ function normalizeDeepSeekModelCatalog(groups2, selection2) {
|
|
|
23621
24460
|
}
|
|
23622
24461
|
}
|
|
23623
24462
|
}
|
|
24463
|
+
const identities = groups2.flatMap((group) => group.models.map((model2) => ({ provider: group.id, model: model2.id })));
|
|
24464
|
+
if (selection3 && !identities.some((model2) => sameModel(model2, selection3))) {
|
|
24465
|
+
identities.push({ provider: selection3.provider, model: selection3.model });
|
|
24466
|
+
}
|
|
24467
|
+
const index = modelIndex(identities);
|
|
23624
24468
|
const models = groups2.flatMap((group) => group.models.map((model2) => ({
|
|
23625
|
-
ref:
|
|
24469
|
+
ref: index.encode({ provider: group.id, model: model2.id }),
|
|
23626
24470
|
label: `${group.name} / ${model2.name}`,
|
|
23627
24471
|
...model2.reasoning && model2.reasoning.efforts.length > 0 ? { supportedThinkingOptionIds: model2.reasoning.efforts.map((effort) => effort.id) } : {}
|
|
23628
24472
|
})));
|
|
23629
|
-
const defaultModel =
|
|
23630
|
-
if (
|
|
23631
|
-
models.unshift({ ref: defaultModel, label: `${
|
|
24473
|
+
const defaultModel = selection3 ? index.encode(selection3) : void 0;
|
|
24474
|
+
if (selection3 && defaultModel && !models.some((model2) => model2.ref.id === defaultModel.id)) {
|
|
24475
|
+
models.unshift({ ref: defaultModel, label: `${selection3.provider} / ${selection3.model}` });
|
|
23632
24476
|
}
|
|
23633
|
-
const defaultReasoning =
|
|
23634
|
-
const defaultThinkingOptionId = parseDeepSeekThinkingOptionId(
|
|
23635
|
-
|
|
24477
|
+
const defaultReasoning = selection3 ? groups2.find((group) => group.id === selection3.provider)?.models.find((model2) => model2.id === selection3.model)?.reasoning : void 0;
|
|
24478
|
+
const defaultThinkingOptionId = parseDeepSeekThinkingOptionId(selection3?.reasoningEffort ?? defaultReasoning?.defaultEffort);
|
|
24479
|
+
const catalog = harnessModelCatalogSchema.parse({
|
|
23636
24480
|
models,
|
|
23637
24481
|
...defaultModel ? { defaultModel } : {},
|
|
23638
24482
|
thinkingOptions,
|
|
23639
24483
|
...defaultThinkingOptionId && defaultReasoning?.efforts.some((effort) => effort.id === defaultThinkingOptionId) ? { defaultThinkingOptionId } : {}
|
|
23640
24484
|
});
|
|
24485
|
+
return { catalog, index };
|
|
23641
24486
|
}
|
|
23642
24487
|
|
|
24488
|
+
// dist/modern/catalog.js
|
|
24489
|
+
import { Buffer as Buffer3 } from "node:buffer";
|
|
24490
|
+
|
|
23643
24491
|
// dist/modern/remote-connection.js
|
|
23644
24492
|
import { spawn as spawn2 } from "node:child_process";
|
|
23645
24493
|
import { randomUUID } from "node:crypto";
|
|
@@ -24762,7 +25610,7 @@ function array2(value, maximum, area) {
|
|
|
24762
25610
|
}
|
|
24763
25611
|
return value;
|
|
24764
25612
|
}
|
|
24765
|
-
function
|
|
25613
|
+
function selection2(value) {
|
|
24766
25614
|
if (!isPlainRecord(value) || !exactKeys2(value, ["provider", "model"], ["reasoningEffort"])) {
|
|
24767
25615
|
throw catalogError("protocolError", "DeepSeek Harness returned an invalid default Model");
|
|
24768
25616
|
}
|
|
@@ -24782,19 +25630,19 @@ function reasoning(value) {
|
|
|
24782
25630
|
if (!isPlainRecord(candidate) || !exactKeys2(candidate, ["id", "name"], ["description"])) {
|
|
24783
25631
|
throw catalogError("protocolError", "DeepSeek Harness returned an invalid reasoning effort");
|
|
24784
25632
|
}
|
|
24785
|
-
const
|
|
24786
|
-
if (!harnessThinkingOptionIdSchema.safeParse(
|
|
25633
|
+
const id2 = boundedString(candidate.id, MAX_ID_LENGTH, "reasoning effort id");
|
|
25634
|
+
if (!harnessThinkingOptionIdSchema.safeParse(id2).success) {
|
|
24787
25635
|
throw catalogError("protocolError", "DeepSeek Harness returned an unusable reasoning effort id");
|
|
24788
25636
|
}
|
|
24789
25637
|
return {
|
|
24790
|
-
id,
|
|
25638
|
+
id: id2,
|
|
24791
25639
|
name: boundedString(candidate.name, MAX_NAME_LENGTH, "reasoning effort name"),
|
|
24792
25640
|
...candidate.description === void 0 ? {} : {
|
|
24793
25641
|
description: boundedString(candidate.description, MAX_DESCRIPTION_LENGTH, "reasoning effort description", true)
|
|
24794
25642
|
}
|
|
24795
25643
|
};
|
|
24796
25644
|
});
|
|
24797
|
-
const ids = efforts.map(({ id }) =>
|
|
25645
|
+
const ids = efforts.map(({ id: id2 }) => id2);
|
|
24798
25646
|
if (new Set(ids).size !== ids.length) {
|
|
24799
25647
|
throw catalogError("protocolError", "DeepSeek Harness returned duplicate reasoning efforts");
|
|
24800
25648
|
}
|
|
@@ -24822,8 +25670,8 @@ function groups(value, routable) {
|
|
|
24822
25670
|
if (!isPlainRecord(candidate) || !exactKeys2(candidate, ["id", "name", "models"])) {
|
|
24823
25671
|
throw catalogError("protocolError", "DeepSeek Harness returned an invalid Model provider group");
|
|
24824
25672
|
}
|
|
24825
|
-
const
|
|
24826
|
-
if (!routable.has(
|
|
25673
|
+
const id2 = boundedString(candidate.id, MAX_ID_LENGTH, "Model provider id");
|
|
25674
|
+
if (!routable.has(id2)) {
|
|
24827
25675
|
throw catalogError("protocolError", "DeepSeek Harness returned a non-routable Model group");
|
|
24828
25676
|
}
|
|
24829
25677
|
const name = boundedString(candidate.name, MAX_NAME_LENGTH, "Model provider name");
|
|
@@ -24858,9 +25706,9 @@ function groups(value, routable) {
|
|
|
24858
25706
|
if (new Set(modelIds).size !== modelIds.length) {
|
|
24859
25707
|
throw catalogError("protocolError", "DeepSeek Harness returned duplicate Model ids");
|
|
24860
25708
|
}
|
|
24861
|
-
return { id, name, models };
|
|
25709
|
+
return { id: id2, name, models };
|
|
24862
25710
|
});
|
|
24863
|
-
const ids = parsed.map(({ id }) =>
|
|
25711
|
+
const ids = parsed.map(({ id: id2 }) => id2);
|
|
24864
25712
|
if (new Set(ids).size !== ids.length) {
|
|
24865
25713
|
throw catalogError("protocolError", "DeepSeek Harness returned duplicate Model provider groups");
|
|
24866
25714
|
}
|
|
@@ -24872,13 +25720,13 @@ function validateFailures(value, routable, successful) {
|
|
|
24872
25720
|
if (!isPlainRecord(candidate) || !exactKeys2(candidate, ["id", "name", "message"])) {
|
|
24873
25721
|
throw catalogError("protocolError", "DeepSeek Harness returned an invalid provider failure");
|
|
24874
25722
|
}
|
|
24875
|
-
const
|
|
25723
|
+
const id2 = boundedString(candidate.id, MAX_ID_LENGTH, "failed provider id");
|
|
24876
25724
|
boundedString(candidate.name, MAX_NAME_LENGTH, "failed provider name");
|
|
24877
25725
|
boundedString(candidate.message, MAX_DESCRIPTION_LENGTH, "provider failure message", true);
|
|
24878
|
-
if (!routable.has(
|
|
25726
|
+
if (!routable.has(id2) || successful.has(id2)) {
|
|
24879
25727
|
throw catalogError("protocolError", "DeepSeek Harness returned an inconsistent provider failure");
|
|
24880
25728
|
}
|
|
24881
|
-
ids.push(
|
|
25729
|
+
ids.push(id2);
|
|
24882
25730
|
}
|
|
24883
25731
|
if (new Set(ids).size !== ids.length) {
|
|
24884
25732
|
throw catalogError("protocolError", "DeepSeek Harness returned duplicate provider failures");
|
|
@@ -24889,26 +25737,24 @@ function parseModernModelCatalog(value) {
|
|
|
24889
25737
|
if (!isPlainRecord(value) || !exactKeys2(value, ["default", "routableProviders", "groups", "failures"])) {
|
|
24890
25738
|
throw catalogError("protocolError", "DeepSeek Harness returned an invalid model catalog");
|
|
24891
25739
|
}
|
|
24892
|
-
const defaultSelection =
|
|
25740
|
+
const defaultSelection = selection2(value.default);
|
|
24893
25741
|
const routableProviders = array2(value.routableProviders, MAX_PROVIDERS, "routable provider list").map((candidate) => boundedString(candidate, MAX_ID_LENGTH, "routable provider id"));
|
|
24894
25742
|
if (new Set(routableProviders).size !== routableProviders.length) {
|
|
24895
25743
|
throw catalogError("protocolError", "DeepSeek Harness returned duplicate routable providers");
|
|
24896
25744
|
}
|
|
24897
25745
|
const routable = new Set(routableProviders);
|
|
24898
25746
|
const parsedGroups = groups(value.groups, routable);
|
|
24899
|
-
validateFailures(value.failures, routable, new Set(parsedGroups.map(({ id }) =>
|
|
24900
|
-
let catalog;
|
|
25747
|
+
validateFailures(value.failures, routable, new Set(parsedGroups.map(({ id: id2 }) => id2)));
|
|
24901
25748
|
try {
|
|
24902
|
-
|
|
25749
|
+
return {
|
|
25750
|
+
...normalizeDeepSeekModelCatalog(parsedGroups, routable.has(defaultSelection.provider) ? defaultSelection : void 0),
|
|
25751
|
+
defaultSelection,
|
|
25752
|
+
routableProviders,
|
|
25753
|
+
groups: parsedGroups
|
|
25754
|
+
};
|
|
24903
25755
|
} catch {
|
|
24904
25756
|
throw catalogError("protocolError", "DeepSeek Harness returned an unusable model catalog");
|
|
24905
25757
|
}
|
|
24906
|
-
return {
|
|
24907
|
-
catalog,
|
|
24908
|
-
defaultSelection,
|
|
24909
|
-
routableProviders,
|
|
24910
|
-
groups: parsedGroups
|
|
24911
|
-
};
|
|
24912
25758
|
}
|
|
24913
25759
|
async function loadModernModelCatalog(remote, signal) {
|
|
24914
25760
|
try {
|
|
@@ -25882,11 +26728,11 @@ function presetOptions(value, area) {
|
|
|
25882
26728
|
if (!isPlainRecord4(candidate) || !exactKeys3(candidate, ["value", "name"], ["description"])) {
|
|
25883
26729
|
throw permissionError("protocolError", "DeepSeek Harness returned an invalid permission option");
|
|
25884
26730
|
}
|
|
25885
|
-
const
|
|
25886
|
-
if (!
|
|
26731
|
+
const id2 = harnessPermissionModeIdSchema.safeParse(candidate.value);
|
|
26732
|
+
if (!id2.success) {
|
|
25887
26733
|
throw permissionError("protocolError", "DeepSeek Harness returned an invalid permission option id");
|
|
25888
26734
|
}
|
|
25889
|
-
if (
|
|
26735
|
+
if (id2.data === CUSTOM_PERMISSION_MODE_ID) {
|
|
25890
26736
|
throw permissionError("protocolError", "DeepSeek Harness advertised the reserved custom permission");
|
|
25891
26737
|
}
|
|
25892
26738
|
const label = nonBlankString2(candidate.name, HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH, "permission label");
|
|
@@ -25896,13 +26742,13 @@ function presetOptions(value, area) {
|
|
|
25896
26742
|
}
|
|
25897
26743
|
const presentation = presetLabels.get(label);
|
|
25898
26744
|
return {
|
|
25899
|
-
id:
|
|
26745
|
+
id: id2.data,
|
|
25900
26746
|
label,
|
|
25901
26747
|
...presentation ? { localizations: { en: { label: presentation.en }, "zh-CN": { label: presentation.zh } } } : {},
|
|
25902
26748
|
...description?.trim() ? { description } : {}
|
|
25903
26749
|
};
|
|
25904
26750
|
});
|
|
25905
|
-
if (new Set(modes.map(({ id }) =>
|
|
26751
|
+
if (new Set(modes.map(({ id: id2 }) => id2)).size !== modes.length) {
|
|
25906
26752
|
throw permissionError("protocolError", "DeepSeek Harness returned duplicate permission choices");
|
|
25907
26753
|
}
|
|
25908
26754
|
return modes;
|
|
@@ -25914,11 +26760,11 @@ function parseModernPermissionPresetCatalog(value) {
|
|
|
25914
26760
|
}
|
|
25915
26761
|
const modes = presetOptions(value.options, "options");
|
|
25916
26762
|
const defaults = presetOptions(value.defaultOptions, "default options");
|
|
25917
|
-
if (defaults.some((preset) => !modes.some(({ id, label, description }) =>
|
|
26763
|
+
if (defaults.some((preset) => !modes.some(({ id: id2, label, description }) => id2 === preset.id && label === preset.label && description === preset.description))) {
|
|
25918
26764
|
throw permissionError("protocolError", "DeepSeek Harness permission defaults disagree with its selectable presets");
|
|
25919
26765
|
}
|
|
25920
26766
|
const defaultModeId = harnessPermissionModeIdSchema.safeParse(value.defaultPreset);
|
|
25921
|
-
if (!defaultModeId.success || !defaults.some(({ id }) =>
|
|
26767
|
+
if (!defaultModeId.success || !defaults.some(({ id: id2 }) => id2 === defaultModeId.data)) {
|
|
25922
26768
|
throw permissionError("protocolError", "DeepSeek Harness returned an invalid permission default");
|
|
25923
26769
|
}
|
|
25924
26770
|
try {
|
|
@@ -25955,7 +26801,7 @@ function parseCurrentPermission(value, catalog) {
|
|
|
25955
26801
|
if (!current.success) {
|
|
25956
26802
|
throw permissionError("protocolError", "DeepSeek Harness returned an invalid current permission");
|
|
25957
26803
|
}
|
|
25958
|
-
if (current.data !== CUSTOM_PERMISSION_MODE_ID && current.data !== AUTO_PERMISSION_MODE_ID && !catalog.modes.some(({ id }) =>
|
|
26804
|
+
if (current.data !== CUSTOM_PERMISSION_MODE_ID && current.data !== AUTO_PERMISSION_MODE_ID && !catalog.modes.some(({ id: id2 }) => id2 === current.data)) {
|
|
25959
26805
|
throw permissionError("protocolError", "DeepSeek Harness returned an unknown current permission");
|
|
25960
26806
|
}
|
|
25961
26807
|
return current.data;
|
|
@@ -25980,7 +26826,7 @@ function readModernPermissionModeState(row, catalog) {
|
|
|
25980
26826
|
}
|
|
25981
26827
|
function isModernPermissionModeProjectionMatch(value, catalog, expectedPermissionModeId) {
|
|
25982
26828
|
const expected = harnessPermissionModeIdSchema.safeParse(expectedPermissionModeId);
|
|
25983
|
-
if (!expected.success || !catalog.modes.some(({ id }) =>
|
|
26829
|
+
if (!expected.success || !catalog.modes.some(({ id: id2 }) => id2 === expected.data)) {
|
|
25984
26830
|
throw new TypeError("expectedPermissionModeId is not in the permission catalog");
|
|
25985
26831
|
}
|
|
25986
26832
|
return parseCurrentPermission(value, catalog) === expected.data;
|
|
@@ -26059,28 +26905,28 @@ function readModernModelSelectionState(row, catalog) {
|
|
|
26059
26905
|
throw configurationError("protocolError", "DeepSeek Harness modelSelection projection has an invalid sequence");
|
|
26060
26906
|
}
|
|
26061
26907
|
const projected = parseProjectionSelection(row.value);
|
|
26062
|
-
const
|
|
26908
|
+
const selection3 = projected ?? parseSelection(catalog.defaultSelection, "default Model selection");
|
|
26063
26909
|
try {
|
|
26064
|
-
encodeDeepSeekHarnessModelRef(
|
|
26910
|
+
encodeDeepSeekHarnessModelRef(selection3, catalog.index);
|
|
26065
26911
|
} catch {
|
|
26066
26912
|
throw configurationError("protocolError", "DeepSeek Harness modelSelection projection cannot be represented by codexhost");
|
|
26067
26913
|
}
|
|
26068
|
-
return { selection:
|
|
26914
|
+
return { selection: selection3, projectionSeq: row.seq, explicit: projected !== null };
|
|
26069
26915
|
}
|
|
26070
|
-
function stateForSelection(nativeRef,
|
|
26071
|
-
const effectiveModel = encodeDeepSeekHarnessModelRef(
|
|
26072
|
-
if (!catalog.routableProviders.includes(
|
|
26916
|
+
function stateForSelection(nativeRef, selection3, catalog, permissionModeId) {
|
|
26917
|
+
const effectiveModel = encodeDeepSeekHarnessModelRef(selection3, catalog.index);
|
|
26918
|
+
if (!catalog.routableProviders.includes(selection3.provider)) {
|
|
26073
26919
|
throw configurationError("protocolError", "DeepSeek Harness modelSelection names a non-routable provider");
|
|
26074
26920
|
}
|
|
26075
|
-
const nativeModel = catalog.groups.find(({ id }) =>
|
|
26921
|
+
const nativeModel = catalog.groups.find(({ id: id2 }) => id2 === selection3.provider)?.models.find(({ id: id2 }) => id2 === selection3.model);
|
|
26076
26922
|
const catalogModel = nativeModel ? catalog.catalog.models.find(({ ref }) => ref.id === effectiveModel.id) : void 0;
|
|
26077
26923
|
const availableThinkingOptions = normalizeDeepSeekThinkingOptions({
|
|
26078
|
-
current:
|
|
26924
|
+
current: selection3,
|
|
26079
26925
|
groups: catalog.groups
|
|
26080
26926
|
});
|
|
26081
|
-
const effectiveEffort =
|
|
26927
|
+
const effectiveEffort = selection3.reasoningEffort ?? nativeModel?.reasoning?.defaultEffort;
|
|
26082
26928
|
const effectiveThinkingOptionId = effectiveEffort === void 0 ? void 0 : harnessThinkingOptionIdSchema.parse(effectiveEffort);
|
|
26083
|
-
const canPublishThinkingOptions = availableThinkingOptions.length > 0 && (!effectiveThinkingOptionId || availableThinkingOptions.some(({ id }) =>
|
|
26929
|
+
const canPublishThinkingOptions = availableThinkingOptions.length > 0 && (!effectiveThinkingOptionId || availableThinkingOptions.some(({ id: id2 }) => id2 === effectiveThinkingOptionId));
|
|
26084
26930
|
return {
|
|
26085
26931
|
nativeRef,
|
|
26086
26932
|
effectiveModel,
|
|
@@ -26106,7 +26952,7 @@ function readModernConfigurationSnapshot(input) {
|
|
|
26106
26952
|
function modernSelectionForModel(catalog, model2, thinkingOptionId) {
|
|
26107
26953
|
let native;
|
|
26108
26954
|
try {
|
|
26109
|
-
native = decodeDeepSeekHarnessModelRef(model2);
|
|
26955
|
+
native = decodeDeepSeekHarnessModelRef(model2, catalog.index);
|
|
26110
26956
|
} catch (error51) {
|
|
26111
26957
|
throw configurationError("invalidRequest", error51 instanceof Error ? error51.message : "DeepSeek Harness Model is invalid");
|
|
26112
26958
|
}
|
|
@@ -26114,7 +26960,7 @@ function modernSelectionForModel(catalog, model2, thinkingOptionId) {
|
|
|
26114
26960
|
if (!catalogModel) {
|
|
26115
26961
|
throw configurationError("invalidRequest", "DeepSeek Harness Model is unavailable");
|
|
26116
26962
|
}
|
|
26117
|
-
const nativeModel = catalog.groups.find(({ id }) =>
|
|
26963
|
+
const nativeModel = catalog.groups.find(({ id: id2 }) => id2 === native.provider)?.models.find(({ id: id2 }) => id2 === native.model);
|
|
26118
26964
|
const effort = thinkingOptionId ?? nativeModel?.reasoning?.defaultEffort;
|
|
26119
26965
|
if (effort !== void 0) {
|
|
26120
26966
|
const parsed = harnessThinkingOptionIdSchema.safeParse(effort);
|
|
@@ -26166,7 +27012,7 @@ async function selectModernModel(remote, control, sessionId, catalog, requested,
|
|
|
26166
27012
|
}
|
|
26167
27013
|
async function selectModernPermissionMode(remote, control, sessionId, catalog, permissionModeId, signal) {
|
|
26168
27014
|
const requested = harnessPermissionModeIdSchema.safeParse(permissionModeId);
|
|
26169
|
-
if (!requested.success || !catalog?.modes.some(({ id }) =>
|
|
27015
|
+
if (!requested.success || !catalog?.modes.some(({ id: id2 }) => id2 === requested.data)) {
|
|
26170
27016
|
throw configurationError(catalog ? "invalidRequest" : "unsupported", "DeepSeek Harness Permission Mode is unavailable");
|
|
26171
27017
|
}
|
|
26172
27018
|
const current = await requireModernPermissionModeState(control, sessionId, catalog, signal);
|
|
@@ -27037,7 +27883,7 @@ function parseQuestionRequest(value) {
|
|
|
27037
27883
|
if (value.questions.length === 0)
|
|
27038
27884
|
throw invalidFrame();
|
|
27039
27885
|
const questions = value.questions.map(parseQuestionItem);
|
|
27040
|
-
if (new Set(questions.map(({ id }) =>
|
|
27886
|
+
if (new Set(questions.map(({ id: id2 }) => id2)).size !== questions.length)
|
|
27041
27887
|
throw invalidFrame();
|
|
27042
27888
|
const wait = Object.hasOwn(value, "wait") ? parseQuestionWait(value.wait) : void 0;
|
|
27043
27889
|
if (questions.some(({ intent }) => intent?.kind === "approval") && (questions.length !== 1 || wait !== void 0)) {
|
|
@@ -27417,9 +28263,9 @@ async function openModernJournal(remote, request, options = {}) {
|
|
|
27417
28263
|
}
|
|
27418
28264
|
const parsed = parseLiveItem(item.value, limits, profile);
|
|
27419
28265
|
if ("frame" in parsed.item) {
|
|
27420
|
-
const
|
|
28266
|
+
const expectedRevision2 = assistantRevision + 1;
|
|
27421
28267
|
const restartsLifecycle = parsed.item.frame.type === "start" && parsed.item.frame.revision === 1;
|
|
27422
|
-
if (!restartsLifecycle && parsed.item.frame.revision !==
|
|
28268
|
+
if (!restartsLifecycle && parsed.item.frame.revision !== expectedRevision2) {
|
|
27423
28269
|
throw new ModernJournalDesyncError("journal assistant stream is not revision-contiguous");
|
|
27424
28270
|
}
|
|
27425
28271
|
assistantRevision = parsed.item.frame.revision;
|
|
@@ -27578,10 +28424,10 @@ function parseWindow(records, hasMore, expectedLastSeq, label, limits, profile)
|
|
|
27578
28424
|
const events = [];
|
|
27579
28425
|
let retainedBytes = 0;
|
|
27580
28426
|
const logicalLimit = expectedLastSeq < 0 ? 0 : expectedLastSeq + 1;
|
|
27581
|
-
for (const
|
|
27582
|
-
assertWireBytes(
|
|
28427
|
+
for (const record4 of records) {
|
|
28428
|
+
assertWireBytes(record4, limits.maxRecordBytes, `${label} record`);
|
|
27583
28429
|
const remaining = Math.min(limits.maxEvents, logicalLimit) - events.length;
|
|
27584
|
-
const expanded = profile.parseHistoryRecord(
|
|
28430
|
+
const expanded = profile.parseHistoryRecord(record4, remaining);
|
|
27585
28431
|
const expandedBytes = expanded.reduce((total, event) => total + Buffer.byteLength(JSON.stringify(event), "utf8"), 0);
|
|
27586
28432
|
if (expandedBytes > limits.maxHistoryBytes - retainedBytes) {
|
|
27587
28433
|
throw limitError("journal history exceeded maxHistoryBytes");
|
|
@@ -27840,12 +28686,12 @@ function invalidInbox() {
|
|
|
27840
28686
|
}
|
|
27841
28687
|
|
|
27842
28688
|
// dist/modern/history.js
|
|
27843
|
-
import
|
|
28689
|
+
import path9 from "node:path";
|
|
27844
28690
|
import { isDeepStrictEqual as isDeepStrictEqual5 } from "node:util";
|
|
27845
28691
|
|
|
27846
28692
|
// ../../harness-adapter/dist/local-media-markdown.js
|
|
27847
28693
|
import { existsSync, statSync as statSync2 } from "node:fs";
|
|
27848
|
-
import
|
|
28694
|
+
import path8 from "node:path";
|
|
27849
28695
|
import { fileURLToPath } from "node:url";
|
|
27850
28696
|
var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
27851
28697
|
".aac",
|
|
@@ -28148,7 +28994,7 @@ function skipBlanks(text, start) {
|
|
|
28148
28994
|
return index;
|
|
28149
28995
|
}
|
|
28150
28996
|
function mediaMarkdownImage(absolutePath) {
|
|
28151
|
-
const name =
|
|
28997
|
+
const name = path8.basename(absolutePath).replaceAll("]", "\\]");
|
|
28152
28998
|
return `})`;
|
|
28153
28999
|
}
|
|
28154
29000
|
function markdownDestination(absolutePath, bracketed) {
|
|
@@ -28167,11 +29013,11 @@ function resolveLocalMediaPath(raw, roots, exists = mediaFileExists) {
|
|
|
28167
29013
|
if (stripped === null)
|
|
28168
29014
|
return null;
|
|
28169
29015
|
if (isAbsoluteMediaPath(stripped)) {
|
|
28170
|
-
const absolute =
|
|
29016
|
+
const absolute = path8.resolve(stripped);
|
|
28171
29017
|
return hasMediaExtension(absolute) && exists(absolute) ? absolute : null;
|
|
28172
29018
|
}
|
|
28173
29019
|
for (const root of roots) {
|
|
28174
|
-
const absolute =
|
|
29020
|
+
const absolute = path8.resolve(root, stripped);
|
|
28175
29021
|
if (hasMediaExtension(absolute) && exists(absolute))
|
|
28176
29022
|
return absolute;
|
|
28177
29023
|
}
|
|
@@ -28190,10 +29036,10 @@ function stripFileUrl(value) {
|
|
|
28190
29036
|
}
|
|
28191
29037
|
}
|
|
28192
29038
|
function isAbsoluteMediaPath(value) {
|
|
28193
|
-
return
|
|
29039
|
+
return path8.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
|
|
28194
29040
|
}
|
|
28195
29041
|
function hasMediaExtension(value) {
|
|
28196
|
-
return MEDIA_EXTENSIONS.has(
|
|
29042
|
+
return MEDIA_EXTENSIONS.has(path8.extname(value).toLowerCase());
|
|
28197
29043
|
}
|
|
28198
29044
|
function mediaFileExists(absolutePath) {
|
|
28199
29045
|
try {
|
|
@@ -28822,7 +29668,7 @@ function projectModernHistory(input) {
|
|
|
28822
29668
|
const toolOutputLimit = boundedInteger(input.toolOutputLimit ?? MODERN_TOOL_OUTPUT_LIMIT, "toolOutputLimit", 0);
|
|
28823
29669
|
const validator = new ModernEventValidator(input.maxEvents, profile);
|
|
28824
29670
|
const turns = [];
|
|
28825
|
-
let
|
|
29671
|
+
let active2 = null;
|
|
28826
29672
|
let effectiveModel = input.fallbackModel;
|
|
28827
29673
|
let effectiveThinkingOptionId = input.fallbackThinkingOptionId;
|
|
28828
29674
|
let contextWindowTokens;
|
|
@@ -28853,7 +29699,7 @@ function projectModernHistory(input) {
|
|
|
28853
29699
|
workingDirectory = modernWorkingDirectory(workingDirectory, event);
|
|
28854
29700
|
switch (event.type) {
|
|
28855
29701
|
case "turn/start":
|
|
28856
|
-
|
|
29702
|
+
active2 = {
|
|
28857
29703
|
turn: data.turn,
|
|
28858
29704
|
startIndex: index,
|
|
28859
29705
|
input: [],
|
|
@@ -28865,19 +29711,19 @@ function projectModernHistory(input) {
|
|
|
28865
29711
|
};
|
|
28866
29712
|
break;
|
|
28867
29713
|
case "model/selection": {
|
|
28868
|
-
const
|
|
28869
|
-
effectiveModel =
|
|
28870
|
-
effectiveThinkingOptionId =
|
|
28871
|
-
if (
|
|
28872
|
-
|
|
29714
|
+
const selection3 = selectionFrom(data, input.modelIndex);
|
|
29715
|
+
effectiveModel = selection3.model;
|
|
29716
|
+
effectiveThinkingOptionId = selection3.thinking;
|
|
29717
|
+
if (active2)
|
|
29718
|
+
active2.model = selection3.model;
|
|
28873
29719
|
break;
|
|
28874
29720
|
}
|
|
28875
29721
|
case "request/header": {
|
|
28876
|
-
const
|
|
28877
|
-
effectiveModel =
|
|
28878
|
-
effectiveThinkingOptionId =
|
|
28879
|
-
if (
|
|
28880
|
-
|
|
29722
|
+
const selection3 = selectionFromHeader(data, input.modelIndex);
|
|
29723
|
+
effectiveModel = selection3.model;
|
|
29724
|
+
effectiveThinkingOptionId = selection3.thinking;
|
|
29725
|
+
if (active2)
|
|
29726
|
+
active2.model = selection3.model;
|
|
28881
29727
|
break;
|
|
28882
29728
|
}
|
|
28883
29729
|
case "request/context":
|
|
@@ -28885,8 +29731,8 @@ function projectModernHistory(input) {
|
|
|
28885
29731
|
rebuildUsage();
|
|
28886
29732
|
break;
|
|
28887
29733
|
case "user/message":
|
|
28888
|
-
if (
|
|
28889
|
-
|
|
29734
|
+
if (active2 && event.surfaceOp === "append" && isRecord4(data.source) && data.source.kind === "user") {
|
|
29735
|
+
active2.input.push(...textInputs(data.content));
|
|
28890
29736
|
}
|
|
28891
29737
|
break;
|
|
28892
29738
|
case "assistant/attempt":
|
|
@@ -28895,18 +29741,18 @@ function projectModernHistory(input) {
|
|
|
28895
29741
|
case "assistant/message":
|
|
28896
29742
|
if (event.surfaceOp === "append") {
|
|
28897
29743
|
recordSettlementUsage(data, event.seq);
|
|
28898
|
-
if (
|
|
28899
|
-
projectAssistantMessage(
|
|
29744
|
+
if (active2) {
|
|
29745
|
+
projectAssistantMessage(active2, input.sessionId, data, media ? modernMediaRoots(workingDirectory, input.cwd) : void 0);
|
|
28900
29746
|
}
|
|
28901
29747
|
}
|
|
28902
29748
|
break;
|
|
28903
29749
|
case "compaction/start":
|
|
28904
|
-
if (
|
|
28905
|
-
if (
|
|
29750
|
+
if (active2 && data.turn === active2.turn && data.sourceCommandId === void 0) {
|
|
29751
|
+
if (active2.compaction)
|
|
28906
29752
|
fail("Modern compactions overlap");
|
|
28907
29753
|
const nativeId = data.compactionId;
|
|
28908
|
-
|
|
28909
|
-
|
|
29754
|
+
active2.compaction = { nativeId, itemIndex: active2.items.length };
|
|
29755
|
+
active2.items.push({
|
|
28910
29756
|
item: {
|
|
28911
29757
|
type: "contextCompaction",
|
|
28912
29758
|
itemId: modernItemId(input.sessionId, `compaction:${nativeId}`)
|
|
@@ -28916,45 +29762,45 @@ function projectModernHistory(input) {
|
|
|
28916
29762
|
}
|
|
28917
29763
|
break;
|
|
28918
29764
|
case "compaction/end":
|
|
28919
|
-
if (
|
|
28920
|
-
if (!
|
|
29765
|
+
if (active2 && data.turn === active2.turn && data.sourceCommandId === void 0) {
|
|
29766
|
+
if (!active2.compaction || active2.compaction.nativeId !== data.compactionId)
|
|
28921
29767
|
fail("Modern compaction ended without its start");
|
|
28922
|
-
const index2 =
|
|
28923
|
-
const snapshot =
|
|
29768
|
+
const index2 = active2.compaction.itemIndex;
|
|
29769
|
+
const snapshot = active2.items[index2];
|
|
28924
29770
|
if (!snapshot)
|
|
28925
29771
|
fail("Modern compaction Item is missing");
|
|
28926
|
-
|
|
28927
|
-
delete
|
|
29772
|
+
active2.items[index2] = { ...snapshot, outcome: modernCompactionOutcome(data) };
|
|
29773
|
+
delete active2.compaction;
|
|
28928
29774
|
}
|
|
28929
29775
|
break;
|
|
28930
29776
|
case "tool/call":
|
|
28931
|
-
if (
|
|
28932
|
-
projectToolCall(
|
|
29777
|
+
if (active2)
|
|
29778
|
+
projectToolCall(active2, input.sessionId, data, event.seq);
|
|
28933
29779
|
break;
|
|
28934
29780
|
case "tool/result":
|
|
28935
|
-
if (
|
|
28936
|
-
projectToolResultEvent(
|
|
29781
|
+
if (active2 && event.surfaceOp === "append") {
|
|
29782
|
+
projectToolResultEvent(active2, input.sessionId, event, toolOutputLimit);
|
|
28937
29783
|
}
|
|
28938
29784
|
break;
|
|
28939
29785
|
case "tool/ptc-dispatch-start":
|
|
28940
|
-
if (
|
|
28941
|
-
projectPtcDispatchStart(
|
|
29786
|
+
if (active2)
|
|
29787
|
+
projectPtcDispatchStart(active2, input.sessionId, data, event.seq);
|
|
28942
29788
|
break;
|
|
28943
29789
|
case "tool/ptc-dispatch":
|
|
28944
|
-
if (
|
|
28945
|
-
projectPtcDispatchSettle(
|
|
29790
|
+
if (active2) {
|
|
29791
|
+
projectPtcDispatchSettle(active2, input.sessionId, data, event.seq, toolOutputLimit);
|
|
28946
29792
|
}
|
|
28947
29793
|
break;
|
|
28948
29794
|
case "turn/end":
|
|
28949
|
-
if (
|
|
29795
|
+
if (active2) {
|
|
28950
29796
|
const terminal = safeTurnReason(data.reason);
|
|
28951
|
-
finishIncompleteTools(
|
|
28952
|
-
if (
|
|
28953
|
-
const index2 =
|
|
28954
|
-
const snapshot =
|
|
29797
|
+
finishIncompleteTools(active2, itemOutcome(terminal.outcome));
|
|
29798
|
+
if (active2.compaction) {
|
|
29799
|
+
const index2 = active2.compaction.itemIndex;
|
|
29800
|
+
const snapshot = active2.items[index2];
|
|
28955
29801
|
if (!snapshot)
|
|
28956
29802
|
fail("Modern compaction Item is missing");
|
|
28957
|
-
|
|
29803
|
+
active2.items[index2] = {
|
|
28958
29804
|
...snapshot,
|
|
28959
29805
|
outcome: terminal.outcome.status === "succeeded" ? modernCompactionOutcome({
|
|
28960
29806
|
error: "DeepSeek Harness compaction ended without a terminal event"
|
|
@@ -28962,14 +29808,14 @@ function projectModernHistory(input) {
|
|
|
28962
29808
|
};
|
|
28963
29809
|
}
|
|
28964
29810
|
turns.push({
|
|
28965
|
-
nativeTurnRef: modernNativeTurnRef(harnessId, input.sessionId,
|
|
29811
|
+
nativeTurnRef: modernNativeTurnRef(harnessId, input.sessionId, active2.turn),
|
|
28966
29812
|
checkpoint: modernCheckpointRef(harnessId, input.sessionId, event.seq, profile),
|
|
28967
|
-
input:
|
|
28968
|
-
items:
|
|
29813
|
+
input: active2.input,
|
|
29814
|
+
items: active2.items,
|
|
28969
29815
|
outcome: terminal.history,
|
|
28970
|
-
...
|
|
29816
|
+
...active2.model ? { model: active2.model } : {}
|
|
28971
29817
|
});
|
|
28972
|
-
|
|
29818
|
+
active2 = null;
|
|
28973
29819
|
}
|
|
28974
29820
|
break;
|
|
28975
29821
|
default:
|
|
@@ -28995,7 +29841,7 @@ function projectModernHistory(input) {
|
|
|
28995
29841
|
effectiveThinkingOptionId,
|
|
28996
29842
|
contextWindowTokens,
|
|
28997
29843
|
usage,
|
|
28998
|
-
incompleteTurn:
|
|
29844
|
+
incompleteTurn: active2 ? { turn: active2.turn, events: input.events.slice(active2.startIndex) } : void 0
|
|
28999
29845
|
};
|
|
29000
29846
|
}
|
|
29001
29847
|
function modernNativeTurnRef(harnessId, sessionId, turn) {
|
|
@@ -29023,9 +29869,9 @@ function modernWorkingDirectory(current, event) {
|
|
|
29023
29869
|
return current;
|
|
29024
29870
|
}
|
|
29025
29871
|
const next = event.data.cwd;
|
|
29026
|
-
if (
|
|
29027
|
-
return
|
|
29028
|
-
return current === void 0 ? void 0 :
|
|
29872
|
+
if (path9.isAbsolute(next))
|
|
29873
|
+
return path9.resolve(next);
|
|
29874
|
+
return current === void 0 ? void 0 : path9.resolve(current, next);
|
|
29029
29875
|
}
|
|
29030
29876
|
function modernMediaRoots(workingDirectory, sessionDirectory) {
|
|
29031
29877
|
return [
|
|
@@ -29170,18 +30016,18 @@ function incompleteToolOutcome(toolName) {
|
|
|
29170
30016
|
})
|
|
29171
30017
|
};
|
|
29172
30018
|
}
|
|
29173
|
-
function selectionFrom(data) {
|
|
30019
|
+
function selectionFrom(data, index) {
|
|
29174
30020
|
return {
|
|
29175
30021
|
model: encodeDeepSeekHarnessModelRef({
|
|
29176
30022
|
provider: data.provider,
|
|
29177
30023
|
model: data.model
|
|
29178
|
-
}),
|
|
30024
|
+
}, index),
|
|
29179
30025
|
thinking: parseDeepSeekThinkingOptionId(data.reasoningEffort)
|
|
29180
30026
|
};
|
|
29181
30027
|
}
|
|
29182
|
-
function selectionFromHeader(data) {
|
|
30028
|
+
function selectionFromHeader(data, index) {
|
|
29183
30029
|
const header = data.header;
|
|
29184
|
-
return selectionFrom(header.config);
|
|
30030
|
+
return selectionFrom(header.config, index);
|
|
29185
30031
|
}
|
|
29186
30032
|
function textInputs(value) {
|
|
29187
30033
|
return Array.isArray(value) ? value.flatMap((block) => isRecord4(block) && block.type === "text" && typeof block.text === "string" ? [{ type: "text", text: block.text }] : []) : [];
|
|
@@ -29949,6 +30795,7 @@ var ModernHarnessSession = class {
|
|
|
29949
30795
|
this.#workingDirectory = modernWorkingDirectory(this.#workingDirectory, event);
|
|
29950
30796
|
}
|
|
29951
30797
|
const projection = projectModernHistory({
|
|
30798
|
+
modelIndex: this.#modelCatalog.index,
|
|
29952
30799
|
harnessId: this.harnessId,
|
|
29953
30800
|
sessionId: this.#sessionId,
|
|
29954
30801
|
events: this.#events,
|
|
@@ -30096,9 +30943,9 @@ var ModernHarnessSession = class {
|
|
|
30096
30943
|
this.#queuedDeliveries.set(delivery.eventId, delivery);
|
|
30097
30944
|
return;
|
|
30098
30945
|
}
|
|
30099
|
-
const
|
|
30100
|
-
if (
|
|
30101
|
-
this.#publishInteraction(delivery,
|
|
30946
|
+
const active2 = this.#active;
|
|
30947
|
+
if (active2 && !active2.terminal) {
|
|
30948
|
+
this.#publishInteraction(delivery, active2);
|
|
30102
30949
|
return;
|
|
30103
30950
|
}
|
|
30104
30951
|
this.#queuedDeliveries.set(delivery.eventId, delivery);
|
|
@@ -30117,12 +30964,12 @@ var ModernHarnessSession = class {
|
|
|
30117
30964
|
this.#closeInteraction(interactionId, "cancelled");
|
|
30118
30965
|
}
|
|
30119
30966
|
async cancelNative() {
|
|
30120
|
-
const
|
|
30121
|
-
if (
|
|
30967
|
+
const active2 = this.#active;
|
|
30968
|
+
if (active2?.cancelAcknowledged)
|
|
30122
30969
|
return;
|
|
30123
|
-
const operation =
|
|
30124
|
-
if (
|
|
30125
|
-
|
|
30970
|
+
const operation = active2?.cancelPromise ?? this.#requestNativeCancel(active2);
|
|
30971
|
+
if (active2 && !active2.cancelPromise)
|
|
30972
|
+
active2.cancelPromise = operation;
|
|
30126
30973
|
await operation;
|
|
30127
30974
|
}
|
|
30128
30975
|
onFault(error51) {
|
|
@@ -30302,8 +31149,8 @@ var ModernHarnessSession = class {
|
|
|
30302
31149
|
}
|
|
30303
31150
|
}
|
|
30304
31151
|
#outlivesReleasedWait(pending) {
|
|
30305
|
-
const
|
|
30306
|
-
return !this.#closed && !this.#closing && pending.delivery.type === "question" && pending.delivery.request.wait?.timed === true &&
|
|
31152
|
+
const active2 = this.#active;
|
|
31153
|
+
return !this.#closed && !this.#closing && pending.delivery.type === "question" && pending.delivery.request.wait?.timed === true && active2 !== void 0 && !active2.terminal && active2.interactions.has(pending.interaction.interactionId);
|
|
30307
31154
|
}
|
|
30308
31155
|
/** Keep a timed answer pending until its call's native result arrives or the interaction closes. */
|
|
30309
31156
|
#holdAnswer(pending, callId, answer) {
|
|
@@ -30313,9 +31160,9 @@ var ModernHarnessSession = class {
|
|
|
30313
31160
|
return { callId, answer, outcome };
|
|
30314
31161
|
}
|
|
30315
31162
|
/** Apply the native result of a timed question's call to its Host interaction. */
|
|
30316
|
-
#observeTimedQuestion(
|
|
31163
|
+
#observeTimedQuestion(active2, callId, readOutcome) {
|
|
30317
31164
|
let interactionId;
|
|
30318
|
-
for (const candidate of
|
|
31165
|
+
for (const candidate of active2.interactions) {
|
|
30319
31166
|
const delivery = this.#interactions.get(candidate)?.delivery;
|
|
30320
31167
|
if (delivery?.type === "question" && delivery.request.wait?.timed === true && delivery.request.wait.callId === callId) {
|
|
30321
31168
|
interactionId = candidate;
|
|
@@ -30338,7 +31185,7 @@ var ModernHarnessSession = class {
|
|
|
30338
31185
|
this.#closeInteraction(interactionId, outcome === "answered" ? "superseded" : "cancelled");
|
|
30339
31186
|
}
|
|
30340
31187
|
}
|
|
30341
|
-
#publishInteraction(delivery,
|
|
31188
|
+
#publishInteraction(delivery, active2) {
|
|
30342
31189
|
const interactionId = hostInteractionIdSchema.parse(this.#randomUUID());
|
|
30343
31190
|
if (this.#usedInteractionIds.has(interactionId)) {
|
|
30344
31191
|
throw new ModernEventGatewayError("protocolError", "DeepSeek Harness Host interaction identity was duplicated");
|
|
@@ -30348,7 +31195,7 @@ var ModernHarnessSession = class {
|
|
|
30348
31195
|
interaction = {
|
|
30349
31196
|
type: "approval",
|
|
30350
31197
|
interactionId,
|
|
30351
|
-
turnId:
|
|
31198
|
+
turnId: active2.turnId,
|
|
30352
31199
|
title: delivery.request.displayReason?.en ?? delivery.request.reason ?? `Allow ${delivery.request.toolName}?`,
|
|
30353
31200
|
description: delivery.request.callId ? `${delivery.request.toolName} (${delivery.request.callId})` : delivery.request.toolName,
|
|
30354
31201
|
subject: { type: "nativeAction" },
|
|
@@ -30365,7 +31212,7 @@ var ModernHarnessSession = class {
|
|
|
30365
31212
|
interaction = {
|
|
30366
31213
|
type: "question",
|
|
30367
31214
|
interactionId,
|
|
30368
|
-
turnId:
|
|
31215
|
+
turnId: active2.turnId,
|
|
30369
31216
|
title: first.header ?? "DeepSeek Harness question",
|
|
30370
31217
|
questions: delivery.request.questions.map((question) => {
|
|
30371
31218
|
const prompt = question.detail ? `${question.question}
|
|
@@ -30398,12 +31245,12 @@ ${question.detail}` : question.question;
|
|
|
30398
31245
|
this.#usedInteractionIds.add(interactionId);
|
|
30399
31246
|
this.#interactions.set(interactionId, { delivery, interaction, responding: false });
|
|
30400
31247
|
this.#interactionByEventId.set(delivery.eventId, interactionId);
|
|
30401
|
-
|
|
31248
|
+
active2.interactions.add(interactionId);
|
|
30402
31249
|
this.#channel.emit({ kind: "interaction", interaction });
|
|
30403
31250
|
}
|
|
30404
|
-
#publishQueuedInteractions(
|
|
31251
|
+
#publishQueuedInteractions(active2) {
|
|
30405
31252
|
for (const delivery of [...this.#queuedDeliveries.values()]) {
|
|
30406
|
-
this.#publishInteraction(delivery,
|
|
31253
|
+
this.#publishInteraction(delivery, active2);
|
|
30407
31254
|
}
|
|
30408
31255
|
}
|
|
30409
31256
|
#closeInteraction(interactionId, reason) {
|
|
@@ -30423,8 +31270,8 @@ ${question.detail}` : question.question;
|
|
|
30423
31270
|
reason
|
|
30424
31271
|
});
|
|
30425
31272
|
}
|
|
30426
|
-
#closeActiveInteractions(
|
|
30427
|
-
for (const interactionId of [...
|
|
31273
|
+
#closeActiveInteractions(active2) {
|
|
31274
|
+
for (const interactionId of [...active2.interactions]) {
|
|
30428
31275
|
const pending = this.#interactions.get(interactionId);
|
|
30429
31276
|
if (pending?.continuation) {
|
|
30430
31277
|
this.#closeInteraction(interactionId, "expired");
|
|
@@ -30754,7 +31601,7 @@ ${question.detail}` : question.question;
|
|
|
30754
31601
|
if (admission.cancellationRequested) {
|
|
30755
31602
|
return { ok: false, error: invalidState2("DeepSeek Harness command was cancelled") };
|
|
30756
31603
|
}
|
|
30757
|
-
if (!catalog.value.commands.some(({ id }) =>
|
|
31604
|
+
if (!catalog.value.commands.some(({ id: id2 }) => id2 === parsed.value.commandId)) {
|
|
30758
31605
|
return {
|
|
30759
31606
|
ok: false,
|
|
30760
31607
|
error: {
|
|
@@ -30769,19 +31616,19 @@ ${question.detail}` : question.question;
|
|
|
30769
31616
|
}
|
|
30770
31617
|
const itemId = modernItemId(this.#sessionId, `host-command:${command.turnId}`);
|
|
30771
31618
|
const item = parsed.value.commandId === "dsh.compact" ? { type: "contextCompaction", itemId } : { type: "commandExecution", itemId, command: parsed.value.line };
|
|
30772
|
-
const
|
|
31619
|
+
const active2 = {
|
|
30773
31620
|
command,
|
|
30774
31621
|
line: parsed.value.line,
|
|
30775
31622
|
abort: new AbortController(),
|
|
30776
31623
|
item,
|
|
30777
31624
|
cancellationRequested: false
|
|
30778
31625
|
};
|
|
30779
|
-
this.#activeCommand =
|
|
31626
|
+
this.#activeCommand = active2;
|
|
30780
31627
|
this.#acceptedTurnIds.add(command.turnId);
|
|
30781
|
-
this.#operationControllers.add(
|
|
31628
|
+
this.#operationControllers.add(active2.abort);
|
|
30782
31629
|
this.#emit({ type: "turn.started", turnId: command.turnId });
|
|
30783
31630
|
this.#emit({ type: "item.started", turnId: command.turnId, item });
|
|
30784
|
-
void this.#runHarnessCommand(
|
|
31631
|
+
void this.#runHarnessCommand(active2);
|
|
30785
31632
|
return { ok: true, value: { turnId: command.turnId } };
|
|
30786
31633
|
} finally {
|
|
30787
31634
|
this.#operationControllers.delete(admission.abort);
|
|
@@ -30793,66 +31640,66 @@ ${question.detail}` : question.question;
|
|
|
30793
31640
|
#hasCommandConflict(ignoreOwnOperation = false) {
|
|
30794
31641
|
return Boolean(this.#active || this.#buffer || this.#pendingByRequestId.size > 0 || this.#activeCommand || !ignoreOwnOperation && this.#commandAdmission || this.#queuedDeliveries.size > 0 || this.#configuring || this.#reading);
|
|
30795
31642
|
}
|
|
30796
|
-
async #runHarnessCommand(
|
|
31643
|
+
async #runHarnessCommand(active2) {
|
|
30797
31644
|
try {
|
|
30798
|
-
const execution = await executeModernCommand(this.#remote, this.#sessionId,
|
|
30799
|
-
if (this.#activeCommand !==
|
|
31645
|
+
const execution = await executeModernCommand(this.#remote, this.#sessionId, active2.line, active2.abort.signal);
|
|
31646
|
+
if (this.#activeCommand !== active2)
|
|
30800
31647
|
return;
|
|
30801
31648
|
if (!execution) {
|
|
30802
|
-
this.#finishCommand(
|
|
31649
|
+
this.#finishCommand(active2, {
|
|
30803
31650
|
status: "failed",
|
|
30804
31651
|
error: {
|
|
30805
31652
|
code: "nativeFailure",
|
|
30806
|
-
message: `DeepSeek Harness did not resolve registered command '${
|
|
31653
|
+
message: `DeepSeek Harness did not resolve registered command '${active2.command.commandId}'`,
|
|
30807
31654
|
retryable: false
|
|
30808
31655
|
}
|
|
30809
31656
|
});
|
|
30810
31657
|
return;
|
|
30811
31658
|
}
|
|
30812
31659
|
if (execution.result.kind === "success") {
|
|
30813
|
-
this.#finishCommand(
|
|
30814
|
-
} else if (
|
|
30815
|
-
this.#finishCommand(
|
|
31660
|
+
this.#finishCommand(active2, { status: "succeeded" }, execution.result.text);
|
|
31661
|
+
} else if (active2.cancellationRequested || active2.command.commandId === "dsh.compact" && execution.result.text === DSH_COMPACT_CANCELLED) {
|
|
31662
|
+
this.#finishCommand(active2, { status: "cancelled", reason: execution.result.text }, execution.result.text);
|
|
30816
31663
|
} else {
|
|
30817
|
-
this.#finishCommand(
|
|
31664
|
+
this.#finishCommand(active2, {
|
|
30818
31665
|
status: "failed",
|
|
30819
31666
|
error: {
|
|
30820
|
-
code:
|
|
31667
|
+
code: active2.command.commandId === "dsh.compact" && execution.result.text === DSH_COMPACT_BUSY ? "sessionBusy" : "nativeFailure",
|
|
30821
31668
|
message: execution.result.text,
|
|
30822
31669
|
retryable: true
|
|
30823
31670
|
}
|
|
30824
31671
|
}, execution.result.text);
|
|
30825
31672
|
}
|
|
30826
31673
|
} catch (error51) {
|
|
30827
|
-
if (this.#activeCommand !==
|
|
31674
|
+
if (this.#activeCommand !== active2)
|
|
30828
31675
|
return;
|
|
30829
|
-
if (
|
|
30830
|
-
this.#finishCommand(
|
|
31676
|
+
if (active2.cancellationRequested || active2.abort.signal.aborted) {
|
|
31677
|
+
this.#finishCommand(active2, {
|
|
30831
31678
|
status: "cancelled",
|
|
30832
|
-
reason:
|
|
31679
|
+
reason: active2.command.commandId === "dsh.compact" ? "DeepSeek Harness context compaction was cancelled" : "DeepSeek Harness command was cancelled"
|
|
30833
31680
|
});
|
|
30834
31681
|
} else {
|
|
30835
31682
|
const failure = commandHarnessError(error51);
|
|
30836
31683
|
if (commandFailureRequiresSessionFault(error51))
|
|
30837
31684
|
this.#fault(failure);
|
|
30838
31685
|
else
|
|
30839
|
-
this.#finishCommand(
|
|
31686
|
+
this.#finishCommand(active2, { status: "failed", error: failure });
|
|
30840
31687
|
}
|
|
30841
31688
|
} finally {
|
|
30842
|
-
this.#operationControllers.delete(
|
|
31689
|
+
this.#operationControllers.delete(active2.abort);
|
|
30843
31690
|
}
|
|
30844
31691
|
}
|
|
30845
|
-
#finishCommand(
|
|
30846
|
-
if (this.#activeCommand !==
|
|
31692
|
+
#finishCommand(active2, outcome, output) {
|
|
31693
|
+
if (this.#activeCommand !== active2)
|
|
30847
31694
|
return;
|
|
30848
31695
|
this.#activeCommand = void 0;
|
|
30849
|
-
const item =
|
|
31696
|
+
const item = active2.item.type === "commandExecution" && output !== void 0 ? { ...active2.item, output } : active2.item;
|
|
30850
31697
|
this.#emit({
|
|
30851
31698
|
type: "item.completed",
|
|
30852
|
-
turnId:
|
|
31699
|
+
turnId: active2.command.turnId,
|
|
30853
31700
|
snapshot: { item, outcome }
|
|
30854
31701
|
});
|
|
30855
|
-
this.#emit({ type: "turn.completed", turnId:
|
|
31702
|
+
this.#emit({ type: "turn.completed", turnId: active2.command.turnId, outcome });
|
|
30856
31703
|
this.#activateBufferedAutonomous();
|
|
30857
31704
|
}
|
|
30858
31705
|
#cancel(command) {
|
|
@@ -30872,23 +31719,23 @@ ${question.detail}` : question.question;
|
|
|
30872
31719
|
}
|
|
30873
31720
|
return Promise.resolve({ ok: true, value: { cancellationRequested: true } });
|
|
30874
31721
|
}
|
|
30875
|
-
const
|
|
30876
|
-
if (!
|
|
31722
|
+
const active2 = this.#active;
|
|
31723
|
+
if (!active2 || active2.terminal || active2.turnId !== command.turnId) {
|
|
30877
31724
|
return Promise.resolve({
|
|
30878
31725
|
ok: false,
|
|
30879
31726
|
error: invalidState2("DeepSeek Harness cancel requires the active Turn")
|
|
30880
31727
|
});
|
|
30881
31728
|
}
|
|
30882
|
-
if (
|
|
31729
|
+
if (active2.cancelAcknowledged) {
|
|
30883
31730
|
return Promise.resolve({ ok: true, value: { cancellationRequested: true } });
|
|
30884
31731
|
}
|
|
30885
|
-
if (
|
|
30886
|
-
return
|
|
30887
|
-
const operation = this.#requestNativeCancel(
|
|
30888
|
-
|
|
31732
|
+
if (active2.cancelPromise)
|
|
31733
|
+
return active2.cancelPromise;
|
|
31734
|
+
const operation = this.#requestNativeCancel(active2);
|
|
31735
|
+
active2.cancelPromise = operation;
|
|
30889
31736
|
return operation;
|
|
30890
31737
|
}
|
|
30891
|
-
#requestNativeCancel(
|
|
31738
|
+
#requestNativeCancel(active2) {
|
|
30892
31739
|
const abort = new AbortController();
|
|
30893
31740
|
this.#operationControllers.add(abort);
|
|
30894
31741
|
const operation = (async () => {
|
|
@@ -30906,8 +31753,8 @@ ${question.detail}` : question.question;
|
|
|
30906
31753
|
this.#fault(error51);
|
|
30907
31754
|
return { ok: false, error: error51 };
|
|
30908
31755
|
}
|
|
30909
|
-
if (
|
|
30910
|
-
|
|
31756
|
+
if (active2)
|
|
31757
|
+
active2.cancelAcknowledged = true;
|
|
30911
31758
|
return { ok: true, value: { cancellationRequested: true } };
|
|
30912
31759
|
} catch (error51) {
|
|
30913
31760
|
return {
|
|
@@ -30916,8 +31763,8 @@ ${question.detail}` : question.question;
|
|
|
30916
31763
|
};
|
|
30917
31764
|
} finally {
|
|
30918
31765
|
this.#operationControllers.delete(abort);
|
|
30919
|
-
if (
|
|
30920
|
-
delete
|
|
31766
|
+
if (active2 && !active2.cancelAcknowledged)
|
|
31767
|
+
delete active2.cancelPromise;
|
|
30921
31768
|
}
|
|
30922
31769
|
})();
|
|
30923
31770
|
return operation;
|
|
@@ -31082,46 +31929,46 @@ ${question.detail}` : question.question;
|
|
|
31082
31929
|
}
|
|
31083
31930
|
#discardAssistantAttempt() {
|
|
31084
31931
|
const attempt = this.#assistantAttempt;
|
|
31085
|
-
const
|
|
31086
|
-
if (attempt && !attempt.projected &&
|
|
31087
|
-
this.#cancelAgentItem(
|
|
31932
|
+
const active2 = this.#active;
|
|
31933
|
+
if (attempt && !attempt.projected && active2?.nativeTurn === attempt.turn && active2.agent) {
|
|
31934
|
+
this.#cancelAgentItem(active2);
|
|
31088
31935
|
}
|
|
31089
|
-
if (attempt &&
|
|
31090
|
-
this.#cancelReasoningItem(
|
|
31936
|
+
if (attempt && active2?.reasoning?.attemptId === attempt.attemptId) {
|
|
31937
|
+
this.#cancelReasoningItem(active2);
|
|
31091
31938
|
}
|
|
31092
31939
|
this.#assistantAttempt = void 0;
|
|
31093
31940
|
}
|
|
31094
|
-
#cancelAgentItem(
|
|
31095
|
-
const agent =
|
|
31941
|
+
#cancelAgentItem(active2) {
|
|
31942
|
+
const agent = active2.agent;
|
|
31096
31943
|
if (!agent)
|
|
31097
31944
|
return;
|
|
31098
|
-
this.#flushAgent(
|
|
31945
|
+
this.#flushAgent(active2, agent);
|
|
31099
31946
|
agent.item = { ...agent.item, text: agent.item.text + CANCELLED_ASSISTANT_ATTEMPT_SUFFIX };
|
|
31100
31947
|
this.#emit({
|
|
31101
31948
|
type: "item.updated",
|
|
31102
|
-
turnId:
|
|
31949
|
+
turnId: active2.turnId,
|
|
31103
31950
|
itemId: agent.item.itemId,
|
|
31104
31951
|
update: { type: "text.append", text: CANCELLED_ASSISTANT_ATTEMPT_SUFFIX }
|
|
31105
31952
|
});
|
|
31106
|
-
delete
|
|
31107
|
-
this.#completeItem(
|
|
31953
|
+
delete active2.agent;
|
|
31954
|
+
this.#completeItem(active2, agent.item, { status: "cancelled" });
|
|
31108
31955
|
}
|
|
31109
|
-
#cancelReasoningItem(
|
|
31110
|
-
const reasoning2 =
|
|
31956
|
+
#cancelReasoningItem(active2) {
|
|
31957
|
+
const reasoning2 = active2.reasoning;
|
|
31111
31958
|
if (!reasoning2)
|
|
31112
31959
|
return;
|
|
31113
|
-
delete
|
|
31114
|
-
this.#completeItem(
|
|
31960
|
+
delete active2.reasoning;
|
|
31961
|
+
this.#completeItem(active2, reasoning2.item, { status: "cancelled" });
|
|
31115
31962
|
}
|
|
31116
31963
|
#projectAssistantLiveChunks() {
|
|
31117
31964
|
const attempt = this.#assistantAttempt;
|
|
31118
|
-
const
|
|
31119
|
-
if (!attempt || attempt.projected || !
|
|
31965
|
+
const active2 = this.#active;
|
|
31966
|
+
if (!attempt || attempt.projected || !active2 || active2.terminal || active2.nativeTurn !== attempt.turn)
|
|
31120
31967
|
return;
|
|
31121
31968
|
while (attempt.projectedChunks < attempt.chunks.length) {
|
|
31122
31969
|
const frame = attempt.chunks[attempt.projectedChunks++];
|
|
31123
31970
|
if (frame)
|
|
31124
|
-
this.#projectAssistantChunk(
|
|
31971
|
+
this.#projectAssistantChunk(active2, frame.chunk, attempt.step, false, attempt.attemptId);
|
|
31125
31972
|
}
|
|
31126
31973
|
}
|
|
31127
31974
|
#matchesDurableAssistantSettlement(attempt, outcome) {
|
|
@@ -31138,7 +31985,7 @@ ${question.detail}` : question.question;
|
|
|
31138
31985
|
}
|
|
31139
31986
|
attempt.settlement = { eventType: event.type, seq: event.seq };
|
|
31140
31987
|
}
|
|
31141
|
-
#projectAssistantSettlement(
|
|
31988
|
+
#projectAssistantSettlement(active2, event, initialReplay) {
|
|
31142
31989
|
const attempt = this.#assistantAttempt;
|
|
31143
31990
|
if (!attempt || attempt.settlement?.seq !== event.seq || attempt.projected)
|
|
31144
31991
|
return;
|
|
@@ -31146,8 +31993,8 @@ ${question.detail}` : question.question;
|
|
|
31146
31993
|
if (!initialReplay)
|
|
31147
31994
|
this.#projectAssistantLiveChunks();
|
|
31148
31995
|
} else {
|
|
31149
|
-
this.#cancelAgentItem(
|
|
31150
|
-
this.#cancelReasoningItem(
|
|
31996
|
+
this.#cancelAgentItem(active2);
|
|
31997
|
+
this.#cancelReasoningItem(active2);
|
|
31151
31998
|
}
|
|
31152
31999
|
attempt.projected = true;
|
|
31153
32000
|
if (attempt.ended)
|
|
@@ -31377,7 +32224,7 @@ ${question.detail}` : question.question;
|
|
|
31377
32224
|
if (buffer.active || this.#active) {
|
|
31378
32225
|
throw new ModernHistoryError("protocolError", "Modern Host Turns overlap");
|
|
31379
32226
|
}
|
|
31380
|
-
const
|
|
32227
|
+
const active2 = {
|
|
31381
32228
|
turnId,
|
|
31382
32229
|
nativeTurn: buffer.nativeTurn,
|
|
31383
32230
|
input: [...input],
|
|
@@ -31390,8 +32237,8 @@ ${question.detail}` : question.question;
|
|
|
31390
32237
|
terminal: false,
|
|
31391
32238
|
cancelAcknowledged: false
|
|
31392
32239
|
};
|
|
31393
|
-
buffer.active =
|
|
31394
|
-
this.#active =
|
|
32240
|
+
buffer.active = active2;
|
|
32241
|
+
this.#active = active2;
|
|
31395
32242
|
this.#flush(buffer, initialReplay);
|
|
31396
32243
|
}
|
|
31397
32244
|
#flush(buffer, initialReplay) {
|
|
@@ -31404,152 +32251,152 @@ ${question.detail}` : question.question;
|
|
|
31404
32251
|
this.#projectAssistantLiveChunks();
|
|
31405
32252
|
}
|
|
31406
32253
|
#projectLiveEvent(buffer, event, initialReplay) {
|
|
31407
|
-
const
|
|
31408
|
-
if (!
|
|
32254
|
+
const active2 = buffer.active;
|
|
32255
|
+
if (!active2 || !isRecord4(event.data))
|
|
31409
32256
|
return;
|
|
31410
32257
|
const data = event.data;
|
|
31411
32258
|
switch (event.type) {
|
|
31412
32259
|
case "turn/start":
|
|
31413
|
-
this.#emit({ type: "turn.started", turnId:
|
|
31414
|
-
this.#publishQueuedInteractions(
|
|
32260
|
+
this.#emit({ type: "turn.started", turnId: active2.turnId });
|
|
32261
|
+
this.#publishQueuedInteractions(active2);
|
|
31415
32262
|
return;
|
|
31416
32263
|
case "request/header":
|
|
31417
32264
|
case "request/context":
|
|
31418
32265
|
case "model/selection":
|
|
31419
32266
|
return;
|
|
31420
32267
|
case "compaction/start": {
|
|
31421
|
-
if (data.turn !==
|
|
32268
|
+
if (data.turn !== active2.nativeTurn || data.sourceCommandId !== void 0)
|
|
31422
32269
|
return;
|
|
31423
|
-
if (
|
|
32270
|
+
if (active2.compaction)
|
|
31424
32271
|
throw new ModernHistoryError("protocolError", "Modern compactions overlap");
|
|
31425
32272
|
const nativeId = data.compactionId;
|
|
31426
32273
|
const item = {
|
|
31427
32274
|
type: "contextCompaction",
|
|
31428
32275
|
itemId: modernItemId(this.#sessionId, `compaction:${nativeId}`)
|
|
31429
32276
|
};
|
|
31430
|
-
|
|
31431
|
-
this.#emit({ type: "item.started", turnId:
|
|
32277
|
+
active2.compaction = { nativeId, item };
|
|
32278
|
+
this.#emit({ type: "item.started", turnId: active2.turnId, item });
|
|
31432
32279
|
return;
|
|
31433
32280
|
}
|
|
31434
32281
|
case "compaction/end": {
|
|
31435
|
-
if (data.turn !==
|
|
32282
|
+
if (data.turn !== active2.nativeTurn || data.sourceCommandId !== void 0)
|
|
31436
32283
|
return;
|
|
31437
|
-
if (!
|
|
32284
|
+
if (!active2.compaction || active2.compaction.nativeId !== data.compactionId) {
|
|
31438
32285
|
throw new ModernHistoryError("protocolError", "Modern compaction ended without its start");
|
|
31439
32286
|
}
|
|
31440
|
-
const { item } =
|
|
31441
|
-
delete
|
|
31442
|
-
this.#completeItem(
|
|
32287
|
+
const { item } = active2.compaction;
|
|
32288
|
+
delete active2.compaction;
|
|
32289
|
+
this.#completeItem(active2, item, modernCompactionOutcome(data));
|
|
31443
32290
|
if (!initialReplay)
|
|
31444
|
-
this.#publishUsageChanges(
|
|
32291
|
+
this.#publishUsageChanges(active2.turnId);
|
|
31445
32292
|
return;
|
|
31446
32293
|
}
|
|
31447
32294
|
case "assistant/message":
|
|
31448
|
-
this.#projectAssistantSettlement(
|
|
32295
|
+
this.#projectAssistantSettlement(active2, event, initialReplay);
|
|
31449
32296
|
if (event.surfaceOp === "append")
|
|
31450
|
-
this.#completeAssistant(
|
|
32297
|
+
this.#completeAssistant(active2, data);
|
|
31451
32298
|
if (event.surfaceOp === "append" && data.usage !== void 0 && !initialReplay) {
|
|
31452
|
-
this.#publishUsageChanges(
|
|
32299
|
+
this.#publishUsageChanges(active2.turnId);
|
|
31453
32300
|
}
|
|
31454
32301
|
return;
|
|
31455
32302
|
case "assistant/attempt":
|
|
31456
|
-
this.#projectAssistantSettlement(
|
|
32303
|
+
this.#projectAssistantSettlement(active2, event, initialReplay);
|
|
31457
32304
|
if (!initialReplay)
|
|
31458
|
-
this.#publishUsageChanges(
|
|
32305
|
+
this.#publishUsageChanges(active2.turnId);
|
|
31459
32306
|
return;
|
|
31460
32307
|
case "tool/call":
|
|
31461
|
-
this.#startTool(
|
|
32308
|
+
this.#startTool(active2, data, event.seq);
|
|
31462
32309
|
return;
|
|
31463
32310
|
case "tool/result":
|
|
31464
32311
|
if (event.surfaceOp === "append") {
|
|
31465
|
-
const callId = this.#completeTool(
|
|
31466
|
-
this.#observeTimedQuestion(
|
|
32312
|
+
const callId = this.#completeTool(active2, event);
|
|
32313
|
+
this.#observeTimedQuestion(active2, callId, () => toolResultQuestionOutcome(data));
|
|
31467
32314
|
}
|
|
31468
32315
|
return;
|
|
31469
32316
|
case "tool/ptc-dispatch-start":
|
|
31470
|
-
this.#startPtcDispatch(
|
|
32317
|
+
this.#startPtcDispatch(active2, data, event.seq, event.time);
|
|
31471
32318
|
return;
|
|
31472
32319
|
case "tool/ptc-dispatch":
|
|
31473
|
-
this.#settlePtcDispatch(
|
|
32320
|
+
this.#settlePtcDispatch(active2, data, event.seq, event.time);
|
|
31474
32321
|
if (typeof data.subCallId === "string") {
|
|
31475
|
-
this.#observeTimedQuestion(
|
|
32322
|
+
this.#observeTimedQuestion(active2, data.subCallId, () => ptcDispatchQuestionOutcome(data));
|
|
31476
32323
|
}
|
|
31477
32324
|
return;
|
|
31478
32325
|
case "step/end":
|
|
31479
|
-
this.#cancelReasoningItem(
|
|
32326
|
+
this.#cancelReasoningItem(active2);
|
|
31480
32327
|
return;
|
|
31481
32328
|
case "turn/end":
|
|
31482
|
-
this.#finishTurn(buffer,
|
|
32329
|
+
this.#finishTurn(buffer, active2, data.reason, event.seq);
|
|
31483
32330
|
return;
|
|
31484
32331
|
default:
|
|
31485
32332
|
return;
|
|
31486
32333
|
}
|
|
31487
32334
|
}
|
|
31488
|
-
#projectAssistantChunk(
|
|
32335
|
+
#projectAssistantChunk(active2, chunk, step, initialReplay, attemptId) {
|
|
31489
32336
|
if (chunk.type === "text-delta") {
|
|
31490
|
-
this.#appendAgent(
|
|
32337
|
+
this.#appendAgent(active2, chunk.text, step, attemptId);
|
|
31491
32338
|
} else if (chunk.type === "reasoning-delta") {
|
|
31492
|
-
this.#appendReasoning(
|
|
32339
|
+
this.#appendReasoning(active2, chunk.text, step, true, attemptId);
|
|
31493
32340
|
} else if (chunk.type === "usage" && !initialReplay) {
|
|
31494
|
-
this.#publishUsageChanges(
|
|
32341
|
+
this.#publishUsageChanges(active2.turnId);
|
|
31495
32342
|
}
|
|
31496
32343
|
}
|
|
31497
|
-
#appendAgent(
|
|
32344
|
+
#appendAgent(active2, text, step, attemptId) {
|
|
31498
32345
|
if (!text)
|
|
31499
32346
|
return;
|
|
31500
|
-
if (!
|
|
32347
|
+
if (!active2.agent) {
|
|
31501
32348
|
const item = {
|
|
31502
32349
|
type: "agentMessage",
|
|
31503
|
-
itemId: modernItemId(this.#sessionId, `turn:${
|
|
32350
|
+
itemId: modernItemId(this.#sessionId, `turn:${active2.nativeTurn}:step:${step}:${attemptId ? `attempt:${attemptId}:` : ""}assistant`),
|
|
31504
32351
|
text: ""
|
|
31505
32352
|
};
|
|
31506
32353
|
const buffer = this.#buffer;
|
|
31507
|
-
const workingDirectory = buffer?.active ===
|
|
32354
|
+
const workingDirectory = buffer?.active === active2 ? buffer.workingDirectory : this.#workingDirectory;
|
|
31508
32355
|
const roots = modernMediaRoots(workingDirectory, this.#sessionDirectory);
|
|
31509
|
-
|
|
31510
|
-
this.#emit({ type: "item.started", turnId:
|
|
32356
|
+
active2.agent = { item, text: "", media: new LocalMediaMarkdownStream(roots) };
|
|
32357
|
+
this.#emit({ type: "item.started", turnId: active2.turnId, item });
|
|
31511
32358
|
}
|
|
31512
|
-
|
|
31513
|
-
this.#publishAgent(
|
|
32359
|
+
active2.agent.text += text;
|
|
32360
|
+
this.#publishAgent(active2, active2.agent, active2.agent.media.append(text));
|
|
31514
32361
|
}
|
|
31515
32362
|
/** Publish text the media projection held for a trailing construct before the Item ends. */
|
|
31516
|
-
#flushAgent(
|
|
31517
|
-
this.#publishAgent(
|
|
32363
|
+
#flushAgent(active2, agent) {
|
|
32364
|
+
this.#publishAgent(active2, agent, agent.media.flush());
|
|
31518
32365
|
}
|
|
31519
|
-
#publishAgent(
|
|
32366
|
+
#publishAgent(active2, agent, delta) {
|
|
31520
32367
|
if (!delta)
|
|
31521
32368
|
return;
|
|
31522
32369
|
agent.item = { ...agent.item, text: agent.media.text };
|
|
31523
32370
|
this.#emit({
|
|
31524
32371
|
type: "item.updated",
|
|
31525
|
-
turnId:
|
|
32372
|
+
turnId: active2.turnId,
|
|
31526
32373
|
itemId: agent.item.itemId,
|
|
31527
32374
|
update: { type: "text.append", text: delta }
|
|
31528
32375
|
});
|
|
31529
32376
|
}
|
|
31530
|
-
#startReasoning(
|
|
31531
|
-
if (!
|
|
31532
|
-
const key = provisional ? `reasoning:provisional:${++
|
|
32377
|
+
#startReasoning(active2, step, provisional, attemptId) {
|
|
32378
|
+
if (!active2.reasoning) {
|
|
32379
|
+
const key = provisional ? `reasoning:provisional:${++active2.reasoningOrdinal}` : "reasoning";
|
|
31533
32380
|
const item = {
|
|
31534
32381
|
type: "reasoning",
|
|
31535
|
-
itemId: modernItemId(this.#sessionId, `turn:${
|
|
32382
|
+
itemId: modernItemId(this.#sessionId, `turn:${active2.nativeTurn}:step:${step}:${key}`),
|
|
31536
32383
|
text: ""
|
|
31537
32384
|
};
|
|
31538
|
-
|
|
32385
|
+
active2.reasoning = {
|
|
31539
32386
|
item,
|
|
31540
32387
|
text: "",
|
|
31541
32388
|
provisional,
|
|
31542
32389
|
pendingLineBreaks: "",
|
|
31543
32390
|
...attemptId ? { attemptId } : {}
|
|
31544
32391
|
};
|
|
31545
|
-
this.#emit({ type: "item.started", turnId:
|
|
32392
|
+
this.#emit({ type: "item.started", turnId: active2.turnId, item });
|
|
31546
32393
|
}
|
|
31547
|
-
return
|
|
32394
|
+
return active2.reasoning;
|
|
31548
32395
|
}
|
|
31549
|
-
#appendReasoning(
|
|
32396
|
+
#appendReasoning(active2, text, step, provisional = false, attemptId, final = false) {
|
|
31550
32397
|
if (!text)
|
|
31551
32398
|
return;
|
|
31552
|
-
const reasoning2 = this.#startReasoning(
|
|
32399
|
+
const reasoning2 = this.#startReasoning(active2, step, provisional, attemptId);
|
|
31553
32400
|
const candidate = final ? text : reasoning2.pendingLineBreaks + text;
|
|
31554
32401
|
const appended = final ? candidate : candidate.replace(/[\r\n]+$/u, "");
|
|
31555
32402
|
reasoning2.pendingLineBreaks = final ? "" : candidate.slice(appended.length);
|
|
@@ -31559,18 +32406,18 @@ ${question.detail}` : question.question;
|
|
|
31559
32406
|
reasoning2.item = { ...reasoning2.item, text: reasoning2.text };
|
|
31560
32407
|
this.#emit({
|
|
31561
32408
|
type: "item.updated",
|
|
31562
|
-
turnId:
|
|
32409
|
+
turnId: active2.turnId,
|
|
31563
32410
|
itemId: reasoning2.item.itemId,
|
|
31564
32411
|
update: { type: "text.append", text: appended }
|
|
31565
32412
|
});
|
|
31566
32413
|
}
|
|
31567
|
-
#completeAssistant(
|
|
32414
|
+
#completeAssistant(active2, data) {
|
|
31568
32415
|
const message = data.message;
|
|
31569
32416
|
const step = data.step;
|
|
31570
32417
|
if (Array.isArray(message.content)) {
|
|
31571
32418
|
for (const block of message.content) {
|
|
31572
32419
|
if (isRecord4(block) && block.type === "tool-call" && typeof block.id === "string" && typeof block.name === "string" && typeof block.arguments === "string") {
|
|
31573
|
-
|
|
32420
|
+
active2.advertisedTools.set(block.id, {
|
|
31574
32421
|
toolName: block.name,
|
|
31575
32422
|
arguments: block.arguments
|
|
31576
32423
|
});
|
|
@@ -31579,56 +32426,56 @@ ${question.detail}` : question.question;
|
|
|
31579
32426
|
}
|
|
31580
32427
|
const reasoning2 = contentText2(message.content, "reasoning");
|
|
31581
32428
|
const text = contentText2(message.content, "text");
|
|
31582
|
-
if (
|
|
31583
|
-
this.#cancelAgentItem(
|
|
31584
|
-
this.#completeReasoning(
|
|
31585
|
-
this.#completeAgentPrefix(
|
|
32429
|
+
if (active2.agent && !text.startsWith(active2.agent.text))
|
|
32430
|
+
this.#cancelAgentItem(active2);
|
|
32431
|
+
this.#completeReasoning(active2, reasoning2, step);
|
|
32432
|
+
this.#completeAgentPrefix(active2, text, step);
|
|
31586
32433
|
}
|
|
31587
|
-
#completeReasoning(
|
|
31588
|
-
if (
|
|
31589
|
-
this.#cancelReasoningItem(
|
|
32434
|
+
#completeReasoning(active2, finalText, step) {
|
|
32435
|
+
if (active2.reasoning && !finalText.startsWith(active2.reasoning.text)) {
|
|
32436
|
+
this.#cancelReasoningItem(active2);
|
|
31590
32437
|
}
|
|
31591
|
-
const suffix = finalText.slice(
|
|
32438
|
+
const suffix = finalText.slice(active2.reasoning?.text.length ?? 0);
|
|
31592
32439
|
if (suffix)
|
|
31593
|
-
this.#appendReasoning(
|
|
31594
|
-
const current =
|
|
32440
|
+
this.#appendReasoning(active2, suffix, step, false, void 0, true);
|
|
32441
|
+
const current = active2.reasoning;
|
|
31595
32442
|
if (!current)
|
|
31596
32443
|
return;
|
|
31597
|
-
delete
|
|
31598
|
-
this.#completeItem(
|
|
32444
|
+
delete active2.reasoning;
|
|
32445
|
+
this.#completeItem(active2, current.item, { status: "succeeded" });
|
|
31599
32446
|
}
|
|
31600
|
-
#completeAgentPrefix(
|
|
31601
|
-
let current =
|
|
32447
|
+
#completeAgentPrefix(active2, finalText, step) {
|
|
32448
|
+
let current = active2.agent;
|
|
31602
32449
|
if (!current && finalText) {
|
|
31603
|
-
this.#appendAgent(
|
|
31604
|
-
current =
|
|
32450
|
+
this.#appendAgent(active2, finalText, step);
|
|
32451
|
+
current = active2.agent;
|
|
31605
32452
|
} else if (current && finalText !== current.text) {
|
|
31606
32453
|
if (!finalText.startsWith(current.text)) {
|
|
31607
32454
|
throw new ModernHistoryError("protocolError", "Modern assistant message does not match its streamed prefix");
|
|
31608
32455
|
}
|
|
31609
32456
|
const suffix = finalText.slice(current.text.length);
|
|
31610
|
-
this.#appendAgent(
|
|
31611
|
-
current =
|
|
32457
|
+
this.#appendAgent(active2, suffix, step);
|
|
32458
|
+
current = active2.agent;
|
|
31612
32459
|
}
|
|
31613
32460
|
if (!current)
|
|
31614
32461
|
return;
|
|
31615
|
-
this.#flushAgent(
|
|
31616
|
-
delete
|
|
31617
|
-
this.#completeItem(
|
|
32462
|
+
this.#flushAgent(active2, current);
|
|
32463
|
+
delete active2.agent;
|
|
32464
|
+
this.#completeItem(active2, current.item, { status: "succeeded" });
|
|
31618
32465
|
}
|
|
31619
|
-
#startTool(
|
|
32466
|
+
#startTool(active2, data, seq) {
|
|
31620
32467
|
const callId = data.callId;
|
|
31621
|
-
if (
|
|
32468
|
+
if (active2.tools.has(callId) || active2.programCalls.has(callId)) {
|
|
31622
32469
|
throw new ModernHistoryError("protocolError", "Modern tool/call is duplicated");
|
|
31623
32470
|
}
|
|
31624
|
-
|
|
32471
|
+
active2.advertisedTools.delete(callId);
|
|
31625
32472
|
if (isPtcProgramTool(data.name)) {
|
|
31626
|
-
|
|
32473
|
+
active2.programCalls.add(callId);
|
|
31627
32474
|
return;
|
|
31628
32475
|
}
|
|
31629
|
-
this.#openTool(
|
|
32476
|
+
this.#openTool(active2, callId, seq, data.name, data.arguments);
|
|
31630
32477
|
}
|
|
31631
|
-
#openTool(
|
|
32478
|
+
#openTool(active2, callId, seq, toolName, rawArguments) {
|
|
31632
32479
|
const item = {
|
|
31633
32480
|
type: "toolExecution",
|
|
31634
32481
|
itemId: modernItemId(this.#sessionId, `event:${seq}:tool`),
|
|
@@ -31636,37 +32483,37 @@ ${question.detail}` : question.question;
|
|
|
31636
32483
|
arguments: parseArguments(rawArguments)
|
|
31637
32484
|
};
|
|
31638
32485
|
const tool = { item, toolName, startedAtMs: this.#now() };
|
|
31639
|
-
|
|
31640
|
-
this.#emit({ type: "item.started", turnId:
|
|
32486
|
+
active2.tools.set(callId, tool);
|
|
32487
|
+
this.#emit({ type: "item.started", turnId: active2.turnId, item });
|
|
31641
32488
|
return tool;
|
|
31642
32489
|
}
|
|
31643
32490
|
/** Complete the Tool Item of one appended native result and return its call. */
|
|
31644
|
-
#completeTool(
|
|
32491
|
+
#completeTool(active2, event) {
|
|
31645
32492
|
const data = event.data;
|
|
31646
32493
|
const seq = event.seq;
|
|
31647
32494
|
const result = projectToolResult(data.message, this.#toolOutputLimit);
|
|
31648
32495
|
if (!result)
|
|
31649
32496
|
throw new ModernHistoryError("protocolError", "Modern tool/result is malformed");
|
|
31650
|
-
const advertised =
|
|
31651
|
-
|
|
31652
|
-
if (
|
|
32497
|
+
const advertised = active2.advertisedTools.get(result.callId);
|
|
32498
|
+
active2.advertisedTools.delete(result.callId);
|
|
32499
|
+
if (active2.programCalls.delete(result.callId))
|
|
31653
32500
|
return result.callId;
|
|
31654
|
-
let tool =
|
|
32501
|
+
let tool = active2.tools.get(result.callId);
|
|
31655
32502
|
if (!tool && advertised && isNotStartedToolResult(data, event.sourceEventSeqs, seq)) {
|
|
31656
32503
|
if (isPtcProgramTool(advertised.toolName))
|
|
31657
32504
|
return result.callId;
|
|
31658
|
-
tool = this.#openTool(
|
|
32505
|
+
tool = this.#openTool(active2, result.callId, seq, advertised.toolName, advertised.arguments);
|
|
31659
32506
|
}
|
|
31660
32507
|
if (!tool)
|
|
31661
32508
|
throw new ModernHistoryError("protocolError", "Modern tool/result is unmatched");
|
|
31662
|
-
|
|
32509
|
+
active2.tools.delete(result.callId);
|
|
31663
32510
|
const item = {
|
|
31664
32511
|
...tool.item,
|
|
31665
32512
|
...result.output ? { output: result.output } : {},
|
|
31666
32513
|
durationMs: Math.max(0, this.#now() - tool.startedAtMs)
|
|
31667
32514
|
};
|
|
31668
32515
|
const failed = result.failed || data.error !== void 0;
|
|
31669
|
-
this.#completeItem(
|
|
32516
|
+
this.#completeItem(active2, item, failed ? {
|
|
31670
32517
|
status: "failed",
|
|
31671
32518
|
error: {
|
|
31672
32519
|
code: "nativeFailure",
|
|
@@ -31683,62 +32530,62 @@ ${question.detail}` : question.question;
|
|
|
31683
32530
|
sourceItemIds: [item.itemId],
|
|
31684
32531
|
changes
|
|
31685
32532
|
};
|
|
31686
|
-
this.#emit({ type: "item.started", turnId:
|
|
31687
|
-
this.#completeItem(
|
|
32533
|
+
this.#emit({ type: "item.started", turnId: active2.turnId, item: fileItem });
|
|
32534
|
+
this.#completeItem(active2, fileItem, { status: "succeeded" });
|
|
31688
32535
|
}
|
|
31689
32536
|
}
|
|
31690
32537
|
return result.callId;
|
|
31691
32538
|
}
|
|
31692
|
-
#startPtcDispatch(
|
|
32539
|
+
#startPtcDispatch(active2, data, seq, time3) {
|
|
31693
32540
|
const key = ptcDispatchKey(data);
|
|
31694
|
-
if (
|
|
32541
|
+
if (active2.tools.has(key)) {
|
|
31695
32542
|
throw new ModernHistoryError("protocolError", "Modern PTC dispatch is duplicated");
|
|
31696
32543
|
}
|
|
31697
32544
|
const item = ptcDispatchItem(modernItemId(this.#sessionId, `event:${seq}:tool`), data);
|
|
31698
32545
|
const tool = { item, toolName: item.toolName, startedAtMs: time3 };
|
|
31699
|
-
|
|
31700
|
-
this.#emit({ type: "item.started", turnId:
|
|
32546
|
+
active2.tools.set(key, tool);
|
|
32547
|
+
this.#emit({ type: "item.started", turnId: active2.turnId, item });
|
|
31701
32548
|
return tool;
|
|
31702
32549
|
}
|
|
31703
|
-
#settlePtcDispatch(
|
|
31704
|
-
const tool =
|
|
31705
|
-
|
|
32550
|
+
#settlePtcDispatch(active2, data, seq, time3) {
|
|
32551
|
+
const tool = active2.tools.get(ptcDispatchKey(data)) ?? this.#startPtcDispatch(active2, data, seq, time3);
|
|
32552
|
+
active2.tools.delete(ptcDispatchKey(data));
|
|
31706
32553
|
const output = ptcDispatchOutput(data, this.#toolOutputLimit);
|
|
31707
32554
|
const item = {
|
|
31708
32555
|
...tool.item,
|
|
31709
32556
|
...output ? { output } : {},
|
|
31710
32557
|
durationMs: Math.max(0, time3 - tool.startedAtMs)
|
|
31711
32558
|
};
|
|
31712
|
-
this.#completeItem(
|
|
32559
|
+
this.#completeItem(active2, item, ptcDispatchOutcome(data, tool.toolName));
|
|
31713
32560
|
}
|
|
31714
|
-
#finishTurn(buffer,
|
|
31715
|
-
if (
|
|
32561
|
+
#finishTurn(buffer, active2, reason, seq) {
|
|
32562
|
+
if (active2.terminal)
|
|
31716
32563
|
return;
|
|
31717
32564
|
const projected = turnOutcome(reason);
|
|
31718
32565
|
const itemOutcome2 = toItemOutcome(projected);
|
|
31719
32566
|
this.#discardAssistantAttempt();
|
|
31720
|
-
this.#cancelReasoningItem(
|
|
31721
|
-
this.#closeActiveInteractions(
|
|
31722
|
-
this.#completeOpenItems(
|
|
31723
|
-
|
|
32567
|
+
this.#cancelReasoningItem(active2);
|
|
32568
|
+
this.#closeActiveInteractions(active2);
|
|
32569
|
+
this.#completeOpenItems(active2, itemOutcome2);
|
|
32570
|
+
active2.terminal = true;
|
|
31724
32571
|
if (buffer.pending)
|
|
31725
32572
|
buffer.pending.terminal = true;
|
|
31726
32573
|
this.#nativeCloseTerminal?.();
|
|
31727
32574
|
const checkpoint = modernCheckpointRef(this.harnessId, this.#sessionId, seq, this.#profile);
|
|
31728
32575
|
this.#emit({
|
|
31729
32576
|
type: "turn.completed",
|
|
31730
|
-
turnId:
|
|
31731
|
-
nativeTurnRef: modernNativeTurnRef(this.harnessId, this.#sessionId,
|
|
32577
|
+
turnId: active2.turnId,
|
|
32578
|
+
nativeTurnRef: modernNativeTurnRef(this.harnessId, this.#sessionId, active2.nativeTurn),
|
|
31732
32579
|
outcome: { ...projected, checkpoint }
|
|
31733
32580
|
});
|
|
31734
|
-
if (this.#active ===
|
|
32581
|
+
if (this.#active === active2)
|
|
31735
32582
|
this.#active = void 0;
|
|
31736
32583
|
if (this.#buffer === buffer)
|
|
31737
32584
|
this.#buffer = void 0;
|
|
31738
32585
|
}
|
|
31739
|
-
#completeOpenItems(
|
|
31740
|
-
if (
|
|
31741
|
-
this.#completeItem(
|
|
32586
|
+
#completeOpenItems(active2, outcome) {
|
|
32587
|
+
if (active2.compaction) {
|
|
32588
|
+
this.#completeItem(active2, active2.compaction.item, outcome.status === "succeeded" ? {
|
|
31742
32589
|
status: "failed",
|
|
31743
32590
|
error: {
|
|
31744
32591
|
code: "nativeFailure",
|
|
@@ -31746,27 +32593,27 @@ ${question.detail}` : question.question;
|
|
|
31746
32593
|
retryable: true
|
|
31747
32594
|
}
|
|
31748
32595
|
} : outcome);
|
|
31749
|
-
delete
|
|
32596
|
+
delete active2.compaction;
|
|
31750
32597
|
}
|
|
31751
|
-
if (
|
|
31752
|
-
const item =
|
|
31753
|
-
delete
|
|
31754
|
-
this.#completeItem(
|
|
32598
|
+
if (active2.reasoning) {
|
|
32599
|
+
const item = active2.reasoning.item;
|
|
32600
|
+
delete active2.reasoning;
|
|
32601
|
+
this.#completeItem(active2, item, outcome);
|
|
31755
32602
|
}
|
|
31756
|
-
if (
|
|
31757
|
-
const agent =
|
|
31758
|
-
this.#flushAgent(
|
|
31759
|
-
delete
|
|
31760
|
-
this.#completeItem(
|
|
32603
|
+
if (active2.agent) {
|
|
32604
|
+
const agent = active2.agent;
|
|
32605
|
+
this.#flushAgent(active2, agent);
|
|
32606
|
+
delete active2.agent;
|
|
32607
|
+
this.#completeItem(active2, agent.item, outcome);
|
|
31761
32608
|
}
|
|
31762
|
-
for (const tool of
|
|
31763
|
-
this.#completeItem(
|
|
31764
|
-
|
|
32609
|
+
for (const tool of active2.tools.values())
|
|
32610
|
+
this.#completeItem(active2, tool.item, outcome);
|
|
32611
|
+
active2.tools.clear();
|
|
31765
32612
|
}
|
|
31766
|
-
#completeItem(
|
|
32613
|
+
#completeItem(active2, item, outcome) {
|
|
31767
32614
|
this.#emit({
|
|
31768
32615
|
type: "item.completed",
|
|
31769
|
-
turnId:
|
|
32616
|
+
turnId: active2.turnId,
|
|
31770
32617
|
snapshot: { item, outcome }
|
|
31771
32618
|
});
|
|
31772
32619
|
}
|
|
@@ -31787,6 +32634,7 @@ ${question.detail}` : question.question;
|
|
|
31787
32634
|
/** `media` also resolves local media paths, which only displayed history needs. */
|
|
31788
32635
|
#project(media = false) {
|
|
31789
32636
|
return projectModernHistory({
|
|
32637
|
+
modelIndex: this.#modelCatalog.index,
|
|
31790
32638
|
harnessId: this.harnessId,
|
|
31791
32639
|
sessionId: this.#sessionId,
|
|
31792
32640
|
events: this.#events,
|
|
@@ -31830,9 +32678,9 @@ ${question.detail}` : question.question;
|
|
|
31830
32678
|
async #performFault(failure, acceptedPending) {
|
|
31831
32679
|
await this.#detachEvents().catch(() => void 0);
|
|
31832
32680
|
this.#closeAllInteractions();
|
|
31833
|
-
let
|
|
32681
|
+
let active2 = this.#active;
|
|
31834
32682
|
const buffer = this.#buffer;
|
|
31835
|
-
if (!
|
|
32683
|
+
if (!active2 && buffer) {
|
|
31836
32684
|
const pending = buffer.pending;
|
|
31837
32685
|
const hostBound = pending !== void 0 && (pending.admissionObserved || pending.observed || pending.admitted);
|
|
31838
32686
|
const turnId = hostBound ? pending.command.turnId : hostTurnIdSchema.parse(this.#randomUUID());
|
|
@@ -31843,7 +32691,7 @@ ${question.detail}` : question.question;
|
|
|
31843
32691
|
input: [...buffer.input]
|
|
31844
32692
|
});
|
|
31845
32693
|
}
|
|
31846
|
-
|
|
32694
|
+
active2 = {
|
|
31847
32695
|
turnId,
|
|
31848
32696
|
nativeTurn: buffer.nativeTurn,
|
|
31849
32697
|
input: hostBound ? [...pending.command.input] : [...buffer.input],
|
|
@@ -31856,19 +32704,19 @@ ${question.detail}` : question.question;
|
|
|
31856
32704
|
terminal: false,
|
|
31857
32705
|
cancelAcknowledged: false
|
|
31858
32706
|
};
|
|
31859
|
-
buffer.active =
|
|
31860
|
-
this.#active =
|
|
32707
|
+
buffer.active = active2;
|
|
32708
|
+
this.#active = active2;
|
|
31861
32709
|
this.#emit({ type: "turn.started", turnId });
|
|
31862
32710
|
}
|
|
31863
|
-
if (
|
|
31864
|
-
this.#completeOpenItems(
|
|
31865
|
-
|
|
31866
|
-
if (buffer?.pending?.command.turnId ===
|
|
32711
|
+
if (active2 && !active2.terminal) {
|
|
32712
|
+
this.#completeOpenItems(active2, { status: "failed", error: failure });
|
|
32713
|
+
active2.terminal = true;
|
|
32714
|
+
if (buffer?.pending?.command.turnId === active2.turnId)
|
|
31867
32715
|
buffer.pending.terminal = true;
|
|
31868
32716
|
this.#emit({
|
|
31869
32717
|
type: "turn.completed",
|
|
31870
|
-
turnId:
|
|
31871
|
-
nativeTurnRef: modernNativeTurnRef(this.harnessId, this.#sessionId,
|
|
32718
|
+
turnId: active2.turnId,
|
|
32719
|
+
nativeTurnRef: modernNativeTurnRef(this.harnessId, this.#sessionId, active2.nativeTurn),
|
|
31872
32720
|
outcome: { status: "failed", error: failure }
|
|
31873
32721
|
});
|
|
31874
32722
|
}
|
|
@@ -31950,21 +32798,21 @@ ${question.detail}` : question.question;
|
|
|
31950
32798
|
this.#abortOperations();
|
|
31951
32799
|
await this.#detachEvents().catch(() => void 0);
|
|
31952
32800
|
this.#closeAllInteractions();
|
|
31953
|
-
const
|
|
31954
|
-
if (
|
|
32801
|
+
const active2 = this.#active;
|
|
32802
|
+
if (active2 && !active2.terminal) {
|
|
31955
32803
|
const outcome = {
|
|
31956
32804
|
status: "cancelled",
|
|
31957
32805
|
reason: "DeepSeek Harness Session closed"
|
|
31958
32806
|
};
|
|
31959
|
-
this.#completeOpenItems(
|
|
31960
|
-
|
|
31961
|
-
if (this.#buffer?.pending?.command.turnId ===
|
|
32807
|
+
this.#completeOpenItems(active2, outcome);
|
|
32808
|
+
active2.terminal = true;
|
|
32809
|
+
if (this.#buffer?.pending?.command.turnId === active2.turnId) {
|
|
31962
32810
|
this.#buffer.pending.terminal = true;
|
|
31963
32811
|
}
|
|
31964
32812
|
this.#emit({
|
|
31965
32813
|
type: "turn.completed",
|
|
31966
|
-
turnId:
|
|
31967
|
-
nativeTurnRef: modernNativeTurnRef(this.harnessId, this.#sessionId,
|
|
32814
|
+
turnId: active2.turnId,
|
|
32815
|
+
nativeTurnRef: modernNativeTurnRef(this.harnessId, this.#sessionId, active2.nativeTurn),
|
|
31968
32816
|
outcome
|
|
31969
32817
|
});
|
|
31970
32818
|
}
|
|
@@ -32043,10 +32891,10 @@ ${question.detail}` : question.question;
|
|
|
32043
32891
|
}
|
|
32044
32892
|
/** Publishes a live model request settled in the journal to Host usage metering. */
|
|
32045
32893
|
#meterUsage(event) {
|
|
32046
|
-
const
|
|
32047
|
-
if (
|
|
32048
|
-
this.#emit({ type: "usage.request", request:
|
|
32049
|
-
else if (
|
|
32894
|
+
const record4 = deepSeekUsageRecord(event, false);
|
|
32895
|
+
if (record4.kind === "request")
|
|
32896
|
+
this.#emit({ type: "usage.request", request: record4.request });
|
|
32897
|
+
else if (record4.kind === "missing")
|
|
32050
32898
|
this.#emit({ type: "usage.history", complete: false });
|
|
32051
32899
|
}
|
|
32052
32900
|
};
|
|
@@ -32373,7 +33221,7 @@ function safeTimerDelay(value, name) {
|
|
|
32373
33221
|
|
|
32374
33222
|
// dist/modern/session-list.js
|
|
32375
33223
|
import { Buffer as Buffer5 } from "node:buffer";
|
|
32376
|
-
import
|
|
33224
|
+
import path10 from "node:path";
|
|
32377
33225
|
var MAX_SESSION_LIST_BYTES = 32 * 1024 * 1024;
|
|
32378
33226
|
var MAX_SESSION_LIST_DEPTH = 64;
|
|
32379
33227
|
var MAX_SESSION_LIST_NODES = 2e5;
|
|
@@ -32493,7 +33341,7 @@ function parseSummary(value) {
|
|
|
32493
33341
|
};
|
|
32494
33342
|
}
|
|
32495
33343
|
function isCanonicalAbsoluteCwd(value) {
|
|
32496
|
-
return value !== void 0 && value.trim().length > 0 && !value.includes("\0") &&
|
|
33344
|
+
return value !== void 0 && value.trim().length > 0 && !value.includes("\0") && path10.isAbsolute(value) && path10.resolve(value) === value;
|
|
32497
33345
|
}
|
|
32498
33346
|
function parseModernSessionCandidates(value) {
|
|
32499
33347
|
assertBoundedJson4(value);
|
|
@@ -32556,6 +33404,12 @@ var DEFAULT_DEPENDENCIES2 = {
|
|
|
32556
33404
|
createConnection: (options) => new ModernRemoteConnection(options)
|
|
32557
33405
|
};
|
|
32558
33406
|
var ModernDeepSeekHarnessAdapter = class {
|
|
33407
|
+
normalizeStoredModelRef = (ref, catalog) => {
|
|
33408
|
+
const snapshot = this.#catalog;
|
|
33409
|
+
if (snapshot && isDeepStrictEqual7(snapshot.catalog, catalog)) {
|
|
33410
|
+
return normalizeStoredDeepSeekModelRef(ref, snapshot.index);
|
|
33411
|
+
}
|
|
33412
|
+
};
|
|
32559
33413
|
commandCatalog = deepSeekHarnessCommandCatalog();
|
|
32560
33414
|
harnessId = DEEPSEEK_HARNESS_ID3;
|
|
32561
33415
|
sessionImport = Object.freeze({
|
|
@@ -32691,7 +33545,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
32691
33545
|
let session;
|
|
32692
33546
|
let forkExpectation;
|
|
32693
33547
|
try {
|
|
32694
|
-
const cwd =
|
|
33548
|
+
const cwd = path11.resolve(input.cwd);
|
|
32695
33549
|
let forkInput = input.kind === "fork" ? parseModernForkInput(input, this.#profile) : void 0;
|
|
32696
33550
|
const rollbackSourceSessionId = input.kind === "rollbackLastTurn" ? modernSessionId(input.sourceRef, "roll back") : void 0;
|
|
32697
33551
|
let rollbackPlan;
|
|
@@ -32724,7 +33578,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
32724
33578
|
}
|
|
32725
33579
|
this.#assertAccepting();
|
|
32726
33580
|
if (rollbackSourceSessionId) {
|
|
32727
|
-
rollbackPlan = await this.#resolveLastTurnRollback(rollbackSourceSessionId, cwd);
|
|
33581
|
+
rollbackPlan = await this.#resolveLastTurnRollback(rollbackSourceSessionId, cwd, catalog);
|
|
32728
33582
|
if (rollbackPlan.kind === "fork") {
|
|
32729
33583
|
forkInput = rollbackPlan.input;
|
|
32730
33584
|
} else {
|
|
@@ -32743,7 +33597,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
32743
33597
|
this.#assertAccepting();
|
|
32744
33598
|
}
|
|
32745
33599
|
if (forkInput) {
|
|
32746
|
-
forkExpectation = await this.#forkSession(forkInput, cwd);
|
|
33600
|
+
forkExpectation = await this.#forkSession(forkInput, cwd, catalog);
|
|
32747
33601
|
sessionId = forkExpectation.childSessionId;
|
|
32748
33602
|
if (this.#sessionIds.has(sessionId)) {
|
|
32749
33603
|
throw forkProtocolError();
|
|
@@ -32772,11 +33626,11 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
32772
33626
|
journal = await openModernJournal(this.#connection, { sessionId, cwd }, this.#journalOptions());
|
|
32773
33627
|
this.#assertAccepting();
|
|
32774
33628
|
if (forkExpectation) {
|
|
32775
|
-
await this.#verifyForkJournal(forkExpectation, journal, cwd);
|
|
33629
|
+
await this.#verifyForkJournal(forkExpectation, journal, cwd, catalog);
|
|
32776
33630
|
if (await clearInheritedForkInbox(this.#connection, journal, this.#lifetime.signal)) {
|
|
32777
33631
|
await journal.close();
|
|
32778
33632
|
journal = await openModernJournal(this.#connection, { sessionId, cwd }, this.#journalOptions());
|
|
32779
|
-
await this.#verifyForkJournal(forkExpectation, journal, cwd);
|
|
33633
|
+
await this.#verifyForkJournal(forkExpectation, journal, cwd, catalog);
|
|
32780
33634
|
if (pendingForkInboxIds(journal).length !== 0)
|
|
32781
33635
|
throw forkProtocolError();
|
|
32782
33636
|
await this.#connection.flushSession(sessionId, this.#lifetime.signal);
|
|
@@ -32788,6 +33642,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
32788
33642
|
}
|
|
32789
33643
|
if (rollbackPlan.kind === "create") {
|
|
32790
33644
|
const replacement = projectModernHistory({
|
|
33645
|
+
modelIndex: catalog.index,
|
|
32791
33646
|
harnessId: this.harnessId,
|
|
32792
33647
|
sessionId,
|
|
32793
33648
|
events: journal.events,
|
|
@@ -32910,10 +33765,11 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
32910
33765
|
});
|
|
32911
33766
|
}
|
|
32912
33767
|
}
|
|
32913
|
-
async #resolveLastTurnRollback(sourceSessionId, cwd) {
|
|
33768
|
+
async #resolveLastTurnRollback(sourceSessionId, cwd, catalog) {
|
|
32914
33769
|
const source = await openModernJournal(this.#connection, { sessionId: sourceSessionId, cwd }, this.#journalOptions());
|
|
32915
33770
|
try {
|
|
32916
33771
|
const projected = projectModernHistory({
|
|
33772
|
+
modelIndex: catalog.index,
|
|
32917
33773
|
harnessId: this.harnessId,
|
|
32918
33774
|
sessionId: sourceSessionId,
|
|
32919
33775
|
events: source.events,
|
|
@@ -32955,7 +33811,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
32955
33811
|
await source.close();
|
|
32956
33812
|
}
|
|
32957
33813
|
}
|
|
32958
|
-
async #forkSession(input, cwd) {
|
|
33814
|
+
async #forkSession(input, cwd, catalog) {
|
|
32959
33815
|
const source = await openModernJournal(this.#connection, {
|
|
32960
33816
|
sessionId: input.sourceSessionId,
|
|
32961
33817
|
cwd
|
|
@@ -32967,6 +33823,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
32967
33823
|
if (!boundary)
|
|
32968
33824
|
throw forkCheckpointError();
|
|
32969
33825
|
const projected = projectModernHistory({
|
|
33826
|
+
modelIndex: catalog.index,
|
|
32970
33827
|
harnessId: this.harnessId,
|
|
32971
33828
|
sessionId: input.sourceSessionId,
|
|
32972
33829
|
events: boundary.events,
|
|
@@ -32996,7 +33853,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
32996
33853
|
seedLength
|
|
32997
33854
|
};
|
|
32998
33855
|
}
|
|
32999
|
-
async #verifyForkJournal(expected, child, cwd) {
|
|
33856
|
+
async #verifyForkJournal(expected, child, cwd, catalog) {
|
|
33000
33857
|
const seedLength = child.inheritedEventCount;
|
|
33001
33858
|
if (
|
|
33002
33859
|
// DSH 0.2.2 writes ordinary Fork children without their source; the
|
|
@@ -33018,6 +33875,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33018
33875
|
throw forkProtocolError();
|
|
33019
33876
|
}
|
|
33020
33877
|
const expectedProjection = projectModernHistory({
|
|
33878
|
+
modelIndex: catalog.index,
|
|
33021
33879
|
harnessId: this.harnessId,
|
|
33022
33880
|
sessionId: expected.sourceSessionId,
|
|
33023
33881
|
events: inherited,
|
|
@@ -33026,6 +33884,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33026
33884
|
...this.#options.maxEvents === void 0 ? {} : { maxEvents: this.#options.maxEvents }
|
|
33027
33885
|
});
|
|
33028
33886
|
const childProjection = projectModernHistory({
|
|
33887
|
+
modelIndex: catalog.index,
|
|
33029
33888
|
harnessId: this.harnessId,
|
|
33030
33889
|
sessionId: expected.childSessionId,
|
|
33031
33890
|
events: child.events,
|
|
@@ -33118,7 +33977,10 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33118
33977
|
this.#lifetime.abort(new Error("DeepSeek Harness Adapter faulted"));
|
|
33119
33978
|
for (const session of this.#sessions)
|
|
33120
33979
|
session.fault(failure);
|
|
33121
|
-
this.#closePromise
|
|
33980
|
+
if (this.#closePromise)
|
|
33981
|
+
return;
|
|
33982
|
+
this.#closePromise = this.#performClose(failure);
|
|
33983
|
+
this.#closePromise.catch(() => void 0);
|
|
33122
33984
|
}
|
|
33123
33985
|
#sealEventFailure(error51) {
|
|
33124
33986
|
if (this.#fault || this.#normalClose || this.#declaredEventFailure)
|
|
@@ -33238,7 +34100,7 @@ function resolveCreateConfiguration(input, modelCatalog, permissionModes) {
|
|
|
33238
34100
|
}
|
|
33239
34101
|
const unattended = input.executionPolicy === "unattended-full-access";
|
|
33240
34102
|
const permissionModeId = input.permissionModeId ?? (unattended ? harnessPermissionModeIdSchema.parse(DELEGATION_PERMISSION_PRESET) : void 0);
|
|
33241
|
-
if (permissionModeId && !permissionModes?.modes.some(({ id }) =>
|
|
34103
|
+
if (permissionModeId && !permissionModes?.modes.some(({ id: id2 }) => id2 === permissionModeId)) {
|
|
33242
34104
|
throw new AdapterOperationError({
|
|
33243
34105
|
code: permissionModes ? "invalidRequest" : "unsupported",
|
|
33244
34106
|
message: unattended ? "DeepSeek Harness does not expose the required danger-full-access Permission Mode" : "DeepSeek Harness Permission Mode is unavailable",
|
|
@@ -33481,6 +34343,7 @@ var DelegateSelectionError = class extends Error {
|
|
|
33481
34343
|
};
|
|
33482
34344
|
var DeepSeekHarnessAdapter = class {
|
|
33483
34345
|
commandCatalog = deepSeekHarnessCommandCatalog();
|
|
34346
|
+
normalizeStoredModelRef = (ref, catalog) => this.#delegate?.adapter.normalizeStoredModelRef?.(ref, catalog);
|
|
33484
34347
|
harnessId = DEEPSEEK_HARNESS_ID4;
|
|
33485
34348
|
usageStatistics;
|
|
33486
34349
|
sessionImport = Object.freeze({
|
|
@@ -33517,8 +34380,11 @@ var DeepSeekHarnessAdapter = class {
|
|
|
33517
34380
|
open: () => this.#openWebUi()
|
|
33518
34381
|
});
|
|
33519
34382
|
#options;
|
|
34383
|
+
#balance;
|
|
33520
34384
|
#probeExecutable;
|
|
33521
34385
|
#createModernAdapter;
|
|
34386
|
+
/** Aborted by close() so a balance request in flight does not outlive the Adapter. */
|
|
34387
|
+
#accountInspection = new AbortController();
|
|
33522
34388
|
#candidate;
|
|
33523
34389
|
#cleanupFailedDuringClose = false;
|
|
33524
34390
|
#closePromise;
|
|
@@ -33529,6 +34395,10 @@ var DeepSeekHarnessAdapter = class {
|
|
|
33529
34395
|
#terminalFailure;
|
|
33530
34396
|
constructor(options = {}, dependencies = {}) {
|
|
33531
34397
|
this.#options = options;
|
|
34398
|
+
this.#balance = new DeepSeekBalanceCache(() => fetchDeepSeekBalances({
|
|
34399
|
+
environment: options.environment ?? process.env,
|
|
34400
|
+
signal: this.#accountInspection.signal
|
|
34401
|
+
}));
|
|
33532
34402
|
this.usageStatistics = createDshUsageStatistics(options.environment ?? process.env);
|
|
33533
34403
|
this.#probeExecutable = dependencies.probeExecutable ?? ((input) => probeDeepSeekExecutableGeneration(input));
|
|
33534
34404
|
this.#createModernAdapter = dependencies.createModernAdapter ?? ((modernOptions2) => new ModernDeepSeekHarnessAdapter(modernOptions2));
|
|
@@ -33562,6 +34432,22 @@ var DeepSeekHarnessAdapter = class {
|
|
|
33562
34432
|
this.#closePromise ??= this.#performClose();
|
|
33563
34433
|
return this.#closePromise;
|
|
33564
34434
|
}
|
|
34435
|
+
/** Report the official DeepSeek API key's prepaid balance, not the DSH sign-in account. */
|
|
34436
|
+
async inspectAccounts() {
|
|
34437
|
+
if (this.#closed)
|
|
34438
|
+
return [];
|
|
34439
|
+
return this.#balance.inspect();
|
|
34440
|
+
}
|
|
34441
|
+
/** Cached balance for the Composer; refreshed by {@link refreshBalance}. */
|
|
34442
|
+
balance() {
|
|
34443
|
+
return this.#balance.read();
|
|
34444
|
+
}
|
|
34445
|
+
refreshBalance() {
|
|
34446
|
+
return this.#balance.refresh();
|
|
34447
|
+
}
|
|
34448
|
+
async inspectAccount() {
|
|
34449
|
+
return (await this.inspectAccounts())[0] ?? null;
|
|
34450
|
+
}
|
|
33565
34451
|
async #listSessionImportCandidates() {
|
|
33566
34452
|
try {
|
|
33567
34453
|
const selected = await this.#select(false);
|
|
@@ -33600,7 +34486,7 @@ var DeepSeekHarnessAdapter = class {
|
|
|
33600
34486
|
}
|
|
33601
34487
|
this.#failure = void 0;
|
|
33602
34488
|
const abort = new AbortController();
|
|
33603
|
-
const
|
|
34489
|
+
const selection3 = {};
|
|
33604
34490
|
const promise2 = this.#performSelection(abort.signal).then(async (selected) => {
|
|
33605
34491
|
if (this.#closed || abort.signal.aborted) {
|
|
33606
34492
|
await this.#closeFailedCandidate(selected);
|
|
@@ -33615,11 +34501,11 @@ var DeepSeekHarnessAdapter = class {
|
|
|
33615
34501
|
this.#failure = failure;
|
|
33616
34502
|
throw new DelegateSelectionError(failure);
|
|
33617
34503
|
}).finally(() => {
|
|
33618
|
-
if (this.#selection ===
|
|
34504
|
+
if (this.#selection === selection3)
|
|
33619
34505
|
this.#selection = void 0;
|
|
33620
34506
|
});
|
|
33621
|
-
Object.assign(
|
|
33622
|
-
this.#selection =
|
|
34507
|
+
Object.assign(selection3, { abort, promise: promise2 });
|
|
34508
|
+
this.#selection = selection3;
|
|
33623
34509
|
return promise2;
|
|
33624
34510
|
}
|
|
33625
34511
|
async #performSelection(signal) {
|
|
@@ -33715,16 +34601,18 @@ var DeepSeekHarnessAdapter = class {
|
|
|
33715
34601
|
}
|
|
33716
34602
|
async #performClose() {
|
|
33717
34603
|
this.#closed = true;
|
|
34604
|
+
this.#accountInspection.abort(new Error("DeepSeek Harness account inspection closed"));
|
|
34605
|
+
this.#balance.close();
|
|
33718
34606
|
let cleanupFailed = false;
|
|
33719
|
-
const
|
|
33720
|
-
|
|
34607
|
+
const selection3 = this.#selection;
|
|
34608
|
+
selection3?.abort.abort(new Error("DeepSeek Harness generation selection closed"));
|
|
33721
34609
|
const candidate = this.#candidate;
|
|
33722
34610
|
if (candidate) {
|
|
33723
34611
|
await this.#closeOwner(candidate).catch(() => {
|
|
33724
34612
|
cleanupFailed = true;
|
|
33725
34613
|
});
|
|
33726
34614
|
}
|
|
33727
|
-
await
|
|
34615
|
+
await selection3?.promise.catch(() => void 0);
|
|
33728
34616
|
const lateCandidate = this.#candidate;
|
|
33729
34617
|
if (lateCandidate && lateCandidate !== candidate) {
|
|
33730
34618
|
await this.#closeOwner(lateCandidate).catch(() => {
|