# Awakening Pet Bridge

External local control plane for the Awakening mascot. It does not modify Codex or app.asar.

## API

- GET /health — local service health and current state.
- GET /state — current local state JSON.
- GET /events — local Server-Sent Events stream.
- GET /remote-health — checks the Oracle Pet Gateway over Tailscale.
- POST /state — body: {"state":"running","meta":{...}}.
- POST /codex/activity — accepts Codex-like activity.

## Remote sync

By default, every state change is asynchronously forwarded to the Oracle Pet Gateway at:
`http://100.73.90.98:8080`

Environment variables:
`AWAKENING_PET_REMOTE` overrides the remote URL.
`AWAKENING_PET_TOKEN` sets the optional Bearer token.
`AWAKENING_PET_SYNC=0` disables remote sync.
`AWAKENING_PET_TIMEOUT` sets the remote timeout in milliseconds.

Remote failures never block or break the local bridge.

## State contract

idle, waving, running, running-left, running-right, waiting, review, failed, jumping.

## Run

`node server.js`

Default bind: 127.0.0.1:48173.

## Architecture

Windows bridge = local renderer-facing control point.
Oracle Pet Gateway = remote Awakening event/state endpoint.
Tailscale = private transport between devices.

Awakening owns the event semantics. Codex remains untouched.
