@gengjiawen/os-init 2.2.0 → 2.3.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/CHANGELOG.md +7 -0
- package/build/codex.js +4 -2
- package/libs/codex.test.ts +38 -3
- package/libs/codex.ts +11 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.3.0](https://github.com/gengjiawen/os-init/compare/v2.2.0...v2.3.0) (2026-11-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* point Codex at the gateway model catalog and default to gpt-6.2-sol ([3098c21](https://github.com/gengjiawen/os-init/commit/3098c2140f5974bc74b3f686d8ceedf301ab5af1))
|
|
9
|
+
|
|
3
10
|
## [2.2.0](https://github.com/gengjiawen/os-init/compare/v2.1.1...v2.2.0) (2026-11-17)
|
|
4
11
|
|
|
5
12
|
|
package/build/codex.js
CHANGED
|
@@ -9,22 +9,23 @@ const TOML = require("@iarna/toml");
|
|
|
9
9
|
const execa_1 = require("execa");
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
11
|
const CODEX_BASE_URL = 'https://ai.gengjiawen.com/api/openai';
|
|
12
|
+
const CODEX_MODEL_CATALOG_URL = `${CODEX_BASE_URL}/models`;
|
|
12
13
|
function getCodexConfigDir() {
|
|
13
14
|
return path.join(os.homedir(), '.codex');
|
|
14
15
|
}
|
|
15
16
|
function getCodexConfigTomlTemplate(bearerToken) {
|
|
16
17
|
return `model_provider = "jw"
|
|
17
|
-
model = "gpt-6.
|
|
18
|
+
model = "gpt-6.2-sol"
|
|
18
19
|
model_reasoning_effort = "high"
|
|
19
20
|
plan_mode_reasoning_effort = "high"
|
|
20
21
|
model_auto_compact_token_limit = 159744
|
|
21
|
-
disable_response_storage = true
|
|
22
22
|
check_for_update_on_startup = false
|
|
23
23
|
|
|
24
24
|
[model_providers.jw]
|
|
25
25
|
name = "jw"
|
|
26
26
|
base_url = "${CODEX_BASE_URL}"
|
|
27
27
|
wire_api = "responses"
|
|
28
|
+
model_catalog_url = "${CODEX_MODEL_CATALOG_URL}"
|
|
28
29
|
experimental_bearer_token = ${JSON.stringify(bearerToken)}
|
|
29
30
|
http_headers = { "x-openai-actor-authorization" = "jw" }
|
|
30
31
|
`;
|
|
@@ -59,6 +60,7 @@ function getMergedCodexConfig(existingContent, bearerToken) {
|
|
|
59
60
|
delete existingConfig.service_tier;
|
|
60
61
|
delete existingConfig.model_catalog_json;
|
|
61
62
|
delete existingConfig.preferred_auth_method;
|
|
63
|
+
delete existingConfig.disable_response_storage;
|
|
62
64
|
return TOML.stringify(mergeTomlTables(existingConfig, templateConfig));
|
|
63
65
|
}
|
|
64
66
|
function writeCodexConfig(bearerToken) {
|
package/libs/codex.test.ts
CHANGED
|
@@ -28,10 +28,12 @@ describe('writeCodexConfig', () => {
|
|
|
28
28
|
const configPath = path.join(tempHome, '.codex', 'config.toml')
|
|
29
29
|
const authPath = path.join(tempHome, '.codex', 'auth.json')
|
|
30
30
|
const config = TOML.parse(fs.readFileSync(result.configPath, 'utf8')) as {
|
|
31
|
+
model: string
|
|
31
32
|
model_auto_compact_token_limit: number
|
|
32
33
|
model_providers: {
|
|
33
34
|
jw: {
|
|
34
35
|
experimental_bearer_token: string
|
|
36
|
+
model_catalog_url: string
|
|
35
37
|
http_headers: {
|
|
36
38
|
'x-openai-actor-authorization': string
|
|
37
39
|
}
|
|
@@ -40,14 +42,19 @@ describe('writeCodexConfig', () => {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
expect(result.configPath).toBe(configPath)
|
|
45
|
+
expect(config.model).toBe('gpt-6.2-sol')
|
|
43
46
|
expect(config.model_auto_compact_token_limit).toBe(159744)
|
|
44
47
|
expect(config.model_providers.jw.experimental_bearer_token).toBe(
|
|
45
48
|
'test-api-key'
|
|
46
49
|
)
|
|
50
|
+
expect(config.model_providers.jw.model_catalog_url).toBe(
|
|
51
|
+
'https://ai.gengjiawen.com/api/openai/models'
|
|
52
|
+
)
|
|
47
53
|
expect(
|
|
48
54
|
config.model_providers.jw.http_headers['x-openai-actor-authorization']
|
|
49
55
|
).toBe('jw')
|
|
50
56
|
expect(config).not.toHaveProperty('model_catalog_json')
|
|
57
|
+
expect(config).not.toHaveProperty('disable_response_storage')
|
|
51
58
|
expect(fs.existsSync(authPath)).toBe(false)
|
|
52
59
|
})
|
|
53
60
|
|
|
@@ -95,7 +102,7 @@ custom_model = "keep-me"
|
|
|
95
102
|
expect(config).not.toHaveProperty('service_tier')
|
|
96
103
|
expect(config).not.toHaveProperty('model_catalog_json')
|
|
97
104
|
expect(config.custom_flag).toBe(true)
|
|
98
|
-
expect(config.model).toBe('gpt-6.
|
|
105
|
+
expect(config.model).toBe('gpt-6.2-sol')
|
|
99
106
|
expect(config).not.toHaveProperty('preferred_auth_method')
|
|
100
107
|
expect(config.model_providers.jw.base_url).toBe(
|
|
101
108
|
'https://ai.gengjiawen.com/api/openai'
|
|
@@ -134,7 +141,7 @@ base_url = "https://example.com"
|
|
|
134
141
|
}
|
|
135
142
|
}
|
|
136
143
|
|
|
137
|
-
expect(config.model).toBe('gpt-6.
|
|
144
|
+
expect(config.model).toBe('gpt-6.2-sol')
|
|
138
145
|
expect(config).not.toHaveProperty('model_catalog_json')
|
|
139
146
|
expect(config).not.toHaveProperty('preferred_auth_method')
|
|
140
147
|
expect(config.model_providers.jw.name).toBe('jw')
|
|
@@ -166,6 +173,34 @@ base_url = "https://example.com"
|
|
|
166
173
|
>
|
|
167
174
|
|
|
168
175
|
expect(config).not.toHaveProperty('model_catalog_json')
|
|
169
|
-
expect(config.model).toBe('gpt-6.
|
|
176
|
+
expect(config.model).toBe('gpt-6.2-sol')
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
test('drops retired keys and points the provider at the gateway catalog', () => {
|
|
180
|
+
const configDir = path.join(tempHome, '.codex')
|
|
181
|
+
fs.mkdirSync(configDir, { recursive: true })
|
|
182
|
+
const configPath = path.join(configDir, 'config.toml')
|
|
183
|
+
|
|
184
|
+
fs.writeFileSync(
|
|
185
|
+
configPath,
|
|
186
|
+
`disable_response_storage = true
|
|
187
|
+
check_for_update_on_startup = true
|
|
188
|
+
|
|
189
|
+
[model_providers.jw]
|
|
190
|
+
model_catalog_url = "https://example.com/models"
|
|
191
|
+
`
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
writeCodexConfig('test-api-key')
|
|
195
|
+
const config = TOML.parse(fs.readFileSync(configPath, 'utf8')) as {
|
|
196
|
+
check_for_update_on_startup: boolean
|
|
197
|
+
model_providers: { jw: { model_catalog_url: string } }
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
expect(config).not.toHaveProperty('disable_response_storage')
|
|
201
|
+
expect(config.check_for_update_on_startup).toBe(false)
|
|
202
|
+
expect(config.model_providers.jw.model_catalog_url).toBe(
|
|
203
|
+
'https://ai.gengjiawen.com/api/openai/models'
|
|
204
|
+
)
|
|
170
205
|
})
|
|
171
206
|
})
|
package/libs/codex.ts
CHANGED
|
@@ -8,6 +8,13 @@ import { ensureDir, commandExists, PNPM_INSTALL_ENV } from './utils'
|
|
|
8
8
|
type TomlTable = ReturnType<typeof TOML.parse>
|
|
9
9
|
|
|
10
10
|
const CODEX_BASE_URL = 'https://ai.gengjiawen.com/api/openai'
|
|
11
|
+
/**
|
|
12
|
+
* Codex falls back to synthetic model metadata (and warns every turn) when it
|
|
13
|
+
* cannot find the selected model. Point it at the gateway's catalog so per-model
|
|
14
|
+
* details such as context window and speed tiers come from the gateway.
|
|
15
|
+
* Codex rejects a catalog whose scheme, host, or port differs from base_url.
|
|
16
|
+
*/
|
|
17
|
+
const CODEX_MODEL_CATALOG_URL = `${CODEX_BASE_URL}/models`
|
|
11
18
|
|
|
12
19
|
/** Return Codex configuration directory path */
|
|
13
20
|
function getCodexConfigDir(): string {
|
|
@@ -16,17 +23,17 @@ function getCodexConfigDir(): string {
|
|
|
16
23
|
|
|
17
24
|
function getCodexConfigTomlTemplate(bearerToken: string): string {
|
|
18
25
|
return `model_provider = "jw"
|
|
19
|
-
model = "gpt-6.
|
|
26
|
+
model = "gpt-6.2-sol"
|
|
20
27
|
model_reasoning_effort = "high"
|
|
21
28
|
plan_mode_reasoning_effort = "high"
|
|
22
29
|
model_auto_compact_token_limit = 159744
|
|
23
|
-
disable_response_storage = true
|
|
24
30
|
check_for_update_on_startup = false
|
|
25
31
|
|
|
26
32
|
[model_providers.jw]
|
|
27
33
|
name = "jw"
|
|
28
34
|
base_url = "${CODEX_BASE_URL}"
|
|
29
35
|
wire_api = "responses"
|
|
36
|
+
model_catalog_url = "${CODEX_MODEL_CATALOG_URL}"
|
|
30
37
|
experimental_bearer_token = ${JSON.stringify(bearerToken)}
|
|
31
38
|
http_headers = { "x-openai-actor-authorization" = "jw" }
|
|
32
39
|
`
|
|
@@ -79,6 +86,8 @@ function getMergedCodexConfig(
|
|
|
79
86
|
delete existingConfig.service_tier
|
|
80
87
|
delete existingConfig.model_catalog_json
|
|
81
88
|
delete existingConfig.preferred_auth_method
|
|
89
|
+
// Codex 0.169 warns on every start that it ignores this retired key.
|
|
90
|
+
delete existingConfig.disable_response_storage
|
|
82
91
|
|
|
83
92
|
return TOML.stringify(mergeTomlTables(existingConfig, templateConfig))
|
|
84
93
|
}
|