@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
32 lines (31 loc) • 2.21 kB
TypeScript
import { type Json } from "./protocol.js";
import { type OwnerInbox } from "./owner-inbox.js";
/** The phone gives one aggregate read ten seconds, so a compact peer read gets
* six: a slow Hook lands in `unreachable` while the others' rows stay. */
export declare const COMPACT_PEER_TIMEOUT_MS = 6000;
/** A compact item: the fields above, and nothing an older or newer peer added.
* `reconcile` keeps the aggregation keys, for a Hook reading another Hook.
* `issues` adds the structured issue link for a reader that asked for it; every
* other reader gets the link appended to the title instead (see `inboxWire`). */
export declare function compactInboxItem(item: Json, reconcile?: boolean, issues?: boolean, rules?: boolean): Json;
/** What a manual row is about, when it says: its issue link, else a title that
* opens with `name#N`. A link names the repository by its last two segments and
* by its name alone, since agents write either. */
export declare function inboxSubjects(item: Json): string[];
/** One row per subject: the newest stands for the group and lists the others in
* `also` (`{id,updatedAt,inboxComputer,title}`), so a reader can show and close
* them together. Rows that name no subject are left alone. */
export declare function mergeInboxSubjects(items: Json[]): Json[];
/** Aggregate each Hook's own inbox once, without recursively listing peers.
* inboxComputer identifies the Hook to send a resolution to; computer on a
* dispatch row names the worker and can be a different computer.
*
* `compact` asks for the phone's wire item. It is sent to peers too, but every
* read is projected again here: an older peer ignores it and answers in full,
* and a newer peer may add fields this build does not know.
*
* A compact peer read also carries `reconcile=1`, which keeps the keys the
* aggregation below filters and dedupes on (live, source, actionId); they are
* stripped again before the phone sees the aggregate. A Hook answering its own
* `?local=1&compact=1&reconcile=1` read keeps them for the same reason. */
export declare function ownerInboxView(inbox: OwnerInbox, input: unknown, localOnly?: boolean, compact?: boolean, reconcile?: boolean): Promise<Json>;