declare namespace NodeJS { interface ProcessEnv { [key: string]: string | undefined; HOME?: string; PI_CODING_AGENT_DIR?: string; } interface Process { pid: number; cwd(): string; env: ProcessEnv; } } declare const process: NodeJS.Process; declare module "node:fs" { export function existsSync(path: string): boolean; export function mkdirSync(path: string, options?: { recursive?: boolean }): void; export function readFileSync(path: string, encoding: "utf-8"): string; export function renameSync(oldPath: string, newPath: string): void; export function rmSync(path: string, options?: { recursive?: boolean; force?: boolean }): void; export function unlinkSync(path: string): void; export function writeFileSync(path: string, content: string, encoding: "utf-8"): void; } declare module "node:os" { export function homedir(): string; } declare module "node:path" { export function basename(path: string): string; export function dirname(path: string): string; export function join(...parts: string[]): string; } declare module "node:url" { export function fileURLToPath(url: unknown): string; } declare module "node:assert/strict" { const assert: { equal(actual: unknown, expected: unknown, message?: string): void; deepEqual(actual: unknown, expected: unknown, message?: string): void; ok(value: unknown, message?: string): void; }; export default assert; } declare module "node:test" { const test: (name: string, fn: () => void | Promise) => void; export default test; } declare module "@earendil-works/pi-coding-agent" { export interface SessionManagerLike { getEntries(): unknown[]; getSessionFile(): string | undefined; getLeafId?(): string | null | undefined; } export interface ExtensionContext { hasUI: boolean; cwd: string; sessionManager: SessionManagerLike; ui: { notify(message: string, level?: "info" | "warning" | "error"): void; }; } export interface ExtensionCommandContext extends ExtensionContext { reload(options?: { beforeSessionStart?: () => void | Promise }): Promise; } export class InteractiveMode {} export interface ExtensionAPI { on( eventName: string, handler: (event: Record, ctx: ExtensionContext) => void | Promise, ): void; appendEntry(customType: string, data?: T): void; sendUserMessage( content: string, options?: { deliverAs?: "steer" | "followUp" }, ): void; registerCommand( name: string, definition: { description: string; handler: (args: string, ctx: ExtensionCommandContext) => void | Promise; }, ): void; } }