# 计算管理公共对象

声明可选不等于每条接口都填充；这些接口列表/更新的py_deps未赋值。

## 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，可省略 | 非空时回显规范化依赖文本；当前typed SDK模型未声明。 |
| `py_requirements_sha` | string，可省略 | 非空时回显文本SHA256；当前typed SDK模型未声明。 |
| `py_deps` | object，可省略 | 声明的可选观测对象；当前列表/更新转换器未赋值，不承诺从这里读取安装进度。 |
| `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 | 声明的聚合依赖状态，当前列表/更新不填充。 |
| `ready_count` | integer | 声明的依赖就绪实例数。 |
| `total_count` | integer | 声明的观测实例总数。 |
| `last_error` | string，可省略 | 声明的可选错误文本。 |

## computeResourceBoundWorkflowDTO

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `id` | string | 绑定工作流ID。 |
| `name` | string | 绑定工作流名称。 |
| `node_names` | string（字符串数组），可省略 | 可选涉及节点名称数组；工作流级绑定未必有节点名。 |

## computeResourceDeletePreflightDTO

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `active_tasks` | integer | 当前收集到的活动任务数量。 |
| `active_task_ids` | string（字符串数组），可省略 | 可选活动任务ID数组，空时省略。 |
| `bound_workflows` | integer | 按工作流ID去重的绑定工作流数。 |
| `bound_workflow_details` | object（对象数组），可省略 | 可选绑定工作流明细，空时省略。 |

## computeResourceDeleteAckDTO

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `resource_id` | string | 已持久化删除意图的资源ID。 |
| `status` | string | TERMINATING，仅表示删除意图已持久化。 |

## computeResourceAdminWorkspaceDTO

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `id` | string | 实例实际所属工作区ID。 |
| `name` | string | 所属工作区名称。 |
| `owner_id` | string | 所属工作区Owner ID，不是调用者自动具备的管理权限。 |
| `account_name` | string | 所属工作区账号名。 |

## computeResourceAdminListDTO

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `items` | object（对象数组） | 管理资源数组；每项有workspace且没有allowed_actions。 |
| `total` | integer | 本次筛选的总条数，不是本页条数。 |
| `limit` | integer | 本次分页条数。 |
| `offset` | integer | 本次偏移量。 |

## 管理列表组合投影

computeResourceAdminDTO扁平展开computeResourceDTO，移除allowed_actions，再添加workspace对象；其四字段均非omitempty。组合不作为新的一组独立底层字段重复统计。更新则保留普通资源allowed_actions而不包含workspace。

## 更新镜像与依赖

镜像每项可使用worker_type或兼容kind别名，同时提交必须一致；image_id需在ACTIVE目录且类型匹配，platform需匹配镜像逗号分隔的平台之一。提交完整worker_images时须覆盖当前目录全部类型且不重复，不能用[]恢复默认；SDK注释“仅默认镜像”不能替代当前服务校验。

非空依赖按当前动态开关、原始字节上限、规范化行数及来源白名单校验，不硬编码部署限额。CRLF/CR转LF，每行去尾部空格/Tab，去空行，非空结果末尾补换行后计算小写SHA256。只允许支持的依赖语法及索引/来源形式，不能把任意pip选项当作支持；原始空字符串直接清空，不要求安装能力启用。更新保存不证明已安装成功。
