Skip to content

Commit 0cfa78a

Browse files
Lykhoydaclaude
andauthored
feat(observe): autostart the observe web UI + lifecycle controls (restart, config opt-out, stable port) (#403)
* docs(specs): observe UI overhaul + autostart design spec Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(plans): TDD implementation plans for observe autostart (PR 1) + UI overhaul (PR 2) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(observe): config resolvers for autostart + port (env > .rn-agent/config.json > default 7333) Implements parsePort, DEFAULT_OBSERVE_PORT, resolveObserveAutostart, and resolveObservePort with env > config > default precedence matching existing resolveAutoConnect pattern. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(observe): restart action + config-resolved port in observe tool Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(observe): pin unique port in observe-tool test so the suite never binds the real default 7333 * feat(observe): per-project state file records the live UI url (GH #383 state-file pattern) * feat(observe): autostart web UI at MCP boot in RN projects (non-fatal, env/config gated) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(observe): SessionStart URL notice + /observe command covers stop/restart and autostart opt-out * fix(observe): route /observe sub-arguments via $ARGUMENTS + tolerate null config in hook notice * build(cdp-bridge): rebuild dist for observe autostart + lifecycle (PR1 tasks 1-5) dist/ is the shipped artifact for the plugin (not gitignored, per 86e54ac). Tasks 1-5 of the observe-autostart-lifecycle spec landed src/test changes but left the compiled output stale; this brings dist back in sync via `tsc` so the shipped plugin actually carries the autostart, port-resolution, restart action, and state-file behaviors. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore: changeset for observe autostart + lifecycle Also applies the oxfmt fix on observe-state-file.test.js caught by the repo-wide `npx oxfmt --check` gate. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(observe): prove stop closes the port while the worker process stays alive * fix(observe): make autostart fire-and-forget so a throwing logger can never reject main() Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(observe): serialize start/stop so a stop racing a pending start cannot orphan the server (PR #403 review) --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent e080ace commit 0cfa78a

21 files changed

Lines changed: 3521 additions & 34 deletions
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"rn-dev-agent-cdp": minor
3+
"rn-dev-agent-plugin": minor
4+
---
5+
6+
The observe web UI now autostarts when the MCP worker boots in an RN project, listening on a
7+
stable default port (7333, `http://127.0.0.1:7333`) with an ephemeral fallback on collision.
8+
New `.rn-agent/config.json` block `{ "observe": { "autoStart": boolean, "port": number } }`
9+
plus `RN_AGENT_OBSERVE_AUTOSTART` env override (precedence env > config > default, matching
10+
`cdp.autoConnect`). The `observe` tool gains a `restart` action; `stop` is session-scoped.
11+
The live URL is recorded in a per-project state file and announced at SessionStart.

commands/observe.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
---
22
command: observe
3-
description: Start the read-only observability web UI and print the URL to watch the agent live.
3+
description: Show the observability web UI URL (it autostarts with the session); stop or restart it.
4+
argument-hint: [stop|restart]
45
---
56

6-
Call the `observe` MCP tool with `action: "start"`. Print the returned `url` prominently and tell the user to open it in a browser to watch the live tool-call timeline, device screenshot, and app state. If it's already running, `observe status` returns the existing URL; to stop, call `observe` with `action: "stop"`.
7+
The observe web UI autostarts when the session begins in an RN project. Permanent opt-out:
8+
`.rn-agent/config.json``{ "observe": { "autoStart": false } }` (port via `observe.port`,
9+
default 7333; env `RN_AGENT_OBSERVE_AUTOSTART` / `RN_AGENT_OBSERVE_PORT` override config).
10+
11+
The user's argument: "$ARGUMENTS"
12+
13+
- If the argument is empty: call the `observe` MCP tool with `action: "status"`. If running,
14+
print the returned `url` prominently and tell the user to open it in a browser to watch the
15+
live tool-call timeline, device screenshot, and app state. If NOT running (autostart disabled
16+
or previously stopped), call `action: "start"` — an explicit /observe is an explicit request
17+
to see the UI — and print the URL.
18+
- If the argument is `stop`: call with `action: "stop"`. The UI stays down for the rest of the
19+
session; mention the config opt-out if the user wants it permanent.
20+
- If the argument is `restart`: call with `action: "restart"` and print the (possibly new) URL.
21+
The event timeline is preserved across restarts.

0 commit comments

Comments
 (0)