Skip to content
Back to skills

Ontoplato Workflow Operator

ASecurity

以当前登录主体身份在 OntoPlato 与 Praxis 上办理当前待办:查询 pending/inbox 待办与已授权动作(my-actions/workflows/find/action),按单步推进执行拉式 Action(run)或 Praxis 审批办理(start/decide/assign/case),以及在需要时创建并清理临时 Workflow。

  • 13 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentsbashsqlnodeapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add ontomato-ai/OntoPlato --skill ontoplato-workflow-operator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ontoplato Workflow Operator?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ontoplato Workflow Operator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ontomato-ai-ontoplato-workflow-operator-ontoplato/badge)](https://www.skillsdirectory.com/skills/ontomato-ai-ontoplato-workflow-operator-ontoplato)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ontoplato-workflow-operator
description: "以当前登录主体身份在 OntoPlato 与 Praxis 上办理当前待办:查询 pending/inbox 待办与已授权动作(my-actions/workflows/find/action),按单步推进执行拉式 Action(run)或 Praxis 审批办理(start/decide/assign/case),以及在需要时创建并清理临时 Workflow。"
compatibility: Node.js 24+
---

# 业务办理

本技能只做一件事:**以当前登录主体的身份,把当前轮到自己的那一步办掉;或在确有需要时搭一条一次性临时流程并闭环清理。**

设计公司固定流程、维护概念组件、建组织/角色/权限不归本技能,分别见 `ontoplato-workflow-admin` 与 `ontoplato-permission`。

---

## 连接方式与前置条件

- 运行环境需具备 Node.js 24+(脚本只使用 Node 内置模块),且目标 OntoPlato 服务与 Praxis 已启动、当前账号在目标域内拥有有效身份。
- 下文 `<this-skill>` 表示本技能 `SKILL.md` 所在目录;JSON 参数支持内联 JSON(`{...}`)、文件路径(`file.json`)或 `@file.json`;所有写命令均支持 `--dry-run`(纯本地打印请求,不登录、不访问服务端、不执行动作)。
- 端点配置(基于平台前端基础地址 `ONTOMATO_URL` / `<envUrl>` 如 `http://host:3000`,缺省时回退读取当前目录或技能目录 `application.yml`):
  - `ONTOMATO_ONTOLOGY_URL`(或 `OA_BASE`):数据引擎入口,默认 `<envUrl>/api/data-query`;
  - `ONTOMATO_PRAXIS_URL`(或 `PRAXIS_BASE`):Praxis 产品统一鉴权入口,默认派生为 `<envUrl>/api/praxis`(脚本会自动从当前登录用户获取 `domainId`,无需手工拼接;仅 superAdmin 跨域操作时显式传 `--domain <domainId>`);
  - `OA_AUTH`(仅用户名 + 密码模式需要覆盖认证入口时配置)。
- 认证方式(无默认账号;优先级:平台托管回调 `ONTOMATO_EXECUTION_CALLBACK` > 命令行参数 `--token` / `--api-key` / `--user`+`--password` > 环境变量 `ONTOMATO_API_KEY` > `ONTOMATO_TK` > `OA_CODE`+`OA_PASS`+`OA_DOMAIN` > `application.yml`):
  1. **OntoPlato API Key**:`ONTOMATO_API_KEY`(兼容 `OA_API_KEY`)或 `--api-key <key>`;
  2. **平台 token**:`ONTOMATO_TK`(兼容 `OA_TOKEN`)或命令行 `--token <tk>`;
  3. **用户名 + 密码**:`OA_CODE` + `OA_PASS` + `OA_DOMAIN` 或 `--user` / `--password` / `--domain`。
- 平台 Agent 运行时会自动注入回调地址与凭据;平台外独立运行时配置环境变量或 `application.yml` 即可,命令完全一致。
- `ONTOMATO_CALLER_TK` 仅由数据引擎在 Action 运行时内部注入给 `query_runtime` 的 `praxis_*` 脚手架使用,不是使用方需要配置或传入的值。
- 业务对象与账本由管理员配置为 `multiSource` 只读/可写路由;使用方只读 Run、Step 和 Case,不改动适配器、schema 或账本路由。

```bash
node <this-skill>/scripts/client.mjs me
node <this-skill>/scripts/client.mjs ping
node <this-skill>/scripts/client.mjs praxis-health
node <this-skill>/scripts/client.mjs my-actions
```

---

## 1. 先分清两条执行路径与路由顺序

平台同时存在两条推进路径,语义不同:

| 维度 | 路径 A:OntoPlato 拉式动作(`run`) | 路径 B:Praxis 账本流转(`start` / `inbox` / `decide`) |
| --- | --- | --- |
| 谁判定轮到谁 | Action 自身的 `submissionCriteria`(状态 / 节点 / 负责人) | Run 的 step 状态 + `assignedTo` / `assignee` + 候选人目录 |
| 如何推进 | 直接调用 `run <actionId> <json>` | `inbox` 找 `waiting` 步,通过 `decide <stepId> approve\|reject` 推进 |
| 是否有账本 | 无;状态仅记录在业务对象上 | 有;留存 `workflow_run` / `workflow_case` / `step_run` 与审计事件 |
| 适用场景 | 不属于固定流程的独立动作或显式拉式执行 | 固定流程、待办审批、审计留痕、规则/Agent 派单、Case 临时流程 |

**核心铁律:**

- **绝不对同一件事既 `run` 又 `decide`**:只要步骤已在 Praxis Run 中,必须走 `inbox` → `decide`,直接 `run` 会绕过账本或重复执行审批动作。
- **一次只执行当前 step**:确定当前 `pending` / `inbox` 中属于本主体的那一个 step 并执行一次;成功后立刻停止,回读业务对象或 Run 状态向用户汇报,**绝不连带执行后续 step**。
- **通用路由顺序**:
  1. 收到“提交、推荐、审批、确认、任命、离职、晋升”等业务意图时,先运行 `workflows "<用户原话>"`;若需处理已有待办,同时查看 `inbox` / `pending`。
  2. 只要有匹配的 ACTIVE Workflow,就属于固定流程,必须走 Praxis:已有待办走 `inbox` / `pending` → `decide`;新发起走 `template` → `start` → 对当前首个承办步骤 `decide`。
  3. 仅当 `workflows` 无匹配项,或用户明确点名执行不属于任何 ACTIVE Workflow 的独立 Action 时,才走 `run`。
  4. **不要因 Action 未出现在 `my-actions` 就误判“无权限”**:`caseScoped` 步骤按设计不会写入角色级全局授权,其执行权限只在具体 Run 的当前承办步骤上由 Praxis 签发。
  5. 命中多个 Workflow 时,按流程名、步骤名、Action 名与当前角色选最具体的一项;仍有歧义先读候选流程的 `template`,不要猜。
- **自己办不了时先看组织子树**:运行 `node <this-skill>/scripts/client.mjs org-graph`,查看本组织及下级单位(`units`)、成员与有效角色(`members`)、角色已授权能力(`roles[].capabilities`)、建流程候选标志(`roles[].canCreateWorkflow`)及 Case 只读类信息(`caseClass` / `caseApi`)。没有权限时不要反复重试,按错误信息联系管理员。

---

## 2. 身份、发现与待办查询

```bash
node <this-skill>/scripts/client.mjs my-actions                    # 当前主体可独立执行的已发布 Action 及完整参数
node <this-skill>/scripts/client.mjs workflows "我要请假两天"        # 匹配 ACTIVE Workflow、步骤、角色与 Action
node <this-skill>/scripts/client.mjs template <workflowId>         # 查看冻结模板步骤(s1/s2…)
node <this-skill>/scripts/client.mjs find "采购审批" [className]    # 在已授权动作中按语义/关键词筛选
node <this-skill>/scripts/client.mjs action <actionId>             # 查看动作完整参数(类型/枚举/说明/logic)
node <this-skill>/scripts/client.mjs pending [limit] [--flow <id>] # 平台生成的“我的待办”业务对象查询
node <this-skill>/scripts/client.mjs inbox                         # Praxis 账本中属于我的 waiting 待办
```

- `my-actions` 返回当前主体的有效角色、`ACTIVE` 流程授权与直接授权中 `status=PUBLISHED` 的动作(含来源 `source=process|direct`、流程 ID、版本与参数定义)。若无角色会明确提示 `This subject holds no role in this domain.`。
- **严禁靠反复试跑或 `--dry-run` 探测参数**:先从 `my-actions` 或 `action <actionId>` 读取真实参数定义。
- `pending`(OntoPlato 业务对象视图)与 `inbox`(Praxis 账本视图)是两套独立视图,以业务对象 ID 做交叉对照,不要假设条数完全一致;候选目录退化时 `inbox` 仍返回已钉给你的步骤。

---

## 3. 路径 A:OntoPlato 拉式执行(`run`)

```bash
node <this-skill>/scripts/client.mjs run act_leave_start '{
  "title":"10月客户拜访",
  "dept":"研发部",
  "days":"2",
  "reason":"客户现场"
}'
```

- 底层调用 multipart `/action/execute`,参数键名与 Action 的 `function.parameters` 对齐;缺参报 `Missing parameter: <name>`(`null` 允许,空串与 `0` 视为真实值)。
- 授权、作用域与 `submissionCriteria` 全部由服务端判定,客户端不做二次猜测。
- **仅出现在 ACTIVE 流程 `caseScoped` 步骤中的 Action,普通 `run` 会直接返回未授权**——必须走 Praxis `inbox` → `decide`,绝不尝试补角色授权或绕过 `assignedTo`。
- 常见业务拒绝:非当前回合(前置条件失败)、无权限(`notGranted`)、作用域外(`Action.targetOutsideScope`)、动作未发布/已冻结(`Action.notPublished` / `publishedIsFrozen`)。

---

## 4. 路径 B:Praxis 账本流转

### 4.1 发起新 Run 与绑定业务对象

```bash
node <this-skill>/scripts/client.mjs start <workflowId> '{"s1":{"title":"10月客户拜访","days":"2"}}'
node <this-skill>/scripts/client.mjs start <workflowId> --no-auto
node <this-skill>/scripts/client.mjs tick <runId>
node <this-skill>/scripts/client.mjs bind <runId> leave_request <业务对象id>
```

固定流程自然语言发起标准链:

1. `workflows "<用户原话>"` 命中唯一最具体的 ACTIVE Workflow;
2. `template <workflowId>` 核对首个步骤、角色、Action 与参数;
3. 从用户原话提取首步参数,调用 `start <workflowId> '{"s1":{...}}'`(`requester` 由当前 token 决定,不能替他人发起;默认自动 tick,`--no-auto` 仅建 Run 后续用 `tick` 推进);
4. 对返回的当前首个待办 `stepId` 执行 `decide`,成功后立即停止。

绑定与业务事实要点:

- 审批动作的 `run_id` 是**业务对象 ID**(不是 Praxis Run ID)。若创建型 Action 按契约返回了 `targetClass` 和 `run_id`(或 `id`),Praxis 会自动绑定 `actsOn`,无需手工 `bind`;若返回 `{"completed":true}` 且未绑定业务对象,应立即报告流程绑定配置缺陷,不能假装正常继续。
- 晋升/职务变更类申请不预建目标任职历史记录(如发起时创建 `tech_gwdj_apply`,最终聘任通过后再关闭旧历史并写入真实 `tech_gwdj`)。

复核业务对象状态使用 `dsl` 命令(传入标准本体图谱 DSL JSON,不要用 SQL 或简写对象):

```bash
node <this-skill>/scripts/client.mjs dsl '{"problem":"read record","answer":{"steps":[{"graph":{"patterns":[{"objects":[{"idx":0,"variable":"x","class":"tech_duty","conditions":{"properties":{"field":"id","operator":"=","value":"td-1"}}}]}],"pattern_logic":"and"},"output":{"to_user":true,"fields":[{"as":"id","variable":"x","field":"id"},{"as":"current_step","variable":"x","field":"current_step"}],"limit":{"offset":0,"count":1}}}]}}'
```

### 4.2 审批、指派与状态查看

```bash
node <this-skill>/scripts/client.mjs decide <stepId> approve "同意"
node <this-skill>/scripts/client.mjs decide <stepId> reject "材料不全"
node <this-skill>/scripts/client.mjs candidates <stepId>
node <this-skill>/scripts/client.mjs assign <stepId> dept_leader1
node <this-skill>/scripts/client.mjs assign <stepId> --clear
node <this-skill>/scripts/client.mjs runs [status]
node <this-skill>/scripts/client.mjs run-status <runId>
```

- `decide` 的结论字段为 `verdict`(`approve` | `reject`),仅 `status=waiting` 的 `human` 步骤可执行;`decider` 必须与当前 token 一致。通过或驳回均会以决定人身份执行审批 Action(驳回带 `decision=rejected`)并推进/结束 Run;被拒绝尝试写入 `step.refused` 审计事件。
- `assign` 受组织与改钉规则约束:已钉住的步骤仅当前承办人、Run 发起人或管理角色可改钉,同角色成员不得抢单;`--clear` 清空指派回到角色池。`candidates` 返回 `degraded=true` 表示未配置主体目录,不等于角色无人。
- `run-status` 重点核对:`status`(`pending`/`running`/`waiting`/`completed`/`failed`/`cancelled`)、`steps[].status`(含 `routing` 表示规则或 Agent 正在选人)、`steps[].assignedTo` 与 `events[]`。

### 4.3 `actorPolicy` 运行时办理口径

- **`none/manual`**:`assignedTo=null` 时由角色候选领取;已钉人后仅该主体可办理。
- **`rule/manual`**:进入 `waiting` 前 Praxis 已通过 MetricView 解析 `assignedTo`;先核对 `assignedTo`,不要重复调用 `assign`。
- **`agent/manual`**:由 Praxis AssignmentWorker 异步调用 Agent 选人。当收到 `variables.operation=propose-workflow-assignment` 时,Agent **只能从 `variables.candidates` 中选择并仅返回 JSON 提案**(`{"assignedTo":"...","reason":"...","evidence":[...]}`),**严禁直接调用 `assign`、`decide` 或 `run`**;AssignmentWorker 会再次对照实时候选集校验后写入 `assignedTo`。
- **`invocationMode=automatic`**:当前运行时明确拒绝,不要试图用工具模拟自动执行。

---

## 5. Case 型临时流程与生命周期清理

平台无原生“临时流程”对象,通过 `DRAFT → ACTIVE → 运行 → 停用 → 删除` 实现;**优先使用 `temporary: true` + `runClassName: "workflow_case"` + `caseScoped: true`**,确保不产生角色级全局授权,仅当前 Case 承办人可执行:

```bash
# 保存并激活临时流程(--draft 仅存草稿;--run 立即起 Run;--no-auto 建 Run 不自动 tick)
node <this-skill>/scripts/client.mjs temp-save tmp.json --run '{}'

# Case 读写与结案
node <this-skill>/scripts/client.mjs case <runId>
node <this-skill>/scripts/client.mjs case-submit <runId> '{"cpu":2,"memory_mb":8192,"disk_mb":204800,"os":"centos"}'
node <this-skill>/scripts/client.mjs case-fill <runId> '{"host":"dev-02","ip":"192.0.2.12"}'
node <this-skill>/scripts/client.mjs tick <runId>
node <this-skill>/scripts/client.mjs case-close <runId>

# 停用并删除临时流程(已冻结的 Run 与 Case 记录保留在 Praxis 账本)
node <this-skill>/scripts/client.mjs temp-clean <workflowId>
```

- **`caseScoped: true` 语义**:激活时**绝不写入角色级 `role × action` 全局授权**,仅允许 Case 当前 `assignedTo` 承办人在当前 `waiting` 步骤通过 Praxis 执行;同角色其他成员直调 `run` 或 `decide` 均被拒绝。
- `case-submit` 仅 `requester` 可调;`case-fill` 与 `case-close` 仅 `requester` 或当前 `assignee` 可调;`locked` 字段始终以 Case `payload` 为准,办理人不可覆盖;结案后 Case 不可再写。
- `temp-save` 需要当前账号具备新建/激活流程权限(`CREATE` / `workflow.lifecycle.change`);无权时先由管理员处理。
- **使用完毕务必清理**:`temp-clean` 先停用再删除(停用失败时不会强删,防止删掉仍在运行的流程)。特别是历史非 `caseScoped` 临时流程,未清理会遗留角色授权导致后续会话误判 `my-actions`。

---

## 6. 常见错误语义与下一步

| 返回 | 含义 | 下一步 |
| --- | --- | --- |
| 401 `未授权访问` / `A platform token is required...` | 缺少有效平台凭据或令牌过期 | 重新 `login` 或刷新 `ONTOMATO_TK` / `ONTOMATO_API_KEY` |
| 403 `requested domain does not match` | 请求域与登录用户域不匹配 | 普通用户不跨域;superAdmin 使用目标域凭据或显式 `--domain` |
| 404 `Domain ... is not served by this Praxis process` | 新域自动开通未完成或失败 | 等待重试并请管理员运行 `domain-praxis-check` 查日志,勿改环境变量或重启 Praxis |
| 403 `The requester is X but the token belongs to Y` | 身份与令牌不一致 | 使用本人账号,不要代办冒充 |
| 403 `Not eligible to decide` | 当前非本人可决定的步骤 | 查看 `inbox` / `candidates`,交由有权承办人处理 |
| 403 `Cannot reassign step ...` | 步骤已钉给他人且当前主体无改钉权 | 联系当前承办人、发起人或管理员,不要抢单 |
| 403 `notGranted` / `Action.targetOutsideScope` | OntoPlato 授权或作用域拒绝(含直调 `caseScoped` Action) | 若为固定/Case 步骤回到 Praxis `inbox` → `decide`;否则联系管理员补权 |
| 400 `Missing parameter: X` | 缺少 Action 必填参数 | 从 `action <actionId>` 核对参数补齐 |
| 400 `preconditions are not met` | 非当前回合或业务状态不满足 | 用 `dsl` / `run-status` 查当前节点与状态 |
| `ValueError at program.py line N` | 动作脚本业务校验拒绝(平台遮蔽自定义异常文本) | 读动作 `logic` 并用 `dsl` 核对是否已有进行中记录、重复单或非法字段,勿盲目重试 |
| 400 `Step is X, not waiting` | 步骤已完成或尚未就绪 | 查 `run-status`,勿重复 `decide` |
| 409 `duplicate key` | 定时触发同一时刻重复发起 | 视为已点火,查已有 Run |
| `No published pending-items query` | 流程激活未生成待办查询 | 请管理员检查 `runContract` / `activationNotes` 并重激活 |
| `Praxis 连不上` | 产品 `/api/praxis` 入口不可达 | 排查平台代理与 Praxis 服务;独立拉式 Action 仍可用 |

---

## 7. 命令速查

| 命令 | 作用 |
| --- | --- |
| `login / me / me-full / ping / praxis-health` | 验证认证、当前身份(含完整权限)、平台与 `/api/praxis` 可达性 |
| `org-graph / subjects / roles` | 组织子树与能力图、域主体、角色列表 |
| `my-actions / workflows [需求] / find <需求> [className] / action <actionId>` | 发现已授权动作、匹配 ACTIVE 流程、查看完整参数定义 |
| `dsl <json\|@json>` | 执行本体图谱 DSL 读取业务对象或验证行权限 |
| `pending [limit] [--flow <id>]` | 平台生成的“我的待办”业务对象查询 |
| `run <actionId> <paramJson>` | 路径 A:OntoPlato 拉式执行独立动作 |
| `template <workflowId> / start <workflowId> [inputsJson] [--no-auto] / bind <runId> <targetClass> <targetId> / tick <runId>` | 路径 B:查看模板、创建 Run、绑定业务对象、手动推进 |
| `inbox / runs [status] / run-status <id> / decide <stepId> approve\|reject [comment]` | Praxis 待办、账本状态与审批决定 |
| `candidates <stepId> / assign <stepId> <principal\|--clear>` | 查看候选人与指派/清钉 |
| `case <runId> / case-submit <runId> <json> / case-fill <runId> <json> / case-close <runId>` | 读写与结案临时流程单(Case) |
| `temp-save <json> [--draft] [--run <inputsJson>] [--no-auto] / temp-clean <workflowId>` | 创建/激活/清理临时 Workflow |

---

## 8. 安全与行为红线

- 绝不把密码、token 或 API Key 写进文件、日志或对话;一律通过环境变量注入。
- 绝不用管理员账号伪造业务角色“跑通流程”,审批记录会真实落盘操作主体。
- 创建、停用或删除临时流程前先确认范围;所有变更均作用于真实域数据。
- 绝不通过额外角色授权或直接修改业务对象绕过 `caseScoped` 边界与 Praxis 账本。

Files in this skill

  • SKILL.md18 KB
  • scripts/client.mjs49.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.