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,28 @@
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;
},
});