@codexhost/cli-win32-x64 0.32.1 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +559 -15
- package/app/console-web.js +1361 -192
- package/app/desktop-controller.mjs +620 -16
- package/app/desktop-mcp-client.mjs +619 -0
- package/app/host-runtime.mjs +10370 -5625
- package/app/plugins/antigravity/plugin.mjs +888 -73
- package/app/plugins/claude-code/assets/icon.svg +1 -1
- package/app/plugins/claude-code/manifest.json +1 -1
- package/app/plugins/claude-code/plugin.mjs +1280 -198
- package/app/plugins/codebuddy/plugin.mjs +643 -35
- package/app/plugins/codex-usage/plugin.mjs +544 -12
- package/app/plugins/copilot/assets/icon.svg +1 -1
- package/app/plugins/copilot/manifest.json +1 -1
- package/app/plugins/copilot/plugin.mjs +546 -14
- package/app/plugins/cursor-cli/plugin.mjs +544 -12
- package/app/plugins/deepseek-harness/assets/icon.svg +1 -1
- package/app/plugins/deepseek-harness/manifest.json +1 -1
- package/app/plugins/deepseek-harness/plugin.mjs +983 -153
- package/app/plugins/devin/assets/icon.svg +1 -1
- package/app/plugins/devin/manifest.json +1 -1
- package/app/plugins/devin/plugin.mjs +546 -13
- package/app/plugins/enabled.json +1 -0
- package/app/plugins/grok/plugin.mjs +544 -12
- package/app/plugins/hermes/plugin.mjs +544 -12
- package/app/plugins/kimi-code/plugin.mjs +544 -12
- package/app/plugins/kiro-cli/plugin.mjs +544 -12
- package/app/plugins/omp/assets/icon.svg +1 -1
- package/app/plugins/omp/plugin.mjs +1381 -243
- package/app/plugins/opencode/plugin.mjs +548 -13
- package/app/plugins/pi/assets/icon.svg +1 -1
- package/app/plugins/pi/manifest.json +1 -1
- package/app/plugins/pi/plugin.mjs +572 -14
- package/app/plugins/qoder/assets/icon.svg +1 -1
- package/app/plugins/qoder/plugin.mjs +570 -12
- package/app/plugins/qoder-cn/assets/icon.svg +1 -1
- package/app/plugins/qoder-cn/plugin.mjs +570 -12
- package/app/plugins/qwen-code/assets/icon.svg +1 -1
- package/app/plugins/qwen-code/plugin.mjs +573 -12
- package/app/plugins/workbuddy/plugin.mjs +1263 -472
- package/app/plugins/workbuddy-cn/assets/icon.svg +27 -0
- package/app/plugins/workbuddy-cn/manifest.json +32 -0
- package/app/plugins/workbuddy-cn/plugin.mjs +36211 -0
- package/app/plugins/zcode/plugin.mjs +564 -19
- package/app/renderer-extension.js +2932 -262
- package/app/web/assets/{abnfDiagram-XWFEHMT6-7XITZmBH.js → abnfDiagram-XWFEHMT6-Cg-E7mc4.js} +1 -1
- package/app/web/assets/{architectureDiagram-CSQXQB3N-C8Usdzd8.js → architectureDiagram-CSQXQB3N-B__CwXjW.js} +1 -1
- package/app/web/assets/{blockDiagram-BEDRHYPZ-CyN9yE_Q.js → blockDiagram-BEDRHYPZ-Bk2gCIVM.js} +1 -1
- package/app/web/assets/{c4Diagram-M2UUVUY5-CjhY1l3g.js → c4Diagram-M2UUVUY5-DU_TpjJ3.js} +1 -1
- package/app/web/assets/{chunk-2Q5K7J3B-o24_rh4_.js → chunk-2Q5K7J3B-DnJEi6e4.js} +1 -1
- package/app/web/assets/{chunk-3GCGMST5-D7bw3E1a.js → chunk-3GCGMST5-Dia9jGkf.js} +1 -1
- package/app/web/assets/{chunk-5VM5RSS4-D0v4acf7.js → chunk-5VM5RSS4-2PGDiDvK.js} +1 -1
- package/app/web/assets/{chunk-7U7NFRK5-CYJxP4rV.js → chunk-7U7NFRK5-BLPm3d5H.js} +1 -1
- package/app/web/assets/{chunk-CNRTWJTD-DTgCtcCl.js → chunk-CNRTWJTD-GH_nAEXs.js} +1 -1
- package/app/web/assets/{chunk-D5HYT7QG-qRNelehW.js → chunk-D5HYT7QG-DnIm-Ely.js} +1 -1
- package/app/web/assets/{chunk-EBZ3SEQC-BgJPPYdu.js → chunk-EBZ3SEQC-C6N5qLCR.js} +2 -2
- package/app/web/assets/{chunk-JWPE2WC7-C50ZnSQQ.js → chunk-JWPE2WC7-D_kMgdmr.js} +1 -1
- package/app/web/assets/{chunk-KTR4FSNJ-Cifh4XHc.js → chunk-KTR4FSNJ-BRb9femQ.js} +1 -1
- package/app/web/assets/{chunk-XXDRQBXY-D23WAHPW.js → chunk-XXDRQBXY-BFaK95zq.js} +1 -1
- package/app/web/assets/{classDiagram-v2-KXABOMEV-B3cezFGj.js → classDiagram-v2-KXABOMEV--_hR_XrU.js} +1 -1
- package/app/web/assets/{cose-bilkent-JH36ORCC-VSMi4La2.js → cose-bilkent-JH36ORCC-C7ghEB3_.js} +1 -1
- package/app/web/assets/{cynefin-EF2NZ3EQ-qQnfHq16.js → cynefin-EF2NZ3EQ-Ce1lURwZ.js} +1 -1
- package/app/web/assets/{cynefinDiagram-NJNITYFG-BJELApXD.js → cynefinDiagram-NJNITYFG-Cgr5aSTS.js} +1 -1
- package/app/web/assets/{dagre-KIHZ2IZ3-C8B5ZMVs.js → dagre-KIHZ2IZ3-BBFKmRP1.js} +1 -1
- package/app/web/assets/{diagram-7YQZDPLS-HIWoNpzV.js → diagram-7YQZDPLS-CJQih32K.js} +1 -1
- package/app/web/assets/{diagram-QBROCOUO-3_vS1jbp.js → diagram-QBROCOUO-Cl3S7IUT.js} +1 -1
- package/app/web/assets/{diagram-RJJCUUZO-C_Kndn_e.js → diagram-RJJCUUZO-B6C8N2cV.js} +1 -1
- package/app/web/assets/{diagram-WERXNKYE-BLWdOwya.js → diagram-WERXNKYE-NkciBSQl.js} +1 -1
- package/app/web/assets/{diagram-YHHI257C-DJeOs6eS.js → diagram-YHHI257C-DlEvljeY.js} +1 -1
- package/app/web/assets/{diagram-YR4HJLHV-BKNULu-g.js → diagram-YR4HJLHV-e4_Gzbt6.js} +1 -1
- package/app/web/assets/{ebnfDiagram-N527522P-Bu8aReoF.js → ebnfDiagram-N527522P-WvQEFmPi.js} +1 -1
- package/app/web/assets/{elk-O5DQBFGD-CIp7Z0ER.js → elk-O5DQBFGD-CkyJsjzf.js} +1 -1
- package/app/web/assets/{erDiagram-K3K3BIDK-BTsor1Lp.js → erDiagram-K3K3BIDK-B93gK3X0.js} +1 -1
- package/app/web/assets/{flowDiagram-Z6JWZHQI-p_h5PKQr.js → flowDiagram-Z6JWZHQI-NFaGX6B4.js} +1 -1
- package/app/web/assets/{ganttDiagram-3PRQTZWP-DKjfPPJ1.js → ganttDiagram-3PRQTZWP-Czh68CQm.js} +1 -1
- package/app/web/assets/{gitGraphDiagram-VXDFKS5L-RnPOf2fj.js → gitGraphDiagram-VXDFKS5L-t95UHKja.js} +1 -1
- package/app/web/assets/{grid-E2QIVN74-C96GnBO1.js → grid-E2QIVN74-C87DucDN.js} +1 -1
- package/app/web/assets/index-CGI50Nfg.css +1 -0
- package/app/web/assets/index-Dr6wHi0A.js +208 -0
- package/app/web/assets/{infoDiagram-EZ3ZOAHP-B68eZHsb.js → infoDiagram-EZ3ZOAHP-CxFlfQbY.js} +1 -1
- package/app/web/assets/{ishikawaDiagram-S3EKX5GW-BLj7PFLt.js → ishikawaDiagram-S3EKX5GW-D4IwQJde.js} +1 -1
- package/app/web/assets/{journeyDiagram-POQNLL5X-Bo-_In0d.js → journeyDiagram-POQNLL5X-C0Bf5W4T.js} +1 -1
- package/app/web/assets/{kanban-definition-BH5XI6FM-BpHvxprW.js → kanban-definition-BH5XI6FM-Cda7r2yr.js} +1 -1
- package/app/web/assets/langs/{graphql-D6Z3qcRW.js → graphql-2R4AZ1iu.js} +1 -1
- package/app/web/assets/langs/{http-XiU9G9In.js → http-q2Qm0vBh.js} +1 -1
- package/app/web/assets/langs/{php-DL3xwS-7.js → php-Cz2gDBnd.js} +1 -1
- package/app/web/assets/langs/{rst-DudRVJ9g.js → rst-_9muvx-X.js} +1 -1
- package/app/web/assets/langs/{ruby-_FqsfqJi.js → ruby-cn7REk4H.js} +1 -1
- package/app/web/assets/langs/{svelte-ClsVJoBT.js → svelte-CPnL2mcy.js} +1 -1
- package/app/web/assets/langs/{vue-BiKMXCyK.js → vue-DO0YwyVz.js} +1 -1
- package/app/web/assets/{mermaid.core-COb9i2Gl.js → mermaid.core-f4LJm6AC.js} +5 -5
- package/app/web/assets/{mindmap-definition-WVAN44T4-DG15AlXd.js → mindmap-definition-WVAN44T4-DKapinG7.js} +1 -1
- package/app/web/assets/{pegDiagram-D4NLKWP3-GMBk8RM6.js → pegDiagram-D4NLKWP3-D7iEZGN2.js} +1 -1
- package/app/web/assets/{pieDiagram-36ENHN4W-BzeJgVnn.js → pieDiagram-36ENHN4W-CopXZ5qt.js} +1 -1
- package/app/web/assets/{quadrantDiagram-ZQUDMS73-C--Kif6a.js → quadrantDiagram-ZQUDMS73-mmkKPDGK.js} +1 -1
- package/app/web/assets/{railroadDiagram-JIZHGYPL-NPLVu_R7.js → railroadDiagram-JIZHGYPL-BAGwIIkV.js} +1 -1
- package/app/web/assets/{render-VIF2ZAQL-DdpQ8E0J.js → render-VIF2ZAQL-dXxGa09y.js} +2 -2
- package/app/web/assets/{requirementDiagram-AXW2TVFA-WWRwRbkA.js → requirementDiagram-AXW2TVFA-C35tmLFs.js} +1 -1
- package/app/web/assets/{sankeyDiagram-FBCJTAIF-hBr6pZ0V.js → sankeyDiagram-FBCJTAIF-BbSo5yeK.js} +1 -1
- package/app/web/assets/{sequenceDiagram-3LA2ROMG-DvzZWy5J.js → sequenceDiagram-3LA2ROMG-Cgm2unNy.js} +1 -1
- package/app/web/assets/{sizeCapture-2Q2CQKSF-C2B86W70.js → sizeCapture-2Q2CQKSF-DCXFjl2x.js} +1 -1
- package/app/web/assets/{stateDiagram-v2-ATKHQDJO-Jwj3XqMx.js → stateDiagram-v2-ATKHQDJO-B349iAao.js} +1 -1
- package/app/web/assets/{swimlanes-YQL5WMAO-DxI0hC09.js → swimlanes-YQL5WMAO-6OvL1sEz.js} +1 -1
- package/app/web/assets/swimlanesDiagram-UCCPES4V-CIKaQUvP.js +8 -0
- package/app/web/assets/{timeline-definition-7Z437IG3-m8Ew8iuN.js → timeline-definition-7Z437IG3-Bh1E3mhW.js} +1 -1
- package/app/web/assets/{usecaseDiagram-RDK6N6HP-BsiPSzIT.js → usecaseDiagram-RDK6N6HP-Dr5A05lL.js} +1 -1
- package/app/web/assets/{vendor-BKfNgqAm.js → vendor-BMCjWFMy.js} +20 -20
- package/app/web/assets/{vennDiagram-SHRQU5PJ-yYfXhiGp.js → vennDiagram-SHRQU5PJ-CQPPBa27.js} +1 -1
- package/app/web/assets/{wardleyDiagram-F3OXNVQS-DHLEfnsg.js → wardleyDiagram-F3OXNVQS-BHin00q8.js} +1 -1
- package/app/web/assets/{xychartDiagram-GDYJKCDI-Drn_UxYt.js → xychartDiagram-GDYJKCDI-D4BAWlQZ.js} +1 -1
- package/app/web/codex-agent.png +0 -0
- package/app/web/codex.png +0 -0
- package/app/web/codexhost-settings.js +337 -137
- package/app/web/index.html +3 -3
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +162 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +104 -100
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +114 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +5 -5
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +6 -6
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +80 -80
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +69 -69
- package/app/web/role-avatars/builtin/advisor-otter.webp +0 -0
- package/app/web/role-avatars/builtin/architect-otter.webp +0 -0
- package/app/web/role-avatars/builtin/audio-otter.webp +0 -0
- package/app/web/role-avatars/builtin/backend-otter.webp +0 -0
- package/app/web/role-avatars/builtin/builder-otter.webp +0 -0
- package/app/web/role-avatars/builtin/classic-otter.webp +0 -0
- package/app/web/role-avatars/builtin/data-otter.webp +0 -0
- package/app/web/role-avatars/builtin/debugger-otter.webp +0 -0
- package/app/web/role-avatars/builtin/frontend-otter.webp +0 -0
- package/app/web/role-avatars/builtin/idea-otter.webp +0 -0
- package/app/web/role-avatars/builtin/ops-otter.webp +0 -0
- package/app/web/role-avatars/builtin/pm-otter.webp +0 -0
- package/app/web/role-avatars/builtin/researcher-otter.webp +0 -0
- package/app/web/role-avatars/builtin/reviewer-otter.webp +0 -0
- package/app/web/role-avatars/builtin/sailor-otter.webp +0 -0
- package/app/web/role-avatars/builtin/scholar-otter.webp +0 -0
- package/app/web/role-avatars/builtin/security-otter.webp +0 -0
- package/app/web/role-avatars/builtin/tester-otter.webp +0 -0
- package/app/web/role-avatars/builtin/wizard-otter.webp +0 -0
- package/app/web/role-avatars/builtin/writer-otter.webp +0 -0
- package/app/web-modules/node_modules/@deepseek-ai/dsh-host-webserver/index.js +7 -1
- package/app/web-modules/server.mjs +6951 -2390
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-screenshot.exe +0 -0
- package/libexec/codexhost-shell.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-CDRWzs-u.js +0 -205
- package/app/web/assets/index-Dwdnvinl.css +0 -1
- package/app/web/assets/swimlanesDiagram-UCCPES4V-CR0nv8kJ.js +0 -8
|
@@ -828,10 +828,10 @@ function mergeDefs(...defs) {
|
|
|
828
828
|
function cloneDef(schema) {
|
|
829
829
|
return mergeDefs(schema._zod.def);
|
|
830
830
|
}
|
|
831
|
-
function getElementAtPath(obj,
|
|
832
|
-
if (!
|
|
831
|
+
function getElementAtPath(obj, path14) {
|
|
832
|
+
if (!path14)
|
|
833
833
|
return obj;
|
|
834
|
-
return
|
|
834
|
+
return path14.reduce((acc, key) => acc?.[key], obj);
|
|
835
835
|
}
|
|
836
836
|
function promiseAllObject(promisesObj) {
|
|
837
837
|
const keys = Object.keys(promisesObj);
|
|
@@ -1171,11 +1171,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1171
1171
|
}
|
|
1172
1172
|
return false;
|
|
1173
1173
|
}
|
|
1174
|
-
function prefixIssues(
|
|
1174
|
+
function prefixIssues(path14, issues) {
|
|
1175
1175
|
return issues.map((iss) => {
|
|
1176
1176
|
var _a3;
|
|
1177
1177
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1178
|
-
iss.path.unshift(
|
|
1178
|
+
iss.path.unshift(path14);
|
|
1179
1179
|
return iss;
|
|
1180
1180
|
});
|
|
1181
1181
|
}
|
|
@@ -1637,16 +1637,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
1637
1637
|
}
|
|
1638
1638
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
1639
1639
|
const fieldErrors = { _errors: [] };
|
|
1640
|
-
const processError = (error63,
|
|
1640
|
+
const processError = (error63, path14 = []) => {
|
|
1641
1641
|
for (const issue2 of error63.issues) {
|
|
1642
1642
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1643
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1643
|
+
issue2.errors.map((issues) => processError({ issues }, [...path14, ...issue2.path]));
|
|
1644
1644
|
} else if (issue2.code === "invalid_key") {
|
|
1645
|
-
processError({ issues: issue2.issues }, [...
|
|
1645
|
+
processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
|
|
1646
1646
|
} else if (issue2.code === "invalid_element") {
|
|
1647
|
-
processError({ issues: issue2.issues }, [...
|
|
1647
|
+
processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
|
|
1648
1648
|
} else {
|
|
1649
|
-
const fullpath = [...
|
|
1649
|
+
const fullpath = [...path14, ...issue2.path];
|
|
1650
1650
|
if (fullpath.length === 0) {
|
|
1651
1651
|
fieldErrors._errors.push(mapper(issue2));
|
|
1652
1652
|
} else {
|
|
@@ -1685,17 +1685,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
1685
1685
|
}
|
|
1686
1686
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
1687
1687
|
const result = { errors: [] };
|
|
1688
|
-
const processError = (error63,
|
|
1688
|
+
const processError = (error63, path14 = []) => {
|
|
1689
1689
|
var _a3;
|
|
1690
1690
|
for (const issue2 of error63.issues) {
|
|
1691
1691
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1692
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1692
|
+
issue2.errors.map((issues) => processError({ issues }, [...path14, ...issue2.path]));
|
|
1693
1693
|
} else if (issue2.code === "invalid_key") {
|
|
1694
|
-
processError({ issues: issue2.issues }, [...
|
|
1694
|
+
processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
|
|
1695
1695
|
} else if (issue2.code === "invalid_element") {
|
|
1696
|
-
processError({ issues: issue2.issues }, [...
|
|
1696
|
+
processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
|
|
1697
1697
|
} else {
|
|
1698
|
-
const fullpath = [...
|
|
1698
|
+
const fullpath = [...path14, ...issue2.path];
|
|
1699
1699
|
if (fullpath.length === 0) {
|
|
1700
1700
|
result.errors.push(mapper(issue2));
|
|
1701
1701
|
continue;
|
|
@@ -1734,8 +1734,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
1734
1734
|
}
|
|
1735
1735
|
function toDotPath(_path) {
|
|
1736
1736
|
const segs = [];
|
|
1737
|
-
const
|
|
1738
|
-
for (const seg of
|
|
1737
|
+
const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1738
|
+
for (const seg of path14) {
|
|
1739
1739
|
if (typeof seg === "number")
|
|
1740
1740
|
segs.push(`[${seg}]`);
|
|
1741
1741
|
else if (typeof seg === "symbol")
|
|
@@ -18873,13 +18873,13 @@ function resolveRef(ref, ctx) {
|
|
|
18873
18873
|
if (!ref.startsWith("#")) {
|
|
18874
18874
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
18875
18875
|
}
|
|
18876
|
-
const
|
|
18877
|
-
if (
|
|
18876
|
+
const path14 = ref.slice(1).split("/").filter(Boolean);
|
|
18877
|
+
if (path14.length === 0) {
|
|
18878
18878
|
return ctx.rootSchema;
|
|
18879
18879
|
}
|
|
18880
18880
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
18881
|
-
if (
|
|
18882
|
-
const key =
|
|
18881
|
+
if (path14[0] === defsKey) {
|
|
18882
|
+
const key = path14[1] === void 0 ? void 0 : decodeJSONPointerSegment(path14[1]);
|
|
18883
18883
|
if (!key || !ctx.defs[key]) {
|
|
18884
18884
|
throw new Error(`Reference not found: ${ref}`);
|
|
18885
18885
|
}
|
|
@@ -19815,6 +19815,8 @@ var harnessIdSchema = opaqueIdSchema.brand();
|
|
|
19815
19815
|
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
19816
19816
|
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
19817
19817
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
19818
|
+
var HARNESS_THINKING_OPTION_ID_MAX_LENGTH = 128;
|
|
19819
|
+
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();
|
|
19818
19820
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
19819
19821
|
|
|
19820
19822
|
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
@@ -19896,6 +19898,126 @@ var threadHandoffResultSchema = external_exports.object({
|
|
|
19896
19898
|
handoff: threadHandoffMetadataSchema
|
|
19897
19899
|
}).strict();
|
|
19898
19900
|
|
|
19901
|
+
// ../../shared-contracts/dist/agent-role.js
|
|
19902
|
+
var roleSlugSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/u);
|
|
19903
|
+
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");
|
|
19904
|
+
var roleAccentColorSchema = external_exports.enum(["stone", "rose", "mist", "sage", "amber", "aqua"]);
|
|
19905
|
+
var BUILTIN_ROLE_AVATAR_IDS = [
|
|
19906
|
+
"pm-otter",
|
|
19907
|
+
"frontend-otter",
|
|
19908
|
+
"backend-otter",
|
|
19909
|
+
"reviewer-otter",
|
|
19910
|
+
"idea-otter",
|
|
19911
|
+
"researcher-otter",
|
|
19912
|
+
"writer-otter",
|
|
19913
|
+
"architect-otter",
|
|
19914
|
+
"debugger-otter",
|
|
19915
|
+
"tester-otter",
|
|
19916
|
+
"classic-otter",
|
|
19917
|
+
"ops-otter",
|
|
19918
|
+
"security-otter",
|
|
19919
|
+
"audio-otter",
|
|
19920
|
+
"scholar-otter",
|
|
19921
|
+
"data-otter",
|
|
19922
|
+
"advisor-otter",
|
|
19923
|
+
"builder-otter",
|
|
19924
|
+
"wizard-otter",
|
|
19925
|
+
"sailor-otter"
|
|
19926
|
+
];
|
|
19927
|
+
var builtinRoleAvatarSchema = external_exports.templateLiteral([
|
|
19928
|
+
"builtin:",
|
|
19929
|
+
external_exports.enum(BUILTIN_ROLE_AVATAR_IDS)
|
|
19930
|
+
]);
|
|
19931
|
+
var ROLE_AVATAR_FILENAME_PATTERN = /^[a-zA-Z0-9_-]{1,64}\.(png|jpg|jpeg|webp)$/u;
|
|
19932
|
+
var customRoleAvatarSchema = external_exports.templateLiteral([
|
|
19933
|
+
"custom:",
|
|
19934
|
+
external_exports.string().regex(ROLE_AVATAR_FILENAME_PATTERN)
|
|
19935
|
+
]);
|
|
19936
|
+
var catalogRoleAvatarSchema = external_exports.templateLiteral([
|
|
19937
|
+
"catalog:",
|
|
19938
|
+
external_exports.string().regex(ROLE_AVATAR_FILENAME_PATTERN)
|
|
19939
|
+
]);
|
|
19940
|
+
var roleAvatarSchema = external_exports.union([builtinRoleAvatarSchema, customRoleAvatarSchema]);
|
|
19941
|
+
var roleCatalogAvatarSchema = external_exports.union([builtinRoleAvatarSchema, catalogRoleAvatarSchema]);
|
|
19942
|
+
var saveRoleAvatarSchema = external_exports.union([roleAvatarSchema, catalogRoleAvatarSchema]);
|
|
19943
|
+
var httpsUrlSchema = external_exports.string().url().max(2048).refine((value) => /^https:\/\//i.test(value), "URL must use https://");
|
|
19944
|
+
var localizedRoleTextSchema = external_exports.object({
|
|
19945
|
+
en: external_exports.string().trim().min(1).max(2e3),
|
|
19946
|
+
"zh-CN": external_exports.string().trim().min(1).max(2e3)
|
|
19947
|
+
});
|
|
19948
|
+
var roleCatalogEntrySchema = external_exports.object({
|
|
19949
|
+
slug: roleSlugSchema,
|
|
19950
|
+
name: localizedRoleTextSchema,
|
|
19951
|
+
description: localizedRoleTextSchema,
|
|
19952
|
+
avatar: roleCatalogAvatarSchema,
|
|
19953
|
+
accentColor: roleAccentColorSchema,
|
|
19954
|
+
recommendedHarnessId: harnessIdSchema.optional(),
|
|
19955
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
19956
|
+
authorUrl: httpsUrlSchema.optional(),
|
|
19957
|
+
sourceUrl: httpsUrlSchema.optional(),
|
|
19958
|
+
license: external_exports.string().trim().min(1).max(64).optional(),
|
|
19959
|
+
official: external_exports.boolean().optional(),
|
|
19960
|
+
instructions: external_exports.string().trim().min(1).max(1e5),
|
|
19961
|
+
updatedAt: external_exports.iso.datetime()
|
|
19962
|
+
});
|
|
19963
|
+
var roleCatalogDocumentSchema = external_exports.object({
|
|
19964
|
+
formatVersion: external_exports.literal(1),
|
|
19965
|
+
generatedAt: external_exports.iso.datetime(),
|
|
19966
|
+
roles: external_exports.array(roleCatalogEntrySchema)
|
|
19967
|
+
});
|
|
19968
|
+
var roleIdentitySchema = external_exports.object({
|
|
19969
|
+
slug: roleSlugSchema,
|
|
19970
|
+
name: external_exports.string().refine((name) => name.trim().length > 0),
|
|
19971
|
+
avatar: roleAvatarSchema,
|
|
19972
|
+
accentColor: roleAccentColorSchema
|
|
19973
|
+
});
|
|
19974
|
+
var threadRoleSnapshotSchema = roleIdentitySchema.readonly();
|
|
19975
|
+
var agentRoleSchema = roleIdentitySchema.extend({
|
|
19976
|
+
description: external_exports.string(),
|
|
19977
|
+
harnessId: harnessIdSchema,
|
|
19978
|
+
model: roleModelSchema.optional(),
|
|
19979
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
19980
|
+
instructions: external_exports.string(),
|
|
19981
|
+
updatedAt: external_exports.iso.datetime()
|
|
19982
|
+
});
|
|
19983
|
+
var saveAgentRoleInputSchema = agentRoleSchema.omit({ updatedAt: true, avatar: true }).extend({ avatar: saveRoleAvatarSchema }).partial({ slug: true });
|
|
19984
|
+
var ROLES_LIST_METHOD = "codexhost/roles/list";
|
|
19985
|
+
var ROLES_GET_METHOD = "codexhost/roles/get";
|
|
19986
|
+
var ROLES_SAVE_METHOD = "codexhost/roles/save";
|
|
19987
|
+
var ROLES_DELETE_METHOD = "codexhost/roles/delete";
|
|
19988
|
+
var ROLES_CATALOG_METHOD = "codexhost/roles/catalog";
|
|
19989
|
+
var ROLES_LIKE_METHOD = "codexhost/roles/like";
|
|
19990
|
+
var ROLE_LIKES_MAX_PER_ROLE = 5;
|
|
19991
|
+
var rolesListParamsSchema = external_exports.object({
|
|
19992
|
+
locale: external_exports.string().trim().min(1).max(64).optional()
|
|
19993
|
+
});
|
|
19994
|
+
var rolesListResultSchema = external_exports.object({ roles: external_exports.array(agentRoleSchema) });
|
|
19995
|
+
var rolesGetParamsSchema = external_exports.object({ slug: roleSlugSchema });
|
|
19996
|
+
var rolesGetResultSchema = external_exports.object({ role: agentRoleSchema.nullable() });
|
|
19997
|
+
var rolesSaveResultSchema = external_exports.object({ role: agentRoleSchema });
|
|
19998
|
+
var rolesDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
|
|
19999
|
+
var rolesCatalogParamsSchema = external_exports.object({
|
|
20000
|
+
refresh: external_exports.boolean().optional()
|
|
20001
|
+
});
|
|
20002
|
+
var rolesCatalogResultSchema = external_exports.object({
|
|
20003
|
+
roles: external_exports.array(roleCatalogEntrySchema),
|
|
20004
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
20005
|
+
likes: external_exports.record(roleSlugSchema, external_exports.number().int().nonnegative()).optional(),
|
|
20006
|
+
myLikes: external_exports.record(roleSlugSchema, external_exports.number().int().min(0).max(ROLE_LIKES_MAX_PER_ROLE)).optional(),
|
|
20007
|
+
stale: external_exports.boolean().optional(),
|
|
20008
|
+
error: external_exports.string().optional()
|
|
20009
|
+
});
|
|
20010
|
+
var rolesLikeParamsSchema = external_exports.object({
|
|
20011
|
+
slug: roleSlugSchema
|
|
20012
|
+
});
|
|
20013
|
+
var rolesLikeResultSchema = external_exports.object({
|
|
20014
|
+
slug: roleSlugSchema,
|
|
20015
|
+
likes: external_exports.number().int().nonnegative(),
|
|
20016
|
+
myLikes: external_exports.number().int().min(0).max(ROLE_LIKES_MAX_PER_ROLE),
|
|
20017
|
+
maxLikes: external_exports.literal(ROLE_LIKES_MAX_PER_ROLE),
|
|
20018
|
+
limitReached: external_exports.boolean().optional()
|
|
20019
|
+
});
|
|
20020
|
+
|
|
19899
20021
|
// ../../shared-contracts/dist/thread-usage.js
|
|
19900
20022
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
19901
20023
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -20077,7 +20199,6 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
20077
20199
|
// ../../shared-contracts/dist/harness-models.js
|
|
20078
20200
|
var HARNESS_MODEL_REF_MAX_LENGTH = 512;
|
|
20079
20201
|
var HARNESS_MODEL_LABEL_MAX_LENGTH = 256;
|
|
20080
|
-
var HARNESS_THINKING_OPTION_ID_MAX_LENGTH = 128;
|
|
20081
20202
|
var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
20082
20203
|
var nonBlankTextSchema3 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
20083
20204
|
message: "Value must not be empty or whitespace"
|
|
@@ -20091,7 +20212,6 @@ var harnessModelRefSchema = external_exports.object({
|
|
|
20091
20212
|
function sameHarnessModelRef(left, right) {
|
|
20092
20213
|
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
20093
20214
|
}
|
|
20094
|
-
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();
|
|
20095
20215
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema3.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
20096
20216
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
20097
20217
|
id: harnessThinkingOptionIdSchema,
|
|
@@ -20304,8 +20424,10 @@ var codexThreadInspectionSchema = external_exports.object({
|
|
|
20304
20424
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
20305
20425
|
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
20306
20426
|
supportsThreadReferences: external_exports.literal(true).optional(),
|
|
20307
|
-
handoff: threadHandoffMetadataSchema.optional()
|
|
20308
|
-
|
|
20427
|
+
handoff: threadHandoffMetadataSchema.optional(),
|
|
20428
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
20429
|
+
nativeSessionRef: external_exports.never().optional()
|
|
20430
|
+
});
|
|
20309
20431
|
var externalThreadInspectionSchema = external_exports.object({
|
|
20310
20432
|
owner: external_exports.literal("external"),
|
|
20311
20433
|
harnessId: nonBlankTextSchema3.max(256),
|
|
@@ -20320,8 +20442,10 @@ var externalThreadInspectionSchema = external_exports.object({
|
|
|
20320
20442
|
history: harnessHistoryCapabilitiesSchema,
|
|
20321
20443
|
usage: threadUsageSnapshotSchema.optional(),
|
|
20322
20444
|
handoff: threadHandoffMetadataSchema.optional(),
|
|
20445
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
20446
|
+
nativeSessionRef: external_exports.never().optional(),
|
|
20323
20447
|
locked: external_exports.literal(true)
|
|
20324
|
-
})
|
|
20448
|
+
});
|
|
20325
20449
|
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
20326
20450
|
codexThreadInspectionSchema,
|
|
20327
20451
|
externalThreadInspectionSchema
|
|
@@ -20564,7 +20688,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
|
|
|
20564
20688
|
default: external_exports.string().optional()
|
|
20565
20689
|
})
|
|
20566
20690
|
]).superRefine((field2, ctx) => {
|
|
20567
|
-
const issue2 = (
|
|
20691
|
+
const issue2 = (path14, message) => ctx.addIssue({ code: "custom", path: [path14], message });
|
|
20568
20692
|
if (field2.type === "number" || field2.type === "range") {
|
|
20569
20693
|
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
20570
20694
|
if (min > max)
|
|
@@ -20670,16 +20794,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
|
|
|
20670
20794
|
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
20671
20795
|
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
20672
20796
|
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
20673
|
-
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((
|
|
20797
|
+
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");
|
|
20674
20798
|
var legacy = desktopExtensionManifestSchema.shape;
|
|
20675
20799
|
var localized = (max, min = 0) => external_exports.strictObject({
|
|
20676
20800
|
en: external_exports.string().trim().min(min).max(max),
|
|
20677
20801
|
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
20678
20802
|
});
|
|
20679
|
-
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((
|
|
20803
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path14) => path14.endsWith(suffix), `Expected a ${suffix} file`);
|
|
20680
20804
|
var moduleEntry = resourceWithSuffix(".mjs");
|
|
20681
20805
|
var style = resourceWithSuffix(".css").optional();
|
|
20682
|
-
var hostExtensionCanonicalPath = (
|
|
20806
|
+
var hostExtensionCanonicalPath = (path14) => path14.normalize("NFC").toLowerCase();
|
|
20683
20807
|
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
20684
20808
|
manifestVersion: external_exports.literal(2),
|
|
20685
20809
|
id: hostExtensionIdSchema,
|
|
@@ -20689,8 +20813,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
|
20689
20813
|
details: localized(16384).optional(),
|
|
20690
20814
|
author: legacy.author,
|
|
20691
20815
|
repository: legacy.repository,
|
|
20692
|
-
icon: legacy.icon.refine((
|
|
20693
|
-
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((
|
|
20816
|
+
icon: legacy.icon.refine((path14) => path14 === void 0 || hostExtensionResourcePathSchema.safeParse(path14).success),
|
|
20817
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path14) => hostExtensionResourcePathSchema.safeParse(path14).success)),
|
|
20694
20818
|
categories: legacy.categories,
|
|
20695
20819
|
settingsSchema: legacy.settingsSchema,
|
|
20696
20820
|
slots: legacy.slots.removeDefault().optional(),
|
|
@@ -20724,6 +20848,9 @@ var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
|
20724
20848
|
// ../../shared-contracts/dist/thread-tree-watch.js
|
|
20725
20849
|
var THREAD_TREE_MAX_NODES = 5e3;
|
|
20726
20850
|
var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
|
|
20851
|
+
var threadTreeDelegationSchema = external_exports.object({
|
|
20852
|
+
createdAtMs: external_exports.number().int().nonnegative()
|
|
20853
|
+
});
|
|
20727
20854
|
var threadTreeHandoffSchema = external_exports.strictObject({
|
|
20728
20855
|
sourceThreadId: hostThreadIdSchema,
|
|
20729
20856
|
createdAtMs: external_exports.number().int().nonnegative()
|
|
@@ -20735,13 +20862,14 @@ var threadTreeNodeSchema = external_exports.strictObject({
|
|
|
20735
20862
|
archived: external_exports.boolean(),
|
|
20736
20863
|
updatedAtMs: external_exports.number().int().nonnegative().optional()
|
|
20737
20864
|
});
|
|
20738
|
-
var threadTreeSnapshotSchema = external_exports.
|
|
20865
|
+
var threadTreeSnapshotSchema = external_exports.object({
|
|
20739
20866
|
revision: external_exports.int().nonnegative(),
|
|
20740
20867
|
parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
|
|
20868
|
+
delegations: external_exports.record(hostThreadIdSchema, threadTreeDelegationSchema).optional(),
|
|
20741
20869
|
handoffs: external_exports.record(hostThreadIdSchema, threadTreeHandoffSchema).optional(),
|
|
20742
20870
|
nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
|
|
20743
20871
|
truncated: external_exports.boolean()
|
|
20744
|
-
}).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");
|
|
20872
|
+
}).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");
|
|
20745
20873
|
var subscriptionId = external_exports.string().min(1).max(128);
|
|
20746
20874
|
var threadTreeWatchParamsSchema = external_exports.strictObject({});
|
|
20747
20875
|
var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
|
|
@@ -20812,7 +20940,7 @@ var active = {
|
|
|
20812
20940
|
digest: hostExtensionDigestSchema
|
|
20813
20941
|
};
|
|
20814
20942
|
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
20815
|
-
var filePath = external_exports.string().min(1).max(4096).refine((
|
|
20943
|
+
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");
|
|
20816
20944
|
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");
|
|
20817
20945
|
function base643(maxBytes) {
|
|
20818
20946
|
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
@@ -21009,6 +21137,298 @@ var hostExtensionsRpcSchemas = {
|
|
|
21009
21137
|
}
|
|
21010
21138
|
};
|
|
21011
21139
|
|
|
21140
|
+
// ../../shared-contracts/dist/group-chat.js
|
|
21141
|
+
var DEFAULT_GROUP_MAX_AGENT_HOPS = 5;
|
|
21142
|
+
var MAX_GROUP_AGENT_HOPS = 20;
|
|
21143
|
+
var GROUP_NOTICE_MAX_LENGTH = 2e3;
|
|
21144
|
+
var remoteGroupRoomIdSchema = external_exports.string().regex(/^remote:[A-Za-z0-9_-]{8,512}$/u);
|
|
21145
|
+
var groupRoomIdSchema = external_exports.union([external_exports.uuidv4(), remoteGroupRoomIdSchema]);
|
|
21146
|
+
var groupMemberIdSchema = external_exports.uuidv4();
|
|
21147
|
+
var groupMemberHandleSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/u);
|
|
21148
|
+
var groupUnmentionedPolicySchema = external_exports.enum(["none", "last_speaker", "all"]);
|
|
21149
|
+
var groupMemberStatusSchema = external_exports.enum(["active", "muted", "removed"]);
|
|
21150
|
+
var nonnegativeInteger = external_exports.int().nonnegative();
|
|
21151
|
+
var positiveInteger = external_exports.int().positive();
|
|
21152
|
+
var maxAgentHopsSchema = positiveInteger.max(MAX_GROUP_AGENT_HOPS);
|
|
21153
|
+
var nonblankString = external_exports.string().refine((value) => value.trim().length > 0);
|
|
21154
|
+
var timestamp = external_exports.iso.datetime();
|
|
21155
|
+
var optionalMemberEdits = {
|
|
21156
|
+
handle: groupMemberHandleSchema.optional(),
|
|
21157
|
+
displayName: nonblankString.optional(),
|
|
21158
|
+
note: external_exports.string().optional()
|
|
21159
|
+
};
|
|
21160
|
+
var groupMemberSchema = external_exports.object({
|
|
21161
|
+
memberId: groupMemberIdSchema,
|
|
21162
|
+
threadId: hostThreadIdSchema,
|
|
21163
|
+
handle: groupMemberHandleSchema,
|
|
21164
|
+
displayName: nonblankString,
|
|
21165
|
+
note: external_exports.string().optional(),
|
|
21166
|
+
roleSlug: roleSlugSchema.optional(),
|
|
21167
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
21168
|
+
harnessId: harnessIdSchema,
|
|
21169
|
+
status: groupMemberStatusSchema,
|
|
21170
|
+
projectless: external_exports.boolean().optional(),
|
|
21171
|
+
joinedAtSeq: nonnegativeInteger,
|
|
21172
|
+
lastDeliveredSeq: nonnegativeInteger,
|
|
21173
|
+
lastRosterVersion: nonnegativeInteger,
|
|
21174
|
+
createdAt: timestamp
|
|
21175
|
+
});
|
|
21176
|
+
var groupProjectlessWorkspaceSchema = external_exports.object({
|
|
21177
|
+
workspaceRoot: nonblankString,
|
|
21178
|
+
outputDirectory: nonblankString
|
|
21179
|
+
});
|
|
21180
|
+
var groupRoomRemoteHostSchema = external_exports.object({
|
|
21181
|
+
hostId: nonblankString,
|
|
21182
|
+
displayName: nonblankString,
|
|
21183
|
+
state: nonblankString.optional(),
|
|
21184
|
+
color: external_exports.string().optional(),
|
|
21185
|
+
filePreview: external_exports.boolean().optional()
|
|
21186
|
+
});
|
|
21187
|
+
var groupRoomSchema = external_exports.object({
|
|
21188
|
+
roomId: groupRoomIdSchema,
|
|
21189
|
+
title: nonblankString,
|
|
21190
|
+
defaultCwd: nonblankString,
|
|
21191
|
+
projectlessWorkspace: groupProjectlessWorkspaceSchema.optional(),
|
|
21192
|
+
unmentionedPolicy: groupUnmentionedPolicySchema.default("none"),
|
|
21193
|
+
allowAgentMentions: external_exports.boolean().default(true),
|
|
21194
|
+
maxAgentHops: maxAgentHopsSchema.default(DEFAULT_GROUP_MAX_AGENT_HOPS),
|
|
21195
|
+
lastSeq: nonnegativeInteger,
|
|
21196
|
+
lastSpeakerMemberId: groupMemberIdSchema.optional(),
|
|
21197
|
+
rosterVersion: nonnegativeInteger,
|
|
21198
|
+
humanEpoch: nonnegativeInteger,
|
|
21199
|
+
relayPaused: external_exports.boolean(),
|
|
21200
|
+
pinned: external_exports.boolean(),
|
|
21201
|
+
createdAt: timestamp,
|
|
21202
|
+
updatedAt: timestamp,
|
|
21203
|
+
members: external_exports.array(groupMemberSchema),
|
|
21204
|
+
remote: groupRoomRemoteHostSchema.optional()
|
|
21205
|
+
}).superRefine(({ members: members2 }, context) => {
|
|
21206
|
+
const handles = /* @__PURE__ */ new Set();
|
|
21207
|
+
for (const [index, { handle, status }] of members2.entries()) {
|
|
21208
|
+
if (status === "removed")
|
|
21209
|
+
continue;
|
|
21210
|
+
if (handles.has(handle)) {
|
|
21211
|
+
context.addIssue({
|
|
21212
|
+
code: "custom",
|
|
21213
|
+
path: ["members", index, "handle"],
|
|
21214
|
+
message: "Handle must be unique among non-removed members"
|
|
21215
|
+
});
|
|
21216
|
+
}
|
|
21217
|
+
handles.add(handle);
|
|
21218
|
+
}
|
|
21219
|
+
});
|
|
21220
|
+
var groupAttachmentSchema = external_exports.object({
|
|
21221
|
+
kind: external_exports.enum(["image", "file"]),
|
|
21222
|
+
attachmentId: nonblankString.max(256),
|
|
21223
|
+
name: nonblankString.max(256),
|
|
21224
|
+
path: nonblankString.max(4096),
|
|
21225
|
+
bytes: nonnegativeInteger,
|
|
21226
|
+
mediaType: nonblankString.max(128).optional(),
|
|
21227
|
+
width: positiveInteger.optional(),
|
|
21228
|
+
height: positiveInteger.optional()
|
|
21229
|
+
});
|
|
21230
|
+
var groupMessageSchema = external_exports.object({
|
|
21231
|
+
roomId: groupRoomIdSchema,
|
|
21232
|
+
seq: positiveInteger,
|
|
21233
|
+
messageId: nonblankString,
|
|
21234
|
+
senderType: external_exports.enum(["user", "agent", "system"]),
|
|
21235
|
+
senderMemberId: groupMemberIdSchema.optional(),
|
|
21236
|
+
senderHandle: groupMemberHandleSchema.optional(),
|
|
21237
|
+
senderName: external_exports.string().optional(),
|
|
21238
|
+
senderThreadId: hostThreadIdSchema.optional(),
|
|
21239
|
+
sourceTurnId: nonblankString.optional(),
|
|
21240
|
+
replyToSeq: positiveInteger.optional(),
|
|
21241
|
+
content: external_exports.string(),
|
|
21242
|
+
attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
|
|
21243
|
+
mentionedMemberIds: external_exports.array(groupMemberIdSchema),
|
|
21244
|
+
mentionAll: external_exports.boolean().optional(),
|
|
21245
|
+
hopCount: nonnegativeInteger,
|
|
21246
|
+
createdAt: timestamp
|
|
21247
|
+
});
|
|
21248
|
+
var newThreadOptions = {
|
|
21249
|
+
...optionalMemberEdits,
|
|
21250
|
+
model: roleModelSchema.optional(),
|
|
21251
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
21252
|
+
worktree: external_exports.boolean().optional()
|
|
21253
|
+
};
|
|
21254
|
+
var groupCreateMemberInputSchema = external_exports.discriminatedUnion("kind", [
|
|
21255
|
+
external_exports.strictObject({ kind: external_exports.literal("role"), roleSlug: roleSlugSchema, ...newThreadOptions }),
|
|
21256
|
+
external_exports.strictObject({ kind: external_exports.literal("harness"), harnessId: harnessIdSchema, ...newThreadOptions }),
|
|
21257
|
+
external_exports.strictObject({
|
|
21258
|
+
kind: external_exports.literal("existing"),
|
|
21259
|
+
threadId: hostThreadIdSchema,
|
|
21260
|
+
...optionalMemberEdits,
|
|
21261
|
+
includeRecentHistory: external_exports.boolean().default(true).optional()
|
|
21262
|
+
})
|
|
21263
|
+
]);
|
|
21264
|
+
var GROUPS_LIST_METHOD = "codexhost/groups/list";
|
|
21265
|
+
var GROUPS_GET_METHOD = "codexhost/groups/get";
|
|
21266
|
+
var GROUPS_CREATE_METHOD = "codexhost/groups/create";
|
|
21267
|
+
var GROUPS_UPDATE_METHOD = "codexhost/groups/update";
|
|
21268
|
+
var GROUPS_DELETE_METHOD = "codexhost/groups/delete";
|
|
21269
|
+
var GROUPS_ADD_MEMBER_METHOD = "codexhost/groups/member/add";
|
|
21270
|
+
var GROUPS_UPDATE_MEMBER_METHOD = "codexhost/groups/member/update";
|
|
21271
|
+
var GROUPS_REMOVE_MEMBER_METHOD = "codexhost/groups/member/remove";
|
|
21272
|
+
var GROUPS_REBIND_MEMBER_METHOD = "codexhost/groups/member/rebind";
|
|
21273
|
+
var GROUPS_POST_MESSAGE_METHOD = "codexhost/groups/message/post";
|
|
21274
|
+
var GROUPS_READ_MESSAGES_METHOD = "codexhost/groups/messages/read";
|
|
21275
|
+
var GROUPS_INSPECT_CWD_METHOD = "codexhost/groups/cwd/inspect";
|
|
21276
|
+
var roomIdentity = { roomId: groupRoomIdSchema };
|
|
21277
|
+
var memberIdentity = { ...roomIdentity, memberId: groupMemberIdSchema };
|
|
21278
|
+
var roomEdits = {
|
|
21279
|
+
title: nonblankString.optional(),
|
|
21280
|
+
unmentionedPolicy: groupUnmentionedPolicySchema.optional(),
|
|
21281
|
+
allowAgentMentions: external_exports.boolean().optional(),
|
|
21282
|
+
maxAgentHops: maxAgentHopsSchema.optional()
|
|
21283
|
+
};
|
|
21284
|
+
var groupsListParamsSchema = external_exports.strictObject({});
|
|
21285
|
+
var groupsListResultSchema = external_exports.object({ rooms: external_exports.array(groupRoomSchema) });
|
|
21286
|
+
var groupsGetParamsSchema = external_exports.strictObject({
|
|
21287
|
+
...roomIdentity,
|
|
21288
|
+
limit: positiveInteger.optional(),
|
|
21289
|
+
beforeSeq: positiveInteger.optional()
|
|
21290
|
+
});
|
|
21291
|
+
var groupsGetResultSchema = external_exports.object({
|
|
21292
|
+
room: groupRoomSchema.nullable(),
|
|
21293
|
+
messages: external_exports.array(groupMessageSchema),
|
|
21294
|
+
hasMore: external_exports.boolean()
|
|
21295
|
+
});
|
|
21296
|
+
var groupsCreateParamsSchema = external_exports.strictObject({
|
|
21297
|
+
...roomEdits,
|
|
21298
|
+
defaultCwd: nonblankString.optional(),
|
|
21299
|
+
members: external_exports.array(groupCreateMemberInputSchema)
|
|
21300
|
+
});
|
|
21301
|
+
var groupsCreateResultSchema = external_exports.object({ room: groupRoomSchema });
|
|
21302
|
+
var groupsUpdateParamsSchema = external_exports.strictObject({
|
|
21303
|
+
...roomIdentity,
|
|
21304
|
+
...roomEdits,
|
|
21305
|
+
pinned: external_exports.boolean().optional(),
|
|
21306
|
+
relayPaused: external_exports.boolean().optional()
|
|
21307
|
+
});
|
|
21308
|
+
var groupsDeleteParamsSchema = external_exports.strictObject(roomIdentity);
|
|
21309
|
+
var groupsDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
|
|
21310
|
+
var groupsAddMemberParamsSchema = external_exports.strictObject({
|
|
21311
|
+
...roomIdentity,
|
|
21312
|
+
member: groupCreateMemberInputSchema
|
|
21313
|
+
});
|
|
21314
|
+
var groupsAddMemberResultSchema = external_exports.object({
|
|
21315
|
+
room: groupRoomSchema,
|
|
21316
|
+
member: groupMemberSchema
|
|
21317
|
+
});
|
|
21318
|
+
var groupsUpdateMemberParamsSchema = external_exports.strictObject({
|
|
21319
|
+
...memberIdentity,
|
|
21320
|
+
...optionalMemberEdits,
|
|
21321
|
+
status: groupMemberStatusSchema.optional()
|
|
21322
|
+
});
|
|
21323
|
+
var groupsRemoveMemberParamsSchema = external_exports.strictObject(memberIdentity);
|
|
21324
|
+
var groupsRebindMemberParamsSchema = external_exports.strictObject({
|
|
21325
|
+
...memberIdentity,
|
|
21326
|
+
threadId: hostThreadIdSchema,
|
|
21327
|
+
redeliverFrom: positiveInteger.optional(),
|
|
21328
|
+
note: external_exports.string().optional()
|
|
21329
|
+
});
|
|
21330
|
+
var groupCliRebindMemberParamsSchema = external_exports.strictObject({
|
|
21331
|
+
...roomIdentity,
|
|
21332
|
+
memberId: groupMemberIdSchema.optional(),
|
|
21333
|
+
memberHandle: groupMemberHandleSchema.optional(),
|
|
21334
|
+
threadId: hostThreadIdSchema,
|
|
21335
|
+
redeliverFrom: positiveInteger.optional(),
|
|
21336
|
+
note: external_exports.string().optional()
|
|
21337
|
+
}).refine((value) => value.memberId !== void 0 !== (value.memberHandle !== void 0), "Provide exactly one of memberId or memberHandle");
|
|
21338
|
+
var groupsRebindMemberResultSchema = external_exports.object({
|
|
21339
|
+
room: groupRoomSchema,
|
|
21340
|
+
member: groupMemberSchema,
|
|
21341
|
+
previousThreadId: hostThreadIdSchema,
|
|
21342
|
+
awakened: external_exports.boolean()
|
|
21343
|
+
});
|
|
21344
|
+
var groupCliListMemberSchema = external_exports.object({
|
|
21345
|
+
memberId: groupMemberIdSchema,
|
|
21346
|
+
threadId: hostThreadIdSchema,
|
|
21347
|
+
handle: groupMemberHandleSchema,
|
|
21348
|
+
displayName: nonblankString,
|
|
21349
|
+
status: groupMemberStatusSchema,
|
|
21350
|
+
harnessId: harnessIdSchema,
|
|
21351
|
+
roleSlug: roleSlugSchema.optional(),
|
|
21352
|
+
roleName: nonblankString.optional()
|
|
21353
|
+
});
|
|
21354
|
+
var groupCliListEntrySchema = external_exports.object({
|
|
21355
|
+
roomId: groupRoomIdSchema,
|
|
21356
|
+
title: nonblankString,
|
|
21357
|
+
memberCount: nonnegativeInteger,
|
|
21358
|
+
updatedAt: timestamp,
|
|
21359
|
+
member: groupCliListMemberSchema.optional()
|
|
21360
|
+
});
|
|
21361
|
+
var groupCliListParamsSchema = external_exports.strictObject({
|
|
21362
|
+
threadId: hostThreadIdSchema.optional()
|
|
21363
|
+
});
|
|
21364
|
+
var groupCliListResultSchema = external_exports.object({
|
|
21365
|
+
rooms: external_exports.array(groupCliListEntrySchema)
|
|
21366
|
+
});
|
|
21367
|
+
var groupsPostMessageParamsSchema = external_exports.strictObject({
|
|
21368
|
+
...roomIdentity,
|
|
21369
|
+
content: external_exports.string().max(64e3),
|
|
21370
|
+
attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
|
|
21371
|
+
replyToSeq: positiveInteger.optional(),
|
|
21372
|
+
targetMemberIds: external_exports.array(groupMemberIdSchema).optional(),
|
|
21373
|
+
mentionAll: external_exports.boolean().optional(),
|
|
21374
|
+
notice: external_exports.boolean().optional()
|
|
21375
|
+
}).superRefine((value, context) => {
|
|
21376
|
+
if (value.notice === true) {
|
|
21377
|
+
if (value.content.trim().length === 0) {
|
|
21378
|
+
context.addIssue({
|
|
21379
|
+
code: "custom",
|
|
21380
|
+
path: ["content"],
|
|
21381
|
+
message: "Notice content is required"
|
|
21382
|
+
});
|
|
21383
|
+
}
|
|
21384
|
+
if (value.content.length > GROUP_NOTICE_MAX_LENGTH) {
|
|
21385
|
+
context.addIssue({
|
|
21386
|
+
code: "custom",
|
|
21387
|
+
path: ["content"],
|
|
21388
|
+
message: `Notice content must be at most ${GROUP_NOTICE_MAX_LENGTH} characters`
|
|
21389
|
+
});
|
|
21390
|
+
}
|
|
21391
|
+
if ((value.targetMemberIds?.length ?? 0) > 0 || value.mentionAll === true || (value.attachments?.length ?? 0) > 0) {
|
|
21392
|
+
context.addIssue({
|
|
21393
|
+
code: "custom",
|
|
21394
|
+
path: ["notice"],
|
|
21395
|
+
message: "System notices cannot target members or include attachments"
|
|
21396
|
+
});
|
|
21397
|
+
}
|
|
21398
|
+
return;
|
|
21399
|
+
}
|
|
21400
|
+
if (value.content.trim().length === 0 && (value.attachments?.length ?? 0) === 0) {
|
|
21401
|
+
context.addIssue({
|
|
21402
|
+
code: "custom",
|
|
21403
|
+
path: ["content"],
|
|
21404
|
+
message: "Message content or at least one attachment is required"
|
|
21405
|
+
});
|
|
21406
|
+
}
|
|
21407
|
+
});
|
|
21408
|
+
var groupsPostMessageResultSchema = external_exports.object({
|
|
21409
|
+
room: groupRoomSchema,
|
|
21410
|
+
message: groupMessageSchema,
|
|
21411
|
+
awakenedMemberIds: external_exports.array(groupMemberIdSchema)
|
|
21412
|
+
});
|
|
21413
|
+
var groupsReadMessagesParamsSchema = external_exports.strictObject({
|
|
21414
|
+
...roomIdentity,
|
|
21415
|
+
fromSeq: positiveInteger.optional(),
|
|
21416
|
+
toSeq: positiveInteger.optional(),
|
|
21417
|
+
limit: positiveInteger.optional()
|
|
21418
|
+
});
|
|
21419
|
+
var groupsReadMessagesResultSchema = external_exports.object({
|
|
21420
|
+
...roomIdentity,
|
|
21421
|
+
messages: external_exports.array(groupMessageSchema),
|
|
21422
|
+
totalSeq: nonnegativeInteger
|
|
21423
|
+
});
|
|
21424
|
+
var groupsInspectCwdParamsSchema = external_exports.strictObject({
|
|
21425
|
+
cwd: nonblankString,
|
|
21426
|
+
roomId: groupRoomIdSchema.optional()
|
|
21427
|
+
});
|
|
21428
|
+
var groupsInspectCwdResultSchema = external_exports.object({
|
|
21429
|
+
isGitRepo: external_exports.boolean()
|
|
21430
|
+
});
|
|
21431
|
+
|
|
21012
21432
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
21013
21433
|
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
21014
21434
|
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
@@ -21054,6 +21474,7 @@ var TELEMETRY_OFFICIAL_HARNESSES = [
|
|
|
21054
21474
|
"kiro-cli",
|
|
21055
21475
|
"codebuddy",
|
|
21056
21476
|
"workbuddy",
|
|
21477
|
+
"workbuddy-cn",
|
|
21057
21478
|
"devin",
|
|
21058
21479
|
"hermes",
|
|
21059
21480
|
"qoder",
|
|
@@ -21179,6 +21600,24 @@ var clientThreadSectionMutationResultSchema = external_exports.discriminatedUnio
|
|
|
21179
21600
|
]);
|
|
21180
21601
|
var CLIENT_CHANNEL_METHODS = [
|
|
21181
21602
|
"codexhost/skills/list",
|
|
21603
|
+
ROLES_LIST_METHOD,
|
|
21604
|
+
ROLES_GET_METHOD,
|
|
21605
|
+
ROLES_SAVE_METHOD,
|
|
21606
|
+
ROLES_DELETE_METHOD,
|
|
21607
|
+
ROLES_CATALOG_METHOD,
|
|
21608
|
+
ROLES_LIKE_METHOD,
|
|
21609
|
+
GROUPS_LIST_METHOD,
|
|
21610
|
+
GROUPS_GET_METHOD,
|
|
21611
|
+
GROUPS_CREATE_METHOD,
|
|
21612
|
+
GROUPS_UPDATE_METHOD,
|
|
21613
|
+
GROUPS_DELETE_METHOD,
|
|
21614
|
+
GROUPS_ADD_MEMBER_METHOD,
|
|
21615
|
+
GROUPS_UPDATE_MEMBER_METHOD,
|
|
21616
|
+
GROUPS_REMOVE_MEMBER_METHOD,
|
|
21617
|
+
GROUPS_REBIND_MEMBER_METHOD,
|
|
21618
|
+
GROUPS_POST_MESSAGE_METHOD,
|
|
21619
|
+
GROUPS_READ_MESSAGES_METHOD,
|
|
21620
|
+
GROUPS_INSPECT_CWD_METHOD,
|
|
21182
21621
|
"codexhost/voice/status",
|
|
21183
21622
|
"codexhost/voice/transcribe",
|
|
21184
21623
|
"codexhost/harness/display-settings/get",
|
|
@@ -21340,6 +21779,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
21340
21779
|
}),
|
|
21341
21780
|
external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
|
|
21342
21781
|
external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
|
|
21782
|
+
external_exports.object({
|
|
21783
|
+
type: external_exports.literal("groups-changed"),
|
|
21784
|
+
cursor: clientChannelCursorSchema,
|
|
21785
|
+
roomId: external_exports.string().optional()
|
|
21786
|
+
}),
|
|
21343
21787
|
external_exports.object({
|
|
21344
21788
|
type: external_exports.literal("preferences-changed"),
|
|
21345
21789
|
cursor: clientChannelCursorSchema,
|
|
@@ -21473,6 +21917,7 @@ var clientThreadSnapshotSchema = external_exports.object({
|
|
|
21473
21917
|
status: external_exports.object({ type: external_exports.string() }).passthrough(),
|
|
21474
21918
|
name: external_exports.string().nullable().optional(),
|
|
21475
21919
|
preview: external_exports.string().optional(),
|
|
21920
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
21476
21921
|
codexhostImportSource: clientThreadImportSourceSchema.optional(),
|
|
21477
21922
|
turns: external_exports.array(clientTurnSchema).length(0)
|
|
21478
21923
|
}).passthrough(),
|
|
@@ -21737,7 +22182,23 @@ var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
|
|
|
21737
22182
|
var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
21738
22183
|
var remotePeerNodeIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
21739
22184
|
var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
|
|
21740
|
-
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
|
|
22185
|
+
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "ssh", "custom"]);
|
|
22186
|
+
var remotePeerSshAuthModeSchema = external_exports.enum(["auto", "key", "password"]);
|
|
22187
|
+
var remotePeerSshConfigSchema = external_exports.object({
|
|
22188
|
+
host: external_exports.string().trim().min(1).max(255),
|
|
22189
|
+
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
22190
|
+
user: external_exports.string().trim().min(1).max(128).optional(),
|
|
22191
|
+
identityFile: external_exports.string().trim().min(1).max(1024).optional(),
|
|
22192
|
+
authMode: remotePeerSshAuthModeSchema.default("auto"),
|
|
22193
|
+
remoteDataDir: external_exports.string().trim().min(1).max(1024).optional()
|
|
22194
|
+
});
|
|
22195
|
+
var remotePeerSshSummarySchema = external_exports.object({
|
|
22196
|
+
host: external_exports.string().min(1).max(255),
|
|
22197
|
+
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
22198
|
+
user: external_exports.string().min(1).max(128).optional(),
|
|
22199
|
+
authMode: remotePeerSshAuthModeSchema,
|
|
22200
|
+
keyInstalled: external_exports.boolean().optional()
|
|
22201
|
+
});
|
|
21741
22202
|
var REMOTE_PEER_COLORS = [
|
|
21742
22203
|
"blue",
|
|
21743
22204
|
"purple",
|
|
@@ -21764,6 +22225,7 @@ var remotePeerSummarySchema = external_exports.object({
|
|
|
21764
22225
|
color: remotePeerColorSchema.optional(),
|
|
21765
22226
|
origin: external_exports.string().min(1).max(2048),
|
|
21766
22227
|
transportKind: remotePeerTransportKindSchema,
|
|
22228
|
+
ssh: remotePeerSshSummarySchema.optional(),
|
|
21767
22229
|
encrypted: external_exports.boolean(),
|
|
21768
22230
|
enabled: external_exports.boolean(),
|
|
21769
22231
|
state: remotePeerStateSchema,
|
|
@@ -22011,8 +22473,66 @@ var delegationHostHarnessOptionSchema = external_exports.object({
|
|
|
22011
22473
|
var delegationHostHarnessesResultSchema = external_exports.object({
|
|
22012
22474
|
harnesses: external_exports.array(delegationHostHarnessOptionSchema)
|
|
22013
22475
|
});
|
|
22476
|
+
var sshConfigHostEntrySchema = external_exports.object({
|
|
22477
|
+
alias: external_exports.string().min(1).max(255),
|
|
22478
|
+
hostName: external_exports.string().max(255).optional(),
|
|
22479
|
+
user: external_exports.string().max(128).optional(),
|
|
22480
|
+
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
22481
|
+
identityFile: external_exports.string().max(1024).optional()
|
|
22482
|
+
});
|
|
22483
|
+
var remotePeerListSshConfigHostsResultSchema = external_exports.object({
|
|
22484
|
+
hosts: external_exports.array(sshConfigHostEntrySchema)
|
|
22485
|
+
});
|
|
22486
|
+
var remotePeerSshConnectParamsSchema = external_exports.object({
|
|
22487
|
+
host: external_exports.string().trim().min(1).max(255),
|
|
22488
|
+
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
22489
|
+
user: external_exports.string().trim().min(1).max(128).optional(),
|
|
22490
|
+
identityFile: external_exports.string().trim().min(1).max(1024).optional(),
|
|
22491
|
+
authMode: remotePeerSshAuthModeSchema.default("auto"),
|
|
22492
|
+
password: external_exports.string().max(1024).optional(),
|
|
22493
|
+
installAuthorizedKey: external_exports.boolean().optional(),
|
|
22494
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
22495
|
+
color: remotePeerColorSchema.optional(),
|
|
22496
|
+
remoteDataDir: external_exports.string().trim().min(1).max(1024).optional(),
|
|
22497
|
+
sessionId: external_exports.string().min(1).max(128).optional()
|
|
22498
|
+
});
|
|
22499
|
+
var remotePeerSshTestResultSchema = external_exports.object({
|
|
22500
|
+
ok: external_exports.boolean(),
|
|
22501
|
+
codexhostInstalled: external_exports.boolean(),
|
|
22502
|
+
version: external_exports.string().max(128).optional(),
|
|
22503
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
22504
|
+
platform: external_exports.string().max(64).optional(),
|
|
22505
|
+
hostname: external_exports.string().max(255).optional(),
|
|
22506
|
+
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
22507
|
+
errorCode: external_exports.string().max(128).optional(),
|
|
22508
|
+
error: external_exports.string().max(1e3).optional()
|
|
22509
|
+
});
|
|
22510
|
+
var remotePeerSshInstallResultSchema = external_exports.object({
|
|
22511
|
+
ok: external_exports.boolean(),
|
|
22512
|
+
version: external_exports.string().max(128).optional(),
|
|
22513
|
+
message: external_exports.string().max(1e3).optional()
|
|
22514
|
+
});
|
|
22515
|
+
var remotePeerSshAuthPromptSchema = external_exports.object({
|
|
22516
|
+
promptId: external_exports.string().min(1).max(128),
|
|
22517
|
+
sessionId: external_exports.string().min(1).max(128).optional(),
|
|
22518
|
+
peerId: remotePeerIdSchema.optional(),
|
|
22519
|
+
host: external_exports.string().min(1).max(255),
|
|
22520
|
+
kind: external_exports.enum(["host-key", "password", "passphrase", "otp", "generic"]),
|
|
22521
|
+
prompt: external_exports.string().min(1).max(1e3),
|
|
22522
|
+
echo: external_exports.boolean()
|
|
22523
|
+
});
|
|
22524
|
+
var remotePeerSshRespondAuthParamsSchema = external_exports.object({
|
|
22525
|
+
promptId: external_exports.string().min(1).max(128),
|
|
22526
|
+
sessionId: external_exports.string().min(1).max(128).optional(),
|
|
22527
|
+
response: external_exports.string().max(1024).optional(),
|
|
22528
|
+
cancel: external_exports.boolean().optional()
|
|
22529
|
+
});
|
|
22014
22530
|
|
|
22015
22531
|
// ../../shared-contracts/dist/peer-delegation.js
|
|
22532
|
+
var peerWatchNudgeParamsSchema = external_exports.strictObject({
|
|
22533
|
+
hostId: remotePeerHostIdSchema,
|
|
22534
|
+
threadId: external_exports.string().min(1).max(1024).optional()
|
|
22535
|
+
});
|
|
22016
22536
|
var PEER_DELEGATION_BRIDGE_VERSION = 1;
|
|
22017
22537
|
var PEER_DELEGATION_OPERATIONS = [
|
|
22018
22538
|
"listHarnesses",
|
|
@@ -22196,11 +22716,12 @@ var delegationDefaultsSchema = external_exports.strictObject({
|
|
|
22196
22716
|
byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
|
|
22197
22717
|
});
|
|
22198
22718
|
var modelId = external_exports.string().min(1).max(1024);
|
|
22199
|
-
var harnessPreferenceValuesSchema = external_exports.
|
|
22719
|
+
var harnessPreferenceValuesSchema = external_exports.object({
|
|
22200
22720
|
idleRelease: idleReleaseSettingsSchema.optional(),
|
|
22201
22721
|
favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
|
|
22202
22722
|
newThread: newThreadDefaultsSchema.optional(),
|
|
22203
|
-
delegation: delegationDefaultsSchema.optional()
|
|
22723
|
+
delegation: delegationDefaultsSchema.optional(),
|
|
22724
|
+
showGroupChatsInSidebar: external_exports.boolean().optional()
|
|
22204
22725
|
});
|
|
22205
22726
|
var harnessPreferenceSnapshotSchema = external_exports.strictObject({
|
|
22206
22727
|
scope: harnessPreferenceScopeSchema,
|
|
@@ -22233,6 +22754,10 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
|
|
|
22233
22754
|
kind: external_exports.literal("delegation"),
|
|
22234
22755
|
harnessId: harnessIdSchema,
|
|
22235
22756
|
configuration: harnessDelegationDefaultSchema.nullable()
|
|
22757
|
+
}),
|
|
22758
|
+
external_exports.strictObject({
|
|
22759
|
+
kind: external_exports.literal("groupChatsSidebar"),
|
|
22760
|
+
visible: external_exports.boolean()
|
|
22236
22761
|
})
|
|
22237
22762
|
]);
|
|
22238
22763
|
var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
@@ -22500,6 +23025,10 @@ var webToolOutputPreviewSchema = external_exports.object({
|
|
|
22500
23025
|
bytes: external_exports.number().int().nonnegative()
|
|
22501
23026
|
});
|
|
22502
23027
|
|
|
23028
|
+
// ../../shared-contracts/dist/desktop-shell.js
|
|
23029
|
+
var desktopShellOpenParamsSchema = external_exports.strictObject({});
|
|
23030
|
+
var desktopShellOpenResultSchema = external_exports.strictObject({});
|
|
23031
|
+
|
|
22503
23032
|
// ../../shared-contracts/dist/console.js
|
|
22504
23033
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
22505
23034
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -23065,7 +23594,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
|
23065
23594
|
"unreadable",
|
|
23066
23595
|
"notFound"
|
|
23067
23596
|
];
|
|
23068
|
-
var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)
|
|
23597
|
+
var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)(?:\?hostId=([^\s()<>"?#/&]+))?\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
|
|
23069
23598
|
|
|
23070
23599
|
// ../../shared-contracts/dist/remote-runtime.js
|
|
23071
23600
|
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
@@ -23094,7 +23623,7 @@ var remoteSshSetupParamsSchema = external_exports.object({
|
|
|
23094
23623
|
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
23095
23624
|
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
23096
23625
|
identity: external_exports.string().max(4096).nullable(),
|
|
23097
|
-
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
23626
|
+
action: external_exports.enum(["inspect", "install", "update", "restart", "repair", "uninstall"]),
|
|
23098
23627
|
uninstallPackage: external_exports.boolean().optional(),
|
|
23099
23628
|
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
23100
23629
|
}).strict();
|
|
@@ -23110,6 +23639,7 @@ var target = {
|
|
|
23110
23639
|
var thread2 = { ...target, threadId: identity };
|
|
23111
23640
|
var text = external_exports.string().min(1).max(8e3);
|
|
23112
23641
|
var input2 = { text, requestId: identity };
|
|
23642
|
+
var queueReorderItemIdsSchema = external_exports.array(identity).min(2).max(100).refine((ids) => new Set(ids).size === ids.length, "Queued submission IDs must be distinct");
|
|
23113
23643
|
var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
|
|
23114
23644
|
external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
|
|
23115
23645
|
external_exports.object({
|
|
@@ -23129,6 +23659,7 @@ var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available",
|
|
|
23129
23659
|
external_exports.object({ available: external_exports.literal(false) }),
|
|
23130
23660
|
external_exports.object({
|
|
23131
23661
|
available: external_exports.literal(true),
|
|
23662
|
+
canReorder: external_exports.literal(true).optional(),
|
|
23132
23663
|
items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
|
|
23133
23664
|
})
|
|
23134
23665
|
]);
|
|
@@ -23206,6 +23737,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23206
23737
|
external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input2 }),
|
|
23207
23738
|
external_exports.strictObject({ kind: external_exports.literal("steer"), ...input2, turnId: identity }),
|
|
23208
23739
|
external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
|
|
23740
|
+
external_exports.strictObject({ kind: external_exports.literal("reorder"), itemIds: queueReorderItemIdsSchema }),
|
|
23209
23741
|
external_exports.strictObject({
|
|
23210
23742
|
kind: external_exports.literal("start"),
|
|
23211
23743
|
itemId: identity,
|
|
@@ -25197,7 +25729,7 @@ var BrokeredHarnessAdapter = class {
|
|
|
25197
25729
|
};
|
|
25198
25730
|
|
|
25199
25731
|
// ../codebuddy/dist/usage-statistics.js
|
|
25200
|
-
import
|
|
25732
|
+
import path7 from "node:path";
|
|
25201
25733
|
|
|
25202
25734
|
// ../../harness-adapter/dist/usage-statistics.js
|
|
25203
25735
|
import { createReadStream } from "node:fs";
|
|
@@ -25373,10 +25905,338 @@ function nativeTimeMs(value) {
|
|
|
25373
25905
|
import { createHash } from "node:crypto";
|
|
25374
25906
|
import { realpathSync } from "node:fs";
|
|
25375
25907
|
import { access, readdir as readdir2, realpath as realpath2 } from "node:fs/promises";
|
|
25376
|
-
import { homedir } from "node:os";
|
|
25377
|
-
import
|
|
25908
|
+
import { homedir as homedir2 } from "node:os";
|
|
25909
|
+
import path6 from "node:path";
|
|
25378
25910
|
import { isDeepStrictEqual } from "node:util";
|
|
25379
25911
|
|
|
25912
|
+
// ../../harness-discovery/dist/environment.js
|
|
25913
|
+
import fs from "node:fs";
|
|
25914
|
+
import path3 from "node:path";
|
|
25915
|
+
function targetPath(platform) {
|
|
25916
|
+
return platform === "win32" ? path3.win32 : path3.posix;
|
|
25917
|
+
}
|
|
25918
|
+
function environmentValue(environment, name) {
|
|
25919
|
+
const lowered = name.toLowerCase();
|
|
25920
|
+
for (const [key, value] of Object.entries(environment)) {
|
|
25921
|
+
if (key.toLowerCase() === lowered)
|
|
25922
|
+
return value;
|
|
25923
|
+
}
|
|
25924
|
+
return void 0;
|
|
25925
|
+
}
|
|
25926
|
+
function pathDelimiter(platform) {
|
|
25927
|
+
return platform === "win32" ? ";" : ":";
|
|
25928
|
+
}
|
|
25929
|
+
function pathDirectories(environment, platform) {
|
|
25930
|
+
return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
|
|
25931
|
+
}
|
|
25932
|
+
function executableExtensions(command, platform, environment) {
|
|
25933
|
+
if (platform !== "win32")
|
|
25934
|
+
return [""];
|
|
25935
|
+
if (targetPath(platform).extname(command) !== "")
|
|
25936
|
+
return [""];
|
|
25937
|
+
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
25938
|
+
}
|
|
25939
|
+
function isExecutableFile(filePath2, platform) {
|
|
25940
|
+
try {
|
|
25941
|
+
fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
25942
|
+
return fs.statSync(filePath2).isFile();
|
|
25943
|
+
} catch {
|
|
25944
|
+
return false;
|
|
25945
|
+
}
|
|
25946
|
+
}
|
|
25947
|
+
function isDirectory(candidate) {
|
|
25948
|
+
try {
|
|
25949
|
+
return fs.statSync(candidate).isDirectory();
|
|
25950
|
+
} catch {
|
|
25951
|
+
return false;
|
|
25952
|
+
}
|
|
25953
|
+
}
|
|
25954
|
+
function subdirectoryNames(directory) {
|
|
25955
|
+
try {
|
|
25956
|
+
return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
25957
|
+
} catch {
|
|
25958
|
+
return [];
|
|
25959
|
+
}
|
|
25960
|
+
}
|
|
25961
|
+
function newestFirst(names) {
|
|
25962
|
+
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
25963
|
+
}
|
|
25964
|
+
|
|
25965
|
+
// ../../harness-discovery/dist/invocation.js
|
|
25966
|
+
import path4 from "node:path";
|
|
25967
|
+
function commandInvocation(command, arguments_, environment, platform = process.platform) {
|
|
25968
|
+
const extension = path4.win32.extname(command).toLowerCase();
|
|
25969
|
+
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
25970
|
+
return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
|
|
25971
|
+
}
|
|
25972
|
+
const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
|
|
25973
|
+
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
25974
|
+
return {
|
|
25975
|
+
command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
|
|
25976
|
+
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
25977
|
+
windowsVerbatimArguments: true
|
|
25978
|
+
};
|
|
25979
|
+
}
|
|
25980
|
+
|
|
25981
|
+
// ../../harness-discovery/dist/node-runtime.js
|
|
25982
|
+
import path5 from "node:path";
|
|
25983
|
+
function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
|
|
25984
|
+
const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
|
|
25985
|
+
const delimiter = platform === "win32" ? ";" : ":";
|
|
25986
|
+
const runtimeDirectory = path5.dirname(runtimeExecutable);
|
|
25987
|
+
const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
|
|
25988
|
+
const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
|
|
25989
|
+
if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
|
|
25990
|
+
directories.push(runtimeDirectory);
|
|
25991
|
+
}
|
|
25992
|
+
return { ...environment, [pathKey]: directories.join(delimiter) };
|
|
25993
|
+
}
|
|
25994
|
+
|
|
25995
|
+
// ../../harness-discovery/dist/resolve.js
|
|
25996
|
+
import os2 from "node:os";
|
|
25997
|
+
|
|
25998
|
+
// ../../harness-discovery/dist/version-managers.js
|
|
25999
|
+
function versionManagerBinaryDirectories(context) {
|
|
26000
|
+
const { platform, environment, home } = context;
|
|
26001
|
+
const list = context.subdirectories ?? subdirectoryNames;
|
|
26002
|
+
const pathFlavor = targetPath(platform);
|
|
26003
|
+
const value = (name) => environmentValue(environment, name);
|
|
26004
|
+
const directories = [];
|
|
26005
|
+
const versioned = (root, ...tail) => {
|
|
26006
|
+
for (const version2 of newestFirst(list(root))) {
|
|
26007
|
+
directories.push(pathFlavor.join(root, version2, ...tail));
|
|
26008
|
+
}
|
|
26009
|
+
};
|
|
26010
|
+
if (platform === "win32") {
|
|
26011
|
+
const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
|
|
26012
|
+
const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
|
|
26013
|
+
versioned(pathFlavor.join(appData, "nvm"));
|
|
26014
|
+
versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
|
|
26015
|
+
directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
|
|
26016
|
+
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
26017
|
+
const pnpmHome2 = value("PNPM_HOME");
|
|
26018
|
+
if (pnpmHome2)
|
|
26019
|
+
directories.push(pnpmHome2);
|
|
26020
|
+
directories.push(pathFlavor.join(localAppData, "pnpm"));
|
|
26021
|
+
return directories;
|
|
26022
|
+
}
|
|
26023
|
+
versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
|
|
26024
|
+
const fnmRoots = [
|
|
26025
|
+
value("FNM_DIR"),
|
|
26026
|
+
pathFlavor.join(home, ".local", "share", "fnm"),
|
|
26027
|
+
pathFlavor.join(home, "Library", "Application Support", "fnm")
|
|
26028
|
+
].filter((root) => root !== void 0);
|
|
26029
|
+
for (const root of fnmRoots) {
|
|
26030
|
+
versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
|
|
26031
|
+
}
|
|
26032
|
+
const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
|
|
26033
|
+
versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
|
|
26034
|
+
directories.push(pathFlavor.join(voltaHome, "bin"));
|
|
26035
|
+
const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
|
|
26036
|
+
versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
|
|
26037
|
+
directories.push(pathFlavor.join(asdfHome, "shims"));
|
|
26038
|
+
const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
|
|
26039
|
+
versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
|
|
26040
|
+
directories.push(pathFlavor.join(nodenvHome, "shims"));
|
|
26041
|
+
versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
|
|
26042
|
+
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
26043
|
+
const pnpmHome = value("PNPM_HOME");
|
|
26044
|
+
if (pnpmHome)
|
|
26045
|
+
directories.push(pnpmHome);
|
|
26046
|
+
directories.push(pathFlavor.join(home, "Library", "pnpm"));
|
|
26047
|
+
directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
|
|
26048
|
+
for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
|
|
26049
|
+
for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
|
|
26050
|
+
directories.push(pathFlavor.join(prefix, formula, "bin"));
|
|
26051
|
+
}
|
|
26052
|
+
}
|
|
26053
|
+
return directories;
|
|
26054
|
+
}
|
|
26055
|
+
|
|
26056
|
+
// ../../harness-discovery/dist/resolve.js
|
|
26057
|
+
var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
26058
|
+
function installRootExtensions(platform) {
|
|
26059
|
+
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
26060
|
+
}
|
|
26061
|
+
function resolveHomeDirectory(input3) {
|
|
26062
|
+
return input3.homeDirectory ?? environmentValue(input3.environment, "HOME") ?? environmentValue(input3.environment, "USERPROFILE") ?? os2.homedir();
|
|
26063
|
+
}
|
|
26064
|
+
function templateVariables(environment, platform, home) {
|
|
26065
|
+
const pathFlavor = targetPath(platform);
|
|
26066
|
+
return {
|
|
26067
|
+
HOME: home,
|
|
26068
|
+
USERPROFILE: home,
|
|
26069
|
+
APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
|
|
26070
|
+
LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
|
|
26071
|
+
};
|
|
26072
|
+
}
|
|
26073
|
+
function joinTemplate(platform, value) {
|
|
26074
|
+
const pathFlavor = targetPath(platform);
|
|
26075
|
+
const segments = value.split("/");
|
|
26076
|
+
const head = segments[0] ?? "";
|
|
26077
|
+
const tail = segments.slice(1);
|
|
26078
|
+
if (head === "")
|
|
26079
|
+
return pathFlavor.join(pathFlavor.sep, ...tail);
|
|
26080
|
+
return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
|
|
26081
|
+
}
|
|
26082
|
+
function expandInstallRoot(template, environment, platform, home) {
|
|
26083
|
+
const variables = templateVariables(environment, platform, home);
|
|
26084
|
+
let unresolved = false;
|
|
26085
|
+
const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
|
|
26086
|
+
const value = variables[name] ?? environmentValue(environment, name);
|
|
26087
|
+
if (value === void 0 || value === "") {
|
|
26088
|
+
unresolved = true;
|
|
26089
|
+
return "";
|
|
26090
|
+
}
|
|
26091
|
+
return value;
|
|
26092
|
+
});
|
|
26093
|
+
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
26094
|
+
}
|
|
26095
|
+
function installRootDirectories(spec, input3, dependencies, platform, home) {
|
|
26096
|
+
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
26097
|
+
const directories = [];
|
|
26098
|
+
for (const template of templates) {
|
|
26099
|
+
if (template === VERSION_MANAGER_ROOTS) {
|
|
26100
|
+
directories.push(...versionManagerBinaryDirectories({
|
|
26101
|
+
platform,
|
|
26102
|
+
environment: input3.environment,
|
|
26103
|
+
home,
|
|
26104
|
+
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
26105
|
+
}));
|
|
26106
|
+
continue;
|
|
26107
|
+
}
|
|
26108
|
+
const directory = expandInstallRoot(template, input3.environment, platform, home);
|
|
26109
|
+
if (directory !== void 0)
|
|
26110
|
+
directories.push(directory);
|
|
26111
|
+
}
|
|
26112
|
+
return directories;
|
|
26113
|
+
}
|
|
26114
|
+
function harnessCandidates(spec, input3, dependencies = {}) {
|
|
26115
|
+
const platform = input3.platform ?? process.platform;
|
|
26116
|
+
const pathFlavor = targetPath(platform);
|
|
26117
|
+
const configured = input3.command ?? (spec.commandEnvironmentVariable ? environmentValue(input3.environment, spec.commandEnvironmentVariable) : void 0);
|
|
26118
|
+
const command = configured ?? spec.command;
|
|
26119
|
+
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
26120
|
+
return [{ candidate: command, source: "configured" }];
|
|
26121
|
+
}
|
|
26122
|
+
const candidates = [];
|
|
26123
|
+
const extensions = executableExtensions(command, platform, input3.environment);
|
|
26124
|
+
for (const directory of pathDirectories(input3.environment, platform)) {
|
|
26125
|
+
for (const extension of extensions) {
|
|
26126
|
+
candidates.push({
|
|
26127
|
+
candidate: pathFlavor.join(directory, command + extension),
|
|
26128
|
+
source: "path"
|
|
26129
|
+
});
|
|
26130
|
+
}
|
|
26131
|
+
}
|
|
26132
|
+
if (configured !== void 0)
|
|
26133
|
+
return candidates;
|
|
26134
|
+
const home = resolveHomeDirectory(input3);
|
|
26135
|
+
for (const directory of installRootDirectories(spec, input3, dependencies, platform, home)) {
|
|
26136
|
+
for (const extension of installRootExtensions(platform)) {
|
|
26137
|
+
candidates.push({
|
|
26138
|
+
candidate: pathFlavor.join(directory, spec.command + extension),
|
|
26139
|
+
source: "install-root"
|
|
26140
|
+
});
|
|
26141
|
+
}
|
|
26142
|
+
}
|
|
26143
|
+
return candidates;
|
|
26144
|
+
}
|
|
26145
|
+
function resolveHarnessExecutable(spec, input3, dependencies = {}) {
|
|
26146
|
+
const platform = input3.platform ?? process.platform;
|
|
26147
|
+
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
26148
|
+
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
26149
|
+
const context = { platform, isExecutable };
|
|
26150
|
+
for (const { candidate, source } of harnessCandidates(spec, input3, dependencies)) {
|
|
26151
|
+
const executable = runnable(candidate, context);
|
|
26152
|
+
if (executable !== void 0 && isExecutable(executable))
|
|
26153
|
+
return { executable, source };
|
|
26154
|
+
}
|
|
26155
|
+
return void 0;
|
|
26156
|
+
}
|
|
26157
|
+
|
|
26158
|
+
// ../../harness-discovery/dist/installation.js
|
|
26159
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
26160
|
+
import { homedir } from "node:os";
|
|
26161
|
+
function runInstallationCommand(command, args, environment, timeout = 3e4, cwd) {
|
|
26162
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
26163
|
+
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
26164
|
+
return new Promise((resolve, reject) => {
|
|
26165
|
+
const child = execFile2(invocation.command, invocation.arguments, {
|
|
26166
|
+
env,
|
|
26167
|
+
cwd: cwd ?? env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
26168
|
+
encoding: "utf8",
|
|
26169
|
+
timeout,
|
|
26170
|
+
killSignal: "SIGKILL",
|
|
26171
|
+
maxBuffer: 1024 * 1024,
|
|
26172
|
+
windowsHide: true,
|
|
26173
|
+
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
26174
|
+
}, (error62, stdout, stderr) => {
|
|
26175
|
+
if (error62)
|
|
26176
|
+
reject(new Error(error62.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
|
|
26177
|
+
else
|
|
26178
|
+
resolve((stdout || stderr).trim());
|
|
26179
|
+
});
|
|
26180
|
+
child.stdin?.end();
|
|
26181
|
+
});
|
|
26182
|
+
}
|
|
26183
|
+
function installationVersion(value) {
|
|
26184
|
+
if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
|
|
26185
|
+
throw new Error("Harness returned an invalid version");
|
|
26186
|
+
return value.trim().replace(/^v/, "");
|
|
26187
|
+
}
|
|
26188
|
+
function versionFromOutput(output2) {
|
|
26189
|
+
return installationVersion(output2.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
|
|
26190
|
+
}
|
|
26191
|
+
function newerInstallationVersion(current, latest) {
|
|
26192
|
+
const a = installationVersion(current).replace(/\+.*/, "");
|
|
26193
|
+
const b = installationVersion(latest).replace(/\+.*/, "");
|
|
26194
|
+
const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
|
|
26195
|
+
const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
|
|
26196
|
+
for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
|
|
26197
|
+
if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
|
|
26198
|
+
return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
|
|
26199
|
+
}
|
|
26200
|
+
const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
|
|
26201
|
+
const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
|
|
26202
|
+
if (!preA.length || !preB.length)
|
|
26203
|
+
return !!preA.length && !preB.length;
|
|
26204
|
+
for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
|
|
26205
|
+
const x = preA[i];
|
|
26206
|
+
const y = preB[i];
|
|
26207
|
+
if (x === y)
|
|
26208
|
+
continue;
|
|
26209
|
+
if (x === void 0 || y === void 0)
|
|
26210
|
+
return x === void 0;
|
|
26211
|
+
const numericX = /^\d+$/.test(x);
|
|
26212
|
+
const numericY = /^\d+$/.test(y);
|
|
26213
|
+
if (numericX && numericY) {
|
|
26214
|
+
if (BigInt(x) === BigInt(y))
|
|
26215
|
+
continue;
|
|
26216
|
+
return BigInt(y) > BigInt(x);
|
|
26217
|
+
}
|
|
26218
|
+
if (numericX !== numericY)
|
|
26219
|
+
return numericX;
|
|
26220
|
+
return y > x;
|
|
26221
|
+
}
|
|
26222
|
+
return false;
|
|
26223
|
+
}
|
|
26224
|
+
async function fetchInstallationText(url2) {
|
|
26225
|
+
const request = async () => {
|
|
26226
|
+
const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
|
|
26227
|
+
if (!response.ok)
|
|
26228
|
+
throw new Error("Could not check the latest Harness version");
|
|
26229
|
+
return response.text();
|
|
26230
|
+
};
|
|
26231
|
+
try {
|
|
26232
|
+
return await request();
|
|
26233
|
+
} catch (error62) {
|
|
26234
|
+
if (error62 instanceof DOMException && (error62.name === "AbortError" || error62.name === "TimeoutError"))
|
|
26235
|
+
throw error62;
|
|
26236
|
+
return request();
|
|
26237
|
+
}
|
|
26238
|
+
}
|
|
26239
|
+
|
|
25380
26240
|
// ../codebuddy/dist/common.js
|
|
25381
26241
|
var CODEBUDDY_ID = harnessIdSchema.parse("codebuddy");
|
|
25382
26242
|
var CODEBUDDY_RUNTIME_PROFILE = {
|
|
@@ -25701,16 +26561,16 @@ var Diff = class {
|
|
|
25701
26561
|
}
|
|
25702
26562
|
}
|
|
25703
26563
|
}
|
|
25704
|
-
addToPath(
|
|
25705
|
-
const last =
|
|
26564
|
+
addToPath(path14, added, removed, oldPosInc, options) {
|
|
26565
|
+
const last = path14.lastComponent;
|
|
25706
26566
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
25707
26567
|
return {
|
|
25708
|
-
oldPos:
|
|
26568
|
+
oldPos: path14.oldPos + oldPosInc,
|
|
25709
26569
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
25710
26570
|
};
|
|
25711
26571
|
} else {
|
|
25712
26572
|
return {
|
|
25713
|
-
oldPos:
|
|
26573
|
+
oldPos: path14.oldPos + oldPosInc,
|
|
25714
26574
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
25715
26575
|
};
|
|
25716
26576
|
}
|
|
@@ -26399,15 +27259,18 @@ function codeBuddyCanonicalCwd(cwd) {
|
|
|
26399
27259
|
try {
|
|
26400
27260
|
return realpathSync.native(cwd);
|
|
26401
27261
|
} catch {
|
|
26402
|
-
return
|
|
27262
|
+
return path6.resolve(cwd);
|
|
26403
27263
|
}
|
|
26404
27264
|
}
|
|
26405
|
-
function codeBuddyConfigRoot(environment, profile) {
|
|
26406
|
-
const
|
|
26407
|
-
|
|
27265
|
+
function codeBuddyConfigRoot(environment, profile, source) {
|
|
27266
|
+
const value = (name) => process.platform === "win32" ? environmentValue(environment, name) : environment[name];
|
|
27267
|
+
const configuredRoot = profile.configDirectoryEnvironmentVariables.map((name) => value(name)).find((value2) => typeof value2 === "string" && value2.trim().length > 0);
|
|
27268
|
+
const root = configuredRoot || path6.join(value("HOME") || value("USERPROFILE") || homedir2(), profile.defaultConfigDirectoryName);
|
|
27269
|
+
profile.validateConfigRoot?.(root, source);
|
|
27270
|
+
return root;
|
|
26408
27271
|
}
|
|
26409
27272
|
function codeBuddyPrimaryHistoryPath(cwd, ref, environment, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
26410
|
-
return
|
|
27273
|
+
return path6.join(codeBuddyConfigRoot(environment, profile), "projects", codeBuddyProjectSlug(cwd, profile), `${ref.nativeSessionId}.jsonl`);
|
|
26411
27274
|
}
|
|
26412
27275
|
function derivedLocator(ref) {
|
|
26413
27276
|
const locator = record3(ref.locator);
|
|
@@ -26450,9 +27313,9 @@ async function sameCwd(left, right) {
|
|
|
26450
27313
|
return process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
26451
27314
|
}
|
|
26452
27315
|
async function matchesAnyHistoricalCwd(value, candidates) {
|
|
26453
|
-
const resolved =
|
|
27316
|
+
const resolved = path6.resolve(value);
|
|
26454
27317
|
for (const candidate of candidates) {
|
|
26455
|
-
const other =
|
|
27318
|
+
const other = path6.resolve(candidate);
|
|
26456
27319
|
if (process.platform === "win32" ? resolved.toLowerCase() === other.toLowerCase() : resolved === other)
|
|
26457
27320
|
return true;
|
|
26458
27321
|
try {
|
|
@@ -26476,9 +27339,9 @@ async function codeBuddyLiveNativeHistory(cwd, ref, environment, profile = CODEB
|
|
|
26476
27339
|
async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, profile, transaction) {
|
|
26477
27340
|
validateNativeRef(ref, profile);
|
|
26478
27341
|
const configRoot = codeBuddyConfigRoot(environment, profile);
|
|
26479
|
-
const root =
|
|
27342
|
+
const root = path6.join(configRoot, "projects");
|
|
26480
27343
|
const slug = codeBuddyProjectSlug(cwd, profile);
|
|
26481
|
-
const primary =
|
|
27344
|
+
const primary = path6.join(root, slug, `${ref.nativeSessionId}.jsonl`);
|
|
26482
27345
|
const provenance = derivedLocator(ref);
|
|
26483
27346
|
let candidates = [];
|
|
26484
27347
|
try {
|
|
@@ -26497,7 +27360,7 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
|
|
|
26497
27360
|
for (const directory of directories) {
|
|
26498
27361
|
if (!directory.isDirectory())
|
|
26499
27362
|
continue;
|
|
26500
|
-
const file3 =
|
|
27363
|
+
const file3 = path6.join(root, directory.name, `${ref.nativeSessionId}.jsonl`);
|
|
26501
27364
|
try {
|
|
26502
27365
|
await access(file3);
|
|
26503
27366
|
candidates.push(file3);
|
|
@@ -26512,7 +27375,7 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
|
|
|
26512
27375
|
const file2 = candidates[0];
|
|
26513
27376
|
if (!file2)
|
|
26514
27377
|
throw new CodeBuddyError("sessionNotFound", "Native Session history was not found");
|
|
26515
|
-
if (profile.historyCapabilities?.fork && !transaction &&
|
|
27378
|
+
if (profile.historyCapabilities?.fork && !transaction && path6.resolve(file2) !== path6.resolve(primary))
|
|
26516
27379
|
throw new CodeBuddyError("invalidRequest", "Native Session is not stored in the requested working directory");
|
|
26517
27380
|
const source = await readCodeBuddyVersionedText(file2, 64e6, "Native history exceeds the supported 64 MB snapshot size"), parsed = parseJsonl(source.contents, tolerateIncompleteTail);
|
|
26518
27381
|
const checkedDirectories = /* @__PURE__ */ new Set();
|
|
@@ -26541,7 +27404,7 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
|
|
|
26541
27404
|
}
|
|
26542
27405
|
}
|
|
26543
27406
|
} else if (provenance) {
|
|
26544
|
-
if (!await sameCwd(provenance.boundCwd, cwd) || provenance.targetProjectSlug !== slug ||
|
|
27407
|
+
if (!await sameCwd(provenance.boundCwd, cwd) || provenance.targetProjectSlug !== slug || path6.resolve(file2) !== path6.resolve(primary))
|
|
26545
27408
|
throw new CodeBuddyError("invalidRequest", "Derived Native Session target binding changed");
|
|
26546
27409
|
const active2 = nativeHistoryRows(parsed.contents);
|
|
26547
27410
|
if (provenance.inheritedPrefixRows > active2.length || nativeRowsDigest(active2.slice(0, provenance.inheritedPrefixRows)) !== provenance.inheritedPrefixSha256)
|
|
@@ -26622,41 +27485,99 @@ function isNativeCompactionSummary(row) {
|
|
|
26622
27485
|
return row.type === "message" && row.role === "user" && data.isCompactInternal === true;
|
|
26623
27486
|
}
|
|
26624
27487
|
function nativeHistoryRows(contents) {
|
|
26625
|
-
return collectNativeHistoryRows(contents, false);
|
|
27488
|
+
return collectNativeHistoryRows(contents, { followCompactionParent: false });
|
|
26626
27489
|
}
|
|
26627
27490
|
function nativeDisplayHistoryRows(contents) {
|
|
26628
|
-
return collectNativeHistoryRows(contents,
|
|
27491
|
+
return collectNativeHistoryRows(contents, {
|
|
27492
|
+
followCompactionParent: true,
|
|
27493
|
+
tolerateMissingParent: true
|
|
27494
|
+
});
|
|
26629
27495
|
}
|
|
26630
|
-
function collectNativeHistoryRows(contents,
|
|
26631
|
-
const
|
|
27496
|
+
function collectNativeHistoryRows(contents, options = {}) {
|
|
27497
|
+
const { followCompactionParent = false, tolerateMissingParent = false } = options;
|
|
27498
|
+
const ordered = [];
|
|
27499
|
+
const forkAnchors = /* @__PURE__ */ new Map();
|
|
26632
27500
|
let leaf = "";
|
|
27501
|
+
let segment = 0;
|
|
26633
27502
|
for (const row of parseRows(contents)) {
|
|
26634
27503
|
if (row.type === "resend-fork-notice") {
|
|
26635
27504
|
leaf = text2(row.parentId);
|
|
27505
|
+
segment++;
|
|
27506
|
+
forkAnchors.set(segment, leaf);
|
|
26636
27507
|
continue;
|
|
26637
27508
|
}
|
|
26638
27509
|
if (!NATIVE_MESSAGE_TYPES.has(text2(row.type)))
|
|
26639
27510
|
continue;
|
|
26640
27511
|
if (!text2(row.id))
|
|
26641
27512
|
throw new CodeBuddyError("protocolError", "Native message is missing its stable ID");
|
|
26642
|
-
|
|
27513
|
+
ordered.push({ id: text2(row.id), row, segment });
|
|
26643
27514
|
leaf = text2(row.id);
|
|
26644
27515
|
}
|
|
27516
|
+
const entries = new Map(ordered.map(({ id: id2, row }) => [id2, row]));
|
|
27517
|
+
const rowIndex = new Map(ordered.map((entry, index) => [entry.row, index]));
|
|
26645
27518
|
const chain = [], seen = /* @__PURE__ */ new Set();
|
|
26646
|
-
|
|
26647
|
-
|
|
27519
|
+
const resumeAboveGap = (cursor2) => {
|
|
27520
|
+
const childIndex = chain.length ? rowIndex.get(chain.at(-1)) : void 0;
|
|
27521
|
+
const childSegment = childIndex !== void 0 ? ordered[childIndex].segment : segment;
|
|
27522
|
+
const segmentAnchor = forkAnchors.get(childSegment) ?? "";
|
|
27523
|
+
const start = childIndex ?? ordered.length - 1;
|
|
27524
|
+
const segmentOf = new Map(ordered.map((entry) => [entry.id, entry.segment]));
|
|
27525
|
+
for (let i = start; i >= 0; i--) {
|
|
27526
|
+
const candidate = ordered[i];
|
|
27527
|
+
if (!candidate || candidate.segment !== childSegment)
|
|
27528
|
+
break;
|
|
27529
|
+
if (candidate.id === cursor2 || seen.has(candidate.id) || !entries.has(candidate.id))
|
|
27530
|
+
continue;
|
|
27531
|
+
let probe = candidate.id;
|
|
27532
|
+
const probed = /* @__PURE__ */ new Set();
|
|
27533
|
+
while (probe && !probed.has(probe)) {
|
|
27534
|
+
probed.add(probe);
|
|
27535
|
+
const parentRow = entries.get(probe);
|
|
27536
|
+
if (!parentRow) {
|
|
27537
|
+
probe = void 0;
|
|
27538
|
+
break;
|
|
27539
|
+
}
|
|
27540
|
+
let parentId = text2(parentRow.parentId);
|
|
27541
|
+
if (!parentId && followCompactionParent && isNativeCompactionSummary(parentRow))
|
|
27542
|
+
parentId = text2(parentRow.logicalParentId);
|
|
27543
|
+
if (parentId) {
|
|
27544
|
+
if (parentId === segmentAnchor)
|
|
27545
|
+
break;
|
|
27546
|
+
if (segmentOf.get(parentId) !== candidate.segment) {
|
|
27547
|
+
probe = void 0;
|
|
27548
|
+
break;
|
|
27549
|
+
}
|
|
27550
|
+
}
|
|
27551
|
+
probe = parentId;
|
|
27552
|
+
}
|
|
27553
|
+
if (probe !== void 0)
|
|
27554
|
+
return candidate.id;
|
|
27555
|
+
}
|
|
27556
|
+
if (segmentAnchor && entries.has(segmentAnchor) && segmentAnchor !== cursor2 && !seen.has(segmentAnchor))
|
|
27557
|
+
return segmentAnchor;
|
|
27558
|
+
return "";
|
|
27559
|
+
};
|
|
27560
|
+
let cursor = leaf;
|
|
27561
|
+
while (cursor) {
|
|
27562
|
+
const row = entries.get(cursor);
|
|
27563
|
+
if (!row) {
|
|
27564
|
+
if (!tolerateMissingParent)
|
|
27565
|
+
throw new CodeBuddyError("protocolError", "Native history parent is missing");
|
|
27566
|
+
cursor = resumeAboveGap(cursor);
|
|
27567
|
+
continue;
|
|
27568
|
+
}
|
|
27569
|
+
if (seen.has(cursor))
|
|
26648
27570
|
throw new CodeBuddyError("protocolError", "Native history contains a parent cycle");
|
|
26649
|
-
seen.add(
|
|
26650
|
-
const row = entries.get(leaf);
|
|
26651
|
-
if (!row)
|
|
26652
|
-
throw new CodeBuddyError("protocolError", "Native history parent is missing");
|
|
27571
|
+
seen.add(cursor);
|
|
26653
27572
|
chain.push(row);
|
|
26654
|
-
|
|
26655
|
-
if (!
|
|
26656
|
-
|
|
26657
|
-
if (
|
|
26658
|
-
|
|
26659
|
-
|
|
27573
|
+
cursor = text2(row.parentId);
|
|
27574
|
+
if (!cursor && followCompactionParent && isNativeCompactionSummary(row)) {
|
|
27575
|
+
cursor = text2(row.logicalParentId);
|
|
27576
|
+
if (cursor && !entries.has(cursor)) {
|
|
27577
|
+
if (!tolerateMissingParent)
|
|
27578
|
+
throw new CodeBuddyError("protocolError", "Native compaction parent is missing");
|
|
27579
|
+
cursor = "";
|
|
27580
|
+
}
|
|
26660
27581
|
}
|
|
26661
27582
|
}
|
|
26662
27583
|
return chain.reverse();
|
|
@@ -26948,9 +27869,15 @@ function providerUsageRequest(requestId, data, historical) {
|
|
|
26948
27869
|
return null;
|
|
26949
27870
|
}
|
|
26950
27871
|
}
|
|
27872
|
+
function nativeUsageHistoryRows(contents) {
|
|
27873
|
+
return collectNativeHistoryRows(contents, {
|
|
27874
|
+
followCompactionParent: true,
|
|
27875
|
+
tolerateMissingParent: true
|
|
27876
|
+
});
|
|
27877
|
+
}
|
|
26951
27878
|
function historyUsage(contents) {
|
|
26952
27879
|
const requests = /* @__PURE__ */ new Map();
|
|
26953
|
-
for (const row of
|
|
27880
|
+
for (const row of nativeUsageHistoryRows(contents)) {
|
|
26954
27881
|
const data = record3(row.providerData), usage = record3(data.rawUsage);
|
|
26955
27882
|
if (Object.keys(usage).length && text2(data.messageId))
|
|
26956
27883
|
requests.set(text2(data.messageId), usage);
|
|
@@ -27040,8 +27967,11 @@ async function readCodeBuddyUsage(file2, signal) {
|
|
|
27040
27967
|
function createCodeBuddyUsageStatistics(environment, profile) {
|
|
27041
27968
|
return Object.freeze({
|
|
27042
27969
|
// projects/<project>/<session>.jsonl and <session>/subagents/*.jsonl
|
|
27043
|
-
listSources: (signal) => jsonlUsageSources(
|
|
27044
|
-
readSource: (id2, signal) =>
|
|
27970
|
+
listSources: async (signal) => jsonlUsageSources(path7.join(codeBuddyConfigRoot(environment, profile), "projects"), 3, signal),
|
|
27971
|
+
readSource: async (id2, signal) => {
|
|
27972
|
+
codeBuddyConfigRoot(environment, profile, id2);
|
|
27973
|
+
return readCodeBuddyUsage(id2, signal);
|
|
27974
|
+
}
|
|
27045
27975
|
});
|
|
27046
27976
|
}
|
|
27047
27977
|
|
|
@@ -31283,334 +32213,6 @@ var CodeBuddyCopyCleanup = class {
|
|
|
31283
32213
|
}
|
|
31284
32214
|
};
|
|
31285
32215
|
|
|
31286
|
-
// ../../harness-discovery/dist/environment.js
|
|
31287
|
-
import fs from "node:fs";
|
|
31288
|
-
import path5 from "node:path";
|
|
31289
|
-
function targetPath(platform) {
|
|
31290
|
-
return platform === "win32" ? path5.win32 : path5.posix;
|
|
31291
|
-
}
|
|
31292
|
-
function environmentValue(environment, name) {
|
|
31293
|
-
const lowered = name.toLowerCase();
|
|
31294
|
-
for (const [key, value] of Object.entries(environment)) {
|
|
31295
|
-
if (key.toLowerCase() === lowered)
|
|
31296
|
-
return value;
|
|
31297
|
-
}
|
|
31298
|
-
return void 0;
|
|
31299
|
-
}
|
|
31300
|
-
function pathDelimiter(platform) {
|
|
31301
|
-
return platform === "win32" ? ";" : ":";
|
|
31302
|
-
}
|
|
31303
|
-
function pathDirectories(environment, platform) {
|
|
31304
|
-
return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
|
|
31305
|
-
}
|
|
31306
|
-
function executableExtensions(command, platform, environment) {
|
|
31307
|
-
if (platform !== "win32")
|
|
31308
|
-
return [""];
|
|
31309
|
-
if (targetPath(platform).extname(command) !== "")
|
|
31310
|
-
return [""];
|
|
31311
|
-
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
31312
|
-
}
|
|
31313
|
-
function isExecutableFile(filePath2, platform) {
|
|
31314
|
-
try {
|
|
31315
|
-
fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
31316
|
-
return fs.statSync(filePath2).isFile();
|
|
31317
|
-
} catch {
|
|
31318
|
-
return false;
|
|
31319
|
-
}
|
|
31320
|
-
}
|
|
31321
|
-
function isDirectory(candidate) {
|
|
31322
|
-
try {
|
|
31323
|
-
return fs.statSync(candidate).isDirectory();
|
|
31324
|
-
} catch {
|
|
31325
|
-
return false;
|
|
31326
|
-
}
|
|
31327
|
-
}
|
|
31328
|
-
function subdirectoryNames(directory) {
|
|
31329
|
-
try {
|
|
31330
|
-
return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
31331
|
-
} catch {
|
|
31332
|
-
return [];
|
|
31333
|
-
}
|
|
31334
|
-
}
|
|
31335
|
-
function newestFirst(names) {
|
|
31336
|
-
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
31337
|
-
}
|
|
31338
|
-
|
|
31339
|
-
// ../../harness-discovery/dist/invocation.js
|
|
31340
|
-
import path6 from "node:path";
|
|
31341
|
-
function commandInvocation(command, arguments_, environment, platform = process.platform) {
|
|
31342
|
-
const extension = path6.win32.extname(command).toLowerCase();
|
|
31343
|
-
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
31344
|
-
return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
|
|
31345
|
-
}
|
|
31346
|
-
const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
|
|
31347
|
-
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
31348
|
-
return {
|
|
31349
|
-
command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
|
|
31350
|
-
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
31351
|
-
windowsVerbatimArguments: true
|
|
31352
|
-
};
|
|
31353
|
-
}
|
|
31354
|
-
|
|
31355
|
-
// ../../harness-discovery/dist/node-runtime.js
|
|
31356
|
-
import path7 from "node:path";
|
|
31357
|
-
function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
|
|
31358
|
-
const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
|
|
31359
|
-
const delimiter = platform === "win32" ? ";" : ":";
|
|
31360
|
-
const runtimeDirectory = path7.dirname(runtimeExecutable);
|
|
31361
|
-
const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
|
|
31362
|
-
const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
|
|
31363
|
-
if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
|
|
31364
|
-
directories.push(runtimeDirectory);
|
|
31365
|
-
}
|
|
31366
|
-
return { ...environment, [pathKey]: directories.join(delimiter) };
|
|
31367
|
-
}
|
|
31368
|
-
|
|
31369
|
-
// ../../harness-discovery/dist/resolve.js
|
|
31370
|
-
import os2 from "node:os";
|
|
31371
|
-
|
|
31372
|
-
// ../../harness-discovery/dist/version-managers.js
|
|
31373
|
-
function versionManagerBinaryDirectories(context) {
|
|
31374
|
-
const { platform, environment, home } = context;
|
|
31375
|
-
const list = context.subdirectories ?? subdirectoryNames;
|
|
31376
|
-
const pathFlavor = targetPath(platform);
|
|
31377
|
-
const value = (name) => environmentValue(environment, name);
|
|
31378
|
-
const directories = [];
|
|
31379
|
-
const versioned = (root, ...tail) => {
|
|
31380
|
-
for (const version2 of newestFirst(list(root))) {
|
|
31381
|
-
directories.push(pathFlavor.join(root, version2, ...tail));
|
|
31382
|
-
}
|
|
31383
|
-
};
|
|
31384
|
-
if (platform === "win32") {
|
|
31385
|
-
const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
|
|
31386
|
-
const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
|
|
31387
|
-
versioned(pathFlavor.join(appData, "nvm"));
|
|
31388
|
-
versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
|
|
31389
|
-
directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
|
|
31390
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
31391
|
-
const pnpmHome2 = value("PNPM_HOME");
|
|
31392
|
-
if (pnpmHome2)
|
|
31393
|
-
directories.push(pnpmHome2);
|
|
31394
|
-
directories.push(pathFlavor.join(localAppData, "pnpm"));
|
|
31395
|
-
return directories;
|
|
31396
|
-
}
|
|
31397
|
-
versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
|
|
31398
|
-
const fnmRoots = [
|
|
31399
|
-
value("FNM_DIR"),
|
|
31400
|
-
pathFlavor.join(home, ".local", "share", "fnm"),
|
|
31401
|
-
pathFlavor.join(home, "Library", "Application Support", "fnm")
|
|
31402
|
-
].filter((root) => root !== void 0);
|
|
31403
|
-
for (const root of fnmRoots) {
|
|
31404
|
-
versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
|
|
31405
|
-
}
|
|
31406
|
-
const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
|
|
31407
|
-
versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
|
|
31408
|
-
directories.push(pathFlavor.join(voltaHome, "bin"));
|
|
31409
|
-
const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
|
|
31410
|
-
versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
|
|
31411
|
-
directories.push(pathFlavor.join(asdfHome, "shims"));
|
|
31412
|
-
const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
|
|
31413
|
-
versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
|
|
31414
|
-
directories.push(pathFlavor.join(nodenvHome, "shims"));
|
|
31415
|
-
versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
|
|
31416
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
31417
|
-
const pnpmHome = value("PNPM_HOME");
|
|
31418
|
-
if (pnpmHome)
|
|
31419
|
-
directories.push(pnpmHome);
|
|
31420
|
-
directories.push(pathFlavor.join(home, "Library", "pnpm"));
|
|
31421
|
-
directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
|
|
31422
|
-
for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
|
|
31423
|
-
for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
|
|
31424
|
-
directories.push(pathFlavor.join(prefix, formula, "bin"));
|
|
31425
|
-
}
|
|
31426
|
-
}
|
|
31427
|
-
return directories;
|
|
31428
|
-
}
|
|
31429
|
-
|
|
31430
|
-
// ../../harness-discovery/dist/resolve.js
|
|
31431
|
-
var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
31432
|
-
function installRootExtensions(platform) {
|
|
31433
|
-
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
31434
|
-
}
|
|
31435
|
-
function resolveHomeDirectory(input3) {
|
|
31436
|
-
return input3.homeDirectory ?? environmentValue(input3.environment, "HOME") ?? environmentValue(input3.environment, "USERPROFILE") ?? os2.homedir();
|
|
31437
|
-
}
|
|
31438
|
-
function templateVariables(environment, platform, home) {
|
|
31439
|
-
const pathFlavor = targetPath(platform);
|
|
31440
|
-
return {
|
|
31441
|
-
HOME: home,
|
|
31442
|
-
USERPROFILE: home,
|
|
31443
|
-
APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
|
|
31444
|
-
LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
|
|
31445
|
-
};
|
|
31446
|
-
}
|
|
31447
|
-
function joinTemplate(platform, value) {
|
|
31448
|
-
const pathFlavor = targetPath(platform);
|
|
31449
|
-
const segments = value.split("/");
|
|
31450
|
-
const head = segments[0] ?? "";
|
|
31451
|
-
const tail = segments.slice(1);
|
|
31452
|
-
if (head === "")
|
|
31453
|
-
return pathFlavor.join(pathFlavor.sep, ...tail);
|
|
31454
|
-
return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
|
|
31455
|
-
}
|
|
31456
|
-
function expandInstallRoot(template, environment, platform, home) {
|
|
31457
|
-
const variables = templateVariables(environment, platform, home);
|
|
31458
|
-
let unresolved = false;
|
|
31459
|
-
const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
|
|
31460
|
-
const value = variables[name] ?? environmentValue(environment, name);
|
|
31461
|
-
if (value === void 0 || value === "") {
|
|
31462
|
-
unresolved = true;
|
|
31463
|
-
return "";
|
|
31464
|
-
}
|
|
31465
|
-
return value;
|
|
31466
|
-
});
|
|
31467
|
-
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
31468
|
-
}
|
|
31469
|
-
function installRootDirectories(spec, input3, dependencies, platform, home) {
|
|
31470
|
-
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
31471
|
-
const directories = [];
|
|
31472
|
-
for (const template of templates) {
|
|
31473
|
-
if (template === VERSION_MANAGER_ROOTS) {
|
|
31474
|
-
directories.push(...versionManagerBinaryDirectories({
|
|
31475
|
-
platform,
|
|
31476
|
-
environment: input3.environment,
|
|
31477
|
-
home,
|
|
31478
|
-
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
31479
|
-
}));
|
|
31480
|
-
continue;
|
|
31481
|
-
}
|
|
31482
|
-
const directory = expandInstallRoot(template, input3.environment, platform, home);
|
|
31483
|
-
if (directory !== void 0)
|
|
31484
|
-
directories.push(directory);
|
|
31485
|
-
}
|
|
31486
|
-
return directories;
|
|
31487
|
-
}
|
|
31488
|
-
function harnessCandidates(spec, input3, dependencies = {}) {
|
|
31489
|
-
const platform = input3.platform ?? process.platform;
|
|
31490
|
-
const pathFlavor = targetPath(platform);
|
|
31491
|
-
const configured = input3.command ?? (spec.commandEnvironmentVariable ? environmentValue(input3.environment, spec.commandEnvironmentVariable) : void 0);
|
|
31492
|
-
const command = configured ?? spec.command;
|
|
31493
|
-
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
31494
|
-
return [{ candidate: command, source: "configured" }];
|
|
31495
|
-
}
|
|
31496
|
-
const candidates = [];
|
|
31497
|
-
const extensions = executableExtensions(command, platform, input3.environment);
|
|
31498
|
-
for (const directory of pathDirectories(input3.environment, platform)) {
|
|
31499
|
-
for (const extension of extensions) {
|
|
31500
|
-
candidates.push({
|
|
31501
|
-
candidate: pathFlavor.join(directory, command + extension),
|
|
31502
|
-
source: "path"
|
|
31503
|
-
});
|
|
31504
|
-
}
|
|
31505
|
-
}
|
|
31506
|
-
if (configured !== void 0)
|
|
31507
|
-
return candidates;
|
|
31508
|
-
const home = resolveHomeDirectory(input3);
|
|
31509
|
-
for (const directory of installRootDirectories(spec, input3, dependencies, platform, home)) {
|
|
31510
|
-
for (const extension of installRootExtensions(platform)) {
|
|
31511
|
-
candidates.push({
|
|
31512
|
-
candidate: pathFlavor.join(directory, spec.command + extension),
|
|
31513
|
-
source: "install-root"
|
|
31514
|
-
});
|
|
31515
|
-
}
|
|
31516
|
-
}
|
|
31517
|
-
return candidates;
|
|
31518
|
-
}
|
|
31519
|
-
function resolveHarnessExecutable(spec, input3, dependencies = {}) {
|
|
31520
|
-
const platform = input3.platform ?? process.platform;
|
|
31521
|
-
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
31522
|
-
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
31523
|
-
const context = { platform, isExecutable };
|
|
31524
|
-
for (const { candidate, source } of harnessCandidates(spec, input3, dependencies)) {
|
|
31525
|
-
const executable = runnable(candidate, context);
|
|
31526
|
-
if (executable !== void 0 && isExecutable(executable))
|
|
31527
|
-
return { executable, source };
|
|
31528
|
-
}
|
|
31529
|
-
return void 0;
|
|
31530
|
-
}
|
|
31531
|
-
|
|
31532
|
-
// ../../harness-discovery/dist/installation.js
|
|
31533
|
-
import { execFile as execFile2 } from "node:child_process";
|
|
31534
|
-
import { homedir as homedir2 } from "node:os";
|
|
31535
|
-
function runInstallationCommand(command, args, environment, timeout = 3e4, cwd) {
|
|
31536
|
-
const env = withNodeRuntimeOnPath(environment);
|
|
31537
|
-
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
31538
|
-
return new Promise((resolve, reject) => {
|
|
31539
|
-
const child = execFile2(invocation.command, invocation.arguments, {
|
|
31540
|
-
env,
|
|
31541
|
-
cwd: cwd ?? env.HOME ?? env.USERPROFILE ?? homedir2(),
|
|
31542
|
-
encoding: "utf8",
|
|
31543
|
-
timeout,
|
|
31544
|
-
killSignal: "SIGKILL",
|
|
31545
|
-
maxBuffer: 1024 * 1024,
|
|
31546
|
-
windowsHide: true,
|
|
31547
|
-
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
31548
|
-
}, (error62, stdout, stderr) => {
|
|
31549
|
-
if (error62)
|
|
31550
|
-
reject(new Error(error62.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
|
|
31551
|
-
else
|
|
31552
|
-
resolve((stdout || stderr).trim());
|
|
31553
|
-
});
|
|
31554
|
-
child.stdin?.end();
|
|
31555
|
-
});
|
|
31556
|
-
}
|
|
31557
|
-
function installationVersion(value) {
|
|
31558
|
-
if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
|
|
31559
|
-
throw new Error("Harness returned an invalid version");
|
|
31560
|
-
return value.trim().replace(/^v/, "");
|
|
31561
|
-
}
|
|
31562
|
-
function versionFromOutput(output2) {
|
|
31563
|
-
return installationVersion(output2.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
|
|
31564
|
-
}
|
|
31565
|
-
function newerInstallationVersion(current, latest) {
|
|
31566
|
-
const a = installationVersion(current).replace(/\+.*/, "");
|
|
31567
|
-
const b = installationVersion(latest).replace(/\+.*/, "");
|
|
31568
|
-
const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
|
|
31569
|
-
const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
|
|
31570
|
-
for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
|
|
31571
|
-
if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
|
|
31572
|
-
return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
|
|
31573
|
-
}
|
|
31574
|
-
const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
|
|
31575
|
-
const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
|
|
31576
|
-
if (!preA.length || !preB.length)
|
|
31577
|
-
return !!preA.length && !preB.length;
|
|
31578
|
-
for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
|
|
31579
|
-
const x = preA[i];
|
|
31580
|
-
const y = preB[i];
|
|
31581
|
-
if (x === y)
|
|
31582
|
-
continue;
|
|
31583
|
-
if (x === void 0 || y === void 0)
|
|
31584
|
-
return x === void 0;
|
|
31585
|
-
const numericX = /^\d+$/.test(x);
|
|
31586
|
-
const numericY = /^\d+$/.test(y);
|
|
31587
|
-
if (numericX && numericY) {
|
|
31588
|
-
if (BigInt(x) === BigInt(y))
|
|
31589
|
-
continue;
|
|
31590
|
-
return BigInt(y) > BigInt(x);
|
|
31591
|
-
}
|
|
31592
|
-
if (numericX !== numericY)
|
|
31593
|
-
return numericX;
|
|
31594
|
-
return y > x;
|
|
31595
|
-
}
|
|
31596
|
-
return false;
|
|
31597
|
-
}
|
|
31598
|
-
async function fetchInstallationText(url2) {
|
|
31599
|
-
const request = async () => {
|
|
31600
|
-
const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
|
|
31601
|
-
if (!response.ok)
|
|
31602
|
-
throw new Error("Could not check the latest Harness version");
|
|
31603
|
-
return response.text();
|
|
31604
|
-
};
|
|
31605
|
-
try {
|
|
31606
|
-
return await request();
|
|
31607
|
-
} catch (error62) {
|
|
31608
|
-
if (error62 instanceof DOMException && (error62.name === "AbortError" || error62.name === "TimeoutError"))
|
|
31609
|
-
throw error62;
|
|
31610
|
-
return request();
|
|
31611
|
-
}
|
|
31612
|
-
}
|
|
31613
|
-
|
|
31614
32216
|
// ../codebuddy/dist/command.js
|
|
31615
32217
|
var codeBuddyDiscoverySpec = {
|
|
31616
32218
|
id: "codebuddy",
|
|
@@ -33397,6 +33999,7 @@ var CodeBuddyChildObserver = class {
|
|
|
33397
33999
|
throw error62;
|
|
33398
34000
|
});
|
|
33399
34001
|
if (sameCodeBuddyFileVersion(current, this.#parent.version)) {
|
|
34002
|
+
codeBuddyConfigRoot(this.environment, this.profile);
|
|
33400
34003
|
await this.#validateWorkspaces(this.#parent.historicalCwds);
|
|
33401
34004
|
this.#assertOpen();
|
|
33402
34005
|
return this.#parent;
|
|
@@ -33856,6 +34459,11 @@ var CodeBuddySession = class {
|
|
|
33856
34459
|
this.#usage = historyUsage(history);
|
|
33857
34460
|
this.#meterHistory(history, true);
|
|
33858
34461
|
rewind = pendingNativeHistoryRewind(history);
|
|
34462
|
+
if (rewind?.forkPointId) {
|
|
34463
|
+
const knownIds = new Set(nativeRawHistoryRows(history).map((row) => text2(row.id)).filter(Boolean));
|
|
34464
|
+
if (!knownIds.has(rewind.forkPointId))
|
|
34465
|
+
throw new CodeBuddyError("protocolError", "Native history parent is missing");
|
|
34466
|
+
}
|
|
33859
34467
|
} else {
|
|
33860
34468
|
this.#emit({ type: "usage.history", complete: true });
|
|
33861
34469
|
}
|
|
@@ -34651,8 +35259,8 @@ var CodeBuddyAdapter = class {
|
|
|
34651
35259
|
};
|
|
34652
35260
|
|
|
34653
35261
|
// dist/command.js
|
|
34654
|
-
import { lstatSync, statSync } from "node:fs";
|
|
34655
35262
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
35263
|
+
import { lstatSync, statSync as statSync2 } from "node:fs";
|
|
34656
35264
|
import { homedir as homedir3 } from "node:os";
|
|
34657
35265
|
|
|
34658
35266
|
// dist/delegation.js
|
|
@@ -34881,6 +35489,107 @@ var WORKBUDDY_CREDENTIAL_PRELOAD = String.raw`
|
|
|
34881
35489
|
})();
|
|
34882
35490
|
`;
|
|
34883
35491
|
|
|
35492
|
+
// dist/distribution.js
|
|
35493
|
+
import { readFileSync, realpathSync as realpathSync2, statSync } from "node:fs";
|
|
35494
|
+
import path12 from "node:path";
|
|
35495
|
+
var WORKBUDDY_DISTRIBUTIONS = {
|
|
35496
|
+
global: {
|
|
35497
|
+
harnessId: harnessIdSchema.parse("workbuddy"),
|
|
35498
|
+
displayName: "WorkBuddy",
|
|
35499
|
+
commandEnvironmentVariable: "CODEXHOST_WORKBUDDY_COMMAND",
|
|
35500
|
+
configDirectoryEnvironmentVariable: "WORKBUDDY_CONFIG_DIR",
|
|
35501
|
+
dataFolderName: ".workbuddy-ai",
|
|
35502
|
+
endpoint: "https://www.workbuddy.ai",
|
|
35503
|
+
authenticationId: "workbuddy-desktop-ai"
|
|
35504
|
+
},
|
|
35505
|
+
cn: {
|
|
35506
|
+
harnessId: harnessIdSchema.parse("workbuddy-cn"),
|
|
35507
|
+
displayName: "WorkBuddy CN",
|
|
35508
|
+
commandEnvironmentVariable: "CODEXHOST_WORKBUDDYCN_COMMAND",
|
|
35509
|
+
configDirectoryEnvironmentVariable: "WORKBUDDYCN_CONFIG_DIR",
|
|
35510
|
+
dataFolderName: ".workbuddy",
|
|
35511
|
+
endpoint: "https://www.workbuddy.cn",
|
|
35512
|
+
authenticationId: "workbuddy-desktop"
|
|
35513
|
+
}
|
|
35514
|
+
};
|
|
35515
|
+
var RELEASES = Object.keys(WORKBUDDY_DISTRIBUTIONS);
|
|
35516
|
+
function readWorkBuddyProduct(cliScript) {
|
|
35517
|
+
const packageRoot = path12.dirname(path12.dirname(realpathSync2(cliScript)));
|
|
35518
|
+
return JSON.parse(readWorkBuddyProductConfiguration(path12.join(packageRoot, "product.json")));
|
|
35519
|
+
}
|
|
35520
|
+
function readWorkBuddyProductConfiguration(file2) {
|
|
35521
|
+
if (!statSync(file2).isFile())
|
|
35522
|
+
throw new CodeBuddyError("invalidRequest", "WorkBuddy product configuration is not a regular file");
|
|
35523
|
+
return readFileSync(file2, "utf8");
|
|
35524
|
+
}
|
|
35525
|
+
function serviceOrigin(endpoint) {
|
|
35526
|
+
if (typeof endpoint !== "string")
|
|
35527
|
+
return;
|
|
35528
|
+
try {
|
|
35529
|
+
return new URL(endpoint).origin;
|
|
35530
|
+
} catch {
|
|
35531
|
+
return;
|
|
35532
|
+
}
|
|
35533
|
+
}
|
|
35534
|
+
function workBuddyReleasesDeclaredBy(product) {
|
|
35535
|
+
if (product === null || typeof product !== "object")
|
|
35536
|
+
return [];
|
|
35537
|
+
const { dataFolderName, endpoint, authentication } = product;
|
|
35538
|
+
const service = serviceOrigin(endpoint);
|
|
35539
|
+
const authenticationId = authentication !== null && typeof authentication === "object" ? authentication.id : void 0;
|
|
35540
|
+
return RELEASES.filter((release) => {
|
|
35541
|
+
const identity2 = WORKBUDDY_DISTRIBUTIONS[release];
|
|
35542
|
+
return identity2.dataFolderName === dataFolderName || new URL(identity2.endpoint).origin === service || identity2.authenticationId === authenticationId;
|
|
35543
|
+
});
|
|
35544
|
+
}
|
|
35545
|
+
function foreignWorkBuddyProduct(product, distribution) {
|
|
35546
|
+
const foreign = workBuddyReleasesDeclaredBy(product).find((release) => release !== distribution);
|
|
35547
|
+
if (foreign)
|
|
35548
|
+
return foreign;
|
|
35549
|
+
const dataFolderName = product !== null && typeof product === "object" ? product.dataFolderName : void 0;
|
|
35550
|
+
return dataFolderName !== void 0 && dataFolderName !== WORKBUDDY_DISTRIBUTIONS[distribution].dataFolderName ? "other" : void 0;
|
|
35551
|
+
}
|
|
35552
|
+
function rejectForeignWorkBuddyProduct(source, product, distribution) {
|
|
35553
|
+
const foreign = foreignWorkBuddyProduct(product, distribution);
|
|
35554
|
+
const { displayName } = WORKBUDDY_DISTRIBUTIONS[distribution];
|
|
35555
|
+
if (foreign === "other")
|
|
35556
|
+
throw new CodeBuddyError("invalidRequest", `${source} declares another product's data root, not ${displayName}`);
|
|
35557
|
+
if (foreign)
|
|
35558
|
+
throw new CodeBuddyError("invalidRequest", `${source} declares ${WORKBUDDY_DISTRIBUTIONS[foreign].displayName}, not ${displayName}; select the ${WORKBUDDY_DISTRIBUTIONS[foreign].harnessId} Harness for it`);
|
|
35559
|
+
}
|
|
35560
|
+
function verifiedWorkBuddyRootSnapshot(root, distribution, platform = process.platform, readText = readWorkBuddyProductConfiguration, source) {
|
|
35561
|
+
if (source) {
|
|
35562
|
+
const relative = path12.relative(path12.join(realpathSync2(root), "projects"), realpathSync2(source));
|
|
35563
|
+
if (path12.isAbsolute(relative) || relative === ".." || relative.startsWith(`..${path12.sep}`))
|
|
35564
|
+
throw new CodeBuddyError("invalidRequest", "WorkBuddy usage source is outside the selected data root");
|
|
35565
|
+
}
|
|
35566
|
+
const candidate = targetPath(platform).join(root, "cache", "acc-product-config-v3.json");
|
|
35567
|
+
let product;
|
|
35568
|
+
try {
|
|
35569
|
+
product = JSON.parse(readText(candidate));
|
|
35570
|
+
} catch (error62) {
|
|
35571
|
+
if (error62 instanceof CodeBuddyError)
|
|
35572
|
+
throw error62;
|
|
35573
|
+
return;
|
|
35574
|
+
}
|
|
35575
|
+
rejectForeignWorkBuddyProduct("The product snapshot in this WorkBuddy root", product, distribution);
|
|
35576
|
+
return candidate;
|
|
35577
|
+
}
|
|
35578
|
+
function workBuddyDistributionOfProduct(product) {
|
|
35579
|
+
const declared = workBuddyReleasesDeclaredBy(product);
|
|
35580
|
+
const release = declared.length === 1 ? declared[0] : void 0;
|
|
35581
|
+
return release && !foreignWorkBuddyProduct(product, release) ? release : void 0;
|
|
35582
|
+
}
|
|
35583
|
+
function workBuddyDistributionOf(cliScript, readProduct2 = readWorkBuddyProduct) {
|
|
35584
|
+
let product;
|
|
35585
|
+
try {
|
|
35586
|
+
product = readProduct2(cliScript);
|
|
35587
|
+
} catch {
|
|
35588
|
+
return void 0;
|
|
35589
|
+
}
|
|
35590
|
+
return workBuddyDistributionOfProduct(product);
|
|
35591
|
+
}
|
|
35592
|
+
|
|
34884
35593
|
// dist/discovery.js
|
|
34885
35594
|
var WORKBUDDY_MACOS_ELECTRON = "/Applications/WorkBuddy AI.app/Contents/MacOS/Electron";
|
|
34886
35595
|
var windowsRoots = [
|
|
@@ -34904,16 +35613,16 @@ var macSpec = {
|
|
|
34904
35613
|
]
|
|
34905
35614
|
}
|
|
34906
35615
|
};
|
|
34907
|
-
var
|
|
35616
|
+
var linuxSpecs = ["workbuddy", "workbuddyai"].map((command) => ({
|
|
34908
35617
|
id: "workbuddy",
|
|
34909
|
-
command
|
|
35618
|
+
command,
|
|
34910
35619
|
installRoots: { posix: linuxRoots }
|
|
34911
|
-
};
|
|
35620
|
+
}));
|
|
34912
35621
|
function resolveWorkBuddyInstallDirectory(directory, environment, platform, isExecutable, subdirectories = subdirectoryNames) {
|
|
34913
35622
|
const paths = targetPath(platform);
|
|
34914
|
-
const entries = platform === "win32" ? ["WorkBuddy-app.exe", "WorkBuddy.exe", "WorkBuddy AI.exe", "WorkBuddyAI.exe"] : platform === "darwin" ? [paths.join("Contents", "MacOS", "Electron")] : platform === "linux" ? ["workbuddy"] : [];
|
|
35623
|
+
const entries = platform === "win32" ? ["WorkBuddy-app.exe", "WorkBuddy.exe", "WorkBuddy AI.exe", "WorkBuddyAI.exe"] : platform === "darwin" ? [paths.join("Contents", "MacOS", "Electron")] : platform === "linux" ? ["workbuddy", "workbuddyai"] : [];
|
|
34915
35624
|
for (const entry of entries) {
|
|
34916
|
-
const bundle = resolveWorkBuddyBundle(environment, platform, isExecutable, paths.join(directory, entry), subdirectories);
|
|
35625
|
+
const bundle = resolveWorkBuddyBundle(environment, platform, isExecutable, paths.join(directory, entry), () => true, subdirectories);
|
|
34917
35626
|
if (bundle)
|
|
34918
35627
|
return bundle;
|
|
34919
35628
|
}
|
|
@@ -34946,12 +35655,12 @@ function resolveWorkBuddyLauncherLayout(directory, platform, isExecutable, subdi
|
|
|
34946
35655
|
}
|
|
34947
35656
|
return void 0;
|
|
34948
35657
|
}
|
|
34949
|
-
function resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExecutable, subdirectories = subdirectoryNames) {
|
|
35658
|
+
function resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExecutable, accept, subdirectories = subdirectoryNames) {
|
|
34950
35659
|
const specs = platform === "darwin" ? [macSpec] : platform === "win32" ? ["WorkBuddy AI", "WorkBuddy", "WorkBuddyAI"].map((command) => ({
|
|
34951
35660
|
id: "workbuddy",
|
|
34952
35661
|
command,
|
|
34953
35662
|
installRoots: { windows: windowsRoots }
|
|
34954
|
-
})) : platform === "linux" ?
|
|
35663
|
+
})) : platform === "linux" ? linuxSpecs : [];
|
|
34955
35664
|
const paths = targetPath(platform);
|
|
34956
35665
|
const candidates = explicitExecutable ? [{ candidate: explicitExecutable, source: "configured" }] : specs.flatMap((spec) => harnessCandidates(spec, { environment, platform }));
|
|
34957
35666
|
for (const { candidate, source } of candidates) {
|
|
@@ -34962,11 +35671,14 @@ function resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExe
|
|
|
34962
35671
|
if (!isExecutable(candidate))
|
|
34963
35672
|
continue;
|
|
34964
35673
|
const launcher = resolveWorkBuddyLauncherLayout(paths.dirname(candidate), platform, isExecutable, subdirectories);
|
|
34965
|
-
if (launcher)
|
|
34966
|
-
|
|
35674
|
+
if (launcher) {
|
|
35675
|
+
if (accept(launcher.cli))
|
|
35676
|
+
return launcher;
|
|
35677
|
+
continue;
|
|
35678
|
+
}
|
|
34967
35679
|
const resources = platform === "darwin" ? paths.resolve(paths.dirname(candidate), "..", "Resources") : paths.join(paths.dirname(candidate), "resources");
|
|
34968
35680
|
const cli = paths.join(resources, "app.asar.unpacked", "cli", "bin", "codebuddy");
|
|
34969
|
-
if (isExecutable(cli))
|
|
35681
|
+
if (isExecutable(cli) && accept(cli))
|
|
34970
35682
|
return { executable: candidate, cli };
|
|
34971
35683
|
}
|
|
34972
35684
|
return void 0;
|
|
@@ -34985,18 +35697,29 @@ var WORKBUDDY_PRODUCT_CONFIG_INLINE_ENVS = [
|
|
|
34985
35697
|
"ACC_PRODUCT_CONFIG_V2",
|
|
34986
35698
|
"ACC_PRODUCT_CONFIG"
|
|
34987
35699
|
];
|
|
34988
|
-
function
|
|
34989
|
-
|
|
34990
|
-
|
|
34991
|
-
|
|
34992
|
-
if (
|
|
34993
|
-
|
|
35700
|
+
function platformEnvironmentValue(environment, name, platform) {
|
|
35701
|
+
return platform === "win32" ? environmentValue(environment, name) : environment[name];
|
|
35702
|
+
}
|
|
35703
|
+
function setPlatformEnvironmentValue(environment, name, value, platform) {
|
|
35704
|
+
if (platform === "win32") {
|
|
35705
|
+
const lowered = name.toLowerCase();
|
|
35706
|
+
for (const key of Object.keys(environment)) {
|
|
35707
|
+
if (key !== name && key.toLowerCase() === lowered)
|
|
35708
|
+
Reflect.deleteProperty(environment, key);
|
|
35709
|
+
}
|
|
35710
|
+
}
|
|
35711
|
+
environment[name] = value;
|
|
35712
|
+
}
|
|
35713
|
+
function hasExplicitProductConfiguration(environment, platform) {
|
|
35714
|
+
return platformEnvironmentValue(environment, WORKBUDDY_PRODUCT_CONFIG_PATH_ENV, platform) !== void 0 || WORKBUDDY_PRODUCT_CONFIG_INLINE_ENVS.some((name) => platformEnvironmentValue(environment, name, platform) !== void 0);
|
|
35715
|
+
}
|
|
35716
|
+
function forwardableRootProductConfigPath(candidate, platform, dependencies) {
|
|
34994
35717
|
const paths = targetPath(platform);
|
|
34995
|
-
const candidate = paths.join(root, "cache", "acc-product-config-v3.json");
|
|
34996
35718
|
try {
|
|
34997
35719
|
const inspect = dependencies.lstat ?? lstatSync;
|
|
34998
35720
|
const uid = (dependencies.getuid ?? (() => process.getuid?.()))();
|
|
34999
|
-
|
|
35721
|
+
const cache = paths.dirname(candidate);
|
|
35722
|
+
for (const directory of [paths.dirname(cache), cache]) {
|
|
35000
35723
|
const metadata2 = inspect(directory);
|
|
35001
35724
|
if (!metadata2.isDirectory() || metadata2.isSymbolicLink())
|
|
35002
35725
|
return;
|
|
@@ -35021,14 +35744,38 @@ function bundledProductConfigPath(environment, platform, dependencies) {
|
|
|
35021
35744
|
return;
|
|
35022
35745
|
}
|
|
35023
35746
|
}
|
|
35024
|
-
function
|
|
35747
|
+
function verifyExplicitProductConfiguration(environment, distribution, platform, readText) {
|
|
35748
|
+
const path14 = platformEnvironmentValue(environment, WORKBUDDY_PRODUCT_CONFIG_PATH_ENV, platform)?.trim();
|
|
35749
|
+
const sources = [
|
|
35750
|
+
...path14 ? [[WORKBUDDY_PRODUCT_CONFIG_PATH_ENV, () => readText(path14)]] : [],
|
|
35751
|
+
...WORKBUDDY_PRODUCT_CONFIG_INLINE_ENVS.flatMap((name) => {
|
|
35752
|
+
const value = platformEnvironmentValue(environment, name, platform);
|
|
35753
|
+
return value?.trim() ? [[name, () => value]] : [];
|
|
35754
|
+
})
|
|
35755
|
+
];
|
|
35756
|
+
for (const [name, read] of sources) {
|
|
35757
|
+
let product;
|
|
35758
|
+
try {
|
|
35759
|
+
product = JSON.parse(read());
|
|
35760
|
+
} catch {
|
|
35761
|
+
throw new CodeBuddyError("invalidRequest", `${name} cannot be verified as ${WORKBUDDY_DISTRIBUTIONS[distribution].displayName} product configuration`);
|
|
35762
|
+
}
|
|
35763
|
+
rejectForeignWorkBuddyProduct(name, product, distribution);
|
|
35764
|
+
}
|
|
35765
|
+
}
|
|
35766
|
+
function workBuddyEnvironment(environment, platform = process.platform, distribution = "global") {
|
|
35025
35767
|
const paths = targetPath(platform);
|
|
35026
|
-
const
|
|
35027
|
-
const
|
|
35768
|
+
const { configDirectoryEnvironmentVariable, dataFolderName } = WORKBUDDY_DISTRIBUTIONS[distribution];
|
|
35769
|
+
const configuredRoot = platformEnvironmentValue(environment, configDirectoryEnvironmentVariable, platform);
|
|
35770
|
+
const root = paths.resolve(configuredRoot?.trim() ? configuredRoot : paths.join(platformEnvironmentValue(environment, "HOME", platform) || platformEnvironmentValue(environment, "USERPROFILE", platform) || homedir3(), dataFolderName));
|
|
35771
|
+
const rootedEnvironment = { ...environment };
|
|
35772
|
+
setPlatformEnvironmentValue(rootedEnvironment, "CODEBUDDY_CONFIG_DIR", root, platform);
|
|
35773
|
+
setPlatformEnvironmentValue(rootedEnvironment, "WORKBUDDY_CONFIG_DIR", root, platform);
|
|
35028
35774
|
return {
|
|
35029
|
-
...
|
|
35030
|
-
// The
|
|
35031
|
-
//
|
|
35775
|
+
...rootedEnvironment,
|
|
35776
|
+
// The native CLI runs one product and reads WORKBUDDY_CONFIG_DIR/CODEBUDDY_CONFIG_DIR.
|
|
35777
|
+
// Force both to this release's root so neither a global CodeBuddy nor the other
|
|
35778
|
+
// release's Host override can leak history, authentication or settings.
|
|
35032
35779
|
CODEBUDDY_CONFIG_DIR: root,
|
|
35033
35780
|
WORKBUDDY_CONFIG_DIR: root,
|
|
35034
35781
|
DISABLE_AUTOUPDATER: environment.DISABLE_AUTOUPDATER ?? "1"
|
|
@@ -35036,31 +35783,49 @@ function workBuddyEnvironment(environment, platform = process.platform) {
|
|
|
35036
35783
|
}
|
|
35037
35784
|
function resolveWorkBuddyLaunch(environment, dependencies = {}) {
|
|
35038
35785
|
const platform = dependencies.platform ?? process.platform;
|
|
35039
|
-
const
|
|
35786
|
+
const distribution = dependencies.distribution ?? "global";
|
|
35787
|
+
const { displayName, commandEnvironmentVariable } = WORKBUDDY_DISTRIBUTIONS[distribution];
|
|
35788
|
+
const releaseOf = (cli) => workBuddyDistributionOf(cli, dependencies.readProduct);
|
|
35789
|
+
const configured = environmentValue(environment, commandEnvironmentVariable)?.trim() || void 0;
|
|
35040
35790
|
if (!configured && platform !== "darwin" && platform !== "win32" && platform !== "linux")
|
|
35041
|
-
throw new CodeBuddyError("notInstalled",
|
|
35791
|
+
throw new CodeBuddyError("notInstalled", `${displayName} app discovery is unavailable on this platform; set ${commandEnvironmentVariable} for a compatible native runtime`);
|
|
35042
35792
|
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
35043
35793
|
const subdirectories = dependencies.subdirectories ?? subdirectoryNames;
|
|
35044
35794
|
const configuredDirectory = configured && (dependencies.isDirectory ?? isDirectory)(configured) ? configured : void 0;
|
|
35045
35795
|
const explicitExecutable = configured && !configuredDirectory ? resolveHarnessExecutable(workBuddyDiscoverySpec, { environment, platform, command: configured }, { isExecutable })?.executable : void 0;
|
|
35046
|
-
const explicitBundle = explicitExecutable ? resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExecutable, subdirectories) : void 0;
|
|
35047
|
-
|
|
35048
|
-
|
|
35796
|
+
const explicitBundle = explicitExecutable ? resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExecutable, () => true, subdirectories) : void 0;
|
|
35797
|
+
let explicitCliProduct;
|
|
35798
|
+
let hasExplicitCliProduct = false;
|
|
35799
|
+
if (explicitExecutable && !explicitBundle) {
|
|
35800
|
+
try {
|
|
35801
|
+
explicitCliProduct = (dependencies.readProduct ?? readWorkBuddyProduct)(explicitExecutable);
|
|
35802
|
+
hasExplicitCliProduct = true;
|
|
35803
|
+
} catch {
|
|
35804
|
+
}
|
|
35805
|
+
}
|
|
35806
|
+
const explicitDesktop = explicitExecutable !== void 0 && (explicitBundle !== void 0 || !hasExplicitCliProduct && (platform === "linux" || platform === "win32" && /^(?:WorkBuddy(?:-app)?|WorkBuddy AI|WorkBuddyAI)\.exe$/iu.test(targetPath(platform).basename(explicitExecutable)) || platform === "darwin" && /\/(?:WorkBuddy|WorkBuddy AI)\.app\/Contents\/MacOS\/Electron$/u.test(explicitExecutable)));
|
|
35807
|
+
const bundle = configuredDirectory ? resolveWorkBuddyInstallDirectory(configuredDirectory, environment, platform, isExecutable, subdirectories) : !configured ? resolveWorkBuddyBundle(environment, platform, isExecutable, void 0, (cli) => releaseOf(cli) === distribution, subdirectories) : explicitDesktop ? explicitBundle : void 0;
|
|
35049
35808
|
const executable = configured && !explicitDesktop && !configuredDirectory ? explicitExecutable : bundle?.executable;
|
|
35050
35809
|
if (!executable)
|
|
35051
|
-
throw new CodeBuddyError("notInstalled",
|
|
35810
|
+
throw new CodeBuddyError("notInstalled", `${displayName} app or its bundled CLI is unavailable`);
|
|
35811
|
+
if (configured) {
|
|
35812
|
+
const release = hasExplicitCliProduct && executable === explicitExecutable ? workBuddyDistributionOfProduct(explicitCliProduct) : releaseOf(bundle?.cli ?? executable);
|
|
35813
|
+
if (release !== distribution)
|
|
35814
|
+
throw new CodeBuddyError("invalidRequest", release ? `${configured} is ${WORKBUDDY_DISTRIBUTIONS[release].displayName}, not ${displayName}; select the ${WORKBUDDY_DISTRIBUTIONS[release].harnessId} Harness for it` : `${configured} does not declare ${displayName} product metadata`);
|
|
35815
|
+
}
|
|
35052
35816
|
return { executable, bundle };
|
|
35053
35817
|
}
|
|
35054
35818
|
function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {}, argumentsOverride) {
|
|
35055
35819
|
const dependencies = Array.isArray(dependenciesOrArguments) ? {} : dependenciesOrArguments;
|
|
35056
35820
|
const nativeArguments = Array.isArray(dependenciesOrArguments) ? dependenciesOrArguments : argumentsOverride;
|
|
35057
35821
|
const platform = dependencies.platform ?? process.platform;
|
|
35822
|
+
const distribution = dependencies.distribution ?? "global";
|
|
35058
35823
|
const { executable, bundle } = resolveWorkBuddyLaunch(environment, dependencies);
|
|
35059
35824
|
const paths = targetPath(platform);
|
|
35060
35825
|
const cliDist = bundle && paths.join(paths.dirname(paths.dirname(bundle.cli)), "dist");
|
|
35061
35826
|
const isFile = dependencies.isFile ?? ((candidate) => {
|
|
35062
35827
|
try {
|
|
35063
|
-
return
|
|
35828
|
+
return statSync2(candidate).isFile();
|
|
35064
35829
|
} catch {
|
|
35065
35830
|
return false;
|
|
35066
35831
|
}
|
|
@@ -35072,8 +35837,15 @@ function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {
|
|
|
35072
35837
|
...workBuddyDelegationArguments(environment, ephemeral)
|
|
35073
35838
|
];
|
|
35074
35839
|
const serve = liteOnly && acpArguments.includes("--acp") && !acpArguments.includes("--serve");
|
|
35075
|
-
const
|
|
35076
|
-
const
|
|
35840
|
+
const rootEnvironment = workBuddyEnvironment(environment, platform, distribution);
|
|
35841
|
+
const configuredEnvironment = withNodeRuntimeOnPath(rootEnvironment, process.execPath, platform);
|
|
35842
|
+
const explicitProductConfigPath = platformEnvironmentValue(configuredEnvironment, WORKBUDDY_PRODUCT_CONFIG_PATH_ENV, platform)?.trim();
|
|
35843
|
+
if (explicitProductConfigPath)
|
|
35844
|
+
setPlatformEnvironmentValue(configuredEnvironment, WORKBUDDY_PRODUCT_CONFIG_PATH_ENV, paths.resolve(explicitProductConfigPath), platform);
|
|
35845
|
+
const readText = dependencies.readText ?? readWorkBuddyProductConfiguration;
|
|
35846
|
+
verifyExplicitProductConfiguration(configuredEnvironment, distribution, platform, readText);
|
|
35847
|
+
const rootSnapshot = verifiedWorkBuddyRootSnapshot(rootEnvironment.WORKBUDDY_CONFIG_DIR, distribution, platform, readText);
|
|
35848
|
+
const productConfigPath = bundle && rootSnapshot && !hasExplicitProductConfiguration(configuredEnvironment, platform) ? forwardableRootProductConfigPath(rootSnapshot, platform, dependencies) : void 0;
|
|
35077
35849
|
const childEnvironment = bundle ? {
|
|
35078
35850
|
...configuredEnvironment,
|
|
35079
35851
|
// EOF-only native Fork copies do no model work. The bundled CLI otherwise
|
|
@@ -35101,7 +35873,7 @@ require(process.argv[1]);`, bundle.cli] : [],
|
|
|
35101
35873
|
}
|
|
35102
35874
|
|
|
35103
35875
|
// dist/common.js
|
|
35104
|
-
var WORKBUDDY_ID =
|
|
35876
|
+
var WORKBUDDY_ID = WORKBUDDY_DISTRIBUTIONS.global.harnessId;
|
|
35105
35877
|
var WORKBUDDY_COMMAND_CATALOG = harnessCommandCatalogSchema.parse({
|
|
35106
35878
|
commands: [
|
|
35107
35879
|
{
|
|
@@ -35121,22 +35893,30 @@ var WORKBUDDY_COMMAND_CATALOG = harnessCommandCatalogSchema.parse({
|
|
|
35121
35893
|
}
|
|
35122
35894
|
]
|
|
35123
35895
|
});
|
|
35124
|
-
|
|
35125
|
-
harnessId
|
|
35126
|
-
|
|
35127
|
-
|
|
35128
|
-
|
|
35129
|
-
|
|
35130
|
-
|
|
35131
|
-
|
|
35132
|
-
|
|
35133
|
-
|
|
35134
|
-
|
|
35135
|
-
|
|
35896
|
+
function workBuddyRuntimeProfile(distribution) {
|
|
35897
|
+
const { harnessId, displayName, configDirectoryEnvironmentVariable, dataFolderName } = WORKBUDDY_DISTRIBUTIONS[distribution];
|
|
35898
|
+
return {
|
|
35899
|
+
harnessId,
|
|
35900
|
+
displayName,
|
|
35901
|
+
interactionIdPrefix: harnessId,
|
|
35902
|
+
// History, subagents and Fork read the same Host key the spawned CLI root is mapped from.
|
|
35903
|
+
configDirectoryEnvironmentVariables: [configDirectoryEnvironmentVariable],
|
|
35904
|
+
defaultConfigDirectoryName: dataFolderName,
|
|
35905
|
+
validateConfigRoot: (root, source) => verifiedWorkBuddyRootSnapshot(root, distribution, process.platform, void 0, source),
|
|
35906
|
+
// WorkBuddy's native PathUtils.compressPath preserves case, dots, spaces and Unicode.
|
|
35907
|
+
projectDirectoryName: (cwd) => cwd.replace(/[/\\:]/gu, "-").replace(/^-+/u, "").replace(/-+$/u, "").replace(/-+/gu, "-"),
|
|
35908
|
+
staticCommandCatalog: WORKBUDDY_COMMAND_CATALOG,
|
|
35909
|
+
nativeCommands: true,
|
|
35910
|
+
// Verified online on the international CLI 2.137.1. The China CLI 2.147.0 ships the same
|
|
35911
|
+
// public `--fork-session` mode and `_codebuddy.ai/session/rollback` extension.
|
|
35912
|
+
historyCapabilities: { fork: true, forkAcrossCwd: true, rollbackLastTurn: true }
|
|
35913
|
+
};
|
|
35914
|
+
}
|
|
35915
|
+
var WORKBUDDY_RUNTIME_PROFILE = workBuddyRuntimeProfile("global");
|
|
35136
35916
|
|
|
35137
35917
|
// dist/product-models.js
|
|
35138
35918
|
import { readFile as readFile5, stat as stat4 } from "node:fs/promises";
|
|
35139
|
-
import
|
|
35919
|
+
import path13 from "node:path";
|
|
35140
35920
|
var MAX_PRODUCT_SNAPSHOT_BYTES = 8 * 1024 * 1024;
|
|
35141
35921
|
var PRODUCT_CONFIG_PATH_ENV = "ACC_PRODUCT_CONFIG_PATH";
|
|
35142
35922
|
var PRODUCT_CONFIG_INLINE_ENVS = [
|
|
@@ -35198,10 +35978,10 @@ function bundledFallbackProductPath(invocation) {
|
|
|
35198
35978
|
const cli = invocation.bundledCliPath;
|
|
35199
35979
|
if (!cli)
|
|
35200
35980
|
return;
|
|
35201
|
-
return
|
|
35981
|
+
return path13.join(path13.dirname(path13.dirname(cli)), "product.json");
|
|
35202
35982
|
}
|
|
35203
|
-
async function loadWorkBuddyProductModels(environment) {
|
|
35204
|
-
const invocation = workBuddyInvocation(environment, true);
|
|
35983
|
+
async function loadWorkBuddyProductModels(environment, distribution) {
|
|
35984
|
+
const invocation = workBuddyInvocation(environment, true, { distribution });
|
|
35205
35985
|
const productEnvironment = invocation.environment;
|
|
35206
35986
|
const configuredPath = nonBlank(productEnvironment[PRODUCT_CONFIG_PATH_ENV]);
|
|
35207
35987
|
if (configuredPath) {
|
|
@@ -35256,18 +36036,21 @@ function mergeWorkBuddyProductModels(catalog, productModels) {
|
|
|
35256
36036
|
|
|
35257
36037
|
// dist/workbuddy-adapter.js
|
|
35258
36038
|
var WorkBuddyAdapter = class extends CodeBuddyAdapter {
|
|
36039
|
+
#displayName;
|
|
35259
36040
|
#productModels;
|
|
35260
36041
|
constructor(options = {}) {
|
|
35261
|
-
const { productModels, platform = process.platform, ...codeBuddyOptions } = options;
|
|
36042
|
+
const { productModels, platform = process.platform, distribution = "global", ...codeBuddyOptions } = options;
|
|
35262
36043
|
const environment = { ...codeBuddyOptions.environment ?? process.env };
|
|
35263
|
-
const
|
|
36044
|
+
const baseProfile = workBuddyRuntimeProfile(distribution);
|
|
36045
|
+
const profile = platform === "win32" ? { ...baseProfile, allowUnlistedModelSelection: true } : baseProfile;
|
|
36046
|
+
const invocation = (invocationEnvironment, ephemeral, args) => workBuddyInvocation(invocationEnvironment, ephemeral, { distribution, platform }, args);
|
|
35264
36047
|
super({
|
|
35265
36048
|
...codeBuddyOptions,
|
|
35266
36049
|
profile,
|
|
35267
|
-
invocationFactory:
|
|
35268
|
-
clientFactory: codeBuddyOptions.clientFactory ?? ((clientOptions) => new CodeBuddyAcpClient(clientOptions, void 0, workBuddyInvocation))
|
|
36050
|
+
invocationFactory: invocation
|
|
35269
36051
|
});
|
|
35270
|
-
this.#
|
|
36052
|
+
this.#displayName = baseProfile.displayName;
|
|
36053
|
+
this.#productModels = platform === "win32" ? productModels ?? (() => loadWorkBuddyProductModels(environment, distribution)) : async () => [];
|
|
35271
36054
|
}
|
|
35272
36055
|
async inspect(input3 = {}) {
|
|
35273
36056
|
const inspection = await super.inspect(input3);
|
|
@@ -35287,7 +36070,7 @@ var WorkBuddyAdapter = class extends CodeBuddyAdapter {
|
|
|
35287
36070
|
ok: false,
|
|
35288
36071
|
error: {
|
|
35289
36072
|
code: "invalidRequest",
|
|
35290
|
-
message:
|
|
36073
|
+
message: `${this.#displayName}: unattended execution requires native fullAccess permissions`,
|
|
35291
36074
|
retryable: false
|
|
35292
36075
|
}
|
|
35293
36076
|
};
|
|
@@ -35315,10 +36098,14 @@ async function readProduct(file2) {
|
|
|
35315
36098
|
function createWorkBuddyInstallation(environment, dependencies = {}) {
|
|
35316
36099
|
const platform = dependencies.platform ?? process.platform;
|
|
35317
36100
|
const arch = dependencies.arch ?? process.arch;
|
|
36101
|
+
const distribution = dependencies.distribution ?? "global";
|
|
35318
36102
|
return async (action) => {
|
|
35319
36103
|
if (action === "update")
|
|
35320
36104
|
throw new Error("Complete the update with WorkBuddy's official desktop installer");
|
|
35321
|
-
const { executable, bundle } = resolveWorkBuddyLaunch(environment, {
|
|
36105
|
+
const { executable, bundle } = resolveWorkBuddyLaunch(environment, {
|
|
36106
|
+
platform,
|
|
36107
|
+
distribution
|
|
36108
|
+
});
|
|
35322
36109
|
if (!bundle)
|
|
35323
36110
|
return {
|
|
35324
36111
|
currentVersion: versionFromOutput(await runInstallationCommand(executable, ["--version"], environment)),
|
|
@@ -35377,22 +36164,23 @@ function createWorkBuddyInstallation(environment, dependencies = {}) {
|
|
|
35377
36164
|
}
|
|
35378
36165
|
|
|
35379
36166
|
// dist/plugin.js
|
|
35380
|
-
function createHarnessAdapter(context) {
|
|
36167
|
+
function createHarnessAdapter(context, distribution = "global") {
|
|
36168
|
+
const { harnessId, commandEnvironmentVariable } = WORKBUDDY_DISTRIBUTIONS[distribution];
|
|
35381
36169
|
if (context.platform === "darwin" && context.managedRemoteHost) {
|
|
35382
36170
|
const environment2 = {
|
|
35383
36171
|
...context.environment,
|
|
35384
|
-
...context.launchCommand ? {
|
|
36172
|
+
...context.launchCommand ? { [commandEnvironmentVariable]: context.launchCommand } : {}
|
|
35385
36173
|
};
|
|
35386
36174
|
return new BrokeredHarnessAdapter({
|
|
35387
36175
|
sessionImport: true,
|
|
35388
36176
|
accountCredits: false,
|
|
35389
|
-
harnessId
|
|
36177
|
+
harnessId,
|
|
35390
36178
|
commandCatalog: WORKBUDDY_COMMAND_CATALOG,
|
|
35391
36179
|
forwardDelegationEnvironment: true,
|
|
35392
36180
|
environment: { ...context.environment },
|
|
35393
36181
|
isInstalled: () => {
|
|
35394
36182
|
try {
|
|
35395
|
-
workBuddyInvocation(environment2, true);
|
|
36183
|
+
workBuddyInvocation(environment2, true, { distribution });
|
|
35396
36184
|
return true;
|
|
35397
36185
|
} catch (error62) {
|
|
35398
36186
|
return !(error62 instanceof CodeBuddyError && error62.code === "notInstalled");
|
|
@@ -35403,11 +36191,14 @@ function createHarnessAdapter(context) {
|
|
|
35403
36191
|
}
|
|
35404
36192
|
const environment = {
|
|
35405
36193
|
...context.environment,
|
|
35406
|
-
...context.launchCommand ? {
|
|
36194
|
+
...context.launchCommand ? { [commandEnvironmentVariable]: context.launchCommand } : {}
|
|
35407
36195
|
};
|
|
35408
36196
|
const platform = context.platform === "darwin" || context.platform === "win32" || context.platform === "linux" ? context.platform : void 0;
|
|
35409
|
-
return Object.assign(new WorkBuddyAdapter({ environment, ...platform ? { platform } : {} }), {
|
|
35410
|
-
installation: createWorkBuddyInstallation(environment,
|
|
36197
|
+
return Object.assign(new WorkBuddyAdapter({ distribution, environment, ...platform ? { platform } : {} }), {
|
|
36198
|
+
installation: createWorkBuddyInstallation(environment, {
|
|
36199
|
+
distribution,
|
|
36200
|
+
...platform ? { platform } : {}
|
|
36201
|
+
})
|
|
35411
36202
|
});
|
|
35412
36203
|
}
|
|
35413
36204
|
export {
|