Skip to content

Implement Rozenite as a built-in plugin on top of the plugin system #27

@V3RON

Description

@V3RON

Rozenite support should be implemented as a built-in agent-cdp plugin after the generic plugin system is in place. The goal is to let agent-cdp interoperate with Rozenite's React Native runtime contract without leaking Rozenite-specific protocol details into the core daemon or CLI.

Observed Findings

  • packages/agent-cdp/src/discovery.ts already discovers React Native targets from Metro and preserves appId, webSocketDebuggerUrl, and reactNative.logicalDeviceId.
  • packages/agent-cdp/src/session-manager.ts already reconnects React Native targets using stable identity (logicalDeviceId plus appId) instead of transient raw target ids.
  • packages/agent-cdp/src/daemon.ts already has target lifecycle attachment points that a plugin can use once plugin support exists.
  • packages/agent-cdp/src/bridge/runtime-bridge.ts is currently specialized to the fixed agent-cdp bridge protocol with hardcoded binding names from packages/protocol/src/index.ts.
  • Rozenite uses the same CDP primitives (Runtime.enable, Runtime.addBinding, Runtime.bindingCalled, Runtime.evaluate) but a different runtime contract above them.
  • In ../rn-devtools, Rozenite's runtime contract depends on the global __FUSEBOX_REACT_DEVTOOLS_DISPATCHER__, a dynamic runtime-provided binding name, explicit domain initialization, and a { domain, message } binding payload envelope.
  • Rozenite agent tools are discovered dynamically from runtime messages such as register-tool and unregister-tool; they are not known statically by agent-cdp.
  • Only agent-enabled Rozenite plugins report tools. Plain Rozenite DevTools plugins are not automatically discoverable.
  • Rozenite's CLI primarily targets a Metro-hosted HTTP API, but the compatibility target here should be the React Native runtime contract expected by Rozenite plugins rather than a reimplementation of the Rozenite CLI.

Suggested Behavior

Implement a built-in Rozenite plugin using the plugin system from the blocking issue.

Requirements specific to this plugin:

  • Put all Rozenite-specific behavior under a dedicated module such as packages/agent-cdp/src/plugins/rozenite/*.
  • The main daemon, dispatcher, CLI, and protocol host layer should only know that a plugin named rozenite exists. They should not understand Fusebox globals, Rozenite domains, runtime message envelopes, or tool registry internals.
  • The plugin should activate only for React Native targets and should fail cleanly on unsupported targets.
  • On target selection and reconnect, the plugin should attach through the generic plugin lifecycle hooks and bootstrap the Rozenite runtime contract.
  • The plugin should detect whether the Rozenite runtime is actually present and surface a clear not-ready or not-available status when it is missing.
  • The plugin should maintain its own internal runtime state, readiness state, discovered tool registry, pending call correlation, and reconnect-safe invalidation logic.
  • The plugin should rebuild transient runtime attachment state after reconnect while preserving any daemon-side state that remains valid.
  • The static CLI surface should stay fixed and namespaced. At minimum, support commands in this shape:
agent-cdp rozenite status
agent-cdp rozenite tools
agent-cdp rozenite tool-schema <name>
agent-cdp rozenite call <name> [--input JSON]
  • Rozenite-discovered runtime tools should remain dynamic data behind those fixed commands, not separate dynamically registered CLI commands.
  • status should make readiness debuggable enough to distinguish unsupported target, selected target without Rozenite runtime, attached but waiting for runtime/tool discovery, ready, and error states.
  • tools should list tools discovered from runtime registration messages.
  • tool-schema and call should operate against the plugin-owned registry and report clear errors when a tool is missing or a call fails.
  • Any runtime-specific bootstrap details required by Rozenite, including dynamic binding lookup and domain initialization, must remain internal to the Rozenite plugin module.

Resolution Summary

After the generic plugin system exists, agent-cdp should add a built-in rozenite plugin that attaches to React Native targets, speaks Rozenite's runtime contract internally, tracks dynamically registered agent tools, and exposes a fixed namespaced CLI for status, discovery, schema lookup, and tool calls without leaking Rozenite-specific protocol details into core code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions