@gengjiawen/os-init 2.1.0 → 2.2.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 +10 -2
- package/libs/claude-code.test.ts +5 -2
- package/libs/claude-code.ts +13 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.2.0](https://github.com/gengjiawen/os-init/compare/v2.1.1...v2.2.0) (2026-11-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* 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))
|
|
9
|
+
|
|
10
|
+
## [2.1.1](https://github.com/gengjiawen/os-init/compare/v2.1.0...v2.1.1) (2026-10-08)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* stop Claude Code auto-mode classifier warning on the gateway ([#55](https://github.com/gengjiawen/os-init/issues/55)) ([8f2470f](https://github.com/gengjiawen/os-init/commit/8f2470fbbfeb5d0e369b491285d2f97d70294dc6))
|
|
16
|
+
|
|
3
17
|
## [2.1.0](https://github.com/gengjiawen/os-init/compare/v2.0.0...v2.1.0) (2026-09-30)
|
|
4
18
|
|
|
5
19
|
|
package/build/claude-code.js
CHANGED
|
@@ -9,8 +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
|
+
const CLAUDE_AUTO_MODE_SERVER = '0';
|
|
15
|
+
const CLAUDE_CLEANUP_PERIOD_DAYS = 370;
|
|
14
16
|
function getClaudeSettingsDir() {
|
|
15
17
|
return path.join(os.homedir(), '.claude');
|
|
16
18
|
}
|
|
@@ -33,9 +35,11 @@ const CLAUDE_SETTINGS_TEMPLATE = `{
|
|
|
33
35
|
"ANTHROPIC_BASE_URL": "${CLAUDE_BASE_URL}",
|
|
34
36
|
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
|
|
35
37
|
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "${CLAUDE_AUTO_COMPACT_WINDOW}",
|
|
36
|
-
"CLAUDE_CODE_ATTRIBUTION_HEADER": "${CLAUDE_ATTRIBUTION_HEADER}"
|
|
38
|
+
"CLAUDE_CODE_ATTRIBUTION_HEADER": "${CLAUDE_ATTRIBUTION_HEADER}",
|
|
39
|
+
"CLAUDE_CODE_AUTO_MODE_SERVER": "${CLAUDE_AUTO_MODE_SERVER}"
|
|
37
40
|
},
|
|
38
41
|
"includeCoAuthoredBy": false,
|
|
42
|
+
"cleanupPeriodDays": ${CLAUDE_CLEANUP_PERIOD_DAYS},
|
|
39
43
|
"apiKeyHelper": "echo 'API_KEY_PLACEHOLDER'",
|
|
40
44
|
"permissions": {
|
|
41
45
|
"allow": [],
|
|
@@ -75,6 +79,10 @@ function writeVSCodeClaudePluginConfig(apiKey) {
|
|
|
75
79
|
name: 'CLAUDE_CODE_ATTRIBUTION_HEADER',
|
|
76
80
|
value: CLAUDE_ATTRIBUTION_HEADER,
|
|
77
81
|
},
|
|
82
|
+
{
|
|
83
|
+
name: 'CLAUDE_CODE_AUTO_MODE_SERVER',
|
|
84
|
+
value: CLAUDE_AUTO_MODE_SERVER,
|
|
85
|
+
},
|
|
78
86
|
], {
|
|
79
87
|
formattingOptions: {
|
|
80
88
|
insertSpaces: true,
|
package/libs/claude-code.test.ts
CHANGED
|
@@ -79,11 +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
|
+
expect(claudeSettings).toContain('"CLAUDE_CODE_AUTO_MODE_SERVER": "0"')
|
|
88
|
+
expect(claudeSettings).toContain('"cleanupPeriodDays": 370')
|
|
87
89
|
|
|
88
90
|
const vscodeSettings = fs.readFileSync(result.vscodeSettingsPath, 'utf8')
|
|
89
91
|
expect(vscodeSettings).toContain('"editor.fontSize": 14')
|
|
@@ -94,9 +96,10 @@ describe('writeClaudeConfig', () => {
|
|
|
94
96
|
'"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC"'
|
|
95
97
|
)
|
|
96
98
|
expect(vscodeSettings).toContain('"CLAUDE_CODE_AUTO_COMPACT_WINDOW"')
|
|
97
|
-
expect(vscodeSettings).toContain('"
|
|
99
|
+
expect(vscodeSettings).toContain('"178000"')
|
|
98
100
|
expect(vscodeSettings).not.toContain('CLAUDE_CODE_DISABLE_1M_CONTEXT')
|
|
99
101
|
expect(vscodeSettings).toContain('"CLAUDE_CODE_ATTRIBUTION_HEADER"')
|
|
102
|
+
expect(vscodeSettings).toContain('"CLAUDE_CODE_AUTO_MODE_SERVER"')
|
|
100
103
|
expect(vscodeSettings).toContain('"0"')
|
|
101
104
|
expect(vscodeSettings).toContain('"1"')
|
|
102
105
|
expect(vscodeSettings).toContain('"test-api-key"')
|
package/libs/claude-code.ts
CHANGED
|
@@ -12,8 +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
|
+
// The gateway does not pass auto-mode server classifier checks through.
|
|
18
|
+
// Leave them off so Claude Code does not warn on every session.
|
|
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
|
|
17
22
|
|
|
18
23
|
/** Return Claude settings directory path */
|
|
19
24
|
function getClaudeSettingsDir(): string {
|
|
@@ -53,9 +58,11 @@ const CLAUDE_SETTINGS_TEMPLATE = `{
|
|
|
53
58
|
"ANTHROPIC_BASE_URL": "${CLAUDE_BASE_URL}",
|
|
54
59
|
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
|
|
55
60
|
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "${CLAUDE_AUTO_COMPACT_WINDOW}",
|
|
56
|
-
"CLAUDE_CODE_ATTRIBUTION_HEADER": "${CLAUDE_ATTRIBUTION_HEADER}"
|
|
61
|
+
"CLAUDE_CODE_ATTRIBUTION_HEADER": "${CLAUDE_ATTRIBUTION_HEADER}",
|
|
62
|
+
"CLAUDE_CODE_AUTO_MODE_SERVER": "${CLAUDE_AUTO_MODE_SERVER}"
|
|
57
63
|
},
|
|
58
64
|
"includeCoAuthoredBy": false,
|
|
65
|
+
"cleanupPeriodDays": ${CLAUDE_CLEANUP_PERIOD_DAYS},
|
|
59
66
|
"apiKeyHelper": "echo 'API_KEY_PLACEHOLDER'",
|
|
60
67
|
"permissions": {
|
|
61
68
|
"allow": [],
|
|
@@ -113,6 +120,10 @@ function writeVSCodeClaudePluginConfig(apiKey: string): {
|
|
|
113
120
|
name: 'CLAUDE_CODE_ATTRIBUTION_HEADER',
|
|
114
121
|
value: CLAUDE_ATTRIBUTION_HEADER,
|
|
115
122
|
},
|
|
123
|
+
{
|
|
124
|
+
name: 'CLAUDE_CODE_AUTO_MODE_SERVER',
|
|
125
|
+
value: CLAUDE_AUTO_MODE_SERVER,
|
|
126
|
+
},
|
|
116
127
|
],
|
|
117
128
|
{
|
|
118
129
|
formattingOptions: {
|