> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Dream データ構造

> Dream オブジェクト、入出力、ステータスのスキーマ。

## Dream オブジェクト

すべての Dream エンドポイントは Dream オブジェクトを返します。

| フィールド          | 型               | 説明                                           |
| -------------- | --------------- | -------------------------------------------- |
| `id`           | string          | Dream ID（`drm_` プレフィックス）                     |
| `type`         | string          | 常に `"dream"`                                 |
| `status`       | string          | Dream ステータス、[Dream ステータス](#dream-status) を参照 |
| `inputs`       | array           | 入力リスト、[Dream input](#dream-input) を参照        |
| `outputs`      | array           | 出力リスト、[Dream output](#dream-output) を参照      |
| `model`        | object          | 使用モデル、形式は `{"id": "auto"}`                   |
| `instructions` | string          | カスタム整理指示、最大 4096 文字                          |
| `session_id`   | string または null | 関連する Dreaming Session ID（実行開始後に設定）           |
| `usage`        | object          | トークン使用統計                                     |
| `error`        | object または null | 失敗時のエラー詳細                                    |
| `created_at`   | string          | UTC 作成時刻（ISO 8601）                           |
| `ended_at`     | string または null | UTC 終了時刻（終了状態のみ）                             |
| `archived_at`  | string または null | UTC アーカイブ時刻                                  |

## Dream ステータス

| 値           | 説明                   |
| ----------- | -------------------- |
| `pending`   | 作成済み、実行待ち            |
| `running`   | メモリ整理を実行中            |
| `completed` | 整理完了、結果は outputs に格納 |
| `failed`    | 実行失敗、原因は error を参照   |
| `canceled`  | ユーザーによりキャンセル         |

## Dream input

`inputs` 配列の各要素:

| type の値        | 必須フィールド           | 説明                            |
| -------------- | ----------------- | ----------------------------- |
| `memory_store` | `memory_store_id` | 入力 Memory Store を指定（必須、1 件のみ） |
| `sessions`     | `session_ids`     | 優先する Session を指定（任意、最大 100 件） |

## Dream output

完了後、`outputs` 配列の要素:

| フィールド             | 型      | 説明                     |
| ----------------- | ------ | ---------------------- |
| `type`            | string | 常に `"memory_store"`    |
| `memory_store_id` | string | 整理後の出力 Memory Store ID |
| `files_touched`   | array  | 作成・変更・削除されたメモリファイルのパス  |

## Dream usage

| フィールド                         | 型       | 説明             |
| ----------------------------- | ------- | -------------- |
| `input_tokens`                | integer | 入力トークン数        |
| `output_tokens`               | integer | 出力トークン数        |
| `cache_creation_input_tokens` | integer | キャッシュ作成トークン数   |
| `cache_read_input_tokens`     | integer | キャッシュ読み込みトークン数 |

## Dream error

失敗時に返されるエラーオブジェクト:

| フィールド     | 型      | 説明                                         |
| --------- | ------ | ------------------------------------------ |
| `type`    | string | エラー種別（例: `"no_output"`、`"internal_error"`） |
| `message` | string | エラー説明                                      |
