import type { InputParam, Field } from '../help.js'; export interface DeclRootEntry { concept: string; description: string; whenToUse: string; } export interface DeclBranch { kind: 'branch'; name: string; description: string; whenToUse: string; tier?: 'normal' | 'common' | 'important'; /** Required on a top-level branch, forbidden on a nested one. */ rootEntry?: DeclRootEntry; summary: string; model?: string; /** Plugin dialect only: forward every argv token after this branch to an * external binary instead of parsing children. A passthrough branch is * childless by construction. Forbidden in the configured-CLI dialect — a * remote manifest naming a local binary to exec is a trust hole. */ passthrough?: DeclPassthrough; children: DeclNode[]; } export interface DeclPassthrough { bin: string; installHint: string; } export interface DeclLeafBase { kind: 'leaf'; name: string; description: string; whenToUse: string; tier?: 'normal' | 'common' | 'important'; summary: string; params: InputParam[]; output: Field[]; effects: string[]; } /** Plugin-dialect leaf: requires outputKind: 'object' (no streaming in v1). */ export interface PluginDeclLeaf extends DeclLeafBase { outputKind: 'object'; } /** Configured CLI REST mapping (placeholder types; full spec in manifest.ts). */ export type RestMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; export type RestParamPlacement = 'path' | 'query' | 'body' | 'header'; export interface RestParamMapping { in: RestParamPlacement; as?: string; } export interface RestMapping { method: RestMethod; path: string; streaming?: boolean; /** Constant literal body fields merged into the request body (top-level, alongside * any bodyRoot-nested param values). Forbidden on GET. */ body?: Record; /** When set, all in:"body" param values nest under this key instead of the body * top level (constants from `body` stay top-level regardless). Forbidden on GET. */ bodyRoot?: string; params: Record; } export interface ManifestTimeouts { connectMs?: number; requestMs?: number; streamIdleMs?: number; } /** Configured CLI-dialect leaf: requires rest (derives outputKind from streaming). */ export interface ConfiguredCliDeclLeaf extends DeclLeafBase { rest: RestMapping; } export type DeclLeaf = PluginDeclLeaf | ConfiguredCliDeclLeaf; export type DeclNode = DeclBranch | (L extends DeclLeafBase ? DeclLeaf : never); export interface CommandManifestIssue { code: CommandIssueCode; path?: string; message: string; received: string; expected: string; next: string; } export type CommandIssueCode = 'command_manifest_unreadable' | 'command_manifest_invalid' | 'command_schema_version' | 'command_path_unsafe' | 'command_not_executable' | 'command_parent_invalid' | 'command_node_invalid' | 'command_collision' | 'command_rest_invalid'; type IssueFn = (code: CommandIssueCode, message: string, received: string, expected: string, next: string, path?: string) => void; /** Validate a node for the plugin dialect (leaf must have outputKind: 'object'). */ export declare function validatePluginNode(raw: unknown, path: string, topLevel: boolean, issue: IssueFn): DeclBranch | PluginDeclLeaf | null; /** Validate a node for the configured CLI dialect (leaf must have rest). */ export declare function validateConfiguredCliNode(raw: unknown, path: string, topLevel: boolean, issue: IssueFn): DeclBranch | ConfiguredCliDeclLeaf | null; export {};