feat(v3): implement session continuity, workspace teardown, StatusBar rewrite, subagent routing fix

P6: persistSessionForProject() saves agent state + messages to SQLite on
session complete. registerSessionProject() maps sessionId -> projectId.
ClaudeSession restoreMessagesFromRecords() restores cached messages on mount.

P7: clearAllAgentSessions() clears sessions on group switch. switchGroup()
calls clearAllAgentSessions() + resets terminal tabs.

P10: StatusBar rewritten for workspace store (group name, project count,
agent count, "BTerminal v3"). Subagent routing fixed: project-scoped
sessions skip layout pane creation (render in TeamAgentsPanel instead).
This commit is contained in:
Hibryda 2026-03-07 16:33:27 +01:00
parent 9766a480ed
commit e0056f811f
5 changed files with 156 additions and 31 deletions

View file

@ -130,6 +130,10 @@ export function getTotalCost(id: string): { costUsd: number; inputTokens: number
return { costUsd, inputTokens, outputTokens };
}
export function clearAllAgentSessions(): void {
sessions = [];
}
export function removeAgentSession(id: string): void {
// Also remove from parent's childSessionIds
const session = sessions.find(s => s.id === id);

View file

@ -1,5 +1,6 @@
import { loadGroups, saveGroups, getCliGroup } from '../adapters/groups-bridge';
import type { GroupsFile, GroupConfig, ProjectConfig } from '../types/groups';
import { clearAllAgentSessions } from '../stores/agents.svelte';
export type WorkspaceTab = 'sessions' | 'docs' | 'context' | 'settings';
@ -66,8 +67,9 @@ export function setActiveProject(projectId: string | null): void {
export async function switchGroup(groupId: string): Promise<void> {
if (groupId === activeGroupId) return;
// Clear terminal tabs for the old group
// Teardown: clear terminal tabs and agent sessions for the old group
projectTerminals = new Map();
clearAllAgentSessions();
activeGroupId = groupId;
activeProjectId = null;