mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-22 19:41:15 +00:00
* feat(linux): add node device capabilities * fix(linux-node): actionable pending-approval error + node-host advertise integration test * fix(linux-node): map geoclue access-denied to LOCATION_DISABLED; floor camera maxWidth to avoid zero-height scale * fix(linux-node): clamp small camera maxWidth to 2 instead of default * docs(linux-node): clarify where-am-i -t is a process timeout, not update throttle * refactor(gateway): extract legacy-node filter + rejection hint to fit LOC ratchet; docs-map + deadcode baseline * fix(gateway): drop now-unused DEFAULT_DANGEROUS_NODE_COMMANDS import after hint extraction * test(node-host): drop imports orphaned by removed error-code test
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import type {
|
|
OpenClawPluginApi,
|
|
OpenClawPluginNodeHostCommand,
|
|
OpenClawPluginNodeInvokePolicy,
|
|
} from "openclaw/plugin-sdk/plugin-entry";
|
|
import { describe, expect, it } from "vitest";
|
|
import plugin from "./index.js";
|
|
|
|
describe("linux-node plugin registration", () => {
|
|
it("registers node-host commands and preserves explicit arming for capture", () => {
|
|
const commands: OpenClawPluginNodeHostCommand[] = [];
|
|
const policies: OpenClawPluginNodeInvokePolicy[] = [];
|
|
plugin.register({
|
|
pluginConfig: {
|
|
notify: { enabled: true },
|
|
camera: { enabled: true },
|
|
location: { enabled: true },
|
|
},
|
|
registerNodeHostCommand: (command: OpenClawPluginNodeHostCommand) => commands.push(command),
|
|
registerNodeInvokePolicy: (policy: OpenClawPluginNodeInvokePolicy) => policies.push(policy),
|
|
} as unknown as OpenClawPluginApi);
|
|
|
|
expect(commands.map((command) => command.command)).toEqual([
|
|
"system.notify",
|
|
"camera.list",
|
|
"camera.snap",
|
|
"camera.clip",
|
|
"location.get",
|
|
]);
|
|
expect(
|
|
commands.filter((command) => command.dangerous).map((command) => command.command),
|
|
).toEqual(["camera.snap", "camera.clip"]);
|
|
expect(policies).toHaveLength(2);
|
|
expect(policies[0]).toMatchObject({
|
|
commands: ["camera.list", "location.get"],
|
|
defaultPlatforms: ["linux"],
|
|
});
|
|
expect(policies[1]).toMatchObject({
|
|
commands: ["camera.snap", "camera.clip"],
|
|
dangerous: true,
|
|
});
|
|
expect(policies[1]?.defaultPlatforms).toBeUndefined();
|
|
});
|
|
});
|