@sema-agent/core
Version:
Stateless, task-oriented AI agent core
35 lines (34 loc) • 2.03 kB
TypeScript
import { type ExecResult, type ExecutionEnv, ExecutionError, FileError, type FileInfo, type Result } from "../internal/harness.js";
/**
* A no-op ExecutionEnv for tool/MCP-only deployments (no shell, no filesystem).
*
* AgentHarness requires an `env`, but the normal tools+MCP code path never touches it.
* Every filesystem op returns a `not_supported` FileError; `exec` returns `shell_unavailable`.
* If a task genuinely needs shell/fs, supply a real ExecutionEnv instead (e.g. a Node or SSH one).
*/
export declare class StubExecutionEnv implements ExecutionEnv {
cwd: string;
/** design/380 O9a — declared on the class so the prepare fold can read the optional interface
* member off a `ExecutionEnv | StubExecutionEnv` union; the no-I/O stub produces no target
* content, so it never declares (always `undefined` — the trusted-side default). */
readonly externalContentTarget?: boolean;
constructor(cwd?: string);
private fsErr;
absolutePath(path: string): Promise<Result<string, FileError>>;
joinPath(): Promise<Result<string, FileError>>;
readTextFile(path: string): Promise<Result<string, FileError>>;
readTextLines(path: string): Promise<Result<string[], FileError>>;
readBinaryFile(path: string): Promise<Result<Uint8Array, FileError>>;
writeFile(path: string): Promise<Result<void, FileError>>;
appendFile(path: string): Promise<Result<void, FileError>>;
fileInfo(path: string): Promise<Result<FileInfo, FileError>>;
listDir(path: string): Promise<Result<FileInfo[], FileError>>;
canonicalPath(path: string): Promise<Result<string, FileError>>;
exists(path: string): Promise<Result<boolean, FileError>>;
createDir(path: string): Promise<Result<void, FileError>>;
remove(path: string): Promise<Result<void, FileError>>;
createTempDir(): Promise<Result<string, FileError>>;
createTempFile(): Promise<Result<string, FileError>>;
exec(): Promise<Result<ExecResult, ExecutionError>>;
cleanup(): Promise<void>;
}