cayu.workspaces.microsandbox
Public Cayu API. Definitions are grouped by their public source module, and definitions from private implementation modules appear on their package’s page; adding a symbol does not move existing links. The import shown at each entry is a supported public namespace. Read the Python API overview and install the required extra.
DEFAULT_MICROSANDBOX_WORKSPACE_LIST_LIMIT
Section titled “DEFAULT_MICROSANDBOX_WORKSPACE_LIST_LIMIT”from cayu.workspaces import DEFAULT_MICROSANDBOX_WORKSPACE_LIST_LIMITDEFAULT_MICROSANDBOX_WORKSPACE_LIST_LIMIT = 500Release source · Runtime guarantees · Capability guides
DEFAULT_MICROSANDBOX_WORKSPACE_READ_LIMIT_BYTES
Section titled “DEFAULT_MICROSANDBOX_WORKSPACE_READ_LIMIT_BYTES”from cayu.workspaces import DEFAULT_MICROSANDBOX_WORKSPACE_READ_LIMIT_BYTESDEFAULT_MICROSANDBOX_WORKSPACE_READ_LIMIT_BYTES = 256 * 1024Release source · Runtime guarantees · Capability guides
MicrosandboxWorkspace
Section titled “MicrosandboxWorkspace”from cayu.workspaces import MicrosandboxWorkspaceWorkspace backed by a Microsandbox sandbox.
read_bytes/write_bytes/delete run through a guest-side guard
program (see cayu.workspaces._guest_guard) that resolves and opens
every path component atomically with O_NOFOLLOW inside the sandbox, so
a co-resident guest process cannot race a host-side realpath check
(TOCTOU). Those operations require python3 inside the guest. list
uses Microsandbox’s native filesystem API with best-effort realpath
containment; any subsequent read is re-checked by the guard.
Bases: RunnerBoundWorkspace.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
id |
str |
required |
reference_binding (method)
Section titled “reference_binding (method)”MicrosandboxWorkspace.reference_binding() -> WorkspaceReferenceBindingBind application data to this workspace incarnation.
The default is object-lifetime scoped and fails closed after reopening. Durable adapters may override this method only when they can preserve an incarnation across recovery and rotate it on replacement. Never restore a generation from the application reference being validated.
read_bytes (method)
Section titled “read_bytes (method)”async MicrosandboxWorkspace.read_bytes(path: str, *, offset: int=0, max_bytes: int | None=None) -> WorkspaceReadResultbounded_read_limit (method)
Section titled “bounded_read_limit (method)”MicrosandboxWorkspace.bounded_read_limit(max_bytes: int) -> intwrite_bytes (method)
Section titled “write_bytes (method)”async MicrosandboxWorkspace.write_bytes(path: str, content: bytes) -> Nonedelete (method)
Section titled “delete (method)”async MicrosandboxWorkspace.delete(path: str) -> Nonecreate_bytes (method)
Section titled “create_bytes (method)”async MicrosandboxWorkspace.create_bytes(path: str, content: bytes) -> WorkspaceMutationResultreplace_bytes (method)
Section titled “replace_bytes (method)”async MicrosandboxWorkspace.replace_bytes(path: str, content: bytes, *, expected_revision: str) -> WorkspaceMutationResultdelete_if_revision (method)
Section titled “delete_if_revision (method)”async MicrosandboxWorkspace.delete_if_revision(path: str, *, expected_revision: str) -> WorkspaceMutationResultrequire_absent (method)
Section titled “require_absent (method)”async MicrosandboxWorkspace.require_absent(path: str) -> Nonemove_if_revision (method)
Section titled “move_if_revision (method)”async MicrosandboxWorkspace.move_if_revision(source_path: str, destination_path: str, *, expected_source_revision: str, require_destination_absent: bool=True) -> WorkspaceMoveResultlist (method)
Section titled “list (method)”async MicrosandboxWorkspace.list(pattern: str='**/*', *, limit: int | None=None) -> WorkspaceListResultlist_git_entries (method)
Section titled “list_git_entries (method)”async MicrosandboxWorkspace.list_git_entries(*, limit: int) -> WorkspaceGitEntryListResultList regular files and symlinks without following either entry type.
resource_key (property)
Section titled “resource_key (property)”MicrosandboxWorkspace.resource_key() -> tuple[object, ...] | Nonetar_copy_policy_identity (method)
Section titled “tar_copy_policy_identity (method)”MicrosandboxWorkspace.tar_copy_policy_identity() -> tuple[object, ...] | NoneReturn an exact, content-free identity for tar copy security policy.
SyncBinding only shares a sealed archive when both adapters opt in
with stable identities. Implementations must change the identity whenever
path exclusions, archive parsing, or extraction policy changes. None
conservatively disables sharing for this adapter.
bounded_tar_stream_reader (method)
Section titled “bounded_tar_stream_reader (method)”MicrosandboxWorkspace.bounded_tar_stream_reader() -> BoundedTarStreamReader | NoneReturn an explicit bounded streaming-tar reader capability, if any.
tar_stream_writer (method)
Section titled “tar_stream_writer (method)”MicrosandboxWorkspace.tar_stream_writer() -> TarStreamWriter | NoneReturn an explicit streaming-tar writer capability, if any.
branch_capabilities (method)
Section titled “branch_capabilities (method)”MicrosandboxWorkspace.branch_capabilities() -> WorkspaceBranchCapabilitiesReturn explicit workspace-branch guarantees for this adapter.
Unsupported is the compatibility default. Capability must be declared by the exact adapter instance and is never inferred from adjacent filesystem, snapshot, runner, sync, reconnect, or Git behavior.
branch_lifecycle_summary (method)
Section titled “branch_lifecycle_summary (method)”MicrosandboxWorkspace.branch_lifecycle_summary() -> WorkspaceBranchLifecycleSummaryReturn bounded lifecycle states for branch handles attached here.
create_branch (method)
Section titled “create_branch (method)”async MicrosandboxWorkspace.create_branch(request: WorkspaceBranchRequest) -> WorkspaceBranchCreationResultCreate an isolated bounded workspace branch when supported.
Branching is an optional capability rather than an abstract workspace requirement. Backends that do not implement the complete isolation and publication contract return a typed unsupported result.
is_bound_to_runner (method)
Section titled “is_bound_to_runner (method)”MicrosandboxWorkspace.is_bound_to_runner(runner: Runner) -> boolrunner_cwd (property)
Section titled “runner_cwd (property)”MicrosandboxWorkspace.runner_cwd() -> strbound_runner_resource_key (property)
Section titled “bound_runner_resource_key (property)”MicrosandboxWorkspace.bound_runner_resource_key() -> tuple[object, ...]init (method)
Section titled “init (method)”MicrosandboxWorkspace.__init__(runner: Runner, *, root: str=DEFAULT_MICROSANDBOX_CWD, workspace_id: str | None=None, default_read_limit_bytes: int=DEFAULT_MICROSANDBOX_WORKSPACE_READ_LIMIT_BYTES, default_list_limit: int=DEFAULT_MICROSANDBOX_WORKSPACE_LIST_LIMIT) -> Noneresolve (method)
Section titled “resolve (method)”MicrosandboxWorkspace.resolve(path: str) -> str