feat(server): inference state-graph + supervisor, memory tools, MCP client, schema, routes

- Add state-graph.ts: typed state machine for inference lifecycle
- Add supervisor.ts: agent supervisor pattern for multi-agent coordination
- Add export-formatter.ts: structured export formatting
- Add manage_memory.ts: memory CRUD tool for agent persistence
- Add get_wiki_article.ts: codecontext wiki article retrieval
- Extend memory/index.ts: 3-tier memory (context/daily/core)
- Extend MCP client: mcp-config.ts env-var substitution
- Update schema.sql: agent_sessions, tasks, pending_changes extensions
- Update API types: MessageMetadata, ErrorReason, AgentSessionConfig
- Update routes: chats, messages, sessions — column renames and agent_session_id
- Update inference: error handler, payload builder, stream phase, turn orchestrator
This commit is contained in:
2026-06-08 03:48:47 +00:00
parent 9e2b0a7dc0
commit 381b97f78a
19 changed files with 1546 additions and 230 deletions

View File

@@ -148,6 +148,19 @@ export function getServerPermission(prefixedToolName: string): McpPermission {
return state?.permission ?? 'allow';
}
/** Override the permission for a server. Used by the approval flow. */
export function setServerPermission(serverName: string, permission: McpPermission): void {
const state = servers.get(serverName);
if (state) {
state.permission = permission;
}
}
/** Get the server name from a prefixed tool name. Returns null if not an MCP tool. */
export function getServerName(prefixedToolName: string): string | null {
return toolToServer.get(prefixedToolName) ?? null;
}
/** Return all wrapped ToolDefs from all connected servers, flattened. */
export function getTools(): ToolDef<Record<string, unknown>>[] {
const all: ToolDef<Record<string, unknown>>[] = [];