feat(FN-1800): merge fusion/fn-1800

This commit is contained in:
gsxdsm
2026-04-15 04:45:56 -07:00
parent 3f61d6433d
commit 14f7ab559d
15 changed files with 175 additions and 146 deletions

View File

@@ -50,7 +50,16 @@ export type SubtaskStreamCallback = (event: SubtaskStreamEvent, eventId?: number
const SESSION_TTL_MS = 7 * 24 * 60 * 60 * 1000;
const CLEANUP_INTERVAL_MS = 5 * 60 * 1000;
const sessions = new Map<string, SubtaskSession & { updatedAt: Date; agent?: any; thinkingOutput: string }>();
/** Minimal interface for the agent object created by createKbAgent */
interface SubtaskAgent {
session: {
dispose?: () => void;
prompt: (input: string) => Promise<unknown>;
state: { messages: Array<{ role: string; content?: string | Array<{ type: string; text: string }> }> };
};
}
const sessions = new Map<string, SubtaskSession & { updatedAt: Date; agent?: SubtaskAgent; thinkingOutput: string }>();
// ── AI Session Persistence ────────────────────────────────────────────────
@@ -69,7 +78,7 @@ export function setAiSessionStore(store: AiSessionStore): void {
_aiSessionStore.on("ai_session:deleted", _aiSessionDeletedListener);
}
type SubtaskInternalSession = SubtaskSession & { updatedAt: Date; agent?: any; thinkingOutput: string; projectId?: string };
type SubtaskInternalSession = SubtaskSession & { updatedAt: Date; agent?: SubtaskAgent; thinkingOutput: string; projectId?: string };
function safeParseJson<T>(
text: string | null,