/** The seven verbs the far side implements. An eighth is a two-repo change. */ export type PostOfficeVerb = 'agents.list' | 'threads.open' | 'messages.send' | 'messages.read' | 'messages.ack' | 'handoff.request' | 'handoff.respond'; export interface PostOfficeError { error: string; code: 'HQ_NOT_CONFIGURED' | 'HQ_UNAUTHORIZED' | 'HQ_FORBIDDEN' | 'HQ_NOT_FOUND' | 'HQ_REJECTED' | 'HQ_UNAVAILABLE'; hint?: string; } export declare function isPostOfficeError(v: unknown): v is PostOfficeError; /** * One request to the post office. * * Every failure is mapped to something a caller can act on. The far side is * deliberate about its status codes — 403 names the scope it wanted, 404 * distinguishes an unknown recipient from an unknown thread — and flattening * those into "request failed" would discard the part that tells you what to fix. */ export declare function postOfficeCall(verb: PostOfficeVerb, payload?: Record): Promise | PostOfficeError>; export declare function agentsList(): Promise | PostOfficeError>; export interface ThreadsOpenInput { subject: string; /** * HQ project UUID, NOT a Decibel project slug. hq.agent_threads.project_id is * a uuid referencing hq.projects, so passing 'decibel-tools-mcp' is rejected * by Postgres rather than resolved. There is no lookup verb in the seven, so * a caller that does not already hold the uuid should omit this. */ project?: string; intent?: string; } export declare function threadsOpen(input: ThreadsOpenInput): Promise | PostOfficeError>; export interface MessagesSendInput { to: string; thread: string; summary: string; intent?: 'inform' | 'request' | 'respond'; context_refs?: string[]; request?: string; expected_output?: string; } export declare function messagesSend(input: MessagesSendInput): Promise | PostOfficeError>; export interface MessagesReadInput { thread?: string; status?: string; limit?: number; } /** * Read this agent's mail. * * `status` is deliberately NOT defaulted, and polling must not set it to * 'sent'. The far side marks sent -> read as a side effect of reading, so a * mailbox query filtered to status='sent' never returns a message twice: a * reader that fetches and then dies before acting has silently consumed it, * and no restart recovers it. Unfiltered, the same message comes back as * 'read' and can still be acted on. * * That is the whole reason read and ack are separate verbs — at-least-once * beats at-most-once here, because a duplicated message costs a minute and a * dropped handoff stalls work invisibly. */ export declare function messagesRead(input?: MessagesReadInput): Promise | PostOfficeError>; export interface MessagesAckInput { message: string; } /** Idempotent by construction on the far side: acking twice is not an error. */ export declare function messagesAck(input: MessagesAckInput): Promise | PostOfficeError>; export interface HandoffRequestInput { thread: string; to?: string; summary?: string; } export declare function handoffRequest(input: HandoffRequestInput): Promise | PostOfficeError>; export interface HandoffRespondInput { thread: string; accept: boolean; summary?: string; } export declare function handoffRespond(input: HandoffRespondInput): Promise | PostOfficeError>; //# sourceMappingURL=postoffice.d.ts.map