← All packages

@searsuite/sear-plugin-collab

Connect and observe a session

ConnectSheetCollaborationCommand starts a session over a host-provided transport. The status observation reports connection changes.

classCollaborationChannel
class CollaborationChannel extends CollaborationSession

Long-lived collaboration resource channel shared by standalone and embedded editors. It is the sole owner of transport, revision, pending submissions, ACK handling and rebase state.

classCollaborationChannelError
class CollaborationChannelError extends SearError

Stable public failures raised by a collaboration channel host.

Inherited members 9

Inherited from SearError.

classCollabTransport

Abstract transport layer. Swap implementations (WebSocket, BroadcastChannel, polling, etc.) without touching the plugin logic.

constructorCollabTransport(): CollabTransport
propertyreadonly symbol: symbolstatic

DI token for resolving CollabTransport.

methodconnect(options: CollaborationTransportConnectOptions): Promise<void>

Opens the collaboration transport and begins receiving messages.

methoddisconnect(): void

Closes the collaboration transport and releases its listeners.

methodsend(message: CollaborationSubmission): void

Sends one encoded collaboration message through the transport.

methodsubscribe(handler: (message: CollaborationServerMessage): void): (): void

Subscribes to server messages and returns an idempotent disposer.

classHeadlessCollabTransport
class HeadlessCollabTransport extends CollabTransport

Collaboration transport that keeps the plugin local to the current host.

constructorHeadlessCollabTransport(): HeadlessCollabTransport
propertyreadonly symbol: symbolstatic

DI token for resolving HeadlessCollabTransport.

methodconnect(_options: CollaborationTransportConnectOptions): Promise<void>

Opens the collaboration transport and begins receiving messages.

methoddisconnect(): void

Closes the collaboration transport and releases its listeners.

methodsend(_message: CollaborationSubmission): void

Sends one encoded collaboration message through the transport.

methodsubscribe(_handler: (message: CollaborationServerMessage): void): (): void

Subscribes without producing network messages.

classSheetCollaborationPlugin
class SheetCollaborationPlugin extends Plugin<SearCoreSheet, CellProperties, null>, SheetLifecycleController, CollaborationSession

Thin Sheet bridge around the editor-independent collaboration engine.

constructorSheetCollaborationPlugin(channelBinding: CollaborationChannelBinding, plugins: PluginManager<SearCoreSheet, CellProperties>, commands: SheetCommandBus): SheetCollaborationPlugin
propertyreadonly interestedIn: string[]

Declares which Sheet OT action names this plugin is interested in. The engine will only call apply when a transaction contains at least one operation matching these action names, unless the transaction is owned by this plugin.

  • [&#39;uc&#39;, &#39;rr&#39;, &#39;rc&#39;] — only called for UpdateCell, ResizeRow, ResizeCol
  • [&#39;*&#39;] — called for any transaction (wildcard)
  • [] — only called for this plugin's own transactions
propertyreadonly warnOnDuplicateDepth: false

Whether PluginManager should warn when another ordered plugin shares this depth.

propertyreadonly symbol: typeof symbolstatic
methodapply(_state: null, _transaction: Transaction): null

Applies a transaction to plugin-owned state and returns the next state.

methodconnect(options: CollaborationConnectOptions): Promise<void>
methoddestroy(): void
methoddisconnect(): void
methodgetPluginConfig(): null

Returns this plugin's runtime configuration view for the current core.

methodgetStatus(): CollaborationStatus
methodonTransactionCommitted(transaction: Transaction): void

Runs only after every step in the enclosing pipeline has succeeded and all staged plugin state has been committed. Use it for derived caches, notifications, persistence, and transport; never perform those effects in apply, because a later pipeline step may still fail.

transaction

A committed transaction from the completed pipeline.

methodregisterCommands(commands: SheetCommandBus): void
methodregisterObservations(observations: ObservationRegistry): void
methodregisterState(): { dataEngine: { enabled: boolean }; key: PluginKey; state: null }

Registers one or more plugin-owned state records with the host manager.

methodrender(): null

Produces scene nodes owned by this plugin for the current core state.

methodstart(_context: SheetLifecycleContext): void
Inherited members 27

Inherited from Plugin.

classWebSocketTransport
class WebSocketTransport extends CollabTransport

Browser WebSocket implementation of CollabTransport.

The authority validates and orders submitted operation batches while this adapter owns only WebSocket lifecycle and JSON framing.

constructorWebSocketTransport(): WebSocketTransport
methodconnect(options: CollaborationTransportConnectOptions): Promise<void>

Opens the collaboration transport and begins receiving messages.

methoddisconnect(): void

Closes the collaboration transport and releases its listeners.

methodsend(message: CollaborationSubmission): void

Sends one encoded collaboration message through the transport.

methodsubscribe(handler: (message: CollaborationServerMessage): void): (): void

Subscribes to parsed server messages.

Inherited members 1

Inherited from CollabTransport.

interfaceCollaborationChannelBinding
interface CollaborationChannelBinding CollaborationChannelBinding: { symbol: symbol }

DI value used to distinguish editor-owned channels from host-retained channels.

interfaceCollaborationSession

Host-facing lifecycle API independent from a concrete editor bridge.

interfaceCollaborationTransportConnectOptions

Connection parameters for one collaboration resource.

interfaceConnectSheetCollaborationResult
interface ConnectSheetCollaborationResult extends SheetCommandResult

Command result that resolves when the collaboration transport is connected.

propertyreadonly completion: Promise<void>

Optional asynchronous completion of a command-owned external effect.

Inherited members 3

Inherited from SheetCommandResult.

typeCollaborationChannelErrorCode
type CollaborationChannelErrorCode = typeof CollaborationChannelErrorCode[keyof typeof CollaborationChannelErrorCode] CollaborationChannelErrorCode: { AttachmentConflict: "SEAR_COLLABORATION_ATTACHMENT_CONFLICT"; BoundaryInstalled: "SEAR_COLLABORATION_BOUNDARY_INSTALLED"; ContributorConflict: "SEAR_COLLABORATION_CONTRIBUTOR_CONFLICT"; Destroyed: "SEAR_COLLABORATION_CHANNEL_DESTROYED" }
typeCollaborationConnectionState
type CollaborationConnectionState = typeof CollaborationConnectionState[keyof typeof CollaborationConnectionState] CollaborationConnectionState: { Connecting: "connecting"; Disconnected: "disconnected"; Error: "error"; Online: "online" }

Public lifecycle state of one collaboration session.

variableCollaborationStatusObservation
CollaborationStatusObservation: StateObservationDefinition<CollaborationStatus>

Editor-local collaboration connection and synchronization status.

variableConnectSheetCollaborationCommand
ConnectSheetCollaborationCommand: SheetCommandDefinition<CollaborationConnectOptions, ConnectSheetCollaborationResult>

Starts a Sheet collaboration session through the editor command bus.

variableDisconnectSheetCollaborationCommand
DisconnectSheetCollaborationCommand: SheetCommandDefinition<void, SheetCommandResult>

Disconnects a Sheet collaboration session through the editor command bus.

variableCollaborationChannelErrorCodeType
CollaborationChannelErrorCodeType: { AttachmentConflict: "SEAR_COLLABORATION_ATTACHMENT_CONFLICT"; BoundaryInstalled: "SEAR_COLLABORATION_BOUNDARY_INSTALLED"; ContributorConflict: "SEAR_COLLABORATION_CONTRIBUTOR_CONFLICT"; Destroyed: "SEAR_COLLABORATION_CHANNEL_DESTROYED" }
variableCollaborationConnectionStateType
CollaborationConnectionStateType: { Connecting: "connecting"; Disconnected: "disconnected"; Error: "error"; Online: "online" }

Public lifecycle state of one collaboration session.

Apply and exchange operations

Committed local operations are submitted to the channel; remote operations return through the apply commands and are rebased against pending work.

interfaceCollaborationRemoteOperations

Remote operation batch delivered to the currently mounted editor bridge.

interfaceSheetApplyRemoteOperationsInput

Input for applying operations received from a collaboration transport.

propertyreadonly operations: readonly Operation[]

Remote operations after local OT transformation.

propertyreadonly ownerId: string

Stable collaboration owner id resolved through the local plugin registry.

typeCollaborationExternalEvent
type CollaborationExternalEvent = { epoch: number; kind: "connected"; resourceId: string } | { epoch: number; error: unknown; kind: "failed"; resourceId: string } | { epoch: number; kind: "message"; message: CollaborationServerMessage }

Transport event returned to the owning editor's command bus.

typeCollaborationRemoteOperationApplier
type CollaborationRemoteOperationApplier = (effect: CollaborationRemoteOperations): void
variableApplyRemoteOperationsCommand
ApplyRemoteOperationsCommand: SheetCommandDefinition<SheetApplyRemoteOperationsInput, SheetCommandResult>

Command that applies remote collaboration operations through the normal pipeline.

variableApplySheetCollaborationEventCommand
ApplySheetCollaborationEventCommand: SheetCommandDefinition<CollaborationExternalEvent, SheetCommandResult>

Routes an external transport event into the owning Sheet command bus.

typeCollaborationClientMessage
type CollaborationClientMessage = CollaborationSubmission
variableCollaborationProtocolVersion
CollaborationProtocolVersion: 1

Current collaboration wire protocol version.

interfaceCollaborationRejectedMessage

Explicit authority rejection; clients must not infer recovery from dropped frames.

typeCollaborationServerMessage
type CollaborationServerMessage = CollaborationAcceptedBatch | CollaborationSyncMessage | CollaborationRejectedMessage