import type { IsoTime, NodeIdDTO } from './common.js'; import type { FeedbackResultDTO } from './human.js'; export type ReviewOriginKindDTO = 'ticket' | 'inline'; /** `binding` is intentionally never exposed over the API. */ export type ReviewStateDTO = 'open' | 'approved' | 'canceled'; /** Caller-supplied body for `POST /v1/human/reviews`. */ export interface CreateReviewRequest { /** Caller-selected review origin. */ origin_kind: ReviewOriginKindDTO; /** Caller-selected node whose persisted session is forked. */ origin_node_id: NodeIdDTO; /** Caller-selected absolute file path; the daemon canonicalizes and validates it. */ file: string; /** Caller-minted invocation key; the daemon enforces its uniqueness. */ idempotency_key: string; /** Caller-supplied ticket subtitle; required for ticket origins. */ subtitle?: string; /** Caller-supplied ticket-only projection destination. */ output_path?: string; } /** Daemon-derived canonical review projection. */ export interface ReviewDTO { /** Daemon-minted opaque review identity. */ review_id: string; /** Daemon-recorded origin kind. */ origin_kind: ReviewOriginKindDTO; /** Daemon-recorded originating node. */ origin_node_id: NodeIdDTO; /** Daemon-owned directory containing the review branch and terminal result. */ review_dir: string; /** Daemon-preallocated companion node. */ companion_node_id: NodeIdDTO; /** Daemon-canonicalized reviewed file path. */ file: string; /** Daemon lifecycle state; never `binding`. */ state: ReviewStateDTO; /** Daemon capture timestamp. */ created: IsoTime; /** Daemon open timestamp, after the companion binds. */ opened_at?: IsoTime; /** When the human submitted a review whose companion was still working. The * review remains `open` until the companion goes quiet. */ submit_requested_at?: IsoTime; /** Daemon source-read status at projection time. */ source_missing: boolean; /** Daemon-owned current comment-coordinate source digest. */ anchor_base_sha256: string; /** Daemon approval timestamp. */ approved_at?: IsoTime; /** Daemon comparison of approval bytes to the invocation baseline. */ changed?: boolean; /** Daemon snapshot count at approval. */ comments_total?: number; /** Daemon unresolved-comment count at approval. */ comments_unresolved?: number; /** Daemon cancellation timestamp. */ canceled_at?: IsoTime; /** Daemon-recorded caller cancellation reason. */ cancel_reason?: string; /** Daemon-recorded cancellation actor. */ cancel_actor?: string; /** Daemon-owned immutable result projection path. */ result_path?: string; /** Daemon-recorded approval delivery error, when delivery failed after commit. */ delivery_error?: string; /** Daemon-recorded result projection error, when publication failed after commit. */ projection_error?: string; } /** Caller-supplied optional filters for `GET /v1/human/reviews`. */ export interface ListReviewsQuery { state?: ReviewStateDTO; origin_node_id?: NodeIdDTO; file?: string; } /** Daemon-derived review list. */ export interface ReviewListDTO { reviews: ReviewDTO[]; } /** Daemon-derived result of review approval, which may still be waiting on the * review's companion. */ export interface ReviewSubmitResultDTO { review: ReviewDTO; /** Immutable approval result; absent while the approval awaits the companion. */ result?: FeedbackResultDTO; outcome: 'settled' | 'already_settled' | 'awaiting_companion'; } /** Daemon-derived result of terminal review cancellation. */ export interface ReviewCancelResultDTO { review: ReviewDTO; outcome: 'settled' | 'already_settled'; } /** Caller-supplied optional cancellation context. */ export interface CancelReviewRequest { reason?: string; actor?: string; /** Recipient surfaces send `dismissed`; a requester withdrawal defaults to `canceled`. */ disposition?: 'canceled' | 'dismissed'; } /** Daemon-derived coordinate base for the terminal review surface. */ export interface ReviewDocumentBaseDTO { review_id: string; anchor_base_sha256: string; anchor_base_text: string; file: string; }