declare namespace command_d_exports { export { Command, CommandArgument, CommandExecution, CommandHandlerResult, CommandInput, CommandRegistry, CommandResult, CommandSchema, Parseable, SchemaInput, SchemaOutput, decodeCommandSchema, parseCommandSchema }; } export type Parseable = Readonly<{ parse: (value: Input) => Output; parseAsync?: (value: Input) => Promise; }>; /** Structural mirror of portable neutral contracts: components cannot import host modules. */ interface ValidationIssue { readonly message: string; readonly path?: readonly (PropertyKey | { readonly key: PropertyKey; })[]; } type ValidationResult = { readonly value: Output; readonly issues?: undefined; } | { readonly issues: readonly ValidationIssue[]; }; interface StandardSchema { readonly '~standard': { readonly version: 1; readonly vendor: string; readonly types?: { readonly input: Input; readonly output: Output; }; readonly validate: (value: unknown) => ValidationResult | Promise>; }; } interface NeutralDecoder { readonly kind: 'contract'; readonly types?: { readonly input: Input; readonly output: Output; }; readonly decode: (value: unknown) => Execution; } export type CommandSchema = Parseable | StandardSchema | NeutralDecoder | Promise>>; /** Raw values accepted before decoding, including transform inputs. */ export type SchemaInput = Schema extends NeutralDecoder ? Input : Schema extends { _input: infer Input; } ? Input : Schema extends StandardSchema ? Input : SchemaOutput; export type SchemaOutput = Schema extends Parseable ? ReturnType : Schema extends NeutralDecoder ? Output : Schema extends StandardSchema ? Output : never; export type CommandHandlerResult> = SchemaInput; export type CommandRegistry = Readonly>; /** Values accepted from callers before the command schema parses them. */ export type CommandArgument> = SchemaInput; export type CommandInput> = SchemaOutput; export type CommandResult> = SchemaOutput; export type CommandExecution> = Readonly<{ context: Context; operation: Key; definition: Registry[Key]; command: CommandInput; parseResult: (value: Input) => CommandResult; /** Interpreter-owned asynchronous result decoding, preserving the legacy parser. */ decodeResult?: (value: Input) => Promise>; /** Runs the handler (result-parsed). Accepts a middleware-enriched context. */ run: (context?: Context) => Promise>; /** Runs without parsing for owners that validate after their middleware chain. */ runUnparsed: (context?: Context) => Promise>; }>; type CommandDefinition = Readonly<{ command: CommandSchema; result: CommandSchema; }>; type Operation = Extract; type MaybePromise = Value | Promise; type Execute = >(execution: CommandExecution) => Promise>; type FixedExecutor> = Readonly<{ operation: Key; handler: (context: Context, command: CommandInput) => MaybePromise>; }>; type DynamicExecutor> = Readonly<{ dispatcher: Parseable; select: (dispatcher: Dispatcher) => Key; handler: (context: Context, command: CommandInput) => MaybePromise>; }>; /** Generic command kernel. Host policy is injected by the owning domain. */ export declare class Command { #private; constructor(configuration: { readonly operations: Registry; readonly execute: Execute; }); exec>(executor: FixedExecutor): (context: Context, command: CommandArgument) => Promise>; exec>(executor: DynamicExecutor): (context: Context, command: Dispatcher) => Promise>; } /** Legacy synchronous parsing remains available to existing kernel interpreters. */ export declare function parseCommandSchema(schema: S, value: unknown): SchemaOutput; /** Interpreter-owned decoding awaits validation and leaves thrown/rejected defects intact. */ export declare function decodeCommandSchema(schema: S, value: unknown): Promise>; //#endregion export { command_d_exports }; //# sourceMappingURL=command.d.mts.map