constMessage=UiSchema.TaggedEnum({RequestedAddCommentReview:{path:Schema.String,side:DiffSide,line:Schema.Number,body:Schema.String},RequestedDeleteCommentReview:{comment:Schema.String},RequestedSendReview:{},RequestedLayoutReview:{layout:Schema.Literals(["unified","split"])},})// your app keeps the comments: drafts until Send, then sent, then addressed with the agent's replyexportconstReview=(h:Html.H<typeofMessage.Type>,files:ReadonlyArray<ReviewFile>,comments:ReadonlyArray<ReviewComment>,outcome:Outcome|null)=>DiffReview(h,{props:{id:"ws-4", files, comments,can:["comment","send"], outcome },onEmit:{RequestedAddComment:({ path, side, line, body })=>Message.RequestedAddCommentReview({ path, side, line, body }),RequestedDeleteComment:({ comment })=>Message.RequestedDeleteCommentReview({ comment }),RequestedSend:()=>Message.RequestedSendReview(),RequestedLayout:({ layout })=>Message.RequestedLayoutReview({ layout }),},})
API reference
Props
DiffReview props
Name
Type
Description
idrequired
string
—
filesrequired
ReviewFile[]
—
commentsrequired
ReviewComment[]
—
layout
"unified" | "split"
—
canrequired
("comment" | "send")[]
"comment" lets the person write on lines; "send" sends the drafts
Send every draft to the agent as one review; answer with outcome "send"
Agent actions
What agents can do with DiffReview
Action
Description
RequestedComment
Write a draft comment on a line of a changed file: its path, side (after for added or unchanged lines) and 1-based line
ClickedSend
Send every draft comment to the agent as one review
Accessibility
Every changed file is a diff with line numbers; Tab reaches one comment button and the arrow keys move it from line to line.
A comment box takes focus as it opens: Mod+Enter adds the comment and Escape closes it. Each comment says whether it's a draft, sent or addressed in words.
The drafts bar is a named region with one Send button. Agents read the comments and can write one on a named line.