@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, path19) {
|
|
832
|
+
if (!path19)
|
|
833
833
|
return obj;
|
|
834
|
-
return
|
|
834
|
+
return path19.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(path19, issues) {
|
|
1175
1175
|
return issues.map((iss) => {
|
|
1176
1176
|
var _a4;
|
|
1177
1177
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
1178
|
-
iss.path.unshift(
|
|
1178
|
+
iss.path.unshift(path19);
|
|
1179
1179
|
return iss;
|
|
1180
1180
|
});
|
|
1181
1181
|
}
|
|
@@ -1637,16 +1637,16 @@ function flattenError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1637
1637
|
}
|
|
1638
1638
|
function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
1639
1639
|
const fieldErrors = { _errors: [] };
|
|
1640
|
-
const processError = (error64,
|
|
1640
|
+
const processError = (error64, path19 = []) => {
|
|
1641
1641
|
for (const issue2 of error64.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 }, [...path19, ...issue2.path]));
|
|
1644
1644
|
} else if (issue2.code === "invalid_key") {
|
|
1645
|
-
processError({ issues: issue2.issues }, [...
|
|
1645
|
+
processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
|
|
1646
1646
|
} else if (issue2.code === "invalid_element") {
|
|
1647
|
-
processError({ issues: issue2.issues }, [...
|
|
1647
|
+
processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
|
|
1648
1648
|
} else {
|
|
1649
|
-
const fullpath = [...
|
|
1649
|
+
const fullpath = [...path19, ...issue2.path];
|
|
1650
1650
|
if (fullpath.length === 0) {
|
|
1651
1651
|
fieldErrors._errors.push(mapper(issue2));
|
|
1652
1652
|
} else {
|
|
@@ -1685,17 +1685,17 @@ function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1685
1685
|
}
|
|
1686
1686
|
function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
1687
1687
|
const result = { errors: [] };
|
|
1688
|
-
const processError = (error64,
|
|
1688
|
+
const processError = (error64, path19 = []) => {
|
|
1689
1689
|
var _a4;
|
|
1690
1690
|
for (const issue2 of error64.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 }, [...path19, ...issue2.path]));
|
|
1693
1693
|
} else if (issue2.code === "invalid_key") {
|
|
1694
|
-
processError({ issues: issue2.issues }, [...
|
|
1694
|
+
processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
|
|
1695
1695
|
} else if (issue2.code === "invalid_element") {
|
|
1696
|
-
processError({ issues: issue2.issues }, [...
|
|
1696
|
+
processError({ issues: issue2.issues }, [...path19, ...issue2.path]);
|
|
1697
1697
|
} else {
|
|
1698
|
-
const fullpath = [...
|
|
1698
|
+
const fullpath = [...path19, ...issue2.path];
|
|
1699
1699
|
if (fullpath.length === 0) {
|
|
1700
1700
|
result.errors.push(mapper(issue2));
|
|
1701
1701
|
continue;
|
|
@@ -1734,8 +1734,8 @@ function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1734
1734
|
}
|
|
1735
1735
|
function toDotPath(_path) {
|
|
1736
1736
|
const segs = [];
|
|
1737
|
-
const
|
|
1738
|
-
for (const seg of
|
|
1737
|
+
const path19 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1738
|
+
for (const seg of path19) {
|
|
1739
1739
|
if (typeof seg === "number")
|
|
1740
1740
|
segs.push(`[${seg}]`);
|
|
1741
1741
|
else if (typeof seg === "symbol")
|
|
@@ -16664,8 +16664,8 @@ function rewriteKeyNames(ctx) {
|
|
|
16664
16664
|
bySchema.set(entry.schema, entry);
|
|
16665
16665
|
}
|
|
16666
16666
|
const rewrites = /* @__PURE__ */ new Map();
|
|
16667
|
-
for (const
|
|
16668
|
-
const seen = ctx.seen.get(
|
|
16667
|
+
for (const record4 of pendingRecords.get(ctx) ?? []) {
|
|
16668
|
+
const seen = ctx.seen.get(record4);
|
|
16669
16669
|
const names = (seen?.def ?? seen?.schema)?.propertyNames;
|
|
16670
16670
|
if (!names || names === true || rewrites.has(names))
|
|
16671
16671
|
continue;
|
|
@@ -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 path19 = ref.slice(1).split("/").filter(Boolean);
|
|
18877
|
+
if (path19.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 (path19[0] === defsKey) {
|
|
18882
|
+
const key = path19[1] === void 0 ? void 0 : decodeJSONPointerSegment(path19[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 = (path19, message) => ctx.addIssue({ code: "custom", path: [path19], 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((id3) => !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((path19) => path19.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((path19) => path19.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 = (path19) => path19.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((path19) => path19 === void 0 || hostExtensionResourcePathSchema.safeParse(path19).success),
|
|
20817
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path19) => hostExtensionResourcePathSchema.safeParse(path19).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((path19) => /^(?:\/|[a-z]:[/\\])/iu.test(path19) && !path19.includes("\0") && !path19.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 @@ function desktopImageAttachmentPaths(text3) {
|
|
|
23065
23594
|
const context = end < 0 ? text3 : text3.slice(0, end);
|
|
23066
23595
|
if (!ATTACHED_FILES_HEADING.test(context))
|
|
23067
23596
|
return [];
|
|
23068
|
-
return [...context.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((
|
|
23597
|
+
return [...context.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path19) => path19.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path19));
|
|
23069
23598
|
}
|
|
23070
23599
|
|
|
23071
23600
|
// ../../shared-contracts/dist/thread-watch-notice.js
|
|
@@ -23078,7 +23607,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
|
23078
23607
|
"unreadable",
|
|
23079
23608
|
"notFound"
|
|
23080
23609
|
];
|
|
23081
|
-
var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)
|
|
23610
|
+
var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)(?:\?hostId=([^\s()<>"?#/&]+))?\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
|
|
23082
23611
|
|
|
23083
23612
|
// ../../shared-contracts/dist/remote-runtime.js
|
|
23084
23613
|
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
@@ -23107,7 +23636,7 @@ var remoteSshSetupParamsSchema = external_exports.object({
|
|
|
23107
23636
|
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
23108
23637
|
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
23109
23638
|
identity: external_exports.string().max(4096).nullable(),
|
|
23110
|
-
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
23639
|
+
action: external_exports.enum(["inspect", "install", "update", "restart", "repair", "uninstall"]),
|
|
23111
23640
|
uninstallPackage: external_exports.boolean().optional(),
|
|
23112
23641
|
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
23113
23642
|
}).strict();
|
|
@@ -23123,6 +23652,7 @@ var target = {
|
|
|
23123
23652
|
var thread2 = { ...target, threadId: identity };
|
|
23124
23653
|
var text = external_exports.string().min(1).max(8e3);
|
|
23125
23654
|
var input2 = { text, requestId: identity };
|
|
23655
|
+
var queueReorderItemIdsSchema = external_exports.array(identity).min(2).max(100).refine((ids) => new Set(ids).size === ids.length, "Queued submission IDs must be distinct");
|
|
23126
23656
|
var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
|
|
23127
23657
|
external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
|
|
23128
23658
|
external_exports.object({
|
|
@@ -23142,6 +23672,7 @@ var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available",
|
|
|
23142
23672
|
external_exports.object({ available: external_exports.literal(false) }),
|
|
23143
23673
|
external_exports.object({
|
|
23144
23674
|
available: external_exports.literal(true),
|
|
23675
|
+
canReorder: external_exports.literal(true).optional(),
|
|
23145
23676
|
items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
|
|
23146
23677
|
})
|
|
23147
23678
|
]);
|
|
@@ -23219,6 +23750,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23219
23750
|
external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input2 }),
|
|
23220
23751
|
external_exports.strictObject({ kind: external_exports.literal("steer"), ...input2, turnId: identity }),
|
|
23221
23752
|
external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
|
|
23753
|
+
external_exports.strictObject({ kind: external_exports.literal("reorder"), itemIds: queueReorderItemIdsSchema }),
|
|
23222
23754
|
external_exports.strictObject({
|
|
23223
23755
|
kind: external_exports.literal("start"),
|
|
23224
23756
|
itemId: identity,
|
|
@@ -24145,7 +24677,7 @@ var harnessErrorSchema = external_exports.object({
|
|
|
24145
24677
|
var harnessSessionStateSchema = external_exports.custom((value) => {
|
|
24146
24678
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
24147
24679
|
return false;
|
|
24148
|
-
const
|
|
24680
|
+
const record4 = value;
|
|
24149
24681
|
const allowed2 = /* @__PURE__ */ new Set([
|
|
24150
24682
|
"nativeRef",
|
|
24151
24683
|
"effectiveModel",
|
|
@@ -24154,12 +24686,12 @@ var harnessSessionStateSchema = external_exports.custom((value) => {
|
|
|
24154
24686
|
"availableThinkingOptions",
|
|
24155
24687
|
"effectivePermissionModeId"
|
|
24156
24688
|
]);
|
|
24157
|
-
if (Object.keys(
|
|
24689
|
+
if (Object.keys(record4).some((key) => !allowed2.has(key)))
|
|
24158
24690
|
return false;
|
|
24159
|
-
if (
|
|
24691
|
+
if (record4.nativeRef !== void 0 && !nativeSessionRefSchema.safeParse(record4.nativeRef).success) {
|
|
24160
24692
|
return false;
|
|
24161
24693
|
}
|
|
24162
|
-
const { nativeRef: _nativeRef, ...configuration } =
|
|
24694
|
+
const { nativeRef: _nativeRef, ...configuration } = record4;
|
|
24163
24695
|
void _nativeRef;
|
|
24164
24696
|
return harnessConfigurationStateSchema.safeParse(configuration).success;
|
|
24165
24697
|
});
|
|
@@ -25287,9 +25819,9 @@ function claudeUsageHistory(entries) {
|
|
|
25287
25819
|
}
|
|
25288
25820
|
const requests = [];
|
|
25289
25821
|
for (const [id3, { model: model2, usage }] of usages) {
|
|
25290
|
-
const
|
|
25291
|
-
if (
|
|
25292
|
-
requests.push(
|
|
25822
|
+
const record4 = claudeUsageRecord(id3, model2, usage, { historical: true });
|
|
25823
|
+
if (record4.kind === "request")
|
|
25824
|
+
requests.push(record4.request);
|
|
25293
25825
|
else
|
|
25294
25826
|
complete = false;
|
|
25295
25827
|
}
|
|
@@ -25505,8 +26037,8 @@ async function readClaudeUsage(file2, signal) {
|
|
|
25505
26037
|
}
|
|
25506
26038
|
const entries = [];
|
|
25507
26039
|
for (const [id3, { model: model2, usage, at: at2 }] of messages) {
|
|
25508
|
-
const
|
|
25509
|
-
const entry =
|
|
26040
|
+
const record4 = claudeUsageRecord(id3, model2, usage);
|
|
26041
|
+
const entry = record4.kind === "request" && at2 !== null && usageEntryFromRequest(record4.request, at2);
|
|
25510
26042
|
if (entry)
|
|
25511
26043
|
entries.push(withUsageSession(entry, {
|
|
25512
26044
|
sessionId: text2(sessionId),
|
|
@@ -25600,7 +26132,7 @@ function claudePromptCacheIndicators(accountCreditsSupported, lastResponseAtUnix
|
|
|
25600
26132
|
|
|
25601
26133
|
// dist/claude-code-adapter.js
|
|
25602
26134
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
25603
|
-
import
|
|
26135
|
+
import path16 from "node:path";
|
|
25604
26136
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
25605
26137
|
|
|
25606
26138
|
// ../../../node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
|
|
@@ -38997,12 +39529,12 @@ var fJ = T(function(dJ) {
|
|
|
38997
39529
|
var _J = T(function(hJ) {
|
|
38998
39530
|
Object.defineProperty(hJ, "__esModule", { value: true });
|
|
38999
39531
|
hJ.extendSubschemaMode = hJ.extendSubschemaData = hJ.getSubschema = void 0;
|
|
39000
|
-
var
|
|
39532
|
+
var os9 = Ie(), mJ = We();
|
|
39001
39533
|
function V4e(e, { keyword: t, schemaProp: n, schema: r, schemaPath: o, errSchemaPath: s, topSchemaRef: i }) {
|
|
39002
39534
|
if (t !== void 0 && r !== void 0) throw Error('both "keyword" and "schema" passed, only one allowed');
|
|
39003
39535
|
if (t !== void 0) {
|
|
39004
39536
|
let a = e.schema[t];
|
|
39005
|
-
return n === void 0 ? { schema: a, schemaPath:
|
|
39537
|
+
return n === void 0 ? { schema: a, schemaPath: os9._`${e.schemaPath}${os9.getProperty(t)}`, errSchemaPath: `${e.errSchemaPath}/${t}` } : { schema: a[n], schemaPath: os9._`${e.schemaPath}${os9.getProperty(t)}${os9.getProperty(n)}`, errSchemaPath: `${e.errSchemaPath}/${t}/${mJ.escapeFragment(n)}` };
|
|
39006
39538
|
}
|
|
39007
39539
|
if (r !== void 0) {
|
|
39008
39540
|
if (o === void 0 || s === void 0 || i === void 0) throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
|
|
@@ -39015,11 +39547,11 @@ var _J = T(function(hJ) {
|
|
|
39015
39547
|
if (o !== void 0 && n !== void 0) throw Error('both "data" and "dataProp" passed, only one allowed');
|
|
39016
39548
|
let { gen: a } = t;
|
|
39017
39549
|
if (n !== void 0) {
|
|
39018
|
-
let { errorPath: l, dataPathArr: u, opts: p } = t, f = a.let("data",
|
|
39019
|
-
c(f), e.errorPath =
|
|
39550
|
+
let { errorPath: l, dataPathArr: u, opts: p } = t, f = a.let("data", os9._`${t.data}${os9.getProperty(n)}`, true);
|
|
39551
|
+
c(f), e.errorPath = os9.str`${l}${mJ.getErrorPath(n, r, p.jsPropertySyntax)}`, e.parentDataProperty = os9._`${n}`, e.dataPathArr = [...u, e.parentDataProperty];
|
|
39020
39552
|
}
|
|
39021
39553
|
if (o !== void 0) {
|
|
39022
|
-
let l = o instanceof
|
|
39554
|
+
let l = o instanceof os9.Name ? o : a.let("data", o, true);
|
|
39023
39555
|
if (c(l), i !== void 0) e.propertyName = i;
|
|
39024
39556
|
}
|
|
39025
39557
|
if (s) e.dataTypes = s;
|
|
@@ -61203,6 +61735,317 @@ var ClaudeBackgroundOccupancy = class {
|
|
|
61203
61735
|
}
|
|
61204
61736
|
};
|
|
61205
61737
|
|
|
61738
|
+
// dist/custom-provider-quota.js
|
|
61739
|
+
import { readFile as readFile3, stat as stat2 } from "node:fs/promises";
|
|
61740
|
+
import os3 from "node:os";
|
|
61741
|
+
import path4 from "node:path";
|
|
61742
|
+
var SEAT_QUOTA_PATH = "/quota-api/seats";
|
|
61743
|
+
var KEY_QUOTA_PATH = "/v1/me/quota";
|
|
61744
|
+
var REQUEST_TIMEOUT_MS = 1e4;
|
|
61745
|
+
var SEAT_QUOTA_TIMEOUT_MS = 5e3;
|
|
61746
|
+
var MAX_CUSTOM_PROVIDER_ACCOUNTS = 8;
|
|
61747
|
+
function record3(value) {
|
|
61748
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
61749
|
+
}
|
|
61750
|
+
function trimmedString(value) {
|
|
61751
|
+
if (typeof value !== "string")
|
|
61752
|
+
return void 0;
|
|
61753
|
+
const trimmed = value.trim();
|
|
61754
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
61755
|
+
}
|
|
61756
|
+
function finiteNonNegative(value) {
|
|
61757
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
|
|
61758
|
+
}
|
|
61759
|
+
function finitePositive(value) {
|
|
61760
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : null;
|
|
61761
|
+
}
|
|
61762
|
+
function validResetAt(value) {
|
|
61763
|
+
const text3 = trimmedString(value);
|
|
61764
|
+
return text3 && Number.isFinite(Date.parse(text3)) ? text3 : void 0;
|
|
61765
|
+
}
|
|
61766
|
+
function roundTwoDecimals(value) {
|
|
61767
|
+
return Math.round(value * 100) / 100;
|
|
61768
|
+
}
|
|
61769
|
+
function isOfficialAnthropicHost(hostname3) {
|
|
61770
|
+
const normalized = hostname3.toLowerCase().replace(/\.+$/u, "");
|
|
61771
|
+
return normalized === "anthropic.com" || normalized.endsWith(".anthropic.com");
|
|
61772
|
+
}
|
|
61773
|
+
function parseCustomProviderBaseUrl(baseUrl) {
|
|
61774
|
+
let url2;
|
|
61775
|
+
try {
|
|
61776
|
+
url2 = new URL(baseUrl);
|
|
61777
|
+
} catch {
|
|
61778
|
+
return null;
|
|
61779
|
+
}
|
|
61780
|
+
if (url2.protocol !== "https:" && url2.protocol !== "http:" || !url2.hostname)
|
|
61781
|
+
return null;
|
|
61782
|
+
if (isOfficialAnthropicHost(url2.hostname))
|
|
61783
|
+
return null;
|
|
61784
|
+
return url2;
|
|
61785
|
+
}
|
|
61786
|
+
function customProviderEndpoint(baseUrl, pathname) {
|
|
61787
|
+
const url2 = parseCustomProviderBaseUrl(baseUrl);
|
|
61788
|
+
if (!url2)
|
|
61789
|
+
return null;
|
|
61790
|
+
url2.username = "";
|
|
61791
|
+
url2.password = "";
|
|
61792
|
+
url2.pathname = pathname;
|
|
61793
|
+
url2.search = "";
|
|
61794
|
+
url2.hash = "";
|
|
61795
|
+
return url2.toString();
|
|
61796
|
+
}
|
|
61797
|
+
function claudeConfigDirectory(environment) {
|
|
61798
|
+
const home = environment.HOME || environment.USERPROFILE || os3.homedir();
|
|
61799
|
+
const configured = trimmedString(environment.CLAUDE_CONFIG_DIR);
|
|
61800
|
+
return configured ? path4.resolve(home, configured) : path4.join(home, ".claude");
|
|
61801
|
+
}
|
|
61802
|
+
async function readUserSettingsEnv(environment, signal) {
|
|
61803
|
+
const file2 = path4.join(claudeConfigDirectory(environment), "settings.json");
|
|
61804
|
+
try {
|
|
61805
|
+
signal?.throwIfAborted();
|
|
61806
|
+
if (!(await stat2(file2)).isFile())
|
|
61807
|
+
return {};
|
|
61808
|
+
const text3 = await readFile3(file2, {
|
|
61809
|
+
encoding: "utf8",
|
|
61810
|
+
...signal ? { signal } : {}
|
|
61811
|
+
});
|
|
61812
|
+
const parsed = JSON.parse(text3);
|
|
61813
|
+
const env = record3(record3(parsed).env);
|
|
61814
|
+
const result = {};
|
|
61815
|
+
for (const [key, value] of Object.entries(env)) {
|
|
61816
|
+
if (typeof value === "string")
|
|
61817
|
+
result[key] = value;
|
|
61818
|
+
}
|
|
61819
|
+
return result;
|
|
61820
|
+
} catch {
|
|
61821
|
+
return {};
|
|
61822
|
+
}
|
|
61823
|
+
}
|
|
61824
|
+
async function readClaudeCustomProviderConfig(environment = process.env, signal) {
|
|
61825
|
+
const settingsEnv = await readUserSettingsEnv(environment, signal);
|
|
61826
|
+
const env = { ...environment, ...settingsEnv };
|
|
61827
|
+
const baseUrl = trimmedString(env.ANTHROPIC_BASE_URL);
|
|
61828
|
+
const apiKey = trimmedString(env.ANTHROPIC_AUTH_TOKEN) ?? trimmedString(env.ANTHROPIC_API_KEY);
|
|
61829
|
+
if (!baseUrl || !apiKey)
|
|
61830
|
+
return null;
|
|
61831
|
+
const parsedUrl = parseCustomProviderBaseUrl(baseUrl);
|
|
61832
|
+
if (!parsedUrl)
|
|
61833
|
+
return null;
|
|
61834
|
+
return {
|
|
61835
|
+
baseUrl,
|
|
61836
|
+
apiKey,
|
|
61837
|
+
hostLabel: parsedUrl.hostname
|
|
61838
|
+
};
|
|
61839
|
+
}
|
|
61840
|
+
function creditsFromWindows(windows) {
|
|
61841
|
+
const [primary, ...others] = windows;
|
|
61842
|
+
if (!primary)
|
|
61843
|
+
return null;
|
|
61844
|
+
const genericPrimary = !primary.scope && (primary.product === "5-hour window" || primary.product === "7-day window");
|
|
61845
|
+
return {
|
|
61846
|
+
usedPercent: primary.usagePercent,
|
|
61847
|
+
periodType: primary.periodType,
|
|
61848
|
+
...primary.scope ? { scope: primary.scope } : {},
|
|
61849
|
+
...!genericPrimary ? { label: primary.product } : {},
|
|
61850
|
+
...primary.used !== void 0 ? { used: primary.used } : {},
|
|
61851
|
+
...primary.limit !== void 0 ? { limit: primary.limit } : {},
|
|
61852
|
+
...primary.unit ? { unit: primary.unit } : {},
|
|
61853
|
+
...primary.resetsAt ? { resetsAt: primary.resetsAt } : {},
|
|
61854
|
+
...others.length ? {
|
|
61855
|
+
productUsage: others.map(({ product, periodType, scope, usagePercent, used, limit, unit, resetsAt }) => ({
|
|
61856
|
+
product,
|
|
61857
|
+
periodType,
|
|
61858
|
+
...scope ? { scope } : {},
|
|
61859
|
+
usagePercent,
|
|
61860
|
+
...used !== void 0 ? { used } : {},
|
|
61861
|
+
...limit !== void 0 ? { limit } : {},
|
|
61862
|
+
...unit ? { unit } : {},
|
|
61863
|
+
...resetsAt ? { resetsAt } : {}
|
|
61864
|
+
}))
|
|
61865
|
+
} : {}
|
|
61866
|
+
};
|
|
61867
|
+
}
|
|
61868
|
+
function readSeatWindow(value, product, periodType, scope) {
|
|
61869
|
+
const window2 = record3(value);
|
|
61870
|
+
const ratio = finiteNonNegative(window2.used);
|
|
61871
|
+
if (ratio === null || ratio > 1)
|
|
61872
|
+
return null;
|
|
61873
|
+
const resetsAt = validResetAt(window2.reset_at);
|
|
61874
|
+
return {
|
|
61875
|
+
product,
|
|
61876
|
+
periodType,
|
|
61877
|
+
...scope ? { scope: { id: scope, label: scope } } : {},
|
|
61878
|
+
usagePercent: Math.round(ratio * 1e4) / 100,
|
|
61879
|
+
...resetsAt ? { resetsAt } : {}
|
|
61880
|
+
};
|
|
61881
|
+
}
|
|
61882
|
+
function projectCustomProviderSeatQuota(payload, fallbackLabel) {
|
|
61883
|
+
const data = record3(payload);
|
|
61884
|
+
if (data.object !== "key_seats" || !Array.isArray(data.seats))
|
|
61885
|
+
return [];
|
|
61886
|
+
const baseLabel = trimmedString(data.name) ?? trimmedString(fallbackLabel);
|
|
61887
|
+
const multiSeat = data.seats.length > 1;
|
|
61888
|
+
const accounts = [];
|
|
61889
|
+
for (const [index, entry] of data.seats.entries()) {
|
|
61890
|
+
if (accounts.length >= MAX_CUSTOM_PROVIDER_ACCOUNTS)
|
|
61891
|
+
break;
|
|
61892
|
+
const seat = record3(entry);
|
|
61893
|
+
const windows = [
|
|
61894
|
+
readSeatWindow(seat.w5h, "5-hour window", "five_hour"),
|
|
61895
|
+
readSeatWindow(seat.w7d, "7-day window", "seven_day"),
|
|
61896
|
+
readSeatWindow(seat.opus7d, "Opus · 7-day", "seven_day", "Opus"),
|
|
61897
|
+
readSeatWindow(seat.sonnet7d, "Sonnet · 7-day", "seven_day", "Sonnet"),
|
|
61898
|
+
readSeatWindow(seat.fable7d, "Fable · 7-day", "seven_day", "Fable")
|
|
61899
|
+
].filter((window2) => window2 !== null);
|
|
61900
|
+
const credits = creditsFromWindows(windows);
|
|
61901
|
+
if (!credits)
|
|
61902
|
+
continue;
|
|
61903
|
+
const seatNo = typeof seat.no === "number" && Number.isSafeInteger(seat.no) && seat.no > 0 ? seat.no : index + 1;
|
|
61904
|
+
const label = multiSeat ? baseLabel ? `${baseLabel} · #${seatNo}` : `#${seatNo}` : baseLabel ?? `#${seatNo}`;
|
|
61905
|
+
const plan = trimmedString(seat.tier);
|
|
61906
|
+
const parsed = harnessAccountSnapshotSchema.safeParse({
|
|
61907
|
+
...label ? { label: label.slice(0, 256) } : {},
|
|
61908
|
+
...plan ? { plan: plan.slice(0, 128) } : {},
|
|
61909
|
+
credits
|
|
61910
|
+
});
|
|
61911
|
+
if (parsed.success)
|
|
61912
|
+
accounts.push(parsed.data);
|
|
61913
|
+
}
|
|
61914
|
+
return accounts;
|
|
61915
|
+
}
|
|
61916
|
+
function readCappedUsdWindow(value, product, periodType) {
|
|
61917
|
+
const window2 = record3(value);
|
|
61918
|
+
const limit = finitePositive(window2.limit);
|
|
61919
|
+
const used = finiteNonNegative(window2.used);
|
|
61920
|
+
if (limit === null || used === null)
|
|
61921
|
+
return null;
|
|
61922
|
+
const resetsAt = validResetAt(window2.reset_at);
|
|
61923
|
+
return {
|
|
61924
|
+
product,
|
|
61925
|
+
periodType,
|
|
61926
|
+
usagePercent: Math.min(100, Math.round(used / limit * 1e4) / 100),
|
|
61927
|
+
used: roundTwoDecimals(used),
|
|
61928
|
+
limit: roundTwoDecimals(limit),
|
|
61929
|
+
unit: "USD",
|
|
61930
|
+
...resetsAt ? { resetsAt } : {}
|
|
61931
|
+
};
|
|
61932
|
+
}
|
|
61933
|
+
function projectCustomProviderKeyQuota(payload, fallbackLabel) {
|
|
61934
|
+
const data = record3(payload);
|
|
61935
|
+
if (data.object !== "api_key_quota")
|
|
61936
|
+
return null;
|
|
61937
|
+
const key = record3(data.key);
|
|
61938
|
+
if (key.expired === true)
|
|
61939
|
+
return null;
|
|
61940
|
+
if (typeof key.status === "string" && key.status !== "active")
|
|
61941
|
+
return null;
|
|
61942
|
+
const label = trimmedString(key.name) ?? trimmedString(fallbackLabel);
|
|
61943
|
+
const windowsMap = record3(data.windows);
|
|
61944
|
+
const windows = [
|
|
61945
|
+
readCappedUsdWindow(windowsMap["5h"], "5-hour window", "five_hour"),
|
|
61946
|
+
readCappedUsdWindow(windowsMap["7d"], "7-day window", "seven_day")
|
|
61947
|
+
].filter((window2) => window2 !== null);
|
|
61948
|
+
const credits = creditsFromWindows(windows);
|
|
61949
|
+
if (credits) {
|
|
61950
|
+
const parsed2 = harnessAccountSnapshotSchema.safeParse({
|
|
61951
|
+
...label ? { label: label.slice(0, 256) } : {},
|
|
61952
|
+
credits
|
|
61953
|
+
});
|
|
61954
|
+
return parsed2.success ? parsed2.data : null;
|
|
61955
|
+
}
|
|
61956
|
+
const usd = record3(data.usd);
|
|
61957
|
+
const limit = finitePositive(usd.limit);
|
|
61958
|
+
if (limit === null)
|
|
61959
|
+
return null;
|
|
61960
|
+
const used = finiteNonNegative(usd.used);
|
|
61961
|
+
const remaining = finiteNonNegative(usd.remaining) ?? (used !== null ? Math.max(0, limit - used) : null);
|
|
61962
|
+
if (remaining === null)
|
|
61963
|
+
return null;
|
|
61964
|
+
const parsed = harnessAccountSnapshotSchema.safeParse({
|
|
61965
|
+
...label ? { label: label.slice(0, 256) } : {},
|
|
61966
|
+
balance: {
|
|
61967
|
+
amount: roundTwoDecimals(remaining),
|
|
61968
|
+
currency: "USD",
|
|
61969
|
+
...label ? { label: label.slice(0, 128) } : {}
|
|
61970
|
+
}
|
|
61971
|
+
});
|
|
61972
|
+
return parsed.success ? parsed.data : null;
|
|
61973
|
+
}
|
|
61974
|
+
async function fetchJson(url2, apiKey, fetchImpl, signal) {
|
|
61975
|
+
const response = await fetchImpl(url2, {
|
|
61976
|
+
headers: {
|
|
61977
|
+
Authorization: `Bearer ${apiKey}`,
|
|
61978
|
+
Accept: "application/json"
|
|
61979
|
+
},
|
|
61980
|
+
redirect: "error",
|
|
61981
|
+
signal
|
|
61982
|
+
});
|
|
61983
|
+
if (!response.ok) {
|
|
61984
|
+
void response.body?.cancel().catch(() => void 0);
|
|
61985
|
+
return null;
|
|
61986
|
+
}
|
|
61987
|
+
return await response.json();
|
|
61988
|
+
}
|
|
61989
|
+
async function withTimeout(callerSignal, timeoutMs, task) {
|
|
61990
|
+
callerSignal?.throwIfAborted();
|
|
61991
|
+
const controller = new AbortController();
|
|
61992
|
+
let rejectOnAbort;
|
|
61993
|
+
const aborted2 = new Promise((_resolve, reject) => {
|
|
61994
|
+
rejectOnAbort = reject;
|
|
61995
|
+
});
|
|
61996
|
+
const abort = (reason) => {
|
|
61997
|
+
if (!controller.signal.aborted)
|
|
61998
|
+
controller.abort(reason);
|
|
61999
|
+
rejectOnAbort(reason);
|
|
62000
|
+
};
|
|
62001
|
+
const onCallerAbort = () => abort(callerSignal?.reason ?? new Error("Aborted"));
|
|
62002
|
+
callerSignal?.addEventListener("abort", onCallerAbort, { once: true });
|
|
62003
|
+
const timer = setTimeout(() => abort(new Error("Custom Provider quota request timed out")), timeoutMs);
|
|
62004
|
+
timer.unref();
|
|
62005
|
+
const pending = Promise.resolve().then(() => task(controller.signal));
|
|
62006
|
+
void pending.catch(() => void 0);
|
|
62007
|
+
try {
|
|
62008
|
+
return await Promise.race([pending, aborted2]);
|
|
62009
|
+
} finally {
|
|
62010
|
+
clearTimeout(timer);
|
|
62011
|
+
callerSignal?.removeEventListener("abort", onCallerAbort);
|
|
62012
|
+
}
|
|
62013
|
+
}
|
|
62014
|
+
async function fetchClaudeCustomProviderAccounts(input3 = {}) {
|
|
62015
|
+
try {
|
|
62016
|
+
const callerSignal = input3.signal;
|
|
62017
|
+
callerSignal?.throwIfAborted();
|
|
62018
|
+
const deadline = Date.now() + REQUEST_TIMEOUT_MS;
|
|
62019
|
+
const remainingMs = () => Math.max(0, deadline - Date.now());
|
|
62020
|
+
const environment = input3.environment ?? process.env;
|
|
62021
|
+
const config2 = await withTimeout(callerSignal, remainingMs(), (signal) => input3.readConfig ? input3.readConfig(signal) : readClaudeCustomProviderConfig(environment, signal));
|
|
62022
|
+
if (!config2 || callerSignal?.aborted)
|
|
62023
|
+
return [];
|
|
62024
|
+
const fetchImpl = input3.fetch ?? fetch;
|
|
62025
|
+
const seatsUrl = customProviderEndpoint(config2.baseUrl, SEAT_QUOTA_PATH);
|
|
62026
|
+
const seatsBudget = Math.min(SEAT_QUOTA_TIMEOUT_MS, remainingMs());
|
|
62027
|
+
if (seatsUrl && seatsBudget > 0) {
|
|
62028
|
+
const seatsPayload = await withTimeout(callerSignal, seatsBudget, (signal) => fetchJson(seatsUrl, config2.apiKey, fetchImpl, signal)).catch(() => null);
|
|
62029
|
+
if (callerSignal?.aborted)
|
|
62030
|
+
return [];
|
|
62031
|
+
const seats = projectCustomProviderSeatQuota(seatsPayload, config2.hostLabel);
|
|
62032
|
+
if (seats.length > 0)
|
|
62033
|
+
return seats;
|
|
62034
|
+
}
|
|
62035
|
+
const quotaUrl = customProviderEndpoint(config2.baseUrl, KEY_QUOTA_PATH);
|
|
62036
|
+
const quotaBudget = remainingMs();
|
|
62037
|
+
if (!quotaUrl || quotaBudget <= 0 || callerSignal?.aborted)
|
|
62038
|
+
return [];
|
|
62039
|
+
const quotaPayload = await withTimeout(callerSignal, quotaBudget, (signal) => fetchJson(quotaUrl, config2.apiKey, fetchImpl, signal)).catch(() => null);
|
|
62040
|
+
if (callerSignal?.aborted)
|
|
62041
|
+
return [];
|
|
62042
|
+
const account = projectCustomProviderKeyQuota(quotaPayload, config2.hostLabel);
|
|
62043
|
+
return account ? [account] : [];
|
|
62044
|
+
} catch {
|
|
62045
|
+
return [];
|
|
62046
|
+
}
|
|
62047
|
+
}
|
|
62048
|
+
|
|
61206
62049
|
// dist/ultracode.js
|
|
61207
62050
|
var CLAUDE_ULTRACODE_MINIMUM_VERSION = "2.1.154";
|
|
61208
62051
|
var FAILURES = {
|
|
@@ -61293,9 +62136,9 @@ function claudeUltracodeUnavailableReason(settings, environment = {}) {
|
|
|
61293
62136
|
|
|
61294
62137
|
// dist/claude-session-import.js
|
|
61295
62138
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
61296
|
-
import { opendir, realpath as realpath3, stat as
|
|
61297
|
-
import
|
|
61298
|
-
import
|
|
62139
|
+
import { opendir, realpath as realpath3, stat as stat3 } from "node:fs/promises";
|
|
62140
|
+
import os4 from "node:os";
|
|
62141
|
+
import path5 from "node:path";
|
|
61299
62142
|
import { createInterface as createInterface2 } from "node:readline";
|
|
61300
62143
|
|
|
61301
62144
|
// ../../harness-adapter/dist/session-import.js
|
|
@@ -61409,8 +62252,8 @@ function userText(message) {
|
|
|
61409
62252
|
return text3 && !CLAUDE_INTERNAL_USER_TEXT.test(text3) ? text3 : null;
|
|
61410
62253
|
}
|
|
61411
62254
|
function claudeProjectsDirectory2(environment) {
|
|
61412
|
-
const home = (process.platform === "win32" ? environment.USERPROFILE : environment.HOME) ||
|
|
61413
|
-
return
|
|
62255
|
+
const home = (process.platform === "win32" ? environment.USERPROFILE : environment.HOME) || os4.homedir();
|
|
62256
|
+
return path5.join(path5.resolve(environment.CLAUDE_CONFIG_DIR ?? path5.join(home, ".claude")), "projects");
|
|
61414
62257
|
}
|
|
61415
62258
|
async function sessionFiles(directory, signal) {
|
|
61416
62259
|
signal.throwIfAborted();
|
|
@@ -61426,7 +62269,7 @@ async function sessionFiles(directory, signal) {
|
|
|
61426
62269
|
signal.throwIfAborted();
|
|
61427
62270
|
if (!project2.isDirectory())
|
|
61428
62271
|
continue;
|
|
61429
|
-
const entries = await opendir(
|
|
62272
|
+
const entries = await opendir(path5.join(directory, project2.name)).catch((error63) => {
|
|
61430
62273
|
if (isMissingFileError(error63))
|
|
61431
62274
|
return null;
|
|
61432
62275
|
throw error63;
|
|
@@ -61436,17 +62279,17 @@ async function sessionFiles(directory, signal) {
|
|
|
61436
62279
|
for await (const entry of entries) {
|
|
61437
62280
|
signal.throwIfAborted();
|
|
61438
62281
|
if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
61439
|
-
files.push(
|
|
62282
|
+
files.push(path5.join(directory, project2.name, entry.name));
|
|
61440
62283
|
}
|
|
61441
62284
|
}
|
|
61442
62285
|
}
|
|
61443
62286
|
return files;
|
|
61444
62287
|
}
|
|
61445
62288
|
async function readCandidate(file2, signal) {
|
|
61446
|
-
const nativeSessionId =
|
|
62289
|
+
const nativeSessionId = path5.basename(file2, ".jsonl");
|
|
61447
62290
|
if (!external_exports.uuid().safeParse(nativeSessionId).success)
|
|
61448
62291
|
return null;
|
|
61449
|
-
const before = await
|
|
62292
|
+
const before = await stat3(file2);
|
|
61450
62293
|
if (!before.isFile() || before.size === 0)
|
|
61451
62294
|
return null;
|
|
61452
62295
|
const stream = createReadStream3(file2, { encoding: "utf8", signal, end: before.size - 1 });
|
|
@@ -61473,7 +62316,7 @@ async function readCandidate(file2, signal) {
|
|
|
61473
62316
|
return null;
|
|
61474
62317
|
if (entry.isSidechain === true)
|
|
61475
62318
|
continue;
|
|
61476
|
-
if (typeof entry.cwd === "string" &&
|
|
62319
|
+
if (typeof entry.cwd === "string" && path5.isAbsolute(entry.cwd))
|
|
61477
62320
|
cwd = entry.cwd;
|
|
61478
62321
|
if (entry.type === "custom-title") {
|
|
61479
62322
|
customTitle = cleanText(entry.customTitle);
|
|
@@ -61493,11 +62336,11 @@ async function readCandidate(file2, signal) {
|
|
|
61493
62336
|
}
|
|
61494
62337
|
if (!hasConversation || !cwd)
|
|
61495
62338
|
return null;
|
|
61496
|
-
const after = await
|
|
62339
|
+
const after = await stat3(file2);
|
|
61497
62340
|
if (!sameFileFingerprint(before, after))
|
|
61498
62341
|
throw new SessionImportChangedError(CLAUDE_SESSION_CHANGED);
|
|
61499
62342
|
const resolvedCwd = await realpath3(cwd);
|
|
61500
|
-
if (!(await
|
|
62343
|
+
if (!(await stat3(resolvedCwd)).isDirectory())
|
|
61501
62344
|
return null;
|
|
61502
62345
|
const candidate = sessionImportCandidate({
|
|
61503
62346
|
nativeSessionId,
|
|
@@ -61532,17 +62375,17 @@ var ClaudeSessionImportIndex = class {
|
|
|
61532
62375
|
const sources = [];
|
|
61533
62376
|
for (const file2 of await sessionFiles(this.#directory, signal)) {
|
|
61534
62377
|
signal.throwIfAborted();
|
|
61535
|
-
const nativeSessionId =
|
|
62378
|
+
const nativeSessionId = path5.basename(file2, ".jsonl");
|
|
61536
62379
|
if (identities.has(nativeSessionId))
|
|
61537
62380
|
ambiguous.add(nativeSessionId);
|
|
61538
62381
|
identities.add(nativeSessionId);
|
|
61539
62382
|
try {
|
|
61540
|
-
const fingerprint = await
|
|
62383
|
+
const fingerprint = await stat3(file2);
|
|
61541
62384
|
const cached2 = this.#cache.get(file2);
|
|
61542
62385
|
const source = cached2 && sameFileFingerprint(cached2.fingerprint, fingerprint) ? cached2.source : await readCandidate(file2, signal);
|
|
61543
62386
|
if (!source)
|
|
61544
62387
|
continue;
|
|
61545
|
-
if (!(await
|
|
62388
|
+
if (!(await stat3(source.candidate.cwd)).isDirectory())
|
|
61546
62389
|
continue;
|
|
61547
62390
|
next.set(file2, { fingerprint, source });
|
|
61548
62391
|
sources.push(source);
|
|
@@ -61560,7 +62403,7 @@ var ClaudeSessionImportIndex = class {
|
|
|
61560
62403
|
let selected;
|
|
61561
62404
|
for (const file2 of await sessionFiles(this.#directory, signal)) {
|
|
61562
62405
|
signal.throwIfAborted();
|
|
61563
|
-
if (
|
|
62406
|
+
if (path5.basename(file2, ".jsonl") !== nativeSessionId)
|
|
61564
62407
|
continue;
|
|
61565
62408
|
if (selected)
|
|
61566
62409
|
throw new Error("Claude Code Session identity is ambiguous across files");
|
|
@@ -61580,13 +62423,13 @@ var ClaudeSessionImportIndex = class {
|
|
|
61580
62423
|
};
|
|
61581
62424
|
|
|
61582
62425
|
// dist/command.js
|
|
61583
|
-
import
|
|
62426
|
+
import path10 from "node:path";
|
|
61584
62427
|
|
|
61585
62428
|
// ../../harness-discovery/dist/environment.js
|
|
61586
62429
|
import fs2 from "node:fs";
|
|
61587
|
-
import
|
|
62430
|
+
import path6 from "node:path";
|
|
61588
62431
|
function targetPath(platform) {
|
|
61589
|
-
return platform === "win32" ?
|
|
62432
|
+
return platform === "win32" ? path6.win32 : path6.posix;
|
|
61590
62433
|
}
|
|
61591
62434
|
function environmentValue(environment, name) {
|
|
61592
62435
|
const lowered = name.toLowerCase();
|
|
@@ -61629,9 +62472,9 @@ function newestFirst(names) {
|
|
|
61629
62472
|
}
|
|
61630
62473
|
|
|
61631
62474
|
// ../../harness-discovery/dist/invocation.js
|
|
61632
|
-
import
|
|
62475
|
+
import path7 from "node:path";
|
|
61633
62476
|
function commandInvocation(command, arguments_, environment, platform = process.platform) {
|
|
61634
|
-
const extension =
|
|
62477
|
+
const extension = path7.win32.extname(command).toLowerCase();
|
|
61635
62478
|
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
61636
62479
|
return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
|
|
61637
62480
|
}
|
|
@@ -61645,11 +62488,11 @@ function commandInvocation(command, arguments_, environment, platform = process.
|
|
|
61645
62488
|
}
|
|
61646
62489
|
|
|
61647
62490
|
// ../../harness-discovery/dist/node-runtime.js
|
|
61648
|
-
import
|
|
62491
|
+
import path8 from "node:path";
|
|
61649
62492
|
function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
|
|
61650
62493
|
const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
|
|
61651
62494
|
const delimiter2 = platform === "win32" ? ";" : ":";
|
|
61652
|
-
const runtimeDirectory =
|
|
62495
|
+
const runtimeDirectory = path8.dirname(runtimeExecutable);
|
|
61653
62496
|
const directories = (environment[pathKey] ?? "").split(delimiter2).filter(Boolean);
|
|
61654
62497
|
const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
|
|
61655
62498
|
if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
|
|
@@ -61659,7 +62502,7 @@ function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath
|
|
|
61659
62502
|
}
|
|
61660
62503
|
|
|
61661
62504
|
// ../../harness-discovery/dist/resolve.js
|
|
61662
|
-
import
|
|
62505
|
+
import os5 from "node:os";
|
|
61663
62506
|
|
|
61664
62507
|
// ../../harness-discovery/dist/version-managers.js
|
|
61665
62508
|
function versionManagerBinaryDirectories(context) {
|
|
@@ -61725,7 +62568,7 @@ function installRootExtensions(platform) {
|
|
|
61725
62568
|
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
61726
62569
|
}
|
|
61727
62570
|
function resolveHomeDirectory(input3) {
|
|
61728
|
-
return input3.homeDirectory ?? environmentValue(input3.environment, "HOME") ?? environmentValue(input3.environment, "USERPROFILE") ??
|
|
62571
|
+
return input3.homeDirectory ?? environmentValue(input3.environment, "HOME") ?? environmentValue(input3.environment, "USERPROFILE") ?? os5.homedir();
|
|
61729
62572
|
}
|
|
61730
62573
|
function templateVariables(environment, platform, home) {
|
|
61731
62574
|
const pathFlavor = targetPath(platform);
|
|
@@ -61934,8 +62777,8 @@ async function fetchInstallationText(url2) {
|
|
|
61934
62777
|
}
|
|
61935
62778
|
|
|
61936
62779
|
// ../../harness-discovery/dist/npm-installation.js
|
|
61937
|
-
import { readFile as
|
|
61938
|
-
import
|
|
62780
|
+
import { readFile as readFile4, realpath as realpath4 } from "node:fs/promises";
|
|
62781
|
+
import path9 from "node:path";
|
|
61939
62782
|
function referencesNpmBin(shim, name, bin) {
|
|
61940
62783
|
if (bin.includes(".."))
|
|
61941
62784
|
return false;
|
|
@@ -61957,22 +62800,22 @@ function withAllowedScripts(environment, allowScripts) {
|
|
|
61957
62800
|
async function npmInstallation(command, packages, environment, options = {}) {
|
|
61958
62801
|
let selected = await realpath4(command);
|
|
61959
62802
|
if (process.platform === "win32" && /\.(cmd|bat)$/i.test(selected)) {
|
|
61960
|
-
const shim = (await
|
|
61961
|
-
const root =
|
|
62803
|
+
const shim = (await readFile4(selected, "utf8")).replaceAll("\\", "/");
|
|
62804
|
+
const root = path9.dirname(selected);
|
|
61962
62805
|
for (const name of packages) {
|
|
61963
|
-
const directory2 =
|
|
61964
|
-
const metadata = await
|
|
62806
|
+
const directory2 = path9.join(root, "node_modules", ...name.split("/"));
|
|
62807
|
+
const metadata = await readFile4(path9.join(directory2, "package.json"), "utf8").then((text3) => JSON.parse(text3)).catch(() => null);
|
|
61965
62808
|
const bins = typeof metadata?.bin === "string" ? [metadata.bin] : Object.values(metadata?.bin ?? {});
|
|
61966
62809
|
const bin = bins.find((entry) => referencesNpmBin(shim, name, entry));
|
|
61967
62810
|
if (bin) {
|
|
61968
|
-
selected = await realpath4(
|
|
62811
|
+
selected = await realpath4(path9.join(directory2, bin));
|
|
61969
62812
|
break;
|
|
61970
62813
|
}
|
|
61971
62814
|
}
|
|
61972
62815
|
}
|
|
61973
|
-
let directory =
|
|
62816
|
+
let directory = path9.dirname(selected);
|
|
61974
62817
|
for (let depth = 0; depth < 8; depth++) {
|
|
61975
|
-
const metadata = await
|
|
62818
|
+
const metadata = await readFile4(path9.join(directory, "package.json"), "utf8").then((text3) => JSON.parse(text3)).catch(() => null);
|
|
61976
62819
|
if (metadata?.name && packages.includes(metadata.name)) {
|
|
61977
62820
|
const name = metadata.name;
|
|
61978
62821
|
const currentVersion = installationVersion(metadata.version);
|
|
@@ -61980,22 +62823,22 @@ async function npmInstallation(command, packages, environment, options = {}) {
|
|
|
61980
62823
|
const segments = name.split("/");
|
|
61981
62824
|
let modules = directory;
|
|
61982
62825
|
for (let index = 0; index < segments.length; index++)
|
|
61983
|
-
modules =
|
|
61984
|
-
const prefix = process.platform === "win32" ?
|
|
61985
|
-
const globalRoot = process.platform === "win32" ?
|
|
62826
|
+
modules = path9.dirname(modules);
|
|
62827
|
+
const prefix = process.platform === "win32" ? path9.dirname(modules) : path9.dirname(path9.dirname(modules));
|
|
62828
|
+
const globalRoot = process.platform === "win32" ? path9.join(prefix, "node_modules") : path9.join(prefix, "lib", "node_modules");
|
|
61986
62829
|
const env = withNodeRuntimeOnPath(environment);
|
|
61987
62830
|
const npm = resolveHarnessExecutable({ id: "npm", command: "npm", installRoots: { posix: [], windows: [] } }, { environment: env });
|
|
61988
62831
|
let globalInstall = modules === globalRoot;
|
|
61989
62832
|
if (process.platform === "win32") {
|
|
61990
|
-
const project2 = (await Promise.all(["package.json", "package-lock.json", "npm-shrinkwrap.json"].map((file2) =>
|
|
62833
|
+
const project2 = (await Promise.all(["package.json", "package-lock.json", "npm-shrinkwrap.json"].map((file2) => readFile4(path9.join(prefix, file2), "utf8").then(() => true, (error63) => error63.code !== "ENOENT")))).some(Boolean);
|
|
61991
62834
|
const bins = typeof metadata.bin === "string" ? { [name.split("/").at(-1) ?? name]: metadata.bin } : metadata.bin ?? {};
|
|
61992
62835
|
const launchers = await Promise.all(Object.entries(bins).map(async ([bin, entry]) => {
|
|
61993
|
-
if (
|
|
62836
|
+
if (path9.basename(bin) !== bin || entry.includes(".."))
|
|
61994
62837
|
return false;
|
|
61995
|
-
const target2 = await realpath4(
|
|
62838
|
+
const target2 = await realpath4(path9.join(directory, entry)).catch(() => "");
|
|
61996
62839
|
if (target2.toLowerCase() !== selected.toLowerCase())
|
|
61997
62840
|
return false;
|
|
61998
|
-
const shim = await
|
|
62841
|
+
const shim = await readFile4(path9.join(prefix, `${bin}.cmd`), "utf8").catch(() => "");
|
|
61999
62842
|
return referencesNpmBin(shim, name, entry);
|
|
62000
62843
|
}));
|
|
62001
62844
|
globalInstall = globalInstall && !project2 && launchers.some(Boolean);
|
|
@@ -62026,7 +62869,7 @@ async function npmInstallation(command, packages, environment, options = {}) {
|
|
|
62026
62869
|
}
|
|
62027
62870
|
};
|
|
62028
62871
|
}
|
|
62029
|
-
const parent =
|
|
62872
|
+
const parent = path9.dirname(directory);
|
|
62030
62873
|
if (parent === directory)
|
|
62031
62874
|
break;
|
|
62032
62875
|
directory = parent;
|
|
@@ -62134,14 +62977,14 @@ function resolveClaudeCodeExecutable(input3 = {}, dependencies = {}) {
|
|
|
62134
62977
|
}, dependencies);
|
|
62135
62978
|
if (!resolution)
|
|
62136
62979
|
throw new ClaudeCodeExecutableError("Claude Code is not installed");
|
|
62137
|
-
return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable :
|
|
62980
|
+
return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path10.resolve(resolution.executable);
|
|
62138
62981
|
}
|
|
62139
62982
|
|
|
62140
62983
|
// dist/pending-session.js
|
|
62141
62984
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
62142
|
-
import { mkdir as mkdir3, open as open4, readFile as
|
|
62143
|
-
import
|
|
62144
|
-
import
|
|
62985
|
+
import { mkdir as mkdir3, open as open4, readFile as readFile5, rename as rename3, rm as rm4, stat as stat4, unlink as unlink2 } from "node:fs/promises";
|
|
62986
|
+
import os6 from "node:os";
|
|
62987
|
+
import path11 from "node:path";
|
|
62145
62988
|
var reservationSchema = external_exports.strictObject({
|
|
62146
62989
|
version: external_exports.literal(1),
|
|
62147
62990
|
sessionId: external_exports.uuid(),
|
|
@@ -62154,13 +62997,13 @@ function isPendingClaudeSession(ref) {
|
|
|
62154
62997
|
var ClaudePendingSessions = class {
|
|
62155
62998
|
#directory;
|
|
62156
62999
|
constructor(environment) {
|
|
62157
|
-
this.#directory =
|
|
63000
|
+
this.#directory = path11.join(path11.resolve(environment.CLAUDE_CONFIG_DIR ?? path11.join(os6.homedir(), ".claude")), "codexhost", "pending-sessions");
|
|
62158
63001
|
}
|
|
62159
63002
|
#path(ref, cwd) {
|
|
62160
|
-
if (ref.harnessId !== "claude-code" || !external_exports.uuid().safeParse(ref.nativeSessionId).success || !external_exports.strictObject({ pendingSession: external_exports.literal(1) }).safeParse(ref.locator).success || !
|
|
63003
|
+
if (ref.harnessId !== "claude-code" || !external_exports.uuid().safeParse(ref.nativeSessionId).success || !external_exports.strictObject({ pendingSession: external_exports.literal(1) }).safeParse(ref.locator).success || !path11.isAbsolute(cwd)) {
|
|
62161
63004
|
throw new Error("Claude Code pending Session identity is invalid");
|
|
62162
63005
|
}
|
|
62163
|
-
return
|
|
63006
|
+
return path11.join(this.#directory, ref.nativeSessionId);
|
|
62164
63007
|
}
|
|
62165
63008
|
async create(cwd, configuration) {
|
|
62166
63009
|
const ref = nativeSessionRefSchema.parse({
|
|
@@ -62179,7 +63022,7 @@ var ClaudePendingSessions = class {
|
|
|
62179
63022
|
await mkdir3(this.#directory, { recursive: true, mode: 448 });
|
|
62180
63023
|
await mkdir3(directory, { mode: 448 });
|
|
62181
63024
|
try {
|
|
62182
|
-
const file2 = await open4(
|
|
63025
|
+
const file2 = await open4(path11.join(directory, "session.json"), "wx", 384);
|
|
62183
63026
|
try {
|
|
62184
63027
|
await file2.writeFile(JSON.stringify(reservation));
|
|
62185
63028
|
await file2.sync();
|
|
@@ -62196,13 +63039,13 @@ var ClaudePendingSessions = class {
|
|
|
62196
63039
|
}
|
|
62197
63040
|
async read(ref, cwd) {
|
|
62198
63041
|
const directory = this.#path(ref, cwd);
|
|
62199
|
-
const reservation = reservationSchema.parse(JSON.parse(await
|
|
63042
|
+
const reservation = reservationSchema.parse(JSON.parse(await readFile5(path11.join(directory, "session.json"), "utf8")));
|
|
62200
63043
|
if (reservation.sessionId !== ref.nativeSessionId || reservation.cwd !== cwd) {
|
|
62201
63044
|
throw new Error("Claude Code pending Session does not belong to this working directory");
|
|
62202
63045
|
}
|
|
62203
63046
|
let started = false;
|
|
62204
63047
|
try {
|
|
62205
|
-
const claim2 = await
|
|
63048
|
+
const claim2 = await stat4(path11.join(directory, "started"));
|
|
62206
63049
|
if (!claim2.isFile())
|
|
62207
63050
|
throw new Error("Claude Code pending Session claim is invalid");
|
|
62208
63051
|
started = true;
|
|
@@ -62215,7 +63058,7 @@ var ClaudePendingSessions = class {
|
|
|
62215
63058
|
async saveConfiguration(ref, cwd, configuration) {
|
|
62216
63059
|
await this.read(ref, cwd);
|
|
62217
63060
|
const directory = this.#path(ref, cwd);
|
|
62218
|
-
const temporary =
|
|
63061
|
+
const temporary = path11.join(directory, `${randomUUID3()}.tmp`);
|
|
62219
63062
|
try {
|
|
62220
63063
|
const file2 = await open4(temporary, "wx", 384);
|
|
62221
63064
|
try {
|
|
@@ -62229,7 +63072,7 @@ var ClaudePendingSessions = class {
|
|
|
62229
63072
|
} finally {
|
|
62230
63073
|
await file2.close();
|
|
62231
63074
|
}
|
|
62232
|
-
await rename3(temporary,
|
|
63075
|
+
await rename3(temporary, path11.join(directory, "session.json"));
|
|
62233
63076
|
await this.#sync(directory);
|
|
62234
63077
|
} finally {
|
|
62235
63078
|
await rm4(temporary, { force: true });
|
|
@@ -62247,7 +63090,7 @@ var ClaudePendingSessions = class {
|
|
|
62247
63090
|
}
|
|
62248
63091
|
async claim(ref, cwd) {
|
|
62249
63092
|
await this.read(ref, cwd);
|
|
62250
|
-
const claim2 = await open4(
|
|
63093
|
+
const claim2 = await open4(path11.join(this.#path(ref, cwd), "started"), "wx", 384);
|
|
62251
63094
|
try {
|
|
62252
63095
|
await claim2.sync();
|
|
62253
63096
|
} finally {
|
|
@@ -62257,7 +63100,7 @@ var ClaudePendingSessions = class {
|
|
|
62257
63100
|
}
|
|
62258
63101
|
/** Only the claim owner may release, after proven close and before submitting any native input. */
|
|
62259
63102
|
async release(ref, cwd) {
|
|
62260
|
-
await unlink2(
|
|
63103
|
+
await unlink2(path11.join(this.#path(ref, cwd), "started"));
|
|
62261
63104
|
await this.#sync(this.#path(ref, cwd));
|
|
62262
63105
|
}
|
|
62263
63106
|
async discard(ref, cwd) {
|
|
@@ -62269,7 +63112,7 @@ var ClaudePendingSessions = class {
|
|
|
62269
63112
|
import { isDeepStrictEqual } from "node:util";
|
|
62270
63113
|
|
|
62271
63114
|
// dist/file-change.js
|
|
62272
|
-
import
|
|
63115
|
+
import path12 from "node:path";
|
|
62273
63116
|
var hunkSchema = external_exports.object({
|
|
62274
63117
|
oldStart: external_exports.number().int().nonnegative(),
|
|
62275
63118
|
oldLines: external_exports.number().int().nonnegative(),
|
|
@@ -62317,10 +63160,10 @@ function parseClaudeNativeFileChange(toolName, value) {
|
|
|
62317
63160
|
};
|
|
62318
63161
|
}
|
|
62319
63162
|
function displayPath(nativePath, cwd) {
|
|
62320
|
-
const resolvedCwd =
|
|
62321
|
-
const resolvedPath =
|
|
62322
|
-
const relative2 =
|
|
62323
|
-
const selected = relative2.length > 0 && relative2 !== ".." && !relative2.startsWith(`..${
|
|
63163
|
+
const resolvedCwd = path12.resolve(cwd);
|
|
63164
|
+
const resolvedPath = path12.isAbsolute(nativePath) ? path12.resolve(nativePath) : path12.resolve(cwd, nativePath);
|
|
63165
|
+
const relative2 = path12.relative(resolvedCwd, resolvedPath);
|
|
63166
|
+
const selected = relative2.length > 0 && relative2 !== ".." && !relative2.startsWith(`..${path12.sep}`) ? relative2 : resolvedPath;
|
|
62324
63167
|
const normalized = selected.replaceAll("\\", "/");
|
|
62325
63168
|
return validNativePath(normalized) && normalized !== "." ? normalized : null;
|
|
62326
63169
|
}
|
|
@@ -62332,7 +63175,7 @@ function projectClaudeFileChange(value, cwd) {
|
|
|
62332
63175
|
`@@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`,
|
|
62333
63176
|
...hunk.lines
|
|
62334
63177
|
]);
|
|
62335
|
-
const absoluteDisplayPath =
|
|
63178
|
+
const absoluteDisplayPath = path12.posix.isAbsolute(normalizedPath);
|
|
62336
63179
|
const oldHeader = value.kind === "add" ? "/dev/null" : absoluteDisplayPath ? normalizedPath : `a/${normalizedPath}`;
|
|
62337
63180
|
const newHeader = absoluteDisplayPath ? normalizedPath : `b/${normalizedPath}`;
|
|
62338
63181
|
const unifiedDiff = [`--- ${oldHeader}`, `+++ ${newHeader}`, ...body, ""].join("\n");
|
|
@@ -62568,6 +63411,13 @@ var ABORTED_TERMINALS = /* @__PURE__ */ new Set(["aborted_streaming", "aborted_t
|
|
|
62568
63411
|
var AUTHENTICATION_ERRORS = /* @__PURE__ */ new Set(["authentication_failed", "oauth_org_not_allowed"]);
|
|
62569
63412
|
var MAX_SAFE_UNIX_SECONDS = 864e10;
|
|
62570
63413
|
var CLAUDE_SUBAGENT_TOOLS = /* @__PURE__ */ new Set(["Agent", "Task", "SendMessage"]);
|
|
63414
|
+
var CROSS_SESSION_SEND_TARGET_PATTERN = /^(?:uds:|pipe:|\\\\\.\\pipe\\)/iu;
|
|
63415
|
+
var CROSS_SESSION_SEND_RESULT_MARKERS = [
|
|
63416
|
+
"another Claude session",
|
|
63417
|
+
"in that session's inbox",
|
|
63418
|
+
"[Cross-session delivery notice]",
|
|
63419
|
+
"will send one notice when it is next idle"
|
|
63420
|
+
];
|
|
62571
63421
|
var CLAUDE_WORKFLOW_TOOL = "Workflow";
|
|
62572
63422
|
var BACKGROUND_OUTPUT_FILE_PATTERN = /Output is being written to: (.+?\.output)\./u;
|
|
62573
63423
|
var SUBAGENT_DESCRIPTION_LIMIT = 500;
|
|
@@ -62645,6 +63495,32 @@ function sendResultFromText(outputText) {
|
|
|
62645
63495
|
function claudeSendMessageFailed(nativeResult, outputText) {
|
|
62646
63496
|
return isRecord9(nativeResult) && typeof nativeResult.success === "boolean" ? !nativeResult.success : sendResultFromText(outputText)?.success === false;
|
|
62647
63497
|
}
|
|
63498
|
+
function isCrossSessionSendArguments(argumentsValue) {
|
|
63499
|
+
if (!isRecord9(argumentsValue))
|
|
63500
|
+
return false;
|
|
63501
|
+
if (argumentsValue.notify_when_idle === true)
|
|
63502
|
+
return true;
|
|
63503
|
+
const target2 = targetedSubagentId(argumentsValue);
|
|
63504
|
+
return target2 !== void 0 && CROSS_SESSION_SEND_TARGET_PATTERN.test(target2);
|
|
63505
|
+
}
|
|
63506
|
+
function isClaudeSubagentToolUse(toolName, input3) {
|
|
63507
|
+
if (!CLAUDE_SUBAGENT_TOOLS.has(toolName))
|
|
63508
|
+
return false;
|
|
63509
|
+
return toolName !== "SendMessage" || !isCrossSessionSendArguments(input3);
|
|
63510
|
+
}
|
|
63511
|
+
function claudeSendMessageTargetsPeerSession(nativeResult, outputText) {
|
|
63512
|
+
if (isRecord9(nativeResult)) {
|
|
63513
|
+
if (typeof nativeResult.msg_id === "string" && nativeResult.msg_id.length > 0)
|
|
63514
|
+
return true;
|
|
63515
|
+
const fields = [nativeResult.message, nativeResult.display];
|
|
63516
|
+
if (fields.some((field2) => typeof field2 === "string" && CROSS_SESSION_SEND_RESULT_MARKERS.some((marker) => field2.includes(marker)))) {
|
|
63517
|
+
return true;
|
|
63518
|
+
}
|
|
63519
|
+
}
|
|
63520
|
+
if (!outputText)
|
|
63521
|
+
return false;
|
|
63522
|
+
return CROSS_SESSION_SEND_RESULT_MARKERS.some((marker) => outputText.includes(marker));
|
|
63523
|
+
}
|
|
62648
63524
|
function includesAuthenticationFailure(errors) {
|
|
62649
63525
|
return errors.some((error63) => AUTHENTICATION_ERRORS.has(error63));
|
|
62650
63526
|
}
|
|
@@ -63468,7 +64344,7 @@ var ClaudeNativeTurnAccumulator = class {
|
|
|
63468
64344
|
this.#protocolConflict = true;
|
|
63469
64345
|
continue;
|
|
63470
64346
|
}
|
|
63471
|
-
const subagent =
|
|
64347
|
+
const subagent = isClaudeSubagentToolUse(block.name, argumentsResult.data);
|
|
63472
64348
|
const workflow = block.name === CLAUDE_WORKFLOW_TOOL;
|
|
63473
64349
|
const spawnName = subagent && block.name !== "SendMessage" && isRecord9(argumentsResult.data) ? boundedString(argumentsResult.data.name, SUBAGENT_DESCRIPTION_LIMIT) : void 0;
|
|
63474
64350
|
this.#tools.set(block.id, {
|
|
@@ -63568,9 +64444,9 @@ var ClaudeNativeTurnAccumulator = class {
|
|
|
63568
64444
|
const resultSummary = boundedString(outputText, SUBAGENT_SUMMARY_LIMIT);
|
|
63569
64445
|
const send = tool.name === "SendMessage";
|
|
63570
64446
|
const result = send && !isRecord9(nativeResult) ? sendResultFromText(outputText) : nativeResult;
|
|
63571
|
-
const
|
|
64447
|
+
const failed2 = isError || send && claudeSendMessageFailed(result, outputText);
|
|
63572
64448
|
const agentId = nativeSubagentId(result, outputText);
|
|
63573
|
-
if (!
|
|
64449
|
+
if (!failed2) {
|
|
63574
64450
|
if (tool.spawnName && agentId)
|
|
63575
64451
|
this.#subagentIdsByName.set(tool.spawnName, agentId);
|
|
63576
64452
|
if (send && isRecord9(result) && isRecord9(result.pin)) {
|
|
@@ -63580,18 +64456,21 @@ var ClaudeNativeTurnAccumulator = class {
|
|
|
63580
64456
|
this.#subagentIdsByName.set(name, id3);
|
|
63581
64457
|
}
|
|
63582
64458
|
}
|
|
64459
|
+
const crossSessionPeer = send && !failed2 && !agentId && claudeSendMessageTargetsPeerSession(result, outputText);
|
|
64460
|
+
const continuesInBackground = crossSessionPeer ? false : subagentContinuesInBackground(nativeResult, outputText) ? true : void 0;
|
|
63583
64461
|
events.push({
|
|
63584
64462
|
type: "subagent.completed",
|
|
63585
64463
|
callId,
|
|
63586
|
-
isError:
|
|
63587
|
-
...
|
|
64464
|
+
isError: failed2,
|
|
64465
|
+
...continuesInBackground !== void 0 ? { continuesInBackground } : {},
|
|
63588
64466
|
...agentId ? { nativeSubagentId: agentId } : {},
|
|
63589
64467
|
...resultSummary ? { resultSummary } : {}
|
|
63590
64468
|
});
|
|
63591
64469
|
continue;
|
|
63592
64470
|
}
|
|
63593
|
-
const
|
|
63594
|
-
const
|
|
64471
|
+
const failed = isError || tool.name === "SendMessage" && claudeSendMessageFailed(nativeResult, outputText);
|
|
64472
|
+
const fileChange = failed ? null : parseClaudeNativeFileChange(tool.name, nativeResult);
|
|
64473
|
+
const backgroundTaskId = tool.name === "Bash" && !failed && isRecord9(nativeResult) && typeof nativeResult.backgroundTaskId === "string" && nativeResult.backgroundTaskId.length > 0 ? nativeResult.backgroundTaskId : void 0;
|
|
63595
64474
|
const outputFile = backgroundTaskId !== void 0 ? BACKGROUND_OUTPUT_FILE_PATTERN.exec(outputText ?? "")?.[1] : void 0;
|
|
63596
64475
|
const backgroundOutputFile = typeof outputFile === "string" && outputFile.length > 0 ? outputFile : void 0;
|
|
63597
64476
|
events.push({
|
|
@@ -63600,7 +64479,7 @@ var ClaudeNativeTurnAccumulator = class {
|
|
|
63600
64479
|
toolName: tool.name,
|
|
63601
64480
|
...outputText ? { outputText } : {},
|
|
63602
64481
|
...structuredResult?.success ? { structuredResult: structuredResult.data } : {},
|
|
63603
|
-
isError,
|
|
64482
|
+
isError: failed,
|
|
63604
64483
|
...fileChange ? { fileChange } : {},
|
|
63605
64484
|
...backgroundTaskId ? { backgroundTaskId } : {},
|
|
63606
64485
|
...backgroundOutputFile ? { backgroundOutputFile } : {}
|
|
@@ -63703,6 +64582,27 @@ function isPersistedClaudeMessageId(expectedId, persistedIds) {
|
|
|
63703
64582
|
function isRecord11(value) {
|
|
63704
64583
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
63705
64584
|
}
|
|
64585
|
+
function parseTimestampMs(value) {
|
|
64586
|
+
if (typeof value === "number") {
|
|
64587
|
+
return Number.isFinite(value) && value >= 0 ? Math.floor(value) : void 0;
|
|
64588
|
+
}
|
|
64589
|
+
if (typeof value === "string") {
|
|
64590
|
+
const parsed = Date.parse(value);
|
|
64591
|
+
return Number.isFinite(parsed) && parsed >= 0 ? Math.floor(parsed) : void 0;
|
|
64592
|
+
}
|
|
64593
|
+
return void 0;
|
|
64594
|
+
}
|
|
64595
|
+
function turnTimestampRange(messages) {
|
|
64596
|
+
let startedAtMs;
|
|
64597
|
+
let completedAtMs;
|
|
64598
|
+
for (const entry of messages) {
|
|
64599
|
+
if (entry.timestampMs === void 0)
|
|
64600
|
+
continue;
|
|
64601
|
+
startedAtMs ??= entry.timestampMs;
|
|
64602
|
+
completedAtMs = Math.max(startedAtMs, entry.timestampMs);
|
|
64603
|
+
}
|
|
64604
|
+
return startedAtMs !== void 0 && completedAtMs !== void 0 ? { startedAtMs, completedAtMs } : void 0;
|
|
64605
|
+
}
|
|
63706
64606
|
function textParts(value) {
|
|
63707
64607
|
if (typeof value === "string")
|
|
63708
64608
|
return value.length > 0 ? [value] : [];
|
|
@@ -63824,10 +64724,12 @@ function conversationMessages(values, sessionId) {
|
|
|
63824
64724
|
throw new Error("Claude history contains duplicate message IDs");
|
|
63825
64725
|
ids.add(value.uuid);
|
|
63826
64726
|
const interrupted = isInterruptionRecord(value, turnPromptIds);
|
|
64727
|
+
const timestampMs = parseTimestampMs(value.timestamp) ?? parseTimestampMs(value.message.timestamp);
|
|
63827
64728
|
const message = {
|
|
63828
64729
|
type: value.type,
|
|
63829
64730
|
uuid: value.uuid,
|
|
63830
64731
|
message: value.message,
|
|
64732
|
+
...timestampMs !== void 0 ? { timestampMs } : {},
|
|
63831
64733
|
// Failure metadata belongs to the outer SDK/transcript record, not its Message.
|
|
63832
64734
|
failed: value.type === "assistant" && (typeof value.error === "string" || value.isApiErrorMessage === true),
|
|
63833
64735
|
nested: typeof value.parent_tool_use_id === "string" && value.parent_tool_use_id.length > 0,
|
|
@@ -63856,8 +64758,9 @@ function conversationMessages(values, sessionId) {
|
|
|
63856
64758
|
} else if (event.type === "subagent.completed") {
|
|
63857
64759
|
if (sends.has(event.callId)) {
|
|
63858
64760
|
const agentId = event.nativeSubagentId ?? sends.get(event.callId);
|
|
63859
|
-
if (!event.isError && agentId)
|
|
64761
|
+
if (!event.isError && event.continuesInBackground !== false && agentId) {
|
|
63860
64762
|
occupancy.occupyAgent(agentId);
|
|
64763
|
+
}
|
|
63861
64764
|
sends.delete(event.callId);
|
|
63862
64765
|
} else if (!event.isError && event.continuesInBackground) {
|
|
63863
64766
|
occupancy.occupySpawn(event.callId, event.nativeSubagentId);
|
|
@@ -63977,6 +64880,7 @@ function mapClaudeSnapshotWithCheckpointIds(values, sessionId, mcpServers, tasks
|
|
|
63977
64880
|
let reasoningOrdinal = 0;
|
|
63978
64881
|
let toolOrdinal = 0;
|
|
63979
64882
|
turnCheckpointIds.push(turnMessages.filter(isCheckpointCandidate).map((message) => message.uuid));
|
|
64883
|
+
const timing = turnTimestampRange(turnMessages);
|
|
63980
64884
|
turns.push({
|
|
63981
64885
|
nativeTurnRef: nativeTurnRefSchema.parse({
|
|
63982
64886
|
harnessId: claudeCodeHarnessId,
|
|
@@ -63984,6 +64888,7 @@ function mapClaudeSnapshotWithCheckpointIds(values, sessionId, mcpServers, tasks
|
|
|
63984
64888
|
nativeTurnKey: user.uuid,
|
|
63985
64889
|
formatVersion: 1
|
|
63986
64890
|
}),
|
|
64891
|
+
...timing ? timing : {},
|
|
63987
64892
|
...checkpointMessage ? {
|
|
63988
64893
|
checkpoint: nativeCheckpointRefSchema.parse({
|
|
63989
64894
|
harnessId: claudeCodeHarnessId,
|
|
@@ -64087,7 +64992,7 @@ function mapClaudeSnapshotWithCheckpointIds(values, sessionId, mcpServers, tasks
|
|
|
64087
64992
|
if (block.type !== "tool_use" || typeof block.id !== "string" || typeof block.name !== "string") {
|
|
64088
64993
|
continue;
|
|
64089
64994
|
}
|
|
64090
|
-
const toolItem = !message.nested && !
|
|
64995
|
+
const toolItem = !message.nested && !isClaudeSubagentToolUse(block.name, block.input) ? toolOrdinal += 1 : null;
|
|
64091
64996
|
const result = results.get(block.id);
|
|
64092
64997
|
if (!result)
|
|
64093
64998
|
continue;
|
|
@@ -64288,6 +65193,7 @@ function mapClaudeSubagentSnapshot(values, parentSessionId, nativeSubagentId2, p
|
|
|
64288
65193
|
}
|
|
64289
65194
|
}
|
|
64290
65195
|
const checkpointMessage = turnMessages.findLast(({ type }) => type === "assistant");
|
|
65196
|
+
const timing = turnTimestampRange(turnMessages);
|
|
64291
65197
|
turns.push({
|
|
64292
65198
|
nativeTurnRef: nativeTurnRefSchema.parse({
|
|
64293
65199
|
harnessId: claudeCodeHarnessId,
|
|
@@ -64295,6 +65201,7 @@ function mapClaudeSubagentSnapshot(values, parentSessionId, nativeSubagentId2, p
|
|
|
64295
65201
|
nativeTurnKey: turns.length === 0 ? `subagent-${nativeSubagentId2}-initial` : `subagent-turn-${user?.uuid ?? index}`,
|
|
64296
65202
|
formatVersion: 1
|
|
64297
65203
|
}),
|
|
65204
|
+
...timing ? timing : {},
|
|
64298
65205
|
...checkpointMessage ? {
|
|
64299
65206
|
checkpoint: nativeCheckpointRefSchema.parse({
|
|
64300
65207
|
harnessId: claudeCodeHarnessId,
|
|
@@ -64499,30 +65406,30 @@ async function forkClaudeSession(input3) {
|
|
|
64499
65406
|
|
|
64500
65407
|
// dist/claude-fork-references.js
|
|
64501
65408
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
64502
|
-
import { readFile as
|
|
65409
|
+
import { readFile as readFile6, rename as rename4, rm as rm5, stat as stat6, writeFile as writeFile2 } from "node:fs/promises";
|
|
64503
65410
|
|
|
64504
65411
|
// dist/claude-transcript.js
|
|
64505
65412
|
import { createReadStream as createReadStream4 } from "node:fs";
|
|
64506
|
-
import
|
|
64507
|
-
import
|
|
64508
|
-
import { readdir as readdir4, stat as
|
|
65413
|
+
import os7 from "node:os";
|
|
65414
|
+
import path13 from "node:path";
|
|
65415
|
+
import { readdir as readdir4, stat as stat5 } from "node:fs/promises";
|
|
64509
65416
|
function projectDirectoryName(cwd) {
|
|
64510
65417
|
return cwd.replace(/[^A-Za-z0-9]/gu, "-");
|
|
64511
65418
|
}
|
|
64512
65419
|
function configDirectory(environment) {
|
|
64513
|
-
return environment.CLAUDE_CONFIG_DIR ?
|
|
65420
|
+
return environment.CLAUDE_CONFIG_DIR ? path13.resolve(environment.CLAUDE_CONFIG_DIR) : path13.join(os7.homedir(), ".claude");
|
|
64514
65421
|
}
|
|
64515
65422
|
async function existingFile(file2) {
|
|
64516
65423
|
try {
|
|
64517
|
-
return (await
|
|
65424
|
+
return (await stat5(file2)).isFile();
|
|
64518
65425
|
} catch {
|
|
64519
65426
|
return false;
|
|
64520
65427
|
}
|
|
64521
65428
|
}
|
|
64522
65429
|
async function findClaudeTranscript(input3) {
|
|
64523
|
-
const projectsDirectory =
|
|
65430
|
+
const projectsDirectory = path13.join(configDirectory(input3.environment), "projects");
|
|
64524
65431
|
const name = `${input3.sessionId}.jsonl`;
|
|
64525
|
-
const expected =
|
|
65432
|
+
const expected = path13.join(projectsDirectory, projectDirectoryName(input3.cwd), name);
|
|
64526
65433
|
if (await existingFile(expected))
|
|
64527
65434
|
return expected;
|
|
64528
65435
|
let projects;
|
|
@@ -64532,7 +65439,7 @@ async function findClaudeTranscript(input3) {
|
|
|
64532
65439
|
return null;
|
|
64533
65440
|
}
|
|
64534
65441
|
for (const project2 of projects) {
|
|
64535
|
-
const candidate =
|
|
65442
|
+
const candidate = path13.join(projectsDirectory, project2, name);
|
|
64536
65443
|
if (await existingFile(candidate))
|
|
64537
65444
|
return candidate;
|
|
64538
65445
|
}
|
|
@@ -64621,7 +65528,7 @@ async function remapForkedSessionReferences(input3) {
|
|
|
64621
65528
|
const transcript = await findClaudeTranscript(input3);
|
|
64622
65529
|
if (!transcript)
|
|
64623
65530
|
return 0;
|
|
64624
|
-
const contents = await
|
|
65531
|
+
const contents = await readFile6(transcript, "utf8");
|
|
64625
65532
|
if (!contents.includes('"sameAs"'))
|
|
64626
65533
|
return 0;
|
|
64627
65534
|
const lines = contents.split("\n");
|
|
@@ -64650,7 +65557,7 @@ async function remapForkedSessionReferences(input3) {
|
|
|
64650
65557
|
try {
|
|
64651
65558
|
await writeFile2(temporary, output2.join("\n"), {
|
|
64652
65559
|
flag: "wx",
|
|
64653
|
-
mode: (await
|
|
65560
|
+
mode: (await stat6(transcript)).mode & 511
|
|
64654
65561
|
});
|
|
64655
65562
|
await rename4(temporary, transcript);
|
|
64656
65563
|
} finally {
|
|
@@ -64661,9 +65568,9 @@ async function remapForkedSessionReferences(input3) {
|
|
|
64661
65568
|
|
|
64662
65569
|
// dist/model-catalog.js
|
|
64663
65570
|
import { Buffer as Buffer3 } from "node:buffer";
|
|
64664
|
-
import { readFile as
|
|
64665
|
-
import
|
|
64666
|
-
import
|
|
65571
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
65572
|
+
import os8 from "node:os";
|
|
65573
|
+
import path14 from "node:path";
|
|
64667
65574
|
|
|
64668
65575
|
// dist/thinking-options.js
|
|
64669
65576
|
var option = (id3, label) => ({
|
|
@@ -64832,7 +65739,7 @@ function normalizeStoredClaudeModelRef(ref, catalog) {
|
|
|
64832
65739
|
return tied ? void 0 : best?.ref;
|
|
64833
65740
|
}
|
|
64834
65741
|
function resolveClaudeConfigDirectory(environment = process.env) {
|
|
64835
|
-
return
|
|
65742
|
+
return path14.resolve(environment.CLAUDE_CONFIG_DIR ?? path14.join(os8.homedir(), ".claude"));
|
|
64836
65743
|
}
|
|
64837
65744
|
function parseModelPickerOptions(value) {
|
|
64838
65745
|
if (!Array.isArray(value))
|
|
@@ -64874,10 +65781,10 @@ function parseClaudeModelPickerSettings(value) {
|
|
|
64874
65781
|
};
|
|
64875
65782
|
}
|
|
64876
65783
|
async function readClaudeUserModelPicker(environment = process.env) {
|
|
64877
|
-
const settingsPath =
|
|
65784
|
+
const settingsPath = path14.join(resolveClaudeConfigDirectory(environment), "settings.json");
|
|
64878
65785
|
let raw;
|
|
64879
65786
|
try {
|
|
64880
|
-
raw = await
|
|
65787
|
+
raw = await readFile7(settingsPath, "utf8");
|
|
64881
65788
|
} catch {
|
|
64882
65789
|
return void 0;
|
|
64883
65790
|
}
|
|
@@ -65149,15 +66056,15 @@ function parseClaudeSlashCommands(value) {
|
|
|
65149
66056
|
return value.flatMap((entry) => {
|
|
65150
66057
|
if (typeof entry !== "object" || entry === null)
|
|
65151
66058
|
return [];
|
|
65152
|
-
const
|
|
65153
|
-
const name = typeof
|
|
66059
|
+
const record4 = entry;
|
|
66060
|
+
const name = typeof record4.name === "string" ? record4.name.trim().replace(/^\//u, "") : "";
|
|
65154
66061
|
if (!name)
|
|
65155
66062
|
return [];
|
|
65156
66063
|
return [
|
|
65157
66064
|
{
|
|
65158
66065
|
name,
|
|
65159
|
-
description: typeof
|
|
65160
|
-
argumentHint: typeof
|
|
66066
|
+
description: typeof record4.description === "string" ? record4.description : "",
|
|
66067
|
+
argumentHint: typeof record4.argumentHint === "string" ? record4.argumentHint : ""
|
|
65161
66068
|
}
|
|
65162
66069
|
];
|
|
65163
66070
|
});
|
|
@@ -65224,7 +66131,7 @@ function projectClaudeAccountUsage(usage, account) {
|
|
|
65224
66131
|
|
|
65225
66132
|
// dist/process-fence.js
|
|
65226
66133
|
import { execFile as execFile3 } from "node:child_process";
|
|
65227
|
-
import
|
|
66134
|
+
import path15 from "node:path";
|
|
65228
66135
|
import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
65229
66136
|
import { promisify } from "node:util";
|
|
65230
66137
|
var executeFile = promisify(execFile3);
|
|
@@ -65248,9 +66155,9 @@ async function closeClaudeProcessGroup(child, timeoutMs, retry) {
|
|
|
65248
66155
|
if (child.exitCode !== null || child.signalCode !== null)
|
|
65249
66156
|
throw new Error("Claude process tree cannot be confirmed after its Windows root exited");
|
|
65250
66157
|
const root = process.env.SystemRoot ?? process.env.SYSTEMROOT;
|
|
65251
|
-
if (!root || !
|
|
66158
|
+
if (!root || !path15.win32.isAbsolute(root))
|
|
65252
66159
|
throw new Error("Windows SystemRoot is unavailable");
|
|
65253
|
-
await executeFile(
|
|
66160
|
+
await executeFile(path15.win32.join(root, "System32", "taskkill.exe"), ["/PID", String(pid), "/T", "/F"], {
|
|
65254
66161
|
timeout: timeoutMs,
|
|
65255
66162
|
windowsHide: true
|
|
65256
66163
|
});
|
|
@@ -65640,6 +66547,7 @@ var ClaudeSdkTransport = class {
|
|
|
65640
66547
|
environment: this.#environment
|
|
65641
66548
|
});
|
|
65642
66549
|
const thinking = claudeThinkingConfiguration(this.#thinkingOptionId);
|
|
66550
|
+
const entrypoint = this.#environment.CODEXHOST_CLAUDE_CODE_ENTRYPOINT === "cli" ? "cli" : SESSION_ENTRYPOINT;
|
|
65643
66551
|
const activeQuery = this.#queryFactory({
|
|
65644
66552
|
prompt: this.#input,
|
|
65645
66553
|
options: {
|
|
@@ -65674,7 +66582,7 @@ var ClaudeSdkTransport = class {
|
|
|
65674
66582
|
// stays unset because it hides these tools again.
|
|
65675
66583
|
CLAUDE_CODE_ENABLE_TODO_TOOLS: "1",
|
|
65676
66584
|
...this.#environment,
|
|
65677
|
-
CLAUDE_CODE_ENTRYPOINT:
|
|
66585
|
+
CLAUDE_CODE_ENTRYPOINT: entrypoint,
|
|
65678
66586
|
CLAUDE_AGENT_SDK_CLIENT_APP: CLIENT_APP
|
|
65679
66587
|
}),
|
|
65680
66588
|
spawnClaudeCodeProcess: (options) => this.#spawn(options)
|
|
@@ -66778,7 +67686,7 @@ var ClaudeSubagentLifecycle = class {
|
|
|
66778
67686
|
if (!current)
|
|
66779
67687
|
throw new Error("Claude Code Subagent delegation has no Agent state");
|
|
66780
67688
|
this.#retireSendTarget(active2.item, current.nativeSubagentId, event.nativeSubagentId);
|
|
66781
|
-
const status = cancellationRequested ? "interrupted" : event.isError ? "failed" : active2.item.operation === "send"
|
|
67689
|
+
const status = cancellationRequested ? "interrupted" : event.isError ? "failed" : event.continuesInBackground ?? active2.item.operation === "send" ? "running" : "completed";
|
|
66782
67690
|
const subagent = {
|
|
66783
67691
|
...current,
|
|
66784
67692
|
status,
|
|
@@ -69231,9 +70139,9 @@ var ClaudeHarnessSession = class {
|
|
|
69231
70139
|
}
|
|
69232
70140
|
}
|
|
69233
70141
|
/** Publishes one live request to Host metering; an unusable one marks history incomplete. */
|
|
69234
|
-
#meterUsage(
|
|
69235
|
-
if (
|
|
69236
|
-
this.#event({ type: "usage.request", request:
|
|
70142
|
+
#meterUsage(record4) {
|
|
70143
|
+
if (record4.kind === "request")
|
|
70144
|
+
this.#event({ type: "usage.request", request: record4.request });
|
|
69237
70145
|
else
|
|
69238
70146
|
this.#event({ type: "usage.history", complete: false });
|
|
69239
70147
|
}
|
|
@@ -69831,8 +70739,12 @@ var ClaudeHarnessSession = class {
|
|
|
69831
70739
|
*/
|
|
69832
70740
|
#handlePlanLimit(planLimit) {
|
|
69833
70741
|
const effective = this.#onPlanLimitObserved(planLimit);
|
|
69834
|
-
if (effective)
|
|
69835
|
-
|
|
70742
|
+
if (!effective)
|
|
70743
|
+
return;
|
|
70744
|
+
if (effective.replace)
|
|
70745
|
+
this.replacePlanLimit(effective.planLimit);
|
|
70746
|
+
else
|
|
70747
|
+
this.publishPlanLimit(effective.planLimit);
|
|
69836
70748
|
}
|
|
69837
70749
|
#observePromptCacheTtl(ttlSeconds) {
|
|
69838
70750
|
this.#promptCacheTtlSeconds = ttlSeconds;
|
|
@@ -69865,6 +70777,54 @@ var ClaudeHarnessSession = class {
|
|
|
69865
70777
|
}
|
|
69866
70778
|
this.#mergeAndPublishUsage(delta, this.#active?.command.turnId);
|
|
69867
70779
|
}
|
|
70780
|
+
/**
|
|
70781
|
+
* Replace all plan-limit fields on `#latestUsage`, clearing removed windows
|
|
70782
|
+
* when custom Provider quota changes or expires while preserving other usage.
|
|
70783
|
+
*/
|
|
70784
|
+
replacePlanLimit(planLimit) {
|
|
70785
|
+
if (this.#phase !== "open")
|
|
70786
|
+
return;
|
|
70787
|
+
const { planFiveHourUsedPercent: _fiveHourUsed, planFiveHourResetsAtUnix: _fiveHourReset, planSevenDayUsedPercent: _sevenDayUsed, planSevenDayResetsAtUnix: _sevenDayReset, ...base } = this.#latestUsage ?? {};
|
|
70788
|
+
const next = { ...base };
|
|
70789
|
+
if (planLimit?.fiveHour) {
|
|
70790
|
+
next.planFiveHourUsedPercent = planLimit.fiveHour.utilizationPercent;
|
|
70791
|
+
if (planLimit.fiveHour.resetsAtUnix !== void 0) {
|
|
70792
|
+
next.planFiveHourResetsAtUnix = planLimit.fiveHour.resetsAtUnix;
|
|
70793
|
+
}
|
|
70794
|
+
}
|
|
70795
|
+
if (planLimit?.sevenDay) {
|
|
70796
|
+
next.planSevenDayUsedPercent = planLimit.sevenDay.utilizationPercent;
|
|
70797
|
+
if (planLimit.sevenDay.resetsAtUnix !== void 0) {
|
|
70798
|
+
next.planSevenDayResetsAtUnix = planLimit.sevenDay.resetsAtUnix;
|
|
70799
|
+
}
|
|
70800
|
+
}
|
|
70801
|
+
if (Object.keys(next).length === 0) {
|
|
70802
|
+
if (this.#latestUsage === null)
|
|
70803
|
+
return;
|
|
70804
|
+
this.#latestUsage = null;
|
|
70805
|
+
this.#event({
|
|
70806
|
+
type: "session.usage.changed",
|
|
70807
|
+
...this.#active?.command.turnId !== void 0 ? { observedForTurnId: this.#active.command.turnId } : {},
|
|
70808
|
+
usage: null
|
|
70809
|
+
});
|
|
70810
|
+
return;
|
|
70811
|
+
}
|
|
70812
|
+
let usage;
|
|
70813
|
+
try {
|
|
70814
|
+
usage = parseHostUsage(next);
|
|
70815
|
+
} catch {
|
|
70816
|
+
return;
|
|
70817
|
+
}
|
|
70818
|
+
if (this.#latestUsage && Object.keys(this.#latestUsage).length === Object.keys(usage).length && Object.keys(usage).every((key) => this.#latestUsage?.[key] === usage[key])) {
|
|
70819
|
+
return;
|
|
70820
|
+
}
|
|
70821
|
+
this.#latestUsage = usage;
|
|
70822
|
+
this.#event({
|
|
70823
|
+
type: "session.usage.changed",
|
|
70824
|
+
...this.#active?.command.turnId !== void 0 ? { observedForTurnId: this.#active.command.turnId } : {},
|
|
70825
|
+
usage
|
|
70826
|
+
});
|
|
70827
|
+
}
|
|
69868
70828
|
/**
|
|
69869
70829
|
* Every Usage observation replaces `#latestUsage` in full: unaffected fields
|
|
69870
70830
|
* from the prior snapshot are carried forward, never cleared by an
|
|
@@ -70077,6 +71037,7 @@ var ClaudeHarnessSession = class {
|
|
|
70077
71037
|
this.#channel.emit({ kind: "event", event });
|
|
70078
71038
|
}
|
|
70079
71039
|
};
|
|
71040
|
+
var CUSTOM_PROVIDER_REFRESH_INTERVAL_MS = 6e4;
|
|
70080
71041
|
var ClaudeCodeAdapter = class {
|
|
70081
71042
|
normalizeStoredModelRef = normalizeStoredClaudeModelRef;
|
|
70082
71043
|
commandCatalog = claudeCommandCatalog;
|
|
@@ -70223,6 +71184,7 @@ var ClaudeCodeAdapter = class {
|
|
|
70223
71184
|
#inspectionTasks = /* @__PURE__ */ new Set();
|
|
70224
71185
|
#inspectors = /* @__PURE__ */ new Set();
|
|
70225
71186
|
#sessions = /* @__PURE__ */ new Set();
|
|
71187
|
+
#abortController = new AbortController();
|
|
70226
71188
|
#closePromise = null;
|
|
70227
71189
|
#latestPlanLimit = null;
|
|
70228
71190
|
// Seeded once on cold start (or by the first passive push / explicit account inspection);
|
|
@@ -70230,6 +71192,13 @@ var ClaudeCodeAdapter = class {
|
|
|
70230
71192
|
#creditsSeeded = false;
|
|
70231
71193
|
#accountInspection = null;
|
|
70232
71194
|
#accountCreditsSupported = false;
|
|
71195
|
+
#quotaGeneration = 0;
|
|
71196
|
+
#committedQuotaGeneration = 0;
|
|
71197
|
+
#customProviderActive = false;
|
|
71198
|
+
#customProviderCredits = null;
|
|
71199
|
+
#customProviderBalance = null;
|
|
71200
|
+
#customProviderRefreshAt = Number.NEGATIVE_INFINITY;
|
|
71201
|
+
#customProviderRefresh = null;
|
|
70233
71202
|
constructor(options = {}, dependencies) {
|
|
70234
71203
|
const environment = options.environment ?? process.env;
|
|
70235
71204
|
this.#environment = environment;
|
|
@@ -70258,6 +71227,10 @@ var ClaudeCodeAdapter = class {
|
|
|
70258
71227
|
environment: options.environment ?? process.env
|
|
70259
71228
|
});
|
|
70260
71229
|
},
|
|
71230
|
+
inspectCustomProviderAccounts: (signal) => fetchClaudeCustomProviderAccounts({
|
|
71231
|
+
environment: options.environment ?? process.env,
|
|
71232
|
+
...signal ? { signal } : {}
|
|
71233
|
+
}),
|
|
70261
71234
|
createInspector: (input3) => new ClaudeSdkModelInspector({
|
|
70262
71235
|
...input3,
|
|
70263
71236
|
...options.command ? { command: options.command } : {},
|
|
@@ -70308,7 +71281,7 @@ var ClaudeCodeAdapter = class {
|
|
|
70308
71281
|
error: invalidState("Claude Code Adapter is closing")
|
|
70309
71282
|
};
|
|
70310
71283
|
}
|
|
70311
|
-
const cwd =
|
|
71284
|
+
const cwd = path16.resolve(input3.cwd ?? process.cwd());
|
|
70312
71285
|
const current = this.#inspectionInFlight.get(cwd);
|
|
70313
71286
|
if (input3.refresh) {
|
|
70314
71287
|
this.#inspectionCache.clear();
|
|
@@ -70340,25 +71313,102 @@ var ClaudeCodeAdapter = class {
|
|
|
70340
71313
|
});
|
|
70341
71314
|
return inspection;
|
|
70342
71315
|
}
|
|
70343
|
-
|
|
71316
|
+
inspectAccounts() {
|
|
70344
71317
|
if (this.#closePromise)
|
|
70345
|
-
return Promise.resolve(
|
|
71318
|
+
return Promise.resolve([]);
|
|
70346
71319
|
if (this.#accountInspection)
|
|
70347
71320
|
return this.#accountInspection;
|
|
70348
|
-
this.#accountInspection = this.#
|
|
71321
|
+
this.#accountInspection = this.#readAccounts().finally(() => {
|
|
70349
71322
|
this.#accountInspection = null;
|
|
70350
71323
|
});
|
|
70351
71324
|
return this.#accountInspection;
|
|
70352
71325
|
}
|
|
70353
|
-
async
|
|
70354
|
-
|
|
71326
|
+
async inspectAccount() {
|
|
71327
|
+
return (await this.inspectAccounts())[0] ?? null;
|
|
71328
|
+
}
|
|
71329
|
+
#applyCustomProviderAccounts(accounts, generation) {
|
|
71330
|
+
if (this.#closePromise || generation < this.#committedQuotaGeneration)
|
|
71331
|
+
return false;
|
|
71332
|
+
this.#committedQuotaGeneration = generation;
|
|
71333
|
+
const primary = accounts[0] ?? null;
|
|
71334
|
+
if (primary)
|
|
71335
|
+
this.#latestPlanLimit = null;
|
|
71336
|
+
this.#customProviderCredits = primary?.credits ?? null;
|
|
71337
|
+
this.#customProviderBalance = this.#customProviderCredits ? null : primary?.balance ?? null;
|
|
71338
|
+
this.#accountCreditsSupported = this.#customProviderCredits !== null || this.#customProviderBalance !== null;
|
|
71339
|
+
const inspected = planLimitFromAccountCredits(this.#customProviderCredits);
|
|
71340
|
+
for (const session of this.#sessions) {
|
|
71341
|
+
if (inspected) {
|
|
71342
|
+
session.replacePlanLimit(inspected);
|
|
71343
|
+
} else if (this.#latestPlanLimit === null) {
|
|
71344
|
+
session.replacePlanLimit(null);
|
|
71345
|
+
}
|
|
71346
|
+
session.publishAccountCreditsSupport(this.#accountCreditsSupported);
|
|
71347
|
+
}
|
|
71348
|
+
return true;
|
|
71349
|
+
}
|
|
71350
|
+
#refreshCustomProvider() {
|
|
71351
|
+
if (this.#closePromise)
|
|
71352
|
+
return Promise.resolve();
|
|
71353
|
+
if (this.#accountInspection)
|
|
71354
|
+
return this.#accountInspection.then(() => void 0);
|
|
71355
|
+
if (this.#customProviderRefresh)
|
|
71356
|
+
return this.#customProviderRefresh;
|
|
71357
|
+
const generation = ++this.#quotaGeneration;
|
|
71358
|
+
this.#customProviderRefresh = (async () => {
|
|
71359
|
+
let committed = false;
|
|
71360
|
+
try {
|
|
71361
|
+
const accounts = await this.#dependencies.inspectCustomProviderAccounts?.(this.#abortController.signal) ?? [];
|
|
71362
|
+
committed = this.#applyCustomProviderAccounts(accounts, generation);
|
|
71363
|
+
} catch {
|
|
71364
|
+
committed = this.#applyCustomProviderAccounts([], generation);
|
|
71365
|
+
} finally {
|
|
71366
|
+
if (committed && !this.#closePromise)
|
|
71367
|
+
this.#customProviderRefreshAt = Date.now();
|
|
71368
|
+
}
|
|
71369
|
+
})().finally(() => {
|
|
71370
|
+
this.#customProviderRefresh = null;
|
|
71371
|
+
});
|
|
71372
|
+
return this.#customProviderRefresh;
|
|
71373
|
+
}
|
|
71374
|
+
async #readAccounts() {
|
|
71375
|
+
const generation = ++this.#quotaGeneration;
|
|
71376
|
+
try {
|
|
71377
|
+
const customAccounts = await this.#dependencies.inspectCustomProviderAccounts?.(this.#abortController.signal) ?? [];
|
|
71378
|
+
if (this.#closePromise)
|
|
71379
|
+
return [];
|
|
71380
|
+
if (customAccounts.length > 0) {
|
|
71381
|
+
if (this.#applyCustomProviderAccounts(customAccounts, generation)) {
|
|
71382
|
+
this.#customProviderActive = true;
|
|
71383
|
+
this.#creditsSeeded = true;
|
|
71384
|
+
this.#customProviderRefreshAt = Date.now();
|
|
71385
|
+
}
|
|
71386
|
+
return customAccounts;
|
|
71387
|
+
}
|
|
71388
|
+
} catch {
|
|
71389
|
+
if (this.#closePromise)
|
|
71390
|
+
return [];
|
|
71391
|
+
}
|
|
71392
|
+
if (generation >= this.#committedQuotaGeneration) {
|
|
71393
|
+
this.#committedQuotaGeneration = generation;
|
|
71394
|
+
const hadCustomProvider = this.#customProviderActive || this.#customProviderCredits !== null;
|
|
71395
|
+
this.#customProviderActive = false;
|
|
71396
|
+
this.#customProviderCredits = null;
|
|
71397
|
+
this.#customProviderBalance = null;
|
|
71398
|
+
if (hadCustomProvider && this.#latestPlanLimit === null) {
|
|
71399
|
+
for (const session of this.#sessions) {
|
|
71400
|
+
session.replacePlanLimit(null);
|
|
71401
|
+
}
|
|
71402
|
+
}
|
|
71403
|
+
}
|
|
70355
71404
|
let inspector;
|
|
70356
71405
|
try {
|
|
70357
71406
|
this.#dependencies.inspectInstallation();
|
|
70358
71407
|
inspector = this.#dependencies.createInspector({ cwd: process.cwd() });
|
|
70359
71408
|
this.#inspectors.add(inspector);
|
|
70360
71409
|
const account = await inspector.inspectAccount?.() ?? null;
|
|
70361
|
-
if (this.#
|
|
71410
|
+
if (!this.#closePromise && generation >= this.#committedQuotaGeneration) {
|
|
71411
|
+
this.#committedQuotaGeneration = generation;
|
|
70362
71412
|
this.#accountCreditsSupported = account?.credits !== void 0;
|
|
70363
71413
|
const inspected = planLimitFromAccountCredits(account?.credits);
|
|
70364
71414
|
if (inspected) {
|
|
@@ -70378,9 +71428,9 @@ var ClaudeCodeAdapter = class {
|
|
|
70378
71428
|
session.publishPlanLimit(this.#latestPlanLimit);
|
|
70379
71429
|
}
|
|
70380
71430
|
}
|
|
70381
|
-
return account;
|
|
71431
|
+
return account ? [account] : [];
|
|
70382
71432
|
} catch {
|
|
70383
|
-
return
|
|
71433
|
+
return [];
|
|
70384
71434
|
} finally {
|
|
70385
71435
|
if (inspector) {
|
|
70386
71436
|
await inspector.close().catch(() => void 0);
|
|
@@ -70538,7 +71588,7 @@ var ClaudeCodeAdapter = class {
|
|
|
70538
71588
|
}
|
|
70539
71589
|
requestedPermissionModeId = CLAUDE_DEFAULT_PERMISSION_MODE_ID;
|
|
70540
71590
|
}
|
|
70541
|
-
const cwd =
|
|
71591
|
+
const cwd = path16.resolve(input3.cwd);
|
|
70542
71592
|
if (input3.kind === "rollbackLastTurn") {
|
|
70543
71593
|
for (const source of this.#sessions) {
|
|
70544
71594
|
const ready = await source.prepareRollback(input3.sourceRef.nativeSessionId);
|
|
@@ -70672,31 +71722,63 @@ var ClaudeCodeAdapter = class {
|
|
|
70672
71722
|
} catch {
|
|
70673
71723
|
return null;
|
|
70674
71724
|
}
|
|
71725
|
+
const hadCustomProvider = this.#customProviderActive || this.#customProviderCredits !== null;
|
|
70675
71726
|
this.#latestPlanLimit = next.fiveHour || next.sevenDay ? next : null;
|
|
70676
71727
|
if (this.#latestPlanLimit) {
|
|
71728
|
+
this.#committedQuotaGeneration = ++this.#quotaGeneration;
|
|
71729
|
+
this.#customProviderActive = false;
|
|
71730
|
+
this.#customProviderCredits = null;
|
|
71731
|
+
this.#customProviderBalance = null;
|
|
70677
71732
|
this.#creditsSeeded = true;
|
|
70678
71733
|
this.#accountCreditsSupported = true;
|
|
70679
71734
|
for (const session of this.#sessions) {
|
|
70680
|
-
session
|
|
70681
|
-
|
|
70682
|
-
session.
|
|
71735
|
+
if (hadCustomProvider && session !== origin) {
|
|
71736
|
+
session.replacePlanLimit(this.#latestPlanLimit);
|
|
71737
|
+
session.publishAccountCreditsSupport(true);
|
|
71738
|
+
} else {
|
|
71739
|
+
session.publishAccountCreditsSupport(true);
|
|
71740
|
+
if (session !== origin)
|
|
71741
|
+
session.publishPlanLimit(this.#latestPlanLimit);
|
|
71742
|
+
}
|
|
70683
71743
|
}
|
|
70684
71744
|
}
|
|
70685
|
-
return this.#latestPlanLimit;
|
|
71745
|
+
return this.#latestPlanLimit ? { planLimit: this.#latestPlanLimit, replace: hadCustomProvider } : null;
|
|
70686
71746
|
}
|
|
70687
71747
|
credits() {
|
|
70688
|
-
return projectClaudePlanLimitToCredits(this.#latestPlanLimit);
|
|
71748
|
+
return this.#closePromise ? null : projectClaudePlanLimitToCredits(this.#latestPlanLimit) ?? this.#customProviderCredits;
|
|
71749
|
+
}
|
|
71750
|
+
balance() {
|
|
71751
|
+
return this.#closePromise || this.credits() !== null ? null : this.#customProviderBalance;
|
|
70689
71752
|
}
|
|
70690
71753
|
refreshCredits() {
|
|
70691
71754
|
if (this.#closePromise)
|
|
70692
71755
|
return Promise.resolve(null);
|
|
70693
|
-
if (this.#
|
|
71756
|
+
if (this.#latestPlanLimit)
|
|
71757
|
+
return Promise.resolve(this.credits());
|
|
71758
|
+
if (this.#customProviderActive) {
|
|
71759
|
+
if (!this.#customProviderRefresh && !this.#accountInspection && Date.now() - this.#customProviderRefreshAt < CUSTOM_PROVIDER_REFRESH_INTERVAL_MS) {
|
|
71760
|
+
return Promise.resolve(this.credits());
|
|
71761
|
+
}
|
|
71762
|
+
return this.#refreshCustomProvider().then(() => this.#closePromise ? null : this.credits());
|
|
71763
|
+
}
|
|
71764
|
+
if (this.#creditsSeeded)
|
|
70694
71765
|
return Promise.resolve(this.credits());
|
|
70695
|
-
return this.
|
|
71766
|
+
return this.inspectAccounts().then(() => this.#closePromise ? null : this.credits());
|
|
71767
|
+
}
|
|
71768
|
+
refreshBalance() {
|
|
71769
|
+
if (this.#closePromise || this.credits() !== null)
|
|
71770
|
+
return Promise.resolve(null);
|
|
71771
|
+
return this.refreshCredits().then(() => this.#closePromise ? null : this.balance());
|
|
70696
71772
|
}
|
|
70697
71773
|
close() {
|
|
70698
71774
|
if (!this.#closePromise) {
|
|
71775
|
+
this.#abortController.abort();
|
|
71776
|
+
this.#committedQuotaGeneration = ++this.#quotaGeneration;
|
|
70699
71777
|
this.#creditsSeeded = false;
|
|
71778
|
+
this.#customProviderActive = false;
|
|
71779
|
+
this.#customProviderCredits = null;
|
|
71780
|
+
this.#customProviderBalance = null;
|
|
71781
|
+
this.#customProviderRefreshAt = Number.NEGATIVE_INFINITY;
|
|
70700
71782
|
this.#inspectionCache.clear();
|
|
70701
71783
|
this.#closePromise = Promise.all([
|
|
70702
71784
|
this.#importScope.close(),
|
|
@@ -70710,11 +71792,11 @@ var ClaudeCodeAdapter = class {
|
|
|
70710
71792
|
};
|
|
70711
71793
|
|
|
70712
71794
|
// dist/installation.js
|
|
70713
|
-
import { readFile as
|
|
71795
|
+
import { readFile as readFile8, realpath as realpath5 } from "node:fs/promises";
|
|
70714
71796
|
import { homedir as homedir2 } from "node:os";
|
|
70715
|
-
import
|
|
71797
|
+
import path17 from "node:path";
|
|
70716
71798
|
async function readSettings(file2) {
|
|
70717
|
-
const text3 = await
|
|
71799
|
+
const text3 = await readFile8(file2, "utf8").catch((error63) => {
|
|
70718
71800
|
if (error63.code === "ENOENT")
|
|
70719
71801
|
return "{}";
|
|
70720
71802
|
throw error63;
|
|
@@ -70733,9 +71815,9 @@ function createClaudeInstallation(environment, command) {
|
|
|
70733
71815
|
...command ? { command } : {}
|
|
70734
71816
|
});
|
|
70735
71817
|
const home = environment.HOME ?? environment.USERPROFILE ?? homedir2();
|
|
70736
|
-
const config2 = environment.CLAUDE_CONFIG_DIR ?
|
|
70737
|
-
const managedFile = process.platform === "darwin" ? "/Library/Application Support/ClaudeCode/managed-settings.json" : process.platform === "win32" ?
|
|
70738
|
-
const user = await readSettings(
|
|
71818
|
+
const config2 = environment.CLAUDE_CONFIG_DIR ? path17.resolve(home, environment.CLAUDE_CONFIG_DIR) : path17.join(home, ".claude");
|
|
71819
|
+
const managedFile = process.platform === "darwin" ? "/Library/Application Support/ClaudeCode/managed-settings.json" : process.platform === "win32" ? path17.join(environment.ProgramFiles ?? "C:\\Program Files", "ClaudeCode", "managed-settings.json") : "/etc/claude-code/managed-settings.json";
|
|
71820
|
+
const user = await readSettings(path17.join(config2, "settings.json"));
|
|
70739
71821
|
const managed = await readSettings(managedFile);
|
|
70740
71822
|
const settings = { ...user, ...managed, env: { ...user.env, ...managed.env } };
|
|
70741
71823
|
const env = { ...environment, ...settings.env };
|
|
@@ -70748,10 +71830,10 @@ function createClaudeInstallation(environment, command) {
|
|
|
70748
71830
|
throw new Error("Unknown Claude release channel");
|
|
70749
71831
|
const latestVersion = installationVersion(await fetchInstallationText(`https://downloads.claude.ai/claude-code-releases/${channel}`));
|
|
70750
71832
|
const npm = await npmInstallation(executable, ["@anthropic-ai/claude-code"], env);
|
|
70751
|
-
const launcher =
|
|
71833
|
+
const launcher = path17.join(home, ".local", "bin", process.platform === "win32" ? "claude.exe" : "claude");
|
|
70752
71834
|
const selected = await realpath5(executable);
|
|
70753
|
-
const versions =
|
|
70754
|
-
const native =
|
|
71835
|
+
const versions = path17.join(home, ".local", "share", "claude", "versions") + path17.sep;
|
|
71836
|
+
const native = path17.resolve(executable) === launcher && (selected.startsWith(versions) || process.platform === "win32" && selected === launcher);
|
|
70755
71837
|
const blocked = !!env.DISABLE_UPDATES && env.DISABLE_UPDATES !== "0" || !!settings.minimumVersion && newerInstallationVersion(latestVersion, installationVersion(settings.minimumVersion)) || !!settings.requiredMaximumVersion && newerInstallationVersion(installationVersion(settings.requiredMaximumVersion), latestVersion);
|
|
70756
71838
|
const canUpdate = !blocked && (npm?.canUpdate ?? native);
|
|
70757
71839
|
update = async () => {
|
|
@@ -70782,7 +71864,7 @@ function createClaudeInstallation(environment, command) {
|
|
|
70782
71864
|
}
|
|
70783
71865
|
|
|
70784
71866
|
// dist/user-shell-environment.js
|
|
70785
|
-
import
|
|
71867
|
+
import path18 from "node:path";
|
|
70786
71868
|
import { execFile as execFile4 } from "node:child_process";
|
|
70787
71869
|
var ENVIRONMENT_MARKER = Buffer.from("\0CODEXHOST_USER_SHELL_ENV_V1\0");
|
|
70788
71870
|
var ENVIRONMENT_COMMAND = "printf '\\0CODEXHOST_USER_SHELL_ENV_V1\\0'; /usr/bin/env -0";
|
|
@@ -70816,9 +71898,9 @@ function mergeMissingEnvironment(environment, shellEnvironment, platform) {
|
|
|
70816
71898
|
const merged = { ...environment };
|
|
70817
71899
|
for (const [name, value] of Object.entries(shellEnvironment)) {
|
|
70818
71900
|
if (name === "PATH" && platform === "darwin") {
|
|
70819
|
-
const
|
|
70820
|
-
if (
|
|
70821
|
-
merged.PATH =
|
|
71901
|
+
const path19 = mergeMacPath(merged.PATH, value);
|
|
71902
|
+
if (path19 !== void 0)
|
|
71903
|
+
merged.PATH = path19;
|
|
70822
71904
|
continue;
|
|
70823
71905
|
}
|
|
70824
71906
|
if (merged[name] === void 0)
|
|
@@ -70827,13 +71909,13 @@ function mergeMissingEnvironment(environment, shellEnvironment, platform) {
|
|
|
70827
71909
|
return merged;
|
|
70828
71910
|
}
|
|
70829
71911
|
function mergeMacPath(hostPath, shellPath) {
|
|
70830
|
-
const hostEntries = hostPath?.split(
|
|
70831
|
-
const seen = new Set(hostEntries.filter((entry) => entry.length > 0 &&
|
|
71912
|
+
const hostEntries = hostPath?.split(path18.posix.delimiter) ?? [];
|
|
71913
|
+
const seen = new Set(hostEntries.filter((entry) => entry.length > 0 && path18.posix.isAbsolute(entry)).map((entry) => path18.posix.resolve(entry)));
|
|
70832
71914
|
const additions = [];
|
|
70833
|
-
for (const entry of shellPath.split(
|
|
70834
|
-
if (entry.length === 0 || !
|
|
71915
|
+
for (const entry of shellPath.split(path18.posix.delimiter)) {
|
|
71916
|
+
if (entry.length === 0 || !path18.posix.isAbsolute(entry))
|
|
70835
71917
|
continue;
|
|
70836
|
-
const normalized =
|
|
71918
|
+
const normalized = path18.posix.resolve(entry);
|
|
70837
71919
|
if (seen.has(normalized))
|
|
70838
71920
|
continue;
|
|
70839
71921
|
seen.add(normalized);
|
|
@@ -70841,14 +71923,14 @@ function mergeMacPath(hostPath, shellPath) {
|
|
|
70841
71923
|
}
|
|
70842
71924
|
if (hostPath === void 0 && additions.length === 0)
|
|
70843
71925
|
return void 0;
|
|
70844
|
-
return [...hostEntries, ...additions].join(
|
|
71926
|
+
return [...hostEntries, ...additions].join(path18.posix.delimiter);
|
|
70845
71927
|
}
|
|
70846
71928
|
async function withUserShellEnvironment(environment, dependencies) {
|
|
70847
71929
|
const platform = dependencies?.platform ?? process.platform;
|
|
70848
71930
|
if (platform === "win32" || !environment.HOME)
|
|
70849
71931
|
return environment;
|
|
70850
71932
|
const shell = environment.SHELL?.trim() || defaultShell(platform);
|
|
70851
|
-
if (!shell || !SUPPORTED_SHELLS.has(
|
|
71933
|
+
if (!shell || !SUPPORTED_SHELLS.has(path18.basename(shell)))
|
|
70852
71934
|
return environment;
|
|
70853
71935
|
const cacheKey = `${platform}\0${shell}\0${environment.HOME}`;
|
|
70854
71936
|
const cached2 = dependencies ? void 0 : shellEnvironmentCache.get(cacheKey);
|