import type { ToolDefinition } from "./gateway.js";
export type NetworkPolicy = "inherit" | "none";
export interface SandboxPolicy {
    readonly envAllowlist: readonly string[];
    readonly network: NetworkPolicy;
    readonly maxOutputBytes: number;
    readonly defaultTimeoutMs: number;
    readonly terminationGraceMs: number;
}
export declare const DEFAULT_ENV_ALLOWLIST: readonly string[];
export declare const DEFAULT_SANDBOX_POLICY: SandboxPolicy;
export interface CommandRule {
    readonly executable: string;
    readonly allowedSubcommands?: readonly string[] | undefined;
    readonly deniedSubcommands?: readonly string[] | undefined;
    readonly valueFlags?: readonly string[] | undefined;
    readonly denyFlags?: readonly string[] | undefined;
    readonly knownSubcommands?: readonly string[] | undefined;
}
export declare const DEFAULT_COMMAND_RULES: readonly CommandRule[];
export interface CommandRunInput {
    readonly command: string;
    readonly args?: readonly string[] | undefined;
    readonly cwd?: string | undefined;
    readonly timeoutMs?: number | undefined;
    readonly signal: AbortSignal;
}
export interface CommandResult {
    readonly command: string;
    readonly args: readonly string[];
    readonly exitCode: number | null;
    readonly signal: string | null;
    readonly stdout: string;
    readonly stderr: string;
    readonly durationMs: number;
    readonly timedOut: boolean;
    readonly truncated: boolean;
}
export type PatchChangeKind = "create" | "modify" | "delete";
export interface PatchHunk {
    readonly oldStart: number;
    readonly oldLines: number;
    readonly newStart: number;
    readonly newLines: number;
    readonly lines: readonly string[];
}
export interface PatchFileChange {
    readonly path: string;
    readonly kind: PatchChangeKind;
    readonly hunks: readonly PatchHunk[];
    readonly addedLines: number;
    readonly removedLines: number;
}
export type PatchRejectionCode = "size-limit" | "binary" | "path-unsafe" | "path-denied" | "line-limit" | "file-limit" | "malformed";
export interface PatchRejection {
    readonly code: PatchRejectionCode;
    readonly message: string;
    readonly path?: string | undefined;
}
export interface PatchConflict {
    readonly path: string;
    readonly hunkIndex: number;
    readonly reason: string;
}
export interface PatchValidation {
    readonly ok: boolean;
    readonly files: readonly PatchFileChange[];
    readonly totalChangedLines: number;
    readonly totalBytes: number;
    readonly normalizedDiff?: string | undefined;
    readonly reasons: readonly PatchRejection[];
    readonly conflicts: readonly PatchConflict[];
}
export interface PatchLimits {
    readonly maxPatchBytes: number;
    readonly maxChangedLines: number;
    readonly maxFilesChanged: number;
}
export declare const DEFAULT_PATCH_LIMITS: PatchLimits;
export interface PatchApplyResult {
    readonly changedFiles: readonly string[];
    readonly created: readonly string[];
    readonly deleted: readonly string[];
}
export interface ToolHostConfig {
    readonly sandbox: SandboxPolicy;
    readonly commandRules: readonly CommandRule[];
    readonly patchLimits: PatchLimits;
    readonly applyEnabled: boolean;
    readonly maxReadBytes: number;
}
export declare const DEFAULT_TOOL_HOST_CONFIG: ToolHostConfig;
export interface ToolHostConfigInput {
    readonly sandbox?: Partial<SandboxPolicy> | undefined;
    readonly commandRules?: readonly CommandRule[] | undefined;
    readonly patchLimits?: Partial<PatchLimits> | undefined;
    readonly applyEnabled?: boolean | undefined;
    readonly maxReadBytes?: number | undefined;
}
export interface ToolCallRequest {
    readonly toolCallId: string;
    readonly toolName: string;
    readonly arguments: Record<string, unknown>;
    readonly signal: AbortSignal;
}
export type ToolCallMetadata = {
    readonly kind: "command";
    readonly executable: string;
    readonly argCount: number;
    readonly exitCode: number | null;
    readonly timedOut: boolean;
    readonly sandbox: {
        readonly envAllowlist: readonly string[];
        readonly network: "inherit" | "none";
        readonly maxOutputBytes: number;
        readonly timeoutMs: number;
        readonly terminationGraceMs: number;
        readonly cwdRequested: boolean;
    };
} | {
    readonly kind: "patch-apply";
    readonly changedFiles: number;
    readonly created: number;
    readonly deleted: number;
};
export interface ToolCallResult {
    readonly toolCallId: string;
    readonly output: string;
    readonly durationMs: number;
    readonly commandExecuted?: boolean | undefined;
    readonly metadata?: ToolCallMetadata | undefined;
}
export interface ToolPort {
    readonly execute: (request: ToolCallRequest) => Promise<ToolCallResult>;
    readonly listTools: () => readonly ToolDefinition[];
}
//# sourceMappingURL=tools.d.ts.map