import type { ExecOptions as PiExecOptions, ExecResult as PiExecResult } from '@earendil-works/pi-coding-agent'; import type { Classifier } from './classifier/index.js'; import type { Logger } from './logger.js'; import type { RuntimeFiles } from './runtime-files.js'; export type ExecOptions = PiExecOptions; export interface AgentRuntimeExecOptions extends PiExecOptions { /** Maximum combined stdout/stderr bytes retained by the host adapter, without terminating the command. */ readonly maxOutputBytes?: number; } export interface AgentRuntimeExecResult extends Omit { /** True when output exceeded maxOutputBytes or maxBuffer. Only maxBuffer terminates the command. */ readonly truncated?: boolean; } export type ExecResult = AgentRuntimeExecResult; export type AgentRuntimeShellFlavor = 'default' | 'posix'; export type AgentRuntimeTerminationSignal = 'SIGTERM' | 'SIGKILL'; export interface AgentRuntimeShellOptions extends AgentRuntimeExecOptions { readonly env?: Readonly>; readonly shellFlavor?: AgentRuntimeShellFlavor; } export type AgentRuntimeKind = 'host' | 'docker' | 'daytona'; export type AgentRuntimeStorageScope = 'session' | 'agent'; export interface AgentRuntimeProcessReadOptions { readonly waitMs?: number; readonly maxBytes?: number; readonly signal?: AbortSignal; } export interface AgentRuntimeProcessSnapshot { readonly output: Uint8Array; readonly nextOffset: number; readonly running: boolean; readonly exitCode?: number; readonly signal?: AgentRuntimeTerminationSignal; } export interface AgentRuntimeProcess { readonly pid: number | undefined; read(afterOffset: number, options?: AgentRuntimeProcessReadOptions): Promise; write(content: Uint8Array): Promise; interrupt?(): Promise; terminate(signal?: AgentRuntimeTerminationSignal): Promise; dispose(): Promise; } export interface AgentRuntimeStdioProcess extends AgentRuntimeProcess { readStdout(afterOffset: number, options?: AgentRuntimeProcessReadOptions): Promise; readStderr(afterOffset: number, options?: AgentRuntimeProcessReadOptions): Promise; closeInput(): Promise; } export interface AgentRuntimeStdioProcessOptions { readonly cwd?: string; readonly env?: Readonly>; } export interface AgentRuntimeShellProcessOptions { readonly cwd?: string; readonly env?: Readonly>; readonly shell?: string; readonly shellFlavor?: AgentRuntimeShellFlavor; readonly login?: boolean; readonly stdin?: boolean; } export interface AgentRuntimeProcesses { startShell(command: string, options?: AgentRuntimeShellProcessOptions): Promise; /** Starts a literal-argv process whose protocol output must remain separate from diagnostics. */ startStdio?(command: string, args: readonly string[], options?: AgentRuntimeStdioProcessOptions): Promise; } export interface AgentRuntimePrivateRuntime { /** Creates or validates an owner-private, deterministic directory for short-lived local coordination. */ ensureDirectory(namespace: string): Promise; } export interface AgentRuntimeTerminalOptions extends AgentRuntimeShellProcessOptions { readonly id?: string; } export interface AgentRuntimeTerminals { /** Reattaches a root-scoped terminal without transferring its host-owned lifetime. */ attach?(id: string): AgentRuntimeProcess | undefined; startShell(command: string, options?: AgentRuntimeTerminalOptions): Promise; } export interface AgentRuntimeStorage { readonly root: string; readFile(path: string, options?: AgentRuntimeFileReadOptions): Promise; writeFile(path: string, content: Uint8Array): Promise; appendFile(path: string, content: Uint8Array): Promise; listFiles(path: string, options?: AgentRuntimeListFilesOptions): Promise; mkdir(path: string, options?: { recursive?: boolean; }): Promise; remove(path: string, options?: { recursive?: boolean; }): Promise; } export interface AgentRuntimeFileReadOptions { readonly maxBytes?: number; } export interface AgentRuntimeFileWriteOptions { readonly exclusive?: boolean; readonly noFollow?: boolean; readonly readOnly?: boolean; } export interface AgentRuntimeListFilesOptions { /** Traverse descendants instead of returning only immediate entries. */ readonly recursive?: boolean; /** Include directories as well as regular files in the returned paths. */ readonly includeDirectories?: boolean; /** Include symlinks and special files without traversing them. */ readonly includeOther?: boolean; /** Maximum entry depth below the requested directory; immediate entries have depth 1. */ readonly maxDepth?: number; /** Match returned paths with `/`-separated glob syntax. */ readonly pattern?: string; /** Omit matching paths and prune matching directories before traversal. */ readonly ignore?: readonly string[]; /** Return at most this many entries, ordered by relative path. */ readonly limit?: number; /** Stop traversal when the operation is cancelled. */ readonly signal?: AbortSignal; } /** Task timestamps use ISO 8601 strings, not epoch milliseconds. */ export interface AgentRuntimeTask { readonly id: string; readonly title: string; readonly description?: string; readonly acceptanceCriteria?: string; readonly priority?: number; readonly status: 'pending' | 'in_progress' | 'blocked' | 'completed' | 'cancelled'; readonly blockedBy: readonly string[]; readonly ownerSessionId?: string; readonly claimedAt?: string; readonly notes?: string; readonly result?: string; readonly blockedReason?: string; readonly createdAt?: string; readonly updatedAt?: string; readonly completedAt?: string; } export interface AgentRuntime { readonly kind: AgentRuntimeKind; readonly cwd: string; readonly host?: { readonly name: string; readonly version: string; }; /** User directory in the runtime path namespace, when user resources are available. */ readonly userHome?: string; readonly classifier?: Classifier; readonly logger: Logger; readonly processes?: AgentRuntimeProcesses; readonly privateRuntime?: AgentRuntimePrivateRuntime; readonly terminals?: AgentRuntimeTerminals; readonly files?: RuntimeFiles; readonly tasks?: { /** Reports the full current task graph, not incremental updates. */ changed?(tasks: readonly AgentRuntimeTask[]): void; }; storage(scope?: AgentRuntimeStorageScope): AgentRuntimeStorage; exec(command: string, args: readonly string[], options?: AgentRuntimeExecOptions): Promise; shell(command: string, options?: AgentRuntimeShellOptions): Promise; readFile(path: string, options?: AgentRuntimeFileReadOptions): Promise; writeFile(path: string, content: Uint8Array, options?: AgentRuntimeFileWriteOptions): Promise; listFiles(path: string, options?: AgentRuntimeListFilesOptions): Promise; mkdir(path: string, options?: { recursive?: boolean; }): Promise; remove(path: string, options?: { recursive?: boolean; }): Promise; readAgentFile?(path: string): Promise; getEnvironmentVariable?(name: string): string | undefined; } //# sourceMappingURL=runtime.d.ts.map