@bitkyc08/opencodex 2.56.0 → 2.57.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 (145) hide show
  1. package/bin/ocx.mjs +10 -0
  2. package/gui/dist/assets/{index-BBOZWGB6.css → index-C5-RdDmD.css} +1 -1
  3. package/gui/dist/assets/{index-D4zuyIxQ.js → index-Cz7CLdif.js} +21 -21
  4. package/gui/dist/index.html +2 -2
  5. package/package.json +3 -3
  6. package/src/adapters/codebuddy/adapter.ts +2 -1
  7. package/src/adapters/codebuddy/scaffold-guard.ts +248 -0
  8. package/src/adapters/command-code.ts +1 -1
  9. package/src/adapters/cursor/envelope-echo.ts +8 -2
  10. package/src/adapters/google.ts +7 -7
  11. package/src/adapters/kiro/payload.ts +17 -3
  12. package/src/adapters/kiro/reasoning.ts +70 -7
  13. package/src/adapters/kiro/stream.ts +8 -2
  14. package/src/adapters/kiro/wire.ts +2 -1
  15. package/src/adapters/kiro-events.ts +21 -13
  16. package/src/adapters/openai-chat/tool-name-registry.ts +166 -0
  17. package/src/adapters/openai-chat/tool-schema.ts +25 -7
  18. package/src/adapters/openai-chat.ts +8 -8
  19. package/src/adapters/openai-responses/passthrough.ts +32 -1
  20. package/src/bridge/errors.ts +26 -2
  21. package/src/bridge/response-json.ts +7 -1
  22. package/src/bridge/sse.ts +19 -1
  23. package/src/claude/desktop-profile.ts +66 -9
  24. package/src/claude/outbound.ts +18 -0
  25. package/src/cli/account-main.ts +1 -1
  26. package/src/cli/capabilities.ts +2 -2
  27. package/src/cli/combo.ts +10 -1
  28. package/src/cli/index.ts +48 -5
  29. package/src/cli/registry.ts +2 -1
  30. package/src/cli/system-command.ts +4 -4
  31. package/src/clients/config-export.ts +7 -3
  32. package/src/codex/account-label.ts +14 -3
  33. package/src/codex/account-store.ts +113 -26
  34. package/src/codex/account-usability.ts +21 -0
  35. package/src/codex/auth-api/login-flow.ts +14 -2
  36. package/src/codex/auth-api/reset-credit-service.ts +11 -2
  37. package/src/codex/auth-context.ts +157 -7
  38. package/src/codex/catalog/aggregation.ts +80 -1
  39. package/src/codex/catalog/model-visibility.ts +1 -0
  40. package/src/codex/catalog/remote.ts +30 -0
  41. package/src/codex/catalog/retained-sync.ts +9 -1
  42. package/src/codex/catalog/routed-gather.ts +38 -1
  43. package/src/codex/cli-install-provenance.ts +7 -1
  44. package/src/codex/convergence.ts +7 -2
  45. package/src/codex/desktop-app/types.ts +11 -2
  46. package/src/codex/desktop-app/windows.ts +5 -5
  47. package/src/codex/inject/restore.ts +29 -2
  48. package/src/codex/inject.ts +9 -9
  49. package/src/codex/model-entitlements.ts +152 -15
  50. package/src/codex/pool-refresh-backoff.ts +12 -3
  51. package/src/codex/quota-rejection.ts +104 -15
  52. package/src/codex/routing/cache-affinity.ts +70 -0
  53. package/src/codex/routing/cooldown-math.ts +10 -0
  54. package/src/codex/routing/selection.ts +79 -2
  55. package/src/codex/routing/thread-affinity.ts +50 -2
  56. package/src/codex/routing/transient-hold-dispatch.ts +141 -0
  57. package/src/codex/routing.ts +29 -49
  58. package/src/codex/warmup.ts +1 -1
  59. package/src/combos/failover.ts +85 -0
  60. package/src/combos/request.ts +17 -10
  61. package/src/combos/types.ts +23 -2
  62. package/src/config/pending-teardown.ts +31 -0
  63. package/src/generated/compatibility-version.json +163 -135
  64. package/src/images/loop.ts +1 -1
  65. package/src/lib/errors.ts +17 -0
  66. package/src/lib/request-execution-budget.ts +147 -21
  67. package/src/lib/spend-reservation-ledger.ts +18 -0
  68. package/src/lib/state-store-registrations.ts +6 -2
  69. package/src/lib/test-home-guard.ts +85 -1
  70. package/src/lib/upstream-retry.ts +77 -10
  71. package/src/lib/windows-elevation.ts +76 -14
  72. package/src/oauth/index.ts +2 -2
  73. package/src/oauth/key-providers.ts +2 -2
  74. package/src/providers/kiro-models.ts +4 -3
  75. package/src/providers/label.ts +19 -1
  76. package/src/providers/model-discovery.ts +16 -0
  77. package/src/providers/registry/entries-core.ts +7 -0
  78. package/src/providers/registry/entries-extended.ts +9 -0
  79. package/src/providers/registry/model-seeds.ts +4 -0
  80. package/src/responses/reasoning-envelope.ts +6 -3
  81. package/src/routing/identity-domains.ts +21 -14
  82. package/src/routing/probe-lease.ts +103 -1
  83. package/src/server/chat-completions.ts +3 -1
  84. package/src/server/chat-native.ts +37 -9
  85. package/src/server/index/live-sideband.ts +37 -1
  86. package/src/server/index/websocket-handler.ts +6 -2
  87. package/src/server/index.ts +5 -5
  88. package/src/server/inspection-tee.ts +107 -0
  89. package/src/server/live.ts +46 -1
  90. package/src/server/management/combo-routes.ts +10 -1
  91. package/src/server/relay-eager.ts +2 -0
  92. package/src/server/relay.ts +14 -19
  93. package/src/server/request-log.ts +127 -3
  94. package/src/server/response-log-body.ts +153 -0
  95. package/src/server/responses/account-change-state.ts +74 -0
  96. package/src/server/responses/adapter-continuation.ts +33 -7
  97. package/src/server/responses/adapter-delivery.ts +5 -11
  98. package/src/server/responses/adapter-dispatch.ts +84 -13
  99. package/src/server/responses/codex-ws-wire.ts +5 -0
  100. package/src/server/responses/collaboration.ts +74 -4
  101. package/src/server/responses/combo-session-recall.ts +68 -8
  102. package/src/server/responses/compact.ts +54 -13
  103. package/src/server/responses/core-auth.ts +2 -0
  104. package/src/server/responses/core-codex-account.ts +51 -3
  105. package/src/server/responses/core-combo.ts +103 -23
  106. package/src/server/responses/core-errors.ts +18 -0
  107. package/src/server/responses/core-replay.ts +105 -32
  108. package/src/server/responses/core.ts +3 -3
  109. package/src/server/responses/encrypted-payload.ts +0 -1
  110. package/src/server/responses/input-admission.ts +126 -6
  111. package/src/server/responses/passthrough-delivery.ts +19 -6
  112. package/src/server/responses/passthrough-dispatch.ts +28 -10
  113. package/src/server/responses/passthrough-error.ts +38 -2
  114. package/src/server/responses/request-prepare.ts +132 -22
  115. package/src/server/responses/request-send-budget.ts +97 -2
  116. package/src/server/responses/request-spend.ts +147 -0
  117. package/src/server/responses/request-transport.ts +62 -3
  118. package/src/server/responses/run-turn-execution.ts +59 -31
  119. package/src/server/responses/sidecar-execution.ts +7 -13
  120. package/src/server/responses/terminal-guard.ts +65 -4
  121. package/src/server/responses-undeclared-tool-guard.ts +9 -5
  122. package/src/service/windows-ops.ts +210 -16
  123. package/src/service/windows-scheduler.ts +28 -21
  124. package/src/service.ts +1 -1
  125. package/src/types/config.ts +4 -1
  126. package/src/types/request.ts +8 -5
  127. package/src/types/tools.ts +24 -0
  128. package/src/types.ts +2 -0
  129. package/src/update/index.ts +10 -0
  130. package/src/update/stop-contract.d.mts +1 -0
  131. package/src/update/stop-contract.mjs +19 -0
  132. package/src/update/stop-decision.d.mts +1 -1
  133. package/src/update/stop-decision.mjs +12 -3
  134. package/src/usage/log.ts +1 -1
  135. package/src/vision/anthropic-describe.ts +1 -1
  136. package/src/vision/describe.ts +5 -5
  137. package/src/web-search/anthropic-executor.ts +1 -1
  138. package/src/web-search/exa-executor.ts +1 -1
  139. package/src/web-search/executor.ts +1 -1
  140. package/src/web-search/gemini-executor.ts +1 -1
  141. package/src/web-search/loop.ts +1 -1
  142. package/src/web-search/ollama-executor.ts +1 -1
  143. package/src/web-search/parse.ts +67 -14
  144. package/src/web-search/passthrough-bridge.ts +64 -31
  145. package/src/web-search/xai-executor.ts +1 -1
@@ -1,5 +1,5 @@
1
- import type { OcxComboDefaultEffort, OcxComboReasoningEffortMode, OcxComboTarget, OcxConfig } from "../types";
2
- import { resolveEffortAtOrBelow } from "../reasoning-effort";
1
+ import type { OcxComboDefaultEffort, OcxComboDefaultEffortMode, OcxComboReasoningEffortMode, OcxComboTarget, OcxConfig } from "../types";
2
+ import { isCodexReasoningEffort, resolveEffortAtOrBelow } from "../reasoning-effort";
3
3
  import { resolveComboId } from "./types";
4
4
 
5
5
  const warnedUnsupportedDefaults = new Set<string>();
@@ -60,22 +60,29 @@ export function concreteComboRequestBody(
60
60
  defaultEffort: OcxComboDefaultEffort | null,
61
61
  targetReasoningEfforts: readonly string[] | undefined,
62
62
  reasoningEffortMode: OcxComboReasoningEffortMode = "strict",
63
+ defaultEffortMode: OcxComboDefaultEffortMode = "fallback",
63
64
  ): Record<string, unknown> {
64
65
  const clone = structuredClone(body) as Record<string, unknown>;
65
66
  clone.model = `${target.provider}/${target.model}`;
67
+ if (defaultEffortMode === "force" && (!defaultEffort || !isCodexReasoningEffort(defaultEffort))) {
68
+ throw new Error("force combo default effort requires a valid defaultEffort");
69
+ }
66
70
  if (targetReasoningEfforts?.length === 0
67
71
  || (reasoningEffortMode === "adaptive" && targetReasoningEfforts === undefined)) {
68
72
  stripUnsupportedReasoningControls(clone);
69
73
  }
70
- if (!defaultEffort) return clone;
74
+ if (!defaultEffort || !isCodexReasoningEffort(defaultEffort)) return clone;
71
75
  const reasoning = clone.reasoning;
72
- const needsDefault = reasoning === undefined || (
73
- reasoning
74
- && typeof reasoning === "object"
75
- && !Array.isArray(reasoning)
76
- && !Object.prototype.hasOwnProperty.call(reasoning, "effort")
77
- );
78
- if (!needsDefault) return clone;
76
+ const reasoningRecord = reasoning && typeof reasoning === "object" && !Array.isArray(reasoning)
77
+ ? reasoning as Record<string, unknown>
78
+ : undefined;
79
+ const hasEffort = reasoningRecord !== undefined
80
+ && Object.prototype.hasOwnProperty.call(reasoningRecord, "effort");
81
+ const callerEffort = reasoningRecord?.effort;
82
+ const validCallerEffort = typeof callerEffort === "string" && isCodexReasoningEffort(callerEffort);
83
+ const needsDefault = reasoning === undefined || (reasoningRecord !== undefined && !hasEffort);
84
+ const shouldForce = defaultEffortMode === "force" && validCallerEffort;
85
+ if (!needsDefault && !shouldForce) return clone;
79
86
  // Picker availability treats an unknown ladder as a wildcard, but runtime
80
87
  // injection stays fail-closed until this concrete target advertises support.
81
88
  //
@@ -1,6 +1,6 @@
1
1
  import { isCodexReasoningEffort } from "../reasoning-effort";
2
2
  import { SUPPORTED_NATIVE_OPENAI_SLUGS } from "../codex/catalog/native-models";
3
- import type { OcxComboConfig, OcxComboDefaultEffort, OcxComboReasoningEffortMode, OcxComboStrategy, OcxComboTarget, OcxProviderConfig } from "../types";
3
+ import type { OcxComboConfig, OcxComboDefaultEffort, OcxComboDefaultEffortMode, OcxComboReasoningEffortMode, OcxComboStrategy, OcxComboTarget, OcxProviderConfig } from "../types";
4
4
  import { COMBO_NAMESPACE, isValidComboId, targetKey } from "./identifiers";
5
5
 
6
6
  export const COMBO_DEFAULT_WAIT_FOR_COOLDOWN_MS = 0;
@@ -26,6 +26,8 @@ export interface NormalizedComboConfig {
26
26
  cooldownMs?: number;
27
27
  waitForCooldownMs: number;
28
28
  defaultEffort: OcxComboDefaultEffort | null;
29
+ /** Client-precedence policy; `fallback` preserves legacy behavior. */
30
+ defaultEffortMode: OcxComboDefaultEffortMode;
29
31
  /** Picker-ladder derivation policy; `strict` preserves the legacy intersection rule. */
30
32
  reasoningEffortMode: OcxComboReasoningEffortMode;
31
33
  /** Disable image input; `auto` preserves the intersection derived from all targets. */
@@ -167,6 +169,21 @@ export function comboConfigIssues(
167
169
  message: "defaultEffort must be one of: low, medium, high, xhigh, max, ultra",
168
170
  });
169
171
  }
172
+ if (body.defaultEffortMode !== undefined
173
+ && body.defaultEffortMode !== "fallback"
174
+ && body.defaultEffortMode !== "force") {
175
+ issues.push({
176
+ path: ["defaultEffortMode"],
177
+ message: 'defaultEffortMode must be "fallback" or "force"',
178
+ });
179
+ }
180
+ if (body.defaultEffortMode === "force"
181
+ && (typeof body.defaultEffort !== "string" || !isCodexReasoningEffort(body.defaultEffort))) {
182
+ issues.push({
183
+ path: ["defaultEffort"],
184
+ message: "defaultEffort is required when defaultEffortMode is force",
185
+ });
186
+ }
170
187
  if (body.imageInput !== undefined && body.imageInput !== "auto" && body.imageInput !== "disabled") {
171
188
  issues.push({ path: ["imageInput"], message: 'imageInput must be "auto" or "disabled"' });
172
189
  }
@@ -293,12 +310,16 @@ export function comboConfigError(
293
310
  export function normalizeComboConfig(raw: OcxComboConfig): NormalizedComboConfig {
294
311
  const alias = typeof raw.alias === "string" ? raw.alias.trim() : "";
295
312
  const displayName = typeof raw.displayName === "string" ? raw.displayName.trim() : "";
313
+ const defaultEffort = typeof raw.defaultEffort === "string" && isCodexReasoningEffort(raw.defaultEffort)
314
+ ? raw.defaultEffort
315
+ : null;
296
316
  return {
297
317
  strategy: raw.strategy ?? "failover",
298
318
  stickyLimit: raw.stickyLimit ?? 1,
299
319
  cooldownMs: raw.cooldownMs,
300
320
  waitForCooldownMs: raw.waitForCooldownMs ?? COMBO_DEFAULT_WAIT_FOR_COOLDOWN_MS,
301
- defaultEffort: raw.defaultEffort ?? null,
321
+ defaultEffort,
322
+ defaultEffortMode: raw.defaultEffortMode === "force" && defaultEffort !== null ? "force" : "fallback",
302
323
  reasoningEffortMode: raw.reasoningEffortMode === "adaptive" ? "adaptive" : "strict",
303
324
  imageInput: raw.imageInput === "disabled" ? "disabled" : "auto",
304
325
  alias: alias || null,
@@ -202,6 +202,37 @@ export function pendingTeardownOutstanding(): boolean {
202
202
  }
203
203
  }
204
204
 
205
+ /**
206
+ * Are the outstanding obligations EXACTLY the ones this stop chose to keep?
207
+ *
208
+ * `ocx stop` can preserve its own obligations deliberately — the Codex history preflight
209
+ * refuses before anything is restored, so the receipt has to survive for a later stop
210
+ * (#4718). That is safe for an update to continue past, because the stop knows those
211
+ * receipts describe a proxy it just proved down.
212
+ *
213
+ * Nothing else is. A quarantined receipt is waiting on a human, and a receipt belonging
214
+ * to a live owner means another stop is in flight; letting either ride along would turn
215
+ * "we deliberately kept ours" into "we ignored everyone's". So membership is the test,
216
+ * not a count of ours: an unrecognized obligation of any kind answers false and the
217
+ * caller falls back to the ordinary failure code.
218
+ *
219
+ * Quarantined names are included in the scan on purpose. They do not correspond to any
220
+ * nonce this run preserved, so their presence always answers false.
221
+ */
222
+ export function pendingTeardownsAreExactly(nonces: readonly string[]): boolean {
223
+ const expected = new Set(nonces.map(nonce => `${PREFIX}${nonce}${SUFFIX}`));
224
+ let names: string[];
225
+ try {
226
+ names = readdirSync(getConfigDir());
227
+ } catch (error) {
228
+ // A home that does not exist holds nothing, which matches only an empty expectation.
229
+ // Any other scan failure may be hiding an obligation and must not answer "exactly".
230
+ return (error as NodeJS.ErrnoException).code === "ENOENT" && expected.size === 0;
231
+ }
232
+ const found = names.filter(isAnyTeardownObligationFileName);
233
+ return found.length === expected.size && found.every(name => expected.has(name));
234
+ }
235
+
205
236
  /** Paths of quarantined obligations awaiting a human. */
206
237
  export function listQuarantinedTeardowns(): string[] {
207
238
  try {