{
  "scenario": "cancellation",
  "expectFaults": false,
  "violations": [],
  "warnings": [],
  "stats": {
    "total": 26,
    "types": {
      "connected": 1,
      "session.created": 1,
      "chat.user_message": 2,
      "chat.event": 2,
      "session.stream": 12,
      "chat.inference_tool": 1,
      "chat.message": 3,
      "chat.tool": 2,
      "chat.response": 2
    },
    "streamFrames": {
      "thinking.chunk": 8,
      "error": 1,
      "done": 2,
      "inference.chunk": 1
    },
    "sessions": 1
  },
  "events": [
    {
      "type": "connected",
      "timestamp": 1783815944338,
      "_rxAt": 1783815944340,
      "_seq": 0
    },
    {
      "type": "session.created",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "mode": "chat",
        "parentSessionId": null,
        "instanceName": null,
        "timestamp": 1783815944738
      },
      "_rxAt": 1783815944739,
      "_seq": 1
    },
    {
      "type": "chat.user_message",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "content": "Run the shell command `sleep 30 && echo finished-the-long-sleep` using the bash tool, then tell me what it printed.",
        "timestamp": 1783815944741
      },
      "_rxAt": 1783815944741,
      "_seq": 2
    },
    {
      "type": "chat.event",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "type": "iteration.start",
        "iteration": 1,
        "tokensSoFar": 0,
        "timestamp": 1783815944748
      },
      "_rxAt": 1783815944748,
      "_seq": 3
    },
    {
      "type": "session.stream",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "eventType": "thinking.chunk",
      "data": {
        "content": "The user wants me to run a shell command that sleeps"
      },
      "_rxAt": 1783815944846,
      "_seq": 4
    },
    {
      "type": "session.stream",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "eventType": "thinking.chunk",
      "data": {
        "content": " for 30 seconds and then echoes \"finished-the-long-sleep\"."
      },
      "_rxAt": 1783815944847,
      "_seq": 5
    },
    {
      "type": "session.stream",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "eventType": "thinking.chunk",
      "data": {
        "content": " They want to know what it printed.\n\nThis will take"
      },
      "_rxAt": 1783815944848,
      "_seq": 6
    },
    {
      "type": "session.stream",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "eventType": "thinking.chunk",
      "data": {
        "content": " 30 seconds to complete. The bash tool has a default"
      },
      "_rxAt": 1783815944852,
      "_seq": 7
    },
    {
      "type": "session.stream",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "eventType": "thinking.chunk",
      "data": {
        "content": " timeout of 120 seconds, so this should work fine."
      },
      "_rxAt": 1783815944854,
      "_seq": 8
    },
    {
      "type": "session.stream",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "eventType": "thinking.chunk",
      "data": {
        "content": "\n\nLet me run the command."
      },
      "_rxAt": 1783815944859,
      "_seq": 9
    },
    {
      "type": "chat.inference_tool",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "name": "bash",
        "timestamp": 1783815944862
      },
      "_rxAt": 1783815944863,
      "_seq": 10
    },
    {
      "type": "chat.message",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "id": 2,
        "session_id": "sess_7d033e4f941ca6be",
        "role": "assistant",
        "content": null,
        "tool_calls": [
          {
            "id": "bash:0",
            "type": "function",
            "function": {
              "name": "bash",
              "arguments": "{\"command\": \"sleep 30 && echo finished-the-long-sleep\"}"
            }
          }
        ],
        "tool_call_id": null,
        "thinking_content": "The user wants me to run a shell command that sleeps for 30 seconds and then echoes \"finished-the-long-sleep\". They want to know what it printed.\n\nThis will take 30 seconds to complete. The bash tool has a default timeout of 120 seconds, so this should work fine.\n\nLet me run the command.",
        "thinking_tokens": 75,
        "created_at": "2026-07-12T00:25:44.873Z",
        "finishReason": "tool_calls",
        "iteration": 1,
        "tokenUsage": {
          "input": 1122,
          "output": 93,
          "cache": 768,
          "cost": 0.0005539644
        },
        "timestamp": 1783815944874
      },
      "_rxAt": 1783815944875,
      "_seq": 11
    },
    {
      "type": "chat.tool",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "type": "tool.start",
        "toolName": "bash",
        "toolInput": {
          "command": "sleep 30 && echo finished-the-long-sleep"
        },
        "timestamp": 1783815944875
      },
      "_rxAt": 1783815944875,
      "_seq": 12
    },
    {
      "type": "chat.message",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "id": 3,
        "session_id": "sess_7d033e4f941ca6be",
        "role": "tool",
        "content": "finished-the-long-sleep",
        "tool_calls": null,
        "tool_call_id": "bash:0",
        "created_at": "2026-07-12T00:26:14.890Z",
        "timestamp": 1783815974890
      },
      "_rxAt": 1783815974890,
      "_seq": 13
    },
    {
      "type": "chat.tool",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "type": "tool.end",
        "toolName": "bash",
        "durationMs": 30015,
        "success": true,
        "outputPreview": "finished-the-long-sleep",
        "timestamp": 1783815974890
      },
      "_rxAt": 1783815974890,
      "_seq": 14
    },
    {
      "type": "session.stream",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "eventType": "error",
      "data": {
        "code": "CANCELLED",
        "message": "Session cancelled",
        "details": {
          "reason": "user_cancel"
        }
      },
      "_rxAt": 1783815974891,
      "_seq": 15
    },
    {
      "type": "chat.response",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "content": null,
        "toolCount": 1,
        "timestamp": 1783815974891
      },
      "_rxAt": 1783815974891,
      "_seq": 16
    },
    {
      "type": "session.stream",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "eventType": "done",
      "data": {
        "session": {
          "id": "sess_7d033e4f941ca6be",
          "agent_name": "builder",
          "mode": "chat",
          "instance_folder": "/home/ixi/khacloud/drive/Plugins/VeilCli/test/advanced-test-projects/cancellation",
          "status": "active",
          "model": "moonshotai/kimi-k2.5",
          "title": null,
          "message_count": 3,
          "total_input_tokens": 1122,
          "total_output_tokens": 93,
          "total_cache_tokens": 768,
          "context_size": 1215,
          "context_size_limit": 262144,
          "cost": 0.0005539644,
          "compaction_count": 0,
          "created_at": "2026-07-12T00:25:44.735Z",
          "updated_at": "2026-07-12T00:26:14.890Z",
          "model_thinking": null,
          "compact_summary": null,
          "compact_size": 0,
          "compact_count": 50,
          "compact_auto_threshold": null,
          "compact_enabled": 1,
          "compact_model": "default",
          "compact_custom_instructions": null,
          "temperature": null,
          "max_tokens": null,
          "reasoning": "{\"effort\":\"low\"}",
          "parent_session_id": null,
          "instance_name": null,
          "objective": null,
          "success_criteria": null,
          "token_budget": null,
          "max_wall_seconds": null,
          "max_spawn_depth": null,
          "spawn_depth": 0,
          "trace_id": "trace_4e499927b7321e4e",
          "claude_session_id": null,
          "effort": null
        },
        "agentName": "builder",
        "model": null,
        "iterations": 0,
        "durationMs": 30150,
        "tokenUsage": {
          "input": 0,
          "output": 0,
          "cache": 0,
          "cost": 0
        },
        "toolCalls": [
          {
            "name": "bash",
            "durationMs": 30015,
            "success": true
          }
        ],
        "cancelled": true,
        "cancelReason": "user_cancel"
      },
      "_rxAt": 1783815974892,
      "_seq": 17
    },
    {
      "type": "chat.user_message",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "content": "Good. Now just reply with the single word: OK",
        "timestamp": 1783815974898
      },
      "_rxAt": 1783815974899,
      "_seq": 18
    },
    {
      "type": "chat.event",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "type": "iteration.start",
        "iteration": 1,
        "tokensSoFar": 0,
        "timestamp": 1783815974899
      },
      "_rxAt": 1783815974900,
      "_seq": 19
    },
    {
      "type": "session.stream",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "eventType": "thinking.chunk",
      "data": {
        "content": "The user wants me to reply with just the single "
      },
      "_rxAt": 1783815974908,
      "_seq": 20
    },
    {
      "type": "session.stream",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "eventType": "thinking.chunk",
      "data": {
        "content": "word \"OK\"."
      },
      "_rxAt": 1783815974911,
      "_seq": 21
    },
    {
      "type": "session.stream",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "eventType": "inference.chunk",
      "data": {
        "content": "OK"
      },
      "_rxAt": 1783815974916,
      "_seq": 22
    },
    {
      "type": "chat.message",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "id": 5,
        "session_id": "sess_7d033e4f941ca6be",
        "role": "assistant",
        "content": "OK",
        "tool_calls": null,
        "tool_call_id": null,
        "thinking_content": "The user wants me to reply with just the single word \"OK\".",
        "thinking_tokens": 15,
        "created_at": "2026-07-12T00:26:14.920Z",
        "finishReason": "stop",
        "iteration": 1,
        "tokenUsage": {
          "input": 1186,
          "output": 18,
          "cache": 1024,
          "cost": 0.0003258882
        },
        "timestamp": 1783815974921
      },
      "_rxAt": 1783815974921,
      "_seq": 23
    },
    {
      "type": "chat.response",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "event": {
        "content": "OK",
        "toolCount": 0,
        "timestamp": 1783815974921
      },
      "_rxAt": 1783815974922,
      "_seq": 24
    },
    {
      "type": "session.stream",
      "sessionId": "sess_7d033e4f941ca6be",
      "agentName": "builder",
      "eventType": "done",
      "data": {
        "session": {
          "id": "sess_7d033e4f941ca6be",
          "agent_name": "builder",
          "mode": "chat",
          "instance_folder": "/home/ixi/khacloud/drive/Plugins/VeilCli/test/advanced-test-projects/cancellation",
          "status": "active",
          "model": "moonshotai/kimi-k2.5",
          "title": null,
          "message_count": 5,
          "total_input_tokens": 1186,
          "total_output_tokens": 18,
          "total_cache_tokens": 1024,
          "context_size": 1204,
          "context_size_limit": 262144,
          "cost": 0.0003258882,
          "compaction_count": 0,
          "created_at": "2026-07-12T00:25:44.735Z",
          "updated_at": "2026-07-12T00:26:14.921Z",
          "model_thinking": null,
          "compact_summary": null,
          "compact_size": 0,
          "compact_count": 50,
          "compact_auto_threshold": null,
          "compact_enabled": 1,
          "compact_model": "default",
          "compact_custom_instructions": null,
          "temperature": null,
          "max_tokens": null,
          "reasoning": "{\"effort\":\"low\"}",
          "parent_session_id": null,
          "instance_name": null,
          "objective": null,
          "success_criteria": null,
          "token_budget": null,
          "max_wall_seconds": null,
          "max_spawn_depth": null,
          "spawn_depth": 0,
          "trace_id": "trace_4e499927b7321e4e",
          "claude_session_id": null,
          "effort": null
        },
        "agentName": "builder",
        "model": "moonshotai/kimi-k2.5",
        "iterations": 1,
        "durationMs": 23,
        "tokenUsage": {
          "input": 1186,
          "output": 18,
          "cache": 1024,
          "cost": 0.0003258882
        },
        "toolCalls": [],
        "cancelled": false
      },
      "_rxAt": 1783815974922,
      "_seq": 25
    }
  ]
}