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
+3 -4
View File
@@ -1,3 +1,5 @@
import { getInternalBridgeConfig } from "../internalBridge.js";
type FrontendActionArgs = Record<string, unknown> & {
__frontend_action_call_id?: string;
reason?: string;
@@ -10,15 +12,12 @@ type FrontendActionBridgeResult = {
error?: { code?: string; message?: string };
};
const internalBaseUrl =
process.env.TJWATER_AGENT_INTERNAL_BASE_URL ?? "http://127.0.0.1:8787";
const internalToken = process.env.TJWATER_AGENT_INTERNAL_TOKEN ?? "";
export const executeFrontendAction = async (
name: "render_scada_analysis" | "clear_scada_analysis",
args: FrontendActionArgs,
context: { sessionID: string },
) => {
const { baseUrl: internalBaseUrl, internalToken } = getInternalBridgeConfig();
const callId = args.__frontend_action_call_id;
if (!callId) {
throw new Error("frontend action bridge did not inject the OpenCode call ID");