style(opencode): format tool definitions
This commit is contained in:
@@ -6,7 +6,9 @@ export default tool({
|
|||||||
args: {
|
args: {
|
||||||
reason: tool.schema
|
reason: tool.schema
|
||||||
.string()
|
.string()
|
||||||
.describe("Why this style action is needed for the current user request."),
|
.describe(
|
||||||
|
"Why this style action is needed for the current user request.",
|
||||||
|
),
|
||||||
layer_id: tool.schema
|
layer_id: tool.schema
|
||||||
.enum(["junctions", "pipes"])
|
.enum(["junctions", "pipes"])
|
||||||
.describe("Target layer id. Must be exactly 'junctions' or 'pipes'."),
|
.describe("Target layer id. Must be exactly 'junctions' or 'pipes'."),
|
||||||
@@ -16,14 +18,26 @@ export default tool({
|
|||||||
.describe("Whether to reset the target layer to its default style."),
|
.describe("Whether to reset the target layer to its default style."),
|
||||||
style_config: tool.schema
|
style_config: tool.schema
|
||||||
.object({
|
.object({
|
||||||
property: tool.schema.string().optional().describe("Data property to render."),
|
property: tool.schema
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.describe("Data property to render."),
|
||||||
classification_method: tool.schema
|
classification_method: tool.schema
|
||||||
.enum(["pretty_breaks", "custom_breaks"])
|
.enum(["pretty_breaks", "custom_breaks"])
|
||||||
.optional()
|
.optional()
|
||||||
.describe("Classification method."),
|
.describe("Classification method."),
|
||||||
segments: tool.schema.number().optional().describe("Number of segments."),
|
segments: tool.schema
|
||||||
min_size: tool.schema.number().optional().describe("Minimum point radius."),
|
.number()
|
||||||
max_size: tool.schema.number().optional().describe("Maximum point radius."),
|
.optional()
|
||||||
|
.describe("Number of segments."),
|
||||||
|
min_size: tool.schema
|
||||||
|
.number()
|
||||||
|
.optional()
|
||||||
|
.describe("Minimum point radius."),
|
||||||
|
max_size: tool.schema
|
||||||
|
.number()
|
||||||
|
.optional()
|
||||||
|
.describe("Maximum point radius."),
|
||||||
min_stroke_width: tool.schema
|
min_stroke_width: tool.schema
|
||||||
.number()
|
.number()
|
||||||
.optional()
|
.optional()
|
||||||
@@ -43,8 +57,14 @@ export default tool({
|
|||||||
single_palette_index: tool.schema.number().optional(),
|
single_palette_index: tool.schema.number().optional(),
|
||||||
gradient_palette_index: tool.schema.number().optional(),
|
gradient_palette_index: tool.schema.number().optional(),
|
||||||
rainbow_palette_index: tool.schema.number().optional(),
|
rainbow_palette_index: tool.schema.number().optional(),
|
||||||
show_labels: tool.schema.boolean().optional().describe("Whether to show labels."),
|
show_labels: tool.schema
|
||||||
show_id: tool.schema.boolean().optional().describe("Whether to show ids."),
|
.boolean()
|
||||||
|
.optional()
|
||||||
|
.describe("Whether to show labels."),
|
||||||
|
show_id: tool.schema
|
||||||
|
.boolean()
|
||||||
|
.optional()
|
||||||
|
.describe("Whether to show ids."),
|
||||||
opacity: tool.schema.number().optional().describe("Opacity in [0, 1]."),
|
opacity: tool.schema.number().optional().describe("Opacity in [0, 1]."),
|
||||||
adjust_width_by_property: tool.schema
|
adjust_width_by_property: tool.schema
|
||||||
.boolean()
|
.boolean()
|
||||||
|
|||||||
@@ -5,8 +5,12 @@ export default tool({
|
|||||||
args: {
|
args: {
|
||||||
reason: tool.schema
|
reason: tool.schema
|
||||||
.string()
|
.string()
|
||||||
.describe("Why this map positioning action is needed for the user request."),
|
.describe(
|
||||||
ids: tool.schema.array(tool.schema.string()).describe("Feature ids to locate."),
|
"Why this map positioning action is needed for the user request.",
|
||||||
|
),
|
||||||
|
ids: tool.schema
|
||||||
|
.array(tool.schema.string())
|
||||||
|
.describe("Feature ids to locate."),
|
||||||
feature_type: tool.schema
|
feature_type: tool.schema
|
||||||
.enum(["junction", "pipe", "valve", "reservoir", "pump", "tank"])
|
.enum(["junction", "pipe", "valve", "reservoir", "pump", "tank"])
|
||||||
.describe("Type of feature to locate."),
|
.describe("Type of feature to locate."),
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ export default tool({
|
|||||||
args: {
|
args: {
|
||||||
reason: tool.schema
|
reason: tool.schema
|
||||||
.string()
|
.string()
|
||||||
.describe("Why this junction rendering action is needed for the user request."),
|
.describe(
|
||||||
|
"Why this junction rendering action is needed for the user request.",
|
||||||
|
),
|
||||||
render_ref: tool.schema
|
render_ref: tool.schema
|
||||||
.string()
|
.string()
|
||||||
.describe(
|
.describe(
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ export default tool({
|
|||||||
.describe("Optional maximum number of hits to return."),
|
.describe("Optional maximum number of hits to return."),
|
||||||
},
|
},
|
||||||
async execute(args, context) {
|
async execute(args, context) {
|
||||||
const response = await fetch(`${internalBaseUrl}/internal/tools/session-search`, {
|
const response = await fetch(
|
||||||
|
`${internalBaseUrl}/internal/tools/session-search`,
|
||||||
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@@ -33,7 +35,8 @@ export default tool({
|
|||||||
query: args.query,
|
query: args.query,
|
||||||
session_id: context.sessionID,
|
session_id: context.sessionID,
|
||||||
}),
|
}),
|
||||||
});
|
},
|
||||||
|
);
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(text);
|
throw new Error(text);
|
||||||
|
|||||||
@@ -21,8 +21,14 @@ export default tool({
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.describe("Series data."),
|
.describe("Series data."),
|
||||||
x_axis_name: tool.schema.string().optional().describe("X-axis display name."),
|
x_axis_name: tool.schema
|
||||||
y_axis_name: tool.schema.string().optional().describe("Y-axis display name."),
|
.string()
|
||||||
|
.optional()
|
||||||
|
.describe("X-axis display name."),
|
||||||
|
y_axis_name: tool.schema
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.describe("Y-axis display name."),
|
||||||
},
|
},
|
||||||
async execute() {
|
async execute() {
|
||||||
// 图表数据已经在工具参数里,前端收到 tool_call 后直接渲染,不再二次请求后端。
|
// 图表数据已经在工具参数里,前端收到 tool_call 后直接渲染,不再二次请求后端。
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { tool } from "@opencode-ai/plugin";
|
import { tool } from "@opencode-ai/plugin";
|
||||||
|
|
||||||
const internalBaseUrl = process.env.TJWATER_AGENT_INTERNAL_BASE_URL ?? "http://127.0.0.1:8787";
|
const internalBaseUrl =
|
||||||
|
process.env.TJWATER_AGENT_INTERNAL_BASE_URL ?? "http://127.0.0.1:8787";
|
||||||
const internalToken = process.env.TJWATER_AGENT_INTERNAL_TOKEN ?? "";
|
const internalToken = process.env.TJWATER_AGENT_INTERNAL_TOKEN ?? "";
|
||||||
|
|
||||||
export default tool({
|
export default tool({
|
||||||
@@ -9,7 +10,9 @@ export default tool({
|
|||||||
args: {
|
args: {
|
||||||
reason: tool.schema
|
reason: tool.schema
|
||||||
.string()
|
.string()
|
||||||
.describe("Why this local render payload should be persisted as a render_ref."),
|
.describe(
|
||||||
|
"Why this local render payload should be persisted as a render_ref.",
|
||||||
|
),
|
||||||
file_path: tool.schema
|
file_path: tool.schema
|
||||||
.string()
|
.string()
|
||||||
.describe(
|
.describe(
|
||||||
@@ -17,7 +20,9 @@ export default tool({
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
async execute(args, context) {
|
async execute(args, context) {
|
||||||
const response = await fetch(`${internalBaseUrl}/internal/tools/store-render-ref`, {
|
const response = await fetch(
|
||||||
|
`${internalBaseUrl}/internal/tools/store-render-ref`,
|
||||||
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@@ -27,7 +32,8 @@ export default tool({
|
|||||||
session_id: context.sessionID,
|
session_id: context.sessionID,
|
||||||
file_path: args.file_path,
|
file_path: args.file_path,
|
||||||
}),
|
}),
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { tool } from "@opencode-ai/plugin";
|
import { tool } from "@opencode-ai/plugin";
|
||||||
|
|
||||||
const internalBaseUrl = process.env.TJWATER_AGENT_INTERNAL_BASE_URL ?? "http://127.0.0.1:8787";
|
const internalBaseUrl =
|
||||||
|
process.env.TJWATER_AGENT_INTERNAL_BASE_URL ?? "http://127.0.0.1:8787";
|
||||||
const internalToken = process.env.TJWATER_AGENT_INTERNAL_TOKEN ?? "";
|
const internalToken = process.env.TJWATER_AGENT_INTERNAL_TOKEN ?? "";
|
||||||
|
|
||||||
export default tool({
|
export default tool({
|
||||||
@@ -21,7 +22,9 @@ export default tool({
|
|||||||
.describe("超时秒数,默认 120。大结果集建议设 300+。"),
|
.describe("超时秒数,默认 120。大结果集建议设 300+。"),
|
||||||
},
|
},
|
||||||
async execute(args, context) {
|
async execute(args, context) {
|
||||||
const response = await fetch(`${internalBaseUrl}/internal/tools/tjwater-cli-call`, {
|
const response = await fetch(
|
||||||
|
`${internalBaseUrl}/internal/tools/tjwater-cli-call`,
|
||||||
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@@ -33,7 +36,8 @@ export default tool({
|
|||||||
command: args.command,
|
command: args.command,
|
||||||
timeout: args.timeout,
|
timeout: args.timeout,
|
||||||
}),
|
}),
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
@@ -5,15 +5,23 @@ export default tool({
|
|||||||
args: {
|
args: {
|
||||||
reason: tool.schema
|
reason: tool.schema
|
||||||
.string()
|
.string()
|
||||||
.describe("Why this history panel should be opened for the current task."),
|
.describe(
|
||||||
|
"Why this history panel should be opened for the current task.",
|
||||||
|
),
|
||||||
feature_infos: tool.schema
|
feature_infos: tool.schema
|
||||||
.array(tool.schema.tuple([tool.schema.string(), tool.schema.string()]))
|
.array(tool.schema.tuple([tool.schema.string(), tool.schema.string()]))
|
||||||
.describe("List of [id, type] pairs."),
|
.describe("List of [id, type] pairs."),
|
||||||
data_type: tool.schema
|
data_type: tool.schema
|
||||||
.enum(["realtime", "scheme", "none"])
|
.enum(["realtime", "scheme", "none"])
|
||||||
.describe("History data source type."),
|
.describe("History data source type."),
|
||||||
start_time: tool.schema.string().optional().describe("Optional ISO8601 start time."),
|
start_time: tool.schema
|
||||||
end_time: tool.schema.string().optional().describe("Optional ISO8601 end time."),
|
.string()
|
||||||
|
.optional()
|
||||||
|
.describe("Optional ISO8601 start time."),
|
||||||
|
end_time: tool.schema
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.describe("Optional ISO8601 end time."),
|
||||||
},
|
},
|
||||||
async execute() {
|
async execute() {
|
||||||
// 返回短确认即可;面板打开动作由前端根据 tool_call 参数完成。
|
// 返回短确认即可;面板打开动作由前端根据 tool_call 参数完成。
|
||||||
|
|||||||
@@ -10,9 +10,18 @@ export default tool({
|
|||||||
.array(tool.schema.string())
|
.array(tool.schema.string())
|
||||||
.optional()
|
.optional()
|
||||||
.describe("Preferred SCADA device ids."),
|
.describe("Preferred SCADA device ids."),
|
||||||
device_id: tool.schema.string().optional().describe("Single SCADA device id."),
|
device_id: tool.schema
|
||||||
start_time: tool.schema.string().optional().describe("Optional ISO8601 start time."),
|
.string()
|
||||||
end_time: tool.schema.string().optional().describe("Optional ISO8601 end time."),
|
.optional()
|
||||||
|
.describe("Single SCADA device id."),
|
||||||
|
start_time: tool.schema
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.describe("Optional ISO8601 start time."),
|
||||||
|
end_time: tool.schema
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.describe("Optional ISO8601 end time."),
|
||||||
},
|
},
|
||||||
async execute() {
|
async execute() {
|
||||||
// SCADA 面板仍在浏览器侧执行,工具结果不承载实际监测数据。
|
// SCADA 面板仍在浏览器侧执行,工具结果不承载实际监测数据。
|
||||||
|
|||||||
Reference in New Issue
Block a user