import type { EnginesListOutput as RegistryEnginesListOutput } from "@ai-kod/command-registry/commands/engines.js"; import type { ComponentStageResult, ProgressEvent, SetupMode, SetupReport } from "@ai-kod/setup-core"; export type OutputFormat = "human" | "json" | "jsonl"; export type OutputVerbosity = "quiet" | "summary" | "steps" | "debug"; export interface HintList { readonly title?: string; readonly items: readonly string[]; } export interface OutputContext { readonly format: OutputFormat; readonly verbosity: OutputVerbosity; readonly hints?: HintList; } export interface EnvelopeEvent { readonly id?: string; readonly type?: string; readonly timestamp?: string; readonly priority?: number | string; readonly correlationId?: string; readonly taskId?: string; readonly workflowId?: string; readonly stepId?: string; readonly jobId?: string; readonly data?: unknown; } export interface LogRecord { readonly kind: "log"; readonly timestamp: string; readonly stepId?: string; readonly stream?: "stdout" | "stderr"; readonly message: string; } export interface TaskStepSummary { readonly kind: "task-step-summary"; readonly stepId: string; readonly stage: string; readonly status: string; readonly iteration?: number; readonly createdAt?: string; readonly waiting?: { readonly controller: string; readonly readyChildren?: number; readonly expectedChildren?: number; readonly waitingSince?: string; }; readonly durationMs?: number; readonly startedAt?: string; readonly completedAt?: string; } export interface TaskStepHeader { readonly kind: "task-step-header"; readonly total: number; readonly byStatus: Record; } export interface SetupResultOutput extends SetupReport { readonly kind: "setup"; } export interface SetupComponentsOutput { readonly kind: "setup-components"; readonly mode: SetupMode; readonly dryRun: boolean; readonly components: ComponentStageResult[]; readonly progress?: ProgressEvent[]; } export interface SetupProgressEventOutput { readonly kind: "setup-progress"; readonly event: ProgressEvent; } export interface EnginesListOutput { readonly kind: "engines-list"; readonly engines: RegistryEnginesListOutput["engines"]; } export interface WorkerMetricsSample { readonly ts: string; readonly cpu_pct?: number; readonly mem_mb?: number; readonly current_jobs?: number; } export interface WorkersListOutput { readonly kind: "workers-list"; readonly workers: Record[]; } export interface WorkerDetailOutput { readonly kind: "worker-detail"; readonly worker: Record; } export interface SystemConfigSnapshot { readonly [key: string]: unknown; readonly environment: string; readonly server: { readonly api: string; readonly worker: string; }; readonly redis: string; readonly logLevel: string; readonly redisLogging: boolean; readonly client: { readonly baseUrl: string; readonly timeoutMs: number; readonly tokenConfigured: boolean; }; readonly features: string[]; readonly paths: { readonly dataRoot: string; readonly workspaces: string; readonly library: string; readonly libraryRegistry: string; readonly agents: string; readonly claudeAgents: string; readonly providersRegistry: string; }; readonly library: { readonly workflows: number; readonly packages: number; readonly prompts: number; readonly mcp: number; readonly skills: number; readonly total: number; }; readonly agents: { readonly memoryBank: string[]; readonly claude: string[]; }; readonly engineProfiles: { readonly default: string; readonly profiles: string[]; readonly workflowOverrides: Record; readonly stageOverrides: Record; }; readonly providers: { readonly registryPath: string; readonly providersCount: number; readonly profilesCount: number; readonly engines: Record; }; } export interface SystemConfigOutput { readonly kind: "system-config"; readonly snapshot: SystemConfigSnapshot; readonly verbosity?: OutputVerbosity; } export type StructuredOutput = EnvelopeEvent | LogRecord | TaskStepSummary | TaskStepHeader | SetupResultOutput | SetupComponentsOutput | SetupProgressEventOutput | EnginesListOutput | WorkersListOutput | WorkerDetailOutput | SystemConfigOutput | Record;