Skip to content

armgit / pibot

Public Imported from GitHub
0

Open-source, local-first AI agent team for your desktop: multi-agent group chats, computer use, browser, MCP, routines and approvals. macOS, Windows, Linux + Android. Built on pi.

fix(computer-use): a pointer step keeps only the fields its kind reads

leen.zhoua9b68ec9fbe1
diff --git a/packages/agent/src/extensions/pibot-tools.ts b/packages/agent/src/extensions/pibot-tools.ts
index 6673c77..687f54d 100644
--- a/packages/agent/src/extensions/pibot-tools.ts
+++ b/packages/agent/src/extensions/pibot-tools.ts
@@ -54,7 +54,7 @@ export function toolsExtension(
prepareArguments: (args: unknown) =>
normalizeTodoPauseInput(args) as Record<string, unknown>,
}
- : tool.name === "keys" || tool.name === "ui_action"
+ : tool.name === "keys" || tool.name === "ui_action" || tool.name === "pointer"
? {
// Placeholder fields from strict-mode providers; authorization and the permit
// below both see the normalised call.
diff --git a/packages/protocol-base/src/computer/computer-input.ts b/packages/protocol-base/src/computer/computer-input.ts
index 4f4bbb1..da65284 100644
--- a/packages/protocol-base/src/computer/computer-input.ts
+++ b/packages/protocol-base/src/computer/computer-input.ts
@@ -68,9 +68,25 @@ function normalizeKeys(args: Args): Args {
});
}
-/** Drops placeholder fields from keys / ui_action arguments; other tools pass through untouched. */
+/**
+ * `kind` says which fields a pointer step reads: only a drag has a destination and only a scroll
+ * has dx / dy. A padded `to: {x: 0, y: 0}` on a click made the foreground driver check a drag
+ * destination at the screen corner and refuse every right-click as occluded.
+ */
+function normalizePointer(args: Args): Args {
+ const kind = args.kind;
+ if (typeof kind !== "string") return args;
+ return without(args, (key, value) => {
+ if (key === "to") return kind !== "drag" || value === null;
+ if (key === "dx" || key === "dy") return kind !== "scroll" || value === null;
+ return key !== "app" && key !== "kind" && value === null;
+ });
+}
+
+/** Drops placeholder fields from keys / ui_action / pointer arguments; other tools pass through. */
export function normalizeComputerInput(tool: string, input: unknown): unknown {
- if (tool !== "keys" && tool !== "ui_action") return input;
+ if (tool !== "keys" && tool !== "ui_action" && tool !== "pointer") return input;
if (!input || typeof input !== "object" || Array.isArray(input)) return input;
+ if (tool === "pointer") return normalizePointer(input as Args);
return tool === "keys" ? normalizeKeys(input as Args) : normalizeUiAction(input as Args);
}
diff --git a/packages/workspaces/src/brain/groups/group-member-worktrees.ts b/packages/workspaces/src/brain/groups/group-member-worktrees.ts
index 72cf275..987883d 100644
--- a/packages/workspaces/src/brain/groups/group-member-worktrees.ts
+++ b/packages/workspaces/src/brain/groups/group-member-worktrees.ts
@@ -234,7 +234,7 @@ export class GroupMemberWorktrees {
error instanceof RpcError && /^[a-z0-9_.-]{1,80}$/i.test(error.message)
? error.message
: error instanceof ExecError
- ? `exec_${error.code}`
+ ? `exec_${error.code}${error.reason ? `.${error.reason}` : ""}`
: error instanceof Error
? error.name
: "unknown",