Files
open-design/apps
Cursor AgentandTom Huang 1ae977e066 feat(cli): od daemon start/status/stop + new HTTP daemon-lifecycle routes
Plan §6 Phase 1.5 / spec §11.7.

The desktop default `od` (no subcommand) keeps its current behaviour
for back-compat. New explicit lifecycle entry:

  od daemon start [--headless] [--serve-web] [--port <n>] [--host <addr>]
                  [--no-open] [--namespace <ns>]

  --headless / --no-open / --serve-web all imply 'do not auto-open the
  browser', so a code agent / CI runner / Docker entry point can launch
  the daemon without electron. The port + host flags fall through to
  OD_PORT / OD_BIND_HOST when unset, matching every other surface.

  od daemon status [--json] [--daemon-url <url>]
  od daemon stop   [--daemon-url <url>]

These two CLI verbs hit the new HTTP routes:

  GET  /api/daemon/status      → { ok, version, bindHost, port, pid,
                                   dataDir, mediaConfigDir, namespace,
                                   installedPlugins, shuttingDown }
  POST /api/daemon/shutdown    → 202; emits SIGTERM so the existing
                                   graceful close path runs unchanged.
                                   requireLocalDaemonRequest enforces the
                                   same loopback / origin check used by
                                   composio config writes (no public
                                   shutdown surface).

This makes `od daemon start --headless --port 17456` followed by
`od plugin install ./fixtures/sample-plugin` and the rest of the
§12.5 walkthrough reachable without electron — exactly the substrate
e2e-3 needs.

Daemon tests: 1448 → 1450 (added daemon-lifecycle with 2 cases:
status snapshot shape; shutdown rejects non-loopback callers).

Co-authored-by: Tom Huang <1043269994@qq.com>
2026-05-09 12:04:42 +00:00
..