feat(agent): add typed server API tools

This commit is contained in:
2026-07-15 10:44:07 +08:00
parent f3f873e3c4
commit 8a21908785
30 changed files with 3119 additions and 15 deletions
+5 -5
View File
@@ -2,7 +2,7 @@ import { tool } from "@opencode-ai/plugin";
import { executeFrontendAction } from "./frontend_action.js";
export default tool({
description: "为选定的管网要素打开前端的历史记录或计算结果面板。",
description: "为选定的管网要素打开前端的历史记录或计算结果面板;必须提供 ISO8601 时间区间 start_time 和 end_time。",
args: {
reason: tool.schema
.string()
@@ -17,12 +17,12 @@ export default tool({
.describe("History data source type."),
start_time: tool.schema
.string()
.optional()
.describe("Optional ISO8601 start time."),
.datetime()
.describe("Required ISO8601 inclusive start time for the history query."),
end_time: tool.schema
.string()
.optional()
.describe("Optional ISO8601 end time."),
.datetime()
.describe("Required ISO8601 exclusive end time for the history query; must be after start_time."),
},
async execute(args, context) {
return executeFrontendAction("view_history", args, context);