codex-multi-auth 0.1.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/LICENSE +1 -0
- package/README.md +162 -0
- package/assets/opencode-logo-ornate-dark.svg +18 -0
- package/assets/readme-hero.svg +31 -0
- package/config/README.md +87 -0
- package/config/minimal-opencode.json +13 -0
- package/config/opencode-legacy.json +571 -0
- package/config/opencode-modern.json +239 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3160 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/accounts/rate-limits.d.ts +22 -0
- package/dist/lib/accounts/rate-limits.d.ts.map +1 -0
- package/dist/lib/accounts/rate-limits.js +63 -0
- package/dist/lib/accounts/rate-limits.js.map +1 -0
- package/dist/lib/accounts.d.ts +95 -0
- package/dist/lib/accounts.d.ts.map +1 -0
- package/dist/lib/accounts.js +668 -0
- package/dist/lib/accounts.js.map +1 -0
- package/dist/lib/audit.d.ts +45 -0
- package/dist/lib/audit.d.ts.map +1 -0
- package/dist/lib/audit.js +131 -0
- package/dist/lib/audit.js.map +1 -0
- package/dist/lib/auth/auth.d.ts +56 -0
- package/dist/lib/auth/auth.d.ts.map +1 -0
- package/dist/lib/auth/auth.js +214 -0
- package/dist/lib/auth/auth.js.map +1 -0
- package/dist/lib/auth/browser.d.ts +34 -0
- package/dist/lib/auth/browser.d.ts.map +1 -0
- package/dist/lib/auth/browser.js +185 -0
- package/dist/lib/auth/browser.js.map +1 -0
- package/dist/lib/auth/server.d.ts +24 -0
- package/dist/lib/auth/server.d.ts.map +1 -0
- package/dist/lib/auth/server.js +116 -0
- package/dist/lib/auth/server.js.map +1 -0
- package/dist/lib/auth/token-utils.d.ts +59 -0
- package/dist/lib/auth/token-utils.d.ts.map +1 -0
- package/dist/lib/auth/token-utils.js +331 -0
- package/dist/lib/auth/token-utils.js.map +1 -0
- package/dist/lib/auth-rate-limit.d.ts +20 -0
- package/dist/lib/auth-rate-limit.d.ts.map +1 -0
- package/dist/lib/auth-rate-limit.js +91 -0
- package/dist/lib/auth-rate-limit.js.map +1 -0
- package/dist/lib/auto-update-checker.d.ts +10 -0
- package/dist/lib/auto-update-checker.d.ts.map +1 -0
- package/dist/lib/auto-update-checker.js +216 -0
- package/dist/lib/auto-update-checker.js.map +1 -0
- package/dist/lib/capability-policy.d.ts +18 -0
- package/dist/lib/capability-policy.d.ts.map +1 -0
- package/dist/lib/capability-policy.js +150 -0
- package/dist/lib/capability-policy.js.map +1 -0
- package/dist/lib/circuit-breaker.d.ts +34 -0
- package/dist/lib/circuit-breaker.d.ts.map +1 -0
- package/dist/lib/circuit-breaker.js +124 -0
- package/dist/lib/circuit-breaker.js.map +1 -0
- package/dist/lib/cli.d.ts +64 -0
- package/dist/lib/cli.d.ts.map +1 -0
- package/dist/lib/cli.js +274 -0
- package/dist/lib/cli.js.map +1 -0
- package/dist/lib/codex-cli/observability.d.ts +22 -0
- package/dist/lib/codex-cli/observability.d.ts.map +1 -0
- package/dist/lib/codex-cli/observability.js +36 -0
- package/dist/lib/codex-cli/observability.js.map +1 -0
- package/dist/lib/codex-cli/state.d.ts +86 -0
- package/dist/lib/codex-cli/state.d.ts.map +1 -0
- package/dist/lib/codex-cli/state.js +470 -0
- package/dist/lib/codex-cli/state.js.map +1 -0
- package/dist/lib/codex-cli/sync.d.ts +27 -0
- package/dist/lib/codex-cli/sync.d.ts.map +1 -0
- package/dist/lib/codex-cli/sync.js +325 -0
- package/dist/lib/codex-cli/sync.js.map +1 -0
- package/dist/lib/codex-cli/writer.d.ts +12 -0
- package/dist/lib/codex-cli/writer.d.ts.map +1 -0
- package/dist/lib/codex-cli/writer.js +388 -0
- package/dist/lib/codex-cli/writer.js.map +1 -0
- package/dist/lib/codex-manager.d.ts +2 -0
- package/dist/lib/codex-manager.d.ts.map +1 -0
- package/dist/lib/codex-manager.js +4841 -0
- package/dist/lib/codex-manager.js.map +1 -0
- package/dist/lib/config.d.ts +269 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +789 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/constants.d.ts +78 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +78 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/context-overflow.d.ts +27 -0
- package/dist/lib/context-overflow.d.ts.map +1 -0
- package/dist/lib/context-overflow.js +124 -0
- package/dist/lib/context-overflow.js.map +1 -0
- package/dist/lib/dashboard-settings.d.ts +90 -0
- package/dist/lib/dashboard-settings.d.ts.map +1 -0
- package/dist/lib/dashboard-settings.js +327 -0
- package/dist/lib/dashboard-settings.js.map +1 -0
- package/dist/lib/entitlement-cache.d.ts +41 -0
- package/dist/lib/entitlement-cache.d.ts.map +1 -0
- package/dist/lib/entitlement-cache.js +137 -0
- package/dist/lib/entitlement-cache.js.map +1 -0
- package/dist/lib/errors.d.ts +113 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +103 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/forecast.d.ts +42 -0
- package/dist/lib/forecast.d.ts.map +1 -0
- package/dist/lib/forecast.js +256 -0
- package/dist/lib/forecast.js.map +1 -0
- package/dist/lib/health.d.ts +33 -0
- package/dist/lib/health.d.ts.map +1 -0
- package/dist/lib/health.js +70 -0
- package/dist/lib/health.js.map +1 -0
- package/dist/lib/index.d.ts +32 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +32 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/live-account-sync.d.ts +39 -0
- package/dist/lib/live-account-sync.d.ts.map +1 -0
- package/dist/lib/live-account-sync.js +196 -0
- package/dist/lib/live-account-sync.js.map +1 -0
- package/dist/lib/logger.d.ts +40 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +364 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/oauth-success.html +338 -0
- package/dist/lib/parallel-probe.d.ts +28 -0
- package/dist/lib/parallel-probe.d.ts.map +1 -0
- package/dist/lib/parallel-probe.js +97 -0
- package/dist/lib/parallel-probe.js.map +1 -0
- package/dist/lib/preemptive-quota-scheduler.d.ts +53 -0
- package/dist/lib/preemptive-quota-scheduler.d.ts.map +1 -0
- package/dist/lib/preemptive-quota-scheduler.js +220 -0
- package/dist/lib/preemptive-quota-scheduler.js.map +1 -0
- package/dist/lib/proactive-refresh.d.ts +66 -0
- package/dist/lib/proactive-refresh.d.ts.map +1 -0
- package/dist/lib/proactive-refresh.js +143 -0
- package/dist/lib/proactive-refresh.js.map +1 -0
- package/dist/lib/prompts/codex-opencode-bridge.d.ts +19 -0
- package/dist/lib/prompts/codex-opencode-bridge.d.ts.map +1 -0
- package/dist/lib/prompts/codex-opencode-bridge.js +169 -0
- package/dist/lib/prompts/codex-opencode-bridge.js.map +1 -0
- package/dist/lib/prompts/codex.d.ts +41 -0
- package/dist/lib/prompts/codex.d.ts.map +1 -0
- package/dist/lib/prompts/codex.js +383 -0
- package/dist/lib/prompts/codex.js.map +1 -0
- package/dist/lib/prompts/opencode-codex.d.ts +25 -0
- package/dist/lib/prompts/opencode-codex.d.ts.map +1 -0
- package/dist/lib/prompts/opencode-codex.js +270 -0
- package/dist/lib/prompts/opencode-codex.js.map +1 -0
- package/dist/lib/quota-cache.d.ts +68 -0
- package/dist/lib/quota-cache.d.ts.map +1 -0
- package/dist/lib/quota-cache.js +224 -0
- package/dist/lib/quota-cache.js.map +1 -0
- package/dist/lib/quota-probe.d.ts +49 -0
- package/dist/lib/quota-probe.d.ts.map +1 -0
- package/dist/lib/quota-probe.js +368 -0
- package/dist/lib/quota-probe.js.map +1 -0
- package/dist/lib/recovery/constants.d.ts +12 -0
- package/dist/lib/recovery/constants.d.ts.map +1 -0
- package/dist/lib/recovery/constants.js +31 -0
- package/dist/lib/recovery/constants.js.map +1 -0
- package/dist/lib/recovery/index.d.ts +12 -0
- package/dist/lib/recovery/index.d.ts.map +1 -0
- package/dist/lib/recovery/index.js +12 -0
- package/dist/lib/recovery/index.js.map +1 -0
- package/dist/lib/recovery/storage.d.ts +24 -0
- package/dist/lib/recovery/storage.d.ts.map +1 -0
- package/dist/lib/recovery/storage.js +362 -0
- package/dist/lib/recovery/storage.js.map +1 -0
- package/dist/lib/recovery/types.d.ts +116 -0
- package/dist/lib/recovery/types.d.ts.map +1 -0
- package/dist/lib/recovery/types.js +7 -0
- package/dist/lib/recovery/types.js.map +1 -0
- package/dist/lib/recovery.d.ts +31 -0
- package/dist/lib/recovery.d.ts.map +1 -0
- package/dist/lib/recovery.js +313 -0
- package/dist/lib/recovery.js.map +1 -0
- package/dist/lib/refresh-guardian.d.ts +31 -0
- package/dist/lib/refresh-guardian.d.ts.map +1 -0
- package/dist/lib/refresh-guardian.js +151 -0
- package/dist/lib/refresh-guardian.js.map +1 -0
- package/dist/lib/refresh-lease.d.ts +37 -0
- package/dist/lib/refresh-lease.d.ts.map +1 -0
- package/dist/lib/refresh-lease.js +335 -0
- package/dist/lib/refresh-lease.js.map +1 -0
- package/dist/lib/refresh-queue.d.ts +117 -0
- package/dist/lib/refresh-queue.d.ts.map +1 -0
- package/dist/lib/refresh-queue.js +297 -0
- package/dist/lib/refresh-queue.js.map +1 -0
- package/dist/lib/request/failure-policy.d.ts +42 -0
- package/dist/lib/request/failure-policy.d.ts.map +1 -0
- package/dist/lib/request/failure-policy.js +133 -0
- package/dist/lib/request/failure-policy.js.map +1 -0
- package/dist/lib/request/fetch-helpers.d.ts +152 -0
- package/dist/lib/request/fetch-helpers.d.ts.map +1 -0
- package/dist/lib/request/fetch-helpers.js +704 -0
- package/dist/lib/request/fetch-helpers.js.map +1 -0
- package/dist/lib/request/helpers/input-utils.d.ts +7 -0
- package/dist/lib/request/helpers/input-utils.d.ts.map +1 -0
- package/dist/lib/request/helpers/input-utils.js +214 -0
- package/dist/lib/request/helpers/input-utils.js.map +1 -0
- package/dist/lib/request/helpers/model-map.d.ts +28 -0
- package/dist/lib/request/helpers/model-map.d.ts.map +1 -0
- package/dist/lib/request/helpers/model-map.js +133 -0
- package/dist/lib/request/helpers/model-map.js.map +1 -0
- package/dist/lib/request/helpers/tool-utils.d.ts +29 -0
- package/dist/lib/request/helpers/tool-utils.d.ts.map +1 -0
- package/dist/lib/request/helpers/tool-utils.js +117 -0
- package/dist/lib/request/helpers/tool-utils.js.map +1 -0
- package/dist/lib/request/rate-limit-backoff.d.ts +17 -0
- package/dist/lib/request/rate-limit-backoff.d.ts.map +1 -0
- package/dist/lib/request/rate-limit-backoff.js +83 -0
- package/dist/lib/request/rate-limit-backoff.js.map +1 -0
- package/dist/lib/request/request-transformer.d.ts +107 -0
- package/dist/lib/request/request-transformer.d.ts.map +1 -0
- package/dist/lib/request/request-transformer.js +814 -0
- package/dist/lib/request/request-transformer.js.map +1 -0
- package/dist/lib/request/response-handler.d.ts +23 -0
- package/dist/lib/request/response-handler.d.ts.map +1 -0
- package/dist/lib/request/response-handler.js +155 -0
- package/dist/lib/request/response-handler.js.map +1 -0
- package/dist/lib/request/stream-failover.d.ts +21 -0
- package/dist/lib/request/stream-failover.d.ts.map +1 -0
- package/dist/lib/request/stream-failover.js +204 -0
- package/dist/lib/request/stream-failover.js.map +1 -0
- package/dist/lib/rotation.d.ts +146 -0
- package/dist/lib/rotation.d.ts.map +1 -0
- package/dist/lib/rotation.js +321 -0
- package/dist/lib/rotation.js.map +1 -0
- package/dist/lib/runtime-paths.d.ts +58 -0
- package/dist/lib/runtime-paths.d.ts.map +1 -0
- package/dist/lib/runtime-paths.js +164 -0
- package/dist/lib/runtime-paths.js.map +1 -0
- package/dist/lib/schemas.d.ts +435 -0
- package/dist/lib/schemas.d.ts.map +1 -0
- package/dist/lib/schemas.js +268 -0
- package/dist/lib/schemas.js.map +1 -0
- package/dist/lib/session-affinity.d.ts +23 -0
- package/dist/lib/session-affinity.d.ts.map +1 -0
- package/dist/lib/session-affinity.js +127 -0
- package/dist/lib/session-affinity.js.map +1 -0
- package/dist/lib/shutdown.d.ts +7 -0
- package/dist/lib/shutdown.d.ts.map +1 -0
- package/dist/lib/shutdown.js +43 -0
- package/dist/lib/shutdown.js.map +1 -0
- package/dist/lib/storage/migrations.d.ts +59 -0
- package/dist/lib/storage/migrations.d.ts.map +1 -0
- package/dist/lib/storage/migrations.js +41 -0
- package/dist/lib/storage/migrations.js.map +1 -0
- package/dist/lib/storage/paths.d.ts +51 -0
- package/dist/lib/storage/paths.d.ts.map +1 -0
- package/dist/lib/storage/paths.js +152 -0
- package/dist/lib/storage/paths.js.map +1 -0
- package/dist/lib/storage.d.ts +106 -0
- package/dist/lib/storage.d.ts.map +1 -0
- package/dist/lib/storage.js +896 -0
- package/dist/lib/storage.js.map +1 -0
- package/dist/lib/table-formatter.d.ts +32 -0
- package/dist/lib/table-formatter.d.ts.map +1 -0
- package/dist/lib/table-formatter.js +44 -0
- package/dist/lib/table-formatter.js.map +1 -0
- package/dist/lib/tools/hashline-tools.d.ts +51 -0
- package/dist/lib/tools/hashline-tools.d.ts.map +1 -0
- package/dist/lib/tools/hashline-tools.js +456 -0
- package/dist/lib/tools/hashline-tools.js.map +1 -0
- package/dist/lib/types.d.ts +130 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/ui/ansi.d.ts +40 -0
- package/dist/lib/ui/ansi.d.ts.map +1 -0
- package/dist/lib/ui/ansi.js +68 -0
- package/dist/lib/ui/ansi.js.map +1 -0
- package/dist/lib/ui/auth-menu.d.ts +76 -0
- package/dist/lib/ui/auth-menu.d.ts.map +1 -0
- package/dist/lib/ui/auth-menu.js +590 -0
- package/dist/lib/ui/auth-menu.js.map +1 -0
- package/dist/lib/ui/confirm.d.ts +11 -0
- package/dist/lib/ui/confirm.d.ts.map +1 -0
- package/dist/lib/ui/confirm.js +29 -0
- package/dist/lib/ui/confirm.js.map +1 -0
- package/dist/lib/ui/copy.d.ts +123 -0
- package/dist/lib/ui/copy.d.ts.map +1 -0
- package/dist/lib/ui/copy.js +127 -0
- package/dist/lib/ui/copy.js.map +1 -0
- package/dist/lib/ui/format.d.ts +62 -0
- package/dist/lib/ui/format.d.ts.map +1 -0
- package/dist/lib/ui/format.js +205 -0
- package/dist/lib/ui/format.js.map +1 -0
- package/dist/lib/ui/runtime.d.ts +43 -0
- package/dist/lib/ui/runtime.d.ts.map +1 -0
- package/dist/lib/ui/runtime.js +69 -0
- package/dist/lib/ui/runtime.js.map +1 -0
- package/dist/lib/ui/select.d.ts +60 -0
- package/dist/lib/ui/select.d.ts.map +1 -0
- package/dist/lib/ui/select.js +467 -0
- package/dist/lib/ui/select.js.map +1 -0
- package/dist/lib/ui/theme.d.ts +56 -0
- package/dist/lib/ui/theme.d.ts.map +1 -0
- package/dist/lib/ui/theme.js +186 -0
- package/dist/lib/ui/theme.js.map +1 -0
- package/dist/lib/unified-settings.d.ts +71 -0
- package/dist/lib/unified-settings.d.ts.map +1 -0
- package/dist/lib/unified-settings.js +299 -0
- package/dist/lib/unified-settings.js.map +1 -0
- package/dist/lib/utils.d.ts +29 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +54 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +115 -0
- package/scripts/audit-dev-allowlist.js +128 -0
- package/scripts/bench-format/hashline-v2.mjs +642 -0
- package/scripts/bench-format/models.mjs +105 -0
- package/scripts/bench-format/opencode.mjs +205 -0
- package/scripts/bench-format/render.mjs +496 -0
- package/scripts/bench-format/stats.mjs +54 -0
- package/scripts/bench-format/tasks.mjs +151 -0
- package/scripts/benchmark-edit-formats.mjs +1161 -0
- package/scripts/benchmark-render-dashboard.mjs +49 -0
- package/scripts/codex-multi-auth.js +6 -0
- package/scripts/codex-routing.js +34 -0
- package/scripts/codex.js +122 -0
- package/scripts/copy-oauth-success.js +37 -0
- package/scripts/install-opencode-codex-auth.js +193 -0
- package/scripts/test-all-models.sh +7 -0
- package/scripts/test-model-matrix.js +424 -0
- package/scripts/validate-model-map.sh +7 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared terminal theme primitives for legacy and Codex-style TUI rendering.
|
|
3
|
+
*/
|
|
4
|
+
export type UiColorProfile = "ansi16" | "ansi256" | "truecolor";
|
|
5
|
+
export type UiGlyphMode = "ascii" | "unicode" | "auto";
|
|
6
|
+
export type UiPalette = "green" | "blue";
|
|
7
|
+
export type UiAccent = "green" | "cyan" | "blue" | "yellow";
|
|
8
|
+
export interface UiGlyphSet {
|
|
9
|
+
selected: string;
|
|
10
|
+
unselected: string;
|
|
11
|
+
bullet: string;
|
|
12
|
+
check: string;
|
|
13
|
+
cross: string;
|
|
14
|
+
}
|
|
15
|
+
export interface UiThemeColors {
|
|
16
|
+
reset: string;
|
|
17
|
+
dim: string;
|
|
18
|
+
muted: string;
|
|
19
|
+
heading: string;
|
|
20
|
+
primary: string;
|
|
21
|
+
accent: string;
|
|
22
|
+
success: string;
|
|
23
|
+
warning: string;
|
|
24
|
+
danger: string;
|
|
25
|
+
border: string;
|
|
26
|
+
focusBg: string;
|
|
27
|
+
focusText: string;
|
|
28
|
+
}
|
|
29
|
+
export interface UiTheme {
|
|
30
|
+
profile: UiColorProfile;
|
|
31
|
+
glyphMode: UiGlyphMode;
|
|
32
|
+
glyphs: UiGlyphSet;
|
|
33
|
+
colors: UiThemeColors;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Create a UI theme object for terminal rendering.
|
|
37
|
+
*
|
|
38
|
+
* @param options - Optional configuration:
|
|
39
|
+
* - profile: color profile to use; defaults to `"truecolor"`.
|
|
40
|
+
* - glyphMode: glyph rendering mode; defaults to `"ascii"`.
|
|
41
|
+
* - palette: overall palette variant; defaults to `"green"`.
|
|
42
|
+
* - accent: accent color selection; defaults to `"green"`.
|
|
43
|
+
* @returns The constructed UiTheme object containing `profile`, `glyphMode`, `glyphs`, and `colors`.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* - Concurrency: creation is pure and side-effect free, safe to call concurrently.
|
|
47
|
+
* - Windows filesystem: theme creation does not access the filesystem and has no platform-specific file behavior.
|
|
48
|
+
* - Token redaction: this function does not handle or emit secrets or sensitive tokens.
|
|
49
|
+
*/
|
|
50
|
+
export declare function createUiTheme(options?: {
|
|
51
|
+
profile?: UiColorProfile;
|
|
52
|
+
glyphMode?: UiGlyphMode;
|
|
53
|
+
palette?: UiPalette;
|
|
54
|
+
accent?: UiAccent;
|
|
55
|
+
}): UiTheme;
|
|
56
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../lib/ui/theme.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AACvD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AACzC,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,UAAU;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACvB,OAAO,EAAE,cAAc,CAAC;IACxB,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC;CACtB;AAiKD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE;IACvC,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,CAAC;CAClB,GAAG,OAAO,CAYV"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared terminal theme primitives for legacy and Codex-style TUI rendering.
|
|
3
|
+
*/
|
|
4
|
+
const ansi16 = (code) => `\x1b[${code}m`;
|
|
5
|
+
const ansi256 = (code) => `\x1b[38;5;${code}m`;
|
|
6
|
+
const truecolor = (r, g, b) => `\x1b[38;2;${r};${g};${b}m`;
|
|
7
|
+
const ansi256Bg = (code) => `\x1b[48;5;${code}m`;
|
|
8
|
+
const truecolorBg = (r, g, b) => `\x1b[48;2;${r};${g};${b}m`;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve a glyph mode, interpreting `"auto"` to choose `"unicode"` or `"ascii"` based on the environment.
|
|
11
|
+
*
|
|
12
|
+
* Safe for concurrent use, performs no filesystem operations (including on Windows), and does not expose or log sensitive tokens.
|
|
13
|
+
*
|
|
14
|
+
* @param mode - The requested glyph mode ("ascii", "unicode", or "auto")
|
|
15
|
+
* @returns `"unicode"` when Unicode is likely safe, `"ascii"` otherwise; if `mode` is not `"auto"`, returns it unchanged
|
|
16
|
+
*/
|
|
17
|
+
function resolveGlyphMode(mode) {
|
|
18
|
+
if (mode !== "auto")
|
|
19
|
+
return mode;
|
|
20
|
+
const isLikelyUnicodeSafe = process.env.WT_SESSION !== undefined ||
|
|
21
|
+
process.env.TERM_PROGRAM === "vscode" ||
|
|
22
|
+
process.env.TERM?.toLowerCase().includes("xterm") === true;
|
|
23
|
+
return isLikelyUnicodeSafe ? "unicode" : "ascii";
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Selects a glyph set appropriate for the given glyph mode.
|
|
27
|
+
*
|
|
28
|
+
* This function has no concurrency implications, performs no filesystem I/O (including on Windows), and does not perform any token redaction.
|
|
29
|
+
*
|
|
30
|
+
* @param mode - The resolved glyph mode; `'unicode'` yields Unicode glyphs, otherwise ASCII glyphs
|
|
31
|
+
* @returns The `UiGlyphSet` matching the requested `mode`
|
|
32
|
+
*/
|
|
33
|
+
function getGlyphs(mode) {
|
|
34
|
+
if (mode === "unicode") {
|
|
35
|
+
return {
|
|
36
|
+
selected: "◆",
|
|
37
|
+
unselected: "○",
|
|
38
|
+
bullet: "•",
|
|
39
|
+
check: "✓",
|
|
40
|
+
cross: "✗",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
selected: ">",
|
|
45
|
+
unselected: "o",
|
|
46
|
+
bullet: "-",
|
|
47
|
+
check: "+",
|
|
48
|
+
cross: "x",
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Selects the ANSI escape sequence for the requested accent color according to the color profile.
|
|
53
|
+
*
|
|
54
|
+
* This function is pure and has no side effects: it is safe for concurrent use, performs no filesystem operations (including on Windows), and does not perform any token redaction.
|
|
55
|
+
*
|
|
56
|
+
* @param profile - The color profile to use (`"truecolor"`, `"ansi256"`, or `"ansi16"`)
|
|
57
|
+
* @param accent - The accent name to resolve (`"green"`, `"cyan"`, `"blue"`, or `"yellow"`)
|
|
58
|
+
* @returns The escape sequence for the accent color suitable for use as a foreground color
|
|
59
|
+
*/
|
|
60
|
+
function accentColorForProfile(profile, accent) {
|
|
61
|
+
switch (profile) {
|
|
62
|
+
case "truecolor":
|
|
63
|
+
switch (accent) {
|
|
64
|
+
case "cyan":
|
|
65
|
+
return truecolor(34, 211, 238);
|
|
66
|
+
case "blue":
|
|
67
|
+
return truecolor(59, 130, 246);
|
|
68
|
+
case "yellow":
|
|
69
|
+
return truecolor(245, 158, 11);
|
|
70
|
+
default:
|
|
71
|
+
return truecolor(74, 222, 128);
|
|
72
|
+
}
|
|
73
|
+
case "ansi256":
|
|
74
|
+
switch (accent) {
|
|
75
|
+
case "cyan":
|
|
76
|
+
return ansi256(51);
|
|
77
|
+
case "blue":
|
|
78
|
+
return ansi256(75);
|
|
79
|
+
case "yellow":
|
|
80
|
+
return ansi256(214);
|
|
81
|
+
default:
|
|
82
|
+
return ansi256(83);
|
|
83
|
+
}
|
|
84
|
+
default:
|
|
85
|
+
switch (accent) {
|
|
86
|
+
case "cyan":
|
|
87
|
+
return ansi16(96);
|
|
88
|
+
case "blue":
|
|
89
|
+
return ansi16(94);
|
|
90
|
+
case "yellow":
|
|
91
|
+
return ansi16(93);
|
|
92
|
+
default:
|
|
93
|
+
return ansi16(92);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Produce a set of terminal color tokens and focus/background values appropriate for the given color profile, palette, and accent.
|
|
99
|
+
*
|
|
100
|
+
* This function is safe for concurrent use (no shared mutable state), performs no filesystem operations (including on Windows), and returns color tokens that may contain ANSI escape sequences — treat those sequences as sensitive when logging or emitting to external telemetry and redact them as needed.
|
|
101
|
+
*
|
|
102
|
+
* @param profile - The color capability profile to target (`"ansi16" | "ansi256" | "truecolor"`)
|
|
103
|
+
* @param palette - The UI palette selection that influences primary/success/border colors (`"green" | "blue"`)
|
|
104
|
+
* @param accent - The accent color choice used for the `accent` token (`"green" | "cyan" | "blue" | "yellow"`)
|
|
105
|
+
* @returns A UiThemeColors object containing resolved color tokens (e.g., `reset`, `dim`, `muted`, `heading`, `primary`, `accent`, `success`, `warning`, `danger`, `border`, `focusBg`, and `focusText`)
|
|
106
|
+
*/
|
|
107
|
+
function getColors(profile, palette, accent) {
|
|
108
|
+
const accentColor = accentColorForProfile(profile, accent);
|
|
109
|
+
const isBluePalette = palette === "blue";
|
|
110
|
+
switch (profile) {
|
|
111
|
+
case "truecolor":
|
|
112
|
+
return {
|
|
113
|
+
reset: "\x1b[0m",
|
|
114
|
+
dim: "\x1b[2m",
|
|
115
|
+
muted: truecolor(148, 163, 184),
|
|
116
|
+
heading: truecolor(240, 253, 244),
|
|
117
|
+
primary: isBluePalette ? truecolor(96, 165, 250) : truecolor(74, 222, 128),
|
|
118
|
+
accent: accentColor,
|
|
119
|
+
success: isBluePalette ? truecolor(96, 165, 250) : truecolor(74, 222, 128),
|
|
120
|
+
warning: truecolor(245, 158, 11),
|
|
121
|
+
danger: truecolor(239, 68, 68),
|
|
122
|
+
border: isBluePalette ? truecolor(59, 130, 246) : truecolor(34, 197, 94),
|
|
123
|
+
focusBg: isBluePalette ? truecolorBg(37, 99, 235) : truecolorBg(22, 101, 52),
|
|
124
|
+
focusText: truecolor(248, 250, 252),
|
|
125
|
+
};
|
|
126
|
+
case "ansi256":
|
|
127
|
+
return {
|
|
128
|
+
reset: "\x1b[0m",
|
|
129
|
+
dim: "\x1b[2m",
|
|
130
|
+
muted: ansi256(102),
|
|
131
|
+
heading: ansi256(255),
|
|
132
|
+
primary: isBluePalette ? ansi256(75) : ansi256(83),
|
|
133
|
+
accent: accentColor,
|
|
134
|
+
success: isBluePalette ? ansi256(75) : ansi256(83),
|
|
135
|
+
warning: ansi256(214),
|
|
136
|
+
danger: ansi256(196),
|
|
137
|
+
border: isBluePalette ? ansi256(27) : ansi256(40),
|
|
138
|
+
focusBg: isBluePalette ? ansi256Bg(26) : ansi256Bg(28),
|
|
139
|
+
focusText: ansi256(231),
|
|
140
|
+
};
|
|
141
|
+
default:
|
|
142
|
+
return {
|
|
143
|
+
reset: "\x1b[0m",
|
|
144
|
+
dim: "\x1b[2m",
|
|
145
|
+
muted: ansi16(37),
|
|
146
|
+
heading: ansi16(97),
|
|
147
|
+
primary: isBluePalette ? ansi16(94) : ansi16(92),
|
|
148
|
+
accent: accentColor,
|
|
149
|
+
success: isBluePalette ? ansi16(94) : ansi16(92),
|
|
150
|
+
warning: ansi16(93),
|
|
151
|
+
danger: ansi16(91),
|
|
152
|
+
border: isBluePalette ? ansi16(94) : ansi16(92),
|
|
153
|
+
focusBg: isBluePalette ? "\x1b[104m" : "\x1b[102m",
|
|
154
|
+
focusText: "\x1b[30m",
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Create a UI theme object for terminal rendering.
|
|
160
|
+
*
|
|
161
|
+
* @param options - Optional configuration:
|
|
162
|
+
* - profile: color profile to use; defaults to `"truecolor"`.
|
|
163
|
+
* - glyphMode: glyph rendering mode; defaults to `"ascii"`.
|
|
164
|
+
* - palette: overall palette variant; defaults to `"green"`.
|
|
165
|
+
* - accent: accent color selection; defaults to `"green"`.
|
|
166
|
+
* @returns The constructed UiTheme object containing `profile`, `glyphMode`, `glyphs`, and `colors`.
|
|
167
|
+
*
|
|
168
|
+
* @remarks
|
|
169
|
+
* - Concurrency: creation is pure and side-effect free, safe to call concurrently.
|
|
170
|
+
* - Windows filesystem: theme creation does not access the filesystem and has no platform-specific file behavior.
|
|
171
|
+
* - Token redaction: this function does not handle or emit secrets or sensitive tokens.
|
|
172
|
+
*/
|
|
173
|
+
export function createUiTheme(options) {
|
|
174
|
+
const profile = options?.profile ?? "truecolor";
|
|
175
|
+
const glyphMode = options?.glyphMode ?? "ascii";
|
|
176
|
+
const palette = options?.palette ?? "green";
|
|
177
|
+
const accent = options?.accent ?? "green";
|
|
178
|
+
const resolvedGlyphMode = resolveGlyphMode(glyphMode);
|
|
179
|
+
return {
|
|
180
|
+
profile,
|
|
181
|
+
glyphMode,
|
|
182
|
+
glyphs: getGlyphs(resolvedGlyphMode),
|
|
183
|
+
colors: getColors(profile, palette, accent),
|
|
184
|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OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;gBAChD,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;gBACnB,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;gBAClB,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC/C,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW;gBAClD,SAAS,EAAE,UAAU;aACrB,CAAC;IACJ,CAAC;AACF,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,aAAa,CAAC,OAK7B;IACA,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,WAAW,CAAC;IAChD,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,OAAO,CAAC;IAChD,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,OAAO,CAAC;IAC5C,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC;IAC1C,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACtD,OAAO;QACN,OAAO;QACP,SAAS;QACT,MAAM,EAAE,SAAS,CAAC,iBAAiB,CAAC;QACpC,MAAM,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC;KAC3C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
type JsonRecord = Record<string, unknown>;
|
|
2
|
+
export declare const UNIFIED_SETTINGS_VERSION: 1;
|
|
3
|
+
/**
|
|
4
|
+
* Get the absolute filesystem path to the unified settings JSON file used for multi-auth plugins.
|
|
5
|
+
*
|
|
6
|
+
* The path points to the settings.json inside the Codex multi-auth directory. Callers should treat access as subject to typical filesystem race conditions (concurrent readers/writers may conflict), and be aware that on Windows the path uses platform separators returned by Node's path utilities. The file may contain sensitive tokens; redact or avoid logging file contents.
|
|
7
|
+
*
|
|
8
|
+
* @returns The absolute path to the unified settings JSON file
|
|
9
|
+
*/
|
|
10
|
+
export declare function getUnifiedSettingsPath(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Loads the unified plugin configuration from the versioned settings file.
|
|
13
|
+
*
|
|
14
|
+
* Returns a shallow clone of the `pluginConfig` section if present; returns `null` when the settings file or the section is absent or unreadable.
|
|
15
|
+
*
|
|
16
|
+
* Note: callers should expect possible race conditions if other processes write the settings file concurrently; atomicity is not guaranteed across filesystems (including some Windows setups). This function does not redact or modify sensitive tokens—do not log or expose values returned here without first applying appropriate redaction.
|
|
17
|
+
*
|
|
18
|
+
* @returns A shallow clone of the `pluginConfig` object from the settings file, or `null` if unavailable.
|
|
19
|
+
*/
|
|
20
|
+
export declare function loadUnifiedPluginConfigSync(): JsonRecord | null;
|
|
21
|
+
/**
|
|
22
|
+
* Persist the given plugin configuration into the unified settings file synchronously.
|
|
23
|
+
*
|
|
24
|
+
* The provided `pluginConfig` is stored as the `pluginConfig` section of the on-disk
|
|
25
|
+
* settings payload (shallow-cloned before write). Callers are responsible for redacting
|
|
26
|
+
* any sensitive tokens or secrets prior to calling; values are written verbatim.
|
|
27
|
+
*
|
|
28
|
+
* Concurrency: no cross-process locking is performed — concurrent writers may overwrite
|
|
29
|
+
* each other. On Windows, write semantics and atomicity may differ from POSIX filesystems.
|
|
30
|
+
*
|
|
31
|
+
* @param pluginConfig - Key/value map representing plugin configuration to persist
|
|
32
|
+
*/
|
|
33
|
+
export declare function saveUnifiedPluginConfigSync(pluginConfig: JsonRecord): void;
|
|
34
|
+
/**
|
|
35
|
+
* Persist the provided plugin configuration to the unified settings file, replacing the `pluginConfig` section.
|
|
36
|
+
*
|
|
37
|
+
* Writes a shallow clone of `pluginConfig` into the on-disk settings payload. In-process calls are serialized
|
|
38
|
+
* through an async queue to reduce lost-update races, but there is still no cross-process locking. On Windows,
|
|
39
|
+
* filesystem atomicity and visibility semantics are platform-dependent; do not assume atomic merges across processes.
|
|
40
|
+
* The settings file is written as plain JSON; redact or remove any sensitive tokens or secrets before calling.
|
|
41
|
+
*
|
|
42
|
+
* @param pluginConfig - The plugin configuration object to store (will be shallow-cloned)
|
|
43
|
+
*/
|
|
44
|
+
export declare function saveUnifiedPluginConfig(pluginConfig: JsonRecord): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Load the dashboard display settings section from the unified settings file.
|
|
47
|
+
*
|
|
48
|
+
* Concurrency: callers should avoid concurrent conflicting writes to the settings file; concurrent readers are allowed but may observe intermediate state if a writer is in progress.
|
|
49
|
+
* Windows: note that filesystem semantics on Windows may cause exclusive locks or delayed visibility during writes.
|
|
50
|
+
* Secrets: this API does not perform token or secret redaction; callers must remove or mask sensitive values before saving.
|
|
51
|
+
*
|
|
52
|
+
* @returns A cloned `JsonRecord` with the `dashboardDisplaySettings` section, or `null` if the settings file is missing or cannot be parsed.
|
|
53
|
+
*/
|
|
54
|
+
export declare function loadUnifiedDashboardSettings(): Promise<JsonRecord | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Persist dashboard display settings into the unified settings file.
|
|
57
|
+
*
|
|
58
|
+
* Writes `dashboardDisplaySettings` into the shared settings.json (overwriting
|
|
59
|
+
* any existing dashboardDisplaySettings section) and ensures the payload is
|
|
60
|
+
* normalized with the file version. In-process async callers are serialized
|
|
61
|
+
* through an internal queue (last writer still wins), but no cross-process lock
|
|
62
|
+
* is provided. On Windows, path and directory creation follow Node's filesystem
|
|
63
|
+
* semantics (case-insensitive paths, ACLs apply). Sensitive tokens or secrets
|
|
64
|
+
* included in `dashboardDisplaySettings` are written verbatim — callers must
|
|
65
|
+
* redact or omit secrets before calling.
|
|
66
|
+
*
|
|
67
|
+
* @param dashboardDisplaySettings - A plain JSON record describing dashboard display preferences; the object is shallow-copied before persisting.
|
|
68
|
+
*/
|
|
69
|
+
export declare function saveUnifiedDashboardSettings(dashboardDisplaySettings: JsonRecord): Promise<void>;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=unified-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unified-settings.d.ts","sourceRoot":"","sources":["../../lib/unified-settings.ts"],"names":[],"mappings":"AAaA,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,eAAO,MAAM,wBAAwB,EAAG,CAAU,CAAC;AAsMnD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,IAAI,UAAU,GAAG,IAAI,CAQ/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,UAAU,GAAG,IAAI,CAI1E;AAED;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAAC,YAAY,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAMrF;AAED;;;;;;;;GAQG;AACH,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAQ/E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,4BAA4B,CACjD,wBAAwB,EAAE,UAAU,GAClC,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, renameSync, readFileSync, unlinkSync, writeFileSync, promises as fs, } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { getCodexMultiAuthDir } from "./runtime-paths.js";
|
|
4
|
+
import { sleep } from "./utils.js";
|
|
5
|
+
export const UNIFIED_SETTINGS_VERSION = 1;
|
|
6
|
+
const UNIFIED_SETTINGS_PATH = join(getCodexMultiAuthDir(), "settings.json");
|
|
7
|
+
const RETRYABLE_FS_CODES = new Set(["EBUSY", "EPERM"]);
|
|
8
|
+
let settingsWriteQueue = Promise.resolve();
|
|
9
|
+
function isRetryableFsError(error) {
|
|
10
|
+
const code = error?.code;
|
|
11
|
+
return typeof code === "string" && RETRYABLE_FS_CODES.has(code);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Determines whether a value is a non-null object suitable for use as a JsonRecord.
|
|
15
|
+
*
|
|
16
|
+
* @param value - The value to test
|
|
17
|
+
* @returns `true` if `value` is an object and not `null`, `false` otherwise
|
|
18
|
+
*/
|
|
19
|
+
function isRecord(value) {
|
|
20
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Return a shallow clone of an object-style record, or `null` if the input is not a record.
|
|
24
|
+
*
|
|
25
|
+
* @param value - Value to clone; must be a non-null plain object (record)
|
|
26
|
+
* @returns A new object containing the same own enumerable properties as `value`, or `null` if `value` is not a record
|
|
27
|
+
*/
|
|
28
|
+
function cloneRecord(value) {
|
|
29
|
+
if (!isRecord(value))
|
|
30
|
+
return null;
|
|
31
|
+
return { ...value };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Reads and parses the unified settings JSON file from disk.
|
|
35
|
+
*
|
|
36
|
+
* @returns The parsed settings object as a `JsonRecord`, or `null` if the settings file does not exist or cannot be read/parsed.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* - Concurrency: concurrent writers may produce transient read failures or partial files; atomicity is not guaranteed and callers should tolerate `null` and retry if needed.
|
|
40
|
+
* - Windows: file locking on Windows may cause reads to fail; in those cases this function returns `null`.
|
|
41
|
+
* - Sensitive data: this function performs no token or secret redaction; any sensitive values present in the file are returned as-is and callers are responsible for redaction before logging or external exposure.
|
|
42
|
+
*/
|
|
43
|
+
function readSettingsRecordSync() {
|
|
44
|
+
if (!existsSync(UNIFIED_SETTINGS_PATH)) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const raw = readFileSync(UNIFIED_SETTINGS_PATH, "utf8");
|
|
48
|
+
const parsed = cloneRecord(JSON.parse(raw));
|
|
49
|
+
if (!parsed) {
|
|
50
|
+
throw new Error("Unified settings must contain a JSON object at the root.");
|
|
51
|
+
}
|
|
52
|
+
return parsed;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Reads and parses the unified settings JSON file if present.
|
|
56
|
+
*
|
|
57
|
+
* This attempts to read and parse the file at the unified settings path and returns a shallow-cloned object on success. Returns `null` if the file does not exist, cannot be read, or contains invalid JSON. Concurrent writers may cause this call to return `null` or stale/partial data; callers should tolerate missing or malformed results. On Windows, path and permission semantics follow the Node runtime and may affect visibility. Consumers must redact any sensitive tokens before logging or returning the record.
|
|
58
|
+
*
|
|
59
|
+
* @returns The parsed settings record as an object clone, or `null` if unavailable or invalid.
|
|
60
|
+
*/
|
|
61
|
+
async function readSettingsRecordAsync() {
|
|
62
|
+
if (!existsSync(UNIFIED_SETTINGS_PATH)) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const raw = await fs.readFile(UNIFIED_SETTINGS_PATH, "utf8");
|
|
66
|
+
const parsed = cloneRecord(JSON.parse(raw));
|
|
67
|
+
if (!parsed) {
|
|
68
|
+
throw new Error("Unified settings must contain a JSON object at the root.");
|
|
69
|
+
}
|
|
70
|
+
return parsed;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Return a shallow-cloned settings record with the canonical unified settings `version` applied.
|
|
74
|
+
*
|
|
75
|
+
* This function is pure and only normalizes the payload for disk writes; it does not coordinate or serialize
|
|
76
|
+
* concurrent writers (callers must handle concurrency). No platform-specific behavior is applied for Windows —
|
|
77
|
+
* the `version` field is always set. Sensitive values (tokens, secrets) are not redacted or transformed;
|
|
78
|
+
* callers must remove or redact them before writing if required.
|
|
79
|
+
*
|
|
80
|
+
* @param record - The input settings object to normalize; keys are preserved.
|
|
81
|
+
* @returns The shallow clone of `record` with `version` set to `UNIFIED_SETTINGS_VERSION`.
|
|
82
|
+
*/
|
|
83
|
+
function normalizeForWrite(record) {
|
|
84
|
+
return {
|
|
85
|
+
...record,
|
|
86
|
+
version: UNIFIED_SETTINGS_VERSION,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Persist a unified settings record to the unified settings file on disk.
|
|
91
|
+
*
|
|
92
|
+
* Ensures the target directory exists, writes a pretty-printed, version-normalized JSON payload
|
|
93
|
+
* with a trailing newline to the configured unified settings path. This function does not
|
|
94
|
+
* redact, encrypt, or otherwise transform sensitive values — callers must remove or redact
|
|
95
|
+
* secrets (tokens, credentials) before calling.
|
|
96
|
+
*
|
|
97
|
+
* Concurrency: concurrent invocations may race and overwrite each other; callers should
|
|
98
|
+
* serialize writes if atomicity is required. Filesystem behavior (including atomicity and
|
|
99
|
+
* file-lock semantics) is platform-dependent and may differ on Windows.
|
|
100
|
+
*
|
|
101
|
+
* @param record - The settings object to persist; it will be normalized to include the unified settings version.
|
|
102
|
+
*/
|
|
103
|
+
function writeSettingsRecordSync(record) {
|
|
104
|
+
mkdirSync(getCodexMultiAuthDir(), { recursive: true });
|
|
105
|
+
const payload = normalizeForWrite(record);
|
|
106
|
+
const data = `${JSON.stringify(payload, null, 2)}\n`;
|
|
107
|
+
const tempPath = `${UNIFIED_SETTINGS_PATH}.${process.pid}.${Date.now()}.tmp`;
|
|
108
|
+
writeFileSync(tempPath, data, "utf8");
|
|
109
|
+
let moved = false;
|
|
110
|
+
try {
|
|
111
|
+
for (let attempt = 0; attempt < 5; attempt += 1) {
|
|
112
|
+
try {
|
|
113
|
+
renameSync(tempPath, UNIFIED_SETTINGS_PATH);
|
|
114
|
+
moved = true;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
if (!isRetryableFsError(error) || attempt >= 4) {
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 10 * 2 ** attempt);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
finally {
|
|
126
|
+
if (!moved) {
|
|
127
|
+
try {
|
|
128
|
+
unlinkSync(tempPath);
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
// Best-effort temp cleanup.
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Write a normalized unified settings record to the shared settings.json file.
|
|
138
|
+
*
|
|
139
|
+
* The function ensures the multi-auth settings directory exists, normalizes the
|
|
140
|
+
* provided record by embedding the canonical settings version, and writes a
|
|
141
|
+
* pretty-printed JSON file with a trailing newline to the resolved settings path.
|
|
142
|
+
*
|
|
143
|
+
* Concurrency: concurrent writers may race; the last successful write wins. Callers
|
|
144
|
+
* should coordinate writes if atomic read-modify-write semantics are required.
|
|
145
|
+
*
|
|
146
|
+
* Windows filesystem note: file locking and rename atomicity differ on Windows;
|
|
147
|
+
* callers should handle possible sharing or locking errors when multiple processes
|
|
148
|
+
* interact with the file.
|
|
149
|
+
*
|
|
150
|
+
* Security note: this function does not redact or sanitize sensitive values (e.g.,
|
|
151
|
+
* tokens or secrets). Ensure any secrets are removed or redacted from `record`
|
|
152
|
+
* before calling.
|
|
153
|
+
*
|
|
154
|
+
* @param record - The settings object to persist; it will be normalized (version set)
|
|
155
|
+
*/
|
|
156
|
+
async function writeSettingsRecordAsync(record) {
|
|
157
|
+
await fs.mkdir(getCodexMultiAuthDir(), { recursive: true });
|
|
158
|
+
const payload = normalizeForWrite(record);
|
|
159
|
+
const data = `${JSON.stringify(payload, null, 2)}\n`;
|
|
160
|
+
const tempPath = `${UNIFIED_SETTINGS_PATH}.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2, 8)}.tmp`;
|
|
161
|
+
await fs.writeFile(tempPath, data, "utf8");
|
|
162
|
+
let moved = false;
|
|
163
|
+
try {
|
|
164
|
+
for (let attempt = 0; attempt < 5; attempt += 1) {
|
|
165
|
+
try {
|
|
166
|
+
await fs.rename(tempPath, UNIFIED_SETTINGS_PATH);
|
|
167
|
+
moved = true;
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
if (!isRetryableFsError(error) || attempt >= 4) {
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
await sleep(10 * 2 ** attempt);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
finally {
|
|
179
|
+
if (!moved) {
|
|
180
|
+
try {
|
|
181
|
+
await fs.unlink(tempPath);
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
// Best-effort temp cleanup.
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
async function enqueueSettingsWrite(task) {
|
|
190
|
+
const run = settingsWriteQueue.catch(() => { }).then(task);
|
|
191
|
+
settingsWriteQueue = run.then(() => undefined, () => undefined);
|
|
192
|
+
return run;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Get the absolute filesystem path to the unified settings JSON file used for multi-auth plugins.
|
|
196
|
+
*
|
|
197
|
+
* The path points to the settings.json inside the Codex multi-auth directory. Callers should treat access as subject to typical filesystem race conditions (concurrent readers/writers may conflict), and be aware that on Windows the path uses platform separators returned by Node's path utilities. The file may contain sensitive tokens; redact or avoid logging file contents.
|
|
198
|
+
*
|
|
199
|
+
* @returns The absolute path to the unified settings JSON file
|
|
200
|
+
*/
|
|
201
|
+
export function getUnifiedSettingsPath() {
|
|
202
|
+
return UNIFIED_SETTINGS_PATH;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Loads the unified plugin configuration from the versioned settings file.
|
|
206
|
+
*
|
|
207
|
+
* Returns a shallow clone of the `pluginConfig` section if present; returns `null` when the settings file or the section is absent or unreadable.
|
|
208
|
+
*
|
|
209
|
+
* Note: callers should expect possible race conditions if other processes write the settings file concurrently; atomicity is not guaranteed across filesystems (including some Windows setups). This function does not redact or modify sensitive tokens—do not log or expose values returned here without first applying appropriate redaction.
|
|
210
|
+
*
|
|
211
|
+
* @returns A shallow clone of the `pluginConfig` object from the settings file, or `null` if unavailable.
|
|
212
|
+
*/
|
|
213
|
+
export function loadUnifiedPluginConfigSync() {
|
|
214
|
+
try {
|
|
215
|
+
const record = readSettingsRecordSync();
|
|
216
|
+
if (!record)
|
|
217
|
+
return null;
|
|
218
|
+
return cloneRecord(record.pluginConfig);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Persist the given plugin configuration into the unified settings file synchronously.
|
|
226
|
+
*
|
|
227
|
+
* The provided `pluginConfig` is stored as the `pluginConfig` section of the on-disk
|
|
228
|
+
* settings payload (shallow-cloned before write). Callers are responsible for redacting
|
|
229
|
+
* any sensitive tokens or secrets prior to calling; values are written verbatim.
|
|
230
|
+
*
|
|
231
|
+
* Concurrency: no cross-process locking is performed — concurrent writers may overwrite
|
|
232
|
+
* each other. On Windows, write semantics and atomicity may differ from POSIX filesystems.
|
|
233
|
+
*
|
|
234
|
+
* @param pluginConfig - Key/value map representing plugin configuration to persist
|
|
235
|
+
*/
|
|
236
|
+
export function saveUnifiedPluginConfigSync(pluginConfig) {
|
|
237
|
+
const record = readSettingsRecordSync() ?? {};
|
|
238
|
+
record.pluginConfig = { ...pluginConfig };
|
|
239
|
+
writeSettingsRecordSync(record);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Persist the provided plugin configuration to the unified settings file, replacing the `pluginConfig` section.
|
|
243
|
+
*
|
|
244
|
+
* Writes a shallow clone of `pluginConfig` into the on-disk settings payload. In-process calls are serialized
|
|
245
|
+
* through an async queue to reduce lost-update races, but there is still no cross-process locking. On Windows,
|
|
246
|
+
* filesystem atomicity and visibility semantics are platform-dependent; do not assume atomic merges across processes.
|
|
247
|
+
* The settings file is written as plain JSON; redact or remove any sensitive tokens or secrets before calling.
|
|
248
|
+
*
|
|
249
|
+
* @param pluginConfig - The plugin configuration object to store (will be shallow-cloned)
|
|
250
|
+
*/
|
|
251
|
+
export async function saveUnifiedPluginConfig(pluginConfig) {
|
|
252
|
+
await enqueueSettingsWrite(async () => {
|
|
253
|
+
const record = await readSettingsRecordAsync() ?? {};
|
|
254
|
+
record.pluginConfig = { ...pluginConfig };
|
|
255
|
+
await writeSettingsRecordAsync(record);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Load the dashboard display settings section from the unified settings file.
|
|
260
|
+
*
|
|
261
|
+
* Concurrency: callers should avoid concurrent conflicting writes to the settings file; concurrent readers are allowed but may observe intermediate state if a writer is in progress.
|
|
262
|
+
* Windows: note that filesystem semantics on Windows may cause exclusive locks or delayed visibility during writes.
|
|
263
|
+
* Secrets: this API does not perform token or secret redaction; callers must remove or mask sensitive values before saving.
|
|
264
|
+
*
|
|
265
|
+
* @returns A cloned `JsonRecord` with the `dashboardDisplaySettings` section, or `null` if the settings file is missing or cannot be parsed.
|
|
266
|
+
*/
|
|
267
|
+
export async function loadUnifiedDashboardSettings() {
|
|
268
|
+
try {
|
|
269
|
+
const record = await readSettingsRecordAsync();
|
|
270
|
+
if (!record)
|
|
271
|
+
return null;
|
|
272
|
+
return cloneRecord(record.dashboardDisplaySettings);
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Persist dashboard display settings into the unified settings file.
|
|
280
|
+
*
|
|
281
|
+
* Writes `dashboardDisplaySettings` into the shared settings.json (overwriting
|
|
282
|
+
* any existing dashboardDisplaySettings section) and ensures the payload is
|
|
283
|
+
* normalized with the file version. In-process async callers are serialized
|
|
284
|
+
* through an internal queue (last writer still wins), but no cross-process lock
|
|
285
|
+
* is provided. On Windows, path and directory creation follow Node's filesystem
|
|
286
|
+
* semantics (case-insensitive paths, ACLs apply). Sensitive tokens or secrets
|
|
287
|
+
* included in `dashboardDisplaySettings` are written verbatim — callers must
|
|
288
|
+
* redact or omit secrets before calling.
|
|
289
|
+
*
|
|
290
|
+
* @param dashboardDisplaySettings - A plain JSON record describing dashboard display preferences; the object is shallow-copied before persisting.
|
|
291
|
+
*/
|
|
292
|
+
export async function saveUnifiedDashboardSettings(dashboardDisplaySettings) {
|
|
293
|
+
await enqueueSettingsWrite(async () => {
|
|
294
|
+
const record = await readSettingsRecordAsync() ?? {};
|
|
295
|
+
record.dashboardDisplaySettings = { ...dashboardDisplaySettings };
|
|
296
|
+
await writeSettingsRecordAsync(record);
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
//# sourceMappingURL=unified-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unified-settings.js","sourceRoot":"","sources":["../../lib/unified-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,SAAS,EACT,UAAU,EACV,YAAY,EACZ,UAAU,EACV,aAAa,EACb,QAAQ,IAAI,EAAE,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAInC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAU,CAAC;AAEnD,MAAM,qBAAqB,GAAG,IAAI,CAAC,oBAAoB,EAAE,EAAE,eAAe,CAAC,CAAC;AAC5E,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AACvD,IAAI,kBAAkB,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;AAE1D,SAAS,kBAAkB,CAAC,KAAc;IACzC,MAAM,IAAI,GAAI,KAA2C,EAAE,IAAI,CAAC;IAChE,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,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