Files
next-tjwater-agent/.opencode/tools/add_task_human_evidence.ts
T

29 lines
1.3 KiB
TypeScript

import { tool } from "@opencode-ai/plugin";
import { getInternalBridgeConfig } from "../internalBridge.js";
export default tool({
description: "Record information explicitly supplied or confirmed by the current user as human_input evidence for the current task. Only use in task collaboration. This requeues analysis; do not use it for Agent inference or tool-derived data.",
args: {
request_id: tool.schema.string().describe("Stable UUID idempotency key"),
evidence: tool.schema.object({
evidence_id: tool.schema.string(),
kind: tool.schema.literal("human_input"),
summary: tool.schema.string(),
source_label: tool.schema.string(),
source_ref: tool.schema.string().optional(),
observed_at: tool.schema.string(),
}),
},
async execute(command, context) {
const { baseUrl, internalToken } = getInternalBridgeConfig();
const response = await fetch(`${baseUrl}/internal/operational-task/human-evidence`, {
method: "POST",
headers: { "Content-Type": "application/json", "x-agent-internal-token": internalToken },
body: JSON.stringify({ session_id: context.sessionID, command }),
});
const text = await response.text();
if (!response.ok) throw new Error(`human evidence publish failed (${response.status}): ${text}`);
return text;
},
});