feat(agent): add controlled task execution

This commit is contained in:
2026-09-24 04:19:02 +08:00
parent d018bcae67
commit b31033e9ce
48 changed files with 14498 additions and 86 deletions
@@ -0,0 +1,18 @@
import { tool } from "@opencode-ai/plugin";
import { getInternalBridgeConfig } from "../internalBridge.js";
export default tool({
description: "Read the current operational task's authorized task, plan, report, evidence and scoped investigation data from TJWater Server. Use this before investigating a task. It is read-only and does not expose credentials.",
args: {},
async execute(_args, context) {
const { baseUrl, internalToken } = getInternalBridgeConfig();
const url = new URL("/internal/operational-task/context", baseUrl);
url.searchParams.set("session_id", context.sessionID);
const response = await fetch(url, {
headers: { Accept: "application/json", "x-agent-internal-token": internalToken },
});
const text = await response.text();
if (!response.ok) throw new Error(`task context request failed (${response.status}): ${text}`);
return text;
},
});