import type { AgentTool } from "@apholdings/jensen-agent-core"; import { type Static } from "@sinclair/typebox"; import { type PowerShellConfig } from "../../utils/shell.js"; import { type TruncationResult } from "./truncate.js"; /** * Stateful stream decoder that normalizes PowerShell output to UTF-8. * * PowerShell may emit UTF-16LE (with or without BOM) or UTF-8 depending on * the host version and whether the encoding preamble takes effect. * This decoder detects the encoding on the first non-empty chunk and * decodes consistently across arbitrary chunk boundaries using TextDecoder. * * @internal Exported for testing. */ export declare class PowerStreamDecoder { private decoder; private encoding; private haveReadFirstChunk; /** * Detect encoding from the first bytes of the stream. * Returns "utf-16le" if a BOM or NUL-alternation pattern is found, * "utf-8" otherwise. */ private detectEncoding; /** Feed a chunk. Returns decoded UTF-8 string, or "" if nothing to emit. */ feed(chunk: Buffer): string; /** Flush any remaining decoder state. Call once when the stream closes. */ flush(): string; /** Whether any data has been fed to this decoder. */ get hasData(): boolean; } declare const powershellSchema: import("@sinclair/typebox").TObject<{ command: import("@sinclair/typebox").TString; timeout: import("@sinclair/typebox").TOptional; }>; export type PowerShellToolInput = Static; export interface PowerShellToolDetails { truncation?: TruncationResult; fullOutputPath?: string; cancelled?: boolean; } export interface PowerShellValidateResult { valid: boolean; error?: string; } export interface PowerShellOperations { exec: (command: string, cwd: string, options: { onData: (data: Buffer) => void; signal?: AbortSignal; timeout?: number; env?: NodeJS.ProcessEnv; }) => Promise<{ exitCode: number | null; }>; /** * Validate that the PowerShell transport works correctly. * Runs a probe command and verifies stdout is properly captured. * If the probe returns exit 0 but no stdout marker, the transport is broken * (likely encoding mismatch on Windows PowerShell 5.1). */ validate?: (cwd: string, options: { signal?: AbortSignal; timeout?: number; }) => Promise; } export interface CreateLocalPowerShellOperationsOptions { resolveConfig?: () => PowerShellConfig; } export declare function createLocalPowerShellOperations(options?: CreateLocalPowerShellOperationsOptions): PowerShellOperations; export interface PowerShellToolOptions { operations?: PowerShellOperations; } export declare function resetPowerShellHealthCheck(): void; export declare function createPowerShellTool(cwd: string, options?: PowerShellToolOptions): AgentTool; export declare const powershellTool: AgentTool; }>, any>; export {}; //# sourceMappingURL=powershell.d.ts.map