ObjectStackObjectStack

Draft Review schema — AI Protocol reference

The draft review list — the drafts one ask turn saved, as the console's chat draws them in a card under the answer.

The draft review list — the drafts one ask turn saved, as the console's chat draws them in a card under the answer.

Who writes it, who reads it

  • Producer: the host whose admin skill saves metadata drafts from an ask turn. At the end of a streamed turn that saved at least one draft, before the stream's finish, it sends one UI-message-stream data part named DRAFT_REVIEW_PART_TYPE whose data is a DraftReviewListSchema list, in save order.
  • Reader: the console's chat (extractDraftReview in @object-ui/plugin-chatbot). It reads the part through this schema; a part the schema refuses draws no card, and the answer renders as it does without one.

What each row states

  • type, name, package name the saved draft; label is its display label when the draft has one. One row per draft, unique by package, type and name: a draft the turn saved more than once is one row, placed at its first save and carrying the verdict read last. The rows (and the cap and omitted) count drafts, not saves.
  • verdict is the light authoring door's own list_drafts verdict on the draft — publishable is "no refusal", refusals are what a publish would refuse it on and advisories are findings that do not block it — read as the person who asked. null when no verdict was read: verdictWithheld then says why the person may not read one, or verdictError that reading it failed. Both carry the door's { code, message, status }.
  • verdictRead says when the verdict was read: turn-end, after the turn's last save, or save, by the save that wrote this draft (a later save in the same turn can change it).
  • review holds the two Studio routes where a person reviews the draft, as the door hands them out (studioChangesReviewLink, studioItemReviewLink in @objectstack/types): changes, the package's Changes drawer, where it is published, and item, the draft's own review. Both are Console paths, so each starts with one /.

What the card does not do

Nothing is published or discarded from the chat: a person publishes in Studio, through the review routes, as for any draft. The part is drawn live only: it is not stored with the message, so a conversation reloaded from history shows no card.

Source: packages/spec/src/ai/draft-review.zod.ts

TypeScript Usage

import { DraftReviewItemSchema, DraftReviewLinksSchema, DraftReviewListSchema, DraftReviewVerdictSchema, DraftReviewVerdictRefusalSchema } from '@objectstack/spec/ai';
import type { DraftReviewItem, DraftReviewLinks, DraftReviewList, DraftReviewVerdict, DraftReviewVerdictRefusal } from '@objectstack/spec/ai';

// Validate data
const result = DraftReviewItemSchema.parse(data);

DraftReviewItem

Properties

PropertyTypeRequiredDescription
typestring✅The metadata type of the draft, singular (object, view, flow, …)
namestring✅The draft's machine name
packagestring✅The package the draft was saved into
labelstringoptionalThe draft's display label, when it has one
verdict{ publishable: boolean; refusals: object[]; advisories: object[] } | null✅The door's list_drafts verdict, read as the person who asked; null when none was read (see verdictWithheld and verdictError)
verdictWithheld{ code: string; message: string; status: integer }optionalWhy the person may not read a verdict, when verdict is null for that reason
verdictError{ code: string; message: string; status: integer }optionalThat reading the verdict failed, when verdict is null for that reason
verdictReadEnum<'turn-end' | 'save'>✅When the verdict was read: turn-end, after the turn's last save, or save, by the save that wrote this draft
review{ changes: string; item: string }✅

Nested Shape: DraftReviewItem.verdict

PropertyTypeRequiredDescription
publishableboolean✅true when a publish would refuse the draft on nothing: refusals is empty
refusals{ rule: string; path: string; where: string; message: string; … }[]✅What a publish would refuse the draft on
advisories{ rule: string; path: string; where: string; message: string; … }[]✅Findings that do not block a publish

Nested Shape: DraftReviewItem.verdictWithheld

PropertyTypeRequiredDescription
codestring✅The error code the door answered (PERMISSION_DENIED, RESOURCE_NOT_FOUND, INTERNAL_ERROR, …)
messagestring✅The door's sentence for it
statusinteger✅The HTTP status the door answered

Nested Shape: DraftReviewItem.verdictError

PropertyTypeRequiredDescription
codestring✅The error code the door answered (PERMISSION_DENIED, RESOURCE_NOT_FOUND, INTERNAL_ERROR, …)
messagestring✅The door's sentence for it
statusinteger✅The HTTP status the door answered

Nested Shape: DraftReviewItem.review

PropertyTypeRequiredDescription
changesstring✅The package's Changes drawer in Studio, where its drafts are reviewed and published (studioChangesReviewLink)
itemstring✅The draft's own review in Studio (studioItemReviewLink)

Properties

PropertyTypeRequiredDescription
changesstring✅The package's Changes drawer in Studio, where its drafts are reviewed and published (studioChangesReviewLink)
itemstring✅The draft's own review in Studio (studioItemReviewLink)

DraftReviewList

Properties

PropertyTypeRequiredDescription
drafts{ type: string; name: string; package: string; label?: string; … }[]✅The saved drafts, in save order, at most 50: one row per draft, unique by package, type and name. A draft the turn saved more than once is one row, placed at its first save and carrying the verdict read last
omittedintegeroptionalHow many more drafts (not saves) the turn saved beyond the 50 listed; absent when none

Nested Shape: DraftReviewList.drafts[number]

PropertyTypeRequiredDescription
typestring✅The metadata type of the draft, singular (object, view, flow, …)
namestring✅The draft's machine name
packagestring✅The package the draft was saved into
labelstringoptionalThe draft's display label, when it has one
verdict{ publishable: boolean; refusals: object[]; advisories: object[] } | null✅The door's list_drafts verdict, read as the person who asked; null when none was read (see verdictWithheld and verdictError)
verdictWithheld{ code: string; message: string; status: integer }optionalWhy the person may not read a verdict, when verdict is null for that reason
verdictError{ code: string; message: string; status: integer }optionalThat reading the verdict failed, when verdict is null for that reason
verdictReadEnum<'turn-end' | 'save'>✅When the verdict was read: turn-end, after the turn's last save, or save, by the save that wrote this draft
review{ changes: string; item: string }✅

DraftReviewVerdict

Properties

PropertyTypeRequiredDescription
publishableboolean✅true when a publish would refuse the draft on nothing: refusals is empty
refusals{ rule: string; path: string; where: string; message: string; … }[]✅What a publish would refuse the draft on
advisories{ rule: string; path: string; where: string; message: string; … }[]✅Findings that do not block a publish

Nested Shape: DraftReviewVerdict.refusals[number]

PropertyTypeRequiredDescription
rulestring✅Stable diagnostic rule id (flow-multi-write-unfiltered, approval-expression-invalid, …). Machine-readable and stable across releases — the key a renderer groups or suppresses by.
pathstring✅Config path inside the SUBMITTED body (flows[0].nodes[1].config.multi), so an editor can jump to the offending key. May be empty when the finding is about the item as a whole. The TOP-LEVEL collection entry follows one rule. The gate evaluates against a private per-write snapshot whose indexes no caller can resolve; a collection-resident write type is one whose collection that snapshot fills with the tenant's other stored items beside the written one, and there the entry is keyed by NAME, never by an array index — for example objects.acme_invoice.sharingModel (an object write) or datasets.acme_invoice_metrics.dimensions[0].field (a dataset write). Every other write type is the sole member of its own collection in that snapshot, so its [0] IS the written item and stays positional (for example flows[0]...). Which write types are collection-resident is derived, never listed: @objectstack/lint's runtime gate computes the set (NAME_KEYED_STACK_KEYS) as the collections it carries as resolution context that a gated write type also lands in, so it changes with the gate, not with this text. An entry whose name cannot be spliced into a dotted path keeps its index. Nested positions inside one named item stay positional (objects.acme_invoice.indexes[1]): they index the author's own document.
wherestring✅Human-readable location — flow "leave_approval" · node "approve". Prose for a person; use path for anything mechanical.
messagestring✅What is wrong, in the rule author's own words.
hintstring✅How to fix it.
severityEnum<'error' | 'warning' | 'info'>✅How the gate treated this finding. error means the write was REFUSED (these appear on the 422, never on a 2xx); warning / info are advisory — the write succeeded and the finding is FYI.
userMessagestringoptionalThe finding's user-facing sentence, composed by its producer in the request's locale (else the workspace default locale, else en) — the same field name and producer-marked meaning as ApiErrorSchema.userMessage. Present only when the producer authors a user sentence for this rule; absent, a consumer renders message as before. Consumers render it as received; rule stays the stable id and message / hint stay the developer-facing text.

Nested Shape: DraftReviewVerdict.advisories[number]

PropertyTypeRequiredDescription
rulestring✅Stable diagnostic rule id (flow-multi-write-unfiltered, approval-expression-invalid, …). Machine-readable and stable across releases — the key a renderer groups or suppresses by.
pathstring✅Config path inside the SUBMITTED body (flows[0].nodes[1].config.multi), so an editor can jump to the offending key. May be empty when the finding is about the item as a whole. The TOP-LEVEL collection entry follows one rule. The gate evaluates against a private per-write snapshot whose indexes no caller can resolve; a collection-resident write type is one whose collection that snapshot fills with the tenant's other stored items beside the written one, and there the entry is keyed by NAME, never by an array index — for example objects.acme_invoice.sharingModel (an object write) or datasets.acme_invoice_metrics.dimensions[0].field (a dataset write). Every other write type is the sole member of its own collection in that snapshot, so its [0] IS the written item and stays positional (for example flows[0]...). Which write types are collection-resident is derived, never listed: @objectstack/lint's runtime gate computes the set (NAME_KEYED_STACK_KEYS) as the collections it carries as resolution context that a gated write type also lands in, so it changes with the gate, not with this text. An entry whose name cannot be spliced into a dotted path keeps its index. Nested positions inside one named item stay positional (objects.acme_invoice.indexes[1]): they index the author's own document.
wherestring✅Human-readable location — flow "leave_approval" · node "approve". Prose for a person; use path for anything mechanical.
messagestring✅What is wrong, in the rule author's own words.
hintstring✅How to fix it.
severityEnum<'error' | 'warning' | 'info'>✅How the gate treated this finding. error means the write was REFUSED (these appear on the 422, never on a 2xx); warning / info are advisory — the write succeeded and the finding is FYI.
userMessagestringoptionalThe finding's user-facing sentence, composed by its producer in the request's locale (else the workspace default locale, else en) — the same field name and producer-marked meaning as ApiErrorSchema.userMessage. Present only when the producer authors a user sentence for this rule; absent, a consumer renders message as before. Consumers render it as received; rule stays the stable id and message / hint stay the developer-facing text.

DraftReviewVerdictRefusal

Properties

PropertyTypeRequiredDescription
codestring✅The error code the door answered (PERMISSION_DENIED, RESOURCE_NOT_FOUND, INTERNAL_ERROR, …)
messagestring✅The door's sentence for it
statusinteger✅The HTTP status the door answered

On this page