@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
30 lines • 2.12 kB
TypeScript
import type { Server } from "node:net";
import { type SocketFileIdentity } from "./socket-ownership.ts";
export declare function resolveSocketPath(value: string, agentDir: string): string;
export declare function formatSocketAddress(socketPath: string): string;
export declare const ALIAS_PREFIX = "senpi-bind-";
export declare const ALIAS_LINK = "d";
/** The alias owner record `{ pid, processStartTime, createdAt }` the alias reaper proves the owner dead by. */
export declare const ALIAS_OWNER = ".owner";
/**
* The one start-time reader both the alias writer and its reaper use: in UTC, so a host and a later sweep running
* under different TZ values read the same instant (review r3 LOW 1). An error surfaces to the caller.
*/
export declare function readAliasOwnerStartTime(pid: number): Promise<string | undefined>;
/** The roots a long-path bind may place its alias in, in preference order (also what the alias reaper scans). */
export declare const bindAliasRoots: () => readonly string[];
/** Exported for tests: the mode/owner half of `guardedRoot`, which needs no real directory of another owner. */
export declare function rootModeIsGuarded(entry: {
readonly mode: number;
readonly uid: number;
}, self: number | undefined): boolean;
/**
* Binds and publishes the socket at `socketPath` without ever resolving a link there (#5319). macOS `bind(2)`
* follows a dangling symlink and creates the socket at its target, so the socket is bound inside a fresh private
* directory and published with `link(2)`: atomic, never follows the new name, and fails EEXIST on ANY entry that
* took the endpoint after `prepareSocketPath` (a planted link, or a live socket). `rename(2)` would silently
* replace that entry instead. Returns the identity of the published entry; shutdown removes the path only while
* that identity still matches. Windows pipes and Linux abstract sockets have no filesystem entry and bind directly.
*/
export declare function listen(server: Server, socketPath: string, secret?: Uint8Array): Promise<SocketFileIdentity | undefined>;
//# sourceMappingURL=host-socket-bind.d.ts.map