fix(nodes): reject facing=both when camera deviceId is set

This commit is contained in:
Ayaan Zaidi
2026-02-27 09:53:08 +05:30
committed by Ayaan Zaidi
parent 29f5da5b2a
commit b8373eaddc
4 changed files with 49 additions and 0 deletions

View File

@@ -136,6 +136,17 @@ describe("nodes camera_snap", () => {
deviceId: "cam-123",
});
});
it("rejects facing both when deviceId is provided", async () => {
await expect(
executeNodes({
action: "camera_snap",
node: NODE_ID,
facing: "both",
deviceId: "cam-123",
}),
).rejects.toThrow(/facing=both is not allowed when deviceId is set/i);
});
});
describe("nodes notifications_list", () => {

View File

@@ -248,6 +248,9 @@ export function createNodesTool(options?: {
typeof params.deviceId === "string" && params.deviceId.trim()
? params.deviceId.trim()
: undefined;
if (deviceId && facings.length > 1) {
throw new Error("facing=both is not allowed when deviceId is set");
}
const content: AgentToolResult<unknown>["content"] = [];
const details: Array<Record<string, unknown>> = [];