Revise a spec
Code Mode: praxis.workforce.specs.update
HTTP: PUT /workforce/v1/specs/{kind}/{id}
Replaces the whole spec of a subject: metadata.revision is the revision you last read (0 when none was written) and each success raises it by one, so a mismatch returns REVISION_CONFLICT and you must read again, merge and retry. The spec is { document, provision }: document is Markdown text injected into the holder’s memory and never merged, provision holds the capability blocks and remove; GET /workforce/v1/spec_schema returns the JSON Schema of every block, and a block outside it is refused with its path. labels and annotations carry over from the previous revision when omitted; change_note belongs to this revision only. Other metadata fields you read back (id, name, update_time, updated_by) are accepted and ignored. dry_run=true checks everything and writes nothing: it answers the spec that would be written, the changes against the live one and the reconcile plan of every affected holder in office (at most 50, plans_truncated says more exist). Requires an organization owner or admin, or the head of the subject’s department. Errors: 400 INVALID_PARAMS for a missing spec or metadata.revision, an api_version other than workforce/v1, labels or annotations over their limits, a block outside the registry or an unknown body field; 403 PERMISSION_DENIED; 404 when the subject does not exist; 409 REVISION_CONFLICT. Example body: {“metadata”:{“revision”:0,“change_note”:“first charter”},“spec”:{“document”:“Deliver reliably.”,“provision”:{“computer”:{“template”:“base”}}}}.
签名
praxis.workforce.specs.update(args:{path:{kind:"organization"|"department"|"level"|"job"|"position"|"assignment";id:string};query?:{dry_run?:boolean};body:{/** The language of the envelope; omit it or send workforce/v1, anything else is refused. e.g. "workforce/v1" */ api_version?:"workforce/v1";/** The revision you read and the labels, annotations and note of this revision. */ metadata:{/** The revision you last read, or 0 when the subject has no spec yet; the write is refused with REVISION_CONFLICT unless it is still the live one. */ revision:number;/** Replaces the labels of the previous revision; omit it to keep them. */ labels?:{[key:string]:string};/** Replaces the annotations of the previous revision; omit it to keep them. */ annotations?:{[key:string]:string};/** Why this revision is written, up to 500 characters; it belongs to this revision only and is not carried over. */ change_note?:string};spec:{/** Markdown text of this unit, injected into each holder's memory as its own entry and never merged with other layers. */ document?:string;/** What the unit provisions its holders with: a map from block name to block value, merged along the chain of a seat and sent through verbatim. */ provision?:{[key:string]:unknown}}}}):Promise<{/** The language of this envelope, always workforce/v1. */ api_version:"workforce/v1";kind:"organization"|"department"|"level"|"job"|"position"|"assignment";metadata:{/** The subject's own id (org_..., dept_..., lvl_..., jpr_..., pos_... */ id:string;/** The subject's own name (the organization's, department's, job's, level's or position's title); null for an assignment or when it cannot be read. */ name:string|null;/** Revision, 0 until the first write and raised by one on every revise; send it as metadata.revision. */ revision:number;/** Short tags for grouping, at most 20 keys; a key is lowercase letters, digits, dot, underscore, slash or hyphen up to 63 characters and a value is a string up to */ labels:{[key:string]:string};/** Free notes for people and tools, at most 20 keys with string values up to 1000 characters. */ annotations:{[key:string]:string};/** Why this revision was written, up to 500 characters; each revision has its own, null when none was given. */ change_note:string|null;/** UTC instant (RFC 3339) this revision was written; null when the subject never had a spec written. */ update_time:string|null;/** Actor address that wrote this revision (human:usr_... */ updated_by:string|null};spec:{/** Markdown text of this unit, injected into each holder's memory as its own entry and never merged with other layers. */ document?:string;/** What the unit provisions its holders with: a map from block name to block value, merged along the chain of a seat and sent through verbatim. */ provision?:{[key:string]:unknown}};/** Reconcile summary; given when one spec is read, null in a list and for a past revision. */ status:{/** Holders whose last reconcile had this spec in one of their seats' chains. */ holders:number;/** Of those, holders with no failed block. */ ready:number;/** Of those, holders with at least one failed block. */ failing:number}|null}|{/** Always true; tells the preview from a written spec. */ dry_run:true;spec:{/** The language of this envelope, always workforce/v1. */ api_version:"workforce/v1";kind:"organization"|"department"|"level"|"job"|"position"|"assignment";metadata:{/** The subject's own id (org_..., dept_..., lvl_..., jpr_..., pos_... */ id:string;/** The subject's own name (the organization's, department's, job's, level's or position's title); null for an assignment or when it cannot be read. */ name:string|null;/** Revision, 0 until the first write and raised by one on every revise; send it as metadata.revision. */ revision:number;/** Short tags for grouping, at most 20 keys; a key is lowercase letters, digits, dot, underscore, slash or hyphen up to 63 characters and a value is a string up to */ labels:{[key:string]:string};/** Free notes for people and tools, at most 20 keys with string values up to 1000 characters. */ annotations:{[key:string]:string};/** Why this revision was written, up to 500 characters; each revision has its own, null when none was given. */ change_note:string|null;/** UTC instant (RFC 3339) this revision was written; null when the subject never had a spec written. */ update_time:string|null;/** Actor address that wrote this revision (human:usr_... */ updated_by:string|null};spec:{/** Markdown text of this unit, injected into each holder's memory as its own entry and never merged with other layers. */ document?:string;/** What the unit provisions its holders with: a map from block name to block value, merged along the chain of a seat and sent through verbatim. */ provision?:{[key:string]:unknown}};/** Reconcile summary; given when one spec is read, null in a list and for a past revision. */ status:{/** Holders whose last reconcile had this spec in one of their seats' chains. */ holders:number;/** Of those, holders with no failed block. */ ready:number;/** Of those, holders with at least one failed block. */ failing:number}|null};/** What the write would change against the live spec, in path order. */ changes:Array<{/** Full path of the changed value inside the envelope, such as spec.document, spec.provision.agent.model or spec.provision.repositories[github:org/repo]. */ path:string;/** What happened at this path between the two revisions. */ op:"added"|"removed"|"changed";/** The value at this path in the earlier revision, verbatim; absent when the value was added. */ before?:unknown;/** The value at this path in the later revision, verbatim; absent when the value was removed. */ after?:unknown}>;/** The reconcile plan of every holder in office whose chain contains this subject, computed as if the new spec were already written; at most 50. */ plans:Array<{/** Actor address the plan is for (agent:agent_... */ actor:string;/** The holder kind the merge was made for, derived from the actor address. */ holder_kind:"agent"|"human";/** One action per block the plan considered, in block order. */ actions:Array<{/** Name of the block this action is about, such as agent. */ block:string;/** What the reconciler would do with this block. */ action:"hold"|"update"|"none"|"pending"|"blocked";/** The value the action would write, or the reason it is blocked, verbatim. */ detail:unknown}>;/** Problems that only the merged result shows, such as too many skills after merging; empty when the merge is clean. */ violations:Array<string>}>;/** Present and true when more than 50 holders are affected and only the first 50 have a plan. */ plans_truncated?:true}>;参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| kind | path | “organization” | “department” | “level” | “job” | “position” | “assignment” | 是 | Kind of the subject whose spec to revise. |
| id | path | string | 是 | The subject’s own id (org_…, dept_…, lvl_…, jpr_…, pos_… or asg_…). |
| dry_run | query | boolean | 否 | true checks everything and writes nothing, answering the preview; false or omitted writes. |
请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 是 | application/json |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 200 | application/json | The spec after the revision at the new revision number; with dry_run=true, the preview instead and nothing is written. |
| 400 | application/problem+json | INVALID_PARAMS; the spec or metadata.revision is missing or not an integer, api_version is not workforce/v1, labels or annotations exceed their limits, a block is outside the registry or a body field is unknown. The message names the field or block to fix. |
| 401 | Missing or invalid credential; provide a valid organization API key or sign in to the Console. | |
| 403 | application/problem+json | PERMISSION_DENIED; only an organization owner or admin, or the head of the subject’s department or of a department above it, may revise a spec, and machine tokens are always refused (an agent’s session token may read the organization, never change it). |
| 404 | application/problem+json | The subject is not in your organization: DEPARTMENT_NOT_FOUND, JOB_LEVEL_NOT_FOUND, JOB_NOT_FOUND, POSITION_NOT_FOUND or ASSIGNMENT_NOT_FOUND. Copy an id from the subject’s list. |
| 409 | application/problem+json | REVISION_CONFLICT; the spec moved on since you read it. Read it again, merge your change and retry with its current revision. |