@codexhost/cli-win32-x64 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +589 -30
- package/app/console-web.js +558 -30
- package/app/desktop-controller.mjs +883 -150
- package/app/host-runtime.mjs +8165 -3548
- package/app/plugins/antigravity/plugin.mjs +493 -55
- package/app/plugins/claude-code/assets/icon.svg +1 -1
- package/app/plugins/claude-code/manifest.json +1 -1
- package/app/plugins/claude-code/plugin.mjs +1106 -193
- package/app/plugins/codebuddy/plugin.mjs +465 -27
- package/app/plugins/codex-usage/plugin.mjs +367 -7
- package/app/plugins/copilot/assets/icon.svg +1 -1
- package/app/plugins/copilot/manifest.json +1 -1
- package/app/plugins/copilot/plugin.mjs +369 -9
- package/app/plugins/cursor-cli/plugin.mjs +367 -7
- package/app/plugins/deepseek-harness/assets/icon.svg +1 -1
- package/app/plugins/deepseek-harness/manifest.json +1 -1
- package/app/plugins/deepseek-harness/plugin.mjs +806 -148
- package/app/plugins/devin/assets/icon.svg +1 -1
- package/app/plugins/devin/manifest.json +1 -1
- package/app/plugins/devin/plugin.mjs +369 -8
- package/app/plugins/grok/plugin.mjs +367 -7
- package/app/plugins/hermes/plugin.mjs +367 -7
- package/app/plugins/kimi-code/plugin.mjs +367 -7
- package/app/plugins/kiro-cli/plugin.mjs +367 -7
- package/app/plugins/omp/assets/icon.svg +1 -1
- package/app/plugins/omp/plugin.mjs +393 -7
- package/app/plugins/opencode/plugin.mjs +371 -8
- package/app/plugins/pi/assets/icon.svg +1 -1
- package/app/plugins/pi/manifest.json +1 -1
- package/app/plugins/pi/plugin.mjs +395 -9
- package/app/plugins/qoder/assets/icon.svg +1 -1
- package/app/plugins/qoder/plugin.mjs +393 -7
- package/app/plugins/qoder-cn/assets/icon.svg +1 -1
- package/app/plugins/qoder-cn/plugin.mjs +393 -7
- package/app/plugins/qwen-code/assets/icon.svg +1 -1
- package/app/plugins/qwen-code/plugin.mjs +396 -7
- package/app/plugins/workbuddy/plugin.mjs +465 -27
- package/app/plugins/zcode/plugin.mjs +387 -14
- package/app/renderer-extension.js +581 -41
- package/app/web/assets/{abnfDiagram-XWFEHMT6-CnJyN70L.js → abnfDiagram-XWFEHMT6-VnfRaHM6.js} +1 -1
- package/app/web/assets/{architectureDiagram-CSQXQB3N-DH0ITYVE.js → architectureDiagram-CSQXQB3N-BA1ehtvi.js} +1 -1
- package/app/web/assets/{blockDiagram-BEDRHYPZ-WL3ZKoKg.js → blockDiagram-BEDRHYPZ-31BZSfd4.js} +1 -1
- package/app/web/assets/{c4Diagram-M2UUVUY5-XwSPKj5H.js → c4Diagram-M2UUVUY5-CNzGWc5k.js} +1 -1
- package/app/web/assets/{chunk-2Q5K7J3B-CKEzexjg.js → chunk-2Q5K7J3B-ahAIR-NM.js} +1 -1
- package/app/web/assets/{chunk-3GCGMST5-BdEgLpab.js → chunk-3GCGMST5-BIV5YeRJ.js} +1 -1
- package/app/web/assets/{chunk-5VM5RSS4-DyxL5-Ts.js → chunk-5VM5RSS4-CluTMPJG.js} +1 -1
- package/app/web/assets/{chunk-7U7NFRK5-FXLb4tYa.js → chunk-7U7NFRK5-4NIQuFbE.js} +1 -1
- package/app/web/assets/{chunk-CNRTWJTD-DcdC1OYr.js → chunk-CNRTWJTD-_0bEfGn3.js} +1 -1
- package/app/web/assets/{chunk-D5HYT7QG-BOz9vBX9.js → chunk-D5HYT7QG-_kTC6f8F.js} +1 -1
- package/app/web/assets/{chunk-EBZ3SEQC-Dmc_Z53x.js → chunk-EBZ3SEQC-CykaYOrL.js} +2 -2
- package/app/web/assets/{chunk-JWPE2WC7-CrFwSwYi.js → chunk-JWPE2WC7-3vVOQ_py.js} +1 -1
- package/app/web/assets/{chunk-KTR4FSNJ-BY3AzFaI.js → chunk-KTR4FSNJ-aVg5vgrm.js} +1 -1
- package/app/web/assets/{chunk-XXDRQBXY-CHgNy82n.js → chunk-XXDRQBXY-_gVwGeSp.js} +1 -1
- package/app/web/assets/{classDiagram-v2-KXABOMEV-ClM3-y5Z.js → classDiagram-v2-KXABOMEV-fI1LfeBf.js} +1 -1
- package/app/web/assets/{cose-bilkent-JH36ORCC-I7nd8GgO.js → cose-bilkent-JH36ORCC-DFXMlWov.js} +1 -1
- package/app/web/assets/{cynefin-EF2NZ3EQ-DzsXmyBH.js → cynefin-EF2NZ3EQ-lZy7X6FO.js} +1 -1
- package/app/web/assets/{cynefinDiagram-NJNITYFG-DLHq6igy.js → cynefinDiagram-NJNITYFG-N4DwFSW1.js} +1 -1
- package/app/web/assets/{dagre-KIHZ2IZ3-BK991Mno.js → dagre-KIHZ2IZ3-B7-8baTH.js} +1 -1
- package/app/web/assets/{diagram-7YQZDPLS-C4qiWdQU.js → diagram-7YQZDPLS-DLfjiBXV.js} +1 -1
- package/app/web/assets/{diagram-QBROCOUO-C_ZyBohC.js → diagram-QBROCOUO-CQnRzSTi.js} +1 -1
- package/app/web/assets/{diagram-RJJCUUZO-C5Aezm94.js → diagram-RJJCUUZO-DPnxazRT.js} +1 -1
- package/app/web/assets/{diagram-WERXNKYE-Ckc_umlF.js → diagram-WERXNKYE-BBuEFRvD.js} +1 -1
- package/app/web/assets/{diagram-YHHI257C-BHjReoZZ.js → diagram-YHHI257C-BQ92JNJs.js} +1 -1
- package/app/web/assets/{diagram-YR4HJLHV-DVTGi_y9.js → diagram-YR4HJLHV-Ce6BQO3J.js} +1 -1
- package/app/web/assets/{ebnfDiagram-N527522P-getuz1AR.js → ebnfDiagram-N527522P-DYknE2Jy.js} +1 -1
- package/app/web/assets/{elk-O5DQBFGD-C7mhTIuK.js → elk-O5DQBFGD-4S6_JJFF.js} +1 -1
- package/app/web/assets/{erDiagram-K3K3BIDK-sV-HZvUV.js → erDiagram-K3K3BIDK-DRtF7JVQ.js} +1 -1
- package/app/web/assets/{flowDiagram-Z6JWZHQI-D0L4wXUs.js → flowDiagram-Z6JWZHQI-7Ho8CyR9.js} +1 -1
- package/app/web/assets/{ganttDiagram-3PRQTZWP-BNt9Bjjo.js → ganttDiagram-3PRQTZWP-CW8Ig5y4.js} +1 -1
- package/app/web/assets/{gitGraphDiagram-VXDFKS5L-BABZzhHw.js → gitGraphDiagram-VXDFKS5L-CzS8Xg2D.js} +1 -1
- package/app/web/assets/{grid-E2QIVN74-DLe2FQ_d.js → grid-E2QIVN74-Cq284lCe.js} +1 -1
- package/app/web/assets/index-CINZ6P-q.css +1 -0
- package/app/web/assets/index-CvV6veuY.js +208 -0
- package/app/web/assets/{infoDiagram-EZ3ZOAHP-BKDuUqcr.js → infoDiagram-EZ3ZOAHP-BZgN6qlY.js} +1 -1
- package/app/web/assets/{ishikawaDiagram-S3EKX5GW-C75EGghg.js → ishikawaDiagram-S3EKX5GW-BH9YHc-1.js} +1 -1
- package/app/web/assets/{journeyDiagram-POQNLL5X-q7Obruqa.js → journeyDiagram-POQNLL5X-D50KYOLe.js} +1 -1
- package/app/web/assets/{kanban-definition-BH5XI6FM-CzAqhFED.js → kanban-definition-BH5XI6FM-Crw_5mMP.js} +1 -1
- package/app/web/assets/langs/{graphql-D6Z3qcRW.js → graphql-2R4AZ1iu.js} +1 -1
- package/app/web/assets/langs/{http-XiU9G9In.js → http-q2Qm0vBh.js} +1 -1
- package/app/web/assets/langs/{php-DL3xwS-7.js → php-Cz2gDBnd.js} +1 -1
- package/app/web/assets/langs/{rst-DudRVJ9g.js → rst-_9muvx-X.js} +1 -1
- package/app/web/assets/langs/{ruby-_FqsfqJi.js → ruby-cn7REk4H.js} +1 -1
- package/app/web/assets/langs/{svelte-ClsVJoBT.js → svelte-CPnL2mcy.js} +1 -1
- package/app/web/assets/langs/{vue-BiKMXCyK.js → vue-DO0YwyVz.js} +1 -1
- package/app/web/assets/{mermaid.core-Bysx44LR.js → mermaid.core-o2Qjrppc.js} +5 -5
- package/app/web/assets/{mindmap-definition-WVAN44T4-Ds5rXTrF.js → mindmap-definition-WVAN44T4-B_bEbpAH.js} +1 -1
- package/app/web/assets/{pegDiagram-D4NLKWP3-hmdERwtT.js → pegDiagram-D4NLKWP3-VecAHoyw.js} +1 -1
- package/app/web/assets/{pieDiagram-36ENHN4W-DfTnyG8D.js → pieDiagram-36ENHN4W-o3ei2T-6.js} +1 -1
- package/app/web/assets/{quadrantDiagram-ZQUDMS73-CreQWjZQ.js → quadrantDiagram-ZQUDMS73-DHndOAcn.js} +1 -1
- package/app/web/assets/{railroadDiagram-JIZHGYPL-Bhc_eO9G.js → railroadDiagram-JIZHGYPL-DRd_lfii.js} +1 -1
- package/app/web/assets/{render-VIF2ZAQL-BS1Zgk8K.js → render-VIF2ZAQL-awM3hUqB.js} +2 -2
- package/app/web/assets/{requirementDiagram-AXW2TVFA-Dlp7d6QT.js → requirementDiagram-AXW2TVFA-Ce1ePsOe.js} +1 -1
- package/app/web/assets/{sankeyDiagram-FBCJTAIF-DGBchL30.js → sankeyDiagram-FBCJTAIF-cP-LtgW-.js} +1 -1
- package/app/web/assets/{sequenceDiagram-3LA2ROMG-DauFg5_R.js → sequenceDiagram-3LA2ROMG-C3JStTuW.js} +1 -1
- package/app/web/assets/{sizeCapture-2Q2CQKSF-DR-zy7an.js → sizeCapture-2Q2CQKSF-Dyyelr9K.js} +1 -1
- package/app/web/assets/{stateDiagram-v2-ATKHQDJO-BSRBSGUi.js → stateDiagram-v2-ATKHQDJO-DkYRBVTd.js} +1 -1
- package/app/web/assets/{swimlanes-YQL5WMAO-BwzOr5Dv.js → swimlanes-YQL5WMAO-B2FwJU5_.js} +1 -1
- package/app/web/assets/swimlanesDiagram-UCCPES4V-BkMsxCPb.js +8 -0
- package/app/web/assets/{timeline-definition-7Z437IG3-BoZ-mNKc.js → timeline-definition-7Z437IG3-Di-qRIIi.js} +1 -1
- package/app/web/assets/{usecaseDiagram-RDK6N6HP-DikhgH2m.js → usecaseDiagram-RDK6N6HP-yAImn62t.js} +1 -1
- package/app/web/assets/{vendor-BKfNgqAm.js → vendor-BMCjWFMy.js} +20 -20
- package/app/web/assets/{vennDiagram-SHRQU5PJ-DY_oIxwl.js → vennDiagram-SHRQU5PJ-BEv8jpfv.js} +1 -1
- package/app/web/assets/{wardleyDiagram-F3OXNVQS-DrRIiB_M.js → wardleyDiagram-F3OXNVQS-7irksA0b.js} +1 -1
- package/app/web/assets/{xychartDiagram-GDYJKCDI-CzSPgHV7.js → xychartDiagram-GDYJKCDI-BokJGG2y.js} +1 -1
- package/app/web/codex-agent.png +0 -0
- package/app/web/codex.png +0 -0
- package/app/web/codexhost-settings.js +66 -66
- 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-attachment/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +78 -73
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +92 -92
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +114 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +79 -79
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +70 -70
- package/app/web/role-avatars/builtin/architect-otter.webp +0 -0
- package/app/web/role-avatars/builtin/audio-otter.webp +0 -0
- package/app/web/role-avatars/builtin/backend-otter.webp +0 -0
- package/app/web/role-avatars/builtin/classic-otter.webp +0 -0
- package/app/web/role-avatars/builtin/data-otter.webp +0 -0
- package/app/web/role-avatars/builtin/debugger-otter.webp +0 -0
- package/app/web/role-avatars/builtin/frontend-otter.webp +0 -0
- package/app/web/role-avatars/builtin/idea-otter.webp +0 -0
- package/app/web/role-avatars/builtin/ops-otter.webp +0 -0
- package/app/web/role-avatars/builtin/pm-otter.webp +0 -0
- package/app/web/role-avatars/builtin/researcher-otter.webp +0 -0
- package/app/web/role-avatars/builtin/reviewer-otter.webp +0 -0
- package/app/web/role-avatars/builtin/scholar-otter.webp +0 -0
- package/app/web/role-avatars/builtin/security-otter.webp +0 -0
- package/app/web/role-avatars/builtin/tester-otter.webp +0 -0
- package/app/web/role-avatars/builtin/writer-otter.webp +0 -0
- package/app/web-modules/node_modules/@deepseek-ai/dsh-host-webserver/index.js +7 -1
- package/app/web-modules/server.mjs +1324 -252
- 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-BLmkBEoq.js +0 -205
- package/app/web/assets/index-Dwdnvinl.css +0 -1
- package/app/web/assets/swimlanesDiagram-UCCPES4V-CNV63-us.js +0 -8
|
@@ -2278,7 +2278,7 @@ var require_websocket = __commonJS({
|
|
|
2278
2278
|
var http = __require("http");
|
|
2279
2279
|
var net = __require("net");
|
|
2280
2280
|
var tls = __require("tls");
|
|
2281
|
-
var { randomBytes, createHash: createHash2 } = __require("crypto");
|
|
2281
|
+
var { randomBytes: randomBytes2, createHash: createHash2 } = __require("crypto");
|
|
2282
2282
|
var { Duplex, Readable } = __require("stream");
|
|
2283
2283
|
var { URL: URL2 } = __require("url");
|
|
2284
2284
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -2816,7 +2816,7 @@ var require_websocket = __commonJS({
|
|
|
2816
2816
|
}
|
|
2817
2817
|
}
|
|
2818
2818
|
const defaultPort = isSecure ? 443 : 80;
|
|
2819
|
-
const key =
|
|
2819
|
+
const key = randomBytes2(16).toString("base64");
|
|
2820
2820
|
const request = isSecure ? https.request : http.request;
|
|
2821
2821
|
const protocolSet = /* @__PURE__ */ new Set();
|
|
2822
2822
|
let perMessageDeflate;
|
|
@@ -5038,10 +5038,10 @@ function mergeDefs(...defs) {
|
|
|
5038
5038
|
function cloneDef(schema) {
|
|
5039
5039
|
return mergeDefs(schema._zod.def);
|
|
5040
5040
|
}
|
|
5041
|
-
function getElementAtPath(obj,
|
|
5042
|
-
if (!
|
|
5041
|
+
function getElementAtPath(obj, path14) {
|
|
5042
|
+
if (!path14)
|
|
5043
5043
|
return obj;
|
|
5044
|
-
return
|
|
5044
|
+
return path14.reduce((acc, key) => acc?.[key], obj);
|
|
5045
5045
|
}
|
|
5046
5046
|
function promiseAllObject(promisesObj) {
|
|
5047
5047
|
const keys = Object.keys(promisesObj);
|
|
@@ -5381,11 +5381,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
5381
5381
|
}
|
|
5382
5382
|
return false;
|
|
5383
5383
|
}
|
|
5384
|
-
function prefixIssues(
|
|
5384
|
+
function prefixIssues(path14, issues) {
|
|
5385
5385
|
return issues.map((iss) => {
|
|
5386
5386
|
var _a3;
|
|
5387
5387
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
5388
|
-
iss.path.unshift(
|
|
5388
|
+
iss.path.unshift(path14);
|
|
5389
5389
|
return iss;
|
|
5390
5390
|
});
|
|
5391
5391
|
}
|
|
@@ -5847,16 +5847,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
5847
5847
|
}
|
|
5848
5848
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
5849
5849
|
const fieldErrors = { _errors: [] };
|
|
5850
|
-
const processError = (error63,
|
|
5850
|
+
const processError = (error63, path14 = []) => {
|
|
5851
5851
|
for (const issue2 of error63.issues) {
|
|
5852
5852
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5853
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5853
|
+
issue2.errors.map((issues) => processError({ issues }, [...path14, ...issue2.path]));
|
|
5854
5854
|
} else if (issue2.code === "invalid_key") {
|
|
5855
|
-
processError({ issues: issue2.issues }, [...
|
|
5855
|
+
processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
|
|
5856
5856
|
} else if (issue2.code === "invalid_element") {
|
|
5857
|
-
processError({ issues: issue2.issues }, [...
|
|
5857
|
+
processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
|
|
5858
5858
|
} else {
|
|
5859
|
-
const fullpath = [...
|
|
5859
|
+
const fullpath = [...path14, ...issue2.path];
|
|
5860
5860
|
if (fullpath.length === 0) {
|
|
5861
5861
|
fieldErrors._errors.push(mapper(issue2));
|
|
5862
5862
|
} else {
|
|
@@ -5895,17 +5895,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
5895
5895
|
}
|
|
5896
5896
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
5897
5897
|
const result = { errors: [] };
|
|
5898
|
-
const processError = (error63,
|
|
5898
|
+
const processError = (error63, path14 = []) => {
|
|
5899
5899
|
var _a3;
|
|
5900
5900
|
for (const issue2 of error63.issues) {
|
|
5901
5901
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5902
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5902
|
+
issue2.errors.map((issues) => processError({ issues }, [...path14, ...issue2.path]));
|
|
5903
5903
|
} else if (issue2.code === "invalid_key") {
|
|
5904
|
-
processError({ issues: issue2.issues }, [...
|
|
5904
|
+
processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
|
|
5905
5905
|
} else if (issue2.code === "invalid_element") {
|
|
5906
|
-
processError({ issues: issue2.issues }, [...
|
|
5906
|
+
processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
|
|
5907
5907
|
} else {
|
|
5908
|
-
const fullpath = [...
|
|
5908
|
+
const fullpath = [...path14, ...issue2.path];
|
|
5909
5909
|
if (fullpath.length === 0) {
|
|
5910
5910
|
result.errors.push(mapper(issue2));
|
|
5911
5911
|
continue;
|
|
@@ -5944,8 +5944,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
5944
5944
|
}
|
|
5945
5945
|
function toDotPath(_path) {
|
|
5946
5946
|
const segs = [];
|
|
5947
|
-
const
|
|
5948
|
-
for (const seg of
|
|
5947
|
+
const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
5948
|
+
for (const seg of path14) {
|
|
5949
5949
|
if (typeof seg === "number")
|
|
5950
5950
|
segs.push(`[${seg}]`);
|
|
5951
5951
|
else if (typeof seg === "symbol")
|
|
@@ -23083,13 +23083,13 @@ function resolveRef(ref, ctx) {
|
|
|
23083
23083
|
if (!ref.startsWith("#")) {
|
|
23084
23084
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
23085
23085
|
}
|
|
23086
|
-
const
|
|
23087
|
-
if (
|
|
23086
|
+
const path14 = ref.slice(1).split("/").filter(Boolean);
|
|
23087
|
+
if (path14.length === 0) {
|
|
23088
23088
|
return ctx.rootSchema;
|
|
23089
23089
|
}
|
|
23090
23090
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
23091
|
-
if (
|
|
23092
|
-
const key =
|
|
23091
|
+
if (path14[0] === defsKey) {
|
|
23092
|
+
const key = path14[1] === void 0 ? void 0 : decodeJSONPointerSegment(path14[1]);
|
|
23093
23093
|
if (!key || !ctx.defs[key]) {
|
|
23094
23094
|
throw new Error(`Reference not found: ${ref}`);
|
|
23095
23095
|
}
|
|
@@ -24025,6 +24025,8 @@ var harnessIdSchema = opaqueIdSchema.brand();
|
|
|
24025
24025
|
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
24026
24026
|
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
24027
24027
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
24028
|
+
var HARNESS_THINKING_OPTION_ID_MAX_LENGTH = 128;
|
|
24029
|
+
var harnessThinkingOptionIdSchema = opaqueIdSchema.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
|
|
24028
24030
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
24029
24031
|
|
|
24030
24032
|
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
@@ -24106,6 +24108,122 @@ var threadHandoffResultSchema = external_exports.object({
|
|
|
24106
24108
|
handoff: threadHandoffMetadataSchema
|
|
24107
24109
|
}).strict();
|
|
24108
24110
|
|
|
24111
|
+
// ../../shared-contracts/dist/agent-role.js
|
|
24112
|
+
var roleSlugSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/u);
|
|
24113
|
+
var roleModelSchema = external_exports.string().min(1).max(512).refine((value) => !new RegExp("\\p{Cc}", "u").test(value), "Role model must not contain control characters");
|
|
24114
|
+
var roleAccentColorSchema = external_exports.enum(["stone", "rose", "mist", "sage", "amber", "aqua"]);
|
|
24115
|
+
var BUILTIN_ROLE_AVATAR_IDS = [
|
|
24116
|
+
"pm-otter",
|
|
24117
|
+
"frontend-otter",
|
|
24118
|
+
"backend-otter",
|
|
24119
|
+
"reviewer-otter",
|
|
24120
|
+
"idea-otter",
|
|
24121
|
+
"researcher-otter",
|
|
24122
|
+
"writer-otter",
|
|
24123
|
+
"architect-otter",
|
|
24124
|
+
"debugger-otter",
|
|
24125
|
+
"tester-otter",
|
|
24126
|
+
"classic-otter",
|
|
24127
|
+
"ops-otter",
|
|
24128
|
+
"security-otter",
|
|
24129
|
+
"audio-otter",
|
|
24130
|
+
"scholar-otter",
|
|
24131
|
+
"data-otter"
|
|
24132
|
+
];
|
|
24133
|
+
var builtinRoleAvatarSchema = external_exports.templateLiteral([
|
|
24134
|
+
"builtin:",
|
|
24135
|
+
external_exports.enum(BUILTIN_ROLE_AVATAR_IDS)
|
|
24136
|
+
]);
|
|
24137
|
+
var ROLE_AVATAR_FILENAME_PATTERN = /^[a-zA-Z0-9_-]{1,64}\.(png|jpg|jpeg|webp)$/u;
|
|
24138
|
+
var customRoleAvatarSchema = external_exports.templateLiteral([
|
|
24139
|
+
"custom:",
|
|
24140
|
+
external_exports.string().regex(ROLE_AVATAR_FILENAME_PATTERN)
|
|
24141
|
+
]);
|
|
24142
|
+
var catalogRoleAvatarSchema = external_exports.templateLiteral([
|
|
24143
|
+
"catalog:",
|
|
24144
|
+
external_exports.string().regex(ROLE_AVATAR_FILENAME_PATTERN)
|
|
24145
|
+
]);
|
|
24146
|
+
var roleAvatarSchema = external_exports.union([builtinRoleAvatarSchema, customRoleAvatarSchema]);
|
|
24147
|
+
var roleCatalogAvatarSchema = external_exports.union([builtinRoleAvatarSchema, catalogRoleAvatarSchema]);
|
|
24148
|
+
var saveRoleAvatarSchema = external_exports.union([roleAvatarSchema, catalogRoleAvatarSchema]);
|
|
24149
|
+
var httpsUrlSchema = external_exports.string().url().max(2048).refine((value) => /^https:\/\//i.test(value), "URL must use https://");
|
|
24150
|
+
var localizedRoleTextSchema = external_exports.object({
|
|
24151
|
+
en: external_exports.string().trim().min(1).max(2e3),
|
|
24152
|
+
"zh-CN": external_exports.string().trim().min(1).max(2e3)
|
|
24153
|
+
});
|
|
24154
|
+
var roleCatalogEntrySchema = external_exports.object({
|
|
24155
|
+
slug: roleSlugSchema,
|
|
24156
|
+
name: localizedRoleTextSchema,
|
|
24157
|
+
description: localizedRoleTextSchema,
|
|
24158
|
+
avatar: roleCatalogAvatarSchema,
|
|
24159
|
+
accentColor: roleAccentColorSchema,
|
|
24160
|
+
recommendedHarnessId: harnessIdSchema.optional(),
|
|
24161
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
24162
|
+
authorUrl: httpsUrlSchema.optional(),
|
|
24163
|
+
sourceUrl: httpsUrlSchema.optional(),
|
|
24164
|
+
license: external_exports.string().trim().min(1).max(64).optional(),
|
|
24165
|
+
official: external_exports.boolean().optional(),
|
|
24166
|
+
instructions: external_exports.string().trim().min(1).max(1e5),
|
|
24167
|
+
updatedAt: external_exports.iso.datetime()
|
|
24168
|
+
});
|
|
24169
|
+
var roleCatalogDocumentSchema = external_exports.object({
|
|
24170
|
+
formatVersion: external_exports.literal(1),
|
|
24171
|
+
generatedAt: external_exports.iso.datetime(),
|
|
24172
|
+
roles: external_exports.array(roleCatalogEntrySchema)
|
|
24173
|
+
});
|
|
24174
|
+
var roleIdentitySchema = external_exports.object({
|
|
24175
|
+
slug: roleSlugSchema,
|
|
24176
|
+
name: external_exports.string().refine((name) => name.trim().length > 0),
|
|
24177
|
+
avatar: roleAvatarSchema,
|
|
24178
|
+
accentColor: roleAccentColorSchema
|
|
24179
|
+
});
|
|
24180
|
+
var threadRoleSnapshotSchema = roleIdentitySchema.readonly();
|
|
24181
|
+
var agentRoleSchema = roleIdentitySchema.extend({
|
|
24182
|
+
description: external_exports.string(),
|
|
24183
|
+
harnessId: harnessIdSchema,
|
|
24184
|
+
model: roleModelSchema.optional(),
|
|
24185
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
24186
|
+
instructions: external_exports.string(),
|
|
24187
|
+
updatedAt: external_exports.iso.datetime()
|
|
24188
|
+
});
|
|
24189
|
+
var saveAgentRoleInputSchema = agentRoleSchema.omit({ updatedAt: true, avatar: true }).extend({ avatar: saveRoleAvatarSchema }).partial({ slug: true });
|
|
24190
|
+
var ROLES_LIST_METHOD = "codexhost/roles/list";
|
|
24191
|
+
var ROLES_GET_METHOD = "codexhost/roles/get";
|
|
24192
|
+
var ROLES_SAVE_METHOD = "codexhost/roles/save";
|
|
24193
|
+
var ROLES_DELETE_METHOD = "codexhost/roles/delete";
|
|
24194
|
+
var ROLES_CATALOG_METHOD = "codexhost/roles/catalog";
|
|
24195
|
+
var ROLES_LIKE_METHOD = "codexhost/roles/like";
|
|
24196
|
+
var ROLE_LIKES_MAX_PER_ROLE = 5;
|
|
24197
|
+
var rolesListParamsSchema = external_exports.object({
|
|
24198
|
+
locale: external_exports.string().trim().min(1).max(64).optional()
|
|
24199
|
+
});
|
|
24200
|
+
var rolesListResultSchema = external_exports.object({ roles: external_exports.array(agentRoleSchema) });
|
|
24201
|
+
var rolesGetParamsSchema = external_exports.object({ slug: roleSlugSchema });
|
|
24202
|
+
var rolesGetResultSchema = external_exports.object({ role: agentRoleSchema.nullable() });
|
|
24203
|
+
var rolesSaveResultSchema = external_exports.object({ role: agentRoleSchema });
|
|
24204
|
+
var rolesDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
|
|
24205
|
+
var rolesCatalogParamsSchema = external_exports.object({
|
|
24206
|
+
refresh: external_exports.boolean().optional()
|
|
24207
|
+
});
|
|
24208
|
+
var rolesCatalogResultSchema = external_exports.object({
|
|
24209
|
+
roles: external_exports.array(roleCatalogEntrySchema),
|
|
24210
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
24211
|
+
likes: external_exports.record(roleSlugSchema, external_exports.number().int().nonnegative()).optional(),
|
|
24212
|
+
myLikes: external_exports.record(roleSlugSchema, external_exports.number().int().min(0).max(ROLE_LIKES_MAX_PER_ROLE)).optional(),
|
|
24213
|
+
stale: external_exports.boolean().optional(),
|
|
24214
|
+
error: external_exports.string().optional()
|
|
24215
|
+
});
|
|
24216
|
+
var rolesLikeParamsSchema = external_exports.object({
|
|
24217
|
+
slug: roleSlugSchema
|
|
24218
|
+
});
|
|
24219
|
+
var rolesLikeResultSchema = external_exports.object({
|
|
24220
|
+
slug: roleSlugSchema,
|
|
24221
|
+
likes: external_exports.number().int().nonnegative(),
|
|
24222
|
+
myLikes: external_exports.number().int().min(0).max(ROLE_LIKES_MAX_PER_ROLE),
|
|
24223
|
+
maxLikes: external_exports.literal(ROLE_LIKES_MAX_PER_ROLE),
|
|
24224
|
+
limitReached: external_exports.boolean().optional()
|
|
24225
|
+
});
|
|
24226
|
+
|
|
24109
24227
|
// ../../shared-contracts/dist/thread-usage.js
|
|
24110
24228
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
24111
24229
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -24287,7 +24405,6 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
24287
24405
|
// ../../shared-contracts/dist/harness-models.js
|
|
24288
24406
|
var HARNESS_MODEL_REF_MAX_LENGTH = 512;
|
|
24289
24407
|
var HARNESS_MODEL_LABEL_MAX_LENGTH = 256;
|
|
24290
|
-
var HARNESS_THINKING_OPTION_ID_MAX_LENGTH = 128;
|
|
24291
24408
|
var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
24292
24409
|
var nonBlankTextSchema3 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
24293
24410
|
message: "Value must not be empty or whitespace"
|
|
@@ -24301,7 +24418,6 @@ var harnessModelRefSchema = external_exports.object({
|
|
|
24301
24418
|
function sameHarnessModelRef(left, right) {
|
|
24302
24419
|
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
24303
24420
|
}
|
|
24304
|
-
var harnessThinkingOptionIdSchema = nonBlankTextSchema3.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
|
|
24305
24421
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema3.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
24306
24422
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
24307
24423
|
id: harnessThinkingOptionIdSchema,
|
|
@@ -24514,8 +24630,10 @@ var codexThreadInspectionSchema = external_exports.object({
|
|
|
24514
24630
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
24515
24631
|
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
24516
24632
|
supportsThreadReferences: external_exports.literal(true).optional(),
|
|
24517
|
-
handoff: threadHandoffMetadataSchema.optional()
|
|
24518
|
-
|
|
24633
|
+
handoff: threadHandoffMetadataSchema.optional(),
|
|
24634
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
24635
|
+
nativeSessionRef: external_exports.never().optional()
|
|
24636
|
+
});
|
|
24519
24637
|
var externalThreadInspectionSchema = external_exports.object({
|
|
24520
24638
|
owner: external_exports.literal("external"),
|
|
24521
24639
|
harnessId: nonBlankTextSchema3.max(256),
|
|
@@ -24530,8 +24648,10 @@ var externalThreadInspectionSchema = external_exports.object({
|
|
|
24530
24648
|
history: harnessHistoryCapabilitiesSchema,
|
|
24531
24649
|
usage: threadUsageSnapshotSchema.optional(),
|
|
24532
24650
|
handoff: threadHandoffMetadataSchema.optional(),
|
|
24651
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
24652
|
+
nativeSessionRef: external_exports.never().optional(),
|
|
24533
24653
|
locked: external_exports.literal(true)
|
|
24534
|
-
})
|
|
24654
|
+
});
|
|
24535
24655
|
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
24536
24656
|
codexThreadInspectionSchema,
|
|
24537
24657
|
externalThreadInspectionSchema
|
|
@@ -24774,7 +24894,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
|
|
|
24774
24894
|
default: external_exports.string().optional()
|
|
24775
24895
|
})
|
|
24776
24896
|
]).superRefine((field2, ctx) => {
|
|
24777
|
-
const issue2 = (
|
|
24897
|
+
const issue2 = (path14, message) => ctx.addIssue({ code: "custom", path: [path14], message });
|
|
24778
24898
|
if (field2.type === "number" || field2.type === "range") {
|
|
24779
24899
|
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
24780
24900
|
if (min > max)
|
|
@@ -24880,16 +25000,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
|
|
|
24880
25000
|
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
24881
25001
|
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
24882
25002
|
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
24883
|
-
var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((
|
|
25003
|
+
var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((path14) => path14.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
24884
25004
|
var legacy = desktopExtensionManifestSchema.shape;
|
|
24885
25005
|
var localized = (max, min = 0) => external_exports.strictObject({
|
|
24886
25006
|
en: external_exports.string().trim().min(min).max(max),
|
|
24887
25007
|
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
24888
25008
|
});
|
|
24889
|
-
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((
|
|
25009
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path14) => path14.endsWith(suffix), `Expected a ${suffix} file`);
|
|
24890
25010
|
var moduleEntry = resourceWithSuffix(".mjs");
|
|
24891
25011
|
var style = resourceWithSuffix(".css").optional();
|
|
24892
|
-
var hostExtensionCanonicalPath = (
|
|
25012
|
+
var hostExtensionCanonicalPath = (path14) => path14.normalize("NFC").toLowerCase();
|
|
24893
25013
|
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
24894
25014
|
manifestVersion: external_exports.literal(2),
|
|
24895
25015
|
id: hostExtensionIdSchema,
|
|
@@ -24899,8 +25019,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
|
24899
25019
|
details: localized(16384).optional(),
|
|
24900
25020
|
author: legacy.author,
|
|
24901
25021
|
repository: legacy.repository,
|
|
24902
|
-
icon: legacy.icon.refine((
|
|
24903
|
-
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((
|
|
25022
|
+
icon: legacy.icon.refine((path14) => path14 === void 0 || hostExtensionResourcePathSchema.safeParse(path14).success),
|
|
25023
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path14) => hostExtensionResourcePathSchema.safeParse(path14).success)),
|
|
24904
25024
|
categories: legacy.categories,
|
|
24905
25025
|
settingsSchema: legacy.settingsSchema,
|
|
24906
25026
|
slots: legacy.slots.removeDefault().optional(),
|
|
@@ -24934,6 +25054,9 @@ var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
|
24934
25054
|
// ../../shared-contracts/dist/thread-tree-watch.js
|
|
24935
25055
|
var THREAD_TREE_MAX_NODES = 5e3;
|
|
24936
25056
|
var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
|
|
25057
|
+
var threadTreeDelegationSchema = external_exports.object({
|
|
25058
|
+
createdAtMs: external_exports.number().int().nonnegative()
|
|
25059
|
+
});
|
|
24937
25060
|
var threadTreeHandoffSchema = external_exports.strictObject({
|
|
24938
25061
|
sourceThreadId: hostThreadIdSchema,
|
|
24939
25062
|
createdAtMs: external_exports.number().int().nonnegative()
|
|
@@ -24945,13 +25068,14 @@ var threadTreeNodeSchema = external_exports.strictObject({
|
|
|
24945
25068
|
archived: external_exports.boolean(),
|
|
24946
25069
|
updatedAtMs: external_exports.number().int().nonnegative().optional()
|
|
24947
25070
|
});
|
|
24948
|
-
var threadTreeSnapshotSchema = external_exports.
|
|
25071
|
+
var threadTreeSnapshotSchema = external_exports.object({
|
|
24949
25072
|
revision: external_exports.int().nonnegative(),
|
|
24950
25073
|
parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
|
|
25074
|
+
delegations: external_exports.record(hostThreadIdSchema, threadTreeDelegationSchema).optional(),
|
|
24951
25075
|
handoffs: external_exports.record(hostThreadIdSchema, threadTreeHandoffSchema).optional(),
|
|
24952
25076
|
nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
|
|
24953
25077
|
truncated: external_exports.boolean()
|
|
24954
|
-
}).refine((snapshot) => Object.keys(snapshot.nodes).length <= THREAD_TREE_MAX_NODES, "Too many Thread tree nodes").refine(({ parents, handoffs, nodes }) => Object.entries(parents).every(([child, parent]) => Object.hasOwn(nodes, child) && Object.hasOwn(nodes, parent)) && Object.entries(handoffs ?? {}).every(([target2, { sourceThreadId }]) => Object.hasOwn(nodes, target2) && Object.hasOwn(nodes, sourceThreadId)), "Missing Thread tree node");
|
|
25078
|
+
}).refine((snapshot) => Object.keys(snapshot.nodes).length <= THREAD_TREE_MAX_NODES, "Too many Thread tree nodes").refine(({ parents, handoffs, nodes }) => Object.entries(parents).every(([child, parent]) => Object.hasOwn(nodes, child) && Object.hasOwn(nodes, parent)) && Object.entries(handoffs ?? {}).every(([target2, { sourceThreadId }]) => Object.hasOwn(nodes, target2) && Object.hasOwn(nodes, sourceThreadId)), "Missing Thread tree node").refine(({ parents, delegations }) => Object.keys(delegations ?? {}).every((child) => Object.hasOwn(parents, child)), "Delegation metadata requires a matching parent edge");
|
|
24955
25079
|
var subscriptionId = external_exports.string().min(1).max(128);
|
|
24956
25080
|
var threadTreeWatchParamsSchema = external_exports.strictObject({});
|
|
24957
25081
|
var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
|
|
@@ -25022,7 +25146,7 @@ var active = {
|
|
|
25022
25146
|
digest: hostExtensionDigestSchema
|
|
25023
25147
|
};
|
|
25024
25148
|
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
25025
|
-
var filePath = external_exports.string().min(1).max(4096).refine((
|
|
25149
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path14) => /^(?:\/|[a-z]:[/\\])/iu.test(path14) && !path14.includes("\0") && !path14.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
25026
25150
|
var gitRef = external_exports.string().min(1).max(256).refine((ref) => ref.split("/").every((part) => part && /^[a-z0-9_.-]+$/iu.test(part) && part !== "." && part !== ".."), "Invalid GitHub ref");
|
|
25027
25151
|
function base643(maxBytes) {
|
|
25028
25152
|
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
@@ -25098,6 +25222,7 @@ var HOST_EXTENSIONS_RPC = {
|
|
|
25098
25222
|
snapshot: "codexhost/extensions/snapshot",
|
|
25099
25223
|
catalog: "codexhost/extensions/catalog",
|
|
25100
25224
|
catalogIcon: "codexhost/extensions/catalogIcon",
|
|
25225
|
+
catalogScreenshot: "codexhost/extensions/catalogScreenshot",
|
|
25101
25226
|
install: "codexhost/extensions/install",
|
|
25102
25227
|
update: "codexhost/extensions/update",
|
|
25103
25228
|
enable: "codexhost/extensions/enable",
|
|
@@ -25134,6 +25259,11 @@ var hostExtensionsCatalogIconResultSchema = external_exports.strictObject({
|
|
|
25134
25259
|
mimeType: external_exports.enum(["image/png", "image/jpeg", "image/webp"]),
|
|
25135
25260
|
base64: base643(DESKTOP_EXTENSION_ICON_MAX_BYTES)
|
|
25136
25261
|
});
|
|
25262
|
+
var hostExtensionCatalogScreenshotIndexSchema = external_exports.int().min(0).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT - 1);
|
|
25263
|
+
var hostExtensionsCatalogScreenshotResultSchema = external_exports.strictObject({
|
|
25264
|
+
mimeType: external_exports.enum(["image/png", "image/jpeg", "image/webp"]),
|
|
25265
|
+
base64: base643(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)
|
|
25266
|
+
});
|
|
25137
25267
|
var hostExtensionSettingsSchema = external_exports.strictObject({
|
|
25138
25268
|
settingsRevision: hostExtensionRevisionSchema,
|
|
25139
25269
|
values: jsonObjectSchema
|
|
@@ -25152,6 +25282,10 @@ var hostExtensionsRpcSchemas = {
|
|
|
25152
25282
|
params: external_exports.strictObject({ ...id }),
|
|
25153
25283
|
result: hostExtensionsCatalogIconResultSchema
|
|
25154
25284
|
},
|
|
25285
|
+
[HOST_EXTENSIONS_RPC.catalogScreenshot]: {
|
|
25286
|
+
params: external_exports.strictObject({ ...id, index: hostExtensionCatalogScreenshotIndexSchema }),
|
|
25287
|
+
result: hostExtensionsCatalogScreenshotResultSchema
|
|
25288
|
+
},
|
|
25155
25289
|
[HOST_EXTENSIONS_RPC.install]: {
|
|
25156
25290
|
params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
|
|
25157
25291
|
result: installationResult
|
|
@@ -25209,6 +25343,206 @@ var hostExtensionsRpcSchemas = {
|
|
|
25209
25343
|
}
|
|
25210
25344
|
};
|
|
25211
25345
|
|
|
25346
|
+
// ../../shared-contracts/dist/group-chat.js
|
|
25347
|
+
var DEFAULT_GROUP_MAX_AGENT_HOPS = 5;
|
|
25348
|
+
var MAX_GROUP_AGENT_HOPS = 20;
|
|
25349
|
+
var remoteGroupRoomIdSchema = external_exports.string().regex(/^remote:[A-Za-z0-9_-]{8,512}$/u);
|
|
25350
|
+
var groupRoomIdSchema = external_exports.union([external_exports.uuidv4(), remoteGroupRoomIdSchema]);
|
|
25351
|
+
var groupMemberIdSchema = external_exports.uuidv4();
|
|
25352
|
+
var groupMemberHandleSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/u);
|
|
25353
|
+
var groupUnmentionedPolicySchema = external_exports.enum(["none", "last_speaker", "all"]);
|
|
25354
|
+
var groupMemberStatusSchema = external_exports.enum(["active", "muted", "removed"]);
|
|
25355
|
+
var nonnegativeInteger = external_exports.int().nonnegative();
|
|
25356
|
+
var positiveInteger = external_exports.int().positive();
|
|
25357
|
+
var maxAgentHopsSchema = positiveInteger.max(MAX_GROUP_AGENT_HOPS);
|
|
25358
|
+
var nonblankString = external_exports.string().refine((value) => value.trim().length > 0);
|
|
25359
|
+
var timestamp = external_exports.iso.datetime();
|
|
25360
|
+
var optionalMemberEdits = {
|
|
25361
|
+
handle: groupMemberHandleSchema.optional(),
|
|
25362
|
+
displayName: nonblankString.optional(),
|
|
25363
|
+
note: external_exports.string().optional()
|
|
25364
|
+
};
|
|
25365
|
+
var groupMemberSchema = external_exports.object({
|
|
25366
|
+
memberId: groupMemberIdSchema,
|
|
25367
|
+
threadId: hostThreadIdSchema,
|
|
25368
|
+
handle: groupMemberHandleSchema,
|
|
25369
|
+
displayName: nonblankString,
|
|
25370
|
+
note: external_exports.string().optional(),
|
|
25371
|
+
roleSlug: roleSlugSchema.optional(),
|
|
25372
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
25373
|
+
harnessId: harnessIdSchema,
|
|
25374
|
+
status: groupMemberStatusSchema,
|
|
25375
|
+
joinedAtSeq: nonnegativeInteger,
|
|
25376
|
+
lastDeliveredSeq: nonnegativeInteger,
|
|
25377
|
+
lastRosterVersion: nonnegativeInteger,
|
|
25378
|
+
createdAt: timestamp
|
|
25379
|
+
});
|
|
25380
|
+
var groupRoomRemoteHostSchema = external_exports.object({
|
|
25381
|
+
hostId: nonblankString,
|
|
25382
|
+
displayName: nonblankString,
|
|
25383
|
+
state: nonblankString.optional(),
|
|
25384
|
+
color: external_exports.string().optional(),
|
|
25385
|
+
filePreview: external_exports.boolean().optional()
|
|
25386
|
+
});
|
|
25387
|
+
var groupRoomSchema = external_exports.object({
|
|
25388
|
+
roomId: groupRoomIdSchema,
|
|
25389
|
+
title: nonblankString,
|
|
25390
|
+
defaultCwd: nonblankString,
|
|
25391
|
+
unmentionedPolicy: groupUnmentionedPolicySchema.default("none"),
|
|
25392
|
+
allowAgentMentions: external_exports.boolean().default(true),
|
|
25393
|
+
maxAgentHops: maxAgentHopsSchema.default(DEFAULT_GROUP_MAX_AGENT_HOPS),
|
|
25394
|
+
lastSeq: nonnegativeInteger,
|
|
25395
|
+
lastSpeakerMemberId: groupMemberIdSchema.optional(),
|
|
25396
|
+
rosterVersion: nonnegativeInteger,
|
|
25397
|
+
humanEpoch: nonnegativeInteger,
|
|
25398
|
+
relayPaused: external_exports.boolean(),
|
|
25399
|
+
pinned: external_exports.boolean(),
|
|
25400
|
+
createdAt: timestamp,
|
|
25401
|
+
updatedAt: timestamp,
|
|
25402
|
+
members: external_exports.array(groupMemberSchema),
|
|
25403
|
+
remote: groupRoomRemoteHostSchema.optional()
|
|
25404
|
+
}).superRefine(({ members: members2 }, context) => {
|
|
25405
|
+
const handles = /* @__PURE__ */ new Set();
|
|
25406
|
+
for (const [index, { handle, status }] of members2.entries()) {
|
|
25407
|
+
if (status === "removed")
|
|
25408
|
+
continue;
|
|
25409
|
+
if (handles.has(handle)) {
|
|
25410
|
+
context.addIssue({
|
|
25411
|
+
code: "custom",
|
|
25412
|
+
path: ["members", index, "handle"],
|
|
25413
|
+
message: "Handle must be unique among non-removed members"
|
|
25414
|
+
});
|
|
25415
|
+
}
|
|
25416
|
+
handles.add(handle);
|
|
25417
|
+
}
|
|
25418
|
+
});
|
|
25419
|
+
var groupAttachmentSchema = external_exports.object({
|
|
25420
|
+
kind: external_exports.enum(["image", "file"]),
|
|
25421
|
+
attachmentId: nonblankString.max(256),
|
|
25422
|
+
name: nonblankString.max(256),
|
|
25423
|
+
path: nonblankString.max(4096),
|
|
25424
|
+
bytes: nonnegativeInteger,
|
|
25425
|
+
mediaType: nonblankString.max(128).optional(),
|
|
25426
|
+
width: positiveInteger.optional(),
|
|
25427
|
+
height: positiveInteger.optional()
|
|
25428
|
+
});
|
|
25429
|
+
var groupMessageSchema = external_exports.object({
|
|
25430
|
+
roomId: groupRoomIdSchema,
|
|
25431
|
+
seq: positiveInteger,
|
|
25432
|
+
messageId: nonblankString,
|
|
25433
|
+
senderType: external_exports.enum(["user", "agent", "system"]),
|
|
25434
|
+
senderMemberId: groupMemberIdSchema.optional(),
|
|
25435
|
+
senderHandle: groupMemberHandleSchema.optional(),
|
|
25436
|
+
senderName: external_exports.string().optional(),
|
|
25437
|
+
senderThreadId: hostThreadIdSchema.optional(),
|
|
25438
|
+
sourceTurnId: nonblankString.optional(),
|
|
25439
|
+
replyToSeq: positiveInteger.optional(),
|
|
25440
|
+
content: external_exports.string(),
|
|
25441
|
+
attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
|
|
25442
|
+
mentionedMemberIds: external_exports.array(groupMemberIdSchema),
|
|
25443
|
+
mentionAll: external_exports.boolean().optional(),
|
|
25444
|
+
hopCount: nonnegativeInteger,
|
|
25445
|
+
createdAt: timestamp
|
|
25446
|
+
});
|
|
25447
|
+
var newThreadOptions = {
|
|
25448
|
+
...optionalMemberEdits,
|
|
25449
|
+
model: roleModelSchema.optional(),
|
|
25450
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
25451
|
+
worktree: external_exports.boolean().optional()
|
|
25452
|
+
};
|
|
25453
|
+
var groupCreateMemberInputSchema = external_exports.discriminatedUnion("kind", [
|
|
25454
|
+
external_exports.strictObject({ kind: external_exports.literal("role"), roleSlug: roleSlugSchema, ...newThreadOptions }),
|
|
25455
|
+
external_exports.strictObject({ kind: external_exports.literal("harness"), harnessId: harnessIdSchema, ...newThreadOptions }),
|
|
25456
|
+
external_exports.strictObject({
|
|
25457
|
+
kind: external_exports.literal("existing"),
|
|
25458
|
+
threadId: hostThreadIdSchema,
|
|
25459
|
+
...optionalMemberEdits,
|
|
25460
|
+
includeRecentHistory: external_exports.boolean().default(true).optional()
|
|
25461
|
+
})
|
|
25462
|
+
]);
|
|
25463
|
+
var GROUPS_LIST_METHOD = "codexhost/groups/list";
|
|
25464
|
+
var GROUPS_GET_METHOD = "codexhost/groups/get";
|
|
25465
|
+
var GROUPS_CREATE_METHOD = "codexhost/groups/create";
|
|
25466
|
+
var GROUPS_UPDATE_METHOD = "codexhost/groups/update";
|
|
25467
|
+
var GROUPS_DELETE_METHOD = "codexhost/groups/delete";
|
|
25468
|
+
var GROUPS_ADD_MEMBER_METHOD = "codexhost/groups/member/add";
|
|
25469
|
+
var GROUPS_UPDATE_MEMBER_METHOD = "codexhost/groups/member/update";
|
|
25470
|
+
var GROUPS_REMOVE_MEMBER_METHOD = "codexhost/groups/member/remove";
|
|
25471
|
+
var GROUPS_POST_MESSAGE_METHOD = "codexhost/groups/message/post";
|
|
25472
|
+
var GROUPS_READ_MESSAGES_METHOD = "codexhost/groups/messages/read";
|
|
25473
|
+
var roomIdentity = { roomId: groupRoomIdSchema };
|
|
25474
|
+
var memberIdentity = { ...roomIdentity, memberId: groupMemberIdSchema };
|
|
25475
|
+
var roomEdits = {
|
|
25476
|
+
title: nonblankString.optional(),
|
|
25477
|
+
unmentionedPolicy: groupUnmentionedPolicySchema.optional(),
|
|
25478
|
+
allowAgentMentions: external_exports.boolean().optional(),
|
|
25479
|
+
maxAgentHops: maxAgentHopsSchema.optional()
|
|
25480
|
+
};
|
|
25481
|
+
var groupsListParamsSchema = external_exports.strictObject({});
|
|
25482
|
+
var groupsListResultSchema = external_exports.object({ rooms: external_exports.array(groupRoomSchema) });
|
|
25483
|
+
var groupsGetParamsSchema = external_exports.strictObject({
|
|
25484
|
+
...roomIdentity,
|
|
25485
|
+
limit: positiveInteger.optional(),
|
|
25486
|
+
beforeSeq: positiveInteger.optional()
|
|
25487
|
+
});
|
|
25488
|
+
var groupsGetResultSchema = external_exports.object({
|
|
25489
|
+
room: groupRoomSchema.nullable(),
|
|
25490
|
+
messages: external_exports.array(groupMessageSchema),
|
|
25491
|
+
hasMore: external_exports.boolean()
|
|
25492
|
+
});
|
|
25493
|
+
var groupsCreateParamsSchema = external_exports.strictObject({
|
|
25494
|
+
...roomEdits,
|
|
25495
|
+
defaultCwd: nonblankString,
|
|
25496
|
+
members: external_exports.array(groupCreateMemberInputSchema)
|
|
25497
|
+
});
|
|
25498
|
+
var groupsCreateResultSchema = external_exports.object({ room: groupRoomSchema });
|
|
25499
|
+
var groupsUpdateParamsSchema = external_exports.strictObject({
|
|
25500
|
+
...roomIdentity,
|
|
25501
|
+
...roomEdits,
|
|
25502
|
+
pinned: external_exports.boolean().optional(),
|
|
25503
|
+
relayPaused: external_exports.boolean().optional()
|
|
25504
|
+
});
|
|
25505
|
+
var groupsDeleteParamsSchema = external_exports.strictObject(roomIdentity);
|
|
25506
|
+
var groupsDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
|
|
25507
|
+
var groupsAddMemberParamsSchema = external_exports.strictObject({
|
|
25508
|
+
...roomIdentity,
|
|
25509
|
+
member: groupCreateMemberInputSchema
|
|
25510
|
+
});
|
|
25511
|
+
var groupsAddMemberResultSchema = external_exports.object({
|
|
25512
|
+
room: groupRoomSchema,
|
|
25513
|
+
member: groupMemberSchema
|
|
25514
|
+
});
|
|
25515
|
+
var groupsUpdateMemberParamsSchema = external_exports.strictObject({
|
|
25516
|
+
...memberIdentity,
|
|
25517
|
+
...optionalMemberEdits,
|
|
25518
|
+
status: groupMemberStatusSchema.optional()
|
|
25519
|
+
});
|
|
25520
|
+
var groupsRemoveMemberParamsSchema = external_exports.strictObject(memberIdentity);
|
|
25521
|
+
var groupsPostMessageParamsSchema = external_exports.strictObject({
|
|
25522
|
+
...roomIdentity,
|
|
25523
|
+
content: external_exports.string().max(64e3),
|
|
25524
|
+
attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
|
|
25525
|
+
replyToSeq: positiveInteger.optional(),
|
|
25526
|
+
targetMemberIds: external_exports.array(groupMemberIdSchema).optional(),
|
|
25527
|
+
mentionAll: external_exports.boolean().optional()
|
|
25528
|
+
}).refine((value) => value.content.trim().length > 0 || (value.attachments?.length ?? 0) > 0, "Message content or at least one attachment is required");
|
|
25529
|
+
var groupsPostMessageResultSchema = external_exports.object({
|
|
25530
|
+
room: groupRoomSchema,
|
|
25531
|
+
message: groupMessageSchema,
|
|
25532
|
+
awakenedMemberIds: external_exports.array(groupMemberIdSchema)
|
|
25533
|
+
});
|
|
25534
|
+
var groupsReadMessagesParamsSchema = external_exports.strictObject({
|
|
25535
|
+
...roomIdentity,
|
|
25536
|
+
fromSeq: positiveInteger.optional(),
|
|
25537
|
+
toSeq: positiveInteger.optional(),
|
|
25538
|
+
limit: positiveInteger.optional()
|
|
25539
|
+
});
|
|
25540
|
+
var groupsReadMessagesResultSchema = external_exports.object({
|
|
25541
|
+
...roomIdentity,
|
|
25542
|
+
messages: external_exports.array(groupMessageSchema),
|
|
25543
|
+
totalSeq: nonnegativeInteger
|
|
25544
|
+
});
|
|
25545
|
+
|
|
25212
25546
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
25213
25547
|
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
25214
25548
|
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
@@ -25379,6 +25713,22 @@ var clientThreadSectionMutationResultSchema = external_exports.discriminatedUnio
|
|
|
25379
25713
|
]);
|
|
25380
25714
|
var CLIENT_CHANNEL_METHODS = [
|
|
25381
25715
|
"codexhost/skills/list",
|
|
25716
|
+
ROLES_LIST_METHOD,
|
|
25717
|
+
ROLES_GET_METHOD,
|
|
25718
|
+
ROLES_SAVE_METHOD,
|
|
25719
|
+
ROLES_DELETE_METHOD,
|
|
25720
|
+
ROLES_CATALOG_METHOD,
|
|
25721
|
+
ROLES_LIKE_METHOD,
|
|
25722
|
+
GROUPS_LIST_METHOD,
|
|
25723
|
+
GROUPS_GET_METHOD,
|
|
25724
|
+
GROUPS_CREATE_METHOD,
|
|
25725
|
+
GROUPS_UPDATE_METHOD,
|
|
25726
|
+
GROUPS_DELETE_METHOD,
|
|
25727
|
+
GROUPS_ADD_MEMBER_METHOD,
|
|
25728
|
+
GROUPS_UPDATE_MEMBER_METHOD,
|
|
25729
|
+
GROUPS_REMOVE_MEMBER_METHOD,
|
|
25730
|
+
GROUPS_POST_MESSAGE_METHOD,
|
|
25731
|
+
GROUPS_READ_MESSAGES_METHOD,
|
|
25382
25732
|
"codexhost/voice/status",
|
|
25383
25733
|
"codexhost/voice/transcribe",
|
|
25384
25734
|
"codexhost/harness/display-settings/get",
|
|
@@ -25540,6 +25890,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
25540
25890
|
}),
|
|
25541
25891
|
external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
|
|
25542
25892
|
external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
|
|
25893
|
+
external_exports.object({
|
|
25894
|
+
type: external_exports.literal("groups-changed"),
|
|
25895
|
+
cursor: clientChannelCursorSchema,
|
|
25896
|
+
roomId: external_exports.string().optional()
|
|
25897
|
+
}),
|
|
25543
25898
|
external_exports.object({
|
|
25544
25899
|
type: external_exports.literal("preferences-changed"),
|
|
25545
25900
|
cursor: clientChannelCursorSchema,
|
|
@@ -25673,6 +26028,7 @@ var clientThreadSnapshotSchema = external_exports.object({
|
|
|
25673
26028
|
status: external_exports.object({ type: external_exports.string() }).passthrough(),
|
|
25674
26029
|
name: external_exports.string().nullable().optional(),
|
|
25675
26030
|
preview: external_exports.string().optional(),
|
|
26031
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
25676
26032
|
codexhostImportSource: clientThreadImportSourceSchema.optional(),
|
|
25677
26033
|
turns: external_exports.array(clientTurnSchema).length(0)
|
|
25678
26034
|
}).passthrough(),
|
|
@@ -26700,6 +27056,10 @@ var webToolOutputPreviewSchema = external_exports.object({
|
|
|
26700
27056
|
bytes: external_exports.number().int().nonnegative()
|
|
26701
27057
|
});
|
|
26702
27058
|
|
|
27059
|
+
// ../../shared-contracts/dist/desktop-shell.js
|
|
27060
|
+
var desktopShellOpenParamsSchema = external_exports.strictObject({});
|
|
27061
|
+
var desktopShellOpenResultSchema = external_exports.strictObject({});
|
|
27062
|
+
|
|
26703
27063
|
// ../../shared-contracts/dist/console.js
|
|
26704
27064
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
26705
27065
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -28505,16 +28865,16 @@ var Diff = class {
|
|
|
28505
28865
|
}
|
|
28506
28866
|
}
|
|
28507
28867
|
}
|
|
28508
|
-
addToPath(
|
|
28509
|
-
const last =
|
|
28868
|
+
addToPath(path14, added, removed, oldPosInc, options) {
|
|
28869
|
+
const last = path14.lastComponent;
|
|
28510
28870
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
28511
28871
|
return {
|
|
28512
|
-
oldPos:
|
|
28872
|
+
oldPos: path14.oldPos + oldPosInc,
|
|
28513
28873
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
28514
28874
|
};
|
|
28515
28875
|
} else {
|
|
28516
28876
|
return {
|
|
28517
|
-
oldPos:
|
|
28877
|
+
oldPos: path14.oldPos + oldPosInc,
|
|
28518
28878
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
28519
28879
|
};
|
|
28520
28880
|
}
|
|
@@ -29053,7 +29413,7 @@ function requiredString(value, label) {
|
|
|
29053
29413
|
fail(`Modern history ${label} is invalid`);
|
|
29054
29414
|
return value;
|
|
29055
29415
|
}
|
|
29056
|
-
function
|
|
29416
|
+
function positiveInteger2(value, label) {
|
|
29057
29417
|
return boundedInteger(value, label, 1);
|
|
29058
29418
|
}
|
|
29059
29419
|
function nonNegativeInteger(value, label) {
|
|
@@ -29133,8 +29493,8 @@ function parseAssistantBaseline(value) {
|
|
|
29133
29493
|
const parsed = {
|
|
29134
29494
|
attemptId: identifier(attempt.attemptId, "assistant stream attemptId"),
|
|
29135
29495
|
startedAfterSeq: cursor(attempt.startedAfterSeq, "assistant stream startedAfterSeq"),
|
|
29136
|
-
turn:
|
|
29137
|
-
step:
|
|
29496
|
+
turn: positiveInteger3(attempt.turn, "assistant stream turn"),
|
|
29497
|
+
step: positiveInteger3(attempt.step, "assistant stream step"),
|
|
29138
29498
|
nextIndex: nonNegativeInteger2(attempt.nextIndex, "assistant stream nextIndex"),
|
|
29139
29499
|
stream: jsonArray(attempt.stream, "assistant stream baseline stream")
|
|
29140
29500
|
};
|
|
@@ -29148,7 +29508,7 @@ function parseAssistantFrame(value) {
|
|
|
29148
29508
|
if (!isRecord3(value) || typeof value.type !== "string")
|
|
29149
29509
|
throw invalid("assistant stream frame");
|
|
29150
29510
|
const attemptId = identifier(value.attemptId, "assistant stream attemptId");
|
|
29151
|
-
const revision =
|
|
29511
|
+
const revision = positiveInteger3(value.revision, "assistant stream revision");
|
|
29152
29512
|
switch (value.type) {
|
|
29153
29513
|
case "start":
|
|
29154
29514
|
if (!onlyKeys(value, ["type", "attemptId", "revision", "startedAfterSeq", "turn", "step"])) {
|
|
@@ -29159,8 +29519,8 @@ function parseAssistantFrame(value) {
|
|
|
29159
29519
|
attemptId,
|
|
29160
29520
|
revision,
|
|
29161
29521
|
startedAfterSeq: cursor(value.startedAfterSeq, "assistant stream startedAfterSeq"),
|
|
29162
|
-
turn:
|
|
29163
|
-
step:
|
|
29522
|
+
turn: positiveInteger3(value.turn, "assistant stream turn"),
|
|
29523
|
+
step: positiveInteger3(value.step, "assistant stream step")
|
|
29164
29524
|
};
|
|
29165
29525
|
case "chunk":
|
|
29166
29526
|
if (!onlyKeys(value, ["type", "attemptId", "revision", "index", "time", "chunk"])) {
|
|
@@ -29310,7 +29670,7 @@ function identifier(value, label) {
|
|
|
29310
29670
|
function cursor(value, label) {
|
|
29311
29671
|
return value === -1 ? value : nonNegativeInteger2(value, label);
|
|
29312
29672
|
}
|
|
29313
|
-
function
|
|
29673
|
+
function positiveInteger3(value, label) {
|
|
29314
29674
|
const parsed = safeInteger(value, label);
|
|
29315
29675
|
if (parsed <= 0)
|
|
29316
29676
|
throw invalid(label);
|
|
@@ -29476,8 +29836,8 @@ function validateDeveloperMessage(event) {
|
|
|
29476
29836
|
requiredFields(data, ["turn", "step", "message"]);
|
|
29477
29837
|
if (Object.hasOwn(data, "headerSeq") && !Number.isSafeInteger(data.headerSeq))
|
|
29478
29838
|
throw invalid("developer/message headerSeq");
|
|
29479
|
-
|
|
29480
|
-
|
|
29839
|
+
positiveInteger3(data.turn, "developer/message turn");
|
|
29840
|
+
positiveInteger3(data.step, "developer/message step");
|
|
29481
29841
|
if (!isRecord3(data.message))
|
|
29482
29842
|
throw invalid("developer/message message");
|
|
29483
29843
|
const message = data.message;
|
|
@@ -29531,7 +29891,7 @@ function validateV4Event(event) {
|
|
|
29531
29891
|
if (!isRecord3(data))
|
|
29532
29892
|
throw invalid("workspace/changes");
|
|
29533
29893
|
exactKeys(data, ["turn"]);
|
|
29534
|
-
|
|
29894
|
+
positiveInteger3(data.turn, "workspace/changes turn");
|
|
29535
29895
|
break;
|
|
29536
29896
|
case "tool/result":
|
|
29537
29897
|
if (!isRecord3(data))
|
|
@@ -29580,7 +29940,7 @@ function validateV4Event(event) {
|
|
|
29580
29940
|
break;
|
|
29581
29941
|
case "deliverables/presented":
|
|
29582
29942
|
exactKeys(data, ["turn", "callId", "files"]);
|
|
29583
|
-
|
|
29943
|
+
positiveInteger3(data.turn, "deliverables turn");
|
|
29584
29944
|
identifier(data.callId, "deliverables callId");
|
|
29585
29945
|
if (!Array.isArray(data.files))
|
|
29586
29946
|
throw invalid("deliverables files");
|
|
@@ -30167,6 +30527,11 @@ function isSupportedDeepSeekVersion(version2) {
|
|
|
30167
30527
|
const parsed = parseSemVer(version2);
|
|
30168
30528
|
return parsed !== void 0 && MINIMUM !== void 0 && compareSemVer(parsed, MINIMUM) >= 0;
|
|
30169
30529
|
}
|
|
30530
|
+
function supportsDeepSeekDelegationBridge(version2) {
|
|
30531
|
+
const parsed = parseSemVer(version2);
|
|
30532
|
+
const minimum = parseSemVer("0.2.2-rc.5");
|
|
30533
|
+
return parsed !== void 0 && minimum !== void 0 && compareSemVer(parsed, minimum) >= 0;
|
|
30534
|
+
}
|
|
30170
30535
|
function deepSeekModernProfile(version2) {
|
|
30171
30536
|
return DEEPSEEK_V4_PROFILE.version === version2 ? DEEPSEEK_V4_PROFILE : Object.freeze({ ...DEEPSEEK_V4_PROFILE, version: version2 });
|
|
30172
30537
|
}
|
|
@@ -30502,7 +30867,7 @@ async function probeDeepSeekExecutableGeneration(options = {}, dependencies = {
|
|
|
30502
30867
|
|
|
30503
30868
|
// dist/modern/deepseek-harness-adapter.js
|
|
30504
30869
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
30505
|
-
import
|
|
30870
|
+
import path12 from "node:path";
|
|
30506
30871
|
import { isDeepStrictEqual as isDeepStrictEqual7 } from "node:util";
|
|
30507
30872
|
|
|
30508
30873
|
// dist/model-catalog.js
|
|
@@ -30631,6 +30996,145 @@ var import_websocket = __toESM(require_websocket(), 1);
|
|
|
30631
30996
|
var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
30632
30997
|
var wrapper_default = import_websocket.default;
|
|
30633
30998
|
|
|
30999
|
+
// dist/modern/delegation-bridge.js
|
|
31000
|
+
import { randomBytes } from "node:crypto";
|
|
31001
|
+
import { mkdtemp as mkdtemp2, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
|
|
31002
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
31003
|
+
import path8 from "node:path";
|
|
31004
|
+
var DELEGATION_ENDPOINT = "codexhost/delegation";
|
|
31005
|
+
var DELEGATION_BRIDGE_TOKEN = "CODEXHOST_DSH_BRIDGE_TOKEN";
|
|
31006
|
+
var ENVIRONMENT_KEYS = [
|
|
31007
|
+
"CODEXHOST_RUNTIME_ENDPOINT",
|
|
31008
|
+
"CODEXHOST_RUNTIME_TOKEN",
|
|
31009
|
+
"CODEXHOST_THREAD_ID",
|
|
31010
|
+
"CODEXHOST_CLI_PATH"
|
|
31011
|
+
];
|
|
31012
|
+
function delegationEnvironment(environment) {
|
|
31013
|
+
if (!environment || ENVIRONMENT_KEYS.some((key) => !environment[key])) {
|
|
31014
|
+
return void 0;
|
|
31015
|
+
}
|
|
31016
|
+
return Object.fromEntries(ENVIRONMENT_KEYS.map((key) => [key, environment[key]]));
|
|
31017
|
+
}
|
|
31018
|
+
var DELEGATION_PLUGIN_SOURCE = String.raw`
|
|
31019
|
+
export const name = "codexhost-delegation";
|
|
31020
|
+
export const inject = ["webServer", "shellEnv"];
|
|
31021
|
+
|
|
31022
|
+
export async function apply(ctx) {
|
|
31023
|
+
const { timingSafeEqual } = await import("node:crypto");
|
|
31024
|
+
const secret = process.env.CODEXHOST_DSH_BRIDGE_TOKEN;
|
|
31025
|
+
if (!secret) {
|
|
31026
|
+
throw new Error("CodexHost delegation bridge credential is missing");
|
|
31027
|
+
}
|
|
31028
|
+
const expected = Buffer.from("Bearer " + secret);
|
|
31029
|
+
const keys = [
|
|
31030
|
+
"CODEXHOST_RUNTIME_ENDPOINT",
|
|
31031
|
+
"CODEXHOST_RUNTIME_TOKEN",
|
|
31032
|
+
"CODEXHOST_THREAD_ID",
|
|
31033
|
+
"CODEXHOST_CLI_PATH",
|
|
31034
|
+
];
|
|
31035
|
+
const sessions = new Map();
|
|
31036
|
+
const variables = Object.fromEntries(keys.map((key) => [
|
|
31037
|
+
"DSH_" + key,
|
|
31038
|
+
{ description: "CodexHost delegation identity for the current Session" },
|
|
31039
|
+
]));
|
|
31040
|
+
ctx.shellEnv.register({
|
|
31041
|
+
name,
|
|
31042
|
+
variables,
|
|
31043
|
+
resolve(execution) {
|
|
31044
|
+
const sessionId = execution.agent?.session.header.id;
|
|
31045
|
+
const environment = sessions.get(sessionId);
|
|
31046
|
+
if (!environment) {
|
|
31047
|
+
return {};
|
|
31048
|
+
}
|
|
31049
|
+
return Object.fromEntries(keys.map((key) => ["DSH_" + key, environment[key]]));
|
|
31050
|
+
},
|
|
31051
|
+
});
|
|
31052
|
+
ctx.effect(() => {
|
|
31053
|
+
const unregisterRoute = ctx.webServer.register({
|
|
31054
|
+
kind: "exact",
|
|
31055
|
+
path: "/api/codexhost/delegation",
|
|
31056
|
+
async handler(req, res) {
|
|
31057
|
+
const actual = Buffer.from(req.headers.authorization || "");
|
|
31058
|
+
if (actual.length !== expected.length || !timingSafeEqual(actual, expected)) {
|
|
31059
|
+
res.writeHead(403).end();
|
|
31060
|
+
return;
|
|
31061
|
+
}
|
|
31062
|
+
if (req.method !== "POST") {
|
|
31063
|
+
res.writeHead(405).end();
|
|
31064
|
+
return;
|
|
31065
|
+
}
|
|
31066
|
+
const chunks = [];
|
|
31067
|
+
let size = 0;
|
|
31068
|
+
for await (const chunk of req) {
|
|
31069
|
+
size += chunk.length;
|
|
31070
|
+
if (size > 65536) {
|
|
31071
|
+
res.writeHead(413).end();
|
|
31072
|
+
return;
|
|
31073
|
+
}
|
|
31074
|
+
chunks.push(Buffer.from(chunk));
|
|
31075
|
+
}
|
|
31076
|
+
let request;
|
|
31077
|
+
try {
|
|
31078
|
+
request = JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
31079
|
+
} catch {
|
|
31080
|
+
res.writeHead(400).end();
|
|
31081
|
+
return;
|
|
31082
|
+
}
|
|
31083
|
+
const args = request?.payload?.args;
|
|
31084
|
+
const environment = args?.environment;
|
|
31085
|
+
const valid = request?.type === "client-request"
|
|
31086
|
+
&& typeof request.rpcId === "string"
|
|
31087
|
+
&& request.method === "codexhost/delegation"
|
|
31088
|
+
&& typeof args?.sessionId === "string"
|
|
31089
|
+
&& args.sessionId.length > 0
|
|
31090
|
+
&& (environment === null || (
|
|
31091
|
+
environment && typeof environment === "object" && !Array.isArray(environment)
|
|
31092
|
+
&& Object.keys(environment).length === keys.length
|
|
31093
|
+
&& keys.every((key) => typeof environment[key] === "string"
|
|
31094
|
+
&& environment[key].length > 0 && environment[key].length < 16384)
|
|
31095
|
+
));
|
|
31096
|
+
if (!valid) {
|
|
31097
|
+
res.writeHead(400).end();
|
|
31098
|
+
return;
|
|
31099
|
+
}
|
|
31100
|
+
if (environment === null) {
|
|
31101
|
+
sessions.delete(args.sessionId);
|
|
31102
|
+
} else {
|
|
31103
|
+
sessions.set(args.sessionId, Object.freeze({ ...environment }));
|
|
31104
|
+
}
|
|
31105
|
+
res.writeHead(200, { "content-type": "application/json" });
|
|
31106
|
+
res.end(JSON.stringify({
|
|
31107
|
+
type: "server-response",
|
|
31108
|
+
rpcId: request.rpcId,
|
|
31109
|
+
result: { ok: true },
|
|
31110
|
+
}));
|
|
31111
|
+
},
|
|
31112
|
+
});
|
|
31113
|
+
return () => {
|
|
31114
|
+
unregisterRoute();
|
|
31115
|
+
sessions.clear();
|
|
31116
|
+
};
|
|
31117
|
+
});
|
|
31118
|
+
}
|
|
31119
|
+
`;
|
|
31120
|
+
async function createDelegationBridge() {
|
|
31121
|
+
const directory = await mkdtemp2(path8.join(tmpdir2(), "codexhost-dsh-"));
|
|
31122
|
+
const patchPath = path8.join(directory, "delegation.patch.yml");
|
|
31123
|
+
try {
|
|
31124
|
+
const pluginPath = path8.join(directory, "delegation.mjs");
|
|
31125
|
+
await writeFile2(pluginPath, DELEGATION_PLUGIN_SOURCE, { mode: 384 });
|
|
31126
|
+
await writeFile2(patchPath, JSON.stringify([{ insert: [{ id: "codexhost-delegation", name: pluginPath }] }]), { mode: 384 });
|
|
31127
|
+
return {
|
|
31128
|
+
patchPath,
|
|
31129
|
+
token: randomBytes(32).toString("base64url"),
|
|
31130
|
+
dispose: () => rm2(directory, { recursive: true, force: true })
|
|
31131
|
+
};
|
|
31132
|
+
} catch (error62) {
|
|
31133
|
+
await rm2(directory, { recursive: true, force: true });
|
|
31134
|
+
throw error62;
|
|
31135
|
+
}
|
|
31136
|
+
}
|
|
31137
|
+
|
|
30634
31138
|
// dist/modern/remote-connection.js
|
|
30635
31139
|
var ModernRemoteConnectionError = class extends Error {
|
|
30636
31140
|
code;
|
|
@@ -30738,6 +31242,7 @@ var ModernRemoteConnection = class {
|
|
|
30738
31242
|
#maxReadinessBytes;
|
|
30739
31243
|
#faultListeners = /* @__PURE__ */ new Set();
|
|
30740
31244
|
#child;
|
|
31245
|
+
#delegationBridge;
|
|
30741
31246
|
#closePromise;
|
|
30742
31247
|
#connectPromise;
|
|
30743
31248
|
#cookie;
|
|
@@ -30751,6 +31256,7 @@ var ModernRemoteConnection = class {
|
|
|
30751
31256
|
#closing = false;
|
|
30752
31257
|
#stoppingChild = false;
|
|
30753
31258
|
#stopPromise;
|
|
31259
|
+
#processStopped = false;
|
|
30754
31260
|
constructor(options, dependencies = {}) {
|
|
30755
31261
|
if (options.command.trim() === "") {
|
|
30756
31262
|
throw new ModernRemoteConnectionError("notInstalled", "DeepSeek Harness command is missing");
|
|
@@ -30792,6 +31298,10 @@ var ModernRemoteConnection = class {
|
|
|
30792
31298
|
get stderrTail() {
|
|
30793
31299
|
return this.#stderrTail;
|
|
30794
31300
|
}
|
|
31301
|
+
/** Managed process tree stop confirmation, independent of socket and file cleanup. */
|
|
31302
|
+
get processStopped() {
|
|
31303
|
+
return this.#processStopped;
|
|
31304
|
+
}
|
|
30795
31305
|
connect() {
|
|
30796
31306
|
if (this.#closing) {
|
|
30797
31307
|
return Promise.reject(new ModernRemoteConnectionError("unavailable", "DeepSeek Harness connection is closing"));
|
|
@@ -30830,6 +31340,23 @@ var ModernRemoteConnection = class {
|
|
|
30830
31340
|
this.#faultListeners.delete(listener);
|
|
30831
31341
|
};
|
|
30832
31342
|
}
|
|
31343
|
+
async setSessionEnvironment(sessionId, environment) {
|
|
31344
|
+
if (!this.#options.delegationBridge) {
|
|
31345
|
+
return;
|
|
31346
|
+
}
|
|
31347
|
+
const selected = delegationEnvironment(environment);
|
|
31348
|
+
await this.connect();
|
|
31349
|
+
if (!this.#delegationBridge) {
|
|
31350
|
+
return;
|
|
31351
|
+
}
|
|
31352
|
+
const result = await this.call(DELEGATION_ENDPOINT, {
|
|
31353
|
+
sessionId,
|
|
31354
|
+
environment: selected ?? null
|
|
31355
|
+
});
|
|
31356
|
+
if (!result.ok) {
|
|
31357
|
+
throw new ModernRemoteConnectionError("protocolError", "DSH delegation binding failed");
|
|
31358
|
+
}
|
|
31359
|
+
}
|
|
30833
31360
|
async call(endpoint, args, signal, options = {}) {
|
|
30834
31361
|
if (options.timeoutMs === null && !signal) {
|
|
30835
31362
|
throw new TypeError("Disabling a DeepSeek Harness Remote timeout requires an AbortSignal");
|
|
@@ -30856,7 +31383,8 @@ var ModernRemoteConnection = class {
|
|
|
30856
31383
|
redirect: "manual",
|
|
30857
31384
|
headers: {
|
|
30858
31385
|
"content-type": "application/json",
|
|
30859
|
-
cookie
|
|
31386
|
+
cookie,
|
|
31387
|
+
...endpoint === DELEGATION_ENDPOINT && this.#delegationBridge ? { authorization: `Bearer ${this.#delegationBridge.token}` } : {}
|
|
30860
31388
|
},
|
|
30861
31389
|
body: JSON.stringify({
|
|
30862
31390
|
type: "client-request",
|
|
@@ -31203,9 +31731,16 @@ var ModernRemoteConnection = class {
|
|
|
31203
31731
|
}
|
|
31204
31732
|
}
|
|
31205
31733
|
async #performConnect() {
|
|
31734
|
+
if (this.#options.delegationBridge && this.#environment.CODEXHOST_RUNTIME_ENDPOINT && this.#environment.CODEXHOST_RUNTIME_TOKEN) {
|
|
31735
|
+
this.#delegationBridge = await createDelegationBridge();
|
|
31736
|
+
}
|
|
31737
|
+
if (this.#closing) {
|
|
31738
|
+
throw new ModernRemoteConnectionError("cancelled", "DeepSeek Harness startup was cancelled before process creation");
|
|
31739
|
+
}
|
|
31206
31740
|
const rawArguments = [
|
|
31207
31741
|
...this.#options.commandArguments ?? [],
|
|
31208
31742
|
"web",
|
|
31743
|
+
...this.#delegationBridge ? ["--patch", this.#delegationBridge.patchPath] : [],
|
|
31209
31744
|
"--no-open",
|
|
31210
31745
|
"--host",
|
|
31211
31746
|
"127.0.0.1",
|
|
@@ -31216,7 +31751,10 @@ var ModernRemoteConnection = class {
|
|
|
31216
31751
|
let child;
|
|
31217
31752
|
try {
|
|
31218
31753
|
child = this.#dependencies.spawn(invocation.command, invocation.arguments, {
|
|
31219
|
-
env: deepSeekEnvironment(this.#options.command,
|
|
31754
|
+
env: deepSeekEnvironment(this.#options.command, {
|
|
31755
|
+
...this.#environment,
|
|
31756
|
+
...this.#delegationBridge ? { [DELEGATION_BRIDGE_TOKEN]: this.#delegationBridge.token } : {}
|
|
31757
|
+
}),
|
|
31220
31758
|
stdio: "pipe",
|
|
31221
31759
|
windowsHide: true,
|
|
31222
31760
|
windowsVerbatimArguments: invocation.windowsVerbatimArguments,
|
|
@@ -31427,6 +31965,7 @@ var ModernRemoteConnection = class {
|
|
|
31427
31965
|
...socketClosures,
|
|
31428
31966
|
...connect ? [connect] : []
|
|
31429
31967
|
]);
|
|
31968
|
+
this.#processStopped = stopped?.status === "fulfilled";
|
|
31430
31969
|
const socketResults = remaining.slice(0, socketClosures.length);
|
|
31431
31970
|
this.#faultListeners.clear();
|
|
31432
31971
|
if (child) {
|
|
@@ -31438,6 +31977,8 @@ var ModernRemoteConnection = class {
|
|
|
31438
31977
|
this.#launchUrl = void 0;
|
|
31439
31978
|
this.#origin = void 0;
|
|
31440
31979
|
this.#cookie = void 0;
|
|
31980
|
+
await this.#delegationBridge?.dispose();
|
|
31981
|
+
this.#delegationBridge = void 0;
|
|
31441
31982
|
if (stopped?.status === "rejected")
|
|
31442
31983
|
throw stopped.reason;
|
|
31443
31984
|
const socketFailure2 = socketResults.find((result) => result.status === "rejected");
|
|
@@ -32051,7 +32592,7 @@ function hasExactKeys4(value, keys) {
|
|
|
32051
32592
|
const actual = Reflect.ownKeys(value);
|
|
32052
32593
|
return actual.length === keys.length && keys.every((key) => Object.hasOwn(value, key));
|
|
32053
32594
|
}
|
|
32054
|
-
function
|
|
32595
|
+
function positiveInteger4(value, name, maximum = Number.MAX_SAFE_INTEGER) {
|
|
32055
32596
|
if (!Number.isSafeInteger(value) || value <= 0 || value > maximum) {
|
|
32056
32597
|
throw new TypeError(`${name} must be an integer from 1 through ${String(maximum)}`);
|
|
32057
32598
|
}
|
|
@@ -32307,11 +32848,11 @@ var ModernControlStore = class {
|
|
|
32307
32848
|
#readyResolve;
|
|
32308
32849
|
constructor(source, options = {}) {
|
|
32309
32850
|
this.#source = source;
|
|
32310
|
-
this.#maxSessions =
|
|
32311
|
-
this.#maxKeys =
|
|
32312
|
-
this.#maxWaiters =
|
|
32313
|
-
this.#waitTimeoutMs =
|
|
32314
|
-
this.#recoveryOpenTimeoutMs =
|
|
32851
|
+
this.#maxSessions = positiveInteger4(options.maxSessions ?? DEFAULT_MAX_SESSIONS, "maxSessions");
|
|
32852
|
+
this.#maxKeys = positiveInteger4(options.maxKeysPerSession ?? DEFAULT_MAX_KEYS_PER_SESSION, "maxKeysPerSession");
|
|
32853
|
+
this.#maxWaiters = positiveInteger4(options.maxWaiters ?? DEFAULT_MAX_WAITERS, "maxWaiters");
|
|
32854
|
+
this.#waitTimeoutMs = positiveInteger4(options.waitTimeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS, "waitTimeoutMs", MAX_TIMER_MILLISECONDS2);
|
|
32855
|
+
this.#recoveryOpenTimeoutMs = positiveInteger4(options.recoveryOpenTimeoutMs ?? this.#waitTimeoutMs, "recoveryOpenTimeoutMs", MAX_TIMER_MILLISECONDS2);
|
|
32315
32856
|
this.#onFault = options.onFault;
|
|
32316
32857
|
}
|
|
32317
32858
|
get fault() {
|
|
@@ -32440,7 +32981,7 @@ var ModernControlStore = class {
|
|
|
32440
32981
|
if (this.#waiters.size >= this.#maxWaiters) {
|
|
32441
32982
|
throw storeError("resourceLimit", "Control store waiter limit was exceeded");
|
|
32442
32983
|
}
|
|
32443
|
-
const timeoutMs =
|
|
32984
|
+
const timeoutMs = positiveInteger4(options.timeoutMs ?? this.#waitTimeoutMs, "timeoutMs", MAX_TIMER_MILLISECONDS2);
|
|
32444
32985
|
return new Promise((resolve, reject) => {
|
|
32445
32986
|
const waiter = {
|
|
32446
32987
|
sessionId,
|
|
@@ -33373,9 +33914,9 @@ var ModernEventGateway = class {
|
|
|
33373
33914
|
constructor(remote, options = {}) {
|
|
33374
33915
|
this.#remote = remote;
|
|
33375
33916
|
this.#options = {
|
|
33376
|
-
maxSinks:
|
|
33377
|
-
maxPendingEvents:
|
|
33378
|
-
maxRetiredEvents:
|
|
33917
|
+
maxSinks: positiveInteger5(options.maxSinks ?? DEFAULT_MAX_SINKS, "maxSinks"),
|
|
33918
|
+
maxPendingEvents: positiveInteger5(options.maxPendingEvents ?? DEFAULT_MAX_PENDING_EVENTS, "maxPendingEvents"),
|
|
33919
|
+
maxRetiredEvents: positiveInteger5(options.maxRetiredEvents ?? DEFAULT_MAX_RETIRED_EVENTS, "maxRetiredEvents"),
|
|
33379
33920
|
...options.onGenerationLost ? { onGenerationLost: options.onGenerationLost } : {},
|
|
33380
33921
|
...options.onFailureDeclared ? { onFailureDeclared: options.onFailureDeclared } : {},
|
|
33381
33922
|
...options.onFault ? { onFault: options.onFault } : {}
|
|
@@ -34234,7 +34775,7 @@ function boundedString3(value) {
|
|
|
34234
34775
|
function nonBlankString3(value) {
|
|
34235
34776
|
return boundedString3(value) && value.length > 0;
|
|
34236
34777
|
}
|
|
34237
|
-
function
|
|
34778
|
+
function positiveInteger5(value, name) {
|
|
34238
34779
|
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
34239
34780
|
throw new TypeError(`${name} must be a positive safe integer`);
|
|
34240
34781
|
}
|
|
@@ -34813,12 +35354,12 @@ function invalidInbox() {
|
|
|
34813
35354
|
}
|
|
34814
35355
|
|
|
34815
35356
|
// dist/modern/history.js
|
|
34816
|
-
import
|
|
35357
|
+
import path10 from "node:path";
|
|
34817
35358
|
import { isDeepStrictEqual as isDeepStrictEqual5 } from "node:util";
|
|
34818
35359
|
|
|
34819
35360
|
// ../../harness-adapter/dist/local-media-markdown.js
|
|
34820
35361
|
import { existsSync, statSync } from "node:fs";
|
|
34821
|
-
import
|
|
35362
|
+
import path9 from "node:path";
|
|
34822
35363
|
import { fileURLToPath } from "node:url";
|
|
34823
35364
|
var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
34824
35365
|
".aac",
|
|
@@ -35121,7 +35662,7 @@ function skipBlanks(text2, start) {
|
|
|
35121
35662
|
return index;
|
|
35122
35663
|
}
|
|
35123
35664
|
function mediaMarkdownImage(absolutePath) {
|
|
35124
|
-
const name =
|
|
35665
|
+
const name = path9.basename(absolutePath).replaceAll("]", "\\]");
|
|
35125
35666
|
return `})`;
|
|
35126
35667
|
}
|
|
35127
35668
|
function markdownDestination(absolutePath, bracketed) {
|
|
@@ -35140,11 +35681,11 @@ function resolveLocalMediaPath(raw, roots, exists = mediaFileExists) {
|
|
|
35140
35681
|
if (stripped === null)
|
|
35141
35682
|
return null;
|
|
35142
35683
|
if (isAbsoluteMediaPath(stripped)) {
|
|
35143
|
-
const absolute =
|
|
35684
|
+
const absolute = path9.resolve(stripped);
|
|
35144
35685
|
return hasMediaExtension(absolute) && exists(absolute) ? absolute : null;
|
|
35145
35686
|
}
|
|
35146
35687
|
for (const root of roots) {
|
|
35147
|
-
const absolute =
|
|
35688
|
+
const absolute = path9.resolve(root, stripped);
|
|
35148
35689
|
if (hasMediaExtension(absolute) && exists(absolute))
|
|
35149
35690
|
return absolute;
|
|
35150
35691
|
}
|
|
@@ -35163,10 +35704,10 @@ function stripFileUrl(value) {
|
|
|
35163
35704
|
}
|
|
35164
35705
|
}
|
|
35165
35706
|
function isAbsoluteMediaPath(value) {
|
|
35166
|
-
return
|
|
35707
|
+
return path9.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
|
|
35167
35708
|
}
|
|
35168
35709
|
function hasMediaExtension(value) {
|
|
35169
|
-
return MEDIA_EXTENSIONS.has(
|
|
35710
|
+
return MEDIA_EXTENSIONS.has(path9.extname(value).toLowerCase());
|
|
35170
35711
|
}
|
|
35171
35712
|
function mediaFileExists(absolutePath) {
|
|
35172
35713
|
try {
|
|
@@ -35361,7 +35902,7 @@ var ModernEventValidator = class {
|
|
|
35361
35902
|
switch (event.type) {
|
|
35362
35903
|
case "turn/start": {
|
|
35363
35904
|
exactKeys(data, ["turn"]);
|
|
35364
|
-
const turn =
|
|
35905
|
+
const turn = positiveInteger2(data.turn, "turn/start turn");
|
|
35365
35906
|
if (trace.openTurn !== null || turn !== trace.nextTurn) {
|
|
35366
35907
|
fail("Modern history has an invalid turn/start boundary");
|
|
35367
35908
|
}
|
|
@@ -35371,7 +35912,7 @@ var ModernEventValidator = class {
|
|
|
35371
35912
|
}
|
|
35372
35913
|
case "turn/end": {
|
|
35373
35914
|
exactKeys(data, ["turn", "reason"]);
|
|
35374
|
-
const turn =
|
|
35915
|
+
const turn = positiveInteger2(data.turn, "turn/end turn");
|
|
35375
35916
|
validateTurnReason(data.reason);
|
|
35376
35917
|
if (trace.openTurn !== turn || trace.openStep !== null) {
|
|
35377
35918
|
fail("Modern history has an invalid turn/end boundary");
|
|
@@ -35996,9 +36537,9 @@ function modernWorkingDirectory(current, event) {
|
|
|
35996
36537
|
return current;
|
|
35997
36538
|
}
|
|
35998
36539
|
const next = event.data.cwd;
|
|
35999
|
-
if (
|
|
36000
|
-
return
|
|
36001
|
-
return current === void 0 ? void 0 :
|
|
36540
|
+
if (path10.isAbsolute(next))
|
|
36541
|
+
return path10.resolve(next);
|
|
36542
|
+
return current === void 0 ? void 0 : path10.resolve(current, next);
|
|
36002
36543
|
}
|
|
36003
36544
|
function modernMediaRoots(workingDirectory, sessionDirectory) {
|
|
36004
36545
|
return [
|
|
@@ -36193,8 +36734,8 @@ function requireOpenStep(trace, data, label) {
|
|
|
36193
36734
|
}
|
|
36194
36735
|
function stepPosition(data, label) {
|
|
36195
36736
|
return {
|
|
36196
|
-
turn:
|
|
36197
|
-
step:
|
|
36737
|
+
turn: positiveInteger2(data.turn, `${label} turn`),
|
|
36738
|
+
step: positiveInteger2(data.step, `${label} step`)
|
|
36198
36739
|
};
|
|
36199
36740
|
}
|
|
36200
36741
|
function validateUserMessage(data, profile) {
|
|
@@ -36336,7 +36877,7 @@ function validateRequestContext(data) {
|
|
|
36336
36877
|
fail("Modern history request/context has an invalid Model route");
|
|
36337
36878
|
}
|
|
36338
36879
|
if (data.contextWindow !== void 0)
|
|
36339
|
-
|
|
36880
|
+
positiveInteger2(data.contextWindow, "contextWindow");
|
|
36340
36881
|
if (data.systemPromptUpdate !== void 0 && data.systemPromptUpdate !== "in-history")
|
|
36341
36882
|
fail("Modern history request/context systemPromptUpdate is malformed");
|
|
36342
36883
|
}
|
|
@@ -36434,7 +36975,7 @@ function validateCommandDone(data) {
|
|
|
36434
36975
|
}
|
|
36435
36976
|
function validateHookInvoked(data) {
|
|
36436
36977
|
requiredOptionalKeys(data, ["turn", "point", "dialect", "handlerId"], ["matcher"]);
|
|
36437
|
-
|
|
36978
|
+
positiveInteger2(data.turn, "hook/invoked turn");
|
|
36438
36979
|
requiredString(data.point, "hook/invoked point");
|
|
36439
36980
|
enumValue(data.dialect, ["claude-code", "codex"], "hook/invoked dialect");
|
|
36440
36981
|
requiredString(data.handlerId, "hook/invoked handlerId");
|
|
@@ -36444,7 +36985,7 @@ function validateHookInvoked(data) {
|
|
|
36444
36985
|
}
|
|
36445
36986
|
function validateHookResult(data) {
|
|
36446
36987
|
requiredOptionalKeys(data, ["turn", "point", "handlerId", "decision", "durationMs"], ["exitCode", "stderrSummary"]);
|
|
36447
|
-
|
|
36988
|
+
positiveInteger2(data.turn, "hook/result turn");
|
|
36448
36989
|
requiredString(data.point, "hook/result point");
|
|
36449
36990
|
requiredString(data.handlerId, "hook/result handlerId");
|
|
36450
36991
|
requiredString(data.decision, "hook/result decision");
|
|
@@ -36473,22 +37014,22 @@ function validateRetry(data) {
|
|
|
36473
37014
|
"failure"
|
|
36474
37015
|
], []);
|
|
36475
37016
|
requiredString(data.retryId, "llm/retry retryId");
|
|
36476
|
-
|
|
36477
|
-
|
|
37017
|
+
positiveInteger2(data.turn, "llm/retry turn");
|
|
37018
|
+
positiveInteger2(data.step, "llm/retry step");
|
|
36478
37019
|
requiredString(data.provider, "llm/retry provider");
|
|
36479
37020
|
requiredString(data.policyKey, "llm/retry policyKey");
|
|
36480
|
-
|
|
37021
|
+
positiveInteger2(data.retry, "llm/retry retry");
|
|
36481
37022
|
nonNegativeFiniteNumber(data.delayMs, "llm/retry delayMs");
|
|
36482
37023
|
if (mode === "normal")
|
|
36483
|
-
|
|
37024
|
+
positiveInteger2(data.maxRetries, "llm/retry maxRetries");
|
|
36484
37025
|
validateLlmFailure(data.failure, "llm/retry failure");
|
|
36485
37026
|
}
|
|
36486
37027
|
function validateRetryStarted(data) {
|
|
36487
37028
|
exactKeys(data, ["retryId", "turn", "step", "retry"]);
|
|
36488
37029
|
requiredString(data.retryId, "llm/retry-started retryId");
|
|
36489
|
-
|
|
36490
|
-
|
|
36491
|
-
|
|
37030
|
+
positiveInteger2(data.turn, "llm/retry-started turn");
|
|
37031
|
+
positiveInteger2(data.step, "llm/retry-started step");
|
|
37032
|
+
positiveInteger2(data.retry, "llm/retry-started retry");
|
|
36492
37033
|
}
|
|
36493
37034
|
function validateSessionTitle(data) {
|
|
36494
37035
|
exactKeys(data, ["title", "messageSeqs", "source"]);
|
|
@@ -36517,7 +37058,7 @@ function validateSessionTitleRequest(data) {
|
|
|
36517
37058
|
fail("Modern history session/title request message is malformed");
|
|
36518
37059
|
}
|
|
36519
37060
|
}
|
|
36520
|
-
|
|
37061
|
+
positiveInteger2(data.maxTokens, "session/title request maxTokens");
|
|
36521
37062
|
if (data.reasoningEffort !== void 0 && !nonBlankString(data.reasoningEffort)) {
|
|
36522
37063
|
fail("Modern history session/title request reasoningEffort is invalid");
|
|
36523
37064
|
}
|
|
@@ -36544,7 +37085,7 @@ function validateWorkflow(type, data) {
|
|
|
36544
37085
|
if (type === "tool-workflow/agent-start") {
|
|
36545
37086
|
requiredOptionalKeys(data, ["runId", "seq", "label", "childId"], ["phase"]);
|
|
36546
37087
|
requiredString(data.runId, "workflow runId");
|
|
36547
|
-
|
|
37088
|
+
positiveInteger2(data.seq, "workflow agent seq");
|
|
36548
37089
|
if (typeof data.label !== "string")
|
|
36549
37090
|
fail("Modern history workflow agent label is invalid");
|
|
36550
37091
|
requiredString(data.childId, "workflow childId");
|
|
@@ -36556,7 +37097,7 @@ function validateWorkflow(type, data) {
|
|
|
36556
37097
|
if (type === "tool-workflow/agent-end") {
|
|
36557
37098
|
exactKeys(data, ["runId", "seq", "outcome"]);
|
|
36558
37099
|
requiredString(data.runId, "workflow runId");
|
|
36559
|
-
|
|
37100
|
+
positiveInteger2(data.seq, "workflow agent seq");
|
|
36560
37101
|
enumValue(data.outcome, ["completed", "failed", "cancelled"], "workflow agent outcome");
|
|
36561
37102
|
return;
|
|
36562
37103
|
}
|
|
@@ -36622,7 +37163,7 @@ function validateCompaction(type, data) {
|
|
|
36622
37163
|
requiredOptionalKeys(data, ["compactionId", "turn"], type === "compaction/start" ? ["sourceCommandId"] : ["sourceCommandId", "error"]);
|
|
36623
37164
|
requiredString(data.compactionId, "compaction id");
|
|
36624
37165
|
if (data.turn !== null)
|
|
36625
|
-
|
|
37166
|
+
positiveInteger2(data.turn, "compaction turn");
|
|
36626
37167
|
if (data.sourceCommandId !== void 0)
|
|
36627
37168
|
requiredString(data.sourceCommandId, "compaction commandId");
|
|
36628
37169
|
if (data.error !== void 0 && typeof data.error !== "string") {
|
|
@@ -36651,7 +37192,7 @@ function validateCompaction(type, data) {
|
|
|
36651
37192
|
fail("Modern history compaction summary is malformed");
|
|
36652
37193
|
validateShadow(data);
|
|
36653
37194
|
if (data.maxTokens !== void 0)
|
|
36654
|
-
|
|
37195
|
+
positiveInteger2(data.maxTokens, "compaction maxTokens");
|
|
36655
37196
|
if (data.usage !== void 0)
|
|
36656
37197
|
validateUsage(data.usage);
|
|
36657
37198
|
if (data.rawOutput !== void 0 && !Array.isArray(data.rawOutput)) {
|
|
@@ -36755,7 +37296,7 @@ function validateSearchRequest(data) {
|
|
|
36755
37296
|
fail("Modern history search request body is malformed");
|
|
36756
37297
|
requiredOptionalKeys(data.body, ["model", "max_tokens", "messages", "tools"], ["thinking"]);
|
|
36757
37298
|
requiredString(data.body.model, "search request model");
|
|
36758
|
-
|
|
37299
|
+
positiveInteger2(data.body.max_tokens, "search request max_tokens");
|
|
36759
37300
|
if (!Array.isArray(data.body.messages) || !Array.isArray(data.body.tools)) {
|
|
36760
37301
|
fail("Modern history search request arrays are malformed");
|
|
36761
37302
|
}
|
|
@@ -36880,6 +37421,7 @@ var ModernHarnessSession = class {
|
|
|
36880
37421
|
#closing = false;
|
|
36881
37422
|
#nativeCloseTerminal;
|
|
36882
37423
|
#closedNotified = false;
|
|
37424
|
+
#closedNotificationFailed = false;
|
|
36883
37425
|
#faulted;
|
|
36884
37426
|
#faultMayHaveNativeWork = false;
|
|
36885
37427
|
#closeStopUnconfirmed = false;
|
|
@@ -37048,26 +37590,43 @@ var ModernHarnessSession = class {
|
|
|
37048
37590
|
}
|
|
37049
37591
|
}
|
|
37050
37592
|
close() {
|
|
37593
|
+
return this.#close(true);
|
|
37594
|
+
}
|
|
37595
|
+
/** Local teardown must drain before the Adapter can stop the managed process. */
|
|
37596
|
+
closeForAdapter() {
|
|
37597
|
+
return this.#close(false);
|
|
37598
|
+
}
|
|
37599
|
+
#close(waitForManagedStop) {
|
|
37051
37600
|
this.#localClosePromise ??= this.#performClose();
|
|
37052
37601
|
return this.#localClosePromise.then(() => {
|
|
37053
|
-
if (!this.#faultMayHaveNativeWork)
|
|
37602
|
+
if (!this.#faultMayHaveNativeWork) {
|
|
37054
37603
|
return;
|
|
37604
|
+
}
|
|
37055
37605
|
const processStop = this.#managedProcessStop?.();
|
|
37056
|
-
if (processStop)
|
|
37057
|
-
return processStop;
|
|
37606
|
+
if (processStop) {
|
|
37607
|
+
return waitForManagedStop ? processStop : void 0;
|
|
37608
|
+
}
|
|
37058
37609
|
throw new Error("DeepSeek Harness native execution stop was not confirmed before the Session fault");
|
|
37059
37610
|
}, (error62) => {
|
|
37060
|
-
if (this.#faulted || this.#closeStopUnconfirmed) {
|
|
37611
|
+
if (!this.#closedNotificationFailed && (this.#faulted || this.#closeStopUnconfirmed)) {
|
|
37061
37612
|
const processStop = this.#managedProcessStop?.();
|
|
37062
|
-
if (processStop)
|
|
37063
|
-
return processStop;
|
|
37613
|
+
if (processStop) {
|
|
37614
|
+
return waitForManagedStop ? processStop : void 0;
|
|
37615
|
+
}
|
|
37064
37616
|
}
|
|
37065
37617
|
throw error62;
|
|
37066
37618
|
});
|
|
37067
37619
|
}
|
|
37068
37620
|
/** Adapter-owned local teardown drain after fault; never waits on managed process exit. */
|
|
37069
37621
|
async waitForFaultCleanup() {
|
|
37070
|
-
|
|
37622
|
+
try {
|
|
37623
|
+
await this.#localClosePromise;
|
|
37624
|
+
} catch (error62) {
|
|
37625
|
+
if (!this.#closedNotificationFailed && (this.#faulted || this.#closeStopUnconfirmed)) {
|
|
37626
|
+
return;
|
|
37627
|
+
}
|
|
37628
|
+
throw error62;
|
|
37629
|
+
}
|
|
37071
37630
|
}
|
|
37072
37631
|
/** Adapter-owned transport/control fault convergence. */
|
|
37073
37632
|
fault(error62) {
|
|
@@ -38816,6 +39375,7 @@ ${question.detail}` : question.question;
|
|
|
38816
39375
|
this.#abortOperations();
|
|
38817
39376
|
this.#nativeCloseTerminal?.();
|
|
38818
39377
|
this.#localClosePromise ??= this.#performFault(failure2, acceptedPending);
|
|
39378
|
+
void this.#localClosePromise.catch(() => void 0);
|
|
38819
39379
|
}
|
|
38820
39380
|
async #performFault(failure2, acceptedPending) {
|
|
38821
39381
|
await this.#detachEvents().catch(() => void 0);
|
|
@@ -38870,7 +39430,7 @@ ${question.detail}` : question.question;
|
|
|
38870
39430
|
this.#emit({ type: "session.faulted", error: failure2 });
|
|
38871
39431
|
this.#channel.end();
|
|
38872
39432
|
await Promise.allSettled([this.#journal.close(), this.#pumpPromise]);
|
|
38873
|
-
this.#notifyClosed();
|
|
39433
|
+
await this.#notifyClosed();
|
|
38874
39434
|
}
|
|
38875
39435
|
async #performClose() {
|
|
38876
39436
|
this.#closing = true;
|
|
@@ -38913,7 +39473,11 @@ ${question.detail}` : question.question;
|
|
|
38913
39473
|
}
|
|
38914
39474
|
}
|
|
38915
39475
|
if (this.#faulted) {
|
|
38916
|
-
|
|
39476
|
+
try {
|
|
39477
|
+
await this.#performFault(this.#faulted, this.#acceptedPending(pendingAtClose));
|
|
39478
|
+
} catch (error62) {
|
|
39479
|
+
throw sessionCloseFailure(stopFailure, error62);
|
|
39480
|
+
}
|
|
38917
39481
|
throw stopFailure ?? new Error(this.#faulted.message);
|
|
38918
39482
|
}
|
|
38919
39483
|
if (!this.#closed) {
|
|
@@ -38976,7 +39540,11 @@ ${question.detail}` : question.question;
|
|
|
38976
39540
|
flushFailure = error62;
|
|
38977
39541
|
stopFailure ??= error62;
|
|
38978
39542
|
}
|
|
38979
|
-
|
|
39543
|
+
try {
|
|
39544
|
+
await this.#notifyClosed();
|
|
39545
|
+
} catch (error62) {
|
|
39546
|
+
throw sessionCloseFailure(stopFailure, error62);
|
|
39547
|
+
}
|
|
38980
39548
|
if (stopFailure) {
|
|
38981
39549
|
this.#closeStopUnconfirmed = !flushFailure;
|
|
38982
39550
|
throw stopFailure;
|
|
@@ -39023,13 +39591,16 @@ ${question.detail}` : question.question;
|
|
|
39023
39591
|
clearTimeout(pending.correlationTimer);
|
|
39024
39592
|
pending.correlationTimer = void 0;
|
|
39025
39593
|
}
|
|
39026
|
-
#notifyClosed() {
|
|
39027
|
-
if (this.#closedNotified)
|
|
39594
|
+
async #notifyClosed() {
|
|
39595
|
+
if (this.#closedNotified) {
|
|
39028
39596
|
return;
|
|
39597
|
+
}
|
|
39029
39598
|
this.#closedNotified = true;
|
|
39030
39599
|
try {
|
|
39031
|
-
this.#onClosed();
|
|
39032
|
-
} catch {
|
|
39600
|
+
await this.#onClosed();
|
|
39601
|
+
} catch (error62) {
|
|
39602
|
+
this.#closedNotificationFailed = true;
|
|
39603
|
+
throw error62;
|
|
39033
39604
|
}
|
|
39034
39605
|
}
|
|
39035
39606
|
#emit(event) {
|
|
@@ -39122,6 +39693,14 @@ function journalHistoryBytes(events, maximum) {
|
|
|
39122
39693
|
function journalEventBytes(event) {
|
|
39123
39694
|
return Buffer.byteLength(JSON.stringify(event), "utf8");
|
|
39124
39695
|
}
|
|
39696
|
+
function sessionCloseFailure(stopFailure, cleanupFailure) {
|
|
39697
|
+
if (stopFailure === void 0) {
|
|
39698
|
+
return cleanupFailure;
|
|
39699
|
+
}
|
|
39700
|
+
const stopMessage = stopFailure instanceof Error ? stopFailure.message : "Native stop or persistence failed";
|
|
39701
|
+
const cleanupMessage = cleanupFailure instanceof Error ? cleanupFailure.message : "Session cleanup failed";
|
|
39702
|
+
return new AggregateError([stopFailure, cleanupFailure], redactModernCredential(`DeepSeek Harness Session close failed: ${stopMessage}; ${cleanupMessage}`));
|
|
39703
|
+
}
|
|
39125
39704
|
function unavailableError(error62, message, retryable = true) {
|
|
39126
39705
|
const detail = error62 instanceof Error ? error62.message : String(error62);
|
|
39127
39706
|
return {
|
|
@@ -39367,7 +39946,7 @@ function safeTimerDelay(value, name) {
|
|
|
39367
39946
|
|
|
39368
39947
|
// dist/modern/session-list.js
|
|
39369
39948
|
import { Buffer as Buffer5 } from "node:buffer";
|
|
39370
|
-
import
|
|
39949
|
+
import path11 from "node:path";
|
|
39371
39950
|
var MAX_SESSION_LIST_BYTES = 32 * 1024 * 1024;
|
|
39372
39951
|
var MAX_SESSION_LIST_DEPTH = 64;
|
|
39373
39952
|
var MAX_SESSION_LIST_NODES = 2e5;
|
|
@@ -39487,7 +40066,7 @@ function parseSummary(value) {
|
|
|
39487
40066
|
};
|
|
39488
40067
|
}
|
|
39489
40068
|
function isCanonicalAbsoluteCwd(value) {
|
|
39490
|
-
return value !== void 0 && value.trim().length > 0 && !value.includes("\0") &&
|
|
40069
|
+
return value !== void 0 && value.trim().length > 0 && !value.includes("\0") && path11.isAbsolute(value) && path11.resolve(value) === value;
|
|
39491
40070
|
}
|
|
39492
40071
|
function parseModernSessionCandidates(value) {
|
|
39493
40072
|
assertBoundedJson4(value);
|
|
@@ -39569,8 +40148,11 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39569
40148
|
#dependencies;
|
|
39570
40149
|
#options;
|
|
39571
40150
|
#inflight = /* @__PURE__ */ new Set();
|
|
40151
|
+
#opening = /* @__PURE__ */ new Set();
|
|
40152
|
+
#openingCleanupFailures = [];
|
|
39572
40153
|
#sessionIds = /* @__PURE__ */ new Set();
|
|
39573
40154
|
#sessions = /* @__PURE__ */ new Set();
|
|
40155
|
+
#pendingRevocations = /* @__PURE__ */ new Set();
|
|
39574
40156
|
#removeConnectionFaultListener;
|
|
39575
40157
|
#lifetime = new AbortController();
|
|
39576
40158
|
#accepting = true;
|
|
@@ -39585,6 +40167,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39585
40167
|
#declaredEventFailure;
|
|
39586
40168
|
#faultNotified = false;
|
|
39587
40169
|
#normalClose = false;
|
|
40170
|
+
#processStopped = false;
|
|
39588
40171
|
#eventRecovery;
|
|
39589
40172
|
#eventReplacementUsed = false;
|
|
39590
40173
|
constructor(options, dependencies = {}) {
|
|
@@ -39592,7 +40175,8 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39592
40175
|
this.#profile = deepSeekModernProfile(options.version);
|
|
39593
40176
|
this.#dependencies = { ...DEFAULT_DEPENDENCIES2, ...dependencies };
|
|
39594
40177
|
const connectionOptions = {
|
|
39595
|
-
...options
|
|
40178
|
+
...options,
|
|
40179
|
+
delegationBridge: supportsDeepSeekDelegationBridge(options.version)
|
|
39596
40180
|
};
|
|
39597
40181
|
delete connectionOptions.version;
|
|
39598
40182
|
delete connectionOptions.onFault;
|
|
@@ -39623,7 +40207,9 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39623
40207
|
const rejected = validateOpen(input3);
|
|
39624
40208
|
if (rejected)
|
|
39625
40209
|
return Promise.resolve({ ok: false, error: rejected });
|
|
39626
|
-
|
|
40210
|
+
const opening = this.#open(input3).finally(() => this.#opening.delete(opening));
|
|
40211
|
+
this.#opening.add(opening);
|
|
40212
|
+
return this.#track(opening);
|
|
39627
40213
|
}
|
|
39628
40214
|
close() {
|
|
39629
40215
|
if (!this.#closePromise) {
|
|
@@ -39690,7 +40276,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39690
40276
|
let session;
|
|
39691
40277
|
let forkExpectation;
|
|
39692
40278
|
try {
|
|
39693
|
-
const cwd =
|
|
40279
|
+
const cwd = path12.resolve(input3.cwd);
|
|
39694
40280
|
let forkInput = input3.kind === "fork" ? parseModernForkInput(input3, this.#profile) : void 0;
|
|
39695
40281
|
const rollbackSourceSessionId = input3.kind === "rollbackLastTurn" ? modernSessionId(input3.sourceRef, "roll back") : void 0;
|
|
39696
40282
|
let rollbackPlan;
|
|
@@ -39752,8 +40338,13 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39752
40338
|
detachControl = this.#control.attach(sessionId);
|
|
39753
40339
|
this.#assertAccepting();
|
|
39754
40340
|
}
|
|
39755
|
-
if (!sessionId)
|
|
40341
|
+
if (!sessionId) {
|
|
39756
40342
|
throw new Error("unreachable Session open mode");
|
|
40343
|
+
}
|
|
40344
|
+
if (this.#pendingRevocations.has(sessionId)) {
|
|
40345
|
+
await this.#clearSessionEnvironment(sessionId);
|
|
40346
|
+
this.#assertAccepting();
|
|
40347
|
+
}
|
|
39757
40348
|
if (input3.kind === "create" || rollbackPlan?.kind === "create") {
|
|
39758
40349
|
await this.#createSession(sessionId, cwd, rollbackPlan?.kind === "create" ? rollbackPlan.agentPreset : void 0);
|
|
39759
40350
|
this.#assertAccepting();
|
|
@@ -39822,6 +40413,8 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39822
40413
|
retryable: false
|
|
39823
40414
|
});
|
|
39824
40415
|
}
|
|
40416
|
+
await this.#connection.setSessionEnvironment?.(sessionId, input3.environment);
|
|
40417
|
+
this.#assertAccepting();
|
|
39825
40418
|
const openedSession = new ModernHarnessSession({
|
|
39826
40419
|
remote: this.#connection,
|
|
39827
40420
|
journal,
|
|
@@ -39841,11 +40434,15 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39841
40434
|
...this.#options.recoveryOpenTimeoutMs === void 0 ? {} : { recoveryOpenTimeoutMs: this.#options.recoveryOpenTimeoutMs },
|
|
39842
40435
|
...this.#options.promptCorrelationGraceMs === void 0 ? {} : { promptCorrelationGraceMs: this.#options.promptCorrelationGraceMs },
|
|
39843
40436
|
...this.#options.acceptedCorrelationTimeoutMs === void 0 ? {} : { acceptedCorrelationTimeoutMs: this.#options.acceptedCorrelationTimeoutMs },
|
|
39844
|
-
onClosed: () => {
|
|
40437
|
+
onClosed: async () => {
|
|
39845
40438
|
detachControl?.();
|
|
39846
40439
|
detachControl = void 0;
|
|
39847
|
-
|
|
39848
|
-
|
|
40440
|
+
try {
|
|
40441
|
+
await this.#clearSessionEnvironment(sessionId);
|
|
40442
|
+
} finally {
|
|
40443
|
+
this.#sessions.delete(openedSession);
|
|
40444
|
+
this.#sessionIds.delete(sessionId);
|
|
40445
|
+
}
|
|
39849
40446
|
}
|
|
39850
40447
|
});
|
|
39851
40448
|
session = openedSession;
|
|
@@ -39863,24 +40460,45 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
39863
40460
|
}
|
|
39864
40461
|
return { ok: true, value: openedSession };
|
|
39865
40462
|
} catch (error62) {
|
|
39866
|
-
|
|
40463
|
+
let cleanupFailure;
|
|
40464
|
+
const recordCleanupFailure = (closeError) => {
|
|
40465
|
+
cleanupFailure = toHarnessError(closeError, "unavailable");
|
|
40466
|
+
if (!this.#accepting) {
|
|
40467
|
+
this.#openingCleanupFailures.push(closeError);
|
|
40468
|
+
}
|
|
40469
|
+
};
|
|
40470
|
+
if (session) {
|
|
40471
|
+
await session.closeForAdapter().catch(recordCleanupFailure);
|
|
40472
|
+
}
|
|
39867
40473
|
await journal?.close().catch(() => void 0);
|
|
39868
|
-
|
|
39869
|
-
|
|
40474
|
+
if (!session && reservedSessionId) {
|
|
40475
|
+
await this.#clearSessionEnvironment(reservedSessionId).catch(recordCleanupFailure);
|
|
40476
|
+
detachControl?.();
|
|
39870
40477
|
this.#sessionIds.delete(reservedSessionId);
|
|
39871
|
-
|
|
40478
|
+
}
|
|
40479
|
+
let failure2 = toHarnessError(error62, "nativeFailure");
|
|
39872
40480
|
if (forkExpectation) {
|
|
39873
|
-
|
|
39874
|
-
|
|
39875
|
-
|
|
39876
|
-
|
|
40481
|
+
failure2 = { code: failure2.code, message: FORK_ORPHAN_MESSAGE, retryable: false };
|
|
40482
|
+
} else if (input3.kind === "fork") {
|
|
40483
|
+
failure2 = { ...failure2, retryable: false };
|
|
40484
|
+
}
|
|
40485
|
+
if (cleanupFailure) {
|
|
40486
|
+
failure2 = sanitizedHarnessError2({
|
|
40487
|
+
...failure2,
|
|
40488
|
+
message: `${failure2.message}; Session cleanup was not confirmed: ${cleanupFailure.message}`
|
|
40489
|
+
});
|
|
39877
40490
|
}
|
|
39878
40491
|
return {
|
|
39879
40492
|
ok: false,
|
|
39880
|
-
error:
|
|
40493
|
+
error: failure2
|
|
39881
40494
|
};
|
|
39882
40495
|
}
|
|
39883
40496
|
}
|
|
40497
|
+
async #clearSessionEnvironment(sessionId) {
|
|
40498
|
+
this.#pendingRevocations.add(sessionId);
|
|
40499
|
+
await this.#connection.setSessionEnvironment?.(sessionId);
|
|
40500
|
+
this.#pendingRevocations.delete(sessionId);
|
|
40501
|
+
}
|
|
39884
40502
|
async #openWebUi() {
|
|
39885
40503
|
if (!this.#accepting || !this.#connection.openWebUi) {
|
|
39886
40504
|
return { ok: false, error: this.#stoppedError() };
|
|
@@ -40119,7 +40737,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
40119
40737
|
return;
|
|
40120
40738
|
this.#faultNotified = true;
|
|
40121
40739
|
try {
|
|
40122
|
-
this.#options.onFault?.(error62);
|
|
40740
|
+
this.#options.onFault?.(error62, () => this.#retire());
|
|
40123
40741
|
} catch {
|
|
40124
40742
|
}
|
|
40125
40743
|
}
|
|
@@ -40180,17 +40798,30 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
40180
40798
|
}
|
|
40181
40799
|
return this.#closePromise;
|
|
40182
40800
|
}
|
|
40801
|
+
async #retire() {
|
|
40802
|
+
try {
|
|
40803
|
+
await this.close();
|
|
40804
|
+
} catch (error62) {
|
|
40805
|
+
if (!this.#processStopped) {
|
|
40806
|
+
throw error62;
|
|
40807
|
+
}
|
|
40808
|
+
}
|
|
40809
|
+
}
|
|
40183
40810
|
async #stopAfterFault(failure2) {
|
|
40184
40811
|
this.#lifetime.abort(new Error("DeepSeek Harness Adapter closed"));
|
|
40185
40812
|
this.#removeConnectionFaultListener();
|
|
40186
40813
|
const sessions = [...this.#sessions];
|
|
40187
|
-
await Promise.allSettled(sessions.map((session) => {
|
|
40814
|
+
const sessionResults = await Promise.allSettled(sessions.map((session) => {
|
|
40188
40815
|
session.fault(failure2);
|
|
40189
40816
|
return session.waitForFaultCleanup();
|
|
40190
40817
|
}));
|
|
40191
40818
|
await this.#events.close().catch(() => void 0);
|
|
40192
40819
|
await this.#control.close().catch(() => void 0);
|
|
40193
|
-
await this.#
|
|
40820
|
+
await Promise.allSettled([...this.#opening]);
|
|
40821
|
+
const revocationResults = await Promise.allSettled([...this.#pendingRevocations].map((sessionId) => this.#clearSessionEnvironment(sessionId)));
|
|
40822
|
+
const [connectionResult] = await Promise.allSettled([this.#connection.close()]);
|
|
40823
|
+
this.#processStopped = connectionResult.status === "fulfilled" || this.#connection.processStopped === true;
|
|
40824
|
+
throwCleanupFailures([...sessionResults, ...revocationResults, connectionResult], this.#openingCleanupFailures);
|
|
40194
40825
|
}
|
|
40195
40826
|
async #performNormalClose() {
|
|
40196
40827
|
this.#lifetime.abort(new Error("DeepSeek Harness Adapter closed"));
|
|
@@ -40199,15 +40830,28 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
40199
40830
|
const sessionResults = await Promise.allSettled(sessions.map((session) => session.close()));
|
|
40200
40831
|
await this.#events.close().catch(() => void 0);
|
|
40201
40832
|
await this.#control.close().catch(() => void 0);
|
|
40833
|
+
await Promise.allSettled([...this.#opening]);
|
|
40834
|
+
const revocationResults = await Promise.allSettled([...this.#pendingRevocations].map((sessionId) => this.#clearSessionEnvironment(sessionId)));
|
|
40202
40835
|
const [connectionResult] = await Promise.allSettled([this.#connection.close()]);
|
|
40836
|
+
this.#processStopped = connectionResult.status === "fulfilled" || this.#connection.processStopped === true;
|
|
40203
40837
|
await Promise.allSettled([...this.#inflight, this.#eventRecovery]);
|
|
40204
|
-
|
|
40205
|
-
throw connectionResult.reason;
|
|
40206
|
-
const sessionFailure = sessionResults.find((result) => result.status === "rejected");
|
|
40207
|
-
if (sessionFailure?.status === "rejected")
|
|
40208
|
-
throw sessionFailure.reason;
|
|
40838
|
+
throwCleanupFailures([...sessionResults, ...revocationResults, connectionResult], this.#openingCleanupFailures);
|
|
40209
40839
|
}
|
|
40210
40840
|
};
|
|
40841
|
+
function throwCleanupFailures(results, openingFailures) {
|
|
40842
|
+
const failures = [
|
|
40843
|
+
.../* @__PURE__ */ new Set([
|
|
40844
|
+
...results.flatMap((result) => result.status === "rejected" ? [result.reason] : []),
|
|
40845
|
+
...openingFailures
|
|
40846
|
+
])
|
|
40847
|
+
];
|
|
40848
|
+
if (failures.length === 1) {
|
|
40849
|
+
throw failures[0];
|
|
40850
|
+
}
|
|
40851
|
+
if (failures.length > 1) {
|
|
40852
|
+
throw new AggregateError(failures, redactModernCredential(`DeepSeek Harness cleanup failed: ${failures.map((error62) => error62 instanceof Error ? error62.message : "Cleanup failed").join("; ")}`));
|
|
40853
|
+
}
|
|
40854
|
+
}
|
|
40211
40855
|
var AdapterOperationError = class extends Error {
|
|
40212
40856
|
harnessError;
|
|
40213
40857
|
constructor(harnessError) {
|
|
@@ -40482,11 +41126,11 @@ function toHarnessError(error62, fallback) {
|
|
|
40482
41126
|
if (error62 instanceof ModernConfigurationError) {
|
|
40483
41127
|
return sanitizedHarnessError2(modernConfigurationHarnessError(error62));
|
|
40484
41128
|
}
|
|
40485
|
-
return {
|
|
41129
|
+
return sanitizedHarnessError2({
|
|
40486
41130
|
code: fallback,
|
|
40487
|
-
message: "DeepSeek Harness operation failed",
|
|
41131
|
+
message: error62 instanceof AggregateError ? error62.message : "DeepSeek Harness operation failed",
|
|
40488
41132
|
retryable: fallback === "unavailable" || fallback === "nativeFailure"
|
|
40489
|
-
};
|
|
41133
|
+
});
|
|
40490
41134
|
}
|
|
40491
41135
|
function sanitizedHarnessError2(error62) {
|
|
40492
41136
|
return {
|
|
@@ -40765,7 +41409,7 @@ var DeepSeekHarnessAdapter = class {
|
|
|
40765
41409
|
version: executable.version,
|
|
40766
41410
|
command: executable.command.command,
|
|
40767
41411
|
commandArguments: executable.command.arguments,
|
|
40768
|
-
onFault: (error62) => this.#handleDelegateFault(owner, error62)
|
|
41412
|
+
onFault: (error62, retire) => this.#handleDelegateFault(owner, error62, retire)
|
|
40769
41413
|
});
|
|
40770
41414
|
const owner = {
|
|
40771
41415
|
adapter,
|
|
@@ -40789,14 +41433,17 @@ var DeepSeekHarnessAdapter = class {
|
|
|
40789
41433
|
throw cleanupFailure ?? error62;
|
|
40790
41434
|
}
|
|
40791
41435
|
}
|
|
40792
|
-
#handleDelegateFault(owner, error62) {
|
|
41436
|
+
#handleDelegateFault(owner, error62, retire) {
|
|
40793
41437
|
owner.faultError ??= error62;
|
|
41438
|
+
if (retire) {
|
|
41439
|
+
owner.retire ??= retire;
|
|
41440
|
+
}
|
|
40794
41441
|
if (this.#closed || this.#delegate !== owner)
|
|
40795
41442
|
return;
|
|
40796
41443
|
this.#delegate = void 0;
|
|
40797
41444
|
this.#failure = void 0;
|
|
40798
41445
|
const previous = this.#retiring ?? Promise.resolve();
|
|
40799
|
-
const retiring = previous.then(() => this.#
|
|
41446
|
+
const retiring = previous.then(() => this.#closeForReplacement(owner).catch(() => {
|
|
40800
41447
|
this.#recordCleanupFailure();
|
|
40801
41448
|
})).finally(() => {
|
|
40802
41449
|
if (this.#retiring === retiring)
|
|
@@ -40841,9 +41488,20 @@ var DeepSeekHarnessAdapter = class {
|
|
|
40841
41488
|
owner.closePromise ??= owner.adapter.close();
|
|
40842
41489
|
return owner.closePromise;
|
|
40843
41490
|
}
|
|
40844
|
-
async #
|
|
41491
|
+
async #closeForReplacement(owner) {
|
|
40845
41492
|
try {
|
|
40846
41493
|
await this.#closeOwner(owner);
|
|
41494
|
+
} catch (error62) {
|
|
41495
|
+
this.#cleanupFailed = true;
|
|
41496
|
+
if (!owner.retire) {
|
|
41497
|
+
throw error62;
|
|
41498
|
+
}
|
|
41499
|
+
await owner.retire();
|
|
41500
|
+
}
|
|
41501
|
+
}
|
|
41502
|
+
async #closeFailedCandidate(owner) {
|
|
41503
|
+
try {
|
|
41504
|
+
await this.#closeForReplacement(owner);
|
|
40847
41505
|
} catch {
|
|
40848
41506
|
return this.#recordCleanupFailure();
|
|
40849
41507
|
} finally {
|
|
@@ -40963,8 +41621,8 @@ function closedError2() {
|
|
|
40963
41621
|
|
|
40964
41622
|
// dist/installation.js
|
|
40965
41623
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
40966
|
-
import { mkdir, rename, rm as
|
|
40967
|
-
import
|
|
41624
|
+
import { mkdir, rename, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
|
|
41625
|
+
import path13 from "node:path";
|
|
40968
41626
|
function createDeepSeekInstallation(environment, command) {
|
|
40969
41627
|
let update;
|
|
40970
41628
|
return createInstallationManager({
|
|
@@ -40988,13 +41646,13 @@ function createDeepSeekInstallation(environment, command) {
|
|
|
40988
41646
|
throw new Error("DSH offline npx launch still selects a different version");
|
|
40989
41647
|
const destination = deepSeekNpxVersionFile(environment);
|
|
40990
41648
|
const temporary = `${destination}.${randomUUID3()}.tmp`;
|
|
40991
|
-
await mkdir(
|
|
41649
|
+
await mkdir(path13.dirname(destination), { recursive: true, mode: 448 });
|
|
40992
41650
|
try {
|
|
40993
|
-
await
|
|
41651
|
+
await writeFile3(temporary, `${version2}
|
|
40994
41652
|
`, { flag: "wx", mode: 384 });
|
|
40995
41653
|
await rename(temporary, destination);
|
|
40996
41654
|
} finally {
|
|
40997
|
-
await
|
|
41655
|
+
await rm3(temporary, { force: true }).catch(() => void 0);
|
|
40998
41656
|
}
|
|
40999
41657
|
} : npm?.update;
|
|
41000
41658
|
const canUpdate = isNpx || (npm?.canUpdate ?? false);
|