@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
48 lines • 3.07 kB
TypeScript
/**
* The `get_protocol_info` answer as a CLIENT reads it: the shape, and the tolerant parse that
* produces it.
*
* This is a BOUNDARY: everything past it is typed, and nothing past it re-validates. Every identity
* field is optional because a host from an older release answers without them, and an absent field
* stays absent rather than being defaulted - a guessed `0` generation or a guessed ordinal would be
* a comparison a client could act on, which is precisely what must not happen (I2). The one field
* that IS defaulted is `protocolVersion`, to `0`, because no client speaks protocol 0: a reply from
* before the field existed therefore fails closed instead of matching.
*/
import { type PathIdentityResolverStatus } from "./path-identity-status.ts";
import type { EngineOrdinal } from "../../core/engine-build-identity.ts";
import type { RpcLaunchProfile } from "./rpc-types.ts";
/**
* A `get_protocol_info` answer as a CLIENT reads it. Every identity field is optional because a
* host from an older release answers without them; absence is read as "uncomparable", never as zero.
*/
export interface HostProtocolInfo {
/** Absent on older hosts. A stopping generation never admits a new session. */
readonly lifecycle?: "ready" | "stopping";
readonly protocolVersion: number;
/** Informational only. Nothing in this module compares it. */
readonly serverVersion: string;
readonly capabilities: readonly string[];
/** Which host PROCESS answered. A handoff is complete exactly when this value changes. */
readonly instanceId?: string;
/** Which generation of the daemon that process is; `0` until the first handoff. */
readonly generation?: number;
readonly engineVersion?: string;
readonly engineOrdinal?: EngineOrdinal;
readonly launch_profile?: RpcLaunchProfile;
/** Whether the answering host's memory sampler reads pressure right now; absent on classic and older hosts. */
readonly memory_pressure?: boolean;
/** The permission system's path identity resolver as the host reports it; absent on older hosts. */
readonly path_identity_resolver?: PathIdentityResolverStatus;
/** Content digest of the runtime the host loaded at startup (`sha256:<64 hex>`); absent on older hosts. */
readonly runtimeBuildId?: string;
/** The agent directory the host reads and writes; absent on older hosts. Only a client of the same dir may replace it. */
readonly agentDir?: string;
/** The conditional idle handover this host holds, as it reported it. */
readonly handover?: Readonly<Record<string, unknown>>;
}
/** Parses the `data` of a `get_protocol_info` reply. Unknown or malformed identity fields are dropped, not guessed. */
export declare function parseHostProtocolInfo(data: unknown): HostProtocolInfo | undefined;
/** An engine ordinal on the wire: exactly five numbers, else `undefined` (never a guessed ordinal). */
export declare function parseEngineOrdinal(value: unknown): EngineOrdinal | undefined;
//# sourceMappingURL=host-protocol-info.d.ts.map