@codexhost/cli-win32-x64 0.32.1 → 0.33.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 +372 -10
- package/app/console-web.js +435 -28
- package/app/desktop-controller.mjs +357 -7
- package/app/host-runtime.mjs +7829 -3478
- package/app/plugins/antigravity/plugin.mjs +483 -55
- package/app/plugins/claude-code/assets/icon.svg +1 -1
- package/app/plugins/claude-code/manifest.json +1 -1
- package/app/plugins/claude-code/plugin.mjs +1093 -193
- package/app/plugins/codebuddy/plugin.mjs +444 -25
- package/app/plugins/codex-usage/plugin.mjs +357 -7
- package/app/plugins/copilot/assets/icon.svg +1 -1
- package/app/plugins/copilot/manifest.json +1 -1
- package/app/plugins/copilot/plugin.mjs +359 -9
- package/app/plugins/cursor-cli/plugin.mjs +357 -7
- package/app/plugins/deepseek-harness/assets/icon.svg +1 -1
- package/app/plugins/deepseek-harness/manifest.json +1 -1
- package/app/plugins/deepseek-harness/plugin.mjs +796 -148
- package/app/plugins/devin/assets/icon.svg +1 -1
- package/app/plugins/devin/manifest.json +1 -1
- package/app/plugins/devin/plugin.mjs +359 -8
- package/app/plugins/grok/plugin.mjs +357 -7
- package/app/plugins/hermes/plugin.mjs +357 -7
- package/app/plugins/kimi-code/plugin.mjs +357 -7
- package/app/plugins/kiro-cli/plugin.mjs +357 -7
- package/app/plugins/omp/assets/icon.svg +1 -1
- package/app/plugins/omp/plugin.mjs +383 -7
- package/app/plugins/opencode/plugin.mjs +361 -8
- package/app/plugins/pi/assets/icon.svg +1 -1
- package/app/plugins/pi/manifest.json +1 -1
- package/app/plugins/pi/plugin.mjs +385 -9
- package/app/plugins/qoder/assets/icon.svg +1 -1
- package/app/plugins/qoder/plugin.mjs +383 -7
- package/app/plugins/qoder-cn/assets/icon.svg +1 -1
- package/app/plugins/qoder-cn/plugin.mjs +383 -7
- package/app/plugins/qwen-code/assets/icon.svg +1 -1
- package/app/plugins/qwen-code/plugin.mjs +386 -7
- package/app/plugins/workbuddy/plugin.mjs +444 -25
- package/app/plugins/zcode/plugin.mjs +377 -14
- package/app/renderer-extension.js +457 -37
- package/app/web/assets/{abnfDiagram-XWFEHMT6-7XITZmBH.js → abnfDiagram-XWFEHMT6-VnfRaHM6.js} +1 -1
- package/app/web/assets/{architectureDiagram-CSQXQB3N-C8Usdzd8.js → architectureDiagram-CSQXQB3N-BA1ehtvi.js} +1 -1
- package/app/web/assets/{blockDiagram-BEDRHYPZ-CyN9yE_Q.js → blockDiagram-BEDRHYPZ-31BZSfd4.js} +1 -1
- package/app/web/assets/{c4Diagram-M2UUVUY5-CjhY1l3g.js → c4Diagram-M2UUVUY5-CNzGWc5k.js} +1 -1
- package/app/web/assets/{chunk-2Q5K7J3B-o24_rh4_.js → chunk-2Q5K7J3B-ahAIR-NM.js} +1 -1
- package/app/web/assets/{chunk-3GCGMST5-D7bw3E1a.js → chunk-3GCGMST5-BIV5YeRJ.js} +1 -1
- package/app/web/assets/{chunk-5VM5RSS4-D0v4acf7.js → chunk-5VM5RSS4-CluTMPJG.js} +1 -1
- package/app/web/assets/{chunk-7U7NFRK5-CYJxP4rV.js → chunk-7U7NFRK5-4NIQuFbE.js} +1 -1
- package/app/web/assets/{chunk-CNRTWJTD-DTgCtcCl.js → chunk-CNRTWJTD-_0bEfGn3.js} +1 -1
- package/app/web/assets/{chunk-D5HYT7QG-qRNelehW.js → chunk-D5HYT7QG-_kTC6f8F.js} +1 -1
- package/app/web/assets/{chunk-EBZ3SEQC-BgJPPYdu.js → chunk-EBZ3SEQC-CykaYOrL.js} +2 -2
- package/app/web/assets/{chunk-JWPE2WC7-C50ZnSQQ.js → chunk-JWPE2WC7-3vVOQ_py.js} +1 -1
- package/app/web/assets/{chunk-KTR4FSNJ-Cifh4XHc.js → chunk-KTR4FSNJ-aVg5vgrm.js} +1 -1
- package/app/web/assets/{chunk-XXDRQBXY-D23WAHPW.js → chunk-XXDRQBXY-_gVwGeSp.js} +1 -1
- package/app/web/assets/{classDiagram-v2-KXABOMEV-B3cezFGj.js → classDiagram-v2-KXABOMEV-fI1LfeBf.js} +1 -1
- package/app/web/assets/{cose-bilkent-JH36ORCC-VSMi4La2.js → cose-bilkent-JH36ORCC-DFXMlWov.js} +1 -1
- package/app/web/assets/{cynefin-EF2NZ3EQ-qQnfHq16.js → cynefin-EF2NZ3EQ-lZy7X6FO.js} +1 -1
- package/app/web/assets/{cynefinDiagram-NJNITYFG-BJELApXD.js → cynefinDiagram-NJNITYFG-N4DwFSW1.js} +1 -1
- package/app/web/assets/{dagre-KIHZ2IZ3-C8B5ZMVs.js → dagre-KIHZ2IZ3-B7-8baTH.js} +1 -1
- package/app/web/assets/{diagram-7YQZDPLS-HIWoNpzV.js → diagram-7YQZDPLS-DLfjiBXV.js} +1 -1
- package/app/web/assets/{diagram-QBROCOUO-3_vS1jbp.js → diagram-QBROCOUO-CQnRzSTi.js} +1 -1
- package/app/web/assets/{diagram-RJJCUUZO-C_Kndn_e.js → diagram-RJJCUUZO-DPnxazRT.js} +1 -1
- package/app/web/assets/{diagram-WERXNKYE-BLWdOwya.js → diagram-WERXNKYE-BBuEFRvD.js} +1 -1
- package/app/web/assets/{diagram-YHHI257C-DJeOs6eS.js → diagram-YHHI257C-BQ92JNJs.js} +1 -1
- package/app/web/assets/{diagram-YR4HJLHV-BKNULu-g.js → diagram-YR4HJLHV-Ce6BQO3J.js} +1 -1
- package/app/web/assets/{ebnfDiagram-N527522P-Bu8aReoF.js → ebnfDiagram-N527522P-DYknE2Jy.js} +1 -1
- package/app/web/assets/{elk-O5DQBFGD-CIp7Z0ER.js → elk-O5DQBFGD-4S6_JJFF.js} +1 -1
- package/app/web/assets/{erDiagram-K3K3BIDK-BTsor1Lp.js → erDiagram-K3K3BIDK-DRtF7JVQ.js} +1 -1
- package/app/web/assets/{flowDiagram-Z6JWZHQI-p_h5PKQr.js → flowDiagram-Z6JWZHQI-7Ho8CyR9.js} +1 -1
- package/app/web/assets/{ganttDiagram-3PRQTZWP-DKjfPPJ1.js → ganttDiagram-3PRQTZWP-CW8Ig5y4.js} +1 -1
- package/app/web/assets/{gitGraphDiagram-VXDFKS5L-RnPOf2fj.js → gitGraphDiagram-VXDFKS5L-CzS8Xg2D.js} +1 -1
- package/app/web/assets/{grid-E2QIVN74-C96GnBO1.js → grid-E2QIVN74-Cq284lCe.js} +1 -1
- package/app/web/assets/index-CINZ6P-q.css +1 -0
- package/app/web/assets/index-CvV6veuY.js +208 -0
- package/app/web/assets/{infoDiagram-EZ3ZOAHP-B68eZHsb.js → infoDiagram-EZ3ZOAHP-BZgN6qlY.js} +1 -1
- package/app/web/assets/{ishikawaDiagram-S3EKX5GW-BLj7PFLt.js → ishikawaDiagram-S3EKX5GW-BH9YHc-1.js} +1 -1
- package/app/web/assets/{journeyDiagram-POQNLL5X-Bo-_In0d.js → journeyDiagram-POQNLL5X-D50KYOLe.js} +1 -1
- package/app/web/assets/{kanban-definition-BH5XI6FM-BpHvxprW.js → kanban-definition-BH5XI6FM-Crw_5mMP.js} +1 -1
- package/app/web/assets/langs/{graphql-D6Z3qcRW.js → graphql-2R4AZ1iu.js} +1 -1
- package/app/web/assets/langs/{http-XiU9G9In.js → http-q2Qm0vBh.js} +1 -1
- package/app/web/assets/langs/{php-DL3xwS-7.js → php-Cz2gDBnd.js} +1 -1
- package/app/web/assets/langs/{rst-DudRVJ9g.js → rst-_9muvx-X.js} +1 -1
- package/app/web/assets/langs/{ruby-_FqsfqJi.js → ruby-cn7REk4H.js} +1 -1
- package/app/web/assets/langs/{svelte-ClsVJoBT.js → svelte-CPnL2mcy.js} +1 -1
- package/app/web/assets/langs/{vue-BiKMXCyK.js → vue-DO0YwyVz.js} +1 -1
- package/app/web/assets/{mermaid.core-COb9i2Gl.js → mermaid.core-o2Qjrppc.js} +5 -5
- package/app/web/assets/{mindmap-definition-WVAN44T4-DG15AlXd.js → mindmap-definition-WVAN44T4-B_bEbpAH.js} +1 -1
- package/app/web/assets/{pegDiagram-D4NLKWP3-GMBk8RM6.js → pegDiagram-D4NLKWP3-VecAHoyw.js} +1 -1
- package/app/web/assets/{pieDiagram-36ENHN4W-BzeJgVnn.js → pieDiagram-36ENHN4W-o3ei2T-6.js} +1 -1
- package/app/web/assets/{quadrantDiagram-ZQUDMS73-C--Kif6a.js → quadrantDiagram-ZQUDMS73-DHndOAcn.js} +1 -1
- package/app/web/assets/{railroadDiagram-JIZHGYPL-NPLVu_R7.js → railroadDiagram-JIZHGYPL-DRd_lfii.js} +1 -1
- package/app/web/assets/{render-VIF2ZAQL-DdpQ8E0J.js → render-VIF2ZAQL-awM3hUqB.js} +2 -2
- package/app/web/assets/{requirementDiagram-AXW2TVFA-WWRwRbkA.js → requirementDiagram-AXW2TVFA-Ce1ePsOe.js} +1 -1
- package/app/web/assets/{sankeyDiagram-FBCJTAIF-hBr6pZ0V.js → sankeyDiagram-FBCJTAIF-cP-LtgW-.js} +1 -1
- package/app/web/assets/{sequenceDiagram-3LA2ROMG-DvzZWy5J.js → sequenceDiagram-3LA2ROMG-C3JStTuW.js} +1 -1
- package/app/web/assets/{sizeCapture-2Q2CQKSF-C2B86W70.js → sizeCapture-2Q2CQKSF-Dyyelr9K.js} +1 -1
- package/app/web/assets/{stateDiagram-v2-ATKHQDJO-Jwj3XqMx.js → stateDiagram-v2-ATKHQDJO-DkYRBVTd.js} +1 -1
- package/app/web/assets/{swimlanes-YQL5WMAO-DxI0hC09.js → swimlanes-YQL5WMAO-B2FwJU5_.js} +1 -1
- package/app/web/assets/swimlanesDiagram-UCCPES4V-BkMsxCPb.js +8 -0
- package/app/web/assets/{timeline-definition-7Z437IG3-m8Ew8iuN.js → timeline-definition-7Z437IG3-Di-qRIIi.js} +1 -1
- package/app/web/assets/{usecaseDiagram-RDK6N6HP-BsiPSzIT.js → usecaseDiagram-RDK6N6HP-yAImn62t.js} +1 -1
- package/app/web/assets/{vendor-BKfNgqAm.js → vendor-BMCjWFMy.js} +20 -20
- package/app/web/assets/{vennDiagram-SHRQU5PJ-yYfXhiGp.js → vennDiagram-SHRQU5PJ-BEv8jpfv.js} +1 -1
- package/app/web/assets/{wardleyDiagram-F3OXNVQS-DHLEfnsg.js → wardleyDiagram-F3OXNVQS-7irksA0b.js} +1 -1
- package/app/web/assets/{xychartDiagram-GDYJKCDI-Drn_UxYt.js → xychartDiagram-GDYJKCDI-BokJGG2y.js} +1 -1
- package/app/web/codex-agent.png +0 -0
- package/app/web/codex.png +0 -0
- package/app/web/codexhost-settings.js +61 -61
- package/app/web/index.html +3 -3
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +78 -73
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +92 -92
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +114 -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-tool/client.js +79 -79
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +70 -70
- package/app/web/role-avatars/builtin/architect-otter.webp +0 -0
- package/app/web/role-avatars/builtin/audio-otter.webp +0 -0
- package/app/web/role-avatars/builtin/backend-otter.webp +0 -0
- package/app/web/role-avatars/builtin/classic-otter.webp +0 -0
- package/app/web/role-avatars/builtin/data-otter.webp +0 -0
- package/app/web/role-avatars/builtin/debugger-otter.webp +0 -0
- package/app/web/role-avatars/builtin/frontend-otter.webp +0 -0
- package/app/web/role-avatars/builtin/idea-otter.webp +0 -0
- package/app/web/role-avatars/builtin/ops-otter.webp +0 -0
- package/app/web/role-avatars/builtin/pm-otter.webp +0 -0
- package/app/web/role-avatars/builtin/researcher-otter.webp +0 -0
- package/app/web/role-avatars/builtin/reviewer-otter.webp +0 -0
- package/app/web/role-avatars/builtin/scholar-otter.webp +0 -0
- package/app/web/role-avatars/builtin/security-otter.webp +0 -0
- package/app/web/role-avatars/builtin/tester-otter.webp +0 -0
- package/app/web/role-avatars/builtin/writer-otter.webp +0 -0
- package/app/web-modules/node_modules/@deepseek-ai/dsh-host-webserver/index.js +7 -1
- package/app/web-modules/server.mjs +1281 -246
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-screenshot.exe +0 -0
- package/libexec/codexhost-shell.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-CDRWzs-u.js +0 -205
- package/app/web/assets/index-Dwdnvinl.css +0 -1
- package/app/web/assets/swimlanesDiagram-UCCPES4V-CR0nv8kJ.js +0 -8
|
@@ -2278,7 +2278,7 @@ var require_websocket = __commonJS({
|
|
|
2278
2278
|
var http = __require("http");
|
|
2279
2279
|
var net = __require("net");
|
|
2280
2280
|
var tls = __require("tls");
|
|
2281
|
-
var { randomBytes, createHash: createHash2 } = __require("crypto");
|
|
2281
|
+
var { randomBytes: randomBytes2, createHash: createHash2 } = __require("crypto");
|
|
2282
2282
|
var { Duplex, Readable } = __require("stream");
|
|
2283
2283
|
var { URL: URL2 } = __require("url");
|
|
2284
2284
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -2816,7 +2816,7 @@ var require_websocket = __commonJS({
|
|
|
2816
2816
|
}
|
|
2817
2817
|
}
|
|
2818
2818
|
const defaultPort = isSecure ? 443 : 80;
|
|
2819
|
-
const key =
|
|
2819
|
+
const key = randomBytes2(16).toString("base64");
|
|
2820
2820
|
const request = isSecure ? https.request : http.request;
|
|
2821
2821
|
const protocolSet = /* @__PURE__ */ new Set();
|
|
2822
2822
|
let perMessageDeflate;
|
|
@@ -5038,10 +5038,10 @@ function mergeDefs(...defs) {
|
|
|
5038
5038
|
function cloneDef(schema) {
|
|
5039
5039
|
return mergeDefs(schema._zod.def);
|
|
5040
5040
|
}
|
|
5041
|
-
function getElementAtPath(obj,
|
|
5042
|
-
if (!
|
|
5041
|
+
function getElementAtPath(obj, path14) {
|
|
5042
|
+
if (!path14)
|
|
5043
5043
|
return obj;
|
|
5044
|
-
return
|
|
5044
|
+
return path14.reduce((acc, key) => acc?.[key], obj);
|
|
5045
5045
|
}
|
|
5046
5046
|
function promiseAllObject(promisesObj) {
|
|
5047
5047
|
const keys = Object.keys(promisesObj);
|
|
@@ -5381,11 +5381,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
5381
5381
|
}
|
|
5382
5382
|
return false;
|
|
5383
5383
|
}
|
|
5384
|
-
function prefixIssues(
|
|
5384
|
+
function prefixIssues(path14, issues) {
|
|
5385
5385
|
return issues.map((iss) => {
|
|
5386
5386
|
var _a3;
|
|
5387
5387
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
5388
|
-
iss.path.unshift(
|
|
5388
|
+
iss.path.unshift(path14);
|
|
5389
5389
|
return iss;
|
|
5390
5390
|
});
|
|
5391
5391
|
}
|
|
@@ -5847,16 +5847,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
5847
5847
|
}
|
|
5848
5848
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
5849
5849
|
const fieldErrors = { _errors: [] };
|
|
5850
|
-
const processError = (error63,
|
|
5850
|
+
const processError = (error63, path14 = []) => {
|
|
5851
5851
|
for (const issue2 of error63.issues) {
|
|
5852
5852
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5853
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5853
|
+
issue2.errors.map((issues) => processError({ issues }, [...path14, ...issue2.path]));
|
|
5854
5854
|
} else if (issue2.code === "invalid_key") {
|
|
5855
|
-
processError({ issues: issue2.issues }, [...
|
|
5855
|
+
processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
|
|
5856
5856
|
} else if (issue2.code === "invalid_element") {
|
|
5857
|
-
processError({ issues: issue2.issues }, [...
|
|
5857
|
+
processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
|
|
5858
5858
|
} else {
|
|
5859
|
-
const fullpath = [...
|
|
5859
|
+
const fullpath = [...path14, ...issue2.path];
|
|
5860
5860
|
if (fullpath.length === 0) {
|
|
5861
5861
|
fieldErrors._errors.push(mapper(issue2));
|
|
5862
5862
|
} else {
|
|
@@ -5895,17 +5895,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
5895
5895
|
}
|
|
5896
5896
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
5897
5897
|
const result = { errors: [] };
|
|
5898
|
-
const processError = (error63,
|
|
5898
|
+
const processError = (error63, path14 = []) => {
|
|
5899
5899
|
var _a3;
|
|
5900
5900
|
for (const issue2 of error63.issues) {
|
|
5901
5901
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5902
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5902
|
+
issue2.errors.map((issues) => processError({ issues }, [...path14, ...issue2.path]));
|
|
5903
5903
|
} else if (issue2.code === "invalid_key") {
|
|
5904
|
-
processError({ issues: issue2.issues }, [...
|
|
5904
|
+
processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
|
|
5905
5905
|
} else if (issue2.code === "invalid_element") {
|
|
5906
|
-
processError({ issues: issue2.issues }, [...
|
|
5906
|
+
processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
|
|
5907
5907
|
} else {
|
|
5908
|
-
const fullpath = [...
|
|
5908
|
+
const fullpath = [...path14, ...issue2.path];
|
|
5909
5909
|
if (fullpath.length === 0) {
|
|
5910
5910
|
result.errors.push(mapper(issue2));
|
|
5911
5911
|
continue;
|
|
@@ -5944,8 +5944,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
5944
5944
|
}
|
|
5945
5945
|
function toDotPath(_path) {
|
|
5946
5946
|
const segs = [];
|
|
5947
|
-
const
|
|
5948
|
-
for (const seg of
|
|
5947
|
+
const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
5948
|
+
for (const seg of path14) {
|
|
5949
5949
|
if (typeof seg === "number")
|
|
5950
5950
|
segs.push(`[${seg}]`);
|
|
5951
5951
|
else if (typeof seg === "symbol")
|
|
@@ -23083,13 +23083,13 @@ function resolveRef(ref, ctx) {
|
|
|
23083
23083
|
if (!ref.startsWith("#")) {
|
|
23084
23084
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
23085
23085
|
}
|
|
23086
|
-
const
|
|
23087
|
-
if (
|
|
23086
|
+
const path14 = ref.slice(1).split("/").filter(Boolean);
|
|
23087
|
+
if (path14.length === 0) {
|
|
23088
23088
|
return ctx.rootSchema;
|
|
23089
23089
|
}
|
|
23090
23090
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
23091
|
-
if (
|
|
23092
|
-
const key =
|
|
23091
|
+
if (path14[0] === defsKey) {
|
|
23092
|
+
const key = path14[1] === void 0 ? void 0 : decodeJSONPointerSegment(path14[1]);
|
|
23093
23093
|
if (!key || !ctx.defs[key]) {
|
|
23094
23094
|
throw new Error(`Reference not found: ${ref}`);
|
|
23095
23095
|
}
|
|
@@ -24025,6 +24025,8 @@ var harnessIdSchema = opaqueIdSchema.brand();
|
|
|
24025
24025
|
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
24026
24026
|
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
24027
24027
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
24028
|
+
var HARNESS_THINKING_OPTION_ID_MAX_LENGTH = 128;
|
|
24029
|
+
var harnessThinkingOptionIdSchema = opaqueIdSchema.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
|
|
24028
24030
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
24029
24031
|
|
|
24030
24032
|
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
@@ -24106,6 +24108,122 @@ var threadHandoffResultSchema = external_exports.object({
|
|
|
24106
24108
|
handoff: threadHandoffMetadataSchema
|
|
24107
24109
|
}).strict();
|
|
24108
24110
|
|
|
24111
|
+
// ../../shared-contracts/dist/agent-role.js
|
|
24112
|
+
var roleSlugSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/u);
|
|
24113
|
+
var roleModelSchema = external_exports.string().min(1).max(512).refine((value) => !new RegExp("\\p{Cc}", "u").test(value), "Role model must not contain control characters");
|
|
24114
|
+
var roleAccentColorSchema = external_exports.enum(["stone", "rose", "mist", "sage", "amber", "aqua"]);
|
|
24115
|
+
var BUILTIN_ROLE_AVATAR_IDS = [
|
|
24116
|
+
"pm-otter",
|
|
24117
|
+
"frontend-otter",
|
|
24118
|
+
"backend-otter",
|
|
24119
|
+
"reviewer-otter",
|
|
24120
|
+
"idea-otter",
|
|
24121
|
+
"researcher-otter",
|
|
24122
|
+
"writer-otter",
|
|
24123
|
+
"architect-otter",
|
|
24124
|
+
"debugger-otter",
|
|
24125
|
+
"tester-otter",
|
|
24126
|
+
"classic-otter",
|
|
24127
|
+
"ops-otter",
|
|
24128
|
+
"security-otter",
|
|
24129
|
+
"audio-otter",
|
|
24130
|
+
"scholar-otter",
|
|
24131
|
+
"data-otter"
|
|
24132
|
+
];
|
|
24133
|
+
var builtinRoleAvatarSchema = external_exports.templateLiteral([
|
|
24134
|
+
"builtin:",
|
|
24135
|
+
external_exports.enum(BUILTIN_ROLE_AVATAR_IDS)
|
|
24136
|
+
]);
|
|
24137
|
+
var ROLE_AVATAR_FILENAME_PATTERN = /^[a-zA-Z0-9_-]{1,64}\.(png|jpg|jpeg|webp)$/u;
|
|
24138
|
+
var customRoleAvatarSchema = external_exports.templateLiteral([
|
|
24139
|
+
"custom:",
|
|
24140
|
+
external_exports.string().regex(ROLE_AVATAR_FILENAME_PATTERN)
|
|
24141
|
+
]);
|
|
24142
|
+
var catalogRoleAvatarSchema = external_exports.templateLiteral([
|
|
24143
|
+
"catalog:",
|
|
24144
|
+
external_exports.string().regex(ROLE_AVATAR_FILENAME_PATTERN)
|
|
24145
|
+
]);
|
|
24146
|
+
var roleAvatarSchema = external_exports.union([builtinRoleAvatarSchema, customRoleAvatarSchema]);
|
|
24147
|
+
var roleCatalogAvatarSchema = external_exports.union([builtinRoleAvatarSchema, catalogRoleAvatarSchema]);
|
|
24148
|
+
var saveRoleAvatarSchema = external_exports.union([roleAvatarSchema, catalogRoleAvatarSchema]);
|
|
24149
|
+
var httpsUrlSchema = external_exports.string().url().max(2048).refine((value) => /^https:\/\//i.test(value), "URL must use https://");
|
|
24150
|
+
var localizedRoleTextSchema = external_exports.object({
|
|
24151
|
+
en: external_exports.string().trim().min(1).max(2e3),
|
|
24152
|
+
"zh-CN": external_exports.string().trim().min(1).max(2e3)
|
|
24153
|
+
});
|
|
24154
|
+
var roleCatalogEntrySchema = external_exports.object({
|
|
24155
|
+
slug: roleSlugSchema,
|
|
24156
|
+
name: localizedRoleTextSchema,
|
|
24157
|
+
description: localizedRoleTextSchema,
|
|
24158
|
+
avatar: roleCatalogAvatarSchema,
|
|
24159
|
+
accentColor: roleAccentColorSchema,
|
|
24160
|
+
recommendedHarnessId: harnessIdSchema.optional(),
|
|
24161
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
24162
|
+
authorUrl: httpsUrlSchema.optional(),
|
|
24163
|
+
sourceUrl: httpsUrlSchema.optional(),
|
|
24164
|
+
license: external_exports.string().trim().min(1).max(64).optional(),
|
|
24165
|
+
official: external_exports.boolean().optional(),
|
|
24166
|
+
instructions: external_exports.string().trim().min(1).max(1e5),
|
|
24167
|
+
updatedAt: external_exports.iso.datetime()
|
|
24168
|
+
});
|
|
24169
|
+
var roleCatalogDocumentSchema = external_exports.object({
|
|
24170
|
+
formatVersion: external_exports.literal(1),
|
|
24171
|
+
generatedAt: external_exports.iso.datetime(),
|
|
24172
|
+
roles: external_exports.array(roleCatalogEntrySchema)
|
|
24173
|
+
});
|
|
24174
|
+
var roleIdentitySchema = external_exports.object({
|
|
24175
|
+
slug: roleSlugSchema,
|
|
24176
|
+
name: external_exports.string().refine((name) => name.trim().length > 0),
|
|
24177
|
+
avatar: roleAvatarSchema,
|
|
24178
|
+
accentColor: roleAccentColorSchema
|
|
24179
|
+
});
|
|
24180
|
+
var threadRoleSnapshotSchema = roleIdentitySchema.readonly();
|
|
24181
|
+
var agentRoleSchema = roleIdentitySchema.extend({
|
|
24182
|
+
description: external_exports.string(),
|
|
24183
|
+
harnessId: harnessIdSchema,
|
|
24184
|
+
model: roleModelSchema.optional(),
|
|
24185
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
24186
|
+
instructions: external_exports.string(),
|
|
24187
|
+
updatedAt: external_exports.iso.datetime()
|
|
24188
|
+
});
|
|
24189
|
+
var saveAgentRoleInputSchema = agentRoleSchema.omit({ updatedAt: true, avatar: true }).extend({ avatar: saveRoleAvatarSchema }).partial({ slug: true });
|
|
24190
|
+
var ROLES_LIST_METHOD = "codexhost/roles/list";
|
|
24191
|
+
var ROLES_GET_METHOD = "codexhost/roles/get";
|
|
24192
|
+
var ROLES_SAVE_METHOD = "codexhost/roles/save";
|
|
24193
|
+
var ROLES_DELETE_METHOD = "codexhost/roles/delete";
|
|
24194
|
+
var ROLES_CATALOG_METHOD = "codexhost/roles/catalog";
|
|
24195
|
+
var ROLES_LIKE_METHOD = "codexhost/roles/like";
|
|
24196
|
+
var ROLE_LIKES_MAX_PER_ROLE = 5;
|
|
24197
|
+
var rolesListParamsSchema = external_exports.object({
|
|
24198
|
+
locale: external_exports.string().trim().min(1).max(64).optional()
|
|
24199
|
+
});
|
|
24200
|
+
var rolesListResultSchema = external_exports.object({ roles: external_exports.array(agentRoleSchema) });
|
|
24201
|
+
var rolesGetParamsSchema = external_exports.object({ slug: roleSlugSchema });
|
|
24202
|
+
var rolesGetResultSchema = external_exports.object({ role: agentRoleSchema.nullable() });
|
|
24203
|
+
var rolesSaveResultSchema = external_exports.object({ role: agentRoleSchema });
|
|
24204
|
+
var rolesDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
|
|
24205
|
+
var rolesCatalogParamsSchema = external_exports.object({
|
|
24206
|
+
refresh: external_exports.boolean().optional()
|
|
24207
|
+
});
|
|
24208
|
+
var rolesCatalogResultSchema = external_exports.object({
|
|
24209
|
+
roles: external_exports.array(roleCatalogEntrySchema),
|
|
24210
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
24211
|
+
likes: external_exports.record(roleSlugSchema, external_exports.number().int().nonnegative()).optional(),
|
|
24212
|
+
myLikes: external_exports.record(roleSlugSchema, external_exports.number().int().min(0).max(ROLE_LIKES_MAX_PER_ROLE)).optional(),
|
|
24213
|
+
stale: external_exports.boolean().optional(),
|
|
24214
|
+
error: external_exports.string().optional()
|
|
24215
|
+
});
|
|
24216
|
+
var rolesLikeParamsSchema = external_exports.object({
|
|
24217
|
+
slug: roleSlugSchema
|
|
24218
|
+
});
|
|
24219
|
+
var rolesLikeResultSchema = external_exports.object({
|
|
24220
|
+
slug: roleSlugSchema,
|
|
24221
|
+
likes: external_exports.number().int().nonnegative(),
|
|
24222
|
+
myLikes: external_exports.number().int().min(0).max(ROLE_LIKES_MAX_PER_ROLE),
|
|
24223
|
+
maxLikes: external_exports.literal(ROLE_LIKES_MAX_PER_ROLE),
|
|
24224
|
+
limitReached: external_exports.boolean().optional()
|
|
24225
|
+
});
|
|
24226
|
+
|
|
24109
24227
|
// ../../shared-contracts/dist/thread-usage.js
|
|
24110
24228
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
24111
24229
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -24287,7 +24405,6 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
24287
24405
|
// ../../shared-contracts/dist/harness-models.js
|
|
24288
24406
|
var HARNESS_MODEL_REF_MAX_LENGTH = 512;
|
|
24289
24407
|
var HARNESS_MODEL_LABEL_MAX_LENGTH = 256;
|
|
24290
|
-
var HARNESS_THINKING_OPTION_ID_MAX_LENGTH = 128;
|
|
24291
24408
|
var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
24292
24409
|
var nonBlankTextSchema3 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
24293
24410
|
message: "Value must not be empty or whitespace"
|
|
@@ -24301,7 +24418,6 @@ var harnessModelRefSchema = external_exports.object({
|
|
|
24301
24418
|
function sameHarnessModelRef(left, right) {
|
|
24302
24419
|
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
24303
24420
|
}
|
|
24304
|
-
var harnessThinkingOptionIdSchema = nonBlankTextSchema3.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
|
|
24305
24421
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema3.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
24306
24422
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
24307
24423
|
id: harnessThinkingOptionIdSchema,
|
|
@@ -24514,8 +24630,10 @@ var codexThreadInspectionSchema = external_exports.object({
|
|
|
24514
24630
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
24515
24631
|
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
24516
24632
|
supportsThreadReferences: external_exports.literal(true).optional(),
|
|
24517
|
-
handoff: threadHandoffMetadataSchema.optional()
|
|
24518
|
-
|
|
24633
|
+
handoff: threadHandoffMetadataSchema.optional(),
|
|
24634
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
24635
|
+
nativeSessionRef: external_exports.never().optional()
|
|
24636
|
+
});
|
|
24519
24637
|
var externalThreadInspectionSchema = external_exports.object({
|
|
24520
24638
|
owner: external_exports.literal("external"),
|
|
24521
24639
|
harnessId: nonBlankTextSchema3.max(256),
|
|
@@ -24530,8 +24648,10 @@ var externalThreadInspectionSchema = external_exports.object({
|
|
|
24530
24648
|
history: harnessHistoryCapabilitiesSchema,
|
|
24531
24649
|
usage: threadUsageSnapshotSchema.optional(),
|
|
24532
24650
|
handoff: threadHandoffMetadataSchema.optional(),
|
|
24651
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
24652
|
+
nativeSessionRef: external_exports.never().optional(),
|
|
24533
24653
|
locked: external_exports.literal(true)
|
|
24534
|
-
})
|
|
24654
|
+
});
|
|
24535
24655
|
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
24536
24656
|
codexThreadInspectionSchema,
|
|
24537
24657
|
externalThreadInspectionSchema
|
|
@@ -24774,7 +24894,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
|
|
|
24774
24894
|
default: external_exports.string().optional()
|
|
24775
24895
|
})
|
|
24776
24896
|
]).superRefine((field2, ctx) => {
|
|
24777
|
-
const issue2 = (
|
|
24897
|
+
const issue2 = (path14, message) => ctx.addIssue({ code: "custom", path: [path14], message });
|
|
24778
24898
|
if (field2.type === "number" || field2.type === "range") {
|
|
24779
24899
|
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
24780
24900
|
if (min > max)
|
|
@@ -24880,16 +25000,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
|
|
|
24880
25000
|
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
24881
25001
|
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
24882
25002
|
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
24883
|
-
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((
|
|
25003
|
+
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((path14) => path14.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
24884
25004
|
var legacy = desktopExtensionManifestSchema.shape;
|
|
24885
25005
|
var localized = (max, min = 0) => external_exports.strictObject({
|
|
24886
25006
|
en: external_exports.string().trim().min(min).max(max),
|
|
24887
25007
|
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
24888
25008
|
});
|
|
24889
|
-
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((
|
|
25009
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path14) => path14.endsWith(suffix), `Expected a ${suffix} file`);
|
|
24890
25010
|
var moduleEntry = resourceWithSuffix(".mjs");
|
|
24891
25011
|
var style = resourceWithSuffix(".css").optional();
|
|
24892
|
-
var hostExtensionCanonicalPath = (
|
|
25012
|
+
var hostExtensionCanonicalPath = (path14) => path14.normalize("NFC").toLowerCase();
|
|
24893
25013
|
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
24894
25014
|
manifestVersion: external_exports.literal(2),
|
|
24895
25015
|
id: hostExtensionIdSchema,
|
|
@@ -24899,8 +25019,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
|
24899
25019
|
details: localized(16384).optional(),
|
|
24900
25020
|
author: legacy.author,
|
|
24901
25021
|
repository: legacy.repository,
|
|
24902
|
-
icon: legacy.icon.refine((
|
|
24903
|
-
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((
|
|
25022
|
+
icon: legacy.icon.refine((path14) => path14 === void 0 || hostExtensionResourcePathSchema.safeParse(path14).success),
|
|
25023
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path14) => hostExtensionResourcePathSchema.safeParse(path14).success)),
|
|
24904
25024
|
categories: legacy.categories,
|
|
24905
25025
|
settingsSchema: legacy.settingsSchema,
|
|
24906
25026
|
slots: legacy.slots.removeDefault().optional(),
|
|
@@ -24934,6 +25054,9 @@ var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
|
24934
25054
|
// ../../shared-contracts/dist/thread-tree-watch.js
|
|
24935
25055
|
var THREAD_TREE_MAX_NODES = 5e3;
|
|
24936
25056
|
var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
|
|
25057
|
+
var threadTreeDelegationSchema = external_exports.object({
|
|
25058
|
+
createdAtMs: external_exports.number().int().nonnegative()
|
|
25059
|
+
});
|
|
24937
25060
|
var threadTreeHandoffSchema = external_exports.strictObject({
|
|
24938
25061
|
sourceThreadId: hostThreadIdSchema,
|
|
24939
25062
|
createdAtMs: external_exports.number().int().nonnegative()
|
|
@@ -24945,13 +25068,14 @@ var threadTreeNodeSchema = external_exports.strictObject({
|
|
|
24945
25068
|
archived: external_exports.boolean(),
|
|
24946
25069
|
updatedAtMs: external_exports.number().int().nonnegative().optional()
|
|
24947
25070
|
});
|
|
24948
|
-
var threadTreeSnapshotSchema = external_exports.
|
|
25071
|
+
var threadTreeSnapshotSchema = external_exports.object({
|
|
24949
25072
|
revision: external_exports.int().nonnegative(),
|
|
24950
25073
|
parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
|
|
25074
|
+
delegations: external_exports.record(hostThreadIdSchema, threadTreeDelegationSchema).optional(),
|
|
24951
25075
|
handoffs: external_exports.record(hostThreadIdSchema, threadTreeHandoffSchema).optional(),
|
|
24952
25076
|
nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
|
|
24953
25077
|
truncated: external_exports.boolean()
|
|
24954
|
-
}).refine((snapshot) => Object.keys(snapshot.nodes).length <= THREAD_TREE_MAX_NODES, "Too many Thread tree nodes").refine(({ parents, handoffs, nodes }) => Object.entries(parents).every(([child, parent]) => Object.hasOwn(nodes, child) && Object.hasOwn(nodes, parent)) && Object.entries(handoffs ?? {}).every(([target2, { sourceThreadId }]) => Object.hasOwn(nodes, target2) && Object.hasOwn(nodes, sourceThreadId)), "Missing Thread tree node");
|
|
25078
|
+
}).refine((snapshot) => Object.keys(snapshot.nodes).length <= THREAD_TREE_MAX_NODES, "Too many Thread tree nodes").refine(({ parents, handoffs, nodes }) => Object.entries(parents).every(([child, parent]) => Object.hasOwn(nodes, child) && Object.hasOwn(nodes, parent)) && Object.entries(handoffs ?? {}).every(([target2, { sourceThreadId }]) => Object.hasOwn(nodes, target2) && Object.hasOwn(nodes, sourceThreadId)), "Missing Thread tree node").refine(({ parents, delegations }) => Object.keys(delegations ?? {}).every((child) => Object.hasOwn(parents, child)), "Delegation metadata requires a matching parent edge");
|
|
24955
25079
|
var subscriptionId = external_exports.string().min(1).max(128);
|
|
24956
25080
|
var threadTreeWatchParamsSchema = external_exports.strictObject({});
|
|
24957
25081
|
var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
|
|
@@ -25022,7 +25146,7 @@ var active = {
|
|
|
25022
25146
|
digest: hostExtensionDigestSchema
|
|
25023
25147
|
};
|
|
25024
25148
|
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
25025
|
-
var filePath = external_exports.string().min(1).max(4096).refine((
|
|
25149
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path14) => /^(?:\/|[a-z]:[/\\])/iu.test(path14) && !path14.includes("\0") && !path14.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
25026
25150
|
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");
|
|
25027
25151
|
function base643(maxBytes) {
|
|
25028
25152
|
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
@@ -25219,6 +25343,206 @@ var hostExtensionsRpcSchemas = {
|
|
|
25219
25343
|
}
|
|
25220
25344
|
};
|
|
25221
25345
|
|
|
25346
|
+
// ../../shared-contracts/dist/group-chat.js
|
|
25347
|
+
var DEFAULT_GROUP_MAX_AGENT_HOPS = 5;
|
|
25348
|
+
var MAX_GROUP_AGENT_HOPS = 20;
|
|
25349
|
+
var remoteGroupRoomIdSchema = external_exports.string().regex(/^remote:[A-Za-z0-9_-]{8,512}$/u);
|
|
25350
|
+
var groupRoomIdSchema = external_exports.union([external_exports.uuidv4(), remoteGroupRoomIdSchema]);
|
|
25351
|
+
var groupMemberIdSchema = external_exports.uuidv4();
|
|
25352
|
+
var groupMemberHandleSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/u);
|
|
25353
|
+
var groupUnmentionedPolicySchema = external_exports.enum(["none", "last_speaker", "all"]);
|
|
25354
|
+
var groupMemberStatusSchema = external_exports.enum(["active", "muted", "removed"]);
|
|
25355
|
+
var nonnegativeInteger = external_exports.int().nonnegative();
|
|
25356
|
+
var positiveInteger = external_exports.int().positive();
|
|
25357
|
+
var maxAgentHopsSchema = positiveInteger.max(MAX_GROUP_AGENT_HOPS);
|
|
25358
|
+
var nonblankString = external_exports.string().refine((value) => value.trim().length > 0);
|
|
25359
|
+
var timestamp = external_exports.iso.datetime();
|
|
25360
|
+
var optionalMemberEdits = {
|
|
25361
|
+
handle: groupMemberHandleSchema.optional(),
|
|
25362
|
+
displayName: nonblankString.optional(),
|
|
25363
|
+
note: external_exports.string().optional()
|
|
25364
|
+
};
|
|
25365
|
+
var groupMemberSchema = external_exports.object({
|
|
25366
|
+
memberId: groupMemberIdSchema,
|
|
25367
|
+
threadId: hostThreadIdSchema,
|
|
25368
|
+
handle: groupMemberHandleSchema,
|
|
25369
|
+
displayName: nonblankString,
|
|
25370
|
+
note: external_exports.string().optional(),
|
|
25371
|
+
roleSlug: roleSlugSchema.optional(),
|
|
25372
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
25373
|
+
harnessId: harnessIdSchema,
|
|
25374
|
+
status: groupMemberStatusSchema,
|
|
25375
|
+
joinedAtSeq: nonnegativeInteger,
|
|
25376
|
+
lastDeliveredSeq: nonnegativeInteger,
|
|
25377
|
+
lastRosterVersion: nonnegativeInteger,
|
|
25378
|
+
createdAt: timestamp
|
|
25379
|
+
});
|
|
25380
|
+
var groupRoomRemoteHostSchema = external_exports.object({
|
|
25381
|
+
hostId: nonblankString,
|
|
25382
|
+
displayName: nonblankString,
|
|
25383
|
+
state: nonblankString.optional(),
|
|
25384
|
+
color: external_exports.string().optional(),
|
|
25385
|
+
filePreview: external_exports.boolean().optional()
|
|
25386
|
+
});
|
|
25387
|
+
var groupRoomSchema = external_exports.object({
|
|
25388
|
+
roomId: groupRoomIdSchema,
|
|
25389
|
+
title: nonblankString,
|
|
25390
|
+
defaultCwd: nonblankString,
|
|
25391
|
+
unmentionedPolicy: groupUnmentionedPolicySchema.default("none"),
|
|
25392
|
+
allowAgentMentions: external_exports.boolean().default(true),
|
|
25393
|
+
maxAgentHops: maxAgentHopsSchema.default(DEFAULT_GROUP_MAX_AGENT_HOPS),
|
|
25394
|
+
lastSeq: nonnegativeInteger,
|
|
25395
|
+
lastSpeakerMemberId: groupMemberIdSchema.optional(),
|
|
25396
|
+
rosterVersion: nonnegativeInteger,
|
|
25397
|
+
humanEpoch: nonnegativeInteger,
|
|
25398
|
+
relayPaused: external_exports.boolean(),
|
|
25399
|
+
pinned: external_exports.boolean(),
|
|
25400
|
+
createdAt: timestamp,
|
|
25401
|
+
updatedAt: timestamp,
|
|
25402
|
+
members: external_exports.array(groupMemberSchema),
|
|
25403
|
+
remote: groupRoomRemoteHostSchema.optional()
|
|
25404
|
+
}).superRefine(({ members: members2 }, context) => {
|
|
25405
|
+
const handles = /* @__PURE__ */ new Set();
|
|
25406
|
+
for (const [index, { handle, status }] of members2.entries()) {
|
|
25407
|
+
if (status === "removed")
|
|
25408
|
+
continue;
|
|
25409
|
+
if (handles.has(handle)) {
|
|
25410
|
+
context.addIssue({
|
|
25411
|
+
code: "custom",
|
|
25412
|
+
path: ["members", index, "handle"],
|
|
25413
|
+
message: "Handle must be unique among non-removed members"
|
|
25414
|
+
});
|
|
25415
|
+
}
|
|
25416
|
+
handles.add(handle);
|
|
25417
|
+
}
|
|
25418
|
+
});
|
|
25419
|
+
var groupAttachmentSchema = external_exports.object({
|
|
25420
|
+
kind: external_exports.enum(["image", "file"]),
|
|
25421
|
+
attachmentId: nonblankString.max(256),
|
|
25422
|
+
name: nonblankString.max(256),
|
|
25423
|
+
path: nonblankString.max(4096),
|
|
25424
|
+
bytes: nonnegativeInteger,
|
|
25425
|
+
mediaType: nonblankString.max(128).optional(),
|
|
25426
|
+
width: positiveInteger.optional(),
|
|
25427
|
+
height: positiveInteger.optional()
|
|
25428
|
+
});
|
|
25429
|
+
var groupMessageSchema = external_exports.object({
|
|
25430
|
+
roomId: groupRoomIdSchema,
|
|
25431
|
+
seq: positiveInteger,
|
|
25432
|
+
messageId: nonblankString,
|
|
25433
|
+
senderType: external_exports.enum(["user", "agent", "system"]),
|
|
25434
|
+
senderMemberId: groupMemberIdSchema.optional(),
|
|
25435
|
+
senderHandle: groupMemberHandleSchema.optional(),
|
|
25436
|
+
senderName: external_exports.string().optional(),
|
|
25437
|
+
senderThreadId: hostThreadIdSchema.optional(),
|
|
25438
|
+
sourceTurnId: nonblankString.optional(),
|
|
25439
|
+
replyToSeq: positiveInteger.optional(),
|
|
25440
|
+
content: external_exports.string(),
|
|
25441
|
+
attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
|
|
25442
|
+
mentionedMemberIds: external_exports.array(groupMemberIdSchema),
|
|
25443
|
+
mentionAll: external_exports.boolean().optional(),
|
|
25444
|
+
hopCount: nonnegativeInteger,
|
|
25445
|
+
createdAt: timestamp
|
|
25446
|
+
});
|
|
25447
|
+
var newThreadOptions = {
|
|
25448
|
+
...optionalMemberEdits,
|
|
25449
|
+
model: roleModelSchema.optional(),
|
|
25450
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
25451
|
+
worktree: external_exports.boolean().optional()
|
|
25452
|
+
};
|
|
25453
|
+
var groupCreateMemberInputSchema = external_exports.discriminatedUnion("kind", [
|
|
25454
|
+
external_exports.strictObject({ kind: external_exports.literal("role"), roleSlug: roleSlugSchema, ...newThreadOptions }),
|
|
25455
|
+
external_exports.strictObject({ kind: external_exports.literal("harness"), harnessId: harnessIdSchema, ...newThreadOptions }),
|
|
25456
|
+
external_exports.strictObject({
|
|
25457
|
+
kind: external_exports.literal("existing"),
|
|
25458
|
+
threadId: hostThreadIdSchema,
|
|
25459
|
+
...optionalMemberEdits,
|
|
25460
|
+
includeRecentHistory: external_exports.boolean().default(true).optional()
|
|
25461
|
+
})
|
|
25462
|
+
]);
|
|
25463
|
+
var GROUPS_LIST_METHOD = "codexhost/groups/list";
|
|
25464
|
+
var GROUPS_GET_METHOD = "codexhost/groups/get";
|
|
25465
|
+
var GROUPS_CREATE_METHOD = "codexhost/groups/create";
|
|
25466
|
+
var GROUPS_UPDATE_METHOD = "codexhost/groups/update";
|
|
25467
|
+
var GROUPS_DELETE_METHOD = "codexhost/groups/delete";
|
|
25468
|
+
var GROUPS_ADD_MEMBER_METHOD = "codexhost/groups/member/add";
|
|
25469
|
+
var GROUPS_UPDATE_MEMBER_METHOD = "codexhost/groups/member/update";
|
|
25470
|
+
var GROUPS_REMOVE_MEMBER_METHOD = "codexhost/groups/member/remove";
|
|
25471
|
+
var GROUPS_POST_MESSAGE_METHOD = "codexhost/groups/message/post";
|
|
25472
|
+
var GROUPS_READ_MESSAGES_METHOD = "codexhost/groups/messages/read";
|
|
25473
|
+
var roomIdentity = { roomId: groupRoomIdSchema };
|
|
25474
|
+
var memberIdentity = { ...roomIdentity, memberId: groupMemberIdSchema };
|
|
25475
|
+
var roomEdits = {
|
|
25476
|
+
title: nonblankString.optional(),
|
|
25477
|
+
unmentionedPolicy: groupUnmentionedPolicySchema.optional(),
|
|
25478
|
+
allowAgentMentions: external_exports.boolean().optional(),
|
|
25479
|
+
maxAgentHops: maxAgentHopsSchema.optional()
|
|
25480
|
+
};
|
|
25481
|
+
var groupsListParamsSchema = external_exports.strictObject({});
|
|
25482
|
+
var groupsListResultSchema = external_exports.object({ rooms: external_exports.array(groupRoomSchema) });
|
|
25483
|
+
var groupsGetParamsSchema = external_exports.strictObject({
|
|
25484
|
+
...roomIdentity,
|
|
25485
|
+
limit: positiveInteger.optional(),
|
|
25486
|
+
beforeSeq: positiveInteger.optional()
|
|
25487
|
+
});
|
|
25488
|
+
var groupsGetResultSchema = external_exports.object({
|
|
25489
|
+
room: groupRoomSchema.nullable(),
|
|
25490
|
+
messages: external_exports.array(groupMessageSchema),
|
|
25491
|
+
hasMore: external_exports.boolean()
|
|
25492
|
+
});
|
|
25493
|
+
var groupsCreateParamsSchema = external_exports.strictObject({
|
|
25494
|
+
...roomEdits,
|
|
25495
|
+
defaultCwd: nonblankString,
|
|
25496
|
+
members: external_exports.array(groupCreateMemberInputSchema)
|
|
25497
|
+
});
|
|
25498
|
+
var groupsCreateResultSchema = external_exports.object({ room: groupRoomSchema });
|
|
25499
|
+
var groupsUpdateParamsSchema = external_exports.strictObject({
|
|
25500
|
+
...roomIdentity,
|
|
25501
|
+
...roomEdits,
|
|
25502
|
+
pinned: external_exports.boolean().optional(),
|
|
25503
|
+
relayPaused: external_exports.boolean().optional()
|
|
25504
|
+
});
|
|
25505
|
+
var groupsDeleteParamsSchema = external_exports.strictObject(roomIdentity);
|
|
25506
|
+
var groupsDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
|
|
25507
|
+
var groupsAddMemberParamsSchema = external_exports.strictObject({
|
|
25508
|
+
...roomIdentity,
|
|
25509
|
+
member: groupCreateMemberInputSchema
|
|
25510
|
+
});
|
|
25511
|
+
var groupsAddMemberResultSchema = external_exports.object({
|
|
25512
|
+
room: groupRoomSchema,
|
|
25513
|
+
member: groupMemberSchema
|
|
25514
|
+
});
|
|
25515
|
+
var groupsUpdateMemberParamsSchema = external_exports.strictObject({
|
|
25516
|
+
...memberIdentity,
|
|
25517
|
+
...optionalMemberEdits,
|
|
25518
|
+
status: groupMemberStatusSchema.optional()
|
|
25519
|
+
});
|
|
25520
|
+
var groupsRemoveMemberParamsSchema = external_exports.strictObject(memberIdentity);
|
|
25521
|
+
var groupsPostMessageParamsSchema = external_exports.strictObject({
|
|
25522
|
+
...roomIdentity,
|
|
25523
|
+
content: external_exports.string().max(64e3),
|
|
25524
|
+
attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
|
|
25525
|
+
replyToSeq: positiveInteger.optional(),
|
|
25526
|
+
targetMemberIds: external_exports.array(groupMemberIdSchema).optional(),
|
|
25527
|
+
mentionAll: external_exports.boolean().optional()
|
|
25528
|
+
}).refine((value) => value.content.trim().length > 0 || (value.attachments?.length ?? 0) > 0, "Message content or at least one attachment is required");
|
|
25529
|
+
var groupsPostMessageResultSchema = external_exports.object({
|
|
25530
|
+
room: groupRoomSchema,
|
|
25531
|
+
message: groupMessageSchema,
|
|
25532
|
+
awakenedMemberIds: external_exports.array(groupMemberIdSchema)
|
|
25533
|
+
});
|
|
25534
|
+
var groupsReadMessagesParamsSchema = external_exports.strictObject({
|
|
25535
|
+
...roomIdentity,
|
|
25536
|
+
fromSeq: positiveInteger.optional(),
|
|
25537
|
+
toSeq: positiveInteger.optional(),
|
|
25538
|
+
limit: positiveInteger.optional()
|
|
25539
|
+
});
|
|
25540
|
+
var groupsReadMessagesResultSchema = external_exports.object({
|
|
25541
|
+
...roomIdentity,
|
|
25542
|
+
messages: external_exports.array(groupMessageSchema),
|
|
25543
|
+
totalSeq: nonnegativeInteger
|
|
25544
|
+
});
|
|
25545
|
+
|
|
25222
25546
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
25223
25547
|
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
25224
25548
|
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
@@ -25389,6 +25713,22 @@ var clientThreadSectionMutationResultSchema = external_exports.discriminatedUnio
|
|
|
25389
25713
|
]);
|
|
25390
25714
|
var CLIENT_CHANNEL_METHODS = [
|
|
25391
25715
|
"codexhost/skills/list",
|
|
25716
|
+
ROLES_LIST_METHOD,
|
|
25717
|
+
ROLES_GET_METHOD,
|
|
25718
|
+
ROLES_SAVE_METHOD,
|
|
25719
|
+
ROLES_DELETE_METHOD,
|
|
25720
|
+
ROLES_CATALOG_METHOD,
|
|
25721
|
+
ROLES_LIKE_METHOD,
|
|
25722
|
+
GROUPS_LIST_METHOD,
|
|
25723
|
+
GROUPS_GET_METHOD,
|
|
25724
|
+
GROUPS_CREATE_METHOD,
|
|
25725
|
+
GROUPS_UPDATE_METHOD,
|
|
25726
|
+
GROUPS_DELETE_METHOD,
|
|
25727
|
+
GROUPS_ADD_MEMBER_METHOD,
|
|
25728
|
+
GROUPS_UPDATE_MEMBER_METHOD,
|
|
25729
|
+
GROUPS_REMOVE_MEMBER_METHOD,
|
|
25730
|
+
GROUPS_POST_MESSAGE_METHOD,
|
|
25731
|
+
GROUPS_READ_MESSAGES_METHOD,
|
|
25392
25732
|
"codexhost/voice/status",
|
|
25393
25733
|
"codexhost/voice/transcribe",
|
|
25394
25734
|
"codexhost/harness/display-settings/get",
|
|
@@ -25550,6 +25890,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
25550
25890
|
}),
|
|
25551
25891
|
external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
|
|
25552
25892
|
external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
|
|
25893
|
+
external_exports.object({
|
|
25894
|
+
type: external_exports.literal("groups-changed"),
|
|
25895
|
+
cursor: clientChannelCursorSchema,
|
|
25896
|
+
roomId: external_exports.string().optional()
|
|
25897
|
+
}),
|
|
25553
25898
|
external_exports.object({
|
|
25554
25899
|
type: external_exports.literal("preferences-changed"),
|
|
25555
25900
|
cursor: clientChannelCursorSchema,
|
|
@@ -25683,6 +26028,7 @@ var clientThreadSnapshotSchema = external_exports.object({
|
|
|
25683
26028
|
status: external_exports.object({ type: external_exports.string() }).passthrough(),
|
|
25684
26029
|
name: external_exports.string().nullable().optional(),
|
|
25685
26030
|
preview: external_exports.string().optional(),
|
|
26031
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
25686
26032
|
codexhostImportSource: clientThreadImportSourceSchema.optional(),
|
|
25687
26033
|
turns: external_exports.array(clientTurnSchema).length(0)
|
|
25688
26034
|
}).passthrough(),
|
|
@@ -26710,6 +27056,10 @@ var webToolOutputPreviewSchema = external_exports.object({
|
|
|
26710
27056
|
bytes: external_exports.number().int().nonnegative()
|
|
26711
27057
|
});
|
|
26712
27058
|
|
|
27059
|
+
// ../../shared-contracts/dist/desktop-shell.js
|
|
27060
|
+
var desktopShellOpenParamsSchema = external_exports.strictObject({});
|
|
27061
|
+
var desktopShellOpenResultSchema = external_exports.strictObject({});
|
|
27062
|
+
|
|
26713
27063
|
// ../../shared-contracts/dist/console.js
|
|
26714
27064
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
26715
27065
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -28515,16 +28865,16 @@ var Diff = class {
|
|
|
28515
28865
|
}
|
|
28516
28866
|
}
|
|
28517
28867
|
}
|
|
28518
|
-
addToPath(
|
|
28519
|
-
const last =
|
|
28868
|
+
addToPath(path14, added, removed, oldPosInc, options) {
|
|
28869
|
+
const last = path14.lastComponent;
|
|
28520
28870
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
28521
28871
|
return {
|
|
28522
|
-
oldPos:
|
|
28872
|
+
oldPos: path14.oldPos + oldPosInc,
|
|
28523
28873
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
28524
28874
|
};
|
|
28525
28875
|
} else {
|
|
28526
28876
|
return {
|
|
28527
|
-
oldPos:
|
|
28877
|
+
oldPos: path14.oldPos + oldPosInc,
|
|
28528
28878
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
28529
28879
|
};
|
|
28530
28880
|
}
|
|
@@ -29063,7 +29413,7 @@ function requiredString(value, label) {
|
|
|
29063
29413
|
fail(`Modern history ${label} is invalid`);
|
|
29064
29414
|
return value;
|
|
29065
29415
|
}
|
|
29066
|
-
function
|
|
29416
|
+
function positiveInteger2(value, label) {
|
|
29067
29417
|
return boundedInteger(value, label, 1);
|
|
29068
29418
|
}
|
|
29069
29419
|
function nonNegativeInteger(value, label) {
|
|
@@ -29143,8 +29493,8 @@ function parseAssistantBaseline(value) {
|
|
|
29143
29493
|
const parsed = {
|
|
29144
29494
|
attemptId: identifier(attempt.attemptId, "assistant stream attemptId"),
|
|
29145
29495
|
startedAfterSeq: cursor(attempt.startedAfterSeq, "assistant stream startedAfterSeq"),
|
|
29146
|
-
turn:
|
|
29147
|
-
step:
|
|
29496
|
+
turn: positiveInteger3(attempt.turn, "assistant stream turn"),
|
|
29497
|
+
step: positiveInteger3(attempt.step, "assistant stream step"),
|
|
29148
29498
|
nextIndex: nonNegativeInteger2(attempt.nextIndex, "assistant stream nextIndex"),
|
|
29149
29499
|
stream: jsonArray(attempt.stream, "assistant stream baseline stream")
|
|
29150
29500
|
};
|
|
@@ -29158,7 +29508,7 @@ function parseAssistantFrame(value) {
|
|
|
29158
29508
|
if (!isRecord3(value) || typeof value.type !== "string")
|
|
29159
29509
|
throw invalid("assistant stream frame");
|
|
29160
29510
|
const attemptId = identifier(value.attemptId, "assistant stream attemptId");
|
|
29161
|
-
const revision =
|
|
29511
|
+
const revision = positiveInteger3(value.revision, "assistant stream revision");
|
|
29162
29512
|
switch (value.type) {
|
|
29163
29513
|
case "start":
|
|
29164
29514
|
if (!onlyKeys(value, ["type", "attemptId", "revision", "startedAfterSeq", "turn", "step"])) {
|
|
@@ -29169,8 +29519,8 @@ function parseAssistantFrame(value) {
|
|
|
29169
29519
|
attemptId,
|
|
29170
29520
|
revision,
|
|
29171
29521
|
startedAfterSeq: cursor(value.startedAfterSeq, "assistant stream startedAfterSeq"),
|
|
29172
|
-
turn:
|
|
29173
|
-
step:
|
|
29522
|
+
turn: positiveInteger3(value.turn, "assistant stream turn"),
|
|
29523
|
+
step: positiveInteger3(value.step, "assistant stream step")
|
|
29174
29524
|
};
|
|
29175
29525
|
case "chunk":
|
|
29176
29526
|
if (!onlyKeys(value, ["type", "attemptId", "revision", "index", "time", "chunk"])) {
|
|
@@ -29320,7 +29670,7 @@ function identifier(value, label) {
|
|
|
29320
29670
|
function cursor(value, label) {
|
|
29321
29671
|
return value === -1 ? value : nonNegativeInteger2(value, label);
|
|
29322
29672
|
}
|
|
29323
|
-
function
|
|
29673
|
+
function positiveInteger3(value, label) {
|
|
29324
29674
|
const parsed = safeInteger(value, label);
|
|
29325
29675
|
if (parsed <= 0)
|
|
29326
29676
|
throw invalid(label);
|
|
@@ -29486,8 +29836,8 @@ function validateDeveloperMessage(event) {
|
|
|
29486
29836
|
requiredFields(data, ["turn", "step", "message"]);
|
|
29487
29837
|
if (Object.hasOwn(data, "headerSeq") && !Number.isSafeInteger(data.headerSeq))
|
|
29488
29838
|
throw invalid("developer/message headerSeq");
|
|
29489
|
-
|
|
29490
|
-
|
|
29839
|
+
positiveInteger3(data.turn, "developer/message turn");
|
|
29840
|
+
positiveInteger3(data.step, "developer/message step");
|
|
29491
29841
|
if (!isRecord3(data.message))
|
|
29492
29842
|
throw invalid("developer/message message");
|
|
29493
29843
|
const message = data.message;
|
|
@@ -29541,7 +29891,7 @@ function validateV4Event(event) {
|
|
|
29541
29891
|
if (!isRecord3(data))
|
|
29542
29892
|
throw invalid("workspace/changes");
|
|
29543
29893
|
exactKeys(data, ["turn"]);
|
|
29544
|
-
|
|
29894
|
+
positiveInteger3(data.turn, "workspace/changes turn");
|
|
29545
29895
|
break;
|
|
29546
29896
|
case "tool/result":
|
|
29547
29897
|
if (!isRecord3(data))
|
|
@@ -29590,7 +29940,7 @@ function validateV4Event(event) {
|
|
|
29590
29940
|
break;
|
|
29591
29941
|
case "deliverables/presented":
|
|
29592
29942
|
exactKeys(data, ["turn", "callId", "files"]);
|
|
29593
|
-
|
|
29943
|
+
positiveInteger3(data.turn, "deliverables turn");
|
|
29594
29944
|
identifier(data.callId, "deliverables callId");
|
|
29595
29945
|
if (!Array.isArray(data.files))
|
|
29596
29946
|
throw invalid("deliverables files");
|
|
@@ -30177,6 +30527,11 @@ function isSupportedDeepSeekVersion(version2) {
|
|
|
30177
30527
|
const parsed = parseSemVer(version2);
|
|
30178
30528
|
return parsed !== void 0 && MINIMUM !== void 0 && compareSemVer(parsed, MINIMUM) >= 0;
|
|
30179
30529
|
}
|
|
30530
|
+
function supportsDeepSeekDelegationBridge(version2) {
|
|
30531
|
+
const parsed = parseSemVer(version2);
|
|
30532
|
+
const minimum = parseSemVer("0.2.2-rc.5");
|
|
30533
|
+
return parsed !== void 0 && minimum !== void 0 && compareSemVer(parsed, minimum) >= 0;
|
|
30534
|
+
}
|
|
30180
30535
|
function deepSeekModernProfile(version2) {
|
|
30181
30536
|
return DEEPSEEK_V4_PROFILE.version === version2 ? DEEPSEEK_V4_PROFILE : Object.freeze({ ...DEEPSEEK_V4_PROFILE, version: version2 });
|
|
30182
30537
|
}
|
|
@@ -30512,7 +30867,7 @@ async function probeDeepSeekExecutableGeneration(options = {}, dependencies = {
|
|
|
30512
30867
|
|
|
30513
30868
|
// dist/modern/deepseek-harness-adapter.js
|
|
30514
30869
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
30515
|
-
import
|
|
30870
|
+
import path12 from "node:path";
|
|
30516
30871
|
import { isDeepStrictEqual as isDeepStrictEqual7 } from "node:util";
|
|
30517
30872
|
|
|
30518
30873
|
// dist/model-catalog.js
|
|
@@ -30641,6 +30996,145 @@ var import_websocket = __toESM(require_websocket(), 1);
|
|
|
30641
30996
|
var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
30642
30997
|
var wrapper_default = import_websocket.default;
|
|
30643
30998
|
|
|
30999
|
+
// dist/modern/delegation-bridge.js
|
|
31000
|
+
import { randomBytes } from "node:crypto";
|
|
31001
|
+
import { mkdtemp as mkdtemp2, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
|
|
31002
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
31003
|
+
import path8 from "node:path";
|
|
31004
|
+
var DELEGATION_ENDPOINT = "codexhost/delegation";
|
|
31005
|
+
var DELEGATION_BRIDGE_TOKEN = "CODEXHOST_DSH_BRIDGE_TOKEN";
|
|
31006
|
+
var ENVIRONMENT_KEYS = [
|
|
31007
|
+
"CODEXHOST_RUNTIME_ENDPOINT",
|
|
31008
|
+
"CODEXHOST_RUNTIME_TOKEN",
|
|
31009
|
+
"CODEXHOST_THREAD_ID",
|
|
31010
|
+
"CODEXHOST_CLI_PATH"
|
|
31011
|
+
];
|
|
31012
|
+
function delegationEnvironment(environment) {
|
|
31013
|
+
if (!environment || ENVIRONMENT_KEYS.some((key) => !environment[key])) {
|
|
31014
|
+
return void 0;
|
|
31015
|
+
}
|
|
31016
|
+
return Object.fromEntries(ENVIRONMENT_KEYS.map((key) => [key, environment[key]]));
|
|
31017
|
+
}
|
|
31018
|
+
var DELEGATION_PLUGIN_SOURCE = String.raw`
|
|
31019
|
+
export const name = "codexhost-delegation";
|
|
31020
|
+
export const inject = ["webServer", "shellEnv"];
|
|
31021
|
+
|
|
31022
|
+
export async function apply(ctx) {
|
|
31023
|
+
const { timingSafeEqual } = await import("node:crypto");
|
|
31024
|
+
const secret = process.env.CODEXHOST_DSH_BRIDGE_TOKEN;
|
|
31025
|
+
if (!secret) {
|
|
31026
|
+
throw new Error("CodexHost delegation bridge credential is missing");
|
|
31027
|
+
}
|
|
31028
|
+
const expected = Buffer.from("Bearer " + secret);
|
|
31029
|
+
const keys = [
|
|
31030
|
+
"CODEXHOST_RUNTIME_ENDPOINT",
|
|
31031
|
+
"CODEXHOST_RUNTIME_TOKEN",
|
|
31032
|
+
"CODEXHOST_THREAD_ID",
|
|
31033
|
+
"CODEXHOST_CLI_PATH",
|
|
31034
|
+
];
|
|
31035
|
+
const sessions = new Map();
|
|
31036
|
+
const variables = Object.fromEntries(keys.map((key) => [
|
|
31037
|
+
"DSH_" + key,
|
|
31038
|
+
{ description: "CodexHost delegation identity for the current Session" },
|
|
31039
|
+
]));
|
|
31040
|
+
ctx.shellEnv.register({
|
|
31041
|
+
name,
|
|
31042
|
+
variables,
|
|
31043
|
+
resolve(execution) {
|
|
31044
|
+
const sessionId = execution.agent?.session.header.id;
|
|
31045
|
+
const environment = sessions.get(sessionId);
|
|
31046
|
+
if (!environment) {
|
|
31047
|
+
return {};
|
|
31048
|
+
}
|
|
31049
|
+
return Object.fromEntries(keys.map((key) => ["DSH_" + key, environment[key]]));
|
|
31050
|
+
},
|
|
31051
|
+
});
|
|
31052
|
+
ctx.effect(() => {
|
|
31053
|
+
const unregisterRoute = ctx.webServer.register({
|
|
31054
|
+
kind: "exact",
|
|
31055
|
+
path: "/api/codexhost/delegation",
|
|
31056
|
+
async handler(req, res) {
|
|
31057
|
+
const actual = Buffer.from(req.headers.authorization || "");
|
|
31058
|
+
if (actual.length !== expected.length || !timingSafeEqual(actual, expected)) {
|
|
31059
|
+
res.writeHead(403).end();
|
|
31060
|
+
return;
|
|
31061
|
+
}
|
|
31062
|
+
if (req.method !== "POST") {
|
|
31063
|
+
res.writeHead(405).end();
|
|
31064
|
+
return;
|
|
31065
|
+
}
|
|
31066
|
+
const chunks = [];
|
|
31067
|
+
let size = 0;
|
|
31068
|
+
for await (const chunk of req) {
|
|
31069
|
+
size += chunk.length;
|
|
31070
|
+
if (size > 65536) {
|
|
31071
|
+
res.writeHead(413).end();
|
|
31072
|
+
return;
|
|
31073
|
+
}
|
|
31074
|
+
chunks.push(Buffer.from(chunk));
|
|
31075
|
+
}
|
|
31076
|
+
let request;
|
|
31077
|
+
try {
|
|
31078
|
+
request = JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
31079
|
+
} catch {
|
|
31080
|
+
res.writeHead(400).end();
|
|
31081
|
+
return;
|
|
31082
|
+
}
|
|
31083
|
+
const args = request?.payload?.args;
|
|
31084
|
+
const environment = args?.environment;
|
|
31085
|
+
const valid = request?.type === "client-request"
|
|
31086
|
+
&& typeof request.rpcId === "string"
|
|
31087
|
+
&& request.method === "codexhost/delegation"
|
|
31088
|
+
&& typeof args?.sessionId === "string"
|
|
31089
|
+
&& args.sessionId.length > 0
|
|
31090
|
+
&& (environment === null || (
|
|
31091
|
+
environment && typeof environment === "object" && !Array.isArray(environment)
|
|
31092
|
+
&& Object.keys(environment).length === keys.length
|
|
31093
|
+
&& keys.every((key) => typeof environment[key] === "string"
|
|
31094
|
+
&& environment[key].length > 0 && environment[key].length < 16384)
|
|
31095
|
+
));
|
|
31096
|
+
if (!valid) {
|
|
31097
|
+
res.writeHead(400).end();
|
|
31098
|
+
return;
|
|
31099
|
+
}
|
|
31100
|
+
if (environment === null) {
|
|
31101
|
+
sessions.delete(args.sessionId);
|
|
31102
|
+
} else {
|
|
31103
|
+
sessions.set(args.sessionId, Object.freeze({ ...environment }));
|
|
31104
|
+
}
|
|
31105
|
+
res.writeHead(200, { "content-type": "application/json" });
|
|
31106
|
+
res.end(JSON.stringify({
|
|
31107
|
+
type: "server-response",
|
|
31108
|
+
rpcId: request.rpcId,
|
|
31109
|
+
result: { ok: true },
|
|
31110
|
+
}));
|
|
31111
|
+
},
|
|
31112
|
+
});
|
|
31113
|
+
return () => {
|
|
31114
|
+
unregisterRoute();
|
|
31115
|
+
sessions.clear();
|
|
31116
|
+
};
|
|
31117
|
+
});
|
|
31118
|
+
}
|
|
31119
|
+
`;
|
|
31120
|
+
async function createDelegationBridge() {
|
|
31121
|
+
const directory = await mkdtemp2(path8.join(tmpdir2(), "codexhost-dsh-"));
|
|
31122
|
+
const patchPath = path8.join(directory, "delegation.patch.yml");
|
|
31123
|
+
try {
|
|
31124
|
+
const pluginPath = path8.join(directory, "delegation.mjs");
|
|
31125
|
+
await writeFile2(pluginPath, DELEGATION_PLUGIN_SOURCE, { mode: 384 });
|
|
31126
|
+
await writeFile2(patchPath, JSON.stringify([{ insert: [{ id: "codexhost-delegation", name: pluginPath }] }]), { mode: 384 });
|
|
31127
|
+
return {
|
|
31128
|
+
patchPath,
|
|
31129
|
+
token: randomBytes(32).toString("base64url"),
|
|
31130
|
+
dispose: () => rm2(directory, { recursive: true, force: true })
|
|
31131
|
+
};
|
|
31132
|
+
} catch (error62) {
|
|
31133
|
+
await rm2(directory, { recursive: true, force: true });
|
|
31134
|
+
throw error62;
|
|
31135
|
+
}
|
|
31136
|
+
}
|
|
31137
|
+
|
|
30644
31138
|
// dist/modern/remote-connection.js
|
|
30645
31139
|
var ModernRemoteConnectionError = class extends Error {
|
|
30646
31140
|
code;
|
|
@@ -30748,6 +31242,7 @@ var ModernRemoteConnection = class {
|
|
|
30748
31242
|
#maxReadinessBytes;
|
|
30749
31243
|
#faultListeners = /* @__PURE__ */ new Set();
|
|
30750
31244
|
#child;
|
|
31245
|
+
#delegationBridge;
|
|
30751
31246
|
#closePromise;
|
|
30752
31247
|
#connectPromise;
|
|
30753
31248
|
#cookie;
|
|
@@ -30761,6 +31256,7 @@ var ModernRemoteConnection = class {
|
|
|
30761
31256
|
#closing = false;
|
|
30762
31257
|
#stoppingChild = false;
|
|
30763
31258
|
#stopPromise;
|
|
31259
|
+
#processStopped = false;
|
|
30764
31260
|
constructor(options, dependencies = {}) {
|
|
30765
31261
|
if (options.command.trim() === "") {
|
|
30766
31262
|
throw new ModernRemoteConnectionError("notInstalled", "DeepSeek Harness command is missing");
|
|
@@ -30802,6 +31298,10 @@ var ModernRemoteConnection = class {
|
|
|
30802
31298
|
get stderrTail() {
|
|
30803
31299
|
return this.#stderrTail;
|
|
30804
31300
|
}
|
|
31301
|
+
/** Managed process tree stop confirmation, independent of socket and file cleanup. */
|
|
31302
|
+
get processStopped() {
|
|
31303
|
+
return this.#processStopped;
|
|
31304
|
+
}
|
|
30805
31305
|
connect() {
|
|
30806
31306
|
if (this.#closing) {
|
|
30807
31307
|
return Promise.reject(new ModernRemoteConnectionError("unavailable", "DeepSeek Harness connection is closing"));
|
|
@@ -30840,6 +31340,23 @@ var ModernRemoteConnection = class {
|
|
|
30840
31340
|
this.#faultListeners.delete(listener);
|
|
30841
31341
|
};
|
|
30842
31342
|
}
|
|
31343
|
+
async setSessionEnvironment(sessionId, environment) {
|
|
31344
|
+
if (!this.#options.delegationBridge) {
|
|
31345
|
+
return;
|
|
31346
|
+
}
|
|
31347
|
+
const selected = delegationEnvironment(environment);
|
|
31348
|
+
await this.connect();
|
|
31349
|
+
if (!this.#delegationBridge) {
|
|
31350
|
+
return;
|
|
31351
|
+
}
|
|
31352
|
+
const result = await this.call(DELEGATION_ENDPOINT, {
|
|
31353
|
+
sessionId,
|
|
31354
|
+
environment: selected ?? null
|
|
31355
|
+
});
|
|
31356
|
+
if (!result.ok) {
|
|
31357
|
+
throw new ModernRemoteConnectionError("protocolError", "DSH delegation binding failed");
|
|
31358
|
+
}
|
|
31359
|
+
}
|
|
30843
31360
|
async call(endpoint, args, signal, options = {}) {
|
|
30844
31361
|
if (options.timeoutMs === null && !signal) {
|
|
30845
31362
|
throw new TypeError("Disabling a DeepSeek Harness Remote timeout requires an AbortSignal");
|
|
@@ -30866,7 +31383,8 @@ var ModernRemoteConnection = class {
|
|
|
30866
31383
|
redirect: "manual",
|
|
30867
31384
|
headers: {
|
|
30868
31385
|
"content-type": "application/json",
|
|
30869
|
-
cookie
|
|
31386
|
+
cookie,
|
|
31387
|
+
...endpoint === DELEGATION_ENDPOINT && this.#delegationBridge ? { authorization: `Bearer ${this.#delegationBridge.token}` } : {}
|
|
30870
31388
|
},
|
|
30871
31389
|
body: JSON.stringify({
|
|
30872
31390
|
type: "client-request",
|
|
@@ -31213,9 +31731,16 @@ var ModernRemoteConnection = class {
|
|
|
31213
31731
|
}
|
|
31214
31732
|
}
|
|
31215
31733
|
async #performConnect() {
|
|
31734
|
+
if (this.#options.delegationBridge && this.#environment.CODEXHOST_RUNTIME_ENDPOINT && this.#environment.CODEXHOST_RUNTIME_TOKEN) {
|
|
31735
|
+
this.#delegationBridge = await createDelegationBridge();
|
|
31736
|
+
}
|
|
31737
|
+
if (this.#closing) {
|
|
31738
|
+
throw new ModernRemoteConnectionError("cancelled", "DeepSeek Harness startup was cancelled before process creation");
|
|
31739
|
+
}
|
|
31216
31740
|
const rawArguments = [
|
|
31217
31741
|
...this.#options.commandArguments ?? [],
|
|
31218
31742
|
"web",
|
|
31743
|
+
...this.#delegationBridge ? ["--patch", this.#delegationBridge.patchPath] : [],
|
|
31219
31744
|
"--no-open",
|
|
31220
31745
|
"--host",
|
|
31221
31746
|
"127.0.0.1",
|
|
@@ -31226,7 +31751,10 @@ var ModernRemoteConnection = class {
|
|
|
31226
31751
|
let child;
|
|
31227
31752
|
try {
|
|
31228
31753
|
child = this.#dependencies.spawn(invocation.command, invocation.arguments, {
|
|
31229
|
-
env: deepSeekEnvironment(this.#options.command,
|
|
31754
|
+
env: deepSeekEnvironment(this.#options.command, {
|
|
31755
|
+
...this.#environment,
|
|
31756
|
+
...this.#delegationBridge ? { [DELEGATION_BRIDGE_TOKEN]: this.#delegationBridge.token } : {}
|
|
31757
|
+
}),
|
|
31230
31758
|
stdio: "pipe",
|
|
31231
31759
|
windowsHide: true,
|
|
31232
31760
|
windowsVerbatimArguments: invocation.windowsVerbatimArguments,
|
|
@@ -31437,6 +31965,7 @@ var ModernRemoteConnection = class {
|
|
|
31437
31965
|
...socketClosures,
|
|
31438
31966
|
...connect ? [connect] : []
|
|
31439
31967
|
]);
|
|
31968
|
+
this.#processStopped = stopped?.status === "fulfilled";
|
|
31440
31969
|
const socketResults = remaining.slice(0, socketClosures.length);
|
|
31441
31970
|
this.#faultListeners.clear();
|
|
31442
31971
|
if (child) {
|
|
@@ -31448,6 +31977,8 @@ var ModernRemoteConnection = class {
|
|
|
31448
31977
|
this.#launchUrl = void 0;
|
|
31449
31978
|
this.#origin = void 0;
|
|
31450
31979
|
this.#cookie = void 0;
|
|
31980
|
+
await this.#delegationBridge?.dispose();
|
|
31981
|
+
this.#delegationBridge = void 0;
|
|
31451
31982
|
if (stopped?.status === "rejected")
|
|
31452
31983
|
throw stopped.reason;
|
|
31453
31984
|
const socketFailure2 = socketResults.find((result) => result.status === "rejected");
|
|
@@ -32061,7 +32592,7 @@ function hasExactKeys4(value, keys) {
|
|
|
32061
32592
|
const actual = Reflect.ownKeys(value);
|
|
32062
32593
|
return actual.length === keys.length && keys.every((key) => Object.hasOwn(value, key));
|
|
32063
32594
|
}
|
|
32064
|
-
function
|
|
32595
|
+
function positiveInteger4(value, name, maximum = Number.MAX_SAFE_INTEGER) {
|
|
32065
32596
|
if (!Number.isSafeInteger(value) || value <= 0 || value > maximum) {
|
|
32066
32597
|
throw new TypeError(`${name} must be an integer from 1 through ${String(maximum)}`);
|
|
32067
32598
|
}
|
|
@@ -32317,11 +32848,11 @@ var ModernControlStore = class {
|
|
|
32317
32848
|
#readyResolve;
|
|
32318
32849
|
constructor(source, options = {}) {
|
|
32319
32850
|
this.#source = source;
|
|
32320
|
-
this.#maxSessions =
|
|
32321
|
-
this.#maxKeys =
|
|
32322
|
-
this.#maxWaiters =
|
|
32323
|
-
this.#waitTimeoutMs =
|
|
32324
|
-
this.#recoveryOpenTimeoutMs =
|
|
32851
|
+
this.#maxSessions = positiveInteger4(options.maxSessions ?? DEFAULT_MAX_SESSIONS, "maxSessions");
|
|
32852
|
+
this.#maxKeys = positiveInteger4(options.maxKeysPerSession ?? DEFAULT_MAX_KEYS_PER_SESSION, "maxKeysPerSession");
|
|
32853
|
+
this.#maxWaiters = positiveInteger4(options.maxWaiters ?? DEFAULT_MAX_WAITERS, "maxWaiters");
|
|
32854
|
+
this.#waitTimeoutMs = positiveInteger4(options.waitTimeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS, "waitTimeoutMs", MAX_TIMER_MILLISECONDS2);
|
|
32855
|
+
this.#recoveryOpenTimeoutMs = positiveInteger4(options.recoveryOpenTimeoutMs ?? this.#waitTimeoutMs, "recoveryOpenTimeoutMs", MAX_TIMER_MILLISECONDS2);
|
|
32325
32856
|
this.#onFault = options.onFault;
|
|
32326
32857
|
}
|
|
32327
32858
|
get fault() {
|
|
@@ -32450,7 +32981,7 @@ var ModernControlStore = class {
|
|
|
32450
32981
|
if (this.#waiters.size >= this.#maxWaiters) {
|
|
32451
32982
|
throw storeError("resourceLimit", "Control store waiter limit was exceeded");
|
|
32452
32983
|
}
|
|
32453
|
-
const timeoutMs =
|
|
32984
|
+
const timeoutMs = positiveInteger4(options.timeoutMs ?? this.#waitTimeoutMs, "timeoutMs", MAX_TIMER_MILLISECONDS2);
|
|
32454
32985
|
return new Promise((resolve, reject) => {
|
|
32455
32986
|
const waiter = {
|
|
32456
32987
|
sessionId,
|
|
@@ -33383,9 +33914,9 @@ var ModernEventGateway = class {
|
|
|
33383
33914
|
constructor(remote, options = {}) {
|
|
33384
33915
|
this.#remote = remote;
|
|
33385
33916
|
this.#options = {
|
|
33386
|
-
maxSinks:
|
|
33387
|
-
maxPendingEvents:
|
|
33388
|
-
maxRetiredEvents:
|
|
33917
|
+
maxSinks: positiveInteger5(options.maxSinks ?? DEFAULT_MAX_SINKS, "maxSinks"),
|
|
33918
|
+
maxPendingEvents: positiveInteger5(options.maxPendingEvents ?? DEFAULT_MAX_PENDING_EVENTS, "maxPendingEvents"),
|
|
33919
|
+
maxRetiredEvents: positiveInteger5(options.maxRetiredEvents ?? DEFAULT_MAX_RETIRED_EVENTS, "maxRetiredEvents"),
|
|
33389
33920
|
...options.onGenerationLost ? { onGenerationLost: options.onGenerationLost } : {},
|
|
33390
33921
|
...options.onFailureDeclared ? { onFailureDeclared: options.onFailureDeclared } : {},
|
|
33391
33922
|
...options.onFault ? { onFault: options.onFault } : {}
|
|
@@ -34244,7 +34775,7 @@ function boundedString3(value) {
|
|
|
34244
34775
|
function nonBlankString3(value) {
|
|
34245
34776
|
return boundedString3(value) && value.length > 0;
|
|
34246
34777
|
}
|
|
34247
|
-
function
|
|
34778
|
+
function positiveInteger5(value, name) {
|
|
34248
34779
|
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
34249
34780
|
throw new TypeError(`${name} must be a positive safe integer`);
|
|
34250
34781
|
}
|
|
@@ -34823,12 +35354,12 @@ function invalidInbox() {
|
|
|
34823
35354
|
}
|
|
34824
35355
|
|
|
34825
35356
|
// dist/modern/history.js
|
|
34826
|
-
import
|
|
35357
|
+
import path10 from "node:path";
|
|
34827
35358
|
import { isDeepStrictEqual as isDeepStrictEqual5 } from "node:util";
|
|
34828
35359
|
|
|
34829
35360
|
// ../../harness-adapter/dist/local-media-markdown.js
|
|
34830
35361
|
import { existsSync, statSync } from "node:fs";
|
|
34831
|
-
import
|
|
35362
|
+
import path9 from "node:path";
|
|
34832
35363
|
import { fileURLToPath } from "node:url";
|
|
34833
35364
|
var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
34834
35365
|
".aac",
|
|
@@ -35131,7 +35662,7 @@ function skipBlanks(text2, start) {
|
|
|
35131
35662
|
return index;
|
|
35132
35663
|
}
|
|
35133
35664
|
function mediaMarkdownImage(absolutePath) {
|
|
35134
|
-
const name =
|
|
35665
|
+
const name = path9.basename(absolutePath).replaceAll("]", "\\]");
|
|
35135
35666
|
return `})`;
|
|
35136
35667
|
}
|
|
35137
35668
|
function markdownDestination(absolutePath, bracketed) {
|
|
@@ -35150,11 +35681,11 @@ function resolveLocalMediaPath(raw, roots, exists = mediaFileExists) {
|
|
|
35150
35681
|
if (stripped === null)
|
|
35151
35682
|
return null;
|
|
35152
35683
|
if (isAbsoluteMediaPath(stripped)) {
|
|
35153
|
-
const absolute =
|
|
35684
|
+
const absolute = path9.resolve(stripped);
|
|
35154
35685
|
return hasMediaExtension(absolute) && exists(absolute) ? absolute : null;
|
|
35155
35686
|
}
|
|
35156
35687
|
for (const root of roots) {
|
|
35157
|
-
const absolute =
|
|
35688
|
+
const absolute = path9.resolve(root, stripped);
|
|
35158
35689
|
if (hasMediaExtension(absolute) && exists(absolute))
|
|
35159
35690
|
return absolute;
|
|
35160
35691
|
}
|
|
@@ -35173,10 +35704,10 @@ function stripFileUrl(value) {
|
|
|
35173
35704
|
}
|
|
35174
35705
|
}
|
|
35175
35706
|
function isAbsoluteMediaPath(value) {
|
|
35176
|
-
return
|
|
35707
|
+
return path9.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
|
|
35177
35708
|
}
|
|
35178
35709
|
function hasMediaExtension(value) {
|
|
35179
|
-
return MEDIA_EXTENSIONS.has(
|
|
35710
|
+
return MEDIA_EXTENSIONS.has(path9.extname(value).toLowerCase());
|
|
35180
35711
|
}
|
|
35181
35712
|
function mediaFileExists(absolutePath) {
|
|
35182
35713
|
try {
|
|
@@ -35371,7 +35902,7 @@ var ModernEventValidator = class {
|
|
|
35371
35902
|
switch (event.type) {
|
|
35372
35903
|
case "turn/start": {
|
|
35373
35904
|
exactKeys(data, ["turn"]);
|
|
35374
|
-
const turn =
|
|
35905
|
+
const turn = positiveInteger2(data.turn, "turn/start turn");
|
|
35375
35906
|
if (trace.openTurn !== null || turn !== trace.nextTurn) {
|
|
35376
35907
|
fail("Modern history has an invalid turn/start boundary");
|
|
35377
35908
|
}
|
|
@@ -35381,7 +35912,7 @@ var ModernEventValidator = class {
|
|
|
35381
35912
|
}
|
|
35382
35913
|
case "turn/end": {
|
|
35383
35914
|
exactKeys(data, ["turn", "reason"]);
|
|
35384
|
-
const turn =
|
|
35915
|
+
const turn = positiveInteger2(data.turn, "turn/end turn");
|
|
35385
35916
|
validateTurnReason(data.reason);
|
|
35386
35917
|
if (trace.openTurn !== turn || trace.openStep !== null) {
|
|
35387
35918
|
fail("Modern history has an invalid turn/end boundary");
|
|
@@ -36006,9 +36537,9 @@ function modernWorkingDirectory(current, event) {
|
|
|
36006
36537
|
return current;
|
|
36007
36538
|
}
|
|
36008
36539
|
const next = event.data.cwd;
|
|
36009
|
-
if (
|
|
36010
|
-
return
|
|
36011
|
-
return current === void 0 ? void 0 :
|
|
36540
|
+
if (path10.isAbsolute(next))
|
|
36541
|
+
return path10.resolve(next);
|
|
36542
|
+
return current === void 0 ? void 0 : path10.resolve(current, next);
|
|
36012
36543
|
}
|
|
36013
36544
|
function modernMediaRoots(workingDirectory, sessionDirectory) {
|
|
36014
36545
|
return [
|
|
@@ -36203,8 +36734,8 @@ function requireOpenStep(trace, data, label) {
|
|
|
36203
36734
|
}
|
|
36204
36735
|
function stepPosition(data, label) {
|
|
36205
36736
|
return {
|
|
36206
|
-
turn:
|
|
36207
|
-
step:
|
|
36737
|
+
turn: positiveInteger2(data.turn, `${label} turn`),
|
|
36738
|
+
step: positiveInteger2(data.step, `${label} step`)
|
|
36208
36739
|
};
|
|
36209
36740
|
}
|
|
36210
36741
|
function validateUserMessage(data, profile) {
|
|
@@ -36346,7 +36877,7 @@ function validateRequestContext(data) {
|
|
|
36346
36877
|
fail("Modern history request/context has an invalid Model route");
|
|
36347
36878
|
}
|
|
36348
36879
|
if (data.contextWindow !== void 0)
|
|
36349
|
-
|
|
36880
|
+
positiveInteger2(data.contextWindow, "contextWindow");
|
|
36350
36881
|
if (data.systemPromptUpdate !== void 0 && data.systemPromptUpdate !== "in-history")
|
|
36351
36882
|
fail("Modern history request/context systemPromptUpdate is malformed");
|
|
36352
36883
|
}
|
|
@@ -36444,7 +36975,7 @@ function validateCommandDone(data) {
|
|
|
36444
36975
|
}
|
|
36445
36976
|
function validateHookInvoked(data) {
|
|
36446
36977
|
requiredOptionalKeys(data, ["turn", "point", "dialect", "handlerId"], ["matcher"]);
|
|
36447
|
-
|
|
36978
|
+
positiveInteger2(data.turn, "hook/invoked turn");
|
|
36448
36979
|
requiredString(data.point, "hook/invoked point");
|
|
36449
36980
|
enumValue(data.dialect, ["claude-code", "codex"], "hook/invoked dialect");
|
|
36450
36981
|
requiredString(data.handlerId, "hook/invoked handlerId");
|
|
@@ -36454,7 +36985,7 @@ function validateHookInvoked(data) {
|
|
|
36454
36985
|
}
|
|
36455
36986
|
function validateHookResult(data) {
|
|
36456
36987
|
requiredOptionalKeys(data, ["turn", "point", "handlerId", "decision", "durationMs"], ["exitCode", "stderrSummary"]);
|
|
36457
|
-
|
|
36988
|
+
positiveInteger2(data.turn, "hook/result turn");
|
|
36458
36989
|
requiredString(data.point, "hook/result point");
|
|
36459
36990
|
requiredString(data.handlerId, "hook/result handlerId");
|
|
36460
36991
|
requiredString(data.decision, "hook/result decision");
|
|
@@ -36483,22 +37014,22 @@ function validateRetry(data) {
|
|
|
36483
37014
|
"failure"
|
|
36484
37015
|
], []);
|
|
36485
37016
|
requiredString(data.retryId, "llm/retry retryId");
|
|
36486
|
-
|
|
36487
|
-
|
|
37017
|
+
positiveInteger2(data.turn, "llm/retry turn");
|
|
37018
|
+
positiveInteger2(data.step, "llm/retry step");
|
|
36488
37019
|
requiredString(data.provider, "llm/retry provider");
|
|
36489
37020
|
requiredString(data.policyKey, "llm/retry policyKey");
|
|
36490
|
-
|
|
37021
|
+
positiveInteger2(data.retry, "llm/retry retry");
|
|
36491
37022
|
nonNegativeFiniteNumber(data.delayMs, "llm/retry delayMs");
|
|
36492
37023
|
if (mode === "normal")
|
|
36493
|
-
|
|
37024
|
+
positiveInteger2(data.maxRetries, "llm/retry maxRetries");
|
|
36494
37025
|
validateLlmFailure(data.failure, "llm/retry failure");
|
|
36495
37026
|
}
|
|
36496
37027
|
function validateRetryStarted(data) {
|
|
36497
37028
|
exactKeys(data, ["retryId", "turn", "step", "retry"]);
|
|
36498
37029
|
requiredString(data.retryId, "llm/retry-started retryId");
|
|
36499
|
-
|
|
36500
|
-
|
|
36501
|
-
|
|
37030
|
+
positiveInteger2(data.turn, "llm/retry-started turn");
|
|
37031
|
+
positiveInteger2(data.step, "llm/retry-started step");
|
|
37032
|
+
positiveInteger2(data.retry, "llm/retry-started retry");
|
|
36502
37033
|
}
|
|
36503
37034
|
function validateSessionTitle(data) {
|
|
36504
37035
|
exactKeys(data, ["title", "messageSeqs", "source"]);
|
|
@@ -36527,7 +37058,7 @@ function validateSessionTitleRequest(data) {
|
|
|
36527
37058
|
fail("Modern history session/title request message is malformed");
|
|
36528
37059
|
}
|
|
36529
37060
|
}
|
|
36530
|
-
|
|
37061
|
+
positiveInteger2(data.maxTokens, "session/title request maxTokens");
|
|
36531
37062
|
if (data.reasoningEffort !== void 0 && !nonBlankString(data.reasoningEffort)) {
|
|
36532
37063
|
fail("Modern history session/title request reasoningEffort is invalid");
|
|
36533
37064
|
}
|
|
@@ -36554,7 +37085,7 @@ function validateWorkflow(type, data) {
|
|
|
36554
37085
|
if (type === "tool-workflow/agent-start") {
|
|
36555
37086
|
requiredOptionalKeys(data, ["runId", "seq", "label", "childId"], ["phase"]);
|
|
36556
37087
|
requiredString(data.runId, "workflow runId");
|
|
36557
|
-
|
|
37088
|
+
positiveInteger2(data.seq, "workflow agent seq");
|
|
36558
37089
|
if (typeof data.label !== "string")
|
|
36559
37090
|
fail("Modern history workflow agent label is invalid");
|
|
36560
37091
|
requiredString(data.childId, "workflow childId");
|
|
@@ -36566,7 +37097,7 @@ function validateWorkflow(type, data) {
|
|
|
36566
37097
|
if (type === "tool-workflow/agent-end") {
|
|
36567
37098
|
exactKeys(data, ["runId", "seq", "outcome"]);
|
|
36568
37099
|
requiredString(data.runId, "workflow runId");
|
|
36569
|
-
|
|
37100
|
+
positiveInteger2(data.seq, "workflow agent seq");
|
|
36570
37101
|
enumValue(data.outcome, ["completed", "failed", "cancelled"], "workflow agent outcome");
|
|
36571
37102
|
return;
|
|
36572
37103
|
}
|
|
@@ -36632,7 +37163,7 @@ function validateCompaction(type, data) {
|
|
|
36632
37163
|
requiredOptionalKeys(data, ["compactionId", "turn"], type === "compaction/start" ? ["sourceCommandId"] : ["sourceCommandId", "error"]);
|
|
36633
37164
|
requiredString(data.compactionId, "compaction id");
|
|
36634
37165
|
if (data.turn !== null)
|
|
36635
|
-
|
|
37166
|
+
positiveInteger2(data.turn, "compaction turn");
|
|
36636
37167
|
if (data.sourceCommandId !== void 0)
|
|
36637
37168
|
requiredString(data.sourceCommandId, "compaction commandId");
|
|
36638
37169
|
if (data.error !== void 0 && typeof data.error !== "string") {
|
|
@@ -36661,7 +37192,7 @@ function validateCompaction(type, data) {
|
|
|
36661
37192
|
fail("Modern history compaction summary is malformed");
|
|
36662
37193
|
validateShadow(data);
|
|
36663
37194
|
if (data.maxTokens !== void 0)
|
|
36664
|
-
|
|
37195
|
+
positiveInteger2(data.maxTokens, "compaction maxTokens");
|
|
36665
37196
|
if (data.usage !== void 0)
|
|
36666
37197
|
validateUsage(data.usage);
|
|
36667
37198
|
if (data.rawOutput !== void 0 && !Array.isArray(data.rawOutput)) {
|
|
@@ -36765,7 +37296,7 @@ function validateSearchRequest(data) {
|
|
|
36765
37296
|
fail("Modern history search request body is malformed");
|
|
36766
37297
|
requiredOptionalKeys(data.body, ["model", "max_tokens", "messages", "tools"], ["thinking"]);
|
|
36767
37298
|
requiredString(data.body.model, "search request model");
|
|
36768
|
-
|
|
37299
|
+
positiveInteger2(data.body.max_tokens, "search request max_tokens");
|
|
36769
37300
|
if (!Array.isArray(data.body.messages) || !Array.isArray(data.body.tools)) {
|
|
36770
37301
|
fail("Modern history search request arrays are malformed");
|
|
36771
37302
|
}
|
|
@@ -36890,6 +37421,7 @@ var ModernHarnessSession = class {
|
|
|
36890
37421
|
#closing = false;
|
|
36891
37422
|
#nativeCloseTerminal;
|
|
36892
37423
|
#closedNotified = false;
|
|
37424
|
+
#closedNotificationFailed = false;
|
|
36893
37425
|
#faulted;
|
|
36894
37426
|
#faultMayHaveNativeWork = false;
|
|
36895
37427
|
#closeStopUnconfirmed = false;
|
|
@@ -37058,26 +37590,43 @@ var ModernHarnessSession = class {
|
|
|
37058
37590
|
}
|
|
37059
37591
|
}
|
|
37060
37592
|
close() {
|
|
37593
|
+
return this.#close(true);
|
|
37594
|
+
}
|
|
37595
|
+
/** Local teardown must drain before the Adapter can stop the managed process. */
|
|
37596
|
+
closeForAdapter() {
|
|
37597
|
+
return this.#close(false);
|
|
37598
|
+
}
|
|
37599
|
+
#close(waitForManagedStop) {
|
|
37061
37600
|
this.#localClosePromise ??= this.#performClose();
|
|
37062
37601
|
return this.#localClosePromise.then(() => {
|
|
37063
|
-
if (!this.#faultMayHaveNativeWork)
|
|
37602
|
+
if (!this.#faultMayHaveNativeWork) {
|
|
37064
37603
|
return;
|
|
37604
|
+
}
|
|
37065
37605
|
const processStop = this.#managedProcessStop?.();
|
|
37066
|
-
if (processStop)
|
|
37067
|
-
return processStop;
|
|
37606
|
+
if (processStop) {
|
|
37607
|
+
return waitForManagedStop ? processStop : void 0;
|
|
37608
|
+
}
|
|
37068
37609
|
throw new Error("DeepSeek Harness native execution stop was not confirmed before the Session fault");
|
|
37069
37610
|
}, (error62) => {
|
|
37070
|
-
if (this.#faulted || this.#closeStopUnconfirmed) {
|
|
37611
|
+
if (!this.#closedNotificationFailed && (this.#faulted || this.#closeStopUnconfirmed)) {
|
|
37071
37612
|
const processStop = this.#managedProcessStop?.();
|
|
37072
|
-
if (processStop)
|
|
37073
|
-
return processStop;
|
|
37613
|
+
if (processStop) {
|
|
37614
|
+
return waitForManagedStop ? processStop : void 0;
|
|
37615
|
+
}
|
|
37074
37616
|
}
|
|
37075
37617
|
throw error62;
|
|
37076
37618
|
});
|
|
37077
37619
|
}
|
|
37078
37620
|
/** Adapter-owned local teardown drain after fault; never waits on managed process exit. */
|
|
37079
37621
|
async waitForFaultCleanup() {
|
|
37080
|
-
|
|
37622
|
+
try {
|
|
37623
|
+
await this.#localClosePromise;
|
|
37624
|
+
} catch (error62) {
|
|
37625
|
+
if (!this.#closedNotificationFailed && (this.#faulted || this.#closeStopUnconfirmed)) {
|
|
37626
|
+
return;
|
|
37627
|
+
}
|
|
37628
|
+
throw error62;
|
|
37629
|
+
}
|
|
37081
37630
|
}
|
|
37082
37631
|
/** Adapter-owned transport/control fault convergence. */
|
|
37083
37632
|
fault(error62) {
|
|
@@ -38826,6 +39375,7 @@ ${question.detail}` : question.question;
|
|
|
38826
39375
|
this.#abortOperations();
|
|
38827
39376
|
this.#nativeCloseTerminal?.();
|
|
38828
39377
|
this.#localClosePromise ??= this.#performFault(failure2, acceptedPending);
|
|
39378
|
+
void this.#localClosePromise.catch(() => void 0);
|
|
38829
39379
|
}
|
|
38830
39380
|
async #performFault(failure2, acceptedPending) {
|
|
38831
39381
|
await this.#detachEvents().catch(() => void 0);
|
|
@@ -38880,7 +39430,7 @@ ${question.detail}` : question.question;
|
|
|
38880
39430
|
this.#emit({ type: "session.faulted", error: failure2 });
|
|
38881
39431
|
this.#channel.end();
|
|
38882
39432
|
await Promise.allSettled([this.#journal.close(), this.#pumpPromise]);
|
|
38883
|
-
this.#notifyClosed();
|
|
39433
|
+
await this.#notifyClosed();
|
|
38884
39434
|
}
|
|
38885
39435
|
async #performClose() {
|
|
38886
39436
|
this.#closing = true;
|
|
@@ -38923,7 +39473,11 @@ ${question.detail}` : question.question;
|
|
|
38923
39473
|
}
|
|
38924
39474
|
}
|
|
38925
39475
|
if (this.#faulted) {
|
|
38926
|
-
|
|
39476
|
+
try {
|
|
39477
|
+
await this.#performFault(this.#faulted, this.#acceptedPending(pendingAtClose));
|
|
39478
|
+
} catch (error62) {
|
|
39479
|
+
throw sessionCloseFailure(stopFailure, error62);
|
|
39480
|
+
}
|
|
38927
39481
|
throw stopFailure ?? new Error(this.#faulted.message);
|
|
38928
39482
|
}
|
|
38929
39483
|
if (!this.#closed) {
|
|
@@ -38986,7 +39540,11 @@ ${question.detail}` : question.question;
|
|
|
38986
39540
|
flushFailure = error62;
|
|
38987
39541
|
stopFailure ??= error62;
|
|
38988
39542
|
}
|
|
38989
|
-
|
|
39543
|
+
try {
|
|
39544
|
+
await this.#notifyClosed();
|
|
39545
|
+
} catch (error62) {
|
|
39546
|
+
throw sessionCloseFailure(stopFailure, error62);
|
|
39547
|
+
}
|
|
38990
39548
|
if (stopFailure) {
|
|
38991
39549
|
this.#closeStopUnconfirmed = !flushFailure;
|
|
38992
39550
|
throw stopFailure;
|
|
@@ -39033,13 +39591,16 @@ ${question.detail}` : question.question;
|
|
|
39033
39591
|
clearTimeout(pending.correlationTimer);
|
|
39034
39592
|
pending.correlationTimer = void 0;
|
|
39035
39593
|
}
|
|
39036
|
-
#notifyClosed() {
|
|
39037
|
-
if (this.#closedNotified)
|
|
39594
|
+
async #notifyClosed() {
|
|
39595
|
+
if (this.#closedNotified) {
|
|
39038
39596
|
return;
|
|
39597
|
+
}
|
|
39039
39598
|
this.#closedNotified = true;
|
|
39040
39599
|
try {
|
|
39041
|
-
this.#onClosed();
|
|
39042
|
-
} catch {
|
|
39600
|
+
await this.#onClosed();
|
|
39601
|
+
} catch (error62) {
|
|
39602
|
+
this.#closedNotificationFailed = true;
|
|
39603
|
+
throw error62;
|
|
39043
39604
|
}
|
|
39044
39605
|
}
|
|
39045
39606
|
#emit(event) {
|
|
@@ -39132,6 +39693,14 @@ function journalHistoryBytes(events, maximum) {
|
|
|
39132
39693
|
function journalEventBytes(event) {
|
|
39133
39694
|
return Buffer.byteLength(JSON.stringify(event), "utf8");
|
|
39134
39695
|
}
|
|
39696
|
+
function sessionCloseFailure(stopFailure, cleanupFailure) {
|
|
39697
|
+
if (stopFailure === void 0) {
|
|
39698
|
+
return cleanupFailure;
|
|
39699
|
+
}
|
|
39700
|
+
const stopMessage = stopFailure instanceof Error ? stopFailure.message : "Native stop or persistence failed";
|
|
39701
|
+
const cleanupMessage = cleanupFailure instanceof Error ? cleanupFailure.message : "Session cleanup failed";
|
|
39702
|
+
return new AggregateError([stopFailure, cleanupFailure], redactModernCredential(`DeepSeek Harness Session close failed: ${stopMessage}; ${cleanupMessage}`));
|
|
39703
|
+
}
|
|
39135
39704
|
function unavailableError(error62, message, retryable = true) {
|
|
39136
39705
|
const detail = error62 instanceof Error ? error62.message : String(error62);
|
|
39137
39706
|
return {
|
|
@@ -39377,7 +39946,7 @@ function safeTimerDelay(value, name) {
|
|
|
39377
39946
|
|
|
39378
39947
|
// dist/modern/session-list.js
|
|
39379
39948
|
import { Buffer as Buffer5 } from "node:buffer";
|
|
39380
|
-
import
|
|
39949
|
+
import path11 from "node:path";
|
|
39381
39950
|
var MAX_SESSION_LIST_BYTES = 32 * 1024 * 1024;
|
|
39382
39951
|
var MAX_SESSION_LIST_DEPTH = 64;
|
|
39383
39952
|
var MAX_SESSION_LIST_NODES = 2e5;
|
|
@@ -39497,7 +40066,7 @@ function parseSummary(value) {
|
|
|
39497
40066
|
};
|
|
39498
40067
|
}
|
|
39499
40068
|
function isCanonicalAbsoluteCwd(value) {
|
|
39500
|
-
return value !== void 0 && value.trim().length > 0 && !value.includes("\0") &&
|
|
40069
|
+
return value !== void 0 && value.trim().length > 0 && !value.includes("\0") && path11.isAbsolute(value) && path11.resolve(value) === value;
|
|
39501
40070
|
}
|
|
39502
40071
|
function parseModernSessionCandidates(value) {
|
|
39503
40072
|
assertBoundedJson4(value);
|
|
@@ -39579,8 +40148,11 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39579
40148
|
#dependencies;
|
|
39580
40149
|
#options;
|
|
39581
40150
|
#inflight = /* @__PURE__ */ new Set();
|
|
40151
|
+
#opening = /* @__PURE__ */ new Set();
|
|
40152
|
+
#openingCleanupFailures = [];
|
|
39582
40153
|
#sessionIds = /* @__PURE__ */ new Set();
|
|
39583
40154
|
#sessions = /* @__PURE__ */ new Set();
|
|
40155
|
+
#pendingRevocations = /* @__PURE__ */ new Set();
|
|
39584
40156
|
#removeConnectionFaultListener;
|
|
39585
40157
|
#lifetime = new AbortController();
|
|
39586
40158
|
#accepting = true;
|
|
@@ -39595,6 +40167,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39595
40167
|
#declaredEventFailure;
|
|
39596
40168
|
#faultNotified = false;
|
|
39597
40169
|
#normalClose = false;
|
|
40170
|
+
#processStopped = false;
|
|
39598
40171
|
#eventRecovery;
|
|
39599
40172
|
#eventReplacementUsed = false;
|
|
39600
40173
|
constructor(options, dependencies = {}) {
|
|
@@ -39602,7 +40175,8 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39602
40175
|
this.#profile = deepSeekModernProfile(options.version);
|
|
39603
40176
|
this.#dependencies = { ...DEFAULT_DEPENDENCIES2, ...dependencies };
|
|
39604
40177
|
const connectionOptions = {
|
|
39605
|
-
...options
|
|
40178
|
+
...options,
|
|
40179
|
+
delegationBridge: supportsDeepSeekDelegationBridge(options.version)
|
|
39606
40180
|
};
|
|
39607
40181
|
delete connectionOptions.version;
|
|
39608
40182
|
delete connectionOptions.onFault;
|
|
@@ -39633,7 +40207,9 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39633
40207
|
const rejected = validateOpen(input3);
|
|
39634
40208
|
if (rejected)
|
|
39635
40209
|
return Promise.resolve({ ok: false, error: rejected });
|
|
39636
|
-
|
|
40210
|
+
const opening = this.#open(input3).finally(() => this.#opening.delete(opening));
|
|
40211
|
+
this.#opening.add(opening);
|
|
40212
|
+
return this.#track(opening);
|
|
39637
40213
|
}
|
|
39638
40214
|
close() {
|
|
39639
40215
|
if (!this.#closePromise) {
|
|
@@ -39700,7 +40276,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39700
40276
|
let session;
|
|
39701
40277
|
let forkExpectation;
|
|
39702
40278
|
try {
|
|
39703
|
-
const cwd =
|
|
40279
|
+
const cwd = path12.resolve(input3.cwd);
|
|
39704
40280
|
let forkInput = input3.kind === "fork" ? parseModernForkInput(input3, this.#profile) : void 0;
|
|
39705
40281
|
const rollbackSourceSessionId = input3.kind === "rollbackLastTurn" ? modernSessionId(input3.sourceRef, "roll back") : void 0;
|
|
39706
40282
|
let rollbackPlan;
|
|
@@ -39762,8 +40338,13 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39762
40338
|
detachControl = this.#control.attach(sessionId);
|
|
39763
40339
|
this.#assertAccepting();
|
|
39764
40340
|
}
|
|
39765
|
-
if (!sessionId)
|
|
40341
|
+
if (!sessionId) {
|
|
39766
40342
|
throw new Error("unreachable Session open mode");
|
|
40343
|
+
}
|
|
40344
|
+
if (this.#pendingRevocations.has(sessionId)) {
|
|
40345
|
+
await this.#clearSessionEnvironment(sessionId);
|
|
40346
|
+
this.#assertAccepting();
|
|
40347
|
+
}
|
|
39767
40348
|
if (input3.kind === "create" || rollbackPlan?.kind === "create") {
|
|
39768
40349
|
await this.#createSession(sessionId, cwd, rollbackPlan?.kind === "create" ? rollbackPlan.agentPreset : void 0);
|
|
39769
40350
|
this.#assertAccepting();
|
|
@@ -39832,6 +40413,8 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39832
40413
|
retryable: false
|
|
39833
40414
|
});
|
|
39834
40415
|
}
|
|
40416
|
+
await this.#connection.setSessionEnvironment?.(sessionId, input3.environment);
|
|
40417
|
+
this.#assertAccepting();
|
|
39835
40418
|
const openedSession = new ModernHarnessSession({
|
|
39836
40419
|
remote: this.#connection,
|
|
39837
40420
|
journal,
|
|
@@ -39851,11 +40434,15 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39851
40434
|
...this.#options.recoveryOpenTimeoutMs === void 0 ? {} : { recoveryOpenTimeoutMs: this.#options.recoveryOpenTimeoutMs },
|
|
39852
40435
|
...this.#options.promptCorrelationGraceMs === void 0 ? {} : { promptCorrelationGraceMs: this.#options.promptCorrelationGraceMs },
|
|
39853
40436
|
...this.#options.acceptedCorrelationTimeoutMs === void 0 ? {} : { acceptedCorrelationTimeoutMs: this.#options.acceptedCorrelationTimeoutMs },
|
|
39854
|
-
onClosed: () => {
|
|
40437
|
+
onClosed: async () => {
|
|
39855
40438
|
detachControl?.();
|
|
39856
40439
|
detachControl = void 0;
|
|
39857
|
-
|
|
39858
|
-
|
|
40440
|
+
try {
|
|
40441
|
+
await this.#clearSessionEnvironment(sessionId);
|
|
40442
|
+
} finally {
|
|
40443
|
+
this.#sessions.delete(openedSession);
|
|
40444
|
+
this.#sessionIds.delete(sessionId);
|
|
40445
|
+
}
|
|
39859
40446
|
}
|
|
39860
40447
|
});
|
|
39861
40448
|
session = openedSession;
|
|
@@ -39873,24 +40460,45 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39873
40460
|
}
|
|
39874
40461
|
return { ok: true, value: openedSession };
|
|
39875
40462
|
} catch (error62) {
|
|
39876
|
-
|
|
40463
|
+
let cleanupFailure;
|
|
40464
|
+
const recordCleanupFailure = (closeError) => {
|
|
40465
|
+
cleanupFailure = toHarnessError(closeError, "unavailable");
|
|
40466
|
+
if (!this.#accepting) {
|
|
40467
|
+
this.#openingCleanupFailures.push(closeError);
|
|
40468
|
+
}
|
|
40469
|
+
};
|
|
40470
|
+
if (session) {
|
|
40471
|
+
await session.closeForAdapter().catch(recordCleanupFailure);
|
|
40472
|
+
}
|
|
39877
40473
|
await journal?.close().catch(() => void 0);
|
|
39878
|
-
|
|
39879
|
-
|
|
40474
|
+
if (!session && reservedSessionId) {
|
|
40475
|
+
await this.#clearSessionEnvironment(reservedSessionId).catch(recordCleanupFailure);
|
|
40476
|
+
detachControl?.();
|
|
39880
40477
|
this.#sessionIds.delete(reservedSessionId);
|
|
39881
|
-
|
|
40478
|
+
}
|
|
40479
|
+
let failure2 = toHarnessError(error62, "nativeFailure");
|
|
39882
40480
|
if (forkExpectation) {
|
|
39883
|
-
|
|
39884
|
-
|
|
39885
|
-
|
|
39886
|
-
|
|
40481
|
+
failure2 = { code: failure2.code, message: FORK_ORPHAN_MESSAGE, retryable: false };
|
|
40482
|
+
} else if (input3.kind === "fork") {
|
|
40483
|
+
failure2 = { ...failure2, retryable: false };
|
|
40484
|
+
}
|
|
40485
|
+
if (cleanupFailure) {
|
|
40486
|
+
failure2 = sanitizedHarnessError2({
|
|
40487
|
+
...failure2,
|
|
40488
|
+
message: `${failure2.message}; Session cleanup was not confirmed: ${cleanupFailure.message}`
|
|
40489
|
+
});
|
|
39887
40490
|
}
|
|
39888
40491
|
return {
|
|
39889
40492
|
ok: false,
|
|
39890
|
-
error:
|
|
40493
|
+
error: failure2
|
|
39891
40494
|
};
|
|
39892
40495
|
}
|
|
39893
40496
|
}
|
|
40497
|
+
async #clearSessionEnvironment(sessionId) {
|
|
40498
|
+
this.#pendingRevocations.add(sessionId);
|
|
40499
|
+
await this.#connection.setSessionEnvironment?.(sessionId);
|
|
40500
|
+
this.#pendingRevocations.delete(sessionId);
|
|
40501
|
+
}
|
|
39894
40502
|
async #openWebUi() {
|
|
39895
40503
|
if (!this.#accepting || !this.#connection.openWebUi) {
|
|
39896
40504
|
return { ok: false, error: this.#stoppedError() };
|
|
@@ -40129,7 +40737,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
40129
40737
|
return;
|
|
40130
40738
|
this.#faultNotified = true;
|
|
40131
40739
|
try {
|
|
40132
|
-
this.#options.onFault?.(error62);
|
|
40740
|
+
this.#options.onFault?.(error62, () => this.#retire());
|
|
40133
40741
|
} catch {
|
|
40134
40742
|
}
|
|
40135
40743
|
}
|
|
@@ -40190,17 +40798,30 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
40190
40798
|
}
|
|
40191
40799
|
return this.#closePromise;
|
|
40192
40800
|
}
|
|
40801
|
+
async #retire() {
|
|
40802
|
+
try {
|
|
40803
|
+
await this.close();
|
|
40804
|
+
} catch (error62) {
|
|
40805
|
+
if (!this.#processStopped) {
|
|
40806
|
+
throw error62;
|
|
40807
|
+
}
|
|
40808
|
+
}
|
|
40809
|
+
}
|
|
40193
40810
|
async #stopAfterFault(failure2) {
|
|
40194
40811
|
this.#lifetime.abort(new Error("DeepSeek Harness Adapter closed"));
|
|
40195
40812
|
this.#removeConnectionFaultListener();
|
|
40196
40813
|
const sessions = [...this.#sessions];
|
|
40197
|
-
await Promise.allSettled(sessions.map((session) => {
|
|
40814
|
+
const sessionResults = await Promise.allSettled(sessions.map((session) => {
|
|
40198
40815
|
session.fault(failure2);
|
|
40199
40816
|
return session.waitForFaultCleanup();
|
|
40200
40817
|
}));
|
|
40201
40818
|
await this.#events.close().catch(() => void 0);
|
|
40202
40819
|
await this.#control.close().catch(() => void 0);
|
|
40203
|
-
await this.#
|
|
40820
|
+
await Promise.allSettled([...this.#opening]);
|
|
40821
|
+
const revocationResults = await Promise.allSettled([...this.#pendingRevocations].map((sessionId) => this.#clearSessionEnvironment(sessionId)));
|
|
40822
|
+
const [connectionResult] = await Promise.allSettled([this.#connection.close()]);
|
|
40823
|
+
this.#processStopped = connectionResult.status === "fulfilled" || this.#connection.processStopped === true;
|
|
40824
|
+
throwCleanupFailures([...sessionResults, ...revocationResults, connectionResult], this.#openingCleanupFailures);
|
|
40204
40825
|
}
|
|
40205
40826
|
async #performNormalClose() {
|
|
40206
40827
|
this.#lifetime.abort(new Error("DeepSeek Harness Adapter closed"));
|
|
@@ -40209,15 +40830,28 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
40209
40830
|
const sessionResults = await Promise.allSettled(sessions.map((session) => session.close()));
|
|
40210
40831
|
await this.#events.close().catch(() => void 0);
|
|
40211
40832
|
await this.#control.close().catch(() => void 0);
|
|
40833
|
+
await Promise.allSettled([...this.#opening]);
|
|
40834
|
+
const revocationResults = await Promise.allSettled([...this.#pendingRevocations].map((sessionId) => this.#clearSessionEnvironment(sessionId)));
|
|
40212
40835
|
const [connectionResult] = await Promise.allSettled([this.#connection.close()]);
|
|
40836
|
+
this.#processStopped = connectionResult.status === "fulfilled" || this.#connection.processStopped === true;
|
|
40213
40837
|
await Promise.allSettled([...this.#inflight, this.#eventRecovery]);
|
|
40214
|
-
|
|
40215
|
-
throw connectionResult.reason;
|
|
40216
|
-
const sessionFailure = sessionResults.find((result) => result.status === "rejected");
|
|
40217
|
-
if (sessionFailure?.status === "rejected")
|
|
40218
|
-
throw sessionFailure.reason;
|
|
40838
|
+
throwCleanupFailures([...sessionResults, ...revocationResults, connectionResult], this.#openingCleanupFailures);
|
|
40219
40839
|
}
|
|
40220
40840
|
};
|
|
40841
|
+
function throwCleanupFailures(results, openingFailures) {
|
|
40842
|
+
const failures = [
|
|
40843
|
+
.../* @__PURE__ */ new Set([
|
|
40844
|
+
...results.flatMap((result) => result.status === "rejected" ? [result.reason] : []),
|
|
40845
|
+
...openingFailures
|
|
40846
|
+
])
|
|
40847
|
+
];
|
|
40848
|
+
if (failures.length === 1) {
|
|
40849
|
+
throw failures[0];
|
|
40850
|
+
}
|
|
40851
|
+
if (failures.length > 1) {
|
|
40852
|
+
throw new AggregateError(failures, redactModernCredential(`DeepSeek Harness cleanup failed: ${failures.map((error62) => error62 instanceof Error ? error62.message : "Cleanup failed").join("; ")}`));
|
|
40853
|
+
}
|
|
40854
|
+
}
|
|
40221
40855
|
var AdapterOperationError = class extends Error {
|
|
40222
40856
|
harnessError;
|
|
40223
40857
|
constructor(harnessError) {
|
|
@@ -40492,11 +41126,11 @@ function toHarnessError(error62, fallback) {
|
|
|
40492
41126
|
if (error62 instanceof ModernConfigurationError) {
|
|
40493
41127
|
return sanitizedHarnessError2(modernConfigurationHarnessError(error62));
|
|
40494
41128
|
}
|
|
40495
|
-
return {
|
|
41129
|
+
return sanitizedHarnessError2({
|
|
40496
41130
|
code: fallback,
|
|
40497
|
-
message: "DeepSeek Harness operation failed",
|
|
41131
|
+
message: error62 instanceof AggregateError ? error62.message : "DeepSeek Harness operation failed",
|
|
40498
41132
|
retryable: fallback === "unavailable" || fallback === "nativeFailure"
|
|
40499
|
-
};
|
|
41133
|
+
});
|
|
40500
41134
|
}
|
|
40501
41135
|
function sanitizedHarnessError2(error62) {
|
|
40502
41136
|
return {
|
|
@@ -40775,7 +41409,7 @@ var DeepSeekHarnessAdapter = class {
|
|
|
40775
41409
|
version: executable.version,
|
|
40776
41410
|
command: executable.command.command,
|
|
40777
41411
|
commandArguments: executable.command.arguments,
|
|
40778
|
-
onFault: (error62) => this.#handleDelegateFault(owner, error62)
|
|
41412
|
+
onFault: (error62, retire) => this.#handleDelegateFault(owner, error62, retire)
|
|
40779
41413
|
});
|
|
40780
41414
|
const owner = {
|
|
40781
41415
|
adapter,
|
|
@@ -40799,14 +41433,17 @@ var DeepSeekHarnessAdapter = class {
|
|
|
40799
41433
|
throw cleanupFailure ?? error62;
|
|
40800
41434
|
}
|
|
40801
41435
|
}
|
|
40802
|
-
#handleDelegateFault(owner, error62) {
|
|
41436
|
+
#handleDelegateFault(owner, error62, retire) {
|
|
40803
41437
|
owner.faultError ??= error62;
|
|
41438
|
+
if (retire) {
|
|
41439
|
+
owner.retire ??= retire;
|
|
41440
|
+
}
|
|
40804
41441
|
if (this.#closed || this.#delegate !== owner)
|
|
40805
41442
|
return;
|
|
40806
41443
|
this.#delegate = void 0;
|
|
40807
41444
|
this.#failure = void 0;
|
|
40808
41445
|
const previous = this.#retiring ?? Promise.resolve();
|
|
40809
|
-
const retiring = previous.then(() => this.#
|
|
41446
|
+
const retiring = previous.then(() => this.#closeForReplacement(owner).catch(() => {
|
|
40810
41447
|
this.#recordCleanupFailure();
|
|
40811
41448
|
})).finally(() => {
|
|
40812
41449
|
if (this.#retiring === retiring)
|
|
@@ -40851,9 +41488,20 @@ var DeepSeekHarnessAdapter = class {
|
|
|
40851
41488
|
owner.closePromise ??= owner.adapter.close();
|
|
40852
41489
|
return owner.closePromise;
|
|
40853
41490
|
}
|
|
40854
|
-
async #
|
|
41491
|
+
async #closeForReplacement(owner) {
|
|
40855
41492
|
try {
|
|
40856
41493
|
await this.#closeOwner(owner);
|
|
41494
|
+
} catch (error62) {
|
|
41495
|
+
this.#cleanupFailed = true;
|
|
41496
|
+
if (!owner.retire) {
|
|
41497
|
+
throw error62;
|
|
41498
|
+
}
|
|
41499
|
+
await owner.retire();
|
|
41500
|
+
}
|
|
41501
|
+
}
|
|
41502
|
+
async #closeFailedCandidate(owner) {
|
|
41503
|
+
try {
|
|
41504
|
+
await this.#closeForReplacement(owner);
|
|
40857
41505
|
} catch {
|
|
40858
41506
|
return this.#recordCleanupFailure();
|
|
40859
41507
|
} finally {
|
|
@@ -40973,8 +41621,8 @@ function closedError2() {
|
|
|
40973
41621
|
|
|
40974
41622
|
// dist/installation.js
|
|
40975
41623
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
40976
|
-
import { mkdir, rename, rm as
|
|
40977
|
-
import
|
|
41624
|
+
import { mkdir, rename, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
|
|
41625
|
+
import path13 from "node:path";
|
|
40978
41626
|
function createDeepSeekInstallation(environment, command) {
|
|
40979
41627
|
let update;
|
|
40980
41628
|
return createInstallationManager({
|
|
@@ -40998,13 +41646,13 @@ function createDeepSeekInstallation(environment, command) {
|
|
|
40998
41646
|
throw new Error("DSH offline npx launch still selects a different version");
|
|
40999
41647
|
const destination = deepSeekNpxVersionFile(environment);
|
|
41000
41648
|
const temporary = `${destination}.${randomUUID3()}.tmp`;
|
|
41001
|
-
await mkdir(
|
|
41649
|
+
await mkdir(path13.dirname(destination), { recursive: true, mode: 448 });
|
|
41002
41650
|
try {
|
|
41003
|
-
await
|
|
41651
|
+
await writeFile3(temporary, `${version2}
|
|
41004
41652
|
`, { flag: "wx", mode: 384 });
|
|
41005
41653
|
await rename(temporary, destination);
|
|
41006
41654
|
} finally {
|
|
41007
|
-
await
|
|
41655
|
+
await rm3(temporary, { force: true }).catch(() => void 0);
|
|
41008
41656
|
}
|
|
41009
41657
|
} : npm?.update;
|
|
41010
41658
|
const canUpdate = isNpx || (npm?.canUpdate ?? false);
|