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. List rows
arrive in { items, nextCursor }; authorization, search, and personal state can make a page short
or empty, so only a null cursor means the walk is complete.
Use ?topLevel=true on that collection to page only roots. To walk lineage, request
GET /agent/sessions/{parentSessionId}/sessions; it returns exactly that readable parent's direct
children in the same summary envelope. A grandchild appears only when its own parent is queried.
Children may belong to another agent, have no agent, or carry a machine—the relationship is the
parent ID, not inherited agent scope. Each parent and each bucket/archive choice has an independent
opaque cursor; never reuse a cursor from the root list or another parent.
Parent readability is only the entry check. The server still evaluates every child through the
caller's current discovery lanes, so a specific-audience child can be omitted and a personal
archive can differ between readers. Archiving a parent does not archive its children: use the
child collection's archived=only mode to page archived children independently. As with all session
pages, a short or empty page may still have a continuation; stop only at nextCursor: null.
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, selects an automatic router (frontier or balanced) or a stable provider
alias (openai-frontier, openai-max, anthropic-frontier, or anthropic-max). Provider aliases
follow model upgrades on subsequent turns without changing the saved choice. An unavailable model
fails through the ordinary session error path; it does not switch to another model.
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 uses the universal page envelope { items, nextCursor }, with at most 100 timeline rows per
page. Omit order for newest-first reading, or use order=asc for replay. afterSeq is accepted only
with ascending order and starts strictly after that durable sequence. Continuations are opaque:
pass nextCursor back unchanged, continue through short or empty pages, and stop only when it is
null. A page may be shorter than its requested limit when the next event would cross the bounded
database-read or serialized-response budget; its cursor still resumes at that first unconsumed
event. A chronological UI reverses each newest-first wire page before merging it into its local
timeline. The event stream resumes independently from the last committed sequence, 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.
File attachments use the workspace drive rather than the inline image body: mint a grant and send the bytes to the VM, then name the resulting drive path on the message. See Files.
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?order=asc&afterSeq=<seq> accepts to begin strictly later, so the sequence a model sees in
its message envelope is a ready-made replay boundary.
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 the agent runner 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.
Treat audience and archive as response-driven state
Choosing Specific people changes which humans participate in a session and who receives its noise. It is not an isolation boundary for agents, memory, installed apps, workspace VM processes, or workspace owners. Those resources remain in the workspace trust domain; use the response's audience and permission fields instead of inferring authority from a role, submitting actor, or audience kind.
Discover audience IDs through the existing paginated workspace member directory. That collection
accepts either sessions or files:read, so a sessions-only app or workspace process can select
people without requesting unrelated file access. Use each returned member's id in creation's
memberUserIds or an audience update's add and remove arrays; continue through nextCursor
exactly like every other collection.
Archive is two independent desired states. A person may archive a session only for themselves, while
an authorized editor or owner may archive it for everyone. The response preserves both timestamps;
the workspace-wide cause dominates effective visibility without erasing the personal cause beneath
it. Restoring the dominant cause can therefore reveal the preserved cause rather than making the
session active. Clients should render actions from permissions.personalArchive,
permissions.globalArchive, and permissions.delete, send the desired cause, then commit the
returned summary. They must not manufacture timestamps or recompute the effective reason locally.
Archiving never moves the default alias and never cascades to child sessions. Permanent deletion includes the selected session and every descendant. It may clear a default alias only when that alias still points at a deleted session; the server makes that comparison and the client never chooses a replacement.
An empty 204 means the selected root is already sealed from public reads and its recursive deletion
work is durable; descendant sealing, runner disposal, and physical cleanup continue asynchronously.
Successful, missing, hidden, and retried deletion all return that same empty response, so retrying
after a lost response is safe. An unavailable runner delays hidden physical cleanup instead of
restoring visibility or turning the accepted request into 502. Connected-provider cleanup is best
effort and never retains Duet session data once runner disposal succeeds. A caller that can still see
the session but lacks lifecycle authority receives 403 and should refresh detail to learn the
current response-driven permissions.
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
30 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": 50, "type": "integer", "minimum": 1, "maximum": 100 }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "archived": { "default": "exclude", "type": "string", "enum": [ "exclude", "only" ] }, "search": { "type": "string", "maxLength": 200 }, "agentId": { "type": "string", "minLength": 1 }, "excludeDefault": { "anyOf": [ { "type": "boolean", "const": true }, { "type": "string", "const": "true" } ] }, "topLevel": { "anyOf": [ { "type": "boolean", "const": true }, { "type": "string", "const": "true" } ] } }, "additionalProperties": false }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "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" ] }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" }, "audience": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "workspace" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "preview": { "maxItems": 5, "type": "array", "items": { "type": "object", "properties": { "memberId": { "type": "string" }, "userId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "role": { "type": "string", "enum": [ "owner", "editor", "viewer" ] } }, "required": [ "memberId", "userId", "name", "email", "role" ], "additionalProperties": false } } }, "required": [ "kind", "count", "preview" ], "additionalProperties": false } ] }, "archive": { "type": "object", "properties": { "globalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "personalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "reason": { "anyOf": [ { "type": "string", "enum": [ "global", "personal" ] }, { "type": "null" } ] } }, "required": [ "globalArchivedAt", "personalArchivedAt", "reason" ], "additionalProperties": false }, "permissions": { "type": "object", "properties": { "send": { "type": "boolean" }, "answer": { "type": "boolean" }, "interrupt": { "type": "boolean" }, "rename": { "type": "boolean" }, "manageAudience": { "type": "boolean" }, "personalArchive": { "type": "boolean" }, "globalArchive": { "type": "boolean" }, "delete": { "type": "boolean" } }, "required": [ "send", "answer", "interrupt", "rename", "manageAudience", "personalArchive", "globalArchive", "delete" ], "additionalProperties": false }, "machine": { "type": "object", "properties": { "step": { "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 }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "activity" ], "additionalProperties": false } }, "required": [ "id", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "audience", "archive", "permissions" ], "additionalProperties": false } }, "nextCursor": { "anyOf": [ { "type": "string", "minLength": 1 }, { "type": "null" } ] } }, "required": [ "items", "nextCursor" ], "additionalProperties": false }- Errors
Opaque collection cursor is malformed or bound to another walk (400)
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "error": { "type": "string", "const": "invalid_cursor" } }, "required": [ "error" ], "additionalProperties": false, "description": "Opaque collection cursor is malformed or bound to another walk (400)" }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /skillsList the skills available to a session working in a workspace folder
- 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": 50, "type": "integer", "minimum": 1, "maximum": 100 }, "cwd": { "type": "string" } }, "additionalProperties": false }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "description": { "type": "string" }, "path": { "type": "string", "minLength": 1 }, "scope": { "type": "string", "enum": [ "user", "project", "temporary", "builtin" ] } }, "required": [ "name", "path" ], "additionalProperties": false } }, "nextCursor": { "anyOf": [ { "type": "string", "minLength": 1 }, { "type": "null" } ] } }, "required": [ "items", "nextCursor" ], "additionalProperties": false }- Errors
Opaque collection cursor is malformed or bound to another walk (400)
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "error": { "type": "string", "const": "invalid_cursor" } }, "required": [ "error" ], "additionalProperties": false, "description": "Opaque collection cursor is malformed or bound to another walk (400)" }- 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", "description": "The words of the input. May be empty when it carries images or attachments." }, "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", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "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" ] }, "audience": { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "memberUserIds": { "maxItems": 100, "type": "array", "items": { "type": "string" } } }, "required": [ "kind", "memberUserIds" ], "additionalProperties": false } }, "required": [ "prompt" ], "additionalProperties": false }- 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" }, "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" ] }, "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" }, "audience": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "workspace" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "preview": { "maxItems": 5, "type": "array", "items": { "type": "object", "properties": { "memberId": { "type": "string" }, "userId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "role": { "type": "string", "enum": [ "owner", "editor", "viewer" ] } }, "required": [ "memberId", "userId", "name", "email", "role" ], "additionalProperties": false } } }, "required": [ "kind", "count", "preview" ], "additionalProperties": false } ] }, "archive": { "type": "object", "properties": { "globalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "personalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "reason": { "anyOf": [ { "type": "string", "enum": [ "global", "personal" ] }, { "type": "null" } ] } }, "required": [ "globalArchivedAt", "personalArchivedAt", "reason" ], "additionalProperties": false }, "permissions": { "type": "object", "properties": { "send": { "type": "boolean" }, "answer": { "type": "boolean" }, "interrupt": { "type": "boolean" }, "rename": { "type": "boolean" }, "manageAudience": { "type": "boolean" }, "personalArchive": { "type": "boolean" }, "globalArchive": { "type": "boolean" }, "delete": { "type": "boolean" } }, "required": [ "send", "answer", "interrupt", "rename", "manageAudience", "personalArchive", "globalArchive", "delete" ], "additionalProperties": false }, "workspaceId": { "type": "string" }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "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", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "audience", "archive", "permissions", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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", "interrupt_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" }, "probabilities": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "number" } }, "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", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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": "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": [ "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 /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", "description": "The words of the input. May be empty when it carries images or attachments." }, "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", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "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" ] }, "audience": { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "memberUserIds": { "maxItems": 100, "type": "array", "items": { "type": "string" } } }, "required": [ "kind", "memberUserIds" ], "additionalProperties": false } }, "required": [ "prompt", "clientRequestId" ], "additionalProperties": false }- 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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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", "interrupt_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" }, "probabilities": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "number" } }, "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", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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": "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", "description": "The words of the input. May be empty when it carries images or attachments." }, "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", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "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" ], "additionalProperties": false }- 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" }, "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" ] }, "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" }, "audience": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "workspace" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "preview": { "maxItems": 5, "type": "array", "items": { "type": "object", "properties": { "memberId": { "type": "string" }, "userId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "role": { "type": "string", "enum": [ "owner", "editor", "viewer" ] } }, "required": [ "memberId", "userId", "name", "email", "role" ], "additionalProperties": false } } }, "required": [ "kind", "count", "preview" ], "additionalProperties": false } ] }, "archive": { "type": "object", "properties": { "globalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "personalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "reason": { "anyOf": [ { "type": "string", "enum": [ "global", "personal" ] }, { "type": "null" } ] } }, "required": [ "globalArchivedAt", "personalArchivedAt", "reason" ], "additionalProperties": false }, "permissions": { "type": "object", "properties": { "send": { "type": "boolean" }, "answer": { "type": "boolean" }, "interrupt": { "type": "boolean" }, "rename": { "type": "boolean" }, "manageAudience": { "type": "boolean" }, "personalArchive": { "type": "boolean" }, "globalArchive": { "type": "boolean" }, "delete": { "type": "boolean" } }, "required": [ "send", "answer", "interrupt", "rename", "manageAudience", "personalArchive", "globalArchive", "delete" ], "additionalProperties": false }, "workspaceId": { "type": "string" }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "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", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "audience", "archive", "permissions", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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", "interrupt_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" }, "probabilities": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "number" } }, "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", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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": "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": [ "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", "description": "The words of the input. May be empty when it carries images or attachments." }, "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", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "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" ], "additionalProperties": false }- 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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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", "interrupt_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" }, "probabilities": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "number" } }, "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", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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": "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} /sessionsPage one session’s direct children
- 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": 50, "type": "integer", "minimum": 1, "maximum": 100 }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "archived": { "default": "exclude", "type": "string", "enum": [ "exclude", "only" ] } }, "additionalProperties": false }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "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" ] }, "cwd": { "type": "string" }, "agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "onboarding": { "type": "boolean" }, "createdBySessionId": { "type": "string" }, "createdAt": { "type": "number" }, "updatedAt": { "type": "number" }, "lastEventSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "unread": { "type": "boolean" }, "audience": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "workspace" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "preview": { "maxItems": 5, "type": "array", "items": { "type": "object", "properties": { "memberId": { "type": "string" }, "userId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "role": { "type": "string", "enum": [ "owner", "editor", "viewer" ] } }, "required": [ "memberId", "userId", "name", "email", "role" ], "additionalProperties": false } } }, "required": [ "kind", "count", "preview" ], "additionalProperties": false } ] }, "archive": { "type": "object", "properties": { "globalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "personalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "reason": { "anyOf": [ { "type": "string", "enum": [ "global", "personal" ] }, { "type": "null" } ] } }, "required": [ "globalArchivedAt", "personalArchivedAt", "reason" ], "additionalProperties": false }, "permissions": { "type": "object", "properties": { "send": { "type": "boolean" }, "answer": { "type": "boolean" }, "interrupt": { "type": "boolean" }, "rename": { "type": "boolean" }, "manageAudience": { "type": "boolean" }, "personalArchive": { "type": "boolean" }, "globalArchive": { "type": "boolean" }, "delete": { "type": "boolean" } }, "required": [ "send", "answer", "interrupt", "rename", "manageAudience", "personalArchive", "globalArchive", "delete" ], "additionalProperties": false }, "machine": { "type": "object", "properties": { "step": { "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 }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "activity" ], "additionalProperties": false } }, "required": [ "id", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "audience", "archive", "permissions" ], "additionalProperties": false } }, "nextCursor": { "anyOf": [ { "type": "string", "minLength": 1 }, { "type": "null" } ] } }, "required": [ "items", "nextCursor" ], "additionalProperties": false }- Errors
Opaque collection cursor is malformed or bound to another walk (400)
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "error": { "type": "string", "const": "invalid_cursor" } }, "required": [ "error" ], "additionalProperties": false, "description": "Opaque collection cursor is malformed or bound to another walk (400)" }- 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" }, "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" ] }, "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" }, "audience": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "workspace" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "preview": { "maxItems": 5, "type": "array", "items": { "type": "object", "properties": { "memberId": { "type": "string" }, "userId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "role": { "type": "string", "enum": [ "owner", "editor", "viewer" ] } }, "required": [ "memberId", "userId", "name", "email", "role" ], "additionalProperties": false } } }, "required": [ "kind", "count", "preview" ], "additionalProperties": false } ] }, "archive": { "type": "object", "properties": { "globalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "personalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "reason": { "anyOf": [ { "type": "string", "enum": [ "global", "personal" ] }, { "type": "null" } ] } }, "required": [ "globalArchivedAt", "personalArchivedAt", "reason" ], "additionalProperties": false }, "permissions": { "type": "object", "properties": { "send": { "type": "boolean" }, "answer": { "type": "boolean" }, "interrupt": { "type": "boolean" }, "rename": { "type": "boolean" }, "manageAudience": { "type": "boolean" }, "personalArchive": { "type": "boolean" }, "globalArchive": { "type": "boolean" }, "delete": { "type": "boolean" } }, "required": [ "send", "answer", "interrupt", "rename", "manageAudience", "personalArchive", "globalArchive", "delete" ], "additionalProperties": false }, "workspaceId": { "type": "string" }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "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", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "audience", "archive", "permissions", "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" }, "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" ] }, "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" }, "audience": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "workspace" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "preview": { "maxItems": 5, "type": "array", "items": { "type": "object", "properties": { "memberId": { "type": "string" }, "userId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "role": { "type": "string", "enum": [ "owner", "editor", "viewer" ] } }, "required": [ "memberId", "userId", "name", "email", "role" ], "additionalProperties": false } } }, "required": [ "kind", "count", "preview" ], "additionalProperties": false } ] }, "archive": { "type": "object", "properties": { "globalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "personalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "reason": { "anyOf": [ { "type": "string", "enum": [ "global", "personal" ] }, { "type": "null" } ] } }, "required": [ "globalArchivedAt", "personalArchivedAt", "reason" ], "additionalProperties": false }, "permissions": { "type": "object", "properties": { "send": { "type": "boolean" }, "answer": { "type": "boolean" }, "interrupt": { "type": "boolean" }, "rename": { "type": "boolean" }, "manageAudience": { "type": "boolean" }, "personalArchive": { "type": "boolean" }, "globalArchive": { "type": "boolean" }, "delete": { "type": "boolean" } }, "required": [ "send", "answer", "interrupt", "rename", "manageAudience", "personalArchive", "globalArchive", "delete" ], "additionalProperties": false }, "workspaceId": { "type": "string" }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "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", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "audience", "archive", "permissions", "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" }, "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" ] }, "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" }, "audience": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "workspace" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "preview": { "maxItems": 5, "type": "array", "items": { "type": "object", "properties": { "memberId": { "type": "string" }, "userId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "role": { "type": "string", "enum": [ "owner", "editor", "viewer" ] } }, "required": [ "memberId", "userId", "name", "email", "role" ], "additionalProperties": false } } }, "required": [ "kind", "count", "preview" ], "additionalProperties": false } ] }, "archive": { "type": "object", "properties": { "globalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "personalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "reason": { "anyOf": [ { "type": "string", "enum": [ "global", "personal" ] }, { "type": "null" } ] } }, "required": [ "globalArchivedAt", "personalArchivedAt", "reason" ], "additionalProperties": false }, "permissions": { "type": "object", "properties": { "send": { "type": "boolean" }, "answer": { "type": "boolean" }, "interrupt": { "type": "boolean" }, "rename": { "type": "boolean" }, "manageAudience": { "type": "boolean" }, "personalArchive": { "type": "boolean" }, "globalArchive": { "type": "boolean" }, "delete": { "type": "boolean" } }, "required": [ "send", "answer", "interrupt", "rename", "manageAudience", "personalArchive", "globalArchive", "delete" ], "additionalProperties": false }, "workspaceId": { "type": "string" }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "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", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "audience", "archive", "permissions", "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": "string", "minLength": 1 }, "limit": { "default": 50, "type": "integer", "minimum": 1, "maximum": 100 }, "order": { "default": "desc", "type": "string", "enum": [ "asc", "desc" ] }, "view": { "default": "all", "type": "string", "enum": [ "all", "transcript" ] }, "afterSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "additionalProperties": false }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "items": { "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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", "interrupt_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" }, "probabilities": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "number" } }, "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", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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": "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": { "anyOf": [ { "type": "string", "minLength": 1 }, { "type": "null" } ] } }, "required": [ "items", "nextCursor" ], "additionalProperties": false }- Errors
Error body JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "anyOf": [ { "type": "object", "properties": { "error": { "type": "string", "const": "no_default_session" } }, "required": [ "error" ], "additionalProperties": false, "description": "The selected owner has no default session (404)" }, { "type": "object", "properties": { "error": { "type": "string", "const": "not_found" } }, "required": [ "error" ], "additionalProperties": false, "description": "The session is unavailable to this caller (404)" } ] }, { "type": "object", "properties": { "error": { "type": "string", "const": "invalid_cursor" } }, "required": [ "error" ], "additionalProperties": false, "description": "Opaque collection cursor is malformed or bound to another walk (400)" } ] }- 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", "description": "The words of the input. May be empty when it carries images or attachments." }, "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", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "behavior": { "default": "steer", "type": "string", "enum": [ "steer", "follow_up" ] }, "sourceSessionId": { "type": "string", "minLength": 1 }, "agentFirstMessage": { "type": "string", "maxLength": 2000 } }, "required": [ "prompt" ], "additionalProperties": false }- 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" }, "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" ] }, "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" }, "audience": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "workspace" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "preview": { "maxItems": 5, "type": "array", "items": { "type": "object", "properties": { "memberId": { "type": "string" }, "userId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "role": { "type": "string", "enum": [ "owner", "editor", "viewer" ] } }, "required": [ "memberId", "userId", "name", "email", "role" ], "additionalProperties": false } } }, "required": [ "kind", "count", "preview" ], "additionalProperties": false } ] }, "archive": { "type": "object", "properties": { "globalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "personalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "reason": { "anyOf": [ { "type": "string", "enum": [ "global", "personal" ] }, { "type": "null" } ] } }, "required": [ "globalArchivedAt", "personalArchivedAt", "reason" ], "additionalProperties": false }, "permissions": { "type": "object", "properties": { "send": { "type": "boolean" }, "answer": { "type": "boolean" }, "interrupt": { "type": "boolean" }, "rename": { "type": "boolean" }, "manageAudience": { "type": "boolean" }, "personalArchive": { "type": "boolean" }, "globalArchive": { "type": "boolean" }, "delete": { "type": "boolean" } }, "required": [ "send", "answer", "interrupt", "rename", "manageAudience", "personalArchive", "globalArchive", "delete" ], "additionalProperties": false }, "workspaceId": { "type": "string" }, "tier": { "type": "string", "enum": [ "frontier", "balanced", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "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", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "audience", "archive", "permissions", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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", "interrupt_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" }, "probabilities": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "number" } }, "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", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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": "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": [ "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", "description": "The words of the input. May be empty when it carries images or attachments." }, "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", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "behavior": { "default": "steer", "type": "string", "enum": [ "steer", "follow_up" ] }, "sourceSessionId": { "type": "string", "minLength": 1 }, "agentFirstMessage": { "type": "string", "maxLength": 2000 } }, "required": [ "prompt", "clientRequestId" ], "additionalProperties": false }- 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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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", "interrupt_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" }, "probabilities": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "number" } }, "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", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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": "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} /audiencePage the current members of a specific session audience
- 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": 50, "type": "integer", "minimum": 1, "maximum": 100 } }, "additionalProperties": false }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "memberId": { "type": "string" }, "userId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "role": { "type": "string", "enum": [ "owner", "editor", "viewer" ] } }, "required": [ "memberId", "userId", "name", "email", "role" ], "additionalProperties": false } }, "nextCursor": { "anyOf": [ { "type": "string", "minLength": 1 }, { "type": "null" } ] } }, "required": [ "items", "nextCursor" ], "additionalProperties": false }- Errors
Error body JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "anyOf": [ { "type": "object", "properties": { "error": { "type": "string", "const": "not_found" } }, "required": [ "error" ], "additionalProperties": false, "description": "The session is unavailable to this caller (404)" }, { "type": "object", "properties": { "error": { "type": "string", "const": "audience_kind_immutable" } }, "required": [ "error" ], "additionalProperties": false, "description": "This session does not have a specific-people audience (409)" } ] }, { "type": "object", "properties": { "error": { "type": "string", "const": "invalid_cursor" } }, "required": [ "error" ], "additionalProperties": false, "description": "Opaque collection cursor is malformed or bound to another walk (400)" } ] }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /audienceAtomically update a specific session audience; self-removal returns no body when access is lost
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "add": { "maxItems": 100, "type": "array", "items": { "type": "string" } }, "remove": { "maxItems": 100, "type": "array", "items": { "type": "string" } } }, "additionalProperties": false }- Response
200200 response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": { "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" ] }, "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" }, "audience": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "workspace" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "preview": { "maxItems": 5, "type": "array", "items": { "type": "object", "properties": { "memberId": { "type": "string" }, "userId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "role": { "type": "string", "enum": [ "owner", "editor", "viewer" ] } }, "required": [ "memberId", "userId", "name", "email", "role" ], "additionalProperties": false } } }, "required": [ "kind", "count", "preview" ], "additionalProperties": false } ] }, "archive": { "type": "object", "properties": { "globalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "personalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "reason": { "anyOf": [ { "type": "string", "enum": [ "global", "personal" ] }, { "type": "null" } ] } }, "required": [ "globalArchivedAt", "personalArchivedAt", "reason" ], "additionalProperties": false }, "permissions": { "type": "object", "properties": { "send": { "type": "boolean" }, "answer": { "type": "boolean" }, "interrupt": { "type": "boolean" }, "rename": { "type": "boolean" }, "manageAudience": { "type": "boolean" }, "personalArchive": { "type": "boolean" }, "globalArchive": { "type": "boolean" }, "delete": { "type": "boolean" } }, "required": [ "send", "answer", "interrupt", "rename", "manageAudience", "personalArchive", "globalArchive", "delete" ], "additionalProperties": false } }, "required": [ "id", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "audience", "archive", "permissions" ], "additionalProperties": false }204No structured response body
- 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": "string", "minLength": 1 }, "limit": { "default": 50, "type": "integer", "minimum": 1, "maximum": 100 }, "order": { "default": "desc", "type": "string", "enum": [ "asc", "desc" ] }, "view": { "default": "all", "type": "string", "enum": [ "all", "transcript" ] }, "afterSeq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "additionalProperties": false }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "items": { "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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", "interrupt_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" }, "probabilities": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "number" } }, "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", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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": "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": { "anyOf": [ { "type": "string", "minLength": 1 }, { "type": "null" } ] } }, "required": [ "items", "nextCursor" ], "additionalProperties": false }- Errors
Error body JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "type": "object", "properties": { "error": { "type": "string", "const": "not_found" } }, "required": [ "error" ], "additionalProperties": false, "description": "The session is unavailable to this caller (404)" }, { "type": "object", "properties": { "error": { "type": "string", "const": "invalid_cursor" } }, "required": [ "error" ], "additionalProperties": false, "description": "Opaque collection cursor is malformed or bound to another walk (400)" } ] }- 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": {}, "additionalProperties": false }- 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 }, "createdAt": { "type": "number" }, "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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", "interrupt_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" }, "probabilities": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "number" } }, "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", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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": "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", "description": "The words of the input. May be empty when it carries images or attachments." }, "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", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "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", "description": "The words of the input. May be empty when it carries images or attachments." }, "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", "openai-frontier", "openai-max", "anthropic-frontier", "anthropic-max" ] }, "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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", "interrupt_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" }, "probabilities": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "number" } }, "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", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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": "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", "maxLength": 16384, "description": "The words of the input. May be empty when it carries images or attachments." }, "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", "description": "The words of the input. May be empty when it carries images or attachments." }, "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", "description": "The words of the input. May be empty when it carries images or attachments." }, "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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", "interrupt_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" }, "probabilities": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "number" } }, "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", "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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 }, "pendingStateTransition": { "type": "object", "properties": { "stateName": { "type": "string" } }, "required": [ "stateName" ], "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": "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" }, "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" ] }, "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" }, "audience": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "workspace" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "preview": { "maxItems": 5, "type": "array", "items": { "type": "object", "properties": { "memberId": { "type": "string" }, "userId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "role": { "type": "string", "enum": [ "owner", "editor", "viewer" ] } }, "required": [ "memberId", "userId", "name", "email", "role" ], "additionalProperties": false } } }, "required": [ "kind", "count", "preview" ], "additionalProperties": false } ] }, "archive": { "type": "object", "properties": { "globalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "personalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "reason": { "anyOf": [ { "type": "string", "enum": [ "global", "personal" ] }, { "type": "null" } ] } }, "required": [ "globalArchivedAt", "personalArchivedAt", "reason" ], "additionalProperties": false }, "permissions": { "type": "object", "properties": { "send": { "type": "boolean" }, "answer": { "type": "boolean" }, "interrupt": { "type": "boolean" }, "rename": { "type": "boolean" }, "manageAudience": { "type": "boolean" }, "personalArchive": { "type": "boolean" }, "globalArchive": { "type": "boolean" }, "delete": { "type": "boolean" } }, "required": [ "send", "answer", "interrupt", "rename", "manageAudience", "personalArchive", "globalArchive", "delete" ], "additionalProperties": false } }, "required": [ "id", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "audience", "archive", "permissions" ], "additionalProperties": false }- Delivery
- Standard response
- Retry
- Not declared idempotent
/v1 /ws /{workspaceSlug} /agent /sessions /{sessionId} /archiveSet one independent personal or workspace-wide archive cause
- Scope
ws:{workspaceSlug}:sessions- Request
Request JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "kind": { "type": "string", "enum": [ "personal", "global" ] }, "archived": { "type": "boolean" } }, "required": [ "kind", "archived" ], "additionalProperties": false }- Response
Response JSON schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": { "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" ] }, "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" }, "audience": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "workspace" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "specific" }, "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "preview": { "maxItems": 5, "type": "array", "items": { "type": "object", "properties": { "memberId": { "type": "string" }, "userId": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email", "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, "role": { "type": "string", "enum": [ "owner", "editor", "viewer" ] } }, "required": [ "memberId", "userId", "name", "email", "role" ], "additionalProperties": false } } }, "required": [ "kind", "count", "preview" ], "additionalProperties": false } ] }, "archive": { "type": "object", "properties": { "globalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "personalArchivedAt": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "reason": { "anyOf": [ { "type": "string", "enum": [ "global", "personal" ] }, { "type": "null" } ] } }, "required": [ "globalArchivedAt", "personalArchivedAt", "reason" ], "additionalProperties": false }, "permissions": { "type": "object", "properties": { "send": { "type": "boolean" }, "answer": { "type": "boolean" }, "interrupt": { "type": "boolean" }, "rename": { "type": "boolean" }, "manageAudience": { "type": "boolean" }, "personalArchive": { "type": "boolean" }, "globalArchive": { "type": "boolean" }, "delete": { "type": "boolean" } }, "required": [ "send", "answer", "interrupt", "rename", "manageAudience", "personalArchive", "globalArchive", "delete" ], "additionalProperties": false } }, "required": [ "id", "turnStatus", "bucket", "title", "titleOrigin", "titleStatus", "createdAt", "updatedAt", "lastEventSeq", "unread", "audience", "archive", "permissions" ], "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": 20, "type": "integer", "minimum": 1, "maximum": 20 } } }- 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" }, "title": { "type": "string" }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "updatedAt": { "type": "number" }, "unread": { "type": "boolean" }, "machine": { "type": "object", "properties": { "step": { "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 }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "activity" ], "additionalProperties": false } }, "required": [ "id", "title", "bucket", "updatedAt", "unread" ], "additionalProperties": false } }, "truncated": { "type": "boolean" }, "chat": { "type": "object", "properties": { "id": { "type": "string" }, "title": { "type": "string" }, "bucket": { "type": "string", "enum": [ "asking", "running", "scheduled", "done" ] }, "updatedAt": { "type": "number" }, "unread": { "type": "boolean" }, "machine": { "type": "object", "properties": { "step": { "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 }, "activity": { "type": "string", "enum": [ "running", "sleeping", "waiting", "idle" ] }, "nextWakeAt": { "type": "number" }, "outcome": { "type": "string", "enum": [ "interrupted", "completed", "failed", "cancelled", "error" ] } }, "required": [ "activity" ], "additionalProperties": false }, "preview": { "type": "object", "properties": { "text": { "type": "string", "minLength": 1 }, "author": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "agent" } }, "required": [ "kind" ], "additionalProperties": false }, { "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 } ] } }, "required": [ "text", "author" ], "additionalProperties": false } }, "required": [ "id", "title", "bucket", "updatedAt", "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}Idempotently accept permanent deletion of a session and every descendant
- Scope
ws:{workspaceSlug}:sessions- Request
- No JSON request body
- Response
- No structured response body
- Delivery
- Standard response
- Retry
- Declared idempotent