@codexhost/cli-win32-x64 0.33.0 → 0.35.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.
Files changed (122) hide show
  1. package/README.md +2 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +670 -116
  4. package/app/console-web.js +2032 -309
  5. package/app/desktop-controller.mjs +621 -74
  6. package/app/desktop-mcp-client.mjs +619 -0
  7. package/app/host-runtime.mjs +7134 -3865
  8. package/app/plugins/antigravity/plugin.mjs +1411 -121
  9. package/app/plugins/claude-code/plugin.mjs +527 -70
  10. package/app/plugins/codebuddy/plugin.mjs +592 -98
  11. package/app/plugins/codex-usage/plugin.mjs +659 -74
  12. package/app/plugins/copilot/plugin.mjs +527 -72
  13. package/app/plugins/cursor-cli/plugin.mjs +527 -70
  14. package/app/plugins/deepseek-harness/plugin.mjs +527 -70
  15. package/app/plugins/devin/plugin.mjs +527 -70
  16. package/app/plugins/enabled.json +1 -0
  17. package/app/plugins/grok/plugin.mjs +580 -92
  18. package/app/plugins/hermes/plugin.mjs +526 -69
  19. package/app/plugins/kimi-code/plugin.mjs +527 -70
  20. package/app/plugins/kiro-cli/plugin.mjs +527 -70
  21. package/app/plugins/omp/plugin.mjs +1338 -301
  22. package/app/plugins/opencode/plugin.mjs +527 -70
  23. package/app/plugins/pi/plugin.mjs +527 -70
  24. package/app/plugins/qoder/plugin.mjs +528 -71
  25. package/app/plugins/qoder-cn/plugin.mjs +528 -71
  26. package/app/plugins/qwen-code/plugin.mjs +526 -69
  27. package/app/plugins/workbuddy/plugin.mjs +1231 -546
  28. package/app/plugins/workbuddy-cn/assets/icon.svg +27 -0
  29. package/app/plugins/workbuddy-cn/manifest.json +32 -0
  30. package/app/plugins/workbuddy-cn/plugin.mjs +36524 -0
  31. package/app/plugins/zcode/plugin.mjs +528 -70
  32. package/app/renderer-extension.js +3898 -478
  33. package/app/web/assets/{abnfDiagram-XWFEHMT6-VnfRaHM6.js → abnfDiagram-XWFEHMT6-CGkBtBVj.js} +1 -1
  34. package/app/web/assets/{architectureDiagram-CSQXQB3N-BA1ehtvi.js → architectureDiagram-CSQXQB3N-Byv-cZeH.js} +1 -1
  35. package/app/web/assets/{blockDiagram-BEDRHYPZ-31BZSfd4.js → blockDiagram-BEDRHYPZ-DjLzUtwg.js} +1 -1
  36. package/app/web/assets/{c4Diagram-M2UUVUY5-CNzGWc5k.js → c4Diagram-M2UUVUY5-CJlsb6QO.js} +1 -1
  37. package/app/web/assets/{chunk-2Q5K7J3B-ahAIR-NM.js → chunk-2Q5K7J3B-CWm537bw.js} +1 -1
  38. package/app/web/assets/{chunk-3GCGMST5-BIV5YeRJ.js → chunk-3GCGMST5-NpcInIx4.js} +1 -1
  39. package/app/web/assets/{chunk-5VM5RSS4-CluTMPJG.js → chunk-5VM5RSS4-CeyyP0dm.js} +1 -1
  40. package/app/web/assets/{chunk-7U7NFRK5-4NIQuFbE.js → chunk-7U7NFRK5-Bto5OgbF.js} +1 -1
  41. package/app/web/assets/{chunk-CNRTWJTD-_0bEfGn3.js → chunk-CNRTWJTD-CuRMFCjT.js} +1 -1
  42. package/app/web/assets/{chunk-D5HYT7QG-_kTC6f8F.js → chunk-D5HYT7QG-DtQM1-2k.js} +1 -1
  43. package/app/web/assets/{chunk-EBZ3SEQC-CykaYOrL.js → chunk-EBZ3SEQC-DbUb3ZJ4.js} +2 -2
  44. package/app/web/assets/{chunk-JWPE2WC7-3vVOQ_py.js → chunk-JWPE2WC7-Dxh3d9Ag.js} +1 -1
  45. package/app/web/assets/{chunk-KTR4FSNJ-aVg5vgrm.js → chunk-KTR4FSNJ-BfwavXUO.js} +1 -1
  46. package/app/web/assets/{chunk-XXDRQBXY-_gVwGeSp.js → chunk-XXDRQBXY-CxR1flID.js} +1 -1
  47. package/app/web/assets/{classDiagram-v2-KXABOMEV-fI1LfeBf.js → classDiagram-v2-KXABOMEV-2WV2q_X2.js} +1 -1
  48. package/app/web/assets/{cose-bilkent-JH36ORCC-DFXMlWov.js → cose-bilkent-JH36ORCC-C-ENrCL_.js} +1 -1
  49. package/app/web/assets/{cynefin-EF2NZ3EQ-lZy7X6FO.js → cynefin-EF2NZ3EQ-Bg5LeTZO.js} +1 -1
  50. package/app/web/assets/{cynefinDiagram-NJNITYFG-N4DwFSW1.js → cynefinDiagram-NJNITYFG-CRAdbGGt.js} +1 -1
  51. package/app/web/assets/{dagre-KIHZ2IZ3-B7-8baTH.js → dagre-KIHZ2IZ3-dNHEvUqL.js} +1 -1
  52. package/app/web/assets/{diagram-7YQZDPLS-DLfjiBXV.js → diagram-7YQZDPLS-7F4O37o5.js} +1 -1
  53. package/app/web/assets/{diagram-QBROCOUO-CQnRzSTi.js → diagram-QBROCOUO-B-5KpeI2.js} +1 -1
  54. package/app/web/assets/{diagram-RJJCUUZO-DPnxazRT.js → diagram-RJJCUUZO-DqDsyDaL.js} +1 -1
  55. package/app/web/assets/{diagram-WERXNKYE-BBuEFRvD.js → diagram-WERXNKYE-f1oaPKos.js} +1 -1
  56. package/app/web/assets/{diagram-YHHI257C-BQ92JNJs.js → diagram-YHHI257C-DVMtl9Bt.js} +1 -1
  57. package/app/web/assets/{diagram-YR4HJLHV-Ce6BQO3J.js → diagram-YR4HJLHV-BWFCNFFF.js} +1 -1
  58. package/app/web/assets/{ebnfDiagram-N527522P-DYknE2Jy.js → ebnfDiagram-N527522P-B4N7d-Bi.js} +1 -1
  59. package/app/web/assets/{elk-O5DQBFGD-4S6_JJFF.js → elk-O5DQBFGD-DRdfF_UQ.js} +1 -1
  60. package/app/web/assets/{erDiagram-K3K3BIDK-DRtF7JVQ.js → erDiagram-K3K3BIDK-BW4-_5sZ.js} +1 -1
  61. package/app/web/assets/{flowDiagram-Z6JWZHQI-7Ho8CyR9.js → flowDiagram-Z6JWZHQI-DIQa5yEv.js} +1 -1
  62. package/app/web/assets/{ganttDiagram-3PRQTZWP-CW8Ig5y4.js → ganttDiagram-3PRQTZWP-JBK9PM7A.js} +1 -1
  63. package/app/web/assets/{gitGraphDiagram-VXDFKS5L-CzS8Xg2D.js → gitGraphDiagram-VXDFKS5L-TPI9Su0g.js} +1 -1
  64. package/app/web/assets/{grid-E2QIVN74-Cq284lCe.js → grid-E2QIVN74-DmHbunuP.js} +1 -1
  65. package/app/web/assets/index-BKDmniRf.js +209 -0
  66. package/app/web/assets/index-BPMnQdGr.css +1 -0
  67. package/app/web/assets/{infoDiagram-EZ3ZOAHP-BZgN6qlY.js → infoDiagram-EZ3ZOAHP-BeFwO9PI.js} +1 -1
  68. package/app/web/assets/{ishikawaDiagram-S3EKX5GW-BH9YHc-1.js → ishikawaDiagram-S3EKX5GW-BTbrKF_p.js} +1 -1
  69. package/app/web/assets/{journeyDiagram-POQNLL5X-D50KYOLe.js → journeyDiagram-POQNLL5X-DR0yWxJi.js} +1 -1
  70. package/app/web/assets/{kanban-definition-BH5XI6FM-Crw_5mMP.js → kanban-definition-BH5XI6FM-DMHrC9oV.js} +1 -1
  71. package/app/web/assets/{mermaid.core-o2Qjrppc.js → mermaid.core-Brmc1kJw.js} +4 -4
  72. package/app/web/assets/{mindmap-definition-WVAN44T4-B_bEbpAH.js → mindmap-definition-WVAN44T4-NT_XVwlI.js} +1 -1
  73. package/app/web/assets/{pegDiagram-D4NLKWP3-VecAHoyw.js → pegDiagram-D4NLKWP3-K67_THcc.js} +1 -1
  74. package/app/web/assets/{pieDiagram-36ENHN4W-o3ei2T-6.js → pieDiagram-36ENHN4W-GlTgKnTi.js} +1 -1
  75. package/app/web/assets/{quadrantDiagram-ZQUDMS73-DHndOAcn.js → quadrantDiagram-ZQUDMS73-yMEZ6-Nr.js} +1 -1
  76. package/app/web/assets/{railroadDiagram-JIZHGYPL-DRd_lfii.js → railroadDiagram-JIZHGYPL-MXCqwbuq.js} +1 -1
  77. package/app/web/assets/{render-VIF2ZAQL-awM3hUqB.js → render-VIF2ZAQL-BRUlhHPG.js} +2 -2
  78. package/app/web/assets/{requirementDiagram-AXW2TVFA-Ce1ePsOe.js → requirementDiagram-AXW2TVFA-Dqx4p0Bz.js} +1 -1
  79. package/app/web/assets/{sankeyDiagram-FBCJTAIF-cP-LtgW-.js → sankeyDiagram-FBCJTAIF-COp3IWvs.js} +1 -1
  80. package/app/web/assets/{sequenceDiagram-3LA2ROMG-C3JStTuW.js → sequenceDiagram-3LA2ROMG-j1xwrmp8.js} +1 -1
  81. package/app/web/assets/{sizeCapture-2Q2CQKSF-Dyyelr9K.js → sizeCapture-2Q2CQKSF-ZEXdxLeY.js} +1 -1
  82. package/app/web/assets/{stateDiagram-v2-ATKHQDJO-DkYRBVTd.js → stateDiagram-v2-ATKHQDJO-2pt2L-Zd.js} +1 -1
  83. package/app/web/assets/{swimlanes-YQL5WMAO-B2FwJU5_.js → swimlanes-YQL5WMAO-BHpgfPPd.js} +1 -1
  84. package/app/web/assets/swimlanesDiagram-UCCPES4V-BrYKheZO.js +8 -0
  85. package/app/web/assets/{timeline-definition-7Z437IG3-Di-qRIIi.js → timeline-definition-7Z437IG3-Cw4F_3FM.js} +1 -1
  86. package/app/web/assets/{usecaseDiagram-RDK6N6HP-yAImn62t.js → usecaseDiagram-RDK6N6HP-DefiMBIg.js} +1 -1
  87. package/app/web/assets/{vennDiagram-SHRQU5PJ-BEv8jpfv.js → vennDiagram-SHRQU5PJ-D30EMFrI.js} +1 -1
  88. package/app/web/assets/{wardleyDiagram-F3OXNVQS-7irksA0b.js → wardleyDiagram-F3OXNVQS-4ok25PKp.js} +1 -1
  89. package/app/web/assets/{xychartDiagram-GDYJKCDI-BokJGG2y.js → xychartDiagram-GDYJKCDI-BB0uAQX5.js} +1 -1
  90. package/app/web/codexhost-settings.js +429 -159
  91. package/app/web/index.html +2 -2
  92. package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
  93. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +63 -63
  94. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +70 -70
  95. package/app/web/plugins/deepseek-ai__dsh-client-file-upload/client.js +1 -1
  96. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  97. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +172 -77
  98. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +104 -100
  99. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +65 -65
  100. package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
  101. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +5 -5
  102. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +6 -6
  103. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.pdf.js +1 -1
  104. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +62 -62
  105. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +72 -72
  106. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +70 -70
  107. package/app/web/plugins.json +1 -0
  108. package/app/web/role-avatars/builtin/advisor-otter.webp +0 -0
  109. package/app/web/role-avatars/builtin/builder-otter.webp +0 -0
  110. package/app/web/role-avatars/builtin/sailor-otter.webp +0 -0
  111. package/app/web/role-avatars/builtin/wizard-otter.webp +0 -0
  112. package/app/web-modules/server.mjs +7262 -2970
  113. package/bin/codexhost.exe +0 -0
  114. package/libexec/codexhost-node-repl.exe +0 -0
  115. package/libexec/codexhost-screenshot.exe +0 -0
  116. package/libexec/codexhost-shell.exe +0 -0
  117. package/libexec/codexhost-shim.exe +0 -0
  118. package/libexec/codexhost-updater.exe +0 -0
  119. package/package.json +1 -1
  120. package/app/web/assets/index-CINZ6P-q.css +0 -1
  121. package/app/web/assets/index-CvV6veuY.js +0 -208
  122. package/app/web/assets/swimlanesDiagram-UCCPES4V-BkMsxCPb.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, path9) {
1231
- if (!path9)
1230
+ function getElementAtPath(obj, path10) {
1231
+ if (!path10)
1232
1232
  return obj;
1233
- return path9.reduce((acc, key) => acc?.[key], obj);
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(path9, issues) {
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(path9);
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, path9 = []) => {
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 }, [...path9, ...issue2.path]));
2042
+ issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
2043
2043
  } else if (issue2.code === "invalid_key") {
2044
- processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
2044
+ processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
2045
2045
  } else if (issue2.code === "invalid_element") {
2046
- processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
2046
+ processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
2047
2047
  } else {
2048
- const fullpath = [...path9, ...issue2.path];
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, path9 = []) => {
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 }, [...path9, ...issue2.path]));
2091
+ issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
2092
2092
  } else if (issue2.code === "invalid_key") {
2093
- processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
2093
+ processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
2094
2094
  } else if (issue2.code === "invalid_element") {
2095
- processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
2095
+ processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
2096
2096
  } else {
2097
- const fullpath = [...path9, ...issue2.path];
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 path9 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
2137
- for (const seg of path9) {
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 record3 of pendingRecords.get(ctx) ?? []) {
17067
- const seen = ctx.seen.get(record3);
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 path9 = ref.slice(1).split("/").filter(Boolean);
19276
- if (path9.length === 0) {
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 (path9[0] === defsKey) {
19281
- const key = path9[1] === void 0 ? void 0 : decodeJSONPointerSegment(path9[1]);
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
  }
@@ -20147,26 +20147,51 @@ var jsonPrimitiveSchema = external_exports.union([
20147
20147
  external_exports.boolean(),
20148
20148
  external_exports.null()
20149
20149
  ]);
20150
- function hasNoCircularReferences(value) {
20151
- const ancestors = /* @__PURE__ */ new WeakSet();
20152
- const stack = [{ value, leaving: false }];
20150
+ function isPlainObject2(value) {
20151
+ const prototype = Object.getPrototypeOf(value);
20152
+ return prototype === Object.prototype || prototype === null;
20153
+ }
20154
+ var JSON_VALIDATION_LEAVE = /* @__PURE__ */ Symbol("json-validation-leave");
20155
+ function isValidJsonValue(value) {
20156
+ if (value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value)) {
20157
+ return true;
20158
+ }
20159
+ if (typeof value !== "object")
20160
+ return false;
20161
+ const ancestors = /* @__PURE__ */ new Set();
20162
+ const stack = [value];
20153
20163
  try {
20154
20164
  while (stack.length > 0) {
20155
- const frame = stack.pop();
20156
- if (!frame)
20157
- break;
20158
- if (frame.leaving) {
20159
- ancestors.delete(frame.value);
20165
+ const current = stack.pop();
20166
+ if (current === JSON_VALIDATION_LEAVE) {
20167
+ ancestors.delete(stack.pop());
20160
20168
  continue;
20161
20169
  }
20162
- if (typeof frame.value !== "object" || frame.value === null)
20170
+ if (current === null || typeof current === "string" || typeof current === "boolean" || typeof current === "number" && Number.isFinite(current)) {
20163
20171
  continue;
20164
- if (ancestors.has(frame.value))
20172
+ }
20173
+ if (typeof current !== "object")
20165
20174
  return false;
20166
- ancestors.add(frame.value);
20167
- stack.push({ value: frame.value, leaving: true });
20168
- for (const child of Object.values(frame.value)) {
20169
- stack.push({ value: child, leaving: false });
20175
+ if (ancestors.has(current))
20176
+ return false;
20177
+ if (Array.isArray(current)) {
20178
+ ancestors.add(current);
20179
+ stack.push(current, JSON_VALIDATION_LEAVE);
20180
+ for (let index = current.length - 1; index >= 0; index -= 1) {
20181
+ stack.push(current[index]);
20182
+ }
20183
+ continue;
20184
+ }
20185
+ if (!isPlainObject2(current))
20186
+ return false;
20187
+ ancestors.add(current);
20188
+ stack.push(current, JSON_VALIDATION_LEAVE);
20189
+ for (const key in current) {
20190
+ if (Object.hasOwn(current, key)) {
20191
+ if (key === "__proto__")
20192
+ return false;
20193
+ stack.push(current[key]);
20194
+ }
20170
20195
  }
20171
20196
  }
20172
20197
  } catch {
@@ -20174,17 +20199,11 @@ function hasNoCircularReferences(value) {
20174
20199
  }
20175
20200
  return true;
20176
20201
  }
20177
- var nonCircularSchema = external_exports.custom(hasNoCircularReferences, {
20178
- message: "JSON value must not contain circular references"
20179
- });
20180
- var recursiveJsonValueSchema = external_exports.lazy(() => external_exports.union([
20181
- jsonPrimitiveSchema,
20182
- external_exports.array(recursiveJsonValueSchema),
20183
- external_exports.record(external_exports.string(), recursiveJsonValueSchema)
20184
- ]));
20185
- var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
20186
- var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
20187
- var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
20202
+ var jsonValueSchema = external_exports.custom(isValidJsonValue, {
20203
+ message: "Invalid JSON value"
20204
+ });
20205
+ var jsonArraySchema = external_exports.custom((value) => Array.isArray(value) && isValidJsonValue(value), { message: "Invalid JSON array" });
20206
+ var jsonObjectSchema = external_exports.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value) && isValidJsonValue(value), { message: "Invalid JSON object" });
20188
20207
 
20189
20208
  // ../../shared-contracts/dist/errors.js
20190
20209
  var codexhostErrorSchema = external_exports.strictObject({
@@ -20317,7 +20336,11 @@ var BUILTIN_ROLE_AVATAR_IDS = [
20317
20336
  "security-otter",
20318
20337
  "audio-otter",
20319
20338
  "scholar-otter",
20320
- "data-otter"
20339
+ "data-otter",
20340
+ "advisor-otter",
20341
+ "builder-otter",
20342
+ "wizard-otter",
20343
+ "sailor-otter"
20321
20344
  ];
20322
20345
  var builtinRoleAvatarSchema = external_exports.templateLiteral([
20323
20346
  "builtin:",
@@ -21083,7 +21106,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
21083
21106
  default: external_exports.string().optional()
21084
21107
  })
21085
21108
  ]).superRefine((field2, ctx) => {
21086
- const issue2 = (path9, message3) => ctx.addIssue({ code: "custom", path: [path9], message: message3 });
21109
+ const issue2 = (path10, message3) => ctx.addIssue({ code: "custom", path: [path10], message: message3 });
21087
21110
  if (field2.type === "number" || field2.type === "range") {
21088
21111
  const { min = -Infinity, max = Infinity, default: value } = field2;
21089
21112
  if (min > max)
@@ -21189,16 +21212,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
21189
21212
  var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
21190
21213
  var hostExtensionDigestSchema = desktopExtensionHashSchema;
21191
21214
  var hostExtensionActivationIdSchema = external_exports.uuid();
21192
- 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((path9) => path9.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
21215
+ 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");
21193
21216
  var legacy = desktopExtensionManifestSchema.shape;
21194
21217
  var localized = (max, min = 0) => external_exports.strictObject({
21195
21218
  en: external_exports.string().trim().min(min).max(max),
21196
21219
  "zh-CN": external_exports.string().trim().min(min).max(max)
21197
21220
  });
21198
- var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path9) => path9.endsWith(suffix), `Expected a ${suffix} file`);
21221
+ var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path10) => path10.endsWith(suffix), `Expected a ${suffix} file`);
21199
21222
  var moduleEntry = resourceWithSuffix(".mjs");
21200
21223
  var style = resourceWithSuffix(".css").optional();
21201
- var hostExtensionCanonicalPath = (path9) => path9.normalize("NFC").toLowerCase();
21224
+ var hostExtensionCanonicalPath = (path10) => path10.normalize("NFC").toLowerCase();
21202
21225
  var hostExtensionManifestV2Schema = external_exports.strictObject({
21203
21226
  manifestVersion: external_exports.literal(2),
21204
21227
  id: hostExtensionIdSchema,
@@ -21208,8 +21231,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
21208
21231
  details: localized(16384).optional(),
21209
21232
  author: legacy.author,
21210
21233
  repository: legacy.repository,
21211
- icon: legacy.icon.refine((path9) => path9 === void 0 || hostExtensionResourcePathSchema.safeParse(path9).success),
21212
- screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path9) => hostExtensionResourcePathSchema.safeParse(path9).success)),
21234
+ icon: legacy.icon.refine((path10) => path10 === void 0 || hostExtensionResourcePathSchema.safeParse(path10).success),
21235
+ screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path10) => hostExtensionResourcePathSchema.safeParse(path10).success)),
21213
21236
  categories: legacy.categories,
21214
21237
  settingsSchema: legacy.settingsSchema,
21215
21238
  slots: legacy.slots.removeDefault().optional(),
@@ -21304,6 +21327,7 @@ var hostExtensionCatalogEntrySchema = external_exports.object({
21304
21327
  backend: external_exports.int().positive().optional()
21305
21328
  }),
21306
21329
  downloadUrl: downloadUrl.refine((url2) => url2.startsWith("https://"), "Expected HTTPS"),
21330
+ downloads7d: external_exports.number().int().min(0).optional(),
21307
21331
  featured: external_exports.boolean().optional(),
21308
21332
  featuredOrder: external_exports.int().nonnegative().optional(),
21309
21333
  changelog: external_exports.array(hostExtensionChangelogEntrySchema).max(20).optional()
@@ -21335,7 +21359,7 @@ var active = {
21335
21359
  digest: hostExtensionDigestSchema
21336
21360
  };
21337
21361
  var optionalActivation = { ...id, activationId: active.activationId.optional() };
21338
- var filePath = external_exports.string().min(1).max(4096).refine((path9) => /^(?:\/|[a-z]:[/\\])/iu.test(path9) && !path9.includes("\0") && !path9.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
21362
+ 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");
21339
21363
  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");
21340
21364
  function base643(maxBytes) {
21341
21365
  return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
@@ -21373,24 +21397,42 @@ var hostExtensionInstallationSchema = external_exports.strictObject({
21373
21397
  var rasterDataUrlSchema = (maxBytes) => external_exports.string().max("data:image/jpeg;base64,".length + 4 * Math.ceil(maxBytes / 3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u);
21374
21398
  var desktopConflict = { desktopConflictWith: hostExtensionIdSchema.optional() };
21375
21399
  var backendState = external_exports.enum(["none", "inactive", "starting", "running", "failed"]);
21400
+ var HOST_EXTENSION_OPERATION_ERROR_MAX_LENGTH = 512;
21401
+ var hostExtensionOperationStatusSchema = external_exports.discriminatedUnion("state", [
21402
+ external_exports.object({
21403
+ state: external_exports.literal("updating"),
21404
+ targetVersion: external_exports.string().trim().min(1).max(128).optional(),
21405
+ startedAt: external_exports.iso.datetime()
21406
+ }),
21407
+ external_exports.object({
21408
+ state: external_exports.literal("failed"),
21409
+ targetVersion: external_exports.string().trim().min(1).max(128).optional(),
21410
+ startedAt: external_exports.iso.datetime(),
21411
+ updatedAt: external_exports.iso.datetime(),
21412
+ error: external_exports.string().min(1).max(HOST_EXTENSION_OPERATION_ERROR_MAX_LENGTH),
21413
+ interruptedByShutdown: external_exports.boolean().optional()
21414
+ })
21415
+ ]);
21376
21416
  var hostExtensionListItemSchema = external_exports.discriminatedUnion("state", [
21377
- hostExtensionInstallationSchema.extend({
21417
+ external_exports.object({
21418
+ ...hostExtensionInstallationSchema.shape,
21378
21419
  state: external_exports.literal("valid"),
21379
21420
  enabled: external_exports.boolean(),
21380
21421
  ...desktopConflict,
21381
21422
  iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
21382
21423
  screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
21383
21424
  backendState: backendState.optional(),
21384
- backendError: external_exports.string().optional()
21425
+ backendError: external_exports.string().optional(),
21426
+ operation: hostExtensionOperationStatusSchema.optional()
21385
21427
  }),
21386
- external_exports.strictObject({
21428
+ external_exports.object({
21387
21429
  state: external_exports.enum(["invalid", "incompatible"]),
21388
21430
  id: external_exports.string().min(1),
21389
21431
  enabled: external_exports.boolean(),
21390
21432
  error: external_exports.string()
21391
21433
  })
21392
21434
  ]);
21393
- var hostExtensionsListResultSchema = external_exports.strictObject({
21435
+ var hostExtensionsListResultSchema = external_exports.object({
21394
21436
  revision: hostExtensionRevisionSchema,
21395
21437
  configuration: hostExtensionConfigurationSchema,
21396
21438
  diagnostics: external_exports.array(external_exports.string()),
@@ -21429,7 +21471,10 @@ var methods = new Set(HOST_EXTENSION_MANAGEMENT_METHODS);
21429
21471
  var noParams = external_exports.strictObject({});
21430
21472
  var expectedRevision = { expectedRevision: hostExtensionRevisionSchema };
21431
21473
  var selection = external_exports.strictObject({ ...id, ...expectedRevision });
21432
- var installationResult = hostExtensionInstallationSchema.extend({ replaced: external_exports.boolean() });
21474
+ var installationResult = external_exports.object({
21475
+ ...hostExtensionInstallationSchema.shape,
21476
+ replaced: external_exports.boolean()
21477
+ });
21433
21478
  var mutationResult = external_exports.discriminatedUnion("state", [
21434
21479
  external_exports.strictObject({ state: external_exports.literal("saved"), configuration: hostExtensionConfigurationSchema }),
21435
21480
  external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: hostExtensionRevisionSchema })
@@ -21458,7 +21503,12 @@ var hostExtensionSettingsSchema = external_exports.strictObject({
21458
21503
  values: jsonObjectSchema
21459
21504
  });
21460
21505
  var hostExtensionsRpcSchemas = {
21461
- [HOST_EXTENSIONS_RPC.list]: { params: noParams, result: hostExtensionsListResultSchema },
21506
+ [HOST_EXTENSIONS_RPC.list]: {
21507
+ params: external_exports.object({
21508
+ includeOperations: external_exports.boolean().optional()
21509
+ }),
21510
+ result: hostExtensionsListResultSchema
21511
+ },
21462
21512
  [HOST_EXTENSIONS_RPC.snapshot]: { params: noParams, result: hostExtensionsSnapshotResultSchema },
21463
21513
  [HOST_EXTENSIONS_RPC.catalog]: {
21464
21514
  params: external_exports.strictObject({
@@ -21484,6 +21534,7 @@ var hostExtensionsRpcSchemas = {
21484
21534
  ...id,
21485
21535
  expectedDigest: active.digest,
21486
21536
  expectedActivationId: active.activationId.optional(),
21537
+ expectedVersion: external_exports.string().trim().min(1).max(128).optional(),
21487
21538
  source: hostExtensionInstallSourceSchema.optional()
21488
21539
  }),
21489
21540
  result: installationResult
@@ -21533,8 +21584,39 @@ var hostExtensionsRpcSchemas = {
21533
21584
  };
21534
21585
 
21535
21586
  // ../../shared-contracts/dist/group-chat.js
21536
- var DEFAULT_GROUP_MAX_AGENT_HOPS = 5;
21537
- var MAX_GROUP_AGENT_HOPS = 20;
21587
+ var GROUP_MEMORY_MAX_BYTES = 4096;
21588
+ var DEFAULT_GROUP_MAX_AGENT_HOPS = 10;
21589
+ var MAX_GROUP_AGENT_HOPS = 200;
21590
+ var GROUP_NOTICE_MAX_LENGTH = 2e3;
21591
+ var cachedUtf8Encoder;
21592
+ function groupUtf8ByteLength(text3) {
21593
+ if (cachedUtf8Encoder === void 0) {
21594
+ cachedUtf8Encoder = typeof TextEncoder === "function" ? new TextEncoder() : null;
21595
+ }
21596
+ if (cachedUtf8Encoder !== null) {
21597
+ return cachedUtf8Encoder.encode(text3).length;
21598
+ }
21599
+ let bytes = 0;
21600
+ for (let i = 0; i < text3.length; i += 1) {
21601
+ const code = text3.charCodeAt(i);
21602
+ if (code <= 127) {
21603
+ bytes += 1;
21604
+ } else if (code <= 2047) {
21605
+ bytes += 2;
21606
+ } else if (code >= 55296 && code <= 56319 && i + 1 < text3.length) {
21607
+ const next = text3.charCodeAt(i + 1);
21608
+ if (next >= 56320 && next <= 57343) {
21609
+ bytes += 4;
21610
+ i += 1;
21611
+ } else {
21612
+ bytes += 3;
21613
+ }
21614
+ } else {
21615
+ bytes += 3;
21616
+ }
21617
+ }
21618
+ return bytes;
21619
+ }
21538
21620
  var remoteGroupRoomIdSchema = external_exports.string().regex(/^remote:[A-Za-z0-9_-]{8,512}$/u);
21539
21621
  var groupRoomIdSchema = external_exports.union([external_exports.uuidv4(), remoteGroupRoomIdSchema]);
21540
21622
  var groupMemberIdSchema = external_exports.uuidv4();
@@ -21543,7 +21625,7 @@ var groupUnmentionedPolicySchema = external_exports.enum(["none", "last_speaker"
21543
21625
  var groupMemberStatusSchema = external_exports.enum(["active", "muted", "removed"]);
21544
21626
  var nonnegativeInteger = external_exports.int().nonnegative();
21545
21627
  var positiveInteger = external_exports.int().positive();
21546
- var maxAgentHopsSchema = positiveInteger.max(MAX_GROUP_AGENT_HOPS);
21628
+ var maxAgentHopsSchema = nonnegativeInteger.max(MAX_GROUP_AGENT_HOPS);
21547
21629
  var nonblankString = external_exports.string().refine((value) => value.trim().length > 0);
21548
21630
  var timestamp = external_exports.iso.datetime();
21549
21631
  var optionalMemberEdits = {
@@ -21561,28 +21643,42 @@ var groupMemberSchema = external_exports.object({
21561
21643
  roleSnapshot: threadRoleSnapshotSchema.optional(),
21562
21644
  harnessId: harnessIdSchema,
21563
21645
  status: groupMemberStatusSchema,
21646
+ projectless: external_exports.boolean().optional(),
21647
+ showInSidebar: external_exports.boolean().optional(),
21564
21648
  joinedAtSeq: nonnegativeInteger,
21565
21649
  lastDeliveredSeq: nonnegativeInteger,
21566
21650
  lastRosterVersion: nonnegativeInteger,
21651
+ lastMemoryVersion: nonnegativeInteger.default(0),
21567
21652
  createdAt: timestamp
21568
21653
  });
21654
+ var groupProjectlessWorkspaceSchema = external_exports.object({
21655
+ workspaceRoot: nonblankString,
21656
+ outputDirectory: nonblankString
21657
+ });
21569
21658
  var groupRoomRemoteHostSchema = external_exports.object({
21570
21659
  hostId: nonblankString,
21571
21660
  displayName: nonblankString,
21572
21661
  state: nonblankString.optional(),
21573
21662
  color: external_exports.string().optional(),
21574
- filePreview: external_exports.boolean().optional()
21663
+ filePreview: external_exports.boolean().optional(),
21664
+ memberSidebarVisibility: external_exports.boolean().optional(),
21665
+ sharedMemory: external_exports.boolean().optional()
21575
21666
  });
21576
- var groupRoomSchema = external_exports.object({
21667
+ var groupRoomObjectSchema = external_exports.object({
21577
21668
  roomId: groupRoomIdSchema,
21578
21669
  title: nonblankString,
21579
21670
  defaultCwd: nonblankString,
21671
+ projectlessWorkspace: groupProjectlessWorkspaceSchema.optional(),
21580
21672
  unmentionedPolicy: groupUnmentionedPolicySchema.default("none"),
21673
+ unmentionedMemberId: groupMemberIdSchema.optional(),
21581
21674
  allowAgentMentions: external_exports.boolean().default(true),
21582
21675
  maxAgentHops: maxAgentHopsSchema.default(DEFAULT_GROUP_MAX_AGENT_HOPS),
21676
+ relayHopLimit: maxAgentHopsSchema.optional(),
21583
21677
  lastSeq: nonnegativeInteger,
21584
21678
  lastSpeakerMemberId: groupMemberIdSchema.optional(),
21585
21679
  rosterVersion: nonnegativeInteger,
21680
+ memoryVersion: nonnegativeInteger.default(0),
21681
+ memorySha256: external_exports.string().regex(/^[0-9a-f]{64}$/u).optional(),
21586
21682
  humanEpoch: nonnegativeInteger,
21587
21683
  relayPaused: external_exports.boolean(),
21588
21684
  pinned: external_exports.boolean(),
@@ -21590,7 +21686,14 @@ var groupRoomSchema = external_exports.object({
21590
21686
  updatedAt: timestamp,
21591
21687
  members: external_exports.array(groupMemberSchema),
21592
21688
  remote: groupRoomRemoteHostSchema.optional()
21593
- }).superRefine(({ members: members2 }, context) => {
21689
+ }).superRefine(({ members: members2, unmentionedPolicy, unmentionedMemberId }, context) => {
21690
+ if (unmentionedMemberId !== void 0 && unmentionedPolicy !== "none") {
21691
+ context.addIssue({
21692
+ code: "custom",
21693
+ path: ["unmentionedMemberId"],
21694
+ message: 'A default member can only be set when unmentionedPolicy is "none"'
21695
+ });
21696
+ }
21594
21697
  const handles = /* @__PURE__ */ new Set();
21595
21698
  for (const [index, { handle, status }] of members2.entries()) {
21596
21699
  if (status === "removed")
@@ -21605,6 +21708,15 @@ var groupRoomSchema = external_exports.object({
21605
21708
  handles.add(handle);
21606
21709
  }
21607
21710
  });
21711
+ var groupRoomSchema = external_exports.preprocess((value) => {
21712
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
21713
+ const record4 = value;
21714
+ if (record4.unmentionedPolicy === "member" && record4.unmentionedMemberId !== void 0) {
21715
+ return { ...record4, unmentionedPolicy: "none" };
21716
+ }
21717
+ }
21718
+ return value;
21719
+ }, groupRoomObjectSchema);
21608
21720
  var groupAttachmentSchema = external_exports.object({
21609
21721
  kind: external_exports.enum(["image", "file"]),
21610
21722
  attachmentId: nonblankString.max(256),
@@ -21631,6 +21743,7 @@ var groupMessageSchema = external_exports.object({
21631
21743
  mentionedMemberIds: external_exports.array(groupMemberIdSchema),
21632
21744
  mentionAll: external_exports.boolean().optional(),
21633
21745
  hopCount: nonnegativeInteger,
21746
+ durationMs: nonnegativeInteger.optional(),
21634
21747
  createdAt: timestamp
21635
21748
  });
21636
21749
  var newThreadOptions = {
@@ -21657,8 +21770,12 @@ var GROUPS_DELETE_METHOD = "codexhost/groups/delete";
21657
21770
  var GROUPS_ADD_MEMBER_METHOD = "codexhost/groups/member/add";
21658
21771
  var GROUPS_UPDATE_MEMBER_METHOD = "codexhost/groups/member/update";
21659
21772
  var GROUPS_REMOVE_MEMBER_METHOD = "codexhost/groups/member/remove";
21773
+ var GROUPS_REBIND_MEMBER_METHOD = "codexhost/groups/member/rebind";
21660
21774
  var GROUPS_POST_MESSAGE_METHOD = "codexhost/groups/message/post";
21661
21775
  var GROUPS_READ_MESSAGES_METHOD = "codexhost/groups/messages/read";
21776
+ var GROUPS_READ_MEMORY_METHOD = "codexhost/groups/memory/read";
21777
+ var GROUPS_UPDATE_MEMORY_METHOD = "codexhost/groups/memory/update";
21778
+ var GROUPS_INSPECT_CWD_METHOD = "codexhost/groups/cwd/inspect";
21662
21779
  var roomIdentity = { roomId: groupRoomIdSchema };
21663
21780
  var memberIdentity = { ...roomIdentity, memberId: groupMemberIdSchema };
21664
21781
  var roomEdits = {
@@ -21681,15 +21798,24 @@ var groupsGetResultSchema = external_exports.object({
21681
21798
  });
21682
21799
  var groupsCreateParamsSchema = external_exports.strictObject({
21683
21800
  ...roomEdits,
21684
- defaultCwd: nonblankString,
21801
+ defaultCwd: nonblankString.optional(),
21685
21802
  members: external_exports.array(groupCreateMemberInputSchema)
21686
21803
  });
21687
21804
  var groupsCreateResultSchema = external_exports.object({ room: groupRoomSchema });
21688
21805
  var groupsUpdateParamsSchema = external_exports.strictObject({
21689
21806
  ...roomIdentity,
21690
21807
  ...roomEdits,
21808
+ unmentionedMemberId: groupMemberIdSchema.nullable().optional(),
21691
21809
  pinned: external_exports.boolean().optional(),
21692
21810
  relayPaused: external_exports.boolean().optional()
21811
+ }).superRefine(({ unmentionedPolicy, unmentionedMemberId }, context) => {
21812
+ if (unmentionedMemberId !== void 0 && unmentionedMemberId !== null && unmentionedPolicy !== void 0 && unmentionedPolicy !== "none") {
21813
+ context.addIssue({
21814
+ code: "custom",
21815
+ path: ["unmentionedMemberId"],
21816
+ message: 'A default member can only be set when unmentionedPolicy is "none"'
21817
+ });
21818
+ }
21693
21819
  });
21694
21820
  var groupsDeleteParamsSchema = external_exports.strictObject(roomIdentity);
21695
21821
  var groupsDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
@@ -21704,17 +21830,94 @@ var groupsAddMemberResultSchema = external_exports.object({
21704
21830
  var groupsUpdateMemberParamsSchema = external_exports.strictObject({
21705
21831
  ...memberIdentity,
21706
21832
  ...optionalMemberEdits,
21707
- status: groupMemberStatusSchema.optional()
21833
+ status: groupMemberStatusSchema.optional(),
21834
+ showInSidebar: external_exports.boolean().optional()
21708
21835
  });
21709
21836
  var groupsRemoveMemberParamsSchema = external_exports.strictObject(memberIdentity);
21837
+ var groupsRebindMemberParamsSchema = external_exports.strictObject({
21838
+ ...memberIdentity,
21839
+ threadId: hostThreadIdSchema,
21840
+ redeliverFrom: positiveInteger.optional(),
21841
+ note: external_exports.string().optional()
21842
+ });
21843
+ var groupCliRebindMemberParamsSchema = external_exports.strictObject({
21844
+ ...roomIdentity,
21845
+ memberId: groupMemberIdSchema.optional(),
21846
+ memberHandle: groupMemberHandleSchema.optional(),
21847
+ threadId: hostThreadIdSchema,
21848
+ redeliverFrom: positiveInteger.optional(),
21849
+ note: external_exports.string().optional()
21850
+ }).refine((value) => value.memberId !== void 0 !== (value.memberHandle !== void 0), "Provide exactly one of memberId or memberHandle");
21851
+ var groupsRebindMemberResultSchema = external_exports.object({
21852
+ room: groupRoomSchema,
21853
+ member: groupMemberSchema,
21854
+ previousThreadId: hostThreadIdSchema,
21855
+ awakened: external_exports.boolean()
21856
+ });
21857
+ var groupCliListMemberSchema = external_exports.object({
21858
+ memberId: groupMemberIdSchema,
21859
+ threadId: hostThreadIdSchema,
21860
+ handle: groupMemberHandleSchema,
21861
+ displayName: nonblankString,
21862
+ status: groupMemberStatusSchema,
21863
+ harnessId: harnessIdSchema,
21864
+ roleSlug: roleSlugSchema.optional(),
21865
+ roleName: nonblankString.optional()
21866
+ });
21867
+ var groupCliListEntrySchema = external_exports.object({
21868
+ roomId: groupRoomIdSchema,
21869
+ title: nonblankString,
21870
+ memberCount: nonnegativeInteger,
21871
+ updatedAt: timestamp,
21872
+ member: groupCliListMemberSchema.optional()
21873
+ });
21874
+ var groupCliListParamsSchema = external_exports.strictObject({
21875
+ threadId: hostThreadIdSchema.optional()
21876
+ });
21877
+ var groupCliListResultSchema = external_exports.object({
21878
+ rooms: external_exports.array(groupCliListEntrySchema)
21879
+ });
21710
21880
  var groupsPostMessageParamsSchema = external_exports.strictObject({
21711
21881
  ...roomIdentity,
21712
21882
  content: external_exports.string().max(64e3),
21713
21883
  attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
21714
21884
  replyToSeq: positiveInteger.optional(),
21715
21885
  targetMemberIds: external_exports.array(groupMemberIdSchema).optional(),
21716
- mentionAll: external_exports.boolean().optional()
21717
- }).refine((value) => value.content.trim().length > 0 || (value.attachments?.length ?? 0) > 0, "Message content or at least one attachment is required");
21886
+ mentionAll: external_exports.boolean().optional(),
21887
+ notice: external_exports.boolean().optional()
21888
+ }).superRefine((value, context) => {
21889
+ if (value.notice === true) {
21890
+ if (value.content.trim().length === 0) {
21891
+ context.addIssue({
21892
+ code: "custom",
21893
+ path: ["content"],
21894
+ message: "Notice content is required"
21895
+ });
21896
+ }
21897
+ if (value.content.length > GROUP_NOTICE_MAX_LENGTH) {
21898
+ context.addIssue({
21899
+ code: "custom",
21900
+ path: ["content"],
21901
+ message: `Notice content must be at most ${GROUP_NOTICE_MAX_LENGTH} characters`
21902
+ });
21903
+ }
21904
+ if ((value.targetMemberIds?.length ?? 0) > 0 || value.mentionAll === true || (value.attachments?.length ?? 0) > 0) {
21905
+ context.addIssue({
21906
+ code: "custom",
21907
+ path: ["notice"],
21908
+ message: "System notices cannot target members or include attachments"
21909
+ });
21910
+ }
21911
+ return;
21912
+ }
21913
+ if (value.content.trim().length === 0 && (value.attachments?.length ?? 0) === 0) {
21914
+ context.addIssue({
21915
+ code: "custom",
21916
+ path: ["content"],
21917
+ message: "Message content or at least one attachment is required"
21918
+ });
21919
+ }
21920
+ });
21718
21921
  var groupsPostMessageResultSchema = external_exports.object({
21719
21922
  room: groupRoomSchema,
21720
21923
  message: groupMessageSchema,
@@ -21731,6 +21934,31 @@ var groupsReadMessagesResultSchema = external_exports.object({
21731
21934
  messages: external_exports.array(groupMessageSchema),
21732
21935
  totalSeq: nonnegativeInteger
21733
21936
  });
21937
+ var groupsReadMemoryParamsSchema = external_exports.strictObject(roomIdentity);
21938
+ var groupsReadMemoryResultSchema = external_exports.object({
21939
+ ...roomIdentity,
21940
+ memoryVersion: nonnegativeInteger,
21941
+ content: external_exports.string(),
21942
+ updatedAt: timestamp
21943
+ });
21944
+ var groupsUpdateMemoryParamsSchema = external_exports.strictObject({
21945
+ ...roomIdentity,
21946
+ content: external_exports.string().refine((value) => groupUtf8ByteLength(value) <= GROUP_MEMORY_MAX_BYTES, `Shared room memory must be at most ${GROUP_MEMORY_MAX_BYTES} UTF-8 bytes`),
21947
+ expectedVersion: nonnegativeInteger.optional()
21948
+ });
21949
+ var groupsUpdateMemoryResultSchema = external_exports.object({
21950
+ room: groupRoomSchema,
21951
+ memoryVersion: nonnegativeInteger,
21952
+ content: external_exports.string(),
21953
+ updatedAt: timestamp
21954
+ });
21955
+ var groupsInspectCwdParamsSchema = external_exports.strictObject({
21956
+ cwd: nonblankString,
21957
+ roomId: groupRoomIdSchema.optional()
21958
+ });
21959
+ var groupsInspectCwdResultSchema = external_exports.object({
21960
+ isGitRepo: external_exports.boolean()
21961
+ });
21734
21962
 
21735
21963
  // ../../shared-contracts/dist/thread-archive-confirm.js
21736
21964
  var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
@@ -21777,6 +22005,7 @@ var TELEMETRY_OFFICIAL_HARNESSES = [
21777
22005
  "kiro-cli",
21778
22006
  "codebuddy",
21779
22007
  "workbuddy",
22008
+ "workbuddy-cn",
21780
22009
  "devin",
21781
22010
  "hermes",
21782
22011
  "qoder",
@@ -21858,6 +22087,149 @@ var nativeCodexGoalResultSchema = external_exports.object({
21858
22087
  }).nullable()
21859
22088
  });
21860
22089
 
22090
+ // ../../shared-contracts/dist/voice.js
22091
+ var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
22092
+ var VOICE_CONFIG_GET_METHOD = "codexhost/voice/config/get";
22093
+ var VOICE_CONFIG_SET_METHOD = "codexhost/voice/config/set";
22094
+ var voiceProviderModeSchema = external_exports.enum([
22095
+ "codex",
22096
+ "openai-compatible",
22097
+ "deepseek-asr",
22098
+ "openai-chat-audio"
22099
+ ]);
22100
+ var voiceAudioFormatSchema = external_exports.enum(["native", "wav"]);
22101
+ var SENSITIVE_VOICE_QUERY_PARAM = /(?:^|[_-])(?:key|token|secret|password|passwd|pwd|auth|authorization|credential|signature|sig)(?:$|[_-])|(?:api|access|auth|client|app|private|bearer)[_-]?(?:key|token|secret)/i;
22102
+ function isLoopbackVoiceHost(hostname3) {
22103
+ const bare = hostname3.trim().toLowerCase().replace(/^\[|\]$/g, "");
22104
+ if (bare === "localhost" || bare.endsWith(".localhost") || bare === "::1")
22105
+ return true;
22106
+ return /^127(?:\.(?:25[0-5]|2[0-4]\d|1?\d?\d)){3}$/.test(bare);
22107
+ }
22108
+ function isValidVoiceBaseUrl(value) {
22109
+ const trimmed = value.trim();
22110
+ if (!trimmed)
22111
+ return false;
22112
+ try {
22113
+ const parsed = new URL(trimmed);
22114
+ if (!parsed.hostname)
22115
+ return false;
22116
+ if (parsed.username !== "" || parsed.password !== "" || parsed.hash !== "")
22117
+ return false;
22118
+ if (parsed.protocol === "https:") {
22119
+ } else if (parsed.protocol === "http:") {
22120
+ if (!isLoopbackVoiceHost(parsed.hostname))
22121
+ return false;
22122
+ } else {
22123
+ return false;
22124
+ }
22125
+ for (const key of parsed.searchParams.keys()) {
22126
+ if (SENSITIVE_VOICE_QUERY_PARAM.test(key))
22127
+ return false;
22128
+ }
22129
+ return true;
22130
+ } catch {
22131
+ return false;
22132
+ }
22133
+ }
22134
+ var voiceBaseUrlSchema = external_exports.string().max(2048).refine((value) => value === "" || isValidVoiceBaseUrl(value), {
22135
+ message: "Base URL must be empty or a valid https:// URL (http:// is allowed only for localhost/127.0.0.1/[::1]) without embedded credentials"
22136
+ });
22137
+ var voiceProviderConfigSnapshotSchema = external_exports.object({
22138
+ baseUrl: voiceBaseUrlSchema,
22139
+ model: external_exports.string().max(256),
22140
+ hasApiKey: external_exports.boolean(),
22141
+ apiKeyHint: external_exports.string().max(64).optional(),
22142
+ apiKey: external_exports.never().optional()
22143
+ });
22144
+ var voiceConfigSnapshotSchema = external_exports.object({
22145
+ mode: voiceProviderModeSchema,
22146
+ baseUrl: voiceBaseUrlSchema,
22147
+ model: external_exports.string().max(256),
22148
+ hasApiKey: external_exports.boolean(),
22149
+ apiKeyHint: external_exports.string().max(64).optional(),
22150
+ apiKey: external_exports.never().optional(),
22151
+ audioFormat: voiceAudioFormatSchema.optional(),
22152
+ providers: external_exports.object({
22153
+ "openai-compatible": voiceProviderConfigSnapshotSchema,
22154
+ "deepseek-asr": voiceProviderConfigSnapshotSchema,
22155
+ "openai-chat-audio": voiceProviderConfigSnapshotSchema
22156
+ }).optional(),
22157
+ codexAvailable: external_exports.boolean(),
22158
+ available: external_exports.boolean()
22159
+ });
22160
+ var voiceConfigUpdateParamsSchema = external_exports.object({
22161
+ mode: voiceProviderModeSchema,
22162
+ baseUrl: external_exports.string().max(2048).optional(),
22163
+ model: external_exports.string().max(256).optional(),
22164
+ apiKey: external_exports.string().max(4096).nullable().optional()
22165
+ }).strict().superRefine((value, ctx) => {
22166
+ const trimmedBaseUrl = value.baseUrl?.trim() ?? "";
22167
+ const trimmedModel = value.model?.trim() ?? "";
22168
+ if (value.mode === "openai-compatible") {
22169
+ if (!isValidVoiceBaseUrl(trimmedBaseUrl)) {
22170
+ ctx.addIssue({
22171
+ code: external_exports.ZodIssueCode.custom,
22172
+ path: ["baseUrl"],
22173
+ message: "OpenAI-compatible mode requires a valid https:// base URL (http:// is allowed only for loopback hosts)"
22174
+ });
22175
+ }
22176
+ return;
22177
+ }
22178
+ if (value.mode === "openai-chat-audio") {
22179
+ if (!isValidVoiceBaseUrl(trimmedBaseUrl)) {
22180
+ ctx.addIssue({
22181
+ code: external_exports.ZodIssueCode.custom,
22182
+ path: ["baseUrl"],
22183
+ message: "Multimodal Chat Audio mode requires a valid https:// base URL (http:// is allowed only for loopback hosts)"
22184
+ });
22185
+ }
22186
+ if (!trimmedModel) {
22187
+ ctx.addIssue({
22188
+ code: external_exports.ZodIssueCode.custom,
22189
+ path: ["model"],
22190
+ message: "Multimodal Chat Audio mode requires a model name"
22191
+ });
22192
+ }
22193
+ return;
22194
+ }
22195
+ if (trimmedBaseUrl !== "" && !isValidVoiceBaseUrl(trimmedBaseUrl)) {
22196
+ ctx.addIssue({
22197
+ code: external_exports.ZodIssueCode.custom,
22198
+ path: ["baseUrl"],
22199
+ message: "Base URL must be empty or a valid https:// URL (http:// is allowed only for loopback hosts)"
22200
+ });
22201
+ }
22202
+ });
22203
+ var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
22204
+ var voiceStatusResultSchema = external_exports.object({
22205
+ available: external_exports.boolean(),
22206
+ audioFormat: voiceAudioFormatSchema.optional()
22207
+ });
22208
+ var voiceTranscribeParamsSchema = external_exports.object({ path: external_exports.string().min(1), mimeType: voiceAudioMimeTypeSchema }).strict();
22209
+ var voiceErrorCodeSchema = external_exports.enum([
22210
+ "credentials-unavailable",
22211
+ "login-expired",
22212
+ "rate-limited",
22213
+ "service-rejected",
22214
+ "host-incompatible",
22215
+ "network",
22216
+ "timeout",
22217
+ "audio-empty",
22218
+ "audio-too-large",
22219
+ "audio-format",
22220
+ "audio-invalid"
22221
+ ]);
22222
+ var voiceTranscribeResultSchema = external_exports.discriminatedUnion("ok", [
22223
+ external_exports.object({ ok: external_exports.literal(true), text: external_exports.string() }).strict(),
22224
+ external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
22225
+ ]);
22226
+
22227
+ // ../../shared-contracts/dist/github-star.js
22228
+ var GITHUB_STAR_STATUS_METHOD = "codexhost/githubStar/status";
22229
+ var GITHUB_STAR_ADD_METHOD = "codexhost/githubStar/star";
22230
+ var githubStarParamsSchema = external_exports.object({}).strict();
22231
+ var githubStarStateSchema = external_exports.object({ ghAvailable: external_exports.boolean(), starred: external_exports.boolean() });
22232
+
21861
22233
  // ../../shared-contracts/dist/client-channel.js
21862
22234
  var CLIENT_CHANNEL_VERSION = 1;
21863
22235
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
@@ -21916,10 +22288,16 @@ var CLIENT_CHANNEL_METHODS = [
21916
22288
  GROUPS_ADD_MEMBER_METHOD,
21917
22289
  GROUPS_UPDATE_MEMBER_METHOD,
21918
22290
  GROUPS_REMOVE_MEMBER_METHOD,
22291
+ GROUPS_REBIND_MEMBER_METHOD,
21919
22292
  GROUPS_POST_MESSAGE_METHOD,
21920
22293
  GROUPS_READ_MESSAGES_METHOD,
22294
+ GROUPS_READ_MEMORY_METHOD,
22295
+ GROUPS_UPDATE_MEMORY_METHOD,
22296
+ GROUPS_INSPECT_CWD_METHOD,
21921
22297
  "codexhost/voice/status",
21922
22298
  "codexhost/voice/transcribe",
22299
+ VOICE_CONFIG_GET_METHOD,
22300
+ VOICE_CONFIG_SET_METHOD,
21923
22301
  "codexhost/harness/display-settings/get",
21924
22302
  "codexhost/harness/display-settings/set",
21925
22303
  "codexhost/harness/display-settings/capabilities",
@@ -21985,6 +22363,8 @@ var CLIENT_CHANNEL_METHODS = [
21985
22363
  "codexhost/harness/session-import/list",
21986
22364
  "codexhost/harness/session-import/import",
21987
22365
  // Host settings shared across Desktop and Web.
22366
+ GITHUB_STAR_STATUS_METHOD,
22367
+ GITHUB_STAR_ADD_METHOD,
21988
22368
  ...HOST_EXTENSION_MANAGEMENT_METHODS,
21989
22369
  "codexhost/harness/installation",
21990
22370
  "codexhost/harness/installation/start",
@@ -22324,28 +22704,16 @@ var extensionActivitySchema = external_exports.strictObject({
22324
22704
  })).max(256)
22325
22705
  });
22326
22706
 
22327
- // ../../shared-contracts/dist/voice.js
22328
- var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
22329
- var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
22330
- var voiceStatusResultSchema = external_exports.object({ available: external_exports.boolean() }).strict();
22331
- var voiceTranscribeParamsSchema = external_exports.object({ path: external_exports.string().min(1), mimeType: voiceAudioMimeTypeSchema }).strict();
22332
- var voiceErrorCodeSchema = external_exports.enum([
22333
- "credentials-unavailable",
22334
- "login-expired",
22335
- "rate-limited",
22336
- "service-rejected",
22337
- "host-incompatible",
22338
- "network",
22339
- "timeout",
22340
- "audio-empty",
22341
- "audio-too-large",
22342
- "audio-format",
22343
- "audio-invalid"
22344
- ]);
22345
- var voiceTranscribeResultSchema = external_exports.discriminatedUnion("ok", [
22346
- external_exports.object({ ok: external_exports.literal(true), text: external_exports.string() }).strict(),
22347
- external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
22348
- ]);
22707
+ // ../../shared-contracts/dist/host-extension-ranking.js
22708
+ var DAY_MS = 24 * 60 * 60 * 1e3;
22709
+ var CATEGORY_SEARCH_LABELS = Object.freeze({
22710
+ appearance: ["appearance", "外观主题"],
22711
+ interface: ["interface", "界面增强"],
22712
+ workflow: ["workflow", "效率与协作"],
22713
+ analytics: ["analytics", "数据与统计"],
22714
+ integrations: ["integrations", "外部集成"],
22715
+ tools: ["tools", "实用工具"]
22716
+ });
22349
22717
 
22350
22718
  // ../../shared-contracts/dist/skills.js
22351
22719
  var skillsListParamsSchema = external_exports.object({
@@ -22482,7 +22850,23 @@ var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
22482
22850
  var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
22483
22851
  var remotePeerNodeIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
22484
22852
  var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
22485
- var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
22853
+ var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "ssh", "custom"]);
22854
+ var remotePeerSshAuthModeSchema = external_exports.enum(["auto", "key", "password"]);
22855
+ var remotePeerSshConfigSchema = external_exports.object({
22856
+ host: external_exports.string().trim().min(1).max(255),
22857
+ port: external_exports.number().int().min(1).max(65535).optional(),
22858
+ user: external_exports.string().trim().min(1).max(128).optional(),
22859
+ identityFile: external_exports.string().trim().min(1).max(1024).optional(),
22860
+ authMode: remotePeerSshAuthModeSchema.default("auto"),
22861
+ remoteDataDir: external_exports.string().trim().min(1).max(1024).optional()
22862
+ });
22863
+ var remotePeerSshSummarySchema = external_exports.object({
22864
+ host: external_exports.string().min(1).max(255),
22865
+ port: external_exports.number().int().min(1).max(65535).optional(),
22866
+ user: external_exports.string().min(1).max(128).optional(),
22867
+ authMode: remotePeerSshAuthModeSchema,
22868
+ keyInstalled: external_exports.boolean().optional()
22869
+ });
22486
22870
  var REMOTE_PEER_COLORS = [
22487
22871
  "blue",
22488
22872
  "purple",
@@ -22509,6 +22893,7 @@ var remotePeerSummarySchema = external_exports.object({
22509
22893
  color: remotePeerColorSchema.optional(),
22510
22894
  origin: external_exports.string().min(1).max(2048),
22511
22895
  transportKind: remotePeerTransportKindSchema,
22896
+ ssh: remotePeerSshSummarySchema.optional(),
22512
22897
  encrypted: external_exports.boolean(),
22513
22898
  enabled: external_exports.boolean(),
22514
22899
  state: remotePeerStateSchema,
@@ -22637,7 +23022,13 @@ var remotePeerCapabilitiesSchema = external_exports.object({
22637
23022
  /** /api/peer/v1/delegation is available for fixed-whitelist cross-host delegation. */
22638
23023
  delegation: external_exports.literal(1).optional(),
22639
23024
  /** POST /api/peer/v1/peers is available. */
22640
- peerPairing: external_exports.literal(1).optional()
23025
+ peerPairing: external_exports.literal(1).optional(),
23026
+ /** Host supports includeOperations on extensions/list and expectedVersion on extensions/update. */
23027
+ extensionUpdateTracking: external_exports.literal(1).optional(),
23028
+ /** Peer supports per-member `showInSidebar` in `codexhost/groups/member/update`. */
23029
+ groupMemberSidebarVisibility: external_exports.literal(1).optional(),
23030
+ /** Peer supports `codexhost/groups/memory/read` and `codexhost/groups/memory/update`. */
23031
+ groupSharedMemory: external_exports.literal(1).optional()
22641
23032
  });
22642
23033
  var remotePeerManifestSchema = external_exports.object({
22643
23034
  version: external_exports.string().max(128),
@@ -22756,8 +23147,66 @@ var delegationHostHarnessOptionSchema = external_exports.object({
22756
23147
  var delegationHostHarnessesResultSchema = external_exports.object({
22757
23148
  harnesses: external_exports.array(delegationHostHarnessOptionSchema)
22758
23149
  });
23150
+ var sshConfigHostEntrySchema = external_exports.object({
23151
+ alias: external_exports.string().min(1).max(255),
23152
+ hostName: external_exports.string().max(255).optional(),
23153
+ user: external_exports.string().max(128).optional(),
23154
+ port: external_exports.number().int().min(1).max(65535).optional(),
23155
+ identityFile: external_exports.string().max(1024).optional()
23156
+ });
23157
+ var remotePeerListSshConfigHostsResultSchema = external_exports.object({
23158
+ hosts: external_exports.array(sshConfigHostEntrySchema)
23159
+ });
23160
+ var remotePeerSshConnectParamsSchema = external_exports.object({
23161
+ host: external_exports.string().trim().min(1).max(255),
23162
+ port: external_exports.number().int().min(1).max(65535).optional(),
23163
+ user: external_exports.string().trim().min(1).max(128).optional(),
23164
+ identityFile: external_exports.string().trim().min(1).max(1024).optional(),
23165
+ authMode: remotePeerSshAuthModeSchema.default("auto"),
23166
+ password: external_exports.string().max(1024).optional(),
23167
+ installAuthorizedKey: external_exports.boolean().optional(),
23168
+ name: external_exports.string().trim().min(1).max(120).optional(),
23169
+ color: remotePeerColorSchema.optional(),
23170
+ remoteDataDir: external_exports.string().trim().min(1).max(1024).optional(),
23171
+ sessionId: external_exports.string().min(1).max(128).optional()
23172
+ });
23173
+ var remotePeerSshTestResultSchema = external_exports.object({
23174
+ ok: external_exports.boolean(),
23175
+ codexhostInstalled: external_exports.boolean(),
23176
+ version: external_exports.string().max(128).optional(),
23177
+ nodeId: remotePeerNodeIdSchema.optional(),
23178
+ platform: external_exports.string().max(64).optional(),
23179
+ hostname: external_exports.string().max(255).optional(),
23180
+ latencyMs: external_exports.number().int().nonnegative().optional(),
23181
+ errorCode: external_exports.string().max(128).optional(),
23182
+ error: external_exports.string().max(1e3).optional()
23183
+ });
23184
+ var remotePeerSshInstallResultSchema = external_exports.object({
23185
+ ok: external_exports.boolean(),
23186
+ version: external_exports.string().max(128).optional(),
23187
+ message: external_exports.string().max(1e3).optional()
23188
+ });
23189
+ var remotePeerSshAuthPromptSchema = external_exports.object({
23190
+ promptId: external_exports.string().min(1).max(128),
23191
+ sessionId: external_exports.string().min(1).max(128).optional(),
23192
+ peerId: remotePeerIdSchema.optional(),
23193
+ host: external_exports.string().min(1).max(255),
23194
+ kind: external_exports.enum(["host-key", "password", "passphrase", "otp", "generic"]),
23195
+ prompt: external_exports.string().min(1).max(1e3),
23196
+ echo: external_exports.boolean()
23197
+ });
23198
+ var remotePeerSshRespondAuthParamsSchema = external_exports.object({
23199
+ promptId: external_exports.string().min(1).max(128),
23200
+ sessionId: external_exports.string().min(1).max(128).optional(),
23201
+ response: external_exports.string().max(1024).optional(),
23202
+ cancel: external_exports.boolean().optional()
23203
+ });
22759
23204
 
22760
23205
  // ../../shared-contracts/dist/peer-delegation.js
23206
+ var peerWatchNudgeParamsSchema = external_exports.strictObject({
23207
+ hostId: remotePeerHostIdSchema,
23208
+ threadId: external_exports.string().min(1).max(1024).optional()
23209
+ });
22761
23210
  var PEER_DELEGATION_BRIDGE_VERSION = 1;
22762
23211
  var PEER_DELEGATION_OPERATIONS = [
22763
23212
  "listHarnesses",
@@ -22941,11 +23390,12 @@ var delegationDefaultsSchema = external_exports.strictObject({
22941
23390
  byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
22942
23391
  });
22943
23392
  var modelId = external_exports.string().min(1).max(1024);
22944
- var harnessPreferenceValuesSchema = external_exports.strictObject({
23393
+ var harnessPreferenceValuesSchema = external_exports.object({
22945
23394
  idleRelease: idleReleaseSettingsSchema.optional(),
22946
23395
  favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
22947
23396
  newThread: newThreadDefaultsSchema.optional(),
22948
- delegation: delegationDefaultsSchema.optional()
23397
+ delegation: delegationDefaultsSchema.optional(),
23398
+ showGroupChatsInSidebar: external_exports.boolean().optional()
22949
23399
  });
22950
23400
  var harnessPreferenceSnapshotSchema = external_exports.strictObject({
22951
23401
  scope: harnessPreferenceScopeSchema,
@@ -22978,6 +23428,10 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
22978
23428
  kind: external_exports.literal("delegation"),
22979
23429
  harnessId: harnessIdSchema,
22980
23430
  configuration: harnessDelegationDefaultSchema.nullable()
23431
+ }),
23432
+ external_exports.strictObject({
23433
+ kind: external_exports.literal("groupChatsSidebar"),
23434
+ visible: external_exports.boolean()
22981
23435
  })
22982
23436
  ]);
22983
23437
  var harnessPreferencePatchSchema = external_exports.strictObject({
@@ -23814,7 +24268,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
23814
24268
  "unreadable",
23815
24269
  "notFound"
23816
24270
  ];
23817
- var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
24271
+ var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)(?:\?hostId=([^\s()<>"?#/&]+))?\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
23818
24272
 
23819
24273
  // ../../shared-contracts/dist/remote-runtime.js
23820
24274
  var remoteUpdatePhaseSchema = external_exports.enum([
@@ -23843,7 +24297,7 @@ var remoteSshSetupParamsSchema = external_exports.object({
23843
24297
  hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
23844
24298
  port: external_exports.number().int().min(1).max(65535).nullable(),
23845
24299
  identity: external_exports.string().max(4096).nullable(),
23846
- action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
24300
+ action: external_exports.enum(["inspect", "install", "update", "restart", "repair", "uninstall"]),
23847
24301
  uninstallPackage: external_exports.boolean().optional(),
23848
24302
  version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
23849
24303
  }).strict();
@@ -23859,6 +24313,7 @@ var target = {
23859
24313
  var thread2 = { ...target, threadId: identity };
23860
24314
  var text = external_exports.string().min(1).max(8e3);
23861
24315
  var input2 = { text, requestId: identity };
24316
+ var queueReorderItemIdsSchema = external_exports.array(identity).min(2).max(100).refine((ids) => new Set(ids).size === ids.length, "Queued submission IDs must be distinct");
23862
24317
  var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
23863
24318
  external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
23864
24319
  external_exports.object({
@@ -23878,6 +24333,7 @@ var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available",
23878
24333
  external_exports.object({ available: external_exports.literal(false) }),
23879
24334
  external_exports.object({
23880
24335
  available: external_exports.literal(true),
24336
+ canReorder: external_exports.literal(true).optional(),
23881
24337
  items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
23882
24338
  })
23883
24339
  ]);
@@ -23955,6 +24411,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
23955
24411
  external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input2 }),
23956
24412
  external_exports.strictObject({ kind: external_exports.literal("steer"), ...input2, turnId: identity }),
23957
24413
  external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
24414
+ external_exports.strictObject({ kind: external_exports.literal("reorder"), itemIds: queueReorderItemIdsSchema }),
23958
24415
  external_exports.strictObject({
23959
24416
  kind: external_exports.literal("start"),
23960
24417
  itemId: identity,
@@ -24743,9 +25200,9 @@ async function jsonlHeader(file2, match, signal, maxLines = 4) {
24743
25200
  continue;
24744
25201
  }
24745
25202
  if (typeof value === "object" && value !== null && !Array.isArray(value)) {
24746
- const record3 = value;
24747
- if (match(record3))
24748
- return record3;
25203
+ const record4 = value;
25204
+ if (match(record4))
25205
+ return record4;
24749
25206
  }
24750
25207
  }
24751
25208
  return null;
@@ -24756,6 +25213,7 @@ function nativeTimeMs(value) {
24756
25213
  }
24757
25214
 
24758
25215
  // dist/session-import.js
25216
+ import { randomUUID } from "node:crypto";
24759
25217
  import { createReadStream as createReadStream2 } from "node:fs";
24760
25218
  import { opendir, realpath, stat } from "node:fs/promises";
24761
25219
  import os2 from "node:os";
@@ -24985,7 +25443,17 @@ var OmpSessionImport = class {
24985
25443
  if (sources?.length !== 1 || !sources[0])
24986
25444
  return null;
24987
25445
  const source = await this.#source(sources[0].file, signal);
24988
- return source?.nativeRef.nativeSessionId === nativeSessionId ? { candidate: source.candidate, nativeRef: source.nativeRef } : null;
25446
+ if (!source || source.candidate.nativeSessionId !== nativeSessionId)
25447
+ return null;
25448
+ return {
25449
+ candidate: source.candidate,
25450
+ nativeRef: nativeSessionRefSchema.parse({
25451
+ harnessId: "omp",
25452
+ nativeSessionId,
25453
+ formatVersion: 1,
25454
+ locator: { sessionFile: source.file, speedScope: randomUUID() }
25455
+ })
25456
+ };
24989
25457
  });
24990
25458
  }
24991
25459
  close() {
@@ -25027,9 +25495,9 @@ var OmpSessionImport = class {
25027
25495
  const source = await this.#source(file2, signal);
25028
25496
  if (!source)
25029
25497
  continue;
25030
- const sources = found.get(source.nativeRef.nativeSessionId) ?? [];
25498
+ const sources = found.get(source.candidate.nativeSessionId) ?? [];
25031
25499
  sources.push(source);
25032
- found.set(source.nativeRef.nativeSessionId, sources);
25500
+ found.set(source.candidate.nativeSessionId, sources);
25033
25501
  } catch (error62) {
25034
25502
  if (!(error62 instanceof SessionImportChangedError))
25035
25503
  throw error62;
@@ -25058,17 +25526,7 @@ var OmpSessionImport = class {
25058
25526
  });
25059
25527
  if (!candidate)
25060
25528
  return null;
25061
- return {
25062
- file: file2,
25063
- candidate,
25064
- // Resume needs the file itself: OMP is started with `--session <file>`.
25065
- nativeRef: nativeSessionRefSchema.parse({
25066
- harnessId: "omp",
25067
- nativeSessionId: facts.nativeSessionId,
25068
- locator: { sessionFile: await realpath(file2) },
25069
- formatVersion: 1
25070
- })
25071
- };
25529
+ return { file: await realpath(file2), candidate };
25072
25530
  } catch (error62) {
25073
25531
  signal.throwIfAborted();
25074
25532
  if (isStorageAccessError(error62))
@@ -25112,16 +25570,28 @@ function readableId({ provider, id: id2 }) {
25112
25570
  function modelLabel({ provider, id: id2 }) {
25113
25571
  return `${provider} / ${id2}`;
25114
25572
  }
25573
+ function supportsOmpChatGptFast(model2) {
25574
+ 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"));
25575
+ }
25115
25576
  function encodedId({ provider, id: id2 }) {
25116
25577
  return `${OMP_MODEL_REF_PREFIX}${Buffer.from(JSON.stringify([provider, id2])).toString("base64url")}`;
25117
25578
  }
25118
25579
  function encodeOmpModelRef(model2, id2 = readableId(model2)) {
25119
25580
  assertNativePart(model2.provider, "Model provider");
25120
25581
  assertNativePart(model2.id, "Model id");
25121
- return harnessModelRefSchema.parse({ id: id2 });
25582
+ return harnessModelRefSchema.parse({
25583
+ id: id2,
25584
+ ...model2.serviceTier && { serviceTier: model2.serviceTier }
25585
+ });
25122
25586
  }
25123
25587
  function createOmpModelIndex(models) {
25124
- const entries = new Map(models.map(({ provider, id: id2 }) => [JSON.stringify([provider, id2]), { provider, model: id2, id: id2 }]));
25588
+ const entries = /* @__PURE__ */ new Map();
25589
+ for (const entry of models) {
25590
+ const pair = JSON.stringify([entry.provider, entry.id]);
25591
+ if (entry.api || entry.serviceTiers || !entries.has(pair)) {
25592
+ entries.set(pair, { ...entry, model: entry.id });
25593
+ }
25594
+ }
25125
25595
  const byId = compositeModelRefIds([...entries.values()], (entry) => encodedId(entry));
25126
25596
  const idsByPair = new Map([...byId].map(([id2, entry]) => [JSON.stringify([entry.provider, entry.model]), id2]));
25127
25597
  return {
@@ -25135,13 +25605,17 @@ function createOmpModelIndex(models) {
25135
25605
  }
25136
25606
  function resolveOmpModelRef(ref, index) {
25137
25607
  const model2 = index.byId.get(ref.id);
25138
- if (!model2 || ref.serviceTier) {
25608
+ if (!model2 || ref.serviceTier && (ref.serviceTier !== "priority" || !supportsOmpChatGptFast(model2))) {
25139
25609
  throw new Error("Model Ref is not in the current Omp Model catalog");
25140
25610
  }
25141
- return { provider: model2.provider, id: model2.id };
25611
+ return {
25612
+ provider: model2.provider,
25613
+ id: model2.id,
25614
+ ...ref.serviceTier && { serviceTier: ref.serviceTier }
25615
+ };
25142
25616
  }
25143
25617
  function normalizeStoredOmpModelRef(ref, catalog) {
25144
- if (!ref.id.startsWith(OMP_MODEL_REF_PREFIX) || ref.serviceTier)
25618
+ if (!ref.id.startsWith(OMP_MODEL_REF_PREFIX))
25145
25619
  return void 0;
25146
25620
  let tuple2;
25147
25621
  try {
@@ -25156,7 +25630,10 @@ function normalizeStoredOmpModelRef(ref, catalog) {
25156
25630
  if (encoded !== ref.id)
25157
25631
  return void 0;
25158
25632
  const readable = readableId(native);
25159
- return catalog.models.find(({ ref: ref2, label }) => ref2.id === encoded || ref2.id === readable && label === modelLabel(native))?.ref;
25633
+ const base = catalog.models.find(({ ref: ref2, label }) => !ref2.serviceTier && (ref2.id === encoded || ref2.id === readable && label === modelLabel(native)));
25634
+ if (!base || !ref.serviceTier)
25635
+ return base?.ref;
25636
+ return ref.serviceTier === "priority" ? base.fastModel : void 0;
25160
25637
  }
25161
25638
  function sameOmpModel(left, right) {
25162
25639
  return left === null ? right === null : right !== null && left.provider === right.provider && left.id === right.id;
@@ -25171,7 +25648,7 @@ function normalizeOmpThinkingOptions(levels) {
25171
25648
  label: OMP_THINKING_LABELS[id2] ?? fallbackThinkingLabel(id2)
25172
25649
  }));
25173
25650
  }
25174
- function normalizeOmpModelCatalog(nativeModels, effectiveModel, thinkingLevels, effectiveThinkingOptionId) {
25651
+ function normalizeOmpModelCatalog(nativeModels, effectiveModel, thinkingLevels, effectiveThinkingOptionId, speedAvailable = false) {
25175
25652
  const index = createOmpModelIndex(nativeModels);
25176
25653
  const byRef = /* @__PURE__ */ new Map();
25177
25654
  for (const native of nativeModels) {
@@ -25181,17 +25658,14 @@ function normalizeOmpModelCatalog(nativeModels, effectiveModel, thinkingLevels,
25181
25658
  if (existing.reasoning !== native.reasoning) {
25182
25659
  throw new Error("Omp duplicate Model entries disagree on reasoning capability");
25183
25660
  }
25661
+ if (supportsOmpChatGptFast(existing) !== supportsOmpChatGptFast(native)) {
25662
+ throw new Error("Omp duplicate Model entries disagree on service tiers");
25663
+ }
25184
25664
  continue;
25185
25665
  }
25186
- byRef.set(ref.id, {
25187
- model: {
25188
- ref,
25189
- label: modelLabel(native)
25190
- },
25191
- reasoning: native.reasoning
25192
- });
25666
+ byRef.set(ref.id, native);
25193
25667
  }
25194
- const defaultModel = effectiveModel ? index.ref(effectiveModel) : void 0;
25668
+ const defaultModel = effectiveModel ? index.ref({ provider: effectiveModel.provider, id: effectiveModel.id }) : void 0;
25195
25669
  if (defaultModel && !byRef.has(defaultModel.id)) {
25196
25670
  throw new Error("Omp effective Model is absent from the available Model catalog");
25197
25671
  }
@@ -25204,9 +25678,11 @@ function normalizeOmpModelCatalog(nativeModels, effectiveModel, thinkingLevels,
25204
25678
  const thinkingOptions = thinkingLevels ? normalizeOmpThinkingOptions(OMP_DRAFT_THINKING_OPTION_IDS) : [];
25205
25679
  const allThinkingOptionIds = thinkingOptions.map(({ id: id2 }) => id2);
25206
25680
  const offThinkingOptionId = thinkingOptions.find(({ id: id2 }) => id2 === "off")?.id;
25207
- const models = [...byRef.values()].map(({ model: model2, reasoning }) => ({
25208
- ...model2,
25209
- supportedThinkingOptionIds: reasoning ? allThinkingOptionIds : offThinkingOptionId ? [offThinkingOptionId] : []
25681
+ const models = [...byRef].map(([id2, native]) => ({
25682
+ ref: { id: id2 },
25683
+ label: modelLabel(native),
25684
+ ...speedAvailable && supportsOmpChatGptFast(native) ? { fastModel: { id: id2, serviceTier: "priority" } } : {},
25685
+ supportedThinkingOptionIds: native.reasoning ? allThinkingOptionIds : offThinkingOptionId ? [offThinkingOptionId] : []
25210
25686
  })).sort((left, right) => compareText(left.label, right.label) || compareText(left.ref.id, right.ref.id));
25211
25687
  const defaultThinkingOptionId = thinkingOptions.find(({ id: id2 }) => id2 === effectiveThinkingOptionId)?.id;
25212
25688
  return harnessModelCatalogSchema.parse({
@@ -25629,10 +26105,10 @@ function ompUsageHistory(history) {
25629
26105
  for (const entry of history.entries) {
25630
26106
  if (entry.type !== "message")
25631
26107
  continue;
25632
- const record3 = ompUsageRecord(entry.message, { historical: true });
25633
- if (record3?.kind === "request")
25634
- requests.push(record3.request);
25635
- else if (record3?.kind === "missing")
26108
+ const record4 = ompUsageRecord(entry.message, { historical: true });
26109
+ if (record4?.kind === "request")
26110
+ requests.push(record4.request);
26111
+ else if (record4?.kind === "missing")
25636
26112
  complete = false;
25637
26113
  }
25638
26114
  return { requests, complete };
@@ -25641,8 +26117,8 @@ function ompUsageHistory(history) {
25641
26117
  // dist/omp-usage-statistics.js
25642
26118
  async function readOmpUsage(file2, signal) {
25643
26119
  const entries = [];
25644
- const header = await jsonlHeader(file2, (record3) => record3.type === "session", signal);
25645
- const titled = await jsonlHeader(file2, (record3) => record3.type === "title", signal);
26120
+ const header = await jsonlHeader(file2, (record4) => record4.type === "session", signal);
26121
+ const titled = await jsonlHeader(file2, (record4) => record4.type === "title", signal);
25646
26122
  const session = {
25647
26123
  sessionId: typeof header?.id === "string" ? header.id : void 0,
25648
26124
  cwd: typeof header?.cwd === "string" ? header.cwd : void 0,
@@ -25651,12 +26127,12 @@ async function readOmpUsage(file2, signal) {
25651
26127
  for await (const line of jsonlRecords(file2, '"assistant"', signal)) {
25652
26128
  if (line.type !== "message")
25653
26129
  continue;
25654
- const record3 = ompUsageRecord(line.message);
25655
- if (record3?.kind !== "request")
26130
+ const record4 = ompUsageRecord(line.message);
26131
+ if (record4?.kind !== "request")
25656
26132
  continue;
25657
26133
  const message3 = line.message;
25658
26134
  const at = nativeTimeMs(message3.timestamp) ?? nativeTimeMs(line.timestamp);
25659
- const entry = at !== null && usageEntryFromRequest(record3.request, at);
26135
+ const entry = at !== null && usageEntryFromRequest(record4.request, at);
25660
26136
  if (!entry)
25661
26137
  continue;
25662
26138
  if (!(typeof message3.responseId === "string" && message3.responseId.length > 0)) {
@@ -25707,8 +26183,8 @@ function resolveOmpExecutable(input3, dependencies = {}) {
25707
26183
 
25708
26184
  // dist/omp-rpc-session.js
25709
26185
  import { spawn, spawnSync } from "node:child_process";
25710
- import { randomUUID } from "node:crypto";
25711
- import path6 from "node:path";
26186
+ import { randomUUID as randomUUID3 } from "node:crypto";
26187
+ import path7 from "node:path";
25712
26188
 
25713
26189
  // dist/omp-slash-commands.js
25714
26190
  var OMP_LIVE_COMMAND_ID_PREFIX = "omp.slash.";
@@ -25740,6 +26216,121 @@ function ompLiveCommands(native) {
25740
26216
  }));
25741
26217
  }
25742
26218
 
26219
+ // dist/omp-native-extension.js
26220
+ import { createHash, createHmac, randomUUID as randomUUID2 } from "node:crypto";
26221
+ import { mkdir, readFile, rename, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
26222
+ import { homedir as homedir2 } from "node:os";
26223
+ import path6 from "node:path";
26224
+ var hookKeyEnv = "CODEXHOST_OMP_RPC_KEY";
26225
+ var hookStatus = "codexhost.rpc.v1";
26226
+ function proof(key, ...parts) {
26227
+ return createHmac("sha256", key).update(JSON.stringify(parts)).digest("base64url");
26228
+ }
26229
+ var record3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
26230
+ function eligibleWireRoute(model2) {
26231
+ if (model2.providerType != null && model2.providerType !== "openai-codex")
26232
+ return false;
26233
+ if (model2.transport != null)
26234
+ return false;
26235
+ if (model2.requestModelId != null && (typeof model2.requestModelId !== "string" || !/^gpt(?:[-.]|$)/iu.test(model2.requestModelId)))
26236
+ return false;
26237
+ if (model2.accountAccess == null)
26238
+ return true;
26239
+ return record3(model2.accountAccess) && Object.values(model2.accountAccess).every((access) => {
26240
+ if (!record3(access))
26241
+ return false;
26242
+ const tiers = access.serviceTiers;
26243
+ return tiers == null || Array.isArray(tiers) && (tiers.length === 0 || tiers.includes("priority"));
26244
+ });
26245
+ }
26246
+ var routeFields = [
26247
+ "provider",
26248
+ "api",
26249
+ "id",
26250
+ "requestModelId",
26251
+ "baseUrl",
26252
+ "providerType",
26253
+ "transport",
26254
+ "headers",
26255
+ "serviceTiers",
26256
+ "accountAccess"
26257
+ ];
26258
+ function requestScope(key, session, file2, model2) {
26259
+ return proof(key, "request", session, file2, ...routeFields.map((field2) => model2[field2] ?? null));
26260
+ }
26261
+ var ompHookSource = `import { createHmac } from "node:crypto";
26262
+ const key = process.env.${hookKeyEnv};
26263
+ delete process.env.${hookKeyEnv};
26264
+ const sign = (...parts) => createHmac("sha256", key).update(JSON.stringify(parts)).digest("base64url");
26265
+ const fields = ${JSON.stringify(routeFields)};
26266
+ const main = ctx => ctx.mode === "rpc" && ctx.agent?.kind === "main";
26267
+ export default function(pi) {
26268
+ if (!key) return;
26269
+ let durableSession;
26270
+ pi.on("before_agent_start", async (event, ctx) => {
26271
+ if (event.reason !== "prompt" || !main(ctx)) return;
26272
+ const manager = ctx.sessionManager;
26273
+ const file = manager.getSessionFile();
26274
+ const id = manager.getSessionId();
26275
+ if (!file || durableSession === id || !manager.ensureOnDisk) return;
26276
+ await manager.ensureOnDisk();
26277
+ ctx.ui.setStatus("${hookStatus}", sign("durable", id, file));
26278
+ durableSession = id;
26279
+ });
26280
+ const version = /^(\\d+)\\.(\\d+)\\.(\\d+)(?:\\+[^-]+)?$/.exec(pi.pi?.VERSION);
26281
+ if (!version) return;
26282
+ const [major, minor, patch] = version.slice(1).map(Number);
26283
+ if (major < 19 || (major === 19 && (minor < 4 || (minor === 4 && patch < 1)))) return;
26284
+ const status = state => (_event, ctx) => { if (main(ctx)) ctx.ui.setStatus("${hookStatus}", sign(state)); };
26285
+ pi.on("session_start", status("ready"));
26286
+ pi.on("session_switch", status("ready"));
26287
+ pi.on("session_shutdown", status("shutdown"));
26288
+ const title = sign("select");
26289
+ pi.on("before_provider_request", async ({payload}, ctx) => {
26290
+ const m = ctx.model;
26291
+ if (!main(ctx) || m?.provider !== "openai-codex" || m.api !== "openai-codex-responses" ||
26292
+ !/^gpt(?:[-.]|$)/i.test(m.id) || payload?.model !== (m.requestModelId ?? m.id)) return;
26293
+ const scope = sign("request", ctx.sessionManager.getSessionId(), ctx.sessionManager.getSessionFile() ?? null,
26294
+ ...fields.map(field => m[field] ?? null));
26295
+ const missed = () => ctx.ui.setStatus("${hookStatus}", sign("missed", scope));
26296
+ let lane;
26297
+ try {
26298
+ lane = await ctx.ui.input(title, scope, { timeout: 2000, onTimeout: missed });
26299
+ } catch {
26300
+ missed();
26301
+ }
26302
+ if (lane === "priority") return { ...payload, service_tier: "priority" };
26303
+ });
26304
+ }
26305
+ `;
26306
+ var digest = createHash("sha256").update(ompHookSource).digest("hex");
26307
+ async function ensureOmpHook(environment) {
26308
+ const data = environment.CODEXHOST_DATA_DIR ?? path6.join(environment.HOME ?? environment.USERPROFILE ?? homedir2(), ".codexhost");
26309
+ const directory = path6.resolve(data, "extensions", "omp-rpc");
26310
+ const file2 = path6.join(directory, `${digest}.js`);
26311
+ const matches = async () => await readFile(file2, "utf8").catch((error62) => {
26312
+ if (error62.code === "ENOENT")
26313
+ return null;
26314
+ throw error62;
26315
+ }) === ompHookSource;
26316
+ if (await matches())
26317
+ return file2;
26318
+ await mkdir(directory, { recursive: true, mode: 448 });
26319
+ const temporary = `${file2}.${randomUUID2()}.tmp`;
26320
+ try {
26321
+ await writeFile2(temporary, ompHookSource, { flag: "wx", mode: 384 });
26322
+ try {
26323
+ await rename(temporary, file2);
26324
+ } catch (error62) {
26325
+ if (!await matches())
26326
+ throw error62;
26327
+ }
26328
+ } finally {
26329
+ await rm2(temporary, { force: true });
26330
+ }
26331
+ return file2;
26332
+ }
26333
+
25743
26334
  // dist/omp-session-file.js
25744
26335
  import { createReadStream as createReadStream3 } from "node:fs";
25745
26336
  import { open as open2, realpath as realpath2 } from "node:fs/promises";
@@ -25801,7 +26392,8 @@ async function readOmpSessionHistory(sessionFile, maxBytes) {
25801
26392
  continue;
25802
26393
  }
25803
26394
  entries.push(entry);
25804
- leafId = entry.id;
26395
+ if (entry.type !== "model_usage")
26396
+ leafId = entry.id;
25805
26397
  }
25806
26398
  return { entries, leafId, ...incomplete ? { incomplete: true } : {} };
25807
26399
  }
@@ -25988,7 +26580,18 @@ function sessionStateData(response) {
25988
26580
  throw new OmpRpcFaultError("protocolError", "Omp RPC state response has no data");
25989
26581
  return data;
25990
26582
  }
25991
- function parseSessionState(response) {
26583
+ function fastMetadata(model2) {
26584
+ const { serviceTiers } = model2;
26585
+ if (serviceTiers != null && !(Array.isArray(serviceTiers) && serviceTiers.every(nonBlankString))) {
26586
+ throw new OmpRpcFaultError("protocolError", "Omp RPC Model contains invalid service tiers");
26587
+ }
26588
+ return {
26589
+ ...nonBlankString(model2.api) && { api: model2.api },
26590
+ ...serviceTiers != null && { serviceTiers },
26591
+ ...model2.provider === "openai-codex" && !eligibleWireRoute(model2) && { fastEligible: false }
26592
+ };
26593
+ }
26594
+ function parseSessionState(response, key) {
25992
26595
  const data = sessionStateData(response);
25993
26596
  const model2 = parseNativeModel(data.model, "state");
25994
26597
  if (!nonBlankString(data.sessionId)) {
@@ -26003,16 +26606,25 @@ function parseSessionState(response) {
26003
26606
  const parsed = harnessThinkingOptionIdSchema.safeParse(level);
26004
26607
  return parsed.success ? [parsed.data] : [];
26005
26608
  }) : null;
26609
+ const metadata = isRecord8(data.model) ? fastMetadata(data.model) : {};
26610
+ const file2 = typeof data.sessionFile === "string" ? data.sessionFile : null;
26611
+ const eligible = model2 && supportsOmpChatGptFast({ ...model2, ...metadata });
26006
26612
  return {
26007
26613
  sessionId: data.sessionId,
26008
- sessionFile: typeof data.sessionFile === "string" ? data.sessionFile : null,
26614
+ sessionFile: file2,
26009
26615
  provider: model2?.provider ?? null,
26010
26616
  modelId: model2?.id ?? null,
26617
+ ...metadata,
26618
+ ...eligible && isRecord8(data.model) && { fastScope: requestScope(key, data.sessionId, file2, data.model) },
26619
+ ...eligible && typeof data.fastModeEnabled === "boolean" && { fastModeEnabled: data.fastModeEnabled },
26011
26620
  thinkingLevel: thinkingLevel?.data ?? null,
26012
26621
  contextUsage: optionalOmpStateContextUsage(data.contextUsage),
26013
26622
  availableThinkingLevels
26014
26623
  };
26015
26624
  }
26625
+ function isOmpNativeSpeedMutation(text3) {
26626
+ return /^\s*\/(?:fast|ultrafast)(?=$|[:\s])(?![\s:]+status\s*$)|^\s*\/switch(?=$|[:\s])/iu.test(text3);
26627
+ }
26016
26628
  function parseSessionStreaming(response) {
26017
26629
  const isStreaming = sessionStateData(response).isStreaming;
26018
26630
  if (typeof isStreaming !== "boolean") {
@@ -26034,7 +26646,7 @@ function parseAvailableModels(response) {
26034
26646
  if (!parsed || !isRecord8(model2) || typeof model2.reasoning !== "boolean") {
26035
26647
  throw new OmpRpcFaultError("protocolError", "Omp RPC catalog contains a Model without reasoning capability");
26036
26648
  }
26037
- return { ...parsed, reasoning: model2.reasoning };
26649
+ return { ...parsed, reasoning: model2.reasoning, ...fastMetadata(model2) };
26038
26650
  });
26039
26651
  }
26040
26652
  function parseSubagentMessages(response) {
@@ -26144,11 +26756,12 @@ function ompRpcProcessCommand(options, dependencies = {}) {
26144
26756
  "--mode",
26145
26757
  // OMP only creates ask and connects its tool UI in rpc-ui mode.
26146
26758
  "rpc-ui",
26759
+ ...options.extensionFile ? ["--extension", options.extensionFile] : [],
26147
26760
  ...permissionArguments,
26148
26761
  ...modelArguments,
26149
26762
  ...sessionArguments
26150
26763
  ];
26151
- const extension = path6.win32.extname(command).toLowerCase();
26764
+ const extension = path7.win32.extname(command).toLowerCase();
26152
26765
  if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
26153
26766
  return { command, arguments: arguments_, windowsVerbatimArguments: false };
26154
26767
  }
@@ -26185,9 +26798,16 @@ var OmpRpcSession = class {
26185
26798
  #compactionTurn = null;
26186
26799
  #compactionTimeout = null;
26187
26800
  #failed = false;
26801
+ #started = false;
26188
26802
  #pending = /* @__PURE__ */ new Map();
26189
26803
  #state = null;
26190
26804
  #availableCommands = null;
26805
+ #settingFast = false;
26806
+ #hookKey = randomUUID3();
26807
+ #hookTitle = proof(this.#hookKey, "select");
26808
+ #hookReady = false;
26809
+ #durableProof = null;
26810
+ #fastScope;
26191
26811
  #latestCacheHitRatePercent;
26192
26812
  #manualCompaction = null;
26193
26813
  #usageRequestStartedAtMs = null;
@@ -26228,18 +26848,28 @@ var OmpRpcSession = class {
26228
26848
  get stderrTail() {
26229
26849
  return this.#stderrTail;
26230
26850
  }
26851
+ get speedAvailable() {
26852
+ return this.#hookReady && !this.#closed && !this.#failed;
26853
+ }
26231
26854
  async start() {
26232
- if (this.#child || this.#closed)
26855
+ if (this.#started || this.#closed)
26233
26856
  throw new Error("Omp RPC Session cannot be started twice");
26857
+ this.#started = true;
26858
+ const environment = withNodeRuntimeOnPath({
26859
+ ...process.env,
26860
+ ...this.#options.environment,
26861
+ [hookKeyEnv]: this.#hookKey,
26862
+ OMP_SKIP_VERSION_CHECK: "1",
26863
+ OMP_TELEMETRY: "0"
26864
+ });
26865
+ const extensionFile = this.#processAdapter === nodeProcessAdapter ? await ensureOmpHook(environment) : void 0;
26866
+ if (this.#closed)
26867
+ throw new Error("Omp RPC Session closed during startup");
26234
26868
  const child = this.#processAdapter.spawn({
26235
26869
  cwd: this.#options.cwd,
26236
26870
  ...this.#options.command ? { command: this.#options.command } : {},
26237
- environment: withNodeRuntimeOnPath({
26238
- ...process.env,
26239
- ...this.#options.environment,
26240
- OMP_SKIP_VERSION_CHECK: "1",
26241
- OMP_TELEMETRY: "0"
26242
- }),
26871
+ environment,
26872
+ ...extensionFile && { extensionFile },
26243
26873
  ...this.#options.sessionFile ? { sessionFile: this.#options.sessionFile } : {},
26244
26874
  ...this.#options.forkSessionFile ? { forkSessionFile: this.#options.forkSessionFile } : {},
26245
26875
  ...this.#options.model ? { model: this.#options.model } : {},
@@ -26293,7 +26923,7 @@ var OmpRpcSession = class {
26293
26923
  await this.#send("set_subagent_subscription", { level: "events" }).catch(() => void 0);
26294
26924
  }
26295
26925
  try {
26296
- this.#state = parseSessionState(await this.#send("get_state", {}));
26926
+ this.#state = parseSessionState(await this.#send("get_state", {}), this.#hookKey);
26297
26927
  } catch (error62) {
26298
26928
  const fault = error62 instanceof OmpRpcFaultError ? error62 : new OmpRpcFaultError("unavailable", `Omp RPC state unavailable: ${message2(error62)}`);
26299
26929
  this.#fail(fault);
@@ -26376,7 +27006,7 @@ var OmpRpcSession = class {
26376
27006
  if (!this.#child || !this.#state || this.#closed || this.#failed) {
26377
27007
  throw new Error("Omp RPC Session is unavailable");
26378
27008
  }
26379
- if (this.#activeTurn || this.#manualCompaction || this.#compactionActive) {
27009
+ if (this.#activeTurn || this.#settingFast || this.#manualCompaction || this.#compactionActive) {
26380
27010
  throw new Error("Omp RPC Session already has an active operation");
26381
27011
  }
26382
27012
  const result = new Promise((resolve, reject) => {
@@ -26400,7 +27030,7 @@ var OmpRpcSession = class {
26400
27030
  if (!(error62 instanceof OmpRpcUnsupportedCommandError))
26401
27031
  throw error62;
26402
27032
  const response = await this.#send("get_state", {});
26403
- const observedState = parseSessionState(response);
27033
+ const observedState = parseSessionState(response, this.#hookKey);
26404
27034
  if (!this.#state || observedState.sessionId !== this.#state.sessionId || observedState.provider !== this.#state.provider || observedState.modelId !== this.#state.modelId) {
26405
27035
  throw new Error("Omp RPC Usage fallback does not match the confirmed Session state");
26406
27036
  }
@@ -26422,6 +27052,8 @@ var OmpRpcSession = class {
26422
27052
  return this.#latestCacheHitRatePercent === null || this.#latestCacheHitRatePercent === void 0 ? usage : parseHostUsage({ ...usage, cacheHitRatePercent: this.#latestCacheHitRatePercent });
26423
27053
  }
26424
27054
  async fork(entryId) {
27055
+ if (this.#settingFast)
27056
+ throw new Error("Omp RPC Session already has an active operation");
26425
27057
  if (!nonBlankString(entryId))
26426
27058
  throw new Error("Omp RPC Fork requires an Entry identity");
26427
27059
  try {
@@ -26430,7 +27062,8 @@ var OmpRpcSession = class {
26430
27062
  if (!data || data.cancelled === true) {
26431
27063
  throw new OmpRpcFaultError("unavailable", "Omp RPC Fork was cancelled");
26432
27064
  }
26433
- this.#state = parseSessionState(await this.#send("get_state", {}));
27065
+ this.#releaseOverlay();
27066
+ this.#state = parseSessionState(await this.#send("get_state", {}), this.#hookKey);
26434
27067
  return this.#state;
26435
27068
  } catch (error62) {
26436
27069
  if (error62 instanceof OmpRpcFaultError)
@@ -26458,18 +27091,84 @@ var OmpRpcSession = class {
26458
27091
  return this.state.availableThinkingLevels;
26459
27092
  }
26460
27093
  async selectModel(model2) {
27094
+ if (this.#settingFast)
27095
+ throw new Error("Omp RPC Session already has an active operation");
26461
27096
  await this.#send("set_model", { provider: model2.provider, modelId: model2.id });
27097
+ this.#releaseOverlay();
26462
27098
  return this.#refreshState("Model");
26463
27099
  }
26464
27100
  async selectThinkingOption(thinkingOptionId) {
27101
+ if (this.#settingFast)
27102
+ throw new Error("Omp RPC Session already has an active operation");
26465
27103
  const level = harnessThinkingOptionIdSchema.parse(thinkingOptionId);
26466
27104
  await this.#send("set_thinking_level", { level });
26467
27105
  return this.#refreshState("Thinking");
26468
27106
  }
26469
- async #refreshState(operation) {
27107
+ async selectSpeed(tier) {
27108
+ if (tier !== "priority" && tier !== null)
27109
+ throw new Error("Unsupported Omp speed");
27110
+ if (this.#manualCompaction || this.#compactionActive || this.#settingFast) {
27111
+ throw new Error("Omp RPC Session already has an active operation");
27112
+ }
27113
+ this.#settingFast = true;
26470
27114
  try {
26471
- this.#state = parseSessionState(await this.#send("get_state", {}));
27115
+ const active2 = this.#activeTurn;
27116
+ const previousScope = this.state.fastScope;
27117
+ const snapshot = await this.#send("get_state", {});
27118
+ if (this.state.fastScope !== previousScope)
27119
+ throw new Error("Omp Fast selection target changed");
27120
+ const state = this.#acceptState(parseSessionState(snapshot, this.#hookKey));
27121
+ const settled = sessionSettled(snapshot, true);
27122
+ if (this.#compactionActive || sessionStateData(snapshot).isCompacting === true || !this.#activeTurn && !settled) {
27123
+ throw new Error("Omp RPC Session is not idle");
27124
+ }
27125
+ if (active2 && (active2.nativeSpeedMutation || active2.cancellation !== "none")) {
27126
+ throw new Error("Omp RPC Session already has an active operation");
27127
+ }
27128
+ if (tier !== null || active2) {
27129
+ if (state.fastScope !== previousScope)
27130
+ throw new Error("Omp Fast selection target changed");
27131
+ if (!state.fastScope)
27132
+ throw new Error("Omp Fast requires an eligible ChatGPT Codex Model");
27133
+ if (!this.speedAvailable)
27134
+ throw new Error("Omp request-scoped Fast hook is unavailable");
27135
+ }
27136
+ if (tier === null) {
27137
+ this.#clearSelectedSpeed();
27138
+ return this.state;
27139
+ }
27140
+ this.#fastScope = state.fastScope;
27141
+ this.#state = { ...state, serviceTier: "priority" };
26472
27142
  return this.#state;
27143
+ } finally {
27144
+ this.#settingFast = false;
27145
+ }
27146
+ }
27147
+ #releaseOverlay() {
27148
+ if (this.#activeTurn)
27149
+ this.#activeTurn.fastScope = void 0;
27150
+ this.#clearSelectedSpeed();
27151
+ }
27152
+ #clearSelectedSpeed() {
27153
+ this.#fastScope = void 0;
27154
+ if (this.#state?.serviceTier) {
27155
+ const { serviceTier: _, ...native } = this.#state;
27156
+ this.#state = native;
27157
+ }
27158
+ }
27159
+ #acceptState(state) {
27160
+ const eligibleScope = this.speedAvailable ? state.fastScope : void 0;
27161
+ if (this.#fastScope !== eligibleScope)
27162
+ this.#fastScope = void 0;
27163
+ if (this.#activeTurn && this.#activeTurn.fastScope !== eligibleScope) {
27164
+ this.#activeTurn.fastScope = void 0;
27165
+ }
27166
+ this.#state = this.#fastScope ? { ...state, serviceTier: "priority" } : state;
27167
+ return this.#state;
27168
+ }
27169
+ async #refreshState(operation) {
27170
+ try {
27171
+ return this.#acceptState(parseSessionState(await this.#send("get_state", {}), this.#hookKey));
26473
27172
  } catch (error62) {
26474
27173
  const fault = error62 instanceof OmpRpcFaultError ? error62 : new OmpRpcFaultError("protocolError", `Omp RPC ${operation} state could not be confirmed: ${message2(error62)}`);
26475
27174
  this.#fail(fault);
@@ -26484,6 +27183,11 @@ var OmpRpcSession = class {
26484
27183
  throw new Error("Omp steer text must not be empty");
26485
27184
  const target2 = this.#activeTurn;
26486
27185
  let targetEnded = false;
27186
+ if (isOmpNativeSpeedMutation(message3)) {
27187
+ if (target2)
27188
+ target2.nativeSpeedMutation = true;
27189
+ this.#releaseOverlay();
27190
+ }
26487
27191
  const response = await this.#send("steer", { message: message3 }, void 0, () => {
26488
27192
  targetEnded = target2 !== null && this.#activeTurn !== target2;
26489
27193
  });
@@ -26504,14 +27208,20 @@ var OmpRpcSession = class {
26504
27208
  if (!this.#child || !this.#state || this.#closed || this.#failed) {
26505
27209
  throw new Error("Omp RPC Session is unavailable");
26506
27210
  }
26507
- if (this.#activeTurn)
26508
- throw new Error("Omp RPC Session already has an active Turn");
27211
+ if (this.#activeTurn || this.#settingFast) {
27212
+ throw new Error("Omp RPC Session already has an active operation");
27213
+ }
26509
27214
  if (text3.length === 0)
26510
27215
  throw new Error("Omp text Turn must not be empty");
26511
- const promptId = `codexhost-${randomUUID()}`;
27216
+ const nativeSpeedMutation = isOmpNativeSpeedMutation(text3);
27217
+ if (nativeSpeedMutation)
27218
+ this.#releaseOverlay();
27219
+ const promptId = `codexhost-${randomUUID3()}`;
26512
27220
  const settled = new Promise((resolve, reject) => {
26513
27221
  this.#activeTurn = {
26514
27222
  promptId,
27223
+ fastScope: this.#fastScope,
27224
+ nativeSpeedMutation,
26515
27225
  localResult: null,
26516
27226
  text: "",
26517
27227
  assistantMessageId: null,
@@ -26688,6 +27398,27 @@ var OmpRpcSession = class {
26688
27398
  this.#readyResolve = null;
26689
27399
  return;
26690
27400
  }
27401
+ if (value.type === "extension_ui_request") {
27402
+ const scope = this.#activeTurn ? this.#activeTurn.fastScope : this.#fastScope;
27403
+ if (value.method === "setStatus" && value.statusKey === hookStatus) {
27404
+ if (value.statusText === proof(this.#hookKey, "ready"))
27405
+ this.#hookReady = true;
27406
+ else if (value.statusText === proof(this.#hookKey, "shutdown"))
27407
+ this.#hookReady = false;
27408
+ else if (scope && value.statusText === proof(this.#hookKey, "missed", scope)) {
27409
+ this.#releaseOverlay();
27410
+ this.#fail(new OmpRpcFaultError("protocolError", "Omp Fast request could not be confirmed"));
27411
+ } else if (this.#state?.sessionFile && value.statusText === proof(this.#hookKey, "durable", this.#state.sessionId, this.#state.sessionFile)) {
27412
+ this.#durableProof = value.statusText;
27413
+ }
27414
+ return;
27415
+ }
27416
+ if (value.method === "input" && value.title === this.#hookTitle && nonBlankString(value.id)) {
27417
+ const lane = this.speedAvailable && scope && value.placeholder === scope ? "priority" : "native";
27418
+ 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)}`)));
27419
+ return;
27420
+ }
27421
+ }
26691
27422
  if (value.type === "response") {
26692
27423
  this.#handleResponse(value);
26693
27424
  return;
@@ -26743,6 +27474,9 @@ var OmpRpcSession = class {
26743
27474
  this.#observeUsage(value);
26744
27475
  if (value.type === "agent_start" && active2) {
26745
27476
  active2.terminalEnd = false;
27477
+ if (!active2.sawAgentStart && (!this.#hookReady || this.state.sessionFile && this.#durableProof === proof(this.#hookKey, "durable", this.state.sessionId, this.state.sessionFile))) {
27478
+ active2.onEvent({ type: "agent.started" });
27479
+ }
26746
27480
  active2.sawAgentStart = true;
26747
27481
  }
26748
27482
  if ((value.type === "session_settled" || value.type === "agent_start") && active2?.cancellation === "accepted") {
@@ -27151,11 +27885,12 @@ var OmpRpcSession = class {
27151
27885
  return;
27152
27886
  response = await this.#send("get_state", {});
27153
27887
  }
27154
- let state = parseSessionState(response);
27888
+ let state = parseSessionState(response, this.#hookKey);
27155
27889
  if (this.#activeTurn !== active2 || active2.cancellation !== "accepted")
27156
27890
  return;
27157
27891
  const data = sessionStateData(response);
27158
27892
  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) {
27893
+ const previous = state;
27159
27894
  await this.verifySessionCwd(this.#options.cwd);
27160
27895
  if (this.#activeTurn !== active2)
27161
27896
  return;
@@ -27172,9 +27907,8 @@ var OmpRpcSession = class {
27172
27907
  if (!isRecord8(reloaded.data) || reloaded.data.cancelled !== false) {
27173
27908
  throw new OmpRpcFaultError("unavailable", "Omp cancelled Session reload was refused");
27174
27909
  }
27175
- const previous = state;
27176
27910
  response = await this.#send("get_state", {});
27177
- state = parseSessionState(response);
27911
+ state = parseSessionState(response, this.#hookKey);
27178
27912
  if (state.sessionId !== previous.sessionId || state.sessionFile !== previous.sessionFile) {
27179
27913
  throw new OmpRpcFaultError("protocolError", "Omp cancelled Session reload changed its identity");
27180
27914
  }
@@ -27187,9 +27921,11 @@ var OmpRpcSession = class {
27187
27921
  if (previous.thinkingLevel && state.thinkingLevel !== previous.thinkingLevel) {
27188
27922
  await this.#send("set_thinking_level", { level: previous.thinkingLevel });
27189
27923
  }
27190
- response = await this.#send("get_state", {});
27191
- state = parseSessionState(response);
27192
- if (state.sessionId !== previous.sessionId || state.sessionFile !== previous.sessionFile || state.provider !== previous.provider || state.modelId !== previous.modelId || previous.thinkingLevel !== null && state.thinkingLevel !== previous.thinkingLevel) {
27924
+ if (state.provider !== previous.provider || state.modelId !== previous.modelId || state.thinkingLevel !== previous.thinkingLevel) {
27925
+ response = await this.#send("get_state", {});
27926
+ state = parseSessionState(response, this.#hookKey);
27927
+ }
27928
+ 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) {
27193
27929
  throw new OmpRpcFaultError("protocolError", "Omp cancelled Session reload changed its identity or configuration");
27194
27930
  }
27195
27931
  }
@@ -27201,7 +27937,9 @@ var OmpRpcSession = class {
27201
27937
  }, 250);
27202
27938
  return;
27203
27939
  }
27204
- this.#state = state;
27940
+ if (this.#activeTurn !== active2)
27941
+ return;
27942
+ this.#acceptState(state);
27205
27943
  active2.settlement = "confirmed";
27206
27944
  this.#finishSettledTurn(active2);
27207
27945
  } catch (error62) {
@@ -27228,7 +27966,8 @@ var OmpRpcSession = class {
27228
27966
  active2.settlement = "confirming";
27229
27967
  try {
27230
27968
  const response = await this.#send("get_state", {});
27231
- const state = parseSessionState(response);
27969
+ const settled = sessionSettled(response, hasTurnCompletion(active2));
27970
+ const state = parseSessionState(response, this.#hookKey);
27232
27971
  if (this.#activeTurn !== active2)
27233
27972
  return;
27234
27973
  if (active2.cancellation !== "none") {
@@ -27242,7 +27981,7 @@ var OmpRpcSession = class {
27242
27981
  active2.settledNotice = false;
27243
27982
  return;
27244
27983
  }
27245
- if (!sessionSettled(response, hasTurnCompletion(active2))) {
27984
+ if (!settled) {
27246
27985
  active2.settlement = "pending";
27247
27986
  if (active2.settledNotice) {
27248
27987
  active2.settledNotice = false;
@@ -27253,7 +27992,7 @@ var OmpRpcSession = class {
27253
27992
  }
27254
27993
  return;
27255
27994
  }
27256
- this.#state = state;
27995
+ this.#acceptState(state);
27257
27996
  active2.settlement = "confirmed";
27258
27997
  this.#finishSettledTurn(active2);
27259
27998
  } catch (error62) {
@@ -27303,7 +28042,7 @@ var OmpRpcSession = class {
27303
28042
  if (active2.assistantMessageId !== null && active2.reasoningMessageOpen) {
27304
28043
  active2.onEvent({ type: "reasoning.completed", messageId: active2.assistantMessageId });
27305
28044
  }
27306
- const messageId = assistantMessageId(value) ?? randomUUID();
28045
+ const messageId = assistantMessageId(value) ?? randomUUID3();
27307
28046
  active2.assistantMessageId = messageId;
27308
28047
  active2.sawStreamedMessageText = false;
27309
28048
  active2.sawStreamedMessageReasoning = false;
@@ -27356,7 +28095,7 @@ var OmpRpcSession = class {
27356
28095
  child.stdin.write(frame, (error62) => error62 ? reject(error62) : resolve());
27357
28096
  });
27358
28097
  }
27359
- #send(type, payload, id2 = `codexhost-${randomUUID()}`, onResponse) {
28098
+ #send(type, payload, id2 = `codexhost-${randomUUID3()}`, onResponse) {
27360
28099
  const child = this.#child;
27361
28100
  if (!child?.stdin.writable || this.#closed || this.#failed) {
27362
28101
  return Promise.reject(new Error("Omp RPC stdin is unavailable"));
@@ -27548,7 +28287,17 @@ function parseOmpModelList(output2) {
27548
28287
  if (!isRecord9(model2) || !nonBlankString2(model2.provider) || !nonBlankString2(model2.id) || typeof model2.reasoning !== "boolean") {
27549
28288
  return null;
27550
28289
  }
27551
- models.push({ provider: model2.provider, id: model2.id, reasoning: model2.reasoning });
28290
+ const { serviceTiers } = model2;
28291
+ if (serviceTiers != null && !(Array.isArray(serviceTiers) && serviceTiers.every(nonBlankString2))) {
28292
+ return null;
28293
+ }
28294
+ models.push({
28295
+ provider: model2.provider,
28296
+ id: model2.id,
28297
+ ...typeof model2.api === "string" && { api: model2.api },
28298
+ reasoning: model2.reasoning,
28299
+ ...serviceTiers != null && { serviceTiers }
28300
+ });
27552
28301
  }
27553
28302
  return models;
27554
28303
  }
@@ -27659,16 +28408,16 @@ var Diff = class {
27659
28408
  }
27660
28409
  }
27661
28410
  }
27662
- addToPath(path9, added, removed, oldPosInc, options) {
27663
- const last = path9.lastComponent;
28411
+ addToPath(path10, added, removed, oldPosInc, options) {
28412
+ const last = path10.lastComponent;
27664
28413
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
27665
28414
  return {
27666
- oldPos: path9.oldPos + oldPosInc,
28415
+ oldPos: path10.oldPos + oldPosInc,
27667
28416
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
27668
28417
  };
27669
28418
  } else {
27670
28419
  return {
27671
- oldPos: path9.oldPos + oldPosInc,
28420
+ oldPos: path10.oldPos + oldPosInc,
27672
28421
  lastComponent: { count: 1, added, removed, previousComponent: last }
27673
28422
  };
27674
28423
  }
@@ -28080,9 +28829,9 @@ function splitLines(text3) {
28080
28829
  }
28081
28830
 
28082
28831
  // dist/omp-adapter.js
28083
- import { createHash, randomUUID as randomUUID2 } from "node:crypto";
28832
+ import { createHash as createHash3, randomUUID as randomUUID5 } from "node:crypto";
28084
28833
  import { realpath as realpath3, stat as stat2 } from "node:fs/promises";
28085
- import path7 from "node:path";
28834
+ import path8 from "node:path";
28086
28835
 
28087
28836
  // dist/omp-account-credits.js
28088
28837
  var CACHE_MS = 3e4;
@@ -28286,6 +29035,49 @@ async function rollbackOmpLastTurn(transport, sourceSessionId, cwd) {
28286
29035
  return { ok: true };
28287
29036
  }
28288
29037
 
29038
+ // dist/omp-speed-selection.js
29039
+ import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
29040
+ import { open as open3, rename as rename2, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
29041
+ function selectionFile(sessionFile, scope) {
29042
+ const key = createHash2("sha256").update(scope).digest("hex");
29043
+ return `${sessionFile}.codexhost-speed-${key}`;
29044
+ }
29045
+ async function readOmpSpeedSelection(sessionFile, sessionId, scope) {
29046
+ let handle;
29047
+ try {
29048
+ handle = await open3(selectionFile(sessionFile, scope), "r");
29049
+ const { size } = await handle.stat();
29050
+ if (!size || size > 4096)
29051
+ return null;
29052
+ const { buffer, bytesRead } = await handle.read(Buffer.allocUnsafe(size));
29053
+ const record4 = JSON.parse(buffer.toString("utf8", 0, bytesRead));
29054
+ return record4?.sessionId === sessionId && typeof record4.fastModelId === "string" ? record4.fastModelId : null;
29055
+ } catch {
29056
+ return null;
29057
+ } finally {
29058
+ await handle?.close();
29059
+ }
29060
+ }
29061
+ async function writeOmpSpeedSelection(state, scope, fastModelId) {
29062
+ if (!state.sessionFile)
29063
+ return;
29064
+ const file2 = selectionFile(state.sessionFile, scope);
29065
+ if (fastModelId === null) {
29066
+ await rm3(file2, { force: true });
29067
+ return;
29068
+ }
29069
+ const temporary = `${file2}.${randomUUID4()}.tmp`;
29070
+ try {
29071
+ await writeFile3(temporary, JSON.stringify({ sessionId: state.sessionId, fastModelId }), {
29072
+ flag: "wx",
29073
+ mode: 384
29074
+ });
29075
+ await rename2(temporary, file2);
29076
+ } finally {
29077
+ await rm3(temporary, { force: true });
29078
+ }
29079
+ }
29080
+
28289
29081
  // dist/omp-permission-modes.js
28290
29082
  var nativePermissionModes = /* @__PURE__ */ new Set(["always-ask", "write", "yolo"]);
28291
29083
  var OMP_DEFAULT_PERMISSION_MODE_ID = harnessPermissionModeIdSchema.parse("yolo");
@@ -28515,7 +29307,7 @@ function normalizedError(error62, fallbackCode) {
28515
29307
  function invalidState(message3) {
28516
29308
  return { code: "invalidState", message: message3, retryable: false };
28517
29309
  }
28518
- function nativeModelFromState(state) {
29310
+ function nativeModelForHistory(state) {
28519
29311
  if (state.provider === null && state.modelId === null)
28520
29312
  return null;
28521
29313
  if (state.provider === null || state.modelId === null) {
@@ -28523,7 +29315,14 @@ function nativeModelFromState(state) {
28523
29315
  }
28524
29316
  return { provider: state.provider, id: state.modelId };
28525
29317
  }
28526
- function harnessStateFromOmp(state, thinkingLevels, index, permissionModeId) {
29318
+ function nativeModelFromState(state) {
29319
+ const model2 = nativeModelForHistory(state);
29320
+ if (model2?.provider === "openai-codex" && state.serviceTier) {
29321
+ model2.serviceTier = state.serviceTier;
29322
+ }
29323
+ return model2;
29324
+ }
29325
+ function harnessStateFromOmp(state, thinkingLevels, index, permissionModeId, speedScope) {
28527
29326
  const model2 = nativeModelFromState(state);
28528
29327
  const effectiveModel = model2 ? index.ref(model2) : void 0;
28529
29328
  const availableThinkingOptions = thinkingLevels ? normalizeOmpThinkingOptions(thinkingLevels) : void 0;
@@ -28531,12 +29330,14 @@ function harnessStateFromOmp(state, thinkingLevels, index, permissionModeId) {
28531
29330
  throw new OmpRpcFaultError("protocolError", "Omp effective Thinking level is absent from its available levels");
28532
29331
  }
28533
29332
  return {
28534
- nativeRef: nativeSessionRefSchema.parse({
28535
- harnessId: ompHarnessId2,
28536
- nativeSessionId: state.sessionId,
28537
- ...state.sessionFile ? { locator: { sessionFile: state.sessionFile } } : {},
28538
- formatVersion: 1
28539
- }),
29333
+ ...speedScope !== null ? {
29334
+ nativeRef: nativeSessionRefSchema.parse({
29335
+ harnessId: ompHarnessId2,
29336
+ nativeSessionId: state.sessionId,
29337
+ ...state.sessionFile ? { locator: { sessionFile: state.sessionFile, speedScope } } : {},
29338
+ formatVersion: 1
29339
+ })
29340
+ } : {},
28540
29341
  ...effectiveModel ? { effectiveModel } : {},
28541
29342
  ...state.thinkingLevel ? { effectiveThinkingOptionId: state.thinkingLevel } : {},
28542
29343
  ...availableThinkingOptions ? { availableThinkingOptions } : {},
@@ -28556,8 +29357,89 @@ async function reconcileThinkingLevel(transport, state, thinkingLevels) {
28556
29357
  thinkingLevels: await transport.getAvailableThinkingLevels()
28557
29358
  };
28558
29359
  }
28559
- function nativeModelForHistory(state) {
28560
- return nativeModelFromState(state);
29360
+ function validateOmpModel(ref) {
29361
+ const parsed = harnessModelRefSchema.parse(ref);
29362
+ if (parsed.serviceTier !== void 0 && parsed.serviceTier !== "priority") {
29363
+ throw new Error("Unsupported Omp service tier");
29364
+ }
29365
+ return parsed;
29366
+ }
29367
+ async function selectBaseModel(transport, model2) {
29368
+ if (!sameOmpModel(nativeModelForHistory(transport.state), model2)) {
29369
+ await transport.selectModel({ provider: model2.provider, id: model2.id });
29370
+ if (!sameOmpModel(nativeModelForHistory(transport.state), model2)) {
29371
+ throw new Error("Omp did not activate the requested Model");
29372
+ }
29373
+ }
29374
+ }
29375
+ async function selectOmpSpeed(transport, fast) {
29376
+ const tier = fast ? "priority" : null;
29377
+ const state = await transport.selectSpeed(tier);
29378
+ if (state.serviceTier === "priority" !== fast) {
29379
+ throw new Error("Omp did not activate the requested speed");
29380
+ }
29381
+ }
29382
+ async function restoreOmpSpeed(transport, fastModelId) {
29383
+ if (!transport.speedAvailable || transport.state.provider !== "openai-codex" || transport.state.modelId !== fastModelId)
29384
+ return null;
29385
+ try {
29386
+ await selectOmpSpeed(transport, true);
29387
+ return fastModelId;
29388
+ } catch (error62) {
29389
+ if (error62 instanceof OmpRpcFaultError)
29390
+ throw error62;
29391
+ if (transport.state.serviceTier === "priority")
29392
+ await selectOmpSpeed(transport, false);
29393
+ return null;
29394
+ }
29395
+ }
29396
+ async function applyOmpModel(transport, requested, ownedFastModelId, commit) {
29397
+ const oldModel = nativeModelForHistory(transport.state);
29398
+ const { serviceTier, thinkingLevel, fastScope } = transport.state;
29399
+ const fast = requested.serviceTier === "priority";
29400
+ if (fast && !transport.speedAvailable) {
29401
+ throw new OmpAdapterFaultError({
29402
+ code: "unsupported",
29403
+ message: "Omp speed selection is unavailable",
29404
+ retryable: false
29405
+ });
29406
+ }
29407
+ const changingModel = !sameOmpModel(oldModel, requested);
29408
+ let attemptedSpeed = false;
29409
+ try {
29410
+ let selection2 = changingModel ? null : ownedFastModelId;
29411
+ await selectBaseModel(transport, requested);
29412
+ if (transport.state.serviceTier === "priority" !== fast) {
29413
+ attemptedSpeed = true;
29414
+ await selectOmpSpeed(transport, fast);
29415
+ selection2 = fast ? requested.id : null;
29416
+ }
29417
+ await commit(selection2);
29418
+ } catch (error62) {
29419
+ if (error62 instanceof OmpRpcFaultError)
29420
+ throw error62;
29421
+ const switched = !sameOmpModel(nativeModelForHistory(transport.state), oldModel);
29422
+ if (!changingModel && (switched || fastScope !== transport.state.fastScope || serviceTier === transport.state.serviceTier && thinkingLevel === transport.state.thinkingLevel)) {
29423
+ throw error62;
29424
+ }
29425
+ try {
29426
+ if (switched && oldModel)
29427
+ await selectBaseModel(transport, oldModel);
29428
+ if (ownedFastModelId && (switched || attemptedSpeed))
29429
+ await selectOmpSpeed(transport, true);
29430
+ else if (attemptedSpeed && !switched)
29431
+ await selectOmpSpeed(transport, false);
29432
+ if (thinkingLevel && thinkingLevel !== transport.state.thinkingLevel) {
29433
+ await transport.selectThinkingOption(thinkingLevel);
29434
+ }
29435
+ if (!sameOmpModel(nativeModelForHistory(transport.state), oldModel) || serviceTier !== transport.state.serviceTier || thinkingLevel !== transport.state.thinkingLevel) {
29436
+ throw new Error("previous configuration was not restored");
29437
+ }
29438
+ } catch (rollbackError) {
29439
+ throw new OmpRpcFaultError("protocolError", `Omp Model selection failed (${errorMessage(error62)}) and could not be rolled back: ${errorMessage(rollbackError)}`);
29440
+ }
29441
+ throw error62;
29442
+ }
28561
29443
  }
28562
29444
  function sessionFileFromRef(ref) {
28563
29445
  if (ref.harnessId !== ompHarnessId2 || !isRecord10(ref.locator) || typeof ref.locator.sessionFile !== "string" || ref.locator.sessionFile.length === 0) {
@@ -28570,7 +29452,7 @@ function subagentTranscriptPath(parentSessionFile, nativeSubagentId) {
28570
29452
  if (nativeSubagentId.includes("/") || nativeSubagentId.includes("\\") || nativeSubagentId.includes("\0") || nativeSubagentId === "." || nativeSubagentId === "..") {
28571
29453
  throw new Error("Omp Subagent ID is not a plain transcript file name");
28572
29454
  }
28573
- if (!parentSessionFile.endsWith(".jsonl") || !path7.isAbsolute(parentSessionFile)) {
29455
+ if (!parentSessionFile.endsWith(".jsonl") || !path8.isAbsolute(parentSessionFile)) {
28574
29456
  return null;
28575
29457
  }
28576
29458
  return `${parentSessionFile.slice(0, -".jsonl".length)}/${nativeSubagentId}.jsonl`;
@@ -28579,7 +29461,7 @@ async function readSubagentTranscriptFile(parentSessionFile, nativeSubagentId) {
28579
29461
  const transcriptFile = subagentTranscriptPath(parentSessionFile, nativeSubagentId);
28580
29462
  if (transcriptFile === null)
28581
29463
  return { status: "missing" };
28582
- const parentDirectory = path7.dirname(transcriptFile);
29464
+ const parentDirectory = path8.dirname(transcriptFile);
28583
29465
  let metadata;
28584
29466
  try {
28585
29467
  metadata = await stat2(transcriptFile);
@@ -28597,7 +29479,7 @@ async function readSubagentTranscriptFile(parentSessionFile, nativeSubagentId) {
28597
29479
  realpath3(transcriptFile),
28598
29480
  realpath3(parentDirectory)
28599
29481
  ]);
28600
- if (path7.dirname(resolvedTranscript) !== resolvedParentDirectory) {
29482
+ if (path8.dirname(resolvedTranscript) !== resolvedParentDirectory) {
28601
29483
  throw new Error("Omp Subagent transcript resolves outside its parent Session directory");
28602
29484
  }
28603
29485
  return {
@@ -28662,10 +29544,10 @@ function stripDiffPrefix(pathString) {
28662
29544
  return pathString.startsWith("a/") || pathString.startsWith("b/") ? pathString.slice(2) : pathString;
28663
29545
  }
28664
29546
  function displayPath(nativePath, cwd) {
28665
- const resolvedCwd = path7.resolve(cwd);
28666
- const resolvedPath = path7.isAbsolute(nativePath) ? path7.resolve(nativePath) : path7.resolve(cwd, nativePath);
28667
- const relative = path7.relative(resolvedCwd, resolvedPath);
28668
- const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path7.sep}`);
29547
+ const resolvedCwd = path8.resolve(cwd);
29548
+ const resolvedPath = path8.isAbsolute(nativePath) ? path8.resolve(nativePath) : path8.resolve(cwd, nativePath);
29549
+ const relative = path8.relative(resolvedCwd, resolvedPath);
29550
+ const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path8.sep}`);
28669
29551
  const selected = inside ? relative : resolvedPath;
28670
29552
  const normalized = selected.replaceAll("\\", "/");
28671
29553
  if (normalized.length === 0 || normalized === ".")
@@ -28825,6 +29707,10 @@ var OmpHarnessSession = class {
28825
29707
  #onClosed;
28826
29708
  #requestedModel;
28827
29709
  #requestedThinkingOptionId;
29710
+ #fastModelId;
29711
+ #speedScope;
29712
+ #hasNativeRef;
29713
+ #mayHaveTurns;
28828
29714
  #toolOutputLimit;
28829
29715
  #accountCredits;
28830
29716
  #modelIndex;
@@ -28834,6 +29720,7 @@ var OmpHarnessSession = class {
28834
29720
  #active = null;
28835
29721
  #closePromise = null;
28836
29722
  #configuring = false;
29723
+ #modelStateWrites = Promise.resolve();
28837
29724
  #phase = "open";
28838
29725
  #starting = null;
28839
29726
  #state = {};
@@ -28850,6 +29737,10 @@ var OmpHarnessSession = class {
28850
29737
  this.#closeTimeoutMs = options.closeTimeoutMs;
28851
29738
  this.#requestedModel = options.model;
28852
29739
  this.#requestedThinkingOptionId = options.thinkingOptionId;
29740
+ this.#fastModelId = options.fastModelId ?? null;
29741
+ this.#speedScope = options.speedScope ?? randomUUID5();
29742
+ this.#hasNativeRef = !!options.startedTransport;
29743
+ this.#mayHaveTurns = this.#hasNativeRef;
28853
29744
  this.#toolOutputLimit = options.toolOutputLimit;
28854
29745
  this.#accountCredits = options.accountCredits;
28855
29746
  this.#accountKey = options.initialAccountKey ?? null;
@@ -28874,7 +29765,7 @@ var OmpHarnessSession = class {
28874
29765
  };
28875
29766
  this.#transport = options.startedTransport ?? null;
28876
29767
  this.#modelIndex = createOmpModelIndex(options.startedModels ?? []);
28877
- this.initialState = options.startedTransport ? harnessStateFromOmp(options.startedTransport.state, options.startedThinkingLevels ?? null, this.#modelIndex, this.#permissionModeId) : { effectivePermissionModeId: this.#permissionModeId };
29768
+ this.initialState = options.startedTransport ? harnessStateFromOmp(options.startedTransport.state, options.startedThinkingLevels ?? null, this.#modelIndex, this.#permissionModeId, this.#speedScope) : { effectivePermissionModeId: this.#permissionModeId };
28878
29769
  this.initialUsage = options.initialUsage ?? null;
28879
29770
  this.#usage = this.initialUsage;
28880
29771
  this.#state = this.initialState;
@@ -28919,10 +29810,10 @@ var OmpHarnessSession = class {
28919
29810
  if (this.#phase !== "open")
28920
29811
  return;
28921
29812
  this.#finishAccountAttempt(ompMessageAccount(observation.message));
28922
- const record3 = ompUsageRecord(observation.message, observation);
28923
- if (record3?.kind === "request")
28924
- this.#event({ type: "usage.request", request: record3.request });
28925
- else if (record3?.kind === "missing")
29813
+ const record4 = ompUsageRecord(observation.message, observation);
29814
+ if (record4?.kind === "request")
29815
+ this.#event({ type: "usage.request", request: record4.request });
29816
+ else if (record4?.kind === "missing")
28926
29817
  this.#event({ type: "usage.history", complete: false });
28927
29818
  }
28928
29819
  #displayedAccount() {
@@ -29084,7 +29975,7 @@ var OmpHarnessSession = class {
29084
29975
  }
29085
29976
  this.#acceptingTurn = true;
29086
29977
  try {
29087
- const isInitialSpawn = this.#transport === null;
29978
+ const noHistory = !this.#mayHaveTurns;
29088
29979
  let transport;
29089
29980
  try {
29090
29981
  transport = await this.#ensureTransport();
@@ -29095,7 +29986,7 @@ var OmpHarnessSession = class {
29095
29986
  return { ok: false, error: invalidState("Omp Session became unavailable during startup") };
29096
29987
  }
29097
29988
  let beforeHistory;
29098
- if (isInitialSpawn) {
29989
+ if (noHistory) {
29099
29990
  beforeHistory = { turns: [] };
29100
29991
  } else {
29101
29992
  try {
@@ -29142,29 +30033,41 @@ var OmpHarnessSession = class {
29142
30033
  this.#event({ type: "turn.started", turnId: command.turnId });
29143
30034
  this.#event({ type: "item.started", turnId: command.turnId, item });
29144
30035
  void transport.runTurn(text3, (event) => this.#handleTurnEvent(active2, event)).then(async (result) => {
30036
+ if (active2.admission)
30037
+ await active2.admission;
29145
30038
  if (!result.agentInvoked) {
30039
+ await this.#observeTurnState(transport, "unconfirmed");
29146
30040
  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);
29147
30041
  return;
29148
30042
  }
29149
30043
  try {
30044
+ this.#mayHaveTurns = true;
29150
30045
  const identity2 = await this.#completedTurnIdentity(active2, transport);
30046
+ await this.#observeTurnState(transport, "persisted");
29151
30047
  this.#completeTurn(active2, result.cancelled ? {
29152
30048
  status: "cancelled",
29153
30049
  reason: "Cancelled by user",
29154
30050
  checkpoint: identity2.checkpoint
29155
30051
  } : { status: "succeeded", checkpoint: identity2.checkpoint }, result.text, identity2.nativeTurnRef);
29156
30052
  } catch (error62) {
30053
+ if (this.#phase === "open")
30054
+ await this.#observeTurnState(transport, "unconfirmed");
29157
30055
  this.#completeTurn(active2, {
29158
30056
  status: "failed",
29159
30057
  error: normalizedError(error62, "protocolError")
29160
30058
  });
29161
30059
  }
29162
30060
  }).catch(async (error62) => {
30061
+ if (active2.admission)
30062
+ await active2.admission;
29163
30063
  let identity2;
29164
30064
  try {
29165
30065
  identity2 = await this.#completedTurnIdentity(active2, transport);
30066
+ this.#mayHaveTurns = true;
29166
30067
  } catch {
29167
30068
  }
30069
+ if (this.#phase === "open")
30070
+ await this.#observeTurnState(transport, identity2 ? "persisted" : "unconfirmed");
29168
30071
  this.#completeTurn(active2, {
29169
30072
  status: "failed",
29170
30073
  error: normalizedError(error62, "nativeFailure"),
@@ -29183,7 +30086,7 @@ var OmpHarnessSession = class {
29183
30086
  return this.#closePromise;
29184
30087
  }
29185
30088
  async #selectModel(command) {
29186
- if (this.#acceptingTurn || this.#configuring) {
30089
+ if (this.#acceptingTurn || this.#configuring || this.#starting) {
29187
30090
  return {
29188
30091
  ok: false,
29189
30092
  error: {
@@ -29193,56 +30096,84 @@ var OmpHarnessSession = class {
29193
30096
  }
29194
30097
  };
29195
30098
  }
29196
- const transport = this.#transport;
29197
- if (!transport) {
29198
- return {
29199
- ok: false,
29200
- error: invalidState("Omp Model selection requires a started Native Session")
29201
- };
29202
- }
29203
- const previousModel = this.#state.effectiveModel;
29204
30099
  this.#configuring = true;
29205
30100
  try {
29206
- let requested;
30101
+ return await this.#withModelState(() => this.#applyModelSelection(command));
30102
+ } finally {
30103
+ this.#configuring = false;
30104
+ }
30105
+ }
30106
+ // Turn admission/settlement and the composer both publish the model and persist its preference.
30107
+ #withModelState(update) {
30108
+ const result = this.#modelStateWrites.then(update);
30109
+ this.#modelStateWrites = result.then(() => void 0, () => void 0);
30110
+ return result;
30111
+ }
30112
+ async #applyModelSelection(command) {
30113
+ try {
30114
+ let model2;
29207
30115
  try {
29208
- const index = createOmpModelIndex(await transport.getAvailableModels());
29209
- requested = resolveOmpModelRef(harnessModelRefSchema.parse(command.model), index);
29210
- this.#modelIndex = index;
30116
+ model2 = validateOmpModel(command.model);
29211
30117
  } catch (error62) {
29212
30118
  return { ok: false, error: normalizedError(error62, "invalidRequest") };
29213
30119
  }
29214
- let state;
29215
- let thinkingLevels;
30120
+ const transport = this.#transport;
30121
+ if (!transport) {
30122
+ await this.#ensureTransport(model2, true);
30123
+ this.#requestedModel = model2;
30124
+ return { ok: true, value: { completed: true } };
30125
+ }
30126
+ let requested;
29216
30127
  try {
29217
- state = await transport.selectModel(requested);
29218
- thinkingLevels = await transport.getAvailableThinkingLevels();
29219
- const reconciled = await reconcileThinkingLevel(transport, state, thinkingLevels);
29220
- state = reconciled.state;
29221
- thinkingLevels = reconciled.thinkingLevels;
29222
- this.#publishTransportState(state, thinkingLevels);
30128
+ this.#modelIndex = createOmpModelIndex(await transport.getAvailableModels());
30129
+ requested = resolveOmpModelRef(model2, this.#modelIndex);
29223
30130
  } catch (error62) {
29224
- if (error62 instanceof OmpRpcFaultError)
29225
- this.#fault(error62);
29226
- return { ok: false, error: normalizedError(error62, "nativeFailure") };
29227
- }
29228
- const actual = nativeModelFromState(state);
29229
- if (previousModel?.id !== this.#state.effectiveModel?.id) {
29230
- this.#invalidateUsage();
29231
- void this.#refreshUsage();
30131
+ return { ok: false, error: normalizedError(error62, "invalidRequest") };
29232
30132
  }
29233
- if (!sameOmpModel(actual, requested)) {
30133
+ const previousModel = nativeModelFromState(transport.state);
30134
+ const changingModel = !sameOmpModel(previousModel, requested);
30135
+ if (this.#active && changingModel && (requested.serviceTier === "priority" || previousModel?.serviceTier === "priority" || this.#fastModelId !== null)) {
29234
30136
  return {
29235
30137
  ok: false,
29236
30138
  error: {
29237
- code: "nativeFailure",
29238
- message: "Omp did not activate the requested Model",
29239
- retryable: false
30139
+ code: "sessionBusy",
30140
+ message: "Omp cannot switch models and Fast mode together during an active Turn",
30141
+ retryable: true
29240
30142
  }
29241
30143
  };
29242
30144
  }
30145
+ await applyOmpModel(transport, requested, this.#fastModelId, async (selection2) => {
30146
+ const current = transport.state;
30147
+ const reconciled = changingModel ? await reconcileThinkingLevel(transport, current, await transport.getAvailableThinkingLevels()) : { state: current, thinkingLevels: current.availableThinkingLevels };
30148
+ const state = this.#projectState(reconciled.state, reconciled.thinkingLevels);
30149
+ this.#confirmModel(model2, state);
30150
+ if (this.#hasNativeRef && selection2 !== this.#fastModelId) {
30151
+ await writeOmpSpeedSelection(reconciled.state, this.#speedScope, selection2);
30152
+ }
30153
+ this.#fastModelId = selection2;
30154
+ this.#requestedModel = model2;
30155
+ this.#publishState(state);
30156
+ });
30157
+ if (changingModel) {
30158
+ this.#invalidateUsage();
30159
+ void this.#refreshUsage();
30160
+ }
29243
30161
  return { ok: true, value: { completed: true } };
29244
- } finally {
29245
- this.#configuring = false;
30162
+ } catch (error62) {
30163
+ if (error62 instanceof OmpRpcFaultError) {
30164
+ this.#fault(error62);
30165
+ void this.#transport?.close().catch(() => void 0);
30166
+ }
30167
+ return { ok: false, error: normalizedError(error62, "nativeFailure") };
30168
+ }
30169
+ }
30170
+ #confirmModel(requested, state) {
30171
+ if (!sameHarnessModelRef(state.effectiveModel, requested)) {
30172
+ throw new OmpAdapterFaultError({
30173
+ code: "nativeFailure",
30174
+ message: "Omp did not activate the requested Model and speed",
30175
+ retryable: false
30176
+ });
29246
30177
  }
29247
30178
  }
29248
30179
  async #selectThinking(command) {
@@ -29309,6 +30240,7 @@ var OmpHarnessSession = class {
29309
30240
  }
29310
30241
  try {
29311
30242
  this.#publishTransportState(state, thinkingLevels);
30243
+ this.#requestedThinkingOptionId = thinkingOptionId;
29312
30244
  } catch (error62) {
29313
30245
  if (error62 instanceof OmpRpcFaultError)
29314
30246
  this.#fault(error62);
@@ -29342,7 +30274,16 @@ var OmpHarnessSession = class {
29342
30274
  return { ok: true, value: { completed: true } };
29343
30275
  }
29344
30276
  const transport = this.#transport;
29345
- if (!transport) {
30277
+ if (!transport || !this.#mayHaveTurns) {
30278
+ if (transport) {
30279
+ this.#configuring = true;
30280
+ try {
30281
+ await transport.close();
30282
+ this.#transport = null;
30283
+ } finally {
30284
+ this.#configuring = false;
30285
+ }
30286
+ }
29346
30287
  this.#permissionMode = permissionMode;
29347
30288
  this.#permissionModeId = permissionModeId;
29348
30289
  this.#state = { ...this.#state, effectivePermissionModeId: permissionModeId };
@@ -29378,6 +30319,7 @@ var OmpHarnessSession = class {
29378
30319
  throw new Error("Omp Permission Mode restart changed the Native Session identity");
29379
30320
  }
29380
30321
  const thinkingLevels = await replacement.getAvailableThinkingLevels();
30322
+ await this.#restoreAfterRestart(replacement);
29381
30323
  this.#transport = replacement;
29382
30324
  this.#permissionMode = permissionMode;
29383
30325
  this.#permissionModeId = permissionModeId;
@@ -29393,6 +30335,7 @@ var OmpHarnessSession = class {
29393
30335
  throw new Error("Omp Permission Mode recovery changed the Native Session identity");
29394
30336
  }
29395
30337
  const thinkingLevels = await recovery.getAvailableThinkingLevels();
30338
+ await this.#restoreAfterRestart(recovery);
29396
30339
  this.#transport = recovery;
29397
30340
  this.#publishTransportState(recovery.state, thinkingLevels);
29398
30341
  } catch (recoveryError) {
@@ -29683,7 +30626,7 @@ var OmpHarnessSession = class {
29683
30626
  this.#acceptingTurn = false;
29684
30627
  }
29685
30628
  }
29686
- async #ensureTransport() {
30629
+ async #ensureTransport(requestedModel = this.#requestedModel, configure = false) {
29687
30630
  if (this.#transport)
29688
30631
  return this.#transport;
29689
30632
  if (this.#starting)
@@ -29700,46 +30643,57 @@ var OmpHarnessSession = class {
29700
30643
  const starting = transport.start().then(async () => {
29701
30644
  if (this.#phase !== "open")
29702
30645
  throw new Error("Omp Session closed during startup");
29703
- let state = transport.state;
29704
30646
  const models = await transport.getAvailableModels();
29705
30647
  this.#modelIndex = createOmpModelIndex(models);
29706
- let thinkingLevels = await transport.getAvailableThinkingLevels();
29707
- if (this.#requestedModel) {
29708
- const requested = resolveOmpModelRef(this.#requestedModel, this.#modelIndex);
29709
- const current = nativeModelFromState(state);
29710
- if (!sameOmpModel(current, requested))
29711
- state = await transport.selectModel(requested);
29712
- thinkingLevels = await transport.getAvailableThinkingLevels();
29713
- if (!sameOmpModel(nativeModelFromState(state), requested)) {
29714
- this.#publishTransportState(state, thinkingLevels);
29715
- throw new Error("Omp did not activate the requested create Model");
29716
- }
29717
- }
29718
- if (this.#requestedThinkingOptionId) {
29719
- if (!thinkingLevels) {
29720
- const current = nativeModelFromState(state);
29721
- const thinkingAlreadyOff = this.#requestedThinkingOptionId === "off" && (state.thinkingLevel === "off" || current !== null && models.some((model2) => sameOmpModel(model2, current) && model2.reasoning === false));
29722
- if (!thinkingAlreadyOff) {
29723
- throw new OmpAdapterFaultError({
29724
- code: "unsupported",
29725
- message: "Installed Omp does not support Thinking selection",
29726
- retryable: false
29727
- });
30648
+ let requested;
30649
+ if (requestedModel) {
30650
+ try {
30651
+ requested = resolveOmpModelRef(requestedModel, this.#modelIndex);
30652
+ } catch (error62) {
30653
+ throw new OmpAdapterFaultError(normalizedError(error62, "invalidRequest"));
30654
+ }
30655
+ }
30656
+ const finishStartup = async (selection2) => {
30657
+ let state = transport.state;
30658
+ let thinkingLevels = await transport.getAvailableThinkingLevels();
30659
+ const requestedThinking = this.#requestedThinkingOptionId;
30660
+ const changedDraftModel = configure && requestedModel?.id !== this.#requestedModel?.id;
30661
+ if (requestedThinking && (!changedDraftModel || thinkingLevels?.includes(requestedThinking))) {
30662
+ if (thinkingLevels) {
30663
+ state = await transport.selectThinkingOption(requestedThinking);
30664
+ thinkingLevels = await transport.getAvailableThinkingLevels();
30665
+ } else {
30666
+ const current = nativeModelFromState(state);
30667
+ const thinkingAlreadyOff = requestedThinking === "off" && (state.thinkingLevel === "off" || current !== null && models.some((model2) => sameOmpModel(model2, current) && model2.reasoning === false));
30668
+ if (!thinkingAlreadyOff) {
30669
+ throw new OmpAdapterFaultError({
30670
+ code: "unsupported",
30671
+ message: "Installed Omp does not support Thinking selection",
30672
+ retryable: false
30673
+ });
30674
+ }
29728
30675
  }
29729
- } else {
29730
- state = await transport.selectThinkingOption(this.#requestedThinkingOptionId);
29731
- thinkingLevels = await transport.getAvailableThinkingLevels();
29732
30676
  }
29733
- }
29734
- const reconciled = await reconcileThinkingLevel(transport, state, thinkingLevels);
29735
- state = reconciled.state;
29736
- thinkingLevels = reconciled.thinkingLevels;
29737
- this.#transport = transport;
29738
- this.#publishTransportState(state, thinkingLevels);
30677
+ const reconciled = await reconcileThinkingLevel(transport, state, thinkingLevels);
30678
+ const projected = this.#projectState(reconciled.state, reconciled.thinkingLevels);
30679
+ if (requestedModel)
30680
+ this.#confirmModel(requestedModel, projected);
30681
+ if (this.#phase !== "open")
30682
+ throw new Error("Omp Session closed during configuration");
30683
+ this.#fastModelId = selection2;
30684
+ if (configure)
30685
+ this.#requestedThinkingOptionId = projected.effectiveThinkingOptionId;
30686
+ this.#transport = transport;
30687
+ this.#publishState(projected);
30688
+ };
30689
+ if (requested)
30690
+ await applyOmpModel(transport, requested, null, finishStartup);
30691
+ else
30692
+ await finishStartup(null);
29739
30693
  return transport;
29740
30694
  }).catch(async (error62) => {
29741
30695
  await transport.close().catch(() => void 0);
29742
- if (this.#phase === "open")
30696
+ if (this.#phase === "open" && !configure)
29743
30697
  this.#fault(error62);
29744
30698
  throw error62;
29745
30699
  }).finally(() => {
@@ -29749,9 +30703,59 @@ var OmpHarnessSession = class {
29749
30703
  this.#starting = starting;
29750
30704
  return starting;
29751
30705
  }
30706
+ async #restoreAfterRestart(transport) {
30707
+ if (!this.#fastModelId)
30708
+ return;
30709
+ this.#fastModelId = await restoreOmpSpeed(transport, this.#fastModelId);
30710
+ if (!this.#fastModelId) {
30711
+ await writeOmpSpeedSelection(transport.state, this.#speedScope, null).catch(() => void 0);
30712
+ }
30713
+ }
30714
+ #observeTurnState(transport, journal) {
30715
+ return this.#withModelState(() => this.#synchronizeTurnState(transport, journal));
30716
+ }
30717
+ async #synchronizeTurnState(transport, journal) {
30718
+ const state = transport.state;
30719
+ const publishIdentity = journal !== "unconfirmed" && !this.#hasNativeRef;
30720
+ const selection2 = this.#fastModelId;
30721
+ const relinquish = selection2 !== null && (state.provider !== "openai-codex" || state.modelId !== selection2 || state.serviceTier !== "priority");
30722
+ if (publishIdentity && selection2 && !relinquish || this.#hasNativeRef && relinquish) {
30723
+ await writeOmpSpeedSelection(state, this.#speedScope, relinquish ? null : selection2).catch(() => void 0);
30724
+ }
30725
+ if (relinquish) {
30726
+ this.#fastModelId = null;
30727
+ this.#requestedModel = void 0;
30728
+ }
30729
+ if (journal === "admitted" && this.#phase !== "open")
30730
+ return;
30731
+ if (publishIdentity)
30732
+ this.#hasNativeRef = true;
30733
+ if (journal === "admitted") {
30734
+ const { nativeRef } = this.#projectState(state, null);
30735
+ if (nativeRef)
30736
+ this.#publishState({ ...this.#state, nativeRef });
30737
+ return;
30738
+ }
30739
+ const model2 = nativeModelFromState(state);
30740
+ if (publishIdentity || !sameHarnessModelRef(this.#state.effectiveModel, model2 ? this.#modelIndex.ref(model2) : void 0) || this.#state.effectiveThinkingOptionId !== (state.thinkingLevel ?? void 0)) {
30741
+ try {
30742
+ const actual = await reconcileThinkingLevel(transport, state, state.availableThinkingLevels);
30743
+ this.#publishTransportState(actual.state, actual.thinkingLevels);
30744
+ } catch (error62) {
30745
+ this.#fault(error62);
30746
+ void transport.close().catch(() => void 0);
30747
+ }
30748
+ }
30749
+ }
30750
+ #projectState(state, levels) {
30751
+ return harnessStateFromOmp(state, levels, this.#modelIndex, this.#permissionModeId, this.#hasNativeRef ? this.#speedScope : null);
30752
+ }
30753
+ #publishState(state) {
30754
+ this.#state = state;
30755
+ this.#event({ type: "session.state.changed", state });
30756
+ }
29752
30757
  #publishTransportState(state, thinkingLevels) {
29753
- this.#state = harnessStateFromOmp(state, thinkingLevels, this.#modelIndex, this.#permissionModeId);
29754
- this.#event({ type: "session.state.changed", state: this.#state });
30758
+ this.#publishState(this.#projectState(state, thinkingLevels));
29755
30759
  }
29756
30760
  #invalidateUsage() {
29757
30761
  this.#usageGeneration += 1;
@@ -29790,6 +30794,12 @@ var OmpHarnessSession = class {
29790
30794
  if (this.#active !== active2 || this.#phase === "closed" || this.#phase === "faulted")
29791
30795
  return;
29792
30796
  switch (event.type) {
30797
+ case "agent.started":
30798
+ this.#mayHaveTurns = true;
30799
+ if (!this.#hasNativeRef && !active2.admission && this.#transport?.state.sessionFile) {
30800
+ active2.admission = this.#observeTurnState(this.#transport, "admitted").catch((error62) => this.#fault(error62));
30801
+ }
30802
+ return;
29793
30803
  case "text.delta":
29794
30804
  this.#activateAgentMessage(active2, event.messageId);
29795
30805
  this.#appendText(active2, event.delta);
@@ -29872,7 +30882,7 @@ var OmpHarnessSession = class {
29872
30882
  if (active2.interactionByNativeId.has(request.requestId)) {
29873
30883
  throw new Error("Omp Interaction started more than once");
29874
30884
  }
29875
- const interactionId = hostInteractionIdSchema.parse(randomUUID2());
30885
+ const interactionId = hostInteractionIdSchema.parse(randomUUID5());
29876
30886
  let interaction;
29877
30887
  if (request.method === "select" && request.options.length === 2 && request.options[0] === "Approve" && request.options[1] === "Deny") {
29878
30888
  interaction = {
@@ -30253,7 +31263,7 @@ var OmpHarnessSession = class {
30253
31263
  this.#channel.emit({ kind: "event", event });
30254
31264
  }
30255
31265
  #newItemId() {
30256
- return hostItemIdSchema.parse(randomUUID2());
31266
+ return hostItemIdSchema.parse(randomUUID5());
30257
31267
  }
30258
31268
  };
30259
31269
  var OmpAdapter = class {
@@ -30357,7 +31367,7 @@ var OmpAdapter = class {
30357
31367
  const leafId = entries.at(-1)?.id;
30358
31368
  const snapshot = mapOmpSnapshot({ entries, leafId: typeof leafId === "string" ? leafId : null }, {
30359
31369
  sessionId: input3.parent.nativeSessionId,
30360
- model: nativeModelFromState(transport.state)
31370
+ model: nativeModelForHistory(transport.state)
30361
31371
  });
30362
31372
  return { ok: true, value: snapshot };
30363
31373
  } catch (error62) {
@@ -30538,7 +31548,7 @@ var OmpAdapter = class {
30538
31548
  const models = await transport.getAvailableModels();
30539
31549
  stage = "capabilities";
30540
31550
  const thinkingLevels = await transport.getAvailableThinkingLevels();
30541
- const catalog = normalizeOmpModelCatalog(models, nativeModelFromState(transport.state), thinkingLevels, transport.state.thinkingLevel);
31551
+ const catalog = normalizeOmpModelCatalog(models, nativeModelFromState(transport.state), thinkingLevels, transport.state.thinkingLevel, transport.speedAvailable);
30542
31552
  await transport.close();
30543
31553
  return {
30544
31554
  status: "ready",
@@ -30580,6 +31590,14 @@ var OmpAdapter = class {
30580
31590
  }
30581
31591
  };
30582
31592
  }
31593
+ const modelHint = "model" in input3 ? input3.model : void 0;
31594
+ if (modelHint && input3.kind === "create") {
31595
+ try {
31596
+ validateOmpModel(modelHint);
31597
+ } catch (error62) {
31598
+ return { ok: false, error: normalizedError(error62, "invalidRequest") };
31599
+ }
31600
+ }
30583
31601
  const environment = input3.environment ? { ...this.#environment, ...input3.environment } : this.#environment;
30584
31602
  if (input3.kind === "create") {
30585
31603
  let permissionModeId = input3.permissionModeId ?? (input3.executionPolicy === "unattended-full-access" ? encodeOmpPermissionModeId("yolo") : OMP_DEFAULT_PERMISSION_MODE_ID);
@@ -30590,15 +31608,6 @@ var OmpAdapter = class {
30590
31608
  } catch (error62) {
30591
31609
  return { ok: false, error: normalizedError(error62, "invalidRequest") };
30592
31610
  }
30593
- if (input3.model) {
30594
- const parsed = harnessModelRefSchema.safeParse(input3.model);
30595
- if (!parsed.success || parsed.data.serviceTier) {
30596
- return {
30597
- ok: false,
30598
- error: { code: "invalidRequest", message: "Invalid Omp Model Ref", retryable: false }
30599
- };
30600
- }
30601
- }
30602
31611
  const thinkingOptionId = input3.thinkingOptionId ? harnessThinkingOptionIdSchema.safeParse(input3.thinkingOptionId) : null;
30603
31612
  if (thinkingOptionId && !thinkingOptionId.success) {
30604
31613
  return {
@@ -30647,15 +31656,18 @@ var OmpAdapter = class {
30647
31656
  });
30648
31657
  }
30649
31658
  }
30650
- transport = this.#createTransport({
31659
+ const callbacks = {
30651
31660
  cwd: input3.cwd,
30652
31661
  environment,
30653
- ...input3.kind === "resume" ? { sessionFile: sourceSessionFile } : { forkSessionFile: sourceSessionFile },
30654
31662
  onFault: (error62) => session?.handleTransportFault(error62),
30655
31663
  onSubagentEvent: (event) => session?.handleTransportEvent(event),
30656
31664
  onAssistantStart: (message3) => session?.handleAssistantStart(message3),
30657
31665
  onAssistantSummary: (messages) => session?.handleAssistantSummary(messages),
30658
31666
  onUsage: (observation) => session?.handleTransportUsage(observation)
31667
+ };
31668
+ transport = this.#createTransport({
31669
+ ...callbacks,
31670
+ ...input3.kind === "resume" ? { sessionFile: sourceSessionFile } : { forkSessionFile: sourceSessionFile }
30659
31671
  });
30660
31672
  await transport.start();
30661
31673
  if (input3.kind === "resume") {
@@ -30706,6 +31718,27 @@ var OmpAdapter = class {
30706
31718
  });
30707
31719
  }
30708
31720
  }
31721
+ const startedModels = await transport.getAvailableModels();
31722
+ const current = nativeModelForHistory(transport.state);
31723
+ const locator = sourceRef.locator;
31724
+ let sourceScope;
31725
+ if (isRecord10(locator) && typeof locator.speedScope === "string")
31726
+ sourceScope = locator.speedScope;
31727
+ else if (environment.CODEXHOST_THREAD_ID)
31728
+ sourceScope = `legacy:${environment.CODEXHOST_DATA_DIR ?? ""}`;
31729
+ const speedScope = input3.kind === "resume" && sourceScope ? sourceScope : randomUUID5();
31730
+ let fastModelId = null;
31731
+ const stored = sourceScope ? await readOmpSpeedSelection(sourceSessionFile, sourceRef.nativeSessionId, sourceScope) : null;
31732
+ if (stored) {
31733
+ const eligible = current?.id === stored && startedModels.some((m) => sameOmpModel(m, current) && supportsOmpChatGptFast(m));
31734
+ const consistent = !modelHint || current && createOmpModelIndex(startedModels).ref(current).id === modelHint.id && modelHint.serviceTier === "priority";
31735
+ if (eligible && consistent)
31736
+ fastModelId = await restoreOmpSpeed(transport, stored);
31737
+ const previous = input3.kind === "resume" ? stored : null;
31738
+ if (previous !== fastModelId) {
31739
+ await writeOmpSpeedSelection(transport.state, speedScope, fastModelId).catch(() => void 0);
31740
+ }
31741
+ }
30709
31742
  let startedThinkingLevels = await transport.getAvailableThinkingLevels();
30710
31743
  const reconciled = await reconcileThinkingLevel(transport, transport.state, startedThinkingLevels);
30711
31744
  startedThinkingLevels = reconciled.thinkingLevels;
@@ -30724,7 +31757,9 @@ var OmpAdapter = class {
30724
31757
  initialAccountKey,
30725
31758
  environment,
30726
31759
  startedTransport: transport,
30727
- startedModels: await transport.getAvailableModels(),
31760
+ startedModels,
31761
+ fastModelId,
31762
+ speedScope,
30728
31763
  startedThinkingLevels,
30729
31764
  initialUsage,
30730
31765
  supportsThinkingSelection: startedThinkingLevels !== null,
@@ -30750,7 +31785,7 @@ var OmpAdapter = class {
30750
31785
  #trackSession(cwd, options) {
30751
31786
  const environment = options.environment;
30752
31787
  const entries = Object.entries(environment).filter(([name]) => name !== "CODEXHOST_THREAD_ID").sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
30753
- const key = createHash("sha256").update(JSON.stringify([cwd, entries])).digest("hex");
31788
+ const key = createHash3("sha256").update(JSON.stringify([cwd, entries])).digest("hex");
30754
31789
  let quota = this.#sessionQuota.get(key);
30755
31790
  if (!quota) {
30756
31791
  quota = {
@@ -30776,6 +31811,8 @@ var OmpAdapter = class {
30776
31811
  permissionMode: options.permissionMode,
30777
31812
  permissionModeId: options.permissionModeId,
30778
31813
  ...options.startedTransport ? { startedTransport: options.startedTransport } : {},
31814
+ ...options.fastModelId ? { fastModelId: options.fastModelId } : {},
31815
+ ...options.speedScope ? { speedScope: options.speedScope } : {},
30779
31816
  ...options.startedModels ? { startedModels: options.startedModels } : {},
30780
31817
  ...options.startedThinkingLevels !== void 0 ? { startedThinkingLevels: options.startedThinkingLevels } : {},
30781
31818
  ...options.initialUsage !== void 0 ? { initialUsage: options.initialUsage } : {},
@@ -30800,7 +31837,7 @@ var OmpAdapter = class {
30800
31837
 
30801
31838
  // dist/installation.js
30802
31839
  import { realpath as realpath4 } from "node:fs/promises";
30803
- import path8 from "node:path";
31840
+ import path9 from "node:path";
30804
31841
  function createOmpInstallation(environment, command) {
30805
31842
  let executable;
30806
31843
  let env;
@@ -30811,7 +31848,7 @@ function createOmpInstallation(environment, command) {
30811
31848
  const pathKey = Object.keys(environment).find((key) => key.toLowerCase() === "path") ?? "PATH";
30812
31849
  env = {
30813
31850
  ...environment,
30814
- [pathKey]: `${path8.dirname(executable)}${path8.delimiter}${environment[pathKey] ?? ""}`
31851
+ [pathKey]: `${path9.dirname(executable)}${path9.delimiter}${environment[pathKey] ?? ""}`
30815
31852
  };
30816
31853
  const target2 = resolveHarnessExecutable({ id: "omp", command: "omp", installRoots: { posix: [], windows: [] } }, { environment: env });
30817
31854
  const canUpdate = !selected.includes("/nix/store/") && !!target2 && await realpath4(target2.executable) === selected;