session::append
Append one entry (idempotent on entry_id); fires session::message-added.
- customany of
Append a bookkeeping `kind: "custom"` entry instead of a message (e.g. the harness's compaction record). Custom entries do not count toward `message_count` and are only returned by `session::messages` when `include_custom` is set.
any of (2)Variant 1- custom_typestringrequired
App-defined discriminator (e.g. `"compaction"`).
- dataunknown
Opaque app data.
Variant 2valuenull - entry_idstring
Caller-supplied id for idempotent appends: appending an id that already exists is a no-op — the existing entry is returned and no event fires.
- messageany of
The message to append (a `kind: "message"` entry). Exactly one of `message` / `custom` must be supplied.
any of (2)Variant 1one of (4)Variant 1- contentone of[]required
Show 5 nestedHide nested
one of (5)Variant 1- textstringrequired
- typestringrequiredenum text
Variant 2- datastringrequired
Base64-encoded image bytes.
- mimestringrequired
MIME type, e.g. `image/png`.
- typestringrequiredenum image
Variant 3- signaturestring
- textstringrequired
- typestringrequiredenum thinking
Variant 4- argumentsunknown
Model-produced arguments (JSON).
- function_idstringrequired
The iii function id to invoke.
- idstringrequired
Unique per call, echoed by the result.
- typestringrequiredenum function_call
Variant 5- contentunknown[]required
- function_call_idstringrequired
- is_errorboolean
- typestringrequiredenum function_result
- rolestringrequiredenum user
- timestampinteger· int64required
Milliseconds since epoch.
Variant 2- agentstring
The AGENT worker that produced this turn (`claude-code`, `pi`), when one says so. Distinct from `provider`, which names who served the model: two agents can run the same model, and a reader given only a model cannot tell which agent answered. Optional, because the harness's own turns have no agent worker to name.
- contentone of[]required
Show 5 nestedHide nested
one of (5)Variant 1- textstringrequired
- typestringrequiredenum text
Variant 2- datastringrequired
Base64-encoded image bytes.
- mimestringrequired
MIME type, e.g. `image/png`.
- typestringrequiredenum image
Variant 3- signaturestring
- textstringrequired
- typestringrequiredenum thinking
Variant 4- argumentsunknown
Model-produced arguments (JSON).
- function_idstringrequired
The iii function id to invoke.
- idstringrequired
Unique per call, echoed by the result.
- typestringrequiredenum function_call
Variant 5- contentunknown[]required
- function_call_idstringrequired
- is_errorboolean
- typestringrequiredenum function_result
- error_kindany of
Show 2 nestedHide nested
any of (2)Variant 1valuestringenum auth_expired, rate_limited, context_overflow, transient, permanentVariant 2valuenull - error_messagestring
- modelstringrequired
- native_stop_reasonstring
Provider's raw finish reason, passed through untouched.
- providerstringrequired
- rolestringrequiredenum assistant
- stop_reasonstringrequiredenum end, length, function_call, aborted, error
Why an assistant message stopped generating.
- timestampinteger· int64required
Milliseconds since epoch.
- usageany of
Show 2 nestedHide nested
any of (2)Variant 1- cache_readinteger· uint64min 0
- cache_writeinteger· uint64min 0
- cost_usdnumber· double
- inputinteger· uint64min 0
- outputinteger· uint64min 0
- reasoninginteger· uint64min 0
Variant 2valuenull - warningsstring[]
Report-and-continue notices (e.g. dropped unsupported param).
Variant 3- contentone of[]required
Show 5 nestedHide nested
one of (5)Variant 1- textstringrequired
- typestringrequiredenum text
Variant 2- datastringrequired
Base64-encoded image bytes.
- mimestringrequired
MIME type, e.g. `image/png`.
- typestringrequiredenum image
Variant 3- signaturestring
- textstringrequired
- typestringrequiredenum thinking
Variant 4- argumentsunknown
Model-produced arguments (JSON).
- function_idstringrequired
The iii function id to invoke.
- idstringrequired
Unique per call, echoed by the result.
- typestringrequiredenum function_call
Variant 5- contentunknown[]required
- function_call_idstringrequired
- is_errorboolean
- typestringrequiredenum function_result
- detailsunknown
Opaque structured payload kept alongside the rendered content.
- function_call_idstringrequired
Echoes the `function_call` block id this result answers.
- function_idstringrequired
- is_errorboolean
- rolestringrequiredenum function_result
- timestampinteger· int64required
Milliseconds since epoch.
Variant 4- contentone of[]required
Show 5 nestedHide nested
one of (5)Variant 1- textstringrequired
- typestringrequiredenum text
Variant 2- datastringrequired
Base64-encoded image bytes.
- mimestringrequired
MIME type, e.g. `image/png`.
- typestringrequiredenum image
Variant 3- signaturestring
- textstringrequired
- typestringrequiredenum thinking
Variant 4- argumentsunknown
Model-produced arguments (JSON).
- function_idstringrequired
The iii function id to invoke.
- idstringrequired
Unique per call, echoed by the result.
- typestringrequiredenum function_call
Variant 5- contentunknown[]required
- function_call_idstringrequired
- is_errorboolean
- typestringrequiredenum function_result
- custom_typestringrequired
App-defined discriminator.
- detailsunknown
- displaystring
- rolestringrequiredenum custom
- timestampinteger· int64required
Milliseconds since epoch.
Variant 2valuenull - originobject
Opaque correlation (e.g. `{ "turn_id": ... }`), echoed on events.
- parent_idstring
Override the parent (default: active leaf). Appending always moves the active leaf to the new entry.
- session_idstringrequired
- entry_idstringrequired
- parent_idstring
- timestampinteger· int64required