Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
// Generated from the cua SDK's UniFFI namespace in libcua_spaces_ffi by
// scripts/build-native.mjs --bindings; do not edit.
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
// Trust me, you don't want to mess with it!
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import nativeModule from "./cua_sdk-ffi";
import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct, type UniffiVTableCallbackInterfaceCuaSdkAudioSink, type UniffiVTableCallbackInterfaceCuaSdkBuildListener, type UniffiVTableCallbackInterfaceCuaSdkFrameSink, type UniffiVTableCallbackInterfaceCuaSdkResourcesListener, type UniffiVTableCallbackInterfaceCuaSdkSpaceCreateListener, type UniffiVTableCallbackInterfaceCuaSdkTeleportApprover,
} from "./cua_sdk-ffi";
import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, type UniffiReferenceHolder, type UniffiRustCallStatus, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterFloat64, FfiConverterInt32, FfiConverterInt64, FfiConverterMap, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCall, uniffiTypeNameSymbol, variantOrdinalSymbol,
} from "@ubjs/core";
const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
const uniffiIsDebug =
// @ts-ignore -- The process global might not be defined
typeof process !== "object" ||
// @ts-ignore -- The process global might not be defined
process?.env?.NODE_ENV !== "production" ||
false;
// Public interface members begin here.
/**
* The category of an event kind: `message`, `user`, `activity` or
* `hidden` (the rule [`AgentEvent::category`] and [`AgentTranscript`] use).
*/
export function agentEventCategory(kind: string): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_agent_event_category(
FfiConverterString.lower(kind, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The harnesses, their readiness, installs, key variables and limits, as
* JSON.
*/
export function agentHarnesses(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_agent_harnesses(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The qualified candidates an `AmbiguousSandbox` message lists (empty
* for any other message).
*/
export function ambiguousSandboxCandidates(message: string): Array<string> {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_ambiguous_sandbox_candidates(
FfiConverterString.lower(message, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The canonical image for `os` (`linux`, `windows`, `macos`) and
* `version` (`None` = default: `ghcr.io/trycua/linux:24.04`,
* `ghcr.io/trycua/windows:2022`, `ghcr.io/trycua/macos:26`; macOS accepts
* `tahoe`/`sequoia`). `CUA_IMAGE_<OS>` overrides the default version.
*/
export function canonicalImage(os: string, version: string | undefined): string /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_canonical_image(
FfiConverterString.lower(os, nativeModule().rustbuffer_alloc),
FfiConverterOptionalString.lower(version, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The canonical image for `os`, `version` and `tier`: `slim` (the minimum
* that passes `cua-spacesd doctor --strict`; CI and benchmarks use it),
* `full` or `None` (the default, with dev tooling), on macOS `xcode`
* / `xcode-<X.Y>` (full plus one pinned Xcode) or, on Linux, `docker`
* (slim plus the Docker engine, a VM: `-docker-disk`). The tag is
* `<os-version>[-<tier>]` (`ghcr.io/trycua/linux:24.04-slim`); the
* resolver finds its `-disk` sibling. `CUA_IMAGE_<OS>` overrides only the
* default full image. Raises `ImageNotPublished` for a tier CI has not
* published yet, `InvalidArgument` for an unknown tier, `xcode` outside
* macOS or `docker` outside Linux.
*/
export function canonicalImageTier(os: string, version: string | undefined, tier: string | undefined): string /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_canonical_image_tier(
FfiConverterString.lower(os, nativeModule().rustbuffer_alloc),
FfiConverterOptionalString.lower(version, nativeModule().rustbuffer_alloc),
FfiConverterOptionalString.lower(tier, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Checks a location, kind and runtime against each other without creating
* anything: `InvalidPlacement` (listing the valid values) when the
* combination does not exist. Empty strings are `auto`; an empty `on` is
* the user default.
*/
export function checkPlacement(on: string, kind: string, runtime: string): void /*throws*/ {uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_func_check_placement(
FfiConverterString.lower(on, nativeModule().rustbuffer_alloc),
FfiConverterString.lower(kind, nativeModule().rustbuffer_alloc),
FfiConverterString.lower(runtime, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
/**
* One setting's effective value and source.
*/
export function configGet(key: string): ConfigEntry /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterTypeConfigEntry.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_config_get(
FfiConverterString.lower(key, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Every setting with its effective value and source.
*/
export function configList(): Array<ConfigEntry> /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceTypeConfigEntry.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_config_list(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The config file's path (`$CUA_HOME/config.toml`).
*/
export function configPath(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_config_path(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Writes a setting to the config file (checked and normalised: `default.on`
* takes `local` or a provider). Returns its effective value, which
* an environment variable may still override.
*/
export function configSet(key: string, value: string): ConfigEntry /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterTypeConfigEntry.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_config_set(
FfiConverterString.lower(key, nativeModule().rustbuffer_alloc),
FfiConverterString.lower(value, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Removes a setting from the config file. Returns its effective value
* afterwards (the environment variable or the built-in default).
*/
export function configUnset(key: string): ConfigEntry /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterTypeConfigEntry.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_config_unset(
FfiConverterString.lower(key, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The contrib providers this build includes (empty unless built with the
* `contrib` feature).
*/
export function contribProvidersBuilt(): Array<string> {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_contrib_providers_built(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Version of the SDK library.
*/
export function cuaSdkVersion(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_cua_sdk_version(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* A link to the errors-reference entry of a [`CuaError`] variant, by name
* (`InvalidArgument`, case-insensitive). An unknown name links to the
* page itself. The bindings' `doc_url` / `docUrl` on `CuaError` use it.
*/
export function errorDocUrl(variant: string): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_error_doc_url(
FfiConverterString.lower(variant, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The canonical image a CLI alias (`linux`, `windows`, `macos[:version]`,
* bare `ubuntu`) names, or `None` for a plain reference (`ubuntu:24.04`
* is Docker Hub's image).
*/
export function imageAlias(name: string): string | undefined {
return ((__rb: Uint8Array) => {
try {
return FfiConverterOptionalString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_image_alias(
FfiConverterString.lower(name, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Every location with the kinds and runtimes it offers (for pickers and
* help text).
*/
export function locations(): Array<LocationInfo> {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceTypeLocationInfo.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_locations(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Whether a `cua auth login` session may be stored, decided without
* reading the OS credential vault (the non-secret session marker, or the
* file store's file). Implicit callers (the default sandbox listing) check
* this before reading the session; an explicit read of a session stored
* before markers existed writes the marker.
*/
export function mayHaveSession(): boolean {
return FfiConverterBool.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_may_have_session(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Connects an MCP client to `config` (from `Sandbox.mcp_config`).
*/
export async function mcpConnect(config: McpConfig, asyncOpts_?: { signal: AbortSignal }): Promise<McpClientLike> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_func_mcp_connect(FfiConverterTypeMcpConfig.lower(config, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_u64,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_u64,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_u64,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_u64,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeMcpClient.lift.bind(FfiConverterTypeMcpClient),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Connects an MCP client to an endpoint URL (`http://host:8765/mcp`; a
* bare origin means `/mcp`) with `headers` on every request.
*/
export async function mcpConnectUrl(url: string, headers: Array<HttpHeader> | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<McpClientLike> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_func_mcp_connect_url(FfiConverterString.lower(url, nativeModule().rustbuffer_alloc),FfiConverterOptionalSequenceTypeHttpHeader.lower(headers, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_u64,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_u64,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_u64,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_u64,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeMcpClient.lift.bind(FfiConverterTypeMcpClient),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Normalises a reference like the docker CLI (`python` is
* `docker.io/library/python:latest`). No registry read.
*/
export function normalizeImage(reference: string): string /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_normalize_image(
FfiConverterString.lower(reference, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The Omarchy image, `ghcr.io/trycua/omarchy:<channel>` (default `edge`;
* also `rc`, `stable`): Omarchy (Arch Linux, Hyprland) with cua-spacesd,
* as an amd64 VM (QEMU locally, KubeVirt in the cloud; emulated on arm64
* hosts). Raises `ImageNotPublished` until CI publishes the channel; pass
* the reference explicitly to use it before then.
*/
export function omarchyImage(channel: string | undefined): string /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_omarchy_image(
FfiConverterOptionalString.lower(channel, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Parses a sandbox ref: `local:<name>`, `cloud:<name>`,
* `direct:<host:port>`, `relay:<machine-id>`, a legacy spelling
* (`space://cloud/<name>`, `url:<addr>`, a URL), or a bare name.
*/
export function parseSandboxRef(input: string): SandboxRefParts /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterTypeSandboxRefParts.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_parse_sandbox_ref(
FfiConverterString.lower(input, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The stable presence color of an agent or other principal (`#rrggbb`): a
* cursor palette color picked by a hash of `id`. Request it when the agent
* joins presence (`PresenceIdentity.color`) and use it as the agent's
* avatar background, so both come from one source.
*/
export function presenceColor(id: string): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_presence_color(
FfiConverterString.lower(id, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The presence conformance vectors (JSON), for binding test suites.
*/
export function presenceConformanceJson(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_presence_conformance_json(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The shared art for `shape` (unknown names give the arrow).
*/
export function presenceCursorArt(shape: string): CursorArt {
return ((__rb: Uint8Array) => {
try {
return FfiConverterTypeCursorArt.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_presence_cursor_art(
FfiConverterString.lower(shape, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The shared art for every shape.
*/
export function presenceCursorArtAll(): Array<CursorArt> {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceTypeCursorArt.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_presence_cursor_art_all(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* A standalone SVG of `shape` in `color`, `size` pixels square.
*/
export function presenceCursorArtSvg(shape: string, color: string, size: number): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_presence_cursor_art_svg(
FfiConverterString.lower(shape, nativeModule().rustbuffer_alloc),
FfiConverterString.lower(color, nativeModule().rustbuffer_alloc),
FfiConverterFloat64.lower(size, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The local clock [`PresenceView`] expects: Unix time in milliseconds.
*/
export function presenceNowMs(): number {
return FfiConverterFloat64.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_presence_now_ms(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Black or white text (`#000000` / `#ffffff`), whichever reads better on
* `background` (`#rrggbb`).
*/
export function presenceTextColor(background: string): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_presence_text_color(
FfiConverterString.lower(background, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Qualifies `name` for a lookup: `local = true` narrows a bare name to
* `local:<name>`, `false` to `cloud:<name>`, `None` keeps it (a bare name
* is then searched across locations). A qualified ref elsewhere than
* `local` asks is an `InvalidArgument`.
*/
export function qualifySandboxRef(name: string, local: boolean | undefined = undefined): string /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_qualify_sandbox_ref(
FfiConverterString.lower(name, nativeModule().rustbuffer_alloc),
FfiConverterOptionalBoolean.lower(local, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Resolves `reference` for `backend` (`auto`, `local`, `provider`,
* `container`/`docker`/`gvisor`, `vm`/`qemu`/`kubevirt`, `lume`)
* on `arch` (`amd64`/`arm64`; `None` = this host).
* `reference` is literal (`ubuntu:24.04` is Docker Hub's image): no
* alias applies here; use [`image_alias`] or [`canonical_image`] first.
* Raises `NotFound` (no such image: e.g. a tag only the local engine has),
* `Unauthenticated` (the registry refused the credentials), `Unsupported`
* (no variant the backend runs, e.g. a macOS image on a cloud provider).
* Blocks while the registry is read (cached for five minutes).
*/
export function resolveImage(reference: string, backend: string, arch: string | undefined): ResolvedImage /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterTypeResolvedImage.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_resolve_image(
FfiConverterString.lower(reference, nativeModule().rustbuffer_alloc),
FfiConverterString.lower(backend, nativeModule().rustbuffer_alloc),
FfiConverterOptionalString.lower(arch, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* [`resolve_image`] for a private image: `secret` joins the head of the
* registry auth chain (it is read in this process and never cached or
* logged). Same errors as [`resolve_image`].
*/
export function resolveImageWithSecret(reference: string, backend: string, arch: string | undefined, secret: RegistrySecret): ResolvedImage /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterTypeResolvedImage.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_resolve_image_with_secret(
FfiConverterString.lower(reference, nativeModule().rustbuffer_alloc),
FfiConverterString.lower(backend, nativeModule().rustbuffer_alloc),
FfiConverterOptionalString.lower(arch, nativeModule().rustbuffer_alloc),
FfiConverterTypeRegistrySecret.lower(secret, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Every location word `on=` accepts, in display order: `local`, `cloud`,
* then the contrib providers (`e2b`, `daytona`, `modal`, ...) and your own
* clouds (`aws`, `gcp`, `hetzner`). A word is listed whether or not this build
* includes that provider (see [`contrib_providers_built`]).
*/
export function sandboxLocations(): Array<string> {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_sandbox_locations(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Which SDK method covers each Spaces contract tool. Language test suites
* check every listed method exists on the generated class.
*/
export function spacesToolMethods(): Array<SpacesToolMethod> {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceTypeSpacesToolMethod.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_spaces_tool_methods(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The person closed the linking notice (either button). Linking starts
* with the app's next launch, never in the process that showed it.
*/
export function telemetryAcknowledgeLinkNotice(): void {uniffiCaller.rustCall(
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
/**
* Records that the first-run notice was shown in the app's UI (nothing is
* sent from a machine before that). Apps that show the notice themselves
* call [`telemetry_use_app_notice`] first so the SDK does not print it.
*/
export function telemetryAcknowledgeNotice(): void {uniffiCaller.rustCall(
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_func_telemetry_acknowledge_notice(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
/**
* Sends queued events now, waiting at most `timeout_ms`; anything left
* is kept on disk for a later process.
*/
export function telemetryFlush(timeoutMs: number): void {uniffiCaller.rustCall(
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_func_telemetry_flush(
FfiConverterUInt32.lower(timeoutMs, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
/**
* The one-time linking notice's words.
*/
export function telemetryLinkNotice(): TelemetryLinkNotice {
return ((__rb: Uint8Array) => {
try {
return FfiConverterTypeTelemetryLinkNotice.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_link_notice(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Whether the app should show the one-time linking notice now: usage data
* is on, the account offered linking, and this machine has not shown it.
*/
export function telemetryLinkNoticeDue(): boolean {
return FfiConverterBool.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_link_notice_due(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Where linking stands: `off`, `not_offered`, `notice_due` or `linked`.
*/
export function telemetryLinkState(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_link_state(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The first-run notice text (an app shows it in its own UI, then calls
* [`telemetry_acknowledge_notice`]).
*/
export function telemetryNoticeText(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_notice_text(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Records a finished cua-bench run: the taskset (catalog name, else
* `custom`), the aggregate success rate (0 to 1, bucketed), the task count
* (bucketed) and the outcome (`ok`, `error`, `cancelled`).
*/
export function telemetryRecordBenchRun(taskset: string, successRate: number | undefined, taskCount: bigint, outcome: string): boolean {
return FfiConverterBool.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_record_bench_run(
FfiConverterString.lower(taskset, nativeModule().rustbuffer_alloc),
FfiConverterOptionalFloat64.lower(successRate, nativeModule().rustbuffer_alloc),
FfiConverterUInt64.lower(taskCount, nativeModule().rustbuffer_alloc),
FfiConverterString.lower(outcome, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Records use of a Spaces app feature (fixed names: `space_create_local`,
* `teleport_drop`, ... see the docs). Returns whether it was queued;
* unknown names are dropped.
*/
export function telemetryRecordFeature(feature: string): boolean {
return FfiConverterBool.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_record_feature(
FfiConverterString.lower(feature, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Records an install or onboarding funnel step (fixed names:
* `onboarding_shown`, `signed_in`, `first_space_created`, ...; `first_*`
* steps count once per install). Returns whether it was queued.
*/
export function telemetryRecordOnboardingStep(step: string, ok: boolean): boolean {
return FfiConverterBool.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_record_onboarding_step(
FfiConverterString.lower(step, nativeModule().rustbuffer_alloc),
FfiConverterBool.lower(ok, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Records one stream session's aggregate stats (bucketed and sampled).
*/
export function telemetryRecordStreamStats(stats: StreamStatsReport): boolean {
return FfiConverterBool.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_record_stream_stats(
FfiConverterTypeStreamStatsReport.lower(stats, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Deletes the anonymous install id and its salt.
*/
export function telemetryResetId(): void /*throws*/ {uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_func_telemetry_reset_id(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
/**
* Every event and property that may be sent, as JSON.
*/
export function telemetrySchemaJson(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_schema_json(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Turns usage telemetry on or off for this machine (`$CUA_HOME/config.toml`,
* the same switch as `cua telemetry off` and the Spaces app setting). The
* environment (`DO_NOT_TRACK`, `CUA_TELEMETRY`) still wins.
*/
export function telemetrySetEnabled(enabled: boolean): TelemetryStatus /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterTypeTelemetryStatus.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_set_enabled(
FfiConverterBool.lower(enabled, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Names the SDK surface events are attributed to. Bindings call it at
* import: `sdk_python`, `sdk_typescript`, `sdk_swift`, `sdk_kotlin`;
* apps pass their own product (`spaces_app`). Unknown names are ignored.
*/
export function telemetrySetSurface(surface: string, version: string): void {uniffiCaller.rustCall(
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_func_telemetry_set_surface(
FfiConverterString.lower(surface, nativeModule().rustbuffer_alloc),
FfiConverterString.lower(version, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
/**
* The last `limit` events queued or sent from this machine, exactly as
* sent, as JSON (`[{status, payload}]`).
*/
export function telemetryShowLast(limit: number): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_show_last(
FfiConverterUInt32.lower(limit, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Telemetry state, and exactly what every event carries.
*/
export function telemetryStatus(): TelemetryStatus {
return ((__rb: Uint8Array) => {
try {
return FfiConverterTypeTelemetryStatus.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_status(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Asks the Spaces API for the signed-in account's opaque id and hands it
* to telemetry (none unlinks). Call at launch and after a sign-in; the
* SDK's own sign-in already does. Returns the link state. Best effort:
* offline or signed out, nothing changes.
*/
export async function telemetrySyncAccount(asyncOpts_?: { signal: AbortSignal }): Promise<string> {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_func_telemetry_sync_account(
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* The host app shows the first-run notice itself (no stderr notice).
*/
export function telemetryUseAppNotice(): void {uniffiCaller.rustCall(
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_func_telemetry_use_app_notice(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
const stringConverter = (() => {
const encoder = new TextEncoder();
const decoder = new TextDecoder();
return {
stringToBytes: (s: string) => encoder.encode(s),
bytesToString: (ab: UniffiByteArray) => decoder.decode(ab),
stringByteLength: (s: string) => encoder.encode(s).byteLength,
writeStringIntoBuffer: (s: string, buf: any, offset: number): number => {
const view = new Uint8Array(
buf.arrayBuffer,
offset,
buf.arrayBuffer.byteLength - offset,
);
return encoder.encodeInto(s, view).written;
},
readStringFromBuffer: (buf: any, offset: number, length: number): string =>
decoder.decode(new Uint8Array(buf.arrayBuffer, offset, length)),
};
})();
const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
/**
* Result of [`Space::agent_message`] / [`Space::agent_stop`].
*/
export type AgentActionReport = {
/**
* Run id.
*/
runId: string,
/**
* Delivered (message) or stopped (stop).
*/
ok: boolean,
/**
* Why.
*/
reason: string,
/**
* The whole report as JSON.
*/
json: string
}
/**
* Generated factory for {@link AgentActionReport} record objects.
*/
export const AgentActionReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentActionReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentActionReport>,
});
})();
const FfiConverterTypeAgentActionReport = (() => {
type TypeName = AgentActionReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
runId: FfiConverterString.read(from),
ok: FfiConverterBool.read(from),
reason: FfiConverterString.read(from),
json: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.runId, into);
FfiConverterBool.write(value.ok, into);
FfiConverterString.write(value.reason, into);
FfiConverterString.write(value.json, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.runId) +
FfiConverterBool.allocationSize(value.ok) +
FfiConverterString.allocationSize(value.reason) +
FfiConverterString.allocationSize(value.json);
}
};
return new FFIConverter();
})();
/**
* A file the run created or changed.
*/
export type AgentArtifact = {
path: string,
size: bigint,
modifiedMs: bigint
}
/**
* Generated factory for {@link AgentArtifact} record objects.
*/
export const AgentArtifact = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentArtifact, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentArtifact>,
});
})();
const FfiConverterTypeAgentArtifact = (() => {
type TypeName = AgentArtifact;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
path: FfiConverterString.read(from),
size: FfiConverterUInt64.read(from),
modifiedMs: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.path, into);
FfiConverterUInt64.write(value.size, into);
FfiConverterUInt64.write(value.modifiedMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.path) +
FfiConverterUInt64.allocationSize(value.size) +
FfiConverterUInt64.allocationSize(value.modifiedMs);
}
};
return new FFIConverter();
})();
/**
* What moved between the drive and a Space.
*/
export type HomeTransfer = {
files: bigint,
bytes: bigint,
unchanged: bigint,
removed: bigint,
/**
* `path (kind)` of each file the secret scanner kept out.
*/
blocked: Array<string>,
millis: bigint
}
/**
* Generated factory for {@link HomeTransfer} record objects.
*/
export const HomeTransfer = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<HomeTransfer, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<HomeTransfer>,
});
})();
const FfiConverterTypeHomeTransfer = (() => {
type TypeName = HomeTransfer;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
files: FfiConverterUInt64.read(from),
bytes: FfiConverterUInt64.read(from),
unchanged: FfiConverterUInt64.read(from),
removed: FfiConverterUInt64.read(from),
blocked: FfiConverterSequenceString.read(from),
millis: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt64.write(value.files, into);
FfiConverterUInt64.write(value.bytes, into);
FfiConverterUInt64.write(value.unchanged, into);
FfiConverterUInt64.write(value.removed, into);
FfiConverterSequenceString.write(value.blocked, into);
FfiConverterUInt64.write(value.millis, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.files) +
FfiConverterUInt64.allocationSize(value.bytes) +
FfiConverterUInt64.allocationSize(value.unchanged) +
FfiConverterUInt64.allocationSize(value.removed) +
FfiConverterSequenceString.allocationSize(value.blocked) +
FfiConverterUInt64.allocationSize(value.millis);
}
};
return new FFIConverter();
})();
/**
* What [`Spaces::persistent_agent_send`] did.
*/
export type AgentDelivery = {
runId: string,
/**
* A new run started (with the home restored) rather than a follow-up.
*/
started: boolean,
restored?: HomeTransfer
}
/**
* Generated factory for {@link AgentDelivery} record objects.
*/
export const AgentDelivery = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentDelivery, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentDelivery>,
});
})();
const FfiConverterTypeAgentDelivery = (() => {
type TypeName = AgentDelivery;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
runId: FfiConverterString.read(from),
started: FfiConverterBool.read(from),
restored: FfiConverterOptionalTypeHomeTransfer.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.runId, into);
FfiConverterBool.write(value.started, into);
FfiConverterOptionalTypeHomeTransfer.write(value.restored, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.runId) +
FfiConverterBool.allocationSize(value.started) +
FfiConverterOptionalTypeHomeTransfer.allocationSize(value.restored);
}
};
return new FFIConverter();
})();
/**
* One normalized event.
*/
export type AgentEvent = {
seq: bigint,
tsMs: bigint,
turn: number,
/**
* `message`, `thought`, `tool_call`, `tool_update`, `plan`, `usage`,
* `permission`, `turn_started`, `turn_ended`, `install`, `error`,
* `exited`, ... (see `harnesses()`).
*/
kind: string,
text?: string,
toolId?: string,
toolTitle?: string,
toolKind?: string,
toolStatus?: string,
stopReason?: string,
/**
* How a conversation view shows it: `message` (the agent's words),
* `user` (the prompt as the agent got it), `activity` (a muted one-line
* row: install, thinking, tools, plan, turn end, notice, error, exit)
* or `hidden`. See [`AgentTranscript`].
*/
category: string,
/**
* One short line for an `activity` event.
*/
summary?: string,
/**
* One human-readable line, when the kind has one.
*/
line?: string,
/**
* The event as written (ACP payload included), JSON.
*/
json: string
}
/**
* Generated factory for {@link AgentEvent} record objects.
*/
export const AgentEvent = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentEvent, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentEvent>,
});
})();
const FfiConverterTypeAgentEvent = (() => {
type TypeName = AgentEvent;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
seq: FfiConverterUInt64.read(from),
tsMs: FfiConverterUInt64.read(from),
turn: FfiConverterUInt32.read(from),
kind: FfiConverterString.read(from),
text: FfiConverterOptionalString.read(from),
toolId: FfiConverterOptionalString.read(from),
toolTitle: FfiConverterOptionalString.read(from),
toolKind: FfiConverterOptionalString.read(from),
toolStatus: FfiConverterOptionalString.read(from),
stopReason: FfiConverterOptionalString.read(from),
category: FfiConverterString.read(from),
summary: FfiConverterOptionalString.read(from),
line: FfiConverterOptionalString.read(from),
json: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt64.write(value.seq, into);
FfiConverterUInt64.write(value.tsMs, into);
FfiConverterUInt32.write(value.turn, into);
FfiConverterString.write(value.kind, into);
FfiConverterOptionalString.write(value.text, into);
FfiConverterOptionalString.write(value.toolId, into);
FfiConverterOptionalString.write(value.toolTitle, into);
FfiConverterOptionalString.write(value.toolKind, into);
FfiConverterOptionalString.write(value.toolStatus, into);
FfiConverterOptionalString.write(value.stopReason, into);
FfiConverterString.write(value.category, into);
FfiConverterOptionalString.write(value.summary, into);
FfiConverterOptionalString.write(value.line, into);
FfiConverterString.write(value.json, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.seq) +
FfiConverterUInt64.allocationSize(value.tsMs) +
FfiConverterUInt32.allocationSize(value.turn) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterOptionalString.allocationSize(value.text) +
FfiConverterOptionalString.allocationSize(value.toolId) +
FfiConverterOptionalString.allocationSize(value.toolTitle) +
FfiConverterOptionalString.allocationSize(value.toolKind) +
FfiConverterOptionalString.allocationSize(value.toolStatus) +
FfiConverterOptionalString.allocationSize(value.stopReason) +
FfiConverterString.allocationSize(value.category) +
FfiConverterOptionalString.allocationSize(value.summary) +
FfiConverterOptionalString.allocationSize(value.line) +
FfiConverterString.allocationSize(value.json);
}
};
return new FFIConverter();
})();
/**
* A page of events.
*/
export type AgentEventPage = {
events: Array<AgentEvent>,
/**
* Pass back to continue.
*/
cursor: bigint,
/**
* Nothing more is written yet.
*/
caughtUp: boolean
}
/**
* Generated factory for {@link AgentEventPage} record objects.
*/
export const AgentEventPage = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentEventPage, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentEventPage>,
});
})();
const FfiConverterTypeAgentEventPage = (() => {
type TypeName = AgentEventPage;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
events: FfiConverterSequenceTypeAgentEvent.read(from),
cursor: FfiConverterUInt64.read(from),
caughtUp: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterSequenceTypeAgentEvent.write(value.events, into);
FfiConverterUInt64.write(value.cursor, into);
FfiConverterBool.write(value.caughtUp, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceTypeAgentEvent.allocationSize(value.events) +
FfiConverterUInt64.allocationSize(value.cursor) +
FfiConverterBool.allocationSize(value.caughtUp);
}
};
return new FFIConverter();
})();
/**
* A file for the first prompt or a follow-up.
*/
export type AgentFile = {
/**
* File name in the run's `attachments/`.
*/
name: string,
bytes: ArrayBuffer
}
/**
* Generated factory for {@link AgentFile} record objects.
*/
export const AgentFile = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentFile, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentFile>,
});
})();
const FfiConverterTypeAgentFile = (() => {
type TypeName = AgentFile;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
bytes: FfiConverterArrayBuffer.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterArrayBuffer.write(value.bytes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterArrayBuffer.allocationSize(value.bytes);
}
};
return new FFIConverter();
})();
/**
* One AI coding agent and what cua configured for it.
*/
export type AgentInfo = {
/**
* Registry id (`claude-code`, `codex`, `cursor`, ...).
*/
id: string,
/**
* Display name.
*/
name: string,
/**
* Whether it looks installed.
*/
installed: boolean,
/**
* What gave it away (`bin:<path>`, `path:<dir>`, `app:<bundle>`).
*/
evidence: Array<string>,
/**
* User skills directory, when the agent supports Agent Skills.
*/
skillsDir?: string,
/**
* User MCP config file, when the agent supports MCP.
*/
mcpConfig?: string,
/**
* `json`, `toml` or `yaml`.
*/
mcpFormat?: string,
/**
* A `cua` MCP server launching a cua binary is configured.
*/
cuaConfigured: boolean,
/**
* That entry is the one cua wrote.
*/
cuaManaged: boolean,
/**
* A `cua-driver` MCP server (background computer-use) is configured.
*/
cuaDriverConfigured: boolean,
/**
* Bundled skills present in the skills directory.
*/
skillsInstalled: Array<string>,
/**
* Installed bundled skills that differ from this SDK's copy.
*/
skillsOutdated: Array<string>,
/**
* Problem reading the MCP config (for example a malformed file).
*/
error?: string,
/**
* What could not be verified from the agent's official docs.
*/
unverified?: string,
/**
* The account the agent signs in with on its own (`ChatGPT` for
* Codex), when cua can see that sign-in.
*/
signIn?: string,
/**
* That sign-in is on this computer.
*/
signedIn: boolean
}
/**
* Generated factory for {@link AgentInfo} record objects.
*/
export const AgentInfo = (() => {
const defaults = () => ({
signIn: undefined,
signedIn: false
});
const create = (() => {
return uniffiCreateRecord<AgentInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentInfo>,
});
})();
const FfiConverterTypeAgentInfo = (() => {
type TypeName = AgentInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
name: FfiConverterString.read(from),
installed: FfiConverterBool.read(from),
evidence: FfiConverterSequenceString.read(from),
skillsDir: FfiConverterOptionalString.read(from),
mcpConfig: FfiConverterOptionalString.read(from),
mcpFormat: FfiConverterOptionalString.read(from),
cuaConfigured: FfiConverterBool.read(from),
cuaManaged: FfiConverterBool.read(from),
cuaDriverConfigured: FfiConverterBool.read(from),
skillsInstalled: FfiConverterSequenceString.read(from),
skillsOutdated: FfiConverterSequenceString.read(from),
error: FfiConverterOptionalString.read(from),
unverified: FfiConverterOptionalString.read(from),
signIn: FfiConverterOptionalString.read(from),
signedIn: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.name, into);
FfiConverterBool.write(value.installed, into);
FfiConverterSequenceString.write(value.evidence, into);
FfiConverterOptionalString.write(value.skillsDir, into);
FfiConverterOptionalString.write(value.mcpConfig, into);
FfiConverterOptionalString.write(value.mcpFormat, into);
FfiConverterBool.write(value.cuaConfigured, into);
FfiConverterBool.write(value.cuaManaged, into);
FfiConverterBool.write(value.cuaDriverConfigured, into);
FfiConverterSequenceString.write(value.skillsInstalled, into);
FfiConverterSequenceString.write(value.skillsOutdated, into);
FfiConverterOptionalString.write(value.error, into);
FfiConverterOptionalString.write(value.unverified, into);
FfiConverterOptionalString.write(value.signIn, into);
FfiConverterBool.write(value.signedIn, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.name) +
FfiConverterBool.allocationSize(value.installed) +
FfiConverterSequenceString.allocationSize(value.evidence) +
FfiConverterOptionalString.allocationSize(value.skillsDir) +
FfiConverterOptionalString.allocationSize(value.mcpConfig) +
FfiConverterOptionalString.allocationSize(value.mcpFormat) +
FfiConverterBool.allocationSize(value.cuaConfigured) +
FfiConverterBool.allocationSize(value.cuaManaged) +
FfiConverterBool.allocationSize(value.cuaDriverConfigured) +
FfiConverterSequenceString.allocationSize(value.skillsInstalled) +
FfiConverterSequenceString.allocationSize(value.skillsOutdated) +
FfiConverterOptionalString.allocationSize(value.error) +
FfiConverterOptionalString.allocationSize(value.unverified) +
FfiConverterOptionalString.allocationSize(value.signIn) +
FfiConverterBool.allocationSize(value.signedIn);
}
};
return new FFIConverter();
})();
/**
* The MCP server to register.
*/
export type AgentMcpServer = {
/**
* Server name (`cua`).
*/
name: string,
/**
* Launch command (an absolute `cua` path is best: GUI agents often
* lack the shell PATH).
*/
command: string,
/**
* Arguments (`["mcp"]`).
*/
args: Array<string>,
/**
* Extra environment.
*/
env: Map<string, string>
}
/**
* Generated factory for {@link AgentMcpServer} record objects.
*/
export const AgentMcpServer = (() => {
const defaults = () => ({
name: "cua",
});
const create = (() => {
return uniffiCreateRecord<AgentMcpServer, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentMcpServer>,
});
})();
const FfiConverterTypeAgentMcpServer = (() => {
type TypeName = AgentMcpServer;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
command: FfiConverterString.read(from),
args: FfiConverterSequenceString.read(from),
env: FfiConverterMapStringString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.command, into);
FfiConverterSequenceString.write(value.args, into);
FfiConverterMapStringString.write(value.env, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.command) +
FfiConverterSequenceString.allocationSize(value.args) +
FfiConverterMapStringString.allocationSize(value.env);
}
};
return new FFIConverter();
})();
/**
* What [`Spaces::agent_pause`] did.
*/
export type AgentPauseReport = {
stoppedRun?: string,
saved?: HomeTransfer,
spaceState: string,
millis: bigint
}
/**
* Generated factory for {@link AgentPauseReport} record objects.
*/
export const AgentPauseReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentPauseReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentPauseReport>,
});
})();
const FfiConverterTypeAgentPauseReport = (() => {
type TypeName = AgentPauseReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
stoppedRun: FfiConverterOptionalString.read(from),
saved: FfiConverterOptionalTypeHomeTransfer.read(from),
spaceState: FfiConverterString.read(from),
millis: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.stoppedRun, into);
FfiConverterOptionalTypeHomeTransfer.write(value.saved, into);
FfiConverterString.write(value.spaceState, into);
FfiConverterUInt64.write(value.millis, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.stoppedRun) +
FfiConverterOptionalTypeHomeTransfer.allocationSize(value.saved) +
FfiConverterString.allocationSize(value.spaceState) +
FfiConverterUInt64.allocationSize(value.millis);
}
};
return new FFIConverter();
})();
/**
* What [`Spaces::agent_resume`] did.
*/
export type AgentResumeReport = {
space: string,
recreated: boolean,
restored?: HomeTransfer,
runId?: string,
/**
* From the call to the home being back in a ready Space.
*/
readyMs: bigint
}
/**
* Generated factory for {@link AgentResumeReport} record objects.
*/
export const AgentResumeReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentResumeReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentResumeReport>,
});
})();
const FfiConverterTypeAgentResumeReport = (() => {
type TypeName = AgentResumeReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
space: FfiConverterString.read(from),
recreated: FfiConverterBool.read(from),
restored: FfiConverterOptionalTypeHomeTransfer.read(from),
runId: FfiConverterOptionalString.read(from),
readyMs: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.space, into);
FfiConverterBool.write(value.recreated, into);
FfiConverterOptionalTypeHomeTransfer.write(value.restored, into);
FfiConverterOptionalString.write(value.runId, into);
FfiConverterUInt64.write(value.readyMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.space) +
FfiConverterBool.allocationSize(value.recreated) +
FfiConverterOptionalTypeHomeTransfer.allocationSize(value.restored) +
FfiConverterOptionalString.allocationSize(value.runId) +
FfiConverterUInt64.allocationSize(value.readyMs);
}
};
return new FFIConverter();
})();
/**
* A run's state.
*/
export type AgentRunInfo = {
runId: string,
harness?: string,
/**
* `running`, `idle`, `failed`, `crashed`, `unknown`.
*/
status: string,
/**
* `installing`, `starting`, `working`, `waiting`, `exited`, ...
*/
phase: string,
reason: string,
turn: number,
alive?: boolean,
/**
* A follow-up sent now starts the next turn (not mid-turn).
*/
acceptsMessage: boolean,
prompt?: string,
label?: string,
/**
* Unix seconds.
*/
createdAt?: number,
json: string
}
/**
* Generated factory for {@link AgentRunInfo} record objects.
*/
export const AgentRunInfo = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentRunInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentRunInfo>,
});
})();
const FfiConverterTypeAgentRunInfo = (() => {
type TypeName = AgentRunInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
runId: FfiConverterString.read(from),
harness: FfiConverterOptionalString.read(from),
status: FfiConverterString.read(from),
phase: FfiConverterString.read(from),
reason: FfiConverterString.read(from),
turn: FfiConverterUInt32.read(from),
alive: FfiConverterOptionalBoolean.read(from),
acceptsMessage: FfiConverterBool.read(from),
prompt: FfiConverterOptionalString.read(from),
label: FfiConverterOptionalString.read(from),
createdAt: FfiConverterOptionalFloat64.read(from),
json: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.runId, into);
FfiConverterOptionalString.write(value.harness, into);
FfiConverterString.write(value.status, into);
FfiConverterString.write(value.phase, into);
FfiConverterString.write(value.reason, into);
FfiConverterUInt32.write(value.turn, into);
FfiConverterOptionalBoolean.write(value.alive, into);
FfiConverterBool.write(value.acceptsMessage, into);
FfiConverterOptionalString.write(value.prompt, into);
FfiConverterOptionalString.write(value.label, into);
FfiConverterOptionalFloat64.write(value.createdAt, into);
FfiConverterString.write(value.json, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.runId) +
FfiConverterOptionalString.allocationSize(value.harness) +
FfiConverterString.allocationSize(value.status) +
FfiConverterString.allocationSize(value.phase) +
FfiConverterString.allocationSize(value.reason) +
FfiConverterUInt32.allocationSize(value.turn) +
FfiConverterOptionalBoolean.allocationSize(value.alive) +
FfiConverterBool.allocationSize(value.acceptsMessage) +
FfiConverterOptionalString.allocationSize(value.prompt) +
FfiConverterOptionalString.allocationSize(value.label) +
FfiConverterOptionalFloat64.allocationSize(value.createdAt) +
FfiConverterString.allocationSize(value.json);
}
};
return new FFIConverter();
})();
/**
* An MCP server a run's agent gets: `url` (streamable HTTP, as reachable
* from inside the sandbox) or `command` (stdio, run in the sandbox).
*/
export type AgentRunMcpServer = {
/**
* Name the agent sees.
*/
name: string,
url?: string,
/**
* Header values (secrets allowed: they travel like env keys).
*/
headers: Map<string, string>,
command?: string,
args: Array<string>,
env: Map<string, string>
}
/**
* Generated factory for {@link AgentRunMcpServer} record objects.
*/
export const AgentRunMcpServer = (() => {
const defaults = () => ({
url: undefined,
headers: new Map(),
command: undefined,
args: [],
env: new Map()
});
const create = (() => {
return uniffiCreateRecord<AgentRunMcpServer, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentRunMcpServer>,
});
})();
const FfiConverterTypeAgentRunMcpServer = (() => {
type TypeName = AgentRunMcpServer;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
url: FfiConverterOptionalString.read(from),
headers: FfiConverterMapStringString.read(from),
command: FfiConverterOptionalString.read(from),
args: FfiConverterSequenceString.read(from),
env: FfiConverterMapStringString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterOptionalString.write(value.url, into);
FfiConverterMapStringString.write(value.headers, into);
FfiConverterOptionalString.write(value.command, into);
FfiConverterSequenceString.write(value.args, into);
FfiConverterMapStringString.write(value.env, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterOptionalString.allocationSize(value.url) +
FfiConverterMapStringString.allocationSize(value.headers) +
FfiConverterOptionalString.allocationSize(value.command) +
FfiConverterSequenceString.allocationSize(value.args) +
FfiConverterMapStringString.allocationSize(value.env);
}
};
return new FFIConverter();
})();
/**
* Options for [`Agents::run`]. Every field is optional.
*/
export type AgentRunOptions = {
/**
* Working directory in the sandbox (default: the run's own).
*/
cwd?: string,
/**
* Git URL cloned into the working directory first.
*/
repo?: string,
branch?: string,
/**
* Env for the agent only (API keys): written 0600 in the run,
* redacted from its event log, never in argv.
*/
env: Map<string, string>,
/**
* Provider key variables copied from THIS process's environment
* (`["ANTHROPIC_API_KEY"]`); only known provider key names.
*/
envFromHost: Array<string>,
/**
* Model id.
*/
model?: string,
/**
* A custom model endpoint (proxy, gateway, compatible server).
*/
baseUrl?: string,
/**
* Its wire format: `anthropic`, `openai-responses`, `openai-chat`,
* `gemini` (default: the harness's own).
*/
wire?: string,
mcpServers: Array<AgentRunMcpServer>,
/**
* Give the agent the sandbox's own MCP (cua-driver). Default true.
*/
sandboxMcp?: boolean,
/**
* Copy the cua skills into the harness. Default true.
*/
skills?: boolean,
/**
* Install what the harness needs. Default true.
*/
install?: boolean,
files: Array<AgentFile>,
/**
* Stop (resumably) once the queue is empty: fire-and-forget.
*/
exitWhenIdle: boolean,
label?: string
}
/**
* Generated factory for {@link AgentRunOptions} record objects.
*/
export const AgentRunOptions = (() => {
const defaults = () => ({
cwd: undefined,
repo: undefined,
branch: undefined,
env: new Map(),
envFromHost: [],
model: undefined,
baseUrl: undefined,
wire: undefined,
mcpServers: [],
sandboxMcp: undefined,
skills: undefined,
install: undefined,
files: [],
exitWhenIdle: false,
label: undefined
});
const create = (() => {
return uniffiCreateRecord<AgentRunOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentRunOptions>,
});
})();
const FfiConverterTypeAgentRunOptions = (() => {
type TypeName = AgentRunOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
cwd: FfiConverterOptionalString.read(from),
repo: FfiConverterOptionalString.read(from),
branch: FfiConverterOptionalString.read(from),
env: FfiConverterMapStringString.read(from),
envFromHost: FfiConverterSequenceString.read(from),
model: FfiConverterOptionalString.read(from),
baseUrl: FfiConverterOptionalString.read(from),
wire: FfiConverterOptionalString.read(from),
mcpServers: FfiConverterSequenceTypeAgentRunMcpServer.read(from),
sandboxMcp: FfiConverterOptionalBoolean.read(from),
skills: FfiConverterOptionalBoolean.read(from),
install: FfiConverterOptionalBoolean.read(from),
files: FfiConverterSequenceTypeAgentFile.read(from),
exitWhenIdle: FfiConverterBool.read(from),
label: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.cwd, into);
FfiConverterOptionalString.write(value.repo, into);
FfiConverterOptionalString.write(value.branch, into);
FfiConverterMapStringString.write(value.env, into);
FfiConverterSequenceString.write(value.envFromHost, into);
FfiConverterOptionalString.write(value.model, into);
FfiConverterOptionalString.write(value.baseUrl, into);
FfiConverterOptionalString.write(value.wire, into);
FfiConverterSequenceTypeAgentRunMcpServer.write(value.mcpServers, into);
FfiConverterOptionalBoolean.write(value.sandboxMcp, into);
FfiConverterOptionalBoolean.write(value.skills, into);
FfiConverterOptionalBoolean.write(value.install, into);
FfiConverterSequenceTypeAgentFile.write(value.files, into);
FfiConverterBool.write(value.exitWhenIdle, into);
FfiConverterOptionalString.write(value.label, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.cwd) +
FfiConverterOptionalString.allocationSize(value.repo) +
FfiConverterOptionalString.allocationSize(value.branch) +
FfiConverterMapStringString.allocationSize(value.env) +
FfiConverterSequenceString.allocationSize(value.envFromHost) +
FfiConverterOptionalString.allocationSize(value.model) +
FfiConverterOptionalString.allocationSize(value.baseUrl) +
FfiConverterOptionalString.allocationSize(value.wire) +
FfiConverterSequenceTypeAgentRunMcpServer.allocationSize(value.mcpServers) +
FfiConverterOptionalBoolean.allocationSize(value.sandboxMcp) +
FfiConverterOptionalBoolean.allocationSize(value.skills) +
FfiConverterOptionalBoolean.allocationSize(value.install) +
FfiConverterSequenceTypeAgentFile.allocationSize(value.files) +
FfiConverterBool.allocationSize(value.exitWhenIdle) +
FfiConverterOptionalString.allocationSize(value.label);
}
};
return new FFIConverter();
})();
/**
* What the last turn produced.
*/
export type AgentRunResult = {
runId: string,
status: string,
turn: number,
/**
* The agent's messages in the last turn.
*/
text: string,
stopReason?: string,
usageJson?: string,
error?: string,
toolCalls: number
}
/**
* Generated factory for {@link AgentRunResult} record objects.
*/
export const AgentRunResult = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentRunResult, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentRunResult>,
});
})();
const FfiConverterTypeAgentRunResult = (() => {
type TypeName = AgentRunResult;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
runId: FfiConverterString.read(from),
status: FfiConverterString.read(from),
turn: FfiConverterUInt32.read(from),
text: FfiConverterString.read(from),
stopReason: FfiConverterOptionalString.read(from),
usageJson: FfiConverterOptionalString.read(from),
error: FfiConverterOptionalString.read(from),
toolCalls: FfiConverterUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.runId, into);
FfiConverterString.write(value.status, into);
FfiConverterUInt32.write(value.turn, into);
FfiConverterString.write(value.text, into);
FfiConverterOptionalString.write(value.stopReason, into);
FfiConverterOptionalString.write(value.usageJson, into);
FfiConverterOptionalString.write(value.error, into);
FfiConverterUInt32.write(value.toolCalls, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.runId) +
FfiConverterString.allocationSize(value.status) +
FfiConverterUInt32.allocationSize(value.turn) +
FfiConverterString.allocationSize(value.text) +
FfiConverterOptionalString.allocationSize(value.stopReason) +
FfiConverterOptionalString.allocationSize(value.usageJson) +
FfiConverterOptionalString.allocationSize(value.error) +
FfiConverterUInt32.allocationSize(value.toolCalls);
}
};
return new FFIConverter();
})();
/**
* One agent run's status.
*/
export type AgentRunStatus = {
/**
* Run id.
*/
runId: string,
/**
* Agent.
*/
agent?: string,
/**
* Status (`running`, `done`, `failed`, ...).
*/
status: string,
/**
* Why.
*/
reason: string,
/**
* Finer grain: `installing`, `working`, `waiting`, `exited`, ...
*/
phase: string,
/**
* The last turn's final text (`agent_status` only).
*/
resultText?: string,
/**
* A follow-up sent now starts the next turn (the server's rule: idle,
* or a crashed or failed run it restarts; not mid-turn). Read this,
* never derive it from `status`.
*/
acceptsMessage: boolean,
/**
* Output tail.
*/
outputTail?: string,
/**
* The whole status as JSON.
*/
json: string
}
/**
* Generated factory for {@link AgentRunStatus} record objects.
*/
export const AgentRunStatus = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentRunStatus, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentRunStatus>,
});
})();
const FfiConverterTypeAgentRunStatus = (() => {
type TypeName = AgentRunStatus;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
runId: FfiConverterString.read(from),
agent: FfiConverterOptionalString.read(from),
status: FfiConverterString.read(from),
reason: FfiConverterString.read(from),
phase: FfiConverterString.read(from),
resultText: FfiConverterOptionalString.read(from),
acceptsMessage: FfiConverterBool.read(from),
outputTail: FfiConverterOptionalString.read(from),
json: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.runId, into);
FfiConverterOptionalString.write(value.agent, into);
FfiConverterString.write(value.status, into);
FfiConverterString.write(value.reason, into);
FfiConverterString.write(value.phase, into);
FfiConverterOptionalString.write(value.resultText, into);
FfiConverterBool.write(value.acceptsMessage, into);
FfiConverterOptionalString.write(value.outputTail, into);
FfiConverterString.write(value.json, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.runId) +
FfiConverterOptionalString.allocationSize(value.agent) +
FfiConverterString.allocationSize(value.status) +
FfiConverterString.allocationSize(value.reason) +
FfiConverterString.allocationSize(value.phase) +
FfiConverterOptionalString.allocationSize(value.resultText) +
FfiConverterBool.allocationSize(value.acceptsMessage) +
FfiConverterOptionalString.allocationSize(value.outputTail) +
FfiConverterString.allocationSize(value.json);
}
};
return new FFIConverter();
})();
/**
* What an operation touched.
*/
export enum AgentSetupTarget {
/**
* A skill folder.
*/
Skill = "skill",
/**
* An MCP config entry.
*/
Mcp = "mcp"
}
const FfiConverterTypeAgentSetupTarget = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = AgentSetupTarget;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return AgentSetupTarget.Skill;
case 2: return AgentSetupTarget.Mcp;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case AgentSetupTarget.Skill: return ordinalConverter.write(1, into);
case AgentSetupTarget.Mcp: return ordinalConverter.write(2, into);
}
}
allocationSize(value: TypeName): number {
return ordinalConverter.allocationSize(0);
}
}
return new FFIConverter();
})();
/**
* What happened to one target.
*/
export enum AgentSetupChange {
/**
* Written where nothing was.
*/
Created = "created",
/**
* Replaced or edited.
*/
Updated = "updated",
/**
* Already as wanted.
*/
Unchanged = "unchanged",
/**
* Removed (or the previous entry restored).
*/
Removed = "removed",
/**
* Deliberately left alone (see detail).
*/
Skipped = "skipped",
/**
* Failed (see detail); the target was left untouched.
*/
Failed = "failed"
}
const FfiConverterTypeAgentSetupChange = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = AgentSetupChange;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return AgentSetupChange.Created;
case 2: return AgentSetupChange.Updated;
case 3: return AgentSetupChange.Unchanged;
case 4: return AgentSetupChange.Removed;
case 5: return AgentSetupChange.Skipped;
case 6: return AgentSetupChange.Failed;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case AgentSetupChange.Created: return ordinalConverter.write(1, into);
case AgentSetupChange.Updated: return ordinalConverter.write(2, into);
case AgentSetupChange.Unchanged: return ordinalConverter.write(3, into);
case AgentSetupChange.Removed: return ordinalConverter.write(4, into);
case AgentSetupChange.Skipped: return ordinalConverter.write(5, into);
case AgentSetupChange.Failed: return ordinalConverter.write(6, into);
}
}
allocationSize(value: TypeName): number {
return ordinalConverter.allocationSize(0);
}
}
return new FFIConverter();
})();
/**
* One target's outcome.
*/
export type AgentSetupOutcome = {
/**
* Agents served by this target.
*/
agents: Array<string>,
/**
* Kind.
*/
target: AgentSetupTarget,
/**
* Skill or server name.
*/
item: string,
/**
* Skill folder or config file.
*/
path: string,
/**
* Result.
*/
change: AgentSetupChange,
/**
* Explanation.
*/
detail: string,
/**
* Backup taken before this write.
*/
backup?: string
}
/**
* Generated factory for {@link AgentSetupOutcome} record objects.
*/
export const AgentSetupOutcome = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentSetupOutcome, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentSetupOutcome>,
});
})();
const FfiConverterTypeAgentSetupOutcome = (() => {
type TypeName = AgentSetupOutcome;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
agents: FfiConverterSequenceString.read(from),
target: FfiConverterTypeAgentSetupTarget.read(from),
item: FfiConverterString.read(from),
path: FfiConverterString.read(from),
change: FfiConverterTypeAgentSetupChange.read(from),
detail: FfiConverterString.read(from),
backup: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterSequenceString.write(value.agents, into);
FfiConverterTypeAgentSetupTarget.write(value.target, into);
FfiConverterString.write(value.item, into);
FfiConverterString.write(value.path, into);
FfiConverterTypeAgentSetupChange.write(value.change, into);
FfiConverterString.write(value.detail, into);
FfiConverterOptionalString.write(value.backup, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceString.allocationSize(value.agents) +
FfiConverterTypeAgentSetupTarget.allocationSize(value.target) +
FfiConverterString.allocationSize(value.item) +
FfiConverterString.allocationSize(value.path) +
FfiConverterTypeAgentSetupChange.allocationSize(value.change) +
FfiConverterString.allocationSize(value.detail) +
FfiConverterOptionalString.allocationSize(value.backup);
}
};
return new FFIConverter();
})();
/**
* Result of [`Space::agent_start`].
*/
export type AgentStartReport = {
/**
* Run id.
*/
runId: string,
/**
* Agent.
*/
agent: string,
/**
* Space.
*/
space: string,
/**
* spacesd process tag of the first turn.
*/
processTag: string,
/**
* Preparation steps that could not be completed.
*/
notes: Array<string>,
/**
* The whole report as JSON.
*/
json: string
}
/**
* Generated factory for {@link AgentStartReport} record objects.
*/
export const AgentStartReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentStartReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentStartReport>,
});
})();
const FfiConverterTypeAgentStartReport = (() => {
type TypeName = AgentStartReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
runId: FfiConverterString.read(from),
agent: FfiConverterString.read(from),
space: FfiConverterString.read(from),
processTag: FfiConverterString.read(from),
notes: FfiConverterSequenceString.read(from),
json: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.runId, into);
FfiConverterString.write(value.agent, into);
FfiConverterString.write(value.space, into);
FfiConverterString.write(value.processTag, into);
FfiConverterSequenceString.write(value.notes, into);
FfiConverterString.write(value.json, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.runId) +
FfiConverterString.allocationSize(value.agent) +
FfiConverterString.allocationSize(value.space) +
FfiConverterString.allocationSize(value.processTag) +
FfiConverterSequenceString.allocationSize(value.notes) +
FfiConverterString.allocationSize(value.json);
}
};
return new FFIConverter();
})();
/**
* One item of an [`AgentTranscript`].
*/
export type AgentTranscriptItem = {
/**
* `message` (a bubble or prose), `user` (the prompt as the agent got
* it; skip it when the app shows what the user typed) or `activity`
* (a muted, collapsible group of one-line steps).
*/
kind: string,
/**
* Turn number (0 before the first prompt).
*/
turn: number,
/**
* The message or prompt; for `activity`, the group summary (`5 steps`).
*/
text: string,
/**
* `activity` only: one line per step.
*/
steps: Array<string>
}
/**
* Generated factory for {@link AgentTranscriptItem} record objects.
*/
export const AgentTranscriptItem = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AgentTranscriptItem, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AgentTranscriptItem>,
});
})();
const FfiConverterTypeAgentTranscriptItem = (() => {
type TypeName = AgentTranscriptItem;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
kind: FfiConverterString.read(from),
turn: FfiConverterUInt32.read(from),
text: FfiConverterString.read(from),
steps: FfiConverterSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.kind, into);
FfiConverterUInt32.write(value.turn, into);
FfiConverterString.write(value.text, into);
FfiConverterSequenceString.write(value.steps, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.kind) +
FfiConverterUInt32.allocationSize(value.turn) +
FfiConverterString.allocationSize(value.text) +
FfiConverterSequenceString.allocationSize(value.steps);
}
};
return new FFIConverter();
})();
/**
* One audio packet (MEDIA.md §12.2).
*/
export type AudioPacket = {
/**
* Track id from `NegotiatedAudio`.
*/
trackId: number,
/**
* Per-track sequence (wraps mod 2³²).
*/
sequence: number,
/**
* Media-clock time of the first sample (µs).
*/
ptsUs: bigint,
/**
* Samples per channel.
*/
frameSamples: number,
/**
* Must match the latest `audio_config` of the track.
*/
configEpoch: number,
/**
* The previous packet was dropped or the track restarted.
*/
discontinuity: boolean,
/**
* DTX / comfort-noise frame.
*/
dtx: boolean,
/**
* One Opus packet or interleaved s16le PCM.
*/
data: ArrayBuffer
}
/**
* Generated factory for {@link AudioPacket} record objects.
*/
export const AudioPacket = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AudioPacket, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AudioPacket>,
});
})();
const FfiConverterTypeAudioPacket = (() => {
type TypeName = AudioPacket;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
trackId: FfiConverterUInt16.read(from),
sequence: FfiConverterUInt32.read(from),
ptsUs: FfiConverterUInt64.read(from),
frameSamples: FfiConverterUInt16.read(from),
configEpoch: FfiConverterUInt8.read(from),
discontinuity: FfiConverterBool.read(from),
dtx: FfiConverterBool.read(from),
data: FfiConverterArrayBuffer.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt16.write(value.trackId, into);
FfiConverterUInt32.write(value.sequence, into);
FfiConverterUInt64.write(value.ptsUs, into);
FfiConverterUInt16.write(value.frameSamples, into);
FfiConverterUInt8.write(value.configEpoch, into);
FfiConverterBool.write(value.discontinuity, into);
FfiConverterBool.write(value.dtx, into);
FfiConverterArrayBuffer.write(value.data, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt16.allocationSize(value.trackId) +
FfiConverterUInt32.allocationSize(value.sequence) +
FfiConverterUInt64.allocationSize(value.ptsUs) +
FfiConverterUInt16.allocationSize(value.frameSamples) +
FfiConverterUInt8.allocationSize(value.configEpoch) +
FfiConverterBool.allocationSize(value.discontinuity) +
FfiConverterBool.allocationSize(value.dtx) +
FfiConverterArrayBuffer.allocationSize(value.data);
}
};
return new FFIConverter();
})();
/**
* Who is signed in (from token claims; display only).
*/
export type AuthIdentity = {
/**
* `preferred_username`.
*/
username?: string,
/**
* `email`.
*/
email?: string,
/**
* `name`.
*/
name?: string,
/**
* `sub`.
*/
subject?: string,
/**
* One display string (email, else username, else subject).
*/
display?: string
}
/**
* Generated factory for {@link AuthIdentity} record objects.
*/
export const AuthIdentity = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AuthIdentity, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AuthIdentity>,
});
})();
const FfiConverterTypeAuthIdentity = (() => {
type TypeName = AuthIdentity;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
username: FfiConverterOptionalString.read(from),
email: FfiConverterOptionalString.read(from),
name: FfiConverterOptionalString.read(from),
subject: FfiConverterOptionalString.read(from),
display: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.username, into);
FfiConverterOptionalString.write(value.email, into);
FfiConverterOptionalString.write(value.name, into);
FfiConverterOptionalString.write(value.subject, into);
FfiConverterOptionalString.write(value.display, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.username) +
FfiConverterOptionalString.allocationSize(value.email) +
FfiConverterOptionalString.allocationSize(value.name) +
FfiConverterOptionalString.allocationSize(value.subject) +
FfiConverterOptionalString.allocationSize(value.display);
}
};
return new FFIConverter();
})();
/**
* The stored session, read without network access.
*/
export type AuthStatus = {
/**
* A session is stored.
*/
loggedIn: boolean,
/**
* Who.
*/
identity?: AuthIdentity,
/**
* RFC 3339 expiry of the current access token (it refreshes itself).
*/
expiresAt?: string,
/**
* Where credentials live.
*/
store: string
}
/**
* Generated factory for {@link AuthStatus} record objects.
*/
export const AuthStatus = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<AuthStatus, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<AuthStatus>,
});
})();
const FfiConverterTypeAuthStatus = (() => {
type TypeName = AuthStatus;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
loggedIn: FfiConverterBool.read(from),
identity: FfiConverterOptionalTypeAuthIdentity.read(from),
expiresAt: FfiConverterOptionalString.read(from),
store: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterBool.write(value.loggedIn, into);
FfiConverterOptionalTypeAuthIdentity.write(value.identity, into);
FfiConverterOptionalString.write(value.expiresAt, into);
FfiConverterString.write(value.store, into);
}
allocationSize(value: TypeName): number {
return FfiConverterBool.allocationSize(value.loggedIn) +
FfiConverterOptionalTypeAuthIdentity.allocationSize(value.identity) +
FfiConverterOptionalString.allocationSize(value.expiresAt) +
FfiConverterString.allocationSize(value.store);
}
};
return new FFIConverter();
})();
/**
* The fork [`BakeOptions::verify_fork`] made and checked.
*/
export type BakeForkCheck = {
/**
* The fork's name (deleted after the check).
*/
fork: string,
/**
* Seconds from the fork request until it was ready.
*/
forkS: number,
/**
* Seconds the stack check and health commands took in the fork.
*/
checkS: number
}
/**
* Generated factory for {@link BakeForkCheck} record objects.
*/
export const BakeForkCheck = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<BakeForkCheck, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<BakeForkCheck>,
});
})();
const FfiConverterTypeBakeForkCheck = (() => {
type TypeName = BakeForkCheck;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
fork: FfiConverterString.read(from),
forkS: FfiConverterFloat64.read(from),
checkS: FfiConverterFloat64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.fork, into);
FfiConverterFloat64.write(value.forkS, into);
FfiConverterFloat64.write(value.checkS, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.fork) +
FfiConverterFloat64.allocationSize(value.forkS) +
FfiConverterFloat64.allocationSize(value.checkS);
}
};
return new FFIConverter();
})();
/**
* Options for [`Sandboxes::bake`].
*/
export type BakeOptions = {
/**
* The Docker Compose project directory on this machine (holds
* compose.yaml or docker-compose.yml, and whatever it builds or
* mounts).
*/
projectDir: string,
/**
* The checkpoint to save (`Sandboxes.fork(checkpoint, name)` starts
* from it).
*/
checkpoint: string,
/**
* The image: a reference or a local disk path. `None`: the docker tier
* (`Image.linux(tier="docker")`, a Linux image with Docker).
*/
image?: string,
/**
* The bake Space's name. `None`: `bake-<checkpoint>`.
*/
name?: string,
/**
* vCPUs of the bake Space (forks get the same).
*/
cpus?: number,
/**
* Memory of the bake Space in MiB (forks get the same).
*/
memoryMb?: bigint,
/**
* Compose files, relative to the project. Empty: compose's own lookup.
*/
composeFiles: Array<string>,
/**
* The compose project name. `None`: the directory name.
*/
projectName?: string,
/**
* Where the project lands in the guest. `None`:
* `/opt/cua-bake/<project>`.
*/
dest?: string,
/**
* `docker save` tarballs on this machine to `docker load` before
* `compose up`, for images the guest cannot pull.
*/
imageTarballs: Array<string>,
/**
* Guest shell commands, run as root in the project directory, that
* must exit 0 before the checkpoint (each retried until
* `health_timeout_s`). `compose up --wait` already waits for the
* services' healthchecks.
*/
health: Array<string>,
/**
* Budget for `compose up --wait` and each health command, seconds.
*/
healthTimeoutS: number,
/**
* Guest shell commands, run as root in the project directory once the
* stack is healthy and before the checkpoint: state forks should start
* with.
*/
run: Array<string>,
/**
* Fork the checkpoint once, check the stack is live in the fork, then
* delete the fork.
*/
verifyFork: boolean,
/**
* Keep the bake Space after the checkpoint (default: delete it).
*/
keep: boolean
}
/**
* Generated factory for {@link BakeOptions} record objects.
*/
export const BakeOptions = (() => {
const defaults = () => ({
image: undefined,
name: undefined,
cpus: undefined,
memoryMb: undefined,
composeFiles: [],
projectName: undefined,
dest: undefined,
imageTarballs: [],
health: [],
healthTimeoutS: 600,
run: [],
verifyFork: false,
keep: false
});
const create = (() => {
return uniffiCreateRecord<BakeOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<BakeOptions>,
});
})();
const FfiConverterTypeBakeOptions = (() => {
type TypeName = BakeOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
projectDir: FfiConverterString.read(from),
checkpoint: FfiConverterString.read(from),
image: FfiConverterOptionalString.read(from),
name: FfiConverterOptionalString.read(from),
cpus: FfiConverterOptionalUInt32.read(from),
memoryMb: FfiConverterOptionalUInt64.read(from),
composeFiles: FfiConverterSequenceString.read(from),
projectName: FfiConverterOptionalString.read(from),
dest: FfiConverterOptionalString.read(from),
imageTarballs: FfiConverterSequenceString.read(from),
health: FfiConverterSequenceString.read(from),
healthTimeoutS: FfiConverterUInt32.read(from),
run: FfiConverterSequenceString.read(from),
verifyFork: FfiConverterBool.read(from),
keep: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.projectDir, into);
FfiConverterString.write(value.checkpoint, into);
FfiConverterOptionalString.write(value.image, into);
FfiConverterOptionalString.write(value.name, into);
FfiConverterOptionalUInt32.write(value.cpus, into);
FfiConverterOptionalUInt64.write(value.memoryMb, into);
FfiConverterSequenceString.write(value.composeFiles, into);
FfiConverterOptionalString.write(value.projectName, into);
FfiConverterOptionalString.write(value.dest, into);
FfiConverterSequenceString.write(value.imageTarballs, into);
FfiConverterSequenceString.write(value.health, into);
FfiConverterUInt32.write(value.healthTimeoutS, into);
FfiConverterSequenceString.write(value.run, into);
FfiConverterBool.write(value.verifyFork, into);
FfiConverterBool.write(value.keep, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.projectDir) +
FfiConverterString.allocationSize(value.checkpoint) +
FfiConverterOptionalString.allocationSize(value.image) +
FfiConverterOptionalString.allocationSize(value.name) +
FfiConverterOptionalUInt32.allocationSize(value.cpus) +
FfiConverterOptionalUInt64.allocationSize(value.memoryMb) +
FfiConverterSequenceString.allocationSize(value.composeFiles) +
FfiConverterOptionalString.allocationSize(value.projectName) +
FfiConverterOptionalString.allocationSize(value.dest) +
FfiConverterSequenceString.allocationSize(value.imageTarballs) +
FfiConverterSequenceString.allocationSize(value.health) +
FfiConverterUInt32.allocationSize(value.healthTimeoutS) +
FfiConverterSequenceString.allocationSize(value.run) +
FfiConverterBool.allocationSize(value.verifyFork) +
FfiConverterBool.allocationSize(value.keep);
}
};
return new FFIConverter();
})();
/**
* What [`Sandboxes::bake`] did and how long each step took (seconds).
*/
export type BakeSummary = {
/**
* The checkpoint saved.
*/
checkpoint: string,
/**
* The engine holding it (`qemu`, ...).
*/
runtime: string,
/**
* The bake Space (deleted unless `keep`).
*/
space: string,
/**
* The image it ran.
*/
image: string,
/**
* The compose project name.
*/
project: string,
/**
* The project directory in the guest.
*/
dest: string,
/**
* When dockerd became ready, seconds after the guest kernel booted.
*/
dockerdReadyS?: number,
/**
* Creating the Space until its cua-spacesd answered.
*/
createS: number,
/**
* The packed project's size.
*/
uploadBytes: bigint,
/**
* Uploading the project and loading the tarballs.
*/
uploadS: number,
/**
* `docker compose up --wait`.
*/
composeUpS: number,
/**
* The stack check and health commands.
*/
healthS: number,
/**
* The checkpoint.
*/
checkpointS: number,
/**
* The whole bake.
*/
totalS: number,
/**
* One line per container: name, state or health, restarts.
*/
containers: Array<string>,
/**
* The fork check, with `verify_fork`.
*/
verifyFork?: BakeForkCheck
}
/**
* Generated factory for {@link BakeSummary} record objects.
*/
export const BakeSummary = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<BakeSummary, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<BakeSummary>,
});
})();
const FfiConverterTypeBakeSummary = (() => {
type TypeName = BakeSummary;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
checkpoint: FfiConverterString.read(from),
runtime: FfiConverterString.read(from),
space: FfiConverterString.read(from),
image: FfiConverterString.read(from),
project: FfiConverterString.read(from),
dest: FfiConverterString.read(from),
dockerdReadyS: FfiConverterOptionalFloat64.read(from),
createS: FfiConverterFloat64.read(from),
uploadBytes: FfiConverterUInt64.read(from),
uploadS: FfiConverterFloat64.read(from),
composeUpS: FfiConverterFloat64.read(from),
healthS: FfiConverterFloat64.read(from),
checkpointS: FfiConverterFloat64.read(from),
totalS: FfiConverterFloat64.read(from),
containers: FfiConverterSequenceString.read(from),
verifyFork: FfiConverterOptionalTypeBakeForkCheck.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.checkpoint, into);
FfiConverterString.write(value.runtime, into);
FfiConverterString.write(value.space, into);
FfiConverterString.write(value.image, into);
FfiConverterString.write(value.project, into);
FfiConverterString.write(value.dest, into);
FfiConverterOptionalFloat64.write(value.dockerdReadyS, into);
FfiConverterFloat64.write(value.createS, into);
FfiConverterUInt64.write(value.uploadBytes, into);
FfiConverterFloat64.write(value.uploadS, into);
FfiConverterFloat64.write(value.composeUpS, into);
FfiConverterFloat64.write(value.healthS, into);
FfiConverterFloat64.write(value.checkpointS, into);
FfiConverterFloat64.write(value.totalS, into);
FfiConverterSequenceString.write(value.containers, into);
FfiConverterOptionalTypeBakeForkCheck.write(value.verifyFork, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.checkpoint) +
FfiConverterString.allocationSize(value.runtime) +
FfiConverterString.allocationSize(value.space) +
FfiConverterString.allocationSize(value.image) +
FfiConverterString.allocationSize(value.project) +
FfiConverterString.allocationSize(value.dest) +
FfiConverterOptionalFloat64.allocationSize(value.dockerdReadyS) +
FfiConverterFloat64.allocationSize(value.createS) +
FfiConverterUInt64.allocationSize(value.uploadBytes) +
FfiConverterFloat64.allocationSize(value.uploadS) +
FfiConverterFloat64.allocationSize(value.composeUpS) +
FfiConverterFloat64.allocationSize(value.healthS) +
FfiConverterFloat64.allocationSize(value.checkpointS) +
FfiConverterFloat64.allocationSize(value.totalS) +
FfiConverterSequenceString.allocationSize(value.containers) +
FfiConverterOptionalTypeBakeForkCheck.allocationSize(value.verifyFork);
}
};
return new FFIConverter();
})();
/**
* A local file copied into a built image.
*/
export type BuildFile = {
/**
* Local path.
*/
source: string,
/**
* Absolute path in the image.
*/
destination: string
}
/**
* Generated factory for {@link BuildFile} record objects.
*/
export const BuildFile = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<BuildFile, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<BuildFile>,
});
})();
const FfiConverterTypeBuildFile = (() => {
type TypeName = BuildFile;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
source: FfiConverterString.read(from),
destination: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.source, into);
FfiConverterString.write(value.destination, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.source) +
FfiConverterString.allocationSize(value.destination);
}
};
return new FFIConverter();
})();
/**
* What an image configures for commands run in it.
*/
export type BuildImageConfig = {
/**
* The `FROM` reference.
*/
base: string,
/**
* Environment from `ENV` steps.
*/
env: Map<string, string>,
/**
* Working directory, when a step set one.
*/
workdir?: string,
/**
* User, when a step set one.
*/
user?: string,
/**
* The user cua-spacesd runs as in the image.
*/
driverUser: string,
/**
* Default command.
*/
cmd?: Array<string>,
/**
* Entrypoint.
*/
entrypoint?: Array<string>,
/**
* The shell `Run` used.
*/
shell?: Array<string>,
/**
* Exposed ports.
*/
exposed: Array<string>,
/**
* Labels.
*/
labels: Map<string, string>,
/**
* Volumes.
*/
volumes: Array<string>,
/**
* Stop signal.
*/
stopSignal?: string,
/**
* Health check, as written.
*/
healthcheck?: string
}
/**
* Generated factory for {@link BuildImageConfig} record objects.
*/
export const BuildImageConfig = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<BuildImageConfig, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<BuildImageConfig>,
});
})();
const FfiConverterTypeBuildImageConfig = (() => {
type TypeName = BuildImageConfig;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
base: FfiConverterString.read(from),
env: FfiConverterMapStringString.read(from),
workdir: FfiConverterOptionalString.read(from),
user: FfiConverterOptionalString.read(from),
driverUser: FfiConverterString.read(from),
cmd: FfiConverterOptionalSequenceString.read(from),
entrypoint: FfiConverterOptionalSequenceString.read(from),
shell: FfiConverterOptionalSequenceString.read(from),
exposed: FfiConverterSequenceString.read(from),
labels: FfiConverterMapStringString.read(from),
volumes: FfiConverterSequenceString.read(from),
stopSignal: FfiConverterOptionalString.read(from),
healthcheck: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.base, into);
FfiConverterMapStringString.write(value.env, into);
FfiConverterOptionalString.write(value.workdir, into);
FfiConverterOptionalString.write(value.user, into);
FfiConverterString.write(value.driverUser, into);
FfiConverterOptionalSequenceString.write(value.cmd, into);
FfiConverterOptionalSequenceString.write(value.entrypoint, into);
FfiConverterOptionalSequenceString.write(value.shell, into);
FfiConverterSequenceString.write(value.exposed, into);
FfiConverterMapStringString.write(value.labels, into);
FfiConverterSequenceString.write(value.volumes, into);
FfiConverterOptionalString.write(value.stopSignal, into);
FfiConverterOptionalString.write(value.healthcheck, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.base) +
FfiConverterMapStringString.allocationSize(value.env) +
FfiConverterOptionalString.allocationSize(value.workdir) +
FfiConverterOptionalString.allocationSize(value.user) +
FfiConverterString.allocationSize(value.driverUser) +
FfiConverterOptionalSequenceString.allocationSize(value.cmd) +
FfiConverterOptionalSequenceString.allocationSize(value.entrypoint) +
FfiConverterOptionalSequenceString.allocationSize(value.shell) +
FfiConverterSequenceString.allocationSize(value.exposed) +
FfiConverterMapStringString.allocationSize(value.labels) +
FfiConverterSequenceString.allocationSize(value.volumes) +
FfiConverterOptionalString.allocationSize(value.stopSignal) +
FfiConverterOptionalString.allocationSize(value.healthcheck);
}
};
return new FFIConverter();
})();
/**
* A build on this machine ([`Spaces::builds`]).
*/
export type BuildInfo = {
/**
* The final layer's checkpoint.
*/
checkpoint: string,
/**
* The recipe's cache key.
*/
key: string,
/**
* Tags naming it.
*/
tags: Array<string>,
/**
* The `FROM` reference.
*/
base: string,
/**
* Layers it is made of (checkpoints), base first.
*/
layers: Array<string>,
/**
* RFC 3339 build time.
*/
createdAt: string,
/**
* Image configuration.
*/
config: BuildImageConfig
}
/**
* Generated factory for {@link BuildInfo} record objects.
*/
export const BuildInfo = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<BuildInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<BuildInfo>,
});
})();
const FfiConverterTypeBuildInfo = (() => {
type TypeName = BuildInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
checkpoint: FfiConverterString.read(from),
key: FfiConverterString.read(from),
tags: FfiConverterSequenceString.read(from),
base: FfiConverterString.read(from),
layers: FfiConverterSequenceString.read(from),
createdAt: FfiConverterString.read(from),
config: FfiConverterTypeBuildImageConfig.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.checkpoint, into);
FfiConverterString.write(value.key, into);
FfiConverterSequenceString.write(value.tags, into);
FfiConverterString.write(value.base, into);
FfiConverterSequenceString.write(value.layers, into);
FfiConverterString.write(value.createdAt, into);
FfiConverterTypeBuildImageConfig.write(value.config, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.checkpoint) +
FfiConverterString.allocationSize(value.key) +
FfiConverterSequenceString.allocationSize(value.tags) +
FfiConverterString.allocationSize(value.base) +
FfiConverterSequenceString.allocationSize(value.layers) +
FfiConverterString.allocationSize(value.createdAt) +
FfiConverterTypeBuildImageConfig.allocationSize(value.config);
}
};
return new FFIConverter();
})();
// Enum: BuildStep
export enum BuildStep_Tags {
Run = "Run",
RunExec = "RunExec",
Copy = "Copy",
Env = "Env",
Workdir = "Workdir",
User = "User",
Expose = "Expose",
Cmd = "Cmd",
Entrypoint = "Entrypoint",
Shell = "Shell",
Label = "Label",
Volume = "Volume",
StopSignal = "StopSignal",
Healthcheck = "Healthcheck"
}
/**
* One build step. Values are literal: a Dockerfile's `$VAR`s are expanded
* by [`BuildOptions::dockerfile`]'s parser, not here. `Run` and `Copy`
* steps run as the `User`, in the `Workdir` and with the `Env` set before
* them.
*/
export const BuildStep = (() => {
type Run__interface = {
tag: BuildStep_Tags.Run;
inner:
Readonly<{command: string}>
};
/**
* A shell command line (`/bin/sh -c`, or the last `Shell`).
*/
class Run_ extends UniffiEnum implements Run__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.Run;
readonly inner:
Readonly<{command: string}>;
constructor(
inner: {command: string }) {
super("BuildStep", "Run");
this.inner = Object.freeze(inner);
}
static new(
inner: {command: string }): Run_ {
return new Run_(inner);
}
static instanceOf(obj: any): obj is Run_ {
return obj.tag === BuildStep_Tags.Run;
}
}
type RunExec__interface = {
tag: BuildStep_Tags.RunExec;
inner:
Readonly<{argv: Array<string>}>
};
/**
* A command and arguments, run without a shell.
*/
class RunExec_ extends UniffiEnum implements RunExec__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.RunExec;
readonly inner:
Readonly<{argv: Array<string>}>;
constructor(
inner: {argv: Array<string> }) {
super("BuildStep", "RunExec");
this.inner = Object.freeze(inner);
}
static new(
inner: {argv: Array<string> }): RunExec_ {
return new RunExec_(inner);
}
static instanceOf(obj: any): obj is RunExec_ {
return obj.tag === BuildStep_Tags.RunExec;
}
}
type Copy__interface = {
tag: BuildStep_Tags.Copy;
inner:
Readonly<{sources: Array<string>; dest: string; owner?: string; mode?: string; unpack: boolean}>
};
/**
* Files of the build context copied in (`COPY`; `unpack`: `ADD`).
*/
class Copy_ extends UniffiEnum implements Copy__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.Copy;
readonly inner:
Readonly<{sources: Array<string>; dest: string; owner?: string; mode?: string; unpack: boolean}>;
constructor(
inner: {sources: Array<string>; dest: string; owner?: string; mode?: string; unpack: boolean }) {
super("BuildStep", "Copy");
this.inner = Object.freeze(inner);
}
static new(
inner: {sources: Array<string>; dest: string; owner?: string; mode?: string; unpack: boolean }): Copy_ {
return new Copy_(inner);
}
static instanceOf(obj: any): obj is Copy_ {
return obj.tag === BuildStep_Tags.Copy;
}
}
type Env__interface = {
tag: BuildStep_Tags.Env;
inner:
Readonly<{vars: Map<string, string>}>
};
/**
* Environment for later steps and for commands run in the image.
*/
class Env_ extends UniffiEnum implements Env__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.Env;
readonly inner:
Readonly<{vars: Map<string, string>}>;
constructor(
inner: {vars: Map<string, string> }) {
super("BuildStep", "Env");
this.inner = Object.freeze(inner);
}
static new(
inner: {vars: Map<string, string> }): Env_ {
return new Env_(inner);
}
static instanceOf(obj: any): obj is Env_ {
return obj.tag === BuildStep_Tags.Env;
}
}
type Workdir__interface = {
tag: BuildStep_Tags.Workdir;
inner:
Readonly<{path: string}>
};
/**
* The working directory (created when missing).
*/
class Workdir_ extends UniffiEnum implements Workdir__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.Workdir;
readonly inner:
Readonly<{path: string}>;
constructor(
inner: {path: string }) {
super("BuildStep", "Workdir");
this.inner = Object.freeze(inner);
}
static new(
inner: {path: string }): Workdir_ {
return new Workdir_(inner);
}
static instanceOf(obj: any): obj is Workdir_ {
return obj.tag === BuildStep_Tags.Workdir;
}
}
type User__interface = {
tag: BuildStep_Tags.User;
inner:
Readonly<{user: string}>
};
/**
* The user later steps and the image's commands run as.
*/
class User_ extends UniffiEnum implements User__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.User;
readonly inner:
Readonly<{user: string}>;
constructor(
inner: {user: string }) {
super("BuildStep", "User");
this.inner = Object.freeze(inner);
}
static new(
inner: {user: string }): User_ {
return new User_(inner);
}
static instanceOf(obj: any): obj is User_ {
return obj.tag === BuildStep_Tags.User;
}
}
type Expose__interface = {
tag: BuildStep_Tags.Expose;
inner:
Readonly<{ports: Array<string>}>
};
/**
* Ports the image listens on.
*/
class Expose_ extends UniffiEnum implements Expose__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.Expose;
readonly inner:
Readonly<{ports: Array<string>}>;
constructor(
inner: {ports: Array<string> }) {
super("BuildStep", "Expose");
this.inner = Object.freeze(inner);
}
static new(
inner: {ports: Array<string> }): Expose_ {
return new Expose_(inner);
}
static instanceOf(obj: any): obj is Expose_ {
return obj.tag === BuildStep_Tags.Expose;
}
}
type Cmd__interface = {
tag: BuildStep_Tags.Cmd;
inner:
Readonly<{argv: Array<string>}>
};
/**
* The image's default command.
*/
class Cmd_ extends UniffiEnum implements Cmd__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.Cmd;
readonly inner:
Readonly<{argv: Array<string>}>;
constructor(
inner: {argv: Array<string> }) {
super("BuildStep", "Cmd");
this.inner = Object.freeze(inner);
}
static new(
inner: {argv: Array<string> }): Cmd_ {
return new Cmd_(inner);
}
static instanceOf(obj: any): obj is Cmd_ {
return obj.tag === BuildStep_Tags.Cmd;
}
}
type Entrypoint__interface = {
tag: BuildStep_Tags.Entrypoint;
inner:
Readonly<{argv: Array<string>}>
};
/**
* The image's entrypoint.
*/
class Entrypoint_ extends UniffiEnum implements Entrypoint__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.Entrypoint;
readonly inner:
Readonly<{argv: Array<string>}>;
constructor(
inner: {argv: Array<string> }) {
super("BuildStep", "Entrypoint");
this.inner = Object.freeze(inner);
}
static new(
inner: {argv: Array<string> }): Entrypoint_ {
return new Entrypoint_(inner);
}
static instanceOf(obj: any): obj is Entrypoint_ {
return obj.tag === BuildStep_Tags.Entrypoint;
}
}
type Shell__interface = {
tag: BuildStep_Tags.Shell;
inner:
Readonly<{argv: Array<string>}>
};
/**
* The shell `Run` uses.
*/
class Shell_ extends UniffiEnum implements Shell__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.Shell;
readonly inner:
Readonly<{argv: Array<string>}>;
constructor(
inner: {argv: Array<string> }) {
super("BuildStep", "Shell");
this.inner = Object.freeze(inner);
}
static new(
inner: {argv: Array<string> }): Shell_ {
return new Shell_(inner);
}
static instanceOf(obj: any): obj is Shell_ {
return obj.tag === BuildStep_Tags.Shell;
}
}
type Label__interface = {
tag: BuildStep_Tags.Label;
inner:
Readonly<{labels: Map<string, string>}>
};
/**
* Image labels.
*/
class Label_ extends UniffiEnum implements Label__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.Label;
readonly inner:
Readonly<{labels: Map<string, string>}>;
constructor(
inner: {labels: Map<string, string> }) {
super("BuildStep", "Label");
this.inner = Object.freeze(inner);
}
static new(
inner: {labels: Map<string, string> }): Label_ {
return new Label_(inner);
}
static instanceOf(obj: any): obj is Label_ {
return obj.tag === BuildStep_Tags.Label;
}
}
type Volume__interface = {
tag: BuildStep_Tags.Volume;
inner:
Readonly<{paths: Array<string>}>
};
/**
* Volume mount points.
*/
class Volume_ extends UniffiEnum implements Volume__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.Volume;
readonly inner:
Readonly<{paths: Array<string>}>;
constructor(
inner: {paths: Array<string> }) {
super("BuildStep", "Volume");
this.inner = Object.freeze(inner);
}
static new(
inner: {paths: Array<string> }): Volume_ {
return new Volume_(inner);
}
static instanceOf(obj: any): obj is Volume_ {
return obj.tag === BuildStep_Tags.Volume;
}
}
type StopSignal__interface = {
tag: BuildStep_Tags.StopSignal;
inner:
Readonly<{signal: string}>
};
/**
* The stop signal.
*/
class StopSignal_ extends UniffiEnum implements StopSignal__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.StopSignal;
readonly inner:
Readonly<{signal: string}>;
constructor(
inner: {signal: string }) {
super("BuildStep", "StopSignal");
this.inner = Object.freeze(inner);
}
static new(
inner: {signal: string }): StopSignal_ {
return new StopSignal_(inner);
}
static instanceOf(obj: any): obj is StopSignal_ {
return obj.tag === BuildStep_Tags.StopSignal;
}
}
type Healthcheck__interface = {
tag: BuildStep_Tags.Healthcheck;
inner:
Readonly<{text: string}>
};
/**
* The health check, as written.
*/
class Healthcheck_ extends UniffiEnum implements Healthcheck__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "BuildStep";
readonly tag = BuildStep_Tags.Healthcheck;
readonly inner:
Readonly<{text: string}>;
constructor(
inner: {text: string }) {
super("BuildStep", "Healthcheck");
this.inner = Object.freeze(inner);
}
static new(
inner: {text: string }): Healthcheck_ {
return new Healthcheck_(inner);
}
static instanceOf(obj: any): obj is Healthcheck_ {
return obj.tag === BuildStep_Tags.Healthcheck;
}
}
function instanceOf(obj: any): obj is BuildStep {
return obj[uniffiTypeNameSymbol] === "BuildStep";
}
return Object.freeze({
instanceOf,
Run: Run_,
RunExec: RunExec_,
Copy: Copy_,
Env: Env_,
Workdir: Workdir_,
User: User_,
Expose: Expose_,
Cmd: Cmd_,
Entrypoint: Entrypoint_,
Shell: Shell_,
Label: Label_,
Volume: Volume_,
StopSignal: StopSignal_,
Healthcheck: Healthcheck_
});
})();
/**
* One build step. Values are literal: a Dockerfile's `$VAR`s are expanded
* by [`BuildOptions::dockerfile`]'s parser, not here. `Run` and `Copy`
* steps run as the `User`, in the `Workdir` and with the `Env` set before
* them.
*/
export type BuildStep = InstanceType<
typeof BuildStep['Run' | 'RunExec' | 'Copy' | 'Env' | 'Workdir' | 'User' | 'Expose' | 'Cmd' | 'Entrypoint' | 'Shell' | 'Label' | 'Volume' | 'StopSignal' | 'Healthcheck']
>;
// FfiConverter for enum BuildStep
const FfiConverterTypeBuildStep = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = BuildStep;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return new BuildStep.Run({command: FfiConverterString.read(from) });
case 2: return new BuildStep.RunExec({argv: FfiConverterSequenceString.read(from) });
case 3: return new BuildStep.Copy({sources: FfiConverterSequenceString.read(from), dest: FfiConverterString.read(from), owner: FfiConverterOptionalString.read(from), mode: FfiConverterOptionalString.read(from), unpack: FfiConverterBool.read(from) });
case 4: return new BuildStep.Env({vars: FfiConverterMapStringString.read(from) });
case 5: return new BuildStep.Workdir({path: FfiConverterString.read(from) });
case 6: return new BuildStep.User({user: FfiConverterString.read(from) });
case 7: return new BuildStep.Expose({ports: FfiConverterSequenceString.read(from) });
case 8: return new BuildStep.Cmd({argv: FfiConverterSequenceString.read(from) });
case 9: return new BuildStep.Entrypoint({argv: FfiConverterSequenceString.read(from) });
case 10: return new BuildStep.Shell({argv: FfiConverterSequenceString.read(from) });
case 11: return new BuildStep.Label({labels: FfiConverterMapStringString.read(from) });
case 12: return new BuildStep.Volume({paths: FfiConverterSequenceString.read(from) });
case 13: return new BuildStep.StopSignal({signal: FfiConverterString.read(from) });
case 14: return new BuildStep.Healthcheck({text: FfiConverterString.read(from) });
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value.tag) {
case BuildStep_Tags.Run: {
ordinalConverter.write(1, into);
const inner = value.inner;
FfiConverterString.write(inner.command, into);
return;
}
case BuildStep_Tags.RunExec: {
ordinalConverter.write(2, into);
const inner = value.inner;
FfiConverterSequenceString.write(inner.argv, into);
return;
}
case BuildStep_Tags.Copy: {
ordinalConverter.write(3, into);
const inner = value.inner;
FfiConverterSequenceString.write(inner.sources, into);
FfiConverterString.write(inner.dest, into);
FfiConverterOptionalString.write(inner.owner, into);
FfiConverterOptionalString.write(inner.mode, into);
FfiConverterBool.write(inner.unpack, into);
return;
}
case BuildStep_Tags.Env: {
ordinalConverter.write(4, into);
const inner = value.inner;
FfiConverterMapStringString.write(inner.vars, into);
return;
}
case BuildStep_Tags.Workdir: {
ordinalConverter.write(5, into);
const inner = value.inner;
FfiConverterString.write(inner.path, into);
return;
}
case BuildStep_Tags.User: {
ordinalConverter.write(6, into);
const inner = value.inner;
FfiConverterString.write(inner.user, into);
return;
}
case BuildStep_Tags.Expose: {
ordinalConverter.write(7, into);
const inner = value.inner;
FfiConverterSequenceString.write(inner.ports, into);
return;
}
case BuildStep_Tags.Cmd: {
ordinalConverter.write(8, into);
const inner = value.inner;
FfiConverterSequenceString.write(inner.argv, into);
return;
}
case BuildStep_Tags.Entrypoint: {
ordinalConverter.write(9, into);
const inner = value.inner;
FfiConverterSequenceString.write(inner.argv, into);
return;
}
case BuildStep_Tags.Shell: {
ordinalConverter.write(10, into);
const inner = value.inner;
FfiConverterSequenceString.write(inner.argv, into);
return;
}
case BuildStep_Tags.Label: {
ordinalConverter.write(11, into);
const inner = value.inner;
FfiConverterMapStringString.write(inner.labels, into);
return;
}
case BuildStep_Tags.Volume: {
ordinalConverter.write(12, into);
const inner = value.inner;
FfiConverterSequenceString.write(inner.paths, into);
return;
}
case BuildStep_Tags.StopSignal: {
ordinalConverter.write(13, into);
const inner = value.inner;
FfiConverterString.write(inner.signal, into);
return;
}
case BuildStep_Tags.Healthcheck: {
ordinalConverter.write(14, into);
const inner = value.inner;
FfiConverterString.write(inner.text, into);
return;
}
default:
// Throwing from here means that BuildStep_Tags hasn't matched an ordinal.
throw new UniffiInternalError.UnexpectedEnumCase();
}
}
allocationSize(value: TypeName): number {
switch (value.tag) {
case BuildStep_Tags.Run: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(1);
size += FfiConverterString.allocationSize(inner.command);
return size;
}
case BuildStep_Tags.RunExec: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(2);
size += FfiConverterSequenceString.allocationSize(inner.argv);
return size;
}
case BuildStep_Tags.Copy: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(3);
size += FfiConverterSequenceString.allocationSize(inner.sources);
size += FfiConverterString.allocationSize(inner.dest);
size += FfiConverterOptionalString.allocationSize(inner.owner);
size += FfiConverterOptionalString.allocationSize(inner.mode);
size += FfiConverterBool.allocationSize(inner.unpack);
return size;
}
case BuildStep_Tags.Env: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(4);
size += FfiConverterMapStringString.allocationSize(inner.vars);
return size;
}
case BuildStep_Tags.Workdir: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(5);
size += FfiConverterString.allocationSize(inner.path);
return size;
}
case BuildStep_Tags.User: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(6);
size += FfiConverterString.allocationSize(inner.user);
return size;
}
case BuildStep_Tags.Expose: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(7);
size += FfiConverterSequenceString.allocationSize(inner.ports);
return size;
}
case BuildStep_Tags.Cmd: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(8);
size += FfiConverterSequenceString.allocationSize(inner.argv);
return size;
}
case BuildStep_Tags.Entrypoint: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(9);
size += FfiConverterSequenceString.allocationSize(inner.argv);
return size;
}
case BuildStep_Tags.Shell: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(10);
size += FfiConverterSequenceString.allocationSize(inner.argv);
return size;
}
case BuildStep_Tags.Label: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(11);
size += FfiConverterMapStringString.allocationSize(inner.labels);
return size;
}
case BuildStep_Tags.Volume: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(12);
size += FfiConverterSequenceString.allocationSize(inner.paths);
return size;
}
case BuildStep_Tags.StopSignal: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(13);
size += FfiConverterString.allocationSize(inner.signal);
return size;
}
case BuildStep_Tags.Healthcheck: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(14);
size += FfiConverterString.allocationSize(inner.text);
return size;
}
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
}
return new FFIConverter();
})();
/**
* Options for [`Spaces::build`] and [`super::SpaceCreateOptions::build`].
* Give the recipe as a `dockerfile` (text) or a `base` image; `steps` are
* applied after it.
*/
export type BuildOptions = {
/**
* Dockerfile text. One stage; the instructions `cua build` documents
* (multi-stage, heredocs, BuildKit flags and `ONBUILD` are refused,
* naming the line).
*/
dockerfile?: string,
/**
* The build context: the directory `COPY` sources are relative to
* (`.dockerignore` applies). Default: none, and a `COPY` fails.
*/
contextDir?: string,
/**
* A base image, for a build made of `steps` alone: a Cua image,
* `ubuntu:<version>`, `debian:<version>` or `python:<version>`.
*/
base?: string,
/**
* Steps, after the Dockerfile's.
*/
steps: Array<BuildStep>,
/**
* Build arguments (`ARG` values).
*/
buildArgs: Map<string, string>,
/**
* An alias for the result: `Spaces.fork`, `build:<tag>` images and
* `Spaces.create(build=...)` find the build by it.
*/
tag?: string,
/**
* `vm` (default), `container` or `microvm`.
*/
kind?: string,
/**
* Where: `local` (default). A build's checkpoints stay on the machine
* that took them.
*/
on?: string,
/**
* vCPUs of the build's machine, and so of Spaces made from it
* (default 2).
*/
cpus?: number,
/**
* Memory in MiB (default 4096).
*/
memoryMb?: bigint,
/**
* No desktop: only cua-spacesd runs (default true).
*/
headless?: boolean,
/**
* Build every layer again instead of using cached ones.
*/
noCache: boolean,
/**
* Budget for each step in milliseconds (default one hour).
*/
stepTimeoutMs?: bigint
}
/**
* Generated factory for {@link BuildOptions} record objects.
*/
export const BuildOptions = (() => {
const defaults = () => ({
dockerfile: undefined,
contextDir: undefined,
base: undefined,
steps: [],
buildArgs: new Map(),
tag: undefined,
kind: undefined,
on: undefined,
cpus: undefined,
memoryMb: undefined,
headless: undefined,
noCache: false,
stepTimeoutMs: undefined
});
const create = (() => {
return uniffiCreateRecord<BuildOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<BuildOptions>,
});
})();
const FfiConverterTypeBuildOptions = (() => {
type TypeName = BuildOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
dockerfile: FfiConverterOptionalString.read(from),
contextDir: FfiConverterOptionalString.read(from),
base: FfiConverterOptionalString.read(from),
steps: FfiConverterSequenceTypeBuildStep.read(from),
buildArgs: FfiConverterMapStringString.read(from),
tag: FfiConverterOptionalString.read(from),
kind: FfiConverterOptionalString.read(from),
on: FfiConverterOptionalString.read(from),
cpus: FfiConverterOptionalUInt32.read(from),
memoryMb: FfiConverterOptionalUInt64.read(from),
headless: FfiConverterOptionalBoolean.read(from),
noCache: FfiConverterBool.read(from),
stepTimeoutMs: FfiConverterOptionalUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.dockerfile, into);
FfiConverterOptionalString.write(value.contextDir, into);
FfiConverterOptionalString.write(value.base, into);
FfiConverterSequenceTypeBuildStep.write(value.steps, into);
FfiConverterMapStringString.write(value.buildArgs, into);
FfiConverterOptionalString.write(value.tag, into);
FfiConverterOptionalString.write(value.kind, into);
FfiConverterOptionalString.write(value.on, into);
FfiConverterOptionalUInt32.write(value.cpus, into);
FfiConverterOptionalUInt64.write(value.memoryMb, into);
FfiConverterOptionalBoolean.write(value.headless, into);
FfiConverterBool.write(value.noCache, into);
FfiConverterOptionalUInt64.write(value.stepTimeoutMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.dockerfile) +
FfiConverterOptionalString.allocationSize(value.contextDir) +
FfiConverterOptionalString.allocationSize(value.base) +
FfiConverterSequenceTypeBuildStep.allocationSize(value.steps) +
FfiConverterMapStringString.allocationSize(value.buildArgs) +
FfiConverterOptionalString.allocationSize(value.tag) +
FfiConverterOptionalString.allocationSize(value.kind) +
FfiConverterOptionalString.allocationSize(value.on) +
FfiConverterOptionalUInt32.allocationSize(value.cpus) +
FfiConverterOptionalUInt64.allocationSize(value.memoryMb) +
FfiConverterOptionalBoolean.allocationSize(value.headless) +
FfiConverterBool.allocationSize(value.noCache) +
FfiConverterOptionalUInt64.allocationSize(value.stepTimeoutMs);
}
};
return new FFIConverter();
})();
/**
* What a build is doing ([`Spaces::build_with_progress`]).
*/
export type BuildProgress = {
/**
* `note`, `step`, `output`, `step_done` or `finished`.
*/
event: string,
/**
* The step (0: the base image).
*/
index: number,
/**
* Steps after the base.
*/
total: number,
/**
* The step as a line, a note, or an output line.
*/
text: string,
/**
* `step`: served from a cached layer. `finished`: nothing ran.
*/
cached: boolean,
/**
* `step_done` and `finished`: seconds taken.
*/
seconds: number,
/**
* `step_done`: the layer's checkpoint.
*/
checkpoint: string
}
/**
* Generated factory for {@link BuildProgress} record objects.
*/
export const BuildProgress = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<BuildProgress, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<BuildProgress>,
});
})();
const FfiConverterTypeBuildProgress = (() => {
type TypeName = BuildProgress;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
event: FfiConverterString.read(from),
index: FfiConverterUInt32.read(from),
total: FfiConverterUInt32.read(from),
text: FfiConverterString.read(from),
cached: FfiConverterBool.read(from),
seconds: FfiConverterFloat64.read(from),
checkpoint: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.event, into);
FfiConverterUInt32.write(value.index, into);
FfiConverterUInt32.write(value.total, into);
FfiConverterString.write(value.text, into);
FfiConverterBool.write(value.cached, into);
FfiConverterFloat64.write(value.seconds, into);
FfiConverterString.write(value.checkpoint, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.event) +
FfiConverterUInt32.allocationSize(value.index) +
FfiConverterUInt32.allocationSize(value.total) +
FfiConverterString.allocationSize(value.text) +
FfiConverterBool.allocationSize(value.cached) +
FfiConverterFloat64.allocationSize(value.seconds) +
FfiConverterString.allocationSize(value.checkpoint);
}
};
return new FFIConverter();
})();
/**
* One step of a finished build.
*/
export type BuildStepResult = {
/**
* The step (0: the base image).
*/
index: number,
/**
* The step as a line (`RUN make`).
*/
text: string,
/**
* Served from a cached layer: nothing ran.
*/
cached: boolean,
/**
* Seconds it took (0 when cached).
*/
seconds: number,
/**
* The layer's checkpoint, for a step that makes one.
*/
checkpoint?: string
}
/**
* Generated factory for {@link BuildStepResult} record objects.
*/
export const BuildStepResult = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<BuildStepResult, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<BuildStepResult>,
});
})();
const FfiConverterTypeBuildStepResult = (() => {
type TypeName = BuildStepResult;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
index: FfiConverterUInt32.read(from),
text: FfiConverterString.read(from),
cached: FfiConverterBool.read(from),
seconds: FfiConverterFloat64.read(from),
checkpoint: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt32.write(value.index, into);
FfiConverterString.write(value.text, into);
FfiConverterBool.write(value.cached, into);
FfiConverterFloat64.write(value.seconds, into);
FfiConverterOptionalString.write(value.checkpoint, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt32.allocationSize(value.index) +
FfiConverterString.allocationSize(value.text) +
FfiConverterBool.allocationSize(value.cached) +
FfiConverterFloat64.allocationSize(value.seconds) +
FfiConverterOptionalString.allocationSize(value.checkpoint);
}
};
return new FFIConverter();
})();
/**
* The result of [`Spaces::build`].
*/
export type BuildResult = {
/**
* The final layer's checkpoint: `Spaces.fork` and `cua sb fork` start
* Spaces from it.
*/
checkpoint: string,
/**
* The tag, when one was asked for.
*/
tag?: string,
/**
* The recipe's cache key.
*/
key: string,
/**
* Every layer was cached: nothing ran.
*/
cached: boolean,
/**
* One per step, base first.
*/
steps: Array<BuildStepResult>,
/**
* What commands run in the image get.
*/
config: BuildImageConfig,
/**
* Seconds the build took.
*/
seconds: number
}
/**
* Generated factory for {@link BuildResult} record objects.
*/
export const BuildResult = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<BuildResult, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<BuildResult>,
});
})();
const FfiConverterTypeBuildResult = (() => {
type TypeName = BuildResult;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
checkpoint: FfiConverterString.read(from),
tag: FfiConverterOptionalString.read(from),
key: FfiConverterString.read(from),
cached: FfiConverterBool.read(from),
steps: FfiConverterSequenceTypeBuildStepResult.read(from),
config: FfiConverterTypeBuildImageConfig.read(from),
seconds: FfiConverterFloat64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.checkpoint, into);
FfiConverterOptionalString.write(value.tag, into);
FfiConverterString.write(value.key, into);
FfiConverterBool.write(value.cached, into);
FfiConverterSequenceTypeBuildStepResult.write(value.steps, into);
FfiConverterTypeBuildImageConfig.write(value.config, into);
FfiConverterFloat64.write(value.seconds, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.checkpoint) +
FfiConverterOptionalString.allocationSize(value.tag) +
FfiConverterString.allocationSize(value.key) +
FfiConverterBool.allocationSize(value.cached) +
FfiConverterSequenceTypeBuildStepResult.allocationSize(value.steps) +
FfiConverterTypeBuildImageConfig.allocationSize(value.config) +
FfiConverterFloat64.allocationSize(value.seconds);
}
};
return new FFIConverter();
})();
/**
* A skill bundled with the SDK.
*/
export type BundledSkill = {
/**
* Name.
*/
name: string,
/**
* Description.
*/
description: string,
/**
* Version.
*/
version: string,
/**
* Number of files.
*/
files: number
}
/**
* Generated factory for {@link BundledSkill} record objects.
*/
export const BundledSkill = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<BundledSkill, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<BundledSkill>,
});
})();
const FfiConverterTypeBundledSkill = (() => {
type TypeName = BundledSkill;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
description: FfiConverterString.read(from),
version: FfiConverterString.read(from),
files: FfiConverterUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.description, into);
FfiConverterString.write(value.version, into);
FfiConverterUInt32.write(value.files, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.description) +
FfiConverterString.allocationSize(value.version) +
FfiConverterUInt32.allocationSize(value.files);
}
};
return new FFIConverter();
})();
/**
* A named checkpoint of a sandbox, and the machine that holds it.
*/
export type CheckpointSummary = {
/**
* The checkpoint's name.
*/
name: string,
/**
* The sandbox it was taken from.
*/
source: string,
/**
* The engine that holds it (`firecracker`, `gvisor`, `qemu`, ...).
*/
runtimeType: string,
/**
* RFC 3339 creation time.
*/
createdAt: string,
/**
* The source's image.
*/
image: string,
/**
* Pinned: a fork source to keep (`delete_checkpoint` refuses it and
* `prune_checkpoints` leaves it until it is unpinned).
*/
pinned: boolean,
/**
* Its forks map its RAM copy-on-write and share the pages they do not
* write (a QEMU memory checkpoint).
*/
sharedMemory: boolean,
/**
* Taken to fork a running sandbox many times ([`Sandboxes::fork_many`]
* of a sandbox): deleted with the last of its forks.
*/
releaseWithForks: boolean,
/**
* How many of its forks still exist (for `release_with_forks`).
*/
forks: number,
/**
* Where it is: empty for this machine, else the name of the machine of
* yours that holds it (a checkpoint of a Space that machine provides).
* Its forks start there (`Spaces.create` with image
* `checkpoint:<name>`, or `fork_many`), or on another machine after a
* verified copy.
*/
host: string
}
/**
* Generated factory for {@link CheckpointSummary} record objects.
*/
export const CheckpointSummary = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CheckpointSummary, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CheckpointSummary>,
});
})();
const FfiConverterTypeCheckpointSummary = (() => {
type TypeName = CheckpointSummary;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
source: FfiConverterString.read(from),
runtimeType: FfiConverterString.read(from),
createdAt: FfiConverterString.read(from),
image: FfiConverterString.read(from),
pinned: FfiConverterBool.read(from),
sharedMemory: FfiConverterBool.read(from),
releaseWithForks: FfiConverterBool.read(from),
forks: FfiConverterUInt32.read(from),
host: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.source, into);
FfiConverterString.write(value.runtimeType, into);
FfiConverterString.write(value.createdAt, into);
FfiConverterString.write(value.image, into);
FfiConverterBool.write(value.pinned, into);
FfiConverterBool.write(value.sharedMemory, into);
FfiConverterBool.write(value.releaseWithForks, into);
FfiConverterUInt32.write(value.forks, into);
FfiConverterString.write(value.host, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.source) +
FfiConverterString.allocationSize(value.runtimeType) +
FfiConverterString.allocationSize(value.createdAt) +
FfiConverterString.allocationSize(value.image) +
FfiConverterBool.allocationSize(value.pinned) +
FfiConverterBool.allocationSize(value.sharedMemory) +
FfiConverterBool.allocationSize(value.releaseWithForks) +
FfiConverterUInt32.allocationSize(value.forks) +
FfiConverterString.allocationSize(value.host);
}
};
return new FFIConverter();
})();
/**
* One line of the cloud audit log (`cloud_audit`). Never a secret.
*/
export type CloudAuditEntry = {
/**
* When (RFC 3339, UTC).
*/
ts: string,
/**
* `connect`, `disconnect`, `resource_recorded`, `resource_created`,
* `resource_confirmed` or `resource_deleted`.
*/
action: string,
provider: string,
/**
* The resource type; empty for `connect` and `disconnect`.
*/
kind: string,
id: string,
/**
* The Space it belongs to.
*/
space: string,
/**
* `user`, `sweep`, `auto-sweep`, `disconnect` or `rollback`.
*/
actor: string,
/**
* `ok`, `failed` or `refused`.
*/
outcome: string,
detail: string
}
/**
* Generated factory for {@link CloudAuditEntry} record objects.
*/
export const CloudAuditEntry = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudAuditEntry, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudAuditEntry>,
});
})();
const FfiConverterTypeCloudAuditEntry = (() => {
type TypeName = CloudAuditEntry;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
ts: FfiConverterString.read(from),
action: FfiConverterString.read(from),
provider: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
id: FfiConverterString.read(from),
space: FfiConverterString.read(from),
actor: FfiConverterString.read(from),
outcome: FfiConverterString.read(from),
detail: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.ts, into);
FfiConverterString.write(value.action, into);
FfiConverterString.write(value.provider, into);
FfiConverterString.write(value.kind, into);
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.space, into);
FfiConverterString.write(value.actor, into);
FfiConverterString.write(value.outcome, into);
FfiConverterString.write(value.detail, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.ts) +
FfiConverterString.allocationSize(value.action) +
FfiConverterString.allocationSize(value.provider) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.space) +
FfiConverterString.allocationSize(value.actor) +
FfiConverterString.allocationSize(value.outcome) +
FfiConverterString.allocationSize(value.detail);
}
};
return new FFIConverter();
})();
/**
* One check `cloud_test` ran.
*/
export type CloudCheck = {
name: string,
ok: boolean,
detail: string
}
/**
* Generated factory for {@link CloudCheck} record objects.
*/
export const CloudCheck = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudCheck, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudCheck>,
});
})();
const FfiConverterTypeCloudCheck = (() => {
type TypeName = CloudCheck;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
ok: FfiConverterBool.read(from),
detail: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterBool.write(value.ok, into);
FfiConverterString.write(value.detail, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterBool.allocationSize(value.ok) +
FfiConverterString.allocationSize(value.detail);
}
};
return new FFIConverter();
})();
/**
* How `cloud_connect` links a cloud, beyond where.
*/
export type CloudConnectOptions = {
/**
* `cli` (default), `oidc` (AWS: no stored key) or `sealed`.
*/
auth?: string,
/**
* The monthly budget, US dollars.
*/
budgetUsdMonth?: number,
/**
* The largest machine, `4x16`.
*/
maxSize?: string,
/**
* AWS `oidc`: the 12-digit account id.
*/
accountId?: string,
/**
* AWS `oidc`: the role ARN when it is not `cua-spaces`.
*/
roleArn?: string,
/**
* `oidc`: prove the link (nothing is created) and save it.
*/
check: boolean,
/**
* The agent making the change; its changes wait for approval.
*/
agent?: string
}
/**
* Generated factory for {@link CloudConnectOptions} record objects.
*/
export const CloudConnectOptions = (() => {
const defaults = () => ({
auth: undefined,
budgetUsdMonth: undefined,
maxSize: undefined,
accountId: undefined,
roleArn: undefined,
check: false,
agent: undefined
});
const create = (() => {
return uniffiCreateRecord<CloudConnectOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudConnectOptions>,
});
})();
const FfiConverterTypeCloudConnectOptions = (() => {
type TypeName = CloudConnectOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
auth: FfiConverterOptionalString.read(from),
budgetUsdMonth: FfiConverterOptionalFloat64.read(from),
maxSize: FfiConverterOptionalString.read(from),
accountId: FfiConverterOptionalString.read(from),
roleArn: FfiConverterOptionalString.read(from),
check: FfiConverterBool.read(from),
agent: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.auth, into);
FfiConverterOptionalFloat64.write(value.budgetUsdMonth, into);
FfiConverterOptionalString.write(value.maxSize, into);
FfiConverterOptionalString.write(value.accountId, into);
FfiConverterOptionalString.write(value.roleArn, into);
FfiConverterBool.write(value.check, into);
FfiConverterOptionalString.write(value.agent, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.auth) +
FfiConverterOptionalFloat64.allocationSize(value.budgetUsdMonth) +
FfiConverterOptionalString.allocationSize(value.maxSize) +
FfiConverterOptionalString.allocationSize(value.accountId) +
FfiConverterOptionalString.allocationSize(value.roleArn) +
FfiConverterBool.allocationSize(value.check) +
FfiConverterOptionalString.allocationSize(value.agent);
}
};
return new FFIConverter();
})();
/**
* Where a cloud's credentials were found on this machine (never a
* secret).
*/
export type CloudCredentials = {
found: boolean,
/**
* "~/.aws profile default", "gcloud account [email protected]".
*/
source: string
}
/**
* Generated factory for {@link CloudCredentials} record objects.
*/
export const CloudCredentials = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudCredentials, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudCredentials>,
});
})();
const FfiConverterTypeCloudCredentials = (() => {
type TypeName = CloudCredentials;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
found: FfiConverterBool.read(from),
source: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterBool.write(value.found, into);
FfiConverterString.write(value.source, into);
}
allocationSize(value: TypeName): number {
return FfiConverterBool.allocationSize(value.found) +
FfiConverterString.allocationSize(value.source);
}
};
return new FFIConverter();
})();
/**
* What a cloud can run for one image family, and the estimated cost.
*/
export type CloudKind = {
/**
* `linux`, `linux-slim`, `windows`, `omarchy`, `macos`.
*/
image: string,
/**
* `container` or `vm`.
*/
kind: string,
supported: boolean,
/**
* Why not, or how it runs (one line).
*/
reason: string,
/**
* The machine type Cua picks (`t3.medium`, `e2-medium`).
*/
machineType: string,
/**
* Estimated on-demand US dollars per hour while it runs.
*/
usdPerHour: number
}
/**
* Generated factory for {@link CloudKind} record objects.
*/
export const CloudKind = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudKind, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudKind>,
});
})();
const FfiConverterTypeCloudKind = (() => {
type TypeName = CloudKind;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
image: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
supported: FfiConverterBool.read(from),
reason: FfiConverterString.read(from),
machineType: FfiConverterString.read(from),
usdPerHour: FfiConverterFloat64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.image, into);
FfiConverterString.write(value.kind, into);
FfiConverterBool.write(value.supported, into);
FfiConverterString.write(value.reason, into);
FfiConverterString.write(value.machineType, into);
FfiConverterFloat64.write(value.usdPerHour, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.image) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterBool.allocationSize(value.supported) +
FfiConverterString.allocationSize(value.reason) +
FfiConverterString.allocationSize(value.machineType) +
FfiConverterFloat64.allocationSize(value.usdPerHour);
}
};
return new FFIConverter();
})();
/**
* One cloud as `cloud_status` lists it.
*/
export type CloudProvider = {
/**
* `aws`, `gcp`, `hetzner`, `modal`.
*/
name: string,
/**
* `AWS`, `Google Cloud`, `Hetzner Cloud`, `Modal`.
*/
title: string,
/**
* `vm` or `sandbox`.
*/
tier: string,
connected: boolean,
/**
* Whether it is the default location (`default.on`).
*/
default: boolean,
credentials: CloudCredentials,
/**
* The account, project or workspace (after a test or connect).
*/
account: string,
profile: string,
region: string,
zone: string,
project: string,
environment: string,
/**
* "AWS · us-west-2".
*/
label: string,
/**
* Hours after which a Space there deletes itself (0: never).
*/
ttlHours: number,
kinds: Array<CloudKind>,
/**
* `cli` (the cloud CLI's sign-in), `oidc` (no stored key) or
* `sealed`; empty when not connected.
*/
auth: string,
/**
* `connected`, `waiting-for-approval`, `not-connected`; from
* `cloud_connect` also `needs-trust`, `checking`, `failed`.
*/
status: string,
/**
* The monthly budget in US dollars, when set.
*/
budgetUsdMonth?: number,
/**
* The largest machine (`4x16`: vCPUs x GiB), empty: no limit.
*/
maxSize: string,
/**
* Estimated US dollars this calendar month.
*/
spentMonth: number,
/**
* Machines Cua runs there now.
*/
running: number,
/**
* `connection` or `limits` while a person's approval is pending.
*/
approval: string,
/**
* The agent whose request waits for approval.
*/
approvalAgent: string,
/**
* The monthly budget an agent asked for, waiting for approval.
*/
pendingBudgetUsdMonth?: number,
/**
* The largest machine an agent asked for (`4x16`), waiting for
* approval.
*/
pendingMaxSize: string,
/**
* Whether this caller (a person) can approve or deny what waits
* (`cloud_approve`).
*/
canApprove: boolean,
/**
* `oidc` when this link could switch to linking without a stored key
* (an AWS link through the CLI sign-in), else empty.
*/
suggestAuth: string,
/**
* What is wrong with the link and what to do, one sentence, or empty.
*/
issue: string
}
/**
* Generated factory for {@link CloudProvider} record objects.
*/
export const CloudProvider = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudProvider, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudProvider>,
});
})();
const FfiConverterTypeCloudProvider = (() => {
type TypeName = CloudProvider;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
title: FfiConverterString.read(from),
tier: FfiConverterString.read(from),
connected: FfiConverterBool.read(from),
default: FfiConverterBool.read(from),
credentials: FfiConverterTypeCloudCredentials.read(from),
account: FfiConverterString.read(from),
profile: FfiConverterString.read(from),
region: FfiConverterString.read(from),
zone: FfiConverterString.read(from),
project: FfiConverterString.read(from),
environment: FfiConverterString.read(from),
label: FfiConverterString.read(from),
ttlHours: FfiConverterUInt32.read(from),
kinds: FfiConverterSequenceTypeCloudKind.read(from),
auth: FfiConverterString.read(from),
status: FfiConverterString.read(from),
budgetUsdMonth: FfiConverterOptionalFloat64.read(from),
maxSize: FfiConverterString.read(from),
spentMonth: FfiConverterFloat64.read(from),
running: FfiConverterUInt32.read(from),
approval: FfiConverterString.read(from),
approvalAgent: FfiConverterString.read(from),
pendingBudgetUsdMonth: FfiConverterOptionalFloat64.read(from),
pendingMaxSize: FfiConverterString.read(from),
canApprove: FfiConverterBool.read(from),
suggestAuth: FfiConverterString.read(from),
issue: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.title, into);
FfiConverterString.write(value.tier, into);
FfiConverterBool.write(value.connected, into);
FfiConverterBool.write(value.default, into);
FfiConverterTypeCloudCredentials.write(value.credentials, into);
FfiConverterString.write(value.account, into);
FfiConverterString.write(value.profile, into);
FfiConverterString.write(value.region, into);
FfiConverterString.write(value.zone, into);
FfiConverterString.write(value.project, into);
FfiConverterString.write(value.environment, into);
FfiConverterString.write(value.label, into);
FfiConverterUInt32.write(value.ttlHours, into);
FfiConverterSequenceTypeCloudKind.write(value.kinds, into);
FfiConverterString.write(value.auth, into);
FfiConverterString.write(value.status, into);
FfiConverterOptionalFloat64.write(value.budgetUsdMonth, into);
FfiConverterString.write(value.maxSize, into);
FfiConverterFloat64.write(value.spentMonth, into);
FfiConverterUInt32.write(value.running, into);
FfiConverterString.write(value.approval, into);
FfiConverterString.write(value.approvalAgent, into);
FfiConverterOptionalFloat64.write(value.pendingBudgetUsdMonth, into);
FfiConverterString.write(value.pendingMaxSize, into);
FfiConverterBool.write(value.canApprove, into);
FfiConverterString.write(value.suggestAuth, into);
FfiConverterString.write(value.issue, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.title) +
FfiConverterString.allocationSize(value.tier) +
FfiConverterBool.allocationSize(value.connected) +
FfiConverterBool.allocationSize(value.default) +
FfiConverterTypeCloudCredentials.allocationSize(value.credentials) +
FfiConverterString.allocationSize(value.account) +
FfiConverterString.allocationSize(value.profile) +
FfiConverterString.allocationSize(value.region) +
FfiConverterString.allocationSize(value.zone) +
FfiConverterString.allocationSize(value.project) +
FfiConverterString.allocationSize(value.environment) +
FfiConverterString.allocationSize(value.label) +
FfiConverterUInt32.allocationSize(value.ttlHours) +
FfiConverterSequenceTypeCloudKind.allocationSize(value.kinds) +
FfiConverterString.allocationSize(value.auth) +
FfiConverterString.allocationSize(value.status) +
FfiConverterOptionalFloat64.allocationSize(value.budgetUsdMonth) +
FfiConverterString.allocationSize(value.maxSize) +
FfiConverterFloat64.allocationSize(value.spentMonth) +
FfiConverterUInt32.allocationSize(value.running) +
FfiConverterString.allocationSize(value.approval) +
FfiConverterString.allocationSize(value.approvalAgent) +
FfiConverterOptionalFloat64.allocationSize(value.pendingBudgetUsdMonth) +
FfiConverterString.allocationSize(value.pendingMaxSize) +
FfiConverterBool.allocationSize(value.canApprove) +
FfiConverterString.allocationSize(value.suggestAuth) +
FfiConverterString.allocationSize(value.issue);
}
};
return new FFIConverter();
})();
/**
* The next step of a `cloud_connect`: a command for the agent, or a page
* for a person (and what to paste there), and why.
*/
export type CloudNext = {
run?: string,
open?: string,
paste?: string,
why: string
}
/**
* Generated factory for {@link CloudNext} record objects.
*/
export const CloudNext = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudNext, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudNext>,
});
})();
const FfiConverterTypeCloudNext = (() => {
type TypeName = CloudNext;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
run: FfiConverterOptionalString.read(from),
open: FfiConverterOptionalString.read(from),
paste: FfiConverterOptionalString.read(from),
why: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.run, into);
FfiConverterOptionalString.write(value.open, into);
FfiConverterOptionalString.write(value.paste, into);
FfiConverterString.write(value.why, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.run) +
FfiConverterOptionalString.allocationSize(value.open) +
FfiConverterOptionalString.allocationSize(value.paste) +
FfiConverterString.allocationSize(value.why);
}
};
return new FFIConverter();
})();
/**
* `cloud_connect`: the cloud (its `status` is the outcome), the checks it
* ran, the next step and the command that verifies it.
*/
export type CloudConnected = {
provider: CloudProvider,
checks: Array<CloudCheck>,
/**
* `None`: nothing left to do.
*/
next?: CloudNext,
/**
* `cua cloud status aws`.
*/
verify: string
}
/**
* Generated factory for {@link CloudConnected} record objects.
*/
export const CloudConnected = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudConnected, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudConnected>,
});
})();
const FfiConverterTypeCloudConnected = (() => {
type TypeName = CloudConnected;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
provider: FfiConverterTypeCloudProvider.read(from),
checks: FfiConverterSequenceTypeCloudCheck.read(from),
next: FfiConverterOptionalTypeCloudNext.read(from),
verify: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterTypeCloudProvider.write(value.provider, into);
FfiConverterSequenceTypeCloudCheck.write(value.checks, into);
FfiConverterOptionalTypeCloudNext.write(value.next, into);
FfiConverterString.write(value.verify, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypeCloudProvider.allocationSize(value.provider) +
FfiConverterSequenceTypeCloudCheck.allocationSize(value.checks) +
FfiConverterOptionalTypeCloudNext.allocationSize(value.next) +
FfiConverterString.allocationSize(value.verify);
}
};
return new FFIConverter();
})();
/**
* One thing Cua created in a cloud.
*/
export type CloudResource = {
provider: string,
/**
* The cloud's id.
*/
id: string,
/**
* `instance`, `security_group`, `firewall`, `sandbox`, ...
*/
resourceType: string,
/**
* The sandbox it belongs to (`aws:<name>`), empty for shared
* resources.
*/
sandbox: string,
/**
* The relay machine the sandbox joined as (its Space is
* `relay:<machine>`).
*/
machine: string,
region: string,
state: string,
/**
* RFC 3339.
*/
created: string,
/**
* RFC 3339, empty: never.
*/
expires: string,
expired: boolean,
/**
* Who started it: an agent's name, or `user` (empty for records made
* before it was kept).
*/
startedBy: string,
/**
* Estimated US dollars it cost so far (list price times runtime).
*/
costUsd: number
}
/**
* Generated factory for {@link CloudResource} record objects.
*/
export const CloudResource = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudResource, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudResource>,
});
})();
const FfiConverterTypeCloudResource = (() => {
type TypeName = CloudResource;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
provider: FfiConverterString.read(from),
id: FfiConverterString.read(from),
resourceType: FfiConverterString.read(from),
sandbox: FfiConverterString.read(from),
machine: FfiConverterString.read(from),
region: FfiConverterString.read(from),
state: FfiConverterString.read(from),
created: FfiConverterString.read(from),
expires: FfiConverterString.read(from),
expired: FfiConverterBool.read(from),
startedBy: FfiConverterString.read(from),
costUsd: FfiConverterFloat64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.provider, into);
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.resourceType, into);
FfiConverterString.write(value.sandbox, into);
FfiConverterString.write(value.machine, into);
FfiConverterString.write(value.region, into);
FfiConverterString.write(value.state, into);
FfiConverterString.write(value.created, into);
FfiConverterString.write(value.expires, into);
FfiConverterBool.write(value.expired, into);
FfiConverterString.write(value.startedBy, into);
FfiConverterFloat64.write(value.costUsd, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.provider) +
FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.resourceType) +
FfiConverterString.allocationSize(value.sandbox) +
FfiConverterString.allocationSize(value.machine) +
FfiConverterString.allocationSize(value.region) +
FfiConverterString.allocationSize(value.state) +
FfiConverterString.allocationSize(value.created) +
FfiConverterString.allocationSize(value.expires) +
FfiConverterBool.allocationSize(value.expired) +
FfiConverterString.allocationSize(value.startedBy) +
FfiConverterFloat64.allocationSize(value.costUsd);
}
};
return new FFIConverter();
})();
/**
* `cloud_disconnect`.
*/
export type CloudDisconnected = {
provider: string,
disconnected: boolean,
/**
* Resources Cua still records there.
*/
left: Array<CloudResource>,
/**
* With `delete`: what was deleted from the account first.
*/
deleted: Array<CloudResource>
}
/**
* Generated factory for {@link CloudDisconnected} record objects.
*/
export const CloudDisconnected = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudDisconnected, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudDisconnected>,
});
})();
const FfiConverterTypeCloudDisconnected = (() => {
type TypeName = CloudDisconnected;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
provider: FfiConverterString.read(from),
disconnected: FfiConverterBool.read(from),
left: FfiConverterSequenceTypeCloudResource.read(from),
deleted: FfiConverterSequenceTypeCloudResource.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.provider, into);
FfiConverterBool.write(value.disconnected, into);
FfiConverterSequenceTypeCloudResource.write(value.left, into);
FfiConverterSequenceTypeCloudResource.write(value.deleted, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.provider) +
FfiConverterBool.allocationSize(value.disconnected) +
FfiConverterSequenceTypeCloudResource.allocationSize(value.left) +
FfiConverterSequenceTypeCloudResource.allocationSize(value.deleted);
}
};
return new FFIConverter();
})();
/**
* `cloud_status`.
*/
export type CloudStatus = {
/**
* `default.on`, for example `aws`.
*/
defaultOn: string,
providers: Array<CloudProvider>,
resources: Array<CloudResource>
}
/**
* Generated factory for {@link CloudStatus} record objects.
*/
export const CloudStatus = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudStatus, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudStatus>,
});
})();
const FfiConverterTypeCloudStatus = (() => {
type TypeName = CloudStatus;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
defaultOn: FfiConverterString.read(from),
providers: FfiConverterSequenceTypeCloudProvider.read(from),
resources: FfiConverterSequenceTypeCloudResource.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.defaultOn, into);
FfiConverterSequenceTypeCloudProvider.write(value.providers, into);
FfiConverterSequenceTypeCloudResource.write(value.resources, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.defaultOn) +
FfiConverterSequenceTypeCloudProvider.allocationSize(value.providers) +
FfiConverterSequenceTypeCloudResource.allocationSize(value.resources);
}
};
return new FFIConverter();
})();
/**
* One row of `cloud_sweep`.
*/
export type CloudSweepItem = {
resource: CloudResource,
/**
* `delete` (dry run), `deleted`, `keep` or `failed`.
*/
action: string,
reason: string
}
/**
* Generated factory for {@link CloudSweepItem} record objects.
*/
export const CloudSweepItem = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudSweepItem, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudSweepItem>,
});
})();
const FfiConverterTypeCloudSweepItem = (() => {
type TypeName = CloudSweepItem;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
resource: FfiConverterTypeCloudResource.read(from),
action: FfiConverterString.read(from),
reason: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterTypeCloudResource.write(value.resource, into);
FfiConverterString.write(value.action, into);
FfiConverterString.write(value.reason, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypeCloudResource.allocationSize(value.resource) +
FfiConverterString.allocationSize(value.action) +
FfiConverterString.allocationSize(value.reason);
}
};
return new FFIConverter();
})();
/**
* `cloud_sweep`.
*/
export type CloudSweepReport = {
dryRun: boolean,
resources: Array<CloudSweepItem>
}
/**
* Generated factory for {@link CloudSweepReport} record objects.
*/
export const CloudSweepReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudSweepReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudSweepReport>,
});
})();
const FfiConverterTypeCloudSweepReport = (() => {
type TypeName = CloudSweepReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
dryRun: FfiConverterBool.read(from),
resources: FfiConverterSequenceTypeCloudSweepItem.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterBool.write(value.dryRun, into);
FfiConverterSequenceTypeCloudSweepItem.write(value.resources, into);
}
allocationSize(value: TypeName): number {
return FfiConverterBool.allocationSize(value.dryRun) +
FfiConverterSequenceTypeCloudSweepItem.allocationSize(value.resources);
}
};
return new FFIConverter();
})();
/**
* Where in a cloud account Spaces go. AWS, Google Cloud and Modal use
* their own CLI sign-in; Hetzner takes its API token in `token` (or
* `HCLOUD_TOKEN`).
*/
export type CloudTarget = {
/**
* `aws`, `gcp`, `hetzner` or `modal`.
*/
provider: string,
/**
* AWS or Modal profile.
*/
profile?: string,
/**
* AWS or GCP region, or Hetzner location (`fsn1`).
*/
region?: string,
/**
* GCP zone.
*/
zone?: string,
/**
* GCP project.
*/
project?: string,
/**
* Modal environment.
*/
environment?: string,
/**
* Hetzner: the project's Read & Write API token. Secret: used for the
* checks, saved in the Cua credential store when they pass, never
* printed.
*/
token?: string
}
/**
* Generated factory for {@link CloudTarget} record objects.
*/
export const CloudTarget = (() => {
const defaults = () => ({
profile: undefined,
region: undefined,
zone: undefined,
project: undefined,
environment: undefined,
token: undefined
});
const create = (() => {
return uniffiCreateRecord<CloudTarget, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudTarget>,
});
})();
const FfiConverterTypeCloudTarget = (() => {
type TypeName = CloudTarget;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
provider: FfiConverterString.read(from),
profile: FfiConverterOptionalString.read(from),
region: FfiConverterOptionalString.read(from),
zone: FfiConverterOptionalString.read(from),
project: FfiConverterOptionalString.read(from),
environment: FfiConverterOptionalString.read(from),
token: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.provider, into);
FfiConverterOptionalString.write(value.profile, into);
FfiConverterOptionalString.write(value.region, into);
FfiConverterOptionalString.write(value.zone, into);
FfiConverterOptionalString.write(value.project, into);
FfiConverterOptionalString.write(value.environment, into);
FfiConverterOptionalString.write(value.token, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.provider) +
FfiConverterOptionalString.allocationSize(value.profile) +
FfiConverterOptionalString.allocationSize(value.region) +
FfiConverterOptionalString.allocationSize(value.zone) +
FfiConverterOptionalString.allocationSize(value.project) +
FfiConverterOptionalString.allocationSize(value.environment) +
FfiConverterOptionalString.allocationSize(value.token);
}
};
return new FFIConverter();
})();
/**
* `cloud_test`.
*/
export type CloudTestReport = {
provider: string,
ok: boolean,
account: string,
checks: Array<CloudCheck>
}
/**
* Generated factory for {@link CloudTestReport} record objects.
*/
export const CloudTestReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CloudTestReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CloudTestReport>,
});
})();
const FfiConverterTypeCloudTestReport = (() => {
type TypeName = CloudTestReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
provider: FfiConverterString.read(from),
ok: FfiConverterBool.read(from),
account: FfiConverterString.read(from),
checks: FfiConverterSequenceTypeCloudCheck.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.provider, into);
FfiConverterBool.write(value.ok, into);
FfiConverterString.write(value.account, into);
FfiConverterSequenceTypeCloudCheck.write(value.checks, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.provider) +
FfiConverterBool.allocationSize(value.ok) +
FfiConverterString.allocationSize(value.account) +
FfiConverterSequenceTypeCloudCheck.allocationSize(value.checks);
}
};
return new FFIConverter();
})();
/**
* A persistent agent's grant on one of the user's computers.
*/
export type ComputerGrant = {
id: string,
agent: string,
machine: string,
createdMs: bigint,
expiresMs?: bigint,
revoked: boolean
}
/**
* Generated factory for {@link ComputerGrant} record objects.
*/
export const ComputerGrant = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ComputerGrant, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ComputerGrant>,
});
})();
const FfiConverterTypeComputerGrant = (() => {
type TypeName = ComputerGrant;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
agent: FfiConverterString.read(from),
machine: FfiConverterString.read(from),
createdMs: FfiConverterUInt64.read(from),
expiresMs: FfiConverterOptionalUInt64.read(from),
revoked: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.agent, into);
FfiConverterString.write(value.machine, into);
FfiConverterUInt64.write(value.createdMs, into);
FfiConverterOptionalUInt64.write(value.expiresMs, into);
FfiConverterBool.write(value.revoked, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.agent) +
FfiConverterString.allocationSize(value.machine) +
FfiConverterUInt64.allocationSize(value.createdMs) +
FfiConverterOptionalUInt64.allocationSize(value.expiresMs) +
FfiConverterBool.allocationSize(value.revoked);
}
};
return new FFIConverter();
})();
/**
* How low the free disk is.
*/
export enum DiskLevel {
/**
* Plenty.
*/
Ok = "ok",
/**
* Under 50 GB or 15% of the volume, whichever line is higher (the
* line never rises above 100 GB).
*/
Low = "low",
/**
* Under the floor where creating a Space already fails (5 GiB).
*/
Critical = "critical"
}
const FfiConverterTypeDiskLevel = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = DiskLevel;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return DiskLevel.Ok;
case 2: return DiskLevel.Low;
case 3: return DiskLevel.Critical;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case DiskLevel.Ok: return ordinalConverter.write(1, into);
case DiskLevel.Low: return ordinalConverter.write(2, into);
case DiskLevel.Critical: return ordinalConverter.write(3, into);
}
}
allocationSize(value: TypeName): number {
return ordinalConverter.allocationSize(0);
}
}
return new FFIConverter();
})();
/**
* The low-disk signal for the app and the menu bar.
*/
export type DiskWarning = {
/**
* How low it is.
*/
level: DiskLevel,
/**
* Free bytes on the volume that holds Spaces.
*/
free: bigint,
/**
* Size of that volume.
*/
total: bigint,
/**
* The line that was crossed (0 when `ok`).
*/
threshold: bigint
}
/**
* Generated factory for {@link DiskWarning} record objects.
*/
export const DiskWarning = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DiskWarning, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DiskWarning>,
});
})();
const FfiConverterTypeDiskWarning = (() => {
type TypeName = DiskWarning;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
level: FfiConverterTypeDiskLevel.read(from),
free: FfiConverterUInt64.read(from),
total: FfiConverterUInt64.read(from),
threshold: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterTypeDiskLevel.write(value.level, into);
FfiConverterUInt64.write(value.free, into);
FfiConverterUInt64.write(value.total, into);
FfiConverterUInt64.write(value.threshold, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypeDiskLevel.allocationSize(value.level) +
FfiConverterUInt64.allocationSize(value.free) +
FfiConverterUInt64.allocationSize(value.total) +
FfiConverterUInt64.allocationSize(value.threshold);
}
};
return new FFIConverter();
})();
/**
* A computer: this Mac, or one of your other computers (from the summary
* it published).
*/
export type ComputerResources = {
/**
* `this-mac`, or the relay machine id.
*/
id: string,
/**
* Display name (empty for this Mac).
*/
name: string,
/**
* Reachable now (always true for this Mac).
*/
online: boolean,
/**
* When the computer measured this, unix ms (another computer's can be
* minutes old).
*/
sampledAtMs: bigint,
/**
* Processor cores.
*/
cpuCount: number,
/**
* Busy now, 0 to 100.
*/
cpuPercent: number,
/**
* 1-minute load average.
*/
loadAverage1m: number,
/**
* Memory size, bytes.
*/
memoryTotal: bigint,
/**
* Memory in use, bytes (without reclaimable cache).
*/
memoryUsed: bigint,
/**
* Size of the volume that holds Spaces, bytes.
*/
diskTotal: bigint,
/**
* Free bytes on it.
*/
diskFree: bigint,
/**
* Extra Spaces on it.
*/
spacesCount: number,
/**
* Of those, running.
*/
spacesRunning: number,
/**
* Cores given to the running ones.
*/
spacesCpuAllocated: number,
/**
* Memory given to the running ones, bytes.
*/
spacesMemoryAllocated: bigint,
/**
* Memory the running guests report in use, bytes.
*/
spacesMemoryUsed: bigint,
/**
* Bytes all its extra Spaces take on it.
*/
spacesDiskBytes: bigint,
/**
* False when some Space's disk could only be estimated.
*/
spacesDiskExact: boolean,
/**
* The low-disk signal.
*/
warning: DiskWarning
}
/**
* Generated factory for {@link ComputerResources} record objects.
*/
export const ComputerResources = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ComputerResources, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ComputerResources>,
});
})();
const FfiConverterTypeComputerResources = (() => {
type TypeName = ComputerResources;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
name: FfiConverterString.read(from),
online: FfiConverterBool.read(from),
sampledAtMs: FfiConverterUInt64.read(from),
cpuCount: FfiConverterUInt32.read(from),
cpuPercent: FfiConverterFloat64.read(from),
loadAverage1m: FfiConverterFloat64.read(from),
memoryTotal: FfiConverterUInt64.read(from),
memoryUsed: FfiConverterUInt64.read(from),
diskTotal: FfiConverterUInt64.read(from),
diskFree: FfiConverterUInt64.read(from),
spacesCount: FfiConverterUInt32.read(from),
spacesRunning: FfiConverterUInt32.read(from),
spacesCpuAllocated: FfiConverterUInt32.read(from),
spacesMemoryAllocated: FfiConverterUInt64.read(from),
spacesMemoryUsed: FfiConverterUInt64.read(from),
spacesDiskBytes: FfiConverterUInt64.read(from),
spacesDiskExact: FfiConverterBool.read(from),
warning: FfiConverterTypeDiskWarning.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.name, into);
FfiConverterBool.write(value.online, into);
FfiConverterUInt64.write(value.sampledAtMs, into);
FfiConverterUInt32.write(value.cpuCount, into);
FfiConverterFloat64.write(value.cpuPercent, into);
FfiConverterFloat64.write(value.loadAverage1m, into);
FfiConverterUInt64.write(value.memoryTotal, into);
FfiConverterUInt64.write(value.memoryUsed, into);
FfiConverterUInt64.write(value.diskTotal, into);
FfiConverterUInt64.write(value.diskFree, into);
FfiConverterUInt32.write(value.spacesCount, into);
FfiConverterUInt32.write(value.spacesRunning, into);
FfiConverterUInt32.write(value.spacesCpuAllocated, into);
FfiConverterUInt64.write(value.spacesMemoryAllocated, into);
FfiConverterUInt64.write(value.spacesMemoryUsed, into);
FfiConverterUInt64.write(value.spacesDiskBytes, into);
FfiConverterBool.write(value.spacesDiskExact, into);
FfiConverterTypeDiskWarning.write(value.warning, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.name) +
FfiConverterBool.allocationSize(value.online) +
FfiConverterUInt64.allocationSize(value.sampledAtMs) +
FfiConverterUInt32.allocationSize(value.cpuCount) +
FfiConverterFloat64.allocationSize(value.cpuPercent) +
FfiConverterFloat64.allocationSize(value.loadAverage1m) +
FfiConverterUInt64.allocationSize(value.memoryTotal) +
FfiConverterUInt64.allocationSize(value.memoryUsed) +
FfiConverterUInt64.allocationSize(value.diskTotal) +
FfiConverterUInt64.allocationSize(value.diskFree) +
FfiConverterUInt32.allocationSize(value.spacesCount) +
FfiConverterUInt32.allocationSize(value.spacesRunning) +
FfiConverterUInt32.allocationSize(value.spacesCpuAllocated) +
FfiConverterUInt64.allocationSize(value.spacesMemoryAllocated) +
FfiConverterUInt64.allocationSize(value.spacesMemoryUsed) +
FfiConverterUInt64.allocationSize(value.spacesDiskBytes) +
FfiConverterBool.allocationSize(value.spacesDiskExact) +
FfiConverterTypeDiskWarning.allocationSize(value.warning);
}
};
return new FFIConverter();
})();
/**
* One setting's effective value.
*/
export type ConfigEntry = {
/**
* `default.on`, `default.kind`, `default.runtime`, `runtime.lume`,
* `runtime.linux` or `telemetry.enabled`.
*/
key: string,
/**
* The effective value.
*/
value: string,
/**
* `env`, `config` or `default`.
*/
source: string,
/**
* Where exactly: `env CUA_DEFAULT_ON`, `config /home/me/.cua/config.toml`
* or `default`.
*/
from: string,
/**
* The environment variable that overrides it.
*/
env: string,
/**
* The built-in default.
*/
defaultValue: string,
/**
* One line about it.
*/
description: string
}
/**
* Generated factory for {@link ConfigEntry} record objects.
*/
export const ConfigEntry = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ConfigEntry, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ConfigEntry>,
});
})();
const FfiConverterTypeConfigEntry = (() => {
type TypeName = ConfigEntry;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
key: FfiConverterString.read(from),
value: FfiConverterString.read(from),
source: FfiConverterString.read(from),
from: FfiConverterString.read(from),
env: FfiConverterString.read(from),
defaultValue: FfiConverterString.read(from),
description: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.key, into);
FfiConverterString.write(value.value, into);
FfiConverterString.write(value.source, into);
FfiConverterString.write(value.from, into);
FfiConverterString.write(value.env, into);
FfiConverterString.write(value.defaultValue, into);
FfiConverterString.write(value.description, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.key) +
FfiConverterString.allocationSize(value.value) +
FfiConverterString.allocationSize(value.source) +
FfiConverterString.allocationSize(value.from) +
FfiConverterString.allocationSize(value.env) +
FfiConverterString.allocationSize(value.defaultValue) +
FfiConverterString.allocationSize(value.description);
}
};
return new FFIConverter();
})();
/**
* An extra container next to a sandbox (a compose-style sidecar),
* addressed by name on every runtime: the sandbox reaches it at its
* `name` (on its `ports`), it reaches the sandbox at `main`, and
* `services` may name its ports (`{"db": 5432}`). Local containers run it
* in the sandbox's network namespace (`localhost` works too; needs
* `runtime="runc"`). Local VM sandboxes refuse sidecars. With sidecars the
* service names `main`, `sidecars` and `sc` are reserved.
*/
export type Container = {
/**
* Image reference.
*/
image: string,
/**
* argv replacing the image's entrypoint.
*/
command?: Array<string>,
/**
* Environment (plain values, not secrets).
*/
env: Map<string, string>,
/**
* Ports it listens on.
*/
ports: Array<number>,
/**
* Name, unique within the sandbox, and its hostname (not `main`).
* Unset: from the image (`redis`).
*/
name?: string
}
/**
* Generated factory for {@link Container} record objects.
*/
export const Container = (() => {
const defaults = () => ({
command: undefined,
env: new Map(),
ports: [],
name: undefined
});
const create = (() => {
return uniffiCreateRecord<Container, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<Container>,
});
})();
const FfiConverterTypeContainer = (() => {
type TypeName = Container;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
image: FfiConverterString.read(from),
command: FfiConverterOptionalSequenceString.read(from),
env: FfiConverterMapStringString.read(from),
ports: FfiConverterSequenceUInt16.read(from),
name: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.image, into);
FfiConverterOptionalSequenceString.write(value.command, into);
FfiConverterMapStringString.write(value.env, into);
FfiConverterSequenceUInt16.write(value.ports, into);
FfiConverterOptionalString.write(value.name, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.image) +
FfiConverterOptionalSequenceString.allocationSize(value.command) +
FfiConverterMapStringString.allocationSize(value.env) +
FfiConverterSequenceUInt16.allocationSize(value.ports) +
FfiConverterOptionalString.allocationSize(value.name);
}
};
return new FFIConverter();
})();
/**
* Configuration of an embedded SDK runtime.
*/
export type CuaConfig = {
/**
* State directory for sandbox state files (default `~/.cua/sandboxes`).
*/
stateDir?: string,
/**
* spacesd probe timeout (default 15 s).
*/
envProbeTimeoutMs?: number,
/**
* Spaces registry directory (default `$CUA_HOME` or `~/.cua`).
*/
spacesHome?: string,
/**
* Teleport reads app sessions under this home directory with no host
* side effects (tests, CI). Default: the real host.
*/
teleportHome?: string,
/**
* Use the signed-in session (`Cua.auth()`, `cua auth login`) from the
* shared credential store, refreshed as needed, for the relay account
* the runtime lists the account's machines with ("My machines").
*/
accountFromSession: boolean
}
/**
* Generated factory for {@link CuaConfig} record objects.
*/
export const CuaConfig = (() => {
const defaults = () => ({
stateDir: undefined,
envProbeTimeoutMs: undefined,
spacesHome: undefined,
teleportHome: undefined,
accountFromSession: false
});
const create = (() => {
return uniffiCreateRecord<CuaConfig, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CuaConfig>,
});
})();
const FfiConverterTypeCuaConfig = (() => {
type TypeName = CuaConfig;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
stateDir: FfiConverterOptionalString.read(from),
envProbeTimeoutMs: FfiConverterOptionalUInt32.read(from),
spacesHome: FfiConverterOptionalString.read(from),
teleportHome: FfiConverterOptionalString.read(from),
accountFromSession: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.stateDir, into);
FfiConverterOptionalUInt32.write(value.envProbeTimeoutMs, into);
FfiConverterOptionalString.write(value.spacesHome, into);
FfiConverterOptionalString.write(value.teleportHome, into);
FfiConverterBool.write(value.accountFromSession, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.stateDir) +
FfiConverterOptionalUInt32.allocationSize(value.envProbeTimeoutMs) +
FfiConverterOptionalString.allocationSize(value.spacesHome) +
FfiConverterOptionalString.allocationSize(value.teleportHome) +
FfiConverterBool.allocationSize(value.accountFromSession);
}
};
return new FFIConverter();
})();
/**
* Where the SDK runtime lives.
*/
export enum CuaMode {
/**
* In this process.
*/
Embedded = "embedded",
/**
* In a `cua daemon`.
*/
Daemon = "daemon"
}
const FfiConverterTypeCuaMode = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = CuaMode;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return CuaMode.Embedded;
case 2: return CuaMode.Daemon;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case CuaMode.Embedded: return ordinalConverter.write(1, into);
case CuaMode.Daemon: return ordinalConverter.write(2, into);
}
}
allocationSize(value: TypeName): number {
return ordinalConverter.allocationSize(0);
}
}
return new FFIConverter();
})();
/**
* Identity of the SDK (and daemon, when connected).
*/
export type CuaInfo = {
/**
* SDK library version.
*/
sdkVersion: string,
/**
* Topology.
*/
mode: CuaMode,
/**
* Daemon version (daemon mode).
*/
daemonVersion?: string,
/**
* Daemon pid (daemon mode).
*/
daemonPid?: number,
/**
* Daemon socket (daemon mode).
*/
socketPath?: string,
/**
* Daemon loopback URL (daemon mode).
*/
loopbackUrl?: string,
/**
* Compiled-in modules.
*/
features: Array<string>
}
/**
* Generated factory for {@link CuaInfo} record objects.
*/
export const CuaInfo = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CuaInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CuaInfo>,
});
})();
const FfiConverterTypeCuaInfo = (() => {
type TypeName = CuaInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
sdkVersion: FfiConverterString.read(from),
mode: FfiConverterTypeCuaMode.read(from),
daemonVersion: FfiConverterOptionalString.read(from),
daemonPid: FfiConverterOptionalUInt32.read(from),
socketPath: FfiConverterOptionalString.read(from),
loopbackUrl: FfiConverterOptionalString.read(from),
features: FfiConverterSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.sdkVersion, into);
FfiConverterTypeCuaMode.write(value.mode, into);
FfiConverterOptionalString.write(value.daemonVersion, into);
FfiConverterOptionalUInt32.write(value.daemonPid, into);
FfiConverterOptionalString.write(value.socketPath, into);
FfiConverterOptionalString.write(value.loopbackUrl, into);
FfiConverterSequenceString.write(value.features, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.sdkVersion) +
FfiConverterTypeCuaMode.allocationSize(value.mode) +
FfiConverterOptionalString.allocationSize(value.daemonVersion) +
FfiConverterOptionalUInt32.allocationSize(value.daemonPid) +
FfiConverterOptionalString.allocationSize(value.socketPath) +
FfiConverterOptionalString.allocationSize(value.loopbackUrl) +
FfiConverterSequenceString.allocationSize(value.features);
}
};
return new FFIConverter();
})();
/**
* One cursor shape's shared art: an SVG path on a square canvas, filled
* with the participant's color over an outline.
*/
export type CursorArt = {
/**
* Shape name.
*/
shape: string,
/**
* SVG path data (absolute `M`, `L`, `C`, `Z`; nonzero fill).
*/
pathD: string,
/**
* Hot spot x on the canvas.
*/
hotspotX: number,
/**
* Hot spot y on the canvas.
*/
hotspotY: number,
/**
* Canvas size (square).
*/
canvas: number,
/**
* Outline color, drawn under the fill.
*/
outlineColor: string,
/**
* Outline width in canvas units.
*/
outlineWidth: number
}
/**
* Generated factory for {@link CursorArt} record objects.
*/
export const CursorArt = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<CursorArt, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<CursorArt>,
});
})();
const FfiConverterTypeCursorArt = (() => {
type TypeName = CursorArt;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
shape: FfiConverterString.read(from),
pathD: FfiConverterString.read(from),
hotspotX: FfiConverterFloat64.read(from),
hotspotY: FfiConverterFloat64.read(from),
canvas: FfiConverterFloat64.read(from),
outlineColor: FfiConverterString.read(from),
outlineWidth: FfiConverterFloat64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.shape, into);
FfiConverterString.write(value.pathD, into);
FfiConverterFloat64.write(value.hotspotX, into);
FfiConverterFloat64.write(value.hotspotY, into);
FfiConverterFloat64.write(value.canvas, into);
FfiConverterString.write(value.outlineColor, into);
FfiConverterFloat64.write(value.outlineWidth, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.shape) +
FfiConverterString.allocationSize(value.pathD) +
FfiConverterFloat64.allocationSize(value.hotspotX) +
FfiConverterFloat64.allocationSize(value.hotspotY) +
FfiConverterFloat64.allocationSize(value.canvas) +
FfiConverterString.allocationSize(value.outlineColor) +
FfiConverterFloat64.allocationSize(value.outlineWidth);
}
};
return new FFIConverter();
})();
/**
* A client device of the account, as the relay lists it.
*/
export type RelayDevice = {
/**
* `dev_…`.
*/
id: string,
/**
* Display name.
*/
name: string,
/**
* `pending`, `enrolled`, `expired` or `revoked`.
*/
state: string,
/**
* Operating system it reported (`macos`, `windows`, `linux`); empty
* when unknown.
*/
platform: string,
/**
* Registered at (Unix seconds).
*/
createdAt: bigint,
/**
* Re-verification due at (Unix seconds).
*/
enrolledUntil?: bigint,
/**
* Last session (Unix seconds).
*/
lastSeen?: bigint,
/**
* This device.
*/
current: boolean
}
/**
* Generated factory for {@link RelayDevice} record objects.
*/
export const RelayDevice = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<RelayDevice, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<RelayDevice>,
});
})();
const FfiConverterTypeRelayDevice = (() => {
type TypeName = RelayDevice;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
name: FfiConverterString.read(from),
state: FfiConverterString.read(from),
platform: FfiConverterString.read(from),
createdAt: FfiConverterUInt64.read(from),
enrolledUntil: FfiConverterOptionalUInt64.read(from),
lastSeen: FfiConverterOptionalUInt64.read(from),
current: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.state, into);
FfiConverterString.write(value.platform, into);
FfiConverterUInt64.write(value.createdAt, into);
FfiConverterOptionalUInt64.write(value.enrolledUntil, into);
FfiConverterOptionalUInt64.write(value.lastSeen, into);
FfiConverterBool.write(value.current, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.state) +
FfiConverterString.allocationSize(value.platform) +
FfiConverterUInt64.allocationSize(value.createdAt) +
FfiConverterOptionalUInt64.allocationSize(value.enrolledUntil) +
FfiConverterOptionalUInt64.allocationSize(value.lastSeen) +
FfiConverterBool.allocationSize(value.current);
}
};
return new FFIConverter();
})();
/**
* `Devices.enroll`'s result.
*/
export type DeviceEnrollment = {
/**
* This device.
*/
device: RelayDevice,
/**
* Enrolled now (right after a fresh sign-in).
*/
enrolled: boolean,
/**
* The one-time code to approve from an enrolled device otherwise.
*/
code?: string
}
/**
* Generated factory for {@link DeviceEnrollment} record objects.
*/
export const DeviceEnrollment = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DeviceEnrollment, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DeviceEnrollment>,
});
})();
const FfiConverterTypeDeviceEnrollment = (() => {
type TypeName = DeviceEnrollment;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
device: FfiConverterTypeRelayDevice.read(from),
enrolled: FfiConverterBool.read(from),
code: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterTypeRelayDevice.write(value.device, into);
FfiConverterBool.write(value.enrolled, into);
FfiConverterOptionalString.write(value.code, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypeRelayDevice.allocationSize(value.device) +
FfiConverterBool.allocationSize(value.enrolled) +
FfiConverterOptionalString.allocationSize(value.code);
}
};
return new FFIConverter();
})();
/**
* One event of the account's audit log.
*/
export type RelayAuditEvent = {
/**
* Unix seconds.
*/
ts: bigint,
/**
* Kind (`machine_access`, `device_enrolled`, `share_added`, ...).
*/
kind: string,
/**
* Acting device.
*/
device?: string,
/**
* Machine id.
*/
machine?: string,
/**
* Other party.
*/
subject?: string,
/**
* Detail.
*/
detail?: string
}
/**
* Generated factory for {@link RelayAuditEvent} record objects.
*/
export const RelayAuditEvent = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<RelayAuditEvent, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<RelayAuditEvent>,
});
})();
const FfiConverterTypeRelayAuditEvent = (() => {
type TypeName = RelayAuditEvent;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
ts: FfiConverterUInt64.read(from),
kind: FfiConverterString.read(from),
device: FfiConverterOptionalString.read(from),
machine: FfiConverterOptionalString.read(from),
subject: FfiConverterOptionalString.read(from),
detail: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt64.write(value.ts, into);
FfiConverterString.write(value.kind, into);
FfiConverterOptionalString.write(value.device, into);
FfiConverterOptionalString.write(value.machine, into);
FfiConverterOptionalString.write(value.subject, into);
FfiConverterOptionalString.write(value.detail, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.ts) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterOptionalString.allocationSize(value.device) +
FfiConverterOptionalString.allocationSize(value.machine) +
FfiConverterOptionalString.allocationSize(value.subject) +
FfiConverterOptionalString.allocationSize(value.detail);
}
};
return new FFIConverter();
})();
/**
* Somebody connected to a machine through the relay.
*/
export type RelayClientInfo = {
/**
* User id.
*/
id: string,
/**
* Email, when shared by the identity provider.
*/
email?: string,
/**
* Display name.
*/
name?: string,
/**
* Open streams.
*/
streams: number,
/**
* Unix seconds of the first open stream.
*/
since: bigint
}
/**
* Generated factory for {@link RelayClientInfo} record objects.
*/
export const RelayClientInfo = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<RelayClientInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<RelayClientInfo>,
});
})();
const FfiConverterTypeRelayClientInfo = (() => {
type TypeName = RelayClientInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
email: FfiConverterOptionalString.read(from),
name: FfiConverterOptionalString.read(from),
streams: FfiConverterUInt32.read(from),
since: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterOptionalString.write(value.email, into);
FfiConverterOptionalString.write(value.name, into);
FfiConverterUInt32.write(value.streams, into);
FfiConverterUInt64.write(value.since, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterOptionalString.allocationSize(value.email) +
FfiConverterOptionalString.allocationSize(value.name) +
FfiConverterUInt32.allocationSize(value.streams) +
FfiConverterUInt64.allocationSize(value.since);
}
};
return new FFIConverter();
})();
/**
* A machine of the account's relay directory (`relay:<id>`).
*/
export type RelayMachine = {
/**
* Machine id.
*/
id: string,
/**
* `relay:<id>`.
*/
spaceId: string,
/**
* Display name.
*/
name: string,
/**
* Owner account id.
*/
ownerId: string,
/**
* Owner email.
*/
ownerEmail?: string,
/**
* `owner` or `shared`.
*/
role: string,
/**
* Connected to the relay.
*/
online: boolean,
/**
* Accepting clients.
*/
sharing: boolean,
/**
* spacesd version.
*/
version: string,
/**
* `<relay>/m/<id>`.
*/
url: string,
/**
* Allowlist (owner view only).
*/
allow: Array<string>,
/**
* Connected clients.
*/
clients: Array<RelayClientInfo>,
/**
* Registered with an enrolled device's signature or MFA, or confirmed
* since from one; `true` for anything a relay registered before this
* check existed. `false` shows the machine as "new" until an enrolled
* device confirms it ([`Devices::confirm_machine`]) (S5).
*/
confirmed: boolean,
/**
* The team you reach it through, for a team machine not shared with
* you directly.
*/
team?: string,
/**
* It creates Spaces for its owner's devices, when it said so at
* registration (`None` from a host or relay that predates it).
*/
providesSpaces?: boolean
}
/**
* Generated factory for {@link RelayMachine} record objects.
*/
export const RelayMachine = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<RelayMachine, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<RelayMachine>,
});
})();
const FfiConverterTypeRelayMachine = (() => {
type TypeName = RelayMachine;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
spaceId: FfiConverterString.read(from),
name: FfiConverterString.read(from),
ownerId: FfiConverterString.read(from),
ownerEmail: FfiConverterOptionalString.read(from),
role: FfiConverterString.read(from),
online: FfiConverterBool.read(from),
sharing: FfiConverterBool.read(from),
version: FfiConverterString.read(from),
url: FfiConverterString.read(from),
allow: FfiConverterSequenceString.read(from),
clients: FfiConverterSequenceTypeRelayClientInfo.read(from),
confirmed: FfiConverterBool.read(from),
team: FfiConverterOptionalString.read(from),
providesSpaces: FfiConverterOptionalBoolean.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.spaceId, into);
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.ownerId, into);
FfiConverterOptionalString.write(value.ownerEmail, into);
FfiConverterString.write(value.role, into);
FfiConverterBool.write(value.online, into);
FfiConverterBool.write(value.sharing, into);
FfiConverterString.write(value.version, into);
FfiConverterString.write(value.url, into);
FfiConverterSequenceString.write(value.allow, into);
FfiConverterSequenceTypeRelayClientInfo.write(value.clients, into);
FfiConverterBool.write(value.confirmed, into);
FfiConverterOptionalString.write(value.team, into);
FfiConverterOptionalBoolean.write(value.providesSpaces, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.spaceId) +
FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.ownerId) +
FfiConverterOptionalString.allocationSize(value.ownerEmail) +
FfiConverterString.allocationSize(value.role) +
FfiConverterBool.allocationSize(value.online) +
FfiConverterBool.allocationSize(value.sharing) +
FfiConverterString.allocationSize(value.version) +
FfiConverterString.allocationSize(value.url) +
FfiConverterSequenceString.allocationSize(value.allow) +
FfiConverterSequenceTypeRelayClientInfo.allocationSize(value.clients) +
FfiConverterBool.allocationSize(value.confirmed) +
FfiConverterOptionalString.allocationSize(value.team) +
FfiConverterOptionalBoolean.allocationSize(value.providesSpaces);
}
};
return new FFIConverter();
})();
/**
* Everything the Devices page reads, in one call.
*/
export type DevicesSnapshot = {
/**
* This device's id, when it has a key.
*/
localDeviceId?: string,
/**
* The account's devices (this one marked `current` once enrolled).
*/
devices: Array<RelayDevice>,
/**
* End of the relay's grace period for unenrolled devices.
*/
enforceAfter?: bigint,
/**
* The account's audit log, newest last (empty when the relay refuses).
*/
audit: Array<RelayAuditEvent>,
/**
* Machine ids to names (empty when this device cannot list them).
*/
machineNames: Map<string, string>,
/**
* The account's relay machines, [`RelayMachine::confirmed`] included
* (S5; empty when this device cannot list them, same as
* `machine_names`).
*/
machines: Array<RelayMachine>
}
/**
* Generated factory for {@link DevicesSnapshot} record objects.
*/
export const DevicesSnapshot = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DevicesSnapshot, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DevicesSnapshot>,
});
})();
const FfiConverterTypeDevicesSnapshot = (() => {
type TypeName = DevicesSnapshot;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
localDeviceId: FfiConverterOptionalString.read(from),
devices: FfiConverterSequenceTypeRelayDevice.read(from),
enforceAfter: FfiConverterOptionalUInt64.read(from),
audit: FfiConverterSequenceTypeRelayAuditEvent.read(from),
machineNames: FfiConverterMapStringString.read(from),
machines: FfiConverterSequenceTypeRelayMachine.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.localDeviceId, into);
FfiConverterSequenceTypeRelayDevice.write(value.devices, into);
FfiConverterOptionalUInt64.write(value.enforceAfter, into);
FfiConverterSequenceTypeRelayAuditEvent.write(value.audit, into);
FfiConverterMapStringString.write(value.machineNames, into);
FfiConverterSequenceTypeRelayMachine.write(value.machines, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.localDeviceId) +
FfiConverterSequenceTypeRelayDevice.allocationSize(value.devices) +
FfiConverterOptionalUInt64.allocationSize(value.enforceAfter) +
FfiConverterSequenceTypeRelayAuditEvent.allocationSize(value.audit) +
FfiConverterMapStringString.allocationSize(value.machineNames) +
FfiConverterSequenceTypeRelayMachine.allocationSize(value.machines);
}
};
return new FFIConverter();
})();
/**
* What a Space costs this computer's disk, as opposed to what the guest
* sees.
*/
export type DiskOnHost = {
/**
* Bytes only this Space holds (what deleting it frees); absent when
* they could not be measured.
*/
bytes?: bigint,
/**
* Blocks its files occupy, clones counted in full: an upper bound.
*/
allocated: bigint,
/**
* Part of it is shared with other copies.
*/
sharesSpace: boolean
}
/**
* Generated factory for {@link DiskOnHost} record objects.
*/
export const DiskOnHost = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DiskOnHost, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DiskOnHost>,
});
})();
const FfiConverterTypeDiskOnHost = (() => {
type TypeName = DiskOnHost;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
bytes: FfiConverterOptionalUInt64.read(from),
allocated: FfiConverterUInt64.read(from),
sharesSpace: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalUInt64.write(value.bytes, into);
FfiConverterUInt64.write(value.allocated, into);
FfiConverterBool.write(value.sharesSpace, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalUInt64.allocationSize(value.bytes) +
FfiConverterUInt64.allocationSize(value.allocated) +
FfiConverterBool.allocationSize(value.sharesSpace);
}
};
return new FFIConverter();
})();
/**
* Status of one local runtime component.
*/
export enum RuntimeCheckStatus {
/**
* Present and usable.
*/
Ok = "ok",
/**
* Missing; `setup` can provision it.
*/
Installable = "installable",
/**
* Missing or broken; needs user action.
*/
Error = "error",
/**
* Not used on this host.
*/
NotApplicable = "notApplicable",
/**
* Not reported.
*/
Unknown = "unknown"
}
const FfiConverterTypeRuntimeCheckStatus = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = RuntimeCheckStatus;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return RuntimeCheckStatus.Ok;
case 2: return RuntimeCheckStatus.Installable;
case 3: return RuntimeCheckStatus.Error;
case 4: return RuntimeCheckStatus.NotApplicable;
case 5: return RuntimeCheckStatus.Unknown;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case RuntimeCheckStatus.Ok: return ordinalConverter.write(1, into);
case RuntimeCheckStatus.Installable: return ordinalConverter.write(2, into);
case RuntimeCheckStatus.Error: return ordinalConverter.write(3, into);
case RuntimeCheckStatus.NotApplicable: return ordinalConverter.write(4, into);
case RuntimeCheckStatus.Unknown: return ordinalConverter.write(5, into);
}
}
allocationSize(value: TypeName): number {
return ordinalConverter.allocationSize(0);
}
}
return new FFIConverter();
})();
/**
* One doctor check (one backend).
*/
export type RuntimeCheck = {
/**
* Backend (`container`, `qemu`, `lume`, ...).
*/
name: string,
/**
* Status.
*/
status: RuntimeCheckStatus,
/**
* Version, when detected.
*/
version?: string,
/**
* Explanation, missing pieces and what `setup` would do.
*/
detail: string
}
/**
* Generated factory for {@link RuntimeCheck} record objects.
*/
export const RuntimeCheck = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<RuntimeCheck, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<RuntimeCheck>,
});
})();
const FfiConverterTypeRuntimeCheck = (() => {
type TypeName = RuntimeCheck;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
status: FfiConverterTypeRuntimeCheckStatus.read(from),
version: FfiConverterOptionalString.read(from),
detail: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterTypeRuntimeCheckStatus.write(value.status, into);
FfiConverterOptionalString.write(value.version, into);
FfiConverterString.write(value.detail, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterTypeRuntimeCheckStatus.allocationSize(value.status) +
FfiConverterOptionalString.allocationSize(value.version) +
FfiConverterString.allocationSize(value.detail);
}
};
return new FFIConverter();
})();
/**
* Doctor output.
*/
export type DoctorReport = {
/**
* One check per backend.
*/
checks: Array<RuntimeCheck>,
/**
* The full cua-vmm host report as JSON.
*/
reportJson: string
}
/**
* Generated factory for {@link DoctorReport} record objects.
*/
export const DoctorReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DoctorReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DoctorReport>,
});
})();
const FfiConverterTypeDoctorReport = (() => {
type TypeName = DoctorReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
checks: FfiConverterSequenceTypeRuntimeCheck.read(from),
reportJson: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterSequenceTypeRuntimeCheck.write(value.checks, into);
FfiConverterString.write(value.reportJson, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceTypeRuntimeCheck.allocationSize(value.checks) +
FfiConverterString.allocationSize(value.reportJson);
}
};
return new FFIConverter();
})();
/**
* An agent's request for more access, waiting for the user.
*/
export type DriveAccessRequest = {
id: string,
principal: string,
prefix: string,
mode: string,
reason: string,
createdMs: bigint
}
/**
* Generated factory for {@link DriveAccessRequest} record objects.
*/
export const DriveAccessRequest = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveAccessRequest, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveAccessRequest>,
});
})();
const FfiConverterTypeDriveAccessRequest = (() => {
type TypeName = DriveAccessRequest;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
principal: FfiConverterString.read(from),
prefix: FfiConverterString.read(from),
mode: FfiConverterString.read(from),
reason: FfiConverterString.read(from),
createdMs: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.principal, into);
FfiConverterString.write(value.prefix, into);
FfiConverterString.write(value.mode, into);
FfiConverterString.write(value.reason, into);
FfiConverterUInt64.write(value.createdMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.principal) +
FfiConverterString.allocationSize(value.prefix) +
FfiConverterString.allocationSize(value.mode) +
FfiConverterString.allocationSize(value.reason) +
FfiConverterUInt64.allocationSize(value.createdMs);
}
};
return new FFIConverter();
})();
/**
* One audit event.
*/
export type DriveAuditEvent = {
seq: bigint,
tsMs: bigint,
principal: string,
action: string,
path: string,
detail: string
}
/**
* Generated factory for {@link DriveAuditEvent} record objects.
*/
export const DriveAuditEvent = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveAuditEvent, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveAuditEvent>,
});
})();
const FfiConverterTypeDriveAuditEvent = (() => {
type TypeName = DriveAuditEvent;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
seq: FfiConverterUInt64.read(from),
tsMs: FfiConverterUInt64.read(from),
principal: FfiConverterString.read(from),
action: FfiConverterString.read(from),
path: FfiConverterString.read(from),
detail: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt64.write(value.seq, into);
FfiConverterUInt64.write(value.tsMs, into);
FfiConverterString.write(value.principal, into);
FfiConverterString.write(value.action, into);
FfiConverterString.write(value.path, into);
FfiConverterString.write(value.detail, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.seq) +
FfiConverterUInt64.allocationSize(value.tsMs) +
FfiConverterString.allocationSize(value.principal) +
FfiConverterString.allocationSize(value.action) +
FfiConverterString.allocationSize(value.path) +
FfiConverterString.allocationSize(value.detail);
}
};
return new FFIConverter();
})();
/**
* The newest audit events and whether the hash chain verified.
*/
export type DriveAudit = {
events: Array<DriveAuditEvent>,
verified: boolean,
error?: string
}
/**
* Generated factory for {@link DriveAudit} record objects.
*/
export const DriveAudit = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveAudit, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveAudit>,
});
})();
const FfiConverterTypeDriveAudit = (() => {
type TypeName = DriveAudit;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
events: FfiConverterSequenceTypeDriveAuditEvent.read(from),
verified: FfiConverterBool.read(from),
error: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterSequenceTypeDriveAuditEvent.write(value.events, into);
FfiConverterBool.write(value.verified, into);
FfiConverterOptionalString.write(value.error, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceTypeDriveAuditEvent.allocationSize(value.events) +
FfiConverterBool.allocationSize(value.verified) +
FfiConverterOptionalString.allocationSize(value.error);
}
};
return new FFIConverter();
})();
/**
* The block cache in front of a remote store.
*/
export type DriveCacheStats = {
dir: string,
sizeBytes: bigint,
capacityBytes: bigint,
blockBytes: bigint,
blocks: bigint,
hits: bigint,
misses: bigint,
hitRate: number,
prefetchedBytes: bigint,
evictions: bigint
}
/**
* Generated factory for {@link DriveCacheStats} record objects.
*/
export const DriveCacheStats = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveCacheStats, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveCacheStats>,
});
})();
const FfiConverterTypeDriveCacheStats = (() => {
type TypeName = DriveCacheStats;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
dir: FfiConverterString.read(from),
sizeBytes: FfiConverterUInt64.read(from),
capacityBytes: FfiConverterUInt64.read(from),
blockBytes: FfiConverterUInt64.read(from),
blocks: FfiConverterUInt64.read(from),
hits: FfiConverterUInt64.read(from),
misses: FfiConverterUInt64.read(from),
hitRate: FfiConverterFloat64.read(from),
prefetchedBytes: FfiConverterUInt64.read(from),
evictions: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.dir, into);
FfiConverterUInt64.write(value.sizeBytes, into);
FfiConverterUInt64.write(value.capacityBytes, into);
FfiConverterUInt64.write(value.blockBytes, into);
FfiConverterUInt64.write(value.blocks, into);
FfiConverterUInt64.write(value.hits, into);
FfiConverterUInt64.write(value.misses, into);
FfiConverterFloat64.write(value.hitRate, into);
FfiConverterUInt64.write(value.prefetchedBytes, into);
FfiConverterUInt64.write(value.evictions, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.dir) +
FfiConverterUInt64.allocationSize(value.sizeBytes) +
FfiConverterUInt64.allocationSize(value.capacityBytes) +
FfiConverterUInt64.allocationSize(value.blockBytes) +
FfiConverterUInt64.allocationSize(value.blocks) +
FfiConverterUInt64.allocationSize(value.hits) +
FfiConverterUInt64.allocationSize(value.misses) +
FfiConverterFloat64.allocationSize(value.hitRate) +
FfiConverterUInt64.allocationSize(value.prefetchedBytes) +
FfiConverterUInt64.allocationSize(value.evictions);
}
};
return new FFIConverter();
})();
/**
* A write that lost to a later one, kept in history and as a copy.
*/
export type DriveConflict = {
path: string,
conflictPath: string,
winnerDevice: string,
loserDevice: string,
winnerVersion: string,
loserVersion: string,
tsMs: bigint
}
/**
* Generated factory for {@link DriveConflict} record objects.
*/
export const DriveConflict = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveConflict, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveConflict>,
});
})();
const FfiConverterTypeDriveConflict = (() => {
type TypeName = DriveConflict;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
path: FfiConverterString.read(from),
conflictPath: FfiConverterString.read(from),
winnerDevice: FfiConverterString.read(from),
loserDevice: FfiConverterString.read(from),
winnerVersion: FfiConverterString.read(from),
loserVersion: FfiConverterString.read(from),
tsMs: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.path, into);
FfiConverterString.write(value.conflictPath, into);
FfiConverterString.write(value.winnerDevice, into);
FfiConverterString.write(value.loserDevice, into);
FfiConverterString.write(value.winnerVersion, into);
FfiConverterString.write(value.loserVersion, into);
FfiConverterUInt64.write(value.tsMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.path) +
FfiConverterString.allocationSize(value.conflictPath) +
FfiConverterString.allocationSize(value.winnerDevice) +
FfiConverterString.allocationSize(value.loserDevice) +
FfiConverterString.allocationSize(value.winnerVersion) +
FfiConverterString.allocationSize(value.loserVersion) +
FfiConverterUInt64.allocationSize(value.tsMs);
}
};
return new FFIConverter();
})();
/**
* A device sharing the drive's bucket.
*/
export type DriveDevice = {
id: string,
name: string,
thisDevice: boolean,
lastSeenMs: bigint,
lastChangeMs: bigint,
changes: bigint
}
/**
* Generated factory for {@link DriveDevice} record objects.
*/
export const DriveDevice = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveDevice, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveDevice>,
});
})();
const FfiConverterTypeDriveDevice = (() => {
type TypeName = DriveDevice;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
name: FfiConverterString.read(from),
thisDevice: FfiConverterBool.read(from),
lastSeenMs: FfiConverterUInt64.read(from),
lastChangeMs: FfiConverterUInt64.read(from),
changes: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.name, into);
FfiConverterBool.write(value.thisDevice, into);
FfiConverterUInt64.write(value.lastSeenMs, into);
FfiConverterUInt64.write(value.lastChangeMs, into);
FfiConverterUInt64.write(value.changes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.name) +
FfiConverterBool.allocationSize(value.thisDevice) +
FfiConverterUInt64.allocationSize(value.lastSeenMs) +
FfiConverterUInt64.allocationSize(value.lastChangeMs) +
FfiConverterUInt64.allocationSize(value.changes);
}
};
return new FFIConverter();
})();
/**
* One file's sync state.
*/
export type DriveFileSync = {
/**
* `synced`, `pending_upload` (not yet in storage: other devices do not
* see it), `conflict` (a write lost to a later one, kept at
* `conflict_path`) or `conflict_copy` (the kept copy of a losing write).
*/
state: string,
/**
* The device that last wrote it, when another one did.
*/
writtenBy?: string,
conflictPath?: string
}
/**
* Generated factory for {@link DriveFileSync} record objects.
*/
export const DriveFileSync = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveFileSync, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveFileSync>,
});
})();
const FfiConverterTypeDriveFileSync = (() => {
type TypeName = DriveFileSync;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
state: FfiConverterString.read(from),
writtenBy: FfiConverterOptionalString.read(from),
conflictPath: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.state, into);
FfiConverterOptionalString.write(value.writtenBy, into);
FfiConverterOptionalString.write(value.conflictPath, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.state) +
FfiConverterOptionalString.allocationSize(value.writtenBy) +
FfiConverterOptionalString.allocationSize(value.conflictPath);
}
};
return new FFIConverter();
})();
/**
* One row of a drive listing.
*/
export type DriveEntry = {
/**
* Key (folders end in `/`).
*/
path: string,
name: string,
folder: boolean,
size: bigint,
modifiedMs: bigint,
etag: string,
/**
* `r` or `rw`: what this view may do there.
*/
mode: string,
/**
* A file's sync state, when it has something to say (uploading,
* conflicted, or last written by another device).
*/
sync?: DriveFileSync
}
/**
* Generated factory for {@link DriveEntry} record objects.
*/
export const DriveEntry = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveEntry, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveEntry>,
});
})();
const FfiConverterTypeDriveEntry = (() => {
type TypeName = DriveEntry;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
path: FfiConverterString.read(from),
name: FfiConverterString.read(from),
folder: FfiConverterBool.read(from),
size: FfiConverterUInt64.read(from),
modifiedMs: FfiConverterUInt64.read(from),
etag: FfiConverterString.read(from),
mode: FfiConverterString.read(from),
sync: FfiConverterOptionalTypeDriveFileSync.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.path, into);
FfiConverterString.write(value.name, into);
FfiConverterBool.write(value.folder, into);
FfiConverterUInt64.write(value.size, into);
FfiConverterUInt64.write(value.modifiedMs, into);
FfiConverterString.write(value.etag, into);
FfiConverterString.write(value.mode, into);
FfiConverterOptionalTypeDriveFileSync.write(value.sync, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.path) +
FfiConverterString.allocationSize(value.name) +
FfiConverterBool.allocationSize(value.folder) +
FfiConverterUInt64.allocationSize(value.size) +
FfiConverterUInt64.allocationSize(value.modifiedMs) +
FfiConverterString.allocationSize(value.etag) +
FfiConverterString.allocationSize(value.mode) +
FfiConverterOptionalTypeDriveFileSync.allocationSize(value.sync);
}
};
return new FFIConverter();
})();
/**
* A file's content and version.
*/
export type DriveFile = {
path: string,
size: bigint,
etag: string,
version: string,
modifiedMs: bigint,
content: ArrayBuffer,
/**
* Its sync state, while the drive's services run.
*/
sync?: DriveFileSync
}
/**
* Generated factory for {@link DriveFile} record objects.
*/
export const DriveFile = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveFile, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveFile>,
});
})();
const FfiConverterTypeDriveFile = (() => {
type TypeName = DriveFile;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
path: FfiConverterString.read(from),
size: FfiConverterUInt64.read(from),
etag: FfiConverterString.read(from),
version: FfiConverterString.read(from),
modifiedMs: FfiConverterUInt64.read(from),
content: FfiConverterArrayBuffer.read(from),
sync: FfiConverterOptionalTypeDriveFileSync.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.path, into);
FfiConverterUInt64.write(value.size, into);
FfiConverterString.write(value.etag, into);
FfiConverterString.write(value.version, into);
FfiConverterUInt64.write(value.modifiedMs, into);
FfiConverterArrayBuffer.write(value.content, into);
FfiConverterOptionalTypeDriveFileSync.write(value.sync, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.path) +
FfiConverterUInt64.allocationSize(value.size) +
FfiConverterString.allocationSize(value.etag) +
FfiConverterString.allocationSize(value.version) +
FfiConverterUInt64.allocationSize(value.modifiedMs) +
FfiConverterArrayBuffer.allocationSize(value.content) +
FfiConverterOptionalTypeDriveFileSync.allocationSize(value.sync);
}
};
return new FFIConverter();
})();
/**
* A widening of an agent's or a Space's access.
*/
export type DriveGrant = {
id: string,
principal: string,
prefix: string,
/**
* `r` or `rw`.
*/
mode: string,
createdMs: bigint,
expiresMs?: bigint,
revoked: boolean,
note: string
}
/**
* Generated factory for {@link DriveGrant} record objects.
*/
export const DriveGrant = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveGrant, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveGrant>,
});
})();
const FfiConverterTypeDriveGrant = (() => {
type TypeName = DriveGrant;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
principal: FfiConverterString.read(from),
prefix: FfiConverterString.read(from),
mode: FfiConverterString.read(from),
createdMs: FfiConverterUInt64.read(from),
expiresMs: FfiConverterOptionalUInt64.read(from),
revoked: FfiConverterBool.read(from),
note: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.principal, into);
FfiConverterString.write(value.prefix, into);
FfiConverterString.write(value.mode, into);
FfiConverterUInt64.write(value.createdMs, into);
FfiConverterOptionalUInt64.write(value.expiresMs, into);
FfiConverterBool.write(value.revoked, into);
FfiConverterString.write(value.note, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.principal) +
FfiConverterString.allocationSize(value.prefix) +
FfiConverterString.allocationSize(value.mode) +
FfiConverterUInt64.allocationSize(value.createdMs) +
FfiConverterOptionalUInt64.allocationSize(value.expiresMs) +
FfiConverterBool.allocationSize(value.revoked) +
FfiConverterString.allocationSize(value.note);
}
};
return new FFIConverter();
})();
/**
* A folder's listing.
*/
export type DriveListing = {
path: string,
/**
* `user` or `agent:<name>`.
*/
principal: string,
entries: Array<DriveEntry>
}
/**
* Generated factory for {@link DriveListing} record objects.
*/
export const DriveListing = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveListing, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveListing>,
});
})();
const FfiConverterTypeDriveListing = (() => {
type TypeName = DriveListing;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
path: FfiConverterString.read(from),
principal: FfiConverterString.read(from),
entries: FfiConverterSequenceTypeDriveEntry.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.path, into);
FfiConverterString.write(value.principal, into);
FfiConverterSequenceTypeDriveEntry.write(value.entries, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.path) +
FfiConverterString.allocationSize(value.principal) +
FfiConverterSequenceTypeDriveEntry.allocationSize(value.entries);
}
};
return new FFIConverter();
})();
/**
* The drive as a volume.
*/
export type DriveMountStatus = {
/**
* The user's opt-in (off by default).
*/
enabled: boolean,
/**
* `off`, `mounting`, `mounted`, `needs_approval`, `unsupported`, `error`.
*/
state: string,
/**
* `nfs` (macOS), `fuse` (Linux), `fskit`, `none`.
*/
method: string,
/**
* The mount point when mounted ("Show in Finder" opens it).
*/
path?: string,
volumeName: string,
detail?: string,
settingsUrl?: string
}
/**
* Generated factory for {@link DriveMountStatus} record objects.
*/
export const DriveMountStatus = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveMountStatus, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveMountStatus>,
});
})();
const FfiConverterTypeDriveMountStatus = (() => {
type TypeName = DriveMountStatus;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
enabled: FfiConverterBool.read(from),
state: FfiConverterString.read(from),
method: FfiConverterString.read(from),
path: FfiConverterOptionalString.read(from),
volumeName: FfiConverterString.read(from),
detail: FfiConverterOptionalString.read(from),
settingsUrl: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterBool.write(value.enabled, into);
FfiConverterString.write(value.state, into);
FfiConverterString.write(value.method, into);
FfiConverterOptionalString.write(value.path, into);
FfiConverterString.write(value.volumeName, into);
FfiConverterOptionalString.write(value.detail, into);
FfiConverterOptionalString.write(value.settingsUrl, into);
}
allocationSize(value: TypeName): number {
return FfiConverterBool.allocationSize(value.enabled) +
FfiConverterString.allocationSize(value.state) +
FfiConverterString.allocationSize(value.method) +
FfiConverterOptionalString.allocationSize(value.path) +
FfiConverterString.allocationSize(value.volumeName) +
FfiConverterOptionalString.allocationSize(value.detail) +
FfiConverterOptionalString.allocationSize(value.settingsUrl);
}
};
return new FFIConverter();
})();
/**
* A written version.
*/
export type DriveObject = {
key: string,
size: bigint,
etag: string,
version: string,
modifiedMs: bigint
}
/**
* Generated factory for {@link DriveObject} record objects.
*/
export const DriveObject = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveObject, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveObject>,
});
})();
const FfiConverterTypeDriveObject = (() => {
type TypeName = DriveObject;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
key: FfiConverterString.read(from),
size: FfiConverterUInt64.read(from),
etag: FfiConverterString.read(from),
version: FfiConverterString.read(from),
modifiedMs: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.key, into);
FfiConverterUInt64.write(value.size, into);
FfiConverterString.write(value.etag, into);
FfiConverterString.write(value.version, into);
FfiConverterUInt64.write(value.modifiedMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.key) +
FfiConverterUInt64.allocationSize(value.size) +
FfiConverterString.allocationSize(value.etag) +
FfiConverterString.allocationSize(value.version) +
FfiConverterUInt64.allocationSize(value.modifiedMs);
}
};
return new FFIConverter();
})();
/**
* A file waiting to upload.
*/
export type DrivePendingUpload = {
path: string,
bytes: bigint
}
/**
* Generated factory for {@link DrivePendingUpload} record objects.
*/
export const DrivePendingUpload = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DrivePendingUpload, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DrivePendingUpload>,
});
})();
const FfiConverterTypeDrivePendingUpload = (() => {
type TypeName = DrivePendingUpload;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
path: FfiConverterString.read(from),
bytes: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.path, into);
FfiConverterUInt64.write(value.bytes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.path) +
FfiConverterUInt64.allocationSize(value.bytes);
}
};
return new FFIConverter();
})();
/**
* Where an S3-compatible bucket is (no keys).
*/
export type DriveS3Settings = {
/**
* `http://127.0.0.1:9000`, `https://<account>.r2.cloudflarestorage.com`;
* `None` for AWS.
*/
endpoint?: string,
/**
* `us-east-1`; `auto` for R2.
*/
region: string,
bucket: string,
/**
* A key prefix inside the bucket (may be empty).
*/
root: string,
/**
* Path-style addressing (MinIO and most self-hosted stores).
*/
pathStyle: boolean
}
/**
* Generated factory for {@link DriveS3Settings} record objects.
*/
export const DriveS3Settings = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveS3Settings, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveS3Settings>,
});
})();
const FfiConverterTypeDriveS3Settings = (() => {
type TypeName = DriveS3Settings;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
endpoint: FfiConverterOptionalString.read(from),
region: FfiConverterString.read(from),
bucket: FfiConverterString.read(from),
root: FfiConverterString.read(from),
pathStyle: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.endpoint, into);
FfiConverterString.write(value.region, into);
FfiConverterString.write(value.bucket, into);
FfiConverterString.write(value.root, into);
FfiConverterBool.write(value.pathStyle, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.endpoint) +
FfiConverterString.allocationSize(value.region) +
FfiConverterString.allocationSize(value.bucket) +
FfiConverterString.allocationSize(value.root) +
FfiConverterBool.allocationSize(value.pathStyle);
}
};
return new FFIConverter();
})();
/**
* The volume mounted in a Space's guest.
*/
export type DriveSpaceVolume = {
space: string,
/**
* `/volume` (Linux) or `~/Cua Volume` (macOS), as the guest sees it.
*/
mountPath: string,
/**
* `fs` (FUSE) or `nfs`.
*/
backend: string,
/**
* Whose view it shows: `space:<folder>`, or `agent:<name>` while a
* persistent agent runs there.
*/
principal: string
}
/**
* Generated factory for {@link DriveSpaceVolume} record objects.
*/
export const DriveSpaceVolume = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveSpaceVolume, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveSpaceVolume>,
});
})();
const FfiConverterTypeDriveSpaceVolume = (() => {
type TypeName = DriveSpaceVolume;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
space: FfiConverterString.read(from),
mountPath: FfiConverterString.read(from),
backend: FfiConverterString.read(from),
principal: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.space, into);
FfiConverterString.write(value.mountPath, into);
FfiConverterString.write(value.backend, into);
FfiConverterString.write(value.principal, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.space) +
FfiConverterString.allocationSize(value.mountPath) +
FfiConverterString.allocationSize(value.backend) +
FfiConverterString.allocationSize(value.principal);
}
};
return new FFIConverter();
})();
/**
* Where the drive keeps its bytes (Settings > Storage).
*/
export type DriveStorage = {
/**
* `fs` or `s3`.
*/
backend: string,
/**
* Where the `fs` backend keeps bytes.
*/
fsPath: string,
s3?: DriveS3Settings,
/**
* S3 keys are saved (they are never returned).
*/
hasKeys: boolean,
/**
* Always false in this release: hide the Cua cloud option.
*/
cloudAvailable: boolean
}
/**
* Generated factory for {@link DriveStorage} record objects.
*/
export const DriveStorage = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveStorage, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveStorage>,
});
})();
const FfiConverterTypeDriveStorage = (() => {
type TypeName = DriveStorage;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
backend: FfiConverterString.read(from),
fsPath: FfiConverterString.read(from),
s3: FfiConverterOptionalTypeDriveS3Settings.read(from),
hasKeys: FfiConverterBool.read(from),
cloudAvailable: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.backend, into);
FfiConverterString.write(value.fsPath, into);
FfiConverterOptionalTypeDriveS3Settings.write(value.s3, into);
FfiConverterBool.write(value.hasKeys, into);
FfiConverterBool.write(value.cloudAvailable, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.backend) +
FfiConverterString.allocationSize(value.fsPath) +
FfiConverterOptionalTypeDriveS3Settings.allocationSize(value.s3) +
FfiConverterBool.allocationSize(value.hasKeys) +
FfiConverterBool.allocationSize(value.cloudAvailable);
}
};
return new FFIConverter();
})();
/**
* What a storage test found.
*/
export type DriveStorageCheck = {
ok: boolean,
reachable: boolean,
authorized: boolean,
/**
* Bucket versioning is on (required).
*/
versioning: boolean,
/**
* A sentence when not ok: what is wrong and how to fix it.
*/
detail?: string,
/**
* What is wrong, to key the UI on: `unreachable`, `bad_keys`,
* `forbidden`, `bucket_missing`, `versioning_off`,
* `path_style_needed`.
*/
problem?: string,
/**
* Saved and switched live.
*/
applied: boolean
}
/**
* Generated factory for {@link DriveStorageCheck} record objects.
*/
export const DriveStorageCheck = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveStorageCheck, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveStorageCheck>,
});
})();
const FfiConverterTypeDriveStorageCheck = (() => {
type TypeName = DriveStorageCheck;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
ok: FfiConverterBool.read(from),
reachable: FfiConverterBool.read(from),
authorized: FfiConverterBool.read(from),
versioning: FfiConverterBool.read(from),
detail: FfiConverterOptionalString.read(from),
problem: FfiConverterOptionalString.read(from),
applied: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterBool.write(value.ok, into);
FfiConverterBool.write(value.reachable, into);
FfiConverterBool.write(value.authorized, into);
FfiConverterBool.write(value.versioning, into);
FfiConverterOptionalString.write(value.detail, into);
FfiConverterOptionalString.write(value.problem, into);
FfiConverterBool.write(value.applied, into);
}
allocationSize(value: TypeName): number {
return FfiConverterBool.allocationSize(value.ok) +
FfiConverterBool.allocationSize(value.reachable) +
FfiConverterBool.allocationSize(value.authorized) +
FfiConverterBool.allocationSize(value.versioning) +
FfiConverterOptionalString.allocationSize(value.detail) +
FfiConverterOptionalString.allocationSize(value.problem) +
FfiConverterBool.allocationSize(value.applied);
}
};
return new FFIConverter();
})();
/**
* A storage change, or with `dry_run` a connection test.
*/
export type DriveStorageUpdate = {
/**
* `fs` or `s3` (`cloud` is refused).
*/
backend: string,
s3?: DriveS3Settings,
/**
* With `secret_access_key` (both or neither); saved in the credential
* store.
*/
accessKeyId?: string,
secretAccessKey?: string,
/**
* Only test; change nothing.
*/
dryRun: boolean
}
/**
* Generated factory for {@link DriveStorageUpdate} record objects.
*/
export const DriveStorageUpdate = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveStorageUpdate, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveStorageUpdate>,
});
})();
const FfiConverterTypeDriveStorageUpdate = (() => {
type TypeName = DriveStorageUpdate;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
backend: FfiConverterString.read(from),
s3: FfiConverterOptionalTypeDriveS3Settings.read(from),
accessKeyId: FfiConverterOptionalString.read(from),
secretAccessKey: FfiConverterOptionalString.read(from),
dryRun: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.backend, into);
FfiConverterOptionalTypeDriveS3Settings.write(value.s3, into);
FfiConverterOptionalString.write(value.accessKeyId, into);
FfiConverterOptionalString.write(value.secretAccessKey, into);
FfiConverterBool.write(value.dryRun, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.backend) +
FfiConverterOptionalTypeDriveS3Settings.allocationSize(value.s3) +
FfiConverterOptionalString.allocationSize(value.accessKeyId) +
FfiConverterOptionalString.allocationSize(value.secretAccessKey) +
FfiConverterBool.allocationSize(value.dryRun);
}
};
return new FFIConverter();
})();
/**
* One sync event.
*/
export type DriveSyncEvent = {
seq: bigint,
tsMs: bigint,
/**
* `remote_change`, `remote_delete`, `upload_started`, `upload_done`,
* `upload_failed`, `conflict`, `error`.
*/
kind: string,
path: string,
device: string,
size: bigint,
version: string,
detail: string
}
/**
* Generated factory for {@link DriveSyncEvent} record objects.
*/
export const DriveSyncEvent = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveSyncEvent, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveSyncEvent>,
});
})();
const FfiConverterTypeDriveSyncEvent = (() => {
type TypeName = DriveSyncEvent;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
seq: FfiConverterUInt64.read(from),
tsMs: FfiConverterUInt64.read(from),
kind: FfiConverterString.read(from),
path: FfiConverterString.read(from),
device: FfiConverterString.read(from),
size: FfiConverterUInt64.read(from),
version: FfiConverterString.read(from),
detail: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt64.write(value.seq, into);
FfiConverterUInt64.write(value.tsMs, into);
FfiConverterString.write(value.kind, into);
FfiConverterString.write(value.path, into);
FfiConverterString.write(value.device, into);
FfiConverterUInt64.write(value.size, into);
FfiConverterString.write(value.version, into);
FfiConverterString.write(value.detail, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.seq) +
FfiConverterUInt64.allocationSize(value.tsMs) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterString.allocationSize(value.path) +
FfiConverterString.allocationSize(value.device) +
FfiConverterUInt64.allocationSize(value.size) +
FfiConverterString.allocationSize(value.version) +
FfiConverterString.allocationSize(value.detail);
}
};
return new FFIConverter();
})();
/**
* Events after a sequence number, and the sequence to ask after next.
*/
export type DriveSyncEvents = {
events: Array<DriveSyncEvent>,
nextSeq: bigint
}
/**
* Generated factory for {@link DriveSyncEvents} record objects.
*/
export const DriveSyncEvents = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveSyncEvents, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveSyncEvents>,
});
})();
const FfiConverterTypeDriveSyncEvents = (() => {
type TypeName = DriveSyncEvents;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
events: FfiConverterSequenceTypeDriveSyncEvent.read(from),
nextSeq: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterSequenceTypeDriveSyncEvent.write(value.events, into);
FfiConverterUInt64.write(value.nextSeq, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceTypeDriveSyncEvent.allocationSize(value.events) +
FfiConverterUInt64.allocationSize(value.nextSeq);
}
};
return new FFIConverter();
})();
/**
* Sync across devices.
*/
export type DriveSyncStatus = {
deviceId: string,
deviceName: string,
/**
* `live`, `off` (a store on this machine), `offline` (the bucket
* stopped answering; see `last_error`).
*/
feed: string,
pollIntervalMs: bigint,
lastPollMs: bigint,
lastRemoteChangeMs: bigint,
pendingUploads: number,
pendingBytes: bigint,
conflicts: Array<DriveConflict>,
devices: Array<DriveDevice>,
lastError?: string,
/**
* The files still uploading, largest first (at most 100).
*/
pending: Array<DrivePendingUpload>,
/**
* `fs` (This Mac) or `s3` (your bucket).
*/
backend: string,
/**
* This machine's mount: `off`, `mounting`, `mounted`,
* `needs_approval`, `unsupported` or `error`.
*/
mount: string,
/**
* The block cache in front of a bucket.
*/
cache?: DriveCacheStats,
/**
* The volume mounted in Spaces.
*/
volumes: Array<DriveSpaceVolume>
}
/**
* Generated factory for {@link DriveSyncStatus} record objects.
*/
export const DriveSyncStatus = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveSyncStatus, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveSyncStatus>,
});
})();
const FfiConverterTypeDriveSyncStatus = (() => {
type TypeName = DriveSyncStatus;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
deviceId: FfiConverterString.read(from),
deviceName: FfiConverterString.read(from),
feed: FfiConverterString.read(from),
pollIntervalMs: FfiConverterUInt64.read(from),
lastPollMs: FfiConverterUInt64.read(from),
lastRemoteChangeMs: FfiConverterUInt64.read(from),
pendingUploads: FfiConverterUInt32.read(from),
pendingBytes: FfiConverterUInt64.read(from),
conflicts: FfiConverterSequenceTypeDriveConflict.read(from),
devices: FfiConverterSequenceTypeDriveDevice.read(from),
lastError: FfiConverterOptionalString.read(from),
pending: FfiConverterSequenceTypeDrivePendingUpload.read(from),
backend: FfiConverterString.read(from),
mount: FfiConverterString.read(from),
cache: FfiConverterOptionalTypeDriveCacheStats.read(from),
volumes: FfiConverterSequenceTypeDriveSpaceVolume.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.deviceId, into);
FfiConverterString.write(value.deviceName, into);
FfiConverterString.write(value.feed, into);
FfiConverterUInt64.write(value.pollIntervalMs, into);
FfiConverterUInt64.write(value.lastPollMs, into);
FfiConverterUInt64.write(value.lastRemoteChangeMs, into);
FfiConverterUInt32.write(value.pendingUploads, into);
FfiConverterUInt64.write(value.pendingBytes, into);
FfiConverterSequenceTypeDriveConflict.write(value.conflicts, into);
FfiConverterSequenceTypeDriveDevice.write(value.devices, into);
FfiConverterOptionalString.write(value.lastError, into);
FfiConverterSequenceTypeDrivePendingUpload.write(value.pending, into);
FfiConverterString.write(value.backend, into);
FfiConverterString.write(value.mount, into);
FfiConverterOptionalTypeDriveCacheStats.write(value.cache, into);
FfiConverterSequenceTypeDriveSpaceVolume.write(value.volumes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.deviceId) +
FfiConverterString.allocationSize(value.deviceName) +
FfiConverterString.allocationSize(value.feed) +
FfiConverterUInt64.allocationSize(value.pollIntervalMs) +
FfiConverterUInt64.allocationSize(value.lastPollMs) +
FfiConverterUInt64.allocationSize(value.lastRemoteChangeMs) +
FfiConverterUInt32.allocationSize(value.pendingUploads) +
FfiConverterUInt64.allocationSize(value.pendingBytes) +
FfiConverterSequenceTypeDriveConflict.allocationSize(value.conflicts) +
FfiConverterSequenceTypeDriveDevice.allocationSize(value.devices) +
FfiConverterOptionalString.allocationSize(value.lastError) +
FfiConverterSequenceTypeDrivePendingUpload.allocationSize(value.pending) +
FfiConverterString.allocationSize(value.backend) +
FfiConverterString.allocationSize(value.mount) +
FfiConverterOptionalTypeDriveCacheStats.allocationSize(value.cache) +
FfiConverterSequenceTypeDriveSpaceVolume.allocationSize(value.volumes);
}
};
return new FFIConverter();
})();
/**
* One version in a file's history.
*/
export type DriveVersion = {
version: string,
size: bigint,
modifiedMs: bigint,
deleted: boolean,
latest: boolean
}
/**
* Generated factory for {@link DriveVersion} record objects.
*/
export const DriveVersion = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<DriveVersion, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveVersion>,
});
})();
const FfiConverterTypeDriveVersion = (() => {
type TypeName = DriveVersion;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
version: FfiConverterString.read(from),
size: FfiConverterUInt64.read(from),
modifiedMs: FfiConverterUInt64.read(from),
deleted: FfiConverterBool.read(from),
latest: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.version, into);
FfiConverterUInt64.write(value.size, into);
FfiConverterUInt64.write(value.modifiedMs, into);
FfiConverterBool.write(value.deleted, into);
FfiConverterBool.write(value.latest, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.version) +
FfiConverterUInt64.allocationSize(value.size) +
FfiConverterUInt64.allocationSize(value.modifiedMs) +
FfiConverterBool.allocationSize(value.deleted) +
FfiConverterBool.allocationSize(value.latest);
}
};
return new FFIConverter();
})();
/**
* Whose view of the drive a call takes: the user (the default, the whole
* drive) or a persistent agent in a Space. It only ever narrows.
*/
export type DriveView = {
/**
* A persistent agent's name (`ada`).
*/
asAgent?: string,
/**
* The Space id the agent is in (`local:work`).
*/
inSpace?: string
}
/**
* Generated factory for {@link DriveView} record objects.
*/
export const DriveView = (() => {
const defaults = () => ({
asAgent: undefined,
inSpace: undefined
});
const create = (() => {
return uniffiCreateRecord<DriveView, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<DriveView>,
});
})();
const FfiConverterTypeDriveView = (() => {
type TypeName = DriveView;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
asAgent: FfiConverterOptionalString.read(from),
inSpace: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.asAgent, into);
FfiConverterOptionalString.write(value.inSpace, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.asAgent) +
FfiConverterOptionalString.allocationSize(value.inSpace);
}
};
return new FFIConverter();
})();
/**
* Which destinations a Space may open connections to. Everything is
* allowed unless a rule says otherwise: every `deny` entry blocks that
* destination, every `allow` entry is an exception that wins over `deny`
* (`deny: ["all"]` with `allow: ["1.1.1.1"]` leaves only 1.1.1.1
* reachable), and an `allow` list with no `deny` blocks nothing. Entries
* are IPv4/IPv6 addresses or CIDRs (`all` is `0.0.0.0/0` and `::/0`);
* a hostname is refused (rules are by IP/CIDR). DNS works only while the
* resolver the guest uses is not blocked (or is allowed): there is no
* special case. Loopback, replies to connections made to the guest and
* IPv6 neighbor discovery are never filtered.
*
* The host the Space runs on enforces it, outside the guest, from the
* guest's first instruction ([`SpaceInfo::egress_enforced`]): containers
* (runc and gVisor) on the container engine's host, Firecracker and QEMU
* VMs on Linux in a network namespace around the VM. Nothing in the
* guest, root included, can change it. macOS VMs, Apple Containerization,
* QEMU on macOS or Windows, Cua Cloud and your own cloud accounts refuse
* a policy (`Unsupported`, saying why).
*/
export type EgressPolicy = {
/**
* Destinations that stay reachable where `deny` blocks them.
*/
allow: Array<string>,
/**
* Destinations that are blocked.
*/
deny: Array<string>
}
/**
* Generated factory for {@link EgressPolicy} record objects.
*/
export const EgressPolicy = (() => {
const defaults = () => ({
allow: [],
deny: []
});
const create = (() => {
return uniffiCreateRecord<EgressPolicy, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<EgressPolicy>,
});
})();
const FfiConverterTypeEgressPolicy = (() => {
type TypeName = EgressPolicy;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
allow: FfiConverterSequenceString.read(from),
deny: FfiConverterSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterSequenceString.write(value.allow, into);
FfiConverterSequenceString.write(value.deny, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceString.allocationSize(value.allow) +
FfiConverterSequenceString.allocationSize(value.deny);
}
};
return new FFIConverter();
})();
/**
* Some Spaces of one group on one machine.
*/
export type ElasticAssignment = {
/**
* The group (`request-0`).
*/
group: string,
/**
* A machine in the pool by name, or empty when it is a new one.
*/
host: string,
/**
* The index into `new_hosts` (when `host` is empty).
*/
newIndex?: number,
/**
* How many Spaces.
*/
count: number,
/**
* The checkpoint is copied there first.
*/
sync: boolean
}
/**
* Generated factory for {@link ElasticAssignment} record objects.
*/
export const ElasticAssignment = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ElasticAssignment, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ElasticAssignment>,
});
})();
const FfiConverterTypeElasticAssignment = (() => {
type TypeName = ElasticAssignment;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
group: FfiConverterString.read(from),
host: FfiConverterString.read(from),
newIndex: FfiConverterOptionalUInt32.read(from),
count: FfiConverterUInt32.read(from),
sync: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.group, into);
FfiConverterString.write(value.host, into);
FfiConverterOptionalUInt32.write(value.newIndex, into);
FfiConverterUInt32.write(value.count, into);
FfiConverterBool.write(value.sync, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.group) +
FfiConverterString.allocationSize(value.host) +
FfiConverterOptionalUInt32.allocationSize(value.newIndex) +
FfiConverterUInt32.allocationSize(value.count) +
FfiConverterBool.allocationSize(value.sync);
}
};
return new FFIConverter();
})();
/**
* The budget, and what the clouds cost now.
*/
export type ElasticBudget = {
autoscale: boolean,
maxUsdPerHour: number,
monthlyUsd: number,
maxNewHosts: number,
warm: boolean,
allowMetal: boolean,
/**
* USD spent on elastic hosts this month.
*/
monthUsd: number,
/**
* USD per hour of the hosts running now.
*/
runningUsdPerHour: number,
/**
* Hosts running.
*/
hosts: number
}
/**
* Generated factory for {@link ElasticBudget} record objects.
*/
export const ElasticBudget = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ElasticBudget, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ElasticBudget>,
});
})();
const FfiConverterTypeElasticBudget = (() => {
type TypeName = ElasticBudget;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
autoscale: FfiConverterBool.read(from),
maxUsdPerHour: FfiConverterFloat64.read(from),
monthlyUsd: FfiConverterFloat64.read(from),
maxNewHosts: FfiConverterUInt32.read(from),
warm: FfiConverterBool.read(from),
allowMetal: FfiConverterBool.read(from),
monthUsd: FfiConverterFloat64.read(from),
runningUsdPerHour: FfiConverterFloat64.read(from),
hosts: FfiConverterUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterBool.write(value.autoscale, into);
FfiConverterFloat64.write(value.maxUsdPerHour, into);
FfiConverterFloat64.write(value.monthlyUsd, into);
FfiConverterUInt32.write(value.maxNewHosts, into);
FfiConverterBool.write(value.warm, into);
FfiConverterBool.write(value.allowMetal, into);
FfiConverterFloat64.write(value.monthUsd, into);
FfiConverterFloat64.write(value.runningUsdPerHour, into);
FfiConverterUInt32.write(value.hosts, into);
}
allocationSize(value: TypeName): number {
return FfiConverterBool.allocationSize(value.autoscale) +
FfiConverterFloat64.allocationSize(value.maxUsdPerHour) +
FfiConverterFloat64.allocationSize(value.monthlyUsd) +
FfiConverterUInt32.allocationSize(value.maxNewHosts) +
FfiConverterBool.allocationSize(value.warm) +
FfiConverterBool.allocationSize(value.allowMetal) +
FfiConverterFloat64.allocationSize(value.monthUsd) +
FfiConverterFloat64.allocationSize(value.runningUsdPerHour) +
FfiConverterUInt32.allocationSize(value.hosts);
}
};
return new FFIConverter();
})();
/**
* The elastic pool's caps and switches (`cloud_budget`): set those given.
*/
export type ElasticBudgetUpdate = {
maxUsdPerHour?: number,
monthlyUsd?: number,
autoscale?: boolean,
maxNewHosts?: number,
warm?: boolean,
allowMetal?: boolean
}
/**
* Generated factory for {@link ElasticBudgetUpdate} record objects.
*/
export const ElasticBudgetUpdate = (() => {
const defaults = () => ({
maxUsdPerHour: undefined,
monthlyUsd: undefined,
autoscale: undefined,
maxNewHosts: undefined,
warm: undefined,
allowMetal: undefined
});
const create = (() => {
return uniffiCreateRecord<ElasticBudgetUpdate, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ElasticBudgetUpdate>,
});
})();
const FfiConverterTypeElasticBudgetUpdate = (() => {
type TypeName = ElasticBudgetUpdate;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
maxUsdPerHour: FfiConverterOptionalFloat64.read(from),
monthlyUsd: FfiConverterOptionalFloat64.read(from),
autoscale: FfiConverterOptionalBoolean.read(from),
maxNewHosts: FfiConverterOptionalUInt32.read(from),
warm: FfiConverterOptionalBoolean.read(from),
allowMetal: FfiConverterOptionalBoolean.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalFloat64.write(value.maxUsdPerHour, into);
FfiConverterOptionalFloat64.write(value.monthlyUsd, into);
FfiConverterOptionalBoolean.write(value.autoscale, into);
FfiConverterOptionalUInt32.write(value.maxNewHosts, into);
FfiConverterOptionalBoolean.write(value.warm, into);
FfiConverterOptionalBoolean.write(value.allowMetal, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalFloat64.allocationSize(value.maxUsdPerHour) +
FfiConverterOptionalFloat64.allocationSize(value.monthlyUsd) +
FfiConverterOptionalBoolean.allocationSize(value.autoscale) +
FfiConverterOptionalUInt32.allocationSize(value.maxNewHosts) +
FfiConverterOptionalBoolean.allocationSize(value.warm) +
FfiConverterOptionalBoolean.allocationSize(value.allowMetal);
}
};
return new FFIConverter();
})();
/**
* One scale-in decision.
*/
export type ElasticDecision = {
host: string,
/**
* `keep`, `cordon` or `remove`.
*/
action: string,
reason: string,
/**
* `keep`: unix seconds it is looked at again.
*/
until: bigint,
/**
* `remove`: USD saved against keeping it a billing step longer.
*/
savesUsd: number
}
/**
* Generated factory for {@link ElasticDecision} record objects.
*/
export const ElasticDecision = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ElasticDecision, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ElasticDecision>,
});
})();
const FfiConverterTypeElasticDecision = (() => {
type TypeName = ElasticDecision;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
host: FfiConverterString.read(from),
action: FfiConverterString.read(from),
reason: FfiConverterString.read(from),
until: FfiConverterUInt64.read(from),
savesUsd: FfiConverterFloat64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.host, into);
FfiConverterString.write(value.action, into);
FfiConverterString.write(value.reason, into);
FfiConverterUInt64.write(value.until, into);
FfiConverterFloat64.write(value.savesUsd, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.host) +
FfiConverterString.allocationSize(value.action) +
FfiConverterString.allocationSize(value.reason) +
FfiConverterUInt64.allocationSize(value.until) +
FfiConverterFloat64.allocationSize(value.savesUsd);
}
};
return new FFIConverter();
})();
/**
* A host the elastic pool added in one of your clouds.
*/
export type ElasticHost = {
/**
* Its pool name (`hetzner-1`).
*/
name: string,
provider: string,
typeName: string,
region: string,
/**
* The cloud's id.
*/
id: string,
/**
* Its relay machine once joined.
*/
machine: string,
/**
* `creating`, `booting`, `joined`, `cordoned`, `offline`, `gone`.
*/
state: string,
/**
* Unix seconds.
*/
started: bigint,
/**
* Unix seconds it ends on its own.
*/
expires: bigint,
usdPerHour: number,
billingStepSecs: bigint,
billingMinSecs: bigint,
/**
* Added by hand: never removed by the scaler.
*/
pinned: boolean
}
/**
* Generated factory for {@link ElasticHost} record objects.
*/
export const ElasticHost = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ElasticHost, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ElasticHost>,
});
})();
const FfiConverterTypeElasticHost = (() => {
type TypeName = ElasticHost;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
provider: FfiConverterString.read(from),
typeName: FfiConverterString.read(from),
region: FfiConverterString.read(from),
id: FfiConverterString.read(from),
machine: FfiConverterString.read(from),
state: FfiConverterString.read(from),
started: FfiConverterUInt64.read(from),
expires: FfiConverterUInt64.read(from),
usdPerHour: FfiConverterFloat64.read(from),
billingStepSecs: FfiConverterUInt64.read(from),
billingMinSecs: FfiConverterUInt64.read(from),
pinned: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.provider, into);
FfiConverterString.write(value.typeName, into);
FfiConverterString.write(value.region, into);
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.machine, into);
FfiConverterString.write(value.state, into);
FfiConverterUInt64.write(value.started, into);
FfiConverterUInt64.write(value.expires, into);
FfiConverterFloat64.write(value.usdPerHour, into);
FfiConverterUInt64.write(value.billingStepSecs, into);
FfiConverterUInt64.write(value.billingMinSecs, into);
FfiConverterBool.write(value.pinned, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.provider) +
FfiConverterString.allocationSize(value.typeName) +
FfiConverterString.allocationSize(value.region) +
FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.machine) +
FfiConverterString.allocationSize(value.state) +
FfiConverterUInt64.allocationSize(value.started) +
FfiConverterUInt64.allocationSize(value.expires) +
FfiConverterFloat64.allocationSize(value.usdPerHour) +
FfiConverterUInt64.allocationSize(value.billingStepSecs) +
FfiConverterUInt64.allocationSize(value.billingMinSecs) +
FfiConverterBool.allocationSize(value.pinned);
}
};
return new FFIConverter();
})();
/**
* A machine the plan adds.
*/
export type ElasticNewHost = {
provider: string,
typeName: string,
region: string,
usdPerHour: number,
bootSecs: number,
/**
* Seconds billed for the work it gets.
*/
billedSecs: bigint,
/**
* A Spaces supplier's Space (Modal), not a host.
*/
oneSpace: boolean,
/**
* Estimated round trip from the requester, ms (0: unknown).
*/
rttMs: number
}
/**
* Generated factory for {@link ElasticNewHost} record objects.
*/
export const ElasticNewHost = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ElasticNewHost, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ElasticNewHost>,
});
})();
const FfiConverterTypeElasticNewHost = (() => {
type TypeName = ElasticNewHost;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
provider: FfiConverterString.read(from),
typeName: FfiConverterString.read(from),
region: FfiConverterString.read(from),
usdPerHour: FfiConverterFloat64.read(from),
bootSecs: FfiConverterUInt32.read(from),
billedSecs: FfiConverterUInt64.read(from),
oneSpace: FfiConverterBool.read(from),
rttMs: FfiConverterUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.provider, into);
FfiConverterString.write(value.typeName, into);
FfiConverterString.write(value.region, into);
FfiConverterFloat64.write(value.usdPerHour, into);
FfiConverterUInt32.write(value.bootSecs, into);
FfiConverterUInt64.write(value.billedSecs, into);
FfiConverterBool.write(value.oneSpace, into);
FfiConverterUInt32.write(value.rttMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.provider) +
FfiConverterString.allocationSize(value.typeName) +
FfiConverterString.allocationSize(value.region) +
FfiConverterFloat64.allocationSize(value.usdPerHour) +
FfiConverterUInt32.allocationSize(value.bootSecs) +
FfiConverterUInt64.allocationSize(value.billedSecs) +
FfiConverterBool.allocationSize(value.oneSpace) +
FfiConverterUInt32.allocationSize(value.rttMs);
}
};
return new FFIConverter();
})();
/**
* Spaces with no place, and why.
*/
export type ElasticUnplaced = {
group: string,
count: number,
reason: string
}
/**
* Generated factory for {@link ElasticUnplaced} record objects.
*/
export const ElasticUnplaced = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ElasticUnplaced, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ElasticUnplaced>,
});
})();
const FfiConverterTypeElasticUnplaced = (() => {
type TypeName = ElasticUnplaced;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
group: FfiConverterString.read(from),
count: FfiConverterUInt32.read(from),
reason: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.group, into);
FfiConverterUInt32.write(value.count, into);
FfiConverterString.write(value.reason, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.group) +
FfiConverterUInt32.allocationSize(value.count) +
FfiConverterString.allocationSize(value.reason);
}
};
return new FFIConverter();
})();
/**
* The elastic pool's decision (`cloud_plan`).
*/
export type ElasticPlan = {
assignments: Array<ElasticAssignment>,
newHosts: Array<ElasticNewHost>,
unplaced: Array<ElasticUnplaced>,
/**
* USD per hour the new machines add.
*/
addedUsdPerHour: number,
/**
* USD the new machines cost for the work, billed.
*/
projectedUsd: number,
/**
* A lower bound for any plan of the same work.
*/
lowerBoundUsd: number,
/**
* `exact`, `exact-incumbent` or `greedy`.
*/
solver: string,
/**
* Seconds until the last Space can start.
*/
readyInSecs: number,
/**
* One line per decision.
*/
explain: Array<string>,
/**
* The hosts added (with `apply`).
*/
added: Array<ElasticHost>,
/**
* The whole answer as JSON (the demand it detected, the pool it saw):
* what an agent inspects or edits.
*/
json: string
}
/**
* Generated factory for {@link ElasticPlan} record objects.
*/
export const ElasticPlan = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ElasticPlan, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ElasticPlan>,
});
})();
const FfiConverterTypeElasticPlan = (() => {
type TypeName = ElasticPlan;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
assignments: FfiConverterSequenceTypeElasticAssignment.read(from),
newHosts: FfiConverterSequenceTypeElasticNewHost.read(from),
unplaced: FfiConverterSequenceTypeElasticUnplaced.read(from),
addedUsdPerHour: FfiConverterFloat64.read(from),
projectedUsd: FfiConverterFloat64.read(from),
lowerBoundUsd: FfiConverterFloat64.read(from),
solver: FfiConverterString.read(from),
readyInSecs: FfiConverterUInt32.read(from),
explain: FfiConverterSequenceString.read(from),
added: FfiConverterSequenceTypeElasticHost.read(from),
json: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterSequenceTypeElasticAssignment.write(value.assignments, into);
FfiConverterSequenceTypeElasticNewHost.write(value.newHosts, into);
FfiConverterSequenceTypeElasticUnplaced.write(value.unplaced, into);
FfiConverterFloat64.write(value.addedUsdPerHour, into);
FfiConverterFloat64.write(value.projectedUsd, into);
FfiConverterFloat64.write(value.lowerBoundUsd, into);
FfiConverterString.write(value.solver, into);
FfiConverterUInt32.write(value.readyInSecs, into);
FfiConverterSequenceString.write(value.explain, into);
FfiConverterSequenceTypeElasticHost.write(value.added, into);
FfiConverterString.write(value.json, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceTypeElasticAssignment.allocationSize(value.assignments) +
FfiConverterSequenceTypeElasticNewHost.allocationSize(value.newHosts) +
FfiConverterSequenceTypeElasticUnplaced.allocationSize(value.unplaced) +
FfiConverterFloat64.allocationSize(value.addedUsdPerHour) +
FfiConverterFloat64.allocationSize(value.projectedUsd) +
FfiConverterFloat64.allocationSize(value.lowerBoundUsd) +
FfiConverterString.allocationSize(value.solver) +
FfiConverterUInt32.allocationSize(value.readyInSecs) +
FfiConverterSequenceString.allocationSize(value.explain) +
FfiConverterSequenceTypeElasticHost.allocationSize(value.added) +
FfiConverterString.allocationSize(value.json);
}
};
return new FFIConverter();
})();
/**
* What to plan for (`cloud_plan`). Pins are constraints of the same
* solve: leave them unset to let the pool decide.
*/
export type ElasticPlanRequest = {
/**
* How many Spaces (default 1).
*/
count?: number,
/**
* Image (default linux).
*/
image?: string,
/**
* `container`, `vm` or `microvm` (default: from the image).
*/
kind?: string,
/**
* vCPUs each (default: learned from earlier Spaces of the image).
*/
cpus?: number,
/**
* MiB each.
*/
memoryMb?: bigint,
/**
* Keep them on one machine (forks of one checkpoint).
*/
together?: boolean,
/**
* `interactive`, `batch`, `compat` or `persistent_agent`.
*/
caller?: string,
/**
* Expected lifetime, seconds.
*/
durationSecs?: bigint,
/**
* Only this cloud.
*/
provider?: string,
/**
* Only this region.
*/
region?: string,
/**
* Only this machine type.
*/
instanceType?: string,
/**
* Exactly this many new machines.
*/
hosts?: number,
/**
* Add no machines.
*/
noScale?: boolean,
/**
* Only your own devices.
*/
devicesOnly?: boolean,
/**
* A $/hour cap for this plan.
*/
maxUsdPerHour?: number,
/**
* Add the machines the plan needs.
*/
apply: boolean
}
/**
* Generated factory for {@link ElasticPlanRequest} record objects.
*/
export const ElasticPlanRequest = (() => {
const defaults = () => ({
count: undefined,
image: undefined,
kind: undefined,
cpus: undefined,
memoryMb: undefined,
together: undefined,
caller: undefined,
durationSecs: undefined,
provider: undefined,
region: undefined,
instanceType: undefined,
hosts: undefined,
noScale: undefined,
devicesOnly: undefined,
maxUsdPerHour: undefined,
apply: false
});
const create = (() => {
return uniffiCreateRecord<ElasticPlanRequest, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ElasticPlanRequest>,
});
})();
const FfiConverterTypeElasticPlanRequest = (() => {
type TypeName = ElasticPlanRequest;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
count: FfiConverterOptionalUInt32.read(from),
image: FfiConverterOptionalString.read(from),
kind: FfiConverterOptionalString.read(from),
cpus: FfiConverterOptionalUInt32.read(from),
memoryMb: FfiConverterOptionalUInt64.read(from),
together: FfiConverterOptionalBoolean.read(from),
caller: FfiConverterOptionalString.read(from),
durationSecs: FfiConverterOptionalUInt64.read(from),
provider: FfiConverterOptionalString.read(from),
region: FfiConverterOptionalString.read(from),
instanceType: FfiConverterOptionalString.read(from),
hosts: FfiConverterOptionalUInt32.read(from),
noScale: FfiConverterOptionalBoolean.read(from),
devicesOnly: FfiConverterOptionalBoolean.read(from),
maxUsdPerHour: FfiConverterOptionalFloat64.read(from),
apply: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalUInt32.write(value.count, into);
FfiConverterOptionalString.write(value.image, into);
FfiConverterOptionalString.write(value.kind, into);
FfiConverterOptionalUInt32.write(value.cpus, into);
FfiConverterOptionalUInt64.write(value.memoryMb, into);
FfiConverterOptionalBoolean.write(value.together, into);
FfiConverterOptionalString.write(value.caller, into);
FfiConverterOptionalUInt64.write(value.durationSecs, into);
FfiConverterOptionalString.write(value.provider, into);
FfiConverterOptionalString.write(value.region, into);
FfiConverterOptionalString.write(value.instanceType, into);
FfiConverterOptionalUInt32.write(value.hosts, into);
FfiConverterOptionalBoolean.write(value.noScale, into);
FfiConverterOptionalBoolean.write(value.devicesOnly, into);
FfiConverterOptionalFloat64.write(value.maxUsdPerHour, into);
FfiConverterBool.write(value.apply, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalUInt32.allocationSize(value.count) +
FfiConverterOptionalString.allocationSize(value.image) +
FfiConverterOptionalString.allocationSize(value.kind) +
FfiConverterOptionalUInt32.allocationSize(value.cpus) +
FfiConverterOptionalUInt64.allocationSize(value.memoryMb) +
FfiConverterOptionalBoolean.allocationSize(value.together) +
FfiConverterOptionalString.allocationSize(value.caller) +
FfiConverterOptionalUInt64.allocationSize(value.durationSecs) +
FfiConverterOptionalString.allocationSize(value.provider) +
FfiConverterOptionalString.allocationSize(value.region) +
FfiConverterOptionalString.allocationSize(value.instanceType) +
FfiConverterOptionalUInt32.allocationSize(value.hosts) +
FfiConverterOptionalBoolean.allocationSize(value.noScale) +
FfiConverterOptionalBoolean.allocationSize(value.devicesOnly) +
FfiConverterOptionalFloat64.allocationSize(value.maxUsdPerHour) +
FfiConverterBool.allocationSize(value.apply);
}
};
return new FFIConverter();
})();
/**
* What `cloud_remove_host` did.
*/
export type ElasticRemoved = {
removed: Array<string>,
/**
* `name: error` per host not removed.
*/
failed: Array<string>
}
/**
* Generated factory for {@link ElasticRemoved} record objects.
*/
export const ElasticRemoved = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ElasticRemoved, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ElasticRemoved>,
});
})();
const FfiConverterTypeElasticRemoved = (() => {
type TypeName = ElasticRemoved;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
removed: FfiConverterSequenceString.read(from),
failed: FfiConverterSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterSequenceString.write(value.removed, into);
FfiConverterSequenceString.write(value.failed, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceString.allocationSize(value.removed) +
FfiConverterSequenceString.allocationSize(value.failed);
}
};
return new FFIConverter();
})();
/**
* How a process ended.
*/
export type ExitInfo = {
/**
* Exit code for a normal exit.
*/
code?: number,
/**
* Terminating signal (`kill`, `term`, ...).
*/
signal?: string,
/**
* Raw number of the terminating signal on the guest's OS, set for every
* signal death, also for those `signal` has no name for (SIGSEGV,
* SIGABRT, SIGPIPE, ...).
*/
signalNumber?: number,
/**
* Conventional name of the terminating signal without `SIG`, in upper
* case ("SEGV", "ABRT"); independent of the guest's OS.
*/
signalName?: string,
/**
* Stopped by its timeout.
*/
timedOut: boolean,
/**
* Supervisor error (for example "executable not found").
*/
error?: string,
/**
* `code == 0`.
*/
success: boolean
}
/**
* Generated factory for {@link ExitInfo} record objects.
*/
export const ExitInfo = (() => {
const defaults = () => ({
signalNumber: undefined,
signalName: undefined,
});
const create = (() => {
return uniffiCreateRecord<ExitInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ExitInfo>,
});
})();
const FfiConverterTypeExitInfo = (() => {
type TypeName = ExitInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
code: FfiConverterOptionalInt32.read(from),
signal: FfiConverterOptionalString.read(from),
signalNumber: FfiConverterOptionalInt32.read(from),
signalName: FfiConverterOptionalString.read(from),
timedOut: FfiConverterBool.read(from),
error: FfiConverterOptionalString.read(from),
success: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalInt32.write(value.code, into);
FfiConverterOptionalString.write(value.signal, into);
FfiConverterOptionalInt32.write(value.signalNumber, into);
FfiConverterOptionalString.write(value.signalName, into);
FfiConverterBool.write(value.timedOut, into);
FfiConverterOptionalString.write(value.error, into);
FfiConverterBool.write(value.success, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalInt32.allocationSize(value.code) +
FfiConverterOptionalString.allocationSize(value.signal) +
FfiConverterOptionalInt32.allocationSize(value.signalNumber) +
FfiConverterOptionalString.allocationSize(value.signalName) +
FfiConverterBool.allocationSize(value.timedOut) +
FfiConverterOptionalString.allocationSize(value.error) +
FfiConverterBool.allocationSize(value.success);
}
};
return new FFIConverter();
})();
/**
* A file or directory in the guest.
*/
export type FileEntry = {
/**
* Base name.
*/
name: string,
/**
* Absolute path.
*/
path: string,
/**
* `file`, `directory`, `symlink` or `other`.
*/
kind: string,
/**
* Size in bytes.
*/
size: bigint,
/**
* Unix mode bits.
*/
mode: number,
/**
* Modification time (Unix ms), when known.
*/
modifiedMs?: bigint,
/**
* Symlink target.
*/
symlinkTarget?: string,
/**
* Owning user name (a numeric id when the guest has no such user);
* `None` where the guest has no owners (Windows).
*/
owner?: string,
/**
* Owning group name; `None` where the guest has none (Windows).
*/
group?: string,
/**
* Extended attributes under the call's `xattr_namespace` (default
* `user.cua.meta.`), without the prefix. Empty when there are none or
* the guest file system has no extended attributes.
*/
metadata: Map<string, string>
}
/**
* Generated factory for {@link FileEntry} record objects.
*/
export const FileEntry = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<FileEntry, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<FileEntry>,
});
})();
const FfiConverterTypeFileEntry = (() => {
type TypeName = FileEntry;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
path: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
size: FfiConverterUInt64.read(from),
mode: FfiConverterUInt32.read(from),
modifiedMs: FfiConverterOptionalInt64.read(from),
symlinkTarget: FfiConverterOptionalString.read(from),
owner: FfiConverterOptionalString.read(from),
group: FfiConverterOptionalString.read(from),
metadata: FfiConverterMapStringString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.path, into);
FfiConverterString.write(value.kind, into);
FfiConverterUInt64.write(value.size, into);
FfiConverterUInt32.write(value.mode, into);
FfiConverterOptionalInt64.write(value.modifiedMs, into);
FfiConverterOptionalString.write(value.symlinkTarget, into);
FfiConverterOptionalString.write(value.owner, into);
FfiConverterOptionalString.write(value.group, into);
FfiConverterMapStringString.write(value.metadata, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.path) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterUInt64.allocationSize(value.size) +
FfiConverterUInt32.allocationSize(value.mode) +
FfiConverterOptionalInt64.allocationSize(value.modifiedMs) +
FfiConverterOptionalString.allocationSize(value.symlinkTarget) +
FfiConverterOptionalString.allocationSize(value.owner) +
FfiConverterOptionalString.allocationSize(value.group) +
FfiConverterMapStringString.allocationSize(value.metadata);
}
};
return new FFIConverter();
})();
/**
* One fork of a batch. Ready, or failed with why.
*/
export type ForkBatchItem = {
/**
* Its index in the batch.
*/
index: number,
/**
* Its group.
*/
group: number,
/**
* Its checkpoint.
*/
source: string,
/**
* Its name.
*/
name: string,
/**
* The machine it runs on (`local` for this one).
*/
host: string,
/**
* The Space to connect to (`local:<name>`, `direct:<addr>`,
* `relay:<machine>`); empty when it failed.
*/
space: string,
/**
* Why it failed; empty when it is ready.
*/
error: string,
/**
* `host_failed`, `no_capacity`, `sync_failed`, `fork_failed` or
* `no_host` with `error`.
*/
errorCode: string,
/**
* Which placement it came from (1: the first).
*/
attempt: number,
/**
* Milliseconds from the start of the batch until it was ready.
*/
elapsedMs: bigint,
/**
* Milliseconds its own fork took.
*/
forkMs: bigint
}
/**
* Generated factory for {@link ForkBatchItem} record objects.
*/
export const ForkBatchItem = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ForkBatchItem, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ForkBatchItem>,
});
})();
const FfiConverterTypeForkBatchItem = (() => {
type TypeName = ForkBatchItem;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
index: FfiConverterUInt32.read(from),
group: FfiConverterUInt32.read(from),
source: FfiConverterString.read(from),
name: FfiConverterString.read(from),
host: FfiConverterString.read(from),
space: FfiConverterString.read(from),
error: FfiConverterString.read(from),
errorCode: FfiConverterString.read(from),
attempt: FfiConverterUInt32.read(from),
elapsedMs: FfiConverterUInt64.read(from),
forkMs: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt32.write(value.index, into);
FfiConverterUInt32.write(value.group, into);
FfiConverterString.write(value.source, into);
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.host, into);
FfiConverterString.write(value.space, into);
FfiConverterString.write(value.error, into);
FfiConverterString.write(value.errorCode, into);
FfiConverterUInt32.write(value.attempt, into);
FfiConverterUInt64.write(value.elapsedMs, into);
FfiConverterUInt64.write(value.forkMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt32.allocationSize(value.index) +
FfiConverterUInt32.allocationSize(value.group) +
FfiConverterString.allocationSize(value.source) +
FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.host) +
FfiConverterString.allocationSize(value.space) +
FfiConverterString.allocationSize(value.error) +
FfiConverterString.allocationSize(value.errorCode) +
FfiConverterUInt32.allocationSize(value.attempt) +
FfiConverterUInt64.allocationSize(value.elapsedMs) +
FfiConverterUInt64.allocationSize(value.forkMs);
}
};
return new FFIConverter();
})();
/**
* A group's placement. Where its forks went.
*/
export type ForkBatchPlacement = {
/**
* The group.
*/
group: number,
/**
* Its checkpoint.
*/
source: string,
/**
* The machine.
*/
host: string,
/**
* How many of its forks go there.
*/
count: number,
/**
* 1 for the first placement, higher when placed again.
*/
attempt: number,
/**
* The checkpoint is copied there first.
*/
needsSync: boolean,
/**
* Why there.
*/
reason: string
}
/**
* Generated factory for {@link ForkBatchPlacement} record objects.
*/
export const ForkBatchPlacement = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ForkBatchPlacement, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ForkBatchPlacement>,
});
})();
const FfiConverterTypeForkBatchPlacement = (() => {
type TypeName = ForkBatchPlacement;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
group: FfiConverterUInt32.read(from),
source: FfiConverterString.read(from),
host: FfiConverterString.read(from),
count: FfiConverterUInt32.read(from),
attempt: FfiConverterUInt32.read(from),
needsSync: FfiConverterBool.read(from),
reason: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt32.write(value.group, into);
FfiConverterString.write(value.source, into);
FfiConverterString.write(value.host, into);
FfiConverterUInt32.write(value.count, into);
FfiConverterUInt32.write(value.attempt, into);
FfiConverterBool.write(value.needsSync, into);
FfiConverterString.write(value.reason, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt32.allocationSize(value.group) +
FfiConverterString.allocationSize(value.source) +
FfiConverterString.allocationSize(value.host) +
FfiConverterUInt32.allocationSize(value.count) +
FfiConverterUInt32.allocationSize(value.attempt) +
FfiConverterBool.allocationSize(value.needsSync) +
FfiConverterString.allocationSize(value.reason);
}
};
return new FFIConverter();
})();
/**
* A batch's summary.
*/
export type ForkBatchSummary = {
/**
* Forks that are ready.
*/
ok: number,
/**
* Forks that failed.
*/
failed: number,
/**
* Milliseconds the batch took.
*/
elapsedMs: bigint,
/**
* Ready forks per machine.
*/
perHost: Map<string, number>,
/**
* Most forks starting at once per machine.
*/
peakParallel: Map<string, number>
}
/**
* Generated factory for {@link ForkBatchSummary} record objects.
*/
export const ForkBatchSummary = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ForkBatchSummary, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ForkBatchSummary>,
});
})();
const FfiConverterTypeForkBatchSummary = (() => {
type TypeName = ForkBatchSummary;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
ok: FfiConverterUInt32.read(from),
failed: FfiConverterUInt32.read(from),
elapsedMs: FfiConverterUInt64.read(from),
perHost: FfiConverterMapStringUInt32.read(from),
peakParallel: FfiConverterMapStringUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt32.write(value.ok, into);
FfiConverterUInt32.write(value.failed, into);
FfiConverterUInt64.write(value.elapsedMs, into);
FfiConverterMapStringUInt32.write(value.perHost, into);
FfiConverterMapStringUInt32.write(value.peakParallel, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt32.allocationSize(value.ok) +
FfiConverterUInt32.allocationSize(value.failed) +
FfiConverterUInt64.allocationSize(value.elapsedMs) +
FfiConverterMapStringUInt32.allocationSize(value.perHost) +
FfiConverterMapStringUInt32.allocationSize(value.peakParallel);
}
};
return new FFIConverter();
})();
/**
* A finished batch. Every fork and the summary ([`ForkBatch::collect`]).
*/
export type ForkBatchResult = {
/**
* The forks, by index.
*/
items: Array<ForkBatchItem>,
/**
* The summary.
*/
summary: ForkBatchSummary
}
/**
* Generated factory for {@link ForkBatchResult} record objects.
*/
export const ForkBatchResult = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ForkBatchResult, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ForkBatchResult>,
});
})();
const FfiConverterTypeForkBatchResult = (() => {
type TypeName = ForkBatchResult;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
items: FfiConverterSequenceTypeForkBatchItem.read(from),
summary: FfiConverterTypeForkBatchSummary.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterSequenceTypeForkBatchItem.write(value.items, into);
FfiConverterTypeForkBatchSummary.write(value.summary, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceTypeForkBatchItem.allocationSize(value.items) +
FfiConverterTypeForkBatchSummary.allocationSize(value.summary);
}
};
return new FFIConverter();
})();
/**
* A group of forks. The forks of one checkpoint that go to one machine
* together ([`Sandboxes::fork_groups`]).
*/
export type ForkGroup = {
/**
* The checkpoint, or a local sandbox (see [`Sandboxes::fork_many`]).
*/
source: string,
/**
* How many forks.
*/
count: number,
/**
* Names are `<prefix>-<n>` (empty: the batch's).
*/
namePrefix: string
}
/**
* Generated factory for {@link ForkGroup} record objects.
*/
export const ForkGroup = (() => {
const defaults = () => ({
namePrefix: ""
});
const create = (() => {
return uniffiCreateRecord<ForkGroup, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ForkGroup>,
});
})();
const FfiConverterTypeForkGroup = (() => {
type TypeName = ForkGroup;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
source: FfiConverterString.read(from),
count: FfiConverterUInt32.read(from),
namePrefix: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.source, into);
FfiConverterUInt32.write(value.count, into);
FfiConverterString.write(value.namePrefix, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.source) +
FfiConverterUInt32.allocationSize(value.count) +
FfiConverterString.allocationSize(value.namePrefix);
}
};
return new FFIConverter();
})();
/**
* A fallback copy of checkpoints. Your machines fetch a checkpoint there
* when the machine that holds it cannot be reached
* ([`Sandboxes::publish_checkpoint`] puts it there). Set `s3_bucket` (S3,
* with each machine's AWS credentials) or `dir` (a folder every machine
* mounts, such as your Cua Volume).
*/
export type SnapshotFallbackOptions = {
/**
* S3 bucket.
*/
s3Bucket: string,
/**
* Key prefix in the bucket (`cua-snapshots/`).
*/
s3Prefix: string,
/**
* Region (empty: each machine's AWS default).
*/
s3Region: string,
/**
* An S3-compatible endpoint (empty: AWS).
*/
s3Endpoint: string,
/**
* A folder every machine mounts (`~` is each machine's home), for
* example `~/Cua Volume/snapshots`.
*/
dir: string
}
/**
* Generated factory for {@link SnapshotFallbackOptions} record objects.
*/
export const SnapshotFallbackOptions = (() => {
const defaults = () => ({
s3Bucket: "",
s3Prefix: "",
s3Region: "",
s3Endpoint: "",
dir: ""
});
const create = (() => {
return uniffiCreateRecord<SnapshotFallbackOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SnapshotFallbackOptions>,
});
})();
const FfiConverterTypeSnapshotFallbackOptions = (() => {
type TypeName = SnapshotFallbackOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
s3Bucket: FfiConverterString.read(from),
s3Prefix: FfiConverterString.read(from),
s3Region: FfiConverterString.read(from),
s3Endpoint: FfiConverterString.read(from),
dir: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.s3Bucket, into);
FfiConverterString.write(value.s3Prefix, into);
FfiConverterString.write(value.s3Region, into);
FfiConverterString.write(value.s3Endpoint, into);
FfiConverterString.write(value.dir, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.s3Bucket) +
FfiConverterString.allocationSize(value.s3Prefix) +
FfiConverterString.allocationSize(value.s3Region) +
FfiConverterString.allocationSize(value.s3Endpoint) +
FfiConverterString.allocationSize(value.dir);
}
};
return new FFIConverter();
})();
/**
* Batched fork options. For [`Sandboxes::fork_many`] and
* [`Sandboxes::fork_groups`].
*/
export type ForkManyOptions = {
/**
* Where: `local` (this machine, the default), `auto` (your machines
* that provide Spaces, this one included, least loaded first) or
* `host:<machine>`.
*/
on?: string,
/**
* Forks per group for [`Sandboxes::fork_many`] (0: all in one group).
* A group's forks go to one machine, so they share the checkpoint's
* memory there.
*/
groupSize: number,
/**
* Forks started at once on one machine (0: 4).
*/
maxParallelPerHost: number,
/**
* Names are `<prefix>-<n>` (empty: `<checkpoint>-<random>`).
*/
namePrefix: string,
/**
* vCPUs each fork is counted as when placing (0: 1, as forks of one
* world are mostly idle).
*/
cpus: number,
/**
* Memory (MiB) each fork is counted as when placing (0: the
* checkpoint's).
*/
memoryMb: bigint,
/**
* Times forks of a machine that failed (or was full) are placed again
* on another (0: once).
*/
retries: number,
/**
* Never place failed forks again: report them.
*/
noRetry: boolean,
/**
* Where machines fetch a checkpoint they lack when the one that holds
* it cannot be reached.
*/
fallback?: SnapshotFallbackOptions
}
/**
* Generated factory for {@link ForkManyOptions} record objects.
*/
export const ForkManyOptions = (() => {
const defaults = () => ({
on: undefined,
groupSize: 0,
maxParallelPerHost: 0,
namePrefix: "",
cpus: 0,
memoryMb: BigInt("0"),
retries: 0,
noRetry: false,
fallback: undefined
});
const create = (() => {
return uniffiCreateRecord<ForkManyOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ForkManyOptions>,
});
})();
const FfiConverterTypeForkManyOptions = (() => {
type TypeName = ForkManyOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
on: FfiConverterOptionalString.read(from),
groupSize: FfiConverterUInt32.read(from),
maxParallelPerHost: FfiConverterUInt32.read(from),
namePrefix: FfiConverterString.read(from),
cpus: FfiConverterUInt32.read(from),
memoryMb: FfiConverterUInt64.read(from),
retries: FfiConverterUInt32.read(from),
noRetry: FfiConverterBool.read(from),
fallback: FfiConverterOptionalTypeSnapshotFallbackOptions.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.on, into);
FfiConverterUInt32.write(value.groupSize, into);
FfiConverterUInt32.write(value.maxParallelPerHost, into);
FfiConverterString.write(value.namePrefix, into);
FfiConverterUInt32.write(value.cpus, into);
FfiConverterUInt64.write(value.memoryMb, into);
FfiConverterUInt32.write(value.retries, into);
FfiConverterBool.write(value.noRetry, into);
FfiConverterOptionalTypeSnapshotFallbackOptions.write(value.fallback, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.on) +
FfiConverterUInt32.allocationSize(value.groupSize) +
FfiConverterUInt32.allocationSize(value.maxParallelPerHost) +
FfiConverterString.allocationSize(value.namePrefix) +
FfiConverterUInt32.allocationSize(value.cpus) +
FfiConverterUInt64.allocationSize(value.memoryMb) +
FfiConverterUInt32.allocationSize(value.retries) +
FfiConverterBool.allocationSize(value.noRetry) +
FfiConverterOptionalTypeSnapshotFallbackOptions.allocationSize(value.fallback);
}
};
return new FFIConverter();
})();
/**
* One GPU option of a runtime (see [`Spaces::gpu_support`]).
*/
export type GpuOption = {
/**
* What to pass as `gpu`.
*/
id: string,
/**
* How a person names it ("GPU acceleration").
*/
label: string,
/**
* Experimental.
*/
experimental: boolean,
/**
* Works on this host now.
*/
supported: boolean,
/**
* Why not, one short line (empty when supported).
*/
reason: string,
/**
* A page that explains it.
*/
learnMore?: string,
/**
* Estimated cost per hour while it runs (cloud GPU types).
*/
usdPerHour?: number
}
/**
* Generated factory for {@link GpuOption} record objects.
*/
export const GpuOption = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<GpuOption, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<GpuOption>,
});
})();
const FfiConverterTypeGpuOption = (() => {
type TypeName = GpuOption;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
label: FfiConverterString.read(from),
experimental: FfiConverterBool.read(from),
supported: FfiConverterBool.read(from),
reason: FfiConverterString.read(from),
learnMore: FfiConverterOptionalString.read(from),
usdPerHour: FfiConverterOptionalFloat64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.label, into);
FfiConverterBool.write(value.experimental, into);
FfiConverterBool.write(value.supported, into);
FfiConverterString.write(value.reason, into);
FfiConverterOptionalString.write(value.learnMore, into);
FfiConverterOptionalFloat64.write(value.usdPerHour, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.label) +
FfiConverterBool.allocationSize(value.experimental) +
FfiConverterBool.allocationSize(value.supported) +
FfiConverterString.allocationSize(value.reason) +
FfiConverterOptionalString.allocationSize(value.learnMore) +
FfiConverterOptionalFloat64.allocationSize(value.usdPerHour);
}
};
return new FFIConverter();
})();
/**
* The GPU options of one runtime: empty, with the reason, when it has
* none.
*/
export type GpuSupport = {
/**
* `lume`, `qemu`, `container`, `gvisor`, a provider's name.
*/
runtime: string,
/**
* Its options.
*/
options: Array<GpuOption>,
/**
* Why it has none.
*/
reason: string
}
/**
* Generated factory for {@link GpuSupport} record objects.
*/
export const GpuSupport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<GpuSupport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<GpuSupport>,
});
})();
const FfiConverterTypeGpuSupport = (() => {
type TypeName = GpuSupport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
runtime: FfiConverterString.read(from),
options: FfiConverterSequenceTypeGpuOption.read(from),
reason: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.runtime, into);
FfiConverterSequenceTypeGpuOption.write(value.options, into);
FfiConverterString.write(value.reason, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.runtime) +
FfiConverterSequenceTypeGpuOption.allocationSize(value.options) +
FfiConverterString.allocationSize(value.reason);
}
};
return new FFIConverter();
})();
/**
* What `SystemService.Metrics` reports from inside a Space.
*/
export type GuestUsage = {
/**
* Cores the guest sees.
*/
cpuCount: number,
/**
* Busy now, 0 to 100.
*/
cpuPercent: number,
/**
* 1-minute load average.
*/
loadAverage1m: number,
/**
* Memory in use, bytes.
*/
memoryUsed: bigint,
/**
* Memory size, bytes.
*/
memoryTotal: bigint,
/**
* `memory_total` is the guest's own limit.
*/
memoryLimited: boolean,
/**
* Disk in use, bytes.
*/
diskUsed: bigint,
/**
* Disk size, bytes.
*/
diskTotal: bigint,
/**
* `disk_total` is the guest's own disk.
*/
diskLimited: boolean
}
/**
* Generated factory for {@link GuestUsage} record objects.
*/
export const GuestUsage = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<GuestUsage, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<GuestUsage>,
});
})();
const FfiConverterTypeGuestUsage = (() => {
type TypeName = GuestUsage;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
cpuCount: FfiConverterUInt32.read(from),
cpuPercent: FfiConverterFloat64.read(from),
loadAverage1m: FfiConverterFloat64.read(from),
memoryUsed: FfiConverterUInt64.read(from),
memoryTotal: FfiConverterUInt64.read(from),
memoryLimited: FfiConverterBool.read(from),
diskUsed: FfiConverterUInt64.read(from),
diskTotal: FfiConverterUInt64.read(from),
diskLimited: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt32.write(value.cpuCount, into);
FfiConverterFloat64.write(value.cpuPercent, into);
FfiConverterFloat64.write(value.loadAverage1m, into);
FfiConverterUInt64.write(value.memoryUsed, into);
FfiConverterUInt64.write(value.memoryTotal, into);
FfiConverterBool.write(value.memoryLimited, into);
FfiConverterUInt64.write(value.diskUsed, into);
FfiConverterUInt64.write(value.diskTotal, into);
FfiConverterBool.write(value.diskLimited, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt32.allocationSize(value.cpuCount) +
FfiConverterFloat64.allocationSize(value.cpuPercent) +
FfiConverterFloat64.allocationSize(value.loadAverage1m) +
FfiConverterUInt64.allocationSize(value.memoryUsed) +
FfiConverterUInt64.allocationSize(value.memoryTotal) +
FfiConverterBool.allocationSize(value.memoryLimited) +
FfiConverterUInt64.allocationSize(value.diskUsed) +
FfiConverterUInt64.allocationSize(value.diskTotal) +
FfiConverterBool.allocationSize(value.diskLimited);
}
};
return new FFIConverter();
})();
/**
* One access to this machine.
*/
export type HostAccessRecord = {
/**
* Epoch ms.
*/
atMs: bigint,
/**
* `relay`, `viewer` or `token`.
*/
via: string,
/**
* Who.
*/
who: string,
/**
* What they used (a service name, or `MCP`).
*/
what: string
}
/**
* Generated factory for {@link HostAccessRecord} record objects.
*/
export const HostAccessRecord = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<HostAccessRecord, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<HostAccessRecord>,
});
})();
const FfiConverterTypeHostAccessRecord = (() => {
type TypeName = HostAccessRecord;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
atMs: FfiConverterInt64.read(from),
via: FfiConverterString.read(from),
who: FfiConverterString.read(from),
what: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterInt64.write(value.atMs, into);
FfiConverterString.write(value.via, into);
FfiConverterString.write(value.who, into);
FfiConverterString.write(value.what, into);
}
allocationSize(value: TypeName): number {
return FfiConverterInt64.allocationSize(value.atMs) +
FfiConverterString.allocationSize(value.via) +
FfiConverterString.allocationSize(value.who) +
FfiConverterString.allocationSize(value.what);
}
};
return new FFIConverter();
})();
/**
* A macOS privacy pane the user must grant.
*/
export type HostPermission = {
/**
* `screen-recording` or `accessibility`.
*/
id: string,
/**
* Title.
*/
title: string,
/**
* `x-apple.systempreferences:` URL.
*/
settingsUrl: string,
/**
* Instructions.
*/
instructions: string
}
/**
* Generated factory for {@link HostPermission} record objects.
*/
export const HostPermission = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<HostPermission, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<HostPermission>,
});
})();
const FfiConverterTypeHostPermission = (() => {
type TypeName = HostPermission;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
title: FfiConverterString.read(from),
settingsUrl: FfiConverterString.read(from),
instructions: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.title, into);
FfiConverterString.write(value.settingsUrl, into);
FfiConverterString.write(value.instructions, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.title) +
FfiConverterString.allocationSize(value.settingsUrl) +
FfiConverterString.allocationSize(value.instructions);
}
};
return new FFIConverter();
})();
/**
* A Space this machine provides to one of your devices.
*/
export type HostProvidedSpace = {
/**
* The relay machine it is reached as (`relay:<machine>`).
*/
relayMachine: string,
/**
* The Space on this machine (`local:<name>`).
*/
localSpace: string,
/**
* Display name.
*/
name: string,
/**
* The image, as requested.
*/
image: string,
/**
* `linux`, `macos` (empty when unknown).
*/
os: string,
/**
* `container` or `vm`.
*/
kind: string,
/**
* Who created it.
*/
createdBy: string,
/**
* Epoch ms.
*/
createdAtMs: bigint
}
/**
* Generated factory for {@link HostProvidedSpace} record objects.
*/
export const HostProvidedSpace = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<HostProvidedSpace, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<HostProvidedSpace>,
});
})();
const FfiConverterTypeHostProvidedSpace = (() => {
type TypeName = HostProvidedSpace;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
relayMachine: FfiConverterString.read(from),
localSpace: FfiConverterString.read(from),
name: FfiConverterString.read(from),
image: FfiConverterString.read(from),
os: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
createdBy: FfiConverterString.read(from),
createdAtMs: FfiConverterInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.relayMachine, into);
FfiConverterString.write(value.localSpace, into);
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.image, into);
FfiConverterString.write(value.os, into);
FfiConverterString.write(value.kind, into);
FfiConverterString.write(value.createdBy, into);
FfiConverterInt64.write(value.createdAtMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.relayMachine) +
FfiConverterString.allocationSize(value.localSpace) +
FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.image) +
FfiConverterString.allocationSize(value.os) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterString.allocationSize(value.createdBy) +
FfiConverterInt64.allocationSize(value.createdAtMs);
}
};
return new FFIConverter();
})();
/**
* What [`Host::migrate_service`] did.
*/
export type HostServiceMigration = {
/**
* `migrated`, `switched`, `cleaned-up`, `rolled-back`, `kept` or
* `not-needed`.
*/
outcome: string,
/**
* In words.
*/
detail: string,
/**
* macOS will ask for Screen Recording and Accessibility for Cua Spaces
* Helper.
*/
permissionsNeeded: boolean
}
/**
* Generated factory for {@link HostServiceMigration} record objects.
*/
export const HostServiceMigration = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<HostServiceMigration, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<HostServiceMigration>,
});
})();
const FfiConverterTypeHostServiceMigration = (() => {
type TypeName = HostServiceMigration;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
outcome: FfiConverterString.read(from),
detail: FfiConverterString.read(from),
permissionsNeeded: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.outcome, into);
FfiConverterString.write(value.detail, into);
FfiConverterBool.write(value.permissionsNeeded, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.outcome) +
FfiConverterString.allocationSize(value.detail) +
FfiConverterBool.allocationSize(value.permissionsNeeded);
}
};
return new FFIConverter();
})();
/**
* A change to this machine's Spaces settings (`None` keeps a value).
*/
export type HostSettingsChange = {
/**
* Share this desktop.
*/
shareDesktop?: boolean,
/**
* Provide Spaces.
*/
provideSpaces?: boolean,
/**
* Provided Spaces at once (0: no limit).
*/
maxSpaces?: number,
/**
* macOS VMs at once (0 to 2, Apple's license).
*/
maxMacosVms?: number
}
/**
* Generated factory for {@link HostSettingsChange} record objects.
*/
export const HostSettingsChange = (() => {
const defaults = () => ({
shareDesktop: undefined,
provideSpaces: undefined,
maxSpaces: undefined,
maxMacosVms: undefined
});
const create = (() => {
return uniffiCreateRecord<HostSettingsChange, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<HostSettingsChange>,
});
})();
const FfiConverterTypeHostSettingsChange = (() => {
type TypeName = HostSettingsChange;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
shareDesktop: FfiConverterOptionalBoolean.read(from),
provideSpaces: FfiConverterOptionalBoolean.read(from),
maxSpaces: FfiConverterOptionalUInt32.read(from),
maxMacosVms: FfiConverterOptionalUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalBoolean.write(value.shareDesktop, into);
FfiConverterOptionalBoolean.write(value.provideSpaces, into);
FfiConverterOptionalUInt32.write(value.maxSpaces, into);
FfiConverterOptionalUInt32.write(value.maxMacosVms, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalBoolean.allocationSize(value.shareDesktop) +
FfiConverterOptionalBoolean.allocationSize(value.provideSpaces) +
FfiConverterOptionalUInt32.allocationSize(value.maxSpaces) +
FfiConverterOptionalUInt32.allocationSize(value.maxMacosVms);
}
};
return new FFIConverter();
})();
/**
* `cua host setup` options.
*/
export type HostSetupOptions = {
/**
* `relay` (default) or `direct`.
*/
mode?: string,
/**
* Relay URL (relay mode; default `CUA_RELAY_URL` / `https://relay.cua.ai`).
*/
relayUrl?: string,
/**
* `ip:port` (direct mode; default `0.0.0.0:3211`).
*/
direct?: string,
/**
* Display name (default: host name).
*/
name?: string,
/**
* Accounts (ids or emails) allowed besides the owner.
*/
allow: Array<string>,
/**
* Driver binary (else `CUA_SPACESD_BIN`, bundled, or download).
*/
driverBin?: string,
/**
* `auto`, `systemd`, `launchd`, `windows-task` or `process`.
*/
runner?: string,
/**
* `desktop` (share this desktop; the default) or `spare` (do not
* share the desktop; provide Spaces). The two settings below override
* it.
*/
profile?: string,
/**
* Share this machine's own desktop as a Space.
*/
shareDesktop?: boolean,
/**
* Create Spaces for your enrolled devices on this machine (relay
* mode). `None`: on for a machine set up for the first time through
* the relay; a machine set up before keeps its setting.
*/
provideSpaces?: boolean
}
/**
* Generated factory for {@link HostSetupOptions} record objects.
*/
export const HostSetupOptions = (() => {
const defaults = () => ({
profile: undefined,
shareDesktop: undefined,
provideSpaces: undefined
});
const create = (() => {
return uniffiCreateRecord<HostSetupOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<HostSetupOptions>,
});
})();
const FfiConverterTypeHostSetupOptions = (() => {
type TypeName = HostSetupOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
mode: FfiConverterOptionalString.read(from),
relayUrl: FfiConverterOptionalString.read(from),
direct: FfiConverterOptionalString.read(from),
name: FfiConverterOptionalString.read(from),
allow: FfiConverterSequenceString.read(from),
driverBin: FfiConverterOptionalString.read(from),
runner: FfiConverterOptionalString.read(from),
profile: FfiConverterOptionalString.read(from),
shareDesktop: FfiConverterOptionalBoolean.read(from),
provideSpaces: FfiConverterOptionalBoolean.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.mode, into);
FfiConverterOptionalString.write(value.relayUrl, into);
FfiConverterOptionalString.write(value.direct, into);
FfiConverterOptionalString.write(value.name, into);
FfiConverterSequenceString.write(value.allow, into);
FfiConverterOptionalString.write(value.driverBin, into);
FfiConverterOptionalString.write(value.runner, into);
FfiConverterOptionalString.write(value.profile, into);
FfiConverterOptionalBoolean.write(value.shareDesktop, into);
FfiConverterOptionalBoolean.write(value.provideSpaces, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.mode) +
FfiConverterOptionalString.allocationSize(value.relayUrl) +
FfiConverterOptionalString.allocationSize(value.direct) +
FfiConverterOptionalString.allocationSize(value.name) +
FfiConverterSequenceString.allocationSize(value.allow) +
FfiConverterOptionalString.allocationSize(value.driverBin) +
FfiConverterOptionalString.allocationSize(value.runner) +
FfiConverterOptionalString.allocationSize(value.profile) +
FfiConverterOptionalBoolean.allocationSize(value.shareDesktop) +
FfiConverterOptionalBoolean.allocationSize(value.provideSpaces);
}
};
return new FFIConverter();
})();
/**
* One line of this machine's Spaces audit (remote creates, deletes,
* refusals and settings changes).
*/
export type HostSpacesAuditRecord = {
/**
* Epoch ms.
*/
atMs: bigint,
/**
* `create`, `delete`, `refused`, `failed` or `config`.
*/
action: string,
/**
* Who (an account, or `local`).
*/
who: string,
/**
* The relay machine or Space.
*/
space: string,
/**
* Detail.
*/
detail: string
}
/**
* Generated factory for {@link HostSpacesAuditRecord} record objects.
*/
export const HostSpacesAuditRecord = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<HostSpacesAuditRecord, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<HostSpacesAuditRecord>,
});
})();
const FfiConverterTypeHostSpacesAuditRecord = (() => {
type TypeName = HostSpacesAuditRecord;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
atMs: FfiConverterInt64.read(from),
action: FfiConverterString.read(from),
who: FfiConverterString.read(from),
space: FfiConverterString.read(from),
detail: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterInt64.write(value.atMs, into);
FfiConverterString.write(value.action, into);
FfiConverterString.write(value.who, into);
FfiConverterString.write(value.space, into);
FfiConverterString.write(value.detail, into);
}
allocationSize(value: TypeName): number {
return FfiConverterInt64.allocationSize(value.atMs) +
FfiConverterString.allocationSize(value.action) +
FfiConverterString.allocationSize(value.who) +
FfiConverterString.allocationSize(value.space) +
FfiConverterString.allocationSize(value.detail);
}
};
return new FFIConverter();
})();
/**
* Host status.
*/
export type HostStatus = {
/**
* Set up.
*/
configured: boolean,
/**
* `relay` or `direct`.
*/
mode?: string,
/**
* Relay URL.
*/
relayUrl?: string,
/**
* Direct URL.
*/
directUrl?: string,
/**
* Env token file (direct mode).
*/
envTokenPath?: string,
/**
* Machine id.
*/
machineId?: string,
/**
* Name.
*/
name?: string,
/**
* Accepting clients.
*/
sharing: boolean,
/**
* Service installed.
*/
serviceInstalled: boolean,
/**
* Service running.
*/
serviceRunning: boolean,
/**
* Runner kind.
*/
serviceKind: string,
/**
* Online at the relay.
*/
online?: boolean,
/**
* Connected clients.
*/
clients: Array<RelayClientInfo>,
/**
* Allowlist.
*/
allow: Array<string>,
/**
* Permission panes (macOS).
*/
permissions: Array<HostPermission>,
/**
* Relay error.
*/
error?: string,
/**
* Who reached this machine recently, newest first (the driver's
* hash-chained access log).
*/
recentAccess: Array<HostAccessRecord>,
/**
* Set when the access log does not verify (edited or truncated).
*/
accessLogError?: string,
/**
* This machine's desktop is a Space.
*/
shareDesktop: boolean,
/**
* This machine provides Spaces to your other devices.
*/
provideSpaces: boolean,
/**
* Provided Spaces at once (0: no limit).
*/
maxSpaces: number,
/**
* macOS VMs at once (at most two).
*/
maxMacosVms: number,
/**
* The Spaces this machine provides now.
*/
providedSpaces: Array<HostProvidedSpace>,
/**
* The Spaces audit, newest first.
*/
spacesAudit: Array<HostSpacesAuditRecord>,
/**
* Set when the Spaces audit does not verify.
*/
spacesAuditError?: string,
/**
* Relay sharing is paused until the owner signs in again
* ([`Host::pause_signed_out`]).
*/
pausedSignedOut: boolean,
/**
* The account this machine is registered to (relay mode): its id.
*/
owner?: string,
/**
* The owner's email, when the relay gave one.
*/
ownerEmail?: string,
/**
* macOS: a Cua Spaces app that can run the host service is
* installed, so the host service can run as it.
*/
helperAvailable: boolean,
/**
* macOS: the old hand-written LaunchAgent is still there.
*/
legacyService: boolean
}
/**
* Generated factory for {@link HostStatus} record objects.
*/
export const HostStatus = (() => {
const defaults = () => ({
recentAccess: [],
accessLogError: undefined,
shareDesktop: true,
provideSpaces: false,
maxSpaces: 0,
maxMacosVms: 0,
providedSpaces: [],
spacesAudit: [],
spacesAuditError: undefined,
pausedSignedOut: false,
owner: undefined,
ownerEmail: undefined,
helperAvailable: false,
legacyService: false
});
const create = (() => {
return uniffiCreateRecord<HostStatus, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<HostStatus>,
});
})();
const FfiConverterTypeHostStatus = (() => {
type TypeName = HostStatus;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
configured: FfiConverterBool.read(from),
mode: FfiConverterOptionalString.read(from),
relayUrl: FfiConverterOptionalString.read(from),
directUrl: FfiConverterOptionalString.read(from),
envTokenPath: FfiConverterOptionalString.read(from),
machineId: FfiConverterOptionalString.read(from),
name: FfiConverterOptionalString.read(from),
sharing: FfiConverterBool.read(from),
serviceInstalled: FfiConverterBool.read(from),
serviceRunning: FfiConverterBool.read(from),
serviceKind: FfiConverterString.read(from),
online: FfiConverterOptionalBoolean.read(from),
clients: FfiConverterSequenceTypeRelayClientInfo.read(from),
allow: FfiConverterSequenceString.read(from),
permissions: FfiConverterSequenceTypeHostPermission.read(from),
error: FfiConverterOptionalString.read(from),
recentAccess: FfiConverterSequenceTypeHostAccessRecord.read(from),
accessLogError: FfiConverterOptionalString.read(from),
shareDesktop: FfiConverterBool.read(from),
provideSpaces: FfiConverterBool.read(from),
maxSpaces: FfiConverterUInt32.read(from),
maxMacosVms: FfiConverterUInt32.read(from),
providedSpaces: FfiConverterSequenceTypeHostProvidedSpace.read(from),
spacesAudit: FfiConverterSequenceTypeHostSpacesAuditRecord.read(from),
spacesAuditError: FfiConverterOptionalString.read(from),
pausedSignedOut: FfiConverterBool.read(from),
owner: FfiConverterOptionalString.read(from),
ownerEmail: FfiConverterOptionalString.read(from),
helperAvailable: FfiConverterBool.read(from),
legacyService: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterBool.write(value.configured, into);
FfiConverterOptionalString.write(value.mode, into);
FfiConverterOptionalString.write(value.relayUrl, into);
FfiConverterOptionalString.write(value.directUrl, into);
FfiConverterOptionalString.write(value.envTokenPath, into);
FfiConverterOptionalString.write(value.machineId, into);
FfiConverterOptionalString.write(value.name, into);
FfiConverterBool.write(value.sharing, into);
FfiConverterBool.write(value.serviceInstalled, into);
FfiConverterBool.write(value.serviceRunning, into);
FfiConverterString.write(value.serviceKind, into);
FfiConverterOptionalBoolean.write(value.online, into);
FfiConverterSequenceTypeRelayClientInfo.write(value.clients, into);
FfiConverterSequenceString.write(value.allow, into);
FfiConverterSequenceTypeHostPermission.write(value.permissions, into);
FfiConverterOptionalString.write(value.error, into);
FfiConverterSequenceTypeHostAccessRecord.write(value.recentAccess, into);
FfiConverterOptionalString.write(value.accessLogError, into);
FfiConverterBool.write(value.shareDesktop, into);
FfiConverterBool.write(value.provideSpaces, into);
FfiConverterUInt32.write(value.maxSpaces, into);
FfiConverterUInt32.write(value.maxMacosVms, into);
FfiConverterSequenceTypeHostProvidedSpace.write(value.providedSpaces, into);
FfiConverterSequenceTypeHostSpacesAuditRecord.write(value.spacesAudit, into);
FfiConverterOptionalString.write(value.spacesAuditError, into);
FfiConverterBool.write(value.pausedSignedOut, into);
FfiConverterOptionalString.write(value.owner, into);
FfiConverterOptionalString.write(value.ownerEmail, into);
FfiConverterBool.write(value.helperAvailable, into);
FfiConverterBool.write(value.legacyService, into);
}
allocationSize(value: TypeName): number {
return FfiConverterBool.allocationSize(value.configured) +
FfiConverterOptionalString.allocationSize(value.mode) +
FfiConverterOptionalString.allocationSize(value.relayUrl) +
FfiConverterOptionalString.allocationSize(value.directUrl) +
FfiConverterOptionalString.allocationSize(value.envTokenPath) +
FfiConverterOptionalString.allocationSize(value.machineId) +
FfiConverterOptionalString.allocationSize(value.name) +
FfiConverterBool.allocationSize(value.sharing) +
FfiConverterBool.allocationSize(value.serviceInstalled) +
FfiConverterBool.allocationSize(value.serviceRunning) +
FfiConverterString.allocationSize(value.serviceKind) +
FfiConverterOptionalBoolean.allocationSize(value.online) +
FfiConverterSequenceTypeRelayClientInfo.allocationSize(value.clients) +
FfiConverterSequenceString.allocationSize(value.allow) +
FfiConverterSequenceTypeHostPermission.allocationSize(value.permissions) +
FfiConverterOptionalString.allocationSize(value.error) +
FfiConverterSequenceTypeHostAccessRecord.allocationSize(value.recentAccess) +
FfiConverterOptionalString.allocationSize(value.accessLogError) +
FfiConverterBool.allocationSize(value.shareDesktop) +
FfiConverterBool.allocationSize(value.provideSpaces) +
FfiConverterUInt32.allocationSize(value.maxSpaces) +
FfiConverterUInt32.allocationSize(value.maxMacosVms) +
FfiConverterSequenceTypeHostProvidedSpace.allocationSize(value.providedSpaces) +
FfiConverterSequenceTypeHostSpacesAuditRecord.allocationSize(value.spacesAudit) +
FfiConverterOptionalString.allocationSize(value.spacesAuditError) +
FfiConverterBool.allocationSize(value.pausedSignedOut) +
FfiConverterOptionalString.allocationSize(value.owner) +
FfiConverterOptionalString.allocationSize(value.ownerEmail) +
FfiConverterBool.allocationSize(value.helperAvailable) +
FfiConverterBool.allocationSize(value.legacyService);
}
};
return new FFIConverter();
})();
/**
* An HTTP header.
*/
export type HttpHeader = {
/**
* Name.
*/
name: string,
/**
* Value.
*/
value: string
}
/**
* Generated factory for {@link HttpHeader} record objects.
*/
export const HttpHeader = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<HttpHeader, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<HttpHeader>,
});
})();
const FfiConverterTypeHttpHeader = (() => {
type TypeName = HttpHeader;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
value: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.value, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.value);
}
};
return new FFIConverter();
})();
/**
* An HTTP response from a sandbox service.
*/
export type HttpResponse = {
/**
* Status.
*/
status: number,
/**
* Headers.
*/
headers: Array<HttpHeader>,
/**
* Body.
*/
body: ArrayBuffer
}
/**
* Generated factory for {@link HttpResponse} record objects.
*/
export const HttpResponse = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<HttpResponse, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<HttpResponse>,
});
})();
const FfiConverterTypeHttpResponse = (() => {
type TypeName = HttpResponse;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
status: FfiConverterUInt16.read(from),
headers: FfiConverterSequenceTypeHttpHeader.read(from),
body: FfiConverterArrayBuffer.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt16.write(value.status, into);
FfiConverterSequenceTypeHttpHeader.write(value.headers, into);
FfiConverterArrayBuffer.write(value.body, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt16.allocationSize(value.status) +
FfiConverterSequenceTypeHttpHeader.allocationSize(value.headers) +
FfiConverterArrayBuffer.allocationSize(value.body);
}
};
return new FFIConverter();
})();
// Enum: ImageLayer
export enum ImageLayer_Tags {
AptInstall = "AptInstall",
PipInstall = "PipInstall",
UvInstall = "UvInstall",
Run = "Run",
AppInstall = "AppInstall"
}
/**
* One image build step (as in `images.cua.ai/v1alpha1` recipes).
*/
export const ImageLayer = (() => {
type AptInstall__interface = {
tag: ImageLayer_Tags.AptInstall;
inner:
Readonly<{packages: Array<string>}>
};
/**
* `apt-get install`.
*/
class AptInstall_ extends UniffiEnum implements AptInstall__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ImageLayer";
readonly tag = ImageLayer_Tags.AptInstall;
readonly inner:
Readonly<{packages: Array<string>}>;
constructor(
inner: {packages: Array<string> }) {
super("ImageLayer", "AptInstall");
this.inner = Object.freeze(inner);
}
static new(
inner: {packages: Array<string> }): AptInstall_ {
return new AptInstall_(inner);
}
static instanceOf(obj: any): obj is AptInstall_ {
return obj.tag === ImageLayer_Tags.AptInstall;
}
}
type PipInstall__interface = {
tag: ImageLayer_Tags.PipInstall;
inner:
Readonly<{packages: Array<string>}>
};
/**
* `pip install`.
*/
class PipInstall_ extends UniffiEnum implements PipInstall__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ImageLayer";
readonly tag = ImageLayer_Tags.PipInstall;
readonly inner:
Readonly<{packages: Array<string>}>;
constructor(
inner: {packages: Array<string> }) {
super("ImageLayer", "PipInstall");
this.inner = Object.freeze(inner);
}
static new(
inner: {packages: Array<string> }): PipInstall_ {
return new PipInstall_(inner);
}
static instanceOf(obj: any): obj is PipInstall_ {
return obj.tag === ImageLayer_Tags.PipInstall;
}
}
type UvInstall__interface = {
tag: ImageLayer_Tags.UvInstall;
inner:
Readonly<{packages: Array<string>}>
};
/**
* `uv pip install`.
*/
class UvInstall_ extends UniffiEnum implements UvInstall__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ImageLayer";
readonly tag = ImageLayer_Tags.UvInstall;
readonly inner:
Readonly<{packages: Array<string>}>;
constructor(
inner: {packages: Array<string> }) {
super("ImageLayer", "UvInstall");
this.inner = Object.freeze(inner);
}
static new(
inner: {packages: Array<string> }): UvInstall_ {
return new UvInstall_(inner);
}
static instanceOf(obj: any): obj is UvInstall_ {
return obj.tag === ImageLayer_Tags.UvInstall;
}
}
type Run__interface = {
tag: ImageLayer_Tags.Run;
inner:
Readonly<{command: string}>
};
/**
* A shell command.
*/
class Run_ extends UniffiEnum implements Run__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ImageLayer";
readonly tag = ImageLayer_Tags.Run;
readonly inner:
Readonly<{command: string}>;
constructor(
inner: {command: string }) {
super("ImageLayer", "Run");
this.inner = Object.freeze(inner);
}
static new(
inner: {command: string }): Run_ {
return new Run_(inner);
}
static instanceOf(obj: any): obj is Run_ {
return obj.tag === ImageLayer_Tags.Run;
}
}
type AppInstall__interface = {
tag: ImageLayer_Tags.AppInstall;
inner:
Readonly<{appId: string}>
};
/**
* An app from the cua catalog (VM images only).
*/
class AppInstall_ extends UniffiEnum implements AppInstall__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ImageLayer";
readonly tag = ImageLayer_Tags.AppInstall;
readonly inner:
Readonly<{appId: string}>;
constructor(
inner: {appId: string }) {
super("ImageLayer", "AppInstall");
this.inner = Object.freeze(inner);
}
static new(
inner: {appId: string }): AppInstall_ {
return new AppInstall_(inner);
}
static instanceOf(obj: any): obj is AppInstall_ {
return obj.tag === ImageLayer_Tags.AppInstall;
}
}
function instanceOf(obj: any): obj is ImageLayer {
return obj[uniffiTypeNameSymbol] === "ImageLayer";
}
return Object.freeze({
instanceOf,
AptInstall: AptInstall_,
PipInstall: PipInstall_,
UvInstall: UvInstall_,
Run: Run_,
AppInstall: AppInstall_
});
})();
/**
* One image build step (as in `images.cua.ai/v1alpha1` recipes).
*/
export type ImageLayer = InstanceType<
typeof ImageLayer['AptInstall' | 'PipInstall' | 'UvInstall' | 'Run' | 'AppInstall']
>;
// FfiConverter for enum ImageLayer
const FfiConverterTypeImageLayer = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = ImageLayer;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return new ImageLayer.AptInstall({packages: FfiConverterSequenceString.read(from) });
case 2: return new ImageLayer.PipInstall({packages: FfiConverterSequenceString.read(from) });
case 3: return new ImageLayer.UvInstall({packages: FfiConverterSequenceString.read(from) });
case 4: return new ImageLayer.Run({command: FfiConverterString.read(from) });
case 5: return new ImageLayer.AppInstall({appId: FfiConverterString.read(from) });
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value.tag) {
case ImageLayer_Tags.AptInstall: {
ordinalConverter.write(1, into);
const inner = value.inner;
FfiConverterSequenceString.write(inner.packages, into);
return;
}
case ImageLayer_Tags.PipInstall: {
ordinalConverter.write(2, into);
const inner = value.inner;
FfiConverterSequenceString.write(inner.packages, into);
return;
}
case ImageLayer_Tags.UvInstall: {
ordinalConverter.write(3, into);
const inner = value.inner;
FfiConverterSequenceString.write(inner.packages, into);
return;
}
case ImageLayer_Tags.Run: {
ordinalConverter.write(4, into);
const inner = value.inner;
FfiConverterString.write(inner.command, into);
return;
}
case ImageLayer_Tags.AppInstall: {
ordinalConverter.write(5, into);
const inner = value.inner;
FfiConverterString.write(inner.appId, into);
return;
}
default:
// Throwing from here means that ImageLayer_Tags hasn't matched an ordinal.
throw new UniffiInternalError.UnexpectedEnumCase();
}
}
allocationSize(value: TypeName): number {
switch (value.tag) {
case ImageLayer_Tags.AptInstall: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(1);
size += FfiConverterSequenceString.allocationSize(inner.packages);
return size;
}
case ImageLayer_Tags.PipInstall: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(2);
size += FfiConverterSequenceString.allocationSize(inner.packages);
return size;
}
case ImageLayer_Tags.UvInstall: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(3);
size += FfiConverterSequenceString.allocationSize(inner.packages);
return size;
}
case ImageLayer_Tags.Run: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(4);
size += FfiConverterString.allocationSize(inner.command);
return size;
}
case ImageLayer_Tags.AppInstall: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(5);
size += FfiConverterString.allocationSize(inner.appId);
return size;
}
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
}
return new FFIConverter();
})();
/**
* Image layers built on top of a sandbox's image. Local: a build into the
* container engine (container images only; VM images take no layers here),
* cached by a content hash (`cua-b-<hash>`), so an identical spec never
* rebuilds.
*/
export type ImageBuild = {
/**
* Steps, in order.
*/
layers: Array<ImageLayer>,
/**
* Image environment.
*/
env: Map<string, string>,
/**
* Ports the image exposes.
*/
ports: Array<number>,
/**
* Local files copied in.
*/
files: Array<BuildFile>,
/**
* Build budget (default one hour).
*/
timeoutMs?: number
}
/**
* Generated factory for {@link ImageBuild} record objects.
*/
export const ImageBuild = (() => {
const defaults = () => ({
layers: [],
env: new Map(),
ports: [],
files: [],
timeoutMs: undefined
});
const create = (() => {
return uniffiCreateRecord<ImageBuild, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ImageBuild>,
});
})();
const FfiConverterTypeImageBuild = (() => {
type TypeName = ImageBuild;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
layers: FfiConverterSequenceTypeImageLayer.read(from),
env: FfiConverterMapStringString.read(from),
ports: FfiConverterSequenceUInt16.read(from),
files: FfiConverterSequenceTypeBuildFile.read(from),
timeoutMs: FfiConverterOptionalUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterSequenceTypeImageLayer.write(value.layers, into);
FfiConverterMapStringString.write(value.env, into);
FfiConverterSequenceUInt16.write(value.ports, into);
FfiConverterSequenceTypeBuildFile.write(value.files, into);
FfiConverterOptionalUInt32.write(value.timeoutMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceTypeImageLayer.allocationSize(value.layers) +
FfiConverterMapStringString.allocationSize(value.env) +
FfiConverterSequenceUInt16.allocationSize(value.ports) +
FfiConverterSequenceTypeBuildFile.allocationSize(value.files) +
FfiConverterOptionalUInt32.allocationSize(value.timeoutMs);
}
};
return new FFIConverter();
})();
/**
* The image a sandbox runs, as resolved and pinned at create time.
*/
export type ImageInfo = {
/**
* The reference as requested, normalised
* (`docker.io/library/python:3.12-slim`).
*/
reference: string,
/**
* `registry/repo@sha256:...` of the variant that runs.
*/
pinnedRef: string,
/**
* The digest in `pinned_ref`.
*/
digest: string,
/**
* `rootfs`, `containerdisk` or `lume`.
*/
variant: string,
/**
* Architecture that runs (`amd64`/`arm64`), when known.
*/
arch?: string,
/**
* Guest OS: `linux`, `windows` or `macos`.
*/
os: string,
/**
* Whether it runs emulated (no build for the requested architecture).
*/
emulated: boolean,
/**
* Whether the image carries cua-spacesd (`ai.cua.spacesd` label or a
* published 3211); `None` when it does not say.
*/
spacesd?: boolean
}
/**
* Generated factory for {@link ImageInfo} record objects.
*/
export const ImageInfo = (() => {
const defaults = () => ({
spacesd: undefined
});
const create = (() => {
return uniffiCreateRecord<ImageInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ImageInfo>,
});
})();
const FfiConverterTypeImageInfo = (() => {
type TypeName = ImageInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
reference: FfiConverterString.read(from),
pinnedRef: FfiConverterString.read(from),
digest: FfiConverterString.read(from),
variant: FfiConverterString.read(from),
arch: FfiConverterOptionalString.read(from),
os: FfiConverterString.read(from),
emulated: FfiConverterBool.read(from),
spacesd: FfiConverterOptionalBoolean.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.reference, into);
FfiConverterString.write(value.pinnedRef, into);
FfiConverterString.write(value.digest, into);
FfiConverterString.write(value.variant, into);
FfiConverterOptionalString.write(value.arch, into);
FfiConverterString.write(value.os, into);
FfiConverterBool.write(value.emulated, into);
FfiConverterOptionalBoolean.write(value.spacesd, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.reference) +
FfiConverterString.allocationSize(value.pinnedRef) +
FfiConverterString.allocationSize(value.digest) +
FfiConverterString.allocationSize(value.variant) +
FfiConverterOptionalString.allocationSize(value.arch) +
FfiConverterString.allocationSize(value.os) +
FfiConverterBool.allocationSize(value.emulated) +
FfiConverterOptionalBoolean.allocationSize(value.spacesd);
}
};
return new FFIConverter();
})();
/**
* A local image.
*/
export type LocalImage = {
/**
* Reference.
*/
reference: string,
/**
* `container` or `vm`.
*/
kind: string,
/**
* Disk path (VM) or engine image reference (container).
*/
location: string,
/**
* Size in bytes, when known.
*/
sizeBytes: bigint
}
/**
* Generated factory for {@link LocalImage} record objects.
*/
export const LocalImage = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<LocalImage, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<LocalImage>,
});
})();
const FfiConverterTypeLocalImage = (() => {
type TypeName = LocalImage;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
reference: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
location: FfiConverterString.read(from),
sizeBytes: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.reference, into);
FfiConverterString.write(value.kind, into);
FfiConverterString.write(value.location, into);
FfiConverterUInt64.write(value.sizeBytes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.reference) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterString.allocationSize(value.location) +
FfiConverterUInt64.allocationSize(value.sizeBytes);
}
};
return new FFIConverter();
})();
/**
* Space on the volume a local engine writes to.
*/
export type StorageVolume = {
/**
* Bytes available to this user.
*/
availableBytes: bigint,
/**
* Volume size in bytes.
*/
totalBytes: bigint,
/**
* What a person calls it: `Macintosh HD`, `Colima`, `Docker Desktop`.
*/
name: string
}
/**
* Generated factory for {@link StorageVolume} record objects.
*/
export const StorageVolume = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<StorageVolume, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<StorageVolume>,
});
})();
const FfiConverterTypeStorageVolume = (() => {
type TypeName = StorageVolume;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
availableBytes: FfiConverterUInt64.read(from),
totalBytes: FfiConverterUInt64.read(from),
name: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt64.write(value.availableBytes, into);
FfiConverterUInt64.write(value.totalBytes, into);
FfiConverterString.write(value.name, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.availableBytes) +
FfiConverterUInt64.allocationSize(value.totalBytes) +
FfiConverterString.allocationSize(value.name);
}
};
return new FFIConverter();
})();
/**
* What local Spaces have room for (see [`Local::storage`]).
*/
export type LocalStorage = {
/**
* This host's architecture (`arm64`, `amd64`).
*/
hostArch: string,
/**
* Bytes cua keeps free on a volume: a create that would leave less
* fails (`CUA_DISK_MIN_FREE`, default 5 GiB).
*/
reserveBytes: bigint,
/**
* Where Lume writes macOS VMs.
*/
lume?: StorageVolume,
/**
* Where QEMU writes VM disks and the containerDisk cache.
*/
qemu?: StorageVolume,
/**
* The container engine's data disk (Colima, Docker Desktop, OrbStack,
* `/var/lib/docker`), when its free space can be read.
*/
container?: StorageVolume,
/**
* Catalog image refs already pulled here at their published digest.
*/
pulled: Array<string>,
linuxRuntimeDownloadBytes: bigint
}
/**
* Generated factory for {@link LocalStorage} record objects.
*/
export const LocalStorage = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<LocalStorage, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<LocalStorage>,
});
})();
const FfiConverterTypeLocalStorage = (() => {
type TypeName = LocalStorage;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
hostArch: FfiConverterString.read(from),
reserveBytes: FfiConverterUInt64.read(from),
lume: FfiConverterOptionalTypeStorageVolume.read(from),
qemu: FfiConverterOptionalTypeStorageVolume.read(from),
container: FfiConverterOptionalTypeStorageVolume.read(from),
pulled: FfiConverterSequenceString.read(from),
linuxRuntimeDownloadBytes: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.hostArch, into);
FfiConverterUInt64.write(value.reserveBytes, into);
FfiConverterOptionalTypeStorageVolume.write(value.lume, into);
FfiConverterOptionalTypeStorageVolume.write(value.qemu, into);
FfiConverterOptionalTypeStorageVolume.write(value.container, into);
FfiConverterSequenceString.write(value.pulled, into);
FfiConverterUInt64.write(value.linuxRuntimeDownloadBytes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.hostArch) +
FfiConverterUInt64.allocationSize(value.reserveBytes) +
FfiConverterOptionalTypeStorageVolume.allocationSize(value.lume) +
FfiConverterOptionalTypeStorageVolume.allocationSize(value.qemu) +
FfiConverterOptionalTypeStorageVolume.allocationSize(value.container) +
FfiConverterSequenceString.allocationSize(value.pulled) +
FfiConverterUInt64.allocationSize(value.linuxRuntimeDownloadBytes);
}
};
return new FFIConverter();
})();
/**
* The locations `on` accepts: `local`, then registered providers.
*/
export type LocationInfo = {
/**
* The location's name.
*/
name: string,
/**
* One line about it.
*/
description: string,
/**
* The kinds it runs (`container`, `vm`).
*/
kinds: Array<string>,
/**
* Its runtimes, in `auto` preference order, per kind
* (`container: gvisor, runc`).
*/
runtimes: Map<string, Array<string>>
}
/**
* Generated factory for {@link LocationInfo} record objects.
*/
export const LocationInfo = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<LocationInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<LocationInfo>,
});
})();
const FfiConverterTypeLocationInfo = (() => {
type TypeName = LocationInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
description: FfiConverterString.read(from),
kinds: FfiConverterSequenceString.read(from),
runtimes: FfiConverterMapStringSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.description, into);
FfiConverterSequenceString.write(value.kinds, into);
FfiConverterMapStringSequenceString.write(value.runtimes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.description) +
FfiConverterSequenceString.allocationSize(value.kinds) +
FfiConverterMapStringSequenceString.allocationSize(value.runtimes);
}
};
return new FFIConverter();
})();
/**
* One check of a machine's health ([`Spaces::machine_health`]).
*/
export type MachineHealthCheck = {
/**
* `machine.local_network`, `machine.disk`, `machine.virtualization`,
* `machine.memory`, `machine.permissions.<id>`.
*/
id: string,
/**
* `pass`, `warn`, `fail` or `skip`.
*/
status: string,
/**
* What it found, in one line.
*/
message: string,
/**
* What to do about a warning or failure.
*/
remediation: string,
/**
* What a UI needs to word it and offer its fix (`app`, `settings_url`,
* `free_gb`, ...).
*/
facts: Map<string, string>
}
/**
* Generated factory for {@link MachineHealthCheck} record objects.
*/
export const MachineHealthCheck = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<MachineHealthCheck, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<MachineHealthCheck>,
});
})();
const FfiConverterTypeMachineHealthCheck = (() => {
type TypeName = MachineHealthCheck;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
status: FfiConverterString.read(from),
message: FfiConverterString.read(from),
remediation: FfiConverterString.read(from),
facts: FfiConverterMapStringString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.status, into);
FfiConverterString.write(value.message, into);
FfiConverterString.write(value.remediation, into);
FfiConverterMapStringString.write(value.facts, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.status) +
FfiConverterString.allocationSize(value.message) +
FfiConverterString.allocationSize(value.remediation) +
FfiConverterMapStringString.allocationSize(value.facts);
}
};
return new FFIConverter();
})();
/**
* A machine's health as its own cua daemon checks it.
*/
export type MachineHealth = {
/**
* The Cua version of the daemon that checked.
*/
cuaVersion: string,
/**
* `macos`, `linux`, `windows`.
*/
os: string,
/**
* Every check, in order.
*/
checks: Array<MachineHealthCheck>,
/**
* The whole report as JSON (the schema `cua doctor --json` writes).
*/
reportJson: string
}
/**
* Generated factory for {@link MachineHealth} record objects.
*/
export const MachineHealth = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<MachineHealth, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<MachineHealth>,
});
})();
const FfiConverterTypeMachineHealth = (() => {
type TypeName = MachineHealth;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
cuaVersion: FfiConverterString.read(from),
os: FfiConverterString.read(from),
checks: FfiConverterSequenceTypeMachineHealthCheck.read(from),
reportJson: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.cuaVersion, into);
FfiConverterString.write(value.os, into);
FfiConverterSequenceTypeMachineHealthCheck.write(value.checks, into);
FfiConverterString.write(value.reportJson, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.cuaVersion) +
FfiConverterString.allocationSize(value.os) +
FfiConverterSequenceTypeMachineHealthCheck.allocationSize(value.checks) +
FfiConverterString.allocationSize(value.reportJson);
}
};
return new FFIConverter();
})();
/**
* Where an MCP endpoint is and what every request needs. Hand it to any
* MCP client (Claude Code, Cursor, the Python or TypeScript SDKs). A
* provider's headers may be short-lived: fetch a fresh config per
* connection.
*/
export type McpConfig = {
/**
* Streamable-HTTP endpoint URL.
*/
url: string,
/**
* Headers to send with every request.
*/
headers: Array<HttpHeader>
}
/**
* Generated factory for {@link McpConfig} record objects.
*/
export const McpConfig = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<McpConfig, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<McpConfig>,
});
})();
const FfiConverterTypeMcpConfig = (() => {
type TypeName = McpConfig;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
url: FfiConverterString.read(from),
headers: FfiConverterSequenceTypeHttpHeader.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.url, into);
FfiConverterSequenceTypeHttpHeader.write(value.headers, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.url) +
FfiConverterSequenceTypeHttpHeader.allocationSize(value.headers);
}
};
return new FFIConverter();
})();
/**
* A media bridge for webviews (daemon mode).
*/
export type MediaBridge = {
/**
* Loopback `ws://` URL carrying a short-lived bridge ticket. Speaks
* rcdp wire v2 unchanged; no env token is exposed.
*/
wsUrl: string,
/**
* The bridge ticket (also accepted as subprotocol
* `cua.ticket.<ticket>`).
*/
ticket: string,
/**
* `cua.env.v1.OpenMediaResponse` as proto3 JSON (upstream ticket
* removed).
*/
openMediaResponseJson: string
}
/**
* Generated factory for {@link MediaBridge} record objects.
*/
export const MediaBridge = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<MediaBridge, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<MediaBridge>,
});
})();
const FfiConverterTypeMediaBridge = (() => {
type TypeName = MediaBridge;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
wsUrl: FfiConverterString.read(from),
ticket: FfiConverterString.read(from),
openMediaResponseJson: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.wsUrl, into);
FfiConverterString.write(value.ticket, into);
FfiConverterString.write(value.openMediaResponseJson, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.wsUrl) +
FfiConverterString.allocationSize(value.ticket) +
FfiConverterString.allocationSize(value.openMediaResponseJson);
}
};
return new FFIConverter();
})();
/**
* A control message (`hello`, `session_opened`, `lifecycle`,
* `audio_config`, `stats`, `error`, ...) or the close of the socket
* (`kind = "closed"`, `json = {"code":…, "reason":…}`).
*/
export type MediaEvent = {
/**
* The message `type`.
*/
kind: string,
/**
* The whole message as JSON.
*/
json: string
}
/**
* Generated factory for {@link MediaEvent} record objects.
*/
export const MediaEvent = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<MediaEvent, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<MediaEvent>,
});
})();
const FfiConverterTypeMediaEvent = (() => {
type TypeName = MediaEvent;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
kind: FfiConverterString.read(from),
json: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.kind, into);
FfiConverterString.write(value.json, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.kind) +
FfiConverterString.allocationSize(value.json);
}
};
return new FFIConverter();
})();
/**
* Media session options.
*/
export type MediaOpenOptions = {
/**
* Display id (primary when unset). Ignored when `window_handle` is set.
*/
display?: string,
/**
* Window handle (from `ListTargets` / `ListWindows`).
*/
windowHandle?: string,
/**
* FPS cap (0 = driver default).
*/
maxFps: number,
/**
* Long-edge cap (0 = native).
*/
maxDimension: number,
/**
* Also negotiate desktop/app audio (Opus).
*/
audio: boolean,
/**
* Audio only.
*/
disableVideo: boolean,
/**
* Extra `OpenMediaRequest` fields as proto3 JSON, merged over the
* above (escape hatch).
*/
requestJson?: string
}
/**
* Generated factory for {@link MediaOpenOptions} record objects.
*/
export const MediaOpenOptions = (() => {
const defaults = () => ({
display: undefined,
windowHandle: undefined,
maxFps: 0,
maxDimension: 0,
audio: false,
disableVideo: false,
requestJson: undefined
});
const create = (() => {
return uniffiCreateRecord<MediaOpenOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<MediaOpenOptions>,
});
})();
const FfiConverterTypeMediaOpenOptions = (() => {
type TypeName = MediaOpenOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
display: FfiConverterOptionalString.read(from),
windowHandle: FfiConverterOptionalString.read(from),
maxFps: FfiConverterUInt32.read(from),
maxDimension: FfiConverterUInt32.read(from),
audio: FfiConverterBool.read(from),
disableVideo: FfiConverterBool.read(from),
requestJson: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.display, into);
FfiConverterOptionalString.write(value.windowHandle, into);
FfiConverterUInt32.write(value.maxFps, into);
FfiConverterUInt32.write(value.maxDimension, into);
FfiConverterBool.write(value.audio, into);
FfiConverterBool.write(value.disableVideo, into);
FfiConverterOptionalString.write(value.requestJson, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.display) +
FfiConverterOptionalString.allocationSize(value.windowHandle) +
FfiConverterUInt32.allocationSize(value.maxFps) +
FfiConverterUInt32.allocationSize(value.maxDimension) +
FfiConverterBool.allocationSize(value.audio) +
FfiConverterBool.allocationSize(value.disableVideo) +
FfiConverterOptionalString.allocationSize(value.requestJson);
}
};
return new FFIConverter();
})();
/**
* Delivery counters.
*/
export type MediaStats = {
/**
* Video frames delivered.
*/
frames: bigint,
/**
* Video frames dropped because the sink fell behind.
*/
framesDropped: bigint,
/**
* Audio packets delivered.
*/
audioPackets: bigint,
/**
* Malformed binary messages ignored.
*/
malformed: bigint,
/**
* Control events delivered.
*/
events: bigint
}
/**
* Generated factory for {@link MediaStats} record objects.
*/
export const MediaStats = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<MediaStats, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<MediaStats>,
});
})();
const FfiConverterTypeMediaStats = (() => {
type TypeName = MediaStats;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
frames: FfiConverterUInt64.read(from),
framesDropped: FfiConverterUInt64.read(from),
audioPackets: FfiConverterUInt64.read(from),
malformed: FfiConverterUInt64.read(from),
events: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt64.write(value.frames, into);
FfiConverterUInt64.write(value.framesDropped, into);
FfiConverterUInt64.write(value.audioPackets, into);
FfiConverterUInt64.write(value.malformed, into);
FfiConverterUInt64.write(value.events, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.frames) +
FfiConverterUInt64.allocationSize(value.framesDropped) +
FfiConverterUInt64.allocationSize(value.audioPackets) +
FfiConverterUInt64.allocationSize(value.malformed) +
FfiConverterUInt64.allocationSize(value.events);
}
};
return new FFIConverter();
})();
/**
* A named volume of Cua Volume ([`Spaces::volumes`]).
*/
export type NamedVolume = {
/**
* The name.
*/
name: string,
/**
* Ids of the Spaces that mount it.
*/
mountedIn: Array<string>
}
/**
* Generated factory for {@link NamedVolume} record objects.
*/
export const NamedVolume = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<NamedVolume, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<NamedVolume>,
});
})();
const FfiConverterTypeNamedVolume = (() => {
type TypeName = NamedVolume;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
mountedIn: FfiConverterSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterSequenceString.write(value.mountedIn, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterSequenceString.allocationSize(value.mountedIn);
}
};
return new FFIConverter();
})();
/**
* One entry of the notifications feed.
*/
export type NotificationInfo = {
id: string,
atMs: bigint,
agent?: string,
/**
* `turn_ended`, `message`, `approval` or `error`.
*/
kind: string,
title: string,
body: string,
runId?: string,
space?: string,
read: boolean
}
/**
* Generated factory for {@link NotificationInfo} record objects.
*/
export const NotificationInfo = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<NotificationInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<NotificationInfo>,
});
})();
const FfiConverterTypeNotificationInfo = (() => {
type TypeName = NotificationInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
atMs: FfiConverterUInt64.read(from),
agent: FfiConverterOptionalString.read(from),
kind: FfiConverterString.read(from),
title: FfiConverterString.read(from),
body: FfiConverterString.read(from),
runId: FfiConverterOptionalString.read(from),
space: FfiConverterOptionalString.read(from),
read: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterUInt64.write(value.atMs, into);
FfiConverterOptionalString.write(value.agent, into);
FfiConverterString.write(value.kind, into);
FfiConverterString.write(value.title, into);
FfiConverterString.write(value.body, into);
FfiConverterOptionalString.write(value.runId, into);
FfiConverterOptionalString.write(value.space, into);
FfiConverterBool.write(value.read, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterUInt64.allocationSize(value.atMs) +
FfiConverterOptionalString.allocationSize(value.agent) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterString.allocationSize(value.title) +
FfiConverterString.allocationSize(value.body) +
FfiConverterOptionalString.allocationSize(value.runId) +
FfiConverterOptionalString.allocationSize(value.space) +
FfiConverterBool.allocationSize(value.read);
}
};
return new FFIConverter();
})();
/**
* A binary to inject into a sandbox.
*/
export type Overlay = {
/**
* `cua-driver`, `cua-spacesd`, or any name (then `target` is required).
* Letters, digits, `.`, `_`, `-`.
*/
name: string,
/**
* The local file to inject.
*/
path: string,
/**
* Guest path to replace. Default: resolved for `cua-driver` and
* `cua-spacesd`.
*/
target?: string,
/**
* Provenance recorded with it (for example the git sha it was built
* from). Default: the local path.
*/
source?: string
}
/**
* Generated factory for {@link Overlay} record objects.
*/
export const Overlay = (() => {
const defaults = () => ({
target: undefined,
source: undefined
});
const create = (() => {
return uniffiCreateRecord<Overlay, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<Overlay>,
});
})();
const FfiConverterTypeOverlay = (() => {
type TypeName = Overlay;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
path: FfiConverterString.read(from),
target: FfiConverterOptionalString.read(from),
source: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.path, into);
FfiConverterOptionalString.write(value.target, into);
FfiConverterOptionalString.write(value.source, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.path) +
FfiConverterOptionalString.allocationSize(value.target) +
FfiConverterOptionalString.allocationSize(value.source);
}
};
return new FFIConverter();
})();
/**
* What an overlay did.
*/
export type OverlayResult = {
/**
* Overlay name.
*/
name: string,
/**
* Guest path that was replaced.
*/
target: string,
/**
* sha256 (hex) of the injected file (pass it to `cua doctor --expect
* NAME=sha256:<hex>`).
*/
sha256: string,
/**
* sha256 of the file it replaced, empty when there was none.
*/
previousSha256: string,
/**
* Bytes.
*/
size: bigint,
/**
* How the running program was restarted (`supervisor:cua-spacesd`,
* `systemd:cua-spacesd.service`, `stopped:<pids>`), empty when nothing
* ran it.
*/
restarted: string
}
/**
* Generated factory for {@link OverlayResult} record objects.
*/
export const OverlayResult = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<OverlayResult, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<OverlayResult>,
});
})();
const FfiConverterTypeOverlayResult = (() => {
type TypeName = OverlayResult;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
target: FfiConverterString.read(from),
sha256: FfiConverterString.read(from),
previousSha256: FfiConverterString.read(from),
size: FfiConverterUInt64.read(from),
restarted: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.target, into);
FfiConverterString.write(value.sha256, into);
FfiConverterString.write(value.previousSha256, into);
FfiConverterUInt64.write(value.size, into);
FfiConverterString.write(value.restarted, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.target) +
FfiConverterString.allocationSize(value.sha256) +
FfiConverterString.allocationSize(value.previousSha256) +
FfiConverterUInt64.allocationSize(value.size) +
FfiConverterString.allocationSize(value.restarted);
}
};
return new FFIConverter();
})();
/**
* A one-time code that adds a machine to the account ("Add a machine"
* by link or QR code).
*/
export type PairingCode = {
/**
* `pc_…` (to revoke it).
*/
id: string,
/**
* `XXXX-XXXX-XXXX`: only when just made.
*/
code?: string,
/**
* `https://cua.ai/add/<code>` (the link and the QR code): only
* when just made.
*/
url?: string,
/**
* `curl … | sh -s -- --pair <code>` (macOS, Linux): only when just made.
*/
installSh?: string,
/**
* The PowerShell one-liner (Windows): only when just made.
*/
installPowershell?: string,
/**
* `active`, `used`, `revoked` or `expired`.
*/
state: string,
/**
* Team the machine is added for.
*/
team?: string,
/**
* Unix seconds.
*/
createdAt: bigint,
/**
* Unix seconds.
*/
expiresAt: bigint,
/**
* When a machine used it.
*/
usedAt?: bigint,
/**
* The machine it added (relay machine id).
*/
machine?: string
}
/**
* Generated factory for {@link PairingCode} record objects.
*/
export const PairingCode = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<PairingCode, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PairingCode>,
});
})();
const FfiConverterTypePairingCode = (() => {
type TypeName = PairingCode;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
code: FfiConverterOptionalString.read(from),
url: FfiConverterOptionalString.read(from),
installSh: FfiConverterOptionalString.read(from),
installPowershell: FfiConverterOptionalString.read(from),
state: FfiConverterString.read(from),
team: FfiConverterOptionalString.read(from),
createdAt: FfiConverterUInt64.read(from),
expiresAt: FfiConverterUInt64.read(from),
usedAt: FfiConverterOptionalUInt64.read(from),
machine: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterOptionalString.write(value.code, into);
FfiConverterOptionalString.write(value.url, into);
FfiConverterOptionalString.write(value.installSh, into);
FfiConverterOptionalString.write(value.installPowershell, into);
FfiConverterString.write(value.state, into);
FfiConverterOptionalString.write(value.team, into);
FfiConverterUInt64.write(value.createdAt, into);
FfiConverterUInt64.write(value.expiresAt, into);
FfiConverterOptionalUInt64.write(value.usedAt, into);
FfiConverterOptionalString.write(value.machine, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterOptionalString.allocationSize(value.code) +
FfiConverterOptionalString.allocationSize(value.url) +
FfiConverterOptionalString.allocationSize(value.installSh) +
FfiConverterOptionalString.allocationSize(value.installPowershell) +
FfiConverterString.allocationSize(value.state) +
FfiConverterOptionalString.allocationSize(value.team) +
FfiConverterUInt64.allocationSize(value.createdAt) +
FfiConverterUInt64.allocationSize(value.expiresAt) +
FfiConverterOptionalUInt64.allocationSize(value.usedAt) +
FfiConverterOptionalString.allocationSize(value.machine);
}
};
return new FFIConverter();
})();
/**
* A persistent agent: a named harness whose memory (its home in the Cua
* Drive) outlives its runs and its Space.
*/
export type PersistentAgentInfo = {
name: string,
/**
* Harness id.
*/
harness: string,
/**
* The Space it works in.
*/
space: string,
model?: string,
baseUrl?: string,
envFromHost: Array<string>,
paused: boolean,
/**
* `running`, `suspended` (a paused local Space) or `released` (a
* paused cloud Space).
*/
spaceState: string,
/**
* The current run.
*/
runId?: string,
/**
* Unix ms of the last home save.
*/
savedMs: bigint,
createdMs: bigint,
lastError?: string
}
/**
* Generated factory for {@link PersistentAgentInfo} record objects.
*/
export const PersistentAgentInfo = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<PersistentAgentInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PersistentAgentInfo>,
});
})();
const FfiConverterTypePersistentAgentInfo = (() => {
type TypeName = PersistentAgentInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
harness: FfiConverterString.read(from),
space: FfiConverterString.read(from),
model: FfiConverterOptionalString.read(from),
baseUrl: FfiConverterOptionalString.read(from),
envFromHost: FfiConverterSequenceString.read(from),
paused: FfiConverterBool.read(from),
spaceState: FfiConverterString.read(from),
runId: FfiConverterOptionalString.read(from),
savedMs: FfiConverterUInt64.read(from),
createdMs: FfiConverterUInt64.read(from),
lastError: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.harness, into);
FfiConverterString.write(value.space, into);
FfiConverterOptionalString.write(value.model, into);
FfiConverterOptionalString.write(value.baseUrl, into);
FfiConverterSequenceString.write(value.envFromHost, into);
FfiConverterBool.write(value.paused, into);
FfiConverterString.write(value.spaceState, into);
FfiConverterOptionalString.write(value.runId, into);
FfiConverterUInt64.write(value.savedMs, into);
FfiConverterUInt64.write(value.createdMs, into);
FfiConverterOptionalString.write(value.lastError, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.harness) +
FfiConverterString.allocationSize(value.space) +
FfiConverterOptionalString.allocationSize(value.model) +
FfiConverterOptionalString.allocationSize(value.baseUrl) +
FfiConverterSequenceString.allocationSize(value.envFromHost) +
FfiConverterBool.allocationSize(value.paused) +
FfiConverterString.allocationSize(value.spaceState) +
FfiConverterOptionalString.allocationSize(value.runId) +
FfiConverterUInt64.allocationSize(value.savedMs) +
FfiConverterUInt64.allocationSize(value.createdMs) +
FfiConverterOptionalString.allocationSize(value.lastError);
}
};
return new FFIConverter();
})();
/**
* How to create a persistent agent.
*/
export type PersistentAgentOptions = {
model?: string,
baseUrl?: string,
/**
* Provider key variables forwarded from the host's environment at each
* start.
*/
envFromHost: Array<string>,
/**
* More environment for every run (not secrets).
*/
env: Map<string, string>
}
/**
* Generated factory for {@link PersistentAgentOptions} record objects.
*/
export const PersistentAgentOptions = (() => {
const defaults = () => ({
model: undefined,
baseUrl: undefined,
envFromHost: [],
env: new Map()
});
const create = (() => {
return uniffiCreateRecord<PersistentAgentOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PersistentAgentOptions>,
});
})();
const FfiConverterTypePersistentAgentOptions = (() => {
type TypeName = PersistentAgentOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
model: FfiConverterOptionalString.read(from),
baseUrl: FfiConverterOptionalString.read(from),
envFromHost: FfiConverterSequenceString.read(from),
env: FfiConverterMapStringString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.model, into);
FfiConverterOptionalString.write(value.baseUrl, into);
FfiConverterSequenceString.write(value.envFromHost, into);
FfiConverterMapStringString.write(value.env, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.model) +
FfiConverterOptionalString.allocationSize(value.baseUrl) +
FfiConverterSequenceString.allocationSize(value.envFromHost) +
FfiConverterMapStringString.allocationSize(value.env);
}
};
return new FFIConverter();
})();
/**
* A point.
*/
export type Point = {
/**
* X.
*/
x: number,
/**
* Y.
*/
y: number
}
/**
* Generated factory for {@link Point} record objects.
*/
export const Point = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<Point, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<Point>,
});
})();
const FfiConverterTypePoint = (() => {
type TypeName = Point;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
x: FfiConverterFloat64.read(from),
y: FfiConverterFloat64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterFloat64.write(value.x, into);
FfiConverterFloat64.write(value.y, into);
}
allocationSize(value: TypeName): number {
return FfiConverterFloat64.allocationSize(value.x) +
FfiConverterFloat64.allocationSize(value.y);
}
};
return new FFIConverter();
})();
/**
* What a pool's sandboxes are and how many it keeps ready
* ([`Sandboxes::create_pool`]). The shape fields mean what they mean in
* [`SandboxCreateOptions`].
*/
export type PoolCreateOptions = {
/**
* Pool name (lower-case letters, digits and `-`). `None`: a new name.
* The name of an existing pool updates it.
*/
name?: string,
/**
* Where its sandboxes run: `local` (the default; the only location
* with pools today).
*/
on?: string,
/**
* What kind of machine: `auto`, `container`, `vm` or `microvm`.
*/
kind?: string,
/**
* Which engine: `auto` or one the location offers for the kind.
*/
runtime?: string,
/**
* Guest OS (`linux`, `macos`, `windows`).
*/
os?: string,
/**
* vCPUs of each sandbox.
*/
cpus?: number,
/**
* Memory of each sandbox (MiB).
*/
memoryMb?: bigint,
/**
* Guest environment.
*/
env: Map<string, string>,
/**
* Extra guest ports to publish.
*/
ports: Array<number>,
/**
* Named services (name → guest port).
*/
services: Map<string, number>,
/**
* The sandboxes' command (argv), replacing the image's entrypoint (as
* [`SandboxCreateOptions::command`]).
*/
command?: Array<string>,
/**
* Sandboxes without a desktop (as [`SandboxCreateOptions::headless`]).
*/
headless: boolean,
/**
* Sandboxes kept ready at all times (refilled right after each create
* from the pool).
*/
min: number,
/**
* The most kept ready, not counting those created from the pool
* (default: `min`).
*/
max?: number,
/**
* After this long without a create from the pool it keeps none ready,
* until the next create (default: never).
*/
idleMs?: bigint
}
/**
* Generated factory for {@link PoolCreateOptions} record objects.
*/
export const PoolCreateOptions = (() => {
const defaults = () => ({
name: undefined,
on: undefined,
kind: undefined,
runtime: undefined,
os: undefined,
cpus: undefined,
memoryMb: undefined,
env: new Map(),
ports: [],
services: new Map(),
command: undefined,
headless: false,
min: 1,
max: undefined,
idleMs: undefined
});
const create = (() => {
return uniffiCreateRecord<PoolCreateOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PoolCreateOptions>,
});
})();
const FfiConverterTypePoolCreateOptions = (() => {
type TypeName = PoolCreateOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterOptionalString.read(from),
on: FfiConverterOptionalString.read(from),
kind: FfiConverterOptionalString.read(from),
runtime: FfiConverterOptionalString.read(from),
os: FfiConverterOptionalString.read(from),
cpus: FfiConverterOptionalUInt32.read(from),
memoryMb: FfiConverterOptionalUInt64.read(from),
env: FfiConverterMapStringString.read(from),
ports: FfiConverterSequenceUInt16.read(from),
services: FfiConverterMapStringUInt16.read(from),
command: FfiConverterOptionalSequenceString.read(from),
headless: FfiConverterBool.read(from),
min: FfiConverterUInt32.read(from),
max: FfiConverterOptionalUInt32.read(from),
idleMs: FfiConverterOptionalUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.name, into);
FfiConverterOptionalString.write(value.on, into);
FfiConverterOptionalString.write(value.kind, into);
FfiConverterOptionalString.write(value.runtime, into);
FfiConverterOptionalString.write(value.os, into);
FfiConverterOptionalUInt32.write(value.cpus, into);
FfiConverterOptionalUInt64.write(value.memoryMb, into);
FfiConverterMapStringString.write(value.env, into);
FfiConverterSequenceUInt16.write(value.ports, into);
FfiConverterMapStringUInt16.write(value.services, into);
FfiConverterOptionalSequenceString.write(value.command, into);
FfiConverterBool.write(value.headless, into);
FfiConverterUInt32.write(value.min, into);
FfiConverterOptionalUInt32.write(value.max, into);
FfiConverterOptionalUInt64.write(value.idleMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.name) +
FfiConverterOptionalString.allocationSize(value.on) +
FfiConverterOptionalString.allocationSize(value.kind) +
FfiConverterOptionalString.allocationSize(value.runtime) +
FfiConverterOptionalString.allocationSize(value.os) +
FfiConverterOptionalUInt32.allocationSize(value.cpus) +
FfiConverterOptionalUInt64.allocationSize(value.memoryMb) +
FfiConverterMapStringString.allocationSize(value.env) +
FfiConverterSequenceUInt16.allocationSize(value.ports) +
FfiConverterMapStringUInt16.allocationSize(value.services) +
FfiConverterOptionalSequenceString.allocationSize(value.command) +
FfiConverterBool.allocationSize(value.headless) +
FfiConverterUInt32.allocationSize(value.min) +
FfiConverterOptionalUInt32.allocationSize(value.max) +
FfiConverterOptionalUInt64.allocationSize(value.idleMs);
}
};
return new FFIConverter();
})();
/**
* A normalized cursor.
*/
export type PresenceCursor = {
/**
* Display id (empty = primary).
*/
displayId: string,
/**
* Window handle.
*/
windowId?: string,
/**
* X in `[0, 1]`.
*/
x: number,
/**
* Y in `[0, 1]`.
*/
y: number,
/**
* Visible.
*/
visible: boolean,
/**
* A button is down (datagram channel only).
*/
pressed: boolean,
/**
* The guest's cursor shape here (server-computed): `arrow`, `text`,
* `pointer`, `resize_ns`, `resize_ew`, `resize_nesw`, `resize_nwse`,
* `wait`, `progress`, `not_allowed`, `crosshair`, `grab`, `grabbing`,
* `move`. Ignored when publishing.
*/
shape: string,
/**
* How `shape` was determined: `unspecified`, `hit_test`, `system` or
* `probe`. Ignored when publishing.
*/
shapeSource: string,
/**
* Server time of the sample in milliseconds (0 = unknown).
*/
atMs: number,
/**
* Local Unix time it was received in milliseconds (0 = unknown).
*/
receivedMs: number
}
/**
* Generated factory for {@link PresenceCursor} record objects.
*/
export const PresenceCursor = (() => {
const defaults = () => ({
displayId: "",
windowId: undefined,
visible: true,
pressed: false,
shape: "arrow",
shapeSource: "unspecified",
atMs: 0.0,
receivedMs: 0.0
});
const create = (() => {
return uniffiCreateRecord<PresenceCursor, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PresenceCursor>,
});
})();
const FfiConverterTypePresenceCursor = (() => {
type TypeName = PresenceCursor;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
displayId: FfiConverterString.read(from),
windowId: FfiConverterOptionalString.read(from),
x: FfiConverterFloat64.read(from),
y: FfiConverterFloat64.read(from),
visible: FfiConverterBool.read(from),
pressed: FfiConverterBool.read(from),
shape: FfiConverterString.read(from),
shapeSource: FfiConverterString.read(from),
atMs: FfiConverterFloat64.read(from),
receivedMs: FfiConverterFloat64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.displayId, into);
FfiConverterOptionalString.write(value.windowId, into);
FfiConverterFloat64.write(value.x, into);
FfiConverterFloat64.write(value.y, into);
FfiConverterBool.write(value.visible, into);
FfiConverterBool.write(value.pressed, into);
FfiConverterString.write(value.shape, into);
FfiConverterString.write(value.shapeSource, into);
FfiConverterFloat64.write(value.atMs, into);
FfiConverterFloat64.write(value.receivedMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.displayId) +
FfiConverterOptionalString.allocationSize(value.windowId) +
FfiConverterFloat64.allocationSize(value.x) +
FfiConverterFloat64.allocationSize(value.y) +
FfiConverterBool.allocationSize(value.visible) +
FfiConverterBool.allocationSize(value.pressed) +
FfiConverterString.allocationSize(value.shape) +
FfiConverterString.allocationSize(value.shapeSource) +
FfiConverterFloat64.allocationSize(value.atMs) +
FfiConverterFloat64.allocationSize(value.receivedMs);
}
};
return new FFIConverter();
})();
/**
* One cursor to draw now (see [`PresenceView::drawables`]).
*/
export type PresenceDrawable = {
/**
* Whose.
*/
participantId: string,
/**
* Their display name.
*/
displayName: string,
/**
* Their color (`#rrggbb`).
*/
color: string,
/**
* This client's own cursor, drawn at the local pointer.
*/
isMe: boolean,
/**
* An agent.
*/
isAgent: boolean,
/**
* Normalized x.
*/
x: number,
/**
* Normalized y.
*/
y: number,
/**
* Shape name (see [`PresenceCursor::shape`]).
*/
shape: string,
/**
* How the shape was determined.
*/
shapeSource: string,
/**
* Opacity in `[0, 1]` (idle cursors fade).
*/
alpha: number,
/**
* Display id of the cursor's target.
*/
displayId: string,
/**
* Window id, when over a window stream.
*/
windowId?: string
}
/**
* Generated factory for {@link PresenceDrawable} record objects.
*/
export const PresenceDrawable = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<PresenceDrawable, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PresenceDrawable>,
});
})();
const FfiConverterTypePresenceDrawable = (() => {
type TypeName = PresenceDrawable;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
participantId: FfiConverterString.read(from),
displayName: FfiConverterString.read(from),
color: FfiConverterString.read(from),
isMe: FfiConverterBool.read(from),
isAgent: FfiConverterBool.read(from),
x: FfiConverterFloat64.read(from),
y: FfiConverterFloat64.read(from),
shape: FfiConverterString.read(from),
shapeSource: FfiConverterString.read(from),
alpha: FfiConverterFloat64.read(from),
displayId: FfiConverterString.read(from),
windowId: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.participantId, into);
FfiConverterString.write(value.displayName, into);
FfiConverterString.write(value.color, into);
FfiConverterBool.write(value.isMe, into);
FfiConverterBool.write(value.isAgent, into);
FfiConverterFloat64.write(value.x, into);
FfiConverterFloat64.write(value.y, into);
FfiConverterString.write(value.shape, into);
FfiConverterString.write(value.shapeSource, into);
FfiConverterFloat64.write(value.alpha, into);
FfiConverterString.write(value.displayId, into);
FfiConverterOptionalString.write(value.windowId, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.participantId) +
FfiConverterString.allocationSize(value.displayName) +
FfiConverterString.allocationSize(value.color) +
FfiConverterBool.allocationSize(value.isMe) +
FfiConverterBool.allocationSize(value.isAgent) +
FfiConverterFloat64.allocationSize(value.x) +
FfiConverterFloat64.allocationSize(value.y) +
FfiConverterString.allocationSize(value.shape) +
FfiConverterString.allocationSize(value.shapeSource) +
FfiConverterFloat64.allocationSize(value.alpha) +
FfiConverterString.allocationSize(value.displayId) +
FfiConverterOptionalString.allocationSize(value.windowId);
}
};
return new FFIConverter();
})();
/**
* A presence participant.
*/
export type PresenceParticipant = {
/**
* Participant id (per join).
*/
participantId: string,
/**
* Principal id.
*/
principalId: string,
/**
* Display name.
*/
displayName: string,
/**
* Color.
*/
color: string,
/**
* `human` or `agent`.
*/
kind: string
}
/**
* Generated factory for {@link PresenceParticipant} record objects.
*/
export const PresenceParticipant = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<PresenceParticipant, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PresenceParticipant>,
});
})();
const FfiConverterTypePresenceParticipant = (() => {
type TypeName = PresenceParticipant;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
participantId: FfiConverterString.read(from),
principalId: FfiConverterString.read(from),
displayName: FfiConverterString.read(from),
color: FfiConverterString.read(from),
kind: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.participantId, into);
FfiConverterString.write(value.principalId, into);
FfiConverterString.write(value.displayName, into);
FfiConverterString.write(value.color, into);
FfiConverterString.write(value.kind, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.participantId) +
FfiConverterString.allocationSize(value.principalId) +
FfiConverterString.allocationSize(value.displayName) +
FfiConverterString.allocationSize(value.color) +
FfiConverterString.allocationSize(value.kind);
}
};
return new FFIConverter();
})();
/**
* A presence event.
*/
export type PresenceEvent = {
/**
* `joined`, `left`, `cursor_moved`, `shape_changed`, `heartbeat` or
* `keep_alive`.
*/
kind: string,
/**
* `joined`: who.
*/
participant?: PresenceParticipant,
/**
* `left` / `cursor_moved` / `shape_changed`: whose.
*/
participantId?: string,
/**
* `cursor_moved`: where.
*/
cursor?: PresenceCursor,
/**
* `shape_changed`: the new shape.
*/
shape?: string,
/**
* `shape_changed`: how it was determined.
*/
shapeSource?: string,
/**
* `left`: why (`left`, `disconnected`, `timeout`, `run_ended`, or
* empty).
*/
reason?: string,
/**
* `heartbeat`: everyone present.
*/
participantIds?: Array<string>
}
/**
* Generated factory for {@link PresenceEvent} record objects.
*/
export const PresenceEvent = (() => {
const defaults = () => ({
shape: undefined,
shapeSource: undefined,
reason: undefined,
participantIds: undefined
});
const create = (() => {
return uniffiCreateRecord<PresenceEvent, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PresenceEvent>,
});
})();
const FfiConverterTypePresenceEvent = (() => {
type TypeName = PresenceEvent;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
kind: FfiConverterString.read(from),
participant: FfiConverterOptionalTypePresenceParticipant.read(from),
participantId: FfiConverterOptionalString.read(from),
cursor: FfiConverterOptionalTypePresenceCursor.read(from),
shape: FfiConverterOptionalString.read(from),
shapeSource: FfiConverterOptionalString.read(from),
reason: FfiConverterOptionalString.read(from),
participantIds: FfiConverterOptionalSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.kind, into);
FfiConverterOptionalTypePresenceParticipant.write(value.participant, into);
FfiConverterOptionalString.write(value.participantId, into);
FfiConverterOptionalTypePresenceCursor.write(value.cursor, into);
FfiConverterOptionalString.write(value.shape, into);
FfiConverterOptionalString.write(value.shapeSource, into);
FfiConverterOptionalString.write(value.reason, into);
FfiConverterOptionalSequenceString.write(value.participantIds, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.kind) +
FfiConverterOptionalTypePresenceParticipant.allocationSize(value.participant) +
FfiConverterOptionalString.allocationSize(value.participantId) +
FfiConverterOptionalTypePresenceCursor.allocationSize(value.cursor) +
FfiConverterOptionalString.allocationSize(value.shape) +
FfiConverterOptionalString.allocationSize(value.shapeSource) +
FfiConverterOptionalString.allocationSize(value.reason) +
FfiConverterOptionalSequenceString.allocationSize(value.participantIds);
}
};
return new FFIConverter();
})();
/**
* Who joins presence.
*/
export type PresenceIdentity = {
/**
* Stable principal id.
*/
id: string,
/**
* Display name.
*/
displayName: string,
/**
* Requested color.
*/
color: string,
/**
* An agent rather than a human.
*/
agent: boolean
}
/**
* Generated factory for {@link PresenceIdentity} record objects.
*/
export const PresenceIdentity = (() => {
const defaults = () => ({
color: "",
agent: false
});
const create = (() => {
return uniffiCreateRecord<PresenceIdentity, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PresenceIdentity>,
});
})();
const FfiConverterTypePresenceIdentity = (() => {
type TypeName = PresenceIdentity;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
displayName: FfiConverterString.read(from),
color: FfiConverterString.read(from),
agent: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.displayName, into);
FfiConverterString.write(value.color, into);
FfiConverterBool.write(value.agent, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.displayName) +
FfiConverterString.allocationSize(value.color) +
FfiConverterBool.allocationSize(value.agent);
}
};
return new FFIConverter();
})();
/**
* A roster entry.
*/
export type PresenceMember = {
/**
* Who.
*/
participant: PresenceParticipant,
/**
* Their cursor, if known.
*/
cursor?: PresenceCursor
}
/**
* Generated factory for {@link PresenceMember} record objects.
*/
export const PresenceMember = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<PresenceMember, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PresenceMember>,
});
})();
const FfiConverterTypePresenceMember = (() => {
type TypeName = PresenceMember;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
participant: FfiConverterTypePresenceParticipant.read(from),
cursor: FfiConverterOptionalTypePresenceCursor.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterTypePresenceParticipant.write(value.participant, into);
FfiConverterOptionalTypePresenceCursor.write(value.cursor, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypePresenceParticipant.allocationSize(value.participant) +
FfiConverterOptionalTypePresenceCursor.allocationSize(value.cursor);
}
};
return new FFIConverter();
})();
/**
* A normalized point.
*/
export type PresencePoint = {
/**
* X in `[0, 1]`.
*/
x: number,
/**
* Y in `[0, 1]`.
*/
y: number
}
/**
* Generated factory for {@link PresencePoint} record objects.
*/
export const PresencePoint = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<PresencePoint, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PresencePoint>,
});
})();
const FfiConverterTypePresencePoint = (() => {
type TypeName = PresencePoint;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
x: FfiConverterFloat64.read(from),
y: FfiConverterFloat64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterFloat64.write(value.x, into);
FfiConverterFloat64.write(value.y, into);
}
allocationSize(value: TypeName): number {
return FfiConverterFloat64.allocationSize(value.x) +
FfiConverterFloat64.allocationSize(value.y);
}
};
return new FFIConverter();
})();
/**
* Where a prewarm keeps Spaces ready.
*/
export type PrewarmPlacement = {
/**
* The machine's name.
*/
host: string,
/**
* `local` or its relay machine id.
*/
machine: string,
count: number,
ready: number
}
/**
* Generated factory for {@link PrewarmPlacement} record objects.
*/
export const PrewarmPlacement = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<PrewarmPlacement, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PrewarmPlacement>,
});
})();
const FfiConverterTypePrewarmPlacement = (() => {
type TypeName = PrewarmPlacement;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
host: FfiConverterString.read(from),
machine: FfiConverterString.read(from),
count: FfiConverterUInt32.read(from),
ready: FfiConverterUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.host, into);
FfiConverterString.write(value.machine, into);
FfiConverterUInt32.write(value.count, into);
FfiConverterUInt32.write(value.ready, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.host) +
FfiConverterString.allocationSize(value.machine) +
FfiConverterUInt32.allocationSize(value.count) +
FfiConverterUInt32.allocationSize(value.ready);
}
};
return new FFIConverter();
})();
/**
* Spaces of one shape the elastic pool keeps ready: the next creates of
* that shape claim them in a fraction of a second.
*/
export type Prewarm = {
/**
* `pw-xxxxxx`.
*/
id: string,
image: string,
kind: string,
cpus: number,
memoryMb: bigint,
/**
* Asked.
*/
count: number,
/**
* Ready now.
*/
ready: number,
placements: Array<PrewarmPlacement>,
/**
* Unix seconds.
*/
expiresAt: bigint,
/**
* Hosts added for it.
*/
newHosts: Array<string>
}
/**
* Generated factory for {@link Prewarm} record objects.
*/
export const Prewarm = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<Prewarm, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<Prewarm>,
});
})();
const FfiConverterTypePrewarm = (() => {
type TypeName = Prewarm;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
image: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
cpus: FfiConverterUInt32.read(from),
memoryMb: FfiConverterUInt64.read(from),
count: FfiConverterUInt32.read(from),
ready: FfiConverterUInt32.read(from),
placements: FfiConverterSequenceTypePrewarmPlacement.read(from),
expiresAt: FfiConverterUInt64.read(from),
newHosts: FfiConverterSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.image, into);
FfiConverterString.write(value.kind, into);
FfiConverterUInt32.write(value.cpus, into);
FfiConverterUInt64.write(value.memoryMb, into);
FfiConverterUInt32.write(value.count, into);
FfiConverterUInt32.write(value.ready, into);
FfiConverterSequenceTypePrewarmPlacement.write(value.placements, into);
FfiConverterUInt64.write(value.expiresAt, into);
FfiConverterSequenceString.write(value.newHosts, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.image) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterUInt32.allocationSize(value.cpus) +
FfiConverterUInt64.allocationSize(value.memoryMb) +
FfiConverterUInt32.allocationSize(value.count) +
FfiConverterUInt32.allocationSize(value.ready) +
FfiConverterSequenceTypePrewarmPlacement.allocationSize(value.placements) +
FfiConverterUInt64.allocationSize(value.expiresAt) +
FfiConverterSequenceString.allocationSize(value.newHosts);
}
};
return new FFIConverter();
})();
/**
* What to keep ready (`Spaces::prewarm`).
*/
export type PrewarmOptions = {
/**
* How many, 1 to 256 (default 1).
*/
count?: number,
/**
* `auto` (default), `local`, a linked cloud or `host:<machine>`.
*/
on?: string,
/**
* `container`, `vm` or `microvm` (default: the image's).
*/
kind?: string,
cpus?: number,
memoryMb?: bigint,
/**
* Seconds to keep them (default 3600).
*/
ttlSecs?: bigint,
/**
* Only this cloud machine type.
*/
instanceType?: string,
/**
* Only this cloud region.
*/
region?: string
}
/**
* Generated factory for {@link PrewarmOptions} record objects.
*/
export const PrewarmOptions = (() => {
const defaults = () => ({
count: undefined,
on: undefined,
kind: undefined,
cpus: undefined,
memoryMb: undefined,
ttlSecs: undefined,
instanceType: undefined,
region: undefined
});
const create = (() => {
return uniffiCreateRecord<PrewarmOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PrewarmOptions>,
});
})();
const FfiConverterTypePrewarmOptions = (() => {
type TypeName = PrewarmOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
count: FfiConverterOptionalUInt32.read(from),
on: FfiConverterOptionalString.read(from),
kind: FfiConverterOptionalString.read(from),
cpus: FfiConverterOptionalUInt32.read(from),
memoryMb: FfiConverterOptionalUInt64.read(from),
ttlSecs: FfiConverterOptionalUInt64.read(from),
instanceType: FfiConverterOptionalString.read(from),
region: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalUInt32.write(value.count, into);
FfiConverterOptionalString.write(value.on, into);
FfiConverterOptionalString.write(value.kind, into);
FfiConverterOptionalUInt32.write(value.cpus, into);
FfiConverterOptionalUInt64.write(value.memoryMb, into);
FfiConverterOptionalUInt64.write(value.ttlSecs, into);
FfiConverterOptionalString.write(value.instanceType, into);
FfiConverterOptionalString.write(value.region, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalUInt32.allocationSize(value.count) +
FfiConverterOptionalString.allocationSize(value.on) +
FfiConverterOptionalString.allocationSize(value.kind) +
FfiConverterOptionalUInt32.allocationSize(value.cpus) +
FfiConverterOptionalUInt64.allocationSize(value.memoryMb) +
FfiConverterOptionalUInt64.allocationSize(value.ttlSecs) +
FfiConverterOptionalString.allocationSize(value.instanceType) +
FfiConverterOptionalString.allocationSize(value.region);
}
};
return new FFIConverter();
})();
/**
* Kind of a process event.
*/
export enum ProcessEventKind {
/**
* stdout bytes.
*/
Stdout = "stdout",
/**
* stderr bytes.
*/
Stderr = "stderr",
/**
* PTY bytes.
*/
Pty = "pty",
/**
* The process ended (always last).
*/
Exit = "exit"
}
const FfiConverterTypeProcessEventKind = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = ProcessEventKind;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return ProcessEventKind.Stdout;
case 2: return ProcessEventKind.Stderr;
case 3: return ProcessEventKind.Pty;
case 4: return ProcessEventKind.Exit;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case ProcessEventKind.Stdout: return ordinalConverter.write(1, into);
case ProcessEventKind.Stderr: return ordinalConverter.write(2, into);
case ProcessEventKind.Pty: return ordinalConverter.write(3, into);
case ProcessEventKind.Exit: return ordinalConverter.write(4, into);
}
}
allocationSize(value: TypeName): number {
return ordinalConverter.allocationSize(0);
}
}
return new FFIConverter();
})();
/**
* One output chunk or the exit.
*/
export type ProcessEvent = {
/**
* Kind.
*/
kind: ProcessEventKind,
/**
* Combined-output offset of the first byte.
*/
offset: bigint,
/**
* Bytes (empty for `Exit`).
*/
data: ArrayBuffer,
/**
* Exit (only for `Exit`).
*/
exit?: ExitInfo
}
/**
* Generated factory for {@link ProcessEvent} record objects.
*/
export const ProcessEvent = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ProcessEvent, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ProcessEvent>,
});
})();
const FfiConverterTypeProcessEvent = (() => {
type TypeName = ProcessEvent;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
kind: FfiConverterTypeProcessEventKind.read(from),
offset: FfiConverterUInt64.read(from),
data: FfiConverterArrayBuffer.read(from),
exit: FfiConverterOptionalTypeExitInfo.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterTypeProcessEventKind.write(value.kind, into);
FfiConverterUInt64.write(value.offset, into);
FfiConverterArrayBuffer.write(value.data, into);
FfiConverterOptionalTypeExitInfo.write(value.exit, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypeProcessEventKind.allocationSize(value.kind) +
FfiConverterUInt64.allocationSize(value.offset) +
FfiConverterArrayBuffer.allocationSize(value.data) +
FfiConverterOptionalTypeExitInfo.allocationSize(value.exit);
}
};
return new FFIConverter();
})();
/**
* Collected output of a finished process.
*/
export type ProcessOutput = {
/**
* Exit.
*/
exit: ExitInfo,
/**
* stdout bytes.
*/
stdout: ArrayBuffer,
/**
* stderr bytes.
*/
stderr: ArrayBuffer,
/**
* PTY bytes.
*/
pty: ArrayBuffer
}
/**
* Generated factory for {@link ProcessOutput} record objects.
*/
export const ProcessOutput = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ProcessOutput, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ProcessOutput>,
});
})();
const FfiConverterTypeProcessOutput = (() => {
type TypeName = ProcessOutput;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
exit: FfiConverterTypeExitInfo.read(from),
stdout: FfiConverterArrayBuffer.read(from),
stderr: FfiConverterArrayBuffer.read(from),
pty: FfiConverterArrayBuffer.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterTypeExitInfo.write(value.exit, into);
FfiConverterArrayBuffer.write(value.stdout, into);
FfiConverterArrayBuffer.write(value.stderr, into);
FfiConverterArrayBuffer.write(value.pty, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypeExitInfo.allocationSize(value.exit) +
FfiConverterArrayBuffer.allocationSize(value.stdout) +
FfiConverterArrayBuffer.allocationSize(value.stderr) +
FfiConverterArrayBuffer.allocationSize(value.pty);
}
};
return new FFIConverter();
})();
/**
* A PTY size.
*/
export type PtySize = {
/**
* Columns.
*/
cols: number,
/**
* Rows.
*/
rows: number
}
/**
* Generated factory for {@link PtySize} record objects.
*/
export const PtySize = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<PtySize, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PtySize>,
});
})();
const FfiConverterTypePtySize = (() => {
type TypeName = PtySize;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
cols: FfiConverterUInt32.read(from),
rows: FfiConverterUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt32.write(value.cols, into);
FfiConverterUInt32.write(value.rows, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt32.allocationSize(value.cols) +
FfiConverterUInt32.allocationSize(value.rows);
}
};
return new FFIConverter();
})();
/**
* A shareable URL of a sandbox service that expires.
*/
export type PublicUrl = {
/**
* Id for `Sandbox.revoke_public_url`.
*/
id: string,
/**
* The URL.
*/
url: string,
/**
* When it stops working (unix seconds).
*/
expiresAtUnix: bigint,
/**
* Service name.
*/
service: string,
/**
* Provider internals (local: upstream).
*/
providerDetails: Map<string, string>
}
/**
* Generated factory for {@link PublicUrl} record objects.
*/
export const PublicUrl = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<PublicUrl, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<PublicUrl>,
});
})();
const FfiConverterTypePublicUrl = (() => {
type TypeName = PublicUrl;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
url: FfiConverterString.read(from),
expiresAtUnix: FfiConverterInt64.read(from),
service: FfiConverterString.read(from),
providerDetails: FfiConverterMapStringString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.url, into);
FfiConverterInt64.write(value.expiresAtUnix, into);
FfiConverterString.write(value.service, into);
FfiConverterMapStringString.write(value.providerDetails, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.url) +
FfiConverterInt64.allocationSize(value.expiresAtUnix) +
FfiConverterString.allocationSize(value.service) +
FfiConverterMapStringString.allocationSize(value.providerDetails);
}
};
return new FFIConverter();
})();
/**
* A user-declared readiness probe. With no probes a sandbox is ready as
* soon as its provider reports it running; nothing assumes a guest daemon.
*
* Name a declared service (`service = "mcp"`) or a guest port.
*/
export type ReadinessProbe = {
/**
* Guest port (0 with `service`).
*/
port: number,
/**
* HTTP path; `None` is a TCP connect probe.
*/
httpPath?: string,
/**
* Exact HTTP status to wait for; `None` accepts any 2xx.
*/
httpStatus?: number,
/**
* A declared service whose guest port to probe (instead of `port`).
*/
service?: string
}
/**
* Generated factory for {@link ReadinessProbe} record objects.
*/
export const ReadinessProbe = (() => {
const defaults = () => ({
port: 0,
httpPath: undefined,
httpStatus: undefined,
service: undefined
});
const create = (() => {
return uniffiCreateRecord<ReadinessProbe, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ReadinessProbe>,
});
})();
const FfiConverterTypeReadinessProbe = (() => {
type TypeName = ReadinessProbe;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
port: FfiConverterUInt16.read(from),
httpPath: FfiConverterOptionalString.read(from),
httpStatus: FfiConverterOptionalUInt16.read(from),
service: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt16.write(value.port, into);
FfiConverterOptionalString.write(value.httpPath, into);
FfiConverterOptionalUInt16.write(value.httpStatus, into);
FfiConverterOptionalString.write(value.service, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt16.allocationSize(value.port) +
FfiConverterOptionalString.allocationSize(value.httpPath) +
FfiConverterOptionalUInt16.allocationSize(value.httpStatus) +
FfiConverterOptionalString.allocationSize(value.service);
}
};
return new FFIConverter();
})();
/**
* A reference resolved for a backend.
*/
export type ResolvedImage = {
/**
* The reference as given, normalised (`docker.io/library/python:3.12-slim`).
*/
reference: string,
/**
* The chosen variant by tag (the input or its sibling). Lume pulls this.
*/
variantRef: string,
/**
* `registry/repo@sha256:…` of the chosen variant.
*/
pinnedRef: string,
/**
* The digest in `pinned_ref`.
*/
digest: string,
/**
* `rootfs`, `containerdisk` or `lume`.
*/
variant: string,
/**
* Architecture to run (`amd64`/`arm64`).
*/
arch?: string,
/**
* Architectures the variant offers.
*/
architectures: Array<string>,
/**
* Whether `arch` differs from the requested one (runs emulated).
*/
emulated: boolean,
/**
* Guest OS: `linux`, `windows` or `macos`.
*/
os: string,
/**
* Whether the image carries cua-spacesd (`None`: cannot tell).
*/
spacesd?: boolean
}
/**
* Generated factory for {@link ResolvedImage} record objects.
*/
export const ResolvedImage = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ResolvedImage, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ResolvedImage>,
});
})();
const FfiConverterTypeResolvedImage = (() => {
type TypeName = ResolvedImage;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
reference: FfiConverterString.read(from),
variantRef: FfiConverterString.read(from),
pinnedRef: FfiConverterString.read(from),
digest: FfiConverterString.read(from),
variant: FfiConverterString.read(from),
arch: FfiConverterOptionalString.read(from),
architectures: FfiConverterSequenceString.read(from),
emulated: FfiConverterBool.read(from),
os: FfiConverterString.read(from),
spacesd: FfiConverterOptionalBoolean.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.reference, into);
FfiConverterString.write(value.variantRef, into);
FfiConverterString.write(value.pinnedRef, into);
FfiConverterString.write(value.digest, into);
FfiConverterString.write(value.variant, into);
FfiConverterOptionalString.write(value.arch, into);
FfiConverterSequenceString.write(value.architectures, into);
FfiConverterBool.write(value.emulated, into);
FfiConverterString.write(value.os, into);
FfiConverterOptionalBoolean.write(value.spacesd, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.reference) +
FfiConverterString.allocationSize(value.variantRef) +
FfiConverterString.allocationSize(value.pinnedRef) +
FfiConverterString.allocationSize(value.digest) +
FfiConverterString.allocationSize(value.variant) +
FfiConverterOptionalString.allocationSize(value.arch) +
FfiConverterSequenceString.allocationSize(value.architectures) +
FfiConverterBool.allocationSize(value.emulated) +
FfiConverterString.allocationSize(value.os) +
FfiConverterOptionalBoolean.allocationSize(value.spacesd);
}
};
return new FFIConverter();
})();
/**
* One extra Space on this Mac.
*/
export type SpaceResources = {
/**
* `local:<name>`.
*/
id: string,
/**
* `running`, `stopped`, `suspended`, or empty when unknown.
*/
powerState: string,
/**
* Cores given to it (0: unknown).
*/
cpuAllocated: number,
/**
* Memory given to it, bytes (0: unknown).
*/
memoryAllocated: bigint,
/**
* Its disk's size limit, bytes (0: unknown).
*/
diskAllocated: bigint,
/**
* The guest's own numbers; absent while it is off or unreachable.
*/
usage?: GuestUsage,
/**
* What it costs this Mac; absent for a container.
*/
diskOnHost?: DiskOnHost
}
/**
* Generated factory for {@link SpaceResources} record objects.
*/
export const SpaceResources = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceResources, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceResources>,
});
})();
const FfiConverterTypeSpaceResources = (() => {
type TypeName = SpaceResources;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
powerState: FfiConverterString.read(from),
cpuAllocated: FfiConverterUInt32.read(from),
memoryAllocated: FfiConverterUInt64.read(from),
diskAllocated: FfiConverterUInt64.read(from),
usage: FfiConverterOptionalTypeGuestUsage.read(from),
diskOnHost: FfiConverterOptionalTypeDiskOnHost.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.powerState, into);
FfiConverterUInt32.write(value.cpuAllocated, into);
FfiConverterUInt64.write(value.memoryAllocated, into);
FfiConverterUInt64.write(value.diskAllocated, into);
FfiConverterOptionalTypeGuestUsage.write(value.usage, into);
FfiConverterOptionalTypeDiskOnHost.write(value.diskOnHost, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.powerState) +
FfiConverterUInt32.allocationSize(value.cpuAllocated) +
FfiConverterUInt64.allocationSize(value.memoryAllocated) +
FfiConverterUInt64.allocationSize(value.diskAllocated) +
FfiConverterOptionalTypeGuestUsage.allocationSize(value.usage) +
FfiConverterOptionalTypeDiskOnHost.allocationSize(value.diskOnHost);
}
};
return new FFIConverter();
})();
/**
* One sample of everything.
*/
export type ResourcesSnapshot = {
/**
* Grows by one per sample.
*/
sequence: bigint,
/**
* Unix ms.
*/
sampledAtMs: bigint,
/**
* This Mac.
*/
thisMac: ComputerResources,
/**
* Extra Spaces on this Mac.
*/
spaces: Array<SpaceResources>,
/**
* Your other computers, from the summaries they published.
*/
computers: Array<ComputerResources>,
/**
* `this_mac.warning`, for the menu bar.
*/
warning: DiskWarning
}
/**
* Generated factory for {@link ResourcesSnapshot} record objects.
*/
export const ResourcesSnapshot = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ResourcesSnapshot, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ResourcesSnapshot>,
});
})();
const FfiConverterTypeResourcesSnapshot = (() => {
type TypeName = ResourcesSnapshot;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
sequence: FfiConverterUInt64.read(from),
sampledAtMs: FfiConverterUInt64.read(from),
thisMac: FfiConverterTypeComputerResources.read(from),
spaces: FfiConverterSequenceTypeSpaceResources.read(from),
computers: FfiConverterSequenceTypeComputerResources.read(from),
warning: FfiConverterTypeDiskWarning.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt64.write(value.sequence, into);
FfiConverterUInt64.write(value.sampledAtMs, into);
FfiConverterTypeComputerResources.write(value.thisMac, into);
FfiConverterSequenceTypeSpaceResources.write(value.spaces, into);
FfiConverterSequenceTypeComputerResources.write(value.computers, into);
FfiConverterTypeDiskWarning.write(value.warning, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.sequence) +
FfiConverterUInt64.allocationSize(value.sampledAtMs) +
FfiConverterTypeComputerResources.allocationSize(value.thisMac) +
FfiConverterSequenceTypeSpaceResources.allocationSize(value.spaces) +
FfiConverterSequenceTypeComputerResources.allocationSize(value.computers) +
FfiConverterTypeDiskWarning.allocationSize(value.warning);
}
};
return new FFIConverter();
})();
/**
* What changed since the last event: only entries that moved by more than
* 1 point or 256 MB. Replace entries by `id`; drop the `removed` ids.
*/
export type ResourcesUpdate = {
/**
* The sample it brings you to.
*/
sequence: bigint,
/**
* Unix ms.
*/
sampledAtMs: bigint,
/**
* This Mac, when it changed.
*/
thisMac?: ComputerResources,
/**
* Extra Spaces that changed or appeared.
*/
spaces: Array<SpaceResources>,
/**
* Other computers that changed or appeared.
*/
computers: Array<ComputerResources>,
/**
* Ids (Spaces or computers) that are gone.
*/
removed: Array<string>
}
/**
* Generated factory for {@link ResourcesUpdate} record objects.
*/
export const ResourcesUpdate = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ResourcesUpdate, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ResourcesUpdate>,
});
})();
const FfiConverterTypeResourcesUpdate = (() => {
type TypeName = ResourcesUpdate;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
sequence: FfiConverterUInt64.read(from),
sampledAtMs: FfiConverterUInt64.read(from),
thisMac: FfiConverterOptionalTypeComputerResources.read(from),
spaces: FfiConverterSequenceTypeSpaceResources.read(from),
computers: FfiConverterSequenceTypeComputerResources.read(from),
removed: FfiConverterSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt64.write(value.sequence, into);
FfiConverterUInt64.write(value.sampledAtMs, into);
FfiConverterOptionalTypeComputerResources.write(value.thisMac, into);
FfiConverterSequenceTypeSpaceResources.write(value.spaces, into);
FfiConverterSequenceTypeComputerResources.write(value.computers, into);
FfiConverterSequenceString.write(value.removed, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.sequence) +
FfiConverterUInt64.allocationSize(value.sampledAtMs) +
FfiConverterOptionalTypeComputerResources.allocationSize(value.thisMac) +
FfiConverterSequenceTypeSpaceResources.allocationSize(value.spaces) +
FfiConverterSequenceTypeComputerResources.allocationSize(value.computers) +
FfiConverterSequenceString.allocationSize(value.removed);
}
};
return new FFIConverter();
})();
/**
* A routine: a recurring turn of a persistent agent, fired by the daemon.
*/
export type RoutineInfo = {
id: string,
agent: string,
title: string,
prompt: string,
/**
* `Every day at 8:00 AM`.
*/
label: string,
enabled: boolean,
/**
* RFC 3339.
*/
nextFire?: string,
lastFiredAt?: string,
lastOutcome?: string,
lastRunId?: string
}
/**
* Generated factory for {@link RoutineInfo} record objects.
*/
export const RoutineInfo = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<RoutineInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<RoutineInfo>,
});
})();
const FfiConverterTypeRoutineInfo = (() => {
type TypeName = RoutineInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
agent: FfiConverterString.read(from),
title: FfiConverterString.read(from),
prompt: FfiConverterString.read(from),
label: FfiConverterString.read(from),
enabled: FfiConverterBool.read(from),
nextFire: FfiConverterOptionalString.read(from),
lastFiredAt: FfiConverterOptionalString.read(from),
lastOutcome: FfiConverterOptionalString.read(from),
lastRunId: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.agent, into);
FfiConverterString.write(value.title, into);
FfiConverterString.write(value.prompt, into);
FfiConverterString.write(value.label, into);
FfiConverterBool.write(value.enabled, into);
FfiConverterOptionalString.write(value.nextFire, into);
FfiConverterOptionalString.write(value.lastFiredAt, into);
FfiConverterOptionalString.write(value.lastOutcome, into);
FfiConverterOptionalString.write(value.lastRunId, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.agent) +
FfiConverterString.allocationSize(value.title) +
FfiConverterString.allocationSize(value.prompt) +
FfiConverterString.allocationSize(value.label) +
FfiConverterBool.allocationSize(value.enabled) +
FfiConverterOptionalString.allocationSize(value.nextFire) +
FfiConverterOptionalString.allocationSize(value.lastFiredAt) +
FfiConverterOptionalString.allocationSize(value.lastOutcome) +
FfiConverterOptionalString.allocationSize(value.lastRunId);
}
};
return new FFIConverter();
})();
// Enum: RegistrySecret
export enum RegistrySecret_Tags {
Basic = "Basic",
FromEnv = "FromEnv",
AwsEcr = "AwsEcr"
}
/**
* Credentials for a private registry image, used for the pull. Never
* logged or persisted.
*/
export const RegistrySecret = (() => {
type Basic__interface = {
tag: RegistrySecret_Tags.Basic;
inner:
Readonly<{username: string; password: string; registry?: string}>
};
/**
* A user name and password (or access token).
*/
class Basic_ extends UniffiEnum implements Basic__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "RegistrySecret";
readonly tag = RegistrySecret_Tags.Basic;
readonly inner:
Readonly<{username: string; password: string; registry?: string}>;
constructor(
inner: {username: string; password: string; registry?: string }) {
super("RegistrySecret", "Basic");
this.inner = Object.freeze(inner);
}
static new(
inner: {username: string; password: string; registry?: string }): Basic_ {
return new Basic_(inner);
}
static instanceOf(obj: any): obj is Basic_ {
return obj.tag === RegistrySecret_Tags.Basic;
}
}
type FromEnv__interface = {
tag: RegistrySecret_Tags.FromEnv;
inner:
Readonly<{usernameVar: string; passwordVar: string; registry?: string}>
};
/**
* Read from environment variables of this process at create time.
*/
class FromEnv_ extends UniffiEnum implements FromEnv__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "RegistrySecret";
readonly tag = RegistrySecret_Tags.FromEnv;
readonly inner:
Readonly<{usernameVar: string; passwordVar: string; registry?: string}>;
constructor(
inner: {usernameVar: string; passwordVar: string; registry?: string }) {
super("RegistrySecret", "FromEnv");
this.inner = Object.freeze(inner);
}
static new(
inner: {usernameVar: string; passwordVar: string; registry?: string }): FromEnv_ {
return new FromEnv_(inner);
}
static instanceOf(obj: any): obj is FromEnv_ {
return obj.tag === RegistrySecret_Tags.FromEnv;
}
}
type AwsEcr__interface = {
tag: RegistrySecret_Tags.AwsEcr;
inner:
Readonly<{region?: string}>
};
/**
* A private Amazon ECR image: a login token from the AWS CLI
* (`aws ecr get-login-password`) with the caller's AWS credentials.
*/
class AwsEcr_ extends UniffiEnum implements AwsEcr__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "RegistrySecret";
readonly tag = RegistrySecret_Tags.AwsEcr;
readonly inner:
Readonly<{region?: string}>;
constructor(
inner: {region?: string }) {
super("RegistrySecret", "AwsEcr");
this.inner = Object.freeze(inner);
}
static new(
inner: {region?: string }): AwsEcr_ {
return new AwsEcr_(inner);
}
static instanceOf(obj: any): obj is AwsEcr_ {
return obj.tag === RegistrySecret_Tags.AwsEcr;
}
}
function instanceOf(obj: any): obj is RegistrySecret {
return obj[uniffiTypeNameSymbol] === "RegistrySecret";
}
return Object.freeze({
instanceOf,
Basic: Basic_,
FromEnv: FromEnv_,
AwsEcr: AwsEcr_
});
})();
/**
* Credentials for a private registry image, used for the pull. Never
* logged or persisted.
*/
export type RegistrySecret = InstanceType<
typeof RegistrySecret['Basic' | 'FromEnv' | 'AwsEcr']
>;
// FfiConverter for enum RegistrySecret
const FfiConverterTypeRegistrySecret = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = RegistrySecret;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return new RegistrySecret.Basic({username: FfiConverterString.read(from), password: FfiConverterString.read(from), registry: FfiConverterOptionalString.read(from) });
case 2: return new RegistrySecret.FromEnv({usernameVar: FfiConverterString.read(from), passwordVar: FfiConverterString.read(from), registry: FfiConverterOptionalString.read(from) });
case 3: return new RegistrySecret.AwsEcr({region: FfiConverterOptionalString.read(from) });
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value.tag) {
case RegistrySecret_Tags.Basic: {
ordinalConverter.write(1, into);
const inner = value.inner;
FfiConverterString.write(inner.username, into);
FfiConverterString.write(inner.password, into);
FfiConverterOptionalString.write(inner.registry, into);
return;
}
case RegistrySecret_Tags.FromEnv: {
ordinalConverter.write(2, into);
const inner = value.inner;
FfiConverterString.write(inner.usernameVar, into);
FfiConverterString.write(inner.passwordVar, into);
FfiConverterOptionalString.write(inner.registry, into);
return;
}
case RegistrySecret_Tags.AwsEcr: {
ordinalConverter.write(3, into);
const inner = value.inner;
FfiConverterOptionalString.write(inner.region, into);
return;
}
default:
// Throwing from here means that RegistrySecret_Tags hasn't matched an ordinal.
throw new UniffiInternalError.UnexpectedEnumCase();
}
}
allocationSize(value: TypeName): number {
switch (value.tag) {
case RegistrySecret_Tags.Basic: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(1);
size += FfiConverterString.allocationSize(inner.username);
size += FfiConverterString.allocationSize(inner.password);
size += FfiConverterOptionalString.allocationSize(inner.registry);
return size;
}
case RegistrySecret_Tags.FromEnv: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(2);
size += FfiConverterString.allocationSize(inner.usernameVar);
size += FfiConverterString.allocationSize(inner.passwordVar);
size += FfiConverterOptionalString.allocationSize(inner.registry);
return size;
}
case RegistrySecret_Tags.AwsEcr: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(3);
size += FfiConverterOptionalString.allocationSize(inner.region);
return size;
}
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
}
return new FFIConverter();
})();
/**
* Options for [`Sandboxes::create`].
*/
export type SandboxCreateOptions = {
/**
* Where it runs: `local`, `direct:<addr>` (an existing machine running
* cua-spacesd) or a registered provider. `None` (the default): the
* user default (`default.on` in `~/.cua/config.toml`,
* `CUA_DEFAULT_ON`, else `local`). `cloud` fails with the "Cua Cloud has
* ended" error.
*/
on?: string,
/**
* What kind of machine: `auto`, `container`, `vm` or `microvm`. `None`: the user
* default (`default.kind`, else `auto`: macOS and Windows images are
* VMs, an image with a container rootfs is a container, a disk-only
* image is a VM).
*/
kind?: string,
/**
* Which engine: `auto` or one the location offers for the kind (local
* `gvisor`, `runc`, `qemu`, `lume`). `None`:
* the user default (`default.runtime`, else `auto`, the safest
* available). A local sandbox with sidecars needs `runc` where gVisor
* would run. A combination that does not exist is `InvalidPlacement`,
* listing the valid values.
*/
runtime?: string,
/**
* Image reference. A `pool:<name>` image fails with the "Cua Cloud has
* ended" error.
*/
image: string,
/**
* Name. `None`: ephemeral (no state file; deleted with the sandbox).
*/
name?: string,
/**
* spacesd token.
*/
token?: string,
/**
* Create from this pool: locally, a pool made with
* [`Sandboxes::create_pool`] (the sandbox gets the pool's image and
* shape and takes one of its ready sandboxes in about 0.1 s; `image`
* may be left empty).
*/
pool?: string,
/**
* Guest OS (`linux`, `macos`, `windows`).
*/
os?: string,
/**
* vCPUs.
*/
cpus?: number,
/**
* Memory (MiB).
*/
memoryMb?: bigint,
/**
* Extra guest ports (local: published).
*/
ports: Array<number>,
/**
* Named services (name → guest port). `env` defaults to 3211.
*/
services: Map<string, number>,
/**
* Readiness probes.
*/
waitFor: Array<ReadinessProbe>,
/**
* Readiness budget (default 10 min).
*/
readyTimeoutMs?: number,
/**
* Guest environment (local: container environment or cloud-init; values
* are not secrets).
*/
env: Map<string, string>,
/**
* Lifetime backstop in seconds: the platform deletes the sandbox this
* long after it stops being kept alive (a provider sandbox such as
* `on = "e2b"`: its lifetime). `None`: the platform's default.
*/
ttlSeconds?: number,
/**
* The sandbox's command (argv), replacing the image's entrypoint.
* Same meaning local (container ENTRYPOINT, or run by cloud-init in a
* Linux VM) and in the cloud (the template command with
* `processMode: Run`, on gVisor and KubeVirt).
*/
command?: Array<string>,
/**
* Sidecar containers, addressed by name (see [`Container`]).
*/
sidecars: Array<Container>,
/**
* Credentials for a private `image` (and sidecar images on its
* registry).
*/
registrySecret?: RegistrySecret,
/**
* Image layers built on top of `image` (a build into the local
* container engine, cached by content).
*/
build?: ImageBuild,
/**
* Guest network: `"default"` (unset) gives outbound network, like a
* Docker container; `"none"` cuts it while published ports still work.
* Only local QEMU VMs honour `"none"`; containers and Lume reject it.
*/
network?: string,
/**
* Binaries to inject once the sandbox is up, so tests run the build
* under test and not the copy the image bundles (see [`Overlay`]; the
* same as calling [`Sandbox::overlay`] after create). Needs
* cua-spacesd in the image, or a local container.
*/
overlays: Array<Overlay>,
/**
* Keep a named sandbox whose readiness check fails (its VM or
* container, and its record) to debug it. `false` (the default): a
* failed create deletes what it made. Ephemeral sandboxes are always
* deleted.
*/
keepOnFailure: boolean,
/**
* A GPU option of the runtime it runs on (`Spaces.gpu_support` lists them):
* `paravirtual` (a macOS VM on Lume: GPU acceleration, experimental),
* `virgl` (QEMU on Linux), `nvidia` (a runc container on Linux), a
* contrib provider's GPU type; `auto` picks the runtime's own. `None`
* (the default): no GPU.
*/
gpu?: string,
/**
* A Space without a desktop: only cua-spacesd runs (exec, files,
* processes, MCP), with no display, window manager or audio. For shell
* and RL workloads it starts several times faster and fits many more
* per machine. Images without cua-spacesd are unaffected; a `command`
* of your own is kept.
*/
headless: boolean,
/**
* Whether an image without cua-spacesd gets a static one injected, so
* any OCI image is a full Space (local containers and microVMs: exec,
* files, ports). `None` (the default): yes. `Some(false)` runs the
* image as it is.
*/
spacesd?: boolean,
/**
* A size profile: defaults for what is left unset. `"rollout"`: 1
* vCPU, 1024 MiB and `headless` (a local VM gets no display hardware,
* so many more fit on one machine), for RL rollouts and agent episodes
* that mostly wait. `None` or `"default"`: 2 vCPUs, 4096 MiB.
*/
profile?: string,
/**
* A fork source (a "bake" sandbox): a local QEMU VM's guest RAM is a
* shared file, so its checkpoints take milliseconds and forks of them
* share its pages ([`Sandboxes::checkpoint`], [`Sandboxes::fork`]).
* Other kinds ignore it. `None` (the default): not one.
*/
forkable?: boolean
}
/**
* Generated factory for {@link SandboxCreateOptions} record objects.
*/
export const SandboxCreateOptions = (() => {
const defaults = () => ({
on: undefined,
kind: undefined,
runtime: undefined,
image: "",
name: undefined,
token: undefined,
pool: undefined,
os: undefined,
cpus: undefined,
memoryMb: undefined,
ports: [],
services: new Map(),
waitFor: [],
readyTimeoutMs: undefined,
env: new Map(),
ttlSeconds: undefined,
command: undefined,
sidecars: [],
registrySecret: undefined,
build: undefined,
network: undefined,
overlays: [],
keepOnFailure: false,
gpu: undefined,
headless: false,
spacesd: undefined,
profile: undefined,
forkable: undefined
});
const create = (() => {
return uniffiCreateRecord<SandboxCreateOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SandboxCreateOptions>,
});
})();
const FfiConverterTypeSandboxCreateOptions = (() => {
type TypeName = SandboxCreateOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
on: FfiConverterOptionalString.read(from),
kind: FfiConverterOptionalString.read(from),
runtime: FfiConverterOptionalString.read(from),
image: FfiConverterString.read(from),
name: FfiConverterOptionalString.read(from),
token: FfiConverterOptionalString.read(from),
pool: FfiConverterOptionalString.read(from),
os: FfiConverterOptionalString.read(from),
cpus: FfiConverterOptionalUInt32.read(from),
memoryMb: FfiConverterOptionalUInt64.read(from),
ports: FfiConverterSequenceUInt16.read(from),
services: FfiConverterMapStringUInt16.read(from),
waitFor: FfiConverterSequenceTypeReadinessProbe.read(from),
readyTimeoutMs: FfiConverterOptionalUInt32.read(from),
env: FfiConverterMapStringString.read(from),
ttlSeconds: FfiConverterOptionalUInt32.read(from),
command: FfiConverterOptionalSequenceString.read(from),
sidecars: FfiConverterSequenceTypeContainer.read(from),
registrySecret: FfiConverterOptionalTypeRegistrySecret.read(from),
build: FfiConverterOptionalTypeImageBuild.read(from),
network: FfiConverterOptionalString.read(from),
overlays: FfiConverterSequenceTypeOverlay.read(from),
keepOnFailure: FfiConverterBool.read(from),
gpu: FfiConverterOptionalString.read(from),
headless: FfiConverterBool.read(from),
spacesd: FfiConverterOptionalBoolean.read(from),
profile: FfiConverterOptionalString.read(from),
forkable: FfiConverterOptionalBoolean.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.on, into);
FfiConverterOptionalString.write(value.kind, into);
FfiConverterOptionalString.write(value.runtime, into);
FfiConverterString.write(value.image, into);
FfiConverterOptionalString.write(value.name, into);
FfiConverterOptionalString.write(value.token, into);
FfiConverterOptionalString.write(value.pool, into);
FfiConverterOptionalString.write(value.os, into);
FfiConverterOptionalUInt32.write(value.cpus, into);
FfiConverterOptionalUInt64.write(value.memoryMb, into);
FfiConverterSequenceUInt16.write(value.ports, into);
FfiConverterMapStringUInt16.write(value.services, into);
FfiConverterSequenceTypeReadinessProbe.write(value.waitFor, into);
FfiConverterOptionalUInt32.write(value.readyTimeoutMs, into);
FfiConverterMapStringString.write(value.env, into);
FfiConverterOptionalUInt32.write(value.ttlSeconds, into);
FfiConverterOptionalSequenceString.write(value.command, into);
FfiConverterSequenceTypeContainer.write(value.sidecars, into);
FfiConverterOptionalTypeRegistrySecret.write(value.registrySecret, into);
FfiConverterOptionalTypeImageBuild.write(value.build, into);
FfiConverterOptionalString.write(value.network, into);
FfiConverterSequenceTypeOverlay.write(value.overlays, into);
FfiConverterBool.write(value.keepOnFailure, into);
FfiConverterOptionalString.write(value.gpu, into);
FfiConverterBool.write(value.headless, into);
FfiConverterOptionalBoolean.write(value.spacesd, into);
FfiConverterOptionalString.write(value.profile, into);
FfiConverterOptionalBoolean.write(value.forkable, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.on) +
FfiConverterOptionalString.allocationSize(value.kind) +
FfiConverterOptionalString.allocationSize(value.runtime) +
FfiConverterString.allocationSize(value.image) +
FfiConverterOptionalString.allocationSize(value.name) +
FfiConverterOptionalString.allocationSize(value.token) +
FfiConverterOptionalString.allocationSize(value.pool) +
FfiConverterOptionalString.allocationSize(value.os) +
FfiConverterOptionalUInt32.allocationSize(value.cpus) +
FfiConverterOptionalUInt64.allocationSize(value.memoryMb) +
FfiConverterSequenceUInt16.allocationSize(value.ports) +
FfiConverterMapStringUInt16.allocationSize(value.services) +
FfiConverterSequenceTypeReadinessProbe.allocationSize(value.waitFor) +
FfiConverterOptionalUInt32.allocationSize(value.readyTimeoutMs) +
FfiConverterMapStringString.allocationSize(value.env) +
FfiConverterOptionalUInt32.allocationSize(value.ttlSeconds) +
FfiConverterOptionalSequenceString.allocationSize(value.command) +
FfiConverterSequenceTypeContainer.allocationSize(value.sidecars) +
FfiConverterOptionalTypeRegistrySecret.allocationSize(value.registrySecret) +
FfiConverterOptionalTypeImageBuild.allocationSize(value.build) +
FfiConverterOptionalString.allocationSize(value.network) +
FfiConverterSequenceTypeOverlay.allocationSize(value.overlays) +
FfiConverterBool.allocationSize(value.keepOnFailure) +
FfiConverterOptionalString.allocationSize(value.gpu) +
FfiConverterBool.allocationSize(value.headless) +
FfiConverterOptionalBoolean.allocationSize(value.spacesd) +
FfiConverterOptionalString.allocationSize(value.profile) +
FfiConverterOptionalBoolean.allocationSize(value.forkable);
}
};
return new FFIConverter();
})();
/**
* Coarse lifecycle status.
*/
export enum SandboxStatus {
/**
* Running (or bound).
*/
Running = "running",
/**
* Suspended or scaled to zero.
*/
Suspended = "suspended",
/**
* Stopped.
*/
Stopped = "stopped",
/**
* Starting.
*/
Provisioning = "provisioning",
/**
* Unknown; see `SandboxInfo.status_detail`.
*/
Unknown = "unknown"
}
const FfiConverterTypeSandboxStatus = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = SandboxStatus;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return SandboxStatus.Running;
case 2: return SandboxStatus.Suspended;
case 3: return SandboxStatus.Stopped;
case 4: return SandboxStatus.Provisioning;
case 5: return SandboxStatus.Unknown;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case SandboxStatus.Running: return ordinalConverter.write(1, into);
case SandboxStatus.Suspended: return ordinalConverter.write(2, into);
case SandboxStatus.Stopped: return ordinalConverter.write(3, into);
case SandboxStatus.Provisioning: return ordinalConverter.write(4, into);
case SandboxStatus.Unknown: return ordinalConverter.write(5, into);
}
}
allocationSize(value: TypeName): number {
return ordinalConverter.allocationSize(0);
}
}
return new FFIConverter();
})();
/**
* Portable lifecycle phase, the same words on every provider.
*/
export enum SandboxPhase {
/**
* Being created.
*/
Provisioning = "provisioning",
/**
* Booting; readiness probes have not passed yet.
*/
Starting = "starting",
/**
* Running and ready.
*/
Ready = "ready",
/**
* Stopped or suspended.
*/
Stopped = "stopped"
}
const FfiConverterTypeSandboxPhase = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = SandboxPhase;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return SandboxPhase.Provisioning;
case 2: return SandboxPhase.Starting;
case 3: return SandboxPhase.Ready;
case 4: return SandboxPhase.Stopped;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case SandboxPhase.Provisioning: return ordinalConverter.write(1, into);
case SandboxPhase.Starting: return ordinalConverter.write(2, into);
case SandboxPhase.Ready: return ordinalConverter.write(3, into);
case SandboxPhase.Stopped: return ordinalConverter.write(4, into);
}
}
allocationSize(value: TypeName): number {
return ordinalConverter.allocationSize(0);
}
}
return new FFIConverter();
})();
/**
* A sandbox as listed.
*/
export type SandboxInfo = {
/**
* Name.
*/
name: string,
/**
* What kind of machine: `container`, `vm` or `microvm` (empty when not known:
* an existing machine).
*/
kind: string,
/**
* The engine that runs it: `gvisor`, `runc`, `qemu`, `lume` or a
* provider's own (empty when not known).
*/
runtime: string,
/**
* `runtime_type` as persisted (`direct`, `gvisor`, `qemu`, ...); prefer
* `location`, `kind` and `runtime`.
*/
runtimeType: string,
/**
* Status.
*/
status: SandboxStatus,
/**
* Provider's word for an unknown status.
*/
statusDetail?: string,
/**
* No state file; torn down on delete.
*/
ephemeral: boolean,
/**
* Declared services: name → guest port (0 = only the name is known).
*/
services: Map<string, number>,
/**
* Service base URLs by name.
*/
endpoints: Map<string, string>,
/**
* Image, when known.
*/
image?: string,
/**
* Qualified ref: `local:<name>`, `direct:<host:port>` or
* `<provider>:<name>`. Every call that takes a sandbox name accepts it.
*/
id: string,
/**
* Portable phase: provisioning, starting, ready or stopped.
*/
phase: SandboxPhase,
/**
* Where it runs: `local`, `direct` (a machine by address), `relay` or a
* provider.
*/
location: string,
/**
* When it expires unless kept alive (unix seconds), when known.
*/
expiresAtUnix?: bigint,
/**
* Provider internals (local: `backend`, `container_id`). Not part of
* the portable API.
*/
providerDetails: Map<string, string>,
/**
* The image as resolved and pinned at create time (digest, variant).
* `None` for direct connections, images not resolved from a registry,
* and the daemon topology.
*/
imageInfo?: ImageInfo,
/**
* Why a local sandbox stopped without being asked to, in plain words
* ("out of memory", "killed", "exited with code 1"); `None` otherwise.
*/
stopReason?: string
}
/**
* Generated factory for {@link SandboxInfo} record objects.
*/
export const SandboxInfo = (() => {
const defaults = () => ({
imageInfo: undefined,
stopReason: undefined
});
const create = (() => {
return uniffiCreateRecord<SandboxInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SandboxInfo>,
});
})();
const FfiConverterTypeSandboxInfo = (() => {
type TypeName = SandboxInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
runtime: FfiConverterString.read(from),
runtimeType: FfiConverterString.read(from),
status: FfiConverterTypeSandboxStatus.read(from),
statusDetail: FfiConverterOptionalString.read(from),
ephemeral: FfiConverterBool.read(from),
services: FfiConverterMapStringUInt16.read(from),
endpoints: FfiConverterMapStringString.read(from),
image: FfiConverterOptionalString.read(from),
id: FfiConverterString.read(from),
phase: FfiConverterTypeSandboxPhase.read(from),
location: FfiConverterString.read(from),
expiresAtUnix: FfiConverterOptionalInt64.read(from),
providerDetails: FfiConverterMapStringString.read(from),
imageInfo: FfiConverterOptionalTypeImageInfo.read(from),
stopReason: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.kind, into);
FfiConverterString.write(value.runtime, into);
FfiConverterString.write(value.runtimeType, into);
FfiConverterTypeSandboxStatus.write(value.status, into);
FfiConverterOptionalString.write(value.statusDetail, into);
FfiConverterBool.write(value.ephemeral, into);
FfiConverterMapStringUInt16.write(value.services, into);
FfiConverterMapStringString.write(value.endpoints, into);
FfiConverterOptionalString.write(value.image, into);
FfiConverterString.write(value.id, into);
FfiConverterTypeSandboxPhase.write(value.phase, into);
FfiConverterString.write(value.location, into);
FfiConverterOptionalInt64.write(value.expiresAtUnix, into);
FfiConverterMapStringString.write(value.providerDetails, into);
FfiConverterOptionalTypeImageInfo.write(value.imageInfo, into);
FfiConverterOptionalString.write(value.stopReason, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterString.allocationSize(value.runtime) +
FfiConverterString.allocationSize(value.runtimeType) +
FfiConverterTypeSandboxStatus.allocationSize(value.status) +
FfiConverterOptionalString.allocationSize(value.statusDetail) +
FfiConverterBool.allocationSize(value.ephemeral) +
FfiConverterMapStringUInt16.allocationSize(value.services) +
FfiConverterMapStringString.allocationSize(value.endpoints) +
FfiConverterOptionalString.allocationSize(value.image) +
FfiConverterString.allocationSize(value.id) +
FfiConverterTypeSandboxPhase.allocationSize(value.phase) +
FfiConverterString.allocationSize(value.location) +
FfiConverterOptionalInt64.allocationSize(value.expiresAtUnix) +
FfiConverterMapStringString.allocationSize(value.providerDetails) +
FfiConverterOptionalTypeImageInfo.allocationSize(value.imageInfo) +
FfiConverterOptionalString.allocationSize(value.stopReason);
}
};
return new FFIConverter();
})();
/**
* A sandbox listing and what it left out.
*/
export type SandboxListing = {
/**
* Sandboxes, each with its `location`.
*/
sandboxes: Array<SandboxInfo>,
/**
* Sources left out of the listing.
*/
warnings: Array<string>
}
/**
* Generated factory for {@link SandboxListing} record objects.
*/
export const SandboxListing = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SandboxListing, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SandboxListing>,
});
})();
const FfiConverterTypeSandboxListing = (() => {
type TypeName = SandboxListing;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
sandboxes: FfiConverterSequenceTypeSandboxInfo.read(from),
warnings: FfiConverterSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterSequenceTypeSandboxInfo.write(value.sandboxes, into);
FfiConverterSequenceString.write(value.warnings, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceTypeSandboxInfo.allocationSize(value.sandboxes) +
FfiConverterSequenceString.allocationSize(value.warnings);
}
};
return new FFIConverter();
})();
/**
* A pool ([`Sandboxes::create_pool`]).
*/
export type SandboxPool = {
/**
* Name.
*/
name: string,
/**
* Image as given.
*/
image: string,
/**
* Where its sandboxes run (`local`).
*/
location: string,
/**
* Kind and runtime as given (empty: auto).
*/
kind: string,
runtime: string,
/**
* Each sandbox's CPUs and memory (MiB).
*/
cpus: number,
memoryMb: bigint,
/**
* Sandboxes kept ready at all times, and at most.
*/
min: number,
max: number,
/**
* After this long without a create it keeps none ready (`None`: never).
*/
idleMs?: bigint,
/**
* Ready now, and starting.
*/
ready: number,
starting: number,
/**
* Why it holds what it holds, or why it cannot.
*/
status: string
}
/**
* Generated factory for {@link SandboxPool} record objects.
*/
export const SandboxPool = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SandboxPool, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SandboxPool>,
});
})();
const FfiConverterTypeSandboxPool = (() => {
type TypeName = SandboxPool;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
image: FfiConverterString.read(from),
location: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
runtime: FfiConverterString.read(from),
cpus: FfiConverterUInt32.read(from),
memoryMb: FfiConverterUInt64.read(from),
min: FfiConverterUInt32.read(from),
max: FfiConverterUInt32.read(from),
idleMs: FfiConverterOptionalUInt64.read(from),
ready: FfiConverterUInt32.read(from),
starting: FfiConverterUInt32.read(from),
status: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.image, into);
FfiConverterString.write(value.location, into);
FfiConverterString.write(value.kind, into);
FfiConverterString.write(value.runtime, into);
FfiConverterUInt32.write(value.cpus, into);
FfiConverterUInt64.write(value.memoryMb, into);
FfiConverterUInt32.write(value.min, into);
FfiConverterUInt32.write(value.max, into);
FfiConverterOptionalUInt64.write(value.idleMs, into);
FfiConverterUInt32.write(value.ready, into);
FfiConverterUInt32.write(value.starting, into);
FfiConverterString.write(value.status, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.image) +
FfiConverterString.allocationSize(value.location) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterString.allocationSize(value.runtime) +
FfiConverterUInt32.allocationSize(value.cpus) +
FfiConverterUInt64.allocationSize(value.memoryMb) +
FfiConverterUInt32.allocationSize(value.min) +
FfiConverterUInt32.allocationSize(value.max) +
FfiConverterOptionalUInt64.allocationSize(value.idleMs) +
FfiConverterUInt32.allocationSize(value.ready) +
FfiConverterUInt32.allocationSize(value.starting) +
FfiConverterString.allocationSize(value.status);
}
};
return new FFIConverter();
})();
/**
* A parsed sandbox ref.
*/
export type SandboxRefParts = {
/**
* `local`, `cloud`, `direct`, `relay` or a contrib provider (`e2b`);
* `None` for a bare name.
*/
location?: string,
/**
* The name, `host:port` or relay machine id.
*/
name: string,
/**
* The canonical form (`location:name`, or the bare name).
*/
id: string
}
/**
* Generated factory for {@link SandboxRefParts} record objects.
*/
export const SandboxRefParts = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SandboxRefParts, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SandboxRefParts>,
});
})();
const FfiConverterTypeSandboxRefParts = (() => {
type TypeName = SandboxRefParts;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
location: FfiConverterOptionalString.read(from),
name: FfiConverterString.read(from),
id: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.location, into);
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.id, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.location) +
FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.id);
}
};
return new FFIConverter();
})();
/**
* Screenshot encoding.
*/
export enum ImageFormat {
/**
* PNG.
*/
Png = "png",
/**
* JPEG.
*/
Jpeg = "jpeg",
/**
* WebP.
*/
Webp = "webp"
}
const FfiConverterTypeImageFormat = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = ImageFormat;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return ImageFormat.Png;
case 2: return ImageFormat.Jpeg;
case 3: return ImageFormat.Webp;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case ImageFormat.Png: return ordinalConverter.write(1, into);
case ImageFormat.Jpeg: return ordinalConverter.write(2, into);
case ImageFormat.Webp: return ordinalConverter.write(3, into);
}
}
allocationSize(value: TypeName): number {
return ordinalConverter.allocationSize(0);
}
}
return new FFIConverter();
})();
/**
* A captured screenshot.
*/
export type Screenshot = {
/**
* Encoded image.
*/
image: ArrayBuffer,
/**
* Encoding.
*/
format: ImageFormat,
/**
* Pixel width.
*/
width: number,
/**
* Pixel height.
*/
height: number,
/**
* Image pixels per logical point.
*/
scale: number,
/**
* Id for screenshot-space input.
*/
screenshotId: string
}
/**
* Generated factory for {@link Screenshot} record objects.
*/
export const Screenshot = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<Screenshot, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<Screenshot>,
});
})();
const FfiConverterTypeScreenshot = (() => {
type TypeName = Screenshot;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
image: FfiConverterArrayBuffer.read(from),
format: FfiConverterTypeImageFormat.read(from),
width: FfiConverterUInt32.read(from),
height: FfiConverterUInt32.read(from),
scale: FfiConverterFloat64.read(from),
screenshotId: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterArrayBuffer.write(value.image, into);
FfiConverterTypeImageFormat.write(value.format, into);
FfiConverterUInt32.write(value.width, into);
FfiConverterUInt32.write(value.height, into);
FfiConverterFloat64.write(value.scale, into);
FfiConverterString.write(value.screenshotId, into);
}
allocationSize(value: TypeName): number {
return FfiConverterArrayBuffer.allocationSize(value.image) +
FfiConverterTypeImageFormat.allocationSize(value.format) +
FfiConverterUInt32.allocationSize(value.width) +
FfiConverterUInt32.allocationSize(value.height) +
FfiConverterFloat64.allocationSize(value.scale) +
FfiConverterString.allocationSize(value.screenshotId);
}
};
return new FFIConverter();
})();
/**
* Screenshot options.
*/
export type ScreenshotOptions = {
/**
* Display id (primary when unset).
*/
display?: string,
/**
* Encoding (PNG when unset).
*/
format?: ImageFormat,
/**
* Lossy quality 1–100.
*/
quality?: number,
/**
* Long-edge cap in pixels.
*/
maxDimension?: number,
/**
* Draw the cursor.
*/
includeCursor: boolean
}
/**
* Generated factory for {@link ScreenshotOptions} record objects.
*/
export const ScreenshotOptions = (() => {
const defaults = () => ({
display: undefined,
format: undefined,
quality: undefined,
maxDimension: undefined,
includeCursor: false
});
const create = (() => {
return uniffiCreateRecord<ScreenshotOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ScreenshotOptions>,
});
})();
const FfiConverterTypeScreenshotOptions = (() => {
type TypeName = ScreenshotOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
display: FfiConverterOptionalString.read(from),
format: FfiConverterOptionalTypeImageFormat.read(from),
quality: FfiConverterOptionalUInt32.read(from),
maxDimension: FfiConverterOptionalUInt32.read(from),
includeCursor: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.display, into);
FfiConverterOptionalTypeImageFormat.write(value.format, into);
FfiConverterOptionalUInt32.write(value.quality, into);
FfiConverterOptionalUInt32.write(value.maxDimension, into);
FfiConverterBool.write(value.includeCursor, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.display) +
FfiConverterOptionalTypeImageFormat.allocationSize(value.format) +
FfiConverterOptionalUInt32.allocationSize(value.quality) +
FfiConverterOptionalUInt32.allocationSize(value.maxDimension) +
FfiConverterBool.allocationSize(value.includeCursor);
}
};
return new FFIConverter();
})();
/**
* Where a sandbox service is reachable from this process.
*/
export type ServiceEndpoint = {
/**
* Base URL (append the path).
*/
url: string,
/**
* Headers every request needs.
*/
headers: Array<HttpHeader>
}
/**
* Generated factory for {@link ServiceEndpoint} record objects.
*/
export const ServiceEndpoint = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ServiceEndpoint, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ServiceEndpoint>,
});
})();
const FfiConverterTypeServiceEndpoint = (() => {
type TypeName = ServiceEndpoint;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
url: FfiConverterString.read(from),
headers: FfiConverterSequenceTypeHttpHeader.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.url, into);
FfiConverterSequenceTypeHttpHeader.write(value.headers, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.url) +
FfiConverterSequenceTypeHttpHeader.allocationSize(value.headers);
}
};
return new FFIConverter();
})();
/**
* One setup step.
*/
export type SetupStep = {
/**
* Component.
*/
name: string,
/**
* Status after the step.
*/
status: RuntimeCheckStatus,
/**
* What was (or would be) done.
*/
detail: string
}
/**
* Generated factory for {@link SetupStep} record objects.
*/
export const SetupStep = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SetupStep, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SetupStep>,
});
})();
const FfiConverterTypeSetupStep = (() => {
type TypeName = SetupStep;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
status: FfiConverterTypeRuntimeCheckStatus.read(from),
detail: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterTypeRuntimeCheckStatus.write(value.status, into);
FfiConverterString.write(value.detail, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterTypeRuntimeCheckStatus.allocationSize(value.status) +
FfiConverterString.allocationSize(value.detail);
}
};
return new FFIConverter();
})();
/**
* Who may open a share.
*/
export enum ShareAccess {
/**
* Only the owner's cua.ai account, on any of the owner's devices.
*/
Private = "private",
/**
* Members of the owner's team.
*/
Team = "team",
/**
* Anyone with the link, until it expires or is stopped.
*/
Public = "public"
}
const FfiConverterTypeShareAccess = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = ShareAccess;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return ShareAccess.Private;
case 2: return ShareAccess.Team;
case 3: return ShareAccess.Public;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case ShareAccess.Private: return ordinalConverter.write(1, into);
case ShareAccess.Team: return ordinalConverter.write(2, into);
case ShareAccess.Public: return ordinalConverter.write(3, into);
}
}
allocationSize(value: TypeName): number {
return ordinalConverter.allocationSize(0);
}
}
return new FFIConverter();
})();
/**
* One share.
*/
export type Share = {
/**
* Handle for `Shares.stop` (`share-...`).
*/
id: string,
/**
* The link.
*/
url: string,
/**
* Name for lists.
*/
name?: string,
/**
* Who may open it.
*/
access: ShareAccess,
/**
* `port`, `space_port`, `file` or `dir`.
*/
kind: string,
/**
* What it serves (`port 3000`, `space:dev:3000`, a path).
*/
target: string,
/**
* The account that made it.
*/
owner: string,
/**
* When it was made (unix seconds).
*/
createdAtUnix?: bigint,
/**
* When it ends (unix seconds); none: until stopped.
*/
expiresAtUnix?: bigint,
/**
* Limits of this link worth showing next to it (for example that
* browsers cannot open it yet).
*/
notices: Array<string>
}
/**
* Generated factory for {@link Share} record objects.
*/
export const Share = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<Share, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<Share>,
});
})();
const FfiConverterTypeShare = (() => {
type TypeName = Share;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
url: FfiConverterString.read(from),
name: FfiConverterOptionalString.read(from),
access: FfiConverterTypeShareAccess.read(from),
kind: FfiConverterString.read(from),
target: FfiConverterString.read(from),
owner: FfiConverterString.read(from),
createdAtUnix: FfiConverterOptionalInt64.read(from),
expiresAtUnix: FfiConverterOptionalInt64.read(from),
notices: FfiConverterSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.url, into);
FfiConverterOptionalString.write(value.name, into);
FfiConverterTypeShareAccess.write(value.access, into);
FfiConverterString.write(value.kind, into);
FfiConverterString.write(value.target, into);
FfiConverterString.write(value.owner, into);
FfiConverterOptionalInt64.write(value.createdAtUnix, into);
FfiConverterOptionalInt64.write(value.expiresAtUnix, into);
FfiConverterSequenceString.write(value.notices, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.url) +
FfiConverterOptionalString.allocationSize(value.name) +
FfiConverterTypeShareAccess.allocationSize(value.access) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterString.allocationSize(value.target) +
FfiConverterString.allocationSize(value.owner) +
FfiConverterOptionalInt64.allocationSize(value.createdAtUnix) +
FfiConverterOptionalInt64.allocationSize(value.expiresAtUnix) +
FfiConverterSequenceString.allocationSize(value.notices);
}
};
return new FFIConverter();
})();
/**
* What opening a link once returned.
*/
export type ShareCheck = {
/**
* 2xx.
*/
ok: boolean,
/**
* HTTP status (0: the link could not be opened).
*/
status: number,
/**
* `link` (the real link, through the relay, as the owner) or `local`.
*/
via: string,
/**
* A short human line.
*/
detail: string
}
/**
* Generated factory for {@link ShareCheck} record objects.
*/
export const ShareCheck = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ShareCheck, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ShareCheck>,
});
})();
const FfiConverterTypeShareCheck = (() => {
type TypeName = ShareCheck;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
ok: FfiConverterBool.read(from),
status: FfiConverterUInt32.read(from),
via: FfiConverterString.read(from),
detail: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterBool.write(value.ok, into);
FfiConverterUInt32.write(value.status, into);
FfiConverterString.write(value.via, into);
FfiConverterString.write(value.detail, into);
}
allocationSize(value: TypeName): number {
return FfiConverterBool.allocationSize(value.ok) +
FfiConverterUInt32.allocationSize(value.status) +
FfiConverterString.allocationSize(value.via) +
FfiConverterString.allocationSize(value.detail);
}
};
return new FFIConverter();
})();
/**
* Options for [`Space::request_site_login`].
*/
export type SiteLoginOptions = {
/**
* Which saved username, when the site has several.
*/
username?: string,
/**
* The persistent agent asking (shown to the user in the approval).
*/
agent?: string,
/**
* cua-driver lifecycle session of the tab to sign in.
*/
session?: string,
/**
* cua-driver browser target id (from `get_browser_state`).
*/
targetId?: string,
/**
* cua-driver tab id (from `get_browser_state`).
*/
tabId?: string,
/**
* The request id a previous call returned (the retry after approval).
*/
requestId?: string,
/**
* Seconds to wait for the user's decision on a retry (default 20, at
* most 120).
*/
waitSecs?: number
}
/**
* Generated factory for {@link SiteLoginOptions} record objects.
*/
export const SiteLoginOptions = (() => {
const defaults = () => ({
username: undefined,
agent: undefined,
session: undefined,
targetId: undefined,
tabId: undefined,
requestId: undefined,
waitSecs: undefined
});
const create = (() => {
return uniffiCreateRecord<SiteLoginOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SiteLoginOptions>,
});
})();
const FfiConverterTypeSiteLoginOptions = (() => {
type TypeName = SiteLoginOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
username: FfiConverterOptionalString.read(from),
agent: FfiConverterOptionalString.read(from),
session: FfiConverterOptionalString.read(from),
targetId: FfiConverterOptionalString.read(from),
tabId: FfiConverterOptionalString.read(from),
requestId: FfiConverterOptionalString.read(from),
waitSecs: FfiConverterOptionalUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.username, into);
FfiConverterOptionalString.write(value.agent, into);
FfiConverterOptionalString.write(value.session, into);
FfiConverterOptionalString.write(value.targetId, into);
FfiConverterOptionalString.write(value.tabId, into);
FfiConverterOptionalString.write(value.requestId, into);
FfiConverterOptionalUInt32.write(value.waitSecs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.username) +
FfiConverterOptionalString.allocationSize(value.agent) +
FfiConverterOptionalString.allocationSize(value.session) +
FfiConverterOptionalString.allocationSize(value.targetId) +
FfiConverterOptionalString.allocationSize(value.tabId) +
FfiConverterOptionalString.allocationSize(value.requestId) +
FfiConverterOptionalUInt32.allocationSize(value.waitSecs);
}
};
return new FFIConverter();
})();
/**
* What [`Space::request_site_login`] did. Never the password.
*/
export type SiteLoginReport = {
/**
* `pending` (the user has not approved yet) or `filled`.
*/
status: string,
/**
* The Keyvault request to retry with, while pending.
*/
requestId?: string,
/**
* Site of the saved login (`github.com`), once filled.
*/
site?: string,
/**
* The origin signed in to, once filled.
*/
origin?: string,
/**
* The username, masked (`a***@example.test`).
*/
usernameHint?: string,
/**
* The form was submitted.
*/
submitted: boolean,
/**
* The tab's URL after the fill.
*/
pageUrl?: string,
/**
* The tab it signed in (cua-driver ids), to keep using it.
*/
session?: string,
/**
* See `session`.
*/
targetId?: string,
/**
* See `session`.
*/
tabId?: string
}
/**
* Generated factory for {@link SiteLoginReport} record objects.
*/
export const SiteLoginReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SiteLoginReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SiteLoginReport>,
});
})();
const FfiConverterTypeSiteLoginReport = (() => {
type TypeName = SiteLoginReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
status: FfiConverterString.read(from),
requestId: FfiConverterOptionalString.read(from),
site: FfiConverterOptionalString.read(from),
origin: FfiConverterOptionalString.read(from),
usernameHint: FfiConverterOptionalString.read(from),
submitted: FfiConverterBool.read(from),
pageUrl: FfiConverterOptionalString.read(from),
session: FfiConverterOptionalString.read(from),
targetId: FfiConverterOptionalString.read(from),
tabId: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.status, into);
FfiConverterOptionalString.write(value.requestId, into);
FfiConverterOptionalString.write(value.site, into);
FfiConverterOptionalString.write(value.origin, into);
FfiConverterOptionalString.write(value.usernameHint, into);
FfiConverterBool.write(value.submitted, into);
FfiConverterOptionalString.write(value.pageUrl, into);
FfiConverterOptionalString.write(value.session, into);
FfiConverterOptionalString.write(value.targetId, into);
FfiConverterOptionalString.write(value.tabId, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.status) +
FfiConverterOptionalString.allocationSize(value.requestId) +
FfiConverterOptionalString.allocationSize(value.site) +
FfiConverterOptionalString.allocationSize(value.origin) +
FfiConverterOptionalString.allocationSize(value.usernameHint) +
FfiConverterBool.allocationSize(value.submitted) +
FfiConverterOptionalString.allocationSize(value.pageUrl) +
FfiConverterOptionalString.allocationSize(value.session) +
FfiConverterOptionalString.allocationSize(value.targetId) +
FfiConverterOptionalString.allocationSize(value.tabId);
}
};
return new FFIConverter();
})();
/**
* A checkpoint copy's progress. Copying it to a machine that lacked it.
*/
export type SnapshotSyncProgress = {
/**
* The checkpoint.
*/
name: string,
/**
* Its digest.
*/
digest: string,
/**
* Where the bytes come from now (a machine, `s3`, `volume`).
*/
from: string,
/**
* Bytes copied.
*/
bytesDone: bigint,
/**
* Bytes to copy in all.
*/
bytesTotal: bigint,
/**
* Bytes the machine had already.
*/
bytesReused: bigint,
/**
* Finished.
*/
done: boolean,
/**
* Every file matched its SHA-256.
*/
verified: boolean
}
/**
* Generated factory for {@link SnapshotSyncProgress} record objects.
*/
export const SnapshotSyncProgress = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SnapshotSyncProgress, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SnapshotSyncProgress>,
});
})();
const FfiConverterTypeSnapshotSyncProgress = (() => {
type TypeName = SnapshotSyncProgress;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
digest: FfiConverterString.read(from),
from: FfiConverterString.read(from),
bytesDone: FfiConverterUInt64.read(from),
bytesTotal: FfiConverterUInt64.read(from),
bytesReused: FfiConverterUInt64.read(from),
done: FfiConverterBool.read(from),
verified: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.digest, into);
FfiConverterString.write(value.from, into);
FfiConverterUInt64.write(value.bytesDone, into);
FfiConverterUInt64.write(value.bytesTotal, into);
FfiConverterUInt64.write(value.bytesReused, into);
FfiConverterBool.write(value.done, into);
FfiConverterBool.write(value.verified, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.digest) +
FfiConverterString.allocationSize(value.from) +
FfiConverterUInt64.allocationSize(value.bytesDone) +
FfiConverterUInt64.allocationSize(value.bytesTotal) +
FfiConverterUInt64.allocationSize(value.bytesReused) +
FfiConverterBool.allocationSize(value.done) +
FfiConverterBool.allocationSize(value.verified);
}
};
return new FFIConverter();
})();
/**
* Options for [`Space::agent_start`] beyond the harness and prompt.
*/
export type SpaceAgentOptions = {
/**
* Provider key variables forwarded from the Spaces host's environment.
*/
envFromHost: Array<string>,
/**
* More environment for the agent, for example `HERMES_HOME` (stored
* 0600 in the run, redacted from its output; not for provider keys).
*/
env: Map<string, string>,
repo?: string,
branch?: string,
cwd?: string,
model?: string,
/**
* A custom model endpoint.
*/
baseUrl?: string,
/**
* Stop (resumably) once the prompt is answered.
*/
exitWhenIdle?: boolean,
/**
* Run as this persistent agent: its home in the Cua Volume is restored
* first and saved after every turn (see `Spaces.persistent_agent_send`).
*/
home?: string
}
/**
* Generated factory for {@link SpaceAgentOptions} record objects.
*/
export const SpaceAgentOptions = (() => {
const defaults = () => ({
envFromHost: [],
env: new Map(),
repo: undefined,
branch: undefined,
cwd: undefined,
model: undefined,
baseUrl: undefined,
exitWhenIdle: undefined,
home: undefined
});
const create = (() => {
return uniffiCreateRecord<SpaceAgentOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceAgentOptions>,
});
})();
const FfiConverterTypeSpaceAgentOptions = (() => {
type TypeName = SpaceAgentOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
envFromHost: FfiConverterSequenceString.read(from),
env: FfiConverterMapStringString.read(from),
repo: FfiConverterOptionalString.read(from),
branch: FfiConverterOptionalString.read(from),
cwd: FfiConverterOptionalString.read(from),
model: FfiConverterOptionalString.read(from),
baseUrl: FfiConverterOptionalString.read(from),
exitWhenIdle: FfiConverterOptionalBoolean.read(from),
home: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterSequenceString.write(value.envFromHost, into);
FfiConverterMapStringString.write(value.env, into);
FfiConverterOptionalString.write(value.repo, into);
FfiConverterOptionalString.write(value.branch, into);
FfiConverterOptionalString.write(value.cwd, into);
FfiConverterOptionalString.write(value.model, into);
FfiConverterOptionalString.write(value.baseUrl, into);
FfiConverterOptionalBoolean.write(value.exitWhenIdle, into);
FfiConverterOptionalString.write(value.home, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceString.allocationSize(value.envFromHost) +
FfiConverterMapStringString.allocationSize(value.env) +
FfiConverterOptionalString.allocationSize(value.repo) +
FfiConverterOptionalString.allocationSize(value.branch) +
FfiConverterOptionalString.allocationSize(value.cwd) +
FfiConverterOptionalString.allocationSize(value.model) +
FfiConverterOptionalString.allocationSize(value.baseUrl) +
FfiConverterOptionalBoolean.allocationSize(value.exitWhenIdle) +
FfiConverterOptionalString.allocationSize(value.home);
}
};
return new FFIConverter();
})();
/**
* An app icon from [`Space::app_icons`]: the icon the guest desktop uses,
* normalized by the SDK's icon cache.
*/
export type SpaceAppIcon = {
/**
* The 64 px PNG (2x), or an SVG the guest could not rasterize.
*/
bytes: ArrayBuffer,
/**
* `image/png` or `image/svg+xml`.
*/
contentType: string,
/**
* The 32 px PNG (1x); empty for an SVG.
*/
bytes1x: ArrayBuffer
}
/**
* Generated factory for {@link SpaceAppIcon} record objects.
*/
export const SpaceAppIcon = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceAppIcon, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceAppIcon>,
});
})();
const FfiConverterTypeSpaceAppIcon = (() => {
type TypeName = SpaceAppIcon;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
bytes: FfiConverterArrayBuffer.read(from),
contentType: FfiConverterString.read(from),
bytes1x: FfiConverterArrayBuffer.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterArrayBuffer.write(value.bytes, into);
FfiConverterString.write(value.contentType, into);
FfiConverterArrayBuffer.write(value.bytes1x, into);
}
allocationSize(value: TypeName): number {
return FfiConverterArrayBuffer.allocationSize(value.bytes) +
FfiConverterString.allocationSize(value.contentType) +
FfiConverterArrayBuffer.allocationSize(value.bytes1x);
}
};
return new FFIConverter();
})();
/**
* One window's app, for [`Space::app_icons`].
*/
export type SpaceAppIconRequest = {
/**
* App name, as the window list reports it.
*/
appName: string,
/**
* App id (bundle id, `.desktop` id).
*/
appId: string,
/**
* A process of the app (0 when unknown).
*/
pid: number
}
/**
* Generated factory for {@link SpaceAppIconRequest} record objects.
*/
export const SpaceAppIconRequest = (() => {
const defaults = () => ({
appId: "",
pid: 0
});
const create = (() => {
return uniffiCreateRecord<SpaceAppIconRequest, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceAppIconRequest>,
});
})();
const FfiConverterTypeSpaceAppIconRequest = (() => {
type TypeName = SpaceAppIconRequest;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
appName: FfiConverterString.read(from),
appId: FfiConverterString.read(from),
pid: FfiConverterUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.appName, into);
FfiConverterString.write(value.appId, into);
FfiConverterUInt32.write(value.pid, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.appName) +
FfiConverterString.allocationSize(value.appId) +
FfiConverterUInt32.allocationSize(value.pid);
}
};
return new FFIConverter();
})();
/**
* Output of [`Space::bash`].
*/
export type SpaceBashResult = {
/**
* Stdout.
*/
stdout: string,
/**
* Stderr.
*/
stderr: string,
/**
* Exit code (absent when signalled or timed out).
*/
exitCode?: number,
/**
* Signal name, when killed by one.
*/
signal?: string,
/**
* Hit the timeout.
*/
timedOut: boolean,
/**
* Launch error.
*/
error?: string,
/**
* The `space_bash` tool text (`stdout`, `[stderr]`, `[exit N]`).
*/
rendered: string
}
/**
* Generated factory for {@link SpaceBashResult} record objects.
*/
export const SpaceBashResult = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceBashResult, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceBashResult>,
});
})();
const FfiConverterTypeSpaceBashResult = (() => {
type TypeName = SpaceBashResult;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
stdout: FfiConverterString.read(from),
stderr: FfiConverterString.read(from),
exitCode: FfiConverterOptionalInt32.read(from),
signal: FfiConverterOptionalString.read(from),
timedOut: FfiConverterBool.read(from),
error: FfiConverterOptionalString.read(from),
rendered: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.stdout, into);
FfiConverterString.write(value.stderr, into);
FfiConverterOptionalInt32.write(value.exitCode, into);
FfiConverterOptionalString.write(value.signal, into);
FfiConverterBool.write(value.timedOut, into);
FfiConverterOptionalString.write(value.error, into);
FfiConverterString.write(value.rendered, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.stdout) +
FfiConverterString.allocationSize(value.stderr) +
FfiConverterOptionalInt32.allocationSize(value.exitCode) +
FfiConverterOptionalString.allocationSize(value.signal) +
FfiConverterBool.allocationSize(value.timedOut) +
FfiConverterOptionalString.allocationSize(value.error) +
FfiConverterString.allocationSize(value.rendered);
}
};
return new FFIConverter();
})();
/**
* What [`Spaces::cancel_create`] did.
*/
export type SpaceCancelOutcome = {
/**
* The Space id the create had (`local:<name>`), when known.
*/
id: string,
/**
* `cancelled`, `not_creating` (nothing by that key is running) or
* `already_created` (it finished: delete it instead).
*/
state: string,
/**
* What was removed and what stays, for people.
*/
message: string
}
/**
* Generated factory for {@link SpaceCancelOutcome} record objects.
*/
export const SpaceCancelOutcome = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceCancelOutcome, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceCancelOutcome>,
});
})();
const FfiConverterTypeSpaceCancelOutcome = (() => {
type TypeName = SpaceCancelOutcome;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
state: FfiConverterString.read(from),
message: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.state, into);
FfiConverterString.write(value.message, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.state) +
FfiConverterString.allocationSize(value.message);
}
};
return new FFIConverter();
})();
/**
* A named volume of Cua Volume mounted in a Space: the folder
* `volumes/<name>/` (or `subpath` inside it) appears at `path`.
*
* Linux Spaces of every kind (containers, microVMs, VMs) bind-mount it;
* a macOS Space gets a symbolic link to the folder (its writes are
* refused when `read_only`, by the volume's access rules, though the link
* itself is not read-only). The Space sees only the volumes it mounted.
*/
export type VolumeMount = {
/**
* The volume's name ([`Spaces::create_volume`]): 1 to 63 of `a-z`,
* `0-9`, `.`, `_`, `-`.
*/
name: string,
/**
* Where it appears in the Space (absolute, for example `/mnt/shared`).
*/
path: string,
/**
* Mounted read-only: writes fail.
*/
readOnly: boolean,
/**
* A folder inside the volume to mount instead of all of it (relative).
*/
subpath: string
}
/**
* Generated factory for {@link VolumeMount} record objects.
*/
export const VolumeMount = (() => {
const defaults = () => ({
readOnly: false,
subpath: ""
});
const create = (() => {
return uniffiCreateRecord<VolumeMount, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<VolumeMount>,
});
})();
const FfiConverterTypeVolumeMount = (() => {
type TypeName = VolumeMount;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
path: FfiConverterString.read(from),
readOnly: FfiConverterBool.read(from),
subpath: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.path, into);
FfiConverterBool.write(value.readOnly, into);
FfiConverterString.write(value.subpath, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.path) +
FfiConverterBool.allocationSize(value.readOnly) +
FfiConverterString.allocationSize(value.subpath);
}
};
return new FFIConverter();
})();
/**
* Options for [`Spaces::create`]: the same location / kind / runtime model
* as sandboxes.
*/
export type SpaceCreateOptions = {
/**
* Image (default: the canonical Linux image). `checkpoint:<name>`
* starts a fork of that checkpoint, on whichever of your machines
* holds it ([`CheckpointSummary::host`]): its disk, memory and
* processes, so no command, environment, services, GPU or disk size.
*/
image?: string,
/**
* Where: `local` (free), a connected cloud account (`aws`, `gcp`,
* `modal`) or `host:<name>`. `None`: the user default (`default.on`,
* `CUA_DEFAULT_ON`, else `local`); for a `checkpoint:` image, where the
* checkpoint is. A checkpoint also starts on `host:<machine>` or
* `auto`, copied there first when that machine lacks it.
*/
on?: string,
/**
* `auto` (default), `container`, `vm` or `microvm`.
*/
kind?: string,
/**
* `auto` (default) or an engine the location offers for the kind.
*/
runtime?: string,
/**
* Name (default `space-<hex>`).
*/
name?: string,
/**
* vCPUs. Local default 2.
*/
cpus?: number,
/**
* Memory in MiB. Local default 4096.
*/
memoryMb?: bigint,
/**
* Grow the VM's disk to this many GiB (local VMs; default: the
* image's size, never smaller). Lume grows the macOS APFS container
* before the first boot; Linux images grow their root partition at
* boot. Containers and cloud Spaces refuse it.
*/
diskGb?: number,
/**
* Readiness budget (local; default 600 s).
*/
timeoutMs?: bigint,
/**
* Wait until ready (default true).
*/
wait?: boolean,
/**
* Return a reachable registered Space in the same location with the
* requested services instead of creating one.
*/
reuse: boolean,
/**
* Entrypoint override.
*/
command?: Array<string>,
/**
* Guest environment.
*/
env: Map<string, string>,
/**
* Named services (name → guest port), for example `{"mcp": 8765}`.
*/
services: Map<string, number>,
/**
* Whether the image runs cua-spacesd (default: yes for the canonical
* images; any other image gets a static one injected on a local
* container or microVM, so it is a full Space; `false` runs the image
* as it is).
*/
spacesd?: boolean,
/**
* A GPU option of the runtime the Space runs on
* ([`Spaces::gpu_support`]): `paravirtual` for a macOS VM on Lume (GPU
* acceleration, experimental), `virgl` (QEMU on Linux), `nvidia` (a
* runc container on Linux); `auto` picks the runtime's own. `None`
* (the default): no GPU. Kept with the Space.
*/
gpu?: string,
/**
* Your own key for this create (an app's pending row), for
* [`Spaces::cancel_create`] before the Space's id is known.
*/
createId?: string,
/**
* Keep the Space on your machines (`on` "auto"): when its machine goes
* away it is created again on another one, with the same name (its
* disk starts fresh). Needs the cua daemon of Cua Spaces and an
* account with machines that provide Spaces.
*/
durable: boolean,
/**
* A size profile: defaults for what is left unset. `"rollout"`: 1
* vCPU, 1024 MiB and `headless` (a local VM gets no display hardware,
* so many more fit on one machine), for RL rollouts and agent episodes
* that mostly wait. `None` or `"default"`: 2 vCPUs, 4096 MiB.
*/
profile?: string,
/**
* A Space without a desktop: only cua-spacesd runs (exec, files,
* processes, MCP), with no display, window manager or audio. For shell
* and RL workloads it starts several times faster and fits many more
* per machine. `None`: what `profile` says (a desktop by default).
*/
headless?: boolean,
/**
* A fork source (a "bake" Space): a local QEMU VM's guest RAM is a
* shared file, so its checkpoints ([`Space::checkpoint`]) take
* milliseconds and forks of them ([`Space::fork`], [`Spaces::fork`])
* share its pages. Other kinds ignore it. `None` (the default): not
* one.
*/
forkable?: boolean,
/**
* Build an image first (cached when unchanged), then fork the result.
* `image` must be unset.
*/
build?: BuildOptions,
/**
* Named volumes of Cua Volume to mount in the Space
* ([`Spaces::create_volume`]): each appears at its `path`, read-write
* or read-only; the Space sees no other volume. Needs the Cua Volume
* (Cua Spaces) and a guest that can mount it; the create fails
* otherwise, naming what is missing. A fork mounts the same volumes.
*/
volumes: Array<VolumeMount>,
/**
* Guest network: `default` (unset) gives outbound network; `none`
* gives none (QEMU VMs, here or on one of your machines; published
* ports and cua-spacesd still reach the guest). Not with `durable` or
* `reuse`. A daemon or machine whose cua is too old to enforce `none`
* is refused (`CapabilityMissing`) and the Space it made is deleted.
*/
network?: string,
/**
* Labels kept with the Space and returned in `SpaceInfo.labels`: at
* most 64; keys and values are not empty (UTF-8); keys up to 63 bytes,
* values up to 256. Not with `durable` or `reuse`. The device that
* creates the Space keeps them (also for `host:` and `auto`).
*/
labels: Map<string, string>,
/**
* Egress policy (see [`EgressPolicy`]), enforced by the host the Space
* runs on from the guest's first instruction. A kind or location with
* no host-side point refuses it (`Unsupported`) before anything is
* created. Not with `durable`, `reuse` or `wait = false`; a daemon too old
* to enforce it makes the create fail.
*/
egress?: EgressPolicy,
/**
* With `on` a linked cloud (`aws`, `hetzner`, ...): the machine type
* its host must be (`c7g.xlarge`, `cax41`), a pin of the elastic
* pool's solve. `None`: the pool picks the cheapest that fits.
*/
instanceType?: string,
/**
* With `on` a linked cloud: the region its host must be in.
*/
region?: string
}
/**
* Generated factory for {@link SpaceCreateOptions} record objects.
*/
export const SpaceCreateOptions = (() => {
const defaults = () => ({
image: undefined,
on: undefined,
kind: undefined,
runtime: undefined,
name: undefined,
cpus: undefined,
memoryMb: undefined,
diskGb: undefined,
timeoutMs: undefined,
wait: undefined,
reuse: false,
command: undefined,
env: new Map(),
services: new Map(),
spacesd: undefined,
gpu: undefined,
createId: undefined,
durable: false,
profile: undefined,
headless: undefined,
forkable: undefined,
build: undefined,
volumes: [],
network: undefined,
labels: new Map(),
egress: undefined,
instanceType: undefined,
region: undefined
});
const create = (() => {
return uniffiCreateRecord<SpaceCreateOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceCreateOptions>,
});
})();
const FfiConverterTypeSpaceCreateOptions = (() => {
type TypeName = SpaceCreateOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
image: FfiConverterOptionalString.read(from),
on: FfiConverterOptionalString.read(from),
kind: FfiConverterOptionalString.read(from),
runtime: FfiConverterOptionalString.read(from),
name: FfiConverterOptionalString.read(from),
cpus: FfiConverterOptionalUInt32.read(from),
memoryMb: FfiConverterOptionalUInt64.read(from),
diskGb: FfiConverterOptionalUInt32.read(from),
timeoutMs: FfiConverterOptionalUInt64.read(from),
wait: FfiConverterOptionalBoolean.read(from),
reuse: FfiConverterBool.read(from),
command: FfiConverterOptionalSequenceString.read(from),
env: FfiConverterMapStringString.read(from),
services: FfiConverterMapStringUInt16.read(from),
spacesd: FfiConverterOptionalBoolean.read(from),
gpu: FfiConverterOptionalString.read(from),
createId: FfiConverterOptionalString.read(from),
durable: FfiConverterBool.read(from),
profile: FfiConverterOptionalString.read(from),
headless: FfiConverterOptionalBoolean.read(from),
forkable: FfiConverterOptionalBoolean.read(from),
build: FfiConverterOptionalTypeBuildOptions.read(from),
volumes: FfiConverterSequenceTypeVolumeMount.read(from),
network: FfiConverterOptionalString.read(from),
labels: FfiConverterMapStringString.read(from),
egress: FfiConverterOptionalTypeEgressPolicy.read(from),
instanceType: FfiConverterOptionalString.read(from),
region: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.image, into);
FfiConverterOptionalString.write(value.on, into);
FfiConverterOptionalString.write(value.kind, into);
FfiConverterOptionalString.write(value.runtime, into);
FfiConverterOptionalString.write(value.name, into);
FfiConverterOptionalUInt32.write(value.cpus, into);
FfiConverterOptionalUInt64.write(value.memoryMb, into);
FfiConverterOptionalUInt32.write(value.diskGb, into);
FfiConverterOptionalUInt64.write(value.timeoutMs, into);
FfiConverterOptionalBoolean.write(value.wait, into);
FfiConverterBool.write(value.reuse, into);
FfiConverterOptionalSequenceString.write(value.command, into);
FfiConverterMapStringString.write(value.env, into);
FfiConverterMapStringUInt16.write(value.services, into);
FfiConverterOptionalBoolean.write(value.spacesd, into);
FfiConverterOptionalString.write(value.gpu, into);
FfiConverterOptionalString.write(value.createId, into);
FfiConverterBool.write(value.durable, into);
FfiConverterOptionalString.write(value.profile, into);
FfiConverterOptionalBoolean.write(value.headless, into);
FfiConverterOptionalBoolean.write(value.forkable, into);
FfiConverterOptionalTypeBuildOptions.write(value.build, into);
FfiConverterSequenceTypeVolumeMount.write(value.volumes, into);
FfiConverterOptionalString.write(value.network, into);
FfiConverterMapStringString.write(value.labels, into);
FfiConverterOptionalTypeEgressPolicy.write(value.egress, into);
FfiConverterOptionalString.write(value.instanceType, into);
FfiConverterOptionalString.write(value.region, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.image) +
FfiConverterOptionalString.allocationSize(value.on) +
FfiConverterOptionalString.allocationSize(value.kind) +
FfiConverterOptionalString.allocationSize(value.runtime) +
FfiConverterOptionalString.allocationSize(value.name) +
FfiConverterOptionalUInt32.allocationSize(value.cpus) +
FfiConverterOptionalUInt64.allocationSize(value.memoryMb) +
FfiConverterOptionalUInt32.allocationSize(value.diskGb) +
FfiConverterOptionalUInt64.allocationSize(value.timeoutMs) +
FfiConverterOptionalBoolean.allocationSize(value.wait) +
FfiConverterBool.allocationSize(value.reuse) +
FfiConverterOptionalSequenceString.allocationSize(value.command) +
FfiConverterMapStringString.allocationSize(value.env) +
FfiConverterMapStringUInt16.allocationSize(value.services) +
FfiConverterOptionalBoolean.allocationSize(value.spacesd) +
FfiConverterOptionalString.allocationSize(value.gpu) +
FfiConverterOptionalString.allocationSize(value.createId) +
FfiConverterBool.allocationSize(value.durable) +
FfiConverterOptionalString.allocationSize(value.profile) +
FfiConverterOptionalBoolean.allocationSize(value.headless) +
FfiConverterOptionalBoolean.allocationSize(value.forkable) +
FfiConverterOptionalTypeBuildOptions.allocationSize(value.build) +
FfiConverterSequenceTypeVolumeMount.allocationSize(value.volumes) +
FfiConverterOptionalString.allocationSize(value.network) +
FfiConverterMapStringString.allocationSize(value.labels) +
FfiConverterOptionalTypeEgressPolicy.allocationSize(value.egress) +
FfiConverterOptionalString.allocationSize(value.instanceType) +
FfiConverterOptionalString.allocationSize(value.region);
}
};
return new FFIConverter();
})();
/**
* What a Space create is doing (see [`Spaces::create_with_progress`]).
*/
export type SpaceCreateProgress = {
/**
* `preparing`, `pulling`, `creating`, `booting`,
* `waiting_for_services`, `connecting` or `ready`, in that order.
*/
phase: string,
/**
* How far through the phase, 0.0 to 1.0, when its size is known (an
* image pull).
*/
fraction?: number,
/**
* One short line, for example the image being pulled.
*/
detail: string,
/**
* Bytes downloaded so far, when the step counts them (an image pull).
*/
bytesDone?: bigint,
/**
* Bytes the download has in all.
*/
bytesTotal?: bigint,
/**
* Smoothed download rate, bytes per second (time left: the bytes to
* go over it).
*/
bytesPerSecond?: number,
/**
* The id the Space will have (`local:<name>`), for
* [`Spaces::cancel_create`].
*/
space: string
}
/**
* Generated factory for {@link SpaceCreateProgress} record objects.
*/
export const SpaceCreateProgress = (() => {
const defaults = () => ({
bytesDone: undefined,
bytesTotal: undefined,
bytesPerSecond: undefined,
space: ""
});
const create = (() => {
return uniffiCreateRecord<SpaceCreateProgress, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceCreateProgress>,
});
})();
const FfiConverterTypeSpaceCreateProgress = (() => {
type TypeName = SpaceCreateProgress;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
phase: FfiConverterString.read(from),
fraction: FfiConverterOptionalFloat64.read(from),
detail: FfiConverterString.read(from),
bytesDone: FfiConverterOptionalUInt64.read(from),
bytesTotal: FfiConverterOptionalUInt64.read(from),
bytesPerSecond: FfiConverterOptionalFloat64.read(from),
space: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.phase, into);
FfiConverterOptionalFloat64.write(value.fraction, into);
FfiConverterString.write(value.detail, into);
FfiConverterOptionalUInt64.write(value.bytesDone, into);
FfiConverterOptionalUInt64.write(value.bytesTotal, into);
FfiConverterOptionalFloat64.write(value.bytesPerSecond, into);
FfiConverterString.write(value.space, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.phase) +
FfiConverterOptionalFloat64.allocationSize(value.fraction) +
FfiConverterString.allocationSize(value.detail) +
FfiConverterOptionalUInt64.allocationSize(value.bytesDone) +
FfiConverterOptionalUInt64.allocationSize(value.bytesTotal) +
FfiConverterOptionalFloat64.allocationSize(value.bytesPerSecond) +
FfiConverterString.allocationSize(value.space);
}
};
return new FFIConverter();
})();
/**
* Where a Space's egress policy is enforced ([`SpaceInfo::egress_enforced`]).
*/
export enum EgressEnforcement {
/**
* By the host the Space runs on, outside the guest: nothing in the
* guest, root included, can change it.
*/
Host = "host"
}
const FfiConverterTypeEgressEnforcement = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = EgressEnforcement;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return EgressEnforcement.Host;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case EgressEnforcement.Host: return ordinalConverter.write(1, into);
}
}
allocationSize(value: TypeName): number {
return ordinalConverter.allocationSize(0);
}
}
return new FFIConverter();
})();
/**
* A registered Space.
*/
export type SpaceInfo = {
/**
* Id, for example `direct:10.0.0.5:3211` or `cloud:<name>` (the
* sandbox ref scheme).
*/
id: string,
/**
* Display name.
*/
name: string,
/**
* `cloud`, `local`, `direct` or `relay` (the location words).
*/
provider: string,
/**
* spacesd version at the last handshake.
*/
spacesdVersion: string,
/**
* Supported features at the last handshake.
*/
features: Array<string>,
/**
* Guest OS family at the last handshake: `linux`, `macos`, `windows`,
* or empty when not reported.
*/
os: string,
/**
* Guest OS product or distribution at the last handshake ("Ubuntu",
* "macOS"), or empty when not reported.
*/
osName: string,
/**
* The guest's full OS string at the last handshake ("Ubuntu 24.04.3
* LTS", "macOS 26.5.2 (25F84)"), or empty from older drivers.
*/
osPrettyName: string,
/**
* The image the sandbox runs ("ghcr.io/trycua/linux:24.04"), or empty
* when unknown (a Space added by address).
*/
image: string,
/**
* The digest of the variant that runs ("sha256:..."), or empty.
*/
imageDigest: string,
/**
* `container`, `vm` or `microvm`, or empty when unknown.
*/
kind: string,
/**
* The guest's CPU architecture (`arm64`, `amd64`), or empty when
* unknown.
*/
arch: string,
/**
* Declared services (never `env`), reachable with `list_tools` /
* `call_tool` (`service`). A Space without cua-spacesd has an empty
* `features` list and only these.
*/
services: Array<string>,
/**
* When it was added (RFC 3339).
*/
addedAt?: string,
/**
* For a Space one of your machines provides (created with
* `on="host:<machine>"`): that host's relay machine id; empty
* otherwise. Lists group these Spaces under their host.
*/
host: string,
/**
* The host's display name, when known.
*/
hostName: string,
/**
* How it turns off and on again ([`Spaces::stop`], [`Spaces::start`]):
* `suspend` (its memory is kept), `stop` (its disk is kept), or empty
* when it cannot (a cloud Space, a Space added by address).
*/
power: string,
/**
* `running`, `suspended` or `stopped` as cua last recorded it; empty
* when unknown (a Space one of your machines provides answers while it
* runs).
*/
powerState: string,
/**
* A Space in your own cloud: the provider (`aws`, `gcp`, `hetzner`, `modal`);
* empty otherwise.
*/
cloud: string,
/**
* Where it runs ("AWS · us-west-2").
*/
cloudPlace: string,
/**
* How `delete` would delete it permanently from here: `here` (this
* device created it), `host:<machine>` (the device that created it,
* through the relay) or `elsewhere` (only there; `remove` keeps it).
* Empty for other Spaces.
*/
cloudDelete: string,
/**
* A durable Space (`SpaceCreateOptions.durable`): its name. It is
* created again on another of your machines when its machine goes
* away, and keeps this name. Empty for other Spaces.
*/
durable: string,
/**
* Why a local Space stopped without being asked to, in plain words
* ("out of memory", "killed", "exited with code 1"); empty otherwise,
* and once it is started again.
*/
stopReason: string,
/**
* Labels set at create (`SpaceCreateOptions.labels`).
*/
labels: Map<string, string>,
/**
* When the Space ends (Unix seconds), as set by
* [`Spaces::set_lifetime`]; 0 when it has none.
*/
expiresAtUnix: bigint,
/**
* What happens then: `delete` or `suspend`; empty without a lifetime.
*/
onExpire: string,
/**
* When the Space was created (Unix seconds; the time it was added, for
* a Space added by address); 0 when unknown.
*/
createdAtUnix: bigint,
/**
* The egress policy last set on the Space; empty when it has none.
*/
egress: EgressPolicy,
/**
* Where `egress` is enforced; `None` without one.
*/
egressEnforced?: EgressEnforcement,
/**
* Named volumes mounted in the Space (see
* [`SpaceCreateOptions::volumes`]).
*/
volumes: Array<VolumeMount>
}
/**
* Generated factory for {@link SpaceInfo} record objects.
*/
export const SpaceInfo = (() => {
const defaults = () => ({
durable: "",
stopReason: "",
});
const create = (() => {
return uniffiCreateRecord<SpaceInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceInfo>,
});
})();
const FfiConverterTypeSpaceInfo = (() => {
type TypeName = SpaceInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
name: FfiConverterString.read(from),
provider: FfiConverterString.read(from),
spacesdVersion: FfiConverterString.read(from),
features: FfiConverterSequenceString.read(from),
os: FfiConverterString.read(from),
osName: FfiConverterString.read(from),
osPrettyName: FfiConverterString.read(from),
image: FfiConverterString.read(from),
imageDigest: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
arch: FfiConverterString.read(from),
services: FfiConverterSequenceString.read(from),
addedAt: FfiConverterOptionalString.read(from),
host: FfiConverterString.read(from),
hostName: FfiConverterString.read(from),
power: FfiConverterString.read(from),
powerState: FfiConverterString.read(from),
cloud: FfiConverterString.read(from),
cloudPlace: FfiConverterString.read(from),
cloudDelete: FfiConverterString.read(from),
durable: FfiConverterString.read(from),
stopReason: FfiConverterString.read(from),
labels: FfiConverterMapStringString.read(from),
expiresAtUnix: FfiConverterInt64.read(from),
onExpire: FfiConverterString.read(from),
createdAtUnix: FfiConverterInt64.read(from),
egress: FfiConverterTypeEgressPolicy.read(from),
egressEnforced: FfiConverterOptionalTypeEgressEnforcement.read(from),
volumes: FfiConverterSequenceTypeVolumeMount.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.provider, into);
FfiConverterString.write(value.spacesdVersion, into);
FfiConverterSequenceString.write(value.features, into);
FfiConverterString.write(value.os, into);
FfiConverterString.write(value.osName, into);
FfiConverterString.write(value.osPrettyName, into);
FfiConverterString.write(value.image, into);
FfiConverterString.write(value.imageDigest, into);
FfiConverterString.write(value.kind, into);
FfiConverterString.write(value.arch, into);
FfiConverterSequenceString.write(value.services, into);
FfiConverterOptionalString.write(value.addedAt, into);
FfiConverterString.write(value.host, into);
FfiConverterString.write(value.hostName, into);
FfiConverterString.write(value.power, into);
FfiConverterString.write(value.powerState, into);
FfiConverterString.write(value.cloud, into);
FfiConverterString.write(value.cloudPlace, into);
FfiConverterString.write(value.cloudDelete, into);
FfiConverterString.write(value.durable, into);
FfiConverterString.write(value.stopReason, into);
FfiConverterMapStringString.write(value.labels, into);
FfiConverterInt64.write(value.expiresAtUnix, into);
FfiConverterString.write(value.onExpire, into);
FfiConverterInt64.write(value.createdAtUnix, into);
FfiConverterTypeEgressPolicy.write(value.egress, into);
FfiConverterOptionalTypeEgressEnforcement.write(value.egressEnforced, into);
FfiConverterSequenceTypeVolumeMount.write(value.volumes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.provider) +
FfiConverterString.allocationSize(value.spacesdVersion) +
FfiConverterSequenceString.allocationSize(value.features) +
FfiConverterString.allocationSize(value.os) +
FfiConverterString.allocationSize(value.osName) +
FfiConverterString.allocationSize(value.osPrettyName) +
FfiConverterString.allocationSize(value.image) +
FfiConverterString.allocationSize(value.imageDigest) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterString.allocationSize(value.arch) +
FfiConverterSequenceString.allocationSize(value.services) +
FfiConverterOptionalString.allocationSize(value.addedAt) +
FfiConverterString.allocationSize(value.host) +
FfiConverterString.allocationSize(value.hostName) +
FfiConverterString.allocationSize(value.power) +
FfiConverterString.allocationSize(value.powerState) +
FfiConverterString.allocationSize(value.cloud) +
FfiConverterString.allocationSize(value.cloudPlace) +
FfiConverterString.allocationSize(value.cloudDelete) +
FfiConverterString.allocationSize(value.durable) +
FfiConverterString.allocationSize(value.stopReason) +
FfiConverterMapStringString.allocationSize(value.labels) +
FfiConverterInt64.allocationSize(value.expiresAtUnix) +
FfiConverterString.allocationSize(value.onExpire) +
FfiConverterInt64.allocationSize(value.createdAtUnix) +
FfiConverterTypeEgressPolicy.allocationSize(value.egress) +
FfiConverterOptionalTypeEgressEnforcement.allocationSize(value.egressEnforced) +
FfiConverterSequenceTypeVolumeMount.allocationSize(value.volumes);
}
};
return new FFIConverter();
})();
/**
* Result of [`Spaces::create`].
*/
export type SpaceCreateResult = {
/**
* The Space, once ready.
*/
space?: SpaceInfo,
/**
* With `wait = false`: the id the Space will have.
*/
pendingId?: string,
/**
* `reuse` returned an existing Space.
*/
reused: boolean
}
/**
* Generated factory for {@link SpaceCreateResult} record objects.
*/
export const SpaceCreateResult = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceCreateResult, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceCreateResult>,
});
})();
const FfiConverterTypeSpaceCreateResult = (() => {
type TypeName = SpaceCreateResult;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
space: FfiConverterOptionalTypeSpaceInfo.read(from),
pendingId: FfiConverterOptionalString.read(from),
reused: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalTypeSpaceInfo.write(value.space, into);
FfiConverterOptionalString.write(value.pendingId, into);
FfiConverterBool.write(value.reused, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalTypeSpaceInfo.allocationSize(value.space) +
FfiConverterOptionalString.allocationSize(value.pendingId) +
FfiConverterBool.allocationSize(value.reused);
}
};
return new FFIConverter();
})();
/**
* One of a Space's displays ([`Space::displays`]).
*/
export type SpaceDisplay = {
/**
* Display id.
*/
id: string,
/**
* Name ("XVFB-0", "Built-in Retina Display").
*/
name: string,
/**
* The primary display.
*/
primary: boolean,
/**
* Framebuffer width in physical pixels.
*/
widthPx: number,
/**
* Framebuffer height in physical pixels.
*/
heightPx: number,
/**
* Physical pixels per logical point.
*/
scaleFactor: number
}
/**
* Generated factory for {@link SpaceDisplay} record objects.
*/
export const SpaceDisplay = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceDisplay, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceDisplay>,
});
})();
const FfiConverterTypeSpaceDisplay = (() => {
type TypeName = SpaceDisplay;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
name: FfiConverterString.read(from),
primary: FfiConverterBool.read(from),
widthPx: FfiConverterUInt32.read(from),
heightPx: FfiConverterUInt32.read(from),
scaleFactor: FfiConverterFloat64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.name, into);
FfiConverterBool.write(value.primary, into);
FfiConverterUInt32.write(value.widthPx, into);
FfiConverterUInt32.write(value.heightPx, into);
FfiConverterFloat64.write(value.scaleFactor, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.name) +
FfiConverterBool.allocationSize(value.primary) +
FfiConverterUInt32.allocationSize(value.widthPx) +
FfiConverterUInt32.allocationSize(value.heightPx) +
FfiConverterFloat64.allocationSize(value.scaleFactor);
}
};
return new FFIConverter();
})();
/**
* Hotspot state.
*/
export type SpaceHotspotStatus = {
/**
* Space.
*/
space: string,
/**
* `stopped`, `waiting_for_peer` or `active`.
*/
state: string,
/**
* Hotspot id.
*/
hotspotId: string,
/**
* Guest SOCKS address.
*/
socksAddress: string,
/**
* Open relayed connections.
*/
activeConnections: number,
/**
* Bytes out of the guest.
*/
bytesOut: bigint,
/**
* Bytes into the guest.
*/
bytesIn: bigint,
/**
* Served by the process that owns the Spaces runtime.
*/
servedHere: boolean
}
/**
* Generated factory for {@link SpaceHotspotStatus} record objects.
*/
export const SpaceHotspotStatus = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceHotspotStatus, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceHotspotStatus>,
});
})();
const FfiConverterTypeSpaceHotspotStatus = (() => {
type TypeName = SpaceHotspotStatus;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
space: FfiConverterString.read(from),
state: FfiConverterString.read(from),
hotspotId: FfiConverterString.read(from),
socksAddress: FfiConverterString.read(from),
activeConnections: FfiConverterUInt32.read(from),
bytesOut: FfiConverterUInt64.read(from),
bytesIn: FfiConverterUInt64.read(from),
servedHere: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.space, into);
FfiConverterString.write(value.state, into);
FfiConverterString.write(value.hotspotId, into);
FfiConverterString.write(value.socksAddress, into);
FfiConverterUInt32.write(value.activeConnections, into);
FfiConverterUInt64.write(value.bytesOut, into);
FfiConverterUInt64.write(value.bytesIn, into);
FfiConverterBool.write(value.servedHere, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.space) +
FfiConverterString.allocationSize(value.state) +
FfiConverterString.allocationSize(value.hotspotId) +
FfiConverterString.allocationSize(value.socksAddress) +
FfiConverterUInt32.allocationSize(value.activeConnections) +
FfiConverterUInt64.allocationSize(value.bytesOut) +
FfiConverterUInt64.allocationSize(value.bytesIn) +
FfiConverterBool.allocationSize(value.servedHere);
}
};
return new FFIConverter();
})();
/**
* What [`Spaces::stop`] or [`Spaces::start`] did.
*/
export type SpacePowerReport = {
/**
* The Space.
*/
space: string,
/**
* `running`, `suspended` or `stopped`: the state it is in now.
*/
state: string,
/**
* How it turns off: `suspend` (its memory is kept) or `stop` (its
* disk is kept).
*/
power: string,
/**
* What happened, for people.
*/
message: string
}
/**
* Generated factory for {@link SpacePowerReport} record objects.
*/
export const SpacePowerReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpacePowerReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpacePowerReport>,
});
})();
const FfiConverterTypeSpacePowerReport = (() => {
type TypeName = SpacePowerReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
space: FfiConverterString.read(from),
state: FfiConverterString.read(from),
power: FfiConverterString.read(from),
message: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.space, into);
FfiConverterString.write(value.state, into);
FfiConverterString.write(value.power, into);
FfiConverterString.write(value.message, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.space) +
FfiConverterString.allocationSize(value.state) +
FfiConverterString.allocationSize(value.power) +
FfiConverterString.allocationSize(value.message);
}
};
return new FFIConverter();
})();
/**
* A Space published on the relay ([`Spaces::relay_register`]).
*/
export type SpaceRelayRegistration = {
/**
* The Space.
*/
space: string,
/**
* How the account's other devices reach it: `relay:<machine>`.
*/
relaySpace: string,
/**
* The relay machine id.
*/
machine: string,
/**
* The relay URL of the machine.
*/
url: string,
/**
* Connected to the relay now.
*/
online: boolean
}
/**
* Generated factory for {@link SpaceRelayRegistration} record objects.
*/
export const SpaceRelayRegistration = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceRelayRegistration, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceRelayRegistration>,
});
})();
const FfiConverterTypeSpaceRelayRegistration = (() => {
type TypeName = SpaceRelayRegistration;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
space: FfiConverterString.read(from),
relaySpace: FfiConverterString.read(from),
machine: FfiConverterString.read(from),
url: FfiConverterString.read(from),
online: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.space, into);
FfiConverterString.write(value.relaySpace, into);
FfiConverterString.write(value.machine, into);
FfiConverterString.write(value.url, into);
FfiConverterBool.write(value.online, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.space) +
FfiConverterString.allocationSize(value.relaySpace) +
FfiConverterString.allocationSize(value.machine) +
FfiConverterString.allocationSize(value.url) +
FfiConverterBool.allocationSize(value.online);
}
};
return new FFIConverter();
})();
/**
* Options for [`Space::send_file`].
*/
export type SpaceSendFileOptions = {
/**
* Downloads subdirectory (`None` = `~/Downloads`), or a `~/Downloads/…`
* path.
*/
targetDirectory?: string,
/**
* Honor ignore files when sending a folder.
*/
respectIgnoreFiles: boolean,
/**
* When a file of the same name is already there: `rename` (default,
* keeps both as `name (1).ext`), `skip`, or `overwrite` to replace it.
*/
conflict?: string
}
/**
* Generated factory for {@link SpaceSendFileOptions} record objects.
*/
export const SpaceSendFileOptions = (() => {
const defaults = () => ({
targetDirectory: undefined,
respectIgnoreFiles: true,
conflict: undefined
});
const create = (() => {
return uniffiCreateRecord<SpaceSendFileOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceSendFileOptions>,
});
})();
const FfiConverterTypeSpaceSendFileOptions = (() => {
type TypeName = SpaceSendFileOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
targetDirectory: FfiConverterOptionalString.read(from),
respectIgnoreFiles: FfiConverterBool.read(from),
conflict: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.targetDirectory, into);
FfiConverterBool.write(value.respectIgnoreFiles, into);
FfiConverterOptionalString.write(value.conflict, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.targetDirectory) +
FfiConverterBool.allocationSize(value.respectIgnoreFiles) +
FfiConverterOptionalString.allocationSize(value.conflict);
}
};
return new FFIConverter();
})();
/**
* One file placed by [`Space::send_file`].
*/
export type SpaceSentFile = {
/**
* Guest path.
*/
path: string,
/**
* Bytes.
*/
size: bigint,
/**
* SHA-256, verified on both ends.
*/
sha256: string
}
/**
* Generated factory for {@link SpaceSentFile} record objects.
*/
export const SpaceSentFile = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceSentFile, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceSentFile>,
});
})();
const FfiConverterTypeSpaceSentFile = (() => {
type TypeName = SpaceSentFile;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
path: FfiConverterString.read(from),
size: FfiConverterUInt64.read(from),
sha256: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.path, into);
FfiConverterUInt64.write(value.size, into);
FfiConverterString.write(value.sha256, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.path) +
FfiConverterUInt64.allocationSize(value.size) +
FfiConverterString.allocationSize(value.sha256);
}
};
return new FFIConverter();
})();
/**
* Result of [`Space::send_file`].
*/
export type SpaceSendFileReport = {
/**
* Host source.
*/
source: string,
/**
* Transfer root in the guest.
*/
destination: string,
/**
* Where the file or folder landed.
*/
dest: string,
/**
* `file` or `folder`.
*/
kind: string,
/**
* Files placed.
*/
files: Array<SpaceSentFile>,
/**
* Total bytes.
*/
bytes: bigint,
/**
* Paths left out by ignore rules (first 200).
*/
skippedByIgnorefiles: Array<string>,
/**
* Paths the guest skipped.
*/
skippedByGuest: Array<string>,
/**
* Every hash matched.
*/
verified: boolean
}
/**
* Generated factory for {@link SpaceSendFileReport} record objects.
*/
export const SpaceSendFileReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceSendFileReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceSendFileReport>,
});
})();
const FfiConverterTypeSpaceSendFileReport = (() => {
type TypeName = SpaceSendFileReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
source: FfiConverterString.read(from),
destination: FfiConverterString.read(from),
dest: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
files: FfiConverterSequenceTypeSpaceSentFile.read(from),
bytes: FfiConverterUInt64.read(from),
skippedByIgnorefiles: FfiConverterSequenceString.read(from),
skippedByGuest: FfiConverterSequenceString.read(from),
verified: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.source, into);
FfiConverterString.write(value.destination, into);
FfiConverterString.write(value.dest, into);
FfiConverterString.write(value.kind, into);
FfiConverterSequenceTypeSpaceSentFile.write(value.files, into);
FfiConverterUInt64.write(value.bytes, into);
FfiConverterSequenceString.write(value.skippedByIgnorefiles, into);
FfiConverterSequenceString.write(value.skippedByGuest, into);
FfiConverterBool.write(value.verified, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.source) +
FfiConverterString.allocationSize(value.destination) +
FfiConverterString.allocationSize(value.dest) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterSequenceTypeSpaceSentFile.allocationSize(value.files) +
FfiConverterUInt64.allocationSize(value.bytes) +
FfiConverterSequenceString.allocationSize(value.skippedByIgnorefiles) +
FfiConverterSequenceString.allocationSize(value.skippedByGuest) +
FfiConverterBool.allocationSize(value.verified);
}
};
return new FFIConverter();
})();
/**
* One account a Space is shared with.
*/
export type SpaceShareEntry = {
/**
* The email or account id, as shared.
*/
who: string,
/**
* `viewer` or `editor`.
*/
role: string,
/**
* Connected through the relay right now.
*/
connected: boolean
}
/**
* Generated factory for {@link SpaceShareEntry} record objects.
*/
export const SpaceShareEntry = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceShareEntry, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceShareEntry>,
});
})();
const FfiConverterTypeSpaceShareEntry = (() => {
type TypeName = SpaceShareEntry;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
who: FfiConverterString.read(from),
role: FfiConverterString.read(from),
connected: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.who, into);
FfiConverterString.write(value.role, into);
FfiConverterBool.write(value.connected, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.who) +
FfiConverterString.allocationSize(value.role) +
FfiConverterBool.allocationSize(value.connected);
}
};
return new FFIConverter();
})();
/**
* Who a Space is shared with.
*/
export type SpaceShares = {
/**
* The Space.
*/
space: string,
/**
* The relay machine it is shared as (empty when not shared).
*/
machine: string,
/**
* What the people it is shared with open (`relay:<machine>`).
*/
inviteeSpace: string,
/**
* The relay URL of the machine.
*/
url: string,
/**
* The machine is on the relay now.
*/
online: boolean,
/**
* The accounts and their roles.
*/
shares: Array<SpaceShareEntry>
}
/**
* Generated factory for {@link SpaceShares} record objects.
*/
export const SpaceShares = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceShares, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceShares>,
});
})();
const FfiConverterTypeSpaceShares = (() => {
type TypeName = SpaceShares;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
space: FfiConverterString.read(from),
machine: FfiConverterString.read(from),
inviteeSpace: FfiConverterString.read(from),
url: FfiConverterString.read(from),
online: FfiConverterBool.read(from),
shares: FfiConverterSequenceTypeSpaceShareEntry.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.space, into);
FfiConverterString.write(value.machine, into);
FfiConverterString.write(value.inviteeSpace, into);
FfiConverterString.write(value.url, into);
FfiConverterBool.write(value.online, into);
FfiConverterSequenceTypeSpaceShareEntry.write(value.shares, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.space) +
FfiConverterString.allocationSize(value.machine) +
FfiConverterString.allocationSize(value.inviteeSpace) +
FfiConverterString.allocationSize(value.url) +
FfiConverterBool.allocationSize(value.online) +
FfiConverterSequenceTypeSpaceShareEntry.allocationSize(value.shares);
}
};
return new FFIConverter();
})();
/**
* What to stream and how.
*/
export type SpaceStreamOptions = {
/**
* Window handle (wins over `app_name` and `display`).
*/
windowId?: string,
/**
* The largest window of this app.
*/
appName?: string,
/**
* Display id (`None` = primary).
*/
display?: string,
/**
* Codecs in preference order (`h264`, `bgra`, `png`; empty = any).
*/
codecs: Array<string>,
/**
* FPS cap (0 = 30).
*/
maxFps: number,
/**
* Long-edge cap (0 = native).
*/
maxDimension: number,
/**
* Request the paired audio track.
*/
audio: boolean,
/**
* Ticket lifetime (default 60 s).
*/
ticketTtlMs?: bigint,
/**
* Input policy: `view_only` (default), `background_only` (input
* without activating the target) or `allow_activation`.
*/
policy?: string
}
/**
* Generated factory for {@link SpaceStreamOptions} record objects.
*/
export const SpaceStreamOptions = (() => {
const defaults = () => ({
windowId: undefined,
appName: undefined,
display: undefined,
codecs: [],
maxFps: 0,
maxDimension: 0,
audio: false,
ticketTtlMs: undefined,
policy: undefined
});
const create = (() => {
return uniffiCreateRecord<SpaceStreamOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceStreamOptions>,
});
})();
const FfiConverterTypeSpaceStreamOptions = (() => {
type TypeName = SpaceStreamOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
windowId: FfiConverterOptionalString.read(from),
appName: FfiConverterOptionalString.read(from),
display: FfiConverterOptionalString.read(from),
codecs: FfiConverterSequenceString.read(from),
maxFps: FfiConverterUInt32.read(from),
maxDimension: FfiConverterUInt32.read(from),
audio: FfiConverterBool.read(from),
ticketTtlMs: FfiConverterOptionalUInt64.read(from),
policy: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalString.write(value.windowId, into);
FfiConverterOptionalString.write(value.appName, into);
FfiConverterOptionalString.write(value.display, into);
FfiConverterSequenceString.write(value.codecs, into);
FfiConverterUInt32.write(value.maxFps, into);
FfiConverterUInt32.write(value.maxDimension, into);
FfiConverterBool.write(value.audio, into);
FfiConverterOptionalUInt64.write(value.ticketTtlMs, into);
FfiConverterOptionalString.write(value.policy, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.windowId) +
FfiConverterOptionalString.allocationSize(value.appName) +
FfiConverterOptionalString.allocationSize(value.display) +
FfiConverterSequenceString.allocationSize(value.codecs) +
FfiConverterUInt32.allocationSize(value.maxFps) +
FfiConverterUInt32.allocationSize(value.maxDimension) +
FfiConverterBool.allocationSize(value.audio) +
FfiConverterOptionalUInt64.allocationSize(value.ticketTtlMs) +
FfiConverterOptionalString.allocationSize(value.policy);
}
};
return new FFIConverter();
})();
/**
* Delivery counters of a [`SpaceStreamSession`].
*/
export type SpaceStreamStats = {
/**
* Frames delivered.
*/
frames: bigint,
/**
* Keyframes delivered.
*/
keyframes: bigint,
/**
* Frames dropped (sink behind; each forces a keyframe resync).
*/
framesDropped: bigint,
/**
* Frames held back awaiting a keyframe.
*/
framesGated: bigint,
/**
* Keyframe requests sent.
*/
keyframeRequests: bigint,
/**
* Audio packets delivered.
*/
audioPackets: bigint,
/**
* Audio packets reported lost.
*/
audioLost: bigint,
/**
* Control events delivered.
*/
events: bigint,
/**
* Malformed messages ignored.
*/
malformed: bigint
}
/**
* Generated factory for {@link SpaceStreamStats} record objects.
*/
export const SpaceStreamStats = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceStreamStats, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceStreamStats>,
});
})();
const FfiConverterTypeSpaceStreamStats = (() => {
type TypeName = SpaceStreamStats;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
frames: FfiConverterUInt64.read(from),
keyframes: FfiConverterUInt64.read(from),
framesDropped: FfiConverterUInt64.read(from),
framesGated: FfiConverterUInt64.read(from),
keyframeRequests: FfiConverterUInt64.read(from),
audioPackets: FfiConverterUInt64.read(from),
audioLost: FfiConverterUInt64.read(from),
events: FfiConverterUInt64.read(from),
malformed: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt64.write(value.frames, into);
FfiConverterUInt64.write(value.keyframes, into);
FfiConverterUInt64.write(value.framesDropped, into);
FfiConverterUInt64.write(value.framesGated, into);
FfiConverterUInt64.write(value.keyframeRequests, into);
FfiConverterUInt64.write(value.audioPackets, into);
FfiConverterUInt64.write(value.audioLost, into);
FfiConverterUInt64.write(value.events, into);
FfiConverterUInt64.write(value.malformed, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.frames) +
FfiConverterUInt64.allocationSize(value.keyframes) +
FfiConverterUInt64.allocationSize(value.framesDropped) +
FfiConverterUInt64.allocationSize(value.framesGated) +
FfiConverterUInt64.allocationSize(value.keyframeRequests) +
FfiConverterUInt64.allocationSize(value.audioPackets) +
FfiConverterUInt64.allocationSize(value.audioLost) +
FfiConverterUInt64.allocationSize(value.events) +
FfiConverterUInt64.allocationSize(value.malformed);
}
};
return new FFIConverter();
})();
/**
* A minted media session.
*/
export type SpaceStreamTicket = {
/**
* Space id.
*/
space: string,
/**
* Media session id.
*/
mediaSessionId: string,
/**
* Media WebSocket URL, ticket included (the daemon passthrough in
* daemon mode).
*/
wsUrl: string,
/**
* The bare ticket.
*/
ticket: string,
/**
* Expiry (RFC 3339).
*/
ticketExpiresAt?: string,
/**
* `h264`, `bgra` or `png`.
*/
codec: string,
/**
* Media wire version.
*/
wireVersion: number,
/**
* Initial width.
*/
width: number,
/**
* Initial height.
*/
height: number,
/**
* Attaching needs [`Space::websocket_headers`] (a gateway or the daemon
* passthrough).
*/
needsHeaders: boolean
}
/**
* Generated factory for {@link SpaceStreamTicket} record objects.
*/
export const SpaceStreamTicket = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceStreamTicket, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceStreamTicket>,
});
})();
const FfiConverterTypeSpaceStreamTicket = (() => {
type TypeName = SpaceStreamTicket;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
space: FfiConverterString.read(from),
mediaSessionId: FfiConverterString.read(from),
wsUrl: FfiConverterString.read(from),
ticket: FfiConverterString.read(from),
ticketExpiresAt: FfiConverterOptionalString.read(from),
codec: FfiConverterString.read(from),
wireVersion: FfiConverterUInt32.read(from),
width: FfiConverterUInt32.read(from),
height: FfiConverterUInt32.read(from),
needsHeaders: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.space, into);
FfiConverterString.write(value.mediaSessionId, into);
FfiConverterString.write(value.wsUrl, into);
FfiConverterString.write(value.ticket, into);
FfiConverterOptionalString.write(value.ticketExpiresAt, into);
FfiConverterString.write(value.codec, into);
FfiConverterUInt32.write(value.wireVersion, into);
FfiConverterUInt32.write(value.width, into);
FfiConverterUInt32.write(value.height, into);
FfiConverterBool.write(value.needsHeaders, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.space) +
FfiConverterString.allocationSize(value.mediaSessionId) +
FfiConverterString.allocationSize(value.wsUrl) +
FfiConverterString.allocationSize(value.ticket) +
FfiConverterOptionalString.allocationSize(value.ticketExpiresAt) +
FfiConverterString.allocationSize(value.codec) +
FfiConverterUInt32.allocationSize(value.wireVersion) +
FfiConverterUInt32.allocationSize(value.width) +
FfiConverterUInt32.allocationSize(value.height) +
FfiConverterBool.allocationSize(value.needsHeaders);
}
};
return new FFIConverter();
})();
/**
* A Space's latest thumbnail, from the cache every client on this machine
* shares ([`crate::native::spaces::Space::thumbnail`]).
*/
export type SpaceThumbnail = {
/**
* Encoded image (a small JPEG of the primary display).
*/
image: ArrayBuffer,
/**
* Encoding.
*/
format: ImageFormat,
/**
* Pixel width.
*/
width: number,
/**
* Pixel height.
*/
height: number,
/**
* When it was captured, Unix milliseconds.
*/
capturedAtMs: bigint
}
/**
* Generated factory for {@link SpaceThumbnail} record objects.
*/
export const SpaceThumbnail = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceThumbnail, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceThumbnail>,
});
})();
const FfiConverterTypeSpaceThumbnail = (() => {
type TypeName = SpaceThumbnail;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
image: FfiConverterArrayBuffer.read(from),
format: FfiConverterTypeImageFormat.read(from),
width: FfiConverterUInt32.read(from),
height: FfiConverterUInt32.read(from),
capturedAtMs: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterArrayBuffer.write(value.image, into);
FfiConverterTypeImageFormat.write(value.format, into);
FfiConverterUInt32.write(value.width, into);
FfiConverterUInt32.write(value.height, into);
FfiConverterUInt64.write(value.capturedAtMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterArrayBuffer.allocationSize(value.image) +
FfiConverterTypeImageFormat.allocationSize(value.format) +
FfiConverterUInt32.allocationSize(value.width) +
FfiConverterUInt32.allocationSize(value.height) +
FfiConverterUInt64.allocationSize(value.capturedAtMs);
}
};
return new FFIConverter();
})();
/**
* A tool of a Space's MCP service.
*/
export type SpaceToolInfo = {
/**
* Name.
*/
name: string,
/**
* Description.
*/
description: string,
/**
* Input JSON Schema.
*/
inputSchemaJson: string,
/**
* Read-only.
*/
readOnly: boolean,
/**
* Destructive.
*/
destructive: boolean
}
/**
* Generated factory for {@link SpaceToolInfo} record objects.
*/
export const SpaceToolInfo = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceToolInfo, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceToolInfo>,
});
})();
const FfiConverterTypeSpaceToolInfo = (() => {
type TypeName = SpaceToolInfo;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
description: FfiConverterString.read(from),
inputSchemaJson: FfiConverterString.read(from),
readOnly: FfiConverterBool.read(from),
destructive: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.description, into);
FfiConverterString.write(value.inputSchemaJson, into);
FfiConverterBool.write(value.readOnly, into);
FfiConverterBool.write(value.destructive, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.description) +
FfiConverterString.allocationSize(value.inputSchemaJson) +
FfiConverterBool.allocationSize(value.readOnly) +
FfiConverterBool.allocationSize(value.destructive);
}
};
return new FFIConverter();
})();
/**
* The result of a tool call (MCP content as JSON).
*/
export type SpaceToolResult = {
/**
* MCP content parts as a JSON array.
*/
contentJson: string,
/**
* Structured content as JSON, when present.
*/
structuredJson?: string,
/**
* The tool failed.
*/
isError: boolean,
/**
* Concatenated text parts.
*/
text: string,
/**
* The result's `_meta` as JSON, when present.
*/
metaJson?: string
}
/**
* Generated factory for {@link SpaceToolResult} record objects.
*/
export const SpaceToolResult = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceToolResult, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceToolResult>,
});
})();
const FfiConverterTypeSpaceToolResult = (() => {
type TypeName = SpaceToolResult;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
contentJson: FfiConverterString.read(from),
structuredJson: FfiConverterOptionalString.read(from),
isError: FfiConverterBool.read(from),
text: FfiConverterString.read(from),
metaJson: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.contentJson, into);
FfiConverterOptionalString.write(value.structuredJson, into);
FfiConverterBool.write(value.isError, into);
FfiConverterString.write(value.text, into);
FfiConverterOptionalString.write(value.metaJson, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.contentJson) +
FfiConverterOptionalString.allocationSize(value.structuredJson) +
FfiConverterBool.allocationSize(value.isError) +
FfiConverterString.allocationSize(value.text) +
FfiConverterOptionalString.allocationSize(value.metaJson);
}
};
return new FFIConverter();
})();
/**
* Result of [`Space::upload`] / [`Space::download`].
*/
export type SpaceTransferReport = {
/**
* Source.
*/
source: string,
/**
* Destination.
*/
dest: string,
/**
* `file` or `folder`.
*/
kind: string,
/**
* Files written.
*/
files: bigint,
/**
* Directories created (uploads).
*/
directories: bigint,
/**
* Total bytes.
*/
bytes: bigint,
/**
* SHA-256 (single files).
*/
sha256?: string,
/**
* Every file verified by SHA-256.
*/
verified: boolean
}
/**
* Generated factory for {@link SpaceTransferReport} record objects.
*/
export const SpaceTransferReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceTransferReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceTransferReport>,
});
})();
const FfiConverterTypeSpaceTransferReport = (() => {
type TypeName = SpaceTransferReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
source: FfiConverterString.read(from),
dest: FfiConverterString.read(from),
kind: FfiConverterString.read(from),
files: FfiConverterUInt64.read(from),
directories: FfiConverterUInt64.read(from),
bytes: FfiConverterUInt64.read(from),
sha256: FfiConverterOptionalString.read(from),
verified: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.source, into);
FfiConverterString.write(value.dest, into);
FfiConverterString.write(value.kind, into);
FfiConverterUInt64.write(value.files, into);
FfiConverterUInt64.write(value.directories, into);
FfiConverterUInt64.write(value.bytes, into);
FfiConverterOptionalString.write(value.sha256, into);
FfiConverterBool.write(value.verified, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.source) +
FfiConverterString.allocationSize(value.dest) +
FfiConverterString.allocationSize(value.kind) +
FfiConverterUInt64.allocationSize(value.files) +
FfiConverterUInt64.allocationSize(value.directories) +
FfiConverterUInt64.allocationSize(value.bytes) +
FfiConverterOptionalString.allocationSize(value.sha256) +
FfiConverterBool.allocationSize(value.verified);
}
};
return new FFIConverter();
})();
/**
* What carries a connected Space's calls ([`Space::transport`]), for a
* badge: whether the relay can read them.
*/
export type SpaceTransport = {
/**
* `local`, `direct`, `mesh` (end to end), `relay_https` (the relay's
* HTTPS path: the relay can read the session in transit), `cloud`, or
* empty when the Space runs no cua-spacesd.
*/
transport: string,
/**
* Why it took the relay's HTTPS path although the mesh was wanted;
* empty on the mesh and when the HTTPS path was chosen
* (`CUA_MESH=off`), and from an older daemon.
*/
fallbackReason: string
}
/**
* Generated factory for {@link SpaceTransport} record objects.
*/
export const SpaceTransport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceTransport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceTransport>,
});
})();
const FfiConverterTypeSpaceTransport = (() => {
type TypeName = SpaceTransport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
transport: FfiConverterString.read(from),
fallbackReason: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.transport, into);
FfiConverterString.write(value.fallbackReason, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.transport) +
FfiConverterString.allocationSize(value.fallbackReason);
}
};
return new FFIConverter();
})();
/**
* Processor, memory and storage use ([`Space::usage`]). A size is the
* guest's own limit only when its `*_limited` flag says so (a VM's memory
* or disk, a container's cgroup memory limit).
*/
export type SpaceUsage = {
/**
* Cores the guest sees (0 from a guest that does not report it).
*/
cpuCount: number,
/**
* Busy now, 0 to 100.
*/
cpuPercent: number,
/**
* 1-minute load average.
*/
loadAverage1m: number,
/**
* Memory in use, bytes.
*/
memoryUsed: bigint,
/**
* Memory size, bytes.
*/
memoryTotal: bigint,
/**
* `memory_total` is the guest's limit.
*/
memoryLimited: boolean,
/**
* Home filesystem bytes in use.
*/
diskUsed: bigint,
/**
* Home filesystem size, bytes.
*/
diskTotal: bigint,
/**
* `disk_total` is the guest's own disk.
*/
diskLimited: boolean
}
/**
* Generated factory for {@link SpaceUsage} record objects.
*/
export const SpaceUsage = (() => {
const defaults = () => ({
cpuCount: 0,
cpuPercent: 0.0,
loadAverage1m: 0.0,
});
const create = (() => {
return uniffiCreateRecord<SpaceUsage, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceUsage>,
});
})();
const FfiConverterTypeSpaceUsage = (() => {
type TypeName = SpaceUsage;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
cpuCount: FfiConverterUInt32.read(from),
cpuPercent: FfiConverterFloat64.read(from),
loadAverage1m: FfiConverterFloat64.read(from),
memoryUsed: FfiConverterUInt64.read(from),
memoryTotal: FfiConverterUInt64.read(from),
memoryLimited: FfiConverterBool.read(from),
diskUsed: FfiConverterUInt64.read(from),
diskTotal: FfiConverterUInt64.read(from),
diskLimited: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt32.write(value.cpuCount, into);
FfiConverterFloat64.write(value.cpuPercent, into);
FfiConverterFloat64.write(value.loadAverage1m, into);
FfiConverterUInt64.write(value.memoryUsed, into);
FfiConverterUInt64.write(value.memoryTotal, into);
FfiConverterBool.write(value.memoryLimited, into);
FfiConverterUInt64.write(value.diskUsed, into);
FfiConverterUInt64.write(value.diskTotal, into);
FfiConverterBool.write(value.diskLimited, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt32.allocationSize(value.cpuCount) +
FfiConverterFloat64.allocationSize(value.cpuPercent) +
FfiConverterFloat64.allocationSize(value.loadAverage1m) +
FfiConverterUInt64.allocationSize(value.memoryUsed) +
FfiConverterUInt64.allocationSize(value.memoryTotal) +
FfiConverterBool.allocationSize(value.memoryLimited) +
FfiConverterUInt64.allocationSize(value.diskUsed) +
FfiConverterUInt64.allocationSize(value.diskTotal) +
FfiConverterBool.allocationSize(value.diskLimited);
}
};
return new FFIConverter();
})();
/**
* A streamable window.
*/
export type SpaceWindow = {
/**
* Window handle.
*/
windowId: string,
/**
* Generation.
*/
epoch: bigint,
/**
* Title.
*/
title: string,
/**
* App name.
*/
appName: string,
/**
* App id.
*/
appId: string,
/**
* Pid.
*/
pid: number,
/**
* `[x, y, width, height]` in logical points.
*/
bounds: Array<number>,
/**
* On screen.
*/
onScreen: boolean,
/**
* Focused.
*/
focused: boolean,
/**
* Streamable now.
*/
available: boolean,
/**
* Why not.
*/
limitation: string
}
/**
* Generated factory for {@link SpaceWindow} record objects.
*/
export const SpaceWindow = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceWindow, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceWindow>,
});
})();
const FfiConverterTypeSpaceWindow = (() => {
type TypeName = SpaceWindow;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
windowId: FfiConverterString.read(from),
epoch: FfiConverterUInt64.read(from),
title: FfiConverterString.read(from),
appName: FfiConverterString.read(from),
appId: FfiConverterString.read(from),
pid: FfiConverterUInt32.read(from),
bounds: FfiConverterSequenceFloat64.read(from),
onScreen: FfiConverterBool.read(from),
focused: FfiConverterBool.read(from),
available: FfiConverterBool.read(from),
limitation: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.windowId, into);
FfiConverterUInt64.write(value.epoch, into);
FfiConverterString.write(value.title, into);
FfiConverterString.write(value.appName, into);
FfiConverterString.write(value.appId, into);
FfiConverterUInt32.write(value.pid, into);
FfiConverterSequenceFloat64.write(value.bounds, into);
FfiConverterBool.write(value.onScreen, into);
FfiConverterBool.write(value.focused, into);
FfiConverterBool.write(value.available, into);
FfiConverterString.write(value.limitation, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.windowId) +
FfiConverterUInt64.allocationSize(value.epoch) +
FfiConverterString.allocationSize(value.title) +
FfiConverterString.allocationSize(value.appName) +
FfiConverterString.allocationSize(value.appId) +
FfiConverterUInt32.allocationSize(value.pid) +
FfiConverterSequenceFloat64.allocationSize(value.bounds) +
FfiConverterBool.allocationSize(value.onScreen) +
FfiConverterBool.allocationSize(value.focused) +
FfiConverterBool.allocationSize(value.available) +
FfiConverterString.allocationSize(value.limitation);
}
};
return new FFIConverter();
})();
/**
* Result of [`Space::write`].
*/
export type SpaceWriteReport = {
/**
* Guest path.
*/
path: string,
/**
* Bytes.
*/
bytes: bigint,
/**
* SHA-256 verified in the Space.
*/
sha256: string
}
/**
* Generated factory for {@link SpaceWriteReport} record objects.
*/
export const SpaceWriteReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpaceWriteReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpaceWriteReport>,
});
})();
const FfiConverterTypeSpaceWriteReport = (() => {
type TypeName = SpaceWriteReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
path: FfiConverterString.read(from),
bytes: FfiConverterUInt64.read(from),
sha256: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.path, into);
FfiConverterUInt64.write(value.bytes, into);
FfiConverterString.write(value.sha256, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.path) +
FfiConverterUInt64.allocationSize(value.bytes) +
FfiConverterString.allocationSize(value.sha256);
}
};
return new FFIConverter();
})();
/**
* One limit of a host that provides Spaces and how much of it is used.
*/
export type SpacesHostLimit = {
/**
* `spaces` (every Space it provides) or `macos_vms`.
*/
resource: string,
/**
* In use now.
*/
used: number,
/**
* The limit (0: none).
*/
limit: number,
/**
* Why the limit exists, for people.
*/
reason: string
}
/**
* Generated factory for {@link SpacesHostLimit} record objects.
*/
export const SpacesHostLimit = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpacesHostLimit, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpacesHostLimit>,
});
})();
const FfiConverterTypeSpacesHostLimit = (() => {
type TypeName = SpacesHostLimit;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
resource: FfiConverterString.read(from),
used: FfiConverterUInt32.read(from),
limit: FfiConverterUInt32.read(from),
reason: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.resource, into);
FfiConverterUInt32.write(value.used, into);
FfiConverterUInt32.write(value.limit, into);
FfiConverterString.write(value.reason, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.resource) +
FfiConverterUInt32.allocationSize(value.used) +
FfiConverterUInt32.allocationSize(value.limit) +
FfiConverterString.allocationSize(value.reason);
}
};
return new FFIConverter();
})();
/**
* How busy one of your machines is (its job runner's view).
*/
export type SpacesHostLoad = {
/**
* CPU it offers, in thousandths.
*/
millicpusTotal: number,
/**
* Of that, free.
*/
millicpusFree: number,
/**
* Memory it offers (MiB).
*/
memoryTotalMb: bigint,
/**
* Of that, free.
*/
memoryFreeMb: bigint,
/**
* Spaces running there.
*/
spaces: number,
/**
* Why it takes nothing now (empty: it does).
*/
problem: string,
/**
* The kinds it creates (`container`, `vm`, `microvm`), as it reports
* them; empty when it does not say.
*/
kinds: Array<string>
}
/**
* Generated factory for {@link SpacesHostLoad} record objects.
*/
export const SpacesHostLoad = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpacesHostLoad, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpacesHostLoad>,
});
})();
const FfiConverterTypeSpacesHostLoad = (() => {
type TypeName = SpacesHostLoad;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
millicpusTotal: FfiConverterUInt32.read(from),
millicpusFree: FfiConverterUInt32.read(from),
memoryTotalMb: FfiConverterUInt64.read(from),
memoryFreeMb: FfiConverterUInt64.read(from),
spaces: FfiConverterUInt32.read(from),
problem: FfiConverterString.read(from),
kinds: FfiConverterSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt32.write(value.millicpusTotal, into);
FfiConverterUInt32.write(value.millicpusFree, into);
FfiConverterUInt64.write(value.memoryTotalMb, into);
FfiConverterUInt64.write(value.memoryFreeMb, into);
FfiConverterUInt32.write(value.spaces, into);
FfiConverterString.write(value.problem, into);
FfiConverterSequenceString.write(value.kinds, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt32.allocationSize(value.millicpusTotal) +
FfiConverterUInt32.allocationSize(value.millicpusFree) +
FfiConverterUInt64.allocationSize(value.memoryTotalMb) +
FfiConverterUInt64.allocationSize(value.memoryFreeMb) +
FfiConverterUInt32.allocationSize(value.spaces) +
FfiConverterString.allocationSize(value.problem) +
FfiConverterSequenceString.allocationSize(value.kinds);
}
};
return new FFIConverter();
})();
/**
* One of your machines that provides Spaces ([`Spaces::hosts`]).
*/
export type SpacesHost = {
/**
* What `on="host:<id>"` takes: the relay machine id, or the name a
* direct host was added as.
*/
id: string,
/**
* Its name.
*/
name: string,
/**
* `relay` or `direct`.
*/
via: string,
/**
* It answered.
*/
online: boolean,
/**
* Its operating system (`macos`, `linux`, `windows`), when it answered.
*/
os: string,
/**
* Its limits, when it answered.
*/
limits: Array<SpacesHostLimit>,
/**
* How busy it is, when it answered and reports it.
*/
load?: SpacesHostLoad
}
/**
* Generated factory for {@link SpacesHost} record objects.
*/
export const SpacesHost = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpacesHost, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpacesHost>,
});
})();
const FfiConverterTypeSpacesHost = (() => {
type TypeName = SpacesHost;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
id: FfiConverterString.read(from),
name: FfiConverterString.read(from),
via: FfiConverterString.read(from),
online: FfiConverterBool.read(from),
os: FfiConverterString.read(from),
limits: FfiConverterSequenceTypeSpacesHostLimit.read(from),
load: FfiConverterOptionalTypeSpacesHostLoad.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.id, into);
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.via, into);
FfiConverterBool.write(value.online, into);
FfiConverterString.write(value.os, into);
FfiConverterSequenceTypeSpacesHostLimit.write(value.limits, into);
FfiConverterOptionalTypeSpacesHostLoad.write(value.load, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.id) +
FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.via) +
FfiConverterBool.allocationSize(value.online) +
FfiConverterString.allocationSize(value.os) +
FfiConverterSequenceTypeSpacesHostLimit.allocationSize(value.limits) +
FfiConverterOptionalTypeSpacesHostLoad.allocationSize(value.load);
}
};
return new FFIConverter();
})();
/**
* One row of [`SPACES_TOOL_METHODS`].
*/
export type SpacesToolMethod = {
/**
* Contract tool name.
*/
tool: string,
/**
* `Class.method` (Rust / Python spelling; camelCase in TS, Swift and
* Kotlin).
*/
method: string
}
/**
* Generated factory for {@link SpacesToolMethod} record objects.
*/
export const SpacesToolMethod = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpacesToolMethod, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpacesToolMethod>,
});
})();
const FfiConverterTypeSpacesToolMethod = (() => {
type TypeName = SpacesToolMethod;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
tool: FfiConverterString.read(from),
method: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.tool, into);
FfiConverterString.write(value.method, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.tool) +
FfiConverterString.allocationSize(value.method);
}
};
return new FFIConverter();
})();
/**
* One capability flag.
*/
export type SpacesdFeature = {
/**
* Feature name (for example `a11y`, `stream.h264`, `audio.desktop`).
*/
name: string,
/**
* Supported in this guest.
*/
supported: boolean,
/**
* Limitation when degraded or unsupported.
*/
limitation?: string,
/**
* Extra attributes.
*/
attributes: Map<string, string>
}
/**
* Generated factory for {@link SpacesdFeature} record objects.
*/
export const SpacesdFeature = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpacesdFeature, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpacesdFeature>,
});
})();
const FfiConverterTypeSpacesdFeature = (() => {
type TypeName = SpacesdFeature;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
supported: FfiConverterBool.read(from),
limitation: FfiConverterOptionalString.read(from),
attributes: FfiConverterMapStringString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterBool.write(value.supported, into);
FfiConverterOptionalString.write(value.limitation, into);
FfiConverterMapStringString.write(value.attributes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterBool.allocationSize(value.supported) +
FfiConverterOptionalString.allocationSize(value.limitation) +
FfiConverterMapStringString.allocationSize(value.attributes);
}
};
return new FFIConverter();
})();
/**
* `SystemService.GetCapabilities`, summarized. `json` has everything.
*/
export type SpacesdCapabilities = {
/**
* spacesd version.
*/
version: string,
/**
* `cua.env.v1` protocol version.
*/
protocolVersion: number,
/**
* Additive contract revision.
*/
protocolRevision: number,
/**
* OS family (`linux`, `macos`, `windows`).
*/
osFamily: string,
/**
* OS name.
*/
osName: string,
/**
* OS version.
*/
osVersion: string,
/**
* CPU architecture.
*/
arch: string,
/**
* Guest hostname.
*/
hostname: string,
/**
* `SystemService.Init` has run.
*/
initialized: boolean,
/**
* Feature flags.
*/
features: Array<SpacesdFeature>,
/**
* The full response as proto3 JSON.
*/
json: string
}
/**
* Generated factory for {@link SpacesdCapabilities} record objects.
*/
export const SpacesdCapabilities = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpacesdCapabilities, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpacesdCapabilities>,
});
})();
const FfiConverterTypeSpacesdCapabilities = (() => {
type TypeName = SpacesdCapabilities;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
version: FfiConverterString.read(from),
protocolVersion: FfiConverterUInt32.read(from),
protocolRevision: FfiConverterUInt32.read(from),
osFamily: FfiConverterString.read(from),
osName: FfiConverterString.read(from),
osVersion: FfiConverterString.read(from),
arch: FfiConverterString.read(from),
hostname: FfiConverterString.read(from),
initialized: FfiConverterBool.read(from),
features: FfiConverterSequenceTypeSpacesdFeature.read(from),
json: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.version, into);
FfiConverterUInt32.write(value.protocolVersion, into);
FfiConverterUInt32.write(value.protocolRevision, into);
FfiConverterString.write(value.osFamily, into);
FfiConverterString.write(value.osName, into);
FfiConverterString.write(value.osVersion, into);
FfiConverterString.write(value.arch, into);
FfiConverterString.write(value.hostname, into);
FfiConverterBool.write(value.initialized, into);
FfiConverterSequenceTypeSpacesdFeature.write(value.features, into);
FfiConverterString.write(value.json, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.version) +
FfiConverterUInt32.allocationSize(value.protocolVersion) +
FfiConverterUInt32.allocationSize(value.protocolRevision) +
FfiConverterString.allocationSize(value.osFamily) +
FfiConverterString.allocationSize(value.osName) +
FfiConverterString.allocationSize(value.osVersion) +
FfiConverterString.allocationSize(value.arch) +
FfiConverterString.allocationSize(value.hostname) +
FfiConverterBool.allocationSize(value.initialized) +
FfiConverterSequenceTypeSpacesdFeature.allocationSize(value.features) +
FfiConverterString.allocationSize(value.json);
}
};
return new FFIConverter();
})();
/**
* A command to run in the guest.
*/
export type SpacesdCommand = {
/**
* Program (absolute path or `PATH` lookup).
*/
program: string,
/**
* Arguments.
*/
args: Array<string>,
/**
* Extra environment.
*/
env: Map<string, string>,
/**
* Working directory.
*/
cwd?: string,
/**
* Run as this user.
*/
user?: string,
/**
* Kill after this long.
*/
timeoutMs?: number,
/**
* Tag for reattaching (`attach(tag=…)`).
*/
tag?: string,
/**
* Keep stdin open for `write_stdin`.
*/
stdin: boolean,
/**
* Run in a PTY of this size.
*/
pty?: PtySize,
/**
* Idempotency key: a later start with the same key reattaches to the
* running process or replays its recorded outcome instead of running
* the command again (the guest's exec ledger; see `GetExecRecord`).
*/
requestId?: string,
/**
* Fencing epoch: a start with an epoch lower than the Space's current
* one is refused; a higher one advances it. `None` is unfenced.
*/
epoch?: bigint,
/**
* Size of the guest's output scrollback ring for this process, in
* bytes. The ring never blocks the process: a reader that falls more
* than this far behind loses the evicted bytes (visible as an offset
* gap). `None` uses the server default (8 MiB); the server clamps
* larger requests to its maximum (512 MiB) rather than failing. The
* ring is allocated up to this size as output arrives, so the cost is
* bounded by the output actually produced.
*/
scrollbackBytes?: bigint,
/**
* Kill the process (`term`, then `kill`) when this client's connection
* to cua-spacesd ends before the process does, including when the
* client process dies. Off by default: processes are detached and can be
* reattached by tag.
*/
killOnDisconnect: boolean
}
/**
* Generated factory for {@link SpacesdCommand} record objects.
*/
export const SpacesdCommand = (() => {
const defaults = () => ({
args: [],
env: new Map(),
cwd: undefined,
user: undefined,
timeoutMs: undefined,
tag: undefined,
stdin: false,
pty: undefined,
requestId: undefined,
epoch: undefined,
scrollbackBytes: undefined,
killOnDisconnect: false
});
const create = (() => {
return uniffiCreateRecord<SpacesdCommand, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpacesdCommand>,
});
})();
const FfiConverterTypeSpacesdCommand = (() => {
type TypeName = SpacesdCommand;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
program: FfiConverterString.read(from),
args: FfiConverterSequenceString.read(from),
env: FfiConverterMapStringString.read(from),
cwd: FfiConverterOptionalString.read(from),
user: FfiConverterOptionalString.read(from),
timeoutMs: FfiConverterOptionalUInt32.read(from),
tag: FfiConverterOptionalString.read(from),
stdin: FfiConverterBool.read(from),
pty: FfiConverterOptionalTypePtySize.read(from),
requestId: FfiConverterOptionalString.read(from),
epoch: FfiConverterOptionalUInt64.read(from),
scrollbackBytes: FfiConverterOptionalUInt64.read(from),
killOnDisconnect: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.program, into);
FfiConverterSequenceString.write(value.args, into);
FfiConverterMapStringString.write(value.env, into);
FfiConverterOptionalString.write(value.cwd, into);
FfiConverterOptionalString.write(value.user, into);
FfiConverterOptionalUInt32.write(value.timeoutMs, into);
FfiConverterOptionalString.write(value.tag, into);
FfiConverterBool.write(value.stdin, into);
FfiConverterOptionalTypePtySize.write(value.pty, into);
FfiConverterOptionalString.write(value.requestId, into);
FfiConverterOptionalUInt64.write(value.epoch, into);
FfiConverterOptionalUInt64.write(value.scrollbackBytes, into);
FfiConverterBool.write(value.killOnDisconnect, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.program) +
FfiConverterSequenceString.allocationSize(value.args) +
FfiConverterMapStringString.allocationSize(value.env) +
FfiConverterOptionalString.allocationSize(value.cwd) +
FfiConverterOptionalString.allocationSize(value.user) +
FfiConverterOptionalUInt32.allocationSize(value.timeoutMs) +
FfiConverterOptionalString.allocationSize(value.tag) +
FfiConverterBool.allocationSize(value.stdin) +
FfiConverterOptionalTypePtySize.allocationSize(value.pty) +
FfiConverterOptionalString.allocationSize(value.requestId) +
FfiConverterOptionalUInt64.allocationSize(value.epoch) +
FfiConverterOptionalUInt64.allocationSize(value.scrollbackBytes) +
FfiConverterBool.allocationSize(value.killOnDisconnect);
}
};
return new FFIConverter();
})();
/**
* One HTTP header (duplicates are kept in order).
*/
export type SpacesdHttpHeader = {
/**
* Header name.
*/
name: string,
/**
* Header value.
*/
value: string
}
/**
* Generated factory for {@link SpacesdHttpHeader} record objects.
*/
export const SpacesdHttpHeader = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpacesdHttpHeader, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpacesdHttpHeader>,
});
})();
const FfiConverterTypeSpacesdHttpHeader = (() => {
type TypeName = SpacesdHttpHeader;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
name: FfiConverterString.read(from),
value: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.name, into);
FfiConverterString.write(value.value, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name) +
FfiConverterString.allocationSize(value.value);
}
};
return new FFIConverter();
})();
/**
* A plain-HTTP request to the spacesd port (for example MCP at `/mcp`).
*/
export type SpacesdHttpRequest = {
/**
* Method, for example `POST`.
*/
method: string,
/**
* Absolute path under the endpoint, for example `/mcp`. Never a URL.
*/
path: string,
/**
* Extra headers. Credentials (`authorization` and the env headers) are
* the client's and cannot be set here.
*/
headers: Array<SpacesdHttpHeader>,
/**
* Request body (empty for none).
*/
body: ArrayBuffer,
/**
* Whole-request timeout; 30 s when unset.
*/
timeoutMs?: number,
/**
* Response body cap; 16 MiB when unset.
*/
maxResponseBytes?: bigint
}
/**
* Generated factory for {@link SpacesdHttpRequest} record objects.
*/
export const SpacesdHttpRequest = (() => {
const defaults = () => ({
headers: [],
timeoutMs: undefined,
maxResponseBytes: undefined
});
const create = (() => {
return uniffiCreateRecord<SpacesdHttpRequest, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpacesdHttpRequest>,
});
})();
const FfiConverterTypeSpacesdHttpRequest = (() => {
type TypeName = SpacesdHttpRequest;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
method: FfiConverterString.read(from),
path: FfiConverterString.read(from),
headers: FfiConverterSequenceTypeSpacesdHttpHeader.read(from),
body: FfiConverterArrayBuffer.read(from),
timeoutMs: FfiConverterOptionalUInt32.read(from),
maxResponseBytes: FfiConverterOptionalUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.method, into);
FfiConverterString.write(value.path, into);
FfiConverterSequenceTypeSpacesdHttpHeader.write(value.headers, into);
FfiConverterArrayBuffer.write(value.body, into);
FfiConverterOptionalUInt32.write(value.timeoutMs, into);
FfiConverterOptionalUInt64.write(value.maxResponseBytes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.method) +
FfiConverterString.allocationSize(value.path) +
FfiConverterSequenceTypeSpacesdHttpHeader.allocationSize(value.headers) +
FfiConverterArrayBuffer.allocationSize(value.body) +
FfiConverterOptionalUInt32.allocationSize(value.timeoutMs) +
FfiConverterOptionalUInt64.allocationSize(value.maxResponseBytes);
}
};
return new FFIConverter();
})();
/**
* The spacesd's HTTP answer.
*/
export type SpacesdHttpResponse = {
/**
* Status code.
*/
status: number,
/**
* Response headers, in order.
*/
headers: Array<SpacesdHttpHeader>,
/**
* Response body.
*/
body: ArrayBuffer
}
/**
* Generated factory for {@link SpacesdHttpResponse} record objects.
*/
export const SpacesdHttpResponse = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<SpacesdHttpResponse, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<SpacesdHttpResponse>,
});
})();
const FfiConverterTypeSpacesdHttpResponse = (() => {
type TypeName = SpacesdHttpResponse;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
status: FfiConverterUInt16.read(from),
headers: FfiConverterSequenceTypeSpacesdHttpHeader.read(from),
body: FfiConverterArrayBuffer.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt16.write(value.status, into);
FfiConverterSequenceTypeSpacesdHttpHeader.write(value.headers, into);
FfiConverterArrayBuffer.write(value.body, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt16.allocationSize(value.status) +
FfiConverterSequenceTypeSpacesdHttpHeader.allocationSize(value.headers) +
FfiConverterArrayBuffer.allocationSize(value.body);
}
};
return new FFIConverter();
})();
/**
* One stream session's aggregate stats (sampled).
*/
export type StreamStatsReport = {
/**
* `quic`, `webrtc`, `websocket` or `grpc`.
*/
transport: string,
/**
* `h264`, `hevc`, `av1`, `vp8`, `vp9`, `jpeg` or `png`.
*/
codec: string,
/**
* Hardware decode (None: not decoded here).
*/
hwDecode?: boolean,
avgFps: number,
/**
* p95 input-to-present or control round trip, ms.
*/
p95LatencyMs?: number,
/**
* Stream height in pixels.
*/
height: number,
durationMs: bigint
}
/**
* Generated factory for {@link StreamStatsReport} record objects.
*/
export const StreamStatsReport = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<StreamStatsReport, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<StreamStatsReport>,
});
})();
const FfiConverterTypeStreamStatsReport = (() => {
type TypeName = StreamStatsReport;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
transport: FfiConverterString.read(from),
codec: FfiConverterString.read(from),
hwDecode: FfiConverterOptionalBoolean.read(from),
avgFps: FfiConverterFloat64.read(from),
p95LatencyMs: FfiConverterOptionalFloat64.read(from),
height: FfiConverterUInt32.read(from),
durationMs: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.transport, into);
FfiConverterString.write(value.codec, into);
FfiConverterOptionalBoolean.write(value.hwDecode, into);
FfiConverterFloat64.write(value.avgFps, into);
FfiConverterOptionalFloat64.write(value.p95LatencyMs, into);
FfiConverterUInt32.write(value.height, into);
FfiConverterUInt64.write(value.durationMs, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.transport) +
FfiConverterString.allocationSize(value.codec) +
FfiConverterOptionalBoolean.allocationSize(value.hwDecode) +
FfiConverterFloat64.allocationSize(value.avgFps) +
FfiConverterOptionalFloat64.allocationSize(value.p95LatencyMs) +
FfiConverterUInt32.allocationSize(value.height) +
FfiConverterUInt64.allocationSize(value.durationMs);
}
};
return new FFIConverter();
})();
/**
* The one-time notice for machines that saw the older "anonymous" wording,
* shown before anything is linked to the account. Both buttons close it;
* the second also turns usage data off.
*/
export type TelemetryLinkNotice = {
title: string,
body: string,
/**
* Keeps usage data on ("Got it").
*/
okLabel: string,
/**
* Turns usage data off ("Turn off usage data").
*/
turnOffLabel: string,
/**
* The link to what is collected.
*/
detailsLabel: string,
docsUrl: string
}
/**
* Generated factory for {@link TelemetryLinkNotice} record objects.
*/
export const TelemetryLinkNotice = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<TelemetryLinkNotice, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<TelemetryLinkNotice>,
});
})();
const FfiConverterTypeTelemetryLinkNotice = (() => {
type TypeName = TelemetryLinkNotice;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
title: FfiConverterString.read(from),
body: FfiConverterString.read(from),
okLabel: FfiConverterString.read(from),
turnOffLabel: FfiConverterString.read(from),
detailsLabel: FfiConverterString.read(from),
docsUrl: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.title, into);
FfiConverterString.write(value.body, into);
FfiConverterString.write(value.okLabel, into);
FfiConverterString.write(value.turnOffLabel, into);
FfiConverterString.write(value.detailsLabel, into);
FfiConverterString.write(value.docsUrl, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.title) +
FfiConverterString.allocationSize(value.body) +
FfiConverterString.allocationSize(value.okLabel) +
FfiConverterString.allocationSize(value.turnOffLabel) +
FfiConverterString.allocationSize(value.detailsLabel) +
FfiConverterString.allocationSize(value.docsUrl);
}
};
return new FFIConverter();
})();
/**
* Telemetry state.
*/
export type TelemetryStatus = {
/**
* Usage events may be sent.
*/
enabled: boolean,
/**
* Why (`env CUA_TELEMETRY`, `env DO_NOT_TRACK`, `config <path>`, `CI
* environment ...`, `default`).
*/
source: string,
/**
* `do_not_track`, `env`, `legacy_env`, `config`, `ci` or `default`.
*/
sourceKind: string,
/**
* Running in CI.
*/
isCi: boolean,
/**
* The first 8 characters of the anonymous install id, if one exists.
*/
installId?: string,
/**
* The first-run notice was shown on this machine.
*/
noticeShown: boolean,
/**
* Where batches go.
*/
endpoint: string,
/**
* Which Cua program events are attributed to.
*/
product: string,
/**
* The exact properties every event carries, as JSON.
*/
envelopeJson: string
}
/**
* Generated factory for {@link TelemetryStatus} record objects.
*/
export const TelemetryStatus = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<TelemetryStatus, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<TelemetryStatus>,
});
})();
const FfiConverterTypeTelemetryStatus = (() => {
type TypeName = TelemetryStatus;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
enabled: FfiConverterBool.read(from),
source: FfiConverterString.read(from),
sourceKind: FfiConverterString.read(from),
isCi: FfiConverterBool.read(from),
installId: FfiConverterOptionalString.read(from),
noticeShown: FfiConverterBool.read(from),
endpoint: FfiConverterString.read(from),
product: FfiConverterString.read(from),
envelopeJson: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterBool.write(value.enabled, into);
FfiConverterString.write(value.source, into);
FfiConverterString.write(value.sourceKind, into);
FfiConverterBool.write(value.isCi, into);
FfiConverterOptionalString.write(value.installId, into);
FfiConverterBool.write(value.noticeShown, into);
FfiConverterString.write(value.endpoint, into);
FfiConverterString.write(value.product, into);
FfiConverterString.write(value.envelopeJson, into);
}
allocationSize(value: TypeName): number {
return FfiConverterBool.allocationSize(value.enabled) +
FfiConverterString.allocationSize(value.source) +
FfiConverterString.allocationSize(value.sourceKind) +
FfiConverterBool.allocationSize(value.isCi) +
FfiConverterOptionalString.allocationSize(value.installId) +
FfiConverterBool.allocationSize(value.noticeShown) +
FfiConverterString.allocationSize(value.endpoint) +
FfiConverterString.allocationSize(value.product) +
FfiConverterString.allocationSize(value.envelopeJson);
}
};
return new FFIConverter();
})();
/**
* A human's answer to a teleport manifest.
*/
export type TeleportDecision = {
/**
* Items to send (`None` = the provider's default-checked set, never
* everything). An empty list is refused as ambiguous.
*/
include?: Array<string>,
/**
* The human acknowledged the sensitive items in the selection.
*/
acknowledgeSensitive: boolean
}
/**
* Generated factory for {@link TeleportDecision} record objects.
*/
export const TeleportDecision = (() => {
const defaults = () => ({
include: undefined,
acknowledgeSensitive: false
});
const create = (() => {
return uniffiCreateRecord<TeleportDecision, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<TeleportDecision>,
});
})();
const FfiConverterTypeTeleportDecision = (() => {
type TypeName = TeleportDecision;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
include: FfiConverterOptionalSequenceString.read(from),
acknowledgeSensitive: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalSequenceString.write(value.include, into);
FfiConverterBool.write(value.acknowledgeSensitive, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalSequenceString.allocationSize(value.include) +
FfiConverterBool.allocationSize(value.acknowledgeSensitive);
}
};
return new FFIConverter();
})();
/**
* One item a teleport would move.
*/
export type TeleportItem = {
/**
* Bundle-relative path (what an approval names).
*/
relativePath: string,
/**
* Label.
*/
label: string,
/**
* Estimated bytes.
*/
estimatedBytes: bigint,
/**
* Credentials, cookies, tokens, transcripts.
*/
isSensitive: boolean,
/**
* In the default selection.
*/
isCheckedByDefault: boolean,
/**
* Count of things it holds.
*/
count?: bigint,
/**
* Noun for `count`.
*/
countNoun?: string
}
/**
* Generated factory for {@link TeleportItem} record objects.
*/
export const TeleportItem = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<TeleportItem, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<TeleportItem>,
});
})();
const FfiConverterTypeTeleportItem = (() => {
type TypeName = TeleportItem;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
relativePath: FfiConverterString.read(from),
label: FfiConverterString.read(from),
estimatedBytes: FfiConverterUInt64.read(from),
isSensitive: FfiConverterBool.read(from),
isCheckedByDefault: FfiConverterBool.read(from),
count: FfiConverterOptionalUInt64.read(from),
countNoun: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.relativePath, into);
FfiConverterString.write(value.label, into);
FfiConverterUInt64.write(value.estimatedBytes, into);
FfiConverterBool.write(value.isSensitive, into);
FfiConverterBool.write(value.isCheckedByDefault, into);
FfiConverterOptionalUInt64.write(value.count, into);
FfiConverterOptionalString.write(value.countNoun, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.relativePath) +
FfiConverterString.allocationSize(value.label) +
FfiConverterUInt64.allocationSize(value.estimatedBytes) +
FfiConverterBool.allocationSize(value.isSensitive) +
FfiConverterBool.allocationSize(value.isCheckedByDefault) +
FfiConverterOptionalUInt64.allocationSize(value.count) +
FfiConverterOptionalString.allocationSize(value.countNoun);
}
};
return new FFIConverter();
})();
/**
* Exactly what would leave this machine.
*/
export type TeleportManifest = {
/**
* Provider id (`firefox`, `chrome`, `claude-code`, ...).
*/
app: string,
/**
* Display name.
*/
displayName: string,
/**
* `full` or `tabs`.
*/
scope: string,
/**
* Items.
*/
items: Array<TeleportItem>,
/**
* Provider total.
*/
totalEstimatedBytes: bigint,
/**
* Provider caveats.
*/
notes: Array<string>
}
/**
* Generated factory for {@link TeleportManifest} record objects.
*/
export const TeleportManifest = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<TeleportManifest, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<TeleportManifest>,
});
})();
const FfiConverterTypeTeleportManifest = (() => {
type TypeName = TeleportManifest;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
app: FfiConverterString.read(from),
displayName: FfiConverterString.read(from),
scope: FfiConverterString.read(from),
items: FfiConverterSequenceTypeTeleportItem.read(from),
totalEstimatedBytes: FfiConverterUInt64.read(from),
notes: FfiConverterSequenceString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.app, into);
FfiConverterString.write(value.displayName, into);
FfiConverterString.write(value.scope, into);
FfiConverterSequenceTypeTeleportItem.write(value.items, into);
FfiConverterUInt64.write(value.totalEstimatedBytes, into);
FfiConverterSequenceString.write(value.notes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.app) +
FfiConverterString.allocationSize(value.displayName) +
FfiConverterString.allocationSize(value.scope) +
FfiConverterSequenceTypeTeleportItem.allocationSize(value.items) +
FfiConverterUInt64.allocationSize(value.totalEstimatedBytes) +
FfiConverterSequenceString.allocationSize(value.notes);
}
};
return new FFIConverter();
})();
/**
* What a teleport moved, or how to retry a pending Keyvault approval.
*
* Through a daemon (`Host::Daemon`), the underlying `teleport_app` tool is
* consent-gated: a first call never delivers, it only files the request and
* returns `status: "pending"` with a `request_id`; show the user the
* Keyvault approval step, then call [`Space::teleport`] again with that
* same `request_id` (`TeleportRetry::request_id`). A second `"pending"`
* means the user has not decided yet -- call again the same way. Only
* `status: "moved"` means the session actually landed. An embedded host
* (no separate daemon) always returns `"moved"` in one call: there is
* nothing to retry.
*/
export type TeleportReceipt = {
/**
* `moved` or `pending`.
*/
status: string,
/**
* The Keyvault request to retry with, while pending.
*/
requestId?: string,
/**
* App.
*/
app: string,
/**
* Space.
*/
space: string,
/**
* `import_session`.
*/
method: string,
/**
* Paths sent.
*/
transferredPaths: Array<string>,
/**
* Bundle bytes.
*/
bundleBytes: bigint,
/**
* Bundle SHA-256, verified by the Space.
*/
bundleSha256: string,
/**
* Groups imported.
*/
imported: Array<string>,
/**
* Items skipped, with reasons.
*/
skipped: Array<string>,
/**
* The app was launched.
*/
launched: boolean
}
/**
* Generated factory for {@link TeleportReceipt} record objects.
*/
export const TeleportReceipt = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<TeleportReceipt, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<TeleportReceipt>,
});
})();
const FfiConverterTypeTeleportReceipt = (() => {
type TypeName = TeleportReceipt;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
status: FfiConverterString.read(from),
requestId: FfiConverterOptionalString.read(from),
app: FfiConverterString.read(from),
space: FfiConverterString.read(from),
method: FfiConverterString.read(from),
transferredPaths: FfiConverterSequenceString.read(from),
bundleBytes: FfiConverterUInt64.read(from),
bundleSha256: FfiConverterString.read(from),
imported: FfiConverterSequenceString.read(from),
skipped: FfiConverterSequenceString.read(from),
launched: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.status, into);
FfiConverterOptionalString.write(value.requestId, into);
FfiConverterString.write(value.app, into);
FfiConverterString.write(value.space, into);
FfiConverterString.write(value.method, into);
FfiConverterSequenceString.write(value.transferredPaths, into);
FfiConverterUInt64.write(value.bundleBytes, into);
FfiConverterString.write(value.bundleSha256, into);
FfiConverterSequenceString.write(value.imported, into);
FfiConverterSequenceString.write(value.skipped, into);
FfiConverterBool.write(value.launched, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.status) +
FfiConverterOptionalString.allocationSize(value.requestId) +
FfiConverterString.allocationSize(value.app) +
FfiConverterString.allocationSize(value.space) +
FfiConverterString.allocationSize(value.method) +
FfiConverterSequenceString.allocationSize(value.transferredPaths) +
FfiConverterUInt64.allocationSize(value.bundleBytes) +
FfiConverterString.allocationSize(value.bundleSha256) +
FfiConverterSequenceString.allocationSize(value.imported) +
FfiConverterSequenceString.allocationSize(value.skipped) +
FfiConverterBool.allocationSize(value.launched);
}
};
return new FFIConverter();
})();
/**
* Result of an upload or download.
*/
export type TransferResult = {
/**
* Bytes transferred.
*/
size: bigint,
/**
* SHA-256 (hex) of the content.
*/
sha256: string,
/**
* Resumes after dropped connections.
*/
resumes: number
}
/**
* Generated factory for {@link TransferResult} record objects.
*/
export const TransferResult = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<TransferResult, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<TransferResult>,
});
})();
const FfiConverterTypeTransferResult = (() => {
type TypeName = TransferResult;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
size: FfiConverterUInt64.read(from),
sha256: FfiConverterString.read(from),
resumes: FfiConverterUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt64.write(value.size, into);
FfiConverterString.write(value.sha256, into);
FfiConverterUInt32.write(value.resumes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.size) +
FfiConverterString.allocationSize(value.sha256) +
FfiConverterUInt32.allocationSize(value.resumes);
}
};
return new FFIConverter();
})();
/**
* Upload options.
*/
export type UploadOptions = {
/**
* Fail when the file exists (instead of overwriting).
*/
createNew: boolean,
/**
* Append instead of overwriting.
*/
append: boolean,
/**
* Unix permissions (0 = default).
*/
permissions: number,
/**
* Create missing parent directories.
*/
createParents: boolean,
/**
* Guest user to write as: the file (and parents it creates) is owned
* by that user and the user's permissions apply. Needs a guest agent
* that runs as root or has passwordless `sudo` (the Linux images do);
* otherwise the call fails with a permission error that says why.
*/
user?: string,
/**
* Extended attributes to store with the file, published atomically
* with its content. At most 32 keys; a key is 1-128 bytes of
* `A-Za-z0-9._:/@+-`, a value at most 1024 bytes, 3072 bytes in all.
*/
metadata?: Map<string, string>,
/**
* Extended-attribute key prefix for `metadata` (and for the metadata
* reported back): must start with `user.` and end with `.`. Default
* `user.cua.meta.`.
*/
xattrNamespace?: string
}
/**
* Generated factory for {@link UploadOptions} record objects.
*/
export const UploadOptions = (() => {
const defaults = () => ({
createNew: false,
append: false,
permissions: 0,
createParents: true,
user: undefined,
metadata: undefined,
xattrNamespace: undefined
});
const create = (() => {
return uniffiCreateRecord<UploadOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<UploadOptions>,
});
})();
const FfiConverterTypeUploadOptions = (() => {
type TypeName = UploadOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
createNew: FfiConverterBool.read(from),
append: FfiConverterBool.read(from),
permissions: FfiConverterUInt32.read(from),
createParents: FfiConverterBool.read(from),
user: FfiConverterOptionalString.read(from),
metadata: FfiConverterOptionalMapStringString.read(from),
xattrNamespace: FfiConverterOptionalString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterBool.write(value.createNew, into);
FfiConverterBool.write(value.append, into);
FfiConverterUInt32.write(value.permissions, into);
FfiConverterBool.write(value.createParents, into);
FfiConverterOptionalString.write(value.user, into);
FfiConverterOptionalMapStringString.write(value.metadata, into);
FfiConverterOptionalString.write(value.xattrNamespace, into);
}
allocationSize(value: TypeName): number {
return FfiConverterBool.allocationSize(value.createNew) +
FfiConverterBool.allocationSize(value.append) +
FfiConverterUInt32.allocationSize(value.permissions) +
FfiConverterBool.allocationSize(value.createParents) +
FfiConverterOptionalString.allocationSize(value.user) +
FfiConverterOptionalMapStringString.allocationSize(value.metadata) +
FfiConverterOptionalString.allocationSize(value.xattrNamespace);
}
};
return new FFIConverter();
})();
/**
* One encoded video access unit.
*/
export type VideoFrame = {
/**
* Per-target frame sequence (may start anywhere; gaps mean replaced
* frames).
*/
sequence: bigint,
/**
* `h264`, `bgra` or `png`.
*/
codec: string,
/**
* Random-access point (IDR with SPS/PPS for H.264).
*/
keyframe: boolean,
/**
* Payload width in pixels.
*/
width: number,
/**
* Payload height in pixels.
*/
height: number,
/**
* Media-clock capture time (µs).
*/
captureTimestampUs: bigint,
/**
* Decoder configuration generation; reset the decoder when it changes.
*/
codecEpoch: bigint,
/**
* Coordinate generation.
*/
geometryEpoch: bigint,
/**
* Encoded payload.
*/
data: ArrayBuffer,
/**
* The packet's JSON header, verbatim.
*/
headerJson: string
}
/**
* Generated factory for {@link VideoFrame} record objects.
*/
export const VideoFrame = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<VideoFrame, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<VideoFrame>,
});
})();
const FfiConverterTypeVideoFrame = (() => {
type TypeName = VideoFrame;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
sequence: FfiConverterUInt64.read(from),
codec: FfiConverterString.read(from),
keyframe: FfiConverterBool.read(from),
width: FfiConverterUInt32.read(from),
height: FfiConverterUInt32.read(from),
captureTimestampUs: FfiConverterUInt64.read(from),
codecEpoch: FfiConverterUInt64.read(from),
geometryEpoch: FfiConverterUInt64.read(from),
data: FfiConverterArrayBuffer.read(from),
headerJson: FfiConverterString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt64.write(value.sequence, into);
FfiConverterString.write(value.codec, into);
FfiConverterBool.write(value.keyframe, into);
FfiConverterUInt32.write(value.width, into);
FfiConverterUInt32.write(value.height, into);
FfiConverterUInt64.write(value.captureTimestampUs, into);
FfiConverterUInt64.write(value.codecEpoch, into);
FfiConverterUInt64.write(value.geometryEpoch, into);
FfiConverterArrayBuffer.write(value.data, into);
FfiConverterString.write(value.headerJson, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.sequence) +
FfiConverterString.allocationSize(value.codec) +
FfiConverterBool.allocationSize(value.keyframe) +
FfiConverterUInt32.allocationSize(value.width) +
FfiConverterUInt32.allocationSize(value.height) +
FfiConverterUInt64.allocationSize(value.captureTimestampUs) +
FfiConverterUInt64.allocationSize(value.codecEpoch) +
FfiConverterUInt64.allocationSize(value.geometryEpoch) +
FfiConverterArrayBuffer.allocationSize(value.data) +
FfiConverterString.allocationSize(value.headerJson);
}
};
return new FFIConverter();
})();
/**
* A link to the sandbox desktop in the cua-spacesd HTML5 viewer.
*/
export type ViewerLink = {
/**
* Open this in any modern browser. The credential is in the fragment
* (`#ticket=`), which browsers never send to a server.
*/
url: string,
/**
* When the link stops working for new connections (unix seconds).
*/
expiresAtUnix: bigint
}
/**
* Generated factory for {@link ViewerLink} record objects.
*/
export const ViewerLink = (() => {
const defaults = () => ({
});
const create = (() => {
return uniffiCreateRecord<ViewerLink, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ViewerLink>,
});
})();
const FfiConverterTypeViewerLink = (() => {
type TypeName = ViewerLink;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
url: FfiConverterString.read(from),
expiresAtUnix: FfiConverterInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterString.write(value.url, into);
FfiConverterInt64.write(value.expiresAtUnix, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.url) +
FfiConverterInt64.allocationSize(value.expiresAtUnix);
}
};
return new FFIConverter();
})();
/**
* Options for [`Sandbox::viewer_url`].
*/
export type ViewerOptions = {
/**
* Lifetime of the link in seconds (60 to 86400). Default 3600.
*/
ttlSeconds?: number,
/**
* Watch only: no input, clipboard, files or microphone.
*/
viewOnly: boolean,
/**
* Two-way clipboard sync.
*/
clipboard: boolean,
/**
* Guest directory for uploads and folder sharing (`~` is the desktop
* user's home). `None` means `~`; an empty string turns files off.
*/
filesRoot?: string,
/**
* Allow the microphone (also subject to the sandbox's uplink policy).
*/
microphone: boolean
}
/**
* Generated factory for {@link ViewerOptions} record objects.
*/
export const ViewerOptions = (() => {
const defaults = () => ({
ttlSeconds: undefined,
viewOnly: false,
clipboard: true,
filesRoot: undefined,
microphone: true
});
const create = (() => {
return uniffiCreateRecord<ViewerOptions, ReturnType<typeof defaults>>(defaults);
})();
return Object.freeze({
create,
new: create,
defaults: () => Object.freeze(defaults()) as Partial<ViewerOptions>,
});
})();
const FfiConverterTypeViewerOptions = (() => {
type TypeName = ViewerOptions;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
ttlSeconds: FfiConverterOptionalUInt32.read(from),
viewOnly: FfiConverterBool.read(from),
clipboard: FfiConverterBool.read(from),
filesRoot: FfiConverterOptionalString.read(from),
microphone: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterOptionalUInt32.write(value.ttlSeconds, into);
FfiConverterBool.write(value.viewOnly, into);
FfiConverterBool.write(value.clipboard, into);
FfiConverterOptionalString.write(value.filesRoot, into);
FfiConverterBool.write(value.microphone, into);
}
allocationSize(value: TypeName): number {
return FfiConverterOptionalUInt32.allocationSize(value.ttlSeconds) +
FfiConverterBool.allocationSize(value.viewOnly) +
FfiConverterBool.allocationSize(value.clipboard) +
FfiConverterOptionalString.allocationSize(value.filesRoot) +
FfiConverterBool.allocationSize(value.microphone);
}
};
return new FFIConverter();
})();
// Flat error type: CuaError
export enum CuaError_Tags {
InvalidArgument = "InvalidArgument",
InvalidPlacement = "InvalidPlacement",
NotFound = "NotFound",
ProviderNotConfigured = "ProviderNotConfigured",
Unsupported = "Unsupported",
SpacesdNotAvailable = "SpacesdNotAvailable",
Timeout = "Timeout",
Runtime = "Runtime",
Env = "Env",
Http = "Http",
Unauthenticated = "Unauthenticated",
PermissionDenied = "PermissionDenied",
Transport = "Transport",
DaemonNotRunning = "DaemonNotRunning",
Closed = "Closed",
CapabilityMissing = "CapabilityMissing",
HostCapabilityMissing = "HostCapabilityMissing",
TeleportRefused = "TeleportRefused",
Internal = "Internal",
AmbiguousSandbox = "AmbiguousSandbox",
InsufficientDisk = "InsufficientDisk",
ImageNotPublished = "ImageNotPublished",
Cancelled = "Cancelled",
Cloud = "Cloud",
HostCapacity = "HostCapacity"
}
/**
* Every error the SDK raises. Flat across the FFI: each language sees one
* exception/error type with a case per variant and the message.
*/
export const CuaError = (() => {
/**
* Bad input.
*
* Fix: Check the value against the reference; the message names the
* argument and what it accepts.
*/
class InvalidArgument extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 1;
readonly tag = CuaError_Tags.InvalidArgument;
constructor(message: string) {
super("CuaError", "InvalidArgument", message);
}
static instanceOf(e: any): e is InvalidArgument {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 1
);
}
}
/**
* A location, kind or runtime that does not exist, or a combination of
* them (or with the image) that does not. The message ends with the
* valid values for that context.
*
* Fix: Use one of the values the message lists, or leave `kind` and
* `runtime` unset (`auto`). `cua config list` shows the defaults in
* effect.
*/
class InvalidPlacement extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 2;
readonly tag = CuaError_Tags.InvalidPlacement;
constructor(message: string) {
super("CuaError", "InvalidPlacement", message);
}
static instanceOf(e: any): e is InvalidPlacement {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 2
);
}
}
/**
* No such sandbox, process, path, forward or session.
*
* Fix: Check the ref, path or id. `Sandboxes.list` (`cua sb ls`) lists the
* sandboxes this client can see.
*/
class NotFound extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 3;
readonly tag = CuaError_Tags.NotFound;
constructor(message: string) {
super("CuaError", "NotFound", message);
}
static instanceOf(e: any): e is NotFound {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 3
);
}
}
/**
* The provider is not configured (for example no credentials for it).
*
* Fix: Set the credentials the message names (for a contrib provider, its
* environment variable or `cua auth provider set <name>`).
*/
class ProviderNotConfigured extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 4;
readonly tag = CuaError_Tags.ProviderNotConfigured;
constructor(message: string) {
super("CuaError", "ProviderNotConfigured", message);
}
static instanceOf(e: any): e is ProviderNotConfigured {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 4
);
}
}
/**
* Not supported by this provider, guest or build.
*
* Fix: Use a provider, image or runtime that supports the call; the
* message names what is missing.
*/
class Unsupported extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 5;
readonly tag = CuaError_Tags.Unsupported;
constructor(message: string) {
super("CuaError", "Unsupported", message);
}
static instanceOf(e: any): e is Unsupported {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 5
);
}
}
/**
* No cua-spacesd answered in the sandbox or at the URL.
*
* Fix: Use an image that runs cua-spacesd (the canonical Linux image does),
* or reach the sandbox through the services it declares.
*/
class SpacesdNotAvailable extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 6;
readonly tag = CuaError_Tags.SpacesdNotAvailable;
constructor(message: string) {
super("CuaError", "SpacesdNotAvailable", message);
}
static instanceOf(e: any): e is SpacesdNotAvailable {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 6
);
}
}
/**
* A deadline elapsed.
*
* Fix: Raise the timeout (for example `ready_timeout_ms`), and check that
* the sandbox or service actually starts.
*/
class Timeout extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 7;
readonly tag = CuaError_Tags.Timeout;
constructor(message: string) {
super("CuaError", "Timeout", message);
}
static instanceOf(e: any): e is Timeout {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 7
);
}
}
/**
* Local runtime failure.
*
* Fix: Run `cua runtime doctor` (`Local.doctor`) and follow the steps it
* prints.
*/
class Runtime extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 8;
readonly tag = CuaError_Tags.Runtime;
constructor(message: string) {
super("CuaError", "Runtime", message);
}
static instanceOf(e: any): e is Runtime {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 8
);
}
}
/**
* spacesd call failure.
*
* Fix: Read the status in the message; `SpacesdClient.capabilities` tells
* whether this spacesd supports the call.
*/
class Env extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 9;
readonly tag = CuaError_Tags.Env;
constructor(message: string) {
super("CuaError", "Env", message);
}
static instanceOf(e: any): e is Env {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 9
);
}
}
/**
* HTTP failure talking to a sandbox service.
*
* Fix: Check that the service listens on its declared port and answers
* HTTP.
*/
class Http extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 10;
readonly tag = CuaError_Tags.Http;
constructor(message: string) {
super("CuaError", "Http", message);
}
static instanceOf(e: any): e is Http {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 10
);
}
}
/**
* Missing or wrong token or ticket.
*
* Fix: Pass the sandbox's env token, or run `cua auth login` again.
*/
class Unauthenticated extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 11;
readonly tag = CuaError_Tags.Unauthenticated;
constructor(message: string) {
super("CuaError", "Unauthenticated", message);
}
static instanceOf(e: any): e is Unauthenticated {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 11
);
}
}
/**
* The guest OS denied permission.
*
* Fix: Run the call as a guest user allowed to do it, or change the
* permissions of the path.
*/
class PermissionDenied extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 12;
readonly tag = CuaError_Tags.PermissionDenied;
constructor(message: string) {
super("CuaError", "PermissionDenied", message);
}
static instanceOf(e: any): e is PermissionDenied {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 12
);
}
}
/**
* Could not reach the daemon or the endpoint.
*
* Fix: Check the address. For a daemon client, start the daemon with `cua
* daemon start`.
*/
class Transport extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 13;
readonly tag = CuaError_Tags.Transport;
constructor(message: string) {
super("CuaError", "Transport", message);
}
static instanceOf(e: any): e is Transport {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 13
);
}
}
/**
* No `cua daemon` is running: nothing listens at its socket or
* port, or its discovery file (`~/.cua/daemon.json`) was left by a
* daemon that exited. The message says so in plain words.
*
* Fix: Start Cua (the Spaces app starts the daemon), or run `cua daemon
* start`. `Cua.auto` uses the runtime in this process when no daemon
* runs.
*/
class DaemonNotRunning extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 14;
readonly tag = CuaError_Tags.DaemonNotRunning;
constructor(message: string) {
super("CuaError", "DaemonNotRunning", message);
}
static instanceOf(e: any): e is DaemonNotRunning {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 14
);
}
}
/**
* The object was closed.
*
* Fix: Open a new handle or session; a closed one stays closed.
*/
class Closed extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 15;
readonly tag = CuaError_Tags.Closed;
constructor(message: string) {
super("CuaError", "Closed", message);
}
static instanceOf(e: any): e is Closed {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 15
);
}
}
/**
* The Space's spacesd reports a feature this call needs as
* unsupported (the message names it).
*
* Fix: Use a Space whose spacesd supports the feature (`Space.supports`),
* or update cua-spacesd on it.
*/
class CapabilityMissing extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 16;
readonly tag = CuaError_Tags.CapabilityMissing;
constructor(message: string) {
super("CuaError", "CapabilityMissing", message);
}
static instanceOf(e: any): e is CapabilityMissing {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 16
);
}
}
/**
* A host-side prerequisite (app-session providers, an operator
* display, a local runtime) is not available.
*
* Fix: Install or start the prerequisite the message names on this
* computer.
*/
class HostCapabilityMissing extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 17;
readonly tag = CuaError_Tags.HostCapabilityMissing;
constructor(message: string) {
super("CuaError", "HostCapabilityMissing", message);
}
static instanceOf(e: any): e is HostCapabilityMissing {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 17
);
}
}
/**
* The teleport consent gate refused (or the approver declined).
*
* Fix: Approve the manifest in the consent callback, or teleport a smaller
* scope.
*/
class TeleportRefused extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 18;
readonly tag = CuaError_Tags.TeleportRefused;
constructor(message: string) {
super("CuaError", "TeleportRefused", message);
}
static instanceOf(e: any): e is TeleportRefused {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 18
);
}
}
/**
* Bug or I/O failure.
*
* Fix: Report it with the message at https://github.com/trycua/cua/issues.
*/
class Internal extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 19;
readonly tag = CuaError_Tags.Internal;
constructor(message: string) {
super("CuaError", "Internal", message);
}
static instanceOf(e: any): e is Internal {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 19
);
}
}
/**
* A bare sandbox name matches sandboxes in more than one location. The
* message ends with the qualified candidates (`use one of: local:box,
* cloud:box`); `ambiguous_sandbox_candidates` extracts them.
*
* Fix: Use one of the qualified refs the message lists (`local:<name>`,
* `cloud:<name>`).
*/
class AmbiguousSandbox extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 20;
readonly tag = CuaError_Tags.AmbiguousSandbox;
constructor(message: string) {
super("CuaError", "AmbiguousSandbox", message);
}
static instanceOf(e: any): e is AmbiguousSandbox {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 20
);
}
}
/**
* A pull, build or VM create would leave less than the configured
* minimum free disk space (`CUA_DISK_MIN_FREE`, default 5 GiB);
* nothing was written.
*
* Fix: Free space with `cua cache prune`, or lower `CUA_DISK_MIN_FREE`.
*/
class InsufficientDisk extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 21;
readonly tag = CuaError_Tags.InsufficientDisk;
constructor(message: string) {
super("CuaError", "InsufficientDisk", message);
}
static instanceOf(e: any): e is InsufficientDisk {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 21
);
}
}
/**
* A catalog image (an `Image.*` constructor, a tier or `cua sb create
* <word>`) that CI has not published yet. The message names the
* reference.
*
* Fix: Pass the reference explicitly (`Image.from_registry("<ref>")`,
* `cua sb create <ref>`) to use it anyway, or pick a published image
* (`cua images ls`).
*/
class ImageNotPublished extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 22;
readonly tag = CuaError_Tags.ImageNotPublished;
constructor(message: string) {
super("CuaError", "ImageNotPublished", message);
}
static instanceOf(e: any): e is ImageNotPublished {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 22
);
}
}
/**
* The create was cancelled (`Spaces.cancel_create`, Ctrl-C in `cua`,
* or its caller went away). What it made is gone; the message says
* what was removed and what stays (finished image downloads stay
* cached, so the next create resumes).
*
* Fix: Nothing to clean up. Create it again when you want it.
*/
class Cancelled extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 23;
readonly tag = CuaError_Tags.Cancelled;
constructor(message: string) {
super("CuaError", "Cancelled", message);
}
static instanceOf(e: any): e is Cancelled {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 23
);
}
}
/**
* Your own cloud account (AWS, Google Cloud, Hetzner, Modal) refused or failed
* a call Cua made for a Space there: a missing permission, a quota, a
* region without the machine type. The message names the cloud's own
* error.
*
* Fix: Fix what the message names in that account (`cua cloud test
* <provider>` checks it without creating anything), or connect another
* region or project.
*/
class Cloud extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 24;
readonly tag = CuaError_Tags.Cloud;
constructor(message: string) {
super("CuaError", "Cloud", message);
}
static instanceOf(e: any): e is Cloud {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 24
);
}
}
/**
* The machine has no room for another Space now: its VMs are at their
* memory limit (shared snapshot memory counted once) or CPU limit, or
* the machine itself is low on memory. Nothing was started. The
* message says which limit, by how much, and what to do.
*
* Fix: Delete a Space, create it smaller (`cpus`, `memory_mb`), create
* it on another machine (`on="auto"`), or raise the limit on this one
* (`CUA_VM_MAX_RSS_FRACTION`, `CUA_VM_VCPU_OVERCOMMIT`).
*/
class HostCapacity extends UniffiError {
/**
* @private
* This field is private and should not be used.
*/
readonly [uniffiTypeNameSymbol]: string = "CuaError";
/**
* @private
* This field is private and should not be used.
*/
readonly [variantOrdinalSymbol] = 25;
readonly tag = CuaError_Tags.HostCapacity;
constructor(message: string) {
super("CuaError", "HostCapacity", message);
}
static instanceOf(e: any): e is HostCapacity {
return (
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 25
);
}
}
// Utility function which does not rely on instanceof.
function instanceOf(e: any): e is CuaError {
return (e as any)[uniffiTypeNameSymbol] === "CuaError";
}
return {
InvalidArgument,
InvalidPlacement,
NotFound,
ProviderNotConfigured,
Unsupported,
SpacesdNotAvailable,
Timeout,
Runtime,
Env,
Http,
Unauthenticated,
PermissionDenied,
Transport,
DaemonNotRunning,
Closed,
CapabilityMissing,
HostCapabilityMissing,
TeleportRefused,
Internal,
AmbiguousSandbox,
InsufficientDisk,
ImageNotPublished,
Cancelled,
Cloud,
HostCapacity,
instanceOf,
};
})();
// Union type for CuaError error type.
/**
* Every error the SDK raises. Flat across the FFI: each language sees one
* exception/error type with a case per variant and the message.
*/
export type CuaError = InstanceType<
typeof CuaError['InvalidArgument' | 'InvalidPlacement' | 'NotFound' | 'ProviderNotConfigured' | 'Unsupported' | 'SpacesdNotAvailable' | 'Timeout' | 'Runtime' | 'Env' | 'Http' | 'Unauthenticated' | 'PermissionDenied' | 'Transport' | 'DaemonNotRunning' | 'Closed' | 'CapabilityMissing' | 'HostCapabilityMissing' | 'TeleportRefused' | 'Internal' | 'AmbiguousSandbox' | 'InsufficientDisk' | 'ImageNotPublished' | 'Cancelled' | 'Cloud' | 'HostCapacity']
>;
const FfiConverterTypeCuaError = (() => {
const intConverter = FfiConverterInt32;
type TypeName = CuaError;
class FfiConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (intConverter.read(from)) {
case 1: return new CuaError.InvalidArgument(
FfiConverterString.read(from)
);
case 2: return new CuaError.InvalidPlacement(
FfiConverterString.read(from)
);
case 3: return new CuaError.NotFound(
FfiConverterString.read(from)
);
case 4: return new CuaError.ProviderNotConfigured(
FfiConverterString.read(from)
);
case 5: return new CuaError.Unsupported(
FfiConverterString.read(from)
);
case 6: return new CuaError.SpacesdNotAvailable(
FfiConverterString.read(from)
);
case 7: return new CuaError.Timeout(
FfiConverterString.read(from)
);
case 8: return new CuaError.Runtime(
FfiConverterString.read(from)
);
case 9: return new CuaError.Env(
FfiConverterString.read(from)
);
case 10: return new CuaError.Http(
FfiConverterString.read(from)
);
case 11: return new CuaError.Unauthenticated(
FfiConverterString.read(from)
);
case 12: return new CuaError.PermissionDenied(
FfiConverterString.read(from)
);
case 13: return new CuaError.Transport(
FfiConverterString.read(from)
);
case 14: return new CuaError.DaemonNotRunning(
FfiConverterString.read(from)
);
case 15: return new CuaError.Closed(
FfiConverterString.read(from)
);
case 16: return new CuaError.CapabilityMissing(
FfiConverterString.read(from)
);
case 17: return new CuaError.HostCapabilityMissing(
FfiConverterString.read(from)
);
case 18: return new CuaError.TeleportRefused(
FfiConverterString.read(from)
);
case 19: return new CuaError.Internal(
FfiConverterString.read(from)
);
case 20: return new CuaError.AmbiguousSandbox(
FfiConverterString.read(from)
);
case 21: return new CuaError.InsufficientDisk(
FfiConverterString.read(from)
);
case 22: return new CuaError.ImageNotPublished(
FfiConverterString.read(from)
);
case 23: return new CuaError.Cancelled(
FfiConverterString.read(from)
);
case 24: return new CuaError.Cloud(
FfiConverterString.read(from)
);
case 25: return new CuaError.HostCapacity(
FfiConverterString.read(from)
);
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
const obj = value as any;
const index = obj[variantOrdinalSymbol] as number;
intConverter.write(index, into);
}
allocationSize(value: TypeName): number {
return intConverter.allocationSize(0);
}
}
return new FfiConverter();
})();
// Enum: ForkBatchEvent
export enum ForkBatchEvent_Tags {
Placement = "Placement",
Sync = "Sync",
Item = "Item",
Done = "Done"
}
/**
* A batch event.
*/
export const ForkBatchEvent = (() => {
type Placement__interface = {
tag: ForkBatchEvent_Tags.Placement;
inner:
Readonly<{placement: ForkBatchPlacement}>
};
/**
* A group was placed.
*/
class Placement_ extends UniffiEnum implements Placement__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ForkBatchEvent";
readonly tag = ForkBatchEvent_Tags.Placement;
readonly inner:
Readonly<{placement: ForkBatchPlacement}>;
constructor(
inner: {placement: ForkBatchPlacement }) {
super("ForkBatchEvent", "Placement");
this.inner = Object.freeze(inner);
}
static new(
inner: {placement: ForkBatchPlacement }): Placement_ {
return new Placement_(inner);
}
static instanceOf(obj: any): obj is Placement_ {
return obj.tag === ForkBatchEvent_Tags.Placement;
}
}
type Sync__interface = {
tag: ForkBatchEvent_Tags.Sync;
inner:
Readonly<{progress: SnapshotSyncProgress}>
};
/**
* A checkpoint is being copied to a machine.
*/
class Sync_ extends UniffiEnum implements Sync__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ForkBatchEvent";
readonly tag = ForkBatchEvent_Tags.Sync;
readonly inner:
Readonly<{progress: SnapshotSyncProgress}>;
constructor(
inner: {progress: SnapshotSyncProgress }) {
super("ForkBatchEvent", "Sync");
this.inner = Object.freeze(inner);
}
static new(
inner: {progress: SnapshotSyncProgress }): Sync_ {
return new Sync_(inner);
}
static instanceOf(obj: any): obj is Sync_ {
return obj.tag === ForkBatchEvent_Tags.Sync;
}
}
type Item__interface = {
tag: ForkBatchEvent_Tags.Item;
inner:
Readonly<{item: ForkBatchItem}>
};
/**
* A fork is ready, or failed.
*/
class Item_ extends UniffiEnum implements Item__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ForkBatchEvent";
readonly tag = ForkBatchEvent_Tags.Item;
readonly inner:
Readonly<{item: ForkBatchItem}>;
constructor(
inner: {item: ForkBatchItem }) {
super("ForkBatchEvent", "Item");
this.inner = Object.freeze(inner);
}
static new(
inner: {item: ForkBatchItem }): Item_ {
return new Item_(inner);
}
static instanceOf(obj: any): obj is Item_ {
return obj.tag === ForkBatchEvent_Tags.Item;
}
}
type Done__interface = {
tag: ForkBatchEvent_Tags.Done;
inner:
Readonly<{summary: ForkBatchSummary}>
};
/**
* The batch is over (the last event).
*/
class Done_ extends UniffiEnum implements Done__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ForkBatchEvent";
readonly tag = ForkBatchEvent_Tags.Done;
readonly inner:
Readonly<{summary: ForkBatchSummary}>;
constructor(
inner: {summary: ForkBatchSummary }) {
super("ForkBatchEvent", "Done");
this.inner = Object.freeze(inner);
}
static new(
inner: {summary: ForkBatchSummary }): Done_ {
return new Done_(inner);
}
static instanceOf(obj: any): obj is Done_ {
return obj.tag === ForkBatchEvent_Tags.Done;
}
}
function instanceOf(obj: any): obj is ForkBatchEvent {
return obj[uniffiTypeNameSymbol] === "ForkBatchEvent";
}
return Object.freeze({
instanceOf,
Placement: Placement_,
Sync: Sync_,
Item: Item_,
Done: Done_
});
})();
/**
* A batch event.
*/
export type ForkBatchEvent = InstanceType<
typeof ForkBatchEvent['Placement' | 'Sync' | 'Item' | 'Done']
>;
// FfiConverter for enum ForkBatchEvent
const FfiConverterTypeForkBatchEvent = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = ForkBatchEvent;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return new ForkBatchEvent.Placement({placement: FfiConverterTypeForkBatchPlacement.read(from) });
case 2: return new ForkBatchEvent.Sync({progress: FfiConverterTypeSnapshotSyncProgress.read(from) });
case 3: return new ForkBatchEvent.Item({item: FfiConverterTypeForkBatchItem.read(from) });
case 4: return new ForkBatchEvent.Done({summary: FfiConverterTypeForkBatchSummary.read(from) });
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value.tag) {
case ForkBatchEvent_Tags.Placement: {
ordinalConverter.write(1, into);
const inner = value.inner;
FfiConverterTypeForkBatchPlacement.write(inner.placement, into);
return;
}
case ForkBatchEvent_Tags.Sync: {
ordinalConverter.write(2, into);
const inner = value.inner;
FfiConverterTypeSnapshotSyncProgress.write(inner.progress, into);
return;
}
case ForkBatchEvent_Tags.Item: {
ordinalConverter.write(3, into);
const inner = value.inner;
FfiConverterTypeForkBatchItem.write(inner.item, into);
return;
}
case ForkBatchEvent_Tags.Done: {
ordinalConverter.write(4, into);
const inner = value.inner;
FfiConverterTypeForkBatchSummary.write(inner.summary, into);
return;
}
default:
// Throwing from here means that ForkBatchEvent_Tags hasn't matched an ordinal.
throw new UniffiInternalError.UnexpectedEnumCase();
}
}
allocationSize(value: TypeName): number {
switch (value.tag) {
case ForkBatchEvent_Tags.Placement: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(1);
size += FfiConverterTypeForkBatchPlacement.allocationSize(inner.placement);
return size;
}
case ForkBatchEvent_Tags.Sync: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(2);
size += FfiConverterTypeSnapshotSyncProgress.allocationSize(inner.progress);
return size;
}
case ForkBatchEvent_Tags.Item: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(3);
size += FfiConverterTypeForkBatchItem.allocationSize(inner.item);
return size;
}
case ForkBatchEvent_Tags.Done: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(4);
size += FfiConverterTypeForkBatchSummary.allocationSize(inner.summary);
return size;
}
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
}
return new FFIConverter();
})();
/**
* How a sign-in proceeds.
*/
export enum LoginMethod {
/**
* Open `url` in a browser on this machine; it redirects back here.
*/
Browser = "browser",
/**
* Open `url` on any device and enter `user_code`.
*/
Device = "device"
}
const FfiConverterTypeLoginMethod = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = LoginMethod;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return LoginMethod.Browser;
case 2: return LoginMethod.Device;
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value) {
case LoginMethod.Browser: return ordinalConverter.write(1, into);
case LoginMethod.Device: return ordinalConverter.write(2, into);
}
}
allocationSize(value: TypeName): number {
return ordinalConverter.allocationSize(0);
}
}
return new FFIConverter();
})();
// Enum: ReplayMode
export enum ReplayMode_Tags {
None = "None",
All = "All",
LastBytes = "LastBytes",
FromOffset = "FromOffset"
}
/**
* Scrollback replay when attaching.
*/
export const ReplayMode = (() => {
type None__interface = {
tag: ReplayMode_Tags.None
};
/**
* Live output only.
*/
class None_ extends UniffiEnum implements None__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ReplayMode";
readonly tag = ReplayMode_Tags.None;
constructor() {
super("ReplayMode", "None");
}
static new(): None_ {
return new None_();
}
static instanceOf(obj: any): obj is None_ {
return obj.tag === ReplayMode_Tags.None;
}
}
type All__interface = {
tag: ReplayMode_Tags.All
};
/**
* Everything retained.
*/
class All_ extends UniffiEnum implements All__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ReplayMode";
readonly tag = ReplayMode_Tags.All;
constructor() {
super("ReplayMode", "All");
}
static new(): All_ {
return new All_();
}
static instanceOf(obj: any): obj is All_ {
return obj.tag === ReplayMode_Tags.All;
}
}
type LastBytes__interface = {
tag: ReplayMode_Tags.LastBytes;
inner:
Readonly<{n: bigint}>
};
/**
* The last `n` bytes.
*/
class LastBytes_ extends UniffiEnum implements LastBytes__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ReplayMode";
readonly tag = ReplayMode_Tags.LastBytes;
readonly inner:
Readonly<{n: bigint}>;
constructor(
inner: {n: bigint }) {
super("ReplayMode", "LastBytes");
this.inner = Object.freeze(inner);
}
static new(
inner: {n: bigint }): LastBytes_ {
return new LastBytes_(inner);
}
static instanceOf(obj: any): obj is LastBytes_ {
return obj.tag === ReplayMode_Tags.LastBytes;
}
}
type FromOffset__interface = {
tag: ReplayMode_Tags.FromOffset;
inner:
Readonly<{offset: bigint}>
};
/**
* From this combined-output offset.
*/
class FromOffset_ extends UniffiEnum implements FromOffset__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ReplayMode";
readonly tag = ReplayMode_Tags.FromOffset;
readonly inner:
Readonly<{offset: bigint}>;
constructor(
inner: {offset: bigint }) {
super("ReplayMode", "FromOffset");
this.inner = Object.freeze(inner);
}
static new(
inner: {offset: bigint }): FromOffset_ {
return new FromOffset_(inner);
}
static instanceOf(obj: any): obj is FromOffset_ {
return obj.tag === ReplayMode_Tags.FromOffset;
}
}
function instanceOf(obj: any): obj is ReplayMode {
return obj[uniffiTypeNameSymbol] === "ReplayMode";
}
return Object.freeze({
instanceOf,
None: None_,
All: All_,
LastBytes: LastBytes_,
FromOffset: FromOffset_
});
})();
/**
* Scrollback replay when attaching.
*/
export type ReplayMode = InstanceType<
typeof ReplayMode['None' | 'All' | 'LastBytes' | 'FromOffset']
>;
// FfiConverter for enum ReplayMode
const FfiConverterTypeReplayMode = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = ReplayMode;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return new ReplayMode.None();
case 2: return new ReplayMode.All();
case 3: return new ReplayMode.LastBytes({n: FfiConverterUInt64.read(from) });
case 4: return new ReplayMode.FromOffset({offset: FfiConverterUInt64.read(from) });
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value.tag) {
case ReplayMode_Tags.None: {
ordinalConverter.write(1, into);
return;
}
case ReplayMode_Tags.All: {
ordinalConverter.write(2, into);
return;
}
case ReplayMode_Tags.LastBytes: {
ordinalConverter.write(3, into);
const inner = value.inner;
FfiConverterUInt64.write(inner.n, into);
return;
}
case ReplayMode_Tags.FromOffset: {
ordinalConverter.write(4, into);
const inner = value.inner;
FfiConverterUInt64.write(inner.offset, into);
return;
}
default:
// Throwing from here means that ReplayMode_Tags hasn't matched an ordinal.
throw new UniffiInternalError.UnexpectedEnumCase();
}
}
allocationSize(value: TypeName): number {
switch (value.tag) {
case ReplayMode_Tags.None: {
return ordinalConverter.allocationSize(1);
}
case ReplayMode_Tags.All: {
return ordinalConverter.allocationSize(2);
}
case ReplayMode_Tags.LastBytes: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(3);
size += FfiConverterUInt64.allocationSize(inner.n);
return size;
}
case ReplayMode_Tags.FromOffset: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(4);
size += FfiConverterUInt64.allocationSize(inner.offset);
return size;
}
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
}
return new FFIConverter();
})();
// Enum: ResourcesEvent
export enum ResourcesEvent_Tags {
Snapshot = "Snapshot",
Update = "Update",
LowDisk = "LowDisk"
}
/**
* What [`Spaces::watch_resources`] reports.
*/
export const ResourcesEvent = (() => {
type Snapshot__interface = {
tag: ResourcesEvent_Tags.Snapshot;
inner:
Readonly<{snapshot: ResourcesSnapshot}>
};
/**
* Everything, at the start (and again after a reconnect).
*/
class Snapshot_ extends UniffiEnum implements Snapshot__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ResourcesEvent";
readonly tag = ResourcesEvent_Tags.Snapshot;
readonly inner:
Readonly<{snapshot: ResourcesSnapshot}>;
constructor(
inner: {snapshot: ResourcesSnapshot }) {
super("ResourcesEvent", "Snapshot");
this.inner = Object.freeze(inner);
}
static new(
inner: {snapshot: ResourcesSnapshot }): Snapshot_ {
return new Snapshot_(inner);
}
static instanceOf(obj: any): obj is Snapshot_ {
return obj.tag === ResourcesEvent_Tags.Snapshot;
}
}
type Update__interface = {
tag: ResourcesEvent_Tags.Update;
inner:
Readonly<{update: ResourcesUpdate}>
};
/**
* Only what changed.
*/
class Update_ extends UniffiEnum implements Update__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ResourcesEvent";
readonly tag = ResourcesEvent_Tags.Update;
readonly inner:
Readonly<{update: ResourcesUpdate}>;
constructor(
inner: {update: ResourcesUpdate }) {
super("ResourcesEvent", "Update");
this.inner = Object.freeze(inner);
}
static new(
inner: {update: ResourcesUpdate }): Update_ {
return new Update_(inner);
}
static instanceOf(obj: any): obj is Update_ {
return obj.tag === ResourcesEvent_Tags.Update;
}
}
type LowDisk__interface = {
tag: ResourcesEvent_Tags.LowDisk;
inner:
Readonly<{warning: DiskWarning}>
};
/**
* The low-disk level changed (including back to `ok`).
*/
class LowDisk_ extends UniffiEnum implements LowDisk__interface {
/**
* @private
* This field is private and should not be used, use `tag` instead.
*/
readonly [uniffiTypeNameSymbol] = "ResourcesEvent";
readonly tag = ResourcesEvent_Tags.LowDisk;
readonly inner:
Readonly<{warning: DiskWarning}>;
constructor(
inner: {warning: DiskWarning }) {
super("ResourcesEvent", "LowDisk");
this.inner = Object.freeze(inner);
}
static new(
inner: {warning: DiskWarning }): LowDisk_ {
return new LowDisk_(inner);
}
static instanceOf(obj: any): obj is LowDisk_ {
return obj.tag === ResourcesEvent_Tags.LowDisk;
}
}
function instanceOf(obj: any): obj is ResourcesEvent {
return obj[uniffiTypeNameSymbol] === "ResourcesEvent";
}
return Object.freeze({
instanceOf,
Snapshot: Snapshot_,
Update: Update_,
LowDisk: LowDisk_
});
})();
/**
* What [`Spaces::watch_resources`] reports.
*/
export type ResourcesEvent = InstanceType<
typeof ResourcesEvent['Snapshot' | 'Update' | 'LowDisk']
>;
// FfiConverter for enum ResourcesEvent
const FfiConverterTypeResourcesEvent = (() => {
const ordinalConverter = FfiConverterInt32;
type TypeName = ResourcesEvent;
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return new ResourcesEvent.Snapshot({snapshot: FfiConverterTypeResourcesSnapshot.read(from) });
case 2: return new ResourcesEvent.Update({update: FfiConverterTypeResourcesUpdate.read(from) });
case 3: return new ResourcesEvent.LowDisk({warning: FfiConverterTypeDiskWarning.read(from) });
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
write(value: TypeName, into: RustBuffer): void {
switch (value.tag) {
case ResourcesEvent_Tags.Snapshot: {
ordinalConverter.write(1, into);
const inner = value.inner;
FfiConverterTypeResourcesSnapshot.write(inner.snapshot, into);
return;
}
case ResourcesEvent_Tags.Update: {
ordinalConverter.write(2, into);
const inner = value.inner;
FfiConverterTypeResourcesUpdate.write(inner.update, into);
return;
}
case ResourcesEvent_Tags.LowDisk: {
ordinalConverter.write(3, into);
const inner = value.inner;
FfiConverterTypeDiskWarning.write(inner.warning, into);
return;
}
default:
// Throwing from here means that ResourcesEvent_Tags hasn't matched an ordinal.
throw new UniffiInternalError.UnexpectedEnumCase();
}
}
allocationSize(value: TypeName): number {
switch (value.tag) {
case ResourcesEvent_Tags.Snapshot: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(1);
size += FfiConverterTypeResourcesSnapshot.allocationSize(inner.snapshot);
return size;
}
case ResourcesEvent_Tags.Update: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(2);
size += FfiConverterTypeResourcesUpdate.allocationSize(inner.update);
return size;
}
case ResourcesEvent_Tags.LowDisk: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(3);
size += FfiConverterTypeDiskWarning.allocationSize(inner.warning);
return size;
}
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
}
return new FFIConverter();
})();
/**
* One run.
*/
export interface AgentRunLike {
/**
* Files the run created or changed in its working directory.
*/
artifacts(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<AgentArtifact>>;
/**
* Events after `cursor` (0: from the start), at most `max`.
*/
events(cursor: bigint, max: number | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<AgentEventPage>;
harness(): string;
/**
* Cancels the turn in flight; the session stays open.
*/
interrupt(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<AgentRunInfo>;
/**
* Stops the run and deletes its directory (secrets included).
*/
remove(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
/**
* The last turn's outcome.
*/
result(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<AgentRunResult>;
runId(): string;
/**
* A follow-up in the same session (queued while a turn runs).
*/
send(text: string, files: Array<AgentFile> | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<AgentRunInfo>;
status(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<AgentRunInfo>;
/**
* Stops the run and verifies its process is gone.
*/
stop(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<AgentRunInfo>;
/**
* Waits until no turn is running (at most `timeout_ms`), then returns
* the result.
*/
wait(timeoutMs: bigint | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<AgentRunResult>;
}
/**
* @deprecated Use `AgentRunLike` instead.
*/
export type AgentRunInterface = AgentRunLike;
/**
* One run.
*/
export class AgentRun extends UniffiAbstractObject implements AgentRunLike {
readonly [uniffiTypeNameSymbol] = "AgentRun";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeAgentRunObjectFactory.bless(pointer);
}
/**
* Files the run created or changed in its working directory.
*/
async artifacts(asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentArtifact>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentrun_artifacts(
uniffiTypeAgentRunObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterSequenceTypeAgentArtifact.lift.bind(FfiConverterSequenceTypeAgentArtifact),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Events after `cursor` (0: from the start), at most `max`.
*/
async events(cursor: bigint, max: number | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<AgentEventPage> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentrun_events(
uniffiTypeAgentRunObjectFactory.clonePointer(this),FfiConverterUInt64.lower(cursor, nativeModule().rustbuffer_alloc),FfiConverterOptionalUInt32.lower(max, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeAgentEventPage.lift.bind(FfiConverterTypeAgentEventPage),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
harness(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_agentrun_harness(
uniffiTypeAgentRunObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Cancels the turn in flight; the session stays open.
*/
async interrupt(asyncOpts_?: { signal: AbortSignal }): Promise<AgentRunInfo> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentrun_interrupt(
uniffiTypeAgentRunObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeAgentRunInfo.lift.bind(FfiConverterTypeAgentRunInfo),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Stops the run and deletes its directory (secrets included).
*/
async remove(asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentrun_remove(
uniffiTypeAgentRunObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_void,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_void,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_void,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_void,
/*liftFunc:*/ (_v) => {},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* The last turn's outcome.
*/
async result(asyncOpts_?: { signal: AbortSignal }): Promise<AgentRunResult> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentrun_result(
uniffiTypeAgentRunObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeAgentRunResult.lift.bind(FfiConverterTypeAgentRunResult),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
runId(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_agentrun_run_id(
uniffiTypeAgentRunObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* A follow-up in the same session (queued while a turn runs).
*/
async send(text: string, files: Array<AgentFile> | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<AgentRunInfo> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentrun_send(
uniffiTypeAgentRunObjectFactory.clonePointer(this),FfiConverterString.lower(text, nativeModule().rustbuffer_alloc),FfiConverterOptionalSequenceTypeAgentFile.lower(files, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeAgentRunInfo.lift.bind(FfiConverterTypeAgentRunInfo),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
async status(asyncOpts_?: { signal: AbortSignal }): Promise<AgentRunInfo> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentrun_status(
uniffiTypeAgentRunObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeAgentRunInfo.lift.bind(FfiConverterTypeAgentRunInfo),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Stops the run and verifies its process is gone.
*/
async stop(asyncOpts_?: { signal: AbortSignal }): Promise<AgentRunInfo> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentrun_stop(
uniffiTypeAgentRunObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeAgentRunInfo.lift.bind(FfiConverterTypeAgentRunInfo),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Waits until no turn is running (at most `timeout_ms`), then returns
* the result.
*/
async wait(timeoutMs: bigint | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<AgentRunResult> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentrun_wait(
uniffiTypeAgentRunObjectFactory.clonePointer(this),FfiConverterOptionalUInt64.lower(timeoutMs, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeAgentRunResult.lift.bind(FfiConverterTypeAgentRunResult),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeAgentRunObjectFactory.pointer(this);
uniffiTypeAgentRunObjectFactory.freePointer(pointer);
uniffiTypeAgentRunObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is AgentRun {
return uniffiTypeAgentRunObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeAgentRunObjectFactory: UniffiObjectFactory<AgentRunLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeAgentRunObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): AgentRunLike {
const instance = Object.create(AgentRun.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "AgentRun";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: AgentRunLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: AgentRunLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_agentrun(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_agentrun(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is AgentRunLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "AgentRun";
},
}})();
const FfiConverterTypeAgentRun = new FfiConverterObject(uniffiTypeAgentRunObjectFactory);
/**
* Agent onboarding for this machine's user.
*/
export interface AgentSetupLike {
/**
* Configures the MCP server (default: `cua mcp`, `cua` resolved on
* PATH; `cua-local mcp` named `cua-local` for the Local app) for
* `agents`. A server without a name gets the channel's.
*/
configureMcp(agents: Array<string>, server: AgentMcpServer | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<AgentSetupOutcome>>;
/**
* Every supported agent, installed or not (read-only).
*/
detect(): Array<AgentInfo>;
/**
* Installs `skills` (empty: all bundled) for `agents`. Folders cua did
* not write are skipped unless `force`.
*/
installSkills(agents: Array<string>, skills: Array<string>, force: boolean, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<AgentSetupOutcome>>;
/**
* Whether the user said "never" to agent onboarding.
*/
onboardingDeclined(): boolean;
/**
* Removes what cua added for `agents` (skills and/or MCP).
*/
remove(agents: Array<string>, skills: boolean, mcp: boolean, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<AgentSetupOutcome>>;
/**
* Resolves `all` (installed agents), `none` or `claude,codex` to ids.
*/
select(selection: string) /*throws*/: Array<string>;
/**
* Saves or clears the "never" answer (`~/.cua/config`).
*/
setOnboardingDeclined(declined: boolean) /*throws*/: void;
/**
* Background computer-use for `agents`: the bundled `cua-driver` skill
* (`skills`) and the `cua-driver mcp` server (`mcp`), launching
* `command` (default: the installed cua-driver). The same step as
* `cua agents setup --cua-driver` and the installers' `cua-driver` item.
*/
setupCuaDriver(agents: Array<string>, command: string | undefined, skills: boolean, mcp: boolean, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<AgentSetupOutcome>>;
/**
* Starts `agent`'s own sign-in on this computer (`codex login`: the
* browser opens). Returns once it is running; `detect` reports
* `signed_in` when it is done. cua never reads or copies the sign-in.
*/
signIn(agent: string) /*throws*/: void;
/**
* The skills bundled with this SDK.
*/
skills(): Array<BundledSkill>;
/**
* Same as `detect`, named for status displays.
*/
status(): Array<AgentInfo>;
/**
* Refreshes installed cua skills and re-points managed MCP entries.
*/
update(server: AgentMcpServer | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<AgentSetupOutcome>>;
}
/**
* @deprecated Use `AgentSetupLike` instead.
*/
export type AgentSetupInterface = AgentSetupLike;
/**
* Agent onboarding for this machine's user.
*/
export class AgentSetup extends UniffiAbstractObject implements AgentSetupLike {
readonly [uniffiTypeNameSymbol] = "AgentSetup";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeAgentSetupObjectFactory.bless(pointer);
}
/**
* Configures the MCP server (default: `cua mcp`, `cua` resolved on
* PATH; `cua-local mcp` named `cua-local` for the Local app) for
* `agents`. A server without a name gets the channel's.
*/
async configureMcp(agents: Array<string>, server: AgentMcpServer | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentsetup_configure_mcp(
uniffiTypeAgentSetupObjectFactory.clonePointer(this),FfiConverterSequenceString.lower(agents, nativeModule().rustbuffer_alloc),FfiConverterOptionalTypeAgentMcpServer.lower(server, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterSequenceTypeAgentSetupOutcome.lift.bind(FfiConverterSequenceTypeAgentSetupOutcome),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Every supported agent, installed or not (read-only).
*/
detect(): Array<AgentInfo> {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceTypeAgentInfo.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_agentsetup_detect(
uniffiTypeAgentSetupObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Installs `skills` (empty: all bundled) for `agents`. Folders cua did
* not write are skipped unless `force`.
*/
async installSkills(agents: Array<string>, skills: Array<string>, force: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentsetup_install_skills(
uniffiTypeAgentSetupObjectFactory.clonePointer(this),FfiConverterSequenceString.lower(agents, nativeModule().rustbuffer_alloc),FfiConverterSequenceString.lower(skills, nativeModule().rustbuffer_alloc),FfiConverterBool.lower(force, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterSequenceTypeAgentSetupOutcome.lift.bind(FfiConverterSequenceTypeAgentSetupOutcome),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Whether the user said "never" to agent onboarding.
*/
onboardingDeclined(): boolean {
return FfiConverterBool.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_agentsetup_onboarding_declined(
uniffiTypeAgentSetupObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Removes what cua added for `agents` (skills and/or MCP).
*/
async remove(agents: Array<string>, skills: boolean, mcp: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentsetup_remove(
uniffiTypeAgentSetupObjectFactory.clonePointer(this),FfiConverterSequenceString.lower(agents, nativeModule().rustbuffer_alloc),FfiConverterBool.lower(skills, nativeModule().rustbuffer_alloc),FfiConverterBool.lower(mcp, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterSequenceTypeAgentSetupOutcome.lift.bind(FfiConverterSequenceTypeAgentSetupOutcome),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Resolves `all` (installed agents), `none` or `claude,codex` to ids.
*/
select(selection: string): Array<string> /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_agentsetup_select(
uniffiTypeAgentSetupObjectFactory.clonePointer(this),
FfiConverterString.lower(selection, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Saves or clears the "never" answer (`~/.cua/config`).
*/
setOnboardingDeclined(declined: boolean): void /*throws*/ {uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_agentsetup_set_onboarding_declined(
uniffiTypeAgentSetupObjectFactory.clonePointer(this),
FfiConverterBool.lower(declined, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
/**
* Background computer-use for `agents`: the bundled `cua-driver` skill
* (`skills`) and the `cua-driver mcp` server (`mcp`), launching
* `command` (default: the installed cua-driver). The same step as
* `cua agents setup --cua-driver` and the installers' `cua-driver` item.
*/
async setupCuaDriver(agents: Array<string>, command: string | undefined, skills: boolean, mcp: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentsetup_setup_cua_driver(
uniffiTypeAgentSetupObjectFactory.clonePointer(this),FfiConverterSequenceString.lower(agents, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(command, nativeModule().rustbuffer_alloc),FfiConverterBool.lower(skills, nativeModule().rustbuffer_alloc),FfiConverterBool.lower(mcp, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterSequenceTypeAgentSetupOutcome.lift.bind(FfiConverterSequenceTypeAgentSetupOutcome),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Starts `agent`'s own sign-in on this computer (`codex login`: the
* browser opens). Returns once it is running; `detect` reports
* `signed_in` when it is done. cua never reads or copies the sign-in.
*/
signIn(agent: string): void /*throws*/ {uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_agentsetup_sign_in(
uniffiTypeAgentSetupObjectFactory.clonePointer(this),
FfiConverterString.lower(agent, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
/**
* The skills bundled with this SDK.
*/
skills(): Array<BundledSkill> {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceTypeBundledSkill.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_agentsetup_skills(
uniffiTypeAgentSetupObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Same as `detect`, named for status displays.
*/
status(): Array<AgentInfo> {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceTypeAgentInfo.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_agentsetup_status(
uniffiTypeAgentSetupObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Refreshes installed cua skills and re-points managed MCP entries.
*/
async update(server: AgentMcpServer | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentSetupOutcome>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agentsetup_update(
uniffiTypeAgentSetupObjectFactory.clonePointer(this),FfiConverterOptionalTypeAgentMcpServer.lower(server, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterSequenceTypeAgentSetupOutcome.lift.bind(FfiConverterSequenceTypeAgentSetupOutcome),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeAgentSetupObjectFactory.pointer(this);
uniffiTypeAgentSetupObjectFactory.freePointer(pointer);
uniffiTypeAgentSetupObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is AgentSetup {
return uniffiTypeAgentSetupObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeAgentSetupObjectFactory: UniffiObjectFactory<AgentSetupLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeAgentSetupObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): AgentSetupLike {
const instance = Object.create(AgentSetup.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "AgentSetup";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: AgentSetupLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: AgentSetupLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_agentsetup(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_agentsetup(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is AgentSetupLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "AgentSetup";
},
}})();
const FfiConverterTypeAgentSetup = new FfiConverterObject(uniffiTypeAgentSetupObjectFactory);
/**
* A run's events folded into conversation items, the same rule in every
* language: the agent's message chunks join into `message` items, the
* prompt is a `user` item (never repeated as agent text), and consecutive
* activity of one turn folds into one `activity` group. Absorbing an event
* twice changes nothing, so a poll can re-read a page.
*/
export interface AgentTranscriptLike {
/**
* Adds events from [`AgentRun::events`].
*/
absorb(events: Array<AgentEvent>): void;
/**
* Adds the events of an `agent_events` result (`Space.agent_events`,
* the MCP tool), or a JSON array of events. Returns the page's
* `cursor` (also kept, see [`AgentTranscript::cursor`]) when it has one.
*/
absorbJson(json: string) /*throws*/: bigint | undefined;
/**
* The highest `agent_events` cursor absorbed: pass it back to read on.
*/
cursor(): bigint;
/**
* The items so far.
*/
items(): Array<AgentTranscriptItem>;
/**
* Adds a line the app itself produced (a start note, "queued") as an
* activity step of `turn`.
*/
note(turn: number, text: string): void;
/**
* The agent's last message on one line (a roster preview), `None`
* before it has said anything. Activity is never a preview.
*/
preview(): string | undefined;
/**
* Changes whenever the items do.
*/
revision(): bigint;
}
/**
* @deprecated Use `AgentTranscriptLike` instead.
*/
export type AgentTranscriptInterface = AgentTranscriptLike;
/**
* A run's events folded into conversation items, the same rule in every
* language: the agent's message chunks join into `message` items, the
* prompt is a `user` item (never repeated as agent text), and consecutive
* activity of one turn folds into one `activity` group. Absorbing an event
* twice changes nothing, so a poll can re-read a page.
*/
export class AgentTranscript extends UniffiAbstractObject implements AgentTranscriptLike {
readonly [uniffiTypeNameSymbol] = "AgentTranscript";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
/**
* An empty transcript.
*/
constructor() {
super();
const pointer =
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_constructor_agenttranscript_new(
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeAgentTranscriptObjectFactory.bless(pointer);
}
/**
* Adds events from [`AgentRun::events`].
*/
absorb(events: Array<AgentEvent>): void {uniffiCaller.rustCall(
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_agenttranscript_absorb(
uniffiTypeAgentTranscriptObjectFactory.clonePointer(this),
FfiConverterSequenceTypeAgentEvent.lower(events, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
/**
* Adds the events of an `agent_events` result (`Space.agent_events`,
* the MCP tool), or a JSON array of events. Returns the page's
* `cursor` (also kept, see [`AgentTranscript::cursor`]) when it has one.
*/
absorbJson(json: string): bigint | undefined /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterOptionalUInt64.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_agenttranscript_absorb_json(
uniffiTypeAgentTranscriptObjectFactory.clonePointer(this),
FfiConverterString.lower(json, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The highest `agent_events` cursor absorbed: pass it back to read on.
*/
cursor(): bigint {
return FfiConverterUInt64.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_agenttranscript_cursor(
uniffiTypeAgentTranscriptObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The items so far.
*/
items(): Array<AgentTranscriptItem> {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceTypeAgentTranscriptItem.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_agenttranscript_items(
uniffiTypeAgentTranscriptObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Adds a line the app itself produced (a start note, "queued") as an
* activity step of `turn`.
*/
note(turn: number, text: string): void {uniffiCaller.rustCall(
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_agenttranscript_note(
uniffiTypeAgentTranscriptObjectFactory.clonePointer(this),
FfiConverterUInt32.lower(turn, nativeModule().rustbuffer_alloc),
FfiConverterString.lower(text, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
/**
* The agent's last message on one line (a roster preview), `None`
* before it has said anything. Activity is never a preview.
*/
preview(): string | undefined {
return ((__rb: Uint8Array) => {
try {
return FfiConverterOptionalString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_agenttranscript_preview(
uniffiTypeAgentTranscriptObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Changes whenever the items do.
*/
revision(): bigint {
return FfiConverterUInt64.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_agenttranscript_revision(
uniffiTypeAgentTranscriptObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeAgentTranscriptObjectFactory.pointer(this);
uniffiTypeAgentTranscriptObjectFactory.freePointer(pointer);
uniffiTypeAgentTranscriptObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is AgentTranscript {
return uniffiTypeAgentTranscriptObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeAgentTranscriptObjectFactory: UniffiObjectFactory<AgentTranscriptLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeAgentTranscriptObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): AgentTranscriptLike {
const instance = Object.create(AgentTranscript.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "AgentTranscript";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: AgentTranscriptLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: AgentTranscriptLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_agenttranscript(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_agenttranscript(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is AgentTranscriptLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "AgentTranscript";
},
}})();
const FfiConverterTypeAgentTranscript = new FfiConverterObject(uniffiTypeAgentTranscriptObjectFactory);
/**
* Agent runs in one sandbox.
*/
export interface AgentsLike {
/**
* Installs harnesses or apps (`["claude-code", "blender"]`: harness
* ids or installable ids) now; returns the progress lines.
*/
ensure(ids: Array<string>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<string>>;
/**
* A handle for an existing run (started by any client).
*/
get(runId: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<AgentRunLike>;
/**
* Every run in the sandbox, newest first.
*/
list(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<AgentRunInfo>>;
/**
* Starts `harness` on `prompt` and returns at once; the run lives in
* the sandbox (fire and forget) until it is stopped.
*/
run(harness: string, prompt: string, options: AgentRunOptions | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<AgentRunLike>;
}
/**
* @deprecated Use `AgentsLike` instead.
*/
export type AgentsInterface = AgentsLike;
/**
* Agent runs in one sandbox.
*/
export class Agents extends UniffiAbstractObject implements AgentsLike {
readonly [uniffiTypeNameSymbol] = "Agents";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeAgentsObjectFactory.bless(pointer);
}
/**
* Installs harnesses or apps (`["claude-code", "blender"]`: harness
* ids or installable ids) now; returns the progress lines.
*/
async ensure(ids: Array<string>, asyncOpts_?: { signal: AbortSignal }): Promise<Array<string>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agents_ensure(
uniffiTypeAgentsObjectFactory.clonePointer(this),FfiConverterSequenceString.lower(ids, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterSequenceString.lift.bind(FfiConverterSequenceString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* A handle for an existing run (started by any client).
*/
async get(runId: string, asyncOpts_?: { signal: AbortSignal }): Promise<AgentRunLike> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agents_get(
uniffiTypeAgentsObjectFactory.clonePointer(this),FfiConverterString.lower(runId, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_u64,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_u64,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_u64,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_u64,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeAgentRun.lift.bind(FfiConverterTypeAgentRun),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Every run in the sandbox, newest first.
*/
async list(asyncOpts_?: { signal: AbortSignal }): Promise<Array<AgentRunInfo>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agents_list(
uniffiTypeAgentsObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterSequenceTypeAgentRunInfo.lift.bind(FfiConverterSequenceTypeAgentRunInfo),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Starts `harness` on `prompt` and returns at once; the run lives in
* the sandbox (fire and forget) until it is stopped.
*/
async run(harness: string, prompt: string, options: AgentRunOptions | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<AgentRunLike> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_agents_run(
uniffiTypeAgentsObjectFactory.clonePointer(this),FfiConverterString.lower(harness, nativeModule().rustbuffer_alloc),FfiConverterString.lower(prompt, nativeModule().rustbuffer_alloc),FfiConverterOptionalTypeAgentRunOptions.lower(options, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_u64,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_u64,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_u64,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_u64,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeAgentRun.lift.bind(FfiConverterTypeAgentRun),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeAgentsObjectFactory.pointer(this);
uniffiTypeAgentsObjectFactory.freePointer(pointer);
uniffiTypeAgentsObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is Agents {
return uniffiTypeAgentsObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeAgentsObjectFactory: UniffiObjectFactory<AgentsLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeAgentsObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): AgentsLike {
const instance = Object.create(Agents.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "Agents";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: AgentsLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: AgentsLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_agents(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_agents(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is AgentsLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Agents";
},
}})();
const FfiConverterTypeAgents = new FfiConverterObject(uniffiTypeAgentsObjectFactory);
/**
* Receives audio packets. Must return quickly.
*/
export interface AudioSink {
/**
* An audio packet.
*/
onAudio(packet: AudioPacket): void;
}
/**
* Receives audio packets. Must return quickly.
*/
export class AudioSinkImpl extends UniffiAbstractObject implements AudioSink {
readonly [uniffiTypeNameSymbol] = "AudioSinkImpl";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeAudioSinkImplObjectFactory.bless(pointer);
}
/**
* An audio packet.
*/
onAudio(packet: AudioPacket): void {uniffiCaller.rustCall(
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_audiosink_on_audio(
uniffiTypeAudioSinkImplObjectFactory.clonePointer(this),
FfiConverterTypeAudioPacket.lower(packet, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeAudioSinkImplObjectFactory.pointer(this);
uniffiTypeAudioSinkImplObjectFactory.freePointer(pointer);
uniffiTypeAudioSinkImplObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is AudioSinkImpl {
return uniffiTypeAudioSinkImplObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeAudioSinkImplObjectFactory: UniffiObjectFactory<AudioSink> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeAudioSinkImplObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): AudioSink {
const instance = Object.create(AudioSinkImpl.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "AudioSinkImpl";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: AudioSink): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: AudioSink): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_audiosink(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_audiosink(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is AudioSink {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "AudioSinkImpl";
},
}})();
const FfiConverterTypeAudioSink = new FfiConverterObjectWithCallbacks(uniffiTypeAudioSinkImplObjectFactory);
// Add a vtable for the callbacks that go in AudioSink.
// Put the implementation in a struct so we don't pollute the top-level namespace
const uniffiCallbackInterfaceAudioSink: { vtable: any; register: () => void; } = {
// Create the VTable using a series of closures.
// ts automatically converts these into C callback functions.
vtable: {
on_audio: (
uniffiHandle: bigint,
packet: Uint8Array,) => {
const uniffiMakeCall =
()
: void => {
const jsCallback = FfiConverterTypeAudioSink.lift(uniffiHandle);
return jsCallback.onAudio(
FfiConverterTypeAudioPacket.lift(packet)
)
};
const uniffiResult = UniffiResult.ready<void>();
const uniffiHandleSuccess = (obj: any) => {};
const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => {
UniffiResult.writeError(uniffiResult, code, errBuf);
};
uniffiTraitInterfaceCall(
/*makeCall:*/ uniffiMakeCall,
/*handleSuccess:*/ uniffiHandleSuccess,
/*handleError:*/ uniffiHandleError,
/*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString),
/*alloc:*/ nativeModule().rustbuffer_alloc,
)
return uniffiResult;
},
uniffi_free: (uniffiHandle: UniffiHandle): void => {
// this will throw a stale handle error if the handle isn't found.
FfiConverterTypeAudioSink.drop(uniffiHandle);
},
uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => {
return FfiConverterTypeAudioSink.clone(uniffiHandle);
}
},
register: () => {nativeModule().uniffi_cua_sdk_fn_init_callback_vtable_audiosink(
uniffiCallbackInterfaceAudioSink.vtable
);
},
};
/**
* A started sign-in. Show `url` (and `user_code`), then await `wait()`.
*/
export interface LoginAttemptLike {
/**
* Browser or device.
*/
method(): LoginMethod;
/**
* Why a device code is used although browser sign-in was asked for.
*/
note(): string | undefined;
/**
* The URL to open.
*/
url(): string;
/**
* Device flow: the code to enter.
*/
userCode(): string | undefined;
/**
* Waits for the user, stores the session and returns who signed in.
* Only the first call waits; later calls fail.
*
* This device then registers with the relay (the one `cua` uses:
* `CUA_RELAY_URL`, else this machine's host setup, else relay.cua.ai),
* creating its device key on first use, so the fresh sign-in enrolls
* or re-verifies it without an approval. That step is best effort and
* never fails the sign-in.
*/
wait(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<AuthIdentity>;
}
/**
* @deprecated Use `LoginAttemptLike` instead.
*/
export type LoginAttemptInterface = LoginAttemptLike;
/**
* A started sign-in. Show `url` (and `user_code`), then await `wait()`.
*/
export class LoginAttempt extends UniffiAbstractObject implements LoginAttemptLike {
readonly [uniffiTypeNameSymbol] = "LoginAttempt";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeLoginAttemptObjectFactory.bless(pointer);
}
/**
* Browser or device.
*/
method(): LoginMethod {
return ((__rb: Uint8Array) => {
try {
return FfiConverterTypeLoginMethod.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_loginattempt_method(
uniffiTypeLoginAttemptObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Why a device code is used although browser sign-in was asked for.
*/
note(): string | undefined {
return ((__rb: Uint8Array) => {
try {
return FfiConverterOptionalString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_loginattempt_note(
uniffiTypeLoginAttemptObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The URL to open.
*/
url(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_loginattempt_url(
uniffiTypeLoginAttemptObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Device flow: the code to enter.
*/
userCode(): string | undefined {
return ((__rb: Uint8Array) => {
try {
return FfiConverterOptionalString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_loginattempt_user_code(
uniffiTypeLoginAttemptObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Waits for the user, stores the session and returns who signed in.
* Only the first call waits; later calls fail.
*
* This device then registers with the relay (the one `cua` uses:
* `CUA_RELAY_URL`, else this machine's host setup, else relay.cua.ai),
* creating its device key on first use, so the fresh sign-in enrolls
* or re-verifies it without an approval. That step is best effort and
* never fails the sign-in.
*/
async wait(asyncOpts_?: { signal: AbortSignal }): Promise<AuthIdentity> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_loginattempt_wait(
uniffiTypeLoginAttemptObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeAuthIdentity.lift.bind(FfiConverterTypeAuthIdentity),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeLoginAttemptObjectFactory.pointer(this);
uniffiTypeLoginAttemptObjectFactory.freePointer(pointer);
uniffiTypeLoginAttemptObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is LoginAttempt {
return uniffiTypeLoginAttemptObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeLoginAttemptObjectFactory: UniffiObjectFactory<LoginAttemptLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeLoginAttemptObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): LoginAttemptLike {
const instance = Object.create(LoginAttempt.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "LoginAttempt";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: LoginAttemptLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: LoginAttemptLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_loginattempt(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_loginattempt(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is LoginAttemptLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "LoginAttempt";
},
}})();
const FfiConverterTypeLoginAttempt = new FfiConverterObject(uniffiTypeLoginAttemptObjectFactory);
/**
* This device as a client of the signed-in account on a relay: its
* enrollment, the account's other devices and its audit log. The device
* key lives in the session's vault (shared with the `cua` CLI and daemon).
* Nothing here prompts: approving is the caller's to gate behind presence.
*/
export interface DevicesLike {
/**
* Approves the device showing `code`, or re-verifies `device_id`,
* from this enrolled device.
*/
approve(code: string | undefined, deviceId: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<RelayDevice>;
/**
* Whether the relay lets this device open a session now (enrolled),
* asked afresh. Polled while waiting for an approval.
*/
checkEnrolled(asyncOpts_?: { signal: AbortSignal }): Promise<boolean>;
/**
* Vouches for `machine_id`, a machine that registered without an
* enrolled device's signature or MFA (from this enrolled device) (S5).
* Clears [`RelayMachine::confirmed`]'s "new" flag for every account
* member, not just this device.
*/
confirmMachine(machineId: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<RelayMachine>;
/**
* Makes a one-time code (link, QR, install commands) that adds another
* computer to the account, or to `team` (from this enrolled device).
* It expires after `ttl_secs` (30 minutes when `None`).
*/
createPairingCode(team: string | undefined, ttlSecs: bigint | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<PairingCode>;
/**
* This device's id, when it has a key (no network).
*/
deviceId() /*throws*/: string | undefined;
/**
* Registers this device (creating its key on first use). Right after
* a fresh sign-in it is enrolled at once (replacing this machine's
* older device key, if any); otherwise the result carries a one-time
* code to approve from an enrolled device.
*/
enroll(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<DeviceEnrollment>;
/**
* The account's pairing codes, newest first (without the codes).
*/
pairingCodes(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<PairingCode>>;
/**
* The relay base URL.
*/
relayUrl(): string;
/**
* Renames a device (from this enrolled device).
*/
rename(id: string, name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<RelayDevice>;
/**
* Renames `machine_id`, a machine the account owns, on the relay (from
* this enrolled device). When it is this machine's own registration,
* its host setup takes the new name too.
*/
renameMachine(machineId: string, name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<RelayMachine>;
/**
* Revokes a device (from this enrolled device). Revoking this device
* also deletes its key.
*/
revoke(id: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<RelayDevice>;
/**
* Revokes an unused pairing code (`pc_…`).
*/
revokePairingCode(id: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
/**
* The account's devices, the grace period, the newest `audit_limit`
* audit events and the machines' names. Only the device list must
* succeed; the rest is empty when the relay refuses it.
*/
snapshot(auditLimit: number, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<DevicesSnapshot>;
}
/**
* @deprecated Use `DevicesLike` instead.
*/
export type DevicesInterface = DevicesLike;
/**
* This device as a client of the signed-in account on a relay: its
* enrollment, the account's other devices and its audit log. The device
* key lives in the session's vault (shared with the `cua` CLI and daemon).
* Nothing here prompts: approving is the caller's to gate behind presence.
*/
export class Devices extends UniffiAbstractObject implements DevicesLike {
readonly [uniffiTypeNameSymbol] = "Devices";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeDevicesObjectFactory.bless(pointer);
}
/**
* Approves the device showing `code`, or re-verifies `device_id`,
* from this enrolled device.
*/
async approve(code: string | undefined, deviceId: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<RelayDevice> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_approve(
uniffiTypeDevicesObjectFactory.clonePointer(this),FfiConverterOptionalString.lower(code, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(deviceId, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeRelayDevice.lift.bind(FfiConverterTypeRelayDevice),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Whether the relay lets this device open a session now (enrolled),
* asked afresh. Polled while waiting for an approval.
*/
async checkEnrolled(asyncOpts_?: { signal: AbortSignal }): Promise<boolean> {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_check_enrolled(
uniffiTypeDevicesObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_i8,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_i8,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_i8,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_i8,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterBool.lift.bind(FfiConverterBool),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Vouches for `machine_id`, a machine that registered without an
* enrolled device's signature or MFA (from this enrolled device) (S5).
* Clears [`RelayMachine::confirmed`]'s "new" flag for every account
* member, not just this device.
*/
async confirmMachine(machineId: string, asyncOpts_?: { signal: AbortSignal }): Promise<RelayMachine> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_confirm_machine(
uniffiTypeDevicesObjectFactory.clonePointer(this),FfiConverterString.lower(machineId, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeRelayMachine.lift.bind(FfiConverterTypeRelayMachine),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Makes a one-time code (link, QR, install commands) that adds another
* computer to the account, or to `team` (from this enrolled device).
* It expires after `ttl_secs` (30 minutes when `None`).
*/
async createPairingCode(team: string | undefined, ttlSecs: bigint | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<PairingCode> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_create_pairing_code(
uniffiTypeDevicesObjectFactory.clonePointer(this),FfiConverterOptionalString.lower(team, nativeModule().rustbuffer_alloc),FfiConverterOptionalUInt64.lower(ttlSecs, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypePairingCode.lift.bind(FfiConverterTypePairingCode),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* This device's id, when it has a key (no network).
*/
deviceId(): string | undefined /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterOptionalString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_device_id(
uniffiTypeDevicesObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Registers this device (creating its key on first use). Right after
* a fresh sign-in it is enrolled at once (replacing this machine's
* older device key, if any); otherwise the result carries a one-time
* code to approve from an enrolled device.
*/
async enroll(asyncOpts_?: { signal: AbortSignal }): Promise<DeviceEnrollment> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_enroll(
uniffiTypeDevicesObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeDeviceEnrollment.lift.bind(FfiConverterTypeDeviceEnrollment),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* The account's pairing codes, newest first (without the codes).
*/
async pairingCodes(asyncOpts_?: { signal: AbortSignal }): Promise<Array<PairingCode>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_pairing_codes(
uniffiTypeDevicesObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterSequenceTypePairingCode.lift.bind(FfiConverterSequenceTypePairingCode),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* The relay base URL.
*/
relayUrl(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_relay_url(
uniffiTypeDevicesObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Renames a device (from this enrolled device).
*/
async rename(id: string, name: string, asyncOpts_?: { signal: AbortSignal }): Promise<RelayDevice> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_rename(
uniffiTypeDevicesObjectFactory.clonePointer(this),FfiConverterString.lower(id, nativeModule().rustbuffer_alloc),FfiConverterString.lower(name, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeRelayDevice.lift.bind(FfiConverterTypeRelayDevice),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Renames `machine_id`, a machine the account owns, on the relay (from
* this enrolled device). When it is this machine's own registration,
* its host setup takes the new name too.
*/
async renameMachine(machineId: string, name: string, asyncOpts_?: { signal: AbortSignal }): Promise<RelayMachine> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_rename_machine(
uniffiTypeDevicesObjectFactory.clonePointer(this),FfiConverterString.lower(machineId, nativeModule().rustbuffer_alloc),FfiConverterString.lower(name, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeRelayMachine.lift.bind(FfiConverterTypeRelayMachine),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Revokes a device (from this enrolled device). Revoking this device
* also deletes its key.
*/
async revoke(id: string, asyncOpts_?: { signal: AbortSignal }): Promise<RelayDevice> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_revoke(
uniffiTypeDevicesObjectFactory.clonePointer(this),FfiConverterString.lower(id, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeRelayDevice.lift.bind(FfiConverterTypeRelayDevice),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Revokes an unused pairing code (`pc_…`).
*/
async revokePairingCode(id: string, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_revoke_pairing_code(
uniffiTypeDevicesObjectFactory.clonePointer(this),FfiConverterString.lower(id, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_void,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_void,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_void,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_void,
/*liftFunc:*/ (_v) => {},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* The account's devices, the grace period, the newest `audit_limit`
* audit events and the machines' names. Only the device list must
* succeed; the rest is empty when the relay refuses it.
*/
async snapshot(auditLimit: number, asyncOpts_?: { signal: AbortSignal }): Promise<DevicesSnapshot> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_devices_snapshot(
uniffiTypeDevicesObjectFactory.clonePointer(this),FfiConverterUInt32.lower(auditLimit, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeDevicesSnapshot.lift.bind(FfiConverterTypeDevicesSnapshot),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeDevicesObjectFactory.pointer(this);
uniffiTypeDevicesObjectFactory.freePointer(pointer);
uniffiTypeDevicesObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is Devices {
return uniffiTypeDevicesObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeDevicesObjectFactory: UniffiObjectFactory<DevicesLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeDevicesObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): DevicesLike {
const instance = Object.create(Devices.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "Devices";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: DevicesLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: DevicesLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_devices(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_devices(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is DevicesLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Devices";
},
}})();
const FfiConverterTypeDevices = new FfiConverterObject(uniffiTypeDevicesObjectFactory);
/**
* Sign-in and the shared session.
*/
export interface AuthLike {
/**
* A valid access token (refreshed when it expires within a minute, or
* when `force`). `Unauthenticated` when not signed in.
*/
accessToken(force: boolean, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
/**
* Starts a sign-in. `flow`: `auto` (default: browser, else device
* code), `browser` or `device`.
*/
beginLogin(flow: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<LoginAttemptLike>;
/**
* This device on `relay_url` (`None` = the relay `cua` uses:
* `CUA_RELAY_URL`, else this machine's host setup, else
* `https://relay.cua.ai`) as the signed-in account, shown as `name`
* (default: this computer's name).
*/
devices(relayUrl: string | undefined, name: string | undefined) /*throws*/: DevicesLike;
/**
* Revokes (best effort) and removes the session, and unlinks usage
* data from the account. Returns whether one existed.
*/
logout(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<boolean>;
/**
* The stored session (no network).
*/
status() /*throws*/: AuthStatus;
}
/**
* @deprecated Use `AuthLike` instead.
*/
export type AuthInterface = AuthLike;
/**
* Sign-in and the shared session.
*/
export class Auth extends UniffiAbstractObject implements AuthLike {
readonly [uniffiTypeNameSymbol] = "Auth";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeAuthObjectFactory.bless(pointer);
}
/**
* A valid access token (refreshed when it expires within a minute, or
* when `force`). `Unauthenticated` when not signed in.
*/
async accessToken(force: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_auth_access_token(
uniffiTypeAuthObjectFactory.clonePointer(this),FfiConverterBool.lower(force, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Starts a sign-in. `flow`: `auto` (default: browser, else device
* code), `browser` or `device`.
*/
async beginLogin(flow: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<LoginAttemptLike> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_auth_begin_login(
uniffiTypeAuthObjectFactory.clonePointer(this),FfiConverterOptionalString.lower(flow, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_u64,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_u64,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_u64,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_u64,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeLoginAttempt.lift.bind(FfiConverterTypeLoginAttempt),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* This device on `relay_url` (`None` = the relay `cua` uses:
* `CUA_RELAY_URL`, else this machine's host setup, else
* `https://relay.cua.ai`) as the signed-in account, shown as `name`
* (default: this computer's name).
*/
devices(relayUrl: string | undefined, name: string | undefined): DevicesLike /*throws*/ {
return FfiConverterTypeDevices.lift(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_auth_devices(
uniffiTypeAuthObjectFactory.clonePointer(this),
FfiConverterOptionalString.lower(relayUrl, nativeModule().rustbuffer_alloc),
FfiConverterOptionalString.lower(name, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Revokes (best effort) and removes the session, and unlinks usage
* data from the account. Returns whether one existed.
*/
async logout(asyncOpts_?: { signal: AbortSignal }): Promise<boolean> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_auth_logout(
uniffiTypeAuthObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_i8,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_i8,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_i8,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_i8,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterBool.lift.bind(FfiConverterBool),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* The stored session (no network).
*/
status(): AuthStatus /*throws*/ {
return ((__rb: Uint8Array) => {
try {
return FfiConverterTypeAuthStatus.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_auth_status(
uniffiTypeAuthObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeAuthObjectFactory.pointer(this);
uniffiTypeAuthObjectFactory.freePointer(pointer);
uniffiTypeAuthObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is Auth {
return uniffiTypeAuthObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeAuthObjectFactory: UniffiObjectFactory<AuthLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeAuthObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): AuthLike {
const instance = Object.create(Auth.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "Auth";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: AuthLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: AuthLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_auth(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_auth(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is AuthLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Auth";
},
}})();
const FfiConverterTypeAuth = new FfiConverterObject(uniffiTypeAuthObjectFactory);
/**
* Receives [`BuildProgress`] while [`Spaces::build_with_progress`] runs, in
* order, ending with `finished`. Called on an SDK worker thread; return
* quickly.
*/
export interface BuildListener {
/**
* The build moved on.
*/
onProgress(progress: BuildProgress): void;
}
/**
* Receives [`BuildProgress`] while [`Spaces::build_with_progress`] runs, in
* order, ending with `finished`. Called on an SDK worker thread; return
* quickly.
*/
export class BuildListenerImpl extends UniffiAbstractObject implements BuildListener {
readonly [uniffiTypeNameSymbol] = "BuildListenerImpl";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeBuildListenerImplObjectFactory.bless(pointer);
}
/**
* The build moved on.
*/
onProgress(progress: BuildProgress): void {uniffiCaller.rustCall(
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_buildlistener_on_progress(
uniffiTypeBuildListenerImplObjectFactory.clonePointer(this),
FfiConverterTypeBuildProgress.lower(progress, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeBuildListenerImplObjectFactory.pointer(this);
uniffiTypeBuildListenerImplObjectFactory.freePointer(pointer);
uniffiTypeBuildListenerImplObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is BuildListenerImpl {
return uniffiTypeBuildListenerImplObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeBuildListenerImplObjectFactory: UniffiObjectFactory<BuildListener> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeBuildListenerImplObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): BuildListener {
const instance = Object.create(BuildListenerImpl.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "BuildListenerImpl";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: BuildListener): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: BuildListener): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_buildlistener(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_buildlistener(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is BuildListener {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "BuildListenerImpl";
},
}})();
const FfiConverterTypeBuildListener = new FfiConverterObjectWithCallbacks(uniffiTypeBuildListenerImplObjectFactory);
// Add a vtable for the callbacks that go in BuildListener.
// Put the implementation in a struct so we don't pollute the top-level namespace
const uniffiCallbackInterfaceBuildListener: { vtable: any; register: () => void; } = {
// Create the VTable using a series of closures.
// ts automatically converts these into C callback functions.
vtable: {
on_progress: (
uniffiHandle: bigint,
progress: Uint8Array,) => {
const uniffiMakeCall =
()
: void => {
const jsCallback = FfiConverterTypeBuildListener.lift(uniffiHandle);
return jsCallback.onProgress(
FfiConverterTypeBuildProgress.lift(progress)
)
};
const uniffiResult = UniffiResult.ready<void>();
const uniffiHandleSuccess = (obj: any) => {};
const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => {
UniffiResult.writeError(uniffiResult, code, errBuf);
};
uniffiTraitInterfaceCall(
/*makeCall:*/ uniffiMakeCall,
/*handleSuccess:*/ uniffiHandleSuccess,
/*handleError:*/ uniffiHandleError,
/*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString),
/*alloc:*/ nativeModule().rustbuffer_alloc,
)
return uniffiResult;
},
uniffi_free: (uniffiHandle: UniffiHandle): void => {
// this will throw a stale handle error if the handle isn't found.
FfiConverterTypeBuildListener.drop(uniffiHandle);
},
uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => {
return FfiConverterTypeBuildListener.clone(uniffiHandle);
}
},
register: () => {nativeModule().uniffi_cua_sdk_fn_init_callback_vtable_buildlistener(
uniffiCallbackInterfaceBuildListener.vtable
);
},
};
/**
* Local runtimes and images.
*/
export interface LocalLike {
/**
* Builds an image from an `images.cua.ai/v1alpha1` Image resource
* (JSON) on `base`; pushes to `push` when set. Returns
* `reference@digest` or the local output directory.
*/
buildImage(specJson: string, base: string, push: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
/**
* Inspects local runtimes (read-only: never installs or starts
* anything).
*/
doctor(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<DoctorReport>;
/**
* Pulls an image (container engine for container refs, the image cache
* for `vm:` containerDisks).
*/
pullImage(reference: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<LocalImage>;
/**
* Copies an image (host architecture) to `destination`; returns the
* pushed manifest digest.
*/
pushImage(reference: string, destination: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
/**
* Provisions `components` (`qemu`, `lume`; `runsc` reports its plan).
* Empty = everything provisionable. `dry_run` only reports.
*/
setup(components: Array<string>, dryRun: boolean, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<SetupStep>>;
/**
* Free space where local Spaces are written (Lume's VM storage, the
* cua home for QEMU, the container engine's data disk) and which
* catalog images are already pulled. Read-only and bounded; probed in
* this process (the daemon runs on the same host).
*/
storage(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<LocalStorage>;
}
/**
* @deprecated Use `LocalLike` instead.
*/
export type LocalInterface = LocalLike;
/**
* Local runtimes and images.
*/
export class Local extends UniffiAbstractObject implements LocalLike {
readonly [uniffiTypeNameSymbol] = "Local";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeLocalObjectFactory.bless(pointer);
}
/**
* Builds an image from an `images.cua.ai/v1alpha1` Image resource
* (JSON) on `base`; pushes to `push` when set. Returns
* `reference@digest` or the local output directory.
*/
async buildImage(specJson: string, base: string, push: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_local_build_image(
uniffiTypeLocalObjectFactory.clonePointer(this),FfiConverterString.lower(specJson, nativeModule().rustbuffer_alloc),FfiConverterString.lower(base, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(push, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Inspects local runtimes (read-only: never installs or starts
* anything).
*/
async doctor(asyncOpts_?: { signal: AbortSignal }): Promise<DoctorReport> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_local_doctor(
uniffiTypeLocalObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeDoctorReport.lift.bind(FfiConverterTypeDoctorReport),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Pulls an image (container engine for container refs, the image cache
* for `vm:` containerDisks).
*/
async pullImage(reference: string, asyncOpts_?: { signal: AbortSignal }): Promise<LocalImage> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_local_pull_image(
uniffiTypeLocalObjectFactory.clonePointer(this),FfiConverterString.lower(reference, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeLocalImage.lift.bind(FfiConverterTypeLocalImage),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Copies an image (host architecture) to `destination`; returns the
* pushed manifest digest.
*/
async pushImage(reference: string, destination: string, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_local_push_image(
uniffiTypeLocalObjectFactory.clonePointer(this),FfiConverterString.lower(reference, nativeModule().rustbuffer_alloc),FfiConverterString.lower(destination, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Provisions `components` (`qemu`, `lume`; `runsc` reports its plan).
* Empty = everything provisionable. `dry_run` only reports.
*/
async setup(components: Array<string>, dryRun: boolean, asyncOpts_?: { signal: AbortSignal }): Promise<Array<SetupStep>> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_local_setup(
uniffiTypeLocalObjectFactory.clonePointer(this),FfiConverterSequenceString.lower(components, nativeModule().rustbuffer_alloc),FfiConverterBool.lower(dryRun, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterSequenceTypeSetupStep.lift.bind(FfiConverterSequenceTypeSetupStep),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Free space where local Spaces are written (Lume's VM storage, the
* cua home for QEMU, the container engine's data disk) and which
* catalog images are already pulled. Read-only and bounded; probed in
* this process (the daemon runs on the same host).
*/
async storage(asyncOpts_?: { signal: AbortSignal }): Promise<LocalStorage> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_local_storage(
uniffiTypeLocalObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeLocalStorage.lift.bind(FfiConverterTypeLocalStorage),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeLocalObjectFactory.pointer(this);
uniffiTypeLocalObjectFactory.freePointer(pointer);
uniffiTypeLocalObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is Local {
return uniffiTypeLocalObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeLocalObjectFactory: UniffiObjectFactory<LocalLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeLocalObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): LocalLike {
const instance = Object.create(Local.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "Local";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: LocalLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: LocalLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_local(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_local(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is LocalLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Local";
},
}})();
const FfiConverterTypeLocal = new FfiConverterObject(uniffiTypeLocalObjectFactory);
/**
* An active port forward. Closed on `close()` or when dropped.
*/
export interface PortForwardLike {
/**
* Stops the forward.
*/
close(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
/**
* Guest port.
*/
guestPort(): number;
/**
* Loopback `host:port` accepting connections (local/direct).
*/
localAddr(): string | undefined;
/**
* URL to use (a loopback URL).
*/
url(): string | undefined;
}
/**
* @deprecated Use `PortForwardLike` instead.
*/
export type PortForwardInterface = PortForwardLike;
/**
* An active port forward. Closed on `close()` or when dropped.
*/
export class PortForward extends UniffiAbstractObject implements PortForwardLike {
readonly [uniffiTypeNameSymbol] = "PortForward";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypePortForwardObjectFactory.bless(pointer);
}
/**
* Stops the forward.
*/
async close(asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_portforward_close(
uniffiTypePortForwardObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_void,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_void,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_void,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_void,
/*liftFunc:*/ (_v) => {},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Guest port.
*/
guestPort(): number {
return FfiConverterUInt16.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_portforward_guest_port(
uniffiTypePortForwardObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Loopback `host:port` accepting connections (local/direct).
*/
localAddr(): string | undefined {
return ((__rb: Uint8Array) => {
try {
return FfiConverterOptionalString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_portforward_local_addr(
uniffiTypePortForwardObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* URL to use (a loopback URL).
*/
url(): string | undefined {
return ((__rb: Uint8Array) => {
try {
return FfiConverterOptionalString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_portforward_url(
uniffiTypePortForwardObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypePortForwardObjectFactory.pointer(this);
uniffiTypePortForwardObjectFactory.freePointer(pointer);
uniffiTypePortForwardObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is PortForward {
return uniffiTypePortForwardObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypePortForwardObjectFactory: UniffiObjectFactory<PortForwardLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypePortForwardObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): PortForwardLike {
const instance = Object.create(PortForward.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "PortForward";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: PortForwardLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: PortForwardLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_portforward(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_portforward(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is PortForwardLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "PortForward";
},
}})();
const FfiConverterTypePortForward = new FfiConverterObject(uniffiTypePortForwardObjectFactory);
/**
* The guest display of a sandbox without cua-spacesd
* (`Sandbox.guest_display`). An object, not a record, so no binding's
* default string form (repr, str, description, toString, Debug) can show
* the VNC password: `url()` is masked, and only the explicit
* `url_with_password()` returns it.
*/
export interface GuestDisplayLike {
/**
* A host command that opens a viewer on it (`lume attach <vm>`);
* empty when there is none. It handles the password itself.
*/
openCommand(): Array<string>;
/**
* The display URL (`vnc://HOST:PORT`) with any password masked as `****`.
* Safe to print and log.
*/
url(): string;
/**
* SENSITIVE: the display URL with the VNC password
* (`vnc://:PASSWORD@HOST:PORT`), for handing to a VNC client. Never
* print or log it.
*/
urlWithPassword(): string;
/**
* How the display is reached (`vnc`).
*/
via(): string;
}
/**
* @deprecated Use `GuestDisplayLike` instead.
*/
export type GuestDisplayInterface = GuestDisplayLike;
/**
* The guest display of a sandbox without cua-spacesd
* (`Sandbox.guest_display`). An object, not a record, so no binding's
* default string form (repr, str, description, toString, Debug) can show
* the VNC password: `url()` is masked, and only the explicit
* `url_with_password()` returns it.
*/
export class GuestDisplay extends UniffiAbstractObject implements GuestDisplayLike {
readonly [uniffiTypeNameSymbol] = "GuestDisplay";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeGuestDisplayObjectFactory.bless(pointer);
}
/**
* A host command that opens a viewer on it (`lume attach <vm>`);
* empty when there is none. It handles the password itself.
*/
openCommand(): Array<string> {
return ((__rb: Uint8Array) => {
try {
return FfiConverterSequenceString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_guestdisplay_open_command(
uniffiTypeGuestDisplayObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* The display URL (`vnc://HOST:PORT`) with any password masked as `****`.
* Safe to print and log.
*/
url(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_guestdisplay_url(
uniffiTypeGuestDisplayObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* SENSITIVE: the display URL with the VNC password
* (`vnc://:PASSWORD@HOST:PORT`), for handing to a VNC client. Never
* print or log it.
*/
urlWithPassword(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_guestdisplay_url_with_password(
uniffiTypeGuestDisplayObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* How the display is reached (`vnc`).
*/
via(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_guestdisplay_via(
uniffiTypeGuestDisplayObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeGuestDisplayObjectFactory.pointer(this);
uniffiTypeGuestDisplayObjectFactory.freePointer(pointer);
uniffiTypeGuestDisplayObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is GuestDisplay {
return uniffiTypeGuestDisplayObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeGuestDisplayObjectFactory: UniffiObjectFactory<GuestDisplayLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeGuestDisplayObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): GuestDisplayLike {
const instance = Object.create(GuestDisplay.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "GuestDisplay";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: GuestDisplayLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: GuestDisplayLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_guestdisplay(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_guestdisplay(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is GuestDisplayLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "GuestDisplay";
},
}})();
const FfiConverterTypeGuestDisplay = new FfiConverterObject(uniffiTypeGuestDisplayObjectFactory);
/**
* An MCP client (rmcp, streamable HTTP; protocol 2026-07-28 when the
* server supports it, else the server's revision). Results are the
* server's JSON, unchanged.
*/
export interface McpClientLike {
/**
* Calls `name` with a JSON object of arguments (`None`: `{}`); returns
* the `tools/call` result JSON verbatim (a tool error is `isError`).
*/
callTool(name: string, argumentsJson: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
/**
* Closes the connection (ends the session on servers that keep one).
*/
close(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
/**
* Renders prompt `name`; the `prompts/get` result JSON.
*/
getPrompt(name: string, argumentsJson: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
/**
* Every prompt (all pages), JSON array.
*/
listPrompts(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
/**
* Every resource template (all pages), JSON array.
*/
listResourceTemplates(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
/**
* Every resource (all pages), JSON array.
*/
listResources(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
/**
* Every tool (all pages) as a JSON array of MCP `Tool` objects.
*/
listTools(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
/**
* Reads `uri`; the `resources/read` result JSON.
*/
readResource(uri: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
/**
* Any other JSON-RPC method (extensions such as `skills/list`,
* `skills/get`); returns its `result` JSON.
*/
request(method: string, paramsJson: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
/**
* The server's `serverInfo`/negotiated version as JSON, when known.
*/
serverInfoJson(): string | undefined;
}
/**
* @deprecated Use `McpClientLike` instead.
*/
export type McpClientInterface = McpClientLike;
/**
* An MCP client (rmcp, streamable HTTP; protocol 2026-07-28 when the
* server supports it, else the server's revision). Results are the
* server's JSON, unchanged.
*/
export class McpClient extends UniffiAbstractObject implements McpClientLike {
readonly [uniffiTypeNameSymbol] = "McpClient";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeMcpClientObjectFactory.bless(pointer);
}
/**
* Calls `name` with a JSON object of arguments (`None`: `{}`); returns
* the `tools/call` result JSON verbatim (a tool error is `isError`).
*/
async callTool(name: string, argumentsJson: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_mcpclient_call_tool(
uniffiTypeMcpClientObjectFactory.clonePointer(this),FfiConverterString.lower(name, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(argumentsJson, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Closes the connection (ends the session on servers that keep one).
*/
async close(asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_mcpclient_close(
uniffiTypeMcpClientObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_void,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_void,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_void,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_void,
/*liftFunc:*/ (_v) => {},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Renders prompt `name`; the `prompts/get` result JSON.
*/
async getPrompt(name: string, argumentsJson: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_mcpclient_get_prompt(
uniffiTypeMcpClientObjectFactory.clonePointer(this),FfiConverterString.lower(name, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(argumentsJson, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Every prompt (all pages), JSON array.
*/
async listPrompts(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_mcpclient_list_prompts(
uniffiTypeMcpClientObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Every resource template (all pages), JSON array.
*/
async listResourceTemplates(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_mcpclient_list_resource_templates(
uniffiTypeMcpClientObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Every resource (all pages), JSON array.
*/
async listResources(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_mcpclient_list_resources(
uniffiTypeMcpClientObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Every tool (all pages) as a JSON array of MCP `Tool` objects.
*/
async listTools(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_mcpclient_list_tools(
uniffiTypeMcpClientObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Reads `uri`; the `resources/read` result JSON.
*/
async readResource(uri: string, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_mcpclient_read_resource(
uniffiTypeMcpClientObjectFactory.clonePointer(this),FfiConverterString.lower(uri, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Any other JSON-RPC method (extensions such as `skills/list`,
* `skills/get`); returns its `result` JSON.
*/
async request(method: string, paramsJson: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_mcpclient_request(
uniffiTypeMcpClientObjectFactory.clonePointer(this),FfiConverterString.lower(method, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(paramsJson, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* The server's `serverInfo`/negotiated version as JSON, when known.
*/
serverInfoJson(): string | undefined {
return ((__rb: Uint8Array) => {
try {
return FfiConverterOptionalString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_mcpclient_server_info_json(
uniffiTypeMcpClientObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeMcpClientObjectFactory.pointer(this);
uniffiTypeMcpClientObjectFactory.freePointer(pointer);
uniffiTypeMcpClientObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is McpClient {
return uniffiTypeMcpClientObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeMcpClientObjectFactory: UniffiObjectFactory<McpClientLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeMcpClientObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): McpClientLike {
const instance = Object.create(McpClient.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "McpClient";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: McpClientLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: McpClientLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_mcpclient(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_mcpclient(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is McpClientLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "McpClient";
},
}})();
const FfiConverterTypeMcpClient = new FfiConverterObject(uniffiTypeMcpClientObjectFactory);
/**
* A named service of a sandbox.
*/
export interface ServiceLike {
/**
* Where this service is reachable from this process: base URL plus
* the headers every request needs. Any HTTP client can use it (SSE,
* long-lived streams and every method pass through unchanged).
*/
endpoint(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ServiceEndpoint>;
/**
* An MCP client (the official Rust SDK) for this service's endpoint at
* `path` (default `/mcp`).
*/
mcp(path: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<McpClientLike>;
/**
* The MCP endpoint of this service at `path` (default `/mcp`).
*/
mcpConfig(path: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<McpConfig>;
/**
* Service name.
*/
name(): string;
/**
* A shareable URL for this service that stops working after
* `ttl_seconds` (60 s to 24 h, default 1 h): the same as
* `Sandbox.public_url(name, ...)`: a loopback URL with its own token,
* served by the cua daemon.
*/
publicUrl(ttlSeconds: number | undefined, label: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<PublicUrl>;
/**
* One HTTP request to `path` on the service. Credentials are attached by
* the runtime. `headers` are sent as given (for example `content-type`,
* or `accept` and `mcp-session-id` for MCP).
*/
request(method: string, path: string, body: ArrayBuffer | undefined, timeoutMs: number | undefined, headers: Array<HttpHeader> | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<HttpResponse>;
/**
* A URL for the service usable from this machine with no credentials
* (no trailing slash): the published loopback port locally.
*/
url(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
}
/**
* @deprecated Use `ServiceLike` instead.
*/
export type ServiceInterface = ServiceLike;
/**
* A named service of a sandbox.
*/
export class Service extends UniffiAbstractObject implements ServiceLike {
readonly [uniffiTypeNameSymbol] = "Service";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeServiceObjectFactory.bless(pointer);
}
/**
* Where this service is reachable from this process: base URL plus
* the headers every request needs. Any HTTP client can use it (SSE,
* long-lived streams and every method pass through unchanged).
*/
async endpoint(asyncOpts_?: { signal: AbortSignal }): Promise<ServiceEndpoint> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_service_endpoint(
uniffiTypeServiceObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeServiceEndpoint.lift.bind(FfiConverterTypeServiceEndpoint),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* An MCP client (the official Rust SDK) for this service's endpoint at
* `path` (default `/mcp`).
*/
async mcp(path: string | undefined = undefined, asyncOpts_?: { signal: AbortSignal }): Promise<McpClientLike> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_service_mcp(
uniffiTypeServiceObjectFactory.clonePointer(this),FfiConverterOptionalString.lower(path, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_u64,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_u64,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_u64,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_u64,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeMcpClient.lift.bind(FfiConverterTypeMcpClient),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* The MCP endpoint of this service at `path` (default `/mcp`).
*/
async mcpConfig(path: string | undefined = undefined, asyncOpts_?: { signal: AbortSignal }): Promise<McpConfig> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_service_mcp_config(
uniffiTypeServiceObjectFactory.clonePointer(this),FfiConverterOptionalString.lower(path, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeMcpConfig.lift.bind(FfiConverterTypeMcpConfig),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Service name.
*/
name(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_service_name(
uniffiTypeServiceObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* A shareable URL for this service that stops working after
* `ttl_seconds` (60 s to 24 h, default 1 h): the same as
* `Sandbox.public_url(name, ...)`: a loopback URL with its own token,
* served by the cua daemon.
*/
async publicUrl(ttlSeconds: number | undefined = undefined, label: string | undefined = undefined, asyncOpts_?: { signal: AbortSignal }): Promise<PublicUrl> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_service_public_url(
uniffiTypeServiceObjectFactory.clonePointer(this),FfiConverterOptionalUInt32.lower(ttlSeconds, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(label, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypePublicUrl.lift.bind(FfiConverterTypePublicUrl),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* One HTTP request to `path` on the service. Credentials are attached by
* the runtime. `headers` are sent as given (for example `content-type`,
* or `accept` and `mcp-session-id` for MCP).
*/
async request(method: string, path: string, body: ArrayBuffer | undefined, timeoutMs: number | undefined, headers: Array<HttpHeader> | undefined = undefined, asyncOpts_?: { signal: AbortSignal }): Promise<HttpResponse> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_service_request(
uniffiTypeServiceObjectFactory.clonePointer(this),FfiConverterString.lower(method, nativeModule().rustbuffer_alloc),FfiConverterString.lower(path, nativeModule().rustbuffer_alloc),FfiConverterOptionalBytes.lower(body, nativeModule().rustbuffer_alloc),FfiConverterOptionalUInt32.lower(timeoutMs, nativeModule().rustbuffer_alloc),FfiConverterOptionalSequenceTypeHttpHeader.lower(headers, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeHttpResponse.lift.bind(FfiConverterTypeHttpResponse),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* A URL for the service usable from this machine with no credentials
* (no trailing slash): the published loopback port locally.
*/
async url(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_service_url(
uniffiTypeServiceObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeServiceObjectFactory.pointer(this);
uniffiTypeServiceObjectFactory.freePointer(pointer);
uniffiTypeServiceObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is Service {
return uniffiTypeServiceObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeServiceObjectFactory: UniffiObjectFactory<ServiceLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeServiceObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): ServiceLike {
const instance = Object.create(Service.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "Service";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: ServiceLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: ServiceLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_service(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_service(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is ServiceLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Service";
},
}})();
const FfiConverterTypeService = new FfiConverterObject(uniffiTypeServiceObjectFactory);
/**
* A guest process, from `spawn` or `attach`.
*/
export interface SpacesdProcessLike {
/**
* Closes stdin.
*/
closeStdin(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
/**
* Stops receiving output without affecting the process. A pending
* `next_event` returns `None` at once.
*/
detach(asyncOpts_?: { signal: AbortSignal }): Promise<void>;
/**
* SIGKILL to the process and its process group (what it started),
* including a command run as another user through `sudo`.
*/
kill(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
/**
* Next output chunk or the exit; `None` after the exit was returned.
* Reconnects transparently from the last seen offset.
*/
nextEvent(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ProcessEvent | undefined>;
/**
* Guest pid.
*/
pid(): number;
/**
* Resizes the PTY.
*/
resize(cols: number, rows: number, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
/**
* Sends a signal by name (`term`, `kill`, `SIGINT`, ...). With
* `process_group`, to the process's whole group (everything it started),
* as a terminal's Ctrl-C does; by default to the process alone.
*/
signal(signal: string, processGroup: boolean, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
/**
* Tag, when set.
*/
tag(): string | undefined;
/**
* Collects the remaining output until exit.
*/
wait(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ProcessOutput>;
/**
* Writes PTY keystrokes.
*/
writePty(data: ArrayBuffer, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
/**
* Writes stdin (PTY input for PTY processes), exactly once across
* retries.
*/
writeStdin(data: ArrayBuffer, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
}
/**
* @deprecated Use `SpacesdProcessLike` instead.
*/
export type SpacesdProcessInterface = SpacesdProcessLike;
/**
* A guest process, from `spawn` or `attach`.
*/
export class SpacesdProcess extends UniffiAbstractObject implements SpacesdProcessLike {
readonly [uniffiTypeNameSymbol] = "SpacesdProcess";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeSpacesdProcessObjectFactory.bless(pointer);
}
/**
* Closes stdin.
*/
async closeStdin(asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdprocess_close_stdin(
uniffiTypeSpacesdProcessObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_void,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_void,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_void,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_void,
/*liftFunc:*/ (_v) => {},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Stops receiving output without affecting the process. A pending
* `next_event` returns `None` at once.
*/
async detach(asyncOpts_?: { signal: AbortSignal }): Promise<void> {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdprocess_detach(
uniffiTypeSpacesdProcessObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_void,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_void,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_void,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_void,
/*liftFunc:*/ (_v) => {},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* SIGKILL to the process and its process group (what it started),
* including a command run as another user through `sudo`.
*/
async kill(asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdprocess_kill(
uniffiTypeSpacesdProcessObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_void,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_void,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_void,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_void,
/*liftFunc:*/ (_v) => {},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Next output chunk or the exit; `None` after the exit was returned.
* Reconnects transparently from the last seen offset.
*/
async nextEvent(asyncOpts_?: { signal: AbortSignal }): Promise<ProcessEvent | undefined> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdprocess_next_event(
uniffiTypeSpacesdProcessObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterOptionalTypeProcessEvent.lift.bind(FfiConverterOptionalTypeProcessEvent),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Guest pid.
*/
pid(): number {
return FfiConverterUInt32.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdprocess_pid(
uniffiTypeSpacesdProcessObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Resizes the PTY.
*/
async resize(cols: number, rows: number, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdprocess_resize(
uniffiTypeSpacesdProcessObjectFactory.clonePointer(this),FfiConverterUInt32.lower(cols, nativeModule().rustbuffer_alloc),FfiConverterUInt32.lower(rows, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_void,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_void,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_void,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_void,
/*liftFunc:*/ (_v) => {},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Sends a signal by name (`term`, `kill`, `SIGINT`, ...). With
* `process_group`, to the process's whole group (everything it started),
* as a terminal's Ctrl-C does; by default to the process alone.
*/
async signal(signal: string, processGroup: boolean = false, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdprocess_signal(
uniffiTypeSpacesdProcessObjectFactory.clonePointer(this),FfiConverterString.lower(signal, nativeModule().rustbuffer_alloc),FfiConverterBool.lower(processGroup, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_void,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_void,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_void,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_void,
/*liftFunc:*/ (_v) => {},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Tag, when set.
*/
tag(): string | undefined {
return ((__rb: Uint8Array) => {
try {
return FfiConverterOptionalString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdprocess_tag(
uniffiTypeSpacesdProcessObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Collects the remaining output until exit.
*/
async wait(asyncOpts_?: { signal: AbortSignal }): Promise<ProcessOutput> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdprocess_wait(
uniffiTypeSpacesdProcessObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterTypeProcessOutput.lift.bind(FfiConverterTypeProcessOutput),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Writes PTY keystrokes.
*/
async writePty(data: ArrayBuffer, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdprocess_write_pty(
uniffiTypeSpacesdProcessObjectFactory.clonePointer(this),FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_void,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_void,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_void,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_void,
/*liftFunc:*/ (_v) => {},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
/**
* Writes stdin (PTY input for PTY processes), exactly once across
* retries.
*/
async writeStdin(data: ArrayBuffer, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdprocess_write_stdin(
uniffiTypeSpacesdProcessObjectFactory.clonePointer(this),FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_void,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_void,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_void,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_void,
/*liftFunc:*/ (_v) => {},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeSpacesdProcessObjectFactory.pointer(this);
uniffiTypeSpacesdProcessObjectFactory.freePointer(pointer);
uniffiTypeSpacesdProcessObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is SpacesdProcess {
return uniffiTypeSpacesdProcessObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeSpacesdProcessObjectFactory: UniffiObjectFactory<SpacesdProcessLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeSpacesdProcessObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): SpacesdProcessLike {
const instance = Object.create(SpacesdProcess.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "SpacesdProcess";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: SpacesdProcessLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: SpacesdProcessLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_spacesdprocess(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_spacesdprocess(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is SpacesdProcessLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SpacesdProcess";
},
}})();
const FfiConverterTypeSpacesdProcess = new FfiConverterObject(uniffiTypeSpacesdProcessObjectFactory);
/**
* A loopback (or `bind`) TCP port that reaches a guest port through
* cua-spacesd's tunnel ([`SpacesdClient::forward_tcp`]). Stopped by `stop`
* or when dropped.
*/
export interface SpacesdForwardLike {
/**
* Guest port.
*/
guestPort(): number;
/**
* `host:port` accepting connections.
*/
localAddr(): string;
/**
* Stops listening and revokes the driver-side forward (also done when
* it is dropped).
*/
stop(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
}
/**
* @deprecated Use `SpacesdForwardLike` instead.
*/
export type SpacesdForwardInterface = SpacesdForwardLike;
/**
* A loopback (or `bind`) TCP port that reaches a guest port through
* cua-spacesd's tunnel ([`SpacesdClient::forward_tcp`]). Stopped by `stop`
* or when dropped.
*/
export class SpacesdForward extends UniffiAbstractObject implements SpacesdForwardLike {
readonly [uniffiTypeNameSymbol] = "SpacesdForward";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeSpacesdForwardObjectFactory.bless(pointer);
}
/**
* Guest port.
*/
guestPort(): number {
return FfiConverterUInt16.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdforward_guest_port(
uniffiTypeSpacesdForwardObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* `host:port` accepting connections.
*/
localAddr(): string {
return ((__rb: Uint8Array) => {
try {
return FfiConverterString.lift(__rb);
} finally {
nativeModule().rustbuffer_free(__rb);
}
})(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdforward_local_addr(
uniffiTypeSpacesdForwardObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
/**
* Stops listening and revokes the driver-side forward (also done when
* it is dropped).
*/
async stop(asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesdforward_stop(
uniffiTypeSpacesdForwardObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_void,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_void,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_void,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_void,
/*liftFunc:*/ (_v) => {},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeSpacesdForwardObjectFactory.pointer(this);
uniffiTypeSpacesdForwardObjectFactory.freePointer(pointer);
uniffiTypeSpacesdForwardObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is SpacesdForward {
return uniffiTypeSpacesdForwardObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeSpacesdForwardObjectFactory: UniffiObjectFactory<SpacesdForwardLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeSpacesdForwardObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): SpacesdForwardLike {
const instance = Object.create(SpacesdForward.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "SpacesdForward";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: SpacesdForwardLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: SpacesdForwardLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_spacesdforward(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_spacesdforward(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is SpacesdForwardLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SpacesdForward";
},
}})();
const FfiConverterTypeSpacesdForward = new FfiConverterObject(uniffiTypeSpacesdForwardObjectFactory);
/**
* A download in progress ([`SpacesdClient::open_download`]).
*/
export interface SpacesdDownloadLike {
/**
* Stops the transfer.
*/
cancel(): void;
/**
* The next chunk, or `None` once the whole file arrived.
*/
nextChunk(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ArrayBuffer | undefined>;
}
/**
* @deprecated Use `SpacesdDownloadLike` instead.
*/
export type SpacesdDownloadInterface = SpacesdDownloadLike;
/**
* A download in progress ([`SpacesdClient::open_download`]).
*/
export class SpacesdDownload extends UniffiAbstractObject implements SpacesdDownloadLike {
readonly [uniffiTypeNameSymbol] = "SpacesdDownload";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeSpacesdDownloadObjectFactory.bless(pointer);
}
/**
* Stops the transfer.
*/
cancel(): void {uniffiCaller.rustCall(
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_spacesddownload_cancel(
uniffiTypeSpacesdDownloadObjectFactory.clonePointer(this),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
/**
* The next chunk, or `None` once the whole file arrived.
*/
async nextChunk(asyncOpts_?: { signal: AbortSignal }): Promise<ArrayBuffer | undefined> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
/*rustFutureFunc:*/ () => {
return nativeModule().uniffi_cua_sdk_fn_method_spacesddownload_next_chunk(
uniffiTypeSpacesdDownloadObjectFactory.clonePointer(this)
);
},
/*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,
/*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,
/*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,
/*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,
// Async returns always go through the JS-side converter: the
// FFI symbol returns the future handle (u64), and the user-level
// RustBuffer comes back via the shared `rust_future_complete_*`
// export. The bytes the runtime hands back must be deserialized
// here using the per-callable return-type converter.
/*liftFunc:*/ FfiConverterOptionalBytes.lift.bind(FfiConverterOptionalBytes),
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
/*asyncOpts:*/ asyncOpts_,
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
);
} catch (__error: any) {
if (uniffiIsDebug && __error instanceof Error) {
__error.stack = __stack;
}
throw __error;
}
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeSpacesdDownloadObjectFactory.pointer(this);
uniffiTypeSpacesdDownloadObjectFactory.freePointer(pointer);
uniffiTypeSpacesdDownloadObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is SpacesdDownload {
return uniffiTypeSpacesdDownloadObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeSpacesdDownloadObjectFactory: UniffiObjectFactory<SpacesdDownloadLike> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeSpacesdDownloadObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): SpacesdDownloadLike {
const instance = Object.create(SpacesdDownload.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "SpacesdDownload";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: SpacesdDownloadLike): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: SpacesdDownloadLike): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_spacesddownload(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_spacesddownload(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is SpacesdDownloadLike {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SpacesdDownload";
},
}})();
const FfiConverterTypeSpacesdDownload = new FfiConverterObject(uniffiTypeSpacesdDownloadObjectFactory);
/**
* Receives video frames and control events. Implementations must return
* quickly and hand off decoding.
*/
export interface FrameSink {
/**
* A video access unit.
*/
onFrame(frame: VideoFrame): void;
/**
* A control message or the socket close.
*/
onEvent(event: MediaEvent): void;
}
/**
* Receives video frames and control events. Implementations must return
* quickly and hand off decoding.
*/
export class FrameSinkImpl extends UniffiAbstractObject implements FrameSink {
readonly [uniffiTypeNameSymbol] = "FrameSinkImpl";
readonly [destructorGuardSymbol]: UniffiGcObject;
readonly [pointerLiteralSymbol]: UniffiHandle;
// No primary constructor declared for this class.
private constructor(pointer: UniffiHandle) {
super();
this[pointerLiteralSymbol] = pointer;
this[destructorGuardSymbol] = uniffiTypeFrameSinkImplObjectFactory.bless(pointer);
}
/**
* A video access unit.
*/
onFrame(frame: VideoFrame): void {uniffiCaller.rustCall(
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_framesink_on_frame(
uniffiTypeFrameSinkImplObjectFactory.clonePointer(this),
FfiConverterTypeVideoFrame.lower(frame, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
/**
* A control message or the socket close.
*/
onEvent(event: MediaEvent): void {uniffiCaller.rustCall(
/*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_framesink_on_event(
uniffiTypeFrameSinkImplObjectFactory.clonePointer(this),
FfiConverterTypeMediaEvent.lower(event, nativeModule().rustbuffer_alloc),
callStatus);
},
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
);
}
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
const pointer = uniffiTypeFrameSinkImplObjectFactory.pointer(this);
uniffiTypeFrameSinkImplObjectFactory.freePointer(pointer);
uniffiTypeFrameSinkImplObjectFactory.unbless(ptr);
delete (this as any)[destructorGuardSymbol];
}
}
static instanceOf(obj_: any): obj_ is FrameSinkImpl {
return uniffiTypeFrameSinkImplObjectFactory.isConcreteType(obj_);
}
}
const uniffiTypeFrameSinkImplObjectFactory: UniffiObjectFactory<FrameSink> = (() => {
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypeFrameSinkImplObjectFactory.freePointer(heldValue);
}) : null;
return {
create(pointer: UniffiHandle): FrameSink {
const instance = Object.create(FrameSinkImpl.prototype);
instance[pointerLiteralSymbol] = pointer;
instance[destructorGuardSymbol] = this.bless(pointer);
instance[uniffiTypeNameSymbol] = "FrameSinkImpl";
return instance;
},
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
markDestroyed: () => undefined,
};
if (registry) {
registry.register(ptr, p, ptr);
}
return ptr;
},
unbless(ptr_: UniffiGcObject) {
if (registry) {
registry.unregister(ptr_);
}
},
pointer(obj_: FrameSink): UniffiHandle {
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
throw new UniffiInternalError.UnexpectedNullPointer();
}
return (obj_ as any)[pointerLiteralSymbol];
},
clonePointer(obj_: FrameSink): UniffiHandle {
const pointer = this.pointer(obj_);
return uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_framesink(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
freePointer(pointer: UniffiHandle): void {
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_framesink(pointer, callStatus),
/*liftString:*/ FfiConverterString.lift
);
},
isConcreteType(obj_: any): obj_ is FrameSink {
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "FrameSinkImpl";
},
}})();
const FfiConverterTypeFrameSink = new FfiConverterObjectWithCallbacks(uniffiTypeFrameSinkImplObjectFactory);
// Add a vtable for the callbacks that go in FrameSink.
// Put the implementation in a struct so we don't pollute the top-level namespace
const uniffiCallbackInterfaceFrameSink: { vtable: any; register: () => void; } = {
// Create the VTable using a series of closures.
// ts automatically converts these into C callback functions.
vtable: {
on_frame: (
uniffiHandle: bigint,
frame: Uint8Array,) => {
const uniffiMakeCall =
()
: void => {
const jsCallback = FfiConverterTypeFrameSink.lift(uniffiHandle);
return jsCallback.onFrame(
FfiConverterTypeVideoFrame.lift(frame)
)
};
const uniffiResult = UniffiResult.ready<void>();
const uniffiHandleSuccess = (obj: any) => {};
const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => {
UniffiResult.writeError(uniffiResult, code, errBuf);
};
uniffiTraitInterfaceCall(
/*makeCall:*/ uniffiMakeCall,
/*handleSuccess:*/ uniffiHandleSuccess,
/*handleError:*/ uniffiHandleError,
/*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString),
/*alloc:*/ nativeModule().rustbuffer_alloc,
)
return uniffiResult;
},
on_event: (
uniffiHandle: bigint,
event: Uint8Array,) => {File truncated at 1 MB.