Skip to content

Device schema

This page is the on-the-wire reference. It is generated by reading SystemDevicesActor.ts and listing every field of every record. The overview pages explain why each field exists; this page just enumerates the contract.

IDeviceRecord (in-memory storage)

Source: projects/matrix-3/packages/system/src/SystemDevicesActor.ts:27-46.

FieldTypeRequiredNotes
deviceIdstringyes== hostId. Stable Device identity for the lifetime of the link.
hostNamestringnoMutable human label. NOT displayName.
deviceSlugstringnoStable address-safe management projection key.
hostLinkIdstringnoActive Host Link id; hostlink_<24 hex>.
principalIdstringnoOwner; p_<sha20>.
spaceIdstringnoSpace; spc_<hex>.
linkStatus'active' | 'revoked'noMirror of cloud Host Link status.
authorityRootstringnoBus / security / runtime root.
publicNamespacestringnoTyped namespace claim, e.g. space.alt.stories.
routeKeystringnov1 alias for spacePath.
status'online' | 'offline'yesPresence status only.
source'presence'yesIn-memory storage source is always 'presence'.
registeredAtnumber (ms)yesFirst registration time.
updatedAtnumber (ms)yesLast mutation time.
lastHeartbeatAtnumber (ms)yesLast successful heartbeat time.
heartbeatTtlMsnumberyesTTL after which presence ages to offline. Default 45_000.
metadataRecord<string, unknown>yesFree-form non-secret metadata, e.g. { source: 'host-control', reason, cloudUrl?, deviceRegistryRoot? }.
runtimesMap<string, IDeviceRuntimeRecord>yesKeyed by runtimeId.

IDeviceView (wire return shape)

Source: projects/matrix-3/packages/system/src/SystemDevicesActor.ts:48-53.

IDeviceView extends IDeviceRecord minus runtimes / status / source, with these widened fields:

FieldTypeNotes
source'presence' | 'host-link' | 'merged'See Device records.
status'online' | 'offline' | 'linked' | 'revoked'Computed from presence and Host Link status.
runtimeCountnumberLength of the flattened runtimes array.
runtimesIDeviceRuntimeRecord[]Flattened, sorted by runtimeId.

All other IDeviceRecord fields are passed through unchanged.

IDeviceRuntimeRecord

Source: projects/matrix-3/packages/system/src/SystemDevicesActor.ts:9-25.

FieldTypeRequiredNotes
runtimeIdstringyesUnique runtime id within this Host.
runtimeWireRootstringnoBus authority root the runtime publishes under. Used by host.control to filter advertised runtimes.
runtimeMountstringnoLogical mount of the runtime's root actor.
controlMountstringnoLogical mount of the runtime's control actor.
packageRefstringnoPackage identifier, e.g. @open-matrix/chat.
packageDirstringnoLocal source path; useful for dev.
environmentNamestringno'dev', 'hivecast', etc.
appstringnoApp name for browser packages.
statusstringyes'running', 'starting', 'stopped', 'unknown', etc.
mountCountnumbernoCount of logical mounts the runtime publishes.
localMountsreadonly string[]noSorted list of local mount paths.
webappRecord<string, unknown>no{ routePrefix, displayName, icon, navOrder, ... } for browser packages.
registeredAtnumber (ms)yesFirst registration time.
updatedAtnumber (ms)yesLast mutation time.
metadataRecord<string, unknown>yesFree-form non-secret metadata.

Source enum

Where the source value comes from in IDeviceView:

presence    -- only the in-memory _devices map has this device
              (no Host Link found for the principal scope)
host-link   -- only auth.hostLink.list has this device
              (durable record exists; no live presence)
merged      -- both, AND deviceCanMergeWithHostLink() returned true

Status enum

online   -- presence record, last heartbeat within heartbeatTtlMs
offline  -- presence record, last heartbeat older than heartbeatTtlMs
linked   -- Host Link 'active' but no live presence
revoked  -- Host Link 'revoked' (regardless of presence)

compactDeviceViews() may demote a presence-online view to revoked when the Host Link merge produces revoked.

Identifiers — by-name regex/format quick reference

IdentifierFormatSource
installIdinstall_<20 hex chars>randomBytes(10).toString('hex')
hostIdhost_<20 hex chars>generateHostId()
hostLinkIdhostlink_<24 hex chars>generateHostLinkId()
principalIdp_<20 hex chars>stablePrincipalId(issuer, subject) (sha256 hash slice)
spaceIdspace_<20 hex chars>generateSpaceId() (randomBytes(10).toString('hex'))
deviceSlugkebab-lowercase, ≤64 charsdeviceSlugFromLabel() then allocateDeviceSlug()
userCodeXXXX-XXXX (32-char alphabet, no I/O/0/1)generateDeviceUserCode()
deviceCodebase64url, 32 random bytesgenerateDeviceCode()
hostLinkTokenhlink_<base64url 32 bytes>generateHostLinkHeartbeatToken()
authorityRootspace.<spaceId> for new Spacesper Authority Model

See also

Source: projects/matrix-3/packages/system/src/SystemDevicesActor.ts.