Skip to content

feat(agents): forward tools the screens' page adds to the agents port - #1738

Closed
loganj wants to merge 1 commit into
agent-host-event-portfrom
agent-host-tool-forwarding
Closed

loganj wants to merge 1 commit into
agent-host-event-portfrom
agent-host-tool-forwarding

Conversation

@loganj

@loganj loganj commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

🤖

Summary

  • Stacked on feat(agents): an agents port between webviews over Tauri events #1737. Some plugins add agent tools from their UI entry, not an agent entry: Builderlab apps, GitHub link_pr, and installed plugins such as loganj.branches. Once agents run in their own page, those tools would disappear. This lets the screens' page offer them to the agents service over the agents port.
  • Nothing uses it yet, so behavior does not change. The agents window PR will connect it.

Details

  • tool-port.ts has two halves:
    • toolsClient (screens' page): add(tool, owner) lists the tool's name, description, schema and owning plugin with the service, and returns a withdraw. answer(call) runs the tool when the service forwards a call.
    • serveTools (agents page): each listed tool is added to the service with a stand-in whose call forwards to the screens' page and waits for its reply.
  • A forwarded call carries the agent's BuzzClient as a handle: its string values (pubkey, key, owner, …) and the names of its methods. On the screens' page each method calls back over the port, and the service runs it on the real client while the call is in progress. After the call ends, a callback fails with "That tool call has finished".
  • Bytes (upload, read) travel as { $bytes: base64 }, because the event port is JSON.
  • handoff returns nothing, so its callback is fire-and-forget.
  • Reloads:
    • The service gets a new instance id per page load in its state. When the screens' page sees a new instance, it lists its tools again.
    • When the screens' page reloads and lists a tool again, the service ends that tool's open calls with an error instead of leaving them waiting.
  • Thread tabs and attention are not carried: what they read is the service page's state.

Testing

  • port.test.ts, over a JSON event bus:
    • A tool's call carries bytes both ways, and a reloaded service gets the tools listed again.
    • A call that a reloaded screens' page never answers ends with an error.
  • service.test.ts: the real agents service, with a plugin that adds a tool from its UI entry. The service lists the tool, and the call reaches the agent's client through the handle.
  • Mutation checks: each of these makes a test fail: not wiring the client's arguments, not listing again after a reload, and not ending abandoned calls.
  • tsc --noEmit, Biome, and vitest run src/features/agents src/buzz-mcp (863 passed) pass.

🤖 Generated with Claude Code

Builderlab, GitHub link_pr and installed plugins such as loganj.branches
add agent tools from their UI entry. Once agents run in another page,
the screens' page lists each tool with the service, and the service adds
a stand-in that forwards each call back. The call carries the agent's
client as a handle: its values, and its methods, which the screens' page
calls back over the port, with bytes as base64 on the JSON path. A
reloaded service is told the tools again; a call left unanswered by a
screens' page that reloaded ends with an error. Nothing uses it yet.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Logan Johnson <loganj@squareup.com>
@loganj

loganj commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Closing: the Manager/Runner split replaces this design (#1748 → #1839, with more to come). The branch stays in place because #1737, #1743 and #1744 are still stacked on it. They will move onto the new stack in the hidden-page step.

@loganj loganj closed this Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant