/** * Dependency-injection root (V2-031). * * Constructs the ports, controllers, and command registry once at bootstrap * and returns them as an explicit service bundle — no service locator, no * hidden singletons. Every dependency is overridable so the shell can be * assembled with fakes in tests. This module is renderer-independent: it wires * the application layer and input controllers but imports no `@opentui`/React. */ import type { Mode, ProviderId } from "../../types.js"; import type { AnyAppEvent } from "../../app/events/app-event.js"; import type { Clock, IdFactory } from "../../app/events/sequencer.js"; import type { AgentPort } from "../../app/ports/agent-port.js"; import type { PersistencePort } from "../../app/ports/persistence-port.js"; import type { JobsPort } from "../../app/ports/jobs-port.js"; import type { UpdatesPort } from "../../app/ports/updates-port.js"; import type { ClipboardPort } from "../../app/ports/clipboard-port.js"; import type { ConfirmationPort } from "../../app/ports/confirm-port.js"; import type { SecretPort } from "../../app/ports/secret-port.js"; import type { InteractiveSessionsPort } from "../../app/ports/interactive-sessions-port.js"; import { SessionController } from "../../app/controllers/session-controller.js"; import { CancelCoordinator } from "../../app/controllers/cancel-coordinator.js"; import { type CommandRegistry } from "../../app/commands/registry.js"; import { ActionRouter } from "../actions/action-router.js"; import { FocusController } from "../controllers/focus-controller.js"; import { SelectionController } from "../controllers/selection-controller.js"; import { ToastController } from "../controllers/toast-controller.js"; import { InterruptibleController } from "../controllers/interruptible-controller.js"; import { OverlayController } from "../controllers/overlay-controller.js"; import { TranscriptStore } from "../state/transcript-store.js"; import { PlanController } from "../../app/controllers/plan-controller.js"; import type { PagerExportPort } from "../ports/pager-export-port.js"; import { type TerminalCapabilityReport } from "./capabilities.js"; export interface AppPorts { readonly agent: AgentPort; readonly persistence: PersistencePort; readonly jobs: JobsPort; readonly interactiveSessions: InteractiveSessionsPort; readonly updates: UpdatesPort; readonly clipboard: ClipboardPort; readonly confirm: ConfirmationPort | undefined; readonly requestSecret: SecretPort["request"] | undefined; } export interface CompositionOptions { readonly agent?: AgentPort | undefined; readonly persistence?: PersistencePort | undefined; readonly jobs?: JobsPort | undefined; readonly interactiveSessions?: InteractiveSessionsPort | undefined; readonly updates?: UpdatesPort | undefined; readonly clipboard?: ClipboardPort | undefined; readonly confirm?: ConfirmationPort | undefined; readonly requestSecret?: SecretPort["request"] | undefined; readonly emit?: ((event: AnyAppEvent) => void) | undefined; readonly captureEvents?: boolean | undefined; readonly capabilities?: TerminalCapabilityReport | undefined; /** SEL-006: auto-copy a non-empty mouse selection on release. Default true. */ readonly copyOnRelease?: boolean | undefined; readonly pagerExport?: PagerExportPort | undefined; /** Signals the renderer to tear down and exit (Ctrl+D / second Ctrl+C). */ readonly requestExit?: (() => void) | undefined; readonly provider?: ProviderId | undefined; readonly model?: string | undefined; readonly mode?: Mode | undefined; /** Skip session persistence + AI titles (CLI --no-history). */ readonly noHistory?: boolean | undefined; readonly sessionId?: string | undefined; readonly idFactory?: IdFactory | undefined; readonly clock?: Clock | undefined; } export interface AppServices { readonly ports: AppPorts; readonly commands: CommandRegistry; readonly session: SessionController; readonly focus: FocusController; readonly router: ActionRouter; /** Single owner for pane-scoped semantic selection and copy requests. */ readonly selection: SelectionController; /** Ephemeral right-edge toasts (copy confirmation, short status). */ readonly toast: ToastController; readonly transcript: TranscriptStore; readonly plan: PlanController; /** Single owner for the one blocking overlay (picker/confirm/secret/pager/jobs). */ readonly overlay: OverlayController; /** Cancellable non-session operations (e.g. /update download + install). */ readonly interruptible: InterruptibleController; readonly cancel: CancelCoordinator; readonly pagerExport: PagerExportPort; readonly requestExit: () => void; readonly capabilities: TerminalCapabilityReport; /** Bounded raw events when captureEvents is explicitly enabled. */ readonly recordedEvents: readonly AnyAppEvent[]; dispose(): void; } export declare function createCompositionRoot(options?: CompositionOptions): AppServices;