import type { ConciergeStatus } from "./concierge.js"; import type { BoardSummary } from "./board.js"; import type { ContextInfo, JobRow, OpArgs, OpResults, ReplyMode } from "./protocol-schema.js"; export type { ConciergeActArgs, ConciergeArgs, ConciergeOrderArgs, ContextInfo, DaemonStatus, DispatchArgs, DispatchOrigin, HandbackArgs, HelloArgs, HelloResult, JobRow, JobStateName, JobStatus, OpArgs, OpResults, PeerRow, ReplyMode, ScheduleRow, SendResult, TaskArgs, WaitingFor, WorkerReport, } from "./protocol-schema.js"; export { ArgSchemas, OPS, ResultSchemas } from "./protocol-schema.js"; /** M31: the protocol version this daemon and these clients speak (docs/protocol.md). */ export declare const PROTOCOL_VERSION = 1; /** * M31: what an agent can do, said in its hello. Unknown ones are ignored; the list only * grows with a protocol version. */ export declare const AGENT_CAPABILITIES: readonly ["report", "replies", "steer", "usage", "context", "model-switch", "transcript", "peers", "agent-items"]; export type AgentCapability = (typeof AGENT_CAPABILITIES)[number]; /** M31: what the daemon offers agents beyond report, ack and hello (its hello answers with it). */ export declare const DAEMON_CAPABILITIES: readonly ["replies", "steer", "agent-items", "peers", "spawn", "handback", "events", "watch", "tasks", "workspaces"]; export type DaemonCapability = (typeof DAEMON_CAPABILITIES)[number]; export type Op = keyof OpArgs; export type RequestOf = { id: number; op: O; args?: OpArgs[O]; }; export type Request = { [O in Op]: RequestOf; }[Op]; export type ArgsOf = OpArgs[O]; export type ResultOf = OpResults[O]; export type OkResponse = { id: number; ok: true; result: OpResults[O]; }; export type ErrResponse = { id: number; ok: false; error: string; code?: string; }; export type Response = OkResponse | ErrResponse; export type Event = { event: "job"; job: JobRow; } | { event: "removed"; id: string; } /** M44: the concierge's status changed (on, off, a notice, an answer, its budget). */ | { event: "concierge"; status: ConciergeStatus; } /** M47: the task board changed (its counts; `task list` has the tasks). */ | { event: "board"; board: BoardSummary; } /** Daemon → worker, on the connection the worker reports on. */ | { event: "deliver"; id: string; seq: number; text: string; /** M9: absent for user replies; agent items carry an envelope as text (M43: a notice is a watch that fired; M44: a digest wakes the concierge). */ kind?: "reply" | "message" | "report" | "notice" | "digest"; from?: string; relation?: string; /** M9: a report to a foreground peer, acknowledged with peer_ack. */ ref?: string; /** M28: how a user reply joins a running turn. */ mode?: ReplyMode; }; /** A ContextInfo from untrusted JSON (a report, state.json), or null. */ export declare function contextFrom(v: unknown): ContextInfo | null; /** M49: a line longer than this (in characters) is not a message of this protocol: the reader gives the stream up. */ export declare const LINE_MAX: number; export declare class LineTooLong extends Error { constructor(max: number); } /** * Splits a stream into lines. Only what just arrived is scanned for newlines (a long * line in progress is not read again on every chunk). A line past `max` throws * LineTooLong once; after that the reader takes nothing more. */ export declare class LineReader { private decoder; private partial; private dead; private readonly max; constructor(max?: number); push(chunk: Buffer | string): string[]; private giveUp; } export declare function encodeLine(value: unknown): string;