UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

41 lines (40 loc) • 2.11 kB
import type { MailboxStore } from "../core/mailbox-store.js"; import type { PeerChannel } from "../core/peer-channel.js"; import { type PeerLaneConfig } from "./peer-admission.js"; import { type PeerRegistryDirectoryRefusal } from "./peer-directory.js"; import { type CcProcessProbe } from "./cc-peer-directory.js"; /** Why `listen` refused to bind (closed set): one of the directory-vetting codes, or one of these. */ export type CcPeerChannelRefusal = PeerRegistryDirectoryRefusal | "unsupported_platform" | "socket_path_too_long" | "address_in_use" | "already_listening" | "publish_failed"; export declare class CcPeerChannelError extends Error { readonly code: CcPeerChannelRefusal; readonly path?: string; constructor(code: CcPeerChannelRefusal, message: string, path?: string); } export interface CcUdsPeerChannelOptions { /** The store this session's box lives in (inbound frames are appended here). */ mailbox: MailboxStore; /** Where `listen` binds (`ccPeerDefaultLocations().socketPath` puts it beside the reference's own). */ socketPath: string; /** The reference's session registry (`ccPeerDefaultLocations().registryDir`): `listen` publishes this * session's key file and row there; `dial` / `nudge` read a peer's key there. */ registryDir: string; /** The peer lane's knob table (`RunnerDeps.peerLane`): `maxQueuedPeerMessages` bounds inbound appends. */ lane?: Partial<PeerLaneConfig>; /** What this session's registry row says about it beyond its ids. */ registration?: { name?: string; cwd?: string; startedAt?: number; entrypoint?: string; }; /** Tests: this process's pid, the start-token reader, the clocks and walls, the uid / platform. */ pid?: number; probe?: Pick<CcProcessProbe, "processStartToken" | "processExists">; now?: () => number; firstLineDeadlineMs?: number; sendTimeoutMs?: number; nudgeTimeoutMs?: number; uid?: number; platform?: NodeJS.Platform; } export declare function createCcUdsPeerChannel(opts: CcUdsPeerChannelOptions): PeerChannel;