import type { NativeDirectoryTreeSnapshot } from "@gajae-code/natives"; import type { InternalResource, InternalUrl, ProtocolHandler } from "./types"; export interface ManagedLegacyLocalMigrationEntry { readonly relativePath: string; readonly kind: "directory" | "file"; readonly bytes?: Uint8Array; readonly sha256?: string; } /** Opaque authority for a managed session's legacy `local` artifact tree. */ export interface ManagedLegacyLocalMigrationSource { capture(): Promise<{ readonly snapshot: NativeDirectoryTreeSnapshot; readonly entries: readonly ManagedLegacyLocalMigrationEntry[]; } | null>; retire(snapshot: NativeDirectoryTreeSnapshot): void; } export interface LocalProtocolOptions { getArtifactsDir?: () => string | null; isManagedDestination?: () => boolean; getManagedLegacyLocalMigrationSource?: () => ManagedLegacyLocalMigrationSource | null; getCredentialSessionId?: () => string | null; getSessionId?: () => string | null; } export declare function initializeLocalRoot(options: LocalProtocolOptions): Promise; export declare function resolveLocalRoot(options: LocalProtocolOptions): string; export declare function resolveLocalUrlToPath(input: string | InternalUrl, options: LocalProtocolOptions): string; /** * Protocol handler for local:// URLs. * * URL forms: * - local:// - Lists files at the session local root * - local:// - Reads a file under the session local root */ export declare class LocalProtocolHandler implements ProtocolHandler { #private; readonly scheme = "local"; readonly immutable = false; /** * Install an explicit local-protocol mapping owned by the caller. * * The most recently installed live mapping wins. The returned disposer removes * only this registration and is safe to call more than once. */ static installOverride(value: LocalProtocolOptions): () => void; /** * Install a process-global test override that wins over owned and registry * mappings. Prefer {@link installOverride} for lifecycle-bound production use. */ static setOverride(value: LocalProtocolOptions | undefined): void; /** Reset all process-global local-protocol overrides. Test-only. */ static resetOverrideForTests(): void; /** * Returns the active local-protocol options. * * Resolution order: * 1. Direct test override installed via {@link setOverride}. * 2. The most recently installed live owned override. * 3. A live main session in `AgentRegistry.global()`. */ static resolveOptions(): LocalProtocolOptions | undefined; resolve(url: InternalUrl): Promise; }