codex-multi-auth 2.1.10 → 2.1.12
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 +414 -413
- package/assets/codex-multi-auth-icon.svg +39 -0
- package/package.json +193 -193
- package/scripts/codex.js +153 -4
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="bg" x1="72" y1="44" x2="440" y2="468" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop offset="0" stop-color="#111827"/>
|
|
5
|
+
<stop offset="1" stop-color="#020617"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<linearGradient id="card" x1="138" y1="152" x2="366" y2="352" gradientUnits="userSpaceOnUse">
|
|
8
|
+
<stop offset="0" stop-color="#f8fafc"/>
|
|
9
|
+
<stop offset="1" stop-color="#cbd5e1"/>
|
|
10
|
+
</linearGradient>
|
|
11
|
+
<linearGradient id="accent" x1="164" y1="184" x2="344" y2="332" gradientUnits="userSpaceOnUse">
|
|
12
|
+
<stop offset="0" stop-color="#38bdf8"/>
|
|
13
|
+
<stop offset="1" stop-color="#22c55e"/>
|
|
14
|
+
</linearGradient>
|
|
15
|
+
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%" color-interpolation-filters="sRGB">
|
|
16
|
+
<feDropShadow dx="0" dy="18" stdDeviation="16" flood-color="#000000" flood-opacity="0.34"/>
|
|
17
|
+
</filter>
|
|
18
|
+
</defs>
|
|
19
|
+
<rect width="512" height="512" rx="112" fill="url(#bg)"/>
|
|
20
|
+
<circle cx="256" cy="256" r="176" fill="none" stroke="#1e293b" stroke-width="24"/>
|
|
21
|
+
<path d="M376 138a176 176 0 0 1 54 116" fill="none" stroke="#38bdf8" stroke-linecap="round" stroke-width="24"/>
|
|
22
|
+
<path d="M136 374a176 176 0 0 1-54-116" fill="none" stroke="#22c55e" stroke-linecap="round" stroke-width="24"/>
|
|
23
|
+
<path d="M424 232l20 33 19-34" fill="none" stroke="#38bdf8" stroke-linecap="round" stroke-linejoin="round" stroke-width="18"/>
|
|
24
|
+
<path d="M88 280l-20-33-19 34" fill="none" stroke="#22c55e" stroke-linecap="round" stroke-linejoin="round" stroke-width="18"/>
|
|
25
|
+
<g filter="url(#shadow)">
|
|
26
|
+
<rect x="142" y="158" width="228" height="170" rx="34" fill="#334155" opacity="0.9"/>
|
|
27
|
+
<rect x="124" y="184" width="228" height="170" rx="34" fill="#475569"/>
|
|
28
|
+
<rect x="104" y="210" width="228" height="170" rx="34" fill="url(#card)"/>
|
|
29
|
+
</g>
|
|
30
|
+
<circle cx="172" cy="278" r="36" fill="url(#accent)"/>
|
|
31
|
+
<path d="M130 342c12-31 35-47 70-47s58 16 70 47" fill="none" stroke="#0f172a" stroke-linecap="round" stroke-width="22"/>
|
|
32
|
+
<rect x="210" y="254" width="82" height="18" rx="9" fill="#0f172a" opacity="0.9"/>
|
|
33
|
+
<rect x="210" y="290" width="58" height="18" rx="9" fill="#0f172a" opacity="0.56"/>
|
|
34
|
+
<g transform="translate(302 318)">
|
|
35
|
+
<rect x="0" y="0" width="104" height="74" rx="20" fill="#020617" stroke="#38bdf8" stroke-width="10"/>
|
|
36
|
+
<path d="M28 26l16 12-16 12" fill="none" stroke="#e2e8f0" stroke-linecap="round" stroke-linejoin="round" stroke-width="10"/>
|
|
37
|
+
<path d="M56 52h26" fill="none" stroke="#22c55e" stroke-linecap="round" stroke-width="10"/>
|
|
38
|
+
</g>
|
|
39
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "codex-multi-auth",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "Codex CLI multi-account OAuth manager with account switching, health checks, runtime rotation, diagnostics, and recovery tools for @openai/codex",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/index.js",
|
|
11
|
-
"default": "./dist/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./auth": {
|
|
14
|
-
"types": "./dist/lib/auth/index.d.ts",
|
|
15
|
-
"import": "./dist/lib/auth/index.js",
|
|
16
|
-
"default": "./dist/lib/auth/index.js"
|
|
17
|
-
},
|
|
18
|
-
"./storage": {
|
|
19
|
-
"types": "./dist/lib/storage.d.ts",
|
|
20
|
-
"import": "./dist/lib/storage.js",
|
|
21
|
-
"default": "./dist/lib/storage.js"
|
|
22
|
-
},
|
|
23
|
-
"./config": {
|
|
24
|
-
"types": "./dist/lib/config.d.ts",
|
|
25
|
-
"import": "./dist/lib/config.js",
|
|
26
|
-
"default": "./dist/lib/config.js"
|
|
27
|
-
},
|
|
28
|
-
"./request": {
|
|
29
|
-
"types": "./dist/lib/request/index.d.ts",
|
|
30
|
-
"import": "./dist/lib/request/index.js",
|
|
31
|
-
"default": "./dist/lib/request/index.js"
|
|
32
|
-
},
|
|
33
|
-
"./cli": {
|
|
34
|
-
"types": "./dist/lib/codex-cli/index.d.ts",
|
|
35
|
-
"import": "./dist/lib/codex-cli/index.js",
|
|
36
|
-
"default": "./dist/lib/codex-cli/index.js"
|
|
37
|
-
},
|
|
38
|
-
"./package.json": "./package.json"
|
|
39
|
-
},
|
|
40
|
-
"type": "module",
|
|
41
|
-
"license": "MIT",
|
|
42
|
-
"author": "ndycode",
|
|
43
|
-
"repository": {
|
|
44
|
-
"type": "git",
|
|
45
|
-
"url": "git+https://github.com/ndycode/codex-multi-auth.git"
|
|
46
|
-
},
|
|
47
|
-
"keywords": [
|
|
48
|
-
"openai",
|
|
49
|
-
"codex",
|
|
50
|
-
"codex-cli",
|
|
51
|
-
"codex-auth",
|
|
52
|
-
"codex-multi-account",
|
|
53
|
-
"chatgpt",
|
|
54
|
-
"oauth",
|
|
55
|
-
"oauth2",
|
|
56
|
-
"pkce",
|
|
57
|
-
"multi-account",
|
|
58
|
-
"account-switching",
|
|
59
|
-
"oauth-manager",
|
|
60
|
-
"runtime-rotation",
|
|
61
|
-
"responses-api",
|
|
62
|
-
"local-proxy",
|
|
63
|
-
"quota-management",
|
|
64
|
-
"diagnostics",
|
|
65
|
-
"fault-tolerance",
|
|
66
|
-
"terminal-ui",
|
|
67
|
-
"cli-tool",
|
|
68
|
-
"typescript",
|
|
69
|
-
"nodejs",
|
|
70
|
-
"developer-tools",
|
|
71
|
-
"authentication",
|
|
72
|
-
"account-health",
|
|
73
|
-
"recovery-tools",
|
|
74
|
-
"project-scoped-storage"
|
|
75
|
-
],
|
|
76
|
-
"homepage": "https://github.com/ndycode/codex-multi-auth#readme",
|
|
77
|
-
"bugs": {
|
|
78
|
-
"url": "https://github.com/ndycode/codex-multi-auth/issues"
|
|
79
|
-
},
|
|
80
|
-
"scripts": {
|
|
81
|
-
"build": "tsc && node scripts/copy-oauth-success.js",
|
|
82
|
-
"typecheck": "tsc --noEmit",
|
|
83
|
-
"typecheck:scripts": "tsc -p tsconfig.scripts.json",
|
|
84
|
-
"lint": "npm run lint:ts && npm run lint:scripts",
|
|
85
|
-
"lint:ts": "eslint . --ext .ts",
|
|
86
|
-
"lint:scripts": "eslint scripts --ext .js,.mjs",
|
|
87
|
-
"lint:fix": "npm run lint:ts:fix && npm run lint:scripts:fix",
|
|
88
|
-
"lint:ts:fix": "eslint . --ext .ts --fix",
|
|
89
|
-
"lint:scripts:fix": "eslint scripts --ext .js,.mjs --fix",
|
|
90
|
-
"test": "vitest run --maxWorkers=1",
|
|
91
|
-
"test:watch": "vitest",
|
|
92
|
-
"test:ui": "vitest --ui",
|
|
93
|
-
"test:model-matrix": "node scripts/test-model-matrix.js",
|
|
94
|
-
"test:model-matrix:smoke": "node scripts/test-model-matrix.js --smoke",
|
|
95
|
-
"test:model-matrix:report": "node scripts/test-model-matrix.js --smoke --report-json=.tmp/model-matrix-report.json",
|
|
96
|
-
"clean:repo": "node scripts/repo-hygiene.js clean --mode aggressive",
|
|
97
|
-
"clean:repo:check": "node scripts/repo-hygiene.js check",
|
|
98
|
-
"pack:check": "npm run build && node scripts/check-pack-budget.mjs",
|
|
99
|
-
"bench:edit-formats": "node scripts/benchmark-edit-formats.mjs --preset=codex-core",
|
|
100
|
-
"bench:edit-formats:smoke": "node scripts/benchmark-edit-formats.mjs --smoke --preset=codex-core",
|
|
101
|
-
"bench:edit-formats:render": "node scripts/benchmark-render-dashboard.mjs",
|
|
102
|
-
"bench:runtime-path": "npm run build && node scripts/benchmark-runtime-path.mjs",
|
|
103
|
-
"bench:runtime-path:quick": "node scripts/benchmark-runtime-path.mjs",
|
|
104
|
-
"test:coverage": "vitest run --coverage --maxWorkers=1",
|
|
105
|
-
"coverage": "npm run build && vitest run --coverage --maxWorkers=1",
|
|
106
|
-
"audit:prod": "npm audit --omit=dev --audit-level=high",
|
|
107
|
-
"audit:all": "npm audit --audit-level=high",
|
|
108
|
-
"audit:dev:allowlist": "node scripts/audit-dev-allowlist.js",
|
|
109
|
-
"audit:ci": "npm run audit:prod && npm run audit:dev:allowlist",
|
|
110
|
-
"vendor:verify": "node scripts/verify-vendor-provenance.mjs",
|
|
111
|
-
"vendor:update-manifest": "node scripts/update-vendor-provenance.mjs",
|
|
112
|
-
"postinstall": "node scripts/postinstall.js",
|
|
113
|
-
"prepublishOnly": "npm run build",
|
|
114
|
-
"prepare": "husky"
|
|
115
|
-
},
|
|
116
|
-
"bin": {
|
|
117
|
-
"codex-multi-auth-codex": "scripts/codex.js",
|
|
118
|
-
"codex-multi-auth-app-launcher": "scripts/codex-app-launcher.js",
|
|
119
|
-
"codex-multi-auth": "scripts/codex-multi-auth.js"
|
|
120
|
-
},
|
|
121
|
-
"files": [
|
|
122
|
-
"dist/",
|
|
123
|
-
"assets/",
|
|
124
|
-
"config/",
|
|
125
|
-
"scripts/codex.js",
|
|
126
|
-
"scripts/codex-app-launcher.js",
|
|
127
|
-
"scripts/codex-app-router.js",
|
|
128
|
-
"scripts/codex-bin-resolver.js",
|
|
129
|
-
"scripts/codex-multi-auth.js",
|
|
130
|
-
"scripts/codex-routing.js",
|
|
131
|
-
"scripts/install-codex-auth-utils.js",
|
|
132
|
-
"scripts/postinstall.js",
|
|
133
|
-
"scripts/preuninstall.js",
|
|
134
|
-
"vendor/codex-ai-plugin/",
|
|
135
|
-
"vendor/codex-ai-sdk/",
|
|
136
|
-
"README.md",
|
|
137
|
-
"LICENSE"
|
|
138
|
-
],
|
|
139
|
-
"bundleDependencies": [
|
|
140
|
-
"@codex-ai/plugin"
|
|
141
|
-
],
|
|
142
|
-
"lint-staged": {
|
|
143
|
-
"*.ts": [
|
|
144
|
-
"eslint --max-warnings=0 --fix --no-warn-ignored"
|
|
145
|
-
],
|
|
146
|
-
"scripts/**/*.{js,mjs}": [
|
|
147
|
-
"eslint --max-warnings=0 --fix --no-warn-ignored"
|
|
148
|
-
]
|
|
149
|
-
},
|
|
150
|
-
"engines": {
|
|
151
|
-
"node": ">=18.0.0"
|
|
152
|
-
},
|
|
153
|
-
"peerDependencies": {
|
|
154
|
-
"typescript": "^5"
|
|
155
|
-
},
|
|
156
|
-
"devDependencies": {
|
|
157
|
-
"@codex-ai/sdk": "file:vendor/codex-ai-sdk",
|
|
158
|
-
"@fast-check/vitest": "^0.2.4",
|
|
159
|
-
"@types/node": "^25.3.0",
|
|
160
|
-
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
161
|
-
"@typescript-eslint/parser": "^8.56.0",
|
|
162
|
-
"@vitest/coverage-v8": "^4.0.18",
|
|
163
|
-
"@vitest/ui": "^4.0.18",
|
|
164
|
-
"eslint": "^10.0.0",
|
|
165
|
-
"fast-check": "^4.5.3",
|
|
166
|
-
"husky": "^9.1.7",
|
|
167
|
-
"lint-staged": "^16.2.7",
|
|
168
|
-
"typescript": "^5.9.3",
|
|
169
|
-
"typescript-language-server": "^5.1.3",
|
|
170
|
-
"vitest": "^4.0.18"
|
|
171
|
-
},
|
|
172
|
-
"dependencies": {
|
|
173
|
-
"@codex-ai/plugin": "file:vendor/codex-ai-plugin",
|
|
174
|
-
"@openauthjs/openauth": "^0.4.3",
|
|
175
|
-
"hono": "4.12.18",
|
|
176
|
-
"undici": "6.25.0",
|
|
177
|
-
"zod": "4.4.3"
|
|
178
|
-
},
|
|
179
|
-
"overrides": {
|
|
180
|
-
"hono": "4.12.18",
|
|
181
|
-
"flatted": "3.4.2",
|
|
182
|
-
"minimatch": "10.2.4",
|
|
183
|
-
"picomatch": "4.0.4",
|
|
184
|
-
"rollup": "4.59.0",
|
|
185
|
-
"vite": "^7.3.2",
|
|
186
|
-
"micromatch": {
|
|
187
|
-
"picomatch": "2.3.2"
|
|
188
|
-
},
|
|
189
|
-
"@typescript-eslint/typescript-estree": {
|
|
190
|
-
"minimatch": "9.0.9"
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "codex-multi-auth",
|
|
3
|
+
"version": "2.1.12",
|
|
4
|
+
"description": "Codex CLI multi-account OAuth manager with account switching, health checks, runtime rotation, diagnostics, and recovery tools for @openai/codex",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./auth": {
|
|
14
|
+
"types": "./dist/lib/auth/index.d.ts",
|
|
15
|
+
"import": "./dist/lib/auth/index.js",
|
|
16
|
+
"default": "./dist/lib/auth/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./storage": {
|
|
19
|
+
"types": "./dist/lib/storage.d.ts",
|
|
20
|
+
"import": "./dist/lib/storage.js",
|
|
21
|
+
"default": "./dist/lib/storage.js"
|
|
22
|
+
},
|
|
23
|
+
"./config": {
|
|
24
|
+
"types": "./dist/lib/config.d.ts",
|
|
25
|
+
"import": "./dist/lib/config.js",
|
|
26
|
+
"default": "./dist/lib/config.js"
|
|
27
|
+
},
|
|
28
|
+
"./request": {
|
|
29
|
+
"types": "./dist/lib/request/index.d.ts",
|
|
30
|
+
"import": "./dist/lib/request/index.js",
|
|
31
|
+
"default": "./dist/lib/request/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./cli": {
|
|
34
|
+
"types": "./dist/lib/codex-cli/index.d.ts",
|
|
35
|
+
"import": "./dist/lib/codex-cli/index.js",
|
|
36
|
+
"default": "./dist/lib/codex-cli/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./package.json": "./package.json"
|
|
39
|
+
},
|
|
40
|
+
"type": "module",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"author": "ndycode",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/ndycode/codex-multi-auth.git"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"openai",
|
|
49
|
+
"codex",
|
|
50
|
+
"codex-cli",
|
|
51
|
+
"codex-auth",
|
|
52
|
+
"codex-multi-account",
|
|
53
|
+
"chatgpt",
|
|
54
|
+
"oauth",
|
|
55
|
+
"oauth2",
|
|
56
|
+
"pkce",
|
|
57
|
+
"multi-account",
|
|
58
|
+
"account-switching",
|
|
59
|
+
"oauth-manager",
|
|
60
|
+
"runtime-rotation",
|
|
61
|
+
"responses-api",
|
|
62
|
+
"local-proxy",
|
|
63
|
+
"quota-management",
|
|
64
|
+
"diagnostics",
|
|
65
|
+
"fault-tolerance",
|
|
66
|
+
"terminal-ui",
|
|
67
|
+
"cli-tool",
|
|
68
|
+
"typescript",
|
|
69
|
+
"nodejs",
|
|
70
|
+
"developer-tools",
|
|
71
|
+
"authentication",
|
|
72
|
+
"account-health",
|
|
73
|
+
"recovery-tools",
|
|
74
|
+
"project-scoped-storage"
|
|
75
|
+
],
|
|
76
|
+
"homepage": "https://github.com/ndycode/codex-multi-auth#readme",
|
|
77
|
+
"bugs": {
|
|
78
|
+
"url": "https://github.com/ndycode/codex-multi-auth/issues"
|
|
79
|
+
},
|
|
80
|
+
"scripts": {
|
|
81
|
+
"build": "tsc && node scripts/copy-oauth-success.js",
|
|
82
|
+
"typecheck": "tsc --noEmit",
|
|
83
|
+
"typecheck:scripts": "tsc -p tsconfig.scripts.json",
|
|
84
|
+
"lint": "npm run lint:ts && npm run lint:scripts",
|
|
85
|
+
"lint:ts": "eslint . --ext .ts",
|
|
86
|
+
"lint:scripts": "eslint scripts --ext .js,.mjs",
|
|
87
|
+
"lint:fix": "npm run lint:ts:fix && npm run lint:scripts:fix",
|
|
88
|
+
"lint:ts:fix": "eslint . --ext .ts --fix",
|
|
89
|
+
"lint:scripts:fix": "eslint scripts --ext .js,.mjs --fix",
|
|
90
|
+
"test": "vitest run --maxWorkers=1",
|
|
91
|
+
"test:watch": "vitest",
|
|
92
|
+
"test:ui": "vitest --ui",
|
|
93
|
+
"test:model-matrix": "node scripts/test-model-matrix.js",
|
|
94
|
+
"test:model-matrix:smoke": "node scripts/test-model-matrix.js --smoke",
|
|
95
|
+
"test:model-matrix:report": "node scripts/test-model-matrix.js --smoke --report-json=.tmp/model-matrix-report.json",
|
|
96
|
+
"clean:repo": "node scripts/repo-hygiene.js clean --mode aggressive",
|
|
97
|
+
"clean:repo:check": "node scripts/repo-hygiene.js check",
|
|
98
|
+
"pack:check": "npm run build && node scripts/check-pack-budget.mjs",
|
|
99
|
+
"bench:edit-formats": "node scripts/benchmark-edit-formats.mjs --preset=codex-core",
|
|
100
|
+
"bench:edit-formats:smoke": "node scripts/benchmark-edit-formats.mjs --smoke --preset=codex-core",
|
|
101
|
+
"bench:edit-formats:render": "node scripts/benchmark-render-dashboard.mjs",
|
|
102
|
+
"bench:runtime-path": "npm run build && node scripts/benchmark-runtime-path.mjs",
|
|
103
|
+
"bench:runtime-path:quick": "node scripts/benchmark-runtime-path.mjs",
|
|
104
|
+
"test:coverage": "vitest run --coverage --maxWorkers=1",
|
|
105
|
+
"coverage": "npm run build && vitest run --coverage --maxWorkers=1",
|
|
106
|
+
"audit:prod": "npm audit --omit=dev --audit-level=high",
|
|
107
|
+
"audit:all": "npm audit --audit-level=high",
|
|
108
|
+
"audit:dev:allowlist": "node scripts/audit-dev-allowlist.js",
|
|
109
|
+
"audit:ci": "npm run audit:prod && npm run audit:dev:allowlist",
|
|
110
|
+
"vendor:verify": "node scripts/verify-vendor-provenance.mjs",
|
|
111
|
+
"vendor:update-manifest": "node scripts/update-vendor-provenance.mjs",
|
|
112
|
+
"postinstall": "node scripts/postinstall.js",
|
|
113
|
+
"prepublishOnly": "npm run build",
|
|
114
|
+
"prepare": "husky"
|
|
115
|
+
},
|
|
116
|
+
"bin": {
|
|
117
|
+
"codex-multi-auth-codex": "scripts/codex.js",
|
|
118
|
+
"codex-multi-auth-app-launcher": "scripts/codex-app-launcher.js",
|
|
119
|
+
"codex-multi-auth": "scripts/codex-multi-auth.js"
|
|
120
|
+
},
|
|
121
|
+
"files": [
|
|
122
|
+
"dist/",
|
|
123
|
+
"assets/",
|
|
124
|
+
"config/",
|
|
125
|
+
"scripts/codex.js",
|
|
126
|
+
"scripts/codex-app-launcher.js",
|
|
127
|
+
"scripts/codex-app-router.js",
|
|
128
|
+
"scripts/codex-bin-resolver.js",
|
|
129
|
+
"scripts/codex-multi-auth.js",
|
|
130
|
+
"scripts/codex-routing.js",
|
|
131
|
+
"scripts/install-codex-auth-utils.js",
|
|
132
|
+
"scripts/postinstall.js",
|
|
133
|
+
"scripts/preuninstall.js",
|
|
134
|
+
"vendor/codex-ai-plugin/",
|
|
135
|
+
"vendor/codex-ai-sdk/",
|
|
136
|
+
"README.md",
|
|
137
|
+
"LICENSE"
|
|
138
|
+
],
|
|
139
|
+
"bundleDependencies": [
|
|
140
|
+
"@codex-ai/plugin"
|
|
141
|
+
],
|
|
142
|
+
"lint-staged": {
|
|
143
|
+
"*.ts": [
|
|
144
|
+
"eslint --max-warnings=0 --fix --no-warn-ignored"
|
|
145
|
+
],
|
|
146
|
+
"scripts/**/*.{js,mjs}": [
|
|
147
|
+
"eslint --max-warnings=0 --fix --no-warn-ignored"
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
"engines": {
|
|
151
|
+
"node": ">=18.0.0"
|
|
152
|
+
},
|
|
153
|
+
"peerDependencies": {
|
|
154
|
+
"typescript": "^5"
|
|
155
|
+
},
|
|
156
|
+
"devDependencies": {
|
|
157
|
+
"@codex-ai/sdk": "file:vendor/codex-ai-sdk",
|
|
158
|
+
"@fast-check/vitest": "^0.2.4",
|
|
159
|
+
"@types/node": "^25.3.0",
|
|
160
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
161
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
162
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
163
|
+
"@vitest/ui": "^4.0.18",
|
|
164
|
+
"eslint": "^10.0.0",
|
|
165
|
+
"fast-check": "^4.5.3",
|
|
166
|
+
"husky": "^9.1.7",
|
|
167
|
+
"lint-staged": "^16.2.7",
|
|
168
|
+
"typescript": "^5.9.3",
|
|
169
|
+
"typescript-language-server": "^5.1.3",
|
|
170
|
+
"vitest": "^4.0.18"
|
|
171
|
+
},
|
|
172
|
+
"dependencies": {
|
|
173
|
+
"@codex-ai/plugin": "file:vendor/codex-ai-plugin",
|
|
174
|
+
"@openauthjs/openauth": "^0.4.3",
|
|
175
|
+
"hono": "4.12.18",
|
|
176
|
+
"undici": "6.25.0",
|
|
177
|
+
"zod": "4.4.3"
|
|
178
|
+
},
|
|
179
|
+
"overrides": {
|
|
180
|
+
"hono": "4.12.18",
|
|
181
|
+
"flatted": "3.4.2",
|
|
182
|
+
"minimatch": "10.2.4",
|
|
183
|
+
"picomatch": "4.0.4",
|
|
184
|
+
"rollup": "4.59.0",
|
|
185
|
+
"vite": "^7.3.2",
|
|
186
|
+
"micromatch": {
|
|
187
|
+
"picomatch": "2.3.2"
|
|
188
|
+
},
|
|
189
|
+
"@typescript-eslint/typescript-estree": {
|
|
190
|
+
"minimatch": "9.0.9"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
package/scripts/codex.js
CHANGED
|
@@ -2494,6 +2494,150 @@ function createRuntimeRotationShadowHome(originalCodexHome) {
|
|
|
2494
2494
|
return mkdtempSync(join(shadowRoot, "codex-multi-auth-runtime-home-"));
|
|
2495
2495
|
}
|
|
2496
2496
|
|
|
2497
|
+
function parseHookStateTableKey(line) {
|
|
2498
|
+
const basicStringMatch =
|
|
2499
|
+
/^\s*\[\s*hooks\.state\.("(?:[^"\\]|\\.)*")\s*\]\s*$/.exec(line);
|
|
2500
|
+
if (basicStringMatch) {
|
|
2501
|
+
try {
|
|
2502
|
+
const parsed = JSON.parse(basicStringMatch[1]);
|
|
2503
|
+
return typeof parsed === "string" ? parsed : null;
|
|
2504
|
+
} catch {
|
|
2505
|
+
return null;
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
const literalStringMatch = /^\s*\[\s*hooks\.state\.'([^']*)'\s*\]\s*$/.exec(
|
|
2510
|
+
line,
|
|
2511
|
+
);
|
|
2512
|
+
return literalStringMatch ? literalStringMatch[1] : null;
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
function isTomlTableLine(line) {
|
|
2516
|
+
return /^\s*\[\[?\s*(?:"(?:[^"\\]|\\.)*"|'[^']*'|[A-Za-z0-9_-]+)(?:\s*\.|\s*\]\]?\s*(?:#.*)?$)/.test(
|
|
2517
|
+
line,
|
|
2518
|
+
);
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
// Keep these TOML block scan helpers aligned with test/codex-bin-wrapper.test.ts.
|
|
2522
|
+
function createTomlBlockScanState() {
|
|
2523
|
+
return {
|
|
2524
|
+
arrayDepth: 0,
|
|
2525
|
+
multilineStringDelimiter: null,
|
|
2526
|
+
};
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2529
|
+
function isTopLevelTomlBlockScanState(state) {
|
|
2530
|
+
return state.arrayDepth === 0 && state.multilineStringDelimiter === null;
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
function updateTomlBlockScanState(line, state) {
|
|
2534
|
+
for (let index = 0; index < line.length; index += 1) {
|
|
2535
|
+
if (state.multilineStringDelimiter) {
|
|
2536
|
+
const closeIndex = line.indexOf(state.multilineStringDelimiter, index);
|
|
2537
|
+
if (closeIndex < 0) {
|
|
2538
|
+
return;
|
|
2539
|
+
}
|
|
2540
|
+
index = closeIndex + state.multilineStringDelimiter.length - 1;
|
|
2541
|
+
state.multilineStringDelimiter = null;
|
|
2542
|
+
continue;
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
if (line[index] === "#") {
|
|
2546
|
+
return;
|
|
2547
|
+
}
|
|
2548
|
+
if (line.startsWith('"""', index) || line.startsWith("'''", index)) {
|
|
2549
|
+
state.multilineStringDelimiter = line.slice(index, index + 3);
|
|
2550
|
+
index += 2;
|
|
2551
|
+
continue;
|
|
2552
|
+
}
|
|
2553
|
+
if (line[index] === '"') {
|
|
2554
|
+
index += 1;
|
|
2555
|
+
for (; index < line.length; index += 1) {
|
|
2556
|
+
if (line[index] === "\\") {
|
|
2557
|
+
index += 1;
|
|
2558
|
+
} else if (line[index] === '"') {
|
|
2559
|
+
break;
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2562
|
+
continue;
|
|
2563
|
+
}
|
|
2564
|
+
if (line[index] === "'") {
|
|
2565
|
+
const closeIndex = line.indexOf("'", index + 1);
|
|
2566
|
+
if (closeIndex < 0) return;
|
|
2567
|
+
index = closeIndex;
|
|
2568
|
+
continue;
|
|
2569
|
+
}
|
|
2570
|
+
if (line[index] === "[") {
|
|
2571
|
+
state.arrayDepth += 1;
|
|
2572
|
+
} else if (line[index] === "]" && state.arrayDepth > 0) {
|
|
2573
|
+
state.arrayDepth -= 1;
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
function mirrorRuntimeShadowHookTrustState(
|
|
2579
|
+
rawConfig,
|
|
2580
|
+
originalCodexHome,
|
|
2581
|
+
shadowCodexHome,
|
|
2582
|
+
tomlStringLiteral,
|
|
2583
|
+
) {
|
|
2584
|
+
const sourceHooksPath = join(originalCodexHome, "hooks.json");
|
|
2585
|
+
const shadowHooksPath = join(shadowCodexHome, "hooks.json");
|
|
2586
|
+
if (sourceHooksPath === shadowHooksPath) {
|
|
2587
|
+
return rawConfig;
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
const lineEnding = rawConfig.includes("\r\n") ? "\r\n" : "\n";
|
|
2591
|
+
const lines = rawConfig.length > 0 ? rawConfig.split(/\r?\n/) : [];
|
|
2592
|
+
const sourcePrefix = `${sourceHooksPath}:`;
|
|
2593
|
+
const existingHookStateKeys = new Set();
|
|
2594
|
+
for (const line of lines) {
|
|
2595
|
+
const key = parseHookStateTableKey(line);
|
|
2596
|
+
if (key) {
|
|
2597
|
+
existingHookStateKeys.add(key);
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
const output = [];
|
|
2602
|
+
let changed = false;
|
|
2603
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
2604
|
+
const line = lines[index];
|
|
2605
|
+
const key = parseHookStateTableKey(line);
|
|
2606
|
+
output.push(line);
|
|
2607
|
+
if (!key || !key.startsWith(sourcePrefix)) {
|
|
2608
|
+
continue;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
const blockLines = [];
|
|
2612
|
+
let nextIndex = index + 1;
|
|
2613
|
+
const blockState = createTomlBlockScanState();
|
|
2614
|
+
for (; nextIndex < lines.length; nextIndex += 1) {
|
|
2615
|
+
const nextLine = lines[nextIndex];
|
|
2616
|
+
if (
|
|
2617
|
+
isTopLevelTomlBlockScanState(blockState) &&
|
|
2618
|
+
isTomlTableLine(nextLine)
|
|
2619
|
+
) {
|
|
2620
|
+
break;
|
|
2621
|
+
}
|
|
2622
|
+
blockLines.push(nextLine);
|
|
2623
|
+
updateTomlBlockScanState(nextLine, blockState);
|
|
2624
|
+
}
|
|
2625
|
+
output.push(...blockLines);
|
|
2626
|
+
index = nextIndex - 1;
|
|
2627
|
+
const shadowKey = `${shadowHooksPath}:${key.slice(sourcePrefix.length)}`;
|
|
2628
|
+
if (existingHookStateKeys.has(shadowKey)) {
|
|
2629
|
+
continue;
|
|
2630
|
+
}
|
|
2631
|
+
output.push("");
|
|
2632
|
+
output.push(`[hooks.state.${tomlStringLiteral(shadowKey)}]`);
|
|
2633
|
+
output.push(...blockLines);
|
|
2634
|
+
existingHookStateKeys.add(shadowKey);
|
|
2635
|
+
changed = true;
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
return changed ? output.join(lineEnding) : rawConfig;
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2497
2641
|
function createRuntimeRotationProxyCodexHome(
|
|
2498
2642
|
baseEnv,
|
|
2499
2643
|
proxyBaseUrl,
|
|
@@ -2535,10 +2679,15 @@ function createRuntimeRotationProxyCodexHome(
|
|
|
2535
2679
|
const rawConfig = existsSync(originalConfigPath)
|
|
2536
2680
|
? readFileSync(originalConfigPath, "utf8")
|
|
2537
2681
|
: "";
|
|
2538
|
-
const runtimeConfig =
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2682
|
+
const runtimeConfig = mirrorRuntimeShadowHookTrustState(
|
|
2683
|
+
configTomlModule.rewriteConfigTomlForRuntimeRotationProvider(
|
|
2684
|
+
rawConfig,
|
|
2685
|
+
proxyBaseUrl,
|
|
2686
|
+
clientApiKey,
|
|
2687
|
+
),
|
|
2688
|
+
originalCodexHome,
|
|
2689
|
+
shadowCodexHome,
|
|
2690
|
+
configTomlModule.tomlStringLiteral,
|
|
2542
2691
|
);
|
|
2543
2692
|
const runtimeConfigPath = join(shadowCodexHome, "config.toml");
|
|
2544
2693
|
writeFileSync(runtimeConfigPath, runtimeConfig, "utf8");
|