import { ConfigManager } from '../config/manager.js'; import type { SecretsManager } from '../config/secrets.js'; import { ServiceRegistry } from '../config/service-registry.js'; import { SubscriptionManager } from '../config/subscriptions.js'; import { AutomationDeliveryManager, AutomationManager } from '../automation/index.js'; import { ChannelPluginRegistry, ChannelPolicyManager, RouteBindingManager, SurfaceRegistry } from '../channels/index.js'; import { ChannelDeliveryRouter } from '../channels/delivery-router.js'; import { ApprovalBroker, GatewayMethodCatalog, SessionLiveTurnControlsHolder, SharedSessionBroker } from '../control-plane/index.js'; import { StepUpService } from '../relay/step-up-service.js'; import { WatcherRegistry } from '../watchers/index.js'; import { TriggerManager } from '../triggers/manager.js'; import { ArtifactStore } from '../artifacts/index.js'; import { HomeGraphService, KnowledgeService, ProjectPlanningService } from '../knowledge/index.js'; import { MediaProviderRegistry } from '../media/index.js'; import { MultimodalService } from '../multimodal/index.js'; import { type AgentManager } from '../tools/agent/index.js'; import type { AgentMessageBus } from '../agents/message-bus.js'; import { WrfcController } from '../agents/wrfc-controller.js'; import type { AgentOrchestrator } from '../agents/orchestrator.js'; import type { ArchetypeLoader } from '../agents/archetypes.js'; import { ProcessManager } from '../tools/shared/process-manager.js'; import { ModeManager } from '../state/mode-manager.js'; import { FileUndoManager } from '../state/file-undo.js'; import { WorkspaceCheckpointManager } from '../workspace/checkpoint/index.js'; import { MemoryRegistry } from '../state/memory-registry.js'; import { MemoryStore } from '../state/memory-store.js'; import { CodeIndexStore } from '../state/code-index-store.js'; import { CodeIndexReindexScheduler } from '../state/code-index-reindex.js'; import { StoreSnapshotScheduler } from '../state/store-snapshots.js'; import { MemoryConsolidationScheduler } from '../state/memory-consolidation-scheduler.js'; import { PowerManager, type PowerPlatformSeam } from '../power/index.js'; import { AppendOnlyRetentionScheduler } from './retention/append-only-registry.js'; import type { RuntimeEventBus } from './events/index.js'; import type { DomainDispatch, RuntimeStore } from './store/index.js'; import { DistributedRuntimeManager } from './remote/distributed-runtime-manager.js'; import { RemoteRunnerRegistry, RemoteSupervisor } from './remote/index.js'; import { IntegrationHelperService } from './integration/helpers.js'; import { VoiceProviderRegistry, VoiceService } from '../voice/index.js'; import { WebSearchProviderRegistry, WebSearchService } from '../web-search/index.js'; import { MemoryEmbeddingProviderRegistry } from '../state/memory-embeddings.js'; import { HookActivityTracker } from '../hooks/activity.js'; import { HookDispatcher, type HookWorkbench } from '../hooks/index.js'; import { PluginManager } from '../plugins/manager.js'; import { BookmarkManager } from '../bookmarks/manager.js'; import { ProfileManager } from '../profiles/manager.js'; import { SessionManager } from '../sessions/manager.js'; import { CrossSessionTaskRegistry } from '../sessions/orchestration/index.js'; import { ApiTokenAuditor } from '../security/token-audit.js'; import { UserAuthManager } from '../security/user-auth.js'; import { PairingTokenManager } from '../pairing/pairing-token-store.js'; import { WebhookNotifier } from '../integrations/webhooks.js'; import { McpRegistry } from '../mcp/registry.js'; import { ContextAccountingHolder } from '../tools/context-accounting/index.js'; import { DeterministicReplayEngine } from '../core/deterministic-replay.js'; import type { ProviderOptimizer } from '../providers/optimizer.js'; import type { ProviderRegistry } from '../providers/registry.js'; import type { ProviderCapabilityRegistry } from '../providers/capabilities.js'; import type { CacheHitTracker } from '../providers/cache-strategy.js'; import type { FavoritesStore } from '../providers/favorites.js'; import type { BenchmarkStore } from '../providers/model-benchmarks.js'; import type { ModelLimitsService } from '../providers/model-limits.js'; import type { UserPermissionRuleStore } from '../permissions/user-rule-store.js'; import { SessionMemoryStore } from '../core/session-memory.js'; import { SessionLineageTracker } from '../core/session-lineage.js'; import { SessionChangeTracker } from '../sessions/change-tracker.js'; import { ExecutionPlanManager } from '../core/execution-plan.js'; import { AdaptivePlanner } from '../core/adaptive-planner.js'; import { IdempotencyStore } from './idempotency/index.js'; import { OverflowHandler } from '../tools/shared/overflow.js'; import type { ToolLLM } from '../config/tool-llm.js'; import { ComponentHealthMonitor } from './perf/component-health-monitor.js'; import { WorktreeRegistry } from './worktree/registry.js'; import { SandboxSessionRegistry } from './sandbox/session-registry.js'; import { type ShellPathService } from './shell-paths.js'; import type { FeatureFlagManager } from './feature-flags/index.js'; import type { PolicyRuntimeState } from './permissions/policy-runtime.js'; import { type KeybindingsManagerLike, type PanelManagerLike } from './host-ui.js'; import { type WorkflowServices } from '../tools/workflow/index.js'; import { type ArchivableProcessRegistry } from './fleet/index.js'; import { type OrchestrationEngine } from '../orchestration/index.js'; import { CacheRegistry, PauseController, type MemoryGovernor } from './memory/index.js'; export interface RuntimeServicesOptions { readonly runtimeBus: RuntimeEventBus; readonly runtimeStore: RuntimeStore; readonly configManager: ConfigManager; readonly surfaceRoot: string; readonly featureFlags?: FeatureFlagManager | undefined; readonly getConversationTitle?: (() => string | undefined) | undefined; readonly workingDir: string; readonly homeDirectory: string; readonly panelManager?: PanelManagerLike | undefined; readonly keybindingsManager?: KeybindingsManagerLike | undefined; /** * Opt-in: kick off the code index's initial build (Stage A) after * construction; fire-and-forget. Off by default so constructing * RuntimeServices never runs an unrequested source-tree walk. */ readonly autoStartCodeIndex?: boolean | undefined; /** * Opt-in: fold host coding-agent sessions the daemon did not spawn into the * fleet as read-only observed rows. Off by default (test determinism); the standalone daemon (cli.ts) turns it on. */ readonly observeExternalAgents?: boolean | undefined; /** Override the broker store path (default: home-scoped durable store). */ readonly sessionStorePath?: string | undefined; /** Opt-in host power seam for sleep ownership; absent ⇒ non-spawning unavailable seam (test determinism), the standalone daemon (cli.ts) passes createHostPowerSeam(). */ readonly powerSeam?: PowerPlatformSeam | undefined; /** * The daemon's state root when the host was told one (`--daemon-home`, * `GOODVIBES_DAEMON_HOME`, a test harness's temp tree). Threaded into * `SecretsManager` so the override actually MOVES the daemon-scoped * credential store; see runtime/secrets-composition.ts for what went wrong * while it did not. Absent = the machine default. */ readonly daemonHome?: string | undefined; } export interface RuntimeServices { readonly workingDirectory: string; readonly homeDirectory: string; /** * The `.goodvibes//` segment this composition's own state lives * under. Already returned by createRuntimeServices; declaring it here is what * lets a consumer ask for it instead of deriving a second one, the omission * that produced the unscoped pre-split control-plane store. */ readonly surfaceRoot: string; /** SDK-owned memory governance: samples RSS/heap, sheds caches, pauses jobs, trips on leaks. */ readonly memoryGovernor: MemoryGovernor; /** Registry of every retained cache the governor can observe and shrink. */ readonly cacheRegistry: CacheRegistry; /** Backpressure seam the governor drives to pause/resume deferrable background jobs. */ readonly pauseController: PauseController; readonly shellPaths: ShellPathService; readonly configManager: ConfigManager; readonly featureFlags: FeatureFlagManager; readonly runtimeBus: RuntimeEventBus; readonly runtimeStore: RuntimeStore; readonly runtimeDispatch: DomainDispatch; readonly panelManager: PanelManagerLike; readonly keybindingsManager: KeybindingsManagerLike; readonly routeBindings: RouteBindingManager; readonly surfaceRegistry: SurfaceRegistry; readonly channelPlugins: ChannelPluginRegistry; readonly channelDeliveryRouter: ChannelDeliveryRouter; readonly watcherRegistry: WatcherRegistry; /** * The trigger family's supervisor (stream watchers, model-free condition * checks, on-exit process triggers). This factory always constructs one, and * it does no work while `watchers.triggers.enabled` is false. * * OPTIONAL because hosts hand-compose RuntimeServices: goodvibes-agent builds * its own object literal, and a required field here turned "this host has no * trigger family" into a TypeError on daemon shutdown. Absence must mean no * triggers, never a crash, the same contract the fleet registry's * `triggerSupervisor` dep already honours. */ readonly triggerManager?: TriggerManager | undefined; readonly approvalBroker: ApprovalBroker; readonly userPermissionRuleStore: UserPermissionRuleStore; readonly sessionBroker: SharedSessionBroker; readonly deliveryManager: AutomationDeliveryManager; readonly automationManager: AutomationManager; readonly gatewayMethods: GatewayMethodCatalog; readonly artifactStore: ArtifactStore; readonly knowledgeService: KnowledgeService; readonly agentKnowledgeService: KnowledgeService; readonly homeGraphService: HomeGraphService; readonly projectPlanningService: ProjectPlanningService; readonly memoryStore: MemoryStore; readonly memoryRegistry: MemoryRegistry; /** Repo code index (Stage A): schema-initialized eagerly; the build is never auto-triggered here (would walk arbitrary workingDirectories incl. test fixtures). */ readonly codeIndexStore: CodeIndexStore; /** Stage B tool-site incremental reindex scheduler (bound to codeIndexStore). */ readonly codeIndexReindexScheduler: CodeIndexReindexScheduler; /** Daily snapshots of every SQLite store this runtime writes, with bounded retention; unref'd timers (same lifecycle posture as processRegistry, hosts that tear down a runtime stop() it themselves). */ readonly storeSnapshotScheduler: StoreSnapshotScheduler; /** Periodic re-sweep of every registered append-only store (startup alone never prunes a daemon that stays up for weeks); unref'd timers, stop() on teardown. */ readonly appendOnlyRetentionScheduler: AppendOnlyRetentionScheduler; /** Idle+schedule memory consolidation driver (this runtime is the store's single writer); unref'd timers, stop() on teardown. */ readonly memoryConsolidationScheduler: MemoryConsolidationScheduler; /** Sleep ownership: work inhibition, keep-awake toggle, sleep-edge hooks (platform/power). */ readonly powerManager: PowerManager; readonly serviceRegistry: ServiceRegistry; readonly secretsManager: SecretsManager; /** Relay WebAuthn step-up ceremony service (shared by the stepup.* verbs and the relay gate's verifier). */ readonly stepUpService: StepUpService; readonly subscriptionManager: SubscriptionManager; /** Per-pairing named revocable operator tokens (device-scoped). */ readonly pairingTokens: PairingTokenManager; readonly localUserAuthManager: UserAuthManager; readonly profileManager: ProfileManager; readonly bookmarkManager: BookmarkManager; readonly sessionManager: SessionManager; readonly sessionOrchestration: CrossSessionTaskRegistry; readonly hookDispatcher: HookDispatcher; readonly hookActivityTracker: HookActivityTracker; readonly hookWorkbench: HookWorkbench; readonly pluginManager: PluginManager; readonly workflow: WorkflowServices; readonly voiceProviders: VoiceProviderRegistry; readonly voiceService: VoiceService; readonly webSearchProviders: WebSearchProviderRegistry; readonly webSearchService: WebSearchService; readonly mediaProviders: MediaProviderRegistry; readonly multimodalService: MultimodalService; readonly memoryEmbeddingRegistry: MemoryEmbeddingProviderRegistry; readonly channelPolicy: ChannelPolicyManager; readonly mcpRegistry: McpRegistry; readonly tokenAuditor: ApiTokenAuditor; readonly componentHealthMonitor: ComponentHealthMonitor; readonly worktreeRegistry: WorktreeRegistry; readonly sandboxSessionRegistry: SandboxSessionRegistry; readonly webhookNotifier: WebhookNotifier; readonly replayEngine: DeterministicReplayEngine; readonly providerOptimizer: ProviderOptimizer; readonly providerCapabilityRegistry: ProviderCapabilityRegistry; readonly cacheHitTracker: CacheHitTracker; readonly favoritesStore: FavoritesStore; readonly benchmarkStore: BenchmarkStore; readonly modelLimitsService: ModelLimitsService; readonly providerRegistry: ProviderRegistry; readonly toolLLM: ToolLLM; readonly distributedRuntime: DistributedRuntimeManager; readonly remoteRunnerRegistry: RemoteRunnerRegistry; readonly remoteSupervisor: RemoteSupervisor; readonly sessionMemoryStore: SessionMemoryStore; readonly sessionLineageTracker: SessionLineageTracker; readonly sessionChangeTracker: SessionChangeTracker; readonly planManager: ExecutionPlanManager; readonly adaptivePlanner: AdaptivePlanner; readonly idempotencyStore: IdempotencyStore; readonly overflowHandler: OverflowHandler; readonly policyRuntimeState: PolicyRuntimeState; readonly archetypeLoader: ArchetypeLoader; readonly agentManager: AgentManager; readonly agentMessageBus: AgentMessageBus; readonly agentOrchestrator: AgentOrchestrator; /** Settable holder for the context_accounting tool's session source; an interactive consumer binds its Orchestrator-backed source here. */ readonly contextAccountingHolder: ContextAccountingHolder; /** Settable holder an interactive consumer binds its Orchestrator into, powering sessions.toolCalls.cancel + sessions.queuedMessages.* (same pattern as contextAccountingHolder). */ readonly sessionLiveTurnControls: SessionLiveTurnControlsHolder; readonly wrfcController: WrfcController; /** Orchestration engine (alongside wrfcController; controller-compat.ts): opt-in pipeline scheduler, never auto-started. */ readonly orchestrationEngine: OrchestrationEngine; readonly processManager: ProcessManager; /** Live process registry (fleet aggregation). No dispose seam exists; the unref'd tick runs only while subscribers exist, hosts dispose() themselves. */ readonly processRegistry: ArchivableProcessRegistry; readonly modeManager: ModeManager; readonly fileUndoManager: FileUndoManager; readonly workspaceCheckpointManager: WorkspaceCheckpointManager; readonly integrationHelpers: IntegrationHelperService; /** Re-root path-bound services to a new working directory (WorkspaceSwapManager). MemoryStore + ProjectIndex re-root in-process; others warn and keep their path until restart. @throws INVALID_PATH on failure. */ rerootStores(newWorkingDir: string): Promise; /** * Stop every poller this graph started (config watch, fleet tick, memory * governor, watcher registry, cross-session sweep, orchestration writer, push * sweep, knowledge scheduler, retention schedulers) and release their handles. * * Best-effort, total and idempotent: an owner that throws is logged and the * rest still come down. Dispose only a graph you constructed, a DaemonServer * handed runtime services by its caller does not own them. */ dispose(): void; } export { applyProviderOptimizerConfigMode, bindProviderOptimizerFeatureFlag, } from './provider-optimizer-wiring.js'; export declare function createRuntimeServices(options: RuntimeServicesOptions): RuntimeServices; //# sourceMappingURL=services.d.ts.map