/** * cluster-group-routes.ts, the daemon verbs for LAN group membership. * * These ARE the feature's interface. The `cluster` CLI subcommands, the TUI's * `/cluster` command and any web UI all call these and render what comes back; * none of them contains logic of its own. That is what makes `cluster status` * against a daemon on another machine behave exactly like running it on that * machine. * * Every verb returns the operation layer's structured result verbatim. Nothing * here formats text, and nothing here decides what an operator should see, * `--json` and the human rendering are two views of the same bytes rather than * two code paths that drift. */ import type { RotateKeyResult, CreateGroupResult, ForgetNodeResult, GroupOperationResult, GroupStatusReport, JoinGroupResult, JoinKeyResult, NodesResult } from '../../cluster/group-operations.js'; import type { DiscoveredGroup } from '../../cluster/group-runtime.js'; /** What the daemon facade supplies. One method per verb, no more. */ export interface ClusterGroupVerbs { status(): Promise> | GroupOperationResult; create(input: { name?: string; passphrase?: string; }): Promise>; join(input: { groupId: string; joinKey: string; }): Promise>; key(): Promise> | GroupOperationResult; nodes(): Promise> | GroupOperationResult; groups(): Promise> | GroupOperationResult; forget(nodeId: string): Promise>; rotate(input: { immediate?: boolean; }): Promise>; leave(): Promise>; rename(name: string): Promise>; } /** The router services this dispatcher needs. */ export interface ClusterGroupRouteContext { readonly verbs: ClusterGroupVerbs; /** Non-null means refuse, the daemon's own admin check, unchanged. */ requireAdmin(request: Request): Response | null; parseJsonBody(request: Request): Promise | Response>; } /** * The dispatcher the router adds to its extension list. * * A factory rather than an inline closure in the router, so that wiring a new * route family costs the router one line. `getVerbs` is read on every request * because the LAN group runtime is composed by the HOST, after the router * exists, and when it returns null, `/api/cluster/*` is simply unrouted, which * is the honest answer for an embedder that composed no group runtime. */ export declare function clusterGroupRouteExtension(getVerbs: () => ClusterGroupVerbs | null, host: Pick): (request: Request) => Promise; /** * Route a request against the cluster verbs. * * Returns null when the path is not one of these, so it composes with the rest * of the daemon's dispatchers without shadowing anything. */ export declare function dispatchClusterGroupRoutes(request: Request, context: ClusterGroupRouteContext): Promise; //# sourceMappingURL=cluster-group-routes.d.ts.map