/** * cli-context — the thin `ToolCliContext` assembler (host-owned-run-timing * Phase 6). `buildToolCliContext` wires together the focused host planes — * output, egress, run, live, baseline, state, host-planes — into the single * coherent context handed to each tool and host command. Each concern's logic * lives in its own `bootstrap/*-plane` (or `*-seams`) module; this file only * composes them and exposes the `scope` getter + the assembled context. * * There is NO module-global bootstrap-handoff bag. The populated registries + * admitted-tool manifests/provenance are captured in the pre-action-hook closure * (`installPreActionHook` is called AFTER `bootstrapCli` in `main()`), the hook * builds + enters the per-run `RunScope`, and from there every per-run read * (project, datastore, manifests, provenance, …) goes through `currentScope()`. * * Lazy datastore: a closure-based thunk caches the open DataStore on first access and * lands on `RunScope.datastore`; paths that never touch it never materialise * `.runtime/datastore.sqlite`. */ import { type CommandResult } from '@opensip-cli/contracts'; import { type Logger, type ToolCliContext } from '@opensip-cli/core'; import { type LiveViewRegistry } from './bootstrap/io-plane.js'; import { type DeferredReportEffect } from './bootstrap/report-open-policy.js'; import { type RunActionHooks } from './bootstrap/run-plane.js'; export { buildDatastoreThunk, getCurrentProjectRoot, getCurrentRuntimePaths, getOrOpenDatastore, } from './bootstrap/scope-access.js'; export { createLiveViewRegistry, type LiveViewRegistry } from './bootstrap/io-plane.js'; export interface BuildToolCliContextOptions { readonly render: (result: CommandResult) => Promise; readonly liveViews: LiveViewRegistry; /** * Execute a report request that the context already admitted. The historical * property name stays local to this bootstrap seam; production injects * `executeReportOpen`. */ readonly maybeOpenReport: (effect: DeferredReportEffect) => Promise; readonly logger?: Logger; } export interface ToolCliContextHandle { readonly ctx: ToolCliContext; /** Host-only run-lifecycle hooks — consumed by mount dispatch, not tool handlers. */ readonly runActionHooks: RunActionHooks; readonly getExitCode: () => number | undefined; } export declare function buildToolCliContext(opts: BuildToolCliContextOptions): ToolCliContextHandle; /** * Build the host {@link ToolCliContext} the ADR-0054 M4-F hook-worker supervisor * serves host-RPC upcalls through, when running an EXTERNAL tool's * `collectReportData` / `sessionReplay` out-of-process from a HOST command * (`report` / `sessions show`) whose lean `CliCommandsContext` is not a full * `ToolCliContext`. * * It wires the SAME datastore-backed host planes the real context uses (baseline * / per-tool state / governance-audit-entitlements / egress + SARIF) against the * current entered scope, so any privileged effect a hook legitimately upcalls is * performed by the host through the real plane. The OUTPUT seams (render / emit*) * and the live-view + report-open seams are NOT part of a data-gathering hook's * contract; they throw loudly if a hook attempts them (fail loud, never a silent * no-op) — the worker shim already denies the live-view seams, and a hook has no * business rendering. This context is short-lived (one hook worker run). */ export declare function buildHostDispatchCtx(logger?: Logger): ToolCliContext; //# sourceMappingURL=cli-context.d.ts.map