/**
 * Claude Code / OpenClaw hook + plugin installer.
 *
 * Copies the cortex-memory hook into the hooks directory and
 * the real-time plugin into the OpenClaw extensions directory.
 * Supports both Claude Code (native binary) and legacy OpenClaw (Node.js).
 */
/**
 * Detect whether ShieldCortex is running inside a Docker container
 * or similar isolated environment (Umbrel, Unraid, NixOS sandbox, etc.).
 *
 * In these environments, OpenClaw hook/plugin installation may crash or
 * produce broken state. We warn and skip by default.
 */
export declare function isDockerEnvironment(): boolean;
/**
 * Find ALL valid hook directories for install/uninstall/status.
 *
 * Only returns user-space directories that survive package updates.
 * Creates the hooks/ subdirectory if the parent config dir exists.
 */
export declare function findAllHooksDirs(): string[];
/**
 * The standard installed-hook destination: `~/.openclaw/hooks/cortex-memory`.
 * Resolves the real user's home (sudo-aware) so doctor/postinstall agree with
 * the install path.
 */
export declare function defaultHookDestDir(): string;
/**
 * Single source of truth for "the installed hook copy is out of date".
 *
 * The cortex-memory hook is installed by FILE COPY (see `copyHookFiles`) into
 * `~/.openclaw/hooks/cortex-memory/`. A package update does NOT automatically
 * re-copy it, so the installed `handler.ts` / `runtime.mjs` can drift behind
 * the package's `HOOK_SOURCE` version. This compares every HOOK_FILE in
 * `destDir` against the packaged source by content.
 *
 * Pure + synchronous (fs reads only, no writes, no side effects). Returns
 * `true` if any required file is missing from `destDir` OR differs byte-for-byte
 * from the packaged source. Returns `false` only when every file is present and
 * identical. On any unexpected read error it returns `true` (fail toward
 * "refresh needed") so a half-readable install is never reported as current.
 *
 * If the package's own `HOOK_SOURCE` is missing (corrupt/partial package), the
 * comparison is impossible, so this returns `false` — we can't claim the
 * install is stale relative to a source we can't read.
 */
export declare function hookFilesStale(destDir?: string): boolean;
/**
 * Pure idempotency check for the openclaw.json plugin registration.
 *
 * Returns true if the config needs to be rewritten — i.e. ANY of the
 * load-bearing fields differ from the desired state. Returns false when
 * the config already matches and a re-install would otherwise produce a
 * no-op write (which churned the gateway's config-watcher every
 * `shieldcortex openclaw install` pre-v4.12.11).
 *
 * Intentionally treats `installedAt` as transient — only differing on
 * that field does NOT force a write, otherwise this function would
 * always trip on its own previous timestamp.
 *
 * Exported for direct unit testing without booting the full installer.
 */
export declare function pluginInstallNeedsWrite(config: unknown, pluginId: string, _installDir: string, _version: string): boolean;
/**
 * Install options for `shieldcortex openclaw install`.
 */
export interface OpenClawInstallOptions {
    /** Skip hook installation (--no-hooks flag) */
    noHooks?: boolean;
    /** Skip plugin installation (--no-plugins flag) */
    noPlugins?: boolean;
    /**
     * Best-effort restart of the OpenClaw gateway after install so the freshly
     * copied hook + plugin files are picked up without manual intervention.
     * Defaults to true. Set to false (or pass `--no-gateway-restart` from the
     * CLI) to skip the restart.
     *
     * Symmetric with `uninstall --deep`'s gateway-restart, which has been live
     * since v4.12.0. Without this on the install side, an upgrade of the npm
     * package leaves the running gateway with the old plugin in memory until
     * something else triggers a restart — observed on Edith 2026-04-25 where
     * the npm package was on 4.12.5 but the plugin loaded was still 4.12.2,
     * silently producing zero memories.
     */
    restartGateway?: boolean;
}
export declare function installOpenClawHook(options?: OpenClawInstallOptions): Promise<void>;
export declare function uninstallOpenClawHook(): Promise<void>;
export declare function openClawHookStatus(): Promise<void>;
/**
 * `shieldcortex openclaw repair` (v4.25.5).
 *
 * Diagnoses and fixes the duplicate-plugin-id mess that `shieldcortex doctor`'s
 * "OpenClaw dup installs" check surfaces. Two distinct cases:
 *
 *   1. **Sticky hooks/ duplicate** — when a copy sits at `~/.openclaw/hooks/
 *      shieldcortex-realtime/`, plain `rm -rf` reverts on the next
 *      `openclaw plugins update` because OpenClaw's hook-pack install
 *      tracking re-creates it. The only reliable purge is a full
 *      `openclaw plugins uninstall` + `plugins install @latest` round-trip,
 *      which clears every tracking record at once. Customer-side config
 *      under `~/.openclaw/openclaw.json` → `plugins.entries.shieldcortex-
 *      realtime` (interceptor severity actions, cloudApiKey, autoMemory
 *      thresholds, the enabled flag, allowlist membership) is wiped by
 *      `plugins uninstall`, so this function snapshots it first and
 *      restores it after reinstall.
 *
 *   2. **Extensions/ leftovers** — legacy install locations and
 *      `.trash-*` / `*.disabled-*` directories. No sticky state — a simple
 *      `rm -rf` suffices.
 *
 * Memory data at `~/.shieldcortex/` is never touched.
 *
 * If something fails between uninstall and restore, the snapshot is also
 * written to `~/.openclaw/openclaw.json.repair-backup-<ts>` so the user
 * can recover manually.
 */
export declare function repairOpenClawPlugin(): Promise<void>;
export declare function handleOpenClawCommand(subcommand: string, extraArgs?: string[]): Promise<void>;
