feat: implement Rozenite as a built-in plugin#29
Open
burczu wants to merge 9 commits into
Open
Conversation
Constants and message type definitions for the Rozenite CDP binding protocol — binding payload envelope, app↔agent message union types, and AgentTool shape.
In-memory registry for dynamically registered Rozenite tools — supports register by domain (qualifies names as domain.toolName), unregister by qualified name, and clear on disconnect.
Async poll → bind → domain-init sequence for establishing the Rozenite CDP binding. Polls for __FUSEBOX_REACT_DEVTOOLS_DISPATCHER__ at 500ms intervals, times out after 30s with a descriptive error, and supports AbortSignal cancellation for clean target-cleared teardown.
- Add alwaysExecutable flag to AgentPluginCommand so status-style commands can run regardless of plugin state; honour it in dispatch - Implement RozenitePlugin: fire-and-forget bootstrap, onDisconnected wiring, tool registry lifecycle, in-flight call rejection on disconnect, and four commands: status, tools, tool-schema, call
Add rozenite CLI subcommand family (status, tools, tool-schema, call) and register RozenitePlugin in the PluginOrchestrator alongside the runtime bridge plugin.
18 tests covering bootstrap lifecycle, tool registry, and all four commands — including alwaysExecutable status, tool-level vs transport failure distinction, and disconnect rejection of in-flight calls.
…gration The CDP binding approach (Runtime.addBinding + Runtime.bindingCalled) does not work in Hermes/Fusebox New Architecture — binding events are routed to the DevTools frontend only, not to debugging sessions. Switch to @rozenite/metro's HTTP agent API (/rozenite/agent/*) which is designed for this use case. Remove bootstrap.ts and tool-registry.ts; the HTTP session owns tool state. CDP session disconnects no longer tear down the Rozenite session since the HTTP session is independent of the CDP transport. Add playground integration: metro.config.js wraps Expo config with withRozenite, use-rozenite-bridge.ts registers three test tools (echo, getTimestamp, getPlaygroundInfo), and index.tsx renders a Rozenite status section when the Fusebox dispatcher global is present.
4bd4d97 to
538f24a
Compare
Replaces the HTTP API approach with the correct CDP implementation using Runtime.addBinding / Runtime.bindingCalled. Tools are discovered dynamically from binding events rather than polled via HTTP. Key fixes over the original attempt: Runtime.enable is called before Runtime.addBinding, and the onEvent listener is registered before initializeDomain is called to avoid missing early binding events. Includes verbose console.log output on every Runtime.bindingCalled event to aid investigation of CDP session behaviour.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #27
Summary
Implements the Rozenite plugin on top of the generic plugin system from #26. The plugin lets
agent-cdpinteroperate with Rozenite's React Native agent tooling without leaking any Rozenite-specific details into the core daemon or CLI.Rozenite plugin
packages/agent-cdp/src/plugins/rozenite/*— core code is unaware of Fusebox globals, Rozenite domains, or tool registry internalsRuntime.enable, polls for__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__, reads the dynamicBINDING_NAME, registers it viaRuntime.addBinding, initialises therozenitedomain, and sendsagent-session-readyregister-tool/unregister-toolbinding events and held in an in-memory registry__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__.sendMessageand correlated withtool-resultbinding events via acallIdrozenite status,rozenite tools,rozenite tool-schema <name>,rozenite call <name> [--input JSON]Playground integration
@rozenite/metro(dev) and@rozenite/agent-bridgeto the playgroundmetro.config.jswraps the Expo Metro config withwithRozenite(opt-in viaWITH_ROZENITE=true)useRozeniteBridgehook registers three test tools (app.echo,app.getTimestamp,app.getPlaygroundInfo) for end-to-end testingTesting