feat: simplify subagent model configuration with model selector

Refactor subagent model configuration from nested modelConfig object to a simple model string field for better UX and clarity.

Changes:
- Replace modelConfig object with model string in SubagentConfig interface
- Add model-selection.ts utility for parsing and validating model selectors
- Support 'inherit' keyword and bare model IDs (e.g., 'glm-5', 'claude-sonnet-4-6')
- Maintain backward compatibility by parsing legacy modelConfig frontmatter
- Update validation to reject cross-provider authType-prefixed selectors
- Update SDK types (TypeScript and Java) to reflect new schema
- Add comprehensive tests for model selection and validation
- Update documentation with model selection examples

Breaking changes:
- modelConfig.frontmatter field deprecated in favor of model field
- Cross-provider model selectors (e.g., 'openai:gpt-4') not supported for subagents

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
tanzhenxin 2026-03-27 11:49:45 +08:00
parent 3776825c2d
commit 5d58b2f112
17 changed files with 372 additions and 207 deletions

View file

@ -534,12 +534,6 @@ export function isToolResultBlock(block: any): block is ToolResultBlock {
export type SubagentLevel = 'session';
export interface ModelConfig {
model?: string;
temp?: number;
top_p?: number;
}
export interface RunConfig {
max_time_minutes?: number;
max_turns?: number;
@ -552,7 +546,7 @@ export interface SubagentConfig {
systemPrompt: string;
level: SubagentLevel;
filePath?: string;
modelConfig?: Partial<ModelConfig>;
model?: string;
runConfig?: Partial<RunConfig>;
color?: string;
readonly isBuiltin?: boolean;