Skip to content

Your team of AI agents, on your Mac, Windows or Linux. Agents that talk in channels, write code, review each other and use your tools, on the Claude Code, Codex, OpenCode or Pi you already have. Anything that touches the real world waits for your yes.

Run agents on Gemini: a custom model id with that prefix fell back to Claude (#47)

Rayanne B. Limac7277f0955a7
diff --git a/src/shared/types.ts b/src/shared/types.ts
index e66be76..feab400 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -352,8 +352,10 @@ export const modelInfo = (id: string): Model | undefined => {
if (listed) return listed
const known = found.get(id)
if (known) return known
- const m = /^(claude|codex|opencode|pi):(.*)$/s.exec(id)
- return m ? { id: m[2]!.trim(), engine: m[1] as EngineId, label: m[2]!.trim(), hint: L('Nome próprio', 'Custom name') } : undefined
+ const engine = ENGINE_IDS.find((e) => id.startsWith(`${e}:`))
+ if (!engine) return undefined
+ const name = id.slice(engine.length + 1).trim()
+ return { id: name, engine, label: name, hint: L('Nome próprio', 'Custom name') }
}
export interface ConnectorTool {
diff --git a/test/runner.test.ts b/test/runner.test.ts
index 54821ee..11eb638 100644
--- a/test/runner.test.ts
+++ b/test/runner.test.ts
@@ -3,7 +3,7 @@ import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { beforeEach, describe, expect, it } from 'vitest'
import type { CoreEvent } from '../src/shared/rpc'
-import type { Agent, EngineId, Message, Settings } from '../src/shared/types'
+import { customModel, type Agent, type EngineId, type Message, type Settings } from '../src/shared/types'
import { Db } from '../src/core/db'
import { fakeEngine } from '../src/core/engines/fake'
import type { Engine, Turn } from '../src/core/engines/types'
@@ -357,3 +357,16 @@ describe('browser handback', () => {
expect(claude.turns).toHaveLength(0)
})
})
+
+describe('an agent on Gemini', () => {
+ it('runs on Gemini, not on Claude', async () => {
+ db.saveAgent(agent('a9', 'gi', { modelId: customModel('gemini', 'gemini/gemini-2.5-flash') }))
+ db.createConversation({ id: 'd9', kind: 'dm', name: 'a9', members: ['a9'] })
+ const gemini = counted(fakeEngine('gemini'))
+ const r = new Runner({ db, engines: { claude, codex: fakeEngine('codex'), opencode: fakeEngine('opencode'), pi: fakeEngine('pi'), gemini }, settings: async () => settings, emit: () => {}, workDir: mkdtempSync(join(tmpdir(), 'ad-gemini-')) })
+ await r.send('d9', 'oi')
+ await r.idle()
+ expect(gemini.turns.map((t) => t.model)).toEqual(['gemini/gemini-2.5-flash'])
+ expect(claude.turns).toHaveLength(0)
+ })
+})