import { type SolidFS, type SolidFsProjection } from '../../solidfs'; import type { RdfSearchIndexingService } from '../service/RdfSearchIndexingService'; import type { RdfSearchReconciliationRepository } from '../../search/RdfSearchReconciliationRepository'; import type { AgentRuntimeEvent } from './AgentRuntimeTypes'; import type { RunExecutionBackend, RunExecutionInput } from './RunExecutionBackend'; type PiSdk = typeof import('@mariozechner/pi-coding-agent'); export interface PiAgentRuntimeDriverOptions { /** * local: run pi's full Agent Loop in the API process. * cloud: run the entire pi Agent Loop in a sandboxed worker process. */ agentLoopIsolation?: 'in-process' | 'sandboxed-process'; /** * Cloud defaults to strict sandboxing: do not fall back to an unsandboxed * process if sandbox-exec/bubblewrap is unavailable. */ requireSandbox?: boolean; workerPath?: string; sandboxedLoopRunner?: (input: RunExecutionInput, workdir: string) => AsyncIterable; sessionRootDir?: string; /** * Off by default: pi sessions are request-scoped implementation detail. When * enabled, the JSONL session is a diagnostic copy only; Xpod still restores * authoritative state from Run/Thread/Message before each execution. */ persistPiSessions?: boolean; piSdk?: PiSdk; solidfs?: SolidFS; solidfsProjection?: SolidFsProjection; solidfsJournalRootDir?: string; rdfSearchIndexingService?: RdfSearchIndexingService; rdfSearchReconciliationRepository?: Pick; } /** * Request-scoped adapter around pi's AgentSession primitives. * * Xpod restores durable conversation state into pi with replaceMessages() on * every run. pi owns the atomic agent loop, tools and streaming events for the * current invocation only; its SessionManager is not the Xpod state center. */ export declare class PiAgentRuntimeDriver implements RunExecutionBackend { private readonly options; private static sdkPromise?; private readonly git; private readonly warmRuntimes; private readonly solidfs; constructor(options?: PiAgentRuntimeDriverOptions); private createDefaultSolidFsSyncer; start(input: RunExecutionInput): AsyncIterable; private startInProcess; private startSandboxedAgentLoop; private projectPiEvent; private resolvePiConfig; private resolveApiForBaseUrl; private resolveThinkingLevel; private resolveTools; private getWarmRuntime; private createWarmRuntime; private createSolidFsCodingTools; private createSolidFsReadOnlyTools; private createSolidFsReadOperations; private createSolidFsEditOperations; private createSolidFsWriteOperations; private ensureSolidFsWritablePath; private ensureSolidFsPath; private canHydrateWorkspace; private detectImageMimeType; private warmRuntimeKey; private hashSecret; private toPiMessages; private toRetrievedContextMessage; private retrievedContextMetadataTags; private prepareWorkspace; private resolveWorkspaceSource; private canResolveFileWorkspace; private mapPodUrlToLocalPath; private createSessionManager; private resolveSessionDir; private resolveWorkerPath; private workerEnv; private extractText; private formatError; private startupErrorToEvent; private logWorkspaceRollbackError; private loadPiSdk; } export declare const PI_AGENT_WORKER_EVENT_PREFIX = "XPOD_AGENT_EVENT "; export {};