export { R as RunInProcessOptions, a as RunInSubprocessOptions, r as runInProcess, b as runInSubprocess } from '../runner-B7GNc6fB.js'; import { SerializedError, PluginContextDescriptor, PlatformServices } from '@kb-labs/plugin-contracts'; import '@kb-labs/core-resource-broker'; import '@kb-labs/core-platform'; /** * IPC Protocol for sandbox communication * * Defines message types between parent and child process. */ /** * Message from parent to child: Execute handler */ interface ExecuteMessage { type: 'execute'; descriptor: PluginContextDescriptor; socketPath: string; handlerPath: string; input: unknown; cwd: string; outdir?: string; } /** * Message from parent to child: Abort execution */ interface AbortMessage { type: 'abort'; } /** * Union of messages from parent to child */ type ParentMessage = ExecuteMessage | AbortMessage; /** * Message from child to parent: Execution result * * Contains raw handler return value — no host-specific wrapping. * Host layer (CLI, REST, Workflow) is responsible for interpreting the data. */ interface ResultMessage { type: 'result'; data: unknown; } /** * Message from child to parent: Execution error */ interface ErrorMessage { type: 'error'; error: SerializedError; } /** * Message from child to parent: Ready to receive */ interface ReadyMessage { type: 'ready'; } /** * Message from child to parent: Log line emitted during execution. * Sent in real-time as handler produces output (platform.logger, shell stdout/stderr). */ interface LogMessage { type: 'log'; entry: { level: string; message: string; stream: 'stdout' | 'stderr'; lineNo: number; timestamp: string; meta?: Record; }; } /** * Union of messages from child to parent */ type ChildMessage = ResultMessage | ErrorMessage | ReadyMessage | LogMessage; /** * Type guard for ParentMessage */ declare function isParentMessage(msg: unknown): msg is ParentMessage; /** * Type guard for ChildMessage */ declare function isChildMessage(msg: unknown): msg is ChildMessage; /** * Platform RPC client for subprocess * * Connects to parent process's UnixSocketServer to access platform services via RPC. */ /** * Connect to parent process platform services via Unix socket RPC * * @param socketPath Path to UnixSocketServer socket */ declare function connectToPlatform(socketPath?: string): Promise; /** * Disconnect from platform services */ declare function disconnectFromPlatform(): Promise; export { type AbortMessage, type ChildMessage, type ErrorMessage, type ExecuteMessage, type ParentMessage, type ReadyMessage, type ResultMessage, connectToPlatform, disconnectFromPlatform, isChildMessage, isParentMessage };