MINARA

単一セッションの全履歴を取得

セッションメタデータ、時系列の全メッセージ、未回答の質問を返します。

GET /v1/sessions/:id

履歴を読むための主要エンドポイントです。セッションメタデータ、時系列で永続化された全メッセージ、未解決のインタラクションキュー質問を返します。クライアントはまず履歴を描画し、is_streaming が true の場合はこのセッション ID をキーに WebSocket の chat チャンネルを購読してライブターンを追跡します。

メソッドGET
パス/v1/sessions/:id
認証GATEWAY_AUTH_TOKEN 設定時は Authorization: Bearer <token> が必要
カテゴリsessions

レスポンス本文

{ "id": "chat_abc", "title": "BTC analysis", "origin": "web", "kind": "chat", "created_at_ms": 1747000000000, "updated_at_ms": 1747000500000, "message_count": 2, "has_unseen_completion": true, "completion_settled_at_ms": 1747000500000, "messages": [ { "id": 1, "role": "user", "content": "analyze BTC", "ts_ms": 1747000000000, "metadata": null }, { "id": 2, "role": "assistant", "content": "…", "ts_ms": 1747000400000, "metadata": { "segments": [ { "kind": "text", "text": "…" }, { "kind": "tool", "toolId": "call_1" } ], "toolCalls": [ { "id": "call_1", "name": "get_quote", "args": { "symbol": "BTC" }, "ok": true, "result": "…", "duration_ms": 812 } ] } } ], "is_streaming": false, "pending_questions": [] }

補足

metadata はロールごとに異なります。Assistant 行には順序付き描画計画 segmentstoolId で参照される toolCalls、早期停止時の interrupted: true が含まれます。User 行には attachments、ターン途中の指示を表す interjection: true、音声入力キーが含まれる場合があります。古い行は metadata: null のことがあり、その場合は content を通常の Markdown として描画します。pending_questionspending_question_added イベントと同じ形で、POST /v1/interactions/:id/answer から回答できます。未知の ID は 404 を返します。

レスポンスには、直近に完了または失敗した Agent タスク結果が未閲覧であることを示す has_unseen_completion も含まれます。completion_settled_at_ms はその状態に対応する完了結果を識別し、古い読み取りによって確認済みの結果が復元されるのを防ぎます。

目次