Commit Graph

1 Commits

Author SHA1 Message Date
jules
f28038abec feat: initial commit — extracted from comfy-cloud
Anything-can-drive-the-UI command bus. Single dispatch point for LLM tool
calls, scripts, and (optional) WebSocket remote control. JSON canonical
form plus a plain-text DSL sugar layer. Includes a visible virtual cursor
that animates to elements before commands act on them.

Modules:
- bus.ts        — CommandBus class, dispatch, handlers, vars, history,
                  listActions, readState. Built-in handlers: navigate, click,
                  fill, submit, select, wait, wait_for, scroll, read, expect,
                  set
- parser.ts     — DSL ↔ JSON, with quoted values, # comments, # speed:
                  directive, $name = <cmd> assignment, $var interpolation,
                  expect assertions
- script.ts     — script runner; loads /scripts/<name>.script, supports
                  sub-scripts via `run` command
- cursor.ts     — virtual cursor + ripple, speed-controlled, aria-hidden
- provider.tsx  — React glue: registers `navigate` via react-router, mounts
                  cursor, exposes window.commandBus / runScript /
                  runScriptText for console use
- ws.ts         — optional WebSocket producer (connectCommandSocket)
- llm-bridge.ts — buildSystemPrompt (DSL ref + live action snapshot),
                  extractActionBlocks, runActionBlocks, estimateTokens,
                  trimMessages
- index.tsx     — barrel re-exports

Peer deps: react, react-router (consuming app provides).

Originally inline in `comfy-cloud/app/lib/`. Extracted as part of the
crema-app-aifirst-template scaffolding.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 18:32:22 +10:00