UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

40 lines • 2.62 kB
/** * The one spelling of an endpoint every client derives the same way. On POSIX that is the socket path * with its directory resolved through its deepest existing ancestor (`/tmp` vs `/private/tmp`, a * symlinked agent directory) - the identity the ensure lock is keyed by - and a path already spelled * that way comes back unchanged. On win32 it is the normalized lower-cased path the pipe name is derived * from. An abstract socket has no directory to resolve. Deliberately total: naming a directory must never * fail on a path shape the transport would reject, or a client could not even report WHERE it was looking. */ export declare function canonicalEndpointPath(socket: string, platform?: NodeJS.Platform): string; /** * The directory name every client recomputes from the socket alone: `sha256(<canonical endpoint>)`, so * every spelling of one endpoint shares one directory, and a canonical spelling keeps the name it had * when the name was hashed from the spelling itself. */ export declare function daemonDirectoryName(socket: string, platform?: NodeJS.Platform): string; /** Whether two spellings name one endpoint. */ export declare function sameEndpoint(socket: string, other: string): boolean; /** * Whether a record naming `socket` belongs in the directory called `name`: the canonical name, or the * name a build that hashed the spelling itself gave it - that directory has to stay listable, and * therefore collectable by `host gc`, after the upgrade. */ export declare function socketNamesDirectory(socket: string, name: string): boolean; /** * The owner-keyed shard naming contract every client computes identically - senpi, omo (library * import) and the Desktop (a local mirror checked against `senpi host shard-path`): `p` shards belong * to a parent session, `i` shards to an interactive thread. The key is `sha256("<kind>:<owner>")` in * hex, first 16 characters; the socket is `<root>/<kind>-<key>.sock`. */ export type ShardKind = "p" | "i"; export declare function shardKey(kind: ShardKind, ownerId: string): string; /** The socket of a shard whose key is already known. No hashing: the key IS the name. */ export declare function shardSocketPathForKey(root: string, kind: ShardKind, key: string): string; export declare function shardSocketPath(root: string, kind: ShardKind, ownerId: string): string; /** Which shard a socket names, from its basename alone; `null` for any other endpoint. */ export declare function parseShardSocket(socket: string): { readonly kind: ShardKind; readonly key: string; } | null; //# sourceMappingURL=host-endpoint-names.d.ts.map