/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { TaskGraph } from "@workglow/task-graph"; import type { DataPortSchemaObject } from "@workglow/util/schema"; import type { WebCommandNode } from "./commandTree"; export interface WebField { readonly key: string; readonly label: string; readonly description: string; readonly type: "string" | "number" | "integer" | "boolean" | "enum" | "array" | "object"; /** The widget hook: a schema `format` like "model" or "sec:cik". */ readonly format: string | undefined; readonly required: boolean; readonly advanced: boolean; readonly defaultValue: unknown; readonly choices: readonly string[] | undefined; readonly source: "argument" | "schema" | "config" | "option"; /** Hint text for an empty control, from a field annotation. */ readonly placeholder?: string; /** The field takes a comma-separated list, so a pick appends to it. */ readonly multiple?: boolean; } /** * Answers "what does this command take, given the arguments chosen so far". * * `task run` cannot say until it knows the task type, and `workflow run` * cannot say until it knows the workflow — which is why the arguments are an * input here rather than the fields being static per command. */ export interface CommandSchemas { readonly input: DataPortSchemaObject | undefined; /** Task config, which the CLI takes on single-dash flags. */ readonly config: DataPortSchemaObject | undefined; } export interface CommandSchemaProvider { readonly path: readonly string[]; resolve(args: readonly string[]): Promise; } export declare function registerCommandSchemaProvider(provider: CommandSchemaProvider): void; export declare function resetCommandSchemaProvidersForTesting(): void; /** * The form for one command: its positional arguments, then whatever its input * schema declares, then its flags. * * A command with no schema provider degrades to arguments and flags, which is * every command a downstream CLI adds without doing anything. */ export declare function resolveCommandFields(node: WebCommandNode, args: readonly string[]): Promise; export type WorkflowGraphLoader = (id: string) => Promise; /** The two commands whose real input lives in a schema rather than in flags. */ export declare function registerBuiltInSchemaProviders(loadWorkflowGraph: WorkflowGraphLoader): void;