/** * load-tool-capabilities — the composition-root seam that drives the generic * capability loader (§5.3, §4.5) for the invoked tool's declared domains. * * Replaces the host-coupled, eager `register-graph-adapters.ts` (which statically * imported graph's discover functions + stashed adapters in a module global). * Here the host stays tool-agnostic: for the tool that owns the running command, * it reads each declared capability domain's discovery descriptor off the * per-run capability registry, resolves that domain's preferences from the * project config through the keys the descriptor declares, and calls the generic * `loadCapabilityDomain` — which walks node_modules, imports each contributing * package, and routes every contribution through the owner's registrar. No tool * import; no module singleton; lazy per command (only the invoked tool's domains * load, so `graph` does not load fit-packs). * * This module is one of the few places the CLI imports `@opensip-cli/config` * (the preference resolver) — tools never do. */ import { type CapabilityDiscoveryDescriptor, type CapabilityPackageAdmission, type SelectedCapabilityPackage, type Tool, type ToolProvenance } from '@opensip-cli/core'; /** Options for {@link loadOwningToolCapabilities}. */ export interface LoadOwningToolCapabilitiesOptions { /** The tool that owns the invoked command (from `resolveOwningTool`); `undefined` for CLI-only commands. */ readonly owningTool: Tool | undefined; /** Discovery anchor for consumer-owned packages (the project root). */ readonly projectDir: string; /** The host-validated `plugins:` block from `scope.configDocument`, or `{}` when absent. */ readonly pluginsConfig?: unknown; /** Discovery anchor for built-in packs (those under a descriptor's `builtinScope`). */ readonly cliDir?: string; /** * Per-run tool provenance. An EXTERNAL owning tool's capability domains are * loaded worker-side under dispatch (ADR-0054 M4-F), exactly as its * `initialize` hook is — its registrars do not exist in this process, so * loading here discovers every contribution and then fails to route all of * them. Omitted (or empty) keeps the bundled/in-host behaviour. */ readonly provenance?: readonly ToolProvenance[]; } /** * Discover + route every contribution for each capability domain the invoked * tool declares, through the generic loader. Must run AFTER the scope is entered * (the registrars register into the scope's registries) and the per-run * capability registry is attached. A CLI-only command (no owning tool) loads * nothing. * * Returns the number of domains driven (0 when the tool declares none / is * CLI-only), for diagnostics. */ export declare function loadOwningToolCapabilities(options: LoadOwningToolCapabilitiesOptions): Promise; /** * The host trust-policy capability-pack admission — the ENFORCED security * boundary for external capability packs (plan 09 Phase 3; capability-trust * ADR). Exported so it can be published on `RunScope.capabilityAdmission` * (build-per-run-scope): an engine that triggers its own capability load (the * fitness check-loader) then admits packs through THIS gate — identical to the * bootstrap path. * * Trust direction: a `plugins.` entry in the ANALYZED REPO's own * config is discovery/selection input, never operator trust — a tool whose * job is analyzing code it does not trust must not let that code nominate * executable packs. Operator trust is exactly one surface: the user-level * global-config trust list (`policy.trustedCapabilityPacks`), each grant an * exact id bound to the provenance (manifest hash) verified at grant time — * a trusted NAME alone would be shadowable through the repo's `node_modules`. */ export declare function admitCapabilityPackage(descriptor: CapabilityDiscoveryDescriptor, pkg: SelectedCapabilityPackage, explicitlyConfiguredPackages: ReadonlySet): CapabilityPackageAdmission; //# sourceMappingURL=load-tool-capabilities.d.ts.map