diff --git a/.cursor/skills/create-device-skill/SKILL.md b/.cursor/skills/create-device-skill/SKILL.md index 03172efe..c4fc7a10 100644 --- a/.cursor/skills/create-device-skill/SKILL.md +++ b/.cursor/skills/create-device-skill/SKILL.md @@ -119,13 +119,14 @@ python ./scripts/extract_device_actions.py [--registry ] ./ski ### Step 3 — 写 action-index.md -按模板为每个 action 写条目: +按模板为每个 action 写条目(**必须包含 `action_type`**): ```markdown ### `` <用途描述(一句话)> +- **action_type**: `<从 actions/.json 的 type 字段获取>` - **Schema**: [`actions/.json`](actions/.json) - **核心参数**: `param1`, `param2`(从 schema.required 获取) - **可选参数**: `param3`, `param4` @@ -134,6 +135,7 @@ python ./scripts/extract_device_actions.py [--registry ] ./ski 描述规则: +- **每个 action 必须标注 `action_type`**(从 JSON 的 `type` 字段读取),这是 API #9 调用时的必填参数,传错会导致任务永远卡住 - 从 `schema.properties` 读参数列表(schema 已提升为 goal 内容) - 从 `schema.required` 区分核心/可选参数 - 按功能分类(移液、枪头、外设等) @@ -157,6 +159,7 @@ python ./scripts/extract_device_actions.py [--registry ] ./ski - **AUTH 头** — 使用 Step 0 中 `gen_auth.py` 生成的 `Authorization: Lab `(不要硬编码 `Api` 类型的 key) - **Python 源码路径** — 在 SKILL.md 开头注明设备对应的源码文件,方便参考参数含义 - **Slot 字段表** — 列出本设备哪些 action 的哪些字段需要填入 Slot(物料/设备/节点/类名) +- **action_type 速查表** — 在 API #9 说明后面紧跟一个表格,列出每个 action 对应的 `action_type` 值(从 JSON `type` 字段提取),方便 agent 快速查找而无需打开 JSON 文件 API 模板结构: @@ -201,7 +204,7 @@ API 模板结构: # - #8 启动工作流 POST /lab/workflow/{uuid}/run -# - #9 运行设备单动作 POST /lab/mcp/run/action +# - #9 运行设备单动作 POST /lab/mcp/run/action(⚠️ action_type 必须从 action-index.md 或 actions/.json 的 type 字段获取,传错会导致任务永远卡住) # - #10 查询任务状态 GET /lab/mcp/task/{task_uuid} diff --git a/.cursor/skills/host-node/SKILL.md b/.cursor/skills/host-node/SKILL.md index 52aaa87a..06025355 100644 --- a/.cursor/skills/host-node/SKILL.md +++ b/.cursor/skills/host-node/SKILL.md @@ -132,7 +132,18 @@ curl -s -X POST "$BASE/api/v1/lab/mcp/run/action" \ -d '{"lab_uuid":"","device_id":"host_node","action":"","action_type":"","param":{...}}' ``` -`param` 直接放 goal 里的属性,**不要**再包一层 `{"goal": {...}}`。`action_type` 从 `actions/.json` 的 `type` 字段获取。 +`param` 直接放 goal 里的属性,**不要**再包一层 `{"goal": {...}}`。 + +> **WARNING: `action_type` 必须正确,传错会导致任务永远卡住无法完成。** 从下表或 `actions/.json` 的 `type` 字段获取。 + +#### action_type 速查表 + +| action | action_type | +|--------|-------------| +| `test_latency` | `UniLabJsonCommand` | +| `create_resource` | `ResourceCreateFromOuterEasy` | +| `auto-test_resource` | `UniLabJsonCommand` | +| `manual_confirm` | `UniLabJsonCommand` | ### 10. 查询任务状态 diff --git a/.cursor/skills/host-node/action-index.md b/.cursor/skills/host-node/action-index.md index c565af22..c931bc53 100644 --- a/.cursor/skills/host-node/action-index.md +++ b/.cursor/skills/host-node/action-index.md @@ -10,6 +10,7 @@ 在资源树中创建新资源(容器、物料等),支持指定位置、类型和初始液体 +- **action_type**: `ResourceCreateFromOuterEasy` - **Schema**: [`actions/create_resource.json`](actions/create_resource.json) - **可选参数**: `res_id`, `device_id`, `class_name`, `parent`, `bind_locations`, `liquid_input_slot`, `liquid_type`, `liquid_volume`, `slot_on_deck` - **占位符字段**: @@ -22,6 +23,7 @@ 测试资源系统,返回当前资源树和设备列表 +- **action_type**: `UniLabJsonCommand` - **Schema**: [`actions/test_resource.json`](actions/test_resource.json) - **可选参数**: `resource`, `resources`, `device`, `devices` - **占位符字段**: @@ -38,6 +40,7 @@ 测试设备通信延迟,返回 RTT、时间差、任务延迟等指标 +- **action_type**: `UniLabJsonCommand` - **Schema**: [`actions/test_latency.json`](actions/test_latency.json) - **参数**: 无(零参数调用) @@ -49,6 +52,7 @@ 创建人工确认节点,等待用户手动确认后继续 +- **action_type**: `UniLabJsonCommand` - **Schema**: [`actions/manual_confirm.json`](actions/manual_confirm.json) - **核心参数**: `timeout_seconds`(超时时间,秒), `assignee_user_ids`(指派用户 ID 列表) - **占位符字段**: `assignee_user_ids` — `unilabos_manual_confirm` 类型 diff --git a/.cursor/skills/virtual-workbench/SKILL.md b/.cursor/skills/virtual-workbench/SKILL.md index 5fe33d28..8f7aa0fe 100644 --- a/.cursor/skills/virtual-workbench/SKILL.md +++ b/.cursor/skills/virtual-workbench/SKILL.md @@ -138,7 +138,20 @@ curl -s -X POST "$BASE/api/v1/lab/mcp/run/action" \ -d '{"lab_uuid":"","device_id":"virtual_workbench","action":"","action_type":"","param":{...}}' ``` -`param` 直接放 goal 里的属性,**不要**再包一层 `{"goal": {...}}`。`action_type` 从 `actions/.json` 的 `type` 字段获取。 +`param` 直接放 goal 里的属性,**不要**再包一层 `{"goal": {...}}`。 + +> **WARNING: `action_type` 必须正确,传错会导致任务永远卡住无法完成。** 从下表或 `actions/.json` 的 `type` 字段获取。 + +#### action_type 速查表 + +| action | action_type | +|--------|-------------| +| `auto-prepare_materials` | `UniLabJsonCommand` | +| `auto-move_to_heating_station` | `UniLabJsonCommand` | +| `auto-start_heating` | `UniLabJsonCommand` | +| `auto-move_to_output` | `UniLabJsonCommand` | +| `transfer` | `UniLabJsonCommandAsync` | +| `manual_confirm` | `UniLabJsonCommand` | ### 10. 查询任务状态 diff --git a/.cursor/skills/virtual-workbench/action-index.md b/.cursor/skills/virtual-workbench/action-index.md index 64f940ff..f67d9a91 100644 --- a/.cursor/skills/virtual-workbench/action-index.md +++ b/.cursor/skills/virtual-workbench/action-index.md @@ -10,6 +10,7 @@ 批量准备物料(虚拟起始节点),生成 A1-A5 物料编号,输出 5 个 handle 供后续节点使用 +- **action_type**: `UniLabJsonCommand` - **Schema**: [`actions/prepare_materials.json`](actions/prepare_materials.json) - **可选参数**: `count`(物料数量,默认 5) @@ -21,6 +22,7 @@ 将物料从 An 位置移动到空闲加热台(竞争机械臂,自动查找空闲加热台) +- **action_type**: `UniLabJsonCommand` - **Schema**: [`actions/move_to_heating_station.json`](actions/move_to_heating_station.json) - **核心参数**: `material_number`(物料编号,integer) @@ -28,6 +30,7 @@ 启动指定加热台的加热程序(可并行,3 个加热台同时工作) +- **action_type**: `UniLabJsonCommand` - **Schema**: [`actions/start_heating.json`](actions/start_heating.json) - **核心参数**: `station_id`(加热台 ID),`material_number`(物料编号) @@ -35,6 +38,7 @@ 将加热完成的物料从加热台移动到输出位置 Cn +- **action_type**: `UniLabJsonCommand` - **Schema**: [`actions/move_to_output.json`](actions/move_to_output.json) - **核心参数**: `station_id`(加热台 ID),`material_number`(物料编号) @@ -46,6 +50,7 @@ 异步转移物料到目标设备(通过 ROS 资源转移) +- **action_type**: `UniLabJsonCommandAsync` - **Schema**: [`actions/transfer.json`](actions/transfer.json) - **核心参数**: `resource`, `target_device`, `mount_resource` - **占位符字段**: @@ -61,6 +66,7 @@ 创建人工确认节点,等待用户手动确认后继续(含物料转移上下文) +- **action_type**: `UniLabJsonCommand` - **Schema**: [`actions/manual_confirm.json`](actions/manual_confirm.json) - **核心参数**: `resource`, `target_device`, `mount_resource`, `timeout_seconds`, `assignee_user_ids` - **占位符字段**: