import type { LeafDef } from '../command.js'; import type { DeclLeafBase, DeclBranch, CommandManifestIssue } from './schema.js'; /** Reference to an external contributor (plugin or configured CLI). */ export type CommandContributorRef = { kind: 'plugin' | 'configured-cli'; name: string; scope: 'user' | 'project'; }; /** Adapter callback to turn a declared leaf into a crtr LeafDef. Takes the * leaf definition and its resolved command path, returns the outputKind and * run function to be used by the tree composer. */ export type LeafAdapter = (leaf: DeclLeafBase, commandPath: readonly string[]) => { outputKind: 'object' | 'jsonl'; run: LeafDef['run']; }; /** One accepted external contribution after collision resolution: a validated * top-level branch node, contributor identity, and the adapter callback that * will produce its leaves' run implementations. */ export interface CommandContribution { contributor: CommandContributorRef; node: DeclBranch; adaptLeaf: LeafAdapter; } /** Per-contributor collision issue. */ export interface ContributorIssue extends CommandManifestIssue { contributor: CommandContributorRef; } /** Invocation-local registry snapshot after collision resolution: the accepted * contributions and every discovered issue. The amended spec has no freshness * machinery, so there is no owner-routing map — an unknown-token miss hydrates * ALL absent-store registrations once (§5.1), never a single known owner. */ export interface CommandRegistrySnapshot { /** Accepted top-level contributions, deterministically ordered by * contributor name. */ contributions: CommandContribution[]; /** Every discovered issue, including collisions. */ issues: ContributorIssue[]; } /** Resolve a flat list of candidate contributions into a collision-resolved * snapshot. Every contribution at a collided path is dropped (all claimants), * an issue is recorded on each claimant, core names take precedence, and * results are deterministically ordered by contributor name. */ export declare function resolveCommandRegistry(candidates: readonly CommandContribution[], reservedCoreNames: ReadonlySet): CommandRegistrySnapshot;