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
23 changes: 23 additions & 0 deletions agents/__tests__/base2.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { describe, expect, test } from 'bun:test'

import {
FREEBUFF_DEEPSEEK_V4_PRO_MODEL_ID,
FREEBUFF_KIMI_MODEL_ID,
FREEBUFF_MINIMAX_MODEL_ID,
} from '@codebuff/common/constants/freebuff-models'

import { createBase2 } from '../base2/base2'

describe('base2 reviewer selection', () => {
test.each([
[FREEBUFF_MINIMAX_MODEL_ID, 'code-reviewer-minimax'],
[FREEBUFF_KIMI_MODEL_ID, 'code-reviewer-kimi'],
[FREEBUFF_DEEPSEEK_V4_PRO_MODEL_ID, 'code-reviewer-deepseek'],
])('uses matching reviewer for model %p', (model, expectedReviewer) => {
const base2 = createBase2('free', { model })

expect(base2.spawnableAgents).toContain(expectedReviewer)
expect(base2.instructionsPrompt).toContain(`Spawn a ${expectedReviewer}`)
expect(base2.stepPrompt).toContain(`spawn a ${expectedReviewer}`)
})
})
1 change: 0 additions & 1 deletion agents/base2/base2-free-deepseek.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const definition = {
...createBase2('free', {
noAskUser: true,
model: FREEBUFF_DEEPSEEK_V4_PRO_MODEL_ID,
freeCodeReviewerAgentId: 'code-reviewer-deepseek',
}),
id: 'base2-free-deepseek',
displayName: 'Buffy the DeepSeek Free Orchestrator',
Expand Down
1 change: 0 additions & 1 deletion agents/base2/base2-free-kimi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { createBase2 } from './base2'
const definition = {
...createBase2('free', {
model: FREEBUFF_KIMI_MODEL_ID,
freeCodeReviewerAgentId: 'code-reviewer-kimi',
}),
id: 'base2-free-kimi',
displayName: 'Buffy the Kimi Free Orchestrator',
Expand Down
4 changes: 1 addition & 3 deletions agents/base2/base2-free.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { createBase2 } from './base2'

const definition = {
...createBase2('free', {
freeCodeReviewerAgentId: 'code-reviewer-minimax',
}),
...createBase2('free'),
id: 'base2-free',
displayName: 'Buffy the Free Orchestrator',
}
Expand Down
5 changes: 3 additions & 2 deletions agents/base2/base2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
FREEBUFF_GEMINI_THINKER_STEP_PROMPT,
FREEBUFF_GEMINI_THINKER_SYSTEM_INSTRUCTION,
} from '@codebuff/common/constants/freebuff-gemini-thinker'
import { FREEBUFF_REVIEWER_AGENT_ID_BY_MODEL } from '@codebuff/common/constants/free-agents'
import {
canFreebuffModelSpawnGeminiThinker,
FREEBUFF_MINIMAX_MODEL_ID,
Expand All @@ -24,7 +25,6 @@ export function createBase2(
noAskUser?: boolean
model?: SecretAgentDefinition['model']
providerOptions?: SecretAgentDefinition['providerOptions']
freeCodeReviewerAgentId?: string
},
): Omit<SecretAgentDefinition, 'id'> {
const {
Expand All @@ -33,7 +33,6 @@ export function createBase2(
noAskUser = false,
model: modelOverride,
providerOptions,
freeCodeReviewerAgentId = 'code-reviewer-lite',
} = options ?? {}
const isDefault = mode === 'default'
const isFast = mode === 'fast'
Expand All @@ -56,6 +55,8 @@ export function createBase2(
// reasoning. Fast MiniMax omits the extra round trip by construction.
const hasFreeGeminiThinker =
isFree && canFreebuffModelSpawnGeminiThinker(model)
const freeCodeReviewerAgentId =
FREEBUFF_REVIEWER_AGENT_ID_BY_MODEL[model] ?? 'code-reviewer-lite'
const defaultProviderOptions = isFree
? {
data_collection: 'deny' as const,
Expand Down
Loading