import type { SchemeResult } from "@plurnk/plurnk-schemes"; import type { ClientInteractionRequest, ClientInteractionResolution } from "@plurnk/plurnk-contracts"; import type { PackageAttributions } from "@plurnk/plurnk-meta"; import type { Notice } from "./Notice.ts"; export type ChannelState = "active" | "closed" | "errored"; export interface ChannelDecl { mimetype: string; defaultState?: ChannelState; } export interface ExecutorMetadata { runtime: string; glyph: string; } export interface ExecArgs { runtime: string; body: string; cwd: string | null; target: string | null; env?: NodeJS.ProcessEnv; signal: AbortSignal; write: (channel: string, chunk: string, mimetype?: string) => void; setState: (channel: string, state: ChannelState) => void; emit: (notice: Notice) => void; interact: (request: ClientInteractionRequest) => Promise; entry?: (path: string, content: string | null, opts: { tags: string[]; mimetype?: string; }) => Promise; } export interface ExecResult extends SchemeResult { exitCode?: number; } export type Effect = "pure" | "read" | "host"; export interface RuntimeAvailability { available: boolean; detail?: string; } export interface RuntimeBodyDecl { readonly role: string; readonly required: boolean; } export type RuntimeTargetKind = "literal" | "path" | "resource"; export interface RuntimeTargetDecl { readonly role: string; readonly required: boolean; readonly kind: RuntimeTargetKind; readonly directory?: "cwd"; } export interface RuntimeInvocationExample { readonly body?: string; readonly target?: string; } interface RuntimeInvocationShape { readonly body: RuntimeBodyDecl; readonly target?: RuntimeTargetDecl; readonly exclusive?: true; } export type RuntimeInvocation = RuntimeInvocationShape & ({ readonly example: RuntimeInvocationExample; readonly signature?: never; } | { readonly example?: never; readonly signature: string; }); export interface RuntimeRegisteredTool { readonly target: string; readonly summary: string; readonly invocation: RuntimeInvocation; readonly details?: string; } export interface RuntimeToolRegistry { readonly tools: readonly RuntimeRegisteredTool[]; } export interface ExecInfo { runtime: string; glyph: string; summary: string; invocation: RuntimeInvocation; details: string; resourcesPath?: string; expandTools?: boolean; packageName: string; attribution?: string | string[]; } export interface RuntimeDecl { name: string; glyph?: string; summary: string; invocation: RuntimeInvocation; details?: string; resourcesPath?: string; expandTools?: boolean; } export type RuntimesHook = () => RuntimeDecl[] | Promise; export type ExecRegistry = ReadonlyMap; export interface Discovery { registry: ExecRegistry; packageAttributions: PackageAttributions; skipped: string[]; disabled: string[]; } export interface DiscoverOptions { cwd?: string; packageDirs?: string[]; } export interface SpawnArgs { /** Command to invoke (e.g. "node", "python3", or — when useShell — the raw command). */ cmd: string; /** Args passed to the command. */ args: string[]; /** When true, the command is interpreted as a shell line (cmd is the whole line, args ignored). */ useShell: boolean; /** * When set, written to the child's stdin which is then closed. For filter-style * runtimes that read their program/input from stdin (`bc`, `tclsh`) or that need * EOF with no input (`awk` BEGIN-only). Omitted = stdin left at its default. */ stdin?: string; } export {}; //# sourceMappingURL=types.d.ts.map