@bitkyc08/opencodex 2.88.0 → 2.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/bin/ocx.mjs +15 -4
- package/gui/dist/assets/App-DgxkE6Md.js +58 -0
- package/gui/dist/assets/App-dnkJ85te.css +1 -0
- package/gui/dist/assets/{Tray-B5bC7AWL.js → Tray-DbTNc_88.js} +1 -1
- package/gui/dist/assets/{index-B5bsvxor.js → index-TmaHa54u.js} +15 -15
- package/gui/dist/assets/quota-summary-B16x5DZZ.js +1 -0
- package/gui/dist/index.html +1 -1
- package/package.json +2 -2
- package/src/adapters/anthropic/cache-retention.ts +117 -0
- package/src/adapters/anthropic/passthrough.ts +7 -4
- package/src/adapters/anthropic.ts +10 -3
- package/src/adapters/base.ts +4 -0
- package/src/adapters/claude-cli/adapter.ts +13 -7
- package/src/adapters/claude-cli/usage-admission.ts +14 -2
- package/src/adapters/coding-agent/protocol.ts +6 -0
- package/src/adapters/coding-agent/turn.ts +14 -4
- package/src/adapters/cursor/protobuf-request.ts +3 -0
- package/src/adapters/google-http.ts +3 -2
- package/src/adapters/google-progress-history.ts +19 -1
- package/src/adapters/google-vertex-endpoint.ts +67 -0
- package/src/adapters/google.ts +62 -37
- package/src/adapters/image.ts +5 -3
- package/src/adapters/input-media-guard.ts +5 -2
- package/src/adapters/kiro-refusal.ts +41 -1
- package/src/adapters/ollama-native.ts +1 -0
- package/src/adapters/openai-chat/messages.ts +34 -4
- package/src/adapters/openai-chat/passthrough.ts +37 -4
- package/src/adapters/openai-chat/reasoning-replay.ts +98 -13
- package/src/adapters/openai-chat/serialized-tool-call-content.ts +95 -134
- package/src/adapters/openai-chat/serialized-tool-call-markup.ts +108 -0
- package/src/adapters/openai-chat/standalone-bare-tool-calls.ts +136 -0
- package/src/adapters/openai-chat.ts +7 -6
- package/src/adapters/openai-responses/compaction-search-history.ts +27 -0
- package/src/adapters/openai-responses/opengateway-input.ts +139 -0
- package/src/adapters/openai-responses/passthrough.ts +22 -13
- package/src/adapters/openai-responses/reasoning.ts +68 -1
- package/src/adapters/openai-responses/transport.ts +13 -1
- package/src/adapters/registry.ts +1 -1
- package/src/adapters/upstream-http-error.ts +3 -2
- package/src/adapters/zed.ts +7 -4
- package/src/bridge/internal.ts +11 -1
- package/src/bridge/response-json.ts +2 -2
- package/src/bridge/sse.ts +10 -4
- package/src/claude/desktop-3p-library.ts +43 -3
- package/src/claude/desktop-3p.ts +20 -10
- package/src/claude/desktop-picker-profile.ts +18 -9
- package/src/claude/desktop-remote-store-io.ts +2 -2
- package/src/claude/inbound.ts +12 -26
- package/src/claude/outbound.ts +5 -0
- package/src/cli/account-api.ts +13 -1
- package/src/cli/account-extended.ts +17 -5
- package/src/cli/account-key-quota.ts +4 -1
- package/src/cli/account.ts +1 -1
- package/src/cli/capabilities-agents-routing.ts +45 -8
- package/src/cli/capabilities-base.ts +5 -5
- package/src/cli/capabilities-provider-models.ts +5 -4
- package/src/cli/combo-result.ts +8 -2
- package/src/cli/combo.ts +17 -0
- package/src/cli/ensure-desktop-cold-start.ts +2 -2
- package/src/cli/help.ts +1 -1
- package/src/cli/message-command.ts +4 -1
- package/src/cli/message-remote-args.ts +69 -0
- package/src/cli/message-remote-command.ts +77 -0
- package/src/cli/provider-runtime.ts +69 -1
- package/src/cli/registry.ts +3 -3
- package/src/codex/account-lifecycle.ts +19 -6
- package/src/codex/account-pause.ts +6 -1
- package/src/codex/account-runtime-state.ts +5 -0
- package/src/codex/account-store.ts +55 -9
- package/src/codex/account-usability.ts +4 -1
- package/src/codex/auth-api/account-list.ts +13 -5
- package/src/codex/auth-api/account-pause-group.ts +2 -22
- package/src/codex/auth-api/login-collision.ts +59 -0
- package/src/codex/auth-api/login-flow.ts +12 -7
- package/src/codex/auth-api/main-account-probe.ts +3 -2
- package/src/codex/auth-api/pool-mode-gate.ts +81 -13
- package/src/codex/auth-collision.ts +31 -4
- package/src/codex/auth-context.ts +57 -10
- package/src/codex/catalog/aggregation.ts +15 -0
- package/src/codex/catalog/auto-review.ts +2 -1
- package/src/codex/catalog/build-entries.ts +17 -7
- package/src/codex/catalog/derive-entry.ts +3 -1
- package/src/codex/catalog/metadata.ts +2 -0
- package/src/codex/catalog/model-visibility.ts +0 -2
- package/src/codex/catalog/ownership.ts +71 -0
- package/src/codex/catalog/parsing.ts +12 -3
- package/src/codex/catalog/retained-sync.ts +2 -1
- package/src/codex/catalog/routed-removal.ts +4 -4
- package/src/codex/cli-update-plan.ts +18 -3
- package/src/codex/collision-identity.ts +78 -0
- package/src/codex/convergence.ts +2 -1
- package/src/codex/low-quota-desktop-notifier.ts +125 -0
- package/src/codex/low-quota-protection.ts +57 -31
- package/src/codex/main-account-cache.ts +77 -3
- package/src/codex/main-account-hard-lock.ts +14 -0
- package/src/codex/main-account.ts +6 -2
- package/src/codex/native-residue.ts +2 -3
- package/src/codex/quota.ts +26 -2
- package/src/codex/routing/cooldown-math.ts +5 -0
- package/src/codex/routing/failure-window.ts +61 -9
- package/src/codex/routing.ts +4 -3
- package/src/codex/shim-diagnostics.ts +2 -1
- package/src/codex/shim-fingerprint.ts +11 -2
- package/src/codex/shim-templates.ts +16 -5
- package/src/codex/shim-windows-refresh.ts +224 -0
- package/src/codex/shim.ts +45 -21
- package/src/combos/failover.ts +10 -2
- package/src/combos/jev-model-backend.ts +30 -7
- package/src/combos/jev-model-request.ts +20 -0
- package/src/combos/jev-quota-activation.ts +153 -0
- package/src/combos/jev-quota-config.ts +62 -0
- package/src/combos/jev-quota-route.ts +26 -0
- package/src/combos/jev-quota.ts +88 -0
- package/src/combos/jev.ts +25 -12
- package/src/combos/types.ts +27 -0
- package/src/compatibility/index.ts +3 -0
- package/src/compatibility/openai-responses.ts +8 -1
- package/src/compatibility/opengateway-responses.ts +61 -0
- package/src/config/account-auto-pause-revisions.ts +136 -0
- package/src/config/diagnostics.ts +13 -0
- package/src/config/live-reconcile.ts +9 -0
- package/src/config/persist-unlocked.ts +10 -1
- package/src/config/provider-validation.ts +7 -2
- package/src/config/removed-opencode-free.ts +135 -0
- package/src/config/schema/account-auto-pause.ts +14 -0
- package/src/config/schema/config-schema.ts +15 -0
- package/src/config/schema/leaf-validators.ts +7 -0
- package/src/config.ts +10 -3
- package/src/generated/compatibility-version.json +476 -216
- package/src/generated/model-metadata.ts +1 -1
- package/src/images/loop.ts +34 -11
- package/src/lib/account-auto-pause-response.ts +16 -0
- package/src/lib/bun-runtime.ts +18 -1
- package/src/lib/bun-transpiler-cache-scope.d.mts +8 -0
- package/src/lib/bun-transpiler-cache-scope.mjs +82 -0
- package/src/lib/decision-quota-sink.ts +76 -0
- package/src/lib/provider-admission-wait.ts +14 -0
- package/src/lib/service-secrets.ts +37 -2
- package/src/lib/state-store-registrations.ts +25 -0
- package/src/lib/translator-budget.ts +1 -1
- package/src/lib/upstream-retry.ts +15 -0
- package/src/link/ssh-argv.ts +3 -0
- package/src/messaging/envelope.ts +6 -3
- package/src/messaging/remote-auth.ts +83 -0
- package/src/messaging/remote-bridge.ts +270 -0
- package/src/messaging/remote-contract.ts +108 -0
- package/src/messaging/remote-enrollment-recovery.ts +59 -0
- package/src/messaging/remote-enrollment.ts +244 -0
- package/src/messaging/remote-envelope.ts +40 -0
- package/src/messaging/remote-files.ts +117 -0
- package/src/messaging/remote-owner.ts +169 -0
- package/src/messaging/remote-ports.ts +56 -0
- package/src/messaging/remote-process.ts +131 -0
- package/src/messaging/remote-replies.ts +98 -0
- package/src/messaging/remote-rpc-admission.ts +32 -0
- package/src/messaging/remote-send.ts +72 -0
- package/src/messaging/remote-store.ts +111 -0
- package/src/messaging/remote-tunnels.ts +65 -0
- package/src/messaging/rpc.ts +13 -1
- package/src/oauth/account-auto-pause-policy.ts +66 -0
- package/src/oauth/account-auto-pause.ts +171 -0
- package/src/oauth/account-import/google-antigravity-adapter.ts +38 -2
- package/src/oauth/account-import/parser.ts +15 -2
- package/src/oauth/account-import/types.ts +7 -0
- package/src/oauth/account-quota-rank.ts +2 -1
- package/src/oauth/anthropic-account-refusal.ts +6 -0
- package/src/oauth/anthropic-model-family.ts +8 -0
- package/src/oauth/anthropic-model-quota.ts +2 -6
- package/src/oauth/api-key-pool-preserve.ts +37 -0
- package/src/oauth/chatgpt-shared.ts +10 -1
- package/src/oauth/dsh.ts +45 -2
- package/src/oauth/index.ts +5 -35
- package/src/oauth/kiro.ts +44 -1
- package/src/oauth/login-flow-state.ts +11 -2
- package/src/oauth/store.ts +35 -8
- package/src/oauth/types.ts +2 -0
- package/src/plugins/upstream-hooks.ts +14 -1
- package/src/providers/api-key-pause.ts +32 -0
- package/src/providers/api-key-resolve.ts +10 -4
- package/src/providers/api-key-selection.ts +6 -1
- package/src/providers/api-keys.ts +8 -4
- package/src/providers/claude-cli-usage.ts +25 -5
- package/src/providers/initial-model-selection.ts +2 -2
- package/src/providers/key-failover.ts +21 -13
- package/src/providers/key-store.ts +8 -3
- package/src/providers/mistral-transport.ts +207 -0
- package/src/providers/model-rename-fields.ts +1 -0
- package/src/providers/openai-sidecar.ts +5 -0
- package/src/providers/opencode-zen-rate-limit.ts +6 -72
- package/src/providers/quota/account-cache.ts +15 -1
- package/src/providers/quota/anthropic-account-quota.ts +20 -7
- package/src/providers/quota/anthropic-cooldown-recovery.ts +22 -4
- package/src/providers/quota/anthropic-decision-windows.ts +47 -0
- package/src/providers/quota/antigravity.ts +45 -8
- package/src/providers/quota/failure-codes.ts +18 -0
- package/src/providers/quota/report-cache.ts +14 -0
- package/src/providers/quota/vendor-probes-oauth.ts +15 -6
- package/src/providers/quota-decision-publication.ts +77 -0
- package/src/providers/quota-decision-snapshot.ts +145 -0
- package/src/providers/quota-routing-cache.ts +4 -1
- package/src/providers/quota-types.ts +6 -1
- package/src/providers/quota.ts +8 -3
- package/src/providers/registry/entries-extended.ts +14 -53
- package/src/providers/registry/model-seeds.ts +1 -1
- package/src/providers/registry.ts +1 -2
- package/src/providers/routed-config.ts +1 -1
- package/src/providers/stale-vision-classification-migration.ts +1 -1
- package/src/providers/xai-transport.ts +2 -1
- package/src/responses/audio.ts +46 -0
- package/src/responses/input-media.ts +37 -15
- package/src/responses/parser-content.ts +22 -27
- package/src/responses/parser.ts +18 -10
- package/src/responses/reasoning-retention.ts +218 -11
- package/src/responses/schema.ts +3 -4
- package/src/responses/web-search-replay.ts +147 -0
- package/src/routing/compatibility/behavior.ts +4 -1
- package/src/server/auth-cors.ts +7 -0
- package/src/server/background-lifecycle.ts +2 -1
- package/src/server/chat-native.ts +36 -20
- package/src/server/claude-messages.ts +2 -1
- package/src/server/index/optional-listeners.ts +6 -0
- package/src/server/index/serve-options.ts +8 -2
- package/src/server/index/websocket-handler.ts +10 -0
- package/src/server/lifecycle.ts +17 -1
- package/src/server/management/combo-routes.ts +17 -2
- package/src/server/management/oauth-account-routes.ts +12 -2
- package/src/server/management/provider-completion-test.ts +289 -0
- package/src/server/management/provider-routes.ts +9 -1
- package/src/server/management/route-registry.ts +2 -0
- package/src/server/messages-native.ts +29 -4
- package/src/server/messages-shared.ts +4 -1
- package/src/server/request-log.ts +23 -9
- package/src/server/responses/account-auto-pause-recovery.ts +26 -0
- package/src/server/responses/adapter-continuation.ts +2 -2
- package/src/server/responses/adapter-dispatch.ts +79 -30
- package/src/server/responses/codex-ws-exchange.ts +3 -0
- package/src/server/responses/codex-ws-metadata.ts +44 -0
- package/src/server/responses/codex-ws-session.ts +21 -1
- package/src/server/responses/combo-session-recall.ts +25 -0
- package/src/server/responses/combo-stream-preflight.ts +10 -3
- package/src/server/responses/combo-tool-loop-pin.ts +70 -0
- package/src/server/responses/compact.ts +10 -5
- package/src/server/responses/context-overflow.ts +141 -2
- package/src/server/responses/core-auth.ts +20 -0
- package/src/server/responses/core-codex-account.ts +28 -15
- package/src/server/responses/core-combo.ts +34 -5
- package/src/server/responses/core-opaque-recovery.ts +20 -11
- package/src/server/responses/core.ts +12 -9
- package/src/server/responses/deepseek-image-files.ts +121 -0
- package/src/server/responses/empty-completion-guard.ts +10 -0
- package/src/server/responses/fetch-helpers.ts +65 -14
- package/src/server/responses/input-admission.ts +6 -2
- package/src/server/responses/jev-model-invoke.ts +13 -14
- package/src/server/responses/main-hard-lock-routing.ts +33 -8
- package/src/server/responses/native-steering-log.ts +2 -2
- package/src/server/responses/opengateway-completion-guard.ts +232 -0
- package/src/server/responses/passthrough-completion.ts +41 -0
- package/src/server/responses/passthrough-delivery.ts +5 -2
- package/src/server/responses/passthrough-dispatch.ts +42 -45
- package/src/server/responses/passthrough-key-rotation.ts +40 -0
- package/src/server/responses/passthrough-observations.ts +38 -0
- package/src/server/responses/reasoning-archive-error.ts +21 -0
- package/src/server/responses/request-compression.ts +98 -0
- package/src/server/responses/request-prepare.ts +11 -1
- package/src/server/responses/request-transport.ts +92 -5
- package/src/server/responses/run-turn-execution.ts +2 -0
- package/src/server/responses/sidecar-execution.ts +16 -3
- package/src/server/responses/terminal-guard.ts +2 -0
- package/src/server/startup-action-control.ts +2 -2
- package/src/server/startup-health-cache.ts +2 -2
- package/src/server/windows-tray-control.ts +2 -2
- package/src/service/definition.ts +9 -1
- package/src/service/orchestration.ts +17 -0
- package/src/types/account-auto-pause.ts +15 -0
- package/src/types/config.ts +23 -1
- package/src/types/provider.ts +11 -5
- package/src/types/request.ts +36 -3
- package/src/types.ts +2 -0
- package/src/usage/cost.ts +17 -1
- package/src/usage/expected-prices.ts +3 -1
- package/src/usage/jev-stats.ts +4 -0
- package/src/usage/log.ts +2 -0
- package/src/usage/summary.ts +7 -0
- package/src/web-search/loop.ts +39 -13
- package/src/web-search/progress-stream.ts +4 -1
- package/src/web-search/run-turn-loop.ts +9 -3
- package/src/web-search/sidecar-search-replay.ts +96 -0
- package/gui/dist/assets/App-CHC89EXQ.js +0 -58
- package/gui/dist/assets/App-wT3mXqFz.css +0 -1
- package/gui/dist/assets/quota-summary-D8y2wTsB.js +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MAIN_ACCOUNT_HARD_LOCK_MIN_PERCENT } from "../../codex/quota-types";
|
|
2
2
|
import { validRemainingQuotaAccountIds } from "../../codex/account-use-remaining";
|
|
3
3
|
import * as z from "zod/v4";
|
|
4
|
+
import { accountPauseStateSchema } from "./account-auto-pause";
|
|
4
5
|
import { anthropicAccountPoolSchema } from "./anthropic-account-pool";
|
|
5
6
|
import { compactionRecoverySchema } from "./compaction-recovery";
|
|
6
7
|
import { nativeReasoningRetentionSchema } from "./native-reasoning-retention";
|
|
@@ -163,6 +164,9 @@ export const configSchema = z.object({
|
|
|
163
164
|
.min(0)
|
|
164
165
|
.optional()
|
|
165
166
|
.catch(undefined),
|
|
167
|
+
// Opt-in outbound request compression (#7247). An unknown codec degrades to identity, matching
|
|
168
|
+
// the guards above: a hand-edit typo must not change what the proxy sends or refuse traffic.
|
|
169
|
+
upstreamRequestCompression: z.enum(["off", "gzip", "zstd"]).optional().catch(undefined),
|
|
166
170
|
// Opt-in inbound body ceiling (#3573). An invalid hand edit degrades to the 256 MiB default
|
|
167
171
|
// rather than failing the parse, matching the outbound guard above: a malformed number must
|
|
168
172
|
// not change what the proxy admits. The hard ceiling is NOT enforced here — because of that
|
|
@@ -303,6 +307,17 @@ export const configSchema = z.object({
|
|
|
303
307
|
// and the default label is emitted, rather than failing the parse or writing a config Codex
|
|
304
308
|
// would refuse to load — the provider id routing depends on is never derived from it.
|
|
305
309
|
codexProviderDisplayName: z.string().trim().min(1).max(128).optional().catch(undefined),
|
|
310
|
+
// Preserve an invalid marker: silently treating corrupt epochs as legacy would grant stale attempts authority.
|
|
311
|
+
accountAutoPausePolicyRevisions: z.record(z.string(), z.uuid()).nullable().optional().catch(null),
|
|
312
|
+
// Details are display-only; keep each usable resume revision and the separate paused-id authority.
|
|
313
|
+
codexAccountPauseState: z.preprocess(value => {
|
|
314
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return undefined;
|
|
315
|
+
return Object.fromEntries(Object.entries(value).flatMap(([id, row]) => {
|
|
316
|
+
if (!row || typeof row !== "object" || Array.isArray(row) || typeof row.revision !== "string") return [];
|
|
317
|
+
const parsed = accountPauseStateSchema.safeParse({ [id]: row });
|
|
318
|
+
return [[id, parsed.success ? parsed.data[id] : { revision: row.revision }]];
|
|
319
|
+
}));
|
|
320
|
+
}, accountPauseStateSchema.optional()),
|
|
306
321
|
pausedCodexAccountIds: z.array(z.string().regex(/^[a-zA-Z0-9._-]{1,64}$/)).optional(),
|
|
307
322
|
// A malformed allow-list degrades to "no account spends credits" rather than failing the parse,
|
|
308
323
|
// so a hand-edited typo cannot trip the backup-and-defaults repair path; the write path rejects
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import { accountAutoPausePolicySchema, accountPauseDetailsSchema } from "./account-auto-pause";
|
|
2
3
|
import { anthropicAccountPoolSchema } from "./anthropic-account-pool";
|
|
3
4
|
import { join } from "node:path";
|
|
4
5
|
import { isValidProviderName } from "../provider-name";
|
|
@@ -303,6 +304,8 @@ const providerNoProxySchema = z.unknown().superRefine((value, ctx) => {
|
|
|
303
304
|
* fields pass through (preserved for runtime extensions).
|
|
304
305
|
*/
|
|
305
306
|
export const providerConfigSchema = z.object({
|
|
307
|
+
accountAutoPause: accountAutoPausePolicySchema.optional(),
|
|
308
|
+
apiKeyPool: z.array(z.object({ id: z.string(), key: z.string(), label: z.string().optional(), addedAt: z.number().optional(), disabled: z.boolean().optional(), pauseRevision: z.string().optional(), pauseDetails: accountPauseDetailsSchema.optional() }).passthrough()).optional(),
|
|
306
309
|
anthropicAccountPool: anthropicAccountPoolSchema,
|
|
307
310
|
// Raw diagnostics/writes reject malformed provenance; tolerant loads preserve the custom row.
|
|
308
311
|
anthropicOAuthInstance: z.literal("anthropic2").optional().catch(undefined),
|
|
@@ -1020,12 +1023,16 @@ export const codexPoolSchema = z.object({
|
|
|
1020
1023
|
actions: z.object({
|
|
1021
1024
|
pause: z.boolean(),
|
|
1022
1025
|
notify: z.boolean(),
|
|
1026
|
+
desktop: z.boolean().optional(),
|
|
1023
1027
|
}).strict(),
|
|
1024
1028
|
windows: z.object({
|
|
1025
1029
|
short: z.boolean(),
|
|
1026
1030
|
weekly: z.boolean(),
|
|
1027
1031
|
}).strict(),
|
|
1028
1032
|
}).strict().superRefine((policy, ctx) => {
|
|
1033
|
+
if (policy.actions.desktop === true && !policy.actions.notify) {
|
|
1034
|
+
ctx.addIssue({ code: "custom", path: ["actions", "desktop"], message: "desktop low-quota notification requires notify" });
|
|
1035
|
+
}
|
|
1029
1036
|
if (!policy.enabled) return;
|
|
1030
1037
|
if (!policy.actions.pause && !policy.actions.notify) {
|
|
1031
1038
|
ctx.addIssue({ code: "custom", path: ["actions"], message: "enabled low-quota protection needs an action" });
|
package/src/config.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeAccountAutoPauseRevisions, observeAccountAutoPauseRevisions, observeLoadedAutoPauseConfig } from "./config/account-auto-pause-revisions";
|
|
1
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
3
|
import { join } from "node:path";
|
|
3
4
|
import type { OcxConfig } from "./types";
|
|
@@ -155,14 +156,13 @@ import {
|
|
|
155
156
|
mergeConfigDefaults,
|
|
156
157
|
validateConfigCandidate,
|
|
157
158
|
} from "./config/diagnostics";
|
|
158
|
-
|
|
159
159
|
// replace path — never publishInitialConfigNoReplace
|
|
160
160
|
import { persistConfigUnlocked, readRawConfigJson } from "./config/persist-unlocked";
|
|
161
|
-
|
|
162
161
|
import { withConfigMutationLockSync, bumpGenerationForCooperatingConfigWrite } from "./config/mutation-lock";
|
|
163
162
|
import { getDefaultConfig } from "./config/proxy-env";
|
|
164
163
|
import { configSchema } from "./config/schema/config-schema";
|
|
165
164
|
import { sanitizeOpenCodeOverridesForLoad } from "./config/opencode-wire-upgrade";
|
|
165
|
+
import { sanitizeRemovedOpenCodeFreeForLoad } from "./config/removed-opencode-free";
|
|
166
166
|
import {
|
|
167
167
|
hardenExistingSecret,
|
|
168
168
|
normalizeApiKeyIds,
|
|
@@ -211,7 +211,7 @@ import {
|
|
|
211
211
|
* until a valid config or a genuinely missing file is observed. A partially-
|
|
212
212
|
* invalid config is merged with defaults so providers and pool accounts survive.
|
|
213
213
|
*/
|
|
214
|
-
|
|
214
|
+
function loadConfigUnobserved(): OcxConfig {
|
|
215
215
|
const dir = getConfigDir();
|
|
216
216
|
const configPath = getConfigPath();
|
|
217
217
|
hardenConfigDir();
|
|
@@ -223,6 +223,7 @@ export function loadConfig(): OcxConfig {
|
|
|
223
223
|
try {
|
|
224
224
|
const raw = readFileSync(configPath, "utf-8").replace(/^\uFEFF/, "");
|
|
225
225
|
const parsed = JSON.parse(raw);
|
|
226
|
+
sanitizeRemovedOpenCodeFreeForLoad(parsed);
|
|
226
227
|
sanitizeOpenCodeOverridesForLoad(parsed);
|
|
227
228
|
sanitizeAliasesForLoad(parsed);
|
|
228
229
|
sanitizeReasoningPinsForLoad(parsed);
|
|
@@ -332,6 +333,10 @@ export function loadConfig(): OcxConfig {
|
|
|
332
333
|
}
|
|
333
334
|
}
|
|
334
335
|
|
|
336
|
+
export function loadConfig(): OcxConfig {
|
|
337
|
+
return observeLoadedAutoPauseConfig(loadConfigUnobserved());
|
|
338
|
+
}
|
|
339
|
+
|
|
335
340
|
export type PersistedConfigInitializationOutcome = "created" | "exists" | "invalid";
|
|
336
341
|
|
|
337
342
|
/** Initialize only a missing config; ordinary explicit updates still use saveConfig. */
|
|
@@ -348,11 +353,13 @@ export function initializePersistedConfigIfMissing(
|
|
|
348
353
|
const current = observeInitialConfigState();
|
|
349
354
|
if (current !== "missing") return current;
|
|
350
355
|
const projected = projectCustomModelCatalogMigration(undefined, projectConfigRebaseProvenance(config));
|
|
356
|
+
normalizeAccountAutoPauseRevisions(undefined, projected);
|
|
351
357
|
if (!validateConfigCandidate(projected).ok) throw new Error("Initial configuration is invalid.");
|
|
352
358
|
if (!publishInitialConfigNoReplace(getConfigPath(), JSON.stringify(projected, null, 2) + "\n", io)) {
|
|
353
359
|
return observeInitialConfigState() === "exists" ? "exists" : "invalid";
|
|
354
360
|
}
|
|
355
361
|
published = true;
|
|
362
|
+
observeAccountAutoPauseRevisions(projected);
|
|
356
363
|
recordOwnedConfigPath(getConfigDir(), getConfigPath());
|
|
357
364
|
bumpGenerationForCooperatingConfigWrite();
|
|
358
365
|
return projected;
|