{
  "_meta": {
    "description": "Canonical ServerMessage JSON — generated by server/tests/protocol-snapshots.test.ts",
    "generated": "static",
    "messageCount": 49
  },
  "messages": {
    "connected": {
      "type": "connected",
      "session": {
        "id": "test-session-1",
        "workspaceId": "ws-1",
        "workspaceName": "My Workspace",
        "name": "Test Session",
        "status": "ready",
        "createdAt": 1739750400000,
        "lastActivity": 1739750460000,
        "model": "anthropic/claude-sonnet-4-20250514",
        "messageCount": 5,
        "tokens": {
          "input": 1500,
          "output": 800,
          "cacheRead": 250,
          "cacheWrite": 100
        },
        "cost": 0.012,
        "changeStats": {
          "mutatingToolCalls": 3,
          "filesChanged": 6,
          "changedFiles": [
            "src/main.ts",
            "README.md"
          ],
          "changedFilesOverflow": 4,
          "addedLines": 45,
          "removedLines": 12
        },
        "contextTokens": 2300,
        "contextWindow": 200000,
        "lastMessage": "I've updated the README with the new API docs.",
        "thinkingLevel": "high",
        "launch": {
          "source": "agent",
          "agentId": "agent-reviewer",
          "agentVersion": 4,
          "agentIcon": {
            "kind": "symbol",
            "name": "checkmark.shield"
          },
          "status": "accepted",
          "requestedAt": 1739750399000,
          "completedAt": 1739750400000
        },
        "piSessionFile": "/tmp/pi-sessions/abc123.jsonl",
        "piSessionFiles": [
          "/tmp/pi-sessions/abc123.jsonl"
        ],
        "piSessionId": "uuid-abc-123"
      },
      "currentSeq": 42
    },
    "stream_connected": {
      "type": "stream_connected",
      "userName": "my-server",
      "serverDictationAvailable": true
    },
    "state": {
      "type": "state",
      "session": {
        "id": "test-session-1",
        "workspaceId": "ws-1",
        "workspaceName": "My Workspace",
        "name": "Test Session",
        "status": "ready",
        "createdAt": 1739750400000,
        "lastActivity": 1739750460000,
        "model": "anthropic/claude-sonnet-4-20250514",
        "messageCount": 5,
        "tokens": {
          "input": 1500,
          "output": 800,
          "cacheRead": 250,
          "cacheWrite": 100
        },
        "cost": 0.012,
        "changeStats": {
          "mutatingToolCalls": 3,
          "filesChanged": 6,
          "changedFiles": [
            "src/main.ts",
            "README.md"
          ],
          "changedFilesOverflow": 4,
          "addedLines": 45,
          "removedLines": 12
        },
        "contextTokens": 2300,
        "contextWindow": 200000,
        "lastMessage": "I've updated the README with the new API docs.",
        "thinkingLevel": "high",
        "launch": {
          "source": "agent",
          "agentId": "agent-reviewer",
          "agentVersion": 4,
          "agentIcon": {
            "kind": "symbol",
            "name": "checkmark.shield"
          },
          "status": "accepted",
          "requestedAt": 1739750399000,
          "completedAt": 1739750400000
        },
        "piSessionFile": "/tmp/pi-sessions/abc123.jsonl",
        "piSessionFiles": [
          "/tmp/pi-sessions/abc123.jsonl"
        ],
        "piSessionId": "uuid-abc-123"
      }
    },
    "session_summary": {
      "type": "session_summary",
      "summary": {
        "id": "test-session-1",
        "workspaceId": "ws-1",
        "workspaceName": "My Workspace",
        "name": "Test Session",
        "status": "ready",
        "createdAt": 1739750400000,
        "lastActivity": 1739750460000,
        "model": "anthropic/claude-sonnet-4-20250514",
        "messageCount": 5,
        "tokens": {
          "input": 1500,
          "output": 800,
          "cacheRead": 250,
          "cacheWrite": 100
        },
        "cost": 0.012,
        "changeStats": {
          "mutatingToolCalls": 3,
          "filesChanged": 6,
          "changedFiles": [
            "src/main.ts",
            "README.md"
          ],
          "changedFilesOverflow": 4,
          "addedLines": 45,
          "removedLines": 12
        },
        "contextTokens": 2300,
        "contextWindow": 200000,
        "lastMessage": "I've updated the README with the new API docs.",
        "thinkingLevel": "high",
        "agentId": "agent-reviewer",
        "agentIcon": {
          "kind": "symbol",
          "name": "checkmark.shield"
        }
      }
    },
    "state_control": {
      "type": "state",
      "session": {
        "id": "control-session-1",
        "name": "Oppi Control",
        "status": "ready",
        "createdAt": 1739750400000,
        "lastActivity": 1739750460000,
        "model": "anthropic/claude-sonnet-4-20250514",
        "messageCount": 5,
        "tokens": {
          "input": 1500,
          "output": 800,
          "cacheRead": 250,
          "cacheWrite": 100
        },
        "cost": 0.012,
        "changeStats": {
          "mutatingToolCalls": 3,
          "filesChanged": 6,
          "changedFiles": [
            "src/main.ts",
            "README.md"
          ],
          "changedFilesOverflow": 4,
          "addedLines": 45,
          "removedLines": 12
        },
        "contextTokens": 2300,
        "contextWindow": 200000,
        "lastMessage": "I've updated the README with the new API docs.",
        "thinkingLevel": "high",
        "launch": {
          "source": "agent",
          "agentId": "agent-reviewer",
          "agentVersion": 4,
          "agentIcon": {
            "kind": "symbol",
            "name": "checkmark.shield"
          },
          "status": "accepted",
          "requestedAt": 1739750399000,
          "completedAt": 1739750400000
        },
        "piSessionFile": "/tmp/pi-sessions/abc123.jsonl",
        "piSessionFiles": [
          "/tmp/pi-sessions/abc123.jsonl"
        ],
        "piSessionId": "uuid-abc-123",
        "control": {
          "domain": "skills",
          "intent": "revise",
          "targetId": "skill-reviewer",
          "targetName": "Reviewer Skill"
        }
      }
    },
    "session_summary_control": {
      "type": "session_summary",
      "summary": {
        "id": "control-session-1",
        "name": "Oppi Control",
        "status": "ready",
        "createdAt": 1739750400000,
        "lastActivity": 1739750460000,
        "model": "anthropic/claude-sonnet-4-20250514",
        "messageCount": 5,
        "tokens": {
          "input": 1500,
          "output": 800,
          "cacheRead": 250,
          "cacheWrite": 100
        },
        "cost": 0.012,
        "changeStats": {
          "mutatingToolCalls": 3,
          "filesChanged": 6,
          "changedFiles": [
            "src/main.ts",
            "README.md"
          ],
          "changedFilesOverflow": 4,
          "addedLines": 45,
          "removedLines": 12
        },
        "contextTokens": 2300,
        "contextWindow": 200000,
        "lastMessage": "I've updated the README with the new API docs.",
        "thinkingLevel": "high",
        "agentId": "agent-reviewer",
        "agentIcon": {
          "kind": "symbol",
          "name": "checkmark.shield"
        },
        "control": {
          "domain": "skills",
          "intent": "revise",
          "targetId": "skill-reviewer",
          "targetName": "Reviewer Skill"
        }
      }
    },
    "state_icon_default": {
      "type": "state",
      "session": {
        "id": "test-session-1",
        "workspaceId": "ws-1",
        "workspaceName": "My Workspace",
        "name": "Test Session",
        "status": "ready",
        "createdAt": 1739750400000,
        "lastActivity": 1739750460000,
        "model": "anthropic/claude-sonnet-4-20250514",
        "messageCount": 5,
        "tokens": {
          "input": 1500,
          "output": 800,
          "cacheRead": 250,
          "cacheWrite": 100
        },
        "cost": 0.012,
        "changeStats": {
          "mutatingToolCalls": 3,
          "filesChanged": 6,
          "changedFiles": [
            "src/main.ts",
            "README.md"
          ],
          "changedFilesOverflow": 4,
          "addedLines": 45,
          "removedLines": 12
        },
        "contextTokens": 2300,
        "contextWindow": 200000,
        "lastMessage": "I've updated the README with the new API docs.",
        "thinkingLevel": "high",
        "launch": {
          "source": "agent",
          "agentId": "agent-reviewer",
          "agentVersion": 4,
          "agentIcon": {
            "kind": "default"
          },
          "status": "accepted",
          "requestedAt": 1739750399000,
          "completedAt": 1739750400000
        },
        "piSessionFile": "/tmp/pi-sessions/abc123.jsonl",
        "piSessionFiles": [
          "/tmp/pi-sessions/abc123.jsonl"
        ],
        "piSessionId": "uuid-abc-123"
      }
    },
    "state_icon_emoji": {
      "type": "state",
      "session": {
        "id": "test-session-1",
        "workspaceId": "ws-1",
        "workspaceName": "My Workspace",
        "name": "Test Session",
        "status": "ready",
        "createdAt": 1739750400000,
        "lastActivity": 1739750460000,
        "model": "anthropic/claude-sonnet-4-20250514",
        "messageCount": 5,
        "tokens": {
          "input": 1500,
          "output": 800,
          "cacheRead": 250,
          "cacheWrite": 100
        },
        "cost": 0.012,
        "changeStats": {
          "mutatingToolCalls": 3,
          "filesChanged": 6,
          "changedFiles": [
            "src/main.ts",
            "README.md"
          ],
          "changedFilesOverflow": 4,
          "addedLines": 45,
          "removedLines": 12
        },
        "contextTokens": 2300,
        "contextWindow": 200000,
        "lastMessage": "I've updated the README with the new API docs.",
        "thinkingLevel": "high",
        "launch": {
          "source": "agent",
          "agentId": "agent-reviewer",
          "agentVersion": 4,
          "agentIcon": {
            "kind": "emoji",
            "value": "🧘"
          },
          "status": "accepted",
          "requestedAt": 1739750399000,
          "completedAt": 1739750400000
        },
        "piSessionFile": "/tmp/pi-sessions/abc123.jsonl",
        "piSessionFiles": [
          "/tmp/pi-sessions/abc123.jsonl"
        ],
        "piSessionId": "uuid-abc-123"
      }
    },
    "state_icon_genmoji": {
      "type": "state",
      "session": {
        "id": "test-session-1",
        "workspaceId": "ws-1",
        "workspaceName": "My Workspace",
        "name": "Test Session",
        "status": "ready",
        "createdAt": 1739750400000,
        "lastActivity": 1739750460000,
        "model": "anthropic/claude-sonnet-4-20250514",
        "messageCount": 5,
        "tokens": {
          "input": 1500,
          "output": 800,
          "cacheRead": 250,
          "cacheWrite": 100
        },
        "cost": 0.012,
        "changeStats": {
          "mutatingToolCalls": 3,
          "filesChanged": 6,
          "changedFiles": [
            "src/main.ts",
            "README.md"
          ],
          "changedFilesOverflow": 4,
          "addedLines": 45,
          "removedLines": 12
        },
        "contextTokens": 2300,
        "contextWindow": 200000,
        "lastMessage": "I've updated the README with the new API docs.",
        "thinkingLevel": "high",
        "launch": {
          "source": "agent",
          "agentId": "agent-reviewer",
          "agentVersion": 4,
          "agentIcon": {
            "kind": "genmoji",
            "assetId": "ia_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
            "contentDescription": "A smiling fox"
          },
          "status": "accepted",
          "requestedAt": 1739750399000,
          "completedAt": 1739750400000
        },
        "piSessionFile": "/tmp/pi-sessions/abc123.jsonl",
        "piSessionFiles": [
          "/tmp/pi-sessions/abc123.jsonl"
        ],
        "piSessionId": "uuid-abc-123"
      }
    },
    "state_icon_malformed": {
      "type": "state",
      "session": {
        "id": "test-session-1",
        "workspaceId": "ws-1",
        "workspaceName": "My Workspace",
        "name": "Test Session",
        "status": "ready",
        "createdAt": 1739750400000,
        "lastActivity": 1739750460000,
        "model": "anthropic/claude-sonnet-4-20250514",
        "messageCount": 5,
        "tokens": {
          "input": 1500,
          "output": 800,
          "cacheRead": 250,
          "cacheWrite": 100
        },
        "cost": 0.012,
        "changeStats": {
          "mutatingToolCalls": 3,
          "filesChanged": 6,
          "changedFiles": [
            "src/main.ts",
            "README.md"
          ],
          "changedFilesOverflow": 4,
          "addedLines": 45,
          "removedLines": 12
        },
        "contextTokens": 2300,
        "contextWindow": 200000,
        "lastMessage": "I've updated the README with the new API docs.",
        "thinkingLevel": "high",
        "launch": {
          "source": "agent",
          "agentId": "agent-reviewer",
          "agentVersion": 4,
          "agentIcon": {
            "kind": "emoji",
            "value": "not emoji"
          },
          "status": "accepted",
          "requestedAt": 1739750399000,
          "completedAt": 1739750400000
        },
        "piSessionFile": "/tmp/pi-sessions/abc123.jsonl",
        "piSessionFiles": [
          "/tmp/pi-sessions/abc123.jsonl"
        ],
        "piSessionId": "uuid-abc-123"
      }
    },
    "state_icon_future": {
      "type": "state",
      "session": {
        "id": "test-session-1",
        "workspaceId": "ws-1",
        "workspaceName": "My Workspace",
        "name": "Test Session",
        "status": "ready",
        "createdAt": 1739750400000,
        "lastActivity": 1739750460000,
        "model": "anthropic/claude-sonnet-4-20250514",
        "messageCount": 5,
        "tokens": {
          "input": 1500,
          "output": 800,
          "cacheRead": 250,
          "cacheWrite": 100
        },
        "cost": 0.012,
        "changeStats": {
          "mutatingToolCalls": 3,
          "filesChanged": 6,
          "changedFiles": [
            "src/main.ts",
            "README.md"
          ],
          "changedFilesOverflow": 4,
          "addedLines": 45,
          "removedLines": 12
        },
        "contextTokens": 2300,
        "contextWindow": 200000,
        "lastMessage": "I've updated the README with the new API docs.",
        "thinkingLevel": "high",
        "launch": {
          "source": "agent",
          "agentId": "agent-reviewer",
          "agentVersion": 4,
          "agentIcon": {
            "kind": "animated",
            "version": 2
          },
          "status": "accepted",
          "requestedAt": 1739750399000,
          "completedAt": 1739750400000
        },
        "piSessionFile": "/tmp/pi-sessions/abc123.jsonl",
        "piSessionFiles": [
          "/tmp/pi-sessions/abc123.jsonl"
        ],
        "piSessionId": "uuid-abc-123"
      }
    },
    "session_ended": {
      "type": "session_ended",
      "reason": "Process exited with code 0"
    },
    "session_deleted": {
      "type": "session_deleted",
      "sessionId": "test-session-id"
    },
    "stop_requested": {
      "type": "stop_requested",
      "source": "user",
      "reason": "User pressed stop"
    },
    "stop_confirmed": {
      "type": "stop_confirmed",
      "source": "user",
      "reason": "Session stopped gracefully"
    },
    "stop_failed": {
      "type": "stop_failed",
      "source": "timeout",
      "reason": "Process did not respond to SIGTERM within 10s"
    },
    "error": {
      "type": "error",
      "error": "Model API rate limit exceeded",
      "code": "rate_limit",
      "fatal": false
    },
    "agent_start": {
      "type": "agent_start"
    },
    "agent_end": {
      "type": "agent_end"
    },
    "agent_settled": {
      "type": "agent_settled"
    },
    "message_end": {
      "type": "message_end",
      "role": "assistant",
      "content": "I've finished updating the code."
    },
    "cache_miss": {
      "type": "cache_miss",
      "id": "cache-miss:1739750460000:anthropic/claude-sonnet-4-20250514",
      "message": "Cache miss after 5m idle: 69k tokens re-billed (~$0.79)"
    },
    "text_delta": {
      "type": "text_delta",
      "delta": "Hello, "
    },
    "thinking_delta": {
      "type": "thinking_delta",
      "delta": "Let me analyze...",
      "contentIndex": 0
    },
    "audio_stream": {
      "type": "audio_stream",
      "kind": "audio-stream",
      "id": "audio-001",
      "event": "chunk",
      "mimeType": "audio/pcm; codecs=s16le",
      "sampleRate": 24000,
      "channels": 1,
      "chunkIndex": 0,
      "audioBase64": "AAAA",
      "playbackBehavior": "playNow"
    },
    "tool_start": {
      "type": "tool_start",
      "tool": "bash",
      "args": {
        "command": "npm test"
      },
      "toolCallId": "tc-001"
    },
    "tool_start_with_segments": {
      "type": "tool_start",
      "tool": "read",
      "args": {
        "path": "src/main.ts",
        "offset": 1,
        "limit": 50
      },
      "toolCallId": "tc-seg-001",
      "callSegments": [
        {
          "text": "read ",
          "style": "bold"
        },
        {
          "text": "src/main.ts",
          "style": "accent"
        },
        {
          "text": ":1-50",
          "style": "warning"
        }
      ]
    },
    "tool_update": {
      "type": "tool_update",
      "tool": "write",
      "args": {
        "path": "README.md",
        "content": "hello"
      },
      "toolCallId": "tc-update-001"
    },
    "tool_output": {
      "type": "tool_output",
      "output": "All 42 tests passed",
      "isError": false,
      "toolCallId": "tc-001"
    },
    "tool_output_preview": {
      "type": "tool_output",
      "output": "/path/to/file-180\n/path/to/file-181\n/path/to/file-182",
      "isError": false,
      "toolCallId": "tc-preview-001",
      "mode": "replace",
      "truncated": true,
      "totalBytes": 32768
    },
    "tool_end": {
      "type": "tool_end",
      "tool": "bash",
      "toolCallId": "tc-001"
    },
    "tool_end_with_details": {
      "type": "tool_end",
      "tool": "remember",
      "toolCallId": "tc-ext-001",
      "details": {
        "file": "2026-02-18.md",
        "redacted": false
      },
      "isError": false,
      "resultSegments": [
        {
          "text": "✓ Saved",
          "style": "success"
        },
        {
          "text": " → 2026-02-18.md",
          "style": "muted"
        }
      ]
    },
    "queue_state": {
      "type": "queue_state",
      "queue": {
        "version": 3,
        "steering": [
          {
            "id": "queue-steer-1",
            "message": "Adjust the approach",
            "createdAt": 1739750470000
          }
        ],
        "followUp": []
      }
    },
    "queue_item_started": {
      "type": "queue_item_started",
      "kind": "follow_up",
      "item": {
        "id": "queue-follow-1",
        "message": "Run the tests next",
        "createdAt": 1739750480000
      },
      "queueVersion": 4
    },
    "turn_ack": {
      "type": "turn_ack",
      "command": "prompt",
      "clientTurnId": "turn-abc-123",
      "stage": "accepted",
      "requestId": "req-001",
      "duplicate": false
    },
    "command_result_success": {
      "type": "command_result",
      "command": "get_state",
      "requestId": "req-002",
      "success": true,
      "data": {
        "model": {
          "provider": "anthropic",
          "id": "claude-sonnet-4-0"
        }
      }
    },
    "command_result_error": {
      "type": "command_result",
      "command": "set_model",
      "requestId": "req-003",
      "success": false,
      "error": "Model not found"
    },
    "compaction_start": {
      "type": "compaction_start",
      "reason": "Context window 85% full"
    },
    "compaction_end": {
      "type": "compaction_end",
      "aborted": false,
      "willRetry": false,
      "summary": "Compacted 15k tokens to 8k tokens",
      "tokensBefore": 15000
    },
    "retry_start": {
      "type": "retry_start",
      "attempt": 1,
      "maxAttempts": 3,
      "delayMs": 5000,
      "errorMessage": "API overloaded"
    },
    "retry_end": {
      "type": "retry_end",
      "success": true,
      "attempt": 2
    },
    "extension_ui_request": {
      "type": "extension_ui_request",
      "id": "ui-001",
      "sessionId": "test-session-1",
      "method": "select",
      "title": "Choose a model",
      "options": [
        "claude-sonnet",
        "claude-opus"
      ],
      "message": "Select the model for this task",
      "placeholder": "Select...",
      "prefill": "claude-sonnet",
      "timeout": 30000,
      "extensionScopeId": "npm:review-helper",
      "extensionDisplayName": "Review Helper"
    },
    "extension_ui_notification": {
      "type": "extension_ui_notification",
      "method": "setWidget",
      "message": "Build completed successfully",
      "notifyType": "info",
      "statusKey": "build",
      "statusText": "✅ Build passed",
      "title": "Build status",
      "text": "Act on the review findings",
      "widgetKey": "review",
      "widgetLines": [
        "Review session active",
        "Run /end-review when done"
      ],
      "widgetPlacement": "aboveEditor",
      "extensionScopeId": "npm:review-helper",
      "extensionDisplayName": "Review Helper",
      "workingIndicator": {
        "frames": [
          "●"
        ],
        "intervalMs": 250
      },
      "workingVisible": true,
      "hiddenThinkingLabel": "Private reasoning",
      "toolsExpanded": true
    },
    "extension_ui_settled": {
      "type": "extension_ui_settled",
      "id": "ui-001",
      "sessionId": "test-session-1"
    },
    "git_status": {
      "type": "git_status",
      "workspaceId": "ws-1",
      "status": {
        "isGitRepo": true,
        "branch": "main",
        "headSha": "a1b2c3d",
        "ahead": 1,
        "behind": 0,
        "dirtyCount": 1,
        "untrackedCount": 0,
        "stagedCount": 1,
        "files": [
          {
            "status": "A",
            "path": "src/main.ts",
            "addedLines": 45,
            "removedLines": 0
          },
          {
            "status": "M",
            "path": "README.md",
            "addedLines": 3,
            "removedLines": 1
          }
        ],
        "totalFiles": 2,
        "addedLines": 48,
        "removedLines": 1,
        "stashCount": 0,
        "lastCommitMessage": "Initial commit",
        "lastCommitDate": "2026-02-20T18:00:00.000Z",
        "recentCommits": [
          {
            "sha": "a1b2c3d",
            "message": "Initial commit",
            "date": "2026-02-20T18:00:00.000Z"
          }
        ]
      }
    },
    "dictation_ready": {
      "type": "dictation_ready",
      "sttProvider": "openai-compatible",
      "sttModel": "gpt-4o-transcribe"
    },
    "dictation_result": {
      "type": "dictation_result",
      "text": "hello wor",
      "committedText": "hello ",
      "activeText": "wor",
      "snap": false
    },
    "dictation_final": {
      "type": "dictation_final",
      "text": "hello world",
      "committedText": "hello world",
      "activeText": ""
    },
    "dictation_error": {
      "type": "dictation_error",
      "error": "STT backend unavailable",
      "fatal": true
    }
  }
}
