@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
50 lines (49 loc) • 2.06 kB
TypeScript
export declare const UNPAIR_USAGE = "phren unpair [<number> | SHA256:<fingerprint> | --all | --notifications]";
export interface PhoneKey {
line: string;
device: "ios" | "android";
fingerprint: string;
}
/** The phone keys `phren pair` and the phone's password sign-in wrote, in file order. */
export declare function phoneKeys(authorizedKeys: string): PhoneKey[];
export interface ProcessRow {
pid: number;
ppid: number;
uid: number;
command: string;
}
export declare function parseProcessRows(output: string): ProcessRow[];
/**
* The SSH connections to end after a key is removed. sshd does not say which
* key opened a connection, and one that is already open keeps working without
* its authorized_keys line: it can open the Hook pipe again at any time. So
* every connection of this user that runs nothing but the Phren gateway, or
* nothing at all, is ended; the phones and computers still enrolled reconnect.
* A connection running anything else (a login shell, an editor's server, this
* command itself) is left alone.
*/
export declare function gatewayConnections(rows: ProcessRow[], options: {
uid: number;
root: string;
self: number;
}): {
sessions: number[];
children: number[];
};
/**
* End them; returns how many connections were ended. A sign-in that was accepted
* just before the key went can still be finishing, so the scan runs again after
* a pause until one pass finds nothing.
*/
export declare function endGatewayConnections(root?: string, pauseMs?: number): Promise<number>;
/**
* Push registrations are not tied to an SSH key, so the removed phone's cannot
* be told from the others: the Hook drops them all. With no Hook running, the
* saved list goes and the next Hook starts without it.
*/
export declare function forgetPushRegistrations(root?: string): Promise<number>;
export declare function runUnpair(args: string[], options?: {
sshDirectory?: string;
endConnections?: () => Promise<number>;
forgetPush?: () => Promise<number>;
}): Promise<number>;