# 计算管理运行与生命周期公共对象

字段来自当前handler DTO及转换器。与管理列表不同，三生命周期沿普通computeResourceDTO，包含allowed_actions但不补workspace对象。

## computeResourceDTO

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `id` | string | 计算实例ID。 |
| `workspace_id` | string | 实例实际所属工作区，与鉴权头分开。 |
| `name` | string | 实例名称。 |
| `description` | string | 实例描述，可为空字符串。 |
| `kind` | string | task或query。 |
| `spec_id` | string | 关联规格ID。 |
| `cpu` | integer | 兼容CPU规格字段，单位核；不与cpu_milli混用。 |
| `memory_gib` | integer | 兼容内存规格字段，单位GiB。 |
| `gpu` | integer | 兼容GPU规格字段。 |
| `cpu_milli` | integer | 规格CPU，单位毫核。 |
| `memory_mib` | integer | 规格内存，单位MiB。 |
| `gpu_count` | integer | 规格GPU数量。 |
| `gpu_memory_mib` | integer | 规格GPU显存，单位MiB。 |
| `gpu_cores` | integer | 规格GPU核心字段。 |
| `min_replicas` | integer | 配置的最小副本字段，不等同当前观测副本。 |
| `max_replicas` | integer | 每个Worker类型的副本上限，不是所有类型的总和上限。 |
| `current_replicas` | integer | 当前实例汇总副本字段；与按类型观测分开。 |
| `desired_replicas` | integer | 实例目标副本字段，不表示已就绪。 |
| `go_worker_image_id` | string | 兼容Go Worker镜像ID，可为空。 |
| `python_worker_image_id` | string | 兼容Python Worker镜像ID，可为空。 |
| `worker_images` | object（对象数组），可省略 | 按Worker类型选择的镜像，可省略；每项字段见下表。 |
| `platform` | string | Worker平台配置。 |
| `auto_suspend_minutes` | integer | 自动暂停分钟配置，不是本次操作耗时保证。 |
| `scale_reason` | string | 最近扩缩或生命周期原因。 |
| `is_default` | boolean | 是否默认实例，可为false。 |
| `status` | string | 父实例状态；当前模型包含IDLE、DEPLOYING、SCALING、ACTIVE、DRAINING、SUSPENDED、TERMINATING、ERROR等，不与Worker状态合并。 |
| `status_message` | string | 状态文本，可为空。 |
| `py_requirements_txt` | string，可省略 | 可选的已保存Python依赖文本，非空时可能返回；当前typed SDK模型未声明此字段。 |
| `py_requirements_sha` | string，可省略 | 可选已保存依赖内容哈希；当前typed SDK模型未声明此字段。 |
| `py_deps` | object，可省略 | DTO声明可选观测对象，但本组三生命周期当前转换器不填充；不能依赖此字段读取安装进度。 |
| `created_by` | string | 创建主体。 |
| `allowed_actions` | string（字符串数组） | 允许动作投影；本组三生命周期不单独构造动作，空数组不是管理员资格判定。 |
| `last_activation_at` | string，可省略 | 最近激活时间，RFC3339，未记录时省略。 |
| `last_active_at` | string，可省略 | 最近活跃时间，RFC3339，未记录时省略。 |
| `created_at` | string | 创建时间，RFC3339。 |
| `updated_at` | string | 更新时间，RFC3339；不是调用者可提交的并发版本。 |

## computeResourceWorkerImageDTO

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `worker_type` | string，可省略 | Worker类型标识，不将任意类型简化成Go/Python二选一。 |
| `kind` | string，可省略 | 可选兼容Worker类型别名，优先看worker_type。 |
| `image_id` | string | 镜像ID。 |
| `platform` | string | Worker平台配置。 |

## computeResourcePyDepsDTO

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `status` | string | 声明的聚合依赖状态：EMPTY、INSTALLING、READY、FAILED；本组当前不填。 |
| `ready_count` | integer | 声明的依赖就绪实例数；本组三生命周期未填充该对象。 |
| `total_count` | integer | 声明的依赖观测实例总数。 |
| `last_error` | string，可省略 | 可选依赖错误；本组三生命周期不填充。 |

## computeResourceWorkerRuntimeDTO

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `compute_resource_id` | string | 关联父计算实例ID。 |
| `worker_type` | string | Worker类型标识，不将任意类型简化成Go/Python二选一。 |
| `status` | string | 该Worker类型记录的生命周期状态，与父实例状态分别回查。 |
| `desired_replicas` | integer | 该Worker类型的目标副本字段。 |
| `current_replicas` | integer | 该Worker类型的当前副本字段。 |
| `last_activation_at` | string，可省略 | 最近激活时间，RFC3339，未记录时省略。 |
| `last_active_at` | string，可省略 | 最近活跃时间，RFC3339，未记录时省略。 |
| `created_at` | string | 创建时间，RFC3339。 |
| `updated_at` | string | 更新时间，RFC3339；不是调用者可提交的并发版本。 |

## 当前实际填充范围

computeResourceDTO声明py_deps，但computeResourceToDTO当前不赋值。三生命周期不额外调用依赖聚合读取，故该对象不在当前成功示例中。字段声明不是这几条路径会返回观测的证据；缺失不能当成依赖功能关闭或安装完成。

py_requirements_txt/sha在已保存非空时被转换并返回，空时因omitempty省略。worker_images为空省略，allowed_actions即使nil也转成[]；两可选活跃时间缺失时省略。当前HTTP对象与typed SDK的字段集合不一致，兼容情况另见客户端页。

max_replicas是每个Worker类型的上限；父实例desired/current字段和runtime按类型字段分别回查，不由某一个数字保证全部已就绪。GET runtime当前无分页/单类型过滤，也不输出最后探测时间或外部Pod健康证明。
