import * as path from "node:path";
/**
 * Test seam: builds the synthetic ES module source for a virtual specifier
 * against an explicit registry. Pure (no globalThis read); the emitted source
 * still routes runtime lookups through `globalThis[BUNDLED_REGISTRY_GLOBAL]`.
 */
export declare function __synthesizeLegacyPiBundledSourceWithRegistry(registryKey: string, registry: Readonly<Record<string, Readonly<Record<string, unknown>>>>): string;
/**
 * Test seam: returns the globalThis key the synthetic loader reads from. Tests
 * assert that the emitted source addresses the exact stash key the install
 * function writes to, so a rename can't break extension loads silently.
 */
export declare function __getLegacyPiBundledRegistryGlobal(): string;
/**
 * Compute the package root for the npm prebuilt `dist/cli.js` bundle.
 *
 * `bundle-dist.ts` defines `process.env.PI_BUNDLED="true"`; after bundling,
 * `import.meta.dir` points at `<package>/dist`. Do not resolve the package via
 * bare `@oh-my-pi/pi-coding-agent` here: from a global install Bun can pick an
 * older cache entry, recreating mixed-runtime plugin loading.
 */
export declare function __computeBundledSelfPackageRoot(metaDir: string, pathImpl?: typeof path): string;
/**
 * Resolve the path the TypeBox compatibility shim ships at, then drop it when
 * the source file is missing.
 *
 * In compiled-binary mode the shim is served through the
 * `omp-legacy-pi-bundled:` virtual namespace (issue #3423) — bunfs paths are
 * unreachable on Bun 1.3.14+, so the virtual specifier is always available and
 * needs no filesystem probe. In dev / source-link / installed-package mode the
 * shim is an on-disk source file; validation mirrors
 * `__validateLegacyPiPackageRootOverrides` (#2168): if the computed candidate
 * doesn't exist (e.g. an install that dropped the source — issue #3414),
 * `resolveTypeBoxSpecifier` returns `undefined` and
 * `rewriteLegacyExtensionSource` leaves bare `typebox` / `@sinclair/typebox`
 * specifiers alone, so Bun falls through to native resolution against the
 * extension's own `node_modules`.
 *
 * Exported for tests; production callers use `TYPEBOX_SHIM_PATH`.
 */
export declare function __resolveTypeBoxShimPath(isCompiled: boolean, sourcePath: string, pathExistsSync?: (p: string) => boolean): string | null;
/**
 * Drop overrides whose filesystem targets are missing so they can fall
 * through to the canonical-resolution path. Virtual `omp-legacy-pi-bundled:`
 * entries always pass — the bundled registry is the source of truth in
 * compiled-binary mode where bunfs paths are unreachable (issue #3423).
 *
 * `pathExistsSync` defaults to `fs.existsSync`; tests inject a stub to
 * simulate the missing-entrypoint failure mode without touching the real FS.
 */
export declare function __validateLegacyPiPackageRootOverrides(candidates: Record<string, string>, pathExistsSync?: (p: string) => boolean): Record<string, string>;
/**
 * Compute the override map keyed by every canonical specifier the host serves
 * directly: the pi-ai / pi-coding-agent roots (compat shims that re-attach
 * legacy helpers) plus, in compiled-binary mode, every other canonical pi-*
 * package root AND every non-wildcard subpath registered in the bundled
 * registry (see `legacy-pi-bundled-keys.ts`). Subpath coverage is what stops
 * `@(scope)/pi-ai/oauth` and friends from falling through to the extension's
 * own — possibly absent — peer install when bunfs filesystem walks fail
 * (issue #3442 follow-up to #3423). Exported as a test seam so the
 * compiled-binary branch is verifiable from dev tests.
 */
export declare function __buildLegacyPiPackageRootOverrides(isCompiled: boolean): Record<string, string>;
/** Test seam for compiled-binary legacy extension source rewriting. */
export declare function __rewriteLegacyExtensionSourceForTests(source: string, importerPath: string, mtimeTag?: string | null): Promise<string>;
/**
 * Load a legacy Pi extension module from its real on-disk location.
 *
 * The extension runs in place, so its `import.meta.url` is the real source file
 * and `__dirname`-relative `readFileSync` asset loads (HTML/CSS bundled next to
 * the entry) resolve exactly as they do under the original Pi runtime — no
 * temp-directory mirroring and no asset copying. An `onLoad` hook scoped to the
 * entry's source graph rewrites only host-resolved compatibility imports in the
 * extension's own source; everything else resolves natively.
 */
export declare function loadLegacyPiModule(resolvedPath: string): Promise<unknown>;
export declare function installLegacyPiSpecifierShim(): void;
/** Test seam: clears the memoized canonical specifier resolutions. */
export declare function __resetLegacyPiResolutionCache(): void;
