Files
zeekayandHanzo Dev 4b3950e96a One wiring between a control plane and the workspace
The web app's page held 145 lines that were not about being a page: read
the registry, fold sessions and sandboxes into machines, mint a url per
pane, poll on the plane's own clock. With three hosts for the workspace
that is three answers to how often a machine goes stale, so it is a hook
now and the page is 22 lines.

What a host still owns is the token and where its cloud is. Each gets the
token its own way — a browser mints it with PKCE, the desktop already
holds the signed-in user's — and the hook has no business knowing which.

TerminalHost had two definitions after the first draft of this, so it
moved to the pure vocabulary both sides read. A lib module importing a
component module would invert the layering, and a second copy of the type
is two answers to what a machine is.

One defect fell out of the move: the signed-out screen showed the
REGISTRY's error, which is always null when there is no token — so a
refused sign-in said nothing at all. The two failures have different
remedies and now have different states.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-14 21:02:37 -07:00

85 lines
2.1 KiB
TypeScript

/**
* The workspace, for whoever is hosting it.
*
* tabs.hanzo.ai is one host. The desktop shell is another, and hanzo.ai a
* third — the same tiling of terminals, desktops and pages in each, because it
* is the same component rather than three that look alike. That is the whole
* reason this file exists: a second copy of a pane tree is a second set of
* answers to what a split does, and they drift.
*
* WHAT A HOST SUPPLIES is the machines and a way to mint a pane's url. The
* `Workspace` component holds no token and calls no server: `hosts` and `mint`
* come in as props, so a host points them at whichever control plane its
* identity belongs to. The functions in `lib/api` are the ones tabs.hanzo.ai
* uses for that, offered here because another host most likely wants the same
* ones — each taking its origin as a parameter.
*
* SOURCE IS PUBLISHED, not a build. Both hosts compile TypeScript already, so a
* build step here would be a second toolchain producing something neither
* needs, and one more thing to be stale.
*/
export { Workspace } from './components/workspace';
/**
* The wiring, so a host supplies a token and nothing else.
*
* `useFleet` reads the registry, folds sessions and sandboxes into machines,
* mints a url per pane and polls on the plane's own clock. It was the web app's
* page; copied into each host it would be three answers to how often a machine
* goes stale.
*/
export { type Fleet, useFleet } from './lib/fleet';
export {
DEFAULT_SHELL,
DEADLINE,
DOT,
READY,
type Binding,
type Shell,
type TerminalHost,
host,
isReady,
label,
machineOf,
mintName,
proves,
rescued,
restore,
safeName,
shellUrl,
web,
} from './lib/panes';
export {
type Dir,
type Geometry,
type Path,
type Tile,
closePane,
geometry,
pageGeometry,
pane,
paneIds,
setRatio,
splitPane,
} from './lib/tiles';
export {
API,
type Class,
type Door,
type Machine,
type SandboxMachine,
type Session,
Refusal,
createSandbox,
frameUrl,
grant,
machineName,
machines,
sandboxes,
sessions,
unfunded,
} from './lib/api';