@codexhost/cli-win32-x64 0.32.1 → 0.34.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 +2 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +559 -15
- package/app/console-web.js +1361 -192
- package/app/desktop-controller.mjs +620 -16
- package/app/desktop-mcp-client.mjs +619 -0
- package/app/host-runtime.mjs +10370 -5625
- package/app/plugins/antigravity/plugin.mjs +888 -73
- 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 +1280 -198
- package/app/plugins/codebuddy/plugin.mjs +643 -35
- package/app/plugins/codex-usage/plugin.mjs +544 -12
- package/app/plugins/copilot/assets/icon.svg +1 -1
- package/app/plugins/copilot/manifest.json +1 -1
- package/app/plugins/copilot/plugin.mjs +546 -14
- package/app/plugins/cursor-cli/plugin.mjs +544 -12
- 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 +983 -153
- package/app/plugins/devin/assets/icon.svg +1 -1
- package/app/plugins/devin/manifest.json +1 -1
- package/app/plugins/devin/plugin.mjs +546 -13
- package/app/plugins/enabled.json +1 -0
- package/app/plugins/grok/plugin.mjs +544 -12
- package/app/plugins/hermes/plugin.mjs +544 -12
- package/app/plugins/kimi-code/plugin.mjs +544 -12
- package/app/plugins/kiro-cli/plugin.mjs +544 -12
- package/app/plugins/omp/assets/icon.svg +1 -1
- package/app/plugins/omp/plugin.mjs +1381 -243
- package/app/plugins/opencode/plugin.mjs +548 -13
- package/app/plugins/pi/assets/icon.svg +1 -1
- package/app/plugins/pi/manifest.json +1 -1
- package/app/plugins/pi/plugin.mjs +572 -14
- package/app/plugins/qoder/assets/icon.svg +1 -1
- package/app/plugins/qoder/plugin.mjs +570 -12
- package/app/plugins/qoder-cn/assets/icon.svg +1 -1
- package/app/plugins/qoder-cn/plugin.mjs +570 -12
- package/app/plugins/qwen-code/assets/icon.svg +1 -1
- package/app/plugins/qwen-code/plugin.mjs +573 -12
- package/app/plugins/workbuddy/plugin.mjs +1263 -472
- package/app/plugins/workbuddy-cn/assets/icon.svg +27 -0
- package/app/plugins/workbuddy-cn/manifest.json +32 -0
- package/app/plugins/workbuddy-cn/plugin.mjs +36211 -0
- package/app/plugins/zcode/plugin.mjs +564 -19
- package/app/renderer-extension.js +2932 -262
- package/app/web/assets/{abnfDiagram-XWFEHMT6-7XITZmBH.js → abnfDiagram-XWFEHMT6-Cg-E7mc4.js} +1 -1
- package/app/web/assets/{architectureDiagram-CSQXQB3N-C8Usdzd8.js → architectureDiagram-CSQXQB3N-B__CwXjW.js} +1 -1
- package/app/web/assets/{blockDiagram-BEDRHYPZ-CyN9yE_Q.js → blockDiagram-BEDRHYPZ-Bk2gCIVM.js} +1 -1
- package/app/web/assets/{c4Diagram-M2UUVUY5-CjhY1l3g.js → c4Diagram-M2UUVUY5-DU_TpjJ3.js} +1 -1
- package/app/web/assets/{chunk-2Q5K7J3B-o24_rh4_.js → chunk-2Q5K7J3B-DnJEi6e4.js} +1 -1
- package/app/web/assets/{chunk-3GCGMST5-D7bw3E1a.js → chunk-3GCGMST5-Dia9jGkf.js} +1 -1
- package/app/web/assets/{chunk-5VM5RSS4-D0v4acf7.js → chunk-5VM5RSS4-2PGDiDvK.js} +1 -1
- package/app/web/assets/{chunk-7U7NFRK5-CYJxP4rV.js → chunk-7U7NFRK5-BLPm3d5H.js} +1 -1
- package/app/web/assets/{chunk-CNRTWJTD-DTgCtcCl.js → chunk-CNRTWJTD-GH_nAEXs.js} +1 -1
- package/app/web/assets/{chunk-D5HYT7QG-qRNelehW.js → chunk-D5HYT7QG-DnIm-Ely.js} +1 -1
- package/app/web/assets/{chunk-EBZ3SEQC-BgJPPYdu.js → chunk-EBZ3SEQC-C6N5qLCR.js} +2 -2
- package/app/web/assets/{chunk-JWPE2WC7-C50ZnSQQ.js → chunk-JWPE2WC7-D_kMgdmr.js} +1 -1
- package/app/web/assets/{chunk-KTR4FSNJ-Cifh4XHc.js → chunk-KTR4FSNJ-BRb9femQ.js} +1 -1
- package/app/web/assets/{chunk-XXDRQBXY-D23WAHPW.js → chunk-XXDRQBXY-BFaK95zq.js} +1 -1
- package/app/web/assets/{classDiagram-v2-KXABOMEV-B3cezFGj.js → classDiagram-v2-KXABOMEV--_hR_XrU.js} +1 -1
- package/app/web/assets/{cose-bilkent-JH36ORCC-VSMi4La2.js → cose-bilkent-JH36ORCC-C7ghEB3_.js} +1 -1
- package/app/web/assets/{cynefin-EF2NZ3EQ-qQnfHq16.js → cynefin-EF2NZ3EQ-Ce1lURwZ.js} +1 -1
- package/app/web/assets/{cynefinDiagram-NJNITYFG-BJELApXD.js → cynefinDiagram-NJNITYFG-Cgr5aSTS.js} +1 -1
- package/app/web/assets/{dagre-KIHZ2IZ3-C8B5ZMVs.js → dagre-KIHZ2IZ3-BBFKmRP1.js} +1 -1
- package/app/web/assets/{diagram-7YQZDPLS-HIWoNpzV.js → diagram-7YQZDPLS-CJQih32K.js} +1 -1
- package/app/web/assets/{diagram-QBROCOUO-3_vS1jbp.js → diagram-QBROCOUO-Cl3S7IUT.js} +1 -1
- package/app/web/assets/{diagram-RJJCUUZO-C_Kndn_e.js → diagram-RJJCUUZO-B6C8N2cV.js} +1 -1
- package/app/web/assets/{diagram-WERXNKYE-BLWdOwya.js → diagram-WERXNKYE-NkciBSQl.js} +1 -1
- package/app/web/assets/{diagram-YHHI257C-DJeOs6eS.js → diagram-YHHI257C-DlEvljeY.js} +1 -1
- package/app/web/assets/{diagram-YR4HJLHV-BKNULu-g.js → diagram-YR4HJLHV-e4_Gzbt6.js} +1 -1
- package/app/web/assets/{ebnfDiagram-N527522P-Bu8aReoF.js → ebnfDiagram-N527522P-WvQEFmPi.js} +1 -1
- package/app/web/assets/{elk-O5DQBFGD-CIp7Z0ER.js → elk-O5DQBFGD-CkyJsjzf.js} +1 -1
- package/app/web/assets/{erDiagram-K3K3BIDK-BTsor1Lp.js → erDiagram-K3K3BIDK-B93gK3X0.js} +1 -1
- package/app/web/assets/{flowDiagram-Z6JWZHQI-p_h5PKQr.js → flowDiagram-Z6JWZHQI-NFaGX6B4.js} +1 -1
- package/app/web/assets/{ganttDiagram-3PRQTZWP-DKjfPPJ1.js → ganttDiagram-3PRQTZWP-Czh68CQm.js} +1 -1
- package/app/web/assets/{gitGraphDiagram-VXDFKS5L-RnPOf2fj.js → gitGraphDiagram-VXDFKS5L-t95UHKja.js} +1 -1
- package/app/web/assets/{grid-E2QIVN74-C96GnBO1.js → grid-E2QIVN74-C87DucDN.js} +1 -1
- package/app/web/assets/index-CGI50Nfg.css +1 -0
- package/app/web/assets/index-Dr6wHi0A.js +208 -0
- package/app/web/assets/{infoDiagram-EZ3ZOAHP-B68eZHsb.js → infoDiagram-EZ3ZOAHP-CxFlfQbY.js} +1 -1
- package/app/web/assets/{ishikawaDiagram-S3EKX5GW-BLj7PFLt.js → ishikawaDiagram-S3EKX5GW-D4IwQJde.js} +1 -1
- package/app/web/assets/{journeyDiagram-POQNLL5X-Bo-_In0d.js → journeyDiagram-POQNLL5X-C0Bf5W4T.js} +1 -1
- package/app/web/assets/{kanban-definition-BH5XI6FM-BpHvxprW.js → kanban-definition-BH5XI6FM-Cda7r2yr.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-f4LJm6AC.js} +5 -5
- package/app/web/assets/{mindmap-definition-WVAN44T4-DG15AlXd.js → mindmap-definition-WVAN44T4-DKapinG7.js} +1 -1
- package/app/web/assets/{pegDiagram-D4NLKWP3-GMBk8RM6.js → pegDiagram-D4NLKWP3-D7iEZGN2.js} +1 -1
- package/app/web/assets/{pieDiagram-36ENHN4W-BzeJgVnn.js → pieDiagram-36ENHN4W-CopXZ5qt.js} +1 -1
- package/app/web/assets/{quadrantDiagram-ZQUDMS73-C--Kif6a.js → quadrantDiagram-ZQUDMS73-mmkKPDGK.js} +1 -1
- package/app/web/assets/{railroadDiagram-JIZHGYPL-NPLVu_R7.js → railroadDiagram-JIZHGYPL-BAGwIIkV.js} +1 -1
- package/app/web/assets/{render-VIF2ZAQL-DdpQ8E0J.js → render-VIF2ZAQL-dXxGa09y.js} +2 -2
- package/app/web/assets/{requirementDiagram-AXW2TVFA-WWRwRbkA.js → requirementDiagram-AXW2TVFA-C35tmLFs.js} +1 -1
- package/app/web/assets/{sankeyDiagram-FBCJTAIF-hBr6pZ0V.js → sankeyDiagram-FBCJTAIF-BbSo5yeK.js} +1 -1
- package/app/web/assets/{sequenceDiagram-3LA2ROMG-DvzZWy5J.js → sequenceDiagram-3LA2ROMG-Cgm2unNy.js} +1 -1
- package/app/web/assets/{sizeCapture-2Q2CQKSF-C2B86W70.js → sizeCapture-2Q2CQKSF-DCXFjl2x.js} +1 -1
- package/app/web/assets/{stateDiagram-v2-ATKHQDJO-Jwj3XqMx.js → stateDiagram-v2-ATKHQDJO-B349iAao.js} +1 -1
- package/app/web/assets/{swimlanes-YQL5WMAO-DxI0hC09.js → swimlanes-YQL5WMAO-6OvL1sEz.js} +1 -1
- package/app/web/assets/swimlanesDiagram-UCCPES4V-CIKaQUvP.js +8 -0
- package/app/web/assets/{timeline-definition-7Z437IG3-m8Ew8iuN.js → timeline-definition-7Z437IG3-Bh1E3mhW.js} +1 -1
- package/app/web/assets/{usecaseDiagram-RDK6N6HP-BsiPSzIT.js → usecaseDiagram-RDK6N6HP-Dr5A05lL.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-CQPPBa27.js} +1 -1
- package/app/web/assets/{wardleyDiagram-F3OXNVQS-DHLEfnsg.js → wardleyDiagram-F3OXNVQS-BHin00q8.js} +1 -1
- package/app/web/assets/{xychartDiagram-GDYJKCDI-Drn_UxYt.js → xychartDiagram-GDYJKCDI-D4BAWlQZ.js} +1 -1
- package/app/web/codex-agent.png +0 -0
- package/app/web/codex.png +0 -0
- package/app/web/codexhost-settings.js +337 -137
- 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 +162 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +104 -100
- 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 +5 -5
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +6 -6
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +80 -80
- 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 +69 -69
- package/app/web/role-avatars/builtin/advisor-otter.webp +0 -0
- 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/builder-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/sailor-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/wizard-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 +6951 -2390
- 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,126 @@ 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
|
+
"advisor-otter",
|
|
24133
|
+
"builder-otter",
|
|
24134
|
+
"wizard-otter",
|
|
24135
|
+
"sailor-otter"
|
|
24136
|
+
];
|
|
24137
|
+
var builtinRoleAvatarSchema = external_exports.templateLiteral([
|
|
24138
|
+
"builtin:",
|
|
24139
|
+
external_exports.enum(BUILTIN_ROLE_AVATAR_IDS)
|
|
24140
|
+
]);
|
|
24141
|
+
var ROLE_AVATAR_FILENAME_PATTERN = /^[a-zA-Z0-9_-]{1,64}\.(png|jpg|jpeg|webp)$/u;
|
|
24142
|
+
var customRoleAvatarSchema = external_exports.templateLiteral([
|
|
24143
|
+
"custom:",
|
|
24144
|
+
external_exports.string().regex(ROLE_AVATAR_FILENAME_PATTERN)
|
|
24145
|
+
]);
|
|
24146
|
+
var catalogRoleAvatarSchema = external_exports.templateLiteral([
|
|
24147
|
+
"catalog:",
|
|
24148
|
+
external_exports.string().regex(ROLE_AVATAR_FILENAME_PATTERN)
|
|
24149
|
+
]);
|
|
24150
|
+
var roleAvatarSchema = external_exports.union([builtinRoleAvatarSchema, customRoleAvatarSchema]);
|
|
24151
|
+
var roleCatalogAvatarSchema = external_exports.union([builtinRoleAvatarSchema, catalogRoleAvatarSchema]);
|
|
24152
|
+
var saveRoleAvatarSchema = external_exports.union([roleAvatarSchema, catalogRoleAvatarSchema]);
|
|
24153
|
+
var httpsUrlSchema = external_exports.string().url().max(2048).refine((value) => /^https:\/\//i.test(value), "URL must use https://");
|
|
24154
|
+
var localizedRoleTextSchema = external_exports.object({
|
|
24155
|
+
en: external_exports.string().trim().min(1).max(2e3),
|
|
24156
|
+
"zh-CN": external_exports.string().trim().min(1).max(2e3)
|
|
24157
|
+
});
|
|
24158
|
+
var roleCatalogEntrySchema = external_exports.object({
|
|
24159
|
+
slug: roleSlugSchema,
|
|
24160
|
+
name: localizedRoleTextSchema,
|
|
24161
|
+
description: localizedRoleTextSchema,
|
|
24162
|
+
avatar: roleCatalogAvatarSchema,
|
|
24163
|
+
accentColor: roleAccentColorSchema,
|
|
24164
|
+
recommendedHarnessId: harnessIdSchema.optional(),
|
|
24165
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
24166
|
+
authorUrl: httpsUrlSchema.optional(),
|
|
24167
|
+
sourceUrl: httpsUrlSchema.optional(),
|
|
24168
|
+
license: external_exports.string().trim().min(1).max(64).optional(),
|
|
24169
|
+
official: external_exports.boolean().optional(),
|
|
24170
|
+
instructions: external_exports.string().trim().min(1).max(1e5),
|
|
24171
|
+
updatedAt: external_exports.iso.datetime()
|
|
24172
|
+
});
|
|
24173
|
+
var roleCatalogDocumentSchema = external_exports.object({
|
|
24174
|
+
formatVersion: external_exports.literal(1),
|
|
24175
|
+
generatedAt: external_exports.iso.datetime(),
|
|
24176
|
+
roles: external_exports.array(roleCatalogEntrySchema)
|
|
24177
|
+
});
|
|
24178
|
+
var roleIdentitySchema = external_exports.object({
|
|
24179
|
+
slug: roleSlugSchema,
|
|
24180
|
+
name: external_exports.string().refine((name) => name.trim().length > 0),
|
|
24181
|
+
avatar: roleAvatarSchema,
|
|
24182
|
+
accentColor: roleAccentColorSchema
|
|
24183
|
+
});
|
|
24184
|
+
var threadRoleSnapshotSchema = roleIdentitySchema.readonly();
|
|
24185
|
+
var agentRoleSchema = roleIdentitySchema.extend({
|
|
24186
|
+
description: external_exports.string(),
|
|
24187
|
+
harnessId: harnessIdSchema,
|
|
24188
|
+
model: roleModelSchema.optional(),
|
|
24189
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
24190
|
+
instructions: external_exports.string(),
|
|
24191
|
+
updatedAt: external_exports.iso.datetime()
|
|
24192
|
+
});
|
|
24193
|
+
var saveAgentRoleInputSchema = agentRoleSchema.omit({ updatedAt: true, avatar: true }).extend({ avatar: saveRoleAvatarSchema }).partial({ slug: true });
|
|
24194
|
+
var ROLES_LIST_METHOD = "codexhost/roles/list";
|
|
24195
|
+
var ROLES_GET_METHOD = "codexhost/roles/get";
|
|
24196
|
+
var ROLES_SAVE_METHOD = "codexhost/roles/save";
|
|
24197
|
+
var ROLES_DELETE_METHOD = "codexhost/roles/delete";
|
|
24198
|
+
var ROLES_CATALOG_METHOD = "codexhost/roles/catalog";
|
|
24199
|
+
var ROLES_LIKE_METHOD = "codexhost/roles/like";
|
|
24200
|
+
var ROLE_LIKES_MAX_PER_ROLE = 5;
|
|
24201
|
+
var rolesListParamsSchema = external_exports.object({
|
|
24202
|
+
locale: external_exports.string().trim().min(1).max(64).optional()
|
|
24203
|
+
});
|
|
24204
|
+
var rolesListResultSchema = external_exports.object({ roles: external_exports.array(agentRoleSchema) });
|
|
24205
|
+
var rolesGetParamsSchema = external_exports.object({ slug: roleSlugSchema });
|
|
24206
|
+
var rolesGetResultSchema = external_exports.object({ role: agentRoleSchema.nullable() });
|
|
24207
|
+
var rolesSaveResultSchema = external_exports.object({ role: agentRoleSchema });
|
|
24208
|
+
var rolesDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
|
|
24209
|
+
var rolesCatalogParamsSchema = external_exports.object({
|
|
24210
|
+
refresh: external_exports.boolean().optional()
|
|
24211
|
+
});
|
|
24212
|
+
var rolesCatalogResultSchema = external_exports.object({
|
|
24213
|
+
roles: external_exports.array(roleCatalogEntrySchema),
|
|
24214
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
24215
|
+
likes: external_exports.record(roleSlugSchema, external_exports.number().int().nonnegative()).optional(),
|
|
24216
|
+
myLikes: external_exports.record(roleSlugSchema, external_exports.number().int().min(0).max(ROLE_LIKES_MAX_PER_ROLE)).optional(),
|
|
24217
|
+
stale: external_exports.boolean().optional(),
|
|
24218
|
+
error: external_exports.string().optional()
|
|
24219
|
+
});
|
|
24220
|
+
var rolesLikeParamsSchema = external_exports.object({
|
|
24221
|
+
slug: roleSlugSchema
|
|
24222
|
+
});
|
|
24223
|
+
var rolesLikeResultSchema = external_exports.object({
|
|
24224
|
+
slug: roleSlugSchema,
|
|
24225
|
+
likes: external_exports.number().int().nonnegative(),
|
|
24226
|
+
myLikes: external_exports.number().int().min(0).max(ROLE_LIKES_MAX_PER_ROLE),
|
|
24227
|
+
maxLikes: external_exports.literal(ROLE_LIKES_MAX_PER_ROLE),
|
|
24228
|
+
limitReached: external_exports.boolean().optional()
|
|
24229
|
+
});
|
|
24230
|
+
|
|
24109
24231
|
// ../../shared-contracts/dist/thread-usage.js
|
|
24110
24232
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
24111
24233
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -24287,7 +24409,6 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
24287
24409
|
// ../../shared-contracts/dist/harness-models.js
|
|
24288
24410
|
var HARNESS_MODEL_REF_MAX_LENGTH = 512;
|
|
24289
24411
|
var HARNESS_MODEL_LABEL_MAX_LENGTH = 256;
|
|
24290
|
-
var HARNESS_THINKING_OPTION_ID_MAX_LENGTH = 128;
|
|
24291
24412
|
var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
24292
24413
|
var nonBlankTextSchema3 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
24293
24414
|
message: "Value must not be empty or whitespace"
|
|
@@ -24301,7 +24422,6 @@ var harnessModelRefSchema = external_exports.object({
|
|
|
24301
24422
|
function sameHarnessModelRef(left, right) {
|
|
24302
24423
|
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
24303
24424
|
}
|
|
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
24425
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema3.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
24306
24426
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
24307
24427
|
id: harnessThinkingOptionIdSchema,
|
|
@@ -24514,8 +24634,10 @@ var codexThreadInspectionSchema = external_exports.object({
|
|
|
24514
24634
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
24515
24635
|
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
24516
24636
|
supportsThreadReferences: external_exports.literal(true).optional(),
|
|
24517
|
-
handoff: threadHandoffMetadataSchema.optional()
|
|
24518
|
-
|
|
24637
|
+
handoff: threadHandoffMetadataSchema.optional(),
|
|
24638
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
24639
|
+
nativeSessionRef: external_exports.never().optional()
|
|
24640
|
+
});
|
|
24519
24641
|
var externalThreadInspectionSchema = external_exports.object({
|
|
24520
24642
|
owner: external_exports.literal("external"),
|
|
24521
24643
|
harnessId: nonBlankTextSchema3.max(256),
|
|
@@ -24530,8 +24652,10 @@ var externalThreadInspectionSchema = external_exports.object({
|
|
|
24530
24652
|
history: harnessHistoryCapabilitiesSchema,
|
|
24531
24653
|
usage: threadUsageSnapshotSchema.optional(),
|
|
24532
24654
|
handoff: threadHandoffMetadataSchema.optional(),
|
|
24655
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
24656
|
+
nativeSessionRef: external_exports.never().optional(),
|
|
24533
24657
|
locked: external_exports.literal(true)
|
|
24534
|
-
})
|
|
24658
|
+
});
|
|
24535
24659
|
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
24536
24660
|
codexThreadInspectionSchema,
|
|
24537
24661
|
externalThreadInspectionSchema
|
|
@@ -24774,7 +24898,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
|
|
|
24774
24898
|
default: external_exports.string().optional()
|
|
24775
24899
|
})
|
|
24776
24900
|
]).superRefine((field2, ctx) => {
|
|
24777
|
-
const issue2 = (
|
|
24901
|
+
const issue2 = (path14, message) => ctx.addIssue({ code: "custom", path: [path14], message });
|
|
24778
24902
|
if (field2.type === "number" || field2.type === "range") {
|
|
24779
24903
|
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
24780
24904
|
if (min > max)
|
|
@@ -24880,16 +25004,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
|
|
|
24880
25004
|
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
24881
25005
|
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
24882
25006
|
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((
|
|
25007
|
+
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
25008
|
var legacy = desktopExtensionManifestSchema.shape;
|
|
24885
25009
|
var localized = (max, min = 0) => external_exports.strictObject({
|
|
24886
25010
|
en: external_exports.string().trim().min(min).max(max),
|
|
24887
25011
|
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
24888
25012
|
});
|
|
24889
|
-
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((
|
|
25013
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path14) => path14.endsWith(suffix), `Expected a ${suffix} file`);
|
|
24890
25014
|
var moduleEntry = resourceWithSuffix(".mjs");
|
|
24891
25015
|
var style = resourceWithSuffix(".css").optional();
|
|
24892
|
-
var hostExtensionCanonicalPath = (
|
|
25016
|
+
var hostExtensionCanonicalPath = (path14) => path14.normalize("NFC").toLowerCase();
|
|
24893
25017
|
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
24894
25018
|
manifestVersion: external_exports.literal(2),
|
|
24895
25019
|
id: hostExtensionIdSchema,
|
|
@@ -24899,8 +25023,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
|
24899
25023
|
details: localized(16384).optional(),
|
|
24900
25024
|
author: legacy.author,
|
|
24901
25025
|
repository: legacy.repository,
|
|
24902
|
-
icon: legacy.icon.refine((
|
|
24903
|
-
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((
|
|
25026
|
+
icon: legacy.icon.refine((path14) => path14 === void 0 || hostExtensionResourcePathSchema.safeParse(path14).success),
|
|
25027
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path14) => hostExtensionResourcePathSchema.safeParse(path14).success)),
|
|
24904
25028
|
categories: legacy.categories,
|
|
24905
25029
|
settingsSchema: legacy.settingsSchema,
|
|
24906
25030
|
slots: legacy.slots.removeDefault().optional(),
|
|
@@ -24934,6 +25058,9 @@ var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
|
24934
25058
|
// ../../shared-contracts/dist/thread-tree-watch.js
|
|
24935
25059
|
var THREAD_TREE_MAX_NODES = 5e3;
|
|
24936
25060
|
var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
|
|
25061
|
+
var threadTreeDelegationSchema = external_exports.object({
|
|
25062
|
+
createdAtMs: external_exports.number().int().nonnegative()
|
|
25063
|
+
});
|
|
24937
25064
|
var threadTreeHandoffSchema = external_exports.strictObject({
|
|
24938
25065
|
sourceThreadId: hostThreadIdSchema,
|
|
24939
25066
|
createdAtMs: external_exports.number().int().nonnegative()
|
|
@@ -24945,13 +25072,14 @@ var threadTreeNodeSchema = external_exports.strictObject({
|
|
|
24945
25072
|
archived: external_exports.boolean(),
|
|
24946
25073
|
updatedAtMs: external_exports.number().int().nonnegative().optional()
|
|
24947
25074
|
});
|
|
24948
|
-
var threadTreeSnapshotSchema = external_exports.
|
|
25075
|
+
var threadTreeSnapshotSchema = external_exports.object({
|
|
24949
25076
|
revision: external_exports.int().nonnegative(),
|
|
24950
25077
|
parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
|
|
25078
|
+
delegations: external_exports.record(hostThreadIdSchema, threadTreeDelegationSchema).optional(),
|
|
24951
25079
|
handoffs: external_exports.record(hostThreadIdSchema, threadTreeHandoffSchema).optional(),
|
|
24952
25080
|
nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
|
|
24953
25081
|
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");
|
|
25082
|
+
}).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
25083
|
var subscriptionId = external_exports.string().min(1).max(128);
|
|
24956
25084
|
var threadTreeWatchParamsSchema = external_exports.strictObject({});
|
|
24957
25085
|
var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
|
|
@@ -25022,7 +25150,7 @@ var active = {
|
|
|
25022
25150
|
digest: hostExtensionDigestSchema
|
|
25023
25151
|
};
|
|
25024
25152
|
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
25025
|
-
var filePath = external_exports.string().min(1).max(4096).refine((
|
|
25153
|
+
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
25154
|
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
25155
|
function base643(maxBytes) {
|
|
25028
25156
|
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
@@ -25219,6 +25347,298 @@ var hostExtensionsRpcSchemas = {
|
|
|
25219
25347
|
}
|
|
25220
25348
|
};
|
|
25221
25349
|
|
|
25350
|
+
// ../../shared-contracts/dist/group-chat.js
|
|
25351
|
+
var DEFAULT_GROUP_MAX_AGENT_HOPS = 5;
|
|
25352
|
+
var MAX_GROUP_AGENT_HOPS = 20;
|
|
25353
|
+
var GROUP_NOTICE_MAX_LENGTH = 2e3;
|
|
25354
|
+
var remoteGroupRoomIdSchema = external_exports.string().regex(/^remote:[A-Za-z0-9_-]{8,512}$/u);
|
|
25355
|
+
var groupRoomIdSchema = external_exports.union([external_exports.uuidv4(), remoteGroupRoomIdSchema]);
|
|
25356
|
+
var groupMemberIdSchema = external_exports.uuidv4();
|
|
25357
|
+
var groupMemberHandleSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/u);
|
|
25358
|
+
var groupUnmentionedPolicySchema = external_exports.enum(["none", "last_speaker", "all"]);
|
|
25359
|
+
var groupMemberStatusSchema = external_exports.enum(["active", "muted", "removed"]);
|
|
25360
|
+
var nonnegativeInteger = external_exports.int().nonnegative();
|
|
25361
|
+
var positiveInteger = external_exports.int().positive();
|
|
25362
|
+
var maxAgentHopsSchema = positiveInteger.max(MAX_GROUP_AGENT_HOPS);
|
|
25363
|
+
var nonblankString = external_exports.string().refine((value) => value.trim().length > 0);
|
|
25364
|
+
var timestamp = external_exports.iso.datetime();
|
|
25365
|
+
var optionalMemberEdits = {
|
|
25366
|
+
handle: groupMemberHandleSchema.optional(),
|
|
25367
|
+
displayName: nonblankString.optional(),
|
|
25368
|
+
note: external_exports.string().optional()
|
|
25369
|
+
};
|
|
25370
|
+
var groupMemberSchema = external_exports.object({
|
|
25371
|
+
memberId: groupMemberIdSchema,
|
|
25372
|
+
threadId: hostThreadIdSchema,
|
|
25373
|
+
handle: groupMemberHandleSchema,
|
|
25374
|
+
displayName: nonblankString,
|
|
25375
|
+
note: external_exports.string().optional(),
|
|
25376
|
+
roleSlug: roleSlugSchema.optional(),
|
|
25377
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
25378
|
+
harnessId: harnessIdSchema,
|
|
25379
|
+
status: groupMemberStatusSchema,
|
|
25380
|
+
projectless: external_exports.boolean().optional(),
|
|
25381
|
+
joinedAtSeq: nonnegativeInteger,
|
|
25382
|
+
lastDeliveredSeq: nonnegativeInteger,
|
|
25383
|
+
lastRosterVersion: nonnegativeInteger,
|
|
25384
|
+
createdAt: timestamp
|
|
25385
|
+
});
|
|
25386
|
+
var groupProjectlessWorkspaceSchema = external_exports.object({
|
|
25387
|
+
workspaceRoot: nonblankString,
|
|
25388
|
+
outputDirectory: nonblankString
|
|
25389
|
+
});
|
|
25390
|
+
var groupRoomRemoteHostSchema = external_exports.object({
|
|
25391
|
+
hostId: nonblankString,
|
|
25392
|
+
displayName: nonblankString,
|
|
25393
|
+
state: nonblankString.optional(),
|
|
25394
|
+
color: external_exports.string().optional(),
|
|
25395
|
+
filePreview: external_exports.boolean().optional()
|
|
25396
|
+
});
|
|
25397
|
+
var groupRoomSchema = external_exports.object({
|
|
25398
|
+
roomId: groupRoomIdSchema,
|
|
25399
|
+
title: nonblankString,
|
|
25400
|
+
defaultCwd: nonblankString,
|
|
25401
|
+
projectlessWorkspace: groupProjectlessWorkspaceSchema.optional(),
|
|
25402
|
+
unmentionedPolicy: groupUnmentionedPolicySchema.default("none"),
|
|
25403
|
+
allowAgentMentions: external_exports.boolean().default(true),
|
|
25404
|
+
maxAgentHops: maxAgentHopsSchema.default(DEFAULT_GROUP_MAX_AGENT_HOPS),
|
|
25405
|
+
lastSeq: nonnegativeInteger,
|
|
25406
|
+
lastSpeakerMemberId: groupMemberIdSchema.optional(),
|
|
25407
|
+
rosterVersion: nonnegativeInteger,
|
|
25408
|
+
humanEpoch: nonnegativeInteger,
|
|
25409
|
+
relayPaused: external_exports.boolean(),
|
|
25410
|
+
pinned: external_exports.boolean(),
|
|
25411
|
+
createdAt: timestamp,
|
|
25412
|
+
updatedAt: timestamp,
|
|
25413
|
+
members: external_exports.array(groupMemberSchema),
|
|
25414
|
+
remote: groupRoomRemoteHostSchema.optional()
|
|
25415
|
+
}).superRefine(({ members: members2 }, context) => {
|
|
25416
|
+
const handles = /* @__PURE__ */ new Set();
|
|
25417
|
+
for (const [index, { handle, status }] of members2.entries()) {
|
|
25418
|
+
if (status === "removed")
|
|
25419
|
+
continue;
|
|
25420
|
+
if (handles.has(handle)) {
|
|
25421
|
+
context.addIssue({
|
|
25422
|
+
code: "custom",
|
|
25423
|
+
path: ["members", index, "handle"],
|
|
25424
|
+
message: "Handle must be unique among non-removed members"
|
|
25425
|
+
});
|
|
25426
|
+
}
|
|
25427
|
+
handles.add(handle);
|
|
25428
|
+
}
|
|
25429
|
+
});
|
|
25430
|
+
var groupAttachmentSchema = external_exports.object({
|
|
25431
|
+
kind: external_exports.enum(["image", "file"]),
|
|
25432
|
+
attachmentId: nonblankString.max(256),
|
|
25433
|
+
name: nonblankString.max(256),
|
|
25434
|
+
path: nonblankString.max(4096),
|
|
25435
|
+
bytes: nonnegativeInteger,
|
|
25436
|
+
mediaType: nonblankString.max(128).optional(),
|
|
25437
|
+
width: positiveInteger.optional(),
|
|
25438
|
+
height: positiveInteger.optional()
|
|
25439
|
+
});
|
|
25440
|
+
var groupMessageSchema = external_exports.object({
|
|
25441
|
+
roomId: groupRoomIdSchema,
|
|
25442
|
+
seq: positiveInteger,
|
|
25443
|
+
messageId: nonblankString,
|
|
25444
|
+
senderType: external_exports.enum(["user", "agent", "system"]),
|
|
25445
|
+
senderMemberId: groupMemberIdSchema.optional(),
|
|
25446
|
+
senderHandle: groupMemberHandleSchema.optional(),
|
|
25447
|
+
senderName: external_exports.string().optional(),
|
|
25448
|
+
senderThreadId: hostThreadIdSchema.optional(),
|
|
25449
|
+
sourceTurnId: nonblankString.optional(),
|
|
25450
|
+
replyToSeq: positiveInteger.optional(),
|
|
25451
|
+
content: external_exports.string(),
|
|
25452
|
+
attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
|
|
25453
|
+
mentionedMemberIds: external_exports.array(groupMemberIdSchema),
|
|
25454
|
+
mentionAll: external_exports.boolean().optional(),
|
|
25455
|
+
hopCount: nonnegativeInteger,
|
|
25456
|
+
createdAt: timestamp
|
|
25457
|
+
});
|
|
25458
|
+
var newThreadOptions = {
|
|
25459
|
+
...optionalMemberEdits,
|
|
25460
|
+
model: roleModelSchema.optional(),
|
|
25461
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
25462
|
+
worktree: external_exports.boolean().optional()
|
|
25463
|
+
};
|
|
25464
|
+
var groupCreateMemberInputSchema = external_exports.discriminatedUnion("kind", [
|
|
25465
|
+
external_exports.strictObject({ kind: external_exports.literal("role"), roleSlug: roleSlugSchema, ...newThreadOptions }),
|
|
25466
|
+
external_exports.strictObject({ kind: external_exports.literal("harness"), harnessId: harnessIdSchema, ...newThreadOptions }),
|
|
25467
|
+
external_exports.strictObject({
|
|
25468
|
+
kind: external_exports.literal("existing"),
|
|
25469
|
+
threadId: hostThreadIdSchema,
|
|
25470
|
+
...optionalMemberEdits,
|
|
25471
|
+
includeRecentHistory: external_exports.boolean().default(true).optional()
|
|
25472
|
+
})
|
|
25473
|
+
]);
|
|
25474
|
+
var GROUPS_LIST_METHOD = "codexhost/groups/list";
|
|
25475
|
+
var GROUPS_GET_METHOD = "codexhost/groups/get";
|
|
25476
|
+
var GROUPS_CREATE_METHOD = "codexhost/groups/create";
|
|
25477
|
+
var GROUPS_UPDATE_METHOD = "codexhost/groups/update";
|
|
25478
|
+
var GROUPS_DELETE_METHOD = "codexhost/groups/delete";
|
|
25479
|
+
var GROUPS_ADD_MEMBER_METHOD = "codexhost/groups/member/add";
|
|
25480
|
+
var GROUPS_UPDATE_MEMBER_METHOD = "codexhost/groups/member/update";
|
|
25481
|
+
var GROUPS_REMOVE_MEMBER_METHOD = "codexhost/groups/member/remove";
|
|
25482
|
+
var GROUPS_REBIND_MEMBER_METHOD = "codexhost/groups/member/rebind";
|
|
25483
|
+
var GROUPS_POST_MESSAGE_METHOD = "codexhost/groups/message/post";
|
|
25484
|
+
var GROUPS_READ_MESSAGES_METHOD = "codexhost/groups/messages/read";
|
|
25485
|
+
var GROUPS_INSPECT_CWD_METHOD = "codexhost/groups/cwd/inspect";
|
|
25486
|
+
var roomIdentity = { roomId: groupRoomIdSchema };
|
|
25487
|
+
var memberIdentity = { ...roomIdentity, memberId: groupMemberIdSchema };
|
|
25488
|
+
var roomEdits = {
|
|
25489
|
+
title: nonblankString.optional(),
|
|
25490
|
+
unmentionedPolicy: groupUnmentionedPolicySchema.optional(),
|
|
25491
|
+
allowAgentMentions: external_exports.boolean().optional(),
|
|
25492
|
+
maxAgentHops: maxAgentHopsSchema.optional()
|
|
25493
|
+
};
|
|
25494
|
+
var groupsListParamsSchema = external_exports.strictObject({});
|
|
25495
|
+
var groupsListResultSchema = external_exports.object({ rooms: external_exports.array(groupRoomSchema) });
|
|
25496
|
+
var groupsGetParamsSchema = external_exports.strictObject({
|
|
25497
|
+
...roomIdentity,
|
|
25498
|
+
limit: positiveInteger.optional(),
|
|
25499
|
+
beforeSeq: positiveInteger.optional()
|
|
25500
|
+
});
|
|
25501
|
+
var groupsGetResultSchema = external_exports.object({
|
|
25502
|
+
room: groupRoomSchema.nullable(),
|
|
25503
|
+
messages: external_exports.array(groupMessageSchema),
|
|
25504
|
+
hasMore: external_exports.boolean()
|
|
25505
|
+
});
|
|
25506
|
+
var groupsCreateParamsSchema = external_exports.strictObject({
|
|
25507
|
+
...roomEdits,
|
|
25508
|
+
defaultCwd: nonblankString.optional(),
|
|
25509
|
+
members: external_exports.array(groupCreateMemberInputSchema)
|
|
25510
|
+
});
|
|
25511
|
+
var groupsCreateResultSchema = external_exports.object({ room: groupRoomSchema });
|
|
25512
|
+
var groupsUpdateParamsSchema = external_exports.strictObject({
|
|
25513
|
+
...roomIdentity,
|
|
25514
|
+
...roomEdits,
|
|
25515
|
+
pinned: external_exports.boolean().optional(),
|
|
25516
|
+
relayPaused: external_exports.boolean().optional()
|
|
25517
|
+
});
|
|
25518
|
+
var groupsDeleteParamsSchema = external_exports.strictObject(roomIdentity);
|
|
25519
|
+
var groupsDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
|
|
25520
|
+
var groupsAddMemberParamsSchema = external_exports.strictObject({
|
|
25521
|
+
...roomIdentity,
|
|
25522
|
+
member: groupCreateMemberInputSchema
|
|
25523
|
+
});
|
|
25524
|
+
var groupsAddMemberResultSchema = external_exports.object({
|
|
25525
|
+
room: groupRoomSchema,
|
|
25526
|
+
member: groupMemberSchema
|
|
25527
|
+
});
|
|
25528
|
+
var groupsUpdateMemberParamsSchema = external_exports.strictObject({
|
|
25529
|
+
...memberIdentity,
|
|
25530
|
+
...optionalMemberEdits,
|
|
25531
|
+
status: groupMemberStatusSchema.optional()
|
|
25532
|
+
});
|
|
25533
|
+
var groupsRemoveMemberParamsSchema = external_exports.strictObject(memberIdentity);
|
|
25534
|
+
var groupsRebindMemberParamsSchema = external_exports.strictObject({
|
|
25535
|
+
...memberIdentity,
|
|
25536
|
+
threadId: hostThreadIdSchema,
|
|
25537
|
+
redeliverFrom: positiveInteger.optional(),
|
|
25538
|
+
note: external_exports.string().optional()
|
|
25539
|
+
});
|
|
25540
|
+
var groupCliRebindMemberParamsSchema = external_exports.strictObject({
|
|
25541
|
+
...roomIdentity,
|
|
25542
|
+
memberId: groupMemberIdSchema.optional(),
|
|
25543
|
+
memberHandle: groupMemberHandleSchema.optional(),
|
|
25544
|
+
threadId: hostThreadIdSchema,
|
|
25545
|
+
redeliverFrom: positiveInteger.optional(),
|
|
25546
|
+
note: external_exports.string().optional()
|
|
25547
|
+
}).refine((value) => value.memberId !== void 0 !== (value.memberHandle !== void 0), "Provide exactly one of memberId or memberHandle");
|
|
25548
|
+
var groupsRebindMemberResultSchema = external_exports.object({
|
|
25549
|
+
room: groupRoomSchema,
|
|
25550
|
+
member: groupMemberSchema,
|
|
25551
|
+
previousThreadId: hostThreadIdSchema,
|
|
25552
|
+
awakened: external_exports.boolean()
|
|
25553
|
+
});
|
|
25554
|
+
var groupCliListMemberSchema = external_exports.object({
|
|
25555
|
+
memberId: groupMemberIdSchema,
|
|
25556
|
+
threadId: hostThreadIdSchema,
|
|
25557
|
+
handle: groupMemberHandleSchema,
|
|
25558
|
+
displayName: nonblankString,
|
|
25559
|
+
status: groupMemberStatusSchema,
|
|
25560
|
+
harnessId: harnessIdSchema,
|
|
25561
|
+
roleSlug: roleSlugSchema.optional(),
|
|
25562
|
+
roleName: nonblankString.optional()
|
|
25563
|
+
});
|
|
25564
|
+
var groupCliListEntrySchema = external_exports.object({
|
|
25565
|
+
roomId: groupRoomIdSchema,
|
|
25566
|
+
title: nonblankString,
|
|
25567
|
+
memberCount: nonnegativeInteger,
|
|
25568
|
+
updatedAt: timestamp,
|
|
25569
|
+
member: groupCliListMemberSchema.optional()
|
|
25570
|
+
});
|
|
25571
|
+
var groupCliListParamsSchema = external_exports.strictObject({
|
|
25572
|
+
threadId: hostThreadIdSchema.optional()
|
|
25573
|
+
});
|
|
25574
|
+
var groupCliListResultSchema = external_exports.object({
|
|
25575
|
+
rooms: external_exports.array(groupCliListEntrySchema)
|
|
25576
|
+
});
|
|
25577
|
+
var groupsPostMessageParamsSchema = external_exports.strictObject({
|
|
25578
|
+
...roomIdentity,
|
|
25579
|
+
content: external_exports.string().max(64e3),
|
|
25580
|
+
attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
|
|
25581
|
+
replyToSeq: positiveInteger.optional(),
|
|
25582
|
+
targetMemberIds: external_exports.array(groupMemberIdSchema).optional(),
|
|
25583
|
+
mentionAll: external_exports.boolean().optional(),
|
|
25584
|
+
notice: external_exports.boolean().optional()
|
|
25585
|
+
}).superRefine((value, context) => {
|
|
25586
|
+
if (value.notice === true) {
|
|
25587
|
+
if (value.content.trim().length === 0) {
|
|
25588
|
+
context.addIssue({
|
|
25589
|
+
code: "custom",
|
|
25590
|
+
path: ["content"],
|
|
25591
|
+
message: "Notice content is required"
|
|
25592
|
+
});
|
|
25593
|
+
}
|
|
25594
|
+
if (value.content.length > GROUP_NOTICE_MAX_LENGTH) {
|
|
25595
|
+
context.addIssue({
|
|
25596
|
+
code: "custom",
|
|
25597
|
+
path: ["content"],
|
|
25598
|
+
message: `Notice content must be at most ${GROUP_NOTICE_MAX_LENGTH} characters`
|
|
25599
|
+
});
|
|
25600
|
+
}
|
|
25601
|
+
if ((value.targetMemberIds?.length ?? 0) > 0 || value.mentionAll === true || (value.attachments?.length ?? 0) > 0) {
|
|
25602
|
+
context.addIssue({
|
|
25603
|
+
code: "custom",
|
|
25604
|
+
path: ["notice"],
|
|
25605
|
+
message: "System notices cannot target members or include attachments"
|
|
25606
|
+
});
|
|
25607
|
+
}
|
|
25608
|
+
return;
|
|
25609
|
+
}
|
|
25610
|
+
if (value.content.trim().length === 0 && (value.attachments?.length ?? 0) === 0) {
|
|
25611
|
+
context.addIssue({
|
|
25612
|
+
code: "custom",
|
|
25613
|
+
path: ["content"],
|
|
25614
|
+
message: "Message content or at least one attachment is required"
|
|
25615
|
+
});
|
|
25616
|
+
}
|
|
25617
|
+
});
|
|
25618
|
+
var groupsPostMessageResultSchema = external_exports.object({
|
|
25619
|
+
room: groupRoomSchema,
|
|
25620
|
+
message: groupMessageSchema,
|
|
25621
|
+
awakenedMemberIds: external_exports.array(groupMemberIdSchema)
|
|
25622
|
+
});
|
|
25623
|
+
var groupsReadMessagesParamsSchema = external_exports.strictObject({
|
|
25624
|
+
...roomIdentity,
|
|
25625
|
+
fromSeq: positiveInteger.optional(),
|
|
25626
|
+
toSeq: positiveInteger.optional(),
|
|
25627
|
+
limit: positiveInteger.optional()
|
|
25628
|
+
});
|
|
25629
|
+
var groupsReadMessagesResultSchema = external_exports.object({
|
|
25630
|
+
...roomIdentity,
|
|
25631
|
+
messages: external_exports.array(groupMessageSchema),
|
|
25632
|
+
totalSeq: nonnegativeInteger
|
|
25633
|
+
});
|
|
25634
|
+
var groupsInspectCwdParamsSchema = external_exports.strictObject({
|
|
25635
|
+
cwd: nonblankString,
|
|
25636
|
+
roomId: groupRoomIdSchema.optional()
|
|
25637
|
+
});
|
|
25638
|
+
var groupsInspectCwdResultSchema = external_exports.object({
|
|
25639
|
+
isGitRepo: external_exports.boolean()
|
|
25640
|
+
});
|
|
25641
|
+
|
|
25222
25642
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
25223
25643
|
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
25224
25644
|
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
@@ -25264,6 +25684,7 @@ var TELEMETRY_OFFICIAL_HARNESSES = [
|
|
|
25264
25684
|
"kiro-cli",
|
|
25265
25685
|
"codebuddy",
|
|
25266
25686
|
"workbuddy",
|
|
25687
|
+
"workbuddy-cn",
|
|
25267
25688
|
"devin",
|
|
25268
25689
|
"hermes",
|
|
25269
25690
|
"qoder",
|
|
@@ -25389,6 +25810,24 @@ var clientThreadSectionMutationResultSchema = external_exports.discriminatedUnio
|
|
|
25389
25810
|
]);
|
|
25390
25811
|
var CLIENT_CHANNEL_METHODS = [
|
|
25391
25812
|
"codexhost/skills/list",
|
|
25813
|
+
ROLES_LIST_METHOD,
|
|
25814
|
+
ROLES_GET_METHOD,
|
|
25815
|
+
ROLES_SAVE_METHOD,
|
|
25816
|
+
ROLES_DELETE_METHOD,
|
|
25817
|
+
ROLES_CATALOG_METHOD,
|
|
25818
|
+
ROLES_LIKE_METHOD,
|
|
25819
|
+
GROUPS_LIST_METHOD,
|
|
25820
|
+
GROUPS_GET_METHOD,
|
|
25821
|
+
GROUPS_CREATE_METHOD,
|
|
25822
|
+
GROUPS_UPDATE_METHOD,
|
|
25823
|
+
GROUPS_DELETE_METHOD,
|
|
25824
|
+
GROUPS_ADD_MEMBER_METHOD,
|
|
25825
|
+
GROUPS_UPDATE_MEMBER_METHOD,
|
|
25826
|
+
GROUPS_REMOVE_MEMBER_METHOD,
|
|
25827
|
+
GROUPS_REBIND_MEMBER_METHOD,
|
|
25828
|
+
GROUPS_POST_MESSAGE_METHOD,
|
|
25829
|
+
GROUPS_READ_MESSAGES_METHOD,
|
|
25830
|
+
GROUPS_INSPECT_CWD_METHOD,
|
|
25392
25831
|
"codexhost/voice/status",
|
|
25393
25832
|
"codexhost/voice/transcribe",
|
|
25394
25833
|
"codexhost/harness/display-settings/get",
|
|
@@ -25550,6 +25989,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
25550
25989
|
}),
|
|
25551
25990
|
external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
|
|
25552
25991
|
external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
|
|
25992
|
+
external_exports.object({
|
|
25993
|
+
type: external_exports.literal("groups-changed"),
|
|
25994
|
+
cursor: clientChannelCursorSchema,
|
|
25995
|
+
roomId: external_exports.string().optional()
|
|
25996
|
+
}),
|
|
25553
25997
|
external_exports.object({
|
|
25554
25998
|
type: external_exports.literal("preferences-changed"),
|
|
25555
25999
|
cursor: clientChannelCursorSchema,
|
|
@@ -25683,6 +26127,7 @@ var clientThreadSnapshotSchema = external_exports.object({
|
|
|
25683
26127
|
status: external_exports.object({ type: external_exports.string() }).passthrough(),
|
|
25684
26128
|
name: external_exports.string().nullable().optional(),
|
|
25685
26129
|
preview: external_exports.string().optional(),
|
|
26130
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
25686
26131
|
codexhostImportSource: clientThreadImportSourceSchema.optional(),
|
|
25687
26132
|
turns: external_exports.array(clientTurnSchema).length(0)
|
|
25688
26133
|
}).passthrough(),
|
|
@@ -25947,7 +26392,23 @@ var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
|
|
|
25947
26392
|
var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
25948
26393
|
var remotePeerNodeIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
25949
26394
|
var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
|
|
25950
|
-
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
|
|
26395
|
+
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "ssh", "custom"]);
|
|
26396
|
+
var remotePeerSshAuthModeSchema = external_exports.enum(["auto", "key", "password"]);
|
|
26397
|
+
var remotePeerSshConfigSchema = external_exports.object({
|
|
26398
|
+
host: external_exports.string().trim().min(1).max(255),
|
|
26399
|
+
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
26400
|
+
user: external_exports.string().trim().min(1).max(128).optional(),
|
|
26401
|
+
identityFile: external_exports.string().trim().min(1).max(1024).optional(),
|
|
26402
|
+
authMode: remotePeerSshAuthModeSchema.default("auto"),
|
|
26403
|
+
remoteDataDir: external_exports.string().trim().min(1).max(1024).optional()
|
|
26404
|
+
});
|
|
26405
|
+
var remotePeerSshSummarySchema = external_exports.object({
|
|
26406
|
+
host: external_exports.string().min(1).max(255),
|
|
26407
|
+
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
26408
|
+
user: external_exports.string().min(1).max(128).optional(),
|
|
26409
|
+
authMode: remotePeerSshAuthModeSchema,
|
|
26410
|
+
keyInstalled: external_exports.boolean().optional()
|
|
26411
|
+
});
|
|
25951
26412
|
var REMOTE_PEER_COLORS = [
|
|
25952
26413
|
"blue",
|
|
25953
26414
|
"purple",
|
|
@@ -25974,6 +26435,7 @@ var remotePeerSummarySchema = external_exports.object({
|
|
|
25974
26435
|
color: remotePeerColorSchema.optional(),
|
|
25975
26436
|
origin: external_exports.string().min(1).max(2048),
|
|
25976
26437
|
transportKind: remotePeerTransportKindSchema,
|
|
26438
|
+
ssh: remotePeerSshSummarySchema.optional(),
|
|
25977
26439
|
encrypted: external_exports.boolean(),
|
|
25978
26440
|
enabled: external_exports.boolean(),
|
|
25979
26441
|
state: remotePeerStateSchema,
|
|
@@ -26221,8 +26683,66 @@ var delegationHostHarnessOptionSchema = external_exports.object({
|
|
|
26221
26683
|
var delegationHostHarnessesResultSchema = external_exports.object({
|
|
26222
26684
|
harnesses: external_exports.array(delegationHostHarnessOptionSchema)
|
|
26223
26685
|
});
|
|
26686
|
+
var sshConfigHostEntrySchema = external_exports.object({
|
|
26687
|
+
alias: external_exports.string().min(1).max(255),
|
|
26688
|
+
hostName: external_exports.string().max(255).optional(),
|
|
26689
|
+
user: external_exports.string().max(128).optional(),
|
|
26690
|
+
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
26691
|
+
identityFile: external_exports.string().max(1024).optional()
|
|
26692
|
+
});
|
|
26693
|
+
var remotePeerListSshConfigHostsResultSchema = external_exports.object({
|
|
26694
|
+
hosts: external_exports.array(sshConfigHostEntrySchema)
|
|
26695
|
+
});
|
|
26696
|
+
var remotePeerSshConnectParamsSchema = external_exports.object({
|
|
26697
|
+
host: external_exports.string().trim().min(1).max(255),
|
|
26698
|
+
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
26699
|
+
user: external_exports.string().trim().min(1).max(128).optional(),
|
|
26700
|
+
identityFile: external_exports.string().trim().min(1).max(1024).optional(),
|
|
26701
|
+
authMode: remotePeerSshAuthModeSchema.default("auto"),
|
|
26702
|
+
password: external_exports.string().max(1024).optional(),
|
|
26703
|
+
installAuthorizedKey: external_exports.boolean().optional(),
|
|
26704
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
26705
|
+
color: remotePeerColorSchema.optional(),
|
|
26706
|
+
remoteDataDir: external_exports.string().trim().min(1).max(1024).optional(),
|
|
26707
|
+
sessionId: external_exports.string().min(1).max(128).optional()
|
|
26708
|
+
});
|
|
26709
|
+
var remotePeerSshTestResultSchema = external_exports.object({
|
|
26710
|
+
ok: external_exports.boolean(),
|
|
26711
|
+
codexhostInstalled: external_exports.boolean(),
|
|
26712
|
+
version: external_exports.string().max(128).optional(),
|
|
26713
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
26714
|
+
platform: external_exports.string().max(64).optional(),
|
|
26715
|
+
hostname: external_exports.string().max(255).optional(),
|
|
26716
|
+
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
26717
|
+
errorCode: external_exports.string().max(128).optional(),
|
|
26718
|
+
error: external_exports.string().max(1e3).optional()
|
|
26719
|
+
});
|
|
26720
|
+
var remotePeerSshInstallResultSchema = external_exports.object({
|
|
26721
|
+
ok: external_exports.boolean(),
|
|
26722
|
+
version: external_exports.string().max(128).optional(),
|
|
26723
|
+
message: external_exports.string().max(1e3).optional()
|
|
26724
|
+
});
|
|
26725
|
+
var remotePeerSshAuthPromptSchema = external_exports.object({
|
|
26726
|
+
promptId: external_exports.string().min(1).max(128),
|
|
26727
|
+
sessionId: external_exports.string().min(1).max(128).optional(),
|
|
26728
|
+
peerId: remotePeerIdSchema.optional(),
|
|
26729
|
+
host: external_exports.string().min(1).max(255),
|
|
26730
|
+
kind: external_exports.enum(["host-key", "password", "passphrase", "otp", "generic"]),
|
|
26731
|
+
prompt: external_exports.string().min(1).max(1e3),
|
|
26732
|
+
echo: external_exports.boolean()
|
|
26733
|
+
});
|
|
26734
|
+
var remotePeerSshRespondAuthParamsSchema = external_exports.object({
|
|
26735
|
+
promptId: external_exports.string().min(1).max(128),
|
|
26736
|
+
sessionId: external_exports.string().min(1).max(128).optional(),
|
|
26737
|
+
response: external_exports.string().max(1024).optional(),
|
|
26738
|
+
cancel: external_exports.boolean().optional()
|
|
26739
|
+
});
|
|
26224
26740
|
|
|
26225
26741
|
// ../../shared-contracts/dist/peer-delegation.js
|
|
26742
|
+
var peerWatchNudgeParamsSchema = external_exports.strictObject({
|
|
26743
|
+
hostId: remotePeerHostIdSchema,
|
|
26744
|
+
threadId: external_exports.string().min(1).max(1024).optional()
|
|
26745
|
+
});
|
|
26226
26746
|
var PEER_DELEGATION_BRIDGE_VERSION = 1;
|
|
26227
26747
|
var PEER_DELEGATION_OPERATIONS = [
|
|
26228
26748
|
"listHarnesses",
|
|
@@ -26406,11 +26926,12 @@ var delegationDefaultsSchema = external_exports.strictObject({
|
|
|
26406
26926
|
byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
|
|
26407
26927
|
});
|
|
26408
26928
|
var modelId = external_exports.string().min(1).max(1024);
|
|
26409
|
-
var harnessPreferenceValuesSchema = external_exports.
|
|
26929
|
+
var harnessPreferenceValuesSchema = external_exports.object({
|
|
26410
26930
|
idleRelease: idleReleaseSettingsSchema.optional(),
|
|
26411
26931
|
favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
|
|
26412
26932
|
newThread: newThreadDefaultsSchema.optional(),
|
|
26413
|
-
delegation: delegationDefaultsSchema.optional()
|
|
26933
|
+
delegation: delegationDefaultsSchema.optional(),
|
|
26934
|
+
showGroupChatsInSidebar: external_exports.boolean().optional()
|
|
26414
26935
|
});
|
|
26415
26936
|
var harnessPreferenceSnapshotSchema = external_exports.strictObject({
|
|
26416
26937
|
scope: harnessPreferenceScopeSchema,
|
|
@@ -26443,6 +26964,10 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
|
|
|
26443
26964
|
kind: external_exports.literal("delegation"),
|
|
26444
26965
|
harnessId: harnessIdSchema,
|
|
26445
26966
|
configuration: harnessDelegationDefaultSchema.nullable()
|
|
26967
|
+
}),
|
|
26968
|
+
external_exports.strictObject({
|
|
26969
|
+
kind: external_exports.literal("groupChatsSidebar"),
|
|
26970
|
+
visible: external_exports.boolean()
|
|
26446
26971
|
})
|
|
26447
26972
|
]);
|
|
26448
26973
|
var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
@@ -26710,6 +27235,10 @@ var webToolOutputPreviewSchema = external_exports.object({
|
|
|
26710
27235
|
bytes: external_exports.number().int().nonnegative()
|
|
26711
27236
|
});
|
|
26712
27237
|
|
|
27238
|
+
// ../../shared-contracts/dist/desktop-shell.js
|
|
27239
|
+
var desktopShellOpenParamsSchema = external_exports.strictObject({});
|
|
27240
|
+
var desktopShellOpenResultSchema = external_exports.strictObject({});
|
|
27241
|
+
|
|
26713
27242
|
// ../../shared-contracts/dist/console.js
|
|
26714
27243
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
26715
27244
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -27279,7 +27808,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
|
27279
27808
|
"unreadable",
|
|
27280
27809
|
"notFound"
|
|
27281
27810
|
];
|
|
27282
|
-
var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)
|
|
27811
|
+
var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)(?:\?hostId=([^\s()<>"?#/&]+))?\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
|
|
27283
27812
|
|
|
27284
27813
|
// ../../shared-contracts/dist/remote-runtime.js
|
|
27285
27814
|
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
@@ -27308,7 +27837,7 @@ var remoteSshSetupParamsSchema = external_exports.object({
|
|
|
27308
27837
|
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
27309
27838
|
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
27310
27839
|
identity: external_exports.string().max(4096).nullable(),
|
|
27311
|
-
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
27840
|
+
action: external_exports.enum(["inspect", "install", "update", "restart", "repair", "uninstall"]),
|
|
27312
27841
|
uninstallPackage: external_exports.boolean().optional(),
|
|
27313
27842
|
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
27314
27843
|
}).strict();
|
|
@@ -27324,6 +27853,7 @@ var target = {
|
|
|
27324
27853
|
var thread2 = { ...target, threadId: identity };
|
|
27325
27854
|
var text = external_exports.string().min(1).max(8e3);
|
|
27326
27855
|
var input2 = { text, requestId: identity };
|
|
27856
|
+
var queueReorderItemIdsSchema = external_exports.array(identity).min(2).max(100).refine((ids) => new Set(ids).size === ids.length, "Queued submission IDs must be distinct");
|
|
27327
27857
|
var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
|
|
27328
27858
|
external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
|
|
27329
27859
|
external_exports.object({
|
|
@@ -27343,6 +27873,7 @@ var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available",
|
|
|
27343
27873
|
external_exports.object({ available: external_exports.literal(false) }),
|
|
27344
27874
|
external_exports.object({
|
|
27345
27875
|
available: external_exports.literal(true),
|
|
27876
|
+
canReorder: external_exports.literal(true).optional(),
|
|
27346
27877
|
items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
|
|
27347
27878
|
})
|
|
27348
27879
|
]);
|
|
@@ -27420,6 +27951,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
27420
27951
|
external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input2 }),
|
|
27421
27952
|
external_exports.strictObject({ kind: external_exports.literal("steer"), ...input2, turnId: identity }),
|
|
27422
27953
|
external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
|
|
27954
|
+
external_exports.strictObject({ kind: external_exports.literal("reorder"), itemIds: queueReorderItemIdsSchema }),
|
|
27423
27955
|
external_exports.strictObject({
|
|
27424
27956
|
kind: external_exports.literal("start"),
|
|
27425
27957
|
itemId: identity,
|
|
@@ -28515,16 +29047,16 @@ var Diff = class {
|
|
|
28515
29047
|
}
|
|
28516
29048
|
}
|
|
28517
29049
|
}
|
|
28518
|
-
addToPath(
|
|
28519
|
-
const last =
|
|
29050
|
+
addToPath(path14, added, removed, oldPosInc, options) {
|
|
29051
|
+
const last = path14.lastComponent;
|
|
28520
29052
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
28521
29053
|
return {
|
|
28522
|
-
oldPos:
|
|
29054
|
+
oldPos: path14.oldPos + oldPosInc,
|
|
28523
29055
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
28524
29056
|
};
|
|
28525
29057
|
} else {
|
|
28526
29058
|
return {
|
|
28527
|
-
oldPos:
|
|
29059
|
+
oldPos: path14.oldPos + oldPosInc,
|
|
28528
29060
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
28529
29061
|
};
|
|
28530
29062
|
}
|
|
@@ -29063,7 +29595,7 @@ function requiredString(value, label) {
|
|
|
29063
29595
|
fail(`Modern history ${label} is invalid`);
|
|
29064
29596
|
return value;
|
|
29065
29597
|
}
|
|
29066
|
-
function
|
|
29598
|
+
function positiveInteger2(value, label) {
|
|
29067
29599
|
return boundedInteger(value, label, 1);
|
|
29068
29600
|
}
|
|
29069
29601
|
function nonNegativeInteger(value, label) {
|
|
@@ -29143,8 +29675,8 @@ function parseAssistantBaseline(value) {
|
|
|
29143
29675
|
const parsed = {
|
|
29144
29676
|
attemptId: identifier(attempt.attemptId, "assistant stream attemptId"),
|
|
29145
29677
|
startedAfterSeq: cursor(attempt.startedAfterSeq, "assistant stream startedAfterSeq"),
|
|
29146
|
-
turn:
|
|
29147
|
-
step:
|
|
29678
|
+
turn: positiveInteger3(attempt.turn, "assistant stream turn"),
|
|
29679
|
+
step: positiveInteger3(attempt.step, "assistant stream step"),
|
|
29148
29680
|
nextIndex: nonNegativeInteger2(attempt.nextIndex, "assistant stream nextIndex"),
|
|
29149
29681
|
stream: jsonArray(attempt.stream, "assistant stream baseline stream")
|
|
29150
29682
|
};
|
|
@@ -29158,7 +29690,7 @@ function parseAssistantFrame(value) {
|
|
|
29158
29690
|
if (!isRecord3(value) || typeof value.type !== "string")
|
|
29159
29691
|
throw invalid("assistant stream frame");
|
|
29160
29692
|
const attemptId = identifier(value.attemptId, "assistant stream attemptId");
|
|
29161
|
-
const revision =
|
|
29693
|
+
const revision = positiveInteger3(value.revision, "assistant stream revision");
|
|
29162
29694
|
switch (value.type) {
|
|
29163
29695
|
case "start":
|
|
29164
29696
|
if (!onlyKeys(value, ["type", "attemptId", "revision", "startedAfterSeq", "turn", "step"])) {
|
|
@@ -29169,8 +29701,8 @@ function parseAssistantFrame(value) {
|
|
|
29169
29701
|
attemptId,
|
|
29170
29702
|
revision,
|
|
29171
29703
|
startedAfterSeq: cursor(value.startedAfterSeq, "assistant stream startedAfterSeq"),
|
|
29172
|
-
turn:
|
|
29173
|
-
step:
|
|
29704
|
+
turn: positiveInteger3(value.turn, "assistant stream turn"),
|
|
29705
|
+
step: positiveInteger3(value.step, "assistant stream step")
|
|
29174
29706
|
};
|
|
29175
29707
|
case "chunk":
|
|
29176
29708
|
if (!onlyKeys(value, ["type", "attemptId", "revision", "index", "time", "chunk"])) {
|
|
@@ -29320,7 +29852,7 @@ function identifier(value, label) {
|
|
|
29320
29852
|
function cursor(value, label) {
|
|
29321
29853
|
return value === -1 ? value : nonNegativeInteger2(value, label);
|
|
29322
29854
|
}
|
|
29323
|
-
function
|
|
29855
|
+
function positiveInteger3(value, label) {
|
|
29324
29856
|
const parsed = safeInteger(value, label);
|
|
29325
29857
|
if (parsed <= 0)
|
|
29326
29858
|
throw invalid(label);
|
|
@@ -29486,8 +30018,8 @@ function validateDeveloperMessage(event) {
|
|
|
29486
30018
|
requiredFields(data, ["turn", "step", "message"]);
|
|
29487
30019
|
if (Object.hasOwn(data, "headerSeq") && !Number.isSafeInteger(data.headerSeq))
|
|
29488
30020
|
throw invalid("developer/message headerSeq");
|
|
29489
|
-
|
|
29490
|
-
|
|
30021
|
+
positiveInteger3(data.turn, "developer/message turn");
|
|
30022
|
+
positiveInteger3(data.step, "developer/message step");
|
|
29491
30023
|
if (!isRecord3(data.message))
|
|
29492
30024
|
throw invalid("developer/message message");
|
|
29493
30025
|
const message = data.message;
|
|
@@ -29541,7 +30073,7 @@ function validateV4Event(event) {
|
|
|
29541
30073
|
if (!isRecord3(data))
|
|
29542
30074
|
throw invalid("workspace/changes");
|
|
29543
30075
|
exactKeys(data, ["turn"]);
|
|
29544
|
-
|
|
30076
|
+
positiveInteger3(data.turn, "workspace/changes turn");
|
|
29545
30077
|
break;
|
|
29546
30078
|
case "tool/result":
|
|
29547
30079
|
if (!isRecord3(data))
|
|
@@ -29590,7 +30122,7 @@ function validateV4Event(event) {
|
|
|
29590
30122
|
break;
|
|
29591
30123
|
case "deliverables/presented":
|
|
29592
30124
|
exactKeys(data, ["turn", "callId", "files"]);
|
|
29593
|
-
|
|
30125
|
+
positiveInteger3(data.turn, "deliverables turn");
|
|
29594
30126
|
identifier(data.callId, "deliverables callId");
|
|
29595
30127
|
if (!Array.isArray(data.files))
|
|
29596
30128
|
throw invalid("deliverables files");
|
|
@@ -30177,6 +30709,11 @@ function isSupportedDeepSeekVersion(version2) {
|
|
|
30177
30709
|
const parsed = parseSemVer(version2);
|
|
30178
30710
|
return parsed !== void 0 && MINIMUM !== void 0 && compareSemVer(parsed, MINIMUM) >= 0;
|
|
30179
30711
|
}
|
|
30712
|
+
function supportsDeepSeekDelegationBridge(version2) {
|
|
30713
|
+
const parsed = parseSemVer(version2);
|
|
30714
|
+
const minimum = parseSemVer("0.2.2-rc.5");
|
|
30715
|
+
return parsed !== void 0 && minimum !== void 0 && compareSemVer(parsed, minimum) >= 0;
|
|
30716
|
+
}
|
|
30180
30717
|
function deepSeekModernProfile(version2) {
|
|
30181
30718
|
return DEEPSEEK_V4_PROFILE.version === version2 ? DEEPSEEK_V4_PROFILE : Object.freeze({ ...DEEPSEEK_V4_PROFILE, version: version2 });
|
|
30182
30719
|
}
|
|
@@ -30512,7 +31049,7 @@ async function probeDeepSeekExecutableGeneration(options = {}, dependencies = {
|
|
|
30512
31049
|
|
|
30513
31050
|
// dist/modern/deepseek-harness-adapter.js
|
|
30514
31051
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
30515
|
-
import
|
|
31052
|
+
import path12 from "node:path";
|
|
30516
31053
|
import { isDeepStrictEqual as isDeepStrictEqual7 } from "node:util";
|
|
30517
31054
|
|
|
30518
31055
|
// dist/model-catalog.js
|
|
@@ -30641,6 +31178,145 @@ var import_websocket = __toESM(require_websocket(), 1);
|
|
|
30641
31178
|
var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
30642
31179
|
var wrapper_default = import_websocket.default;
|
|
30643
31180
|
|
|
31181
|
+
// dist/modern/delegation-bridge.js
|
|
31182
|
+
import { randomBytes } from "node:crypto";
|
|
31183
|
+
import { mkdtemp as mkdtemp2, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
|
|
31184
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
31185
|
+
import path8 from "node:path";
|
|
31186
|
+
var DELEGATION_ENDPOINT = "codexhost/delegation";
|
|
31187
|
+
var DELEGATION_BRIDGE_TOKEN = "CODEXHOST_DSH_BRIDGE_TOKEN";
|
|
31188
|
+
var ENVIRONMENT_KEYS = [
|
|
31189
|
+
"CODEXHOST_RUNTIME_ENDPOINT",
|
|
31190
|
+
"CODEXHOST_RUNTIME_TOKEN",
|
|
31191
|
+
"CODEXHOST_THREAD_ID",
|
|
31192
|
+
"CODEXHOST_CLI_PATH"
|
|
31193
|
+
];
|
|
31194
|
+
function delegationEnvironment(environment) {
|
|
31195
|
+
if (!environment || ENVIRONMENT_KEYS.some((key) => !environment[key])) {
|
|
31196
|
+
return void 0;
|
|
31197
|
+
}
|
|
31198
|
+
return Object.fromEntries(ENVIRONMENT_KEYS.map((key) => [key, environment[key]]));
|
|
31199
|
+
}
|
|
31200
|
+
var DELEGATION_PLUGIN_SOURCE = String.raw`
|
|
31201
|
+
export const name = "codexhost-delegation";
|
|
31202
|
+
export const inject = ["webServer", "shellEnv"];
|
|
31203
|
+
|
|
31204
|
+
export async function apply(ctx) {
|
|
31205
|
+
const { timingSafeEqual } = await import("node:crypto");
|
|
31206
|
+
const secret = process.env.CODEXHOST_DSH_BRIDGE_TOKEN;
|
|
31207
|
+
if (!secret) {
|
|
31208
|
+
throw new Error("CodexHost delegation bridge credential is missing");
|
|
31209
|
+
}
|
|
31210
|
+
const expected = Buffer.from("Bearer " + secret);
|
|
31211
|
+
const keys = [
|
|
31212
|
+
"CODEXHOST_RUNTIME_ENDPOINT",
|
|
31213
|
+
"CODEXHOST_RUNTIME_TOKEN",
|
|
31214
|
+
"CODEXHOST_THREAD_ID",
|
|
31215
|
+
"CODEXHOST_CLI_PATH",
|
|
31216
|
+
];
|
|
31217
|
+
const sessions = new Map();
|
|
31218
|
+
const variables = Object.fromEntries(keys.map((key) => [
|
|
31219
|
+
"DSH_" + key,
|
|
31220
|
+
{ description: "CodexHost delegation identity for the current Session" },
|
|
31221
|
+
]));
|
|
31222
|
+
ctx.shellEnv.register({
|
|
31223
|
+
name,
|
|
31224
|
+
variables,
|
|
31225
|
+
resolve(execution) {
|
|
31226
|
+
const sessionId = execution.agent?.session.header.id;
|
|
31227
|
+
const environment = sessions.get(sessionId);
|
|
31228
|
+
if (!environment) {
|
|
31229
|
+
return {};
|
|
31230
|
+
}
|
|
31231
|
+
return Object.fromEntries(keys.map((key) => ["DSH_" + key, environment[key]]));
|
|
31232
|
+
},
|
|
31233
|
+
});
|
|
31234
|
+
ctx.effect(() => {
|
|
31235
|
+
const unregisterRoute = ctx.webServer.register({
|
|
31236
|
+
kind: "exact",
|
|
31237
|
+
path: "/api/codexhost/delegation",
|
|
31238
|
+
async handler(req, res) {
|
|
31239
|
+
const actual = Buffer.from(req.headers.authorization || "");
|
|
31240
|
+
if (actual.length !== expected.length || !timingSafeEqual(actual, expected)) {
|
|
31241
|
+
res.writeHead(403).end();
|
|
31242
|
+
return;
|
|
31243
|
+
}
|
|
31244
|
+
if (req.method !== "POST") {
|
|
31245
|
+
res.writeHead(405).end();
|
|
31246
|
+
return;
|
|
31247
|
+
}
|
|
31248
|
+
const chunks = [];
|
|
31249
|
+
let size = 0;
|
|
31250
|
+
for await (const chunk of req) {
|
|
31251
|
+
size += chunk.length;
|
|
31252
|
+
if (size > 65536) {
|
|
31253
|
+
res.writeHead(413).end();
|
|
31254
|
+
return;
|
|
31255
|
+
}
|
|
31256
|
+
chunks.push(Buffer.from(chunk));
|
|
31257
|
+
}
|
|
31258
|
+
let request;
|
|
31259
|
+
try {
|
|
31260
|
+
request = JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
31261
|
+
} catch {
|
|
31262
|
+
res.writeHead(400).end();
|
|
31263
|
+
return;
|
|
31264
|
+
}
|
|
31265
|
+
const args = request?.payload?.args;
|
|
31266
|
+
const environment = args?.environment;
|
|
31267
|
+
const valid = request?.type === "client-request"
|
|
31268
|
+
&& typeof request.rpcId === "string"
|
|
31269
|
+
&& request.method === "codexhost/delegation"
|
|
31270
|
+
&& typeof args?.sessionId === "string"
|
|
31271
|
+
&& args.sessionId.length > 0
|
|
31272
|
+
&& (environment === null || (
|
|
31273
|
+
environment && typeof environment === "object" && !Array.isArray(environment)
|
|
31274
|
+
&& Object.keys(environment).length === keys.length
|
|
31275
|
+
&& keys.every((key) => typeof environment[key] === "string"
|
|
31276
|
+
&& environment[key].length > 0 && environment[key].length < 16384)
|
|
31277
|
+
));
|
|
31278
|
+
if (!valid) {
|
|
31279
|
+
res.writeHead(400).end();
|
|
31280
|
+
return;
|
|
31281
|
+
}
|
|
31282
|
+
if (environment === null) {
|
|
31283
|
+
sessions.delete(args.sessionId);
|
|
31284
|
+
} else {
|
|
31285
|
+
sessions.set(args.sessionId, Object.freeze({ ...environment }));
|
|
31286
|
+
}
|
|
31287
|
+
res.writeHead(200, { "content-type": "application/json" });
|
|
31288
|
+
res.end(JSON.stringify({
|
|
31289
|
+
type: "server-response",
|
|
31290
|
+
rpcId: request.rpcId,
|
|
31291
|
+
result: { ok: true },
|
|
31292
|
+
}));
|
|
31293
|
+
},
|
|
31294
|
+
});
|
|
31295
|
+
return () => {
|
|
31296
|
+
unregisterRoute();
|
|
31297
|
+
sessions.clear();
|
|
31298
|
+
};
|
|
31299
|
+
});
|
|
31300
|
+
}
|
|
31301
|
+
`;
|
|
31302
|
+
async function createDelegationBridge() {
|
|
31303
|
+
const directory = await mkdtemp2(path8.join(tmpdir2(), "codexhost-dsh-"));
|
|
31304
|
+
const patchPath = path8.join(directory, "delegation.patch.yml");
|
|
31305
|
+
try {
|
|
31306
|
+
const pluginPath = path8.join(directory, "delegation.mjs");
|
|
31307
|
+
await writeFile2(pluginPath, DELEGATION_PLUGIN_SOURCE, { mode: 384 });
|
|
31308
|
+
await writeFile2(patchPath, JSON.stringify([{ insert: [{ id: "codexhost-delegation", name: pluginPath }] }]), { mode: 384 });
|
|
31309
|
+
return {
|
|
31310
|
+
patchPath,
|
|
31311
|
+
token: randomBytes(32).toString("base64url"),
|
|
31312
|
+
dispose: () => rm2(directory, { recursive: true, force: true })
|
|
31313
|
+
};
|
|
31314
|
+
} catch (error62) {
|
|
31315
|
+
await rm2(directory, { recursive: true, force: true });
|
|
31316
|
+
throw error62;
|
|
31317
|
+
}
|
|
31318
|
+
}
|
|
31319
|
+
|
|
30644
31320
|
// dist/modern/remote-connection.js
|
|
30645
31321
|
var ModernRemoteConnectionError = class extends Error {
|
|
30646
31322
|
code;
|
|
@@ -30748,6 +31424,7 @@ var ModernRemoteConnection = class {
|
|
|
30748
31424
|
#maxReadinessBytes;
|
|
30749
31425
|
#faultListeners = /* @__PURE__ */ new Set();
|
|
30750
31426
|
#child;
|
|
31427
|
+
#delegationBridge;
|
|
30751
31428
|
#closePromise;
|
|
30752
31429
|
#connectPromise;
|
|
30753
31430
|
#cookie;
|
|
@@ -30761,6 +31438,7 @@ var ModernRemoteConnection = class {
|
|
|
30761
31438
|
#closing = false;
|
|
30762
31439
|
#stoppingChild = false;
|
|
30763
31440
|
#stopPromise;
|
|
31441
|
+
#processStopped = false;
|
|
30764
31442
|
constructor(options, dependencies = {}) {
|
|
30765
31443
|
if (options.command.trim() === "") {
|
|
30766
31444
|
throw new ModernRemoteConnectionError("notInstalled", "DeepSeek Harness command is missing");
|
|
@@ -30802,6 +31480,10 @@ var ModernRemoteConnection = class {
|
|
|
30802
31480
|
get stderrTail() {
|
|
30803
31481
|
return this.#stderrTail;
|
|
30804
31482
|
}
|
|
31483
|
+
/** Managed process tree stop confirmation, independent of socket and file cleanup. */
|
|
31484
|
+
get processStopped() {
|
|
31485
|
+
return this.#processStopped;
|
|
31486
|
+
}
|
|
30805
31487
|
connect() {
|
|
30806
31488
|
if (this.#closing) {
|
|
30807
31489
|
return Promise.reject(new ModernRemoteConnectionError("unavailable", "DeepSeek Harness connection is closing"));
|
|
@@ -30840,6 +31522,23 @@ var ModernRemoteConnection = class {
|
|
|
30840
31522
|
this.#faultListeners.delete(listener);
|
|
30841
31523
|
};
|
|
30842
31524
|
}
|
|
31525
|
+
async setSessionEnvironment(sessionId, environment) {
|
|
31526
|
+
if (!this.#options.delegationBridge) {
|
|
31527
|
+
return;
|
|
31528
|
+
}
|
|
31529
|
+
const selected = delegationEnvironment(environment);
|
|
31530
|
+
await this.connect();
|
|
31531
|
+
if (!this.#delegationBridge) {
|
|
31532
|
+
return;
|
|
31533
|
+
}
|
|
31534
|
+
const result = await this.call(DELEGATION_ENDPOINT, {
|
|
31535
|
+
sessionId,
|
|
31536
|
+
environment: selected ?? null
|
|
31537
|
+
});
|
|
31538
|
+
if (!result.ok) {
|
|
31539
|
+
throw new ModernRemoteConnectionError("protocolError", "DSH delegation binding failed");
|
|
31540
|
+
}
|
|
31541
|
+
}
|
|
30843
31542
|
async call(endpoint, args, signal, options = {}) {
|
|
30844
31543
|
if (options.timeoutMs === null && !signal) {
|
|
30845
31544
|
throw new TypeError("Disabling a DeepSeek Harness Remote timeout requires an AbortSignal");
|
|
@@ -30866,7 +31565,8 @@ var ModernRemoteConnection = class {
|
|
|
30866
31565
|
redirect: "manual",
|
|
30867
31566
|
headers: {
|
|
30868
31567
|
"content-type": "application/json",
|
|
30869
|
-
cookie
|
|
31568
|
+
cookie,
|
|
31569
|
+
...endpoint === DELEGATION_ENDPOINT && this.#delegationBridge ? { authorization: `Bearer ${this.#delegationBridge.token}` } : {}
|
|
30870
31570
|
},
|
|
30871
31571
|
body: JSON.stringify({
|
|
30872
31572
|
type: "client-request",
|
|
@@ -31213,9 +31913,16 @@ var ModernRemoteConnection = class {
|
|
|
31213
31913
|
}
|
|
31214
31914
|
}
|
|
31215
31915
|
async #performConnect() {
|
|
31916
|
+
if (this.#options.delegationBridge && this.#environment.CODEXHOST_RUNTIME_ENDPOINT && this.#environment.CODEXHOST_RUNTIME_TOKEN) {
|
|
31917
|
+
this.#delegationBridge = await createDelegationBridge();
|
|
31918
|
+
}
|
|
31919
|
+
if (this.#closing) {
|
|
31920
|
+
throw new ModernRemoteConnectionError("cancelled", "DeepSeek Harness startup was cancelled before process creation");
|
|
31921
|
+
}
|
|
31216
31922
|
const rawArguments = [
|
|
31217
31923
|
...this.#options.commandArguments ?? [],
|
|
31218
31924
|
"web",
|
|
31925
|
+
...this.#delegationBridge ? ["--patch", this.#delegationBridge.patchPath] : [],
|
|
31219
31926
|
"--no-open",
|
|
31220
31927
|
"--host",
|
|
31221
31928
|
"127.0.0.1",
|
|
@@ -31226,7 +31933,10 @@ var ModernRemoteConnection = class {
|
|
|
31226
31933
|
let child;
|
|
31227
31934
|
try {
|
|
31228
31935
|
child = this.#dependencies.spawn(invocation.command, invocation.arguments, {
|
|
31229
|
-
env: deepSeekEnvironment(this.#options.command,
|
|
31936
|
+
env: deepSeekEnvironment(this.#options.command, {
|
|
31937
|
+
...this.#environment,
|
|
31938
|
+
...this.#delegationBridge ? { [DELEGATION_BRIDGE_TOKEN]: this.#delegationBridge.token } : {}
|
|
31939
|
+
}),
|
|
31230
31940
|
stdio: "pipe",
|
|
31231
31941
|
windowsHide: true,
|
|
31232
31942
|
windowsVerbatimArguments: invocation.windowsVerbatimArguments,
|
|
@@ -31437,6 +32147,7 @@ var ModernRemoteConnection = class {
|
|
|
31437
32147
|
...socketClosures,
|
|
31438
32148
|
...connect ? [connect] : []
|
|
31439
32149
|
]);
|
|
32150
|
+
this.#processStopped = stopped?.status === "fulfilled";
|
|
31440
32151
|
const socketResults = remaining.slice(0, socketClosures.length);
|
|
31441
32152
|
this.#faultListeners.clear();
|
|
31442
32153
|
if (child) {
|
|
@@ -31448,6 +32159,8 @@ var ModernRemoteConnection = class {
|
|
|
31448
32159
|
this.#launchUrl = void 0;
|
|
31449
32160
|
this.#origin = void 0;
|
|
31450
32161
|
this.#cookie = void 0;
|
|
32162
|
+
await this.#delegationBridge?.dispose();
|
|
32163
|
+
this.#delegationBridge = void 0;
|
|
31451
32164
|
if (stopped?.status === "rejected")
|
|
31452
32165
|
throw stopped.reason;
|
|
31453
32166
|
const socketFailure2 = socketResults.find((result) => result.status === "rejected");
|
|
@@ -32061,7 +32774,7 @@ function hasExactKeys4(value, keys) {
|
|
|
32061
32774
|
const actual = Reflect.ownKeys(value);
|
|
32062
32775
|
return actual.length === keys.length && keys.every((key) => Object.hasOwn(value, key));
|
|
32063
32776
|
}
|
|
32064
|
-
function
|
|
32777
|
+
function positiveInteger4(value, name, maximum = Number.MAX_SAFE_INTEGER) {
|
|
32065
32778
|
if (!Number.isSafeInteger(value) || value <= 0 || value > maximum) {
|
|
32066
32779
|
throw new TypeError(`${name} must be an integer from 1 through ${String(maximum)}`);
|
|
32067
32780
|
}
|
|
@@ -32317,11 +33030,11 @@ var ModernControlStore = class {
|
|
|
32317
33030
|
#readyResolve;
|
|
32318
33031
|
constructor(source, options = {}) {
|
|
32319
33032
|
this.#source = source;
|
|
32320
|
-
this.#maxSessions =
|
|
32321
|
-
this.#maxKeys =
|
|
32322
|
-
this.#maxWaiters =
|
|
32323
|
-
this.#waitTimeoutMs =
|
|
32324
|
-
this.#recoveryOpenTimeoutMs =
|
|
33033
|
+
this.#maxSessions = positiveInteger4(options.maxSessions ?? DEFAULT_MAX_SESSIONS, "maxSessions");
|
|
33034
|
+
this.#maxKeys = positiveInteger4(options.maxKeysPerSession ?? DEFAULT_MAX_KEYS_PER_SESSION, "maxKeysPerSession");
|
|
33035
|
+
this.#maxWaiters = positiveInteger4(options.maxWaiters ?? DEFAULT_MAX_WAITERS, "maxWaiters");
|
|
33036
|
+
this.#waitTimeoutMs = positiveInteger4(options.waitTimeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS, "waitTimeoutMs", MAX_TIMER_MILLISECONDS2);
|
|
33037
|
+
this.#recoveryOpenTimeoutMs = positiveInteger4(options.recoveryOpenTimeoutMs ?? this.#waitTimeoutMs, "recoveryOpenTimeoutMs", MAX_TIMER_MILLISECONDS2);
|
|
32325
33038
|
this.#onFault = options.onFault;
|
|
32326
33039
|
}
|
|
32327
33040
|
get fault() {
|
|
@@ -32450,7 +33163,7 @@ var ModernControlStore = class {
|
|
|
32450
33163
|
if (this.#waiters.size >= this.#maxWaiters) {
|
|
32451
33164
|
throw storeError("resourceLimit", "Control store waiter limit was exceeded");
|
|
32452
33165
|
}
|
|
32453
|
-
const timeoutMs =
|
|
33166
|
+
const timeoutMs = positiveInteger4(options.timeoutMs ?? this.#waitTimeoutMs, "timeoutMs", MAX_TIMER_MILLISECONDS2);
|
|
32454
33167
|
return new Promise((resolve, reject) => {
|
|
32455
33168
|
const waiter = {
|
|
32456
33169
|
sessionId,
|
|
@@ -33383,9 +34096,9 @@ var ModernEventGateway = class {
|
|
|
33383
34096
|
constructor(remote, options = {}) {
|
|
33384
34097
|
this.#remote = remote;
|
|
33385
34098
|
this.#options = {
|
|
33386
|
-
maxSinks:
|
|
33387
|
-
maxPendingEvents:
|
|
33388
|
-
maxRetiredEvents:
|
|
34099
|
+
maxSinks: positiveInteger5(options.maxSinks ?? DEFAULT_MAX_SINKS, "maxSinks"),
|
|
34100
|
+
maxPendingEvents: positiveInteger5(options.maxPendingEvents ?? DEFAULT_MAX_PENDING_EVENTS, "maxPendingEvents"),
|
|
34101
|
+
maxRetiredEvents: positiveInteger5(options.maxRetiredEvents ?? DEFAULT_MAX_RETIRED_EVENTS, "maxRetiredEvents"),
|
|
33389
34102
|
...options.onGenerationLost ? { onGenerationLost: options.onGenerationLost } : {},
|
|
33390
34103
|
...options.onFailureDeclared ? { onFailureDeclared: options.onFailureDeclared } : {},
|
|
33391
34104
|
...options.onFault ? { onFault: options.onFault } : {}
|
|
@@ -34244,7 +34957,7 @@ function boundedString3(value) {
|
|
|
34244
34957
|
function nonBlankString3(value) {
|
|
34245
34958
|
return boundedString3(value) && value.length > 0;
|
|
34246
34959
|
}
|
|
34247
|
-
function
|
|
34960
|
+
function positiveInteger5(value, name) {
|
|
34248
34961
|
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
34249
34962
|
throw new TypeError(`${name} must be a positive safe integer`);
|
|
34250
34963
|
}
|
|
@@ -34823,12 +35536,12 @@ function invalidInbox() {
|
|
|
34823
35536
|
}
|
|
34824
35537
|
|
|
34825
35538
|
// dist/modern/history.js
|
|
34826
|
-
import
|
|
35539
|
+
import path10 from "node:path";
|
|
34827
35540
|
import { isDeepStrictEqual as isDeepStrictEqual5 } from "node:util";
|
|
34828
35541
|
|
|
34829
35542
|
// ../../harness-adapter/dist/local-media-markdown.js
|
|
34830
35543
|
import { existsSync, statSync } from "node:fs";
|
|
34831
|
-
import
|
|
35544
|
+
import path9 from "node:path";
|
|
34832
35545
|
import { fileURLToPath } from "node:url";
|
|
34833
35546
|
var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
34834
35547
|
".aac",
|
|
@@ -35131,7 +35844,7 @@ function skipBlanks(text2, start) {
|
|
|
35131
35844
|
return index;
|
|
35132
35845
|
}
|
|
35133
35846
|
function mediaMarkdownImage(absolutePath) {
|
|
35134
|
-
const name =
|
|
35847
|
+
const name = path9.basename(absolutePath).replaceAll("]", "\\]");
|
|
35135
35848
|
return `})`;
|
|
35136
35849
|
}
|
|
35137
35850
|
function markdownDestination(absolutePath, bracketed) {
|
|
@@ -35150,11 +35863,11 @@ function resolveLocalMediaPath(raw, roots, exists = mediaFileExists) {
|
|
|
35150
35863
|
if (stripped === null)
|
|
35151
35864
|
return null;
|
|
35152
35865
|
if (isAbsoluteMediaPath(stripped)) {
|
|
35153
|
-
const absolute =
|
|
35866
|
+
const absolute = path9.resolve(stripped);
|
|
35154
35867
|
return hasMediaExtension(absolute) && exists(absolute) ? absolute : null;
|
|
35155
35868
|
}
|
|
35156
35869
|
for (const root of roots) {
|
|
35157
|
-
const absolute =
|
|
35870
|
+
const absolute = path9.resolve(root, stripped);
|
|
35158
35871
|
if (hasMediaExtension(absolute) && exists(absolute))
|
|
35159
35872
|
return absolute;
|
|
35160
35873
|
}
|
|
@@ -35173,10 +35886,10 @@ function stripFileUrl(value) {
|
|
|
35173
35886
|
}
|
|
35174
35887
|
}
|
|
35175
35888
|
function isAbsoluteMediaPath(value) {
|
|
35176
|
-
return
|
|
35889
|
+
return path9.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
|
|
35177
35890
|
}
|
|
35178
35891
|
function hasMediaExtension(value) {
|
|
35179
|
-
return MEDIA_EXTENSIONS.has(
|
|
35892
|
+
return MEDIA_EXTENSIONS.has(path9.extname(value).toLowerCase());
|
|
35180
35893
|
}
|
|
35181
35894
|
function mediaFileExists(absolutePath) {
|
|
35182
35895
|
try {
|
|
@@ -35371,7 +36084,7 @@ var ModernEventValidator = class {
|
|
|
35371
36084
|
switch (event.type) {
|
|
35372
36085
|
case "turn/start": {
|
|
35373
36086
|
exactKeys(data, ["turn"]);
|
|
35374
|
-
const turn =
|
|
36087
|
+
const turn = positiveInteger2(data.turn, "turn/start turn");
|
|
35375
36088
|
if (trace.openTurn !== null || turn !== trace.nextTurn) {
|
|
35376
36089
|
fail("Modern history has an invalid turn/start boundary");
|
|
35377
36090
|
}
|
|
@@ -35381,7 +36094,7 @@ var ModernEventValidator = class {
|
|
|
35381
36094
|
}
|
|
35382
36095
|
case "turn/end": {
|
|
35383
36096
|
exactKeys(data, ["turn", "reason"]);
|
|
35384
|
-
const turn =
|
|
36097
|
+
const turn = positiveInteger2(data.turn, "turn/end turn");
|
|
35385
36098
|
validateTurnReason(data.reason);
|
|
35386
36099
|
if (trace.openTurn !== turn || trace.openStep !== null) {
|
|
35387
36100
|
fail("Modern history has an invalid turn/end boundary");
|
|
@@ -36006,9 +36719,9 @@ function modernWorkingDirectory(current, event) {
|
|
|
36006
36719
|
return current;
|
|
36007
36720
|
}
|
|
36008
36721
|
const next = event.data.cwd;
|
|
36009
|
-
if (
|
|
36010
|
-
return
|
|
36011
|
-
return current === void 0 ? void 0 :
|
|
36722
|
+
if (path10.isAbsolute(next))
|
|
36723
|
+
return path10.resolve(next);
|
|
36724
|
+
return current === void 0 ? void 0 : path10.resolve(current, next);
|
|
36012
36725
|
}
|
|
36013
36726
|
function modernMediaRoots(workingDirectory, sessionDirectory) {
|
|
36014
36727
|
return [
|
|
@@ -36203,8 +36916,8 @@ function requireOpenStep(trace, data, label) {
|
|
|
36203
36916
|
}
|
|
36204
36917
|
function stepPosition(data, label) {
|
|
36205
36918
|
return {
|
|
36206
|
-
turn:
|
|
36207
|
-
step:
|
|
36919
|
+
turn: positiveInteger2(data.turn, `${label} turn`),
|
|
36920
|
+
step: positiveInteger2(data.step, `${label} step`)
|
|
36208
36921
|
};
|
|
36209
36922
|
}
|
|
36210
36923
|
function validateUserMessage(data, profile) {
|
|
@@ -36346,7 +37059,7 @@ function validateRequestContext(data) {
|
|
|
36346
37059
|
fail("Modern history request/context has an invalid Model route");
|
|
36347
37060
|
}
|
|
36348
37061
|
if (data.contextWindow !== void 0)
|
|
36349
|
-
|
|
37062
|
+
positiveInteger2(data.contextWindow, "contextWindow");
|
|
36350
37063
|
if (data.systemPromptUpdate !== void 0 && data.systemPromptUpdate !== "in-history")
|
|
36351
37064
|
fail("Modern history request/context systemPromptUpdate is malformed");
|
|
36352
37065
|
}
|
|
@@ -36444,7 +37157,7 @@ function validateCommandDone(data) {
|
|
|
36444
37157
|
}
|
|
36445
37158
|
function validateHookInvoked(data) {
|
|
36446
37159
|
requiredOptionalKeys(data, ["turn", "point", "dialect", "handlerId"], ["matcher"]);
|
|
36447
|
-
|
|
37160
|
+
positiveInteger2(data.turn, "hook/invoked turn");
|
|
36448
37161
|
requiredString(data.point, "hook/invoked point");
|
|
36449
37162
|
enumValue(data.dialect, ["claude-code", "codex"], "hook/invoked dialect");
|
|
36450
37163
|
requiredString(data.handlerId, "hook/invoked handlerId");
|
|
@@ -36454,7 +37167,7 @@ function validateHookInvoked(data) {
|
|
|
36454
37167
|
}
|
|
36455
37168
|
function validateHookResult(data) {
|
|
36456
37169
|
requiredOptionalKeys(data, ["turn", "point", "handlerId", "decision", "durationMs"], ["exitCode", "stderrSummary"]);
|
|
36457
|
-
|
|
37170
|
+
positiveInteger2(data.turn, "hook/result turn");
|
|
36458
37171
|
requiredString(data.point, "hook/result point");
|
|
36459
37172
|
requiredString(data.handlerId, "hook/result handlerId");
|
|
36460
37173
|
requiredString(data.decision, "hook/result decision");
|
|
@@ -36483,22 +37196,22 @@ function validateRetry(data) {
|
|
|
36483
37196
|
"failure"
|
|
36484
37197
|
], []);
|
|
36485
37198
|
requiredString(data.retryId, "llm/retry retryId");
|
|
36486
|
-
|
|
36487
|
-
|
|
37199
|
+
positiveInteger2(data.turn, "llm/retry turn");
|
|
37200
|
+
positiveInteger2(data.step, "llm/retry step");
|
|
36488
37201
|
requiredString(data.provider, "llm/retry provider");
|
|
36489
37202
|
requiredString(data.policyKey, "llm/retry policyKey");
|
|
36490
|
-
|
|
37203
|
+
positiveInteger2(data.retry, "llm/retry retry");
|
|
36491
37204
|
nonNegativeFiniteNumber(data.delayMs, "llm/retry delayMs");
|
|
36492
37205
|
if (mode === "normal")
|
|
36493
|
-
|
|
37206
|
+
positiveInteger2(data.maxRetries, "llm/retry maxRetries");
|
|
36494
37207
|
validateLlmFailure(data.failure, "llm/retry failure");
|
|
36495
37208
|
}
|
|
36496
37209
|
function validateRetryStarted(data) {
|
|
36497
37210
|
exactKeys(data, ["retryId", "turn", "step", "retry"]);
|
|
36498
37211
|
requiredString(data.retryId, "llm/retry-started retryId");
|
|
36499
|
-
|
|
36500
|
-
|
|
36501
|
-
|
|
37212
|
+
positiveInteger2(data.turn, "llm/retry-started turn");
|
|
37213
|
+
positiveInteger2(data.step, "llm/retry-started step");
|
|
37214
|
+
positiveInteger2(data.retry, "llm/retry-started retry");
|
|
36502
37215
|
}
|
|
36503
37216
|
function validateSessionTitle(data) {
|
|
36504
37217
|
exactKeys(data, ["title", "messageSeqs", "source"]);
|
|
@@ -36527,7 +37240,7 @@ function validateSessionTitleRequest(data) {
|
|
|
36527
37240
|
fail("Modern history session/title request message is malformed");
|
|
36528
37241
|
}
|
|
36529
37242
|
}
|
|
36530
|
-
|
|
37243
|
+
positiveInteger2(data.maxTokens, "session/title request maxTokens");
|
|
36531
37244
|
if (data.reasoningEffort !== void 0 && !nonBlankString(data.reasoningEffort)) {
|
|
36532
37245
|
fail("Modern history session/title request reasoningEffort is invalid");
|
|
36533
37246
|
}
|
|
@@ -36554,7 +37267,7 @@ function validateWorkflow(type, data) {
|
|
|
36554
37267
|
if (type === "tool-workflow/agent-start") {
|
|
36555
37268
|
requiredOptionalKeys(data, ["runId", "seq", "label", "childId"], ["phase"]);
|
|
36556
37269
|
requiredString(data.runId, "workflow runId");
|
|
36557
|
-
|
|
37270
|
+
positiveInteger2(data.seq, "workflow agent seq");
|
|
36558
37271
|
if (typeof data.label !== "string")
|
|
36559
37272
|
fail("Modern history workflow agent label is invalid");
|
|
36560
37273
|
requiredString(data.childId, "workflow childId");
|
|
@@ -36566,7 +37279,7 @@ function validateWorkflow(type, data) {
|
|
|
36566
37279
|
if (type === "tool-workflow/agent-end") {
|
|
36567
37280
|
exactKeys(data, ["runId", "seq", "outcome"]);
|
|
36568
37281
|
requiredString(data.runId, "workflow runId");
|
|
36569
|
-
|
|
37282
|
+
positiveInteger2(data.seq, "workflow agent seq");
|
|
36570
37283
|
enumValue(data.outcome, ["completed", "failed", "cancelled"], "workflow agent outcome");
|
|
36571
37284
|
return;
|
|
36572
37285
|
}
|
|
@@ -36632,7 +37345,7 @@ function validateCompaction(type, data) {
|
|
|
36632
37345
|
requiredOptionalKeys(data, ["compactionId", "turn"], type === "compaction/start" ? ["sourceCommandId"] : ["sourceCommandId", "error"]);
|
|
36633
37346
|
requiredString(data.compactionId, "compaction id");
|
|
36634
37347
|
if (data.turn !== null)
|
|
36635
|
-
|
|
37348
|
+
positiveInteger2(data.turn, "compaction turn");
|
|
36636
37349
|
if (data.sourceCommandId !== void 0)
|
|
36637
37350
|
requiredString(data.sourceCommandId, "compaction commandId");
|
|
36638
37351
|
if (data.error !== void 0 && typeof data.error !== "string") {
|
|
@@ -36661,7 +37374,7 @@ function validateCompaction(type, data) {
|
|
|
36661
37374
|
fail("Modern history compaction summary is malformed");
|
|
36662
37375
|
validateShadow(data);
|
|
36663
37376
|
if (data.maxTokens !== void 0)
|
|
36664
|
-
|
|
37377
|
+
positiveInteger2(data.maxTokens, "compaction maxTokens");
|
|
36665
37378
|
if (data.usage !== void 0)
|
|
36666
37379
|
validateUsage(data.usage);
|
|
36667
37380
|
if (data.rawOutput !== void 0 && !Array.isArray(data.rawOutput)) {
|
|
@@ -36765,7 +37478,7 @@ function validateSearchRequest(data) {
|
|
|
36765
37478
|
fail("Modern history search request body is malformed");
|
|
36766
37479
|
requiredOptionalKeys(data.body, ["model", "max_tokens", "messages", "tools"], ["thinking"]);
|
|
36767
37480
|
requiredString(data.body.model, "search request model");
|
|
36768
|
-
|
|
37481
|
+
positiveInteger2(data.body.max_tokens, "search request max_tokens");
|
|
36769
37482
|
if (!Array.isArray(data.body.messages) || !Array.isArray(data.body.tools)) {
|
|
36770
37483
|
fail("Modern history search request arrays are malformed");
|
|
36771
37484
|
}
|
|
@@ -36890,6 +37603,7 @@ var ModernHarnessSession = class {
|
|
|
36890
37603
|
#closing = false;
|
|
36891
37604
|
#nativeCloseTerminal;
|
|
36892
37605
|
#closedNotified = false;
|
|
37606
|
+
#closedNotificationFailed = false;
|
|
36893
37607
|
#faulted;
|
|
36894
37608
|
#faultMayHaveNativeWork = false;
|
|
36895
37609
|
#closeStopUnconfirmed = false;
|
|
@@ -37058,26 +37772,43 @@ var ModernHarnessSession = class {
|
|
|
37058
37772
|
}
|
|
37059
37773
|
}
|
|
37060
37774
|
close() {
|
|
37775
|
+
return this.#close(true);
|
|
37776
|
+
}
|
|
37777
|
+
/** Local teardown must drain before the Adapter can stop the managed process. */
|
|
37778
|
+
closeForAdapter() {
|
|
37779
|
+
return this.#close(false);
|
|
37780
|
+
}
|
|
37781
|
+
#close(waitForManagedStop) {
|
|
37061
37782
|
this.#localClosePromise ??= this.#performClose();
|
|
37062
37783
|
return this.#localClosePromise.then(() => {
|
|
37063
|
-
if (!this.#faultMayHaveNativeWork)
|
|
37784
|
+
if (!this.#faultMayHaveNativeWork) {
|
|
37064
37785
|
return;
|
|
37786
|
+
}
|
|
37065
37787
|
const processStop = this.#managedProcessStop?.();
|
|
37066
|
-
if (processStop)
|
|
37067
|
-
return processStop;
|
|
37788
|
+
if (processStop) {
|
|
37789
|
+
return waitForManagedStop ? processStop : void 0;
|
|
37790
|
+
}
|
|
37068
37791
|
throw new Error("DeepSeek Harness native execution stop was not confirmed before the Session fault");
|
|
37069
37792
|
}, (error62) => {
|
|
37070
|
-
if (this.#faulted || this.#closeStopUnconfirmed) {
|
|
37793
|
+
if (!this.#closedNotificationFailed && (this.#faulted || this.#closeStopUnconfirmed)) {
|
|
37071
37794
|
const processStop = this.#managedProcessStop?.();
|
|
37072
|
-
if (processStop)
|
|
37073
|
-
return processStop;
|
|
37795
|
+
if (processStop) {
|
|
37796
|
+
return waitForManagedStop ? processStop : void 0;
|
|
37797
|
+
}
|
|
37074
37798
|
}
|
|
37075
37799
|
throw error62;
|
|
37076
37800
|
});
|
|
37077
37801
|
}
|
|
37078
37802
|
/** Adapter-owned local teardown drain after fault; never waits on managed process exit. */
|
|
37079
37803
|
async waitForFaultCleanup() {
|
|
37080
|
-
|
|
37804
|
+
try {
|
|
37805
|
+
await this.#localClosePromise;
|
|
37806
|
+
} catch (error62) {
|
|
37807
|
+
if (!this.#closedNotificationFailed && (this.#faulted || this.#closeStopUnconfirmed)) {
|
|
37808
|
+
return;
|
|
37809
|
+
}
|
|
37810
|
+
throw error62;
|
|
37811
|
+
}
|
|
37081
37812
|
}
|
|
37082
37813
|
/** Adapter-owned transport/control fault convergence. */
|
|
37083
37814
|
fault(error62) {
|
|
@@ -38826,6 +39557,7 @@ ${question.detail}` : question.question;
|
|
|
38826
39557
|
this.#abortOperations();
|
|
38827
39558
|
this.#nativeCloseTerminal?.();
|
|
38828
39559
|
this.#localClosePromise ??= this.#performFault(failure2, acceptedPending);
|
|
39560
|
+
void this.#localClosePromise.catch(() => void 0);
|
|
38829
39561
|
}
|
|
38830
39562
|
async #performFault(failure2, acceptedPending) {
|
|
38831
39563
|
await this.#detachEvents().catch(() => void 0);
|
|
@@ -38880,7 +39612,7 @@ ${question.detail}` : question.question;
|
|
|
38880
39612
|
this.#emit({ type: "session.faulted", error: failure2 });
|
|
38881
39613
|
this.#channel.end();
|
|
38882
39614
|
await Promise.allSettled([this.#journal.close(), this.#pumpPromise]);
|
|
38883
|
-
this.#notifyClosed();
|
|
39615
|
+
await this.#notifyClosed();
|
|
38884
39616
|
}
|
|
38885
39617
|
async #performClose() {
|
|
38886
39618
|
this.#closing = true;
|
|
@@ -38923,7 +39655,11 @@ ${question.detail}` : question.question;
|
|
|
38923
39655
|
}
|
|
38924
39656
|
}
|
|
38925
39657
|
if (this.#faulted) {
|
|
38926
|
-
|
|
39658
|
+
try {
|
|
39659
|
+
await this.#performFault(this.#faulted, this.#acceptedPending(pendingAtClose));
|
|
39660
|
+
} catch (error62) {
|
|
39661
|
+
throw sessionCloseFailure(stopFailure, error62);
|
|
39662
|
+
}
|
|
38927
39663
|
throw stopFailure ?? new Error(this.#faulted.message);
|
|
38928
39664
|
}
|
|
38929
39665
|
if (!this.#closed) {
|
|
@@ -38986,7 +39722,11 @@ ${question.detail}` : question.question;
|
|
|
38986
39722
|
flushFailure = error62;
|
|
38987
39723
|
stopFailure ??= error62;
|
|
38988
39724
|
}
|
|
38989
|
-
|
|
39725
|
+
try {
|
|
39726
|
+
await this.#notifyClosed();
|
|
39727
|
+
} catch (error62) {
|
|
39728
|
+
throw sessionCloseFailure(stopFailure, error62);
|
|
39729
|
+
}
|
|
38990
39730
|
if (stopFailure) {
|
|
38991
39731
|
this.#closeStopUnconfirmed = !flushFailure;
|
|
38992
39732
|
throw stopFailure;
|
|
@@ -39033,13 +39773,16 @@ ${question.detail}` : question.question;
|
|
|
39033
39773
|
clearTimeout(pending.correlationTimer);
|
|
39034
39774
|
pending.correlationTimer = void 0;
|
|
39035
39775
|
}
|
|
39036
|
-
#notifyClosed() {
|
|
39037
|
-
if (this.#closedNotified)
|
|
39776
|
+
async #notifyClosed() {
|
|
39777
|
+
if (this.#closedNotified) {
|
|
39038
39778
|
return;
|
|
39779
|
+
}
|
|
39039
39780
|
this.#closedNotified = true;
|
|
39040
39781
|
try {
|
|
39041
|
-
this.#onClosed();
|
|
39042
|
-
} catch {
|
|
39782
|
+
await this.#onClosed();
|
|
39783
|
+
} catch (error62) {
|
|
39784
|
+
this.#closedNotificationFailed = true;
|
|
39785
|
+
throw error62;
|
|
39043
39786
|
}
|
|
39044
39787
|
}
|
|
39045
39788
|
#emit(event) {
|
|
@@ -39132,6 +39875,14 @@ function journalHistoryBytes(events, maximum) {
|
|
|
39132
39875
|
function journalEventBytes(event) {
|
|
39133
39876
|
return Buffer.byteLength(JSON.stringify(event), "utf8");
|
|
39134
39877
|
}
|
|
39878
|
+
function sessionCloseFailure(stopFailure, cleanupFailure) {
|
|
39879
|
+
if (stopFailure === void 0) {
|
|
39880
|
+
return cleanupFailure;
|
|
39881
|
+
}
|
|
39882
|
+
const stopMessage = stopFailure instanceof Error ? stopFailure.message : "Native stop or persistence failed";
|
|
39883
|
+
const cleanupMessage = cleanupFailure instanceof Error ? cleanupFailure.message : "Session cleanup failed";
|
|
39884
|
+
return new AggregateError([stopFailure, cleanupFailure], redactModernCredential(`DeepSeek Harness Session close failed: ${stopMessage}; ${cleanupMessage}`));
|
|
39885
|
+
}
|
|
39135
39886
|
function unavailableError(error62, message, retryable = true) {
|
|
39136
39887
|
const detail = error62 instanceof Error ? error62.message : String(error62);
|
|
39137
39888
|
return {
|
|
@@ -39377,7 +40128,7 @@ function safeTimerDelay(value, name) {
|
|
|
39377
40128
|
|
|
39378
40129
|
// dist/modern/session-list.js
|
|
39379
40130
|
import { Buffer as Buffer5 } from "node:buffer";
|
|
39380
|
-
import
|
|
40131
|
+
import path11 from "node:path";
|
|
39381
40132
|
var MAX_SESSION_LIST_BYTES = 32 * 1024 * 1024;
|
|
39382
40133
|
var MAX_SESSION_LIST_DEPTH = 64;
|
|
39383
40134
|
var MAX_SESSION_LIST_NODES = 2e5;
|
|
@@ -39497,7 +40248,7 @@ function parseSummary(value) {
|
|
|
39497
40248
|
};
|
|
39498
40249
|
}
|
|
39499
40250
|
function isCanonicalAbsoluteCwd(value) {
|
|
39500
|
-
return value !== void 0 && value.trim().length > 0 && !value.includes("\0") &&
|
|
40251
|
+
return value !== void 0 && value.trim().length > 0 && !value.includes("\0") && path11.isAbsolute(value) && path11.resolve(value) === value;
|
|
39501
40252
|
}
|
|
39502
40253
|
function parseModernSessionCandidates(value) {
|
|
39503
40254
|
assertBoundedJson4(value);
|
|
@@ -39579,8 +40330,11 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39579
40330
|
#dependencies;
|
|
39580
40331
|
#options;
|
|
39581
40332
|
#inflight = /* @__PURE__ */ new Set();
|
|
40333
|
+
#opening = /* @__PURE__ */ new Set();
|
|
40334
|
+
#openingCleanupFailures = [];
|
|
39582
40335
|
#sessionIds = /* @__PURE__ */ new Set();
|
|
39583
40336
|
#sessions = /* @__PURE__ */ new Set();
|
|
40337
|
+
#pendingRevocations = /* @__PURE__ */ new Set();
|
|
39584
40338
|
#removeConnectionFaultListener;
|
|
39585
40339
|
#lifetime = new AbortController();
|
|
39586
40340
|
#accepting = true;
|
|
@@ -39595,6 +40349,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39595
40349
|
#declaredEventFailure;
|
|
39596
40350
|
#faultNotified = false;
|
|
39597
40351
|
#normalClose = false;
|
|
40352
|
+
#processStopped = false;
|
|
39598
40353
|
#eventRecovery;
|
|
39599
40354
|
#eventReplacementUsed = false;
|
|
39600
40355
|
constructor(options, dependencies = {}) {
|
|
@@ -39602,7 +40357,8 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39602
40357
|
this.#profile = deepSeekModernProfile(options.version);
|
|
39603
40358
|
this.#dependencies = { ...DEFAULT_DEPENDENCIES2, ...dependencies };
|
|
39604
40359
|
const connectionOptions = {
|
|
39605
|
-
...options
|
|
40360
|
+
...options,
|
|
40361
|
+
delegationBridge: supportsDeepSeekDelegationBridge(options.version)
|
|
39606
40362
|
};
|
|
39607
40363
|
delete connectionOptions.version;
|
|
39608
40364
|
delete connectionOptions.onFault;
|
|
@@ -39633,7 +40389,9 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39633
40389
|
const rejected = validateOpen(input3);
|
|
39634
40390
|
if (rejected)
|
|
39635
40391
|
return Promise.resolve({ ok: false, error: rejected });
|
|
39636
|
-
|
|
40392
|
+
const opening = this.#open(input3).finally(() => this.#opening.delete(opening));
|
|
40393
|
+
this.#opening.add(opening);
|
|
40394
|
+
return this.#track(opening);
|
|
39637
40395
|
}
|
|
39638
40396
|
close() {
|
|
39639
40397
|
if (!this.#closePromise) {
|
|
@@ -39700,7 +40458,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39700
40458
|
let session;
|
|
39701
40459
|
let forkExpectation;
|
|
39702
40460
|
try {
|
|
39703
|
-
const cwd =
|
|
40461
|
+
const cwd = path12.resolve(input3.cwd);
|
|
39704
40462
|
let forkInput = input3.kind === "fork" ? parseModernForkInput(input3, this.#profile) : void 0;
|
|
39705
40463
|
const rollbackSourceSessionId = input3.kind === "rollbackLastTurn" ? modernSessionId(input3.sourceRef, "roll back") : void 0;
|
|
39706
40464
|
let rollbackPlan;
|
|
@@ -39762,8 +40520,13 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39762
40520
|
detachControl = this.#control.attach(sessionId);
|
|
39763
40521
|
this.#assertAccepting();
|
|
39764
40522
|
}
|
|
39765
|
-
if (!sessionId)
|
|
40523
|
+
if (!sessionId) {
|
|
39766
40524
|
throw new Error("unreachable Session open mode");
|
|
40525
|
+
}
|
|
40526
|
+
if (this.#pendingRevocations.has(sessionId)) {
|
|
40527
|
+
await this.#clearSessionEnvironment(sessionId);
|
|
40528
|
+
this.#assertAccepting();
|
|
40529
|
+
}
|
|
39767
40530
|
if (input3.kind === "create" || rollbackPlan?.kind === "create") {
|
|
39768
40531
|
await this.#createSession(sessionId, cwd, rollbackPlan?.kind === "create" ? rollbackPlan.agentPreset : void 0);
|
|
39769
40532
|
this.#assertAccepting();
|
|
@@ -39832,6 +40595,8 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39832
40595
|
retryable: false
|
|
39833
40596
|
});
|
|
39834
40597
|
}
|
|
40598
|
+
await this.#connection.setSessionEnvironment?.(sessionId, input3.environment);
|
|
40599
|
+
this.#assertAccepting();
|
|
39835
40600
|
const openedSession = new ModernHarnessSession({
|
|
39836
40601
|
remote: this.#connection,
|
|
39837
40602
|
journal,
|
|
@@ -39851,11 +40616,15 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39851
40616
|
...this.#options.recoveryOpenTimeoutMs === void 0 ? {} : { recoveryOpenTimeoutMs: this.#options.recoveryOpenTimeoutMs },
|
|
39852
40617
|
...this.#options.promptCorrelationGraceMs === void 0 ? {} : { promptCorrelationGraceMs: this.#options.promptCorrelationGraceMs },
|
|
39853
40618
|
...this.#options.acceptedCorrelationTimeoutMs === void 0 ? {} : { acceptedCorrelationTimeoutMs: this.#options.acceptedCorrelationTimeoutMs },
|
|
39854
|
-
onClosed: () => {
|
|
40619
|
+
onClosed: async () => {
|
|
39855
40620
|
detachControl?.();
|
|
39856
40621
|
detachControl = void 0;
|
|
39857
|
-
|
|
39858
|
-
|
|
40622
|
+
try {
|
|
40623
|
+
await this.#clearSessionEnvironment(sessionId);
|
|
40624
|
+
} finally {
|
|
40625
|
+
this.#sessions.delete(openedSession);
|
|
40626
|
+
this.#sessionIds.delete(sessionId);
|
|
40627
|
+
}
|
|
39859
40628
|
}
|
|
39860
40629
|
});
|
|
39861
40630
|
session = openedSession;
|
|
@@ -39873,24 +40642,45 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39873
40642
|
}
|
|
39874
40643
|
return { ok: true, value: openedSession };
|
|
39875
40644
|
} catch (error62) {
|
|
39876
|
-
|
|
40645
|
+
let cleanupFailure;
|
|
40646
|
+
const recordCleanupFailure = (closeError) => {
|
|
40647
|
+
cleanupFailure = toHarnessError(closeError, "unavailable");
|
|
40648
|
+
if (!this.#accepting) {
|
|
40649
|
+
this.#openingCleanupFailures.push(closeError);
|
|
40650
|
+
}
|
|
40651
|
+
};
|
|
40652
|
+
if (session) {
|
|
40653
|
+
await session.closeForAdapter().catch(recordCleanupFailure);
|
|
40654
|
+
}
|
|
39877
40655
|
await journal?.close().catch(() => void 0);
|
|
39878
|
-
|
|
39879
|
-
|
|
40656
|
+
if (!session && reservedSessionId) {
|
|
40657
|
+
await this.#clearSessionEnvironment(reservedSessionId).catch(recordCleanupFailure);
|
|
40658
|
+
detachControl?.();
|
|
39880
40659
|
this.#sessionIds.delete(reservedSessionId);
|
|
39881
|
-
|
|
40660
|
+
}
|
|
40661
|
+
let failure2 = toHarnessError(error62, "nativeFailure");
|
|
39882
40662
|
if (forkExpectation) {
|
|
39883
|
-
|
|
39884
|
-
|
|
39885
|
-
|
|
39886
|
-
|
|
40663
|
+
failure2 = { code: failure2.code, message: FORK_ORPHAN_MESSAGE, retryable: false };
|
|
40664
|
+
} else if (input3.kind === "fork") {
|
|
40665
|
+
failure2 = { ...failure2, retryable: false };
|
|
40666
|
+
}
|
|
40667
|
+
if (cleanupFailure) {
|
|
40668
|
+
failure2 = sanitizedHarnessError2({
|
|
40669
|
+
...failure2,
|
|
40670
|
+
message: `${failure2.message}; Session cleanup was not confirmed: ${cleanupFailure.message}`
|
|
40671
|
+
});
|
|
39887
40672
|
}
|
|
39888
40673
|
return {
|
|
39889
40674
|
ok: false,
|
|
39890
|
-
error:
|
|
40675
|
+
error: failure2
|
|
39891
40676
|
};
|
|
39892
40677
|
}
|
|
39893
40678
|
}
|
|
40679
|
+
async #clearSessionEnvironment(sessionId) {
|
|
40680
|
+
this.#pendingRevocations.add(sessionId);
|
|
40681
|
+
await this.#connection.setSessionEnvironment?.(sessionId);
|
|
40682
|
+
this.#pendingRevocations.delete(sessionId);
|
|
40683
|
+
}
|
|
39894
40684
|
async #openWebUi() {
|
|
39895
40685
|
if (!this.#accepting || !this.#connection.openWebUi) {
|
|
39896
40686
|
return { ok: false, error: this.#stoppedError() };
|
|
@@ -40129,7 +40919,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
40129
40919
|
return;
|
|
40130
40920
|
this.#faultNotified = true;
|
|
40131
40921
|
try {
|
|
40132
|
-
this.#options.onFault?.(error62);
|
|
40922
|
+
this.#options.onFault?.(error62, () => this.#retire());
|
|
40133
40923
|
} catch {
|
|
40134
40924
|
}
|
|
40135
40925
|
}
|
|
@@ -40190,17 +40980,30 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
40190
40980
|
}
|
|
40191
40981
|
return this.#closePromise;
|
|
40192
40982
|
}
|
|
40983
|
+
async #retire() {
|
|
40984
|
+
try {
|
|
40985
|
+
await this.close();
|
|
40986
|
+
} catch (error62) {
|
|
40987
|
+
if (!this.#processStopped) {
|
|
40988
|
+
throw error62;
|
|
40989
|
+
}
|
|
40990
|
+
}
|
|
40991
|
+
}
|
|
40193
40992
|
async #stopAfterFault(failure2) {
|
|
40194
40993
|
this.#lifetime.abort(new Error("DeepSeek Harness Adapter closed"));
|
|
40195
40994
|
this.#removeConnectionFaultListener();
|
|
40196
40995
|
const sessions = [...this.#sessions];
|
|
40197
|
-
await Promise.allSettled(sessions.map((session) => {
|
|
40996
|
+
const sessionResults = await Promise.allSettled(sessions.map((session) => {
|
|
40198
40997
|
session.fault(failure2);
|
|
40199
40998
|
return session.waitForFaultCleanup();
|
|
40200
40999
|
}));
|
|
40201
41000
|
await this.#events.close().catch(() => void 0);
|
|
40202
41001
|
await this.#control.close().catch(() => void 0);
|
|
40203
|
-
await this.#
|
|
41002
|
+
await Promise.allSettled([...this.#opening]);
|
|
41003
|
+
const revocationResults = await Promise.allSettled([...this.#pendingRevocations].map((sessionId) => this.#clearSessionEnvironment(sessionId)));
|
|
41004
|
+
const [connectionResult] = await Promise.allSettled([this.#connection.close()]);
|
|
41005
|
+
this.#processStopped = connectionResult.status === "fulfilled" || this.#connection.processStopped === true;
|
|
41006
|
+
throwCleanupFailures([...sessionResults, ...revocationResults, connectionResult], this.#openingCleanupFailures);
|
|
40204
41007
|
}
|
|
40205
41008
|
async #performNormalClose() {
|
|
40206
41009
|
this.#lifetime.abort(new Error("DeepSeek Harness Adapter closed"));
|
|
@@ -40209,15 +41012,28 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
40209
41012
|
const sessionResults = await Promise.allSettled(sessions.map((session) => session.close()));
|
|
40210
41013
|
await this.#events.close().catch(() => void 0);
|
|
40211
41014
|
await this.#control.close().catch(() => void 0);
|
|
41015
|
+
await Promise.allSettled([...this.#opening]);
|
|
41016
|
+
const revocationResults = await Promise.allSettled([...this.#pendingRevocations].map((sessionId) => this.#clearSessionEnvironment(sessionId)));
|
|
40212
41017
|
const [connectionResult] = await Promise.allSettled([this.#connection.close()]);
|
|
41018
|
+
this.#processStopped = connectionResult.status === "fulfilled" || this.#connection.processStopped === true;
|
|
40213
41019
|
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;
|
|
41020
|
+
throwCleanupFailures([...sessionResults, ...revocationResults, connectionResult], this.#openingCleanupFailures);
|
|
40219
41021
|
}
|
|
40220
41022
|
};
|
|
41023
|
+
function throwCleanupFailures(results, openingFailures) {
|
|
41024
|
+
const failures = [
|
|
41025
|
+
.../* @__PURE__ */ new Set([
|
|
41026
|
+
...results.flatMap((result) => result.status === "rejected" ? [result.reason] : []),
|
|
41027
|
+
...openingFailures
|
|
41028
|
+
])
|
|
41029
|
+
];
|
|
41030
|
+
if (failures.length === 1) {
|
|
41031
|
+
throw failures[0];
|
|
41032
|
+
}
|
|
41033
|
+
if (failures.length > 1) {
|
|
41034
|
+
throw new AggregateError(failures, redactModernCredential(`DeepSeek Harness cleanup failed: ${failures.map((error62) => error62 instanceof Error ? error62.message : "Cleanup failed").join("; ")}`));
|
|
41035
|
+
}
|
|
41036
|
+
}
|
|
40221
41037
|
var AdapterOperationError = class extends Error {
|
|
40222
41038
|
harnessError;
|
|
40223
41039
|
constructor(harnessError) {
|
|
@@ -40492,11 +41308,11 @@ function toHarnessError(error62, fallback) {
|
|
|
40492
41308
|
if (error62 instanceof ModernConfigurationError) {
|
|
40493
41309
|
return sanitizedHarnessError2(modernConfigurationHarnessError(error62));
|
|
40494
41310
|
}
|
|
40495
|
-
return {
|
|
41311
|
+
return sanitizedHarnessError2({
|
|
40496
41312
|
code: fallback,
|
|
40497
|
-
message: "DeepSeek Harness operation failed",
|
|
41313
|
+
message: error62 instanceof AggregateError ? error62.message : "DeepSeek Harness operation failed",
|
|
40498
41314
|
retryable: fallback === "unavailable" || fallback === "nativeFailure"
|
|
40499
|
-
};
|
|
41315
|
+
});
|
|
40500
41316
|
}
|
|
40501
41317
|
function sanitizedHarnessError2(error62) {
|
|
40502
41318
|
return {
|
|
@@ -40775,7 +41591,7 @@ var DeepSeekHarnessAdapter = class {
|
|
|
40775
41591
|
version: executable.version,
|
|
40776
41592
|
command: executable.command.command,
|
|
40777
41593
|
commandArguments: executable.command.arguments,
|
|
40778
|
-
onFault: (error62) => this.#handleDelegateFault(owner, error62)
|
|
41594
|
+
onFault: (error62, retire) => this.#handleDelegateFault(owner, error62, retire)
|
|
40779
41595
|
});
|
|
40780
41596
|
const owner = {
|
|
40781
41597
|
adapter,
|
|
@@ -40799,14 +41615,17 @@ var DeepSeekHarnessAdapter = class {
|
|
|
40799
41615
|
throw cleanupFailure ?? error62;
|
|
40800
41616
|
}
|
|
40801
41617
|
}
|
|
40802
|
-
#handleDelegateFault(owner, error62) {
|
|
41618
|
+
#handleDelegateFault(owner, error62, retire) {
|
|
40803
41619
|
owner.faultError ??= error62;
|
|
41620
|
+
if (retire) {
|
|
41621
|
+
owner.retire ??= retire;
|
|
41622
|
+
}
|
|
40804
41623
|
if (this.#closed || this.#delegate !== owner)
|
|
40805
41624
|
return;
|
|
40806
41625
|
this.#delegate = void 0;
|
|
40807
41626
|
this.#failure = void 0;
|
|
40808
41627
|
const previous = this.#retiring ?? Promise.resolve();
|
|
40809
|
-
const retiring = previous.then(() => this.#
|
|
41628
|
+
const retiring = previous.then(() => this.#closeForReplacement(owner).catch(() => {
|
|
40810
41629
|
this.#recordCleanupFailure();
|
|
40811
41630
|
})).finally(() => {
|
|
40812
41631
|
if (this.#retiring === retiring)
|
|
@@ -40851,9 +41670,20 @@ var DeepSeekHarnessAdapter = class {
|
|
|
40851
41670
|
owner.closePromise ??= owner.adapter.close();
|
|
40852
41671
|
return owner.closePromise;
|
|
40853
41672
|
}
|
|
40854
|
-
async #
|
|
41673
|
+
async #closeForReplacement(owner) {
|
|
40855
41674
|
try {
|
|
40856
41675
|
await this.#closeOwner(owner);
|
|
41676
|
+
} catch (error62) {
|
|
41677
|
+
this.#cleanupFailed = true;
|
|
41678
|
+
if (!owner.retire) {
|
|
41679
|
+
throw error62;
|
|
41680
|
+
}
|
|
41681
|
+
await owner.retire();
|
|
41682
|
+
}
|
|
41683
|
+
}
|
|
41684
|
+
async #closeFailedCandidate(owner) {
|
|
41685
|
+
try {
|
|
41686
|
+
await this.#closeForReplacement(owner);
|
|
40857
41687
|
} catch {
|
|
40858
41688
|
return this.#recordCleanupFailure();
|
|
40859
41689
|
} finally {
|
|
@@ -40973,8 +41803,8 @@ function closedError2() {
|
|
|
40973
41803
|
|
|
40974
41804
|
// dist/installation.js
|
|
40975
41805
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
40976
|
-
import { mkdir, rename, rm as
|
|
40977
|
-
import
|
|
41806
|
+
import { mkdir, rename, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
|
|
41807
|
+
import path13 from "node:path";
|
|
40978
41808
|
function createDeepSeekInstallation(environment, command) {
|
|
40979
41809
|
let update;
|
|
40980
41810
|
return createInstallationManager({
|
|
@@ -40998,13 +41828,13 @@ function createDeepSeekInstallation(environment, command) {
|
|
|
40998
41828
|
throw new Error("DSH offline npx launch still selects a different version");
|
|
40999
41829
|
const destination = deepSeekNpxVersionFile(environment);
|
|
41000
41830
|
const temporary = `${destination}.${randomUUID3()}.tmp`;
|
|
41001
|
-
await mkdir(
|
|
41831
|
+
await mkdir(path13.dirname(destination), { recursive: true, mode: 448 });
|
|
41002
41832
|
try {
|
|
41003
|
-
await
|
|
41833
|
+
await writeFile3(temporary, `${version2}
|
|
41004
41834
|
`, { flag: "wx", mode: 384 });
|
|
41005
41835
|
await rename(temporary, destination);
|
|
41006
41836
|
} finally {
|
|
41007
|
-
await
|
|
41837
|
+
await rm3(temporary, { force: true }).catch(() => void 0);
|
|
41008
41838
|
}
|
|
41009
41839
|
} : npm?.update;
|
|
41010
41840
|
const canUpdate = isNpx || (npm?.canUpdate ?? false);
|