Skip to content

Commit ca63e17

Browse files
authored
Free Glm 5.1!!! (#499)
1 parent caf29ef commit ca63e17

File tree

13 files changed

+123
-46
lines changed

13 files changed

+123
-46
lines changed

agents/__tests__/editor.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ describe('editor agent', () => {
6262
expect(gpt5Editor.model).toBe('openai/gpt-5.1')
6363
})
6464

65-
test('creates minimax editor', () => {
66-
const minimaxEditor = createCodeEditor({ model: 'minimax' })
67-
expect(minimaxEditor.model).toBe('minimax/minimax-m2.5')
65+
test('creates glm editor', () => {
66+
const glmEditor = createCodeEditor({ model: 'glm' })
67+
expect(glmEditor.model).toBe('z-ai/glm-5.1')
6868
})
6969

7070
test('gpt-5 editor does not include think tags in instructions', () => {
@@ -74,9 +74,9 @@ describe('editor agent', () => {
7474
})
7575

7676
test('glm editor does not include think tags in instructions', () => {
77-
const minimaxEditor = createCodeEditor({ model: 'minimax' })
78-
expect(minimaxEditor.instructionsPrompt).not.toContain('<think>')
79-
expect(minimaxEditor.instructionsPrompt).not.toContain('</think>')
77+
const glmEditor = createCodeEditor({ model: 'glm' })
78+
expect(glmEditor.instructionsPrompt).not.toContain('<think>')
79+
expect(glmEditor.instructionsPrompt).not.toContain('</think>')
8080
})
8181

8282
test('opus editor includes think tags in instructions', () => {
@@ -88,17 +88,17 @@ describe('editor agent', () => {
8888
test('all variants have same base properties', () => {
8989
const opusEditor = createCodeEditor({ model: 'opus' })
9090
const gpt5Editor = createCodeEditor({ model: 'gpt-5' })
91-
const minimaxEditor = createCodeEditor({ model: 'minimax' })
91+
const glmEditor = createCodeEditor({ model: 'glm' })
9292

9393
// All should have same basic structure
9494
expect(opusEditor.displayName).toBe(gpt5Editor.displayName)
95-
expect(gpt5Editor.displayName).toBe(minimaxEditor.displayName)
95+
expect(gpt5Editor.displayName).toBe(glmEditor.displayName)
9696

9797
expect(opusEditor.outputMode).toBe(gpt5Editor.outputMode)
98-
expect(gpt5Editor.outputMode).toBe(minimaxEditor.outputMode)
98+
expect(gpt5Editor.outputMode).toBe(glmEditor.outputMode)
9999

100100
expect(opusEditor.toolNames).toEqual(gpt5Editor.toolNames)
101-
expect(gpt5Editor.toolNames).toEqual(minimaxEditor.toolNames)
101+
expect(gpt5Editor.toolNames).toEqual(glmEditor.toolNames)
102102
})
103103
})
104104

agents/base2/base2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function createBase2(
2828

2929
return {
3030
publisher,
31-
model: isFree ? 'minimax/minimax-m2.5' : 'anthropic/claude-opus-4.6',
31+
model: isFree ? 'z-ai/glm-5.1' : 'anthropic/claude-opus-4.6',
3232
providerOptions: isFree ? {
3333
data_collection: 'deny',
3434
} : {

agents/editor/editor-lite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createCodeEditor } from './editor'
33
import type { AgentDefinition } from '../types/agent-definition'
44

55
const definition: AgentDefinition = {
6-
...createCodeEditor({ model: 'minimax' }),
6+
...createCodeEditor({ model: 'glm' }),
77
id: 'editor-lite',
88
}
99
export default definition

agents/editor/editor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import { publisher } from '../constants'
44
import type { AgentDefinition } from '../types/agent-definition'
55

66
export const createCodeEditor = (options: {
7-
model: 'gpt-5' | 'opus' | 'minimax'
7+
model: 'gpt-5' | 'opus' | 'glm'
88
}): Omit<AgentDefinition, 'id'> => {
99
const { model } = options
1010
return {
1111
publisher,
1212
model:
1313
options.model === 'gpt-5'
1414
? 'openai/gpt-5.1'
15-
: options.model === 'minimax'
16-
? 'minimax/minimax-m2.5'
15+
: options.model === 'glm'
16+
? 'z-ai/glm-5.1'
1717
: 'anthropic/claude-opus-4.6',
1818
...(options.model === 'opus' && {
1919
providerOptions: {
@@ -65,7 +65,7 @@ OR for new files or major rewrites:
6565
}
6666
</codebuff_tool_call>
6767
68-
${model === 'gpt-5' || model === 'minimax'
68+
${model === 'gpt-5' || model === 'glm'
6969
? ''
7070
: `Before you start writing your implementation, you should use <think> tags to think about the best way to implement the changes.
7171

agents/reviewer/code-reviewer-lite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createReviewer } from './code-reviewer'
55
const definition: SecretAgentDefinition = {
66
id: 'code-reviewer-lite',
77
publisher,
8-
...createReviewer('minimax/minimax-m2.5'),
8+
...createReviewer('z-ai/glm-5.1'),
99
}
1010

1111
export default definition

agents/types/agent-definition.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ export type ModelName =
424424
| 'moonshotai/kimi-k2.5'
425425
| 'moonshotai/kimi-k2.5:nitro'
426426
| 'z-ai/glm-5'
427+
| 'z-ai/glm-5.1'
427428
| 'z-ai/glm-4.6'
428429
| 'z-ai/glm-4.6:nitro'
429430
| 'z-ai/glm-4.7'

cli/src/components/choice-ad-banner.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const ChoiceAdBanner: React.FC<ChoiceAdBannerProps> = ({ ads, onImpressio
7070
}
7171
}, [visibleAds, onImpression])
7272

73-
const hoverBorderColor = theme.link
73+
const hoverBorderColor = theme.primary
7474

7575
return (
7676
<box
@@ -124,7 +124,7 @@ export const ChoiceAdBanner: React.FC<ChoiceAdBannerProps> = ({ ads, onImpressio
124124
<text
125125
style={{
126126
fg: theme.name === 'light' ? '#ffffff' : theme.background,
127-
bg: isHovered ? theme.link : theme.muted,
127+
bg: isHovered ? theme.primary : theme.muted,
128128
attributes: TextAttributes.BOLD,
129129
}}
130130
>

cli/src/utils/create-run-config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import path from 'path'
22

3+
import { MAX_AGENT_STEPS_DEFAULT } from '@codebuff/common/constants/agents'
4+
35
import {
46
createEventHandler,
57
createStreamChunkHandler,
@@ -109,7 +111,7 @@ export const createRunConfig = (params: CreateRunConfigParams) => {
109111
content,
110112
previousRun: previousRunState ?? undefined,
111113
agentDefinitions,
112-
maxAgentSteps: 100,
114+
maxAgentSteps: MAX_AGENT_STEPS_DEFAULT,
113115
handleStreamChunk: createStreamChunkHandler(eventHandlerState),
114116
handleEvent: createEventHandler(eventHandlerState),
115117
signal: params.signal,

common/src/constants/agents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ export const AGENT_NAME_TO_TYPES = Object.entries(AGENT_NAMES).reduce(
9292
{} as Record<string, string[]>,
9393
)
9494

95-
export const MAX_AGENT_STEPS_DEFAULT = 100
95+
export const MAX_AGENT_STEPS_DEFAULT = 200

common/src/constants/free-agents.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const FREE_COST_MODE = 'free' as const
1818
*/
1919
export const FREE_MODE_AGENT_MODELS: Record<string, Set<string>> = {
2020
// Root orchestrator
21-
'base2-free': new Set(['minimax/minimax-m2.5']),
21+
'base2-free': new Set(['minimax/minimax-m2.5', 'z-ai/glm-5.1']),
2222

2323
// File exploration agents
2424
'file-picker': new Set(['google/gemini-2.5-flash-lite']),
@@ -33,10 +33,10 @@ export const FREE_MODE_AGENT_MODELS: Record<string, Set<string>> = {
3333
'basher': new Set(['google/gemini-3.1-flash-lite-preview']),
3434

3535
// Editor for free mode
36-
'editor-lite': new Set(['minimax/minimax-m2.5']),
36+
'editor-lite': new Set(['minimax/minimax-m2.5', 'z-ai/glm-5.1']),
3737

3838
// Code reviewer for free mode
39-
'code-reviewer-lite': new Set(['minimax/minimax-m2.5']),
39+
'code-reviewer-lite': new Set(['minimax/minimax-m2.5', 'z-ai/glm-5.1']),
4040

4141
// Thinker for free mode
4242
'thinker-with-files-gemini': new Set(['google/gemini-3.1-pro-preview']),

0 commit comments

Comments
 (0)