/** * Batch Manifest module (batch-runner DESIGN D2, D2.8, D3). * * Strict parse of the manifest schema v1 plus the deterministic * `input → argv` compiler. The manifest carries STRUCTURED, typed values * (numbers as numbers, booleans as booleans, enums as enum members); * the compiler renders them to the exact argv the command handlers' * `parseArgs` consumes, which stays the single semantic validation * authority. Manifest parse checks shape only: required fields, types, * enum membership, subcommand scoping. * * Strict parse throughout: unknown fields reject at every level (top * level, op level, inside `input`) naming the first offender, and old * manifests either parse cleanly or reject — never silently reinterpreted. * * This module performs no I/O of its own: provider capability checks run * against injected descriptors (never `descriptor.create()`), and output * dirname existence runs against an injected `dirExists` probe. */ import type { ProviderCapability, ProviderDescriptor, ProviderId } from "../providers/types.js"; import type { SearchRecency, SearchTopic, SearchType } from "../capabilities/search.js"; /** * Commands a batch manifest may carry (owner decision 2026-08-17): * capability operations only. The array order fixes the rejection * message wording and is part of the pinned contract. */ export declare const BATCH_ALLOWED_COMMANDS: readonly ["search", "read", "research", "repo", "vision", "crawl", "map"]; export type AllowedBatchCommand = (typeof BATCH_ALLOWED_COMMANDS)[number]; /** Rejection message for out-of-allowlist commands (D3, verbatim). */ export declare const BATCH_ALLOWLIST_MESSAGE: string; export type RepoBatchSubcommand = "search" | "tree" | "read" | "brief"; export type VisionBatchSubcommand = "analyze" | "ui-to-code" | "extract-text" | "diagnose-error" | "diagram" | "chart" | "diff" | "video"; /** * Capability id a batch op exercises (DESIGN D4). Vision ops resolve to * their per-operation `vision.` id; this is the grouping key * provider assignment uses and the id the per-op pin is validated * against. */ export declare function batchCommandCapabilityId(command: AllowedBatchCommand, input: Readonly>): ProviderCapability; export interface SearchBatchInput { readonly query: string; readonly count?: number; readonly domain?: string; readonly recency?: SearchRecency; readonly contentSize?: "medium" | "high"; readonly location?: "cn" | "us"; readonly topic?: SearchTopic; readonly type?: SearchType; readonly maxSummary?: number; readonly fields?: string[]; readonly noCache?: boolean; readonly merge?: boolean; } export interface ReadBatchInput { readonly url: string; readonly format?: "markdown" | "text"; readonly noImages?: boolean; readonly withLinks?: boolean; readonly withImagesSummary?: boolean; readonly maxChars?: number; readonly noCache?: boolean; } export interface CrawlBatchInput { readonly url: string; readonly depth?: number; readonly breadth?: number; readonly limit?: number; readonly selectPaths?: string; readonly excludePaths?: string; readonly instructions?: string; readonly format?: "markdown" | "text"; readonly contentSize?: "medium" | "high"; readonly timeout?: number; readonly maxChars?: number; readonly noCache?: boolean; } export interface MapBatchInput { readonly url: string; readonly depth?: number; readonly breadth?: number; readonly limit?: number; readonly selectPaths?: string; readonly excludePaths?: string; readonly instructions?: string; readonly noCache?: boolean; } export interface ResearchBatchInput { readonly query: string; readonly model?: "mini" | "pro" | "auto"; readonly outputLength?: "short" | "standard" | "long"; readonly citationFormat?: "numbered" | "mla" | "apa" | "chicago"; readonly domain?: string; readonly maxChars?: number; readonly timeout?: number; readonly noCache?: boolean; } export interface RepoBatchInput { readonly subcommand: RepoBatchSubcommand; readonly repository: string; readonly query?: string; readonly path?: string; readonly language?: "en" | "zh"; readonly maxChars?: number; readonly focus?: string; readonly depth?: number; readonly noCache?: boolean; } /** * `source` is required for every subcommand except `diff`, which carries * `expected` + `actual` instead. The optionality here is a TypeScript * limitation; the strict parse enforces the per-subcommand requirements * and `compileInput` defends them again. */ export interface VisionBatchInput { readonly subcommand: VisionBatchSubcommand; readonly source?: string; readonly prompt?: string; readonly language?: string; readonly context?: string; readonly type?: string; readonly focus?: string; readonly output?: "code" | "prompt" | "spec" | "description"; readonly expected?: string; readonly actual?: string; } interface BatchOperationBase { readonly name: string; readonly provider?: ProviderId; readonly output?: string; } export interface SearchBatchOperation extends BatchOperationBase { readonly command: "search"; readonly input: SearchBatchInput; } export interface ReadBatchOperation extends BatchOperationBase { readonly command: "read"; readonly input: ReadBatchInput; } export interface ResearchBatchOperation extends BatchOperationBase { readonly command: "research"; readonly input: ResearchBatchInput; } export interface RepoBatchOperation extends BatchOperationBase { readonly command: "repo"; readonly input: RepoBatchInput; } export interface VisionBatchOperation extends BatchOperationBase { readonly command: "vision"; readonly input: VisionBatchInput; } export interface CrawlBatchOperation extends BatchOperationBase { readonly command: "crawl"; readonly input: CrawlBatchInput; } export interface MapBatchOperation extends BatchOperationBase { readonly command: "map"; readonly input: MapBatchInput; } export type BatchOperation = SearchBatchOperation | ReadBatchOperation | ResearchBatchOperation | RepoBatchOperation | VisionBatchOperation | CrawlBatchOperation | MapBatchOperation; export interface BatchManifest { readonly schemaVersion: 1; readonly operations: readonly BatchOperation[]; } /** Injected dependencies: descriptors stay metadata-only, fs stays behind a probe. */ export interface BatchManifestDeps { readonly descriptors: readonly ProviderDescriptor[]; readonly dirExists: (dir: string) => boolean; /** * #157b: true when the enclosing CLI run is under `--isolated`. The * stateful async-job commands (research/crawl) then reject per-op: a * per-pid state dir can never be found by a later resume run, so the * manifest must not pretend the ops carry resume state. Optional — * callers that don't run under isolation (vision batch) omit it and * parse byte-identically to before. */ readonly isolated?: boolean; } /** * Strict-parse a batch manifest (D2). Every rejection throws * `ValidationError` naming the first offender; nothing about a rejected * manifest is partially accepted. Provider pins are validated against * the injected descriptor metadata only — `create()` is never called. */ export declare function parseBatchManifest(raw: unknown, deps: BatchManifestDeps): BatchManifest; /** * Compile a parsed operation's `input` to the argv its handler consumes * (D2.8). Deterministic: same input → same argv, always. Output is a * `string[]` — no shell joining, no escaping hazards. Required fields * for the five positional handlers never render as flags. */ export declare function compileInput(op: BatchOperation): string[]; export {}; //# sourceMappingURL=batch-manifest.d.ts.map