@gengjiawen/os-init 2.1.1 → 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 +14 -0
- package/build/claude-code.js +3 -1
- package/build/codex.js +4 -2
- package/libs/claude-code.test.ts +3 -2
- package/libs/claude-code.ts +4 -1
- 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,19 @@
|
|
|
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
|
+
|
|
10
|
+
## [2.2.0](https://github.com/gengjiawen/os-init/compare/v2.1.1...v2.2.0) (2026-11-17)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* keep Claude sessions for 370 days and compact at 178k ([#57](https://github.com/gengjiawen/os-init/issues/57)) ([757f75b](https://github.com/gengjiawen/os-init/commit/757f75bf02063dc43ee7c0565e6e620820532ece))
|
|
16
|
+
|
|
3
17
|
## [2.1.1](https://github.com/gengjiawen/os-init/compare/v2.1.0...v2.1.1) (2026-10-08)
|
|
4
18
|
|
|
5
19
|
|
package/build/claude-code.js
CHANGED
|
@@ -9,9 +9,10 @@ const execa_1 = require("execa");
|
|
|
9
9
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
11
|
const CLAUDE_BASE_URL = 'https://ai.gengjiawen.com/api/claude/';
|
|
12
|
-
const CLAUDE_AUTO_COMPACT_WINDOW = '
|
|
12
|
+
const CLAUDE_AUTO_COMPACT_WINDOW = '178000';
|
|
13
13
|
const CLAUDE_ATTRIBUTION_HEADER = '0';
|
|
14
14
|
const CLAUDE_AUTO_MODE_SERVER = '0';
|
|
15
|
+
const CLAUDE_CLEANUP_PERIOD_DAYS = 370;
|
|
15
16
|
function getClaudeSettingsDir() {
|
|
16
17
|
return path.join(os.homedir(), '.claude');
|
|
17
18
|
}
|
|
@@ -38,6 +39,7 @@ const CLAUDE_SETTINGS_TEMPLATE = `{
|
|
|
38
39
|
"CLAUDE_CODE_AUTO_MODE_SERVER": "${CLAUDE_AUTO_MODE_SERVER}"
|
|
39
40
|
},
|
|
40
41
|
"includeCoAuthoredBy": false,
|
|
42
|
+
"cleanupPeriodDays": ${CLAUDE_CLEANUP_PERIOD_DAYS},
|
|
41
43
|
"apiKeyHelper": "echo 'API_KEY_PLACEHOLDER'",
|
|
42
44
|
"permissions": {
|
|
43
45
|
"allow": [],
|
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/claude-code.test.ts
CHANGED
|
@@ -79,12 +79,13 @@ describe('writeClaudeConfig', () => {
|
|
|
79
79
|
'"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"'
|
|
80
80
|
)
|
|
81
81
|
expect(claudeSettings).toContain(
|
|
82
|
-
'"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "
|
|
82
|
+
'"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "178000"'
|
|
83
83
|
)
|
|
84
84
|
expect(claudeSettings).not.toContain('CLAUDE_CODE_DISABLE_1M_CONTEXT')
|
|
85
85
|
expect(claudeSettings).not.toContain('CLAUDE_CODE_EFFORT_LEVEL')
|
|
86
86
|
expect(claudeSettings).toContain('"CLAUDE_CODE_ATTRIBUTION_HEADER": "0"')
|
|
87
87
|
expect(claudeSettings).toContain('"CLAUDE_CODE_AUTO_MODE_SERVER": "0"')
|
|
88
|
+
expect(claudeSettings).toContain('"cleanupPeriodDays": 370')
|
|
88
89
|
|
|
89
90
|
const vscodeSettings = fs.readFileSync(result.vscodeSettingsPath, 'utf8')
|
|
90
91
|
expect(vscodeSettings).toContain('"editor.fontSize": 14')
|
|
@@ -95,7 +96,7 @@ describe('writeClaudeConfig', () => {
|
|
|
95
96
|
'"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC"'
|
|
96
97
|
)
|
|
97
98
|
expect(vscodeSettings).toContain('"CLAUDE_CODE_AUTO_COMPACT_WINDOW"')
|
|
98
|
-
expect(vscodeSettings).toContain('"
|
|
99
|
+
expect(vscodeSettings).toContain('"178000"')
|
|
99
100
|
expect(vscodeSettings).not.toContain('CLAUDE_CODE_DISABLE_1M_CONTEXT')
|
|
100
101
|
expect(vscodeSettings).toContain('"CLAUDE_CODE_ATTRIBUTION_HEADER"')
|
|
101
102
|
expect(vscodeSettings).toContain('"CLAUDE_CODE_AUTO_MODE_SERVER"')
|
package/libs/claude-code.ts
CHANGED
|
@@ -12,11 +12,13 @@ import {
|
|
|
12
12
|
} from './utils'
|
|
13
13
|
|
|
14
14
|
const CLAUDE_BASE_URL = 'https://ai.gengjiawen.com/api/claude/'
|
|
15
|
-
const CLAUDE_AUTO_COMPACT_WINDOW = '
|
|
15
|
+
const CLAUDE_AUTO_COMPACT_WINDOW = '178000'
|
|
16
16
|
const CLAUDE_ATTRIBUTION_HEADER = '0'
|
|
17
17
|
// The gateway does not pass auto-mode server classifier checks through.
|
|
18
18
|
// Leave them off so Claude Code does not warn on every session.
|
|
19
19
|
const CLAUDE_AUTO_MODE_SERVER = '0'
|
|
20
|
+
// Claude Code deletes session transcripts older than this on its cleanup sweep.
|
|
21
|
+
const CLAUDE_CLEANUP_PERIOD_DAYS = 370
|
|
20
22
|
|
|
21
23
|
/** Return Claude settings directory path */
|
|
22
24
|
function getClaudeSettingsDir(): string {
|
|
@@ -60,6 +62,7 @@ const CLAUDE_SETTINGS_TEMPLATE = `{
|
|
|
60
62
|
"CLAUDE_CODE_AUTO_MODE_SERVER": "${CLAUDE_AUTO_MODE_SERVER}"
|
|
61
63
|
},
|
|
62
64
|
"includeCoAuthoredBy": false,
|
|
65
|
+
"cleanupPeriodDays": ${CLAUDE_CLEANUP_PERIOD_DAYS},
|
|
63
66
|
"apiKeyHelper": "echo 'API_KEY_PLACEHOLDER'",
|
|
64
67
|
"permissions": {
|
|
65
68
|
"allow": [],
|
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
|
}
|