local_intents Client SQLite table
Device-first structural writes waiting for remote replay: container creates, container moves, and document placement (move and link) intents.
Declared in packages/client-sdk/src/data/sqlite/schema/localIntentSchema.ts
Description
Every lane shares one revision protocol: id is rewritten on each enqueue or repair, settlement compares (id, updatedAt) before acting, and replay runs in createdAt order. Remote reset deletes the scoped intents of every lane (and re-queues creates for surviving containers); nothing here survives a reset. Durable requests that must survive reset (the principal mutation journal and organization provisioning attempts) live in their own tables.
Indexes:
(lane, subjectId)is unique so repeated enqueues coalesce per lane.(lane, syncStatus, createdAt)lists a lane's queue in order.
Columns
idtext- primary key
- nullable
Revision token and primary key.
lanetext- not null
One of
LOCAL_INTENT_LANES.intent_typetext- not null
container.create,container.move,document.move, ordocument.link. A placement intent switches between the last two in place.subject_idtext- not null
Container id for container lanes, server document id for the placement lane.
local_idtext- nullable
Local document row the placement intent updates; null for container lanes.
target_container_idtext- not null
Desired parent (container lanes) or target container (placement lane).
source_container_idtext- nullable
Parent observed when a container move was first queued, or the source container a document move unlinks.
replace_linked_containersinteger- not null
- default 0
Placement only — the final remote link set is only the target container.
remote_container_idtext- nullable
Remote identities a container create records once accepted.
remote_metadata_document_idtext- nullable
Remote identities a container create records once accepted.
remote_metadata_access_state_hashtext- nullable
Remote identities a container create records once accepted.
sync_statustext- not null
Lane-specific state (
pending/syncedfor creates,pending/blockedfor container moves,pending/blocked/denied/unavailablefor placements).hold_kindtext- nullable
Typed hold on a pending container create (
awaiting_parent_listingwithholdSince,slot_taken, orpath_too_deep), keepinglastErrorstrictly for real replay failures.hold_sincetext- nullable
Typed hold on a pending container create (
awaiting_parent_listingwithholdSince,slot_taken, orpath_too_deep), keepinglastErrorstrictly for real replay failures.failure_codetext- nullable
Closed
SyncRefusalCodepersisted alongsidelastError.last_errortext- nullable
Replay diagnostics.
last_attempted_attext- nullable
Replay diagnostics.
created_attext- not null
FIFO replay order.
updated_attext- not null
ISO-8601 time of the last target or status change.
Keys and constraints
- Unique
(lane, subject_id)
Indexes
local_intents_lane_status_created_idx(lane, sync_status, created_at)
DDL
The statements the client runs to create this table and its indexes.
CREATE TABLE IF NOT EXISTS "local_intents" (
"id" TEXT PRIMARY KEY,
"lane" TEXT NOT NULL,
"intent_type" TEXT NOT NULL,
"subject_id" TEXT NOT NULL,
"local_id" TEXT,
"target_container_id" TEXT NOT NULL,
"source_container_id" TEXT,
"replace_linked_containers" INTEGER NOT NULL DEFAULT 0,
"remote_container_id" TEXT,
"remote_metadata_document_id" TEXT,
"remote_metadata_access_state_hash" TEXT,
"sync_status" TEXT NOT NULL,
"hold_kind" TEXT,
"hold_since" TEXT,
"failure_code" TEXT,
"last_error" TEXT,
"last_attempted_at" TEXT,
"created_at" TEXT NOT NULL,
"updated_at" TEXT NOT NULL,
UNIQUE ("lane", "subject_id")
);
CREATE INDEX IF NOT EXISTS "local_intents_lane_status_created_idx" ON "local_intents" ("lane", "sync_status", "created_at");