import type { NodeIdDTO, NodeStatusDTO } from './common.js'; /** `POST /v1/nodes/{id}/revive` body. */ export interface ReviveRequest { /** Resume the saved conversation (true) vs a fresh launch (false). */ resume?: boolean; /** Clear the finalization latch before reviving (the `--reopen` gate). The * revive doorway accepts it only for a finalized node (`not_finalized` * otherwise); without it, a finalized node is rejected (`node_finalized`). * Message delivery has its own wider reopen behavior. */ reopen?: boolean; /** Wake provenance: the cron whose run drove this revive (`CRTR_CRON_ID`, * set by the daemon in every cron run's environment and forwarded by the * CLI). With `resume:false` and a still-live cron row, crtrd injects the * `` block so the revived node learns a CLOCK woke it, not a * message. Prose only — an unknown id is ignored, never an error. */ cron_id?: string; } /** Result of a revive. `revived` is false on the idempotent double-revive no-op. */ export interface ReviveResultDTO { node_id: NodeIdDTO; revived: boolean; resumed: boolean; status: NodeStatusDTO; /** What the call did: `launched` started a broker, `already-live` found one * already running, `frozen` found no free broker slot and left the row * waiting for one. */ outcome: 'launched' | 'already-live' | 'frozen'; } /** `POST /v1/nodes/{id}/relaunch-root` result. A null id means the target * was not a relaunchable live root, or its replacement failed to launch. */ export interface RelaunchRootResultDTO { newNodeId: NodeIdDTO | null; } /** `POST /v1/nodes/revive-all` result. Node ids relaunched, any that failed to * revive with the reason, and any the broker cap turned away (the reader * reports all three). */ export interface ReviveAllResultDTO { revived: NodeIdDTO[]; failed: { node_id: NodeIdDTO; error: string; }[]; /** Frozen for capacity, not failed: the daemon relaunches these as slots free. */ frozen: NodeIdDTO[]; } /** `POST /v1/nodes/{id}/close` body. The cascade set is computed server-side * from edges; the flag only opts out of cascading descendants. */ export interface CloseRequest { cascade?: boolean; /** PID of the shell that invoked this close. The daemon excludes this process * and its descendants from broker teardown so a node can close itself. */ caller_pid?: number; /** Root close disposition: `true` finalizes the root to `done` (the browse `x` * "finish" semantics); default/`false` cancels it. The cascade set (computed * server-side) is torn down either way. */ finish?: boolean; } /** Result of a close. */ export interface CloseResultDTO { /** The closed node — the cascade root. */ root: NodeIdDTO; /** Every node torn down (root + cascaded descendants), leaves-first. */ closed: NodeIdDTO[]; /** Descendants left alive because an out-of-subtree manager still subscribes. */ spared: NodeIdDTO[]; } /** `POST /v1/nodes/{id}/promote` body. */ export interface PromoteRequest { /** Specialize as this kind of orchestrator; defaults to the node's current kind. */ kind?: string; /** Also flip lifecycle→resident (interactable). */ resident?: boolean; /** Durably change the model tier (ultra|strong). */ model?: string; } /** `POST /v1/nodes/{id}/yield` body. */ export interface YieldRequest { note?: string; promote?: boolean; /** Respecialize the kind as the node refreshes. */ kind?: string; /** Durably raise the model tier (ultra|strong) for the fresh revive. */ model?: string; } /** `POST /v1/nodes/{id}/wait` body. */ export interface WaitRequest { controller: NodeIdDTO; }