sync: Agent Architecture Overhaul - AI SDK 6 + workflow optimization

Synced from private repo (feature/ai-sdk-6-upgrade):
- Upgrade AI SDK 5 → 6 (packages + API changes)
- Add sqliteQuery tool for flexible read-only queries
- New WorkflowExecutor with workflow-specific tools
- 83% token reduction for workflow execution
- Remove mini-rah dead code (simplified architecture)
- Add context management usage endpoint
- Fix Connect workflow instructions
- Clickable node references in workflow UI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
“BeeRad”
2026-01-12 20:59:27 +11:00
co-authored by Claude Opus 4.5
parent f9271aeeb4
commit 3f0426ecf4
27 changed files with 3607 additions and 2279 deletions
+17 -21
View File
@@ -1,8 +1,7 @@
import { getDefaultToolNamesForRole } from '@/tools/infrastructure/registry';
import { RAH_MAIN_SYSTEM_PROMPT } from '@/config/prompts/rah-main';
import { RAH_EASY_SYSTEM_PROMPT } from '@/config/prompts/rah-easy';
import { MINI_RAH_SYSTEM_PROMPT } from '@/config/prompts/rah-mini';
import { WISE_RAH_SYSTEM_PROMPT } from '@/config/prompts/wise-rah';
import { WORKFLOW_EXECUTOR_SYSTEM_PROMPT } from '@/config/prompts/workflow-executor';
import type { AgentDefinition } from './types';
/**
@@ -42,29 +41,30 @@ export class AgentRegistry {
memory: null,
prompts: undefined
},
'mini-rah': {
id: 2,
key: 'mini-rah',
displayName: 'mini ra-h',
description: 'Executor agent for delegated tasks',
model: 'openai/gpt-4o-mini',
role: 'executor',
systemPrompt: MINI_RAH_SYSTEM_PROMPT,
availableTools: getDefaultToolNamesForRole('executor'),
'workflow': {
id: 3,
key: 'workflow',
displayName: 'workflow agent',
description: 'Workflow executor (uses same model as easy mode)',
model: 'openai/gpt-5-mini',
role: 'planner',
systemPrompt: WORKFLOW_EXECUTOR_SYSTEM_PROMPT,
availableTools: getDefaultToolNamesForRole('planner'),
enabled: true,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
memory: null,
prompts: undefined
},
// Alias for backwards compatibility
'wise-rah': {
id: 3,
key: 'wise-rah',
displayName: 'wise ra-h',
description: 'Complex workflow planner and orchestrator',
model: 'openai/gpt-5',
key: 'workflow',
displayName: 'workflow agent',
description: 'Workflow executor (uses same model as easy mode)',
model: 'openai/gpt-5-mini',
role: 'planner',
systemPrompt: WISE_RAH_SYSTEM_PROMPT,
systemPrompt: WORKFLOW_EXECUTOR_SYSTEM_PROMPT,
availableTools: getDefaultToolNamesForRole('planner'),
enabled: true,
createdAt: new Date().toISOString(),
@@ -97,11 +97,7 @@ export class AgentRegistry {
return this.AGENTS['ra-h-easy'];
}
static async executor(): Promise<AgentDefinition> {
return this.AGENTS['mini-rah'];
}
static async planner(): Promise<AgentDefinition> {
return this.AGENTS['wise-rah'];
return this.AGENTS['workflow'];
}
}