import type { EngineerEnvelope } from './contract.js'; /** * Daemon-plane HTTP client (epic #2098, child #4). * * Deliberately NOT src/lib/api.ts: that client injects the USER session JWT * and rotates it on 401. The daemon authenticates with the engagement-scoped * `ek_` bearer minted at `engineer init` — no refresh path, and a 401 means * the token was revoked (engagement closed), which callers must see, not * paper over. The token travels ONLY as the Authorization header; it is never * logged, never in argv, never in any child env. */ export declare class EngineerApiError extends Error { readonly status: number; readonly body?: unknown | undefined; constructor(message: string, status: number, body?: unknown | undefined); } export interface DaemonEngagement { id: string; status: 'provisioning' | 'active' | 'frozen' | 'closed'; slackChannelId: string | null; ourBotUserId: string | null; customerBotUserId: string | null; minApprovedOutbound: number; /** * Mode discovery (FDAE PR4). 'shared' = relay-only daemon: no Slack Socket * Mode, no credential fetch — the backend mirrors envelopes into Slack and * proposal acceptance happens server-side (Ford DM). Absent on older * backends → treated as 'pool' (today's behavior). */ provisioningMode?: 'pool' | 'shared'; /** Shared mode only: proposals waiting on the customer's Authorize press. */ awaitingCustomerProposals?: number; } export interface DaemonSlackCredentials { slackAppId: string; botUserId: string; botToken: string; appToken: string; channelId: string | null; pairedBotUserId: string | null; } export interface DeliveredInstruction { id: string; payload: EngineerEnvelope | Record; approvalState: string; createdAt: string; } export interface InstructionPollResult { status: 'provisioning' | 'active' | 'frozen' | 'closed'; messages: DeliveredInstruction[]; } export type AckResult = 'accepted' | 'injected' | 'declined'; /** Bound client for one engagement's daemon token. */ export interface EngineerDaemonApi { getEngagement(): Promise; getCredentials(): Promise; postMessage(envelope: EngineerEnvelope, extra?: { slackTs?: string; slackThreadTs?: string; senderSlackUserId?: string; }): Promise<{ id: string; deduped: boolean; }>; pollInstructions(waitSeconds: number): Promise; ackInstruction(messageId: string, body: { result: AckResult; acceptedBySlackUserId?: string; detail?: string; }): Promise<{ ok: boolean; }>; disconnect(): Promise; } export declare function createDaemonApi(token: string): EngineerDaemonApi; //# sourceMappingURL=api.d.ts.map