diff --git a/lib/kernel.js b/lib/kernel.js index 19efc60..0a58009 100644 --- a/lib/kernel.js +++ b/lib/kernel.js @@ -20,7 +20,7 @@ */ import { join, resolve } from 'node:path'; import { CloudClient } from "./api.js"; -import { LocalMemoryManager, LocalMemoryRemote } from "./local-memory/index.js"; +import { DepartmentManager, LocalMemoryManager, LocalMemoryRemote } from "./local-memory/index.js"; import { VERSION } from "./version.js"; import { createCloudMemoryRemoteFactory } from "./cloudsync.js"; import { ClientRegistry } from "./clients.js"; @@ -59,6 +59,7 @@ export class BrainKernel { memoryRemoteFactory; localMemory; localMemoryRemote; + departments; reporter; skillAdmin; skillRepository; @@ -99,6 +100,7 @@ export class BrainKernel { }), }); this.localMemoryRemote = new LocalMemoryRemote(this.localMemory); + this.departments = new DepartmentManager({ memory: this.localMemory }); // The global space is part of first boot; project space stays lazy until // the first memory use in that project. if (settings().localMemoryEnabled !== false && settings().autoMemorySpaces !== false) @@ -273,6 +275,7 @@ export class BrainKernel { clients: skills ? this.clients : undefined, mcp: this.isActive('mcp'), localMemory: this.localMemory, + departments: this.departments, }; } } diff --git a/src/kernel.ts b/src/kernel.ts index 1d777c9..1f0afd9 100644 --- a/src/kernel.ts +++ b/src/kernel.ts @@ -20,7 +20,7 @@ */ import { join, resolve } from 'node:path' import { CloudClient } from './api.ts' -import { LocalMemoryManager, LocalMemoryRemote } from './local-memory/index.ts' +import { DepartmentManager, LocalMemoryManager, LocalMemoryRemote } from './local-memory/index.ts' import { VERSION } from './version.ts' import { createCloudMemoryRemoteFactory } from './cloudsync.ts' import { ClientRegistry } from './clients.ts' @@ -72,6 +72,7 @@ export class BrainKernel { readonly memoryRemoteFactory: ReturnType readonly localMemory: LocalMemoryManager readonly localMemoryRemote: LocalMemoryRemote + readonly departments: DepartmentManager readonly reporter: Reporter readonly skillAdmin: SkillAdmin readonly skillRepository: AdminSkillRepository @@ -116,6 +117,7 @@ export class BrainKernel { }), }) this.localMemoryRemote = new LocalMemoryRemote(this.localMemory) + this.departments = new DepartmentManager({ memory: this.localMemory }) // The global space is part of first boot; project space stays lazy until // the first memory use in that project. if (settings().localMemoryEnabled !== false && settings().autoMemorySpaces !== false) void this.localMemory.ensureGlobal().catch((error: unknown) => { logger.warn('dsh-brain local memory initialization failed: ' + (error instanceof Error ? error.message : String(error))) }) @@ -301,6 +303,7 @@ export class BrainKernel { clients: skills ? this.clients : undefined, mcp: this.isActive('mcp'), localMemory: this.localMemory, + departments: this.departments, } } } diff --git a/src/routes.ts b/src/routes.ts index 33083fa..fa85a92 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -26,6 +26,7 @@ import type { Reporter } from './reporter.ts' import { createSettingsUiRoutes } from './settings-ui/routes.ts' import type { CloudMemoryWebRoute } from './context-types.ts' import type { LocalMemoryManager } from './local-memory/manager.ts' +import type { DepartmentManager } from './local-memory/departments/index.ts' import type { SkillSync, SkillSyncStats } from './skill-sync.ts' import type { SkillAdmin } from './skill-admin.ts' import type { SkillGroupManager } from './skill-groups.ts' @@ -79,6 +80,8 @@ export interface RouteDeps { mcp?: boolean /** Local memory manager, when the memory bundle is available. */ localMemory?: LocalMemoryManager + /** Department registry (P1.5), when wired in. */ + departments?: DepartmentManager } /** One feature flag the card reads before it renders a control. */