import { type Reply } from './client.js'; import type { MeshMessage, Tier } from './protocol.js'; /** * Presence for processes Monomind itself launches (`agent exec` runtimes, org role runs). The * launched agent cannot be trusted to join on its own, and its pid may be one the hub cannot see * (a sandboxed child lives in another pid namespace and looks dead to `kill(pid, 0)`), so the * long-lived parent monomind process registers on its behalf under its own pid and heartbeats * for the length of the run. */ type Call = (req: Record) => Promise; export interface ManagedJoinOptions { tier: Extract; runtime: string; /** Project directory; decides the project id and the default alias. */ cwd: string; /** Alias to ask for; default `--`, made unique with `-2`… */ alias?: string; task?: string; agentId?: string; /** Address of the session that launched this run, when there is one. */ parent?: string; /** Hub transport for presence; tests pass fakes. */ call?: Call; byeCall?: Call; /** Whole join (hub start-up included) is abandoned after this long. Default 2500 ms. */ timeoutMs?: number; intervalMs?: number; started?: Date; } export interface ManagedPresence { alias: string; addr: string; /** Environment that lets `monomind mesh send|inbox` in the child act as this agent. */ env: Record; /** Unread messages as sealed peer content, marking them read. Empty string when none or offline. */ unreadBlock(limit?: number): Promise; leave(): Promise; } /** Peer messages as a block the agent is told is data. The closing tag cannot be forged from a body. */ export declare function sealMessages(messages: MeshMessage[], more?: boolean): string; /** What an `agent exec` runtime is told: its mesh name, how to message others, and what is waiting. */ export declare function externalPreamble(alias: string, unread: string): string; /** The mesh note appended to an org role's system prompt. */ export declare function roleNote(alias: string, unread: string): string; /** The switch the MCP server's auto-join uses: MONOMIND_MESH_AUTOJOIN=0 turns presence off. */ export declare function meshAutojoinEnabled(env?: NodeJS.ProcessEnv): boolean; /** * Registers a launched process on the mesh. Best effort: resolves to undefined when the hub is * down, refuses, or does not answer in time; never throws and never leaves a registration behind * for a join that was abandoned. */ export declare function joinManaged(o: ManagedJoinOptions): Promise; export {}; //# sourceMappingURL=managed-presence.d.ts.map