Spaces host (TypeScript)
The @trycua/cua/spaces/host helpers for hosting a Space from Node.
The @trycua/cua/spaces/host helpers for hosting a Space from Node.
Import from @trycua/cua/spaces/host. This page covers the hand-written TypeScript layer; the generated native binding (sandboxes, guest, fleet, spaces objects) is documented per object in the Cua SDK reference.
new HostPresentation(options?): HostPresentation;| Parameter | Type |
|---|---|
options | HostPresentationOptions |
available(): Promise<boolean>;Is the desktop app reachable right now?
Promise<boolean>
openViewer(spaceId): Promise<void>;Open the full viewer window for a Local Space.
| Parameter | Type |
|---|---|
spaceId | string |
Promise<void>
pin(spaceId): Promise<void>;Pin a Local Space as picture-in-picture on this Mac's desktop.
| Parameter | Type |
|---|---|
spaceId | string |
Promise<void>
streamWindow(input): Promise<void>;Stream one window of a Local Space back to a bidirectional window here.
rcdpToken must be read fresh: a Local Space's rcdp token rotates on every
rcdpd restart, so a cached one silently stops working.
replica: true opens an additional stream for the same target rather
than focusing the existing one. Note the real limit: only one page per app
can hardware-decode H.264, so a second concurrent stream falls back to an
uncompressed codec and is visibly heavier.
| Parameter | Type |
|---|---|
input | { appName?: string; rcdpToken: string; replica?: boolean; spaceId: string; title?: string; windowId: string; } |
input.appName? | string |
input.rcdpToken | string |
input.replica? | boolean |
input.spaceId | string |
input.title? | string |
input.windowId | string |
Promise<void>
unpin(spaceId): Promise<void>;| Parameter | Type |
|---|---|
spaceId | string |
Promise<void>
| Property | Type | Description |
|---|---|---|
controlFile? | string | Override the discovery file. Mostly for tests. |
fetch? | (input, init?) => Promise<Response> | Inject a fetch (tests, or a different agent). |
function cuaHome(home, env?): string;$CUA_HOME when set and non-empty, else ~/.cua (the Rust core's rule).
| Parameter | Type |
|---|---|
home | string |
env | Record<string, string | undefined> |
string
function readControlEndpoint(controlFile?): Promise<ControlEndpoint>;Read {port, token} from the app's control file.
| Parameter | Type |
|---|---|
controlFile? | string |
Promise<ControlEndpoint>