Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .agents/types/agent-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ export type ModelName =
// Other open source models
| 'moonshotai/kimi-k2'
| 'moonshotai/kimi-k2:nitro'
| 'moonshotai/kimi-k2.5'
| 'moonshotai/kimi-k2.5:nitro'
| 'moonshotai/kimi-k2.6'
| 'z-ai/glm-5'
| 'z-ai/glm-4.6'
| 'z-ai/glm-4.6:nitro'
Expand Down
72 changes: 45 additions & 27 deletions agents/__tests__/editor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import editor, { createCodeEditor } from '../editor/editor'
import type { AgentState, ToolCall } from '../types/agent-definition'

describe('editor agent', () => {
const createMockAgentState = (
messageHistory: any[] = [],
): AgentState => ({
const createMockAgentState = (messageHistory: any[] = []): AgentState => ({
agentId: 'editor-test',
runId: 'test-run',
parentId: undefined,
Expand Down Expand Up @@ -67,6 +65,11 @@ describe('editor agent', () => {
expect(glmEditor.model).toBe('z-ai/glm-5.1')
})

test('creates kimi editor', () => {
const kimiEditor = createCodeEditor({ model: 'kimi' })
expect(kimiEditor.model).toBe('moonshotai/kimi-k2.6')
})

test('creates minimax editor', () => {
const minimaxEditor = createCodeEditor({ model: 'minimax' })
expect(minimaxEditor.model).toBe('minimax/minimax-m2.7')
Expand All @@ -84,6 +87,12 @@ describe('editor agent', () => {
expect(glmEditor.instructionsPrompt).not.toContain('</think>')
})

test('kimi editor does not include think tags in instructions', () => {
const kimiEditor = createCodeEditor({ model: 'kimi' })
expect(kimiEditor.instructionsPrompt).not.toContain('<think>')
expect(kimiEditor.instructionsPrompt).not.toContain('</think>')
})

test('minimax editor does not include think tags in instructions', () => {
const minimaxEditor = createCodeEditor({ model: 'minimax' })
expect(minimaxEditor.instructionsPrompt).not.toContain('<think>')
Expand Down Expand Up @@ -171,10 +180,10 @@ describe('editor agent', () => {
]
const mockAgentState = createMockAgentState(initialMessages)
const mockLogger = {
debug: () => { },
info: () => { },
warn: () => { },
error: () => { },
debug: () => {},
info: () => {},
warn: () => {},
error: () => {},
}

const generator = editor.handleSteps!({
Expand All @@ -194,10 +203,10 @@ describe('editor agent', () => {
]
const mockAgentState = createMockAgentState(initialMessages)
const mockLogger = {
debug: () => { },
info: () => { },
warn: () => { },
error: () => { },
debug: () => {},
info: () => {},
warn: () => {},
error: () => {},
}

const generator = editor.handleSteps!({
Expand Down Expand Up @@ -238,10 +247,10 @@ describe('editor agent', () => {
]
const mockAgentState = createMockAgentState(initialMessages)
const mockLogger = {
debug: () => { },
info: () => { },
warn: () => { },
error: () => { },
debug: () => {},
info: () => {},
warn: () => {},
error: () => {},
}

const generator = editor.handleSteps!({
Expand Down Expand Up @@ -271,7 +280,9 @@ describe('editor agent', () => {
input: { output: { messages: any[] } }
}
expect(toolCall.input.output.messages).toHaveLength(3)
expect(toolCall.input.output.messages[0].content[0].text).toBe('Message 2')
expect(toolCall.input.output.messages[0].content[0].text).toBe(
'Message 2',
)
})

test('handleSteps can be serialized for sandbox execution', () => {
Expand All @@ -289,10 +300,10 @@ describe('editor agent', () => {
const initialMessages: any[] = []
const mockAgentState = createMockAgentState(initialMessages)
const mockLogger = {
debug: () => { },
info: () => { },
warn: () => { },
error: () => { },
debug: () => {},
info: () => {},
warn: () => {},
error: () => {},
}

const generator = editor.handleSteps!({
Expand All @@ -303,7 +314,9 @@ describe('editor agent', () => {

generator.next()

const newMessages = [{ role: 'assistant', content: [{ type: 'text', text: 'Done' }] }]
const newMessages = [
{ role: 'assistant', content: [{ type: 'text', text: 'Done' }] },
]
const updatedState = createMockAgentState(newMessages)

const result = generator.next({
Expand All @@ -316,7 +329,9 @@ describe('editor agent', () => {
toolName: 'set_output',
input: {
output: {
messages: [{ role: 'assistant', content: [{ type: 'text', text: 'Done' }] }],
messages: [
{ role: 'assistant', content: [{ type: 'text', text: 'Done' }] },
],
},
},
includeToolCall: false,
Expand All @@ -326,10 +341,10 @@ describe('editor agent', () => {
test('works with empty initial message history', () => {
const mockAgentState = createMockAgentState([])
const mockLogger = {
debug: () => { },
info: () => { },
warn: () => { },
error: () => { },
debug: () => {},
info: () => {},
warn: () => {},
error: () => {},
}

const generator = editor.handleSteps!({
Expand All @@ -341,7 +356,10 @@ describe('editor agent', () => {
generator.next()

const newMessages = [
{ role: 'assistant', content: [{ type: 'text', text: 'First response' }] },
{
role: 'assistant',
content: [{ type: 'text', text: 'First response' }],
},
]
const updatedState = createMockAgentState(newMessages)

Expand Down
Loading
Loading