Skip to content
API reference

API reference

The generated reference is in docs/api.

Kind Export Description
class ComputerPortReservedError The port belongs to a Computer daemon and cannot be admitted for preview.
class ComputerPortConflictError A requested port cannot be reserved; no other process identity is disclosed.
class ComputerPortLimitError This Computer already admits the maximum number of preview ports.
class ComputerProcessNotFoundError No process with this id was started on this Computer.
class ComputerProcessLimitError Every process slot is occupied by a running process.
class ComputerFileConflict The expected file contents no longer match at atomic replacement.
class ComputerFileRangeError A byte window starts beyond the current file extent.
class ComputerFileTooLargeError The requested file bytes exceed the admitted read bound.
type alias ComputerExecutionBudget Host-owned policy, never supplied in a Computer request body.
type alias ComputerValue A JSON value accepted by computerValueSchema.
type alias ComputerFileReadInput A request to read one whole file as text.
type alias ComputerFileReadOutput The reply to reading one whole file as text.
type alias ComputerFileByteReadInput A request to read a window of bytes from one file.
type alias ComputerFileListInput A request for one page of a directory’s entries.
type alias ComputerFileListOutput The reply to a directory listing.
type alias ComputerFileWriteInput A request to write one file.
type alias ComputerFileWriteOutput The reply to a committed file write.
type alias ComputerFileGlobInput A request to find paths that match a glob.
type alias ComputerFileGrepInput A request to search file contents.
type alias ComputerRequestId A request id that passed computerRequestIdSchema.
type alias ComputerExecTruncation A record that one command stream was cut.
type alias ComputerProcessId A process id that passed computerProcessIdSchema.
type alias ComputerProcessSync A value of computerProcessSyncSchema.
type alias ComputerProcess One started process, as the Computer reports it.
type alias ComputerExecInput The model’s command input.
type alias ComputerExecRequest The host’s command request: the model’s input plus the host’s request id.
type alias ComputerExecOutput What a finished command left behind.
type alias ComputerExecutionCarriage Host-memory-only native inputs. Never part of a tool, replay row or log.
type alias ComputerExecutionInvocation Non-secret identity of the actual native invocation, not its credential.
type alias ComputerExecutionCloseReason Authority closure is distinct from asserting a native exit code.
type alias ComputerExecutionHostHooks The resource host owns cargo meaning and issuance. Computer owns NEW/replay, dispatch and actual native liveness. Only non-secret context is durable; hooks and carriage stay in host memory.
type alias ComputerExecutionHostPort Protected host seam only. Public command/process parsers do not accept cargo.
type alias ComputerOperationResult The durable status of one command invocation, for the host that owns its request id.
type alias ComputerToolResult The status of one command invocation without the host’s request id.
type alias ComputerOperation One public operation name.
type alias ComputerFileReplacement A request to replace a file’s contents if they still match.
type alias ComputerFileReplacementResult The reply to a committed replacement.
constant attachedBackendIdSchema The stable Workspace id of one attached execution backend: container, vm- followed by a lowercase letter-or-digit name that may contain hyphens, or local- followed by 16 lowercase base32 characters. A command request names one to run there; omitted, the Computer routes by its default order.
constant maximumFileBytes Most bytes of file content one Computer read or write carries, counted as UTF-8.
constant maximumListEntries Most entries one list, glob or grep reply returns in a single page.
constant maximumPatternCharacters Longest glob or search pattern a request may send.
constant maximumCommandCharacters Longest command string a request may send.
constant maximumStreamBytes Most bytes of stdout or stderr kept from one command. A longer stream is cut and marked.
constant truncationMarkerReserveBytes Room inside the stream cap for the visible truncation marker.
constant maximumExecutionTimeMs The bound for ordinary Computer commands; hosts own any admitted job budget.
constant genericComputerExecutionBudget The budget for ordinary Computer commands. Hosts that admit a job principal choose their own.
constant computerValueSchema Accepts any JSON value. Capability descriptions and other transport data are checked against it.
constant capabilityNameSchema Accepts the name of one Computer operation: a letter, then letters, digits or underscores.
constant computerPortSchema One valid TCP port number, used only with this Computer’s container.
constant maximumExposedPorts Most preview ports one Computer admits at once.
constant computerDaemonPort computerd’s Workspace RPC port, pinned by the Cloudflare container backend.
constant computerTerminalPort The Computer-owned terminal server inside the container image.
constant computerReservedPorts Ports served by the Computer’s own in-container daemons. An admitted preview must never reach a control plane.
constant computerPortInputSchema Names one container port to expose or remove.
constant computerPortOutputSchema Reply to a request to expose a port.
constant computerPortRemovalOutputSchema Reply to a request to stop exposing a port.
constant computerPortsOutputSchema The ports this Computer currently admits for preview.
constant computerCapabilitiesSchema Native operation descriptions shared by discovery and its OpenAPI document.
constant pathSchema Accepts an absolute path inside the Computer: it starts with a slash and holds no null byte.
constant readInputSchema Complete bounded UTF-8 text reads. Binary reads use the same path input.
constant readOutputSchema The whole contents of one file, as text.
constant readBytesInputSchema Optional byte window; text reads remain complete and independently bounded.
constant computerByteReadReplySchema Finite byte-read reply used by admitted App frame bindings.
constant appMethodPreviewResultSchema Host-admitted App method preview; parsing does not grant port access.
constant listLimitSchema Accepts how many entries a list returns: 1 up to maximumListEntries, 100 when omitted.
constant listOffsetSchema Accepts how many entries a list skips. Zero when omitted.
constant listInputSchema A request for one page of a directory’s entries.
constant listOutputSchema One page of a directory’s entries.
constant fileContentSchema Accepts text to store in a file, within maximumFileBytes.
constant writeInputSchema A request to write one file, creating or replacing its contents.
constant writeOutputSchema The reply to a committed file write.
constant writeBytesInputSchema Names the file for a binary write. The bytes travel as the request body.
constant replaceInputSchema A request to replace a file’s contents only if they still equal what the caller last saw.
constant replaceOutputSchema The reply to a committed replacement. It has the shape of a write reply.
constant globInputSchema A request to find paths under a directory that match a glob.
constant globOutputSchema The paths a glob found.
constant grepInputSchema A request to search file contents under a directory.
constant grepOutputSchema The lines a search found.
constant editInputSchema A request to replace one piece of text in a file.
constant editOutputSchema The reply to a committed edit.
constant mkdirInputSchema A request to create a directory.
constant mkdirOutputSchema The reply to a directory creation.
constant computerRequestIdSchema Host-owned idempotency key for one exec or bash tool invocation. The host mints it once per invocation and keeps it across its own retries of that invocation; the model never sees or supplies it.
constant execInputSchema The model’s command input: command, directory, backend and timeout. It carries no request id.
constant execRequestSchema Host-to-Computer command request: the model input plus the host’s ID.
constant execTruncationSchema One command stream cut at maximumStreamBytes; absent streams were whole.
constant execTruncationMarkerPattern Matches the marker line execTruncationMarker appends at the end of a stream.
constant execOutputSchema What a finished command left behind.
constant computerProcessIdSchema Accepts the durable id of one started process.
constant maximumRunningProcesses At most this many processes may be running in one host scope at once.
constant maximumProcessRecords At most this many process records, running or exited, are kept per host scope.
constant processStartInputSchema The host’s request to start one long-running process.
constant processStartToolInputSchema Model input excludes the host’s replay identity and authority scope.
constant processIdInputSchema Names one started process.
constant computerProcessStateSchema running: computerd still reports the execution live. exited: it ended; exitCode is null when the runtime that ran it was replaced or its record expired before the exit code was observed. uncertain: the Computer could not reach its container to check, so neither is claimed.
constant computerProcessSyncSchema synced: the drain that recorded this exit read all the way to EOF, which is also the read that runs computerd’s post-command pull. pending: that drain gave up waiting at its own deadline (a backgrounded child, for example node server.js &, can hold the transport open long after its parent exits) – a background continuation keeps watching and upgrades this row to synced once it reaches that real EOF, so pending rows stay updatable. unknown: this exit was recorded with no pull evidence at all (a replaced runtime, an expired record, or any other exit path that never drained for one). Never claim synced without the specific evidence for this exit; default to unknown, not synced.
constant computerProcessSchema One started process, as the Computer reports it.
constant processListOutputSchema The processes started on this Computer.
constant processKillOutputSchema The reply to a request to stop a process.
constant computerOperationStatusSchema Where one command invocation stands: accepted, running, succeeded, failed, unknown (the outcome cannot be established, because the Computer restarted mid-command or the id has no record yet is still inside the admission window) or expired (no record, and older than the admission window).
constant computerOperationResultSchema Durable operation status returned to the host that owns the request ID.
constant computerToolResultSchema Model-facing command result: the durable status without the host’s ID.
constant computerOperationSchema Public operation vocabulary; transport adapters map these to routes.
constant patchInputSchema Browser-safe patch contracts shared by native Files tools and Computer HTTP.
constant patchOutputSchema Native patch completion, cancellation or failure, including an optional mismatch.
function isComputerReservedPort() Whether a Computer daemon owns this port, so it can never be admitted for preview.
function boundedTextSchema() Builds a schema for text of at least the given length whose UTF-8 size stays within maximumFileBytes.
function mintComputerRequestId() Mint the request ID for one host tool invocation.
function computerExecutionRequestSchema() Resource hosts select a budget only after admitting their job principal.
function execTruncationMarker() The visible line appended to a cut stream; sizes exclude the line itself.
function utf8Prefix() Longest prefix of bytes within limit that ends on a UTF-8 character boundary.
function mintComputerProcessId() Mint the durable identity of one started process.
function installationProcessScope() A trusted App host binds replay identity to its admitted installation and caller.
function computerToolResult() Project one host operation result onto the model-facing tool result.
function computerCapabilities() The operations every Computer advertises; static, so hosts can describe them without a call. Built on first read: deriving JSON Schema for every operation is real work that a Worker should not pay at startup.

ComputerPortReservedErrorclass

Section titled “ComputerPortReservedError”

The port belongs to a Computer daemon and cannot be admitted for preview.

  • Error
Signature
new ComputerPortReservedError(port): ComputerPortReservedError;
Parameter Type
port number

ComputerPortReservedError

Signature
Error.constructor;

ComputerPortConflictErrorclass

Section titled “ComputerPortConflictError”

A requested port cannot be reserved; no other process identity is disclosed.

  • Error
Signature
new ComputerPortConflictError(): ComputerPortConflictError;

ComputerPortConflictError

Signature
Error.constructor;

This Computer already admits the maximum number of preview ports.

  • Error
Signature
new ComputerPortLimitError(): ComputerPortLimitError;

ComputerPortLimitError

Signature
Error.constructor;

ComputerProcessNotFoundErrorclass

Section titled “ComputerProcessNotFoundError”

No process with this id was started on this Computer.

  • Error
Signature
new ComputerProcessNotFoundError(id): ComputerProcessNotFoundError;
Parameter Type
id string

ComputerProcessNotFoundError

Signature
Error.constructor;

ComputerProcessLimitErrorclass

Section titled “ComputerProcessLimitError”

Every process slot is occupied by a running process.

  • Error
Signature
new ComputerProcessLimitError(): ComputerProcessLimitError;

ComputerProcessLimitError

Signature
Error.constructor;

The expected file contents no longer match at atomic replacement.

  • Error
Signature
new ComputerFileConflict(): ComputerFileConflict;

ComputerFileConflict

Signature
Error.constructor;

A byte window starts beyond the current file extent.

  • Error
Signature
new ComputerFileRangeError(size): ComputerFileRangeError;
Parameter Type Description
size number The file’s current size in bytes.

ComputerFileRangeError

Signature
Error.constructor;
Signature
readonly size: number;

The file’s current size in bytes.


ComputerFileTooLargeErrorclass

Section titled “ComputerFileTooLargeError”

The requested file bytes exceed the admitted read bound.

  • Error
Signature
new ComputerFileTooLargeError(): ComputerFileTooLargeError;

ComputerFileTooLargeError

Signature
Error.constructor;

ComputerExecutionBudgettype alias

Section titled “ComputerExecutionBudget”
Signature
type ComputerExecutionBudget = Readonly<{
maximumTimeMs: number;
}>;

Host-owned policy, never supplied in a Computer request body.


ComputerValuetype alias

Section titled “ComputerValue”
Signature
type ComputerValue = z.output<typeof computerValueSchema>;

A JSON value accepted by computerValueSchema.


ComputerFileReadInputtype alias

Section titled “ComputerFileReadInput”
Signature
type ComputerFileReadInput = z.output<typeof readInputSchema>;

A request to read one whole file as text.


ComputerFileReadOutputtype alias

Section titled “ComputerFileReadOutput”
Signature
type ComputerFileReadOutput = z.output<typeof readOutputSchema>;

The reply to reading one whole file as text.


ComputerFileByteReadInputtype alias

Section titled “ComputerFileByteReadInput”
Signature
type ComputerFileByteReadInput = z.output<typeof readBytesInputSchema>;

A request to read a window of bytes from one file.


ComputerFileListInputtype alias

Section titled “ComputerFileListInput”
Signature
type ComputerFileListInput = z.output<typeof listInputSchema>;

A request for one page of a directory’s entries.


ComputerFileListOutputtype alias

Section titled “ComputerFileListOutput”
Signature
type ComputerFileListOutput = z.output<typeof listOutputSchema>;

The reply to a directory listing.


ComputerFileWriteInputtype alias

Section titled “ComputerFileWriteInput”
Signature
type ComputerFileWriteInput = z.output<typeof writeInputSchema>;

A request to write one file.


ComputerFileWriteOutputtype alias

Section titled “ComputerFileWriteOutput”
Signature
type ComputerFileWriteOutput = z.output<typeof writeOutputSchema>;

The reply to a committed file write.


ComputerFileGlobInputtype alias

Section titled “ComputerFileGlobInput”
Signature
type ComputerFileGlobInput = z.output<typeof globInputSchema>;

A request to find paths that match a glob.


ComputerFileGrepInputtype alias

Section titled “ComputerFileGrepInput”
Signature
type ComputerFileGrepInput = z.output<typeof grepInputSchema>;

A request to search file contents.


ComputerRequestIdtype alias

Section titled “ComputerRequestId”
Signature
type ComputerRequestId = z.output<typeof computerRequestIdSchema>;

A request id that passed computerRequestIdSchema.


ComputerExecTruncationtype alias

Section titled “ComputerExecTruncation”
Signature
type ComputerExecTruncation = z.output<typeof execTruncationSchema>;

A record that one command stream was cut.


ComputerProcessIdtype alias

Section titled “ComputerProcessId”
Signature
type ComputerProcessId = z.output<typeof computerProcessIdSchema>;

A process id that passed computerProcessIdSchema.


ComputerProcessSynctype alias

Section titled “ComputerProcessSync”
Signature
type ComputerProcessSync = z.output<typeof computerProcessSyncSchema>;

A value of computerProcessSyncSchema.


ComputerProcesstype alias

Section titled “ComputerProcess”
Signature
type ComputerProcess = z.output<typeof computerProcessSchema>;

One started process, as the Computer reports it.


ComputerExecInputtype alias

Section titled “ComputerExecInput”
Signature
type ComputerExecInput = z.output<typeof execInputSchema>;

The model’s command input.


ComputerExecRequesttype alias

Section titled “ComputerExecRequest”
Signature
type ComputerExecRequest = z.output<typeof execRequestSchema>;

The host’s command request: the model’s input plus the host’s request id.


ComputerExecOutputtype alias

Section titled “ComputerExecOutput”
Signature
type ComputerExecOutput = z.output<typeof execOutputSchema>;

What a finished command left behind.


ComputerExecutionCarriagetype alias

Section titled “ComputerExecutionCarriage”
Signature
type ComputerExecutionCarriage = Readonly<{
env?: Readonly<Record<string, string>>;
stdin?: string | Uint8Array;
}>;

Host-memory-only native inputs. Never part of a tool, replay row or log.


ComputerExecutionInvocationtype alias

Section titled “ComputerExecutionInvocation”
Signature
type ComputerExecutionInvocation = Readonly<{
id: string;
kind: "exec" | "process";
}>;

Non-secret identity of the actual native invocation, not its credential.


ComputerExecutionCloseReasontype alias

Section titled “ComputerExecutionCloseReason”
Signature
type ComputerExecutionCloseReason =
"refused_start" | "native_exit" | "unknown" | "reconstructed";

Authority closure is distinct from asserting a native exit code.


ComputerExecutionHostHookstype alias

Section titled “ComputerExecutionHostHooks”
Signature
type ComputerExecutionHostHooks = Readonly<{
open: Promise<
Readonly<{
env?: Readonly<Record<string, string>>;
stdin?: string | Uint8Array;
}>
>;
renew: Promise<void>;
close: Promise<void>;
}>;

The resource host owns cargo meaning and issuance. Computer owns NEW/replay, dispatch and actual native liveness. Only non-secret context is durable; hooks and carriage stay in host memory.


ComputerExecutionHostPorttype alias

Section titled “ComputerExecutionHostPort”
Signature
type ComputerExecutionHostPort = Readonly<{
executionHooks:
| Readonly<{
open: Promise<
Readonly<{
env?: Readonly<Record<string, string>>;
stdin?: string | Uint8Array;
}>
>;
renew: Promise<void>;
close: Promise<void>;
}>
| undefined;
executionIsLive: Promise<boolean>;
executeOperationAfterAcceptance: Promise<{
requestId: string;
status:
"unknown" | "failed" | "running" | "accepted" | "succeeded" | "expired";
output: {
status: "completed" | "failed" | "cancelled";
exitCode: number;
stdout: string;
stderr: string;
truncated: false | object[];
} | null;
}>;
startProcessAfterAcceptance: Promise<{
id: string & object;
port: number | null;
command: string;
cwd: string | null;
state: "running" | "exited" | "uncertain";
exitCode: number | null;
sync: "unknown" | "synced" | "pending";
startedAt: number;
endedAt: number | null;
}>;
callAfterAcceptance: Promise<JSONType>;
}>;

Protected host seam only. Public command/process parsers do not accept cargo.


ComputerOperationResulttype alias

Section titled “ComputerOperationResult”
Signature
type ComputerOperationResult = z.output<typeof computerOperationResultSchema>;

The durable status of one command invocation, for the host that owns its request id.


ComputerToolResulttype alias

Section titled “ComputerToolResult”
Signature
type ComputerToolResult = z.output<typeof computerToolResultSchema>;

The status of one command invocation without the host’s request id.


ComputerOperationtype alias

Section titled “ComputerOperation”
Signature
type ComputerOperation = z.output<typeof computerOperationSchema>;

One public operation name.


ComputerFileReplacementtype alias

Section titled “ComputerFileReplacement”
Signature
type ComputerFileReplacement = z.output<typeof replaceInputSchema>;

A request to replace a file’s contents if they still match.


ComputerFileReplacementResulttype alias

Section titled “ComputerFileReplacementResult”
Signature
type ComputerFileReplacementResult = z.output<typeof replaceOutputSchema>;

The reply to a committed replacement.

attachedBackendIdSchemaconstant

Section titled “attachedBackendIdSchema”
Signature
const attachedBackendIdSchema: ZodLazy<ZodString>;

The stable Workspace id of one attached execution backend: container, vm- followed by a lowercase letter-or-digit name that may contain hyphens, or local- followed by 16 lowercase base32 characters. A command request names one to run there; omitted, the Computer routes by its default order.


maximumFileBytesconstant

Section titled “maximumFileBytes”
Signature
const maximumFileBytes: number;

Most bytes of file content one Computer read or write carries, counted as UTF-8.


maximumListEntriesconstant

Section titled “maximumListEntries”
Signature
const maximumListEntries: 256 = 256;

Most entries one list, glob or grep reply returns in a single page.


maximumPatternCharactersconstant

Section titled “maximumPatternCharacters”
Signature
const maximumPatternCharacters: 512 = 512;

Longest glob or search pattern a request may send.


maximumCommandCharactersconstant

Section titled “maximumCommandCharacters”
Signature
const maximumCommandCharacters: number;

Longest command string a request may send.


maximumStreamBytesconstant

Section titled “maximumStreamBytes”
Signature
const maximumStreamBytes: number;

Most bytes of stdout or stderr kept from one command. A longer stream is cut and marked.


truncationMarkerReserveBytesconstant

Section titled “truncationMarkerReserveBytes”
Signature
const truncationMarkerReserveBytes: 256 = 256;

Room inside the stream cap for the visible truncation marker.


maximumExecutionTimeMsconstant

Section titled “maximumExecutionTimeMs”
Signature
const maximumExecutionTimeMs: 120000 = 120_000;

The bound for ordinary Computer commands; hosts own any admitted job budget.


genericComputerExecutionBudgetconstant

Section titled “genericComputerExecutionBudget”
Signature
const genericComputerExecutionBudget: ComputerExecutionBudget;

The budget for ordinary Computer commands. Hosts that admit a job principal choose their own.


computerValueSchemaconstant

Section titled “computerValueSchema”
Signature
const computerValueSchema: ZodJSONSchema;

Accepts any JSON value. Capability descriptions and other transport data are checked against it.


capabilityNameSchemaconstant

Section titled “capabilityNameSchema”
Signature
const capabilityNameSchema: ZodLazy<ZodString>;

Accepts the name of one Computer operation: a letter, then letters, digits or underscores.


computerPortSchemaconstant

Section titled “computerPortSchema”
Signature
const computerPortSchema: ZodLazy<ZodNumber>;

One valid TCP port number, used only with this Computer’s container.


maximumExposedPortsconstant

Section titled “maximumExposedPorts”
Signature
const maximumExposedPorts: 64 = 64;

Most preview ports one Computer admits at once.


computerDaemonPortconstant

Section titled “computerDaemonPort”
Signature
const computerDaemonPort: 8080 = 8080;

computerd’s Workspace RPC port, pinned by the Cloudflare container backend.


computerTerminalPortconstant

Section titled “computerTerminalPort”
Signature
const computerTerminalPort: 7681 = 7681;

The Computer-owned terminal server inside the container image.


computerReservedPortsconstant

Section titled “computerReservedPorts”
Signature
const computerReservedPorts: ReadonlySet<number>;

Ports served by the Computer’s own in-container daemons. An admitted preview must never reach a control plane.


computerPortInputSchemaconstant

Section titled “computerPortInputSchema”
Signature
const computerPortInputSchema: ZodObject<
{
port: ZodLazy<ZodNumber>;
},
$strict
>;

Names one container port to expose or remove.


computerPortOutputSchemaconstant

Section titled “computerPortOutputSchema”
Signature
const computerPortOutputSchema: ZodLazy<
ZodObject<
{
port: ZodLazy<ZodNumber>;
exposed: ZodBoolean;
},
$strict
>
>;

Reply to a request to expose a port.


computerPortRemovalOutputSchemaconstant

Section titled “computerPortRemovalOutputSchema”
Signature
const computerPortRemovalOutputSchema: ZodLazy<
ZodObject<
{
port: ZodLazy<ZodNumber>;
removed: ZodBoolean;
},
$strict
>
>;

Reply to a request to stop exposing a port.


computerPortsOutputSchemaconstant

Section titled “computerPortsOutputSchema”
Signature
const computerPortsOutputSchema: ZodLazy<
ZodObject<
{
ports: ZodArray<ZodLazy<ZodNumber>>;
},
$strict
>
>;

The ports this Computer currently admits for preview.


computerCapabilitiesSchemaconstant

Section titled “computerCapabilitiesSchema”
Signature
const computerCapabilitiesSchema: ZodLazy<
ZodArray<
ZodObject<
{
id: ZodLazy<ZodString>;
name: ZodLazy<ZodString>;
kind: ZodString;
description: ZodString;
parameters: ZodLazy<ZodRecord<ZodString, ZodUnknown>>;
output: ZodLazy<ZodRecord<ZodString, ZodUnknown>>;
},
$strict
>
>
>;

Native operation descriptions shared by discovery and its OpenAPI document.


pathSchemaconstant

Section titled “pathSchema”
Signature
const pathSchema: ZodString;

Accepts an absolute path inside the Computer: it starts with a slash and holds no null byte.


readInputSchemaconstant

Section titled “readInputSchema”
Signature
const readInputSchema: ZodObject<
{
path: ZodString;
},
$strict
>;

Complete bounded UTF-8 text reads. Binary reads use the same path input.


readOutputSchemaconstant

Section titled “readOutputSchema”
Signature
const readOutputSchema: ZodLazy<
ZodObject<
{
path: ZodString;
content: ZodString;
},
$strict
>
>;

The whole contents of one file, as text.


readBytesInputSchemaconstant

Section titled “readBytesInputSchema”
Signature
const readBytesInputSchema: ZodObject<
{
path: ZodString;
byteOffset: ZodOptional<ZodNumber>;
byteLength: ZodOptional<ZodNumber>;
},
$strict
>;

Optional byte window; text reads remain complete and independently bounded.


computerByteReadReplySchemaconstant

Section titled “computerByteReadReplySchema”
Signature
const computerByteReadReplySchema: ZodLazy<
ZodObject<
{
path: ZodString;
byteOffset: ZodNumber;
content: ZodString;
encoding: ZodLiteral<"base64">;
truncated: ZodBoolean;
},
$strict
>
>;

Finite byte-read reply used by admitted App frame bindings.


appMethodPreviewResultSchemaconstant

Section titled “appMethodPreviewResultSchema”
Signature
const appMethodPreviewResultSchema: ZodLazy<
ZodObject<
{
previewUrl: ZodURL;
expiresAt: ZodNumber;
},
$strict
>
>;

Host-admitted App method preview; parsing does not grant port access.


listLimitSchemaconstant

Section titled “listLimitSchema”
Signature
const listLimitSchema: ZodDefault<ZodNumber>;

Accepts how many entries a list returns: 1 up to maximumListEntries, 100 when omitted.


listOffsetSchemaconstant

Section titled “listOffsetSchema”
Signature
const listOffsetSchema: ZodDefault<ZodNumber>;

Accepts how many entries a list skips. Zero when omitted.


listInputSchemaconstant

Section titled “listInputSchema”
Signature
const listInputSchema: ZodObject<
{
path: ZodDefault<ZodString>;
limit: ZodDefault<ZodNumber>;
offset: ZodDefault<ZodNumber>;
},
$strict
>;

A request for one page of a directory’s entries.


listOutputSchemaconstant

Section titled “listOutputSchema”
Signature
const listOutputSchema: ZodLazy<
ZodObject<
{
path: ZodString;
entries: ZodArray<
ZodLazy<
ZodObject<
{
name: ZodString;
size: ZodNumber;
modifiedAt: ZodNumber;
type: ZodEnum<{
file: "file";
directory: "directory";
symlink: "symlink";
}>;
},
$strict
>
>
>;
nextOffset: ZodNullable<ZodNumber>;
},
$strict
>
>;

One page of a directory’s entries.


fileContentSchemaconstant

Section titled “fileContentSchema”
Signature
const fileContentSchema: ZodLazy<ZodString>;

Accepts text to store in a file, within maximumFileBytes.


writeInputSchemaconstant

Section titled “writeInputSchema”
Signature
const writeInputSchema: ZodObject<
{
path: ZodString;
content: ZodLazy<ZodString>;
},
$strict
>;

A request to write one file, creating or replacing its contents.


writeOutputSchemaconstant

Section titled “writeOutputSchema”
Signature
const writeOutputSchema: ZodLazy<
ZodObject<
{
path: ZodString;
bytes: ZodNumber;
},
$strict
>
>;

The reply to a committed file write.


writeBytesInputSchemaconstant

Section titled “writeBytesInputSchema”
Signature
const writeBytesInputSchema: ZodObject<
{
path: ZodString;
},
$strict
> = readInputSchema;

Names the file for a binary write. The bytes travel as the request body.


replaceInputSchemaconstant

Section titled “replaceInputSchema”
Signature
const replaceInputSchema: ZodObject<
{
path: ZodString;
expectedContent: ZodLazy<ZodString>;
content: ZodLazy<ZodString>;
},
$strict
>;

A request to replace a file’s contents only if they still equal what the caller last saw.


replaceOutputSchemaconstant

Section titled “replaceOutputSchema”
Signature
const replaceOutputSchema: ZodLazy<
ZodObject<
{
path: ZodString;
bytes: ZodNumber;
},
$strict
>
> = writeOutputSchema;

The reply to a committed replacement. It has the shape of a write reply.


globInputSchemaconstant

Section titled “globInputSchema”
Signature
const globInputSchema: ZodLazy<
ZodObject<
{
path: ZodString;
pattern: ZodString;
limit: ZodDefault<ZodNumber>;
},
$strict
>
>;

A request to find paths under a directory that match a glob.


globOutputSchemaconstant

Section titled “globOutputSchema”
Signature
const globOutputSchema: ZodLazy<
ZodObject<
{
path: ZodString;
matches: ZodArray<ZodString>;
truncated: ZodBoolean;
},
$strict
>
>;

The paths a glob found.


grepInputSchemaconstant

Section titled “grepInputSchema”
Signature
const grepInputSchema: ZodLazy<
ZodObject<
{
path: ZodString;
pattern: ZodString;
regex: ZodDefault<ZodBoolean>;
ignoreCase: ZodDefault<ZodBoolean>;
include: ZodOptional<ZodString>;
limit: ZodDefault<ZodNumber>;
},
$strict
>
>;

A request to search file contents under a directory.


grepOutputSchemaconstant

Section titled “grepOutputSchema”
Signature
const grepOutputSchema: ZodLazy<
ZodObject<
{
path: ZodString;
matches: ZodArray<
ZodObject<
{
path: ZodString;
line: ZodNumber;
text: ZodString;
},
$strict
>
>;
truncated: ZodBoolean;
},
$strict
>
>;

The lines a search found.


editInputSchemaconstant

Section titled “editInputSchema”
Signature
const editInputSchema: ZodLazy<
ZodObject<
{
path: ZodString;
oldText: ZodString;
newText: ZodString;
},
$strict
>
>;

A request to replace one piece of text in a file.


editOutputSchemaconstant

Section titled “editOutputSchema”
Signature
const editOutputSchema: ZodLazy<
ZodObject<
{
path: ZodString;
bytes: ZodNumber;
diff: ZodString;
firstChangedLine: ZodNullable<ZodNumber>;
},
$strict
>
>;

The reply to a committed edit.


mkdirInputSchemaconstant

Section titled “mkdirInputSchema”
Signature
const mkdirInputSchema: ZodLazy<
ZodObject<
{
path: ZodString;
recursive: ZodDefault<ZodBoolean>;
},
$strict
>
>;

A request to create a directory.


mkdirOutputSchemaconstant

Section titled “mkdirOutputSchema”
Signature
const mkdirOutputSchema: ZodObject<
{
path: ZodString;
},
$strict
>;

The reply to a directory creation.


computerRequestIdSchemaconstant

Section titled “computerRequestIdSchema”
Signature
const computerRequestIdSchema: ZodUUID;

Host-owned idempotency key for one exec or bash tool invocation. The host mints it once per invocation and keeps it across its own retries of that invocation; the model never sees or supplies it.


execInputSchemaconstant

Section titled “execInputSchema”
Signature
const execInputSchema: ZodObject<
{
command: ZodString;
cwd: ZodOptional<ZodString>;
backend: ZodOptional<ZodLazy<ZodString>>;
timeoutMs: ZodDefault<ZodNumber>;
},
$strict
>;

The model’s command input: command, directory, backend and timeout. It carries no request id.


execRequestSchemaconstant

Section titled “execRequestSchema”
Signature
const execRequestSchema: ZodObject<
{
command: ZodString;
cwd: ZodOptional<ZodString>;
backend: ZodOptional<ZodLazy<ZodString>>;
timeoutMs: ZodDefault<ZodNumber>;
requestId: ZodUUID;
},
$strict
>;

Host-to-Computer command request: the model input plus the host’s ID.


execTruncationSchemaconstant

Section titled “execTruncationSchema”
Signature
const execTruncationSchema: ZodObject<
{
stream: ZodEnum<{
stdout: "stdout";
stderr: "stderr";
}>;
keptBytes: ZodNumber;
totalBytes: ZodNumber;
},
$strict
>;

One command stream cut at maximumStreamBytes; absent streams were whole.


execTruncationMarkerPatternconstant

Section titled “execTruncationMarkerPattern”
Signature
const execTruncationMarkerPattern: RegExp;

Matches the marker line execTruncationMarker appends at the end of a stream.


execOutputSchemaconstant

Section titled “execOutputSchema”
Signature
const execOutputSchema: ZodObject<
{
status: ZodEnum<{
completed: "completed";
failed: "failed";
cancelled: "cancelled";
}>;
exitCode: ZodNumber;
stdout: ZodString;
stderr: ZodString;
truncated: ZodUnion<
readonly [
ZodLiteral<false>,
ZodArray<
ZodObject<
{
stream: ZodEnum<{
stdout: "stdout";
stderr: "stderr";
}>;
keptBytes: ZodNumber;
totalBytes: ZodNumber;
},
$strict
>
>,
]
>;
},
$strict
>;

What a finished command left behind.


computerProcessIdSchemaconstant

Section titled “computerProcessIdSchema”
Signature
const computerProcessIdSchema: ZodLazy<
ZodString &
ZodType<
CairnId<"computer-process", "process", 1>,
string,
$ZodTypeInternals<CairnId<"computer-process", "process", 1>, string>
>
>;

Accepts the durable id of one started process.


maximumRunningProcessesconstant

Section titled “maximumRunningProcesses”
Signature
const maximumRunningProcesses: 16 = 16;

At most this many processes may be running in one host scope at once.


maximumProcessRecordsconstant

Section titled “maximumProcessRecords”
Signature
const maximumProcessRecords: 64 = 64;

At most this many process records, running or exited, are kept per host scope.


processStartInputSchemaconstant

Section titled “processStartInputSchema”
Signature
const processStartInputSchema: ZodObject<
{
requestId: ZodString;
requestScope: ZodString;
port: ZodOptional<ZodLazy<ZodNumber>>;
command: ZodString;
cwd: ZodOptional<ZodString>;
},
$strict
>;

The host’s request to start one long-running process.


processStartToolInputSchemaconstant

Section titled “processStartToolInputSchema”
Signature
const processStartToolInputSchema: ZodObject<
{
port: ZodOptional<ZodLazy<ZodNumber>>;
command: ZodString;
cwd: ZodOptional<ZodString>;
},
$strict
>;

Model input excludes the host’s replay identity and authority scope.


processIdInputSchemaconstant

Section titled “processIdInputSchema”
Signature
const processIdInputSchema: ZodObject<
{
id: ZodLazy<
ZodString &
ZodType<
CairnId<"computer-process", "process", 1>,
string,
$ZodTypeInternals<CairnId<"computer-process", "process", 1>, string>
>
>;
},
$strict
>;

Names one started process.


computerProcessStateSchemaconstant

Section titled “computerProcessStateSchema”
Signature
const computerProcessStateSchema: ZodEnum<{
running: "running";
exited: "exited";
uncertain: "uncertain";
}>;

running: computerd still reports the execution live. exited: it ended; exitCode is null when the runtime that ran it was replaced or its record expired before the exit code was observed. uncertain: the Computer could not reach its container to check, so neither is claimed.


computerProcessSyncSchemaconstant

Section titled “computerProcessSyncSchema”
Signature
const computerProcessSyncSchema: ZodEnum<{
synced: "synced";
pending: "pending";
unknown: "unknown";
}>;

synced: the drain that recorded this exit read all the way to EOF, which is also the read that runs computerd’s post-command pull. pending: that drain gave up waiting at its own deadline (a backgrounded child, for example node server.js &, can hold the transport open long after its parent exits) – a background continuation keeps watching and upgrades this row to synced once it reaches that real EOF, so pending rows stay updatable. unknown: this exit was recorded with no pull evidence at all (a replaced runtime, an expired record, or any other exit path that never drained for one). Never claim synced without the specific evidence for this exit; default to unknown, not synced.


computerProcessSchemaconstant

Section titled “computerProcessSchema”
Signature
const computerProcessSchema: ZodObject<
{
id: ZodLazy<
ZodString &
ZodType<
CairnId<"computer-process", "process", 1>,
string,
$ZodTypeInternals<CairnId<"computer-process", "process", 1>, string>
>
>;
port: ZodNullable<ZodLazy<ZodNumber>>;
command: ZodString;
cwd: ZodNullable<ZodString>;
state: ZodEnum<{
running: "running";
exited: "exited";
uncertain: "uncertain";
}>;
exitCode: ZodNullable<ZodNumber>;
sync: ZodEnum<{
synced: "synced";
pending: "pending";
unknown: "unknown";
}>;
startedAt: ZodNumber;
endedAt: ZodNullable<ZodNumber>;
},
$strict
>;

One started process, as the Computer reports it.


processListOutputSchemaconstant

Section titled “processListOutputSchema”
Signature
const processListOutputSchema: ZodObject<
{
processes: ZodArray<
ZodObject<
{
id: ZodLazy<
ZodString &
ZodType<
CairnId<"computer-process", "process", 1>,
string,
$ZodTypeInternals<
CairnId<"computer-process", "process", 1>,
string
>
>
>;
port: ZodNullable<ZodLazy<ZodNumber>>;
command: ZodString;
cwd: ZodNullable<ZodString>;
state: ZodEnum<{
running: "running";
exited: "exited";
uncertain: "uncertain";
}>;
exitCode: ZodNullable<ZodNumber>;
sync: ZodEnum<{
synced: "synced";
pending: "pending";
unknown: "unknown";
}>;
startedAt: ZodNumber;
endedAt: ZodNullable<ZodNumber>;
},
$strict
>
>;
},
$strict
>;

The processes started on this Computer.


processKillOutputSchemaconstant

Section titled “processKillOutputSchema”
Signature
const processKillOutputSchema: ZodLazy<
ZodObject<
{
process: ZodObject<
{
id: ZodLazy<
ZodString &
ZodType<
CairnId<"computer-process", "process", 1>,
string,
$ZodTypeInternals<
CairnId<"computer-process", "process", 1>,
string
>
>
>;
port: ZodNullable<ZodLazy<ZodNumber>>;
command: ZodString;
cwd: ZodNullable<ZodString>;
state: ZodEnum<{
running: "running";
exited: "exited";
uncertain: "uncertain";
}>;
exitCode: ZodNullable<ZodNumber>;
sync: ZodEnum<{
synced: "synced";
pending: "pending";
unknown: "unknown";
}>;
startedAt: ZodNumber;
endedAt: ZodNullable<ZodNumber>;
},
$strict
>;
signalled: ZodBoolean;
},
$strict
>
>;

The reply to a request to stop a process.


computerOperationStatusSchemaconstant

Section titled “computerOperationStatusSchema”
Signature
const computerOperationStatusSchema: ZodEnum<{
accepted: "accepted";
running: "running";
succeeded: "succeeded";
failed: "failed";
unknown: "unknown";
expired: "expired";
}>;

Where one command invocation stands: accepted, running, succeeded, failed, unknown (the outcome cannot be established, because the Computer restarted mid-command or the id has no record yet is still inside the admission window) or expired (no record, and older than the admission window).


computerOperationResultSchemaconstant

Section titled “computerOperationResultSchema”
Signature
const computerOperationResultSchema: ZodObject<{
requestId: ZodUUID;
status: ZodEnum<{
accepted: "accepted";
running: "running";
succeeded: "succeeded";
failed: "failed";
unknown: "unknown";
expired: "expired";
}>;
output: ZodNullable<ZodObject<{
status: ZodEnum<{
completed: "completed";
failed: "failed";
cancelled: "cancelled";
}>;
exitCode: ZodNumber;
stdout: ZodString;
stderr: ZodString;
truncated: ZodUnion<readonly [ZodLiteral<false>, ZodArray<ZodObject<{
stream: ZodEnum<...>;
keptBytes: ZodNumber;
totalBytes: ZodNumber;
}, $strict>>]>;
}, $strict>>;
}, $strict>;

Durable operation status returned to the host that owns the request ID.


computerToolResultSchemaconstant

Section titled “computerToolResultSchema”
Signature
const computerToolResultSchema: ZodObject<{
status: ZodEnum<{
accepted: "accepted";
running: "running";
succeeded: "succeeded";
failed: "failed";
unknown: "unknown";
expired: "expired";
}>;
output: ZodNullable<ZodObject<{
status: ZodEnum<{
completed: "completed";
failed: "failed";
cancelled: "cancelled";
}>;
exitCode: ZodNumber;
stdout: ZodString;
stderr: ZodString;
truncated: ZodUnion<readonly [ZodLiteral<false>, ZodArray<ZodObject<{
stream: ZodEnum<...>;
keptBytes: ZodNumber;
totalBytes: ZodNumber;
}, $strict>>]>;
}, $strict>>;
}, $strict>;

Model-facing command result: the durable status without the host’s ID.


computerOperationSchemaconstant

Section titled “computerOperationSchema”
Signature
const computerOperationSchema: ZodEnum<{
files.read: "files.read";
files.readBytes: "files.readBytes";
files.write: "files.write";
files.writeBytes: "files.writeBytes";
files.list: "files.list";
files.glob: "files.glob";
files.grep: "files.grep";
files.edit: "files.edit";
files.patch: "files.patch";
mkdir: "mkdir";
bash: "bash";
exec: "exec";
}>;

Public operation vocabulary; transport adapters map these to routes.


patchInputSchemaconstant

Section titled “patchInputSchema”
Signature
const patchInputSchema: z.ZodLazy<
z.ZodObject<
{
patch: z.ZodString;
},
z.core.$strict
>
>;

Browser-safe patch contracts shared by native Files tools and Computer HTTP.


patchOutputSchemaconstant

Section titled “patchOutputSchema”
Signature
const patchOutputSchema: z.ZodLazy<z.ZodUnion<readonly [z.ZodObject<{
status: z.ZodEnum<{
completed: "completed";
failed: "failed";
cancelled: "cancelled";
}>;
exitCode: z.ZodNumber;
stdout: z.ZodString;
stderr: z.ZodString;
truncated: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodArray<z.ZodObject<..., ...>>]>;
}, z.core.$strict>, z.ZodObject<{
status: z.ZodEnum<{
completed: "completed";
failed: "failed";
cancelled: "cancelled";
}>;
exitCode: z.ZodNumber;
stdout: z.ZodString;
stderr: z.ZodString;
truncated: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodArray<z.ZodObject<..., ...>>]>;
error: z.ZodObject<{
kind: z.ZodLiteral<"mismatch">;
}, z.core.$strict>;
}, z.core.$strict>]>>;

Native patch completion, cancellation or failure, including an optional mismatch.

isComputerReservedPort()function

Section titled “isComputerReservedPort()”
Signature
function isComputerReservedPort(port): boolean;

Whether a Computer daemon owns this port, so it can never be admitted for preview.

Parameter Type
port number

boolean


boundedTextSchema()function

Section titled “boundedTextSchema()”
Signature
function boundedTextSchema(minimumLength?): ZodString;

Builds a schema for text of at least the given length whose UTF-8 size stays within maximumFileBytes.

Parameter Type Default value
minimumLength number 0

ZodString


mintComputerRequestId()function

Section titled “mintComputerRequestId()”
Signature
function mintComputerRequestId(): string;

Mint the request ID for one host tool invocation.

string


computerExecutionRequestSchema()function

Section titled “computerExecutionRequestSchema()”
Signature
function computerExecutionRequestSchema(budget): ZodObject<
{
command: ZodString;
cwd: ZodOptional<ZodString>;
backend: ZodOptional<ZodLazy<ZodString>>;
timeoutMs: ZodDefault<ZodNumber>;
requestId: ZodUUID;
},
$strict
>;

Resource hosts select a budget only after admitting their job principal.

Parameter Type
budget ComputerExecutionBudget

ZodObject<{ command: ZodString; cwd: ZodOptional<ZodString>; backend: ZodOptional<ZodLazy<ZodString>>; timeoutMs: ZodDefault<ZodNumber>; requestId: ZodUUID; }, $strict>


execTruncationMarker()function

Section titled “execTruncationMarker()”
Signature
function execTruncationMarker(entry): string;

The visible line appended to a cut stream; sizes exclude the line itself.

Parameter Type Description
entry { stream: "stdout" | "stderr"; keptBytes: number; totalBytes: number; } -
entry.stream "stdout" | "stderr" Which stream was cut.
entry.keptBytes number Bytes of the stream that were kept.
entry.totalBytes number Bytes the stream held before it was cut.

string


utf8Prefix()function

Section titled “utf8Prefix()”
Signature
function utf8Prefix(bytes, limit): Uint8Array<ArrayBuffer>;

Longest prefix of bytes within limit that ends on a UTF-8 character boundary.

Parameter Type
bytes Uint8Array
limit number

Uint8Array<ArrayBuffer>


mintComputerProcessId()function

Section titled “mintComputerProcessId()”
Signature
function mintComputerProcessId(): string & object;

Mint the durable identity of one started process.


installationProcessScope()function

Section titled “installationProcessScope()”
Signature
function installationProcessScope(installation, method, actor): string;

A trusted App host binds replay identity to its admitted installation and caller.

Parameter Type
installation string
method string
actor Readonly<{ kind: "member" | "agent" | "team-key"; id: string; }>

string


computerToolResult()function

Section titled “computerToolResult()”
Signature
function computerToolResult(result): object;

Project one host operation result onto the model-facing tool result.

Parameter Type Description
result { requestId: string; status: "unknown" | "failed" | "running" | "accepted" | "succeeded" | "expired"; output: | { status: "completed" | "failed" | "cancelled"; exitCode: number; stdout: string; stderr: string; truncated: false | object[]; } | null; } -
result.requestId string The host’s id for this invocation.
result.status "unknown" | "failed" | "running" | "accepted" | "succeeded" | "expired" Where the invocation stands.
result.output | { status: "completed" | "failed" | "cancelled"; exitCode: number; stdout: string; stderr: string; truncated: false | object[]; } | null The command’s output once known and still retained, otherwise null.
Name Type Default value Description
status "unknown" | "failed" | "running" | "accepted" | "succeeded" | "expired" computerOperationStatusSchema Where the invocation stands.
output | { status: "completed" | "failed" | "cancelled"; exitCode: number; stdout: string; stderr: string; truncated: false | object[]; } | null - The command’s output once known and still retained, otherwise null.

computerCapabilities()function

Section titled “computerCapabilities()”
Signature
function computerCapabilities(): object[];

The operations every Computer advertises; static, so hosts can describe them without a call. Built on first read: deriving JSON Schema for every operation is real work that a Worker should not pay at startup.