feat: implement model persistence with per-session overrides

- Add session_config SQLite table for per-session settings
- Update routing to support session override → agent config → global default resolution chain
- Upgrade WebChat SessionBridge from NativeAgent to AgentOrchestrator
- Add /model, /local, /cloud commands to Telegram adapter
- Add /model command to WebChat gateway handlers
- Clear session overrides on /reset command
- Pass memoryStore and config through to SessionBridge
- Add comprehensive tests for all new functionality

Fixes model persistence bug where TUI model changes didn't affect WebChat/Telegram sessions. Now:
- TUI /model sets global default (persists across restarts, affects all new sessions)
- WebChat/Telegram /model sets session override (only that conversation, cleared on /reset)
- WebChat sessions gain AgentOrchestrator features (delegation, compaction, memory)
This commit is contained in:
William Valentin
2026-02-11 21:51:38 -08:00
parent b0092c8284
commit a8a2c59313
12 changed files with 1175 additions and 46 deletions
+3
View File
@@ -13,6 +13,7 @@ import { SkillRegistry, SkillInstaller, loadAllSkills } from '../skills/index.js
import { assembleSystemPrompt } from '../prompt/index.js';
import { resolve } from 'path';
import { homedir } from 'os';
import type { MemoryStore } from '../memory/store.js';
// ── Skills ──────────────────────────────────────────────────────
@@ -121,6 +122,7 @@ export interface GatewayDeps {
pairingManager?: PairingManager;
lifecycle: Lifecycle;
getChannelAgents: () => Map<string, { orchestrator: AgentOrchestrator; collector: OutboundAttachmentCollector }> | null;
memoryStore?: MemoryStore;
}
export function createGateway(deps: GatewayDeps): GatewayServer {
@@ -144,6 +146,7 @@ export function createGateway(deps: GatewayDeps): GatewayServer {
config,
channelRegistry,
pairingManager,
memoryStore: deps.memoryStore,
restart: async () => {
console.log('Restart requested via gateway');
await lifecycle.shutdown();