> ## 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 对象。

| 字段             | 类型            | 说明                                       |
| -------------- | ------------- | ---------------------------------------- |
| `id`           | string        | Dream ID，前缀为 `drm_`                      |
| `type`         | string        | 固定值 `"dream"`                            |
| `status`       | string        | Dream 状态，见 [Dream status](#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        | Token 用量统计                               |
| `error`        | object 或 null | 失败时的错误详情                                 |
| `created_at`   | string        | UTC 创建时间（ISO 8601）                       |
| `ended_at`     | string 或 null | UTC 结束时间（仅终态时有值）                         |
| `archived_at`  | string 或 null | UTC 归档时间                                 |

## Dream status

| 值           | 说明                |
| ----------- | ----------------- |
| `pending`   | 已创建，等待执行          |
| `running`   | 正在执行记忆整理          |
| `completed` | 整理完成，outputs 中有结果 |
| `failed`    | 执行失败，error 中有原因   |
| `canceled`  | 被用户取消             |

## Dream input

`inputs` 数组中的每个元素：

| type 值         | 必填字段              | 说明                              |
| -------------- | ----------------- | ------------------------------- |
| `memory_store` | `memory_store_id` | 指定输入 Memory Store（必选，且仅允许一个）    |
| `sessions`     | `session_ids`     | 指定重点回顾的 Session（可选，最多 100 个 ID） |

## Dream output

Dream 完成后，`outputs` 数组中的元素：

| 字段                | 类型     | 说明                       |
| ----------------- | ------ | ------------------------ |
| `type`            | string | 固定值 `"memory_store"`     |
| `memory_store_id` | string | 整理后的输出 Memory Store ID   |
| `files_touched`   | array  | 被创建/修改/删除的 memory 文件路径列表 |

## Dream usage

| 字段                            | 类型      | 说明           |
| ----------------------------- | ------- | ------------ |
| `input_tokens`                | integer | 输入 token 数   |
| `output_tokens`               | integer | 输出 token 数   |
| `cache_creation_input_tokens` | integer | 缓存创建 token 数 |
| `cache_read_input_tokens`     | integer | 缓存读取 token 数 |

## Dream error

失败时返回的错误对象：

| 字段        | 类型     | 说明                                       |
| --------- | ------ | ---------------------------------------- |
| `type`    | string | 错误类型（如 `"no_output"`、`"internal_error"`） |
| `message` | string | 错误描述                                     |
