返回 html-video
registry.ts
根目录 / packages / runtime / src / registry.ts
1 import { anthropicApi } from './defs/anthropic-api.js';
2 import { claude } from './defs/claude.js';
3 import { cursorAgent } from './defs/cursor-agent.js';
4 import { codex } from './defs/codex.js';
5 import { hermes } from './defs/hermes.js';
6 import { amr } from './defs/amr.js';
7 import { gemini } from './defs/gemini.js';
8 import { grok } from './defs/grok.js';
9 import { qwen } from './defs/qwen.js';
10 import { opencode } from './defs/opencode.js';
11 import { copilot } from './defs/copilot.js';
12 import { aider } from './defs/aider.js';
13 import { traeCli } from './defs/trae-cli.js';
14 import { qoderCli } from './defs/qoder.js';
15 import type { AgentDef } from './types.js';
16
17 /**
18 * Built-in agent definitions. Order matters: the first one in the list is
19 * the default selection in the studio composer.
20 *
21 * Default = anthropic-api (HTTP / Messages API), because the local
22 * `claude --print` CLI has a non-deterministic 1-byte-empty-reply mode on
23 * long creative outputs (verified 2026-05-28). Direct API doesn't.
24 */
25 // AMR first — it's the recommended option (one login, many models, lower cost),
26 // so it leads the picker. Default SELECTION still falls back to the first
27 // *available* agent (see studio currentId logic), so an un-logged-in AMR up top
28 // won't strand a new project without a working agent.
29 export const AGENT_DEFS: AgentDef[] = [
30 amr,
31 anthropicApi,
32 traeCli,
33 claude,
34 cursorAgent,
35 codex,
36 hermes,
37 gemini,
38 grok,
39 qwen,
40 opencode,
41 copilot,
42 aider,
43 qoderCli,
44 ];
45
46 export function findAgent(id: string): AgentDef | undefined {
47 return AGENT_DEFS.find((a) => a.id === id);
48 }
49
49 lines TYPESCRIPT