refactor(scada): use canonical device identifiers
This commit is contained in:
@@ -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