/** * WorkspaceRuntimeRegistry — lazy per-workspace cache of agent execution runtimes. * * Previously these collaborators (`SkillManager`, `SystemPromptBuilder`, * `MemoryManager`) were created inline inside * `AgentManager.getWorkspaceRuntime` and cached in a private Map. They live * outside `AgentInstance` because multiple session keys for the same agent may * share a workspace. Skill and prompt state stays keyed by agent and workspace, * while memory comes from one process-wide user context. * * Extracted so: * - `AgentManager` no longer owns workspace-scoped runtime caches. * - Hot-reload teardown (`clearAll`) shuts down the shared user context once. * - Future per-workspace runtimes (e.g. embedding store, vector cache) plug in * through `getOrCreate` without touching `AgentManager`. */ import type { Config } from '../../config/schema.js'; import type { MemoryManager } from '../memory/manager.js'; import { SkillManager } from '../skills/skill-manager.js'; import { SystemPromptBuilder } from '../prompt/service-prompt-builder.js'; export interface WorkspaceRuntime { skillManager: SkillManager; systemPromptBuilder: SystemPromptBuilder; memoryManager: MemoryManager; } export interface WorkspaceRuntimeRegistryOptions { /** Effective config snapshot accessor (must always return a value when called). */ getConfig: () => Config; /** Absolute path to the bundled skills directory shared by every workspace. */ bundledSkillsDir: string; /** Called after a runtime is first created for a workspace. */ onRuntimeCreated?: (resolvedPath: string) => void; /** Dynamic project trust lookup used by workspace compatibility skills. */ isWorkspaceTrusted?: (resolvedPath: string) => boolean; } export declare class WorkspaceRuntimeRegistry { private readonly runtimes; private readonly notifiedWorkspacePaths; private readonly getConfig; private readonly bundledSkillsDir; private readonly onRuntimeCreated?; private readonly isWorkspaceTrusted?; private readonly userContextRuntimes; constructor(opts: WorkspaceRuntimeRegistryOptions); /** Lazily construct and cache an agent-scoped runtime for a workspace. */ getOrCreate(resolvedPath: string, requestedAgentId?: string): WorkspaceRuntime; /** Iterate every live workspace runtime (used by skill / config hot-reload). */ values(): IterableIterator; /** * Tear down every runtime (shutdown memory providers) and forget the cache. * Used by `AgentManager.updateAgentDefaults` and `AgentManager.dispose`. */ clearAll(): Promise; }