<span id="计算管理公共对象"></span>

# Compute administration common objects

An optional declaration does not mean every API populates the field. These list and update APIs do not populate py_deps.

## computeResourceDTO

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Compute instance ID. |
| `workspace_id` | string | The workspace that owns the instance, separate from the authentication header. |
| `name` | string | Instance name. |
| `description` | string | Instance description; may be an empty string. |
| `kind` | string | task or query. |
| `spec_id` | string | Associated specification ID. |
| `cpu` | integer | Legacy CPU specification in cores; do not confuse it with cpu_milli. |
| `memory_gib` | integer | Legacy memory specification in GiB. |
| `gpu` | integer | Legacy GPU specification. |
| `cpu_milli` | integer | CPU specification in millicores. |
| `memory_mib` | integer | Memory specification in MiB. |
| `gpu_count` | integer | Number of GPUs in the specification. |
| `gpu_memory_mib` | integer | GPU memory specification in MiB. |
| `gpu_cores` | integer | GPU core specification. |
| `min_replicas` | integer | Configured minimum replicas, distinct from currently observed replicas. |
| `max_replicas` | integer | Replica limit per Worker type, not a combined limit across all types. |
| `current_replicas` | integer | Current aggregate instance replica count, separate from observations by type. |
| `desired_replicas` | integer | Target instance replica count; does not indicate readiness. |
| `go_worker_image_id` | string | Legacy Go Worker image ID; may be empty. |
| `python_worker_image_id` | string | Legacy Python Worker image ID; may be empty. |
| `worker_images` | object (array of objects), optional | Images selected by Worker type; may be omitted. See the item fields below. |
| `platform` | string | Worker platform configuration. |
| `auto_suspend_minutes` | integer | Auto-suspension setting in minutes, not a completion-time guarantee for this operation. |
| `scale_reason` | string | Most recent scaling or lifecycle reason. |
| `is_default` | boolean | Whether this is the default instance; may be false. |
| `status` | string | Parent instance state. The current model includes IDLE, DEPLOYING, SCALING, ACTIVE, DRAINING, SUSPENDED, TERMINATING, and ERROR. Keep this separate from Worker states. |
| `status_message` | string | Status text; may be empty. |
| `py_requirements_txt` | string, optional | Normalized dependency text when nonempty; not declared in the current typed SDK model. |
| `py_requirements_sha` | string, optional | SHA256 of the text when nonempty; not declared in the current typed SDK model. |
| `py_deps` | object, optional | Optional observation object declared by the model. Current list and update converters do not populate it; do not rely on it for installation progress. |
| `created_by` | string | Creating principal. |
| `allowed_actions` | string (array of strings) | Regular resource projection; update results may contain []. Administrative lists remove this field. Do not use it to determine administrator eligibility. |
| `last_activation_at` | string, optional | Last activation time in RFC3339; omitted if not recorded. |
| `last_active_at` | string, optional | Last activity time in RFC3339; omitted if not recorded. |
| `created_at` | string | Creation time in RFC3339. |
| `updated_at` | string | Update time in RFC3339; not a caller-supplied concurrency version. |

## computeResourceWorkerImageDTO

| Field | Type | Description |
| --- | --- | --- |
| `worker_type` | string, optional | Worker type identifier. Do not reduce arbitrary types to a Go/Python choice. |
| `kind` | string, optional | Optional legacy Worker type alias. If provided with worker_type, the two must agree. |
| `image_id` | string | Image ID. |
| `platform` | string | Worker platform configuration. |

## computeResourcePyDepsDTO

| Field | Type | Description |
| --- | --- | --- |
| `status` | string | Declared aggregate dependency state; not populated by current list or update APIs. |
| `ready_count` | integer | Declared number of instances with dependencies ready. |
| `total_count` | integer | Declared total number of observed instances. |
| `last_error` | string, optional | Declared optional error text. |

## computeResourceBoundWorkflowDTO

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Bound workflow ID. |
| `name` | string | Bound workflow name. |
| `node_names` | string (array of strings), optional | Optional names of affected nodes. Workflow-level bindings may have no node names. |

## computeResourceDeletePreflightDTO

| Field | Type | Description |
| --- | --- | --- |
| `active_tasks` | integer | Number of active tasks collected at this time. |
| `active_task_ids` | string (array of strings), optional | Optional active task IDs; omitted when empty. |
| `bound_workflows` | integer | Number of bound workflows, deduplicated by workflow ID. |
| `bound_workflow_details` | object (array of objects), optional | Optional bound workflow details; omitted when empty. |

## computeResourceDeleteAckDTO

| Field | Type | Description |
| --- | --- | --- |
| `resource_id` | string | Resource ID whose deletion intent has been persisted. |
| `status` | string | TERMINATING; only indicates that deletion intent has been persisted. |

## computeResourceAdminWorkspaceDTO

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | ID of the workspace that owns the instance. |
| `name` | string | Owning workspace name. |
| `owner_id` | string | Owning workspace Owner ID; does not automatically grant administrative privileges to the caller. |
| `account_name` | string | Owning workspace account name. |

## computeResourceAdminListDTO

| Field | Type | Description |
| --- | --- | --- |
| `items` | object (array of objects) | Administrative resource array. Each item includes workspace and excludes allowed_actions. |
| `total` | integer | Total number of matching records, not the number on this page. |
| `limit` | integer | Page size used for this request. |
| `offset` | integer | Offset used for this request. |

<span id="管理列表组合投影"></span>

## Administrative list projection

computeResourceAdminDTO flattens computeResourceDTO, removes allowed_actions, and adds a workspace object whose four fields are not omitempty. This composition is not counted again as a separate group of underlying fields. Updates retain the regular resource allowed_actions field and exclude workspace.

<span id="更新镜像与依赖"></span>

## Update images and dependencies

Each image entry accepts worker_type or its legacy kind alias; both must agree if provided. image_id must be ACTIVE in the catalog and match the type. platform must match one of the image's comma-separated platforms. A complete worker_images submission must cover every type in the current catalog without duplicates. [] cannot restore defaults. The SDK comment about default images alone does not replace current service validation.

Nonempty dependencies are validated against the current dynamic feature flag, raw byte limit, normalized line count, and source allowlist; do not hardcode deployment limits. CRLF and CR become LF. Trailing spaces and tabs and empty lines are removed. A final newline is added to a nonempty result before calculating lowercase SHA256. Only supported dependency syntax and index/source forms are accepted; arbitrary pip options are not supported. A raw empty string clears dependencies directly without requiring installation support to be enabled. Saving an update does not prove installation succeeded.
