@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
|
@@ -1227,10 +1227,10 @@ function mergeDefs(...defs) {
|
|
|
1227
1227
|
function cloneDef(schema) {
|
|
1228
1228
|
return mergeDefs(schema._zod.def);
|
|
1229
1229
|
}
|
|
1230
|
-
function getElementAtPath(obj,
|
|
1231
|
-
if (!
|
|
1230
|
+
function getElementAtPath(obj, path10) {
|
|
1231
|
+
if (!path10)
|
|
1232
1232
|
return obj;
|
|
1233
|
-
return
|
|
1233
|
+
return path10.reduce((acc, key) => acc?.[key], obj);
|
|
1234
1234
|
}
|
|
1235
1235
|
function promiseAllObject(promisesObj) {
|
|
1236
1236
|
const keys = Object.keys(promisesObj);
|
|
@@ -1570,11 +1570,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1570
1570
|
}
|
|
1571
1571
|
return false;
|
|
1572
1572
|
}
|
|
1573
|
-
function prefixIssues(
|
|
1573
|
+
function prefixIssues(path10, issues) {
|
|
1574
1574
|
return issues.map((iss) => {
|
|
1575
1575
|
var _a3;
|
|
1576
1576
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1577
|
-
iss.path.unshift(
|
|
1577
|
+
iss.path.unshift(path10);
|
|
1578
1578
|
return iss;
|
|
1579
1579
|
});
|
|
1580
1580
|
}
|
|
@@ -2036,16 +2036,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
2036
2036
|
}
|
|
2037
2037
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
2038
2038
|
const fieldErrors = { _errors: [] };
|
|
2039
|
-
const processError = (error63,
|
|
2039
|
+
const processError = (error63, path10 = []) => {
|
|
2040
2040
|
for (const issue2 of error63.issues) {
|
|
2041
2041
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
2042
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
2042
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
2043
2043
|
} else if (issue2.code === "invalid_key") {
|
|
2044
|
-
processError({ issues: issue2.issues }, [...
|
|
2044
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
2045
2045
|
} else if (issue2.code === "invalid_element") {
|
|
2046
|
-
processError({ issues: issue2.issues }, [...
|
|
2046
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
2047
2047
|
} else {
|
|
2048
|
-
const fullpath = [...
|
|
2048
|
+
const fullpath = [...path10, ...issue2.path];
|
|
2049
2049
|
if (fullpath.length === 0) {
|
|
2050
2050
|
fieldErrors._errors.push(mapper(issue2));
|
|
2051
2051
|
} else {
|
|
@@ -2084,17 +2084,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
2084
2084
|
}
|
|
2085
2085
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
2086
2086
|
const result = { errors: [] };
|
|
2087
|
-
const processError = (error63,
|
|
2087
|
+
const processError = (error63, path10 = []) => {
|
|
2088
2088
|
var _a3;
|
|
2089
2089
|
for (const issue2 of error63.issues) {
|
|
2090
2090
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
2091
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
2091
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
2092
2092
|
} else if (issue2.code === "invalid_key") {
|
|
2093
|
-
processError({ issues: issue2.issues }, [...
|
|
2093
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
2094
2094
|
} else if (issue2.code === "invalid_element") {
|
|
2095
|
-
processError({ issues: issue2.issues }, [...
|
|
2095
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
2096
2096
|
} else {
|
|
2097
|
-
const fullpath = [...
|
|
2097
|
+
const fullpath = [...path10, ...issue2.path];
|
|
2098
2098
|
if (fullpath.length === 0) {
|
|
2099
2099
|
result.errors.push(mapper(issue2));
|
|
2100
2100
|
continue;
|
|
@@ -2133,8 +2133,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
2133
2133
|
}
|
|
2134
2134
|
function toDotPath(_path) {
|
|
2135
2135
|
const segs = [];
|
|
2136
|
-
const
|
|
2137
|
-
for (const seg of
|
|
2136
|
+
const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
2137
|
+
for (const seg of path10) {
|
|
2138
2138
|
if (typeof seg === "number")
|
|
2139
2139
|
segs.push(`[${seg}]`);
|
|
2140
2140
|
else if (typeof seg === "symbol")
|
|
@@ -17063,8 +17063,8 @@ function rewriteKeyNames(ctx) {
|
|
|
17063
17063
|
bySchema.set(entry.schema, entry);
|
|
17064
17064
|
}
|
|
17065
17065
|
const rewrites = /* @__PURE__ */ new Map();
|
|
17066
|
-
for (const
|
|
17067
|
-
const seen = ctx.seen.get(
|
|
17066
|
+
for (const record4 of pendingRecords.get(ctx) ?? []) {
|
|
17067
|
+
const seen = ctx.seen.get(record4);
|
|
17068
17068
|
const names = (seen?.def ?? seen?.schema)?.propertyNames;
|
|
17069
17069
|
if (!names || names === true || rewrites.has(names))
|
|
17070
17070
|
continue;
|
|
@@ -19272,13 +19272,13 @@ function resolveRef(ref, ctx) {
|
|
|
19272
19272
|
if (!ref.startsWith("#")) {
|
|
19273
19273
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
19274
19274
|
}
|
|
19275
|
-
const
|
|
19276
|
-
if (
|
|
19275
|
+
const path10 = ref.slice(1).split("/").filter(Boolean);
|
|
19276
|
+
if (path10.length === 0) {
|
|
19277
19277
|
return ctx.rootSchema;
|
|
19278
19278
|
}
|
|
19279
19279
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
19280
|
-
if (
|
|
19281
|
-
const key =
|
|
19280
|
+
if (path10[0] === defsKey) {
|
|
19281
|
+
const key = path10[1] === void 0 ? void 0 : decodeJSONPointerSegment(path10[1]);
|
|
19282
19282
|
if (!key || !ctx.defs[key]) {
|
|
19283
19283
|
throw new Error(`Reference not found: ${ref}`);
|
|
19284
19284
|
}
|
|
@@ -20214,6 +20214,8 @@ var harnessIdSchema = opaqueIdSchema.brand();
|
|
|
20214
20214
|
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
20215
20215
|
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
20216
20216
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
20217
|
+
var HARNESS_THINKING_OPTION_ID_MAX_LENGTH = 128;
|
|
20218
|
+
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();
|
|
20217
20219
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
20218
20220
|
|
|
20219
20221
|
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
@@ -20295,6 +20297,126 @@ var threadHandoffResultSchema = external_exports.object({
|
|
|
20295
20297
|
handoff: threadHandoffMetadataSchema
|
|
20296
20298
|
}).strict();
|
|
20297
20299
|
|
|
20300
|
+
// ../../shared-contracts/dist/agent-role.js
|
|
20301
|
+
var roleSlugSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/u);
|
|
20302
|
+
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");
|
|
20303
|
+
var roleAccentColorSchema = external_exports.enum(["stone", "rose", "mist", "sage", "amber", "aqua"]);
|
|
20304
|
+
var BUILTIN_ROLE_AVATAR_IDS = [
|
|
20305
|
+
"pm-otter",
|
|
20306
|
+
"frontend-otter",
|
|
20307
|
+
"backend-otter",
|
|
20308
|
+
"reviewer-otter",
|
|
20309
|
+
"idea-otter",
|
|
20310
|
+
"researcher-otter",
|
|
20311
|
+
"writer-otter",
|
|
20312
|
+
"architect-otter",
|
|
20313
|
+
"debugger-otter",
|
|
20314
|
+
"tester-otter",
|
|
20315
|
+
"classic-otter",
|
|
20316
|
+
"ops-otter",
|
|
20317
|
+
"security-otter",
|
|
20318
|
+
"audio-otter",
|
|
20319
|
+
"scholar-otter",
|
|
20320
|
+
"data-otter",
|
|
20321
|
+
"advisor-otter",
|
|
20322
|
+
"builder-otter",
|
|
20323
|
+
"wizard-otter",
|
|
20324
|
+
"sailor-otter"
|
|
20325
|
+
];
|
|
20326
|
+
var builtinRoleAvatarSchema = external_exports.templateLiteral([
|
|
20327
|
+
"builtin:",
|
|
20328
|
+
external_exports.enum(BUILTIN_ROLE_AVATAR_IDS)
|
|
20329
|
+
]);
|
|
20330
|
+
var ROLE_AVATAR_FILENAME_PATTERN = /^[a-zA-Z0-9_-]{1,64}\.(png|jpg|jpeg|webp)$/u;
|
|
20331
|
+
var customRoleAvatarSchema = external_exports.templateLiteral([
|
|
20332
|
+
"custom:",
|
|
20333
|
+
external_exports.string().regex(ROLE_AVATAR_FILENAME_PATTERN)
|
|
20334
|
+
]);
|
|
20335
|
+
var catalogRoleAvatarSchema = external_exports.templateLiteral([
|
|
20336
|
+
"catalog:",
|
|
20337
|
+
external_exports.string().regex(ROLE_AVATAR_FILENAME_PATTERN)
|
|
20338
|
+
]);
|
|
20339
|
+
var roleAvatarSchema = external_exports.union([builtinRoleAvatarSchema, customRoleAvatarSchema]);
|
|
20340
|
+
var roleCatalogAvatarSchema = external_exports.union([builtinRoleAvatarSchema, catalogRoleAvatarSchema]);
|
|
20341
|
+
var saveRoleAvatarSchema = external_exports.union([roleAvatarSchema, catalogRoleAvatarSchema]);
|
|
20342
|
+
var httpsUrlSchema = external_exports.string().url().max(2048).refine((value) => /^https:\/\//i.test(value), "URL must use https://");
|
|
20343
|
+
var localizedRoleTextSchema = external_exports.object({
|
|
20344
|
+
en: external_exports.string().trim().min(1).max(2e3),
|
|
20345
|
+
"zh-CN": external_exports.string().trim().min(1).max(2e3)
|
|
20346
|
+
});
|
|
20347
|
+
var roleCatalogEntrySchema = external_exports.object({
|
|
20348
|
+
slug: roleSlugSchema,
|
|
20349
|
+
name: localizedRoleTextSchema,
|
|
20350
|
+
description: localizedRoleTextSchema,
|
|
20351
|
+
avatar: roleCatalogAvatarSchema,
|
|
20352
|
+
accentColor: roleAccentColorSchema,
|
|
20353
|
+
recommendedHarnessId: harnessIdSchema.optional(),
|
|
20354
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
20355
|
+
authorUrl: httpsUrlSchema.optional(),
|
|
20356
|
+
sourceUrl: httpsUrlSchema.optional(),
|
|
20357
|
+
license: external_exports.string().trim().min(1).max(64).optional(),
|
|
20358
|
+
official: external_exports.boolean().optional(),
|
|
20359
|
+
instructions: external_exports.string().trim().min(1).max(1e5),
|
|
20360
|
+
updatedAt: external_exports.iso.datetime()
|
|
20361
|
+
});
|
|
20362
|
+
var roleCatalogDocumentSchema = external_exports.object({
|
|
20363
|
+
formatVersion: external_exports.literal(1),
|
|
20364
|
+
generatedAt: external_exports.iso.datetime(),
|
|
20365
|
+
roles: external_exports.array(roleCatalogEntrySchema)
|
|
20366
|
+
});
|
|
20367
|
+
var roleIdentitySchema = external_exports.object({
|
|
20368
|
+
slug: roleSlugSchema,
|
|
20369
|
+
name: external_exports.string().refine((name) => name.trim().length > 0),
|
|
20370
|
+
avatar: roleAvatarSchema,
|
|
20371
|
+
accentColor: roleAccentColorSchema
|
|
20372
|
+
});
|
|
20373
|
+
var threadRoleSnapshotSchema = roleIdentitySchema.readonly();
|
|
20374
|
+
var agentRoleSchema = roleIdentitySchema.extend({
|
|
20375
|
+
description: external_exports.string(),
|
|
20376
|
+
harnessId: harnessIdSchema,
|
|
20377
|
+
model: roleModelSchema.optional(),
|
|
20378
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
20379
|
+
instructions: external_exports.string(),
|
|
20380
|
+
updatedAt: external_exports.iso.datetime()
|
|
20381
|
+
});
|
|
20382
|
+
var saveAgentRoleInputSchema = agentRoleSchema.omit({ updatedAt: true, avatar: true }).extend({ avatar: saveRoleAvatarSchema }).partial({ slug: true });
|
|
20383
|
+
var ROLES_LIST_METHOD = "codexhost/roles/list";
|
|
20384
|
+
var ROLES_GET_METHOD = "codexhost/roles/get";
|
|
20385
|
+
var ROLES_SAVE_METHOD = "codexhost/roles/save";
|
|
20386
|
+
var ROLES_DELETE_METHOD = "codexhost/roles/delete";
|
|
20387
|
+
var ROLES_CATALOG_METHOD = "codexhost/roles/catalog";
|
|
20388
|
+
var ROLES_LIKE_METHOD = "codexhost/roles/like";
|
|
20389
|
+
var ROLE_LIKES_MAX_PER_ROLE = 5;
|
|
20390
|
+
var rolesListParamsSchema = external_exports.object({
|
|
20391
|
+
locale: external_exports.string().trim().min(1).max(64).optional()
|
|
20392
|
+
});
|
|
20393
|
+
var rolesListResultSchema = external_exports.object({ roles: external_exports.array(agentRoleSchema) });
|
|
20394
|
+
var rolesGetParamsSchema = external_exports.object({ slug: roleSlugSchema });
|
|
20395
|
+
var rolesGetResultSchema = external_exports.object({ role: agentRoleSchema.nullable() });
|
|
20396
|
+
var rolesSaveResultSchema = external_exports.object({ role: agentRoleSchema });
|
|
20397
|
+
var rolesDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
|
|
20398
|
+
var rolesCatalogParamsSchema = external_exports.object({
|
|
20399
|
+
refresh: external_exports.boolean().optional()
|
|
20400
|
+
});
|
|
20401
|
+
var rolesCatalogResultSchema = external_exports.object({
|
|
20402
|
+
roles: external_exports.array(roleCatalogEntrySchema),
|
|
20403
|
+
fetchedAt: external_exports.iso.datetime(),
|
|
20404
|
+
likes: external_exports.record(roleSlugSchema, external_exports.number().int().nonnegative()).optional(),
|
|
20405
|
+
myLikes: external_exports.record(roleSlugSchema, external_exports.number().int().min(0).max(ROLE_LIKES_MAX_PER_ROLE)).optional(),
|
|
20406
|
+
stale: external_exports.boolean().optional(),
|
|
20407
|
+
error: external_exports.string().optional()
|
|
20408
|
+
});
|
|
20409
|
+
var rolesLikeParamsSchema = external_exports.object({
|
|
20410
|
+
slug: roleSlugSchema
|
|
20411
|
+
});
|
|
20412
|
+
var rolesLikeResultSchema = external_exports.object({
|
|
20413
|
+
slug: roleSlugSchema,
|
|
20414
|
+
likes: external_exports.number().int().nonnegative(),
|
|
20415
|
+
myLikes: external_exports.number().int().min(0).max(ROLE_LIKES_MAX_PER_ROLE),
|
|
20416
|
+
maxLikes: external_exports.literal(ROLE_LIKES_MAX_PER_ROLE),
|
|
20417
|
+
limitReached: external_exports.boolean().optional()
|
|
20418
|
+
});
|
|
20419
|
+
|
|
20298
20420
|
// ../../shared-contracts/dist/thread-usage.js
|
|
20299
20421
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
20300
20422
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -20476,7 +20598,6 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
20476
20598
|
// ../../shared-contracts/dist/harness-models.js
|
|
20477
20599
|
var HARNESS_MODEL_REF_MAX_LENGTH = 512;
|
|
20478
20600
|
var HARNESS_MODEL_LABEL_MAX_LENGTH = 256;
|
|
20479
|
-
var HARNESS_THINKING_OPTION_ID_MAX_LENGTH = 128;
|
|
20480
20601
|
var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
20481
20602
|
var nonBlankTextSchema3 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
20482
20603
|
message: "Value must not be empty or whitespace"
|
|
@@ -20490,7 +20611,6 @@ var harnessModelRefSchema = external_exports.object({
|
|
|
20490
20611
|
function sameHarnessModelRef(left, right) {
|
|
20491
20612
|
return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
|
|
20492
20613
|
}
|
|
20493
|
-
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();
|
|
20494
20614
|
var harnessResolvedModelLabelSchema = nonBlankTextSchema3.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
20495
20615
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
20496
20616
|
id: harnessThinkingOptionIdSchema,
|
|
@@ -20703,8 +20823,10 @@ var codexThreadInspectionSchema = external_exports.object({
|
|
|
20703
20823
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
20704
20824
|
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
20705
20825
|
supportsThreadReferences: external_exports.literal(true).optional(),
|
|
20706
|
-
handoff: threadHandoffMetadataSchema.optional()
|
|
20707
|
-
|
|
20826
|
+
handoff: threadHandoffMetadataSchema.optional(),
|
|
20827
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
20828
|
+
nativeSessionRef: external_exports.never().optional()
|
|
20829
|
+
});
|
|
20708
20830
|
var externalThreadInspectionSchema = external_exports.object({
|
|
20709
20831
|
owner: external_exports.literal("external"),
|
|
20710
20832
|
harnessId: nonBlankTextSchema3.max(256),
|
|
@@ -20719,8 +20841,10 @@ var externalThreadInspectionSchema = external_exports.object({
|
|
|
20719
20841
|
history: harnessHistoryCapabilitiesSchema,
|
|
20720
20842
|
usage: threadUsageSnapshotSchema.optional(),
|
|
20721
20843
|
handoff: threadHandoffMetadataSchema.optional(),
|
|
20844
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
20845
|
+
nativeSessionRef: external_exports.never().optional(),
|
|
20722
20846
|
locked: external_exports.literal(true)
|
|
20723
|
-
})
|
|
20847
|
+
});
|
|
20724
20848
|
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
20725
20849
|
codexThreadInspectionSchema,
|
|
20726
20850
|
externalThreadInspectionSchema
|
|
@@ -20963,7 +21087,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
|
|
|
20963
21087
|
default: external_exports.string().optional()
|
|
20964
21088
|
})
|
|
20965
21089
|
]).superRefine((field2, ctx) => {
|
|
20966
|
-
const issue2 = (
|
|
21090
|
+
const issue2 = (path10, message3) => ctx.addIssue({ code: "custom", path: [path10], message: message3 });
|
|
20967
21091
|
if (field2.type === "number" || field2.type === "range") {
|
|
20968
21092
|
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
20969
21093
|
if (min > max)
|
|
@@ -21069,16 +21193,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
|
|
|
21069
21193
|
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
21070
21194
|
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
21071
21195
|
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
21072
|
-
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((
|
|
21196
|
+
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((path10) => path10.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
21073
21197
|
var legacy = desktopExtensionManifestSchema.shape;
|
|
21074
21198
|
var localized = (max, min = 0) => external_exports.strictObject({
|
|
21075
21199
|
en: external_exports.string().trim().min(min).max(max),
|
|
21076
21200
|
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
21077
21201
|
});
|
|
21078
|
-
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((
|
|
21202
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path10) => path10.endsWith(suffix), `Expected a ${suffix} file`);
|
|
21079
21203
|
var moduleEntry = resourceWithSuffix(".mjs");
|
|
21080
21204
|
var style = resourceWithSuffix(".css").optional();
|
|
21081
|
-
var hostExtensionCanonicalPath = (
|
|
21205
|
+
var hostExtensionCanonicalPath = (path10) => path10.normalize("NFC").toLowerCase();
|
|
21082
21206
|
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
21083
21207
|
manifestVersion: external_exports.literal(2),
|
|
21084
21208
|
id: hostExtensionIdSchema,
|
|
@@ -21088,8 +21212,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
|
21088
21212
|
details: localized(16384).optional(),
|
|
21089
21213
|
author: legacy.author,
|
|
21090
21214
|
repository: legacy.repository,
|
|
21091
|
-
icon: legacy.icon.refine((
|
|
21092
|
-
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((
|
|
21215
|
+
icon: legacy.icon.refine((path10) => path10 === void 0 || hostExtensionResourcePathSchema.safeParse(path10).success),
|
|
21216
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path10) => hostExtensionResourcePathSchema.safeParse(path10).success)),
|
|
21093
21217
|
categories: legacy.categories,
|
|
21094
21218
|
settingsSchema: legacy.settingsSchema,
|
|
21095
21219
|
slots: legacy.slots.removeDefault().optional(),
|
|
@@ -21123,6 +21247,9 @@ var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
|
|
|
21123
21247
|
// ../../shared-contracts/dist/thread-tree-watch.js
|
|
21124
21248
|
var THREAD_TREE_MAX_NODES = 5e3;
|
|
21125
21249
|
var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
|
|
21250
|
+
var threadTreeDelegationSchema = external_exports.object({
|
|
21251
|
+
createdAtMs: external_exports.number().int().nonnegative()
|
|
21252
|
+
});
|
|
21126
21253
|
var threadTreeHandoffSchema = external_exports.strictObject({
|
|
21127
21254
|
sourceThreadId: hostThreadIdSchema,
|
|
21128
21255
|
createdAtMs: external_exports.number().int().nonnegative()
|
|
@@ -21134,13 +21261,14 @@ var threadTreeNodeSchema = external_exports.strictObject({
|
|
|
21134
21261
|
archived: external_exports.boolean(),
|
|
21135
21262
|
updatedAtMs: external_exports.number().int().nonnegative().optional()
|
|
21136
21263
|
});
|
|
21137
|
-
var threadTreeSnapshotSchema = external_exports.
|
|
21264
|
+
var threadTreeSnapshotSchema = external_exports.object({
|
|
21138
21265
|
revision: external_exports.int().nonnegative(),
|
|
21139
21266
|
parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
|
|
21267
|
+
delegations: external_exports.record(hostThreadIdSchema, threadTreeDelegationSchema).optional(),
|
|
21140
21268
|
handoffs: external_exports.record(hostThreadIdSchema, threadTreeHandoffSchema).optional(),
|
|
21141
21269
|
nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
|
|
21142
21270
|
truncated: external_exports.boolean()
|
|
21143
|
-
}).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");
|
|
21271
|
+
}).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");
|
|
21144
21272
|
var subscriptionId = external_exports.string().min(1).max(128);
|
|
21145
21273
|
var threadTreeWatchParamsSchema = external_exports.strictObject({});
|
|
21146
21274
|
var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
|
|
@@ -21211,7 +21339,7 @@ var active = {
|
|
|
21211
21339
|
digest: hostExtensionDigestSchema
|
|
21212
21340
|
};
|
|
21213
21341
|
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
21214
|
-
var filePath = external_exports.string().min(1).max(4096).refine((
|
|
21342
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path10) => /^(?:\/|[a-z]:[/\\])/iu.test(path10) && !path10.includes("\0") && !path10.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
21215
21343
|
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");
|
|
21216
21344
|
function base643(maxBytes) {
|
|
21217
21345
|
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
@@ -21408,6 +21536,298 @@ var hostExtensionsRpcSchemas = {
|
|
|
21408
21536
|
}
|
|
21409
21537
|
};
|
|
21410
21538
|
|
|
21539
|
+
// ../../shared-contracts/dist/group-chat.js
|
|
21540
|
+
var DEFAULT_GROUP_MAX_AGENT_HOPS = 5;
|
|
21541
|
+
var MAX_GROUP_AGENT_HOPS = 20;
|
|
21542
|
+
var GROUP_NOTICE_MAX_LENGTH = 2e3;
|
|
21543
|
+
var remoteGroupRoomIdSchema = external_exports.string().regex(/^remote:[A-Za-z0-9_-]{8,512}$/u);
|
|
21544
|
+
var groupRoomIdSchema = external_exports.union([external_exports.uuidv4(), remoteGroupRoomIdSchema]);
|
|
21545
|
+
var groupMemberIdSchema = external_exports.uuidv4();
|
|
21546
|
+
var groupMemberHandleSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/u);
|
|
21547
|
+
var groupUnmentionedPolicySchema = external_exports.enum(["none", "last_speaker", "all"]);
|
|
21548
|
+
var groupMemberStatusSchema = external_exports.enum(["active", "muted", "removed"]);
|
|
21549
|
+
var nonnegativeInteger = external_exports.int().nonnegative();
|
|
21550
|
+
var positiveInteger = external_exports.int().positive();
|
|
21551
|
+
var maxAgentHopsSchema = positiveInteger.max(MAX_GROUP_AGENT_HOPS);
|
|
21552
|
+
var nonblankString = external_exports.string().refine((value) => value.trim().length > 0);
|
|
21553
|
+
var timestamp = external_exports.iso.datetime();
|
|
21554
|
+
var optionalMemberEdits = {
|
|
21555
|
+
handle: groupMemberHandleSchema.optional(),
|
|
21556
|
+
displayName: nonblankString.optional(),
|
|
21557
|
+
note: external_exports.string().optional()
|
|
21558
|
+
};
|
|
21559
|
+
var groupMemberSchema = external_exports.object({
|
|
21560
|
+
memberId: groupMemberIdSchema,
|
|
21561
|
+
threadId: hostThreadIdSchema,
|
|
21562
|
+
handle: groupMemberHandleSchema,
|
|
21563
|
+
displayName: nonblankString,
|
|
21564
|
+
note: external_exports.string().optional(),
|
|
21565
|
+
roleSlug: roleSlugSchema.optional(),
|
|
21566
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
21567
|
+
harnessId: harnessIdSchema,
|
|
21568
|
+
status: groupMemberStatusSchema,
|
|
21569
|
+
projectless: external_exports.boolean().optional(),
|
|
21570
|
+
joinedAtSeq: nonnegativeInteger,
|
|
21571
|
+
lastDeliveredSeq: nonnegativeInteger,
|
|
21572
|
+
lastRosterVersion: nonnegativeInteger,
|
|
21573
|
+
createdAt: timestamp
|
|
21574
|
+
});
|
|
21575
|
+
var groupProjectlessWorkspaceSchema = external_exports.object({
|
|
21576
|
+
workspaceRoot: nonblankString,
|
|
21577
|
+
outputDirectory: nonblankString
|
|
21578
|
+
});
|
|
21579
|
+
var groupRoomRemoteHostSchema = external_exports.object({
|
|
21580
|
+
hostId: nonblankString,
|
|
21581
|
+
displayName: nonblankString,
|
|
21582
|
+
state: nonblankString.optional(),
|
|
21583
|
+
color: external_exports.string().optional(),
|
|
21584
|
+
filePreview: external_exports.boolean().optional()
|
|
21585
|
+
});
|
|
21586
|
+
var groupRoomSchema = external_exports.object({
|
|
21587
|
+
roomId: groupRoomIdSchema,
|
|
21588
|
+
title: nonblankString,
|
|
21589
|
+
defaultCwd: nonblankString,
|
|
21590
|
+
projectlessWorkspace: groupProjectlessWorkspaceSchema.optional(),
|
|
21591
|
+
unmentionedPolicy: groupUnmentionedPolicySchema.default("none"),
|
|
21592
|
+
allowAgentMentions: external_exports.boolean().default(true),
|
|
21593
|
+
maxAgentHops: maxAgentHopsSchema.default(DEFAULT_GROUP_MAX_AGENT_HOPS),
|
|
21594
|
+
lastSeq: nonnegativeInteger,
|
|
21595
|
+
lastSpeakerMemberId: groupMemberIdSchema.optional(),
|
|
21596
|
+
rosterVersion: nonnegativeInteger,
|
|
21597
|
+
humanEpoch: nonnegativeInteger,
|
|
21598
|
+
relayPaused: external_exports.boolean(),
|
|
21599
|
+
pinned: external_exports.boolean(),
|
|
21600
|
+
createdAt: timestamp,
|
|
21601
|
+
updatedAt: timestamp,
|
|
21602
|
+
members: external_exports.array(groupMemberSchema),
|
|
21603
|
+
remote: groupRoomRemoteHostSchema.optional()
|
|
21604
|
+
}).superRefine(({ members: members2 }, context) => {
|
|
21605
|
+
const handles = /* @__PURE__ */ new Set();
|
|
21606
|
+
for (const [index, { handle, status }] of members2.entries()) {
|
|
21607
|
+
if (status === "removed")
|
|
21608
|
+
continue;
|
|
21609
|
+
if (handles.has(handle)) {
|
|
21610
|
+
context.addIssue({
|
|
21611
|
+
code: "custom",
|
|
21612
|
+
path: ["members", index, "handle"],
|
|
21613
|
+
message: "Handle must be unique among non-removed members"
|
|
21614
|
+
});
|
|
21615
|
+
}
|
|
21616
|
+
handles.add(handle);
|
|
21617
|
+
}
|
|
21618
|
+
});
|
|
21619
|
+
var groupAttachmentSchema = external_exports.object({
|
|
21620
|
+
kind: external_exports.enum(["image", "file"]),
|
|
21621
|
+
attachmentId: nonblankString.max(256),
|
|
21622
|
+
name: nonblankString.max(256),
|
|
21623
|
+
path: nonblankString.max(4096),
|
|
21624
|
+
bytes: nonnegativeInteger,
|
|
21625
|
+
mediaType: nonblankString.max(128).optional(),
|
|
21626
|
+
width: positiveInteger.optional(),
|
|
21627
|
+
height: positiveInteger.optional()
|
|
21628
|
+
});
|
|
21629
|
+
var groupMessageSchema = external_exports.object({
|
|
21630
|
+
roomId: groupRoomIdSchema,
|
|
21631
|
+
seq: positiveInteger,
|
|
21632
|
+
messageId: nonblankString,
|
|
21633
|
+
senderType: external_exports.enum(["user", "agent", "system"]),
|
|
21634
|
+
senderMemberId: groupMemberIdSchema.optional(),
|
|
21635
|
+
senderHandle: groupMemberHandleSchema.optional(),
|
|
21636
|
+
senderName: external_exports.string().optional(),
|
|
21637
|
+
senderThreadId: hostThreadIdSchema.optional(),
|
|
21638
|
+
sourceTurnId: nonblankString.optional(),
|
|
21639
|
+
replyToSeq: positiveInteger.optional(),
|
|
21640
|
+
content: external_exports.string(),
|
|
21641
|
+
attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
|
|
21642
|
+
mentionedMemberIds: external_exports.array(groupMemberIdSchema),
|
|
21643
|
+
mentionAll: external_exports.boolean().optional(),
|
|
21644
|
+
hopCount: nonnegativeInteger,
|
|
21645
|
+
createdAt: timestamp
|
|
21646
|
+
});
|
|
21647
|
+
var newThreadOptions = {
|
|
21648
|
+
...optionalMemberEdits,
|
|
21649
|
+
model: roleModelSchema.optional(),
|
|
21650
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
21651
|
+
worktree: external_exports.boolean().optional()
|
|
21652
|
+
};
|
|
21653
|
+
var groupCreateMemberInputSchema = external_exports.discriminatedUnion("kind", [
|
|
21654
|
+
external_exports.strictObject({ kind: external_exports.literal("role"), roleSlug: roleSlugSchema, ...newThreadOptions }),
|
|
21655
|
+
external_exports.strictObject({ kind: external_exports.literal("harness"), harnessId: harnessIdSchema, ...newThreadOptions }),
|
|
21656
|
+
external_exports.strictObject({
|
|
21657
|
+
kind: external_exports.literal("existing"),
|
|
21658
|
+
threadId: hostThreadIdSchema,
|
|
21659
|
+
...optionalMemberEdits,
|
|
21660
|
+
includeRecentHistory: external_exports.boolean().default(true).optional()
|
|
21661
|
+
})
|
|
21662
|
+
]);
|
|
21663
|
+
var GROUPS_LIST_METHOD = "codexhost/groups/list";
|
|
21664
|
+
var GROUPS_GET_METHOD = "codexhost/groups/get";
|
|
21665
|
+
var GROUPS_CREATE_METHOD = "codexhost/groups/create";
|
|
21666
|
+
var GROUPS_UPDATE_METHOD = "codexhost/groups/update";
|
|
21667
|
+
var GROUPS_DELETE_METHOD = "codexhost/groups/delete";
|
|
21668
|
+
var GROUPS_ADD_MEMBER_METHOD = "codexhost/groups/member/add";
|
|
21669
|
+
var GROUPS_UPDATE_MEMBER_METHOD = "codexhost/groups/member/update";
|
|
21670
|
+
var GROUPS_REMOVE_MEMBER_METHOD = "codexhost/groups/member/remove";
|
|
21671
|
+
var GROUPS_REBIND_MEMBER_METHOD = "codexhost/groups/member/rebind";
|
|
21672
|
+
var GROUPS_POST_MESSAGE_METHOD = "codexhost/groups/message/post";
|
|
21673
|
+
var GROUPS_READ_MESSAGES_METHOD = "codexhost/groups/messages/read";
|
|
21674
|
+
var GROUPS_INSPECT_CWD_METHOD = "codexhost/groups/cwd/inspect";
|
|
21675
|
+
var roomIdentity = { roomId: groupRoomIdSchema };
|
|
21676
|
+
var memberIdentity = { ...roomIdentity, memberId: groupMemberIdSchema };
|
|
21677
|
+
var roomEdits = {
|
|
21678
|
+
title: nonblankString.optional(),
|
|
21679
|
+
unmentionedPolicy: groupUnmentionedPolicySchema.optional(),
|
|
21680
|
+
allowAgentMentions: external_exports.boolean().optional(),
|
|
21681
|
+
maxAgentHops: maxAgentHopsSchema.optional()
|
|
21682
|
+
};
|
|
21683
|
+
var groupsListParamsSchema = external_exports.strictObject({});
|
|
21684
|
+
var groupsListResultSchema = external_exports.object({ rooms: external_exports.array(groupRoomSchema) });
|
|
21685
|
+
var groupsGetParamsSchema = external_exports.strictObject({
|
|
21686
|
+
...roomIdentity,
|
|
21687
|
+
limit: positiveInteger.optional(),
|
|
21688
|
+
beforeSeq: positiveInteger.optional()
|
|
21689
|
+
});
|
|
21690
|
+
var groupsGetResultSchema = external_exports.object({
|
|
21691
|
+
room: groupRoomSchema.nullable(),
|
|
21692
|
+
messages: external_exports.array(groupMessageSchema),
|
|
21693
|
+
hasMore: external_exports.boolean()
|
|
21694
|
+
});
|
|
21695
|
+
var groupsCreateParamsSchema = external_exports.strictObject({
|
|
21696
|
+
...roomEdits,
|
|
21697
|
+
defaultCwd: nonblankString.optional(),
|
|
21698
|
+
members: external_exports.array(groupCreateMemberInputSchema)
|
|
21699
|
+
});
|
|
21700
|
+
var groupsCreateResultSchema = external_exports.object({ room: groupRoomSchema });
|
|
21701
|
+
var groupsUpdateParamsSchema = external_exports.strictObject({
|
|
21702
|
+
...roomIdentity,
|
|
21703
|
+
...roomEdits,
|
|
21704
|
+
pinned: external_exports.boolean().optional(),
|
|
21705
|
+
relayPaused: external_exports.boolean().optional()
|
|
21706
|
+
});
|
|
21707
|
+
var groupsDeleteParamsSchema = external_exports.strictObject(roomIdentity);
|
|
21708
|
+
var groupsDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
|
|
21709
|
+
var groupsAddMemberParamsSchema = external_exports.strictObject({
|
|
21710
|
+
...roomIdentity,
|
|
21711
|
+
member: groupCreateMemberInputSchema
|
|
21712
|
+
});
|
|
21713
|
+
var groupsAddMemberResultSchema = external_exports.object({
|
|
21714
|
+
room: groupRoomSchema,
|
|
21715
|
+
member: groupMemberSchema
|
|
21716
|
+
});
|
|
21717
|
+
var groupsUpdateMemberParamsSchema = external_exports.strictObject({
|
|
21718
|
+
...memberIdentity,
|
|
21719
|
+
...optionalMemberEdits,
|
|
21720
|
+
status: groupMemberStatusSchema.optional()
|
|
21721
|
+
});
|
|
21722
|
+
var groupsRemoveMemberParamsSchema = external_exports.strictObject(memberIdentity);
|
|
21723
|
+
var groupsRebindMemberParamsSchema = external_exports.strictObject({
|
|
21724
|
+
...memberIdentity,
|
|
21725
|
+
threadId: hostThreadIdSchema,
|
|
21726
|
+
redeliverFrom: positiveInteger.optional(),
|
|
21727
|
+
note: external_exports.string().optional()
|
|
21728
|
+
});
|
|
21729
|
+
var groupCliRebindMemberParamsSchema = external_exports.strictObject({
|
|
21730
|
+
...roomIdentity,
|
|
21731
|
+
memberId: groupMemberIdSchema.optional(),
|
|
21732
|
+
memberHandle: groupMemberHandleSchema.optional(),
|
|
21733
|
+
threadId: hostThreadIdSchema,
|
|
21734
|
+
redeliverFrom: positiveInteger.optional(),
|
|
21735
|
+
note: external_exports.string().optional()
|
|
21736
|
+
}).refine((value) => value.memberId !== void 0 !== (value.memberHandle !== void 0), "Provide exactly one of memberId or memberHandle");
|
|
21737
|
+
var groupsRebindMemberResultSchema = external_exports.object({
|
|
21738
|
+
room: groupRoomSchema,
|
|
21739
|
+
member: groupMemberSchema,
|
|
21740
|
+
previousThreadId: hostThreadIdSchema,
|
|
21741
|
+
awakened: external_exports.boolean()
|
|
21742
|
+
});
|
|
21743
|
+
var groupCliListMemberSchema = external_exports.object({
|
|
21744
|
+
memberId: groupMemberIdSchema,
|
|
21745
|
+
threadId: hostThreadIdSchema,
|
|
21746
|
+
handle: groupMemberHandleSchema,
|
|
21747
|
+
displayName: nonblankString,
|
|
21748
|
+
status: groupMemberStatusSchema,
|
|
21749
|
+
harnessId: harnessIdSchema,
|
|
21750
|
+
roleSlug: roleSlugSchema.optional(),
|
|
21751
|
+
roleName: nonblankString.optional()
|
|
21752
|
+
});
|
|
21753
|
+
var groupCliListEntrySchema = external_exports.object({
|
|
21754
|
+
roomId: groupRoomIdSchema,
|
|
21755
|
+
title: nonblankString,
|
|
21756
|
+
memberCount: nonnegativeInteger,
|
|
21757
|
+
updatedAt: timestamp,
|
|
21758
|
+
member: groupCliListMemberSchema.optional()
|
|
21759
|
+
});
|
|
21760
|
+
var groupCliListParamsSchema = external_exports.strictObject({
|
|
21761
|
+
threadId: hostThreadIdSchema.optional()
|
|
21762
|
+
});
|
|
21763
|
+
var groupCliListResultSchema = external_exports.object({
|
|
21764
|
+
rooms: external_exports.array(groupCliListEntrySchema)
|
|
21765
|
+
});
|
|
21766
|
+
var groupsPostMessageParamsSchema = external_exports.strictObject({
|
|
21767
|
+
...roomIdentity,
|
|
21768
|
+
content: external_exports.string().max(64e3),
|
|
21769
|
+
attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
|
|
21770
|
+
replyToSeq: positiveInteger.optional(),
|
|
21771
|
+
targetMemberIds: external_exports.array(groupMemberIdSchema).optional(),
|
|
21772
|
+
mentionAll: external_exports.boolean().optional(),
|
|
21773
|
+
notice: external_exports.boolean().optional()
|
|
21774
|
+
}).superRefine((value, context) => {
|
|
21775
|
+
if (value.notice === true) {
|
|
21776
|
+
if (value.content.trim().length === 0) {
|
|
21777
|
+
context.addIssue({
|
|
21778
|
+
code: "custom",
|
|
21779
|
+
path: ["content"],
|
|
21780
|
+
message: "Notice content is required"
|
|
21781
|
+
});
|
|
21782
|
+
}
|
|
21783
|
+
if (value.content.length > GROUP_NOTICE_MAX_LENGTH) {
|
|
21784
|
+
context.addIssue({
|
|
21785
|
+
code: "custom",
|
|
21786
|
+
path: ["content"],
|
|
21787
|
+
message: `Notice content must be at most ${GROUP_NOTICE_MAX_LENGTH} characters`
|
|
21788
|
+
});
|
|
21789
|
+
}
|
|
21790
|
+
if ((value.targetMemberIds?.length ?? 0) > 0 || value.mentionAll === true || (value.attachments?.length ?? 0) > 0) {
|
|
21791
|
+
context.addIssue({
|
|
21792
|
+
code: "custom",
|
|
21793
|
+
path: ["notice"],
|
|
21794
|
+
message: "System notices cannot target members or include attachments"
|
|
21795
|
+
});
|
|
21796
|
+
}
|
|
21797
|
+
return;
|
|
21798
|
+
}
|
|
21799
|
+
if (value.content.trim().length === 0 && (value.attachments?.length ?? 0) === 0) {
|
|
21800
|
+
context.addIssue({
|
|
21801
|
+
code: "custom",
|
|
21802
|
+
path: ["content"],
|
|
21803
|
+
message: "Message content or at least one attachment is required"
|
|
21804
|
+
});
|
|
21805
|
+
}
|
|
21806
|
+
});
|
|
21807
|
+
var groupsPostMessageResultSchema = external_exports.object({
|
|
21808
|
+
room: groupRoomSchema,
|
|
21809
|
+
message: groupMessageSchema,
|
|
21810
|
+
awakenedMemberIds: external_exports.array(groupMemberIdSchema)
|
|
21811
|
+
});
|
|
21812
|
+
var groupsReadMessagesParamsSchema = external_exports.strictObject({
|
|
21813
|
+
...roomIdentity,
|
|
21814
|
+
fromSeq: positiveInteger.optional(),
|
|
21815
|
+
toSeq: positiveInteger.optional(),
|
|
21816
|
+
limit: positiveInteger.optional()
|
|
21817
|
+
});
|
|
21818
|
+
var groupsReadMessagesResultSchema = external_exports.object({
|
|
21819
|
+
...roomIdentity,
|
|
21820
|
+
messages: external_exports.array(groupMessageSchema),
|
|
21821
|
+
totalSeq: nonnegativeInteger
|
|
21822
|
+
});
|
|
21823
|
+
var groupsInspectCwdParamsSchema = external_exports.strictObject({
|
|
21824
|
+
cwd: nonblankString,
|
|
21825
|
+
roomId: groupRoomIdSchema.optional()
|
|
21826
|
+
});
|
|
21827
|
+
var groupsInspectCwdResultSchema = external_exports.object({
|
|
21828
|
+
isGitRepo: external_exports.boolean()
|
|
21829
|
+
});
|
|
21830
|
+
|
|
21411
21831
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
21412
21832
|
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
21413
21833
|
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
@@ -21453,6 +21873,7 @@ var TELEMETRY_OFFICIAL_HARNESSES = [
|
|
|
21453
21873
|
"kiro-cli",
|
|
21454
21874
|
"codebuddy",
|
|
21455
21875
|
"workbuddy",
|
|
21876
|
+
"workbuddy-cn",
|
|
21456
21877
|
"devin",
|
|
21457
21878
|
"hermes",
|
|
21458
21879
|
"qoder",
|
|
@@ -21578,6 +21999,24 @@ var clientThreadSectionMutationResultSchema = external_exports.discriminatedUnio
|
|
|
21578
21999
|
]);
|
|
21579
22000
|
var CLIENT_CHANNEL_METHODS = [
|
|
21580
22001
|
"codexhost/skills/list",
|
|
22002
|
+
ROLES_LIST_METHOD,
|
|
22003
|
+
ROLES_GET_METHOD,
|
|
22004
|
+
ROLES_SAVE_METHOD,
|
|
22005
|
+
ROLES_DELETE_METHOD,
|
|
22006
|
+
ROLES_CATALOG_METHOD,
|
|
22007
|
+
ROLES_LIKE_METHOD,
|
|
22008
|
+
GROUPS_LIST_METHOD,
|
|
22009
|
+
GROUPS_GET_METHOD,
|
|
22010
|
+
GROUPS_CREATE_METHOD,
|
|
22011
|
+
GROUPS_UPDATE_METHOD,
|
|
22012
|
+
GROUPS_DELETE_METHOD,
|
|
22013
|
+
GROUPS_ADD_MEMBER_METHOD,
|
|
22014
|
+
GROUPS_UPDATE_MEMBER_METHOD,
|
|
22015
|
+
GROUPS_REMOVE_MEMBER_METHOD,
|
|
22016
|
+
GROUPS_REBIND_MEMBER_METHOD,
|
|
22017
|
+
GROUPS_POST_MESSAGE_METHOD,
|
|
22018
|
+
GROUPS_READ_MESSAGES_METHOD,
|
|
22019
|
+
GROUPS_INSPECT_CWD_METHOD,
|
|
21581
22020
|
"codexhost/voice/status",
|
|
21582
22021
|
"codexhost/voice/transcribe",
|
|
21583
22022
|
"codexhost/harness/display-settings/get",
|
|
@@ -21739,6 +22178,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
21739
22178
|
}),
|
|
21740
22179
|
external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
|
|
21741
22180
|
external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
|
|
22181
|
+
external_exports.object({
|
|
22182
|
+
type: external_exports.literal("groups-changed"),
|
|
22183
|
+
cursor: clientChannelCursorSchema,
|
|
22184
|
+
roomId: external_exports.string().optional()
|
|
22185
|
+
}),
|
|
21742
22186
|
external_exports.object({
|
|
21743
22187
|
type: external_exports.literal("preferences-changed"),
|
|
21744
22188
|
cursor: clientChannelCursorSchema,
|
|
@@ -21872,6 +22316,7 @@ var clientThreadSnapshotSchema = external_exports.object({
|
|
|
21872
22316
|
status: external_exports.object({ type: external_exports.string() }).passthrough(),
|
|
21873
22317
|
name: external_exports.string().nullable().optional(),
|
|
21874
22318
|
preview: external_exports.string().optional(),
|
|
22319
|
+
roleSnapshot: threadRoleSnapshotSchema.optional(),
|
|
21875
22320
|
codexhostImportSource: clientThreadImportSourceSchema.optional(),
|
|
21876
22321
|
turns: external_exports.array(clientTurnSchema).length(0)
|
|
21877
22322
|
}).passthrough(),
|
|
@@ -22136,7 +22581,23 @@ var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
|
|
|
22136
22581
|
var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
22137
22582
|
var remotePeerNodeIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
22138
22583
|
var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
|
|
22139
|
-
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
|
|
22584
|
+
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "ssh", "custom"]);
|
|
22585
|
+
var remotePeerSshAuthModeSchema = external_exports.enum(["auto", "key", "password"]);
|
|
22586
|
+
var remotePeerSshConfigSchema = external_exports.object({
|
|
22587
|
+
host: external_exports.string().trim().min(1).max(255),
|
|
22588
|
+
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
22589
|
+
user: external_exports.string().trim().min(1).max(128).optional(),
|
|
22590
|
+
identityFile: external_exports.string().trim().min(1).max(1024).optional(),
|
|
22591
|
+
authMode: remotePeerSshAuthModeSchema.default("auto"),
|
|
22592
|
+
remoteDataDir: external_exports.string().trim().min(1).max(1024).optional()
|
|
22593
|
+
});
|
|
22594
|
+
var remotePeerSshSummarySchema = external_exports.object({
|
|
22595
|
+
host: external_exports.string().min(1).max(255),
|
|
22596
|
+
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
22597
|
+
user: external_exports.string().min(1).max(128).optional(),
|
|
22598
|
+
authMode: remotePeerSshAuthModeSchema,
|
|
22599
|
+
keyInstalled: external_exports.boolean().optional()
|
|
22600
|
+
});
|
|
22140
22601
|
var REMOTE_PEER_COLORS = [
|
|
22141
22602
|
"blue",
|
|
22142
22603
|
"purple",
|
|
@@ -22163,6 +22624,7 @@ var remotePeerSummarySchema = external_exports.object({
|
|
|
22163
22624
|
color: remotePeerColorSchema.optional(),
|
|
22164
22625
|
origin: external_exports.string().min(1).max(2048),
|
|
22165
22626
|
transportKind: remotePeerTransportKindSchema,
|
|
22627
|
+
ssh: remotePeerSshSummarySchema.optional(),
|
|
22166
22628
|
encrypted: external_exports.boolean(),
|
|
22167
22629
|
enabled: external_exports.boolean(),
|
|
22168
22630
|
state: remotePeerStateSchema,
|
|
@@ -22410,8 +22872,66 @@ var delegationHostHarnessOptionSchema = external_exports.object({
|
|
|
22410
22872
|
var delegationHostHarnessesResultSchema = external_exports.object({
|
|
22411
22873
|
harnesses: external_exports.array(delegationHostHarnessOptionSchema)
|
|
22412
22874
|
});
|
|
22875
|
+
var sshConfigHostEntrySchema = external_exports.object({
|
|
22876
|
+
alias: external_exports.string().min(1).max(255),
|
|
22877
|
+
hostName: external_exports.string().max(255).optional(),
|
|
22878
|
+
user: external_exports.string().max(128).optional(),
|
|
22879
|
+
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
22880
|
+
identityFile: external_exports.string().max(1024).optional()
|
|
22881
|
+
});
|
|
22882
|
+
var remotePeerListSshConfigHostsResultSchema = external_exports.object({
|
|
22883
|
+
hosts: external_exports.array(sshConfigHostEntrySchema)
|
|
22884
|
+
});
|
|
22885
|
+
var remotePeerSshConnectParamsSchema = external_exports.object({
|
|
22886
|
+
host: external_exports.string().trim().min(1).max(255),
|
|
22887
|
+
port: external_exports.number().int().min(1).max(65535).optional(),
|
|
22888
|
+
user: external_exports.string().trim().min(1).max(128).optional(),
|
|
22889
|
+
identityFile: external_exports.string().trim().min(1).max(1024).optional(),
|
|
22890
|
+
authMode: remotePeerSshAuthModeSchema.default("auto"),
|
|
22891
|
+
password: external_exports.string().max(1024).optional(),
|
|
22892
|
+
installAuthorizedKey: external_exports.boolean().optional(),
|
|
22893
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
22894
|
+
color: remotePeerColorSchema.optional(),
|
|
22895
|
+
remoteDataDir: external_exports.string().trim().min(1).max(1024).optional(),
|
|
22896
|
+
sessionId: external_exports.string().min(1).max(128).optional()
|
|
22897
|
+
});
|
|
22898
|
+
var remotePeerSshTestResultSchema = external_exports.object({
|
|
22899
|
+
ok: external_exports.boolean(),
|
|
22900
|
+
codexhostInstalled: external_exports.boolean(),
|
|
22901
|
+
version: external_exports.string().max(128).optional(),
|
|
22902
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
22903
|
+
platform: external_exports.string().max(64).optional(),
|
|
22904
|
+
hostname: external_exports.string().max(255).optional(),
|
|
22905
|
+
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
22906
|
+
errorCode: external_exports.string().max(128).optional(),
|
|
22907
|
+
error: external_exports.string().max(1e3).optional()
|
|
22908
|
+
});
|
|
22909
|
+
var remotePeerSshInstallResultSchema = external_exports.object({
|
|
22910
|
+
ok: external_exports.boolean(),
|
|
22911
|
+
version: external_exports.string().max(128).optional(),
|
|
22912
|
+
message: external_exports.string().max(1e3).optional()
|
|
22913
|
+
});
|
|
22914
|
+
var remotePeerSshAuthPromptSchema = external_exports.object({
|
|
22915
|
+
promptId: external_exports.string().min(1).max(128),
|
|
22916
|
+
sessionId: external_exports.string().min(1).max(128).optional(),
|
|
22917
|
+
peerId: remotePeerIdSchema.optional(),
|
|
22918
|
+
host: external_exports.string().min(1).max(255),
|
|
22919
|
+
kind: external_exports.enum(["host-key", "password", "passphrase", "otp", "generic"]),
|
|
22920
|
+
prompt: external_exports.string().min(1).max(1e3),
|
|
22921
|
+
echo: external_exports.boolean()
|
|
22922
|
+
});
|
|
22923
|
+
var remotePeerSshRespondAuthParamsSchema = external_exports.object({
|
|
22924
|
+
promptId: external_exports.string().min(1).max(128),
|
|
22925
|
+
sessionId: external_exports.string().min(1).max(128).optional(),
|
|
22926
|
+
response: external_exports.string().max(1024).optional(),
|
|
22927
|
+
cancel: external_exports.boolean().optional()
|
|
22928
|
+
});
|
|
22413
22929
|
|
|
22414
22930
|
// ../../shared-contracts/dist/peer-delegation.js
|
|
22931
|
+
var peerWatchNudgeParamsSchema = external_exports.strictObject({
|
|
22932
|
+
hostId: remotePeerHostIdSchema,
|
|
22933
|
+
threadId: external_exports.string().min(1).max(1024).optional()
|
|
22934
|
+
});
|
|
22415
22935
|
var PEER_DELEGATION_BRIDGE_VERSION = 1;
|
|
22416
22936
|
var PEER_DELEGATION_OPERATIONS = [
|
|
22417
22937
|
"listHarnesses",
|
|
@@ -22595,11 +23115,12 @@ var delegationDefaultsSchema = external_exports.strictObject({
|
|
|
22595
23115
|
byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
|
|
22596
23116
|
});
|
|
22597
23117
|
var modelId = external_exports.string().min(1).max(1024);
|
|
22598
|
-
var harnessPreferenceValuesSchema = external_exports.
|
|
23118
|
+
var harnessPreferenceValuesSchema = external_exports.object({
|
|
22599
23119
|
idleRelease: idleReleaseSettingsSchema.optional(),
|
|
22600
23120
|
favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
|
|
22601
23121
|
newThread: newThreadDefaultsSchema.optional(),
|
|
22602
|
-
delegation: delegationDefaultsSchema.optional()
|
|
23122
|
+
delegation: delegationDefaultsSchema.optional(),
|
|
23123
|
+
showGroupChatsInSidebar: external_exports.boolean().optional()
|
|
22603
23124
|
});
|
|
22604
23125
|
var harnessPreferenceSnapshotSchema = external_exports.strictObject({
|
|
22605
23126
|
scope: harnessPreferenceScopeSchema,
|
|
@@ -22632,6 +23153,10 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
|
|
|
22632
23153
|
kind: external_exports.literal("delegation"),
|
|
22633
23154
|
harnessId: harnessIdSchema,
|
|
22634
23155
|
configuration: harnessDelegationDefaultSchema.nullable()
|
|
23156
|
+
}),
|
|
23157
|
+
external_exports.strictObject({
|
|
23158
|
+
kind: external_exports.literal("groupChatsSidebar"),
|
|
23159
|
+
visible: external_exports.boolean()
|
|
22635
23160
|
})
|
|
22636
23161
|
]);
|
|
22637
23162
|
var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
@@ -22899,6 +23424,10 @@ var webToolOutputPreviewSchema = external_exports.object({
|
|
|
22899
23424
|
bytes: external_exports.number().int().nonnegative()
|
|
22900
23425
|
});
|
|
22901
23426
|
|
|
23427
|
+
// ../../shared-contracts/dist/desktop-shell.js
|
|
23428
|
+
var desktopShellOpenParamsSchema = external_exports.strictObject({});
|
|
23429
|
+
var desktopShellOpenResultSchema = external_exports.strictObject({});
|
|
23430
|
+
|
|
22902
23431
|
// ../../shared-contracts/dist/console.js
|
|
22903
23432
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
22904
23433
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -23464,7 +23993,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
|
23464
23993
|
"unreadable",
|
|
23465
23994
|
"notFound"
|
|
23466
23995
|
];
|
|
23467
|
-
var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)
|
|
23996
|
+
var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)(?:\?hostId=([^\s()<>"?#/&]+))?\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
|
|
23468
23997
|
|
|
23469
23998
|
// ../../shared-contracts/dist/remote-runtime.js
|
|
23470
23999
|
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
@@ -23493,7 +24022,7 @@ var remoteSshSetupParamsSchema = external_exports.object({
|
|
|
23493
24022
|
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
23494
24023
|
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
23495
24024
|
identity: external_exports.string().max(4096).nullable(),
|
|
23496
|
-
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
24025
|
+
action: external_exports.enum(["inspect", "install", "update", "restart", "repair", "uninstall"]),
|
|
23497
24026
|
uninstallPackage: external_exports.boolean().optional(),
|
|
23498
24027
|
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
23499
24028
|
}).strict();
|
|
@@ -23509,6 +24038,7 @@ var target = {
|
|
|
23509
24038
|
var thread2 = { ...target, threadId: identity };
|
|
23510
24039
|
var text = external_exports.string().min(1).max(8e3);
|
|
23511
24040
|
var input2 = { text, requestId: identity };
|
|
24041
|
+
var queueReorderItemIdsSchema = external_exports.array(identity).min(2).max(100).refine((ids) => new Set(ids).size === ids.length, "Queued submission IDs must be distinct");
|
|
23512
24042
|
var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
|
|
23513
24043
|
external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
|
|
23514
24044
|
external_exports.object({
|
|
@@ -23528,6 +24058,7 @@ var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available",
|
|
|
23528
24058
|
external_exports.object({ available: external_exports.literal(false) }),
|
|
23529
24059
|
external_exports.object({
|
|
23530
24060
|
available: external_exports.literal(true),
|
|
24061
|
+
canReorder: external_exports.literal(true).optional(),
|
|
23531
24062
|
items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
|
|
23532
24063
|
})
|
|
23533
24064
|
]);
|
|
@@ -23605,6 +24136,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23605
24136
|
external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input2 }),
|
|
23606
24137
|
external_exports.strictObject({ kind: external_exports.literal("steer"), ...input2, turnId: identity }),
|
|
23607
24138
|
external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
|
|
24139
|
+
external_exports.strictObject({ kind: external_exports.literal("reorder"), itemIds: queueReorderItemIdsSchema }),
|
|
23608
24140
|
external_exports.strictObject({
|
|
23609
24141
|
kind: external_exports.literal("start"),
|
|
23610
24142
|
itemId: identity,
|
|
@@ -24393,9 +24925,9 @@ async function jsonlHeader(file2, match, signal, maxLines = 4) {
|
|
|
24393
24925
|
continue;
|
|
24394
24926
|
}
|
|
24395
24927
|
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
24396
|
-
const
|
|
24397
|
-
if (match(
|
|
24398
|
-
return
|
|
24928
|
+
const record4 = value;
|
|
24929
|
+
if (match(record4))
|
|
24930
|
+
return record4;
|
|
24399
24931
|
}
|
|
24400
24932
|
}
|
|
24401
24933
|
return null;
|
|
@@ -24406,6 +24938,7 @@ function nativeTimeMs(value) {
|
|
|
24406
24938
|
}
|
|
24407
24939
|
|
|
24408
24940
|
// dist/session-import.js
|
|
24941
|
+
import { randomUUID } from "node:crypto";
|
|
24409
24942
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
24410
24943
|
import { opendir, realpath, stat } from "node:fs/promises";
|
|
24411
24944
|
import os2 from "node:os";
|
|
@@ -24635,7 +25168,17 @@ var OmpSessionImport = class {
|
|
|
24635
25168
|
if (sources?.length !== 1 || !sources[0])
|
|
24636
25169
|
return null;
|
|
24637
25170
|
const source = await this.#source(sources[0].file, signal);
|
|
24638
|
-
|
|
25171
|
+
if (!source || source.candidate.nativeSessionId !== nativeSessionId)
|
|
25172
|
+
return null;
|
|
25173
|
+
return {
|
|
25174
|
+
candidate: source.candidate,
|
|
25175
|
+
nativeRef: nativeSessionRefSchema.parse({
|
|
25176
|
+
harnessId: "omp",
|
|
25177
|
+
nativeSessionId,
|
|
25178
|
+
formatVersion: 1,
|
|
25179
|
+
locator: { sessionFile: source.file, speedScope: randomUUID() }
|
|
25180
|
+
})
|
|
25181
|
+
};
|
|
24639
25182
|
});
|
|
24640
25183
|
}
|
|
24641
25184
|
close() {
|
|
@@ -24677,9 +25220,9 @@ var OmpSessionImport = class {
|
|
|
24677
25220
|
const source = await this.#source(file2, signal);
|
|
24678
25221
|
if (!source)
|
|
24679
25222
|
continue;
|
|
24680
|
-
const sources = found.get(source.
|
|
25223
|
+
const sources = found.get(source.candidate.nativeSessionId) ?? [];
|
|
24681
25224
|
sources.push(source);
|
|
24682
|
-
found.set(source.
|
|
25225
|
+
found.set(source.candidate.nativeSessionId, sources);
|
|
24683
25226
|
} catch (error62) {
|
|
24684
25227
|
if (!(error62 instanceof SessionImportChangedError))
|
|
24685
25228
|
throw error62;
|
|
@@ -24708,17 +25251,7 @@ var OmpSessionImport = class {
|
|
|
24708
25251
|
});
|
|
24709
25252
|
if (!candidate)
|
|
24710
25253
|
return null;
|
|
24711
|
-
return {
|
|
24712
|
-
file: file2,
|
|
24713
|
-
candidate,
|
|
24714
|
-
// Resume needs the file itself: OMP is started with `--session <file>`.
|
|
24715
|
-
nativeRef: nativeSessionRefSchema.parse({
|
|
24716
|
-
harnessId: "omp",
|
|
24717
|
-
nativeSessionId: facts.nativeSessionId,
|
|
24718
|
-
locator: { sessionFile: await realpath(file2) },
|
|
24719
|
-
formatVersion: 1
|
|
24720
|
-
})
|
|
24721
|
-
};
|
|
25254
|
+
return { file: await realpath(file2), candidate };
|
|
24722
25255
|
} catch (error62) {
|
|
24723
25256
|
signal.throwIfAborted();
|
|
24724
25257
|
if (isStorageAccessError(error62))
|
|
@@ -24762,16 +25295,28 @@ function readableId({ provider, id: id2 }) {
|
|
|
24762
25295
|
function modelLabel({ provider, id: id2 }) {
|
|
24763
25296
|
return `${provider} / ${id2}`;
|
|
24764
25297
|
}
|
|
25298
|
+
function supportsOmpChatGptFast(model2) {
|
|
25299
|
+
return model2.provider === "openai-codex" && model2.api === "openai-codex-responses" && model2.fastEligible !== false && /^gpt(?:[-.]|$)/iu.test(model2.id) && (!model2.serviceTiers?.length || model2.serviceTiers.includes("priority"));
|
|
25300
|
+
}
|
|
24765
25301
|
function encodedId({ provider, id: id2 }) {
|
|
24766
25302
|
return `${OMP_MODEL_REF_PREFIX}${Buffer.from(JSON.stringify([provider, id2])).toString("base64url")}`;
|
|
24767
25303
|
}
|
|
24768
25304
|
function encodeOmpModelRef(model2, id2 = readableId(model2)) {
|
|
24769
25305
|
assertNativePart(model2.provider, "Model provider");
|
|
24770
25306
|
assertNativePart(model2.id, "Model id");
|
|
24771
|
-
return harnessModelRefSchema.parse({
|
|
25307
|
+
return harnessModelRefSchema.parse({
|
|
25308
|
+
id: id2,
|
|
25309
|
+
...model2.serviceTier && { serviceTier: model2.serviceTier }
|
|
25310
|
+
});
|
|
24772
25311
|
}
|
|
24773
25312
|
function createOmpModelIndex(models) {
|
|
24774
|
-
const entries =
|
|
25313
|
+
const entries = /* @__PURE__ */ new Map();
|
|
25314
|
+
for (const entry of models) {
|
|
25315
|
+
const pair = JSON.stringify([entry.provider, entry.id]);
|
|
25316
|
+
if (entry.api || entry.serviceTiers || !entries.has(pair)) {
|
|
25317
|
+
entries.set(pair, { ...entry, model: entry.id });
|
|
25318
|
+
}
|
|
25319
|
+
}
|
|
24775
25320
|
const byId = compositeModelRefIds([...entries.values()], (entry) => encodedId(entry));
|
|
24776
25321
|
const idsByPair = new Map([...byId].map(([id2, entry]) => [JSON.stringify([entry.provider, entry.model]), id2]));
|
|
24777
25322
|
return {
|
|
@@ -24785,13 +25330,17 @@ function createOmpModelIndex(models) {
|
|
|
24785
25330
|
}
|
|
24786
25331
|
function resolveOmpModelRef(ref, index) {
|
|
24787
25332
|
const model2 = index.byId.get(ref.id);
|
|
24788
|
-
if (!model2 || ref.serviceTier) {
|
|
25333
|
+
if (!model2 || ref.serviceTier && (ref.serviceTier !== "priority" || !supportsOmpChatGptFast(model2))) {
|
|
24789
25334
|
throw new Error("Model Ref is not in the current Omp Model catalog");
|
|
24790
25335
|
}
|
|
24791
|
-
return {
|
|
25336
|
+
return {
|
|
25337
|
+
provider: model2.provider,
|
|
25338
|
+
id: model2.id,
|
|
25339
|
+
...ref.serviceTier && { serviceTier: ref.serviceTier }
|
|
25340
|
+
};
|
|
24792
25341
|
}
|
|
24793
25342
|
function normalizeStoredOmpModelRef(ref, catalog) {
|
|
24794
|
-
if (!ref.id.startsWith(OMP_MODEL_REF_PREFIX)
|
|
25343
|
+
if (!ref.id.startsWith(OMP_MODEL_REF_PREFIX))
|
|
24795
25344
|
return void 0;
|
|
24796
25345
|
let tuple2;
|
|
24797
25346
|
try {
|
|
@@ -24806,7 +25355,10 @@ function normalizeStoredOmpModelRef(ref, catalog) {
|
|
|
24806
25355
|
if (encoded !== ref.id)
|
|
24807
25356
|
return void 0;
|
|
24808
25357
|
const readable = readableId(native);
|
|
24809
|
-
|
|
25358
|
+
const base = catalog.models.find(({ ref: ref2, label }) => !ref2.serviceTier && (ref2.id === encoded || ref2.id === readable && label === modelLabel(native)));
|
|
25359
|
+
if (!base || !ref.serviceTier)
|
|
25360
|
+
return base?.ref;
|
|
25361
|
+
return ref.serviceTier === "priority" ? base.fastModel : void 0;
|
|
24810
25362
|
}
|
|
24811
25363
|
function sameOmpModel(left, right) {
|
|
24812
25364
|
return left === null ? right === null : right !== null && left.provider === right.provider && left.id === right.id;
|
|
@@ -24821,7 +25373,7 @@ function normalizeOmpThinkingOptions(levels) {
|
|
|
24821
25373
|
label: OMP_THINKING_LABELS[id2] ?? fallbackThinkingLabel(id2)
|
|
24822
25374
|
}));
|
|
24823
25375
|
}
|
|
24824
|
-
function normalizeOmpModelCatalog(nativeModels, effectiveModel, thinkingLevels, effectiveThinkingOptionId) {
|
|
25376
|
+
function normalizeOmpModelCatalog(nativeModels, effectiveModel, thinkingLevels, effectiveThinkingOptionId, speedAvailable = false) {
|
|
24825
25377
|
const index = createOmpModelIndex(nativeModels);
|
|
24826
25378
|
const byRef = /* @__PURE__ */ new Map();
|
|
24827
25379
|
for (const native of nativeModels) {
|
|
@@ -24831,17 +25383,14 @@ function normalizeOmpModelCatalog(nativeModels, effectiveModel, thinkingLevels,
|
|
|
24831
25383
|
if (existing.reasoning !== native.reasoning) {
|
|
24832
25384
|
throw new Error("Omp duplicate Model entries disagree on reasoning capability");
|
|
24833
25385
|
}
|
|
25386
|
+
if (supportsOmpChatGptFast(existing) !== supportsOmpChatGptFast(native)) {
|
|
25387
|
+
throw new Error("Omp duplicate Model entries disagree on service tiers");
|
|
25388
|
+
}
|
|
24834
25389
|
continue;
|
|
24835
25390
|
}
|
|
24836
|
-
byRef.set(ref.id,
|
|
24837
|
-
model: {
|
|
24838
|
-
ref,
|
|
24839
|
-
label: modelLabel(native)
|
|
24840
|
-
},
|
|
24841
|
-
reasoning: native.reasoning
|
|
24842
|
-
});
|
|
25391
|
+
byRef.set(ref.id, native);
|
|
24843
25392
|
}
|
|
24844
|
-
const defaultModel = effectiveModel ? index.ref(effectiveModel) : void 0;
|
|
25393
|
+
const defaultModel = effectiveModel ? index.ref({ provider: effectiveModel.provider, id: effectiveModel.id }) : void 0;
|
|
24845
25394
|
if (defaultModel && !byRef.has(defaultModel.id)) {
|
|
24846
25395
|
throw new Error("Omp effective Model is absent from the available Model catalog");
|
|
24847
25396
|
}
|
|
@@ -24854,9 +25403,11 @@ function normalizeOmpModelCatalog(nativeModels, effectiveModel, thinkingLevels,
|
|
|
24854
25403
|
const thinkingOptions = thinkingLevels ? normalizeOmpThinkingOptions(OMP_DRAFT_THINKING_OPTION_IDS) : [];
|
|
24855
25404
|
const allThinkingOptionIds = thinkingOptions.map(({ id: id2 }) => id2);
|
|
24856
25405
|
const offThinkingOptionId = thinkingOptions.find(({ id: id2 }) => id2 === "off")?.id;
|
|
24857
|
-
const models = [...byRef
|
|
24858
|
-
|
|
24859
|
-
|
|
25406
|
+
const models = [...byRef].map(([id2, native]) => ({
|
|
25407
|
+
ref: { id: id2 },
|
|
25408
|
+
label: modelLabel(native),
|
|
25409
|
+
...speedAvailable && supportsOmpChatGptFast(native) ? { fastModel: { id: id2, serviceTier: "priority" } } : {},
|
|
25410
|
+
supportedThinkingOptionIds: native.reasoning ? allThinkingOptionIds : offThinkingOptionId ? [offThinkingOptionId] : []
|
|
24860
25411
|
})).sort((left, right) => compareText(left.label, right.label) || compareText(left.ref.id, right.ref.id));
|
|
24861
25412
|
const defaultThinkingOptionId = thinkingOptions.find(({ id: id2 }) => id2 === effectiveThinkingOptionId)?.id;
|
|
24862
25413
|
return harnessModelCatalogSchema.parse({
|
|
@@ -24944,6 +25495,30 @@ function messageRole(entry) {
|
|
|
24944
25495
|
const value = message(entry)?.role;
|
|
24945
25496
|
return typeof value === "string" ? value : null;
|
|
24946
25497
|
}
|
|
25498
|
+
function parseTimestampMs(value) {
|
|
25499
|
+
if (typeof value === "number") {
|
|
25500
|
+
return Number.isFinite(value) && value >= 0 ? Math.floor(value) : void 0;
|
|
25501
|
+
}
|
|
25502
|
+
if (typeof value === "string") {
|
|
25503
|
+
const parsed = Date.parse(value);
|
|
25504
|
+
return Number.isFinite(parsed) && parsed >= 0 ? Math.floor(parsed) : void 0;
|
|
25505
|
+
}
|
|
25506
|
+
return void 0;
|
|
25507
|
+
}
|
|
25508
|
+
function entryTimestampRange(entries) {
|
|
25509
|
+
const lastAssistantIndex = entries.findLastIndex((entry) => messageRole(entry) === "assistant");
|
|
25510
|
+
const bounded = lastAssistantIndex >= 0 ? entries.slice(0, lastAssistantIndex + 1) : entries;
|
|
25511
|
+
let startedAtMs;
|
|
25512
|
+
let completedAtMs;
|
|
25513
|
+
for (const entry of bounded) {
|
|
25514
|
+
const ts = parseTimestampMs(message(entry)?.timestamp) ?? parseTimestampMs(entry.timestamp);
|
|
25515
|
+
if (ts === void 0)
|
|
25516
|
+
continue;
|
|
25517
|
+
startedAtMs ??= ts;
|
|
25518
|
+
completedAtMs = Math.max(completedAtMs ?? startedAtMs, startedAtMs, ts);
|
|
25519
|
+
}
|
|
25520
|
+
return startedAtMs !== void 0 && completedAtMs !== void 0 ? { startedAtMs, completedAtMs } : void 0;
|
|
25521
|
+
}
|
|
24947
25522
|
function itemId(entryId, kind, ordinal) {
|
|
24948
25523
|
return hostItemIdSchema.parse(`omp-item-v1-${entryId}-${kind}-${ordinal}`);
|
|
24949
25524
|
}
|
|
@@ -25109,9 +25684,11 @@ function mapOmpSnapshot(history, state) {
|
|
|
25109
25684
|
checkpointId: user.id,
|
|
25110
25685
|
formatVersion: 1
|
|
25111
25686
|
});
|
|
25687
|
+
const timing = entryTimestampRange(entries);
|
|
25112
25688
|
turns.push({
|
|
25113
25689
|
nativeTurnRef,
|
|
25114
25690
|
checkpoint,
|
|
25691
|
+
...timing ? timing : {},
|
|
25115
25692
|
input: [{ type: "text", text: userText }],
|
|
25116
25693
|
items: snapshotItems(entries, outcome),
|
|
25117
25694
|
outcome,
|
|
@@ -25253,10 +25830,10 @@ function ompUsageHistory(history) {
|
|
|
25253
25830
|
for (const entry of history.entries) {
|
|
25254
25831
|
if (entry.type !== "message")
|
|
25255
25832
|
continue;
|
|
25256
|
-
const
|
|
25257
|
-
if (
|
|
25258
|
-
requests.push(
|
|
25259
|
-
else if (
|
|
25833
|
+
const record4 = ompUsageRecord(entry.message, { historical: true });
|
|
25834
|
+
if (record4?.kind === "request")
|
|
25835
|
+
requests.push(record4.request);
|
|
25836
|
+
else if (record4?.kind === "missing")
|
|
25260
25837
|
complete = false;
|
|
25261
25838
|
}
|
|
25262
25839
|
return { requests, complete };
|
|
@@ -25265,8 +25842,8 @@ function ompUsageHistory(history) {
|
|
|
25265
25842
|
// dist/omp-usage-statistics.js
|
|
25266
25843
|
async function readOmpUsage(file2, signal) {
|
|
25267
25844
|
const entries = [];
|
|
25268
|
-
const header = await jsonlHeader(file2, (
|
|
25269
|
-
const titled = await jsonlHeader(file2, (
|
|
25845
|
+
const header = await jsonlHeader(file2, (record4) => record4.type === "session", signal);
|
|
25846
|
+
const titled = await jsonlHeader(file2, (record4) => record4.type === "title", signal);
|
|
25270
25847
|
const session = {
|
|
25271
25848
|
sessionId: typeof header?.id === "string" ? header.id : void 0,
|
|
25272
25849
|
cwd: typeof header?.cwd === "string" ? header.cwd : void 0,
|
|
@@ -25275,12 +25852,12 @@ async function readOmpUsage(file2, signal) {
|
|
|
25275
25852
|
for await (const line of jsonlRecords(file2, '"assistant"', signal)) {
|
|
25276
25853
|
if (line.type !== "message")
|
|
25277
25854
|
continue;
|
|
25278
|
-
const
|
|
25279
|
-
if (
|
|
25855
|
+
const record4 = ompUsageRecord(line.message);
|
|
25856
|
+
if (record4?.kind !== "request")
|
|
25280
25857
|
continue;
|
|
25281
25858
|
const message3 = line.message;
|
|
25282
25859
|
const at = nativeTimeMs(message3.timestamp) ?? nativeTimeMs(line.timestamp);
|
|
25283
|
-
const entry = at !== null && usageEntryFromRequest(
|
|
25860
|
+
const entry = at !== null && usageEntryFromRequest(record4.request, at);
|
|
25284
25861
|
if (!entry)
|
|
25285
25862
|
continue;
|
|
25286
25863
|
if (!(typeof message3.responseId === "string" && message3.responseId.length > 0)) {
|
|
@@ -25331,8 +25908,8 @@ function resolveOmpExecutable(input3, dependencies = {}) {
|
|
|
25331
25908
|
|
|
25332
25909
|
// dist/omp-rpc-session.js
|
|
25333
25910
|
import { spawn, spawnSync } from "node:child_process";
|
|
25334
|
-
import { randomUUID } from "node:crypto";
|
|
25335
|
-
import
|
|
25911
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
25912
|
+
import path7 from "node:path";
|
|
25336
25913
|
|
|
25337
25914
|
// dist/omp-slash-commands.js
|
|
25338
25915
|
var OMP_LIVE_COMMAND_ID_PREFIX = "omp.slash.";
|
|
@@ -25364,6 +25941,121 @@ function ompLiveCommands(native) {
|
|
|
25364
25941
|
}));
|
|
25365
25942
|
}
|
|
25366
25943
|
|
|
25944
|
+
// dist/omp-native-extension.js
|
|
25945
|
+
import { createHash, createHmac, randomUUID as randomUUID2 } from "node:crypto";
|
|
25946
|
+
import { mkdir, readFile, rename, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
|
|
25947
|
+
import { homedir as homedir2 } from "node:os";
|
|
25948
|
+
import path6 from "node:path";
|
|
25949
|
+
var hookKeyEnv = "CODEXHOST_OMP_RPC_KEY";
|
|
25950
|
+
var hookStatus = "codexhost.rpc.v1";
|
|
25951
|
+
function proof(key, ...parts) {
|
|
25952
|
+
return createHmac("sha256", key).update(JSON.stringify(parts)).digest("base64url");
|
|
25953
|
+
}
|
|
25954
|
+
var record3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
25955
|
+
function eligibleWireRoute(model2) {
|
|
25956
|
+
if (model2.providerType != null && model2.providerType !== "openai-codex")
|
|
25957
|
+
return false;
|
|
25958
|
+
if (model2.transport != null)
|
|
25959
|
+
return false;
|
|
25960
|
+
if (model2.requestModelId != null && (typeof model2.requestModelId !== "string" || !/^gpt(?:[-.]|$)/iu.test(model2.requestModelId)))
|
|
25961
|
+
return false;
|
|
25962
|
+
if (model2.accountAccess == null)
|
|
25963
|
+
return true;
|
|
25964
|
+
return record3(model2.accountAccess) && Object.values(model2.accountAccess).every((access) => {
|
|
25965
|
+
if (!record3(access))
|
|
25966
|
+
return false;
|
|
25967
|
+
const tiers = access.serviceTiers;
|
|
25968
|
+
return tiers == null || Array.isArray(tiers) && (tiers.length === 0 || tiers.includes("priority"));
|
|
25969
|
+
});
|
|
25970
|
+
}
|
|
25971
|
+
var routeFields = [
|
|
25972
|
+
"provider",
|
|
25973
|
+
"api",
|
|
25974
|
+
"id",
|
|
25975
|
+
"requestModelId",
|
|
25976
|
+
"baseUrl",
|
|
25977
|
+
"providerType",
|
|
25978
|
+
"transport",
|
|
25979
|
+
"headers",
|
|
25980
|
+
"serviceTiers",
|
|
25981
|
+
"accountAccess"
|
|
25982
|
+
];
|
|
25983
|
+
function requestScope(key, session, file2, model2) {
|
|
25984
|
+
return proof(key, "request", session, file2, ...routeFields.map((field2) => model2[field2] ?? null));
|
|
25985
|
+
}
|
|
25986
|
+
var ompHookSource = `import { createHmac } from "node:crypto";
|
|
25987
|
+
const key = process.env.${hookKeyEnv};
|
|
25988
|
+
delete process.env.${hookKeyEnv};
|
|
25989
|
+
const sign = (...parts) => createHmac("sha256", key).update(JSON.stringify(parts)).digest("base64url");
|
|
25990
|
+
const fields = ${JSON.stringify(routeFields)};
|
|
25991
|
+
const main = ctx => ctx.mode === "rpc" && ctx.agent?.kind === "main";
|
|
25992
|
+
export default function(pi) {
|
|
25993
|
+
if (!key) return;
|
|
25994
|
+
let durableSession;
|
|
25995
|
+
pi.on("before_agent_start", async (event, ctx) => {
|
|
25996
|
+
if (event.reason !== "prompt" || !main(ctx)) return;
|
|
25997
|
+
const manager = ctx.sessionManager;
|
|
25998
|
+
const file = manager.getSessionFile();
|
|
25999
|
+
const id = manager.getSessionId();
|
|
26000
|
+
if (!file || durableSession === id || !manager.ensureOnDisk) return;
|
|
26001
|
+
await manager.ensureOnDisk();
|
|
26002
|
+
ctx.ui.setStatus("${hookStatus}", sign("durable", id, file));
|
|
26003
|
+
durableSession = id;
|
|
26004
|
+
});
|
|
26005
|
+
const version = /^(\\d+)\\.(\\d+)\\.(\\d+)(?:\\+[^-]+)?$/.exec(pi.pi?.VERSION);
|
|
26006
|
+
if (!version) return;
|
|
26007
|
+
const [major, minor, patch] = version.slice(1).map(Number);
|
|
26008
|
+
if (major < 19 || (major === 19 && (minor < 4 || (minor === 4 && patch < 1)))) return;
|
|
26009
|
+
const status = state => (_event, ctx) => { if (main(ctx)) ctx.ui.setStatus("${hookStatus}", sign(state)); };
|
|
26010
|
+
pi.on("session_start", status("ready"));
|
|
26011
|
+
pi.on("session_switch", status("ready"));
|
|
26012
|
+
pi.on("session_shutdown", status("shutdown"));
|
|
26013
|
+
const title = sign("select");
|
|
26014
|
+
pi.on("before_provider_request", async ({payload}, ctx) => {
|
|
26015
|
+
const m = ctx.model;
|
|
26016
|
+
if (!main(ctx) || m?.provider !== "openai-codex" || m.api !== "openai-codex-responses" ||
|
|
26017
|
+
!/^gpt(?:[-.]|$)/i.test(m.id) || payload?.model !== (m.requestModelId ?? m.id)) return;
|
|
26018
|
+
const scope = sign("request", ctx.sessionManager.getSessionId(), ctx.sessionManager.getSessionFile() ?? null,
|
|
26019
|
+
...fields.map(field => m[field] ?? null));
|
|
26020
|
+
const missed = () => ctx.ui.setStatus("${hookStatus}", sign("missed", scope));
|
|
26021
|
+
let lane;
|
|
26022
|
+
try {
|
|
26023
|
+
lane = await ctx.ui.input(title, scope, { timeout: 2000, onTimeout: missed });
|
|
26024
|
+
} catch {
|
|
26025
|
+
missed();
|
|
26026
|
+
}
|
|
26027
|
+
if (lane === "priority") return { ...payload, service_tier: "priority" };
|
|
26028
|
+
});
|
|
26029
|
+
}
|
|
26030
|
+
`;
|
|
26031
|
+
var digest = createHash("sha256").update(ompHookSource).digest("hex");
|
|
26032
|
+
async function ensureOmpHook(environment) {
|
|
26033
|
+
const data = environment.CODEXHOST_DATA_DIR ?? path6.join(environment.HOME ?? environment.USERPROFILE ?? homedir2(), ".codexhost");
|
|
26034
|
+
const directory = path6.resolve(data, "extensions", "omp-rpc");
|
|
26035
|
+
const file2 = path6.join(directory, `${digest}.js`);
|
|
26036
|
+
const matches = async () => await readFile(file2, "utf8").catch((error62) => {
|
|
26037
|
+
if (error62.code === "ENOENT")
|
|
26038
|
+
return null;
|
|
26039
|
+
throw error62;
|
|
26040
|
+
}) === ompHookSource;
|
|
26041
|
+
if (await matches())
|
|
26042
|
+
return file2;
|
|
26043
|
+
await mkdir(directory, { recursive: true, mode: 448 });
|
|
26044
|
+
const temporary = `${file2}.${randomUUID2()}.tmp`;
|
|
26045
|
+
try {
|
|
26046
|
+
await writeFile2(temporary, ompHookSource, { flag: "wx", mode: 384 });
|
|
26047
|
+
try {
|
|
26048
|
+
await rename(temporary, file2);
|
|
26049
|
+
} catch (error62) {
|
|
26050
|
+
if (!await matches())
|
|
26051
|
+
throw error62;
|
|
26052
|
+
}
|
|
26053
|
+
} finally {
|
|
26054
|
+
await rm2(temporary, { force: true });
|
|
26055
|
+
}
|
|
26056
|
+
return file2;
|
|
26057
|
+
}
|
|
26058
|
+
|
|
25367
26059
|
// dist/omp-session-file.js
|
|
25368
26060
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
25369
26061
|
import { open as open2, realpath as realpath2 } from "node:fs/promises";
|
|
@@ -25425,7 +26117,8 @@ async function readOmpSessionHistory(sessionFile, maxBytes) {
|
|
|
25425
26117
|
continue;
|
|
25426
26118
|
}
|
|
25427
26119
|
entries.push(entry);
|
|
25428
|
-
|
|
26120
|
+
if (entry.type !== "model_usage")
|
|
26121
|
+
leafId = entry.id;
|
|
25429
26122
|
}
|
|
25430
26123
|
return { entries, leafId, ...incomplete ? { incomplete: true } : {} };
|
|
25431
26124
|
}
|
|
@@ -25612,7 +26305,18 @@ function sessionStateData(response) {
|
|
|
25612
26305
|
throw new OmpRpcFaultError("protocolError", "Omp RPC state response has no data");
|
|
25613
26306
|
return data;
|
|
25614
26307
|
}
|
|
25615
|
-
function
|
|
26308
|
+
function fastMetadata(model2) {
|
|
26309
|
+
const { serviceTiers } = model2;
|
|
26310
|
+
if (serviceTiers != null && !(Array.isArray(serviceTiers) && serviceTiers.every(nonBlankString))) {
|
|
26311
|
+
throw new OmpRpcFaultError("protocolError", "Omp RPC Model contains invalid service tiers");
|
|
26312
|
+
}
|
|
26313
|
+
return {
|
|
26314
|
+
...nonBlankString(model2.api) && { api: model2.api },
|
|
26315
|
+
...serviceTiers != null && { serviceTiers },
|
|
26316
|
+
...model2.provider === "openai-codex" && !eligibleWireRoute(model2) && { fastEligible: false }
|
|
26317
|
+
};
|
|
26318
|
+
}
|
|
26319
|
+
function parseSessionState(response, key) {
|
|
25616
26320
|
const data = sessionStateData(response);
|
|
25617
26321
|
const model2 = parseNativeModel(data.model, "state");
|
|
25618
26322
|
if (!nonBlankString(data.sessionId)) {
|
|
@@ -25627,16 +26331,25 @@ function parseSessionState(response) {
|
|
|
25627
26331
|
const parsed = harnessThinkingOptionIdSchema.safeParse(level);
|
|
25628
26332
|
return parsed.success ? [parsed.data] : [];
|
|
25629
26333
|
}) : null;
|
|
26334
|
+
const metadata = isRecord8(data.model) ? fastMetadata(data.model) : {};
|
|
26335
|
+
const file2 = typeof data.sessionFile === "string" ? data.sessionFile : null;
|
|
26336
|
+
const eligible = model2 && supportsOmpChatGptFast({ ...model2, ...metadata });
|
|
25630
26337
|
return {
|
|
25631
26338
|
sessionId: data.sessionId,
|
|
25632
|
-
sessionFile:
|
|
26339
|
+
sessionFile: file2,
|
|
25633
26340
|
provider: model2?.provider ?? null,
|
|
25634
26341
|
modelId: model2?.id ?? null,
|
|
26342
|
+
...metadata,
|
|
26343
|
+
...eligible && isRecord8(data.model) && { fastScope: requestScope(key, data.sessionId, file2, data.model) },
|
|
26344
|
+
...eligible && typeof data.fastModeEnabled === "boolean" && { fastModeEnabled: data.fastModeEnabled },
|
|
25635
26345
|
thinkingLevel: thinkingLevel?.data ?? null,
|
|
25636
26346
|
contextUsage: optionalOmpStateContextUsage(data.contextUsage),
|
|
25637
26347
|
availableThinkingLevels
|
|
25638
26348
|
};
|
|
25639
26349
|
}
|
|
26350
|
+
function isOmpNativeSpeedMutation(text3) {
|
|
26351
|
+
return /^\s*\/(?:fast|ultrafast)(?=$|[:\s])(?![\s:]+status\s*$)|^\s*\/switch(?=$|[:\s])/iu.test(text3);
|
|
26352
|
+
}
|
|
25640
26353
|
function parseSessionStreaming(response) {
|
|
25641
26354
|
const isStreaming = sessionStateData(response).isStreaming;
|
|
25642
26355
|
if (typeof isStreaming !== "boolean") {
|
|
@@ -25658,7 +26371,7 @@ function parseAvailableModels(response) {
|
|
|
25658
26371
|
if (!parsed || !isRecord8(model2) || typeof model2.reasoning !== "boolean") {
|
|
25659
26372
|
throw new OmpRpcFaultError("protocolError", "Omp RPC catalog contains a Model without reasoning capability");
|
|
25660
26373
|
}
|
|
25661
|
-
return { ...parsed, reasoning: model2.reasoning };
|
|
26374
|
+
return { ...parsed, reasoning: model2.reasoning, ...fastMetadata(model2) };
|
|
25662
26375
|
});
|
|
25663
26376
|
}
|
|
25664
26377
|
function parseSubagentMessages(response) {
|
|
@@ -25768,11 +26481,12 @@ function ompRpcProcessCommand(options, dependencies = {}) {
|
|
|
25768
26481
|
"--mode",
|
|
25769
26482
|
// OMP only creates ask and connects its tool UI in rpc-ui mode.
|
|
25770
26483
|
"rpc-ui",
|
|
26484
|
+
...options.extensionFile ? ["--extension", options.extensionFile] : [],
|
|
25771
26485
|
...permissionArguments,
|
|
25772
26486
|
...modelArguments,
|
|
25773
26487
|
...sessionArguments
|
|
25774
26488
|
];
|
|
25775
|
-
const extension =
|
|
26489
|
+
const extension = path7.win32.extname(command).toLowerCase();
|
|
25776
26490
|
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
25777
26491
|
return { command, arguments: arguments_, windowsVerbatimArguments: false };
|
|
25778
26492
|
}
|
|
@@ -25809,9 +26523,16 @@ var OmpRpcSession = class {
|
|
|
25809
26523
|
#compactionTurn = null;
|
|
25810
26524
|
#compactionTimeout = null;
|
|
25811
26525
|
#failed = false;
|
|
26526
|
+
#started = false;
|
|
25812
26527
|
#pending = /* @__PURE__ */ new Map();
|
|
25813
26528
|
#state = null;
|
|
25814
26529
|
#availableCommands = null;
|
|
26530
|
+
#settingFast = false;
|
|
26531
|
+
#hookKey = randomUUID3();
|
|
26532
|
+
#hookTitle = proof(this.#hookKey, "select");
|
|
26533
|
+
#hookReady = false;
|
|
26534
|
+
#durableProof = null;
|
|
26535
|
+
#fastScope;
|
|
25815
26536
|
#latestCacheHitRatePercent;
|
|
25816
26537
|
#manualCompaction = null;
|
|
25817
26538
|
#usageRequestStartedAtMs = null;
|
|
@@ -25852,18 +26573,28 @@ var OmpRpcSession = class {
|
|
|
25852
26573
|
get stderrTail() {
|
|
25853
26574
|
return this.#stderrTail;
|
|
25854
26575
|
}
|
|
26576
|
+
get speedAvailable() {
|
|
26577
|
+
return this.#hookReady && !this.#closed && !this.#failed;
|
|
26578
|
+
}
|
|
25855
26579
|
async start() {
|
|
25856
|
-
if (this.#
|
|
26580
|
+
if (this.#started || this.#closed)
|
|
25857
26581
|
throw new Error("Omp RPC Session cannot be started twice");
|
|
26582
|
+
this.#started = true;
|
|
26583
|
+
const environment = withNodeRuntimeOnPath({
|
|
26584
|
+
...process.env,
|
|
26585
|
+
...this.#options.environment,
|
|
26586
|
+
[hookKeyEnv]: this.#hookKey,
|
|
26587
|
+
OMP_SKIP_VERSION_CHECK: "1",
|
|
26588
|
+
OMP_TELEMETRY: "0"
|
|
26589
|
+
});
|
|
26590
|
+
const extensionFile = this.#processAdapter === nodeProcessAdapter ? await ensureOmpHook(environment) : void 0;
|
|
26591
|
+
if (this.#closed)
|
|
26592
|
+
throw new Error("Omp RPC Session closed during startup");
|
|
25858
26593
|
const child = this.#processAdapter.spawn({
|
|
25859
26594
|
cwd: this.#options.cwd,
|
|
25860
26595
|
...this.#options.command ? { command: this.#options.command } : {},
|
|
25861
|
-
environment
|
|
25862
|
-
|
|
25863
|
-
...this.#options.environment,
|
|
25864
|
-
OMP_SKIP_VERSION_CHECK: "1",
|
|
25865
|
-
OMP_TELEMETRY: "0"
|
|
25866
|
-
}),
|
|
26596
|
+
environment,
|
|
26597
|
+
...extensionFile && { extensionFile },
|
|
25867
26598
|
...this.#options.sessionFile ? { sessionFile: this.#options.sessionFile } : {},
|
|
25868
26599
|
...this.#options.forkSessionFile ? { forkSessionFile: this.#options.forkSessionFile } : {},
|
|
25869
26600
|
...this.#options.model ? { model: this.#options.model } : {},
|
|
@@ -25917,7 +26648,7 @@ var OmpRpcSession = class {
|
|
|
25917
26648
|
await this.#send("set_subagent_subscription", { level: "events" }).catch(() => void 0);
|
|
25918
26649
|
}
|
|
25919
26650
|
try {
|
|
25920
|
-
this.#state = parseSessionState(await this.#send("get_state", {}));
|
|
26651
|
+
this.#state = parseSessionState(await this.#send("get_state", {}), this.#hookKey);
|
|
25921
26652
|
} catch (error62) {
|
|
25922
26653
|
const fault = error62 instanceof OmpRpcFaultError ? error62 : new OmpRpcFaultError("unavailable", `Omp RPC state unavailable: ${message2(error62)}`);
|
|
25923
26654
|
this.#fail(fault);
|
|
@@ -26000,7 +26731,7 @@ var OmpRpcSession = class {
|
|
|
26000
26731
|
if (!this.#child || !this.#state || this.#closed || this.#failed) {
|
|
26001
26732
|
throw new Error("Omp RPC Session is unavailable");
|
|
26002
26733
|
}
|
|
26003
|
-
if (this.#activeTurn || this.#manualCompaction || this.#compactionActive) {
|
|
26734
|
+
if (this.#activeTurn || this.#settingFast || this.#manualCompaction || this.#compactionActive) {
|
|
26004
26735
|
throw new Error("Omp RPC Session already has an active operation");
|
|
26005
26736
|
}
|
|
26006
26737
|
const result = new Promise((resolve, reject) => {
|
|
@@ -26024,7 +26755,7 @@ var OmpRpcSession = class {
|
|
|
26024
26755
|
if (!(error62 instanceof OmpRpcUnsupportedCommandError))
|
|
26025
26756
|
throw error62;
|
|
26026
26757
|
const response = await this.#send("get_state", {});
|
|
26027
|
-
const observedState = parseSessionState(response);
|
|
26758
|
+
const observedState = parseSessionState(response, this.#hookKey);
|
|
26028
26759
|
if (!this.#state || observedState.sessionId !== this.#state.sessionId || observedState.provider !== this.#state.provider || observedState.modelId !== this.#state.modelId) {
|
|
26029
26760
|
throw new Error("Omp RPC Usage fallback does not match the confirmed Session state");
|
|
26030
26761
|
}
|
|
@@ -26046,6 +26777,8 @@ var OmpRpcSession = class {
|
|
|
26046
26777
|
return this.#latestCacheHitRatePercent === null || this.#latestCacheHitRatePercent === void 0 ? usage : parseHostUsage({ ...usage, cacheHitRatePercent: this.#latestCacheHitRatePercent });
|
|
26047
26778
|
}
|
|
26048
26779
|
async fork(entryId) {
|
|
26780
|
+
if (this.#settingFast)
|
|
26781
|
+
throw new Error("Omp RPC Session already has an active operation");
|
|
26049
26782
|
if (!nonBlankString(entryId))
|
|
26050
26783
|
throw new Error("Omp RPC Fork requires an Entry identity");
|
|
26051
26784
|
try {
|
|
@@ -26054,7 +26787,8 @@ var OmpRpcSession = class {
|
|
|
26054
26787
|
if (!data || data.cancelled === true) {
|
|
26055
26788
|
throw new OmpRpcFaultError("unavailable", "Omp RPC Fork was cancelled");
|
|
26056
26789
|
}
|
|
26057
|
-
this.#
|
|
26790
|
+
this.#releaseOverlay();
|
|
26791
|
+
this.#state = parseSessionState(await this.#send("get_state", {}), this.#hookKey);
|
|
26058
26792
|
return this.#state;
|
|
26059
26793
|
} catch (error62) {
|
|
26060
26794
|
if (error62 instanceof OmpRpcFaultError)
|
|
@@ -26082,18 +26816,84 @@ var OmpRpcSession = class {
|
|
|
26082
26816
|
return this.state.availableThinkingLevels;
|
|
26083
26817
|
}
|
|
26084
26818
|
async selectModel(model2) {
|
|
26819
|
+
if (this.#settingFast)
|
|
26820
|
+
throw new Error("Omp RPC Session already has an active operation");
|
|
26085
26821
|
await this.#send("set_model", { provider: model2.provider, modelId: model2.id });
|
|
26822
|
+
this.#releaseOverlay();
|
|
26086
26823
|
return this.#refreshState("Model");
|
|
26087
26824
|
}
|
|
26088
26825
|
async selectThinkingOption(thinkingOptionId) {
|
|
26826
|
+
if (this.#settingFast)
|
|
26827
|
+
throw new Error("Omp RPC Session already has an active operation");
|
|
26089
26828
|
const level = harnessThinkingOptionIdSchema.parse(thinkingOptionId);
|
|
26090
26829
|
await this.#send("set_thinking_level", { level });
|
|
26091
26830
|
return this.#refreshState("Thinking");
|
|
26092
26831
|
}
|
|
26093
|
-
async
|
|
26832
|
+
async selectSpeed(tier) {
|
|
26833
|
+
if (tier !== "priority" && tier !== null)
|
|
26834
|
+
throw new Error("Unsupported Omp speed");
|
|
26835
|
+
if (this.#manualCompaction || this.#compactionActive || this.#settingFast) {
|
|
26836
|
+
throw new Error("Omp RPC Session already has an active operation");
|
|
26837
|
+
}
|
|
26838
|
+
this.#settingFast = true;
|
|
26094
26839
|
try {
|
|
26095
|
-
|
|
26840
|
+
const active2 = this.#activeTurn;
|
|
26841
|
+
const previousScope = this.state.fastScope;
|
|
26842
|
+
const snapshot = await this.#send("get_state", {});
|
|
26843
|
+
if (this.state.fastScope !== previousScope)
|
|
26844
|
+
throw new Error("Omp Fast selection target changed");
|
|
26845
|
+
const state = this.#acceptState(parseSessionState(snapshot, this.#hookKey));
|
|
26846
|
+
const settled = sessionSettled(snapshot, true);
|
|
26847
|
+
if (this.#compactionActive || sessionStateData(snapshot).isCompacting === true || !this.#activeTurn && !settled) {
|
|
26848
|
+
throw new Error("Omp RPC Session is not idle");
|
|
26849
|
+
}
|
|
26850
|
+
if (active2 && (active2.nativeSpeedMutation || active2.cancellation !== "none")) {
|
|
26851
|
+
throw new Error("Omp RPC Session already has an active operation");
|
|
26852
|
+
}
|
|
26853
|
+
if (tier !== null || active2) {
|
|
26854
|
+
if (state.fastScope !== previousScope)
|
|
26855
|
+
throw new Error("Omp Fast selection target changed");
|
|
26856
|
+
if (!state.fastScope)
|
|
26857
|
+
throw new Error("Omp Fast requires an eligible ChatGPT Codex Model");
|
|
26858
|
+
if (!this.speedAvailable)
|
|
26859
|
+
throw new Error("Omp request-scoped Fast hook is unavailable");
|
|
26860
|
+
}
|
|
26861
|
+
if (tier === null) {
|
|
26862
|
+
this.#clearSelectedSpeed();
|
|
26863
|
+
return this.state;
|
|
26864
|
+
}
|
|
26865
|
+
this.#fastScope = state.fastScope;
|
|
26866
|
+
this.#state = { ...state, serviceTier: "priority" };
|
|
26096
26867
|
return this.#state;
|
|
26868
|
+
} finally {
|
|
26869
|
+
this.#settingFast = false;
|
|
26870
|
+
}
|
|
26871
|
+
}
|
|
26872
|
+
#releaseOverlay() {
|
|
26873
|
+
if (this.#activeTurn)
|
|
26874
|
+
this.#activeTurn.fastScope = void 0;
|
|
26875
|
+
this.#clearSelectedSpeed();
|
|
26876
|
+
}
|
|
26877
|
+
#clearSelectedSpeed() {
|
|
26878
|
+
this.#fastScope = void 0;
|
|
26879
|
+
if (this.#state?.serviceTier) {
|
|
26880
|
+
const { serviceTier: _, ...native } = this.#state;
|
|
26881
|
+
this.#state = native;
|
|
26882
|
+
}
|
|
26883
|
+
}
|
|
26884
|
+
#acceptState(state) {
|
|
26885
|
+
const eligibleScope = this.speedAvailable ? state.fastScope : void 0;
|
|
26886
|
+
if (this.#fastScope !== eligibleScope)
|
|
26887
|
+
this.#fastScope = void 0;
|
|
26888
|
+
if (this.#activeTurn && this.#activeTurn.fastScope !== eligibleScope) {
|
|
26889
|
+
this.#activeTurn.fastScope = void 0;
|
|
26890
|
+
}
|
|
26891
|
+
this.#state = this.#fastScope ? { ...state, serviceTier: "priority" } : state;
|
|
26892
|
+
return this.#state;
|
|
26893
|
+
}
|
|
26894
|
+
async #refreshState(operation) {
|
|
26895
|
+
try {
|
|
26896
|
+
return this.#acceptState(parseSessionState(await this.#send("get_state", {}), this.#hookKey));
|
|
26097
26897
|
} catch (error62) {
|
|
26098
26898
|
const fault = error62 instanceof OmpRpcFaultError ? error62 : new OmpRpcFaultError("protocolError", `Omp RPC ${operation} state could not be confirmed: ${message2(error62)}`);
|
|
26099
26899
|
this.#fail(fault);
|
|
@@ -26108,6 +26908,11 @@ var OmpRpcSession = class {
|
|
|
26108
26908
|
throw new Error("Omp steer text must not be empty");
|
|
26109
26909
|
const target2 = this.#activeTurn;
|
|
26110
26910
|
let targetEnded = false;
|
|
26911
|
+
if (isOmpNativeSpeedMutation(message3)) {
|
|
26912
|
+
if (target2)
|
|
26913
|
+
target2.nativeSpeedMutation = true;
|
|
26914
|
+
this.#releaseOverlay();
|
|
26915
|
+
}
|
|
26111
26916
|
const response = await this.#send("steer", { message: message3 }, void 0, () => {
|
|
26112
26917
|
targetEnded = target2 !== null && this.#activeTurn !== target2;
|
|
26113
26918
|
});
|
|
@@ -26128,14 +26933,20 @@ var OmpRpcSession = class {
|
|
|
26128
26933
|
if (!this.#child || !this.#state || this.#closed || this.#failed) {
|
|
26129
26934
|
throw new Error("Omp RPC Session is unavailable");
|
|
26130
26935
|
}
|
|
26131
|
-
if (this.#activeTurn)
|
|
26132
|
-
throw new Error("Omp RPC Session already has an active
|
|
26936
|
+
if (this.#activeTurn || this.#settingFast) {
|
|
26937
|
+
throw new Error("Omp RPC Session already has an active operation");
|
|
26938
|
+
}
|
|
26133
26939
|
if (text3.length === 0)
|
|
26134
26940
|
throw new Error("Omp text Turn must not be empty");
|
|
26135
|
-
const
|
|
26941
|
+
const nativeSpeedMutation = isOmpNativeSpeedMutation(text3);
|
|
26942
|
+
if (nativeSpeedMutation)
|
|
26943
|
+
this.#releaseOverlay();
|
|
26944
|
+
const promptId = `codexhost-${randomUUID3()}`;
|
|
26136
26945
|
const settled = new Promise((resolve, reject) => {
|
|
26137
26946
|
this.#activeTurn = {
|
|
26138
26947
|
promptId,
|
|
26948
|
+
fastScope: this.#fastScope,
|
|
26949
|
+
nativeSpeedMutation,
|
|
26139
26950
|
localResult: null,
|
|
26140
26951
|
text: "",
|
|
26141
26952
|
assistantMessageId: null,
|
|
@@ -26312,6 +27123,27 @@ var OmpRpcSession = class {
|
|
|
26312
27123
|
this.#readyResolve = null;
|
|
26313
27124
|
return;
|
|
26314
27125
|
}
|
|
27126
|
+
if (value.type === "extension_ui_request") {
|
|
27127
|
+
const scope = this.#activeTurn ? this.#activeTurn.fastScope : this.#fastScope;
|
|
27128
|
+
if (value.method === "setStatus" && value.statusKey === hookStatus) {
|
|
27129
|
+
if (value.statusText === proof(this.#hookKey, "ready"))
|
|
27130
|
+
this.#hookReady = true;
|
|
27131
|
+
else if (value.statusText === proof(this.#hookKey, "shutdown"))
|
|
27132
|
+
this.#hookReady = false;
|
|
27133
|
+
else if (scope && value.statusText === proof(this.#hookKey, "missed", scope)) {
|
|
27134
|
+
this.#releaseOverlay();
|
|
27135
|
+
this.#fail(new OmpRpcFaultError("protocolError", "Omp Fast request could not be confirmed"));
|
|
27136
|
+
} else if (this.#state?.sessionFile && value.statusText === proof(this.#hookKey, "durable", this.#state.sessionId, this.#state.sessionFile)) {
|
|
27137
|
+
this.#durableProof = value.statusText;
|
|
27138
|
+
}
|
|
27139
|
+
return;
|
|
27140
|
+
}
|
|
27141
|
+
if (value.method === "input" && value.title === this.#hookTitle && nonBlankString(value.id)) {
|
|
27142
|
+
const lane = this.speedAvailable && scope && value.placeholder === scope ? "priority" : "native";
|
|
27143
|
+
void this.#write({ type: "extension_ui_response", id: value.id, value: lane }).catch((error62) => this.#fail(new OmpRpcFaultError("processExited", `Omp request hook disconnected: ${message2(error62)}`)));
|
|
27144
|
+
return;
|
|
27145
|
+
}
|
|
27146
|
+
}
|
|
26315
27147
|
if (value.type === "response") {
|
|
26316
27148
|
this.#handleResponse(value);
|
|
26317
27149
|
return;
|
|
@@ -26367,6 +27199,9 @@ var OmpRpcSession = class {
|
|
|
26367
27199
|
this.#observeUsage(value);
|
|
26368
27200
|
if (value.type === "agent_start" && active2) {
|
|
26369
27201
|
active2.terminalEnd = false;
|
|
27202
|
+
if (!active2.sawAgentStart && (!this.#hookReady || this.state.sessionFile && this.#durableProof === proof(this.#hookKey, "durable", this.state.sessionId, this.state.sessionFile))) {
|
|
27203
|
+
active2.onEvent({ type: "agent.started" });
|
|
27204
|
+
}
|
|
26370
27205
|
active2.sawAgentStart = true;
|
|
26371
27206
|
}
|
|
26372
27207
|
if ((value.type === "session_settled" || value.type === "agent_start") && active2?.cancellation === "accepted") {
|
|
@@ -26775,11 +27610,12 @@ var OmpRpcSession = class {
|
|
|
26775
27610
|
return;
|
|
26776
27611
|
response = await this.#send("get_state", {});
|
|
26777
27612
|
}
|
|
26778
|
-
let state = parseSessionState(response);
|
|
27613
|
+
let state = parseSessionState(response, this.#hookKey);
|
|
26779
27614
|
if (this.#activeTurn !== active2 || active2.cancellation !== "accepted")
|
|
26780
27615
|
return;
|
|
26781
27616
|
const data = sessionStateData(response);
|
|
26782
27617
|
if (!active2.cancellationReloaded && state.sessionFile && state.sessionId === this.state.sessionId && state.sessionFile === this.state.sessionFile && data.isStreaming === false && data.isCompacting === false && data.queuedMessageCount === 0 && data.hasPendingAsyncWork === true && active2.tools.size === 0) {
|
|
27618
|
+
const previous = state;
|
|
26783
27619
|
await this.verifySessionCwd(this.#options.cwd);
|
|
26784
27620
|
if (this.#activeTurn !== active2)
|
|
26785
27621
|
return;
|
|
@@ -26796,9 +27632,8 @@ var OmpRpcSession = class {
|
|
|
26796
27632
|
if (!isRecord8(reloaded.data) || reloaded.data.cancelled !== false) {
|
|
26797
27633
|
throw new OmpRpcFaultError("unavailable", "Omp cancelled Session reload was refused");
|
|
26798
27634
|
}
|
|
26799
|
-
const previous = state;
|
|
26800
27635
|
response = await this.#send("get_state", {});
|
|
26801
|
-
state = parseSessionState(response);
|
|
27636
|
+
state = parseSessionState(response, this.#hookKey);
|
|
26802
27637
|
if (state.sessionId !== previous.sessionId || state.sessionFile !== previous.sessionFile) {
|
|
26803
27638
|
throw new OmpRpcFaultError("protocolError", "Omp cancelled Session reload changed its identity");
|
|
26804
27639
|
}
|
|
@@ -26811,9 +27646,11 @@ var OmpRpcSession = class {
|
|
|
26811
27646
|
if (previous.thinkingLevel && state.thinkingLevel !== previous.thinkingLevel) {
|
|
26812
27647
|
await this.#send("set_thinking_level", { level: previous.thinkingLevel });
|
|
26813
27648
|
}
|
|
26814
|
-
|
|
26815
|
-
|
|
26816
|
-
|
|
27649
|
+
if (state.provider !== previous.provider || state.modelId !== previous.modelId || state.thinkingLevel !== previous.thinkingLevel) {
|
|
27650
|
+
response = await this.#send("get_state", {});
|
|
27651
|
+
state = parseSessionState(response, this.#hookKey);
|
|
27652
|
+
}
|
|
27653
|
+
if (state.sessionId !== previous.sessionId || state.sessionFile !== previous.sessionFile || state.provider !== previous.provider || state.modelId !== previous.modelId || state.fastScope !== previous.fastScope || state.fastModeEnabled !== previous.fastModeEnabled || this.#fastScope !== void 0 && !this.speedAvailable || previous.thinkingLevel !== null && state.thinkingLevel !== previous.thinkingLevel) {
|
|
26817
27654
|
throw new OmpRpcFaultError("protocolError", "Omp cancelled Session reload changed its identity or configuration");
|
|
26818
27655
|
}
|
|
26819
27656
|
}
|
|
@@ -26825,7 +27662,9 @@ var OmpRpcSession = class {
|
|
|
26825
27662
|
}, 250);
|
|
26826
27663
|
return;
|
|
26827
27664
|
}
|
|
26828
|
-
this.#
|
|
27665
|
+
if (this.#activeTurn !== active2)
|
|
27666
|
+
return;
|
|
27667
|
+
this.#acceptState(state);
|
|
26829
27668
|
active2.settlement = "confirmed";
|
|
26830
27669
|
this.#finishSettledTurn(active2);
|
|
26831
27670
|
} catch (error62) {
|
|
@@ -26852,7 +27691,8 @@ var OmpRpcSession = class {
|
|
|
26852
27691
|
active2.settlement = "confirming";
|
|
26853
27692
|
try {
|
|
26854
27693
|
const response = await this.#send("get_state", {});
|
|
26855
|
-
const
|
|
27694
|
+
const settled = sessionSettled(response, hasTurnCompletion(active2));
|
|
27695
|
+
const state = parseSessionState(response, this.#hookKey);
|
|
26856
27696
|
if (this.#activeTurn !== active2)
|
|
26857
27697
|
return;
|
|
26858
27698
|
if (active2.cancellation !== "none") {
|
|
@@ -26866,7 +27706,7 @@ var OmpRpcSession = class {
|
|
|
26866
27706
|
active2.settledNotice = false;
|
|
26867
27707
|
return;
|
|
26868
27708
|
}
|
|
26869
|
-
if (!
|
|
27709
|
+
if (!settled) {
|
|
26870
27710
|
active2.settlement = "pending";
|
|
26871
27711
|
if (active2.settledNotice) {
|
|
26872
27712
|
active2.settledNotice = false;
|
|
@@ -26877,7 +27717,7 @@ var OmpRpcSession = class {
|
|
|
26877
27717
|
}
|
|
26878
27718
|
return;
|
|
26879
27719
|
}
|
|
26880
|
-
this.#state
|
|
27720
|
+
this.#acceptState(state);
|
|
26881
27721
|
active2.settlement = "confirmed";
|
|
26882
27722
|
this.#finishSettledTurn(active2);
|
|
26883
27723
|
} catch (error62) {
|
|
@@ -26927,7 +27767,7 @@ var OmpRpcSession = class {
|
|
|
26927
27767
|
if (active2.assistantMessageId !== null && active2.reasoningMessageOpen) {
|
|
26928
27768
|
active2.onEvent({ type: "reasoning.completed", messageId: active2.assistantMessageId });
|
|
26929
27769
|
}
|
|
26930
|
-
const messageId = assistantMessageId(value) ??
|
|
27770
|
+
const messageId = assistantMessageId(value) ?? randomUUID3();
|
|
26931
27771
|
active2.assistantMessageId = messageId;
|
|
26932
27772
|
active2.sawStreamedMessageText = false;
|
|
26933
27773
|
active2.sawStreamedMessageReasoning = false;
|
|
@@ -26980,7 +27820,7 @@ var OmpRpcSession = class {
|
|
|
26980
27820
|
child.stdin.write(frame, (error62) => error62 ? reject(error62) : resolve());
|
|
26981
27821
|
});
|
|
26982
27822
|
}
|
|
26983
|
-
#send(type, payload, id2 = `codexhost-${
|
|
27823
|
+
#send(type, payload, id2 = `codexhost-${randomUUID3()}`, onResponse) {
|
|
26984
27824
|
const child = this.#child;
|
|
26985
27825
|
if (!child?.stdin.writable || this.#closed || this.#failed) {
|
|
26986
27826
|
return Promise.reject(new Error("Omp RPC stdin is unavailable"));
|
|
@@ -27172,7 +28012,17 @@ function parseOmpModelList(output2) {
|
|
|
27172
28012
|
if (!isRecord9(model2) || !nonBlankString2(model2.provider) || !nonBlankString2(model2.id) || typeof model2.reasoning !== "boolean") {
|
|
27173
28013
|
return null;
|
|
27174
28014
|
}
|
|
27175
|
-
|
|
28015
|
+
const { serviceTiers } = model2;
|
|
28016
|
+
if (serviceTiers != null && !(Array.isArray(serviceTiers) && serviceTiers.every(nonBlankString2))) {
|
|
28017
|
+
return null;
|
|
28018
|
+
}
|
|
28019
|
+
models.push({
|
|
28020
|
+
provider: model2.provider,
|
|
28021
|
+
id: model2.id,
|
|
28022
|
+
...typeof model2.api === "string" && { api: model2.api },
|
|
28023
|
+
reasoning: model2.reasoning,
|
|
28024
|
+
...serviceTiers != null && { serviceTiers }
|
|
28025
|
+
});
|
|
27176
28026
|
}
|
|
27177
28027
|
return models;
|
|
27178
28028
|
}
|
|
@@ -27283,16 +28133,16 @@ var Diff = class {
|
|
|
27283
28133
|
}
|
|
27284
28134
|
}
|
|
27285
28135
|
}
|
|
27286
|
-
addToPath(
|
|
27287
|
-
const last =
|
|
28136
|
+
addToPath(path10, added, removed, oldPosInc, options) {
|
|
28137
|
+
const last = path10.lastComponent;
|
|
27288
28138
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
27289
28139
|
return {
|
|
27290
|
-
oldPos:
|
|
28140
|
+
oldPos: path10.oldPos + oldPosInc,
|
|
27291
28141
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
27292
28142
|
};
|
|
27293
28143
|
} else {
|
|
27294
28144
|
return {
|
|
27295
|
-
oldPos:
|
|
28145
|
+
oldPos: path10.oldPos + oldPosInc,
|
|
27296
28146
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
27297
28147
|
};
|
|
27298
28148
|
}
|
|
@@ -27704,9 +28554,9 @@ function splitLines(text3) {
|
|
|
27704
28554
|
}
|
|
27705
28555
|
|
|
27706
28556
|
// dist/omp-adapter.js
|
|
27707
|
-
import { createHash, randomUUID as
|
|
28557
|
+
import { createHash as createHash3, randomUUID as randomUUID5 } from "node:crypto";
|
|
27708
28558
|
import { realpath as realpath3, stat as stat2 } from "node:fs/promises";
|
|
27709
|
-
import
|
|
28559
|
+
import path8 from "node:path";
|
|
27710
28560
|
|
|
27711
28561
|
// dist/omp-account-credits.js
|
|
27712
28562
|
var CACHE_MS = 3e4;
|
|
@@ -27910,6 +28760,49 @@ async function rollbackOmpLastTurn(transport, sourceSessionId, cwd) {
|
|
|
27910
28760
|
return { ok: true };
|
|
27911
28761
|
}
|
|
27912
28762
|
|
|
28763
|
+
// dist/omp-speed-selection.js
|
|
28764
|
+
import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
|
|
28765
|
+
import { open as open3, rename as rename2, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
|
|
28766
|
+
function selectionFile(sessionFile, scope) {
|
|
28767
|
+
const key = createHash2("sha256").update(scope).digest("hex");
|
|
28768
|
+
return `${sessionFile}.codexhost-speed-${key}`;
|
|
28769
|
+
}
|
|
28770
|
+
async function readOmpSpeedSelection(sessionFile, sessionId, scope) {
|
|
28771
|
+
let handle;
|
|
28772
|
+
try {
|
|
28773
|
+
handle = await open3(selectionFile(sessionFile, scope), "r");
|
|
28774
|
+
const { size } = await handle.stat();
|
|
28775
|
+
if (!size || size > 4096)
|
|
28776
|
+
return null;
|
|
28777
|
+
const { buffer, bytesRead } = await handle.read(Buffer.allocUnsafe(size));
|
|
28778
|
+
const record4 = JSON.parse(buffer.toString("utf8", 0, bytesRead));
|
|
28779
|
+
return record4?.sessionId === sessionId && typeof record4.fastModelId === "string" ? record4.fastModelId : null;
|
|
28780
|
+
} catch {
|
|
28781
|
+
return null;
|
|
28782
|
+
} finally {
|
|
28783
|
+
await handle?.close();
|
|
28784
|
+
}
|
|
28785
|
+
}
|
|
28786
|
+
async function writeOmpSpeedSelection(state, scope, fastModelId) {
|
|
28787
|
+
if (!state.sessionFile)
|
|
28788
|
+
return;
|
|
28789
|
+
const file2 = selectionFile(state.sessionFile, scope);
|
|
28790
|
+
if (fastModelId === null) {
|
|
28791
|
+
await rm3(file2, { force: true });
|
|
28792
|
+
return;
|
|
28793
|
+
}
|
|
28794
|
+
const temporary = `${file2}.${randomUUID4()}.tmp`;
|
|
28795
|
+
try {
|
|
28796
|
+
await writeFile3(temporary, JSON.stringify({ sessionId: state.sessionId, fastModelId }), {
|
|
28797
|
+
flag: "wx",
|
|
28798
|
+
mode: 384
|
|
28799
|
+
});
|
|
28800
|
+
await rename2(temporary, file2);
|
|
28801
|
+
} finally {
|
|
28802
|
+
await rm3(temporary, { force: true });
|
|
28803
|
+
}
|
|
28804
|
+
}
|
|
28805
|
+
|
|
27913
28806
|
// dist/omp-permission-modes.js
|
|
27914
28807
|
var nativePermissionModes = /* @__PURE__ */ new Set(["always-ask", "write", "yolo"]);
|
|
27915
28808
|
var OMP_DEFAULT_PERMISSION_MODE_ID = harnessPermissionModeIdSchema.parse("yolo");
|
|
@@ -28139,7 +29032,7 @@ function normalizedError(error62, fallbackCode) {
|
|
|
28139
29032
|
function invalidState(message3) {
|
|
28140
29033
|
return { code: "invalidState", message: message3, retryable: false };
|
|
28141
29034
|
}
|
|
28142
|
-
function
|
|
29035
|
+
function nativeModelForHistory(state) {
|
|
28143
29036
|
if (state.provider === null && state.modelId === null)
|
|
28144
29037
|
return null;
|
|
28145
29038
|
if (state.provider === null || state.modelId === null) {
|
|
@@ -28147,7 +29040,14 @@ function nativeModelFromState(state) {
|
|
|
28147
29040
|
}
|
|
28148
29041
|
return { provider: state.provider, id: state.modelId };
|
|
28149
29042
|
}
|
|
28150
|
-
function
|
|
29043
|
+
function nativeModelFromState(state) {
|
|
29044
|
+
const model2 = nativeModelForHistory(state);
|
|
29045
|
+
if (model2?.provider === "openai-codex" && state.serviceTier) {
|
|
29046
|
+
model2.serviceTier = state.serviceTier;
|
|
29047
|
+
}
|
|
29048
|
+
return model2;
|
|
29049
|
+
}
|
|
29050
|
+
function harnessStateFromOmp(state, thinkingLevels, index, permissionModeId, speedScope) {
|
|
28151
29051
|
const model2 = nativeModelFromState(state);
|
|
28152
29052
|
const effectiveModel = model2 ? index.ref(model2) : void 0;
|
|
28153
29053
|
const availableThinkingOptions = thinkingLevels ? normalizeOmpThinkingOptions(thinkingLevels) : void 0;
|
|
@@ -28155,12 +29055,14 @@ function harnessStateFromOmp(state, thinkingLevels, index, permissionModeId) {
|
|
|
28155
29055
|
throw new OmpRpcFaultError("protocolError", "Omp effective Thinking level is absent from its available levels");
|
|
28156
29056
|
}
|
|
28157
29057
|
return {
|
|
28158
|
-
|
|
28159
|
-
|
|
28160
|
-
|
|
28161
|
-
|
|
28162
|
-
|
|
28163
|
-
|
|
29058
|
+
...speedScope !== null ? {
|
|
29059
|
+
nativeRef: nativeSessionRefSchema.parse({
|
|
29060
|
+
harnessId: ompHarnessId2,
|
|
29061
|
+
nativeSessionId: state.sessionId,
|
|
29062
|
+
...state.sessionFile ? { locator: { sessionFile: state.sessionFile, speedScope } } : {},
|
|
29063
|
+
formatVersion: 1
|
|
29064
|
+
})
|
|
29065
|
+
} : {},
|
|
28164
29066
|
...effectiveModel ? { effectiveModel } : {},
|
|
28165
29067
|
...state.thinkingLevel ? { effectiveThinkingOptionId: state.thinkingLevel } : {},
|
|
28166
29068
|
...availableThinkingOptions ? { availableThinkingOptions } : {},
|
|
@@ -28180,8 +29082,89 @@ async function reconcileThinkingLevel(transport, state, thinkingLevels) {
|
|
|
28180
29082
|
thinkingLevels: await transport.getAvailableThinkingLevels()
|
|
28181
29083
|
};
|
|
28182
29084
|
}
|
|
28183
|
-
function
|
|
28184
|
-
|
|
29085
|
+
function validateOmpModel(ref) {
|
|
29086
|
+
const parsed = harnessModelRefSchema.parse(ref);
|
|
29087
|
+
if (parsed.serviceTier !== void 0 && parsed.serviceTier !== "priority") {
|
|
29088
|
+
throw new Error("Unsupported Omp service tier");
|
|
29089
|
+
}
|
|
29090
|
+
return parsed;
|
|
29091
|
+
}
|
|
29092
|
+
async function selectBaseModel(transport, model2) {
|
|
29093
|
+
if (!sameOmpModel(nativeModelForHistory(transport.state), model2)) {
|
|
29094
|
+
await transport.selectModel({ provider: model2.provider, id: model2.id });
|
|
29095
|
+
if (!sameOmpModel(nativeModelForHistory(transport.state), model2)) {
|
|
29096
|
+
throw new Error("Omp did not activate the requested Model");
|
|
29097
|
+
}
|
|
29098
|
+
}
|
|
29099
|
+
}
|
|
29100
|
+
async function selectOmpSpeed(transport, fast) {
|
|
29101
|
+
const tier = fast ? "priority" : null;
|
|
29102
|
+
const state = await transport.selectSpeed(tier);
|
|
29103
|
+
if (state.serviceTier === "priority" !== fast) {
|
|
29104
|
+
throw new Error("Omp did not activate the requested speed");
|
|
29105
|
+
}
|
|
29106
|
+
}
|
|
29107
|
+
async function restoreOmpSpeed(transport, fastModelId) {
|
|
29108
|
+
if (!transport.speedAvailable || transport.state.provider !== "openai-codex" || transport.state.modelId !== fastModelId)
|
|
29109
|
+
return null;
|
|
29110
|
+
try {
|
|
29111
|
+
await selectOmpSpeed(transport, true);
|
|
29112
|
+
return fastModelId;
|
|
29113
|
+
} catch (error62) {
|
|
29114
|
+
if (error62 instanceof OmpRpcFaultError)
|
|
29115
|
+
throw error62;
|
|
29116
|
+
if (transport.state.serviceTier === "priority")
|
|
29117
|
+
await selectOmpSpeed(transport, false);
|
|
29118
|
+
return null;
|
|
29119
|
+
}
|
|
29120
|
+
}
|
|
29121
|
+
async function applyOmpModel(transport, requested, ownedFastModelId, commit) {
|
|
29122
|
+
const oldModel = nativeModelForHistory(transport.state);
|
|
29123
|
+
const { serviceTier, thinkingLevel, fastScope } = transport.state;
|
|
29124
|
+
const fast = requested.serviceTier === "priority";
|
|
29125
|
+
if (fast && !transport.speedAvailable) {
|
|
29126
|
+
throw new OmpAdapterFaultError({
|
|
29127
|
+
code: "unsupported",
|
|
29128
|
+
message: "Omp speed selection is unavailable",
|
|
29129
|
+
retryable: false
|
|
29130
|
+
});
|
|
29131
|
+
}
|
|
29132
|
+
const changingModel = !sameOmpModel(oldModel, requested);
|
|
29133
|
+
let attemptedSpeed = false;
|
|
29134
|
+
try {
|
|
29135
|
+
let selection2 = changingModel ? null : ownedFastModelId;
|
|
29136
|
+
await selectBaseModel(transport, requested);
|
|
29137
|
+
if (transport.state.serviceTier === "priority" !== fast) {
|
|
29138
|
+
attemptedSpeed = true;
|
|
29139
|
+
await selectOmpSpeed(transport, fast);
|
|
29140
|
+
selection2 = fast ? requested.id : null;
|
|
29141
|
+
}
|
|
29142
|
+
await commit(selection2);
|
|
29143
|
+
} catch (error62) {
|
|
29144
|
+
if (error62 instanceof OmpRpcFaultError)
|
|
29145
|
+
throw error62;
|
|
29146
|
+
const switched = !sameOmpModel(nativeModelForHistory(transport.state), oldModel);
|
|
29147
|
+
if (!changingModel && (switched || fastScope !== transport.state.fastScope || serviceTier === transport.state.serviceTier && thinkingLevel === transport.state.thinkingLevel)) {
|
|
29148
|
+
throw error62;
|
|
29149
|
+
}
|
|
29150
|
+
try {
|
|
29151
|
+
if (switched && oldModel)
|
|
29152
|
+
await selectBaseModel(transport, oldModel);
|
|
29153
|
+
if (ownedFastModelId && (switched || attemptedSpeed))
|
|
29154
|
+
await selectOmpSpeed(transport, true);
|
|
29155
|
+
else if (attemptedSpeed && !switched)
|
|
29156
|
+
await selectOmpSpeed(transport, false);
|
|
29157
|
+
if (thinkingLevel && thinkingLevel !== transport.state.thinkingLevel) {
|
|
29158
|
+
await transport.selectThinkingOption(thinkingLevel);
|
|
29159
|
+
}
|
|
29160
|
+
if (!sameOmpModel(nativeModelForHistory(transport.state), oldModel) || serviceTier !== transport.state.serviceTier || thinkingLevel !== transport.state.thinkingLevel) {
|
|
29161
|
+
throw new Error("previous configuration was not restored");
|
|
29162
|
+
}
|
|
29163
|
+
} catch (rollbackError) {
|
|
29164
|
+
throw new OmpRpcFaultError("protocolError", `Omp Model selection failed (${errorMessage(error62)}) and could not be rolled back: ${errorMessage(rollbackError)}`);
|
|
29165
|
+
}
|
|
29166
|
+
throw error62;
|
|
29167
|
+
}
|
|
28185
29168
|
}
|
|
28186
29169
|
function sessionFileFromRef(ref) {
|
|
28187
29170
|
if (ref.harnessId !== ompHarnessId2 || !isRecord10(ref.locator) || typeof ref.locator.sessionFile !== "string" || ref.locator.sessionFile.length === 0) {
|
|
@@ -28194,7 +29177,7 @@ function subagentTranscriptPath(parentSessionFile, nativeSubagentId) {
|
|
|
28194
29177
|
if (nativeSubagentId.includes("/") || nativeSubagentId.includes("\\") || nativeSubagentId.includes("\0") || nativeSubagentId === "." || nativeSubagentId === "..") {
|
|
28195
29178
|
throw new Error("Omp Subagent ID is not a plain transcript file name");
|
|
28196
29179
|
}
|
|
28197
|
-
if (!parentSessionFile.endsWith(".jsonl") || !
|
|
29180
|
+
if (!parentSessionFile.endsWith(".jsonl") || !path8.isAbsolute(parentSessionFile)) {
|
|
28198
29181
|
return null;
|
|
28199
29182
|
}
|
|
28200
29183
|
return `${parentSessionFile.slice(0, -".jsonl".length)}/${nativeSubagentId}.jsonl`;
|
|
@@ -28203,7 +29186,7 @@ async function readSubagentTranscriptFile(parentSessionFile, nativeSubagentId) {
|
|
|
28203
29186
|
const transcriptFile = subagentTranscriptPath(parentSessionFile, nativeSubagentId);
|
|
28204
29187
|
if (transcriptFile === null)
|
|
28205
29188
|
return { status: "missing" };
|
|
28206
|
-
const parentDirectory =
|
|
29189
|
+
const parentDirectory = path8.dirname(transcriptFile);
|
|
28207
29190
|
let metadata;
|
|
28208
29191
|
try {
|
|
28209
29192
|
metadata = await stat2(transcriptFile);
|
|
@@ -28221,7 +29204,7 @@ async function readSubagentTranscriptFile(parentSessionFile, nativeSubagentId) {
|
|
|
28221
29204
|
realpath3(transcriptFile),
|
|
28222
29205
|
realpath3(parentDirectory)
|
|
28223
29206
|
]);
|
|
28224
|
-
if (
|
|
29207
|
+
if (path8.dirname(resolvedTranscript) !== resolvedParentDirectory) {
|
|
28225
29208
|
throw new Error("Omp Subagent transcript resolves outside its parent Session directory");
|
|
28226
29209
|
}
|
|
28227
29210
|
return {
|
|
@@ -28286,10 +29269,10 @@ function stripDiffPrefix(pathString) {
|
|
|
28286
29269
|
return pathString.startsWith("a/") || pathString.startsWith("b/") ? pathString.slice(2) : pathString;
|
|
28287
29270
|
}
|
|
28288
29271
|
function displayPath(nativePath, cwd) {
|
|
28289
|
-
const resolvedCwd =
|
|
28290
|
-
const resolvedPath =
|
|
28291
|
-
const relative =
|
|
28292
|
-
const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${
|
|
29272
|
+
const resolvedCwd = path8.resolve(cwd);
|
|
29273
|
+
const resolvedPath = path8.isAbsolute(nativePath) ? path8.resolve(nativePath) : path8.resolve(cwd, nativePath);
|
|
29274
|
+
const relative = path8.relative(resolvedCwd, resolvedPath);
|
|
29275
|
+
const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path8.sep}`);
|
|
28293
29276
|
const selected = inside ? relative : resolvedPath;
|
|
28294
29277
|
const normalized = selected.replaceAll("\\", "/");
|
|
28295
29278
|
if (normalized.length === 0 || normalized === ".")
|
|
@@ -28449,6 +29432,10 @@ var OmpHarnessSession = class {
|
|
|
28449
29432
|
#onClosed;
|
|
28450
29433
|
#requestedModel;
|
|
28451
29434
|
#requestedThinkingOptionId;
|
|
29435
|
+
#fastModelId;
|
|
29436
|
+
#speedScope;
|
|
29437
|
+
#hasNativeRef;
|
|
29438
|
+
#mayHaveTurns;
|
|
28452
29439
|
#toolOutputLimit;
|
|
28453
29440
|
#accountCredits;
|
|
28454
29441
|
#modelIndex;
|
|
@@ -28458,6 +29445,7 @@ var OmpHarnessSession = class {
|
|
|
28458
29445
|
#active = null;
|
|
28459
29446
|
#closePromise = null;
|
|
28460
29447
|
#configuring = false;
|
|
29448
|
+
#modelStateWrites = Promise.resolve();
|
|
28461
29449
|
#phase = "open";
|
|
28462
29450
|
#starting = null;
|
|
28463
29451
|
#state = {};
|
|
@@ -28474,6 +29462,10 @@ var OmpHarnessSession = class {
|
|
|
28474
29462
|
this.#closeTimeoutMs = options.closeTimeoutMs;
|
|
28475
29463
|
this.#requestedModel = options.model;
|
|
28476
29464
|
this.#requestedThinkingOptionId = options.thinkingOptionId;
|
|
29465
|
+
this.#fastModelId = options.fastModelId ?? null;
|
|
29466
|
+
this.#speedScope = options.speedScope ?? randomUUID5();
|
|
29467
|
+
this.#hasNativeRef = !!options.startedTransport;
|
|
29468
|
+
this.#mayHaveTurns = this.#hasNativeRef;
|
|
28477
29469
|
this.#toolOutputLimit = options.toolOutputLimit;
|
|
28478
29470
|
this.#accountCredits = options.accountCredits;
|
|
28479
29471
|
this.#accountKey = options.initialAccountKey ?? null;
|
|
@@ -28498,7 +29490,7 @@ var OmpHarnessSession = class {
|
|
|
28498
29490
|
};
|
|
28499
29491
|
this.#transport = options.startedTransport ?? null;
|
|
28500
29492
|
this.#modelIndex = createOmpModelIndex(options.startedModels ?? []);
|
|
28501
|
-
this.initialState = options.startedTransport ? harnessStateFromOmp(options.startedTransport.state, options.startedThinkingLevels ?? null, this.#modelIndex, this.#permissionModeId) : { effectivePermissionModeId: this.#permissionModeId };
|
|
29493
|
+
this.initialState = options.startedTransport ? harnessStateFromOmp(options.startedTransport.state, options.startedThinkingLevels ?? null, this.#modelIndex, this.#permissionModeId, this.#speedScope) : { effectivePermissionModeId: this.#permissionModeId };
|
|
28502
29494
|
this.initialUsage = options.initialUsage ?? null;
|
|
28503
29495
|
this.#usage = this.initialUsage;
|
|
28504
29496
|
this.#state = this.initialState;
|
|
@@ -28543,10 +29535,10 @@ var OmpHarnessSession = class {
|
|
|
28543
29535
|
if (this.#phase !== "open")
|
|
28544
29536
|
return;
|
|
28545
29537
|
this.#finishAccountAttempt(ompMessageAccount(observation.message));
|
|
28546
|
-
const
|
|
28547
|
-
if (
|
|
28548
|
-
this.#event({ type: "usage.request", request:
|
|
28549
|
-
else if (
|
|
29538
|
+
const record4 = ompUsageRecord(observation.message, observation);
|
|
29539
|
+
if (record4?.kind === "request")
|
|
29540
|
+
this.#event({ type: "usage.request", request: record4.request });
|
|
29541
|
+
else if (record4?.kind === "missing")
|
|
28550
29542
|
this.#event({ type: "usage.history", complete: false });
|
|
28551
29543
|
}
|
|
28552
29544
|
#displayedAccount() {
|
|
@@ -28708,7 +29700,7 @@ var OmpHarnessSession = class {
|
|
|
28708
29700
|
}
|
|
28709
29701
|
this.#acceptingTurn = true;
|
|
28710
29702
|
try {
|
|
28711
|
-
const
|
|
29703
|
+
const noHistory = !this.#mayHaveTurns;
|
|
28712
29704
|
let transport;
|
|
28713
29705
|
try {
|
|
28714
29706
|
transport = await this.#ensureTransport();
|
|
@@ -28719,7 +29711,7 @@ var OmpHarnessSession = class {
|
|
|
28719
29711
|
return { ok: false, error: invalidState("Omp Session became unavailable during startup") };
|
|
28720
29712
|
}
|
|
28721
29713
|
let beforeHistory;
|
|
28722
|
-
if (
|
|
29714
|
+
if (noHistory) {
|
|
28723
29715
|
beforeHistory = { turns: [] };
|
|
28724
29716
|
} else {
|
|
28725
29717
|
try {
|
|
@@ -28766,29 +29758,41 @@ var OmpHarnessSession = class {
|
|
|
28766
29758
|
this.#event({ type: "turn.started", turnId: command.turnId });
|
|
28767
29759
|
this.#event({ type: "item.started", turnId: command.turnId, item });
|
|
28768
29760
|
void transport.runTurn(text3, (event) => this.#handleTurnEvent(active2, event)).then(async (result) => {
|
|
29761
|
+
if (active2.admission)
|
|
29762
|
+
await active2.admission;
|
|
28769
29763
|
if (!result.agentInvoked) {
|
|
29764
|
+
await this.#observeTurnState(transport, "unconfirmed");
|
|
28770
29765
|
this.#completeTurn(active2, result.error !== void 0 ? { status: "failed", error: normalizedError(result.error, "nativeFailure") } : result.cancelled ? { status: "cancelled", reason: "Cancelled by user" } : { status: "succeeded" }, result.text, void 0, true);
|
|
28771
29766
|
return;
|
|
28772
29767
|
}
|
|
28773
29768
|
try {
|
|
29769
|
+
this.#mayHaveTurns = true;
|
|
28774
29770
|
const identity2 = await this.#completedTurnIdentity(active2, transport);
|
|
29771
|
+
await this.#observeTurnState(transport, "persisted");
|
|
28775
29772
|
this.#completeTurn(active2, result.cancelled ? {
|
|
28776
29773
|
status: "cancelled",
|
|
28777
29774
|
reason: "Cancelled by user",
|
|
28778
29775
|
checkpoint: identity2.checkpoint
|
|
28779
29776
|
} : { status: "succeeded", checkpoint: identity2.checkpoint }, result.text, identity2.nativeTurnRef);
|
|
28780
29777
|
} catch (error62) {
|
|
29778
|
+
if (this.#phase === "open")
|
|
29779
|
+
await this.#observeTurnState(transport, "unconfirmed");
|
|
28781
29780
|
this.#completeTurn(active2, {
|
|
28782
29781
|
status: "failed",
|
|
28783
29782
|
error: normalizedError(error62, "protocolError")
|
|
28784
29783
|
});
|
|
28785
29784
|
}
|
|
28786
29785
|
}).catch(async (error62) => {
|
|
29786
|
+
if (active2.admission)
|
|
29787
|
+
await active2.admission;
|
|
28787
29788
|
let identity2;
|
|
28788
29789
|
try {
|
|
28789
29790
|
identity2 = await this.#completedTurnIdentity(active2, transport);
|
|
29791
|
+
this.#mayHaveTurns = true;
|
|
28790
29792
|
} catch {
|
|
28791
29793
|
}
|
|
29794
|
+
if (this.#phase === "open")
|
|
29795
|
+
await this.#observeTurnState(transport, identity2 ? "persisted" : "unconfirmed");
|
|
28792
29796
|
this.#completeTurn(active2, {
|
|
28793
29797
|
status: "failed",
|
|
28794
29798
|
error: normalizedError(error62, "nativeFailure"),
|
|
@@ -28807,7 +29811,7 @@ var OmpHarnessSession = class {
|
|
|
28807
29811
|
return this.#closePromise;
|
|
28808
29812
|
}
|
|
28809
29813
|
async #selectModel(command) {
|
|
28810
|
-
if (this.#acceptingTurn || this.#configuring) {
|
|
29814
|
+
if (this.#acceptingTurn || this.#configuring || this.#starting) {
|
|
28811
29815
|
return {
|
|
28812
29816
|
ok: false,
|
|
28813
29817
|
error: {
|
|
@@ -28817,56 +29821,84 @@ var OmpHarnessSession = class {
|
|
|
28817
29821
|
}
|
|
28818
29822
|
};
|
|
28819
29823
|
}
|
|
28820
|
-
const transport = this.#transport;
|
|
28821
|
-
if (!transport) {
|
|
28822
|
-
return {
|
|
28823
|
-
ok: false,
|
|
28824
|
-
error: invalidState("Omp Model selection requires a started Native Session")
|
|
28825
|
-
};
|
|
28826
|
-
}
|
|
28827
|
-
const previousModel = this.#state.effectiveModel;
|
|
28828
29824
|
this.#configuring = true;
|
|
28829
29825
|
try {
|
|
28830
|
-
|
|
29826
|
+
return await this.#withModelState(() => this.#applyModelSelection(command));
|
|
29827
|
+
} finally {
|
|
29828
|
+
this.#configuring = false;
|
|
29829
|
+
}
|
|
29830
|
+
}
|
|
29831
|
+
// Turn admission/settlement and the composer both publish the model and persist its preference.
|
|
29832
|
+
#withModelState(update) {
|
|
29833
|
+
const result = this.#modelStateWrites.then(update);
|
|
29834
|
+
this.#modelStateWrites = result.then(() => void 0, () => void 0);
|
|
29835
|
+
return result;
|
|
29836
|
+
}
|
|
29837
|
+
async #applyModelSelection(command) {
|
|
29838
|
+
try {
|
|
29839
|
+
let model2;
|
|
28831
29840
|
try {
|
|
28832
|
-
|
|
28833
|
-
requested = resolveOmpModelRef(harnessModelRefSchema.parse(command.model), index);
|
|
28834
|
-
this.#modelIndex = index;
|
|
29841
|
+
model2 = validateOmpModel(command.model);
|
|
28835
29842
|
} catch (error62) {
|
|
28836
29843
|
return { ok: false, error: normalizedError(error62, "invalidRequest") };
|
|
28837
29844
|
}
|
|
28838
|
-
|
|
28839
|
-
|
|
29845
|
+
const transport = this.#transport;
|
|
29846
|
+
if (!transport) {
|
|
29847
|
+
await this.#ensureTransport(model2, true);
|
|
29848
|
+
this.#requestedModel = model2;
|
|
29849
|
+
return { ok: true, value: { completed: true } };
|
|
29850
|
+
}
|
|
29851
|
+
let requested;
|
|
28840
29852
|
try {
|
|
28841
|
-
|
|
28842
|
-
|
|
28843
|
-
const reconciled = await reconcileThinkingLevel(transport, state, thinkingLevels);
|
|
28844
|
-
state = reconciled.state;
|
|
28845
|
-
thinkingLevels = reconciled.thinkingLevels;
|
|
28846
|
-
this.#publishTransportState(state, thinkingLevels);
|
|
29853
|
+
this.#modelIndex = createOmpModelIndex(await transport.getAvailableModels());
|
|
29854
|
+
requested = resolveOmpModelRef(model2, this.#modelIndex);
|
|
28847
29855
|
} catch (error62) {
|
|
28848
|
-
|
|
28849
|
-
this.#fault(error62);
|
|
28850
|
-
return { ok: false, error: normalizedError(error62, "nativeFailure") };
|
|
28851
|
-
}
|
|
28852
|
-
const actual = nativeModelFromState(state);
|
|
28853
|
-
if (previousModel?.id !== this.#state.effectiveModel?.id) {
|
|
28854
|
-
this.#invalidateUsage();
|
|
28855
|
-
void this.#refreshUsage();
|
|
29856
|
+
return { ok: false, error: normalizedError(error62, "invalidRequest") };
|
|
28856
29857
|
}
|
|
28857
|
-
|
|
29858
|
+
const previousModel = nativeModelFromState(transport.state);
|
|
29859
|
+
const changingModel = !sameOmpModel(previousModel, requested);
|
|
29860
|
+
if (this.#active && changingModel && (requested.serviceTier === "priority" || previousModel?.serviceTier === "priority" || this.#fastModelId !== null)) {
|
|
28858
29861
|
return {
|
|
28859
29862
|
ok: false,
|
|
28860
29863
|
error: {
|
|
28861
|
-
code: "
|
|
28862
|
-
message: "Omp
|
|
28863
|
-
retryable:
|
|
29864
|
+
code: "sessionBusy",
|
|
29865
|
+
message: "Omp cannot switch models and Fast mode together during an active Turn",
|
|
29866
|
+
retryable: true
|
|
28864
29867
|
}
|
|
28865
29868
|
};
|
|
28866
29869
|
}
|
|
29870
|
+
await applyOmpModel(transport, requested, this.#fastModelId, async (selection2) => {
|
|
29871
|
+
const current = transport.state;
|
|
29872
|
+
const reconciled = changingModel ? await reconcileThinkingLevel(transport, current, await transport.getAvailableThinkingLevels()) : { state: current, thinkingLevels: current.availableThinkingLevels };
|
|
29873
|
+
const state = this.#projectState(reconciled.state, reconciled.thinkingLevels);
|
|
29874
|
+
this.#confirmModel(model2, state);
|
|
29875
|
+
if (this.#hasNativeRef && selection2 !== this.#fastModelId) {
|
|
29876
|
+
await writeOmpSpeedSelection(reconciled.state, this.#speedScope, selection2);
|
|
29877
|
+
}
|
|
29878
|
+
this.#fastModelId = selection2;
|
|
29879
|
+
this.#requestedModel = model2;
|
|
29880
|
+
this.#publishState(state);
|
|
29881
|
+
});
|
|
29882
|
+
if (changingModel) {
|
|
29883
|
+
this.#invalidateUsage();
|
|
29884
|
+
void this.#refreshUsage();
|
|
29885
|
+
}
|
|
28867
29886
|
return { ok: true, value: { completed: true } };
|
|
28868
|
-
}
|
|
28869
|
-
|
|
29887
|
+
} catch (error62) {
|
|
29888
|
+
if (error62 instanceof OmpRpcFaultError) {
|
|
29889
|
+
this.#fault(error62);
|
|
29890
|
+
void this.#transport?.close().catch(() => void 0);
|
|
29891
|
+
}
|
|
29892
|
+
return { ok: false, error: normalizedError(error62, "nativeFailure") };
|
|
29893
|
+
}
|
|
29894
|
+
}
|
|
29895
|
+
#confirmModel(requested, state) {
|
|
29896
|
+
if (!sameHarnessModelRef(state.effectiveModel, requested)) {
|
|
29897
|
+
throw new OmpAdapterFaultError({
|
|
29898
|
+
code: "nativeFailure",
|
|
29899
|
+
message: "Omp did not activate the requested Model and speed",
|
|
29900
|
+
retryable: false
|
|
29901
|
+
});
|
|
28870
29902
|
}
|
|
28871
29903
|
}
|
|
28872
29904
|
async #selectThinking(command) {
|
|
@@ -28933,6 +29965,7 @@ var OmpHarnessSession = class {
|
|
|
28933
29965
|
}
|
|
28934
29966
|
try {
|
|
28935
29967
|
this.#publishTransportState(state, thinkingLevels);
|
|
29968
|
+
this.#requestedThinkingOptionId = thinkingOptionId;
|
|
28936
29969
|
} catch (error62) {
|
|
28937
29970
|
if (error62 instanceof OmpRpcFaultError)
|
|
28938
29971
|
this.#fault(error62);
|
|
@@ -28966,7 +29999,16 @@ var OmpHarnessSession = class {
|
|
|
28966
29999
|
return { ok: true, value: { completed: true } };
|
|
28967
30000
|
}
|
|
28968
30001
|
const transport = this.#transport;
|
|
28969
|
-
if (!transport) {
|
|
30002
|
+
if (!transport || !this.#mayHaveTurns) {
|
|
30003
|
+
if (transport) {
|
|
30004
|
+
this.#configuring = true;
|
|
30005
|
+
try {
|
|
30006
|
+
await transport.close();
|
|
30007
|
+
this.#transport = null;
|
|
30008
|
+
} finally {
|
|
30009
|
+
this.#configuring = false;
|
|
30010
|
+
}
|
|
30011
|
+
}
|
|
28970
30012
|
this.#permissionMode = permissionMode;
|
|
28971
30013
|
this.#permissionModeId = permissionModeId;
|
|
28972
30014
|
this.#state = { ...this.#state, effectivePermissionModeId: permissionModeId };
|
|
@@ -29002,6 +30044,7 @@ var OmpHarnessSession = class {
|
|
|
29002
30044
|
throw new Error("Omp Permission Mode restart changed the Native Session identity");
|
|
29003
30045
|
}
|
|
29004
30046
|
const thinkingLevels = await replacement.getAvailableThinkingLevels();
|
|
30047
|
+
await this.#restoreAfterRestart(replacement);
|
|
29005
30048
|
this.#transport = replacement;
|
|
29006
30049
|
this.#permissionMode = permissionMode;
|
|
29007
30050
|
this.#permissionModeId = permissionModeId;
|
|
@@ -29017,6 +30060,7 @@ var OmpHarnessSession = class {
|
|
|
29017
30060
|
throw new Error("Omp Permission Mode recovery changed the Native Session identity");
|
|
29018
30061
|
}
|
|
29019
30062
|
const thinkingLevels = await recovery.getAvailableThinkingLevels();
|
|
30063
|
+
await this.#restoreAfterRestart(recovery);
|
|
29020
30064
|
this.#transport = recovery;
|
|
29021
30065
|
this.#publishTransportState(recovery.state, thinkingLevels);
|
|
29022
30066
|
} catch (recoveryError) {
|
|
@@ -29307,7 +30351,7 @@ var OmpHarnessSession = class {
|
|
|
29307
30351
|
this.#acceptingTurn = false;
|
|
29308
30352
|
}
|
|
29309
30353
|
}
|
|
29310
|
-
async #ensureTransport() {
|
|
30354
|
+
async #ensureTransport(requestedModel = this.#requestedModel, configure = false) {
|
|
29311
30355
|
if (this.#transport)
|
|
29312
30356
|
return this.#transport;
|
|
29313
30357
|
if (this.#starting)
|
|
@@ -29324,46 +30368,57 @@ var OmpHarnessSession = class {
|
|
|
29324
30368
|
const starting = transport.start().then(async () => {
|
|
29325
30369
|
if (this.#phase !== "open")
|
|
29326
30370
|
throw new Error("Omp Session closed during startup");
|
|
29327
|
-
let state = transport.state;
|
|
29328
30371
|
const models = await transport.getAvailableModels();
|
|
29329
30372
|
this.#modelIndex = createOmpModelIndex(models);
|
|
29330
|
-
let
|
|
29331
|
-
if (
|
|
29332
|
-
|
|
29333
|
-
|
|
29334
|
-
|
|
29335
|
-
|
|
29336
|
-
|
|
29337
|
-
|
|
29338
|
-
|
|
29339
|
-
|
|
29340
|
-
|
|
29341
|
-
|
|
29342
|
-
|
|
29343
|
-
if (!thinkingLevels) {
|
|
29344
|
-
|
|
29345
|
-
|
|
29346
|
-
|
|
29347
|
-
|
|
29348
|
-
|
|
29349
|
-
|
|
29350
|
-
|
|
29351
|
-
|
|
30373
|
+
let requested;
|
|
30374
|
+
if (requestedModel) {
|
|
30375
|
+
try {
|
|
30376
|
+
requested = resolveOmpModelRef(requestedModel, this.#modelIndex);
|
|
30377
|
+
} catch (error62) {
|
|
30378
|
+
throw new OmpAdapterFaultError(normalizedError(error62, "invalidRequest"));
|
|
30379
|
+
}
|
|
30380
|
+
}
|
|
30381
|
+
const finishStartup = async (selection2) => {
|
|
30382
|
+
let state = transport.state;
|
|
30383
|
+
let thinkingLevels = await transport.getAvailableThinkingLevels();
|
|
30384
|
+
const requestedThinking = this.#requestedThinkingOptionId;
|
|
30385
|
+
const changedDraftModel = configure && requestedModel?.id !== this.#requestedModel?.id;
|
|
30386
|
+
if (requestedThinking && (!changedDraftModel || thinkingLevels?.includes(requestedThinking))) {
|
|
30387
|
+
if (thinkingLevels) {
|
|
30388
|
+
state = await transport.selectThinkingOption(requestedThinking);
|
|
30389
|
+
thinkingLevels = await transport.getAvailableThinkingLevels();
|
|
30390
|
+
} else {
|
|
30391
|
+
const current = nativeModelFromState(state);
|
|
30392
|
+
const thinkingAlreadyOff = requestedThinking === "off" && (state.thinkingLevel === "off" || current !== null && models.some((model2) => sameOmpModel(model2, current) && model2.reasoning === false));
|
|
30393
|
+
if (!thinkingAlreadyOff) {
|
|
30394
|
+
throw new OmpAdapterFaultError({
|
|
30395
|
+
code: "unsupported",
|
|
30396
|
+
message: "Installed Omp does not support Thinking selection",
|
|
30397
|
+
retryable: false
|
|
30398
|
+
});
|
|
30399
|
+
}
|
|
29352
30400
|
}
|
|
29353
|
-
} else {
|
|
29354
|
-
state = await transport.selectThinkingOption(this.#requestedThinkingOptionId);
|
|
29355
|
-
thinkingLevels = await transport.getAvailableThinkingLevels();
|
|
29356
30401
|
}
|
|
29357
|
-
|
|
29358
|
-
|
|
29359
|
-
|
|
29360
|
-
|
|
29361
|
-
|
|
29362
|
-
|
|
30402
|
+
const reconciled = await reconcileThinkingLevel(transport, state, thinkingLevels);
|
|
30403
|
+
const projected = this.#projectState(reconciled.state, reconciled.thinkingLevels);
|
|
30404
|
+
if (requestedModel)
|
|
30405
|
+
this.#confirmModel(requestedModel, projected);
|
|
30406
|
+
if (this.#phase !== "open")
|
|
30407
|
+
throw new Error("Omp Session closed during configuration");
|
|
30408
|
+
this.#fastModelId = selection2;
|
|
30409
|
+
if (configure)
|
|
30410
|
+
this.#requestedThinkingOptionId = projected.effectiveThinkingOptionId;
|
|
30411
|
+
this.#transport = transport;
|
|
30412
|
+
this.#publishState(projected);
|
|
30413
|
+
};
|
|
30414
|
+
if (requested)
|
|
30415
|
+
await applyOmpModel(transport, requested, null, finishStartup);
|
|
30416
|
+
else
|
|
30417
|
+
await finishStartup(null);
|
|
29363
30418
|
return transport;
|
|
29364
30419
|
}).catch(async (error62) => {
|
|
29365
30420
|
await transport.close().catch(() => void 0);
|
|
29366
|
-
if (this.#phase === "open")
|
|
30421
|
+
if (this.#phase === "open" && !configure)
|
|
29367
30422
|
this.#fault(error62);
|
|
29368
30423
|
throw error62;
|
|
29369
30424
|
}).finally(() => {
|
|
@@ -29373,9 +30428,59 @@ var OmpHarnessSession = class {
|
|
|
29373
30428
|
this.#starting = starting;
|
|
29374
30429
|
return starting;
|
|
29375
30430
|
}
|
|
30431
|
+
async #restoreAfterRestart(transport) {
|
|
30432
|
+
if (!this.#fastModelId)
|
|
30433
|
+
return;
|
|
30434
|
+
this.#fastModelId = await restoreOmpSpeed(transport, this.#fastModelId);
|
|
30435
|
+
if (!this.#fastModelId) {
|
|
30436
|
+
await writeOmpSpeedSelection(transport.state, this.#speedScope, null).catch(() => void 0);
|
|
30437
|
+
}
|
|
30438
|
+
}
|
|
30439
|
+
#observeTurnState(transport, journal) {
|
|
30440
|
+
return this.#withModelState(() => this.#synchronizeTurnState(transport, journal));
|
|
30441
|
+
}
|
|
30442
|
+
async #synchronizeTurnState(transport, journal) {
|
|
30443
|
+
const state = transport.state;
|
|
30444
|
+
const publishIdentity = journal !== "unconfirmed" && !this.#hasNativeRef;
|
|
30445
|
+
const selection2 = this.#fastModelId;
|
|
30446
|
+
const relinquish = selection2 !== null && (state.provider !== "openai-codex" || state.modelId !== selection2 || state.serviceTier !== "priority");
|
|
30447
|
+
if (publishIdentity && selection2 && !relinquish || this.#hasNativeRef && relinquish) {
|
|
30448
|
+
await writeOmpSpeedSelection(state, this.#speedScope, relinquish ? null : selection2).catch(() => void 0);
|
|
30449
|
+
}
|
|
30450
|
+
if (relinquish) {
|
|
30451
|
+
this.#fastModelId = null;
|
|
30452
|
+
this.#requestedModel = void 0;
|
|
30453
|
+
}
|
|
30454
|
+
if (journal === "admitted" && this.#phase !== "open")
|
|
30455
|
+
return;
|
|
30456
|
+
if (publishIdentity)
|
|
30457
|
+
this.#hasNativeRef = true;
|
|
30458
|
+
if (journal === "admitted") {
|
|
30459
|
+
const { nativeRef } = this.#projectState(state, null);
|
|
30460
|
+
if (nativeRef)
|
|
30461
|
+
this.#publishState({ ...this.#state, nativeRef });
|
|
30462
|
+
return;
|
|
30463
|
+
}
|
|
30464
|
+
const model2 = nativeModelFromState(state);
|
|
30465
|
+
if (publishIdentity || !sameHarnessModelRef(this.#state.effectiveModel, model2 ? this.#modelIndex.ref(model2) : void 0) || this.#state.effectiveThinkingOptionId !== (state.thinkingLevel ?? void 0)) {
|
|
30466
|
+
try {
|
|
30467
|
+
const actual = await reconcileThinkingLevel(transport, state, state.availableThinkingLevels);
|
|
30468
|
+
this.#publishTransportState(actual.state, actual.thinkingLevels);
|
|
30469
|
+
} catch (error62) {
|
|
30470
|
+
this.#fault(error62);
|
|
30471
|
+
void transport.close().catch(() => void 0);
|
|
30472
|
+
}
|
|
30473
|
+
}
|
|
30474
|
+
}
|
|
30475
|
+
#projectState(state, levels) {
|
|
30476
|
+
return harnessStateFromOmp(state, levels, this.#modelIndex, this.#permissionModeId, this.#hasNativeRef ? this.#speedScope : null);
|
|
30477
|
+
}
|
|
30478
|
+
#publishState(state) {
|
|
30479
|
+
this.#state = state;
|
|
30480
|
+
this.#event({ type: "session.state.changed", state });
|
|
30481
|
+
}
|
|
29376
30482
|
#publishTransportState(state, thinkingLevels) {
|
|
29377
|
-
this.#
|
|
29378
|
-
this.#event({ type: "session.state.changed", state: this.#state });
|
|
30483
|
+
this.#publishState(this.#projectState(state, thinkingLevels));
|
|
29379
30484
|
}
|
|
29380
30485
|
#invalidateUsage() {
|
|
29381
30486
|
this.#usageGeneration += 1;
|
|
@@ -29414,6 +30519,12 @@ var OmpHarnessSession = class {
|
|
|
29414
30519
|
if (this.#active !== active2 || this.#phase === "closed" || this.#phase === "faulted")
|
|
29415
30520
|
return;
|
|
29416
30521
|
switch (event.type) {
|
|
30522
|
+
case "agent.started":
|
|
30523
|
+
this.#mayHaveTurns = true;
|
|
30524
|
+
if (!this.#hasNativeRef && !active2.admission && this.#transport?.state.sessionFile) {
|
|
30525
|
+
active2.admission = this.#observeTurnState(this.#transport, "admitted").catch((error62) => this.#fault(error62));
|
|
30526
|
+
}
|
|
30527
|
+
return;
|
|
29417
30528
|
case "text.delta":
|
|
29418
30529
|
this.#activateAgentMessage(active2, event.messageId);
|
|
29419
30530
|
this.#appendText(active2, event.delta);
|
|
@@ -29496,7 +30607,7 @@ var OmpHarnessSession = class {
|
|
|
29496
30607
|
if (active2.interactionByNativeId.has(request.requestId)) {
|
|
29497
30608
|
throw new Error("Omp Interaction started more than once");
|
|
29498
30609
|
}
|
|
29499
|
-
const interactionId = hostInteractionIdSchema.parse(
|
|
30610
|
+
const interactionId = hostInteractionIdSchema.parse(randomUUID5());
|
|
29500
30611
|
let interaction;
|
|
29501
30612
|
if (request.method === "select" && request.options.length === 2 && request.options[0] === "Approve" && request.options[1] === "Deny") {
|
|
29502
30613
|
interaction = {
|
|
@@ -29877,7 +30988,7 @@ var OmpHarnessSession = class {
|
|
|
29877
30988
|
this.#channel.emit({ kind: "event", event });
|
|
29878
30989
|
}
|
|
29879
30990
|
#newItemId() {
|
|
29880
|
-
return hostItemIdSchema.parse(
|
|
30991
|
+
return hostItemIdSchema.parse(randomUUID5());
|
|
29881
30992
|
}
|
|
29882
30993
|
};
|
|
29883
30994
|
var OmpAdapter = class {
|
|
@@ -29981,7 +31092,7 @@ var OmpAdapter = class {
|
|
|
29981
31092
|
const leafId = entries.at(-1)?.id;
|
|
29982
31093
|
const snapshot = mapOmpSnapshot({ entries, leafId: typeof leafId === "string" ? leafId : null }, {
|
|
29983
31094
|
sessionId: input3.parent.nativeSessionId,
|
|
29984
|
-
model:
|
|
31095
|
+
model: nativeModelForHistory(transport.state)
|
|
29985
31096
|
});
|
|
29986
31097
|
return { ok: true, value: snapshot };
|
|
29987
31098
|
} catch (error62) {
|
|
@@ -30162,7 +31273,7 @@ var OmpAdapter = class {
|
|
|
30162
31273
|
const models = await transport.getAvailableModels();
|
|
30163
31274
|
stage = "capabilities";
|
|
30164
31275
|
const thinkingLevels = await transport.getAvailableThinkingLevels();
|
|
30165
|
-
const catalog = normalizeOmpModelCatalog(models, nativeModelFromState(transport.state), thinkingLevels, transport.state.thinkingLevel);
|
|
31276
|
+
const catalog = normalizeOmpModelCatalog(models, nativeModelFromState(transport.state), thinkingLevels, transport.state.thinkingLevel, transport.speedAvailable);
|
|
30166
31277
|
await transport.close();
|
|
30167
31278
|
return {
|
|
30168
31279
|
status: "ready",
|
|
@@ -30204,6 +31315,14 @@ var OmpAdapter = class {
|
|
|
30204
31315
|
}
|
|
30205
31316
|
};
|
|
30206
31317
|
}
|
|
31318
|
+
const modelHint = "model" in input3 ? input3.model : void 0;
|
|
31319
|
+
if (modelHint && input3.kind === "create") {
|
|
31320
|
+
try {
|
|
31321
|
+
validateOmpModel(modelHint);
|
|
31322
|
+
} catch (error62) {
|
|
31323
|
+
return { ok: false, error: normalizedError(error62, "invalidRequest") };
|
|
31324
|
+
}
|
|
31325
|
+
}
|
|
30207
31326
|
const environment = input3.environment ? { ...this.#environment, ...input3.environment } : this.#environment;
|
|
30208
31327
|
if (input3.kind === "create") {
|
|
30209
31328
|
let permissionModeId = input3.permissionModeId ?? (input3.executionPolicy === "unattended-full-access" ? encodeOmpPermissionModeId("yolo") : OMP_DEFAULT_PERMISSION_MODE_ID);
|
|
@@ -30214,15 +31333,6 @@ var OmpAdapter = class {
|
|
|
30214
31333
|
} catch (error62) {
|
|
30215
31334
|
return { ok: false, error: normalizedError(error62, "invalidRequest") };
|
|
30216
31335
|
}
|
|
30217
|
-
if (input3.model) {
|
|
30218
|
-
const parsed = harnessModelRefSchema.safeParse(input3.model);
|
|
30219
|
-
if (!parsed.success || parsed.data.serviceTier) {
|
|
30220
|
-
return {
|
|
30221
|
-
ok: false,
|
|
30222
|
-
error: { code: "invalidRequest", message: "Invalid Omp Model Ref", retryable: false }
|
|
30223
|
-
};
|
|
30224
|
-
}
|
|
30225
|
-
}
|
|
30226
31336
|
const thinkingOptionId = input3.thinkingOptionId ? harnessThinkingOptionIdSchema.safeParse(input3.thinkingOptionId) : null;
|
|
30227
31337
|
if (thinkingOptionId && !thinkingOptionId.success) {
|
|
30228
31338
|
return {
|
|
@@ -30271,15 +31381,18 @@ var OmpAdapter = class {
|
|
|
30271
31381
|
});
|
|
30272
31382
|
}
|
|
30273
31383
|
}
|
|
30274
|
-
|
|
31384
|
+
const callbacks = {
|
|
30275
31385
|
cwd: input3.cwd,
|
|
30276
31386
|
environment,
|
|
30277
|
-
...input3.kind === "resume" ? { sessionFile: sourceSessionFile } : { forkSessionFile: sourceSessionFile },
|
|
30278
31387
|
onFault: (error62) => session?.handleTransportFault(error62),
|
|
30279
31388
|
onSubagentEvent: (event) => session?.handleTransportEvent(event),
|
|
30280
31389
|
onAssistantStart: (message3) => session?.handleAssistantStart(message3),
|
|
30281
31390
|
onAssistantSummary: (messages) => session?.handleAssistantSummary(messages),
|
|
30282
31391
|
onUsage: (observation) => session?.handleTransportUsage(observation)
|
|
31392
|
+
};
|
|
31393
|
+
transport = this.#createTransport({
|
|
31394
|
+
...callbacks,
|
|
31395
|
+
...input3.kind === "resume" ? { sessionFile: sourceSessionFile } : { forkSessionFile: sourceSessionFile }
|
|
30283
31396
|
});
|
|
30284
31397
|
await transport.start();
|
|
30285
31398
|
if (input3.kind === "resume") {
|
|
@@ -30330,6 +31443,27 @@ var OmpAdapter = class {
|
|
|
30330
31443
|
});
|
|
30331
31444
|
}
|
|
30332
31445
|
}
|
|
31446
|
+
const startedModels = await transport.getAvailableModels();
|
|
31447
|
+
const current = nativeModelForHistory(transport.state);
|
|
31448
|
+
const locator = sourceRef.locator;
|
|
31449
|
+
let sourceScope;
|
|
31450
|
+
if (isRecord10(locator) && typeof locator.speedScope === "string")
|
|
31451
|
+
sourceScope = locator.speedScope;
|
|
31452
|
+
else if (environment.CODEXHOST_THREAD_ID)
|
|
31453
|
+
sourceScope = `legacy:${environment.CODEXHOST_DATA_DIR ?? ""}`;
|
|
31454
|
+
const speedScope = input3.kind === "resume" && sourceScope ? sourceScope : randomUUID5();
|
|
31455
|
+
let fastModelId = null;
|
|
31456
|
+
const stored = sourceScope ? await readOmpSpeedSelection(sourceSessionFile, sourceRef.nativeSessionId, sourceScope) : null;
|
|
31457
|
+
if (stored) {
|
|
31458
|
+
const eligible = current?.id === stored && startedModels.some((m) => sameOmpModel(m, current) && supportsOmpChatGptFast(m));
|
|
31459
|
+
const consistent = !modelHint || current && createOmpModelIndex(startedModels).ref(current).id === modelHint.id && modelHint.serviceTier === "priority";
|
|
31460
|
+
if (eligible && consistent)
|
|
31461
|
+
fastModelId = await restoreOmpSpeed(transport, stored);
|
|
31462
|
+
const previous = input3.kind === "resume" ? stored : null;
|
|
31463
|
+
if (previous !== fastModelId) {
|
|
31464
|
+
await writeOmpSpeedSelection(transport.state, speedScope, fastModelId).catch(() => void 0);
|
|
31465
|
+
}
|
|
31466
|
+
}
|
|
30333
31467
|
let startedThinkingLevels = await transport.getAvailableThinkingLevels();
|
|
30334
31468
|
const reconciled = await reconcileThinkingLevel(transport, transport.state, startedThinkingLevels);
|
|
30335
31469
|
startedThinkingLevels = reconciled.thinkingLevels;
|
|
@@ -30348,7 +31482,9 @@ var OmpAdapter = class {
|
|
|
30348
31482
|
initialAccountKey,
|
|
30349
31483
|
environment,
|
|
30350
31484
|
startedTransport: transport,
|
|
30351
|
-
startedModels
|
|
31485
|
+
startedModels,
|
|
31486
|
+
fastModelId,
|
|
31487
|
+
speedScope,
|
|
30352
31488
|
startedThinkingLevels,
|
|
30353
31489
|
initialUsage,
|
|
30354
31490
|
supportsThinkingSelection: startedThinkingLevels !== null,
|
|
@@ -30374,7 +31510,7 @@ var OmpAdapter = class {
|
|
|
30374
31510
|
#trackSession(cwd, options) {
|
|
30375
31511
|
const environment = options.environment;
|
|
30376
31512
|
const entries = Object.entries(environment).filter(([name]) => name !== "CODEXHOST_THREAD_ID").sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
30377
|
-
const key =
|
|
31513
|
+
const key = createHash3("sha256").update(JSON.stringify([cwd, entries])).digest("hex");
|
|
30378
31514
|
let quota = this.#sessionQuota.get(key);
|
|
30379
31515
|
if (!quota) {
|
|
30380
31516
|
quota = {
|
|
@@ -30400,6 +31536,8 @@ var OmpAdapter = class {
|
|
|
30400
31536
|
permissionMode: options.permissionMode,
|
|
30401
31537
|
permissionModeId: options.permissionModeId,
|
|
30402
31538
|
...options.startedTransport ? { startedTransport: options.startedTransport } : {},
|
|
31539
|
+
...options.fastModelId ? { fastModelId: options.fastModelId } : {},
|
|
31540
|
+
...options.speedScope ? { speedScope: options.speedScope } : {},
|
|
30403
31541
|
...options.startedModels ? { startedModels: options.startedModels } : {},
|
|
30404
31542
|
...options.startedThinkingLevels !== void 0 ? { startedThinkingLevels: options.startedThinkingLevels } : {},
|
|
30405
31543
|
...options.initialUsage !== void 0 ? { initialUsage: options.initialUsage } : {},
|
|
@@ -30424,7 +31562,7 @@ var OmpAdapter = class {
|
|
|
30424
31562
|
|
|
30425
31563
|
// dist/installation.js
|
|
30426
31564
|
import { realpath as realpath4 } from "node:fs/promises";
|
|
30427
|
-
import
|
|
31565
|
+
import path9 from "node:path";
|
|
30428
31566
|
function createOmpInstallation(environment, command) {
|
|
30429
31567
|
let executable;
|
|
30430
31568
|
let env;
|
|
@@ -30435,7 +31573,7 @@ function createOmpInstallation(environment, command) {
|
|
|
30435
31573
|
const pathKey = Object.keys(environment).find((key) => key.toLowerCase() === "path") ?? "PATH";
|
|
30436
31574
|
env = {
|
|
30437
31575
|
...environment,
|
|
30438
|
-
[pathKey]: `${
|
|
31576
|
+
[pathKey]: `${path9.dirname(executable)}${path9.delimiter}${environment[pathKey] ?? ""}`
|
|
30439
31577
|
};
|
|
30440
31578
|
const target2 = resolveHarnessExecutable({ id: "omp", command: "omp", installRoots: { posix: [], windows: [] } }, { environment: env });
|
|
30441
31579
|
const canUpdate = !selected.includes("/nix/store/") && !!target2 && await realpath4(target2.executable) === selected;
|