fix(agents): preserve null node payloads

This commit is contained in:
Vincent Koc
2026-06-02 05:52:31 +02:00
parent 75bc80bb42
commit ffbd02fe8e
2 changed files with 16 additions and 1 deletions
+3 -1
View File
@@ -179,5 +179,7 @@ async function invokeNodeCommandPayload(params: {
params: params.commandParams ?? {},
idempotencyKey: crypto.randomUUID(),
});
return raw?.payload ?? {};
return raw && typeof raw === "object" && Object.hasOwn(raw, "payload")
? raw.payload
: {};
}
+13
View File
@@ -462,6 +462,19 @@ describe("createNodesTool screen_record duration guardrails", () => {
});
});
it("preserves explicit null location_get payloads from node.invoke", async () => {
gatewayMocks.callGatewayTool.mockResolvedValue({ payload: null });
const tool = createNodesTool();
const result = await tool.execute("call-location-null", {
action: "location_get",
node: "macbook",
});
expect(result.details).toBeNull();
expect(result.content).toEqual([{ type: "text", text: "null" }]);
});
it("uses operator.pairing plus operator.admin to approve exec-capable node pair requests", async () => {
mockNodePairApproveFlow({
requiredApproveScopes: ["operator.pairing", "operator.admin"],