@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
33 lines (32 loc) • 1.86 kB
TypeScript
import type { IncomingMessage } from "node:http";
import { type LinkResult, linkComputer } from "./link.js";
import { type Json } from "./protocol.js";
/** The Hook routes for linked computer sets (docs/conductor-sets.md). */
interface LocalInfo {
computer: {
id: string;
name: string;
aliases?: string[];
};
}
/** `GET /v1/conductor`: this computer's live conductor and what a peer needs
* to place it in a set. Asked with the caller's name or host key, it also
* says whether this computer lists the caller back. */
export declare function conductorAnswer(info: LocalInfo, url: URL): Promise<Json>;
/** `GET /v1/sets`: this computer's set and every set its one-way peers are in, plus unlinked computers. */
/** How long the sets view waits for each peer. A live peer answers in a
* second or two; an unreachable one held every reading of the view for the
* full 8 s, and the phone, which reads every computer's sets, gave up on
* the slow ones and showed linked computers as unlinked. A peer past this
* shows as unreachable in this reading only; conductor checks keep 8 s. */
export declare const SETS_PEER_TIMEOUT_MS = 4000;
export declare function readSets(info: LocalInfo): Promise<Json>;
/** `POST /v1/sets/name`: names this computer's set. The owner's call is sent
* on to every reachable member; a member's relay (with `namedAt`) is kept
* when newer than the name held, and goes no further. */
export declare function nameSet(data: Json): Promise<Json>;
/** `POST /v1/sets/link`: the phone's one-tap `phren bridge link <name>`. Runs
* on the computer whose set lists `name` as indirect or one-way, over this
* computer's own ssh login, one link at a time. */
export declare function linkSetMember(data: Json, request: Pick<IncomingMessage, "headers">, link?: typeof linkComputer): Promise<LinkResult>;
export {};