Resource guide
Sessions are durable work, not requests
Starting a session creates an identity that outlives the initiating HTTP response. Store that identity immediately, then follow events to render progress and terminal state. Messages, notes, answers, and interrupts all target the same session timeline.
Session lifecycle routes require the sessions capability. An app that starts or controls sessions
must declare "sessions" in its apiScopes and use its runtime DUET_APP_API_KEY; registration is
where the app requests that authority, without a separate install-consent grant. The attachment
upload-session mint on this page is the exception: it writes to the drive and therefore requires
files:write.
Every durable input records who sent it, and that author is derived from the credential — never
supplied by the caller. A browser session, personal API key, or OAuth token authors as that person;
a registered app's DUET_APP_API_KEY authors as the app; the workspace VM's own key authors as
Duet itself. The one caller-visible attribution field is sourceSessionId on message, note, and
answer requests, which attributes the input to another session in the same workspace after the
server validates it exists there.
Some sessions acquire a runner state machine; the product calls those Jobs, but they are the same
resource on the same route. There is one list, and every session in it carries a bucket saying
what it is doing right now — asking, running, scheduled, or done. That reading prefers the
machine where there is one and the turn where there is not, so a session whose turn reported
complete while its machine keeps working still buckets as running. Page any subset with
?bucket=; omit it to page everything, newest first. A machine-backed session additionally carries
a machine projection, and the canonical Session detail URL exposes the full snapshot.
Start with a bounded prompt
The request schema requires a non-empty prompt. Start, message, note, and answer inputs may carry
a small bounded inline image set or attachment metadata for files already landed in the workspace
drive; attachment bytes do not travel through the session API. Durable input history keeps the
file's path, display name, byte count, and optional media type so clients can render the same file
reference later. Send only context the task needs. tier, when present on a start or message
request, is frontier, balanced, or economy. Answers deliberately have no tier field because
they resume the session's persisted choice.
{
"prompt": "Summarize release notes.",
"tier": "balanced"
}Omitting behavior resolves to steer. On a newly created session there is no active turn yet,
so steer and follow-up have the same initial delivery boundary. You can still state the choice
explicitly:
{
"prompt": "Summarize release notes after indexing finishes.",
"behavior": "follow_up"
}An explicit tier becomes sticky for later messages in that session. Each queued prompt keeps the effective tier resolved when it was accepted, so retries and later workspace-default changes cannot alter work already waiting to run.
The create response is the durable handoff point: it returns the new session identity plus its
canonical snapshot and initial history after one immediate delivery attempt. Cache those values
under the session's detail and history keys, navigate to the session URL immediately, and continue
from the event stream there. Its delivery field is accepted when the runner acknowledged the
initial prompt and queued when the durable timeline still owns a later retry.
History supports two explicit walks. Existing forward replay keeps cursor: events are strictly
after that sequence, and omitting it starts after zero. Interactive readers use before=0 for the
bounded newest page, render its events in ascending sequence order, and pass nextCursor back as
before only when the reader asks for earlier messages. Never combine cursor and before; an
absent nextCursor ends the chosen walk. The event stream resumes forward from the last committed
sequence independently, so reconnecting never requires walking old history again.
Create, message, note, and answer requests may include a stable clientRequestId. The web creates
one UUID per submission; retrying the same request ID returns the already-created session or input
instead of duplicating it.
Mint direct file uploads for an agent folder
File attachments use the workspace drive rather than the inline image body. First mint a short-lived
upload session with a credential that has files:write. Pass the target agent's working directory as
cwd; omit it for the drive-root agent.
{
"cwd": "agents/research"
}The response's vmBaseUrl and uploadPath identify the VM's direct files endpoint, while
uploadToken is the bearer for that upload. Append one URL-encoded filename to uploadPath and
send the bytes with PUT directly to vmBaseUrl; do not send the workspace API key to the VM.
expiresAt is the latest time a new upload may begin. The returned prefix is the canonical
drive-relative folder to store with the eventual message attachment, such as
agents/research/uploads.
The grant covers that one folder tree and is write-only. Clients choose a visible filename before
uploading and handle same-name collisions; the flat uploads folder is an inbox for the agent to
organize, not a permanent filing convention.
Wait for foreground work
Use a /wait route when the caller needs the result of the submitted turn. The request stays open
until the durable timeline contains the terminal caused by that input. Use the existing routes
without /wait for background work: they return after durable submission so the caller can surface
the session link immediately.
An initial wait request requires one UUID. Generate it once per logical submission and reuse it if the connection ends ambiguously.
{
"prompt": "Summarize release notes and report the conclusion.",
"behavior": "follow_up",
"clientRequestId": "4b27f182-b3e8-47c4-9fb8-5a488243ab92"
}Use the corresponding explicit route for the operation: /sessions/wait for root creation,
/{parentSessionId}/sessions/wait for child creation, /{sessionId}/messages/wait for a message,
and /{sessionId}/answer/wait for an answer. Root and agent default aliases add /wait to their
ordinary message path. Notes remain fire-and-forget and have no wait variant.
A terminal returns HTTP 200 with the canonical sessionId, the submitted inputSeq, and the exact
durable terminal marker. complete, ask, interrupted, and sleep all complete the wait; runner
failure or cancellation remains event content rather than becoming an HTTP error. Fetch history
after inputSeq when the caller needs transcript context about how that result was produced—the
wait response deliberately does not copy history.
If no terminal is durable at the server deadline, HTTP 202 means observation timed out while the
turn continued. Retry the same path with the identical request body. Its clientRequestId resumes
observation of the original durable input before any mutable parent or default alias is resolved.
Disconnecting a wait stops only observation—the already-durable input continues normally. Clients that cannot hold a foreground connection open can use ordinary async submission plus history polling instead.
Start related work from a session
Use the session-keyed create route when one session starts another. The parent identity comes from
the path; the body stays the ordinary create shape. Omitted working directory and tier inherit from
the parent, while explicit values override them. The resulting snapshot carries
createdBySessionId even if that parent is later deleted.
Cross-session messages, notes, and answers may set sourceSessionId so the timeline attributes the
injected input to the sending session instead of the credential's owner. Omit the field for ordinary
input. There is no request field for claiming user, app, or system authorship — those are always
derived from the credential.
{
"prompt": "What is your current result and what remains?",
"behavior": "follow_up",
"sourceSessionId": "js7a92k3fd0q1m8v6x4tz5nwr"
}History exposes each input's typed sender — {"kind":"user","userId":…}, {"kind":"app","appId":…},
{"kind":"session","sessionId":…}, or {"kind":"system"} — as stored identity only; current names,
emails, slugs, and titles are resolved at read time and never snapshotted into events. The row's
createdAt is the input's one timestamp, and its seq is the same value history?cursor=<seq>
accepts to page strictly later events, so the sequence a model sees in its message envelope is a
ready-made history cursor.
Use the default alias when identity should be stable
The default path is a server-resolved alias for one ordinary session belonging to an owner — an
agent, or the drive root under the reserved root slug. Reading it before the first message returns
{ "session": null } on a 200, because having no chat yet is the alias's ordinary state rather
than an error; only /history answers no_default_session. Posting the first message creates and
binds the session atomically, while later messages resolve the same real identity.
The binding is a pointer on the owner, not a property of the session, and three things move it.
Posting a first message sets it. Permanent deletion clears it. PUT sets it to any session that
owner already has, or to null — which demotes the current default to an ordinary session without
touching it: it stops being excluded from excludeDefault listings, keeps running whatever it was
running, and the owner's next message starts a fresh default. Archiving a session does not move
the binding.
The default message body is the ordinary message shape and deliberately has no mode: defaults
always launch in automatic mode. Responses expose the resolved session ID whether the request
created the session or continued it, so clients may switch to canonical ID-addressed routes whenever
they need another session operation.
Message and answer responses return { "ok": true, "delivery": "accepted" | "queued" }.
The request waits for one correlated runner acknowledgement: accepted means duet-agent has taken
the input, while queued means the input is already durable and the normal session drain will retry
it. A queued response is therefore a delivery state, not a rejected message.
Continue with steer or follow-up
Messages also default to steer, which lets the running agent incorporate the new user message
immediately.
{
"prompt": "Use the latest deployment logs.",
"tier": "frontier"
}Choose follow_up when the message should wait for the agent to finish its current task. The
message is still accepted and persisted immediately; its delivery behavior is part of the user
message rather than gateway policy.
{
"prompt": "After the current task, compare staging and production.",
"behavior": "follow_up"
}Move the next turn to another directory
A session's working directory is a relative path beneath its workspace drive. Moving it updates the
app pane immediately and takes effect for the agent on its next turn. The gateway validates the real
directory before Duet commits the canonical path, so aliases such as projects/drafts/../release
are stored as projects/release.
curl -sS -X POST \
-H "Authorization: Bearer $DUET_API_KEY" \
-H "Content-Type: application/json" \
"$DUET_API_URL/v1/ws/$DUET_WORKSPACE_SLUG/agent/sessions/$DUET_SESSION_ID/cwd" \
--data '{"cwd":"projects/drafts/../release"}'
curl -sS \
-H "Authorization: Bearer $DUET_API_KEY" \
"$DUET_API_URL/v1/ws/$DUET_WORKSPACE_SLUG/agent/sessions/$DUET_SESSION_ID"An invalid filesystem target returns 422 with error: "invalid_cwd" and a machine-readable
reason; correct the path and retry in the same turn.
curl -sS -X POST \
-H "Authorization: Bearer $DUET_API_KEY" \
-H "Content-Type: application/json" \
"$DUET_API_URL/v1/ws/$DUET_WORKSPACE_SLUG/agent/sessions/$DUET_SESSION_ID/cwd" \
--data '{"cwd":"this-directory-does-not-exist"}'A 409 with error: "cwd_conflict" means another move won the compare-and-swap; read the session
again before retrying. If the gateway accepted a move but the metadata write fails, the next
dispatch re-projects the durable session row and restores the gateway to that authoritative path.
Project events deterministically
Persist canonical events, tolerate ephemeral progress, and treat document patches as updates to
their owned state rather than chat messages. Follow SSE and resume for reconnection.
A machine-backed session's detail response carries a compact machine projection, already
classified into stable ordered-path items. Clients should not infer the current step by matching state labels or
treat the following definition item as a predicted transition.
Sessions
27 operations /v1 /ws /{workspaceSlug} /agent /sessionsList, search, and page sessions by bucket
- Scope
ws:{workspaceSlug}:sessions- Request
- No JSON request body
- Query
Query parameters JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "cursor": { "type": "string", "minLength": 1 }, "limit": { "default": 20, "type": "integer", "minimum": 1, "maximum": 100 }, "search": { "type": "string", "maxLength": 200 }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "archived": { "default": "exclude", "type": "string", "enum": [ "exclude", "only" ] }, "agentId": { "type": "string", "minLength": 1 }, "excludeDefault": { "anyOf": [ { "type": "boolean", "const": true }, { "type": "string", "const": "true" } ] } } }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "sessions": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "turnStatus": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "title": { "type": "string" }, "titleOrigin": { "type": "string", "enum": [ "excerpt", "auto", "manual" ] }, "titleStatus": { "type": "string", "enum": [ "generating", "complete", "failed" ] }, "archivedAt": { "type": "number" }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "machine": { "type": "object", "properties": { "definitionName": { "type": "string" }, "currentState": { "type": "string" }, "followingDefinitionState": { "type": "string" }, "progress": { "type": "object", "properties": { "completed": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "total": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "completed", "total" ], "additionalProperties": false }, "orderedPath": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "index": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "name": { "type": "string" }, "kind": { "type": "string" }, "phase": { "type": "string", "enum": [ "past", "current", "future", "outcome" ] }, "terminalStatus": { "type": "string", "enum": [ "completed", "failed", "cancelled", "error" ] } }, "required": [ "key", "index", "name", "phase" ], "additionalProperties": false } }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "orderedPath", "activity" ], "additionalProperties": false }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" } }, "required": [ "id", "userId", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread" ], "additionalProperties": false } }, "nextCursor": { "type": "string" } }, "required": [ "sessions" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessionsCreate a session from its first user message
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "prompt": { "type": "string", "minLength": 1 }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "cwd": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] } }, "required": [ "data", "mimeType" ] } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ] } }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "behavior": { "default": "steer", "type": "string", "enum": [ "steer", "follow_up" ] }, "mode": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ] } }, "required": [ "prompt" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "session": { "type": "object", "properties": { "sessionId": { "type": "string" }, "status": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "lastDeliveredInputSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "sessionId", "status", "lastEventSeq", "lastDeliveredInputSeq" ], "additionalProperties": false }, "snapshot": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "turnStatus": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "title": { "type": "string" }, "titleOrigin": { "type": "string", "enum": [ "excerpt", "auto", "manual" ] }, "titleStatus": { "type": "string", "enum": [ "generating", "complete", "failed" ] }, "archivedAt": { "type": "number" }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "machine": { "type": "object", "properties": { "definitionName": { "type": "string" }, "currentState": { "type": "string" }, "followingDefinitionState": { "type": "string" }, "progress": { "type": "object", "properties": { "completed": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "total": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "completed", "total" ], "additionalProperties": false }, "orderedPath": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "index": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "name": { "type": "string" }, "kind": { "type": "string" }, "phase": { "type": "string", "enum": [ "past", "current", "future", "outcome" ] }, "terminalStatus": { "type": "string", "enum": [ "completed", "failed", "cancelled", "error" ] } }, "required": [ "key", "index", "name", "phase" ], "additionalProperties": false } }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "orderedPath", "activity" ], "additionalProperties": false }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" }, "workspaceId": { "type": "string" }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "lastDeliveredInputSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "deliveryAttempt": { "type": "object", "properties": { "attemptId": { "type": "string", "minLength": 1 }, "throughSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "kind": { "type": "string", "enum": [ "initial_prompt", "message", "answer" ] }, "createdAt": { "type": "number" } }, "required": [ "attemptId", "throughSeq", "kind", "createdAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "requestedMachine": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "machineState": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "id", "userId", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "workspaceId", "lastDeliveredInputSeq" ], "additionalProperties": false }, "history": { "type": "object", "properties": { "events": { "type": "array", "items": { "type": "object", "properties": { "seq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "event": { "anyOf": [ { "anyOf": [ { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "step" }, "step": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call_start" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "required": [ "type", "toolName", "toolCallId" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "isError": { "type": "boolean" }, "output": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "image" }, "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "data", "mimeType" ], "additionalProperties": false } ] } }, "details": {} }, "required": [ "type", "toolName", "toolCallId", "isError" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "message": { "type": "string" } }, "required": [ "type", "message" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "step" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_started" }, "task": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "task" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_output" }, "taskId": { "type": "string", "pattern": "^t\\d+$" }, "chunk": { "type": "string" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "taskId", "chunk" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_settled" }, "settlement": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "completed" }, "settledAt": { "type": "number" }, "result": {} }, "required": [ "id", "status", "settledAt", "result" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "failed" }, "settledAt": { "type": "number" }, "error": {} }, "required": [ "id", "status", "settledAt", "error" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "stopped" }, "settledAt": { "type": "number" }, "reason": { "type": "string" } }, "required": [ "id", "status", "settledAt", "reason" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "lost" }, "settledAt": { "type": "number" } }, "required": [ "id", "status", "settledAt" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "settlement" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "heartbeat" }, "timestamp": { "type": "number" }, "activeTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } } }, "required": [ "type", "timestamp", "activeTaskIds" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "todos" }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } } }, "required": [ "type", "todos" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "follow_up_queue" }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } } }, "required": [ "type", "followUpQueue" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "state_machine" }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "type", "stateMachine" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "memory" }, "phase": { "type": "string", "enum": [ "observation", "reflection" ] }, "status": { "type": "string", "enum": [ "running", "completed" ] }, "message": { "type": "string" }, "observations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "usageBumpedObservations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "type", "phase", "status", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "usage" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "turnUsage", "usageByModel", "lastMessageUsage", "effectiveContextWindow", "contextWindowUsage" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "level": { "type": "string", "enum": [ "debug", "info", "warn", "error" ] }, "message": { "type": "string" }, "metadata": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "storage_full", "session_cwd_fallback", "bound_agent_root_unavailable", "relay_backlog", "runner_exited", "relay_undeliverable" ] } }, "required": [ "code" ], "additionalProperties": false } }, "required": [ "type", "level", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "router_switch" }, "tier": { "type": "string" }, "route": { "type": "string" }, "fromModel": { "type": "string" }, "toModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] }, "trigger": { "type": "string", "enum": [ "turn_start", "cadence", "advisor", "step_trigger", "compaction" ] }, "rationale": { "type": "string" }, "visionFallback": { "type": "boolean" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "tier", "route", "fromModel", "toModel", "thinkingLevel", "trigger", "rationale", "visionFallback" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "status" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "wakeAt" ], "additionalProperties": false } ] }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "status": { "type": "string", "const": "ask" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "status": { "type": "string", "const": "interrupted" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "status": { "type": "string", "const": "sleep" }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "wakeAt" ], "additionalProperties": false } ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "session_created" }, "prompt": { "type": "string" }, "createdAt": { "type": "string" }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "type", "prompt", "createdAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupt_requested" }, "requestedAt": { "type": "string" } }, "required": [ "type", "requestedAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tier_clamped" }, "requestedTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "effectiveTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] } }, "required": [ "type", "requestedTier", "effectiveTier" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "agent_message" }, "message": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" } }, "required": [ "type", "message", "createdAt" ], "additionalProperties": false }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt_submitted" }, "prompt": { "type": "string" }, "inputKind": { "type": "string", "enum": [ "initial", "message" ] }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "prompt", "inputKind", "behavior", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "note_submitted" }, "note": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "note", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer_submitted" }, "answer": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "answer", "sender" ], "additionalProperties": false } ] } ] }, { "type": "object", "properties": { "type": { "type": "string" } }, "required": [ "type" ], "additionalProperties": {} } ] }, "createdAt": { "type": "number" } }, "required": [ "seq", "event", "createdAt" ], "additionalProperties": false } }, "nextCursor": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 } }, "required": [ "events" ], "additionalProperties": false }, "dispatched": { "type": "boolean", "const": false }, "delivery": { "type": "string", "enum": [ "accepted", "queued" ] } }, "required": [ "session", "snapshot", "history", "dispatched", "delivery" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /attachments /sessionMint short-lived credentials for direct file uploads to an agent folder
- Scope
ws:{workspaceSlug}:files:write- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "cwd": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" } } }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "vmBaseUrl": { "type": "string", "format": "uri" }, "uploadPath": { "type": "string", "minLength": 1 }, "uploadToken": { "type": "string", "minLength": 1 }, "expiresAt": { "type": "number" }, "prefix": { "type": "string", "minLength": 1 } }, "required": [ "vmBaseUrl", "uploadPath", "uploadToken", "expiresAt", "prefix" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /waitCreate a session and wait for the submitted turn to finish
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "prompt": { "type": "string", "minLength": 1 }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "cwd": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] } }, "required": [ "data", "mimeType" ] } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ] } }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "behavior": { "default": "steer", "type": "string", "enum": [ "steer", "follow_up" ] }, "mode": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ] } }, "required": [ "prompt", "clientRequestId" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1 }, "inputSeq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "cwd": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" }, "terminal": { "type": "object", "properties": { "seq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "event": { "anyOf": [ { "anyOf": [ { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "step" }, "step": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call_start" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "required": [ "type", "toolName", "toolCallId" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "isError": { "type": "boolean" }, "output": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "image" }, "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "data", "mimeType" ], "additionalProperties": false } ] } }, "details": {} }, "required": [ "type", "toolName", "toolCallId", "isError" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "message": { "type": "string" } }, "required": [ "type", "message" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "step" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_started" }, "task": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "task" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_output" }, "taskId": { "type": "string", "pattern": "^t\\d+$" }, "chunk": { "type": "string" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "taskId", "chunk" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_settled" }, "settlement": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "completed" }, "settledAt": { "type": "number" }, "result": {} }, "required": [ "id", "status", "settledAt", "result" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "failed" }, "settledAt": { "type": "number" }, "error": {} }, "required": [ "id", "status", "settledAt", "error" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "stopped" }, "settledAt": { "type": "number" }, "reason": { "type": "string" } }, "required": [ "id", "status", "settledAt", "reason" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "lost" }, "settledAt": { "type": "number" } }, "required": [ "id", "status", "settledAt" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "settlement" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "heartbeat" }, "timestamp": { "type": "number" }, "activeTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } } }, "required": [ "type", "timestamp", "activeTaskIds" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "todos" }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } } }, "required": [ "type", "todos" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "follow_up_queue" }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } } }, "required": [ "type", "followUpQueue" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "state_machine" }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "type", "stateMachine" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "memory" }, "phase": { "type": "string", "enum": [ "observation", "reflection" ] }, "status": { "type": "string", "enum": [ "running", "completed" ] }, "message": { "type": "string" }, "observations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "usageBumpedObservations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "type", "phase", "status", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "usage" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "turnUsage", "usageByModel", "lastMessageUsage", "effectiveContextWindow", "contextWindowUsage" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "level": { "type": "string", "enum": [ "debug", "info", "warn", "error" ] }, "message": { "type": "string" }, "metadata": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "storage_full", "session_cwd_fallback", "bound_agent_root_unavailable", "relay_backlog", "runner_exited", "relay_undeliverable" ] } }, "required": [ "code" ], "additionalProperties": false } }, "required": [ "type", "level", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "router_switch" }, "tier": { "type": "string" }, "route": { "type": "string" }, "fromModel": { "type": "string" }, "toModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] }, "trigger": { "type": "string", "enum": [ "turn_start", "cadence", "advisor", "step_trigger", "compaction" ] }, "rationale": { "type": "string" }, "visionFallback": { "type": "boolean" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "tier", "route", "fromModel", "toModel", "thinkingLevel", "trigger", "rationale", "visionFallback" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "status" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "wakeAt" ], "additionalProperties": false } ] }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "status": { "type": "string", "const": "ask" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "status": { "type": "string", "const": "interrupted" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "status": { "type": "string", "const": "sleep" }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "wakeAt" ], "additionalProperties": false } ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "session_created" }, "prompt": { "type": "string" }, "createdAt": { "type": "string" }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "type", "prompt", "createdAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupt_requested" }, "requestedAt": { "type": "string" } }, "required": [ "type", "requestedAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tier_clamped" }, "requestedTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "effectiveTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] } }, "required": [ "type", "requestedTier", "effectiveTier" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "agent_message" }, "message": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" } }, "required": [ "type", "message", "createdAt" ], "additionalProperties": false }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt_submitted" }, "prompt": { "type": "string" }, "inputKind": { "type": "string", "enum": [ "initial", "message" ] }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "prompt", "inputKind", "behavior", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "note_submitted" }, "note": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "note", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer_submitted" }, "answer": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "answer", "sender" ], "additionalProperties": false } ] } ] }, { "type": "object", "properties": { "type": { "type": "string" } }, "required": [ "type" ], "additionalProperties": {} } ] }, "createdAt": { "type": "number" } }, "required": [ "seq", "event", "createdAt" ], "additionalProperties": false } }, "required": [ "sessionId", "inputSeq", "terminal" ], "additionalProperties": false }, { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1 }, "inputSeq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "pending" } }, "required": [ "sessionId", "inputSeq", "status" ], "additionalProperties": false } ] }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /sessionsCreate a child session inheriting its parent context
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "prompt": { "type": "string", "minLength": 1 }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "cwd": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] } }, "required": [ "data", "mimeType" ] } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ] } }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "behavior": { "default": "steer", "type": "string", "enum": [ "steer", "follow_up" ] }, "mode": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ] } }, "required": [ "prompt" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "session": { "type": "object", "properties": { "sessionId": { "type": "string" }, "status": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "lastDeliveredInputSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "sessionId", "status", "lastEventSeq", "lastDeliveredInputSeq" ], "additionalProperties": false }, "snapshot": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "turnStatus": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "title": { "type": "string" }, "titleOrigin": { "type": "string", "enum": [ "excerpt", "auto", "manual" ] }, "titleStatus": { "type": "string", "enum": [ "generating", "complete", "failed" ] }, "archivedAt": { "type": "number" }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "machine": { "type": "object", "properties": { "definitionName": { "type": "string" }, "currentState": { "type": "string" }, "followingDefinitionState": { "type": "string" }, "progress": { "type": "object", "properties": { "completed": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "total": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "completed", "total" ], "additionalProperties": false }, "orderedPath": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "index": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "name": { "type": "string" }, "kind": { "type": "string" }, "phase": { "type": "string", "enum": [ "past", "current", "future", "outcome" ] }, "terminalStatus": { "type": "string", "enum": [ "completed", "failed", "cancelled", "error" ] } }, "required": [ "key", "index", "name", "phase" ], "additionalProperties": false } }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "orderedPath", "activity" ], "additionalProperties": false }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" }, "workspaceId": { "type": "string" }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "lastDeliveredInputSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "deliveryAttempt": { "type": "object", "properties": { "attemptId": { "type": "string", "minLength": 1 }, "throughSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "kind": { "type": "string", "enum": [ "initial_prompt", "message", "answer" ] }, "createdAt": { "type": "number" } }, "required": [ "attemptId", "throughSeq", "kind", "createdAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "requestedMachine": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "machineState": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "id", "userId", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "workspaceId", "lastDeliveredInputSeq" ], "additionalProperties": false }, "history": { "type": "object", "properties": { "events": { "type": "array", "items": { "type": "object", "properties": { "seq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "event": { "anyOf": [ { "anyOf": [ { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "step" }, "step": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call_start" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "required": [ "type", "toolName", "toolCallId" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "isError": { "type": "boolean" }, "output": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "image" }, "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "data", "mimeType" ], "additionalProperties": false } ] } }, "details": {} }, "required": [ "type", "toolName", "toolCallId", "isError" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "message": { "type": "string" } }, "required": [ "type", "message" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "step" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_started" }, "task": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "task" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_output" }, "taskId": { "type": "string", "pattern": "^t\\d+$" }, "chunk": { "type": "string" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "taskId", "chunk" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_settled" }, "settlement": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "completed" }, "settledAt": { "type": "number" }, "result": {} }, "required": [ "id", "status", "settledAt", "result" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "failed" }, "settledAt": { "type": "number" }, "error": {} }, "required": [ "id", "status", "settledAt", "error" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "stopped" }, "settledAt": { "type": "number" }, "reason": { "type": "string" } }, "required": [ "id", "status", "settledAt", "reason" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "lost" }, "settledAt": { "type": "number" } }, "required": [ "id", "status", "settledAt" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "settlement" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "heartbeat" }, "timestamp": { "type": "number" }, "activeTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } } }, "required": [ "type", "timestamp", "activeTaskIds" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "todos" }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } } }, "required": [ "type", "todos" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "follow_up_queue" }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } } }, "required": [ "type", "followUpQueue" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "state_machine" }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "type", "stateMachine" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "memory" }, "phase": { "type": "string", "enum": [ "observation", "reflection" ] }, "status": { "type": "string", "enum": [ "running", "completed" ] }, "message": { "type": "string" }, "observations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "usageBumpedObservations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "type", "phase", "status", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "usage" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "turnUsage", "usageByModel", "lastMessageUsage", "effectiveContextWindow", "contextWindowUsage" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "level": { "type": "string", "enum": [ "debug", "info", "warn", "error" ] }, "message": { "type": "string" }, "metadata": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "storage_full", "session_cwd_fallback", "bound_agent_root_unavailable", "relay_backlog", "runner_exited", "relay_undeliverable" ] } }, "required": [ "code" ], "additionalProperties": false } }, "required": [ "type", "level", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "router_switch" }, "tier": { "type": "string" }, "route": { "type": "string" }, "fromModel": { "type": "string" }, "toModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] }, "trigger": { "type": "string", "enum": [ "turn_start", "cadence", "advisor", "step_trigger", "compaction" ] }, "rationale": { "type": "string" }, "visionFallback": { "type": "boolean" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "tier", "route", "fromModel", "toModel", "thinkingLevel", "trigger", "rationale", "visionFallback" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "status" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "wakeAt" ], "additionalProperties": false } ] }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "status": { "type": "string", "const": "ask" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "status": { "type": "string", "const": "interrupted" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "status": { "type": "string", "const": "sleep" }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "wakeAt" ], "additionalProperties": false } ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "session_created" }, "prompt": { "type": "string" }, "createdAt": { "type": "string" }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "type", "prompt", "createdAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupt_requested" }, "requestedAt": { "type": "string" } }, "required": [ "type", "requestedAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tier_clamped" }, "requestedTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "effectiveTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] } }, "required": [ "type", "requestedTier", "effectiveTier" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "agent_message" }, "message": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" } }, "required": [ "type", "message", "createdAt" ], "additionalProperties": false }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt_submitted" }, "prompt": { "type": "string" }, "inputKind": { "type": "string", "enum": [ "initial", "message" ] }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "prompt", "inputKind", "behavior", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "note_submitted" }, "note": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "note", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer_submitted" }, "answer": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "answer", "sender" ], "additionalProperties": false } ] } ] }, { "type": "object", "properties": { "type": { "type": "string" } }, "required": [ "type" ], "additionalProperties": {} } ] }, "createdAt": { "type": "number" } }, "required": [ "seq", "event", "createdAt" ], "additionalProperties": false } }, "nextCursor": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 } }, "required": [ "events" ], "additionalProperties": false }, "dispatched": { "type": "boolean", "const": false }, "delivery": { "type": "string", "enum": [ "accepted", "queued" ] } }, "required": [ "session", "snapshot", "history", "dispatched", "delivery" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /sessions /waitCreate a child session and wait for the submitted turn to finish
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "prompt": { "type": "string", "minLength": 1 }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "cwd": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] } }, "required": [ "data", "mimeType" ] } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ] } }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "behavior": { "default": "steer", "type": "string", "enum": [ "steer", "follow_up" ] }, "mode": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ] } }, "required": [ "prompt", "clientRequestId" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1 }, "inputSeq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "cwd": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" }, "terminal": { "type": "object", "properties": { "seq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "event": { "anyOf": [ { "anyOf": [ { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "step" }, "step": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call_start" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "required": [ "type", "toolName", "toolCallId" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "isError": { "type": "boolean" }, "output": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "image" }, "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "data", "mimeType" ], "additionalProperties": false } ] } }, "details": {} }, "required": [ "type", "toolName", "toolCallId", "isError" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "message": { "type": "string" } }, "required": [ "type", "message" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "step" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_started" }, "task": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "task" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_output" }, "taskId": { "type": "string", "pattern": "^t\\d+$" }, "chunk": { "type": "string" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "taskId", "chunk" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_settled" }, "settlement": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "completed" }, "settledAt": { "type": "number" }, "result": {} }, "required": [ "id", "status", "settledAt", "result" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "failed" }, "settledAt": { "type": "number" }, "error": {} }, "required": [ "id", "status", "settledAt", "error" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "stopped" }, "settledAt": { "type": "number" }, "reason": { "type": "string" } }, "required": [ "id", "status", "settledAt", "reason" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "lost" }, "settledAt": { "type": "number" } }, "required": [ "id", "status", "settledAt" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "settlement" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "heartbeat" }, "timestamp": { "type": "number" }, "activeTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } } }, "required": [ "type", "timestamp", "activeTaskIds" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "todos" }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } } }, "required": [ "type", "todos" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "follow_up_queue" }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } } }, "required": [ "type", "followUpQueue" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "state_machine" }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "type", "stateMachine" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "memory" }, "phase": { "type": "string", "enum": [ "observation", "reflection" ] }, "status": { "type": "string", "enum": [ "running", "completed" ] }, "message": { "type": "string" }, "observations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "usageBumpedObservations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "type", "phase", "status", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "usage" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "turnUsage", "usageByModel", "lastMessageUsage", "effectiveContextWindow", "contextWindowUsage" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "level": { "type": "string", "enum": [ "debug", "info", "warn", "error" ] }, "message": { "type": "string" }, "metadata": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "storage_full", "session_cwd_fallback", "bound_agent_root_unavailable", "relay_backlog", "runner_exited", "relay_undeliverable" ] } }, "required": [ "code" ], "additionalProperties": false } }, "required": [ "type", "level", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "router_switch" }, "tier": { "type": "string" }, "route": { "type": "string" }, "fromModel": { "type": "string" }, "toModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] }, "trigger": { "type": "string", "enum": [ "turn_start", "cadence", "advisor", "step_trigger", "compaction" ] }, "rationale": { "type": "string" }, "visionFallback": { "type": "boolean" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "tier", "route", "fromModel", "toModel", "thinkingLevel", "trigger", "rationale", "visionFallback" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "status" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "wakeAt" ], "additionalProperties": false } ] }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "status": { "type": "string", "const": "ask" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "status": { "type": "string", "const": "interrupted" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "status": { "type": "string", "const": "sleep" }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "wakeAt" ], "additionalProperties": false } ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "session_created" }, "prompt": { "type": "string" }, "createdAt": { "type": "string" }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "type", "prompt", "createdAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupt_requested" }, "requestedAt": { "type": "string" } }, "required": [ "type", "requestedAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tier_clamped" }, "requestedTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "effectiveTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] } }, "required": [ "type", "requestedTier", "effectiveTier" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "agent_message" }, "message": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" } }, "required": [ "type", "message", "createdAt" ], "additionalProperties": false }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt_submitted" }, "prompt": { "type": "string" }, "inputKind": { "type": "string", "enum": [ "initial", "message" ] }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "prompt", "inputKind", "behavior", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "note_submitted" }, "note": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "note", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer_submitted" }, "answer": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "answer", "sender" ], "additionalProperties": false } ] } ] }, { "type": "object", "properties": { "type": { "type": "string" } }, "required": [ "type" ], "additionalProperties": {} } ] }, "createdAt": { "type": "number" } }, "required": [ "seq", "event", "createdAt" ], "additionalProperties": false } }, "required": [ "sessionId", "inputSeq", "terminal" ], "additionalProperties": false }, { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1 }, "inputSeq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "pending" } }, "required": [ "sessionId", "inputSeq", "status" ], "additionalProperties": false } ] }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId}Get a session snapshot
- Scope
ws:{workspaceSlug}:sessions- Request
- No JSON request body
- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "turnStatus": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "title": { "type": "string" }, "titleOrigin": { "type": "string", "enum": [ "excerpt", "auto", "manual" ] }, "titleStatus": { "type": "string", "enum": [ "generating", "complete", "failed" ] }, "archivedAt": { "type": "number" }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "machine": { "type": "object", "properties": { "definitionName": { "type": "string" }, "currentState": { "type": "string" }, "followingDefinitionState": { "type": "string" }, "progress": { "type": "object", "properties": { "completed": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "total": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "completed", "total" ], "additionalProperties": false }, "orderedPath": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "index": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "name": { "type": "string" }, "kind": { "type": "string" }, "phase": { "type": "string", "enum": [ "past", "current", "future", "outcome" ] }, "terminalStatus": { "type": "string", "enum": [ "completed", "failed", "cancelled", "error" ] } }, "required": [ "key", "index", "name", "phase" ], "additionalProperties": false } }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "orderedPath", "activity" ], "additionalProperties": false }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" }, "workspaceId": { "type": "string" }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "lastDeliveredInputSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "deliveryAttempt": { "type": "object", "properties": { "attemptId": { "type": "string", "minLength": 1 }, "throughSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "kind": { "type": "string", "enum": [ "initial_prompt", "message", "answer" ] }, "createdAt": { "type": "number" } }, "required": [ "attemptId", "throughSeq", "kind", "createdAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "requestedMachine": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "machineState": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "id", "userId", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "workspaceId", "lastDeliveredInputSeq" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agents /{agentSlug} /sessions /defaultGet an agent's default session snapshot
- Scope
ws:{workspaceSlug}:sessions- Request
- No JSON request body
- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "session": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "turnStatus": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "title": { "type": "string" }, "titleOrigin": { "type": "string", "enum": [ "excerpt", "auto", "manual" ] }, "titleStatus": { "type": "string", "enum": [ "generating", "complete", "failed" ] }, "archivedAt": { "type": "number" }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "machine": { "type": "object", "properties": { "definitionName": { "type": "string" }, "currentState": { "type": "string" }, "followingDefinitionState": { "type": "string" }, "progress": { "type": "object", "properties": { "completed": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "total": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "completed", "total" ], "additionalProperties": false }, "orderedPath": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "index": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "name": { "type": "string" }, "kind": { "type": "string" }, "phase": { "type": "string", "enum": [ "past", "current", "future", "outcome" ] }, "terminalStatus": { "type": "string", "enum": [ "completed", "failed", "cancelled", "error" ] } }, "required": [ "key", "index", "name", "phase" ], "additionalProperties": false } }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "orderedPath", "activity" ], "additionalProperties": false }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" }, "workspaceId": { "type": "string" }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "lastDeliveredInputSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "deliveryAttempt": { "type": "object", "properties": { "attemptId": { "type": "string", "minLength": 1 }, "throughSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "kind": { "type": "string", "enum": [ "initial_prompt", "message", "answer" ] }, "createdAt": { "type": "number" } }, "required": [ "attemptId", "throughSeq", "kind", "createdAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "requestedMachine": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "machineState": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "id", "userId", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "workspaceId", "lastDeliveredInputSeq" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "session" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agents /{agentSlug} /sessions /defaultPoint an agent's default session alias at a session, or at nothing
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "sessionId": { "anyOf": [ { "type": "string", "minLength": 1 }, { "type": "null" } ] } }, "required": [ "sessionId" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "session": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "turnStatus": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "title": { "type": "string" }, "titleOrigin": { "type": "string", "enum": [ "excerpt", "auto", "manual" ] }, "titleStatus": { "type": "string", "enum": [ "generating", "complete", "failed" ] }, "archivedAt": { "type": "number" }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "machine": { "type": "object", "properties": { "definitionName": { "type": "string" }, "currentState": { "type": "string" }, "followingDefinitionState": { "type": "string" }, "progress": { "type": "object", "properties": { "completed": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "total": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "completed", "total" ], "additionalProperties": false }, "orderedPath": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "index": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "name": { "type": "string" }, "kind": { "type": "string" }, "phase": { "type": "string", "enum": [ "past", "current", "future", "outcome" ] }, "terminalStatus": { "type": "string", "enum": [ "completed", "failed", "cancelled", "error" ] } }, "required": [ "key", "index", "name", "phase" ], "additionalProperties": false } }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "orderedPath", "activity" ], "additionalProperties": false }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" }, "workspaceId": { "type": "string" }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "lastDeliveredInputSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "deliveryAttempt": { "type": "object", "properties": { "attemptId": { "type": "string", "minLength": 1 }, "throughSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "kind": { "type": "string", "enum": [ "initial_prompt", "message", "answer" ] }, "createdAt": { "type": "number" } }, "required": [ "attemptId", "throughSeq", "kind", "createdAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "requestedMachine": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "machineState": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "id", "userId", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "workspaceId", "lastDeliveredInputSeq" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "session" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Declared idempotent
/v1 /ws /{workspaceSlug} /agents /{agentSlug} /sessions /default /historyPage through an agent's default session history
- Scope
ws:{workspaceSlug}:sessions- Request
- No JSON request body
- Query
Query parameters JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "cursor": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "before": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "limit": { "default": 100, "type": "integer", "minimum": 1, "maximum": 500 } } }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "events": { "type": "array", "items": { "type": "object", "properties": { "seq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "event": { "anyOf": [ { "anyOf": [ { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "step" }, "step": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call_start" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "required": [ "type", "toolName", "toolCallId" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "isError": { "type": "boolean" }, "output": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "image" }, "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "data", "mimeType" ], "additionalProperties": false } ] } }, "details": {} }, "required": [ "type", "toolName", "toolCallId", "isError" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "message": { "type": "string" } }, "required": [ "type", "message" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "step" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_started" }, "task": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "task" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_output" }, "taskId": { "type": "string", "pattern": "^t\\d+$" }, "chunk": { "type": "string" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "taskId", "chunk" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_settled" }, "settlement": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "completed" }, "settledAt": { "type": "number" }, "result": {} }, "required": [ "id", "status", "settledAt", "result" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "failed" }, "settledAt": { "type": "number" }, "error": {} }, "required": [ "id", "status", "settledAt", "error" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "stopped" }, "settledAt": { "type": "number" }, "reason": { "type": "string" } }, "required": [ "id", "status", "settledAt", "reason" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "lost" }, "settledAt": { "type": "number" } }, "required": [ "id", "status", "settledAt" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "settlement" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "heartbeat" }, "timestamp": { "type": "number" }, "activeTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } } }, "required": [ "type", "timestamp", "activeTaskIds" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "todos" }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } } }, "required": [ "type", "todos" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "follow_up_queue" }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } } }, "required": [ "type", "followUpQueue" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "state_machine" }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "type", "stateMachine" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "memory" }, "phase": { "type": "string", "enum": [ "observation", "reflection" ] }, "status": { "type": "string", "enum": [ "running", "completed" ] }, "message": { "type": "string" }, "observations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "usageBumpedObservations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "type", "phase", "status", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "usage" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "turnUsage", "usageByModel", "lastMessageUsage", "effectiveContextWindow", "contextWindowUsage" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "level": { "type": "string", "enum": [ "debug", "info", "warn", "error" ] }, "message": { "type": "string" }, "metadata": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "storage_full", "session_cwd_fallback", "bound_agent_root_unavailable", "relay_backlog", "runner_exited", "relay_undeliverable" ] } }, "required": [ "code" ], "additionalProperties": false } }, "required": [ "type", "level", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "router_switch" }, "tier": { "type": "string" }, "route": { "type": "string" }, "fromModel": { "type": "string" }, "toModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] }, "trigger": { "type": "string", "enum": [ "turn_start", "cadence", "advisor", "step_trigger", "compaction" ] }, "rationale": { "type": "string" }, "visionFallback": { "type": "boolean" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "tier", "route", "fromModel", "toModel", "thinkingLevel", "trigger", "rationale", "visionFallback" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "status" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "wakeAt" ], "additionalProperties": false } ] }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "status": { "type": "string", "const": "ask" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "status": { "type": "string", "const": "interrupted" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "status": { "type": "string", "const": "sleep" }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "wakeAt" ], "additionalProperties": false } ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "session_created" }, "prompt": { "type": "string" }, "createdAt": { "type": "string" }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "type", "prompt", "createdAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupt_requested" }, "requestedAt": { "type": "string" } }, "required": [ "type", "requestedAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tier_clamped" }, "requestedTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "effectiveTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] } }, "required": [ "type", "requestedTier", "effectiveTier" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "agent_message" }, "message": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" } }, "required": [ "type", "message", "createdAt" ], "additionalProperties": false }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt_submitted" }, "prompt": { "type": "string" }, "inputKind": { "type": "string", "enum": [ "initial", "message" ] }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "prompt", "inputKind", "behavior", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "note_submitted" }, "note": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "note", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer_submitted" }, "answer": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "answer", "sender" ], "additionalProperties": false } ] } ] }, { "type": "object", "properties": { "type": { "type": "string" } }, "required": [ "type" ], "additionalProperties": {} } ] }, "createdAt": { "type": "number" } }, "required": [ "seq", "event", "createdAt" ], "additionalProperties": false } }, "nextCursor": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 } }, "required": [ "events" ], "additionalProperties": false }- Errors
Error body JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "error": { "type": "string", "const": "no_default_session" } }, "required": [ "error" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agents /{agentSlug} /sessions /default /messagesCreate or message an agent's default session
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "prompt": { "type": "string", "minLength": 1 }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] } }, "required": [ "data", "mimeType" ] } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ] } }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "behavior": { "default": "steer", "type": "string", "enum": [ "steer", "follow_up" ] }, "sourceSessionId": { "type": "string", "minLength": 1 }, "agentFirstMessage": { "type": "string", "maxLength": 2000 } }, "required": [ "prompt" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "type": "object", "properties": { "session": { "type": "object", "properties": { "sessionId": { "type": "string" }, "status": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "lastDeliveredInputSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "sessionId", "status", "lastEventSeq", "lastDeliveredInputSeq" ], "additionalProperties": false }, "snapshot": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "turnStatus": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "title": { "type": "string" }, "titleOrigin": { "type": "string", "enum": [ "excerpt", "auto", "manual" ] }, "titleStatus": { "type": "string", "enum": [ "generating", "complete", "failed" ] }, "archivedAt": { "type": "number" }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "machine": { "type": "object", "properties": { "definitionName": { "type": "string" }, "currentState": { "type": "string" }, "followingDefinitionState": { "type": "string" }, "progress": { "type": "object", "properties": { "completed": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "total": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "completed", "total" ], "additionalProperties": false }, "orderedPath": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "index": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "name": { "type": "string" }, "kind": { "type": "string" }, "phase": { "type": "string", "enum": [ "past", "current", "future", "outcome" ] }, "terminalStatus": { "type": "string", "enum": [ "completed", "failed", "cancelled", "error" ] } }, "required": [ "key", "index", "name", "phase" ], "additionalProperties": false } }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "orderedPath", "activity" ], "additionalProperties": false }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" }, "workspaceId": { "type": "string" }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "lastDeliveredInputSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "deliveryAttempt": { "type": "object", "properties": { "attemptId": { "type": "string", "minLength": 1 }, "throughSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "kind": { "type": "string", "enum": [ "initial_prompt", "message", "answer" ] }, "createdAt": { "type": "number" } }, "required": [ "attemptId", "throughSeq", "kind", "createdAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "requestedMachine": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "machineState": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "id", "userId", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "workspaceId", "lastDeliveredInputSeq" ], "additionalProperties": false }, "history": { "type": "object", "properties": { "events": { "type": "array", "items": { "type": "object", "properties": { "seq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "event": { "anyOf": [ { "anyOf": [ { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "step" }, "step": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call_start" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "required": [ "type", "toolName", "toolCallId" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "isError": { "type": "boolean" }, "output": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "image" }, "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "data", "mimeType" ], "additionalProperties": false } ] } }, "details": {} }, "required": [ "type", "toolName", "toolCallId", "isError" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "message": { "type": "string" } }, "required": [ "type", "message" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "step" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_started" }, "task": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "task" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_output" }, "taskId": { "type": "string", "pattern": "^t\\d+$" }, "chunk": { "type": "string" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "taskId", "chunk" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_settled" }, "settlement": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "completed" }, "settledAt": { "type": "number" }, "result": {} }, "required": [ "id", "status", "settledAt", "result" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "failed" }, "settledAt": { "type": "number" }, "error": {} }, "required": [ "id", "status", "settledAt", "error" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "stopped" }, "settledAt": { "type": "number" }, "reason": { "type": "string" } }, "required": [ "id", "status", "settledAt", "reason" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "lost" }, "settledAt": { "type": "number" } }, "required": [ "id", "status", "settledAt" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "settlement" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "heartbeat" }, "timestamp": { "type": "number" }, "activeTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } } }, "required": [ "type", "timestamp", "activeTaskIds" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "todos" }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } } }, "required": [ "type", "todos" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "follow_up_queue" }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } } }, "required": [ "type", "followUpQueue" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "state_machine" }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "type", "stateMachine" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "memory" }, "phase": { "type": "string", "enum": [ "observation", "reflection" ] }, "status": { "type": "string", "enum": [ "running", "completed" ] }, "message": { "type": "string" }, "observations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "usageBumpedObservations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "type", "phase", "status", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "usage" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "turnUsage", "usageByModel", "lastMessageUsage", "effectiveContextWindow", "contextWindowUsage" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "level": { "type": "string", "enum": [ "debug", "info", "warn", "error" ] }, "message": { "type": "string" }, "metadata": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "storage_full", "session_cwd_fallback", "bound_agent_root_unavailable", "relay_backlog", "runner_exited", "relay_undeliverable" ] } }, "required": [ "code" ], "additionalProperties": false } }, "required": [ "type", "level", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "router_switch" }, "tier": { "type": "string" }, "route": { "type": "string" }, "fromModel": { "type": "string" }, "toModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] }, "trigger": { "type": "string", "enum": [ "turn_start", "cadence", "advisor", "step_trigger", "compaction" ] }, "rationale": { "type": "string" }, "visionFallback": { "type": "boolean" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "tier", "route", "fromModel", "toModel", "thinkingLevel", "trigger", "rationale", "visionFallback" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "status" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "wakeAt" ], "additionalProperties": false } ] }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "status": { "type": "string", "const": "ask" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "status": { "type": "string", "const": "interrupted" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "status": { "type": "string", "const": "sleep" }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "wakeAt" ], "additionalProperties": false } ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "session_created" }, "prompt": { "type": "string" }, "createdAt": { "type": "string" }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "type", "prompt", "createdAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupt_requested" }, "requestedAt": { "type": "string" } }, "required": [ "type", "requestedAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tier_clamped" }, "requestedTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "effectiveTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] } }, "required": [ "type", "requestedTier", "effectiveTier" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "agent_message" }, "message": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" } }, "required": [ "type", "message", "createdAt" ], "additionalProperties": false }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt_submitted" }, "prompt": { "type": "string" }, "inputKind": { "type": "string", "enum": [ "initial", "message" ] }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "prompt", "inputKind", "behavior", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "note_submitted" }, "note": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "note", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer_submitted" }, "answer": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "answer", "sender" ], "additionalProperties": false } ] } ] }, { "type": "object", "properties": { "type": { "type": "string" } }, "required": [ "type" ], "additionalProperties": {} } ] }, "createdAt": { "type": "number" } }, "required": [ "seq", "event", "createdAt" ], "additionalProperties": false } }, "nextCursor": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 } }, "required": [ "events" ], "additionalProperties": false }, "dispatched": { "type": "boolean", "const": false }, "delivery": { "type": "string", "enum": [ "accepted", "queued" ] } }, "required": [ "session", "snapshot", "history", "dispatched", "delivery" ], "additionalProperties": false }, { "type": "object", "properties": { "ok": { "type": "boolean", "const": true }, "delivery": { "type": "string", "enum": [ "accepted", "queued" ] }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "ok", "delivery", "sessionId" ], "additionalProperties": false } ] }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agents /{agentSlug} /sessions /default /messages /waitCreate or message an agent's default session and wait for the turn
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "prompt": { "type": "string", "minLength": 1 }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] } }, "required": [ "data", "mimeType" ] } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ] } }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "behavior": { "default": "steer", "type": "string", "enum": [ "steer", "follow_up" ] }, "sourceSessionId": { "type": "string", "minLength": 1 } }, "required": [ "prompt", "clientRequestId" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1 }, "inputSeq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "cwd": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" }, "terminal": { "type": "object", "properties": { "seq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "event": { "anyOf": [ { "anyOf": [ { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "step" }, "step": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call_start" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "required": [ "type", "toolName", "toolCallId" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "isError": { "type": "boolean" }, "output": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "image" }, "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "data", "mimeType" ], "additionalProperties": false } ] } }, "details": {} }, "required": [ "type", "toolName", "toolCallId", "isError" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "message": { "type": "string" } }, "required": [ "type", "message" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "step" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_started" }, "task": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "task" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_output" }, "taskId": { "type": "string", "pattern": "^t\\d+$" }, "chunk": { "type": "string" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "taskId", "chunk" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_settled" }, "settlement": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "completed" }, "settledAt": { "type": "number" }, "result": {} }, "required": [ "id", "status", "settledAt", "result" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "failed" }, "settledAt": { "type": "number" }, "error": {} }, "required": [ "id", "status", "settledAt", "error" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "stopped" }, "settledAt": { "type": "number" }, "reason": { "type": "string" } }, "required": [ "id", "status", "settledAt", "reason" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "lost" }, "settledAt": { "type": "number" } }, "required": [ "id", "status", "settledAt" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "settlement" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "heartbeat" }, "timestamp": { "type": "number" }, "activeTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } } }, "required": [ "type", "timestamp", "activeTaskIds" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "todos" }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } } }, "required": [ "type", "todos" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "follow_up_queue" }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } } }, "required": [ "type", "followUpQueue" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "state_machine" }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "type", "stateMachine" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "memory" }, "phase": { "type": "string", "enum": [ "observation", "reflection" ] }, "status": { "type": "string", "enum": [ "running", "completed" ] }, "message": { "type": "string" }, "observations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "usageBumpedObservations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "type", "phase", "status", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "usage" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "turnUsage", "usageByModel", "lastMessageUsage", "effectiveContextWindow", "contextWindowUsage" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "level": { "type": "string", "enum": [ "debug", "info", "warn", "error" ] }, "message": { "type": "string" }, "metadata": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "storage_full", "session_cwd_fallback", "bound_agent_root_unavailable", "relay_backlog", "runner_exited", "relay_undeliverable" ] } }, "required": [ "code" ], "additionalProperties": false } }, "required": [ "type", "level", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "router_switch" }, "tier": { "type": "string" }, "route": { "type": "string" }, "fromModel": { "type": "string" }, "toModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] }, "trigger": { "type": "string", "enum": [ "turn_start", "cadence", "advisor", "step_trigger", "compaction" ] }, "rationale": { "type": "string" }, "visionFallback": { "type": "boolean" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "tier", "route", "fromModel", "toModel", "thinkingLevel", "trigger", "rationale", "visionFallback" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "status" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "wakeAt" ], "additionalProperties": false } ] }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "status": { "type": "string", "const": "ask" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "status": { "type": "string", "const": "interrupted" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "status": { "type": "string", "const": "sleep" }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "wakeAt" ], "additionalProperties": false } ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "session_created" }, "prompt": { "type": "string" }, "createdAt": { "type": "string" }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "type", "prompt", "createdAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupt_requested" }, "requestedAt": { "type": "string" } }, "required": [ "type", "requestedAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tier_clamped" }, "requestedTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "effectiveTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] } }, "required": [ "type", "requestedTier", "effectiveTier" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "agent_message" }, "message": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" } }, "required": [ "type", "message", "createdAt" ], "additionalProperties": false }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt_submitted" }, "prompt": { "type": "string" }, "inputKind": { "type": "string", "enum": [ "initial", "message" ] }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "prompt", "inputKind", "behavior", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "note_submitted" }, "note": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "note", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer_submitted" }, "answer": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "answer", "sender" ], "additionalProperties": false } ] } ] }, { "type": "object", "properties": { "type": { "type": "string" } }, "required": [ "type" ], "additionalProperties": {} } ] }, "createdAt": { "type": "number" } }, "required": [ "seq", "event", "createdAt" ], "additionalProperties": false } }, "required": [ "sessionId", "inputSeq", "terminal" ], "additionalProperties": false }, { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1 }, "inputSeq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "pending" } }, "required": [ "sessionId", "inputSeq", "status" ], "additionalProperties": false } ] }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /historyPage through durable session events
- Scope
ws:{workspaceSlug}:sessions- Request
- No JSON request body
- Query
Query parameters JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "cursor": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "before": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "limit": { "default": 100, "type": "integer", "minimum": 1, "maximum": 500 } } }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "events": { "type": "array", "items": { "type": "object", "properties": { "seq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "event": { "anyOf": [ { "anyOf": [ { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "step" }, "step": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call_start" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "required": [ "type", "toolName", "toolCallId" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "isError": { "type": "boolean" }, "output": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "image" }, "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "data", "mimeType" ], "additionalProperties": false } ] } }, "details": {} }, "required": [ "type", "toolName", "toolCallId", "isError" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "message": { "type": "string" } }, "required": [ "type", "message" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "step" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_started" }, "task": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "task" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_output" }, "taskId": { "type": "string", "pattern": "^t\\d+$" }, "chunk": { "type": "string" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "taskId", "chunk" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_settled" }, "settlement": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "completed" }, "settledAt": { "type": "number" }, "result": {} }, "required": [ "id", "status", "settledAt", "result" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "failed" }, "settledAt": { "type": "number" }, "error": {} }, "required": [ "id", "status", "settledAt", "error" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "stopped" }, "settledAt": { "type": "number" }, "reason": { "type": "string" } }, "required": [ "id", "status", "settledAt", "reason" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "lost" }, "settledAt": { "type": "number" } }, "required": [ "id", "status", "settledAt" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "settlement" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "heartbeat" }, "timestamp": { "type": "number" }, "activeTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } } }, "required": [ "type", "timestamp", "activeTaskIds" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "todos" }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } } }, "required": [ "type", "todos" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "follow_up_queue" }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } } }, "required": [ "type", "followUpQueue" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "state_machine" }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "type", "stateMachine" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "memory" }, "phase": { "type": "string", "enum": [ "observation", "reflection" ] }, "status": { "type": "string", "enum": [ "running", "completed" ] }, "message": { "type": "string" }, "observations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "usageBumpedObservations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "type", "phase", "status", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "usage" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "turnUsage", "usageByModel", "lastMessageUsage", "effectiveContextWindow", "contextWindowUsage" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "level": { "type": "string", "enum": [ "debug", "info", "warn", "error" ] }, "message": { "type": "string" }, "metadata": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "storage_full", "session_cwd_fallback", "bound_agent_root_unavailable", "relay_backlog", "runner_exited", "relay_undeliverable" ] } }, "required": [ "code" ], "additionalProperties": false } }, "required": [ "type", "level", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "router_switch" }, "tier": { "type": "string" }, "route": { "type": "string" }, "fromModel": { "type": "string" }, "toModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] }, "trigger": { "type": "string", "enum": [ "turn_start", "cadence", "advisor", "step_trigger", "compaction" ] }, "rationale": { "type": "string" }, "visionFallback": { "type": "boolean" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "tier", "route", "fromModel", "toModel", "thinkingLevel", "trigger", "rationale", "visionFallback" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "status" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "wakeAt" ], "additionalProperties": false } ] }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "status": { "type": "string", "const": "ask" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "status": { "type": "string", "const": "interrupted" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "status": { "type": "string", "const": "sleep" }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "wakeAt" ], "additionalProperties": false } ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "session_created" }, "prompt": { "type": "string" }, "createdAt": { "type": "string" }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "type", "prompt", "createdAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupt_requested" }, "requestedAt": { "type": "string" } }, "required": [ "type", "requestedAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tier_clamped" }, "requestedTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "effectiveTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] } }, "required": [ "type", "requestedTier", "effectiveTier" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "agent_message" }, "message": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" } }, "required": [ "type", "message", "createdAt" ], "additionalProperties": false }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt_submitted" }, "prompt": { "type": "string" }, "inputKind": { "type": "string", "enum": [ "initial", "message" ] }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "prompt", "inputKind", "behavior", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "note_submitted" }, "note": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "note", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer_submitted" }, "answer": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "answer", "sender" ], "additionalProperties": false } ] } ] }, { "type": "object", "properties": { "type": { "type": "string" } }, "required": [ "type" ], "additionalProperties": {} } ] }, "createdAt": { "type": "number" } }, "required": [ "seq", "event", "createdAt" ], "additionalProperties": false } }, "nextCursor": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 } }, "required": [ "events" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /eventsResume a session event stream
- Scope
ws:{workspaceSlug}:sessions- Request
- No JSON request body
- Query
Query parameters JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "since": { "default": 0, "type": "integer", "minimum": 0, "maximum": 9007199254740991 } } }- Headers
Last-Event-ID— Resume after the last committed numeric sequence.
- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "seq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "event": { "anyOf": [ { "anyOf": [ { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "step" }, "step": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call_start" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "required": [ "type", "toolName", "toolCallId" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "isError": { "type": "boolean" }, "output": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "image" }, "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "data", "mimeType" ], "additionalProperties": false } ] } }, "details": {} }, "required": [ "type", "toolName", "toolCallId", "isError" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "message": { "type": "string" } }, "required": [ "type", "message" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "step" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_started" }, "task": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "task" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_output" }, "taskId": { "type": "string", "pattern": "^t\\d+$" }, "chunk": { "type": "string" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "taskId", "chunk" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_settled" }, "settlement": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "completed" }, "settledAt": { "type": "number" }, "result": {} }, "required": [ "id", "status", "settledAt", "result" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "failed" }, "settledAt": { "type": "number" }, "error": {} }, "required": [ "id", "status", "settledAt", "error" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "stopped" }, "settledAt": { "type": "number" }, "reason": { "type": "string" } }, "required": [ "id", "status", "settledAt", "reason" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "lost" }, "settledAt": { "type": "number" } }, "required": [ "id", "status", "settledAt" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "settlement" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "heartbeat" }, "timestamp": { "type": "number" }, "activeTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } } }, "required": [ "type", "timestamp", "activeTaskIds" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "todos" }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } } }, "required": [ "type", "todos" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "follow_up_queue" }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } } }, "required": [ "type", "followUpQueue" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "state_machine" }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "type", "stateMachine" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "memory" }, "phase": { "type": "string", "enum": [ "observation", "reflection" ] }, "status": { "type": "string", "enum": [ "running", "completed" ] }, "message": { "type": "string" }, "observations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "usageBumpedObservations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "type", "phase", "status", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "usage" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "turnUsage", "usageByModel", "lastMessageUsage", "effectiveContextWindow", "contextWindowUsage" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "level": { "type": "string", "enum": [ "debug", "info", "warn", "error" ] }, "message": { "type": "string" }, "metadata": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "storage_full", "session_cwd_fallback", "bound_agent_root_unavailable", "relay_backlog", "runner_exited", "relay_undeliverable" ] } }, "required": [ "code" ], "additionalProperties": false } }, "required": [ "type", "level", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "router_switch" }, "tier": { "type": "string" }, "route": { "type": "string" }, "fromModel": { "type": "string" }, "toModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] }, "trigger": { "type": "string", "enum": [ "turn_start", "cadence", "advisor", "step_trigger", "compaction" ] }, "rationale": { "type": "string" }, "visionFallback": { "type": "boolean" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "tier", "route", "fromModel", "toModel", "thinkingLevel", "trigger", "rationale", "visionFallback" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "status" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "wakeAt" ], "additionalProperties": false } ] }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "status": { "type": "string", "const": "ask" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "status": { "type": "string", "const": "interrupted" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "status": { "type": "string", "const": "sleep" }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "wakeAt" ], "additionalProperties": false } ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "session_created" }, "prompt": { "type": "string" }, "createdAt": { "type": "string" }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "type", "prompt", "createdAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupt_requested" }, "requestedAt": { "type": "string" } }, "required": [ "type", "requestedAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tier_clamped" }, "requestedTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "effectiveTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] } }, "required": [ "type", "requestedTier", "effectiveTier" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "agent_message" }, "message": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" } }, "required": [ "type", "message", "createdAt" ], "additionalProperties": false }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt_submitted" }, "prompt": { "type": "string" }, "inputKind": { "type": "string", "enum": [ "initial", "message" ] }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "prompt", "inputKind", "behavior", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "note_submitted" }, "note": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "note", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer_submitted" }, "answer": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "answer", "sender" ], "additionalProperties": false } ] } ] }, { "type": "object", "properties": { "type": { "type": "string" } }, "required": [ "type" ], "additionalProperties": {} } ] } }, "required": [ "event" ], "additionalProperties": false }- Delivery
- Server-sent event stream
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /images /{storageId}Read an image referenced by a session event.
- Scope
ws:{workspaceSlug}:sessions- Request
- No JSON request body
- Response
- Raw byte stream
- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /messagesSend a user message to a session
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "prompt": { "type": "string", "minLength": 1 }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] } }, "required": [ "data", "mimeType" ] } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ] } }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "behavior": { "default": "steer", "type": "string", "enum": [ "steer", "follow_up" ] }, "sourceSessionId": { "type": "string", "minLength": 1 } }, "required": [ "prompt" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "ok": { "type": "boolean", "const": true }, "delivery": { "type": "string", "enum": [ "accepted", "queued" ] } }, "required": [ "ok", "delivery" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /messages /waitSend a user message and wait for the submitted turn to finish
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "prompt": { "type": "string", "minLength": 1 }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] } }, "required": [ "data", "mimeType" ] } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ] } }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "behavior": { "default": "steer", "type": "string", "enum": [ "steer", "follow_up" ] }, "sourceSessionId": { "type": "string", "minLength": 1 } }, "required": [ "prompt", "clientRequestId" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1 }, "inputSeq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "cwd": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" }, "terminal": { "type": "object", "properties": { "seq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "event": { "anyOf": [ { "anyOf": [ { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "step" }, "step": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call_start" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "required": [ "type", "toolName", "toolCallId" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "isError": { "type": "boolean" }, "output": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "image" }, "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "data", "mimeType" ], "additionalProperties": false } ] } }, "details": {} }, "required": [ "type", "toolName", "toolCallId", "isError" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "message": { "type": "string" } }, "required": [ "type", "message" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "step" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_started" }, "task": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "task" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_output" }, "taskId": { "type": "string", "pattern": "^t\\d+$" }, "chunk": { "type": "string" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "taskId", "chunk" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_settled" }, "settlement": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "completed" }, "settledAt": { "type": "number" }, "result": {} }, "required": [ "id", "status", "settledAt", "result" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "failed" }, "settledAt": { "type": "number" }, "error": {} }, "required": [ "id", "status", "settledAt", "error" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "stopped" }, "settledAt": { "type": "number" }, "reason": { "type": "string" } }, "required": [ "id", "status", "settledAt", "reason" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "lost" }, "settledAt": { "type": "number" } }, "required": [ "id", "status", "settledAt" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "settlement" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "heartbeat" }, "timestamp": { "type": "number" }, "activeTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } } }, "required": [ "type", "timestamp", "activeTaskIds" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "todos" }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } } }, "required": [ "type", "todos" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "follow_up_queue" }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } } }, "required": [ "type", "followUpQueue" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "state_machine" }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "type", "stateMachine" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "memory" }, "phase": { "type": "string", "enum": [ "observation", "reflection" ] }, "status": { "type": "string", "enum": [ "running", "completed" ] }, "message": { "type": "string" }, "observations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "usageBumpedObservations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "type", "phase", "status", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "usage" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "turnUsage", "usageByModel", "lastMessageUsage", "effectiveContextWindow", "contextWindowUsage" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "level": { "type": "string", "enum": [ "debug", "info", "warn", "error" ] }, "message": { "type": "string" }, "metadata": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "storage_full", "session_cwd_fallback", "bound_agent_root_unavailable", "relay_backlog", "runner_exited", "relay_undeliverable" ] } }, "required": [ "code" ], "additionalProperties": false } }, "required": [ "type", "level", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "router_switch" }, "tier": { "type": "string" }, "route": { "type": "string" }, "fromModel": { "type": "string" }, "toModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] }, "trigger": { "type": "string", "enum": [ "turn_start", "cadence", "advisor", "step_trigger", "compaction" ] }, "rationale": { "type": "string" }, "visionFallback": { "type": "boolean" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "tier", "route", "fromModel", "toModel", "thinkingLevel", "trigger", "rationale", "visionFallback" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "status" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "wakeAt" ], "additionalProperties": false } ] }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "status": { "type": "string", "const": "ask" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "status": { "type": "string", "const": "interrupted" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "status": { "type": "string", "const": "sleep" }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "wakeAt" ], "additionalProperties": false } ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "session_created" }, "prompt": { "type": "string" }, "createdAt": { "type": "string" }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "type", "prompt", "createdAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupt_requested" }, "requestedAt": { "type": "string" } }, "required": [ "type", "requestedAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tier_clamped" }, "requestedTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "effectiveTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] } }, "required": [ "type", "requestedTier", "effectiveTier" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "agent_message" }, "message": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" } }, "required": [ "type", "message", "createdAt" ], "additionalProperties": false }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt_submitted" }, "prompt": { "type": "string" }, "inputKind": { "type": "string", "enum": [ "initial", "message" ] }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "prompt", "inputKind", "behavior", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "note_submitted" }, "note": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "note", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer_submitted" }, "answer": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "answer", "sender" ], "additionalProperties": false } ] } ] }, { "type": "object", "properties": { "type": { "type": "string" } }, "required": [ "type" ], "additionalProperties": {} } ] }, "createdAt": { "type": "number" } }, "required": [ "seq", "event", "createdAt" ], "additionalProperties": false } }, "required": [ "sessionId", "inputSeq", "terminal" ], "additionalProperties": false }, { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1 }, "inputSeq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "pending" } }, "required": [ "sessionId", "inputSeq", "status" ], "additionalProperties": false } ] }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /cwdMove a session to another working directory
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "cwd": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" } }, "required": [ "cwd" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "session": { "type": "object", "properties": { "id": { "type": "string" }, "cwd": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" } }, "required": [ "id", "cwd" ], "additionalProperties": false } }, "required": [ "session" ], "additionalProperties": false }- Errors
Error body JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "error": { "type": "string", "const": "invalid_cwd" }, "reason": { "type": "string", "enum": [ "missing", "not_a_directory", "outside_drive", "outside_agent_anchor" ] } }, "required": [ "error", "reason" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /noteAdd context to a session without starting a turn
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "note": { "type": "string", "minLength": 1, "maxLength": 16384 }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] } }, "required": [ "data", "mimeType" ] } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ] } }, "sourceSessionId": { "type": "string", "minLength": 1 } }, "required": [ "note" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "seq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 } }, "required": [ "seq" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /answerAnswer a session waiting for user input
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "answer": { "type": "string", "minLength": 1 }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] } }, "required": [ "data", "mimeType" ] } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ] } }, "sourceSessionId": { "type": "string", "minLength": 1 } }, "required": [ "answer" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "ok": { "type": "boolean", "const": true }, "delivery": { "type": "string", "enum": [ "accepted", "queued" ] } }, "required": [ "ok", "delivery" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /answer /waitAnswer a session and wait for the submitted turn to finish
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "answer": { "type": "string", "minLength": 1 }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] } }, "required": [ "data", "mimeType" ] } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ] } }, "sourceSessionId": { "type": "string", "minLength": 1 } }, "required": [ "answer", "clientRequestId" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1 }, "inputSeq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "cwd": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" }, "terminal": { "type": "object", "properties": { "seq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "event": { "anyOf": [ { "anyOf": [ { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "step" }, "step": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning_delta" }, "delta": { "type": "string" } }, "required": [ "type", "delta" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "reasoning" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call_start" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "required": [ "type", "toolName", "toolCallId" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "input": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "isError": { "type": "boolean" }, "output": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "image" }, "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "data", "mimeType" ], "additionalProperties": false } ] } }, "details": {} }, "required": [ "type", "toolName", "toolCallId", "isError" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "message": { "type": "string" } }, "required": [ "type", "message" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "step" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_started" }, "task": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "task" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_output" }, "taskId": { "type": "string", "pattern": "^t\\d+$" }, "chunk": { "type": "string" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "taskId", "chunk" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "task_settled" }, "settlement": { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "completed" }, "settledAt": { "type": "number" }, "result": {} }, "required": [ "id", "status", "settledAt", "result" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "failed" }, "settledAt": { "type": "number" }, "error": {} }, "required": [ "id", "status", "settledAt", "error" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "stopped" }, "settledAt": { "type": "number" }, "reason": { "type": "string" } }, "required": [ "id", "status", "settledAt", "reason" ], "additionalProperties": false }, { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "status": { "type": "string", "const": "lost" }, "settledAt": { "type": "number" } }, "required": [ "id", "status", "settledAt" ], "additionalProperties": false } ] }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "settlement" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "heartbeat" }, "timestamp": { "type": "number" }, "activeTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } } }, "required": [ "type", "timestamp", "activeTaskIds" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "todos" }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } } }, "required": [ "type", "todos" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "follow_up_queue" }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } } }, "required": [ "type", "followUpQueue" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "state_machine" }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false } }, "required": [ "type", "stateMachine" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "memory" }, "phase": { "type": "string", "enum": [ "observation", "reflection" ] }, "status": { "type": "string", "enum": [ "running", "completed" ] }, "message": { "type": "string" }, "observations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "usageBumpedObservations": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "type", "phase", "status", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "usage" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "turnUsage", "usageByModel", "lastMessageUsage", "effectiveContextWindow", "contextWindowUsage" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "system" }, "level": { "type": "string", "enum": [ "debug", "info", "warn", "error" ] }, "message": { "type": "string" }, "metadata": { "type": "object", "properties": { "code": { "type": "string", "enum": [ "storage_full", "session_cwd_fallback", "bound_agent_root_unavailable", "relay_backlog", "runner_exited", "relay_undeliverable" ] } }, "required": [ "code" ], "additionalProperties": false } }, "required": [ "type", "level", "message" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "router_switch" }, "tier": { "type": "string" }, "route": { "type": "string" }, "fromModel": { "type": "string" }, "toModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] }, "trigger": { "type": "string", "enum": [ "turn_start", "cadence", "advisor", "step_trigger", "compaction" ] }, "rationale": { "type": "string" }, "visionFallback": { "type": "boolean" }, "origin": { "type": "object", "properties": { "taskId": { "type": "string", "pattern": "^t\\d+$" } }, "required": [ "taskId" ], "additionalProperties": false } }, "required": [ "type", "tier", "route", "fromModel", "toModel", "thinkingLevel", "trigger", "rationale", "visionFallback" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "status" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "state": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting_for_human", "sleeping", "interrupted", "completed", "failed", "cancelled" ] }, "mode": { "anyOf": [ { "type": "string", "const": "agent" }, { "type": "string", "const": "auto" }, { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false } ] }, "options": { "type": "object", "properties": { "model": { "type": "string" }, "memoryModel": { "type": "string" }, "thinkingLevel": { "type": "string", "enum": [ "minimal", "low", "medium", "high", "xhigh" ] } }, "additionalProperties": false }, "agent": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "running", "waiting", "completed", "failed", "cancelled" ] }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" } }, "required": [ "role" ], "additionalProperties": {} } } }, "required": [ "status", "messages" ], "additionalProperties": false }, "stateMachine": { "type": "object", "properties": { "definition": { "type": "object", "properties": { "name": { "type": "string" }, "prompt": { "type": "string" }, "states": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "name", "prompt", "states" ], "additionalProperties": false }, "prompt": { "type": "string" }, "currentState": { "type": "string" }, "currentInput": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "progress": { "type": "object", "properties": { "states": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } } }, "required": [ "states" ], "additionalProperties": {} }, "history": { "type": "array", "items": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "terminal": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "terminalAcknowledged": { "type": "boolean" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" } }, "required": [ "definition", "prompt", "history", "createdAt", "updatedAt" ], "additionalProperties": false }, "todos": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "failed" ] } }, "required": [ "id", "content", "status" ], "additionalProperties": false } }, "followUpQueue": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "message" ], "additionalProperties": false } }, "queuedCommands": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt" }, "message": { "type": "string" }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "message", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "message": { "type": "string" }, "images": { "type": "array", "items": { "type": "object", "properties": { "data": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "data", "mimeType" ], "additionalProperties": false } } }, "required": [ "type", "questions", "answers", "behavior" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "wake" } }, "required": [ "type" ], "additionalProperties": false } ] } }, "tasks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "pattern": "^t\\d+$" }, "kind": { "type": "string", "enum": [ "tool", "subagent", "scheduled" ] }, "name": { "type": "string" }, "label": { "type": "string" }, "ownerScopeId": { "anyOf": [ { "type": "string", "pattern": "^turn-\\d+$" }, { "type": "string", "pattern": "^task:t\\d+$" } ] }, "status": { "type": "string", "enum": [ "running", "scheduled", "completed", "failed", "stopped", "lost" ] }, "startedAt": { "type": "number" }, "wakeAt": { "type": "number" } }, "required": [ "id", "kind", "name", "label", "ownerScopeId", "status", "startedAt" ], "additionalProperties": false } }, "taskOutputTails": { "type": "object", "propertyNames": { "type": "string", "pattern": "^t\\d+$" }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "pendingLostTaskReminderTaskIds": { "type": "array", "items": { "type": "string", "pattern": "^t\\d+$" } }, "nextTaskId": { "type": "number" }, "wireGuardHorizon": { "type": "object", "properties": { "evictionHorizon": { "type": "number" } }, "required": [ "evictionHorizon" ], "additionalProperties": false } }, "required": [ "status", "mode", "agent" ], "additionalProperties": false }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "state", "wakeAt" ], "additionalProperties": false } ] }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "turn_started" } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "complete" }, "status": { "type": "string", "enum": [ "completed", "failed", "cancelled" ] }, "result": { "type": "string" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "ask" }, "status": { "type": "string", "const": "ask" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "question": { "type": "string" }, "header": { "type": "string" }, "options": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": "string" }, "description": { "type": "string" } }, "required": [ "label" ], "additionalProperties": false } }, "multiSelect": { "type": "boolean" } }, "required": [ "question", "options" ], "additionalProperties": false } }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "questions" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupted" }, "status": { "type": "string", "const": "interrupted" }, "error": { "type": "string" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "sleep" }, "status": { "type": "string", "const": "sleep" }, "wakeAt": { "type": "number" }, "turnUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "usageByModel": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "transport": { "type": "object", "properties": { "provider": { "anyOf": [ { "type": "string", "enum": [ "duet-gateway", "vercel-ai-gateway", "openrouter" ] }, { "type": "string", "enum": [ "openai-codex", "github-copilot" ] } ] }, "billing": { "type": "string", "enum": [ "plan-covered", "metered" ] } }, "required": [ "provider", "billing" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false } }, "required": [ "model", "transport", "usage" ], "additionalProperties": false } }, "lastMessageUsage": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "cacheWrite1h": { "type": "number" }, "totalTokens": { "type": "number" }, "cost": { "type": "object", "properties": { "input": { "type": "number" }, "output": { "type": "number" }, "cacheRead": { "type": "number" }, "cacheWrite": { "type": "number" }, "total": { "type": "number" } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "total" ], "additionalProperties": false } }, "required": [ "input", "output", "cacheRead", "cacheWrite", "totalTokens", "cost" ], "additionalProperties": false }, "effectiveContextWindow": { "type": "number" }, "contextWindowUsage": { "type": "object", "properties": { "systemPrompt": { "type": "number" }, "messages": { "type": "number" }, "localMemory": { "type": "number" }, "globalMemory": { "type": "number" } }, "required": [ "systemPrompt", "messages", "localMemory", "globalMemory" ], "additionalProperties": false } }, "required": [ "type", "wakeAt" ], "additionalProperties": false } ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "session_created" }, "prompt": { "type": "string" }, "createdAt": { "type": "string" }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "type", "prompt", "createdAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "interrupt_requested" }, "requestedAt": { "type": "string" } }, "required": [ "type", "requestedAt" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "tier_clamped" }, "requestedTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] }, "effectiveTier": { "type": "string", "enum": [ "frontier", "balanced", "economy" ] } }, "required": [ "type", "requestedTier", "effectiveTier" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "agent_message" }, "message": { "type": "string", "minLength": 1 }, "createdAt": { "type": "string" } }, "required": [ "type", "message", "createdAt" ], "additionalProperties": false }, { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "prompt_submitted" }, "prompt": { "type": "string" }, "inputKind": { "type": "string", "enum": [ "initial", "message" ] }, "behavior": { "type": "string", "enum": [ "steer", "follow_up" ] }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "prompt", "inputKind", "behavior", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "note_submitted" }, "note": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "note", "sender" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "answer_submitted" }, "answer": { "type": "string" }, "sender": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "user" }, "userId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "userId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "app" }, "appId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "appId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "session" }, "sessionId": { "type": "string", "minLength": 1 } }, "required": [ "kind", "sessionId" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "system" } }, "required": [ "kind" ], "additionalProperties": false } ] }, "clientRequestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "images": { "maxItems": 4, "type": "array", "items": { "type": "object", "properties": { "storageId": { "type": "string", "minLength": 1 }, "mimeType": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp", "image/gif" ] }, "bytes": { "type": "integer", "minimum": 0, "maximum": 5242880 } }, "required": [ "storageId", "mimeType", "bytes" ], "additionalProperties": false } }, "attachments": { "maxItems": 10, "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "minLength": 1 } }, "required": [ "path", "name", "bytes" ], "additionalProperties": false } } }, "required": [ "type", "answer", "sender" ], "additionalProperties": false } ] } ] }, { "type": "object", "properties": { "type": { "type": "string" } }, "required": [ "type" ], "additionalProperties": {} } ] }, "createdAt": { "type": "number" } }, "required": [ "seq", "event", "createdAt" ], "additionalProperties": false } }, "required": [ "sessionId", "inputSeq", "terminal" ], "additionalProperties": false }, { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1 }, "inputSeq": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "pending" } }, "required": [ "sessionId", "inputSeq", "status" ], "additionalProperties": false } ] }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /interruptInterrupt a running session
- Scope
ws:{workspaceSlug}:sessions- Request
- No request body
- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "ok": { "type": "boolean", "const": true } }, "required": [ "ok" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId}Permanently replace the generated session title
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "title": { "type": "string", "minLength": 1, "maxLength": 120 } }, "required": [ "title" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "turnStatus": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "title": { "type": "string" }, "titleOrigin": { "type": "string", "enum": [ "excerpt", "auto", "manual" ] }, "titleStatus": { "type": "string", "enum": [ "generating", "complete", "failed" ] }, "archivedAt": { "type": "number" }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "machine": { "type": "object", "properties": { "definitionName": { "type": "string" }, "currentState": { "type": "string" }, "followingDefinitionState": { "type": "string" }, "progress": { "type": "object", "properties": { "completed": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "total": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "completed", "total" ], "additionalProperties": false }, "orderedPath": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "index": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "name": { "type": "string" }, "kind": { "type": "string" }, "phase": { "type": "string", "enum": [ "past", "current", "future", "outcome" ] }, "terminalStatus": { "type": "string", "enum": [ "completed", "failed", "cancelled", "error" ] } }, "required": [ "key", "index", "name", "phase" ], "additionalProperties": false } }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "orderedPath", "activity" ], "additionalProperties": false }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" } }, "required": [ "id", "userId", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /archiveArchive or restore a session
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "archived": { "type": "boolean" } }, "required": [ "archived" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "turnStatus": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "title": { "type": "string" }, "titleOrigin": { "type": "string", "enum": [ "excerpt", "auto", "manual" ] }, "titleStatus": { "type": "string", "enum": [ "generating", "complete", "failed" ] }, "archivedAt": { "type": "number" }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "machine": { "type": "object", "properties": { "definitionName": { "type": "string" }, "currentState": { "type": "string" }, "followingDefinitionState": { "type": "string" }, "progress": { "type": "object", "properties": { "completed": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "total": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "completed", "total" ], "additionalProperties": false }, "orderedPath": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "index": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "name": { "type": "string" }, "kind": { "type": "string" }, "phase": { "type": "string", "enum": [ "past", "current", "future", "outcome" ] }, "terminalStatus": { "type": "string", "enum": [ "completed", "failed", "cancelled", "error" ] } }, "required": [ "key", "index", "name", "phase" ], "additionalProperties": false } }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "orderedPath", "activity" ], "additionalProperties": false }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" } }, "required": [ "id", "userId", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /activityEvery agent’s prioritized recent sessions in one request
- Scope
ws:{workspaceSlug}:sessions- Request
- No JSON request body
- Query
Query parameters JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "limitPerAgent": { "default": 24, "type": "integer", "minimum": 1, "maximum": 100 } } }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "owners": { "type": "array", "items": { "type": "object", "properties": { "agentId": { "type": "string" }, "sessions": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "turnStatus": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "title": { "type": "string" }, "titleOrigin": { "type": "string", "enum": [ "excerpt", "auto", "manual" ] }, "titleStatus": { "type": "string", "enum": [ "generating", "complete", "failed" ] }, "archivedAt": { "type": "number" }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "machine": { "type": "object", "properties": { "definitionName": { "type": "string" }, "currentState": { "type": "string" }, "followingDefinitionState": { "type": "string" }, "progress": { "type": "object", "properties": { "completed": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "total": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "completed", "total" ], "additionalProperties": false }, "orderedPath": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "index": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "name": { "type": "string" }, "kind": { "type": "string" }, "phase": { "type": "string", "enum": [ "past", "current", "future", "outcome" ] }, "terminalStatus": { "type": "string", "enum": [ "completed", "failed", "cancelled", "error" ] } }, "required": [ "key", "index", "name", "phase" ], "additionalProperties": false } }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "orderedPath", "activity" ], "additionalProperties": false }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" } }, "required": [ "id", "userId", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread" ], "additionalProperties": false } }, "truncated": { "type": "boolean" }, "chat": { "type": "object", "properties": { "id": { "type": "string" }, "userId": { "type": "string" }, "turnStatus": { "type": "string", "enum": [ "running", "complete", "ask", "interrupted", "sleep" ] }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "title": { "type": "string" }, "titleOrigin": { "type": "string", "enum": [ "excerpt", "auto", "manual" ] }, "titleStatus": { "type": "string", "enum": [ "generating", "complete", "failed" ] }, "archivedAt": { "type": "number" }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "machine": { "type": "object", "properties": { "definitionName": { "type": "string" }, "currentState": { "type": "string" }, "followingDefinitionState": { "type": "string" }, "progress": { "type": "object", "properties": { "completed": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "total": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "completed", "total" ], "additionalProperties": false }, "orderedPath": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "index": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "name": { "type": "string" }, "kind": { "type": "string" }, "phase": { "type": "string", "enum": [ "past", "current", "future", "outcome" ] }, "terminalStatus": { "type": "string", "enum": [ "completed", "failed", "cancelled", "error" ] } }, "required": [ "key", "index", "name", "phase" ], "additionalProperties": false } }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "orderedPath", "activity" ], "additionalProperties": false }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" } }, "required": [ "id", "userId", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread" ], "additionalProperties": false } }, "required": [ "agentId", "sessions", "truncated" ], "additionalProperties": false } } }, "required": [ "owners" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /readMark a session read up to an event sequence number
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "seq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "seq" ] }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "lastReadSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "lastReadSeq" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId}Stop and permanently delete a session
- Scope
ws:{workspaceSlug}:sessions- Request
- No JSON request body
- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "deleted": { "type": "boolean", "const": true } }, "required": [ "deleted" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Declared idempotent