跳转到内容
EN

Add to or correct a draft's brief

Code Mode: praxis.studio.works.drafts.updateBrief

HTTP: PATCH /studio/v1/works/{work}/drafts/{draft}/brief

Extend the brief of one draft: append text, attach files, replace its constraints, add points taken from an outline, edit one point, or drop a point. The brief belongs to the draft, not the work: the length and plot points of a novel do not bind the promotion derived from it. Points are how the software checks that every requirement landed in a written unit, so split the person’s outline into points here rather than burying them in prose; the constraints (a length such as 3000 字以内, banned wording) are what the length check and the context pack read. The brief carries its own revision, separate from the draft’s.

签名

praxis.studio.works.drafts.updateBrief(args:{path:{/** e.g. "wu-gang" */ work:string;/** e.g. "novel" */ draft:string};body:{/** Brief revision the caller read; a mismatch is refused with REVISION_CONFLICT rather than merged. e.g. 2 */ expected_revision?:number;/** Text to append to the stored brief, added after what is already there and never replacing it. e.g. "补充:故事发生在 1935 年的南京。" */ text?:string;/** The draft's constraints as one text, replacing what is there; pass an empty string to clear them. e.g. "800 字左右,不剧透结局" */ constraints?:string;/** Source files to keep with the brief, added to the ones already attached. */ attachments?:Array<string>;/** New requirement points to split out of the brief; each receives the next free key in order. */ add_points?:Array<string|{/** The requirement itself. e.g. "1931 年上海,冷硬派第一人称" */ text:string;/** unit (the default) is a requirement that must land in some unit: a plot beat, a selling point, a fact the piece has to state; a unit claims it and the coverage e.g. "work" */ scope?:"unit"|"work"}>;/** Existing points to reword, each naming the key it keeps and the text that replaces it. */ edit_points?:Array<{/** Key of the point to reword, taken from the brief as it currently reads. e.g. "p1" */ key:string;/** Text that replaces the current point, usually a more specific version of the same requirement. e.g. "主角是《乌江日报》的排字工" */ text:string;/** Move the point to the other scope; leave it out to keep the scope it has. e.g. "work" */ scope?:"unit"|"work"}>;/** Keys of points to drop; a dropped key is never reused, so later points keep their own keys. */ remove_points?:Array<string>}}):Promise<{value:{/** The requirement exactly as the person gave it, never rewritten by software; it is handed to the writer in the context pack. e.g. "写一部民国背景的长篇,主角是报社排字工。" */ text?:string;/** Files the person attached as source material, referenced by their file identifiers. */ attachments?:Array<string>;/** Requirements split out of the brief, each with a stable key. */ points?:Array<{/** Stable key of the point inside this draft, assigned in order as p1, p2 and so on, so an outline in the same drafts create call can claim p1 and p2; keys are nev e.g. "p1" */ key:string;/** The requirement itself, short enough to be claimed by one unit and specific enough to be checked. e.g. "主角是报社排字工" */ text:string;/** unit (the default) is a requirement that must land in some unit: a plot beat, a selling point, a fact the piece has to state; a unit claims it and the coverage e.g. "unit" */ scope?:"unit"|"work"}>;/** Limits this draft is written under, one per line: a length such as 3000 字以内 or 2000 字左右, banned wording, a deadline. e.g. "全文 3000 字以内,不写血腥场面" */ constraints?:string;/** Brief revision, independent of the draft's own revision; pass it as expected_revision when changing the brief. e.g. 2 */ revision?:number};/** Deterministic checks run against what was just written, such as whether every brief point is claimed by a unit. */ checks?:Array<{/** Key of the check that produced this row, such as unit_chars or body_total_chars; the genre lists which ones it runs. e.g. "unit_chars" */ check:string;/** Whether the check passed; a failed hard check blocks publishing until the text changes. */ ok:boolean;/** What the check found, in words, including the measured value and the bound it broke. e.g. "本章 2680 字,低于 3000 字的目标。" */ text:string;/** Unit the finding is about, present when the check is per unit. e.g. "unt_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ unit?:string;/** Block the finding is about, present when the check is per block, such as a missing image or a banned word. e.g. "blk_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ block?:string;/** How serious the finding is: an error fails the check, a warning is reported without failing it. */ severity:"error"|"warning";/** Whether this is a platform hard limit, which is the only kind a free-writing genre puts into its todo list. */ hard:boolean}>;/** The first few outstanding items now, which after a brief change often includes unplaced points. */ next?:Array<{/** What is outstanding, chosen from a closed set so a caller can branch on it instead of reading the text. */ kind:"goal_incomplete"|"brief_points_unplaced"|"no_structure"|"intent_missing"|"intent_ahead_of_body"|"body_missing"|"draft_stale"|"work_adaptation_stale"|"prop_missing"|"check_failed"|"review_unresolved"|"rendition_stale"|"rendition_missing"|"publish_blocked";/** Which of the seven layers this item belongs to, used to order the list; the layers are always in the same order. */ layer:"goal"|"frame"|"task"|"reference"|"body"|"coherence"|"rendition";/** Unit this item is about, present when the item points at one unit rather than the whole draft. e.g. "unt_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ unit?:string;/** In-work number of that unit, which is what the unit path segment of a call takes. e.g. 12 */ number?:number;/** The item in words, written to be shown to a person as is. e.g. "第 12 节还没有正文" */ text:string;/** For a check_failed item, the key of the failing check, so a program can act on it without parsing the text; a unit that already has an item for it gets no separ e.g. "body_total_chars" */ check?:string;/** Suggested next call for this item, offered as guidance rather than a fixed script. e.g. "praxis.studio.works.units.retrieveContext" */ call?:string}>}>;

参数

名称位置类型必填说明
workpathstring是The work being addressed, either its organization-unique slug or its wk_ identifier; a slug case is what a person would say, and a renamed slug still resolves through its old value.
draftpathstring是Draft being addressed, either its in-work key such as novel or its drf_ identifier; a key renamed earlier still resolves through its previous value.

请求体

必填内容类型说明
是application/jsonThe brief change: new text or points to add, points to edit, and points to drop.

响应

状态码内容类型说明
200application/jsonThe updated brief together with its checks and the next todos.
400application/jsonINVALID_PARAMS means a field is missing, malformed or not allowed for this resource; correct the named field and repeat the call.
401application/jsonThe API key is missing, invalid or carries no organization; send a valid organization key in the Authorization header.
404application/jsonWORK_NOT_FOUND, DRAFT_NOT_FOUND or BRIEF_POINT_NOT_FOUND means the work or draft is not reachable or the named brief point no longer exists; re-read the draft and use the point keys its brief currently carries.
409application/jsonREVISION_CONFLICT means the resource changed since the expected_revision you sent, so nothing was written; re-read it, merge the other change into yours and repeat the call with the revision you just read.
500application/jsonINTERNAL means the request could not complete; re-read the resource before retrying a write, because the write may already have landed.