이벤트

CLI-JAW는 실시간 업데이트를 위해 WebSocket을, AI 응답 스트리밍을 위해 NDJSON을 사용합니다.

WebSocket 연결

ws://localhost:3457/ws

WebSocket 연결을 통해 모든 서버 이벤트를 실시간으로 수신합니다.

주요 이벤트

이벤트페이로드설명
message{role, content}채팅 메시지 (사용자 또는 어시스턴트)
tool_use{name, input}AI의 도구 호출
thinking{content}확장 사고 블록
status{state}에이전트 상태 변경
error{message}오류 알림
steer_started{prompt}Steer 프롬프트 주입
goal_done{goalId}목표 완료
goal_cancel{goalId}목표 취소

NDJSON 스트림

채팅 응답은 줄바꿈으로 구분된 JSON으로 스트리밍됩니다:

POST /api/chat
Content-Type: application/json

{"message": "Hello"}

Response (streaming):
{"type":"thinking","content":"..."}
{"type":"text","content":"Hello! "}
{"type":"text","content":"How can I help?"}
{"type":"done"}

트레이스 파일

세션 트레이스는 ~/.cli-jaw/traces/에 NDJSON 파일로 저장됩니다. 각 줄은 타임스탬프가 포함된 이벤트입니다.