Files
next-tjwater-agent/.opencode/tools/render_scada_analysis.ts
T
jiang 7383ed6d13 feat(agent): migrate OpenCode 2 runtime and sandbox tools
Upgrade the runtime and native plugin API to OpenCode 2.0.24. Restore
session-scoped learning, credential renewal, typed project queries and
controlled frontend actions from the legacy Agent.

Replace host Shell execution with an approved Landlock/seccomp executor
and persistent per-session workspaces. Add typed Bocha search and Tianditu
geocoding bridges using the owning session credential. Require a working
kernel sandbox before startup and persist workspace files in deployments.

Validation completed before this commit: TypeScript checks, 150 Bun tests,
Docker build and UID 10001 sandbox execution, native Shell approval and
session recovery. Tianditu succeeded; Bocha currently reports exhausted
account quota. Unrelated investigation-report contract work is excluded.
2026-10-08 15:46:37 +08:00

37 lines
1.2 KiB
TypeScript

import { tool } from "../tool.js";
import { executeFrontendAction } from "./frontend_action.js";
const deviceId = tool.schema.string().trim().min(1).max(128);
export default tool({
description:
"将已经完成分析并确定等级的 SCADA 点位结果高亮、编号并定位到前端地图。等级只能来自已完成的分析结论。",
args: {
reason: tool.schema
.string()
.trim()
.min(1)
.describe("Why the completed SCADA analysis should be rendered on the map."),
items: tool.schema
.array(
tool.schema.object({
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."),
}),
)
.min(1)
.max(100)
.refine(
(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."),
},
async execute(args, context) {
return executeFrontendAction("render_scada_analysis", args, context);
},
});