From 4f04d0ba9872e171be450cd1e8f888b5b073c390 Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 19 Jul 2026 13:08:00 -0300 Subject: [PATCH] fix frontend invoke result handling --- frontend/src/a2a.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/a2a.js b/frontend/src/a2a.js index e340126..c474f0d 100644 --- a/frontend/src/a2a.js +++ b/frontend/src/a2a.js @@ -1,5 +1,11 @@ export const CONFIG_URL = import.meta.env.DEV ? "/app/config.json" : "./config.json"; +export function unwrapInvokeResponse(payload) { + return payload && typeof payload === "object" && "result" in payload + ? payload.result + : payload; +} + export async function requestJson(url, init = {}) { const response = await fetch(url, { credentials: "same-origin", ...init }); const text = await response.text(); @@ -26,7 +32,7 @@ export async function callSkill(config, skillName, args) { throw new Error("sign in required"); } } - return requestJson( + const payload = await requestJson( `${config.endpoints.invoke}/${encodeURIComponent(skillName)}`, { method: "POST", @@ -34,6 +40,7 @@ export async function callSkill(config, skillName, args) { body: JSON.stringify({ arguments: args }), }, ); + return unwrapInvokeResponse(payload); } export function sampleValue(schema) {