/**
 * Global → local CLI delegation.
 *
 * When the CLI is invoked from a **global** install but the current project
 * has its own locally-installed `@agentuity/cli` whose version differs from
 * the running global one, we re-exec the local binary with the same argv and
 * exit with its code.
 *
 * Why: v2 projects pin `@agentuity/cli` in their devDependencies. Once v3
 * becomes the `latest` dist-tag, a v2 user's global `agentuity` would be v3
 * and would mis-handle their v2 project (wrong build, broken deploy). By
 * deferring to the project-local CLI, a v2 user who never upgrades keeps v2
 * behavior even with a v3 binary on their PATH.
 *
 * Scope and guards:
 *   - Only runs when the invoked binary is a global install.
 *   - Only delegates when the local version differs from the global version
 *     (same version → run in-process, no extra spawn).
 *   - Delegates EVERYTHING with no command/flag exclusions: once we've decided
 *     the project-local CLI owns this project, it should own every command,
 *     including `--version` / `--help` / `--ai-help` (so introspection reflects
 *     the CLI actually handling the project) and `upgrade` (so it upgrades the
 *     CLI being used here).
 *   - A loop guard env var (`AGENTUITY_DELEGATED`) prevents the local CLI
 *     from delegating again.
 *
 * Self-heal (Feature 3): when a global v3 CLI runs inside a project that has
 * `@agentuity/runtime` but NO `@agentuity/cli` dependency and no local
 * install, we add `@agentuity/cli` to devDependencies (matching the
 * runtime's spec) and install it, then fall through to delegation. This way
 * v2 projects that were created without the CLI dep still get v2 behavior
 * under a v3 global instead of being mis-handled.
 */
declare const PACKAGE_NAME = "@agentuity/cli";
export interface LocalCli {
    /** Absolute path to the local CLI's executable (the `bin.agentuity` entry). */
    binPath: string;
    /** Version string from the local package's package.json. */
    version: string;
}
/**
 * Walk up from `startDir` looking for a locally-installed `@agentuity/cli`
 * under `node_modules`. Returns its resolved bin path and version, or null.
 */
export declare function findLocalCli(startDir: string): LocalCli | null;
/**
 * If we're a global install sitting on top of a different project-local
 * `@agentuity/cli`, re-exec the local one and exit. Returns without acting
 * (so the caller continues in-process) when delegation doesn't apply.
 *
 * Before delegating, self-heals v2 projects missing the CLI dep (Feature 3):
 * installs a project-local `@agentuity/cli` matching the runtime spec so the
 * subsequent delegation has something to defer to.
 *
 * @param argv - The raw CLI args (without the runtime/script prefix), i.e.
 *               `process.argv.slice(2)`.
 */
export declare function maybeDelegateToLocal(argv: string[]): Promise<void>;
export { PACKAGE_NAME as DELEGATE_PACKAGE_NAME };
//# sourceMappingURL=local-delegate.d.ts.map