import type { IsoTime, NodeIdDTO } from './common.js'; export type ReviewCommentStatusDTO = 'open' | 'resolved' | 'deleted'; export type ReviewCommentDeliverDTO = 'wake' | 'quiet'; export type ReviewCommentAnchorStateDTO = 'live' | 'detached'; /** Caller-supplied source location for a comment or range remap. */ export interface ReviewCommentAnchorDTO { line: number; end_line: number; col_start?: number; col_end?: number; quote?: string; } /** Daemon-derived current comment projection. */ export interface ReviewCommentDTO { comment_id: string; review_id: string; status: ReviewCommentStatusDTO; revision: number; text: string; anchor: ReviewCommentAnchorDTO; anchor_state: ReviewCommentAnchorStateDTO; anchor_line_text: string; anchor_doc_hash: string; author: { kind: 'human' | 'node'; node_id?: NodeIdDTO; }; updated_by: { kind: 'human' | 'node'; node_id?: NodeIdDTO; }; created_at: IsoTime; updated_at: IsoTime; resolved_at?: IsoTime; deleted_at?: IsoTime; created_seq: number; } /** Caller-supplied body for comment creation. `doc_hash` is supplied by a rendered terminal surface; agent CLI creation omits it and the daemon verifies its current coordinate base instead. */ export interface CreateReviewCommentRequest { text: string; anchor: ReviewCommentAnchorDTO; doc_hash?: string; actor_node_id?: NodeIdDTO | null; deliver?: ReviewCommentDeliverDTO; } /** Caller-supplied body for comment text changes. */ export interface EditReviewCommentRequest { text: string; actor_node_id?: NodeIdDTO | null; deliver?: ReviewCommentDeliverDTO; if_revision?: number; } /** Caller-supplied body for comment state changes. */ export interface ReviewCommentActionRequest { actor_node_id?: NodeIdDTO | null; deliver?: ReviewCommentDeliverDTO; if_revision?: number; } /** Daemon-derived best-effort companion-notification result. */ export interface ReviewCommentDeliveryDTO { attempted: boolean; target_node_id?: NodeIdDTO; status: 'delivered' | 'skipped' | 'failed'; via?: 'engine' | 'inbox'; woke: boolean; reason?: 'capacity_frozen'; error?: string; } /** Daemon-derived result of one comment mutation. */ export interface ReviewCommentMutationDTO { comment: ReviewCommentDTO; changed: boolean; delivery?: ReviewCommentDeliveryDTO; } /** Caller-supplied filter for a review's comment projection. */ export interface ListReviewCommentsQuery { status?: ReviewCommentStatusDTO | 'all'; actor_node_id?: NodeIdDTO | null; } /** Daemon-derived comment list. */ export interface ReviewCommentListDTO { review_id: string; comments: ReviewCommentDTO[]; } /** Daemon-derived one-comment projection and audit history. */ export interface ReviewCommentDetailDTO { comment: ReviewCommentDTO; events: ReviewCommentEventDTO[]; } /** Caller-supplied cursor/limit for the append-only review audit. */ export interface ReadReviewCommentEventsQuery { since_seq?: number; limit?: number; } /** Daemon-derived page of append-only review comment events. */ export interface ReviewCommentEventsDTO { review_id: string; events: ReviewCommentEventDTO[]; next_since_seq: number | null; } /** Daemon-derived append-only comment audit event. */ export interface ReviewCommentEventDTO { seq: number; review_id: string; comment_id: string; kind: 'created' | 'edited' | 'resolved' | 'reopened' | 'deleted' | 'reanchored' | 'notified' | 'notify_failed'; state_change: boolean; revision_after: number | null; actor: { kind: 'human' | 'node' | 'system'; node_id?: NodeIdDTO; }; at: IsoTime; operation_id: string; payload?: unknown; } /** Caller-supplied replacement location for one nondeleted comment. */ export type ReviewCommentRangeEntryDTO = { comment_id: string; anchor: ReviewCommentAnchorDTO; } | { comment_id: string; detached: true; }; /** Caller-supplied atomic full-set range remap body. */ export interface ReviewCommentRangeBatchRequest { from_doc_hash: string; to_doc_hash: string; entries: ReviewCommentRangeEntryDTO[]; } /** Daemon-derived result of an atomic full-set range remap. */ export interface ReviewCommentRangeBatchResultDTO { review_id: string; anchor_base_sha256: string; updated: number; detached: number; unchanged: number; } /** Daemon-derived result of forking the review companion onto one comment. */ export interface ReviewCommentForkDTO { comment_id: string; /** The newborn fork of the review companion. */ node_id: NodeIdDTO; /** Where the fork runs, so a caller can place a viewer for it. */ cwd: string; }