Revert "iOS: wire node services and tests"

This reverts commit 7b0a0f3dac.
This commit is contained in:
Mariano Belinky
2026-02-02 17:27:56 +00:00
parent c83bdb73a4
commit 4ab814fd50
59 changed files with 182 additions and 6234 deletions

View File

@@ -133,52 +133,3 @@ describe("nodes run", () => {
});
});
});
describe("nodes invoke", () => {
beforeEach(() => {
callGateway.mockReset();
});
it("invokes arbitrary commands with params JSON", async () => {
callGateway.mockImplementation(async ({ method, params }) => {
if (method === "node.list") {
return { nodes: [{ nodeId: "ios-1" }] };
}
if (method === "node.invoke") {
expect(params).toMatchObject({
nodeId: "ios-1",
command: "device.info",
params: { includeBattery: true },
timeoutMs: 12_000,
});
return {
ok: true,
nodeId: "ios-1",
command: "device.info",
payload: { deviceName: "iPhone" },
};
}
throw new Error(`unexpected method: ${String(method)}`);
});
const tool = createOpenClawTools().find((candidate) => candidate.name === "nodes");
if (!tool) {
throw new Error("missing nodes tool");
}
const result = await tool.execute("call1", {
action: "invoke",
node: "ios-1",
invokeCommand: "device.info",
invokeParamsJson: JSON.stringify({ includeBattery: true }),
invokeTimeoutMs: 12_000,
});
expect(result.details).toMatchObject({
ok: true,
nodeId: "ios-1",
command: "device.info",
payload: { deviceName: "iPhone" },
});
});
});

View File

@@ -229,7 +229,7 @@ export function buildAgentSystemPrompt(params: {
// Channel docking: add login tools here when a channel needs interactive linking.
browser: "Control web browser",
canvas: "Present/eval/snapshot the Canvas",
nodes: "List/describe/notify/camera/screen/invoke on paired nodes",
nodes: "List/describe/notify/camera/screen on paired nodes",
cron: "Manage cron jobs and wake events (use for reminders; when scheduling a reminder, write the systemEvent text as something that will read like a reminder when it fires, and mention that it is a reminder depending on the time gap between setting and firing; include recent context in reminder text if appropriate)",
message: "Send messages and channel actions",
gateway: "Restart, apply config, or run updates on the running OpenClaw process",
@@ -382,7 +382,7 @@ export function buildAgentSystemPrompt(params: {
`- ${processToolName}: manage background exec sessions`,
"- browser: control openclaw's dedicated browser",
"- canvas: present/eval/snapshot the Canvas",
"- nodes: list/describe/notify/camera/screen/invoke on paired nodes",
"- nodes: list/describe/notify/camera/screen on paired nodes",
"- cron: manage cron jobs and wake events (use for reminders; when scheduling a reminder, write the systemEvent text as something that will read like a reminder when it fires, and mention that it is a reminder depending on the time gap between setting and firing; include recent context in reminder text if appropriate)",
"- sessions_list: list sessions",
"- sessions_history: fetch session history",

View File

@@ -140,10 +140,6 @@
"screen_record": {
"label": "screen record",
"detailKeys": ["node", "nodeId", "duration", "durationMs", "fps", "screenIndex"]
},
"invoke": {
"label": "invoke",
"detailKeys": ["node", "nodeId", "invokeCommand"]
}
}
},

View File

@@ -37,7 +37,6 @@ const NODES_TOOL_ACTIONS = [
"screen_record",
"location_get",
"run",
"invoke",
] as const;
const NOTIFY_PRIORITIES = ["passive", "active", "timeSensitive"] as const;
@@ -85,9 +84,6 @@ const NodesToolSchema = Type.Object({
commandTimeoutMs: Type.Optional(Type.Number()),
invokeTimeoutMs: Type.Optional(Type.Number()),
needsScreenRecording: Type.Optional(Type.Boolean()),
// invoke
invokeCommand: Type.Optional(Type.String()),
invokeParamsJson: Type.Optional(Type.String()),
});
export function createNodesTool(options?: {
@@ -103,7 +99,7 @@ export function createNodesTool(options?: {
label: "Nodes",
name: "nodes",
description:
"Discover and control paired nodes (status/describe/pairing/notify/camera/screen/location/run/invoke).",
"Discover and control paired nodes (status/describe/pairing/notify/camera/screen/location/run).",
parameters: NodesToolSchema,
execute: async (_toolCallId, args) => {
const params = args as Record<string, unknown>;
@@ -442,31 +438,6 @@ export function createNodesTool(options?: {
});
return jsonResult(raw?.payload ?? {});
}
case "invoke": {
const node = readStringParam(params, "node", { required: true });
const nodeId = await resolveNodeId(gatewayOpts, node);
const invokeCommand = readStringParam(params, "invokeCommand", { required: true });
const invokeParamsJson =
typeof params.invokeParamsJson === "string" ? params.invokeParamsJson.trim() : "";
let invokeParams: unknown = {};
if (invokeParamsJson) {
try {
invokeParams = JSON.parse(invokeParamsJson);
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
throw new Error(`invokeParamsJson must be valid JSON: ${message}`, { cause: err });
}
}
const invokeTimeoutMs = parseTimeoutMs(params.invokeTimeoutMs);
const raw = await callGatewayTool("node.invoke", gatewayOpts, {
nodeId,
command: invokeCommand,
params: invokeParams,
timeoutMs: invokeTimeoutMs,
idempotencyKey: crypto.randomUUID(),
});
return jsonResult(raw ?? {});
}
default:
throw new Error(`Unknown action: ${action}`);
}