import type { InboxTierDTO, IsoTime, NodeIdDTO } from './common.js'; /** `POST /v1/nodes/{id}/messages` body. */ export interface SendMessageRequest { body: string; tier?: InboxTierDTO; /** Sender node id for feed attribution (the CLI resolves `CRTR_NODE_ID`; * the daemon has no ambient caller identity). Absent → an external/human * caller (`from: null`). */ from?: NodeIdDTO | null; /** Revive with no inbox entry (`--fresh` → `reviveNode({ resume: false })`). */ fresh?: boolean; /** Clear a latched target's finalization latch before an immediate delivery * or `--fresh` revive (`--reopen`). Immediate only. */ reopen?: boolean; /** Hidden ambient context upserted onto the target's sidecar and delivered as * a `` block, never visible chat (`--situational-context`). * Immediate only; valid alone (no body). */ situational_context?: string; /** Raw JSON-schema string granting a one-off `submit` tool before delivery * (`--output-schema`). Immediate only. */ output_schema?: string; /** `'interactive'`: deliver via the target's LIVE broker engine (prompt/steer * on its one serialized frame loop — the same ordering a tmux viewer gets) * instead of the durable inbox; a dormant or mid-revive target falls back to * the durable inbox + revive (watcher delivers post-boot). Plain immediate * body only — rejected with fresh/reopen/situational_context/ * output_schema or tier 'deferred'. Absent → durable inbox (unchanged). */ delivery?: 'interactive'; } /** Result of an immediate message send. */ export interface MessageResultDTO { node_id: NodeIdDTO; /** Whether an inbox entry was appended now. */ delivered: boolean; /** Whether a dormant target was revived to receive the message. */ revived: boolean; delivered_at?: IsoTime; /** Which channel a `delivery:'interactive'` send actually used: `'engine'` * (live broker frame loop, no inbox entry) or `'inbox'` (durable fallback). * Absent for non-interactive sends. */ delivered_via?: 'engine' | 'inbox'; } /** `POST /v1/nodes/{id}/interrupt` result — the human Esc, first-class. Cancels * pending undelivered human-send inbox entries FIRST, then aborts a live * in-flight turn; a dormant target is NEVER revived. */ export interface InterruptResultDTO { node_id: NodeIdDTO; /** Primary outcome: `aborted_turn` wins over `canceled_pending` over `idle` * (abort + cancel can co-occur; the flags below carry the full picture). */ outcome: 'aborted_turn' | 'canceled_pending' | 'idle'; /** True when a live in-flight turn (or `!` bash run) was actually aborted. */ aborted_turn: boolean; /** How many pending undelivered human-send inbox entries were canceled. */ canceled_pending: number; }