Claude SDK messages
A stream and its final snapshot.
The SDK sends a text delta, then a complete assistant message. The adapter keeps the readable text from appearing twice.
What the adapter receives
- 01
Text delta
- 02
Assistant message + tool block
- 03
User message + result block
- 04
Terminal result message
What the chat can show Saved output
textA readable replyChecking the fixture.
tool_useBash startsprintf 'fixture-ok\n'
tool_resultThe tool returnsfixture-ok
doneThe turn finishesFixture complete.
The sample command is text in the fixture. It is never executed.
The useful difference
One sentence, once.
The saved SDK delta carries “Checking the fixture.” The next assistant message includes that same sentence and a tool call. The adapter emits the tool call without repeating the sentence.
- Text delta: Checking the fixture.text · Checking the fixture.
- Full message: same text + tool blocktool_use · Bash (no repeated text)
Claude source proof uses real SDK message classes with mocked SDK transport and the source’s unit-harness branch. It checks translation inside invocation; it does not run the lifetime dispatcher or CLI.
Inspect the saved input and output
Selected records from this offline capture. Empty output means no event was emitted. The receipt defines the field selection; retained values are unchanged. Any /tmp/fixture-workspace path is synthetic.
[
{
"input_index": 1,
"input": {
"sdk_type": "StreamEvent",
"fields": {
"uuid": "synthetic-delta-0-21",
"session_id": "synthetic-claude-session",
"parent_tool_use_id": null,
"event": {
"type": "content_block_delta",
"index": 0,
"delta": {
"type": "text_delta",
"text": "Checking the fixture."
}
}
}
},
"outputs": [
{
"type": "text",
"content": "Checking the fixture.",
"accumulated": "Checking the fixture.",
"parent_tool_use_id": null,
"session_id": "synthetic-claude-session"
}
]
},
{
"input_index": 2,
"input": {
"sdk_type": "AssistantMessage",
"fields": {
"content": [
{
"sdk_type": "TextBlock",
"fields": {
"text": "Checking the fixture."
}
},
{
"sdk_type": "ToolUseBlock",
"fields": {
"id": "synthetic-call-1",
"name": "Bash",
"input": {
"command": "printf 'fixture-ok\\n'"
}
}
}
],
"model": "synthetic-model",
"parent_tool_use_id": null
}
},
"outputs": [
{
"type": "tool_use",
"tool_use_id": "synthetic-call-1",
"name": "Bash",
"input": {
"command": "printf 'fixture-ok\\n'"
},
"parent_tool_use_id": null,
"ui_resource_uri": null
}
]
},
{
"input_index": 3,
"input": {
"sdk_type": "UserMessage",
"fields": {
"content": [
{
"sdk_type": "ToolResultBlock",
"fields": {
"tool_use_id": "synthetic-call-1",
"content": "fixture-ok\n",
"is_error": false
}
}
],
"parent_tool_use_id": null
}
},
"outputs": [
{
"type": "tool_result",
"tool_use_id": "synthetic-call-1",
"content": "fixture-ok\n",
"is_error": false,
"parent_tool_use_id": null,
"ui_resource_uri": null
}
]
},
{
"input_index": 6,
"input": {
"sdk_type": "ResultMessage",
"fields": {
"subtype": "success",
"session_id": "synthetic-claude-session",
"result": "Fixture complete.",
"is_error": false
}
},
"outputs": [
{
"type": "done",
"session_id": "synthetic-claude-session",
"result": "Fixture complete.",
"final_text": "Fixture complete.",
"is_error": false,
"subtype": "success"
}
]
}
]