自动化

弃用脚本版本

记录版本弃用说明。

记录版本弃用说明;message 为空字符串时取消弃用,版本源码不变。

POST /automation/v1/scripts/{ns}/{name}/versions/{version}/deprecate

鉴权

Authorization: Bearer $PRAXIS_API_KEY

请求字段

参数类型说明
path: nsstring必填;命名空间,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63};praxis 只读。
path: namestring必填;名称,存储前转为小写,格式 [a-z0-9][a-z0-9._-]{0,63}。
path: versionstring必填;规范的精确语义版本,例如 1.2.0 或 1.3.0-beta.1;不能是范围。

application/json

不接受额外字段。

字段类型说明
messagestring必填 / 必有;弃用说明;空字符串取消弃用。

示例

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

变量来源
SCRIPT_NAME创建脚本返回的 name
: "${SCRIPT_NAME:?Set SCRIPT_NAME}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/scripts/docs-samples/${SCRIPT_NAME}/versions/1.0.0/deprecate" \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "message": ""
}'
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.scripts.versions.deprecate({
  "path": {
    "ns": "docs-samples",
    "name": env("SCRIPT_NAME"),
    "version": "1.0.0"
  },
  "body": {
    "message": ""
  }
});
console.log(result);

响应

HTTP 200

Success

application/json

字段类型说明
idstring必填 / 必有;版本 ID,脚本前缀 scv_,工作流前缀 wfv_。
kind"script" / "workflow"必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。
versionstring必填 / 必有;版本号(semver,已去掉 +build 元数据)。
digeststring必填 / 必有;源码与契约的内容摘要。
sourcestring必填 / 必有;该版本的完整源码。版本列表默认不返回,需要时加 expand=source。
input_schemaobject必填 / 必有;任意 JSON 对象(键为字符串,值为任意 JSON 值)。
input_schema.*(分支5)object递归 JSON 值。
input_schema.*(分支6)[]null / string / number / boolean / object / JSON[]递归 JSON 值。
output_schemaobject必填 / 必有;脚本从返回类型推导,支持 Promise 解包、Record、交叉类型和 Date(date-time);推不出时为空 schema,并在 /validate 的 warnings 给出 warning。
output_schema.*(分支5)object递归 JSON 值。
output_schema.*(分支6)[]null / string / number / boolean / object / JSON[]递归 JSON 值。
referencesobject[]必填 / 必有;该版本依赖的动作、平台 API、脚本与工作流。脚本和工作流依赖在发布时锁定到精确版本。
references[].kind"action" / "script" / "workflow" / "platform_api" / "run"必填 / 必有;依赖类型。action 为动作;platform_api 为平台 API 操作;script 为脚本;workflow 为工作流;run 为脚本中 invoke("ns/name") 调用的子运行目标(脚本或工作流,发布时解析)。
references[].namestring必填 / 必有;被依赖对象:动作为 ns/name,平台 API 为操作名,脚本与工作流为 ns/name。
references[].rangestring可选;引用时写的版本范围或标签(npm 规则);未写时为空。
references[].locked_versionstring可选;发布时锁定的精确版本;仅脚本与工作流依赖有,动作与平台 API 不锁定。
outlinenull / object[]必填 / 必有;工作流的步骤大纲(OutlineNode 数组),由解析器静态生成;脚本为 null。
outline(分支2)[].namestring必填 / 必有;步骤名,即工作流 YAML 中该步骤的键。
outline(分支2)[].referencestring必填 / 必有;该步骤在工作流文档中的 JSON Pointer,例如 /do/0/start;与运行时 Task.reference 一致。
outline(分支2)[].kind"run" / "call" / "wait" / "set" / "for" / "fork" / "try" / "switch" / "emit" / "raise" / "listen" / "do"必填 / 必有;工作流步骤类型。call 调用动作;run 运行子脚本或子工作流;wait 等待时长;set 设置变量;for 循环;fork 并行分支;try 带捕获的块;switch 条件分支;emit 发出事件;raise 抛出错误;listen 等待事件;do 顺序执行的步骤块。
outline(分支2)[].targetstring可选;步骤调用的目标:call 步骤为动作 ns/name,run 步骤为 ns/name@范围;其它类型没有。
outline(分支2)[].waitobject可选;等待步骤的摘要:时长(seconds 或 duration)或等待的事件类型(event)。 不接受额外字段。
outline(分支2)[].wait.untilstring可选;等待结束的绝对时刻,仅在可静态确定时给出;目前大纲不填充该字段。
outline(分支2)[].wait.secondsnumber可选;可静态换算的等待秒数;时长对象与可换算的 ISO 时长均投影到此字段。
outline(分支2)[].wait.eventstring可选;listen 步骤等待的事件类型。
outline(分支2)[].wait.durationstring可选;无法静态换算成秒的原始时长或运行时表达式;不与 seconds 强行换算。
outline(分支2)[].loopobject可选;for 步骤的循环信息 {each, in}。 不接受额外字段。
outline(分支2)[].loop.eachstring必填 / 必有;循环变量名;未指定时为 item。
outline(分支2)[].loop.instring必填 / 必有;被遍历的集合表达式原文。
outline(分支2)[].childrenobject[]可选;嵌套的子步骤(do、fork 分支、try 与 catch 内的步骤)。
outline(分支2)[].children[]object递归 JSON 值。
sdk_versionnull / string必填 / 必有;发布脚本所用的 SDK 版本;工作流为 null。
published_atstring必填 / 必有;发布时间(RFC 3339 UTC)。
published_byobject必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。
published_by.type"user" / "api_key" / "agent" / "run" / "trigger"必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。
published_by.idstring必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。
deprecatednull / string必填 / 必有;弃用说明;未弃用为 null。弃用的版本仍可运行,但按范围或标签解析时优先选用未弃用的版本。
deprecated_atnull / string必填 / 必有;弃用时间(RFC 3339 UTC);未弃用为 null。
deprecated_bynull / object必填 / 必有;执行弃用的主体;未弃用为 null。
deprecated_by(分支2).type"user" / "api_key" / "agent" / "run" / "trigger"必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。
deprecated_by(分支2).idstring必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。

实测响应

HTTP 200

{
  "id": "scv_00mv67lza679fc5498438040079f0c5684208c4915",
  "kind": "script",
  "version": "1.0.0",
  "digest": "7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d",
  "input_schema": {
    "type": "object",
    "properties": {
      "n": {
        "type": "number"
      }
    },
    "required": [
      "n"
    ]
  },
  "output_schema": {
    "type": "object",
    "properties": {
      "answer": {
        "type": "number"
      }
    },
    "required": [
      "answer"
    ]
  },
  "references": [],
  "outline": null,
  "sdk_version": "0.1.0",
  "published_at": "2026-10-13T04:57:22.398Z",
  "published_by": {
    "type": "api_key",
    "id": "key_3e00b8984967"
  },
  "deprecated": null,
  "deprecated_at": null,
  "deprecated_by": null,
  "source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });"
}

错误码

HTTP错误码与说明
400INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。
403NAMESPACE_FORBIDDEN:命名空间只读或运行令牌不允许此调用。
404TARGET_NOT_FOUND:编排目标不存在或类型不匹配。 VERSION_NOT_FOUND:指定版本或修订不存在。
409TARGET_ARCHIVED:目标已归档,不能用于本操作;动作执行错误的 detail 包含 ns/name。
412PRECONDITION_FAILED:修订、源码摘要或并发写入条件不匹配。
defaultRFC 9457 automation problem. 429 includes Retry-After.

鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。

导出

本页内容