refactor(scada): use canonical device identifiers
This commit is contained in:
@@ -32,8 +32,8 @@ Agent 负责:
|
||||
1. `render_scada_analysis` 只能在分析结论已经完成后调用,不得让前端计算、猜测或修改高中低等级。
|
||||
2. 每次普通工具调用必须填写具体 `reason`。
|
||||
3. 不生成 JS、JSX、HTML、CSS 或可执行前端代码。
|
||||
4. SCADA 地图结果只允许使用可信 `sensor_id` 和 `high | medium | low | unrated` 等级,不得传入自定义标签、颜色或 HTML。
|
||||
5. 同一批结果不得包含重复 `sensor_id`,每次最多 100 个点位。
|
||||
4. SCADA 地图结果只允许使用后端 API 返回的可信 `device_id` 和 `high | medium | low | unrated` 等级,不得传入自定义标签、颜色或 HTML。
|
||||
5. 同一批结果不得包含重复 `device_id`,每次最多 100 个点位。
|
||||
6. 只有 SCADA 地图工具返回浏览器的成功结果后,才能声称已渲染或已清除;工具报错、超时或无活跃浏览器连接时,必须明确告知用户动作失败,不得伪造已渲染的点位、编号或等级。
|
||||
|
||||
## 执行约束
|
||||
|
||||
@@ -2,7 +2,7 @@ import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
import { executeFrontendAction } from "./frontend_action.js";
|
||||
|
||||
const sensorId = tool.schema.string().trim().min(1).max(128);
|
||||
const deviceId = tool.schema.string().trim().min(1).max(128);
|
||||
|
||||
export default tool({
|
||||
description:
|
||||
@@ -16,7 +16,7 @@ export default tool({
|
||||
items: tool.schema
|
||||
.array(
|
||||
tool.schema.object({
|
||||
sensor_id: sensorId.describe("Trusted SCADA sensor identifier."),
|
||||
device_id: deviceId.describe("Trusted SCADA device identifier from the backend API."),
|
||||
level: tool.schema
|
||||
.enum(["high", "medium", "low", "unrated"])
|
||||
.describe("Completed analysis level; use unrated only when no level was concluded."),
|
||||
@@ -25,8 +25,8 @@ export default tool({
|
||||
.min(1)
|
||||
.max(100)
|
||||
.refine(
|
||||
(items) => new Set(items.map((item) => item.sensor_id)).size === items.length,
|
||||
"sensor_id values must be unique",
|
||||
(items) => new Set(items.map((item) => item.device_id)).size === items.length,
|
||||
"device_id values must be unique",
|
||||
)
|
||||
.describe("One to one hundred unique SCADA analysis results."),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user