# 列出动作修订 (/docs/api/native/automation/listActionRevisions)





按创建时间倒序列出修订。结果包含当前标记及通过兼容门回滚的可行性和原因。 默认不带源码；仅 expand=source 带完整源码，其它值返回 400。详情接口保持全文。

`GET /automation/v1/actions/{ns}/{name}/revisions`

## 鉴权 [#鉴权]

`Authorization: Bearer $PRAXIS_API_KEY`

## 请求字段 [#请求字段]

| 参数 | 类型 | 说明 |
| --- | --- | --- |
| path: ns | `string` | 必填；命名空间，存储前转为小写，格式 [a-z0-9][a-z0-9._-]&#123;0,63&#125;；praxis 只读。 |
| path: name | `string` | 必填；名称，存储前转为小写，格式 [a-z0-9][a-z0-9._-]&#123;0,63&#125;。 |
| query: limit | `integer` | 可选；每页条数，整数 1–100，默认 20。 minimum: 1；maximum: 100 |
| query: cursor | `string` | 可选；上一页返回的 next_cursor，不透明字符串；保持原查询条件继续翻页。 |
| query: expand | `"source"` | 可选；仅接受 source；默认不带源码，其它值返回 400。 |

## 示例 [#示例]

[SDK 安装与示例环境](/docs/api/native/automation)

先设置以下环境变量，使用你自己的资源：

| 变量 | 来源 |
| --- | --- |
| ACTION_NAME | [创建动作返回的 name](/docs/api/native/automation/createAction) |

```bash
: "${ACTION_NAME:?Set ACTION_NAME}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/actions/docs-samples/${ACTION_NAME}/revisions" \
  -H "Authorization: Bearer $PRAXIS_API_KEY"
```

```typescript
import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';

function env(name: string): string {
  const value = process.env[name];
  if (!value) throw new Error(`Set ${name}`);
  return value;
}
const automation = createAutomationClient({
  apiKey: env('PRAXIS_API_KEY'),
  baseUrl: 'https://api.deepraxis.ai',
  maxRetries: 0,
  timeoutMs: 90_000,
});
const result = await automation.actions.revisions.list({
  "path": {
    "ns": "docs-samples",
    "name": env("ACTION_NAME")
  }
});
console.log(result);
```

## 响应 [#响应]

### HTTP 200 [#http-200]

Success

`application/json`

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| data | `object[]` | 必填 / 必有；本页的动作修订（默认不含实现源码，expand=source 才带），按 created_at 倒序、id 倒序排列。 |
| data[].current | `boolean` | 必填 / 必有；true 表示这是动作当前生效的修订。 |
| data[].rollback | `object` | 必填 / 必有；回滚到该修订是否可行，由服务端对当前修订做兼容判定。 不接受额外字段。 |
| data[].rollback.allowed | `boolean` | 必填 / 必有；true 表示可以回滚到此修订；false 时 issues 说明原因。 |
| data[].rollback.issues | `object[]` | 必填 / 必有；回滚会产生的不兼容项，每项含 pointer 与 reason；allowed 为 true 时为空数组。 |
| data[].rollback.issues[].pointer | `string` | 必填 / 必有；不兼容位置的 JSON Pointer（RFC 6901），相对于动作的 input_schema 或 output_schema。 |
| data[].rollback.issues[].reason | `string` | 必填 / 必有；该位置为何与历史修订不兼容（输入应放宽、输出应收紧）。 |
| data[].id | `string` | 必填 / 必有；修订 ID，前缀 actr_；仅用于展示与回滚（rollback 的 revision），不能被脚本直接引用。 |
| data[].digest | `string` | 必填 / 必有；契约与实现的内容摘要；内容相同的更新不会产生新修订。 |
| data[].input_schema | `object` | 必填 / 必有；任意 JSON 对象（键为字符串，值为任意 JSON 值）。 |
| data[].input_schema.*（分支5) | `object` | 递归 JSON 值。 |
| data[].input_schema.*（分支6)[] | `null` / `string` / `number` / `boolean` / `object` / `JSON[]` | 递归 JSON 值。 |
| data[].output_schema | `object` | 必填 / 必有；任意 JSON 对象（键为字符串，值为任意 JSON 值）。 |
| data[].output_schema.*（分支5) | `object` | 递归 JSON 值。 |
| data[].output_schema.*（分支6)[] | `null` / `string` / `number` / `boolean` / `object` / `JSON[]` | 递归 JSON 值。 |
| data[].errors | `object[]` | 必填 / 必有；动作声明的可能错误列表，每项含 type、code、description。 |
| data[].errors[].type | `string` | 必填 / 必有；错误类型：稳定的 URI，或 Open Workflow 标准类型（如 validation、timeout、communication、runtime）。 |
| data[].errors[].code | `string` | 可选；可选的稳定错误码，供调用方按码分支处理。 |
| data[].errors[].description | `string` | 必填 / 必有；该错误的含义与触发条件，面向调用方阅读。 |
| data[].annotations | `object` | 必填 / 必有；动作行为声明 &#123;read_only, idempotent&#125;；创建时未给出的键默认为 false。 不接受额外字段。 |
| data[].annotations.read_only | `boolean` | 必填 / 必有；true 表示动作不修改外部状态，只读取数据。 |
| data[].annotations.idempotent | `boolean` | 必填 / 必有；true 表示同一输入重复调用与调用一次效果相同；此类动作的重试使用同一幂等键（run_id 加步骤路径，不含尝试次数）。 |
| data[].timeout_ms | `number` | 必填 / 必有；单次执行的超时毫秒数；创建时未给出，code 实现默认 30000，容器或 shell 实现默认 600000。 |
| data[].implementation | `object` / `object` / `object` / `object` | 必填 / 必有；实现信息：完整实现，或仅含 kind；列表不返回源码，需源码用 expand=source 或读取单个修订。 |
| data[].implementation（分支1)（分支1).kind | `"code"` | 必填 / 必有；固定为 code：以源码实现。 |
| data[].implementation（分支1)（分支1).language | `"ts"` | 必填 / 必有；源码语言，目前只支持 ts（TypeScript）。 |
| data[].implementation（分支1)（分支1).source | `string` | 必填 / 必有；动作的完整 TypeScript 源码；内置动作为空。 |
| data[].implementation（分支1)（分支2).kind | `"container"` | 必填 / 必有；固定为 container：以容器镜像实现（暂未开放）。 |
| data[].implementation（分支1)（分支2).image | `string` | 必填 / 必有；容器镜像引用。 |
| data[].implementation（分支1)（分支2).command | `string[]` | 必填 / 必有；在容器中执行的命令及参数列表。 |
| data[].implementation（分支1)（分支3).kind | `"shell"` | 必填 / 必有；固定为 shell：以 shell 脚本实现（暂未开放）。 |
| data[].implementation（分支1)（分支3).script | `string` | 必填 / 必有；要执行的 shell 脚本全文。 |
| data[].implementation（分支2).kind | `"code"` / `"container"` / `"shell"` | 必填 / 必有；动作实现方式。code 为源码实现（目前仅 language=ts 可用）；container 为容器镜像加命令，暂未开放；shell 为 shell 脚本，暂未开放。 |
| data[].host | `"builtin"` / `"isolate"` / `"sandbox"` | 必填 / 必有；动作运行位置，发布时计算。builtin 为平台内置动作；isolate 为在隔离的 Worker isolate 中运行用户代码；sandbox 为在沙箱中运行（container 与 shell 实现）。 |
| data[].platform_apis | `string[]` | 必填 / 必有；从代码推导出的平台 API 集合，同时是该动作运行令牌的权限范围（最小权限）。 |
| data[].created_by | `object` | 必填 / 必有；网关注入的主体 &#123;type, id&#125;，表示谁发起或操作；本服务不解析名字，名字由控制台批量解析。 不接受额外字段。 |
| data[].created_by.type | `"user"` / `"api_key"` / `"agent"` / `"run"` / `"trigger"` | 必填 / 必有；主体类型。user 为登录用户；api_key 为平台 API Key；agent 为智能体；run 为由运行本身（例如父运行）执行的操作；trigger 为触发器。 |
| data[].created_by.id | `string` | 必填 / 必有；主体标识，含义随 type 而定：用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID；按不透明字符串处理。 |
| data[].message | `null` / `string` | 必填 / 必有；创建该修订时附带的说明；未提供为 null。 |
| data[].created_at | `string` | 必填 / 必有；该修订的创建时间（RFC 3339 UTC）。 |
| next_cursor | `null` / `string` | 必填 / 必有；下一页游标，原样传给 cursor 参数并保持原查询条件；没有更多页为 null。接口不返回总数。 |

### 实测响应 [#实测响应]

HTTP 200

```json
{
  "data": [
    {
      "id": "actr_00mv67lrt1370820a9daaa4fd3882332e4899a4c9e",
      "digest": "e35c209873c60486ca8da455878062cb7ea572a6147ce3ca03e0693b4769fa45",
      "input_schema": {
        "type": "object",
        "properties": {
          "n": {
            "type": "number"
          }
        },
        "required": [
          "n"
        ],
        "additionalProperties": false
      },
      "output_schema": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "number"
          }
        },
        "required": [
          "answer"
        ],
        "additionalProperties": false
      },
      "errors": [],
      "annotations": {
        "read_only": false,
        "idempotent": false
      },
      "timeout_ms": 30000,
      "host": "isolate",
      "platform_apis": [],
      "created_by": {
        "type": "api_key",
        "id": "key_3e00b8984967"
      },
      "message": "Sample revision",
      "created_at": "2026-10-13T04:57:12.709Z",
      "current": true,
      "rollback": {
        "allowed": true,
        "issues": []
      },
      "implementation": {
        "kind": "code"
      }
    },
    {
      "id": "actr_00mv67loz3e46938b8ecf54e57b8f31297df016a1c",
      "digest": "e35c209873c60486ca8da455878062cb7ea572a6147ce3ca03e0693b4769fa45",
      "input_schema": {
        "type": "object",
        "properties": {
          "n": {
            "type": "number"
          }
        },
        "required": [
          "n"
        ],
        "additionalProperties": false
      },
      "output_schema": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "number"
          }
        },
        "required": [
          "answer"
        ],
        "additionalProperties": false
      },
      "errors": [],
      "annotations": {
        "read_only": false,
        "idempotent": false
      },
      "timeout_ms": 30000,
      "host": "isolate",
      "platform_apis": [],
      "created_by": {
        "type": "api_key",
        "id": "key_3e00b8984967"
      },
      "message": null,
      "created_at": "2026-10-13T04:57:09.039Z",
      "current": false,
      "rollback": {
        "allowed": true,
        "issues": []
      },
      "implementation": {
        "kind": "code"
      }
    }
  ],
  "next_cursor": null
}
```

## 错误码 [#错误码]

| HTTP | 错误码与说明 |
| --- | --- |
| 400 | INVALID_PARAMS：请求参数、路径、游标或请求体格式无效。 |
| 404 | ACTION_NOT_FOUND：动作不存在或当前租户不可见；同名脚本/工作流存在时，hint 指向相应接口。 |
| default | RFC 9457 automation problem. 429 includes Retry-After. |

[鉴权错误与通用错误](/docs/api/errors) · 排查时保留响应头 `X-Request-Id`。
