19 lines
908 B
TypeScript
19 lines
908 B
TypeScript
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;
|
|
},
|
|
});
|