style(opencode): format tool definitions

This commit is contained in:
2026-06-07 17:08:17 +08:00
parent 9d4e5486e9
commit ba46258845
9 changed files with 116 additions and 54 deletions
+17 -13
View File
@@ -1,6 +1,7 @@
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 ?? "";
export default tool({
@@ -21,19 +22,22 @@ export default tool({
.describe("超时秒数,默认 120。大结果集建议设 300+。"),
},
async execute(args, context) {
const response = await fetch(`${internalBaseUrl}/internal/tools/tjwater-cli-call`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-agent-internal-token": internalToken,
const response = await fetch(
`${internalBaseUrl}/internal/tools/tjwater-cli-call`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"x-agent-internal-token": internalToken,
},
body: JSON.stringify({
session_id: context.sessionID,
reason: args.reason,
command: args.command,
timeout: args.timeout,
}),
},
body: JSON.stringify({
session_id: context.sessionID,
reason: args.reason,
command: args.command,
timeout: args.timeout,
}),
});
);
const text = await response.text();
if (!response.ok) {