feat(FN-4583): complete Step 2 — expose engine chat store accessor

Fusion-Task-Id: FN-4583
Fusion-Task-Lineage: 4d9b088d-a705-4376-b547-15b37e5370aa
This commit is contained in:
Fusion
2026-05-15 01:59:43 -07:00
committed by gsxdsm
parent a24d601b86
commit 8b5e467f5c
3 changed files with 21 additions and 0 deletions

View File

@@ -8,4 +8,12 @@ describe("InProcessRuntime onStart duplicate guard", () => {
expect(source).toContain("if (this.taskAgentMap.has(task.id))");
expect(source).toContain("Skipping task-worker creation for");
});
it("exposes getChatStore and wires HeartbeatMonitor to the runtime chatStore instance", () => {
const source = readFileSync(join(process.cwd(), "src/runtimes/in-process-runtime.ts"), "utf-8");
expect(source).toContain("this.chatStore ??= new ChatStore(this.taskStore.getFusionDir(), this.taskStore.getDatabase());");
expect(source).toContain("chatStore: this.chatStore,");
expect(source).toContain("getChatStore(): import(\"@fusion/core\").ChatStore | undefined {");
expect(source).toContain("return this.chatStore;");
});
});

View File

@@ -612,6 +612,11 @@ export class ProjectEngine {
return this.runtime.getMessageStore();
}
/** Get the ChatStore (if initialized). Returns undefined before start(). */
getChatStore(): import("@fusion/core").ChatStore | undefined {
return this.runtime.getChatStore();
}
attachChatStore(chatStore: NotificationChatStore): void {
this.notificationService?.attachChatStore(chatStore);
}

View File

@@ -1004,6 +1004,14 @@ export class InProcessRuntime
return this.messageStore;
}
/**
* Get the ChatStore instance (if initialized).
* Returns undefined before start() or if initialization fails.
*/
getChatStore(): import("@fusion/core").ChatStore | undefined {
return this.chatStore;
}
/**
* Get the project's Scheduler instance.
* @throws Error if runtime has not been started