Skip to content

Workspace

pawaca edited this page Aug 30, 2026 · 1 revision

Workspace

Edge adaptation of the upstream workspace directory management system.

Upstream reference: Workspace

What Upstream Provides

WorkspaceRegistry (ctx.workspaceRegistry) associates stable UUIDs with working directories, each carrying a display title and an ordered session ledger. Operations include create, rename, delete, reorder, attach/detach sessions, and archive sessions. Workspace state is persisted through storageDomain.

What Edge Changed

Direct Reuse WorkspaceRegistry

Installed as-is. All workspace logic — identity, membership, ordering, session ledger, archive — is upstream code.

Transport Bridge CRUD broadcast

Each workspace mutation in instance.ts manually broadcasts a host/workspace-changed or host/workspace-removed frame over WebSocket after the operation completes. Upstream does this through the in-process Connection plugin; Edge replaces the transport with explicit broadcast() calls.

Transport Bridge Default workspace initialization

On first DO activation (no existing workspace state), Edge creates a default workspace at /workspace. This path matches the Computer VFS root where files are stored.

What Edge Did NOT Change

  • Workspace identity (branded UUID), path canonicalization, uniqueness rules
  • Session membership and attachment logic
  • Ordering semantics (insertBefore)
  • Archive session set management
  • Persistence format (storageDomain records)

Performance Characteristics

Workspace list reads

Workspace state lives in storageDomain backed by DO KV. The registry caches the full workspace list in memory after bootstrap. List reads are O(1) from the in-memory cache. Mutations are single-key KV writes.

CRUD broadcast overhead

Each workspace mutation produces one WebSocket frame broadcast. Since workspace operations are infrequent (user-initiated), this adds negligible overhead. Upstream broadcasts the same frames through a different transport.

Architecture Summary

Component Category Edge Code
WorkspaceRegistry Reuse One ctx.plugin() call
CRUD broadcast Bridge Per-mutation broadcast() in instance.ts
Default workspace Bridge One-time /workspace creation on first boot

Key observation: WorkspaceRegistry is fully upstream. Edge only adds the WebSocket broadcast that upstream's Connection plugin would provide, plus a one-time default workspace for the VFS root.

English

中文

Clone this wiki locally