# wild-workspace — Claude Code Web

A Replit/Lovable-style **chat-first** browser UI that wraps the AI agent already installed on your machine (Claude Code by default; Gemini / GLM / Codex if present).

> v0.1.1 — chat-first workspace + bmo-sync daemon (npm) + per-user proxy (b-ii) live. Implements PRD §5.5 (workspace-platform-prd.md v0.10).

## Quick start

```bash
# recommended — global install from npm
npm i -g @venturewild/workspace
wild-workspace
```

A global install pulls the matching **bmo-sync daemon** binary automatically for
win32-x64 / darwin-x64 / darwin-arm64 / linux-x64 (shipped as `optionalDependencies`).

To build from source instead (dev path):

```bash
# install dependencies & web build
npm install
npm run build

# launch
node server/src/index.mjs
# or after `npm install -g .`
wild-workspace
```

Opens `http://localhost:5173` in your default browser.

## What's in here

```
wild-workspace/
├── server/                # Node.js Hono server + WebSocket bridge
│   ├── bin/
│   │   └── wild-workspace.mjs   # CLI entry (the `bin` field)
│   └── src/
│       ├── index.mjs            # server bootstrap
│       ├── config.mjs           # config + role definitions
│       ├── agent.mjs            # claude / gemini / glm / codex subprocess wrapper
│       ├── account.mjs          # login / account + slug claim
│       ├── share.mjs            # JWT share-token mint + verify
│       ├── inbox.mjs            # .wild/inbox.md watcher
│       ├── fs.mjs               # workspace file tree (collapsed by default)
│       ├── activity.mjs         # AI activity event bus
│       ├── preview.mjs          # dev-server port detection
│       ├── sync.mjs             # bmo-sync wiring
│       ├── daemon-bin.mjs       # resolves the platform daemon binary
│       └── routes/              # REST + WS endpoints
├── web/                   # React + Vite frontend
│   └── src/
│       ├── App.jsx              # role-flagged React tree (partner / viewer / client)
│       ├── components/          # Chat, Preview, FileTree, Onboarding, ShareDialog…
│       └── state/               # session + chat stores
├── vw-proxy/              # Cloudflare Worker — public *.venturewild.llc front door
├── landing/               # marketing / landing page (Cloudflare Pages)
└── docs/                  # design notes (incl. b-ii-proxy-plan.md / -design.md)
```

## The three roles (AR-19)

| Role | URL pattern | What they see |
|---|---|---|
| **partner** | `http://localhost:5173` | Chat + preview + file tree + terminal toggle + inbox + share + deploy |
| **partner (published)** | `https://<user>.venturewild.llc` | Your workspace, live on your claimed per-user subdomain (e.g. `tuananh.venturewild.llc`) |
| **viewer** | `https://<user>.venturewild.llc/<wsid>?t=<token>` | Chat history (read-only) + preview + presence + activity stream |
| **client** | `https://workspace.<client>.com` | Chat + preview + "request changes" only |

Same React tree, role-gated visibility (AR-19).

## AR-17: wrap don't embed

We don't ship an AI agent. `server/src/agent.mjs` spawns `claude` (or `gemini` / `glm` / `codex` if installed) as a subprocess and pipes stdout/stderr through WebSocket to the chat UI. The wrapped agent's modes mirror automatically (AR-18). (The one native binary we *do* bundle is the bmo-sync daemon — see below.)

## bmo-sync daemon + per-user URLs

The workspace bundles the **bmo-sync daemon** (run as a subprocess) which links your
local workspace to a per-user subdomain `https://<user>.venturewild.llc`:

```
browser → vw-proxy (Cloudflare Worker on *.venturewild.llc)
        → bmo-sync (Fly, bmo-sync.fly.dev) → your daemon → local workspace server
```

The Worker reads the `Host` header, resolves the slug via bmo-sync, and forwards to
the bmo-sync Fly origin, which proxies to your most-recently-connected daemon. A
**claimed** slug serves your live workspace (e.g. `tuananh.venturewild.llc` → 200); an
**unclaimed** slug 302-redirects to the landing page (e.g. `apple.venturewild.llc`).

The daemon ships via npm `optionalDependencies` (`@venturewild/workspace-daemon-*@0.1.0`
for win32-x64 / darwin-x64 / darwin-arm64 / linux-x64), resolved at launch by
`server/src/daemon-bin.mjs`. Shipped + verified live as of 2026-05-30; see
[`docs/b-ii-proxy-plan.md`](docs/b-ii-proxy-plan.md),
[`docs/b-ii-proxy-design.md`](docs/b-ii-proxy-design.md), and
[`docs/ECOSYSTEM.md`](docs/ECOSYSTEM.md).

## Rich chat rendering

The chat is the product (AR-16), so it renders like one:

- **Markdown** — agent replies render as GitHub-flavored markdown (`Markdown.jsx`).
- **Syntax-highlighted code** — fenced code blocks via prism-react-renderer, with a copy button.
- **Tool cards** — each tool call (`Read`, `Edit`, `Bash`, …) renders as a compact card with a running/done/error status (`ToolCard.jsx`).
- **Inline diffs** — `Edit` / `Write` / `MultiEdit` show a red/green line diff right in the chat (`DiffView.jsx`).
- **Live streaming** — text streams token-by-token from the rebuilt `agent.mjs` stream-json parser, with a per-turn cost + token footer.

## License

MIT — VentureWild.
