Surface

From srid/emanote · View interactive version

Surface is an AI agent skill from the GitHub repository srid/emanote. How a downstream app consumes the shared @kolu/surface stack (@kolu/surface · surface-app · surface-nix-host · surface-mcp) — declaring a typed reactive surface, serving it, consuming it (SolidJS hooks or a CLI), and mirroring a remote surface over ssh. Grounded in the real consumers: kolu, pulam-we

How to use this skill

Skill file

Using @kolu/surface (downstream consumer guide)

Declare a typed reactive surface once; the framework derives the oRPC contract, wires the

server, and binds the Solid client hooks. This is the consumer guide — changing the

framework needs a paired drishti PR (.claude/rules/surface.md).

Who uses it — match the closest consumer, don't hand-roll

| Consumer | Shape | Notable |

| --- | --- | --- |

| kolu (client+server) | one browser ⇄ one Node server, ONE ws | single-tier; two sibling surfaces; uses surface+surface-app only (not -nix-host) |

| pulam-web | browser ⇄ Node ⇄ ssh fleet mirror | one ws per host (/rpc/ws?host=); connectSurface; re-serves terminalWorkspaceSurface |

| drishti (srid/drishti) | browser ⇄ Node ⇄ ssh agent mirror | the canonical twin; 3 workspaces (common/agent/app) |

| odu (juspay/odu) | CI runner: stdio lanes → unix-socket fan-in → CLI/MCP | serve+consume+mirror over every transport at once; surface-mcp projection |

| pulam-tui / kaval-tui | one-shot CLI/TUI, no browser | transport-blind {client,dispose}; unix-socket local, ssh remote; no .use() hooks |

The spine (real import paths)

Links (transport, swappable)

websocketLink(ws) (/links/websocket) · stdioLink (/links/stdio) · unixSocketLink({socketPath}) (/links/unix-socket) · directLink(router) (/links/direct, in-process identity, for tests). Serve side: serveOverStdio (/peer-server), serveOverUnixSocket (/unix-socket), oRPC RPCHandler (@orpc/server/ws, .upgrade(ws)) for browsers. CLIs keep ONE transport-blind Connection = {client, dispose} so every command is written once across local vs ssh.

Mirror a remote surface (drishti / pulam-web / odu)

  1. Dial the host — getHostSession<contract>({host, binary, resolveDrvPath}) (@kolu/surface-nix-host): long-lived, nix copys the agent closure, runs <bin> --stdio over ssh, reconnects. buildHostRegistry fans out N hosts; one-shot CLIs use dialAgentOnce instead.
  2. Mirror inward — pumpRemoteSurface({source, session, makeSink, …}) (-nix-host) folds the remote agent's frames into a local implementSurface re-serve via a SurfaceSink (makeSink, @kolu/surface/mirror). The parent implements the same surface; a remotely-unobservable cell (e.g. connection state) is parent-authoritative.
  3. Re-serve — the local fragment served on /rpc/ws, accepted via acceptSurfaceSocket (@kolu/surface-app/server). Browsers connect with connectSurface (@kolu/surface-app/solid), which bundles socket + websocketLink + surfaceClient + a default-on liveness heartbeat.

Gotchas (hard-won, all real)

Reference

Runnable end-to-end: packages/surface/example/ (its mini-ci stdio example is odu's seed). Full API + rationale: each package's README.md. Match the closest consumer above; don't reinvent a primitive the table already shows how to use.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.