/**
 * In-world MCP registration helper.
 *
 * After `olam create` spawns a fresh world container, we register the
 * agentmemory MCP server inside that world's claude config so the
 * in-world claude session reaches the host-side agent-memory service
 * without manual `claude mcp add` from the operator.
 *
 * Architecture:
 *
 *   host           docker exec               world container
 *   ----           ----------               ---------------
 *   olam create  ─►   docker exec     ─►    claude mcp add agentmemory
 *                                               --scope user
 *                                               --env AGENTMEMORY_URL=...
 *                                               --env AGENTMEMORY_SECRET=...
 *                                               -- agentmemory-mcp
 *
 * The `agentmemory-mcp` bin is pre-baked into the devbox image (B2), so
 * there's no `npx -y` cold-start at first claude invocation (T6).
 *
 * Idempotency: re-running against an already-registered world is a noop.
 * We detect via `claude mcp list` exit code + stderr signature (same
 * "No <scope> MCP server found" pattern reused from the host-side
 * `olam memory uninstall` helper).
 *
 * Graceful skip: when the world wasn't spawned with AGENTMEMORY_* env
 * (because the host memory service was absent at spawn time per B1),
 * we skip registration with an informative log. The world keeps working
 * — the @agentmemory/mcp shim falls back to local InMemoryKV.
 *
 * Plan reference: docs/plans/olam-agent-memory-distributed/phase-b-tasks.md B3
 */
import { type SpawnSyncReturns } from 'node:child_process';
/** Inject points for tests. */
export interface DockerExecDeps {
    /** Wrap spawnSync so tests can stub claude/docker calls. */
    spawn: (cmd: string, args: string[], opts: {
        encoding: 'utf8';
        stdio: ['ignore', 'pipe', 'pipe'];
    }) => SpawnSyncReturns<string>;
    /** Optional logger; defaults to console.log. */
    log?: (msg: string) => void;
}
export declare const DEFAULT_DOCKER_EXEC_DEPS: DockerExecDeps;
/**
 * Result shape — `outcome` is the load-bearing field. Callers use it to
 * decide whether to print a success line vs. a graceful-skip notice.
 */
export type RegisterOutcome = {
    outcome: 'registered';
    scope: 'user';
} | {
    outcome: 'already-registered';
    scope: 'user';
} | {
    outcome: 'skipped-no-env';
    reason: string;
} | {
    outcome: 'failed';
    rc: number;
    detail: string;
};
export interface RegisterAgentMemoryMcpOpts {
    /** Full container name, e.g. `olam-<world-id>-devbox`. */
    containerName: string;
    /** The AGENTMEMORY_URL value that was injected at world spawn (B1). */
    agentmemoryUrl: string;
    /** The AGENTMEMORY_SECRET value that was injected at world spawn (B1). */
    agentmemorySecret: string;
}
/**
 * Probe whether `agentmemory` is already registered inside the world's
 * claude. Uses `claude mcp list` which prints a structured list; we
 * just look for the name in the output. Returns:
 *   - `'present'`   — already registered (idempotent skip path)
 *   - `'absent'`    — not registered yet (proceed to add)
 *   - `'unknown'`   — `claude mcp list` failed for any reason; we don't
 *                     pretend to know the state, caller decides.
 */
export declare function probeMcpListed(containerName: string, deps: DockerExecDeps): 'present' | 'absent' | 'unknown';
/**
 * Register the agentmemory MCP server inside a world container.
 *
 * - Skips silently when `agentmemorySecret` is empty (the world was
 *   spawned without B1's env injection because the host memory service
 *   was absent at spawn time).
 * - Skips idempotently when `claude mcp list` already shows the server.
 * - Otherwise shells to `docker exec <world> claude mcp add agentmemory
 *   --scope user --env ... -- agentmemory-mcp`.
 *
 * The bearer secret transits as an argv element of the spawned `claude`
 * process inside the container (same shape as the host-side
 * `olam memory install`). Documented in the operator-facing
 * docs/architecture/agent-memory.md security model.
 */
export declare function registerAgentMemoryMcp(opts: RegisterAgentMemoryMcpOpts, deps?: DockerExecDeps): RegisterOutcome;
//# sourceMappingURL=world-mcp-register.d.ts.map