UNPKG

@code-yeongyu/senpi

Version:

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

36 lines • 1.6 kB
import { type Socket } from "node:net"; import { ToolChildCodecError } from "./codec.ts"; import type { ToolChildMessage } from "./protocol.ts"; export declare const TOOL_CHILD_ROLE_ENV = "SENPI_INTERNAL_ROLE"; export declare const TOOL_CHILD_CHANNEL_ENV = "SENPI_TOOL_CHILD_CHANNEL"; export declare const TOOL_CHILD_SECRET_ENV = "SENPI_TOOL_CHILD_CHANNEL_SECRET"; export type ChannelCloseReason = { readonly kind: "eof"; } | { readonly kind: "codec"; readonly code: ToolChildCodecError["code"]; } | { readonly kind: "error"; readonly message: string; }; export interface ToolChildChannel { send(message: ToolChildMessage): boolean; /** Subscribes; the returned function unsubscribes. */ onMessage(listener: (message: ToolChildMessage) => void): () => void; readonly closed: Promise<ChannelCloseReason>; close(): void; } export declare function wrapChannelSocket(socket: Socket): ToolChildChannel; export interface ChannelListener { readonly env: Readonly<Record<typeof TOOL_CHILD_CHANNEL_ENV | typeof TOOL_CHILD_SECRET_ENV, string>>; /** The first authenticated connection; the listener stops accepting once it arrives. */ readonly accepted: Promise<ToolChildChannel>; close(): Promise<void>; } export declare function openChannelListener(options: { readonly dir: string; readonly generation: number; }): Promise<ChannelListener>; export declare function channelEnvPresent(env: NodeJS.ProcessEnv): boolean; export declare function connectChannel(env: NodeJS.ProcessEnv): Promise<ToolChildChannel>; //# sourceMappingURL=channel.d.ts.map