import type { RelayCliSurface } from '@agent-relay/cli-surface'; import { type CliIo, type CommandArgSpec } from './cli.js'; import { type RelayhistoryCloudClient } from './cloud-contract.js'; export type { RelayhistoryCloudClient } from './cloud-contract.js'; interface CloudArgs { positional: readonly string[]; flags: ReadonlyMap; } interface CloudCommandSpec { /** Path under the mounted group. Always two tokens: `cloud `. */ path: readonly [string, string]; description: string; args?: readonly CommandArgSpec[]; options: readonly string[]; run(client: RelayhistoryCloudClient, args: CloudArgs, io: CliIo): Promise; } type Route = { kind: 'local'; words: readonly string[]; } | { kind: 'cloud'; spec: CloudCommandSpec; }; /** * Surface path to what runs it. * * The mounted spelling and `ai-hist`'s own argv are not the same — `list` here * is `ai-hist sessions list` — so the table carries the translation rather than * leaving it implied. */ declare function buildRoutes(): Map; /** Longest-first match on the leading tokens; `null` when nothing routes. */ declare function resolve(routes: ReadonlyMap, argv: readonly string[]): { route: Route; rest: readonly string[]; } | null; export interface RelayhistorySurfaceOptions { /** * A `@relayhistory/cloud-client`. Supply it and the `cloud` subcommands are * declared and routable; leave it out and they are declared nowhere, though * `run` still recognises them well enough to name the remedy. */ cloud?: RelayhistoryCloudClient; /** * Cancels a mounted command whose spec is `cancellable`. * * The contract forbids a surface from installing signal handlers, because * the process's signals belong to the host. It also gives `run` no way to * carry cancellation per invocation, so the host hands its own signal in * here when it builds the surface, exactly as it does its cloud client. * Nothing below installs a handler; this is the host's signal, passed * through. */ signal?: AbortSignal; } /** * Build the CLI surface a host mounts as `agent-relay sessions`. * * @param options - Optional cloud client to compose into the tree, and the * host's cancellation signal for the long-running commands. * @returns A surface whose `commands` and `run` are both derived from the * command tables, so neither can describe a command the other does not. */ export declare function createRelayCliSurface(options?: RelayhistorySurfaceOptions): RelayCliSurface; /** Everything the drift test needs to walk the dispatch side. */ export declare const __testing: { CLOUD_COMMANDS: readonly CloudCommandSpec[]; CLOUD_FLAG_SPECS: Record; buildRoutes: typeof buildRoutes; resolve: typeof resolve; }; //# sourceMappingURL=relay-cli.d.ts.map