Cua Volume

The versioned volume every Space and agent shares: files, history, grants, requests, audit, storage and sync.

Cua Volume methods on the Spaces registry. Access is checked by the runtime; pass a DriveView to see the drive as a persistent agent does. Grants and approvals ask the user for presence. Guide: Cua Volume.

Drive methods#

Methods of Spaces.

Spaces.volume_ls#

volume_ls: a folder's immediate children (default the root).

async def volume_ls(self, path: Optional[str], view: Optional[DriveView]) -> DriveListing
ParameterTypeDefault
pathOption<String>required
viewOption<DriveView>required

Returns DriveListing · Async · Raises CuaError

Spaces.volume_read#

volume_read: a file (or one of its versions).

async def volume_read(self, path: str, version: Optional[str], view: Optional[DriveView]) -> DriveFile
ParameterTypeDefault
pathStringrequired
versionOption<String>required
viewOption<DriveView>required

Returns DriveFile · Async · Raises CuaError

Spaces.volume_write#

volume_write: a new version of a file. if_etag makes it a compare-and-swap, create_only makes it create-only.

async def volume_write(self, path: str, content: bytes, if_etag: Optional[str], create_only: bool, view: Optional[DriveView]) -> DriveObject
ParameterTypeDefault
pathStringrequired
contentVec<u8>required
if_etagOption<String>required
create_onlyboolrequired
viewOption<DriveView>required

Returns DriveObject · Async · Raises CuaError

Spaces.volume_delete#

volume_delete: a delete marker (history stays).

async def volume_delete(self, path: str, if_etag: Optional[str], view: Optional[DriveView]) -> None
ParameterTypeDefault
pathStringrequired
if_etagOption<String>required
viewOption<DriveView>required

Async · Raises CuaError

Spaces.volume_history#

volume_history: a file's versions, newest first.

async def volume_history(self, path: str, view: Optional[DriveView]) -> List[DriveVersion]
ParameterTypeDefault
pathStringrequired
viewOption<DriveView>required

Returns Vec<DriveVersion> · Async · Raises CuaError

Spaces.volume_restore#

volume_restore: makes an old version current again.

async def volume_restore(self, path: str, version: str, view: Optional[DriveView]) -> DriveObject
ParameterTypeDefault
pathStringrequired
versionStringrequired
viewOption<DriveView>required

Returns DriveObject · Async · Raises CuaError

Spaces.volume_grant#

volume_grant: widens principal's access (agent:<name> or space:<id>, mode r or rw). The user confirms with presence.

async def volume_grant(self, principal: str, prefix: str, mode: str, expires_in_secs: Optional[int], note: Optional[str]) -> DriveGrant
ParameterTypeDefault
principalStringrequired
prefixStringrequired
modeStringrequired
expires_in_secsOption<u64>required
noteOption<String>required

Returns DriveGrant · Async · Raises CuaError

Spaces.volume_revoke#

volume_revoke.

async def volume_revoke(self, grant_id: str) -> DriveGrant
ParameterTypeDefault
grant_idStringrequired

Returns DriveGrant · Async · Raises CuaError

Spaces.volume_grants#

volume_grants: live grants (every grant with all).

async def volume_grants(self, all: bool) -> List[DriveGrant]
ParameterTypeDefault
allboolrequired

Returns Vec<DriveGrant> · Async · Raises CuaError

Spaces.volume_request_access#

volume_request_access: agent asks the user for more access.

async def volume_request_access(self, agent: str, prefix: str, mode: str, reason: Optional[str], in_space: Optional[str]) -> DriveAccessRequest
ParameterTypeDefault
agentStringrequired
prefixStringrequired
modeStringrequired
reasonOption<String>required
in_spaceOption<String>required

Returns DriveAccessRequest · Async · Raises CuaError

Spaces.volume_requests#

volume_requests: requests waiting for the user.

async def volume_requests(self) -> List[DriveAccessRequest]

Returns Vec<DriveAccessRequest> · Async · Raises CuaError

Spaces.volume_approve#

volume_approve: the request becomes a grant (with presence).

async def volume_approve(self, request_id: str, expires_in_secs: Optional[int]) -> DriveGrant
ParameterTypeDefault
request_idStringrequired
expires_in_secsOption<u64>required

Returns DriveGrant · Async · Raises CuaError

Spaces.volume_deny#

volume_deny.

async def volume_deny(self, request_id: str) -> None
ParameterTypeDefault
request_idStringrequired

Async · Raises CuaError

Spaces.volume_audit#

volume_audit: the newest events (default 50) and whether the log verified.

async def volume_audit(self, limit: Optional[int]) -> DriveAudit
ParameterTypeDefault
limitOption<u32>required

Returns DriveAudit · Async · Raises CuaError

Named volumes#

Methods of Spaces.

Spaces.volumes#

The named volumes of Cua Volume, by name, with the Spaces that mount each. Needs Cua Spaces (the Cua Volume).

async def volumes(self) -> List[NamedVolume]

Returns Vec<NamedVolume> · Async · Raises CuaError

Spaces.create_volume#

Creates the empty named volume name (1 to 63 of a-z, 0-9, ., _, -). Fails when it exists. Mount it with SpaceCreateOptions.volumes; read and write its files with Spaces.volume_ls and friends under volumes/<name>/.

async def create_volume(self, name: str) -> NamedVolume
ParameterTypeDefault
nameStringrequired

Returns NamedVolume · Async · Raises CuaError

Spaces.delete_volume#

Deletes the named volume name and its files (their history stays in the Cua Volume). Refused while Spaces mount it unless force. Returns how many files went.

async def delete_volume(self, name: str, force: bool = False) -> int
ParameterTypeDefault
nameStringrequired
forceboolfalse

Returns u64 · Async · Raises CuaError

VolumeMount record#

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.

FieldTypeDefaultDescription
nameStringThe volume's name (Spaces.create_volume): 1 to 63 of a-z, 0-9, ., _, -.
pathStringWhere it appears in the Space (absolute, for example /mnt/shared).
read_only / readOnlyboolfalseMounted read-only: writes fail.
subpathString""A folder inside the volume to mount instead of all of it (relative).

NamedVolume record#

A named volume of Cua Volume (Spaces.volumes).

Returned by Spaces.create_volume, Spaces.volumes.

FieldTypeDefaultDescription
nameStringThe name.
mounted_in / mountedInVec<String>Ids of the Spaces that mount it.

DriveView record#

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.

FieldTypeDefaultDescription
as_agent / asAgentOption<String>NoneA persistent agent's name (ada).
in_space / inSpaceOption<String>NoneThe Space id the agent is in (local:work).

DriveListing record#

A folder's listing.

Returned by Spaces.volume_ls.

FieldTypeDefaultDescription
pathString
principalStringuser or agent:<name>.
entriesVec<DriveEntry>

DriveEntry record#

One row of a drive listing.

FieldTypeDefaultDescription
pathStringKey (folders end in /).
nameString
folderbool
sizeu64
modified_ms / modifiedMsu64
etagString
modeStringr or rw: what this view may do there.
syncOption<DriveFileSync>A file's sync state, when it has something to say (uploading, conflicted, or last written by another device).

DriveFile record#

A file's content and version.

Returned by Spaces.volume_read.

FieldTypeDefaultDescription
pathString
sizeu64
etagString
versionString
modified_ms / modifiedMsu64
contentVec<u8>
syncOption<DriveFileSync>Its sync state, while the drive's services run.

DriveObject record#

A written version.

Returned by Spaces.volume_restore, Spaces.volume_write.

FieldTypeDefaultDescription
keyString
sizeu64
etagString
versionString
modified_ms / modifiedMsu64

DriveVersion record#

One version in a file's history.

Returned by Spaces.volume_history.

FieldTypeDefaultDescription
versionString
sizeu64
modified_ms / modifiedMsu64
deletedbool
latestbool

DriveGrant record#

A widening of an agent's or a Space's access.

Returned by Spaces.volume_approve, Spaces.volume_grant, Spaces.volume_grants, Spaces.volume_revoke.

FieldTypeDefaultDescription
idString
principalString
prefixString
modeStringr or rw.
created_ms / createdMsu64
expires_ms / expiresMsOption<u64>
revokedbool
noteString

DriveAccessRequest record#

An agent's request for more access, waiting for the user.

Returned by Spaces.volume_request_access, Spaces.volume_requests.

FieldTypeDefaultDescription
idString
principalString
prefixString
modeString
reasonString
created_ms / createdMsu64

DriveAudit record#

The newest audit events and whether the hash chain verified.

Returned by Spaces.volume_audit.

FieldTypeDefaultDescription
eventsVec<DriveAuditEvent>
verifiedbool
errorOption<String>

DriveAuditEvent record#

One audit event.

FieldTypeDefaultDescription
sequ64
ts_ms / tsMsu64
principalString
actionString
pathString
detailString

DriveFileSync record#

One file's sync state.

FieldTypeDefaultDescription
stateStringsynced, 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).
written_by / writtenByOption<String>The device that last wrote it, when another one did.
conflict_path / conflictPathOption<String>

Cua Volume storage and sync#

Runtime methods of the drive on the Spaces registry: Settings > Storage, the mount, sync state and the cache. volume_sync_status also lists the volume mounted in each Space. Files: Cua Volume.

Storage, the volume, sync and the cache#

Methods of Spaces.

Spaces.volume_storage#

volume_storage: where the drive keeps its bytes.

async def volume_storage(self) -> DriveStorage

Returns DriveStorage · Async · Raises CuaError

Spaces.volume_storage_set#

volume_storage_set: tests, and unless dry_run saves and switches to, a storage backend (live, no restart).

async def volume_storage_set(self, update: DriveStorageUpdate) -> DriveStorageCheck
ParameterTypeDefault
updateDriveStorageUpdaterequired

Returns DriveStorageCheck · Async · Raises CuaError

Spaces.volume_mount_status#

volume_mount_status: whether the drive is mounted as a volume.

async def volume_mount_status(self) -> DriveMountStatus

Returns DriveMountStatus · Async · Raises CuaError

Spaces.volume_mount#

volume_mount: turns the mount on (kept across restarts) and mounts.

async def volume_mount(self) -> DriveMountStatus

Returns DriveMountStatus · Async · Raises CuaError

Spaces.volume_unmount#

volume_unmount: turns the mount off; pending uploads land first.

async def volume_unmount(self) -> DriveMountStatus

Returns DriveMountStatus · Async · Raises CuaError

Spaces.volume_sync_status#

volume_sync_status: devices, pending uploads and conflicts.

async def volume_sync_status(self) -> DriveSyncStatus

Returns DriveSyncStatus · Async · Raises CuaError

Spaces.volume_sync_events#

volume_sync_events: events after since_seq, waiting up to wait_ms (at most 30000) for one.

async def volume_sync_events(self, since_seq: Optional[int], wait_ms: Optional[int]) -> DriveSyncEvents
ParameterTypeDefault
since_seqOption<u64>required
wait_msOption<u32>required

Returns DriveSyncEvents · Async · Raises CuaError

Spaces.volume_sync_resolve#

volume_sync_resolve: clears a conflict from the list (files stay).

async def volume_sync_resolve(self, path: str) -> None
ParameterTypeDefault
pathStringrequired

Async · Raises CuaError

Spaces.volume_cache_stats#

volume_cache_stats: the block cache's size, cap and hit rate.

async def volume_cache_stats(self) -> DriveCacheStats

Returns DriveCacheStats · Async · Raises CuaError

Spaces.volume_cache_set#

volume_cache_set: the cache's size cap (at least 256 MiB).

async def volume_cache_set(self, capacity_bytes: int) -> DriveCacheStats
ParameterTypeDefault
capacity_bytesu64required

Returns DriveCacheStats · Async · Raises CuaError

Spaces.volume_cache_clear#

volume_cache_clear: drops every cached block.

async def volume_cache_clear(self) -> DriveCacheStats

Returns DriveCacheStats · Async · Raises CuaError

DriveStorage record#

Where the drive keeps its bytes (Settings > Storage).

Returned by Spaces.volume_storage.

FieldTypeDefaultDescription
backendStringfs or s3.
fs_path / fsPathStringWhere the fs backend keeps bytes.
s3Option<DriveS3Settings>
has_keys / hasKeysboolS3 keys are saved (they are never returned).
cloud_available / cloudAvailableboolAlways false in this release: hide the Cua cloud option.

DriveS3Settings record#

Where an S3-compatible bucket is (no keys).

FieldTypeDefaultDescription
endpointOption<String>http://127.0.0.1:9000, https://<account>.r2.cloudflarestorage.com; None for AWS.
regionStringus-east-1; auto for R2.
bucketString
rootStringA key prefix inside the bucket (may be empty).
path_style / pathStyleboolPath-style addressing (MinIO and most self-hosted stores).

DriveStorageUpdate record#

A storage change, or with dry_run a connection test.

FieldTypeDefaultDescription
backendStringfs or s3 (cloud is refused).
s3Option<DriveS3Settings>
access_key_id / accessKeyIdOption<String>With secret_access_key (both or neither); saved in the credential store.
secret_access_key / secretAccessKeyOption<String>
dry_run / dryRunboolOnly test; change nothing.

DriveStorageCheck record#

What a storage test found.

Returned by Spaces.volume_storage_set.

FieldTypeDefaultDescription
okbool
reachablebool
authorizedbool
versioningboolBucket versioning is on (required).
detailOption<String>A sentence when not ok: what is wrong and how to fix it.
problemOption<String>What is wrong, to key the UI on: unreachable, bad_keys, forbidden, bucket_missing, versioning_off, path_style_needed.
appliedboolSaved and switched live.

DriveMountStatus record#

The drive as a volume.

Returned by Spaces.volume_mount, Spaces.volume_mount_status, Spaces.volume_unmount.

FieldTypeDefaultDescription
enabledboolThe user's opt-in (off by default).
stateStringoff, mounting, mounted, needs_approval, unsupported, error.
methodStringnfs (macOS), fuse (Linux), fskit, none.
pathOption<String>The mount point when mounted ("Show in Finder" opens it).
volume_name / volumeNameString
detailOption<String>
settings_url / settingsUrlOption<String>

DriveSyncStatus record#

Sync across devices.

Returned by Spaces.volume_sync_status.

FieldTypeDefaultDescription
device_id / deviceIdString
device_name / deviceNameString
feedStringlive, off (a store on this machine), offline (the bucket stopped answering; see last_error).
poll_interval_ms / pollIntervalMsu64
last_poll_ms / lastPollMsu64
last_remote_change_ms / lastRemoteChangeMsu64
pending_uploads / pendingUploadsu32
pending_bytes / pendingBytesu64
conflictsVec<DriveConflict>
devicesVec<DriveDevice>
last_error / lastErrorOption<String>
pendingVec<DrivePendingUpload>The files still uploading, largest first (at most 100).
backendStringfs (This Mac) or s3 (your bucket).
mountStringThis machine's mount: off, mounting, mounted, needs_approval, unsupported or error.
cacheOption<DriveCacheStats>The block cache in front of a bucket.
volumesVec<DriveSpaceVolume>The volume mounted in Spaces.

DrivePendingUpload record#

A file waiting to upload.

FieldTypeDefaultDescription
pathString
bytesu64

DriveSpaceVolume record#

The volume mounted in a Space's guest.

FieldTypeDefaultDescription
spaceString
mount_path / mountPathString/volume (Linux) or ~/Cua Volume (macOS), as the guest sees it.
backendStringfs (FUSE) or nfs.
principalStringWhose view it shows: space:<folder>, or agent:<name> while a persistent agent runs there.

DriveConflict record#

A write that lost to a later one, kept in history and as a copy.

FieldTypeDefaultDescription
pathString
conflict_path / conflictPathString
winner_device / winnerDeviceString
loser_device / loserDeviceString
winner_version / winnerVersionString
loser_version / loserVersionString
ts_ms / tsMsu64

DriveDevice record#

A device sharing the drive's bucket.

FieldTypeDefaultDescription
idString
nameString
this_device / thisDevicebool
last_seen_ms / lastSeenMsu64
last_change_ms / lastChangeMsu64
changesu64

DriveSyncEvents record#

Events after a sequence number, and the sequence to ask after next.

Returned by Spaces.volume_sync_events.

FieldTypeDefaultDescription
eventsVec<DriveSyncEvent>
next_seq / nextSequ64

DriveSyncEvent record#

One sync event.

FieldTypeDefaultDescription
sequ64
ts_ms / tsMsu64
kindStringremote_change, remote_delete, upload_started, upload_done, upload_failed, conflict, error.
pathString
deviceString
sizeu64
versionString
detailString

DriveCacheStats record#

The block cache in front of a remote store.

Returned by Spaces.volume_cache_clear, Spaces.volume_cache_set, Spaces.volume_cache_stats.

FieldTypeDefaultDescription
dirString
size_bytes / sizeBytesu64
capacity_bytes / capacityBytesu64
block_bytes / blockBytesu64
blocksu64
hitsu64
missesu64
hit_rate / hitRatef64
prefetched_bytes / prefetchedBytesu64
evictionsu64