/** * hosted-sessions-composition.ts, wiring the hosted-session engine into a * daemon. * * The engine (platform/hosted-sessions) is deliberately ignorant of the daemon: * it takes a way to build a workspace floor, a place to publish lifecycle * notices, a store, and the settings it reads. This file supplies those from a * composed daemon, and nothing else. * * ── Why the floor factory is required rather than defaulted ──────────────── * * A hosted run writes files, runs commands and delegates inside a workspace the * daemon was pointed at over the wire. WHICH permission seam sits in front of * that is the product's decision, the daemon puts its workspace trust gate * there, so an undecided workspace raises the trust question as an approval * record any attached surface can answer, and a restricted one refuses * non-read categories without asking. * * Defaulting that seam would mean picking a trust posture on the product's * behalf, and the only posture available to a default is "no gate at all". So * hosted sessions are OFF until a product states how a floor is built. A daemon * that says nothing hosts nothing, and the verbs refuse honestly rather than * running ungated work. */ import type { ConfigManager } from '../config/manager.js'; import type { RuntimeEventBus } from '../runtime/events/index.js'; import type { ShellPathService } from '../runtime/shell-paths.js'; import type { SessionLiveTurnControlsHolder } from '../control-plane/routes/session-runtime.js'; import type { GatewayMethodCatalog } from '../control-plane/method-catalog.js'; import { HostedSessionManager, type HostedSessionEventPublisher, type HostedSessionLoadReport, type HostedSessionSpine, type HostedWorkspaceFloorFactory } from '../hosted-sessions/index.js'; import type { RuntimeServices } from '../runtime/services.js'; /** What a product states to turn hosted sessions on. */ export interface DaemonHostedSessionsOptions { /** * How a workspace floor is built. Required, see the module header for why * there is no default. */ readonly floorFactory: HostedWorkspaceFloorFactory; /** * The base system prompt for a hosted turn. The orchestrator appends the * runtime-awareness block itself, so this is the product's operator policy. * Omitted ⇒ a plain statement of what the session is. */ readonly systemPrompt?: ((input: { readonly sessionId: string; readonly workspaceRoot: string; }) => string) | undefined; /** Where session state is written. Omitted ⇒ `/.goodvibes/hosted-sessions`. */ readonly stateDirectory?: string | undefined; /** Whether a workspace root is acceptable. Omitted ⇒ it must be an existing directory. */ readonly isWorkspaceUsable?: ((workspaceRoot: string) => boolean) | undefined; } /** What this composition needs from an already-built daemon. */ export interface HostedSessionCompositionInput { readonly options: DaemonHostedSessionsOptions; readonly configManager: ConfigManager; readonly runtimeBus: RuntimeEventBus; readonly shellPaths: ShellPathService; readonly gatewayMethods: GatewayMethodCatalog; readonly liveTurns: SessionLiveTurnControlsHolder; readonly eventPublisher: HostedSessionEventPublisher; readonly spine?: HostedSessionSpine | undefined; } /** * Build the hosted-session engine, attach its verbs and its lifecycle channel. * The caller still has to call `init()` (at start) and `dispose()` (at stop). */ export declare function composeHostedSessions(input: HostedSessionCompositionInput): HostedSessionManager; /** * The facade's one-line entry point. Everything this composition needs is * already on the runtime graph, so the facade names the graph rather than * spelling out six fields it would have to keep in step by hand, and an * absent options object returns null rather than making the facade branch. */ export declare function composeHostedSessionsForFacade(options: DaemonHostedSessionsOptions | undefined, runtimeServices: RuntimeServices, configManager: ConfigManager, runtimeBus: RuntimeEventBus, eventPublisher: HostedSessionEventPublisher): HostedSessionManager | null; /** * State what a restore pass found. A restart that could not bring a session * back has to say so; leaving the counts only in the report object the caller * may or may not read is how a silent loss stays silent. */ export declare function reportHostedSessionRestore(report: HostedSessionLoadReport): void; //# sourceMappingURL=hosted-sessions-composition.d.ts.map