Skip to content

Commit 220dfd2

Browse files
burczuV3RON
andauthored
feat: implement Rozenite as a built-in plugin (#29)
Closes #27 ## Summary Implements the Rozenite plugin on top of the generic plugin system from #26. The plugin lets `agent-cdp` interoperate with Rozenite's React Native agent tooling without leaking any Rozenite-specific details into the core daemon or CLI. ### Rozenite plugin - Lives entirely under `packages/agent-cdp/src/plugins/rozenite/*` — core code is unaware of Fusebox globals, Rozenite domains, or tool registry internals - Activates only for React Native targets; fails cleanly on unsupported targets - On target selection, bootstraps a CDP bridge: calls `Runtime.enable`, polls for `__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__`, reads the dynamic `BINDING_NAME`, registers it via `Runtime.addBinding`, initialises the `rozenite` domain, and sends `agent-session-ready` - Tools are discovered dynamically from `register-tool` / `unregister-tool` binding events and held in an in-memory registry - Tool calls are dispatched by evaluating `__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__.sendMessage` and correlated with `tool-result` binding events via a `callId` - Exposes a fixed CLI surface: `rozenite status`, `rozenite tools`, `rozenite tool-schema <name>`, `rozenite call <name> [--input JSON]` ### Playground integration - Adds `@rozenite/metro` (dev) and `@rozenite/agent-bridge` to the playground - `metro.config.js` wraps the Expo Metro config with `withRozenite` (opt-in via `WITH_ROZENITE=true`) - `useRozeniteBridge` hook registers three test tools (`app.echo`, `app.getTimestamp`, `app.getPlaygroundInfo`) for end-to-end testing ## Testing ```sh # start Metro with Rozenite enabled cd playground && WITH_ROZENITE=true pnpm start # run the app, then: node packages/agent-cdp/dist/bin.js start node packages/agent-cdp/dist/bin.js target list node packages/agent-cdp/dist/bin.js target select <id> node packages/agent-cdp/dist/bin.js rozenite status # state: ready, toolCount: 3 node packages/agent-cdp/dist/bin.js rozenite tools node packages/agent-cdp/dist/bin.js rozenite call app.echo --input '{"text":"hello"}' ``` --------- Co-authored-by: Szymon Chmal <szymon@chmal.it>
1 parent 369c674 commit 220dfd2

18 files changed

Lines changed: 1528 additions & 7 deletions

File tree

packages/agent-cdp/skills/core.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ Requirements:
6969
Metro exposes multiple targets (JS runtime, Hermes debugger, etc.). Pick the
7070
one labelled with your app name or `"React Native"` in the target list.
7171
72+
### Rozenite agent tools
73+
74+
```bash
75+
agent-cdp skills get rozenite
76+
```
77+
7278
## Console capture
7379
7480
```bash
@@ -98,6 +104,14 @@ agent-cdp skills get network
98104
99105
That skill contains session behavior, common workflows, body inspection guidance, and network-specific troubleshooting.
100106
107+
## Rozenite
108+
109+
For Rozenite in-app agent tools (`rozenite status|tools|call`), run:
110+
111+
```bash
112+
agent-cdp skills get rozenite
113+
```
114+
101115
## Trace recording
102116
103117
For trace workflows, run:
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: rozenite
3+
description: Rozenite in-app agent tools via agent-cdp. Use after core target selection. React Native via Metro/Fusebox; Chrome only with the Rozenite browser extension installed.
4+
allowed-tools: Bash(agent-cdp:*)
5+
---
6+
7+
# agent-cdp rozenite
8+
9+
Call tools registered in the app or page through the Rozenite CDP bridge.
10+
11+
Prerequisite: `agent-cdp skills get core`, then `start``target list``target select`.
12+
13+
## Targets
14+
15+
- **React Native** — Metro debug target (`--url http://localhost:8081`). App must use **Rozenite**.
16+
- **Chrome** — CDP tab target (`--url http://localhost:9222`). Requires the **Rozenite browser extension**; without it bootstrap times out.
17+
18+
Check readiness: `agent-cdp rozenite status` (works while bootstrapping).
19+
20+
## Commands
21+
22+
```bash
23+
agent-cdp rozenite status
24+
agent-cdp rozenite tools
25+
agent-cdp rozenite tool-schema <name>
26+
agent-cdp rozenite call <name> [--input '{"key":"value"}']
27+
```
28+
29+
`status` returns `state` (`idle` | `waiting-for-runtime` | `ready` | `error` | `unsupported-target`), `toolCount`, and `target`. Other commands need `state: ready`.
30+
31+
## Troubleshooting
32+
33+
- **`waiting-for-runtime` / timeout** — Fusebox dispatcher missing: RN needs Rozenite in Metro; Chrome needs the extension on that tab.
34+
- **`toolCount: 0` but `ready`** — App has not registered tools yet; wait for `register-tool` events.
35+
- **Call hangs** — Tool handler not returning; default timeout 30s.

0 commit comments

Comments
 (0)