Skip to content

Commit 5027953

Browse files
authored
Merge pull request #94 from lsm/dev
chore: release v0.5.2
2 parents 4925552 + 6dcbb61 commit 5027953

19 files changed

+126
-109
lines changed

npm/neokai/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "neokai",
3-
"version": "0.5.1",
3+
"version": "0.5.2",
44
"description": "NeoKai - Claude Agent SDK Web Interface",
55
"bin": {
66
"kai": "bin/kai.js"

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@neokai/cli",
3-
"version": "0.5.1",
3+
"version": "0.5.2",
44
"type": "module",
55
"license": "Apache-2.0",
66
"bin": {

packages/daemon/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@neokai/daemon",
3-
"version": "0.5.1",
3+
"version": "0.5.2",
44
"type": "module",
55
"license": "Apache-2.0",
66
"main": "main.ts",

packages/daemon/src/lib/agent/query-options-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class QueryOptionsBuilder {
7676

7777
// Translate model ID for SDK compatibility using provider context
7878
// FIX: Recreate context each time to pick up model changes from model switching
79-
// GLM model IDs (glm-4.7, glm-4.5-air) need to be mapped to SDK-recognized IDs
79+
// GLM model IDs (glm-5, glm-4.5-air) need to be mapped to SDK-recognized IDs
8080
// (default, haiku, opus) since the SDK only knows Anthropic model IDs
8181
const contextManager = getProviderContextManager();
8282
const providerContext = contextManager.createContext(this.ctx.session);

packages/daemon/src/lib/provider-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* - Applied to process.env by applyEnvVarsToProcess()
3232
* - Always OVERRIDE user settings to ensure provider works correctly
3333
*
34-
* This ensures that when a user selects "glm-4.7" model:
34+
* This ensures that when a user selects "glm-5" model:
3535
* - GLM's ANTHROPIC_BASE_URL points to GLM's endpoint (not user's custom Anthropic endpoint)
3636
* - GLM's API key is used (not user's Anthropic key)
3737
* - User's other custom env vars are still passed through

packages/daemon/src/lib/providers/glm-provider.ts

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,18 @@ export class GlmProvider implements Provider {
4040
* Static model definitions for GLM
4141
* These cannot be loaded dynamically from SDK
4242
*
43-
* All GLM-4.7 models have 200K context window
44-
* Source: https://llm-stats.com/models/glm-4.7
45-
* Official docs: https://docs.bigmodel.cn/cn/guide/models/text/glm-4.7
43+
* GLM-5 has 200K context window
4644
*/
4745
static readonly MODELS: ModelInfo[] = [
4846
{
49-
id: 'glm-4.7',
50-
name: 'GLM-4.7',
47+
id: 'glm-5',
48+
name: 'GLM-5',
5149
alias: 'glm',
5250
family: 'glm',
5351
provider: 'glm',
5452
contextWindow: 200000,
55-
description: 'GLM-4.7 · Coding-focused model for complex tasks',
56-
releaseDate: '2025-12-22',
53+
description: "GLM-5 · Zhipu AI's Next-Generation Frontier Model",
54+
releaseDate: '2026-02-11',
5755
available: true,
5856
},
5957
];
@@ -90,17 +88,17 @@ export class GlmProvider implements Provider {
9088
* GLM models start with 'glm-'
9189
*/
9290
ownsModel(modelId: string): boolean {
93-
return modelId.toLowerCase().startsWith('glm-');
91+
return modelId === 'glm-5' || modelId.toLowerCase().startsWith('glm-');
9492
}
9593

9694
/**
9795
* Get model for a specific tier
9896
* Maps Anthropic tiers to GLM models
99-
* All tiers use glm-4.7 (flagship model)
97+
* All tiers use glm-5 (flagship model)
10098
*/
10199
getModelForTier(_tier: ModelTier): string | undefined {
102-
// All tiers use glm-4.7
103-
return 'glm-4.7';
100+
// All tiers use glm-5
101+
return 'glm-5';
104102
}
105103

106104
/**
@@ -131,10 +129,10 @@ export class GlmProvider implements Provider {
131129
API_TIMEOUT_MS: '3000000',
132130
// Disable non-essential traffic (telemetry, etc.)
133131
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: '1',
134-
// Map all Anthropic tiers to glm-4.7
135-
ANTHROPIC_DEFAULT_HAIKU_MODEL: 'glm-4.7',
136-
ANTHROPIC_DEFAULT_SONNET_MODEL: 'glm-4.7',
137-
ANTHROPIC_DEFAULT_OPUS_MODEL: 'glm-4.7',
132+
// Map all Anthropic tiers to glm-5
133+
ANTHROPIC_DEFAULT_HAIKU_MODEL: 'glm-5',
134+
ANTHROPIC_DEFAULT_SONNET_MODEL: 'glm-5',
135+
ANTHROPIC_DEFAULT_OPUS_MODEL: 'glm-5',
138136
};
139137

140138
return {
@@ -147,21 +145,21 @@ export class GlmProvider implements Provider {
147145
/**
148146
* Translate GLM model ID to SDK-compatible ID
149147
*
150-
* GLM model IDs (glm-4.7) are not recognized by the SDK.
148+
* GLM model IDs (glm-5) are not recognized by the SDK.
151149
* The SDK only knows Anthropic model IDs: default, opus, haiku.
152150
*
153151
* Translation:
154-
* - glm-4.7 → default (flagship, balanced)
152+
* - glm-5 → default (flagship, balanced)
155153
*/
156154
translateModelIdForSdk(_modelId: string): string {
157-
return 'default'; // glm-4.7 uses 'default' (Sonnet tier)
155+
return 'default'; // glm-5 uses 'default' (Sonnet tier)
158156
}
159157

160158
/**
161159
* Get the title generation model for GLM
162-
* Uses glm-4.7
160+
* Uses glm-5
163161
*/
164162
getTitleGenerationModel(): string {
165-
return 'glm-4.7';
163+
return 'glm-5';
166164
}
167165
}

packages/daemon/tests/online/coordinator/coordinator-mode-switch.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,14 @@ describe('Coordinator Mode Switch - System Init Message', () => {
153153
let daemon: DaemonServerContext;
154154

155155
beforeEach(async () => {
156-
daemon = await createDaemonServer();
156+
daemon = await createDaemonServer({
157+
env: {
158+
GLM_API_KEY: process.env.GLM_API_KEY!,
159+
DEFAULT_PROVIDER: 'glm',
160+
CLAUDE_CODE_OAUTH_TOKEN: '',
161+
ANTHROPIC_API_KEY: '',
162+
},
163+
});
157164
}, 30000);
158165

159166
afterEach(async () => {
@@ -171,6 +178,7 @@ describe('Coordinator Mode Switch - System Init Message', () => {
171178
config: {
172179
coordinatorMode: true,
173180
permissionMode: 'acceptEdits',
181+
model: 'glm-5',
174182
},
175183
})) as { sessionId: string };
176184

@@ -214,6 +222,7 @@ describe('Coordinator Mode Switch - System Init Message', () => {
214222
config: {
215223
coordinatorMode: false,
216224
permissionMode: 'acceptEdits',
225+
model: 'glm-5',
217226
},
218227
})) as { sessionId: string };
219228

@@ -259,6 +268,7 @@ describe('Coordinator Mode Switch - System Init Message', () => {
259268
config: {
260269
coordinatorMode: true,
261270
permissionMode: 'acceptEdits',
271+
model: 'glm-5',
262272
},
263273
})) as { sessionId: string };
264274

packages/daemon/tests/online/coordinator/coordinator-tool-delegation.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,14 @@ describe('Coordinator Tool Delegation - Behavioral', () => {
9696
let testDir: string;
9797

9898
beforeEach(async () => {
99-
daemon = await createDaemonServer();
99+
daemon = await createDaemonServer({
100+
env: {
101+
GLM_API_KEY: process.env.GLM_API_KEY!,
102+
DEFAULT_PROVIDER: 'glm',
103+
CLAUDE_CODE_OAUTH_TOKEN: '',
104+
ANTHROPIC_API_KEY: '',
105+
},
106+
});
100107
testDir = join(TMP_DIR, `coordinator-delegation-test-${Date.now()}`);
101108
mkdirSync(testDir, { recursive: true });
102109
}, 30000);
@@ -121,6 +128,7 @@ describe('Coordinator Tool Delegation - Behavioral', () => {
121128
config: {
122129
coordinatorMode: true,
123130
permissionMode: 'bypassPermissions',
131+
model: 'glm-5',
124132
},
125133
})) as { sessionId: string };
126134

@@ -157,6 +165,7 @@ describe('Coordinator Tool Delegation - Behavioral', () => {
157165
config: {
158166
coordinatorMode: true,
159167
permissionMode: 'bypassPermissions',
168+
model: 'glm-5',
160169
},
161170
})) as { sessionId: string };
162171

packages/daemon/tests/online/glm/glm-provider.test.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('GLM Provider Integration', () => {
4242
const providerService = new ProviderService();
4343

4444
// GLM models start with "glm-"
45-
expect(providerService.isGlmModel('glm-4.7')).toBe(true);
45+
expect(providerService.isGlmModel('glm-5')).toBe(true);
4646
expect(providerService.isGlmModel('glm-4')).toBe(true);
4747
expect(providerService.isGlmModel('GLM-4.7')).toBe(true); // case insensitive
4848

@@ -56,7 +56,7 @@ describe('GLM Provider Integration', () => {
5656
it('should detect provider from model ID', () => {
5757
const providerService = new ProviderService();
5858

59-
expect(providerService.detectProviderFromModel('glm-4.7')).toBe('glm');
59+
expect(providerService.detectProviderFromModel('glm-5')).toBe('glm');
6060
expect(providerService.detectProviderFromModel('GLM-4')).toBe('glm');
6161
expect(providerService.detectProviderFromModel('default')).toBe('anthropic');
6262
expect(providerService.detectProviderFromModel('opus')).toBe('anthropic');
@@ -70,7 +70,7 @@ describe('GLM Provider Integration', () => {
7070
process.env.GLM_API_KEY = 'test-glm-api-key';
7171

7272
try {
73-
const envVars = providerService.getEnvVarsForModel('glm-4.7');
73+
const envVars = providerService.getEnvVarsForModel('glm-5');
7474

7575
// Verify all required env vars are set
7676
expect(envVars.ANTHROPIC_BASE_URL).toBe('https://open.bigmodel.cn/api/anthropic');
@@ -83,10 +83,10 @@ describe('GLM Provider Integration', () => {
8383
expect(envVars.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC).toBe('1');
8484
// API_TIMEOUT_MS is set for GLM (50 minutes)
8585
expect(envVars.API_TIMEOUT_MS).toBe('3000000');
86-
// Model mapping should be set (glm-4.7 maps to all tiers)
87-
expect(envVars.ANTHROPIC_DEFAULT_HAIKU_MODEL).toBe('glm-4.7');
88-
expect(envVars.ANTHROPIC_DEFAULT_SONNET_MODEL).toBe('glm-4.7');
89-
expect(envVars.ANTHROPIC_DEFAULT_OPUS_MODEL).toBe('glm-4.7');
86+
// Model mapping should be set (glm-5 maps to all tiers)
87+
expect(envVars.ANTHROPIC_DEFAULT_HAIKU_MODEL).toBe('glm-5');
88+
expect(envVars.ANTHROPIC_DEFAULT_SONNET_MODEL).toBe('glm-5');
89+
expect(envVars.ANTHROPIC_DEFAULT_OPUS_MODEL).toBe('glm-5');
9090
} finally {
9191
if (originalGlmKey !== undefined) {
9292
process.env.GLM_API_KEY = originalGlmKey;
@@ -96,15 +96,15 @@ describe('GLM Provider Integration', () => {
9696
}
9797
});
9898

99-
it('should return correct env vars for glm-4.7', () => {
99+
it('should return correct env vars for glm-5', () => {
100100
const providerService = new ProviderService();
101101

102102
// Mock GLM_API_KEY
103103
const originalGlmKey = process.env.GLM_API_KEY;
104104
process.env.GLM_API_KEY = 'test-glm-api-key';
105105

106106
try {
107-
const envVars = providerService.getEnvVarsForModel('glm-4.7');
107+
const envVars = providerService.getEnvVarsForModel('glm-5');
108108

109109
// Verify base env vars are set
110110
expect(envVars.ANTHROPIC_BASE_URL).toBe('https://open.bigmodel.cn/api/anthropic');
@@ -114,10 +114,10 @@ describe('GLM Provider Integration', () => {
114114
expect(envVars.ANTHROPIC_API_KEY).toBeUndefined();
115115
// ANTHROPIC_MODEL is NOT set - model ID is passed directly to SDK
116116
expect(envVars.ANTHROPIC_MODEL).toBeUndefined();
117-
// All tiers map to glm-4.7
118-
expect(envVars.ANTHROPIC_DEFAULT_HAIKU_MODEL).toBe('glm-4.7');
119-
expect(envVars.ANTHROPIC_DEFAULT_SONNET_MODEL).toBe('glm-4.7');
120-
expect(envVars.ANTHROPIC_DEFAULT_OPUS_MODEL).toBe('glm-4.7');
117+
// All tiers map to glm-5
118+
expect(envVars.ANTHROPIC_DEFAULT_HAIKU_MODEL).toBe('glm-5');
119+
expect(envVars.ANTHROPIC_DEFAULT_SONNET_MODEL).toBe('glm-5');
120+
expect(envVars.ANTHROPIC_DEFAULT_OPUS_MODEL).toBe('glm-5');
121121
// Extended timeout
122122
expect(envVars.API_TIMEOUT_MS).toBe('3000000');
123123
} finally {
@@ -189,7 +189,7 @@ describe('GLM Provider Integration', () => {
189189
const providerService = new ProviderService();
190190

191191
expect(await providerService.getDefaultModelForProvider('anthropic')).toBe('default');
192-
expect(await providerService.getDefaultModelForProvider('glm')).toBe('glm-4.7');
192+
expect(await providerService.getDefaultModelForProvider('glm')).toBe('glm-5');
193193
});
194194

195195
it('should validate provider switch correctly', async () => {
@@ -260,9 +260,9 @@ describe('GLM Provider Integration', () => {
260260
},
261261
// GLM models are included when GLM_API_KEY is set
262262
{
263-
id: 'glm-4.7',
263+
id: 'glm-5',
264264
name: 'GLM-4.7',
265-
alias: 'glm-4.7',
265+
alias: 'glm-5',
266266
family: 'glm' as const,
267267
provider: 'glm',
268268
contextWindow: 128000,
@@ -284,7 +284,7 @@ describe('GLM Provider Integration', () => {
284284
expect(models.length).toBe(4);
285285

286286
// Find GLM model
287-
const glmModel = models.find((m) => m.id === 'glm-4.7');
287+
const glmModel = models.find((m) => m.id === 'glm-5');
288288
expect(glmModel).toBeDefined();
289289
expect(glmModel!.name).toBe('GLM-4.7');
290290
expect(glmModel!.family).toBe('glm');
@@ -357,7 +357,7 @@ describe('GLM Provider Integration', () => {
357357
expect(models.length).toBe(3);
358358

359359
// Should NOT have GLM model
360-
const glmModel = models.find((m) => m.id === 'glm-4.7');
360+
const glmModel = models.find((m) => m.id === 'glm-5');
361361
expect(glmModel).toBeUndefined();
362362

363363
// Should have Anthropic models
@@ -394,9 +394,9 @@ describe('GLM Provider Integration', () => {
394394
description: 'Sonnet 4.5 · Best for everyday tasks',
395395
},
396396
{
397-
id: 'glm-4.7',
397+
id: 'glm-5',
398398
name: 'GLM-4.7',
399-
alias: 'glm-4.7',
399+
alias: 'glm-5',
400400
family: 'glm' as const,
401401
provider: 'glm',
402402
contextWindow: 128000,
@@ -415,7 +415,7 @@ describe('GLM Provider Integration', () => {
415415
const models = getAvailableModels('global');
416416

417417
// Should include GLM model
418-
const glmModel = models.find((m) => m.id === 'glm-4.7');
418+
const glmModel = models.find((m) => m.id === 'glm-5');
419419
expect(glmModel).toBeDefined();
420420
expect(glmModel!.name).toBe('GLM-4.7');
421421
expect(glmModel!.provider).toBe('glm');
@@ -441,7 +441,7 @@ describe('GLM Provider Integration', () => {
441441
// Create session with GLM model (model-based detection, no provider config needed)
442442
const session = createTestSession(env.testWorkspace, {
443443
config: {
444-
model: 'glm-4.7', // GLM model ID triggers env var injection
444+
model: 'glm-5', // GLM model ID triggers env var injection
445445
},
446446
});
447447

@@ -459,7 +459,7 @@ describe('GLM Provider Integration', () => {
459459
expect(options.env).toBeUndefined();
460460

461461
// The model ID is translated to SDK-recognized ID
462-
expect(options.model).toBe('default'); // glm-4.7 → default (Sonnet tier)
462+
expect(options.model).toBe('default'); // glm-5 → default (Sonnet tier)
463463
} finally {
464464
if (originalGlmKey !== undefined) {
465465
process.env.GLM_API_KEY = originalGlmKey;
@@ -474,7 +474,7 @@ describe('GLM Provider Integration', () => {
474474

475475
const session = createTestSession(env.testWorkspace, {
476476
config: {
477-
model: 'glm-4.7',
477+
model: 'glm-5',
478478
env: {
479479
// API_TIMEOUT_MS is now filtered as provider-specific var
480480
// Provider env vars are managed by the provider system, not options.env
@@ -566,7 +566,7 @@ describe('GLM Provider Integration', () => {
566566
'anthropic-version': '2023-06-01',
567567
},
568568
body: JSON.stringify({
569-
model: 'glm-4.7',
569+
model: 'glm-5',
570570
max_tokens: 100,
571571
messages: [
572572
{

0 commit comments

Comments
 (0)