extract.v1
Status: v1. A published shape is frozen by spec.md section 20.1.
Capability key: extract
Route: POST /extract
Parts in
One row for each part kind that this capability accepts. A kind that is not in
this table is invalid_part.
| kind | role | required | meaning |
|---|---|---|---|
| text | source | yes, exactly one | the text that the plugin reads. |
| json | fields | yes, exactly one | {"fields": [{"name": "...", "type": "string", "description": "..."}]}. |
Parameters
This capability has no parameters. A value in params is ignored (R26). The
fields part carries the whole output schema.
Channels out
One row for each channel that this capability can emit.
| channel | mime | payload |
|---|---|---|
| decision | application/json | {"fields": {"<name>": "<value>"}} |
Terminal metadata
done.meta is vocabulary-defined. The core stores it and never reads it.
done without meta means {}.
| key | type | meaning |
|---|---|---|
model | string | the served name that ran the job |
model is present when outcome is completed. It is absent when the outcome
is cancelled or expired.
Request
POST /extract
{
"model": "<served-name>",
"input": [
{"kind": "text", "role": "source", "text": "The queue held 12 jobs for 400 ms, then drained."},
{"kind": "json", "role": "fields", "json": {"fields": [
{"name": "jobs", "type": "number", "description": "How many jobs the queue held."},
{"name": "drained", "type": "boolean", "description": "Whether the queue emptied."},
{"name": "devices", "type": "string[]", "description": "Device names that ran the jobs."}
]}}
],
"params": {},
"stream": false
}
Response, no stream
{"job": "019...", "outcome": "completed",
"decision": {"mime": "application/json", "inline": {"fields": {
"jobs": 12, "drained": true, "devices": ["gpu-0"]}}},
"usage": {"tokens_in": 41, "tokens_out": 9},
"meta": {"model": "<served-name>"}}
Stream
extract emits one decision event, then the done frame. No other event
appears.
event ch=decision application/json {"fields":{"jobs":12,"drained":true,"devices":["gpu-0"]}}
done outcome=completed meta={"model": "<served-name>"}
Rules
- Exactly one
textpart with rolesourceis required. A request without it isinvalid_part. - Exactly one
jsonpart with rolefieldsis required. A request without it isinvalid_part. - An
image,audio,video, ortokenspart isinvalid_part. - Every entry of the
fieldsarray namesname,type, anddescription. A missing key gives a refusal that namesfields. - The
fieldsarray is not empty. An empty array gives a refusal that namesfields. - A
typevalue isstring,number,boolean, orstring[]. Any other value gives a refusal that namesfields. - Every
namein thefieldsarray is unique. A repeated name gives a refusal that namesfields. - The payload
fieldsobject has one entry per requested name. Its key set equals the requested name set. - A
stringvalue is a JSON string. Anumbervalue is a JSON number, not a string. - A
booleanvalue istrueorfalse. Astring[]value is an array of JSON strings. - A field that the source cannot answer carries
null. The plugin never omits a requested key. - The payload carries no
typeand nodescription. Those strings never appear in the output. - The plugin emits one
decisionevent and nothing else for this job. A seconddecisionevent is a protocol error. - A value in
paramsdoes not change the extracted fields. usage.tokens_incounts the source and the field schema.usage.tokens_outcounts the emitted answer tokens. Both are present whenoutcomeiscompleted.- No event follows a
cancel. The terminal frame isdonewithoutcome = cancelled, and it carries no metadata keys.