@abloatai/ablo 0.64.1 → 0.64.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -4,6 +4,12 @@ Ablo lets AI agents and humans safely edit the same typed data without clobberin
4
4
 
5
5
  Claims don't lock. If another writer holds the row, `claim` waits for them and re-reads the fresh row before handing it to you — so two writers serialize instead of clobbering.
6
6
 
7
+ Groups structure which shared state reaches each person or agent. Declare the
8
+ data's scope and participant authority, then let authorized subscriptions keep
9
+ reactive views current; HTTP agents explicitly read or observe changes. Start
10
+ with [Groups and shared context](./docs/groups.md) to connect membership, access,
11
+ loading and updates.
12
+
7
13
  ## Start here — scaffold with `ablo init`
8
14
 
9
15
  Before choosing among identifier claims, row claims, captured reads, atomic
package/CHANGELOG.md CHANGED
@@ -1,14 +1,74 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.64.2
4
+
5
+ ### More complete upgrade guidance
6
+
7
+ `ablo upgrade` now identifies removed `SyncProvider` imports and the removed
8
+ `AbloProvider` `userId` prop, including aliased imports. Its guidance points to
9
+ the current provider and authenticated client session. React examples and
10
+ identity documentation now use the supported props consistently.
11
+
12
+ ### Registration examples match the scaffold
13
+
14
+ The quickstart now includes the empty type import from `@abloatai/ablo` that
15
+ `ablo init` already generates. It loads the SDK declaration before augmenting
16
+ `Register`, so applications copying the example retain the existing module's
17
+ types. The groups guide also explains how shared context relates to membership
18
+ and subscription changes.
19
+
20
+ This patch introduces no new API changes.
21
+
3
22
  ## 0.64.1
4
23
 
5
- The React read and write boundaries are now explicit: `useAbloClient()` returns the writable client and `useAblo(selector)` returns render snapshots. The zero-argument `useAblo()` overload is removed. `ablo upgrade` reports migration hints; see [Upgrade Guide](./docs/migration.md).
24
+ ### A schema that survives the journey into a package
25
+
26
+ Sharing a schema through a compiled package could leave an application facing
27
+ pages of empty-object and unknown-type errors. The schema was present, but its
28
+ registration no longer reached the parts of Ablo that needed it. Registration
29
+ now carries through the published declarations into Transaction and Humans.
30
+ When it is missing, schema-free mutators report what the application needs to
31
+ supply.
32
+
33
+ Passing the schema explicitly is the recommended approach for mutators. The
34
+ integration guide also explains how to share a schema and React bindings across
35
+ packages, so a monorepo's source imports and its consumers' compiled imports
36
+ agree about the same application.
37
+
38
+ ### React makes the difference between reading and writing visible
39
+
40
+ A component reading a snapshot and an event handler issuing a write now ask for
41
+ different things. `useAblo(selector)` returns the render snapshot;
42
+ `useAbloClient()` returns the client used for operations. The zero-argument
43
+ `useAblo()` call is removed, making that choice visible at the call site.
44
+
45
+ Mutation failures have a dedicated hook again. `useMutationFailure` manages the
46
+ subscription and its cleanup, removing the effect each application otherwise
47
+ had to maintain. Framework adapters can obtain the supported store contract
48
+ through `getAbloStore(client)` from `@abloatai/ablo/client`.
49
+
50
+ ### Presence can leave the current session out
51
+
52
+ A view of who else is working on a record can now request
53
+ `{ excludeSelf: true }` through `usePresence` or `presence.forModel`. The filter
54
+ removes the current session; another tab belonging to the same person remains
55
+ visible. Applications no longer need to repeat that distinction themselves.
56
+
57
+ Generic collaboration subscriptions also retain the event arguments declared
58
+ by their adapters. Handlers that need authenticated sender context use
59
+ `collaboration.subscribe` on the session or `subscribeCollaboration` on the
60
+ transport.
6
61
 
7
- Public schema registration reaches Transaction and Humans across emitted package declarations. Ambient mutators without a registered schema now report a schema diagnostic; prefer explicit-schema overloads. Internal package dependencies are exact, and CLI/SDK compatibility is checked as one release family.
62
+ ### One release, with an explicit upgrade path
8
63
 
9
- `usePresence(..., { excludeSelf: true })` and `presence.forModel(model, id, { excludeSelf: true })` omit the current session. `useMutationFailure` owns React subscription cleanup. Custom framework adapters use `getAbloStore(client)` from `/client`. Generic collaboration subscriptions preserve their declared event tuples; attributed handlers use `collaboration.subscribe` (or transport `subscribeCollaboration`).
64
+ Ablo, Transaction, Humans and the CLI now declare exact compatibility
65
+ requirements, keeping their versions together. Provider terminology is
66
+ consistently `AbloProvider`, including the context used by framework adapters.
10
67
 
11
- `AbloProvider` is now the sole provider vocabulary. Advanced framework adapters use `useAbloStoreContext` and `AbloStoreContextValue`; the missing-provider error code is `ablo_context_missing_provider`.
68
+ Despite the patch number, 0.64.1 includes API removals. `ablo upgrade` reports
69
+ migration hints, and the
70
+ [upgrade guide](https://github.com/Abloatai/ablo/blob/v0.64.1/packages/ablo/docs/migration.md)
71
+ covers the hook replacements, provider context, presence fields and claims.
12
72
 
13
73
  ## 0.64.0
14
74
 
package/README.md CHANGED
@@ -29,6 +29,12 @@ Every write goes through it, so authority, idempotency, conflicts, ordering,
29
29
  and confirmation are enforced in one place. Your Postgres remains the source of
30
30
  truth.
31
31
 
32
+ Groups structure which shared state reaches each person or agent. Declare the
33
+ data's scope and participant authority, then let authorized subscriptions keep
34
+ reactive views current; HTTP agents explicitly read or observe changes. Start
35
+ with [Groups and shared context](./docs/groups.md) to connect membership, access,
36
+ loading and updates.
37
+
32
38
  ## Why Ablo
33
39
 
34
40
  Software used to have one writer: a human clicking through an application. AI
@@ -7,6 +7,9 @@ The maintained reference lives in
7
7
  Start at `src/index.ts`, then follow its owned `accounts`, `agent` and `workspace`
8
8
  boundaries. Its README contains the install, isolated-branch setup and test commands.
9
9
 
10
+ For the full participant lifecycle and its current cache behavior, see
11
+ [Groups and shared context](../groups.md).
12
+
10
13
  ## One account, one authorization rule
11
14
 
12
15
  “People in this account can see its chats” requires both a row rule and a
@@ -104,7 +104,7 @@ const ablo = Ablo({
104
104
  });
105
105
 
106
106
  // The agent run is mounted on behalf of its triggering user.
107
- <AbloProvider client={ablo} userId={triggeringUser.id}>
107
+ <AbloProvider client={ablo}>
108
108
  {children}
109
109
  </AbloProvider>
110
110
  ```
package/docs/groups.md CHANGED
@@ -1,16 +1,137 @@
1
- # Change Propagation
1
+ # Groups and shared context
2
2
 
3
- > How one row's change reaches the rows and actors that depend on it.
3
+ > Structure which shared state reaches each participant, and how their view stays current.
4
4
 
5
- > How a change to one row reaches the rows and actors that depend on it, and how
6
- > to keep a chain of dependent work fresh. This is the propagation half of sync
7
- > groups; [`identity.md`](./identity.md) is the access half (who may read a
8
- > group), and [`concurrency-convention.md`](./concurrency-convention.md) is the
9
- > convention this rests on.
5
+ Groups connect the structure of your data to the people and agents who receive
6
+ it. A group names a shared context, such as `account:acme` or `workspace:abc`.
7
+ Membership and authorization determine the eligible view; subscriptions and
8
+ client loading determine how that view reaches a participant.
10
9
 
11
- ---
10
+ Start here to understand **why this participant receives this record**. Use
11
+ [Identity](./identity.md) for authentication and credential issuance, and the
12
+ [account multiplayer walkthrough](./examples/account-multiplayer.md) for the
13
+ maintained application that puts these pieces together.
14
+
15
+ ## One context, several decisions
16
+
17
+ Ablo has existing declarations for these decisions; there is no single group
18
+ object that configures all of them.
19
+
20
+ | Decision | Existing declaration or behavior |
21
+ | --- | --- |
22
+ | Which records form a context? | Model `groups.root` creates a group per root record; children inherit through `belongsTo` relationships marked `parent: true`. Ordinary references do not propagate membership. `groups.roles` supplies explicit field-based routes. |
23
+ | Who belongs? | Schema `groups.grants` declares a membership edge through its `subject` and `scope` relations within an organization. A trusted backend can also issue session `groups` after verifying application membership. |
24
+ | Which rows may they access? | Model `policy` establishes the read/tenant boundary; `subject` requires a matching credential group for the named row field. Delivery routing alone is not a read policy. |
25
+ | What may they do? | Session `can` grants model operations. Read membership does not grant update or claim authority. |
26
+ | Which changes reach them? | Server-authorized subscriptions match the row's delivery groups. Requested groups cannot widen credential authority. |
27
+ | What is local? | Reactive clients bootstrap and maintain local state; HTTP clients explicitly fetch data. Client loading is distinct from permission to read. |
28
+
29
+ For a model with `subject`, its subject group is the **exclusive delivery
30
+ route**. Parent groups, explicit roles and additional routes cannot provide an
31
+ alternate path to that row. For other routed models, delivery matches any
32
+ eligible group; declaring a narrow route does not narrow an otherwise broad
33
+ read policy. `groups.routingOnly: true` acknowledges that deliberate difference,
34
+ not an authorization grant.
35
+
36
+ ## Follow one conversation
37
+
38
+ The account multiplayer reference declares this model:
39
+
40
+ ```ts
41
+ import { defineSchema, model, z } from '@abloatai/ablo/schema';
42
+
43
+ const schema = defineSchema({
44
+ conversations: model({
45
+ accountId: z.string().min(1),
46
+ title: z.string(),
47
+ executionOwner: z.string().nullable(),
48
+ executionState: z.enum(['idle', 'generating']),
49
+ }, { subject: { field: 'accountId', group: 'account' } }),
50
+ });
51
+ ```
52
+
53
+ A conversation whose `accountId` is `acme` requires `account:acme`. The
54
+ application verifies Alice's membership before issuing her browser session with
55
+ that group and `can: { conversations: ['read'] }`. The agent gets the same group
56
+ with `read` and `update` authority. The reference verifies account membership in
57
+ application code; it does not use a schema `groups.grants` membership model.
58
+
59
+ Both can read the conversation. Alice's browser cannot update it with its
60
+ read-only credential: the reference performs human writes through a separately
61
+ scoped server client. The agent may update it, subject to the write's claims and
62
+ read checks. An outsider cannot gain access by supplying `accountId: 'acme'` in
63
+ a filter or by requesting an unauthorized subscription.
64
+
65
+ ```mermaid
66
+ flowchart TD
67
+ R["Conversation: accountId = acme"] --> S["Subject: account:acme"]
68
+ S --> G["Trusted groups + operation grants"]
69
+ G -->|Bootstrap and live updates| H["Alice's reactive local view"]
70
+ G -->|Explicit reads or log requests| A["Agent's working context"]
71
+ ```
12
72
 
13
- ## Start from the problem
73
+ The diagram describes data flow. Group membership does not prove that a
74
+ participant is connected, has loaded every record, or has acted on an update.
75
+ Presence describes activity; it does not grant authority or locate cached bytes.
76
+
77
+ ## A participant's lifecycle
78
+
79
+ | Event | What happens today |
80
+ | --- | --- |
81
+ | Join | The backend authenticates the participant and verifies membership before minting a scoped session. Issuance does not itself load records. |
82
+ | Load | Alice's reactive client loads its authorized baseline and consumes updates. An HTTP agent calls model reads/lists or observes the ordered log; it has no reactive local graph. |
83
+ | Change | A confirmed conversation change routes through `account:acme` to eligible subscribers. An HTTP agent must explicitly read again or consume log changes to update its working context. |
84
+ | Gain a group | On the incremental group-added path, the reactive client records membership and receives covering deltas for newly visible rows. The full-diff path instead requests re-bootstrap. |
85
+ | Reconnect | The reactive client compares current server-issued groups with stored subscription metadata. Detected shrinkage clears local storage and memory and marks a full bootstrap as required; otherwise normal catch-up applies. |
86
+ | Lose a group | On a group-removal notification, the reactive client clears its managed database and object pool, updates subscription metadata and requests re-bootstrap. It does not selectively evict that group's rows. |
87
+ | Switch account | The reference disposes the previous account client and creates a client using the newly authorized account endpoint. |
88
+
89
+ Group-change handling is a runtime path, not a promise that every change in an
90
+ external membership database immediately invalidates every issued credential.
91
+ The application must connect its membership and credential lifecycle to Ablo.
92
+ An offline participant cannot process a revocation notification until it
93
+ reconnects; managed-cache clearing cannot retract copies retained by application
94
+ code or an agent. Clients configured without automatic bootstrap do not fetch
95
+ a full baseline after a group-change notification; they rely on covering deltas or
96
+ explicit reads for data.
97
+
98
+ Consider a participant authorized for both `account:acme` and `account:beta`.
99
+ Losing Acme currently clears the client's whole managed cache, including cached
100
+ Beta records, before rebuilding the remaining authorized view. Beta records
101
+ remain eligible for loading. For non-subject routing where one row belongs to
102
+ several groups, losing one matching group likewise does not alone establish
103
+ that the row is inaccessible; remaining authorization and routes matter.
104
+
105
+ ## Understand the living system
106
+
107
+ Inspect a participant through three separate questions: **what may they see,
108
+ what are they subscribed to, and what have they loaded?** To explain an individual
109
+ record, follow its model's subject or routing declaration, the participant's
110
+ trusted groups and operation grants, then its client transport and lifecycle.
111
+
112
+ These distinctions also help assess a group design:
113
+
114
+ | Symptom | Design question |
115
+ | --- | --- |
116
+ | Many irrelevant updates | Is the delivery group broader than the participant's work? |
117
+ | One task needs many groups | Has the shared context been fragmented too far? |
118
+ | One change reaches many subscribers | Is that fan-out useful, and do all subscribers need live delivery? |
119
+ | Frequent group-premise rejection | Does the decision depend on the whole group, or only particular rows/fields? |
120
+ | Slow loading or catch-up | How much authorized state is being materialized, and how much changed while offline? |
121
+
122
+ These are evaluation questions, not a built-in group score or per-participant
123
+ cache dashboard. A group does not configure blob prefetch, cache placement or
124
+ selective eviction. Those would be additional capabilities built on these scope
125
+ and update signals.
126
+
127
+ ## Changes and decisions
128
+
129
+ Receiving an update keeps a live view current. Declaring a read premise checks
130
+ whether a particular decision is still valid when written. A group can serve
131
+ both purposes, but membership alone neither locks records nor makes them
132
+ mutually consistent.
133
+
134
+ ### Protect a decision based on a group
14
135
 
15
136
  An agent reads workspace `A` to write document `B`. A moment later it reads `B` to write
16
137
  block `C`. Between those steps someone else edits `A`. The agent is now building
@@ -74,18 +195,17 @@ does not retain the row contents as read evidence.
74
195
  for you and leaves the third to you — on purpose.
75
196
 
76
197
  **Routing — who hears about a change.** Every row belongs to one or more sync
77
- groups, and a write fans out to all of them. A row also inherits its ancestors'
78
- groups: editing a block stamps the delta with `block:…`, `document:…`, *and*
79
- `workspace:…`, so everyone watching the workspace sees the block move. This is delivery,
198
+ groups, and a write fans out to its delivery groups. For a model without an
199
+ exclusive `subject` route, declared scope roots and
200
+ relationships can route a block change to `block:…`, `document:…`, and
201
+ `workspace:…`, so authorized workspace subscribers receive it. This is delivery,
80
202
  resolved by walking the ownership tree at commit time. It routes the change; it
81
203
  never recomputes a value.
82
204
 
83
- **Structural cascade — what disappears with a change.** Deleting a workspace removes
84
- its documents and blocks. The database does that through `ON DELETE CASCADE`, but a
85
- database-level cascade emits no delta, so open clients would quietly hold rows
86
- that no longer exist. The engine closes that gap: before the delete it snapshots
87
- the subtree and emits a tombstone for each descendant, routed to the right
88
- group. Watchers see the whole subtree vanish.
205
+ **Structural cascade — what disappears with a change.** A declared ownership
206
+ relationship can make deleting a parent remove its descendants. Clients need
207
+ routed deletion deltas to remove those records from their views. This follows
208
+ the relationship and delete path; sharing a group alone does not cascade deletes.
89
209
 
90
210
  **Value recomputation — what a change implies for derived state.** If `B` holds a
91
211
  number rolled up from `A`, the engine does not recompute `B` when `A` changes. It
@@ -116,8 +236,8 @@ decides what that means for its own state, commits, and *its* commit is what
116
236
  reaches `C`.
117
237
 
118
238
  The direction matters. The signal flows forward, A to B to C, and each hop is a
119
- real write an actor chose to make. The engine supplies the edges (group
120
- membership) and a stale signal on each edge (the premise check); the actors are
239
+ real write an actor chose to make. Group routing supplies the delivery edges, and declared read premises add
240
+ stale-work checks to writes; the actors are
121
241
  the runtime that walks them. It is closer to a dataset an analyst
122
242
  recalculates cell by cell than to a reactive engine that recomputes the whole
123
243
  column for you.
@@ -167,11 +287,10 @@ group premise fires when *anything* in the group moves — so a group that is to
167
287
  broad wakes actors for changes they don't care about, and one that is too narrow
168
288
  misses the dependency you meant to track.
169
289
 
170
- The rule of thumb: **make a group the smallest set of rows that must stay
171
- mutually consistent.** A workspace and its documents belong together because editing one
172
- changes what the others mean; two unrelated workspaces do not. Reach for finer,
173
- overlapping groups when you genuinely have a dependency chain to track, and keep
174
- them coarse everywhere else.
290
+ Choose groups around shared work and authorized audiences. Use a group premise
291
+ when a decision depends on that whole context; use row or field premises when
292
+ it depends on less. Overlapping routing groups can express useful audiences,
293
+ but do not create transaction boundaries or a consistency guarantee.
175
294
 
176
295
  ---
177
296
 
package/docs/identity.md CHANGED
@@ -1,7 +1,11 @@
1
- # Identity & Sync Groups
1
+ # Identity and credentials
2
2
 
3
3
  > Who is connecting, and which slice of state they are allowed to see.
4
4
 
5
+ Start with [Groups and shared context](./groups.md) for how data membership,
6
+ authorization, subscriptions and local state fit together. This guide owns
7
+ authentication, credential issuance and the schema wiring behind that view.
8
+
5
9
  This is the doc the Quickstart skips: **who is connecting, and which slice
6
10
  of shared state do they get?** If you've wired `<AbloProvider client={ablo}>`
7
11
  and wondered where org / team / user actually come from — start here.
@@ -15,7 +19,7 @@ Ablo is not an identity provider. It has no login, no password store, no
15
19
  session of its own. You keep whatever you already use — Clerk, Auth0,
16
20
  NextAuth, WorkOS, your own session table. Ablo's job begins **after** you've
17
21
  authenticated the user: you hand Ablo the already-authenticated identity, and
18
- Ablo decides which **sync groups** that identity may read and write.
22
+ Ablo enforces that credential's groups, model read policies and operation grants.
19
23
 
20
24
  ## Inspect the credential the application is actually using
21
25
 
@@ -75,13 +79,12 @@ that.
75
79
 
76
80
  ## What a sync group is
77
81
 
78
- A **sync group** is a named channel of shared state a string like
79
- `org:acme` or `workspace:abc123`. It is simultaneously:
80
-
81
- - **the unit of fan-out:** a confirmed write to a row publishes a delta to
82
- every participant subscribed to that row's sync group(s), and
83
- - **the unit of access:** a participant receives a row's deltas *only if* the
84
- row's sync group is in their allowed set.
82
+ A **sync group** names shared state, such as `org:acme` or `workspace:abc123`.
83
+ The server checks allowed groups for delivery; model `policy` and `subject`
84
+ rules govern row access, and capability operations govern permitted actions.
85
+ Routing a row to a group does not itself authorize an HTTP read or write.
86
+ See [the group lifecycle](./groups.md#a-participants-lifecycle) for loading,
87
+ updates, reconnects and removal.
85
88
 
86
89
  There is no built-in `org` / `team` / `user` concept in the engine. Those are
87
90
  *your* domain words. Ablo only knows sync-group strings. The mapping from "this
@@ -133,7 +136,7 @@ export const schema = defineSchema(
133
136
  // 2. app/providers.tsx — a HUMAN gets their full org / team scope.
134
137
  // teamIds is set on the client you build (Ablo({ schema, teamIds: user.teamIds })),
135
138
  // not passed to the provider; the provider just takes that client.
136
- <AbloProvider client={ablo} userId={user.id}>
139
+ <AbloProvider client={ablo}>
137
140
  {children}
138
141
  </AbloProvider>
139
142
  ```
@@ -255,9 +258,11 @@ Delivery scoping is two declarations that meet in the middle. One describes the
255
258
  changes when the row's sync groups intersect the participant's allowed set.
256
259
 
257
260
  That intersection does not itself authorize an HTTP read. A model's `policy`
258
- governs read access. Treat sync-groups as change routing and `policy` (plus the
259
- organization boundary beneath it) as authorization; declaring one never
260
- silently creates the other.
261
+ governs read access, while `subject` can require a credential group for a row
262
+ field. Operation grants bound the actions. A subject-scoped row uses only its
263
+ subject delivery group; other routes cannot bypass that boundary. See
264
+ [Groups and shared context](./groups.md#one-context-several-decisions) for how
265
+ these declarations fit together.
261
266
 
262
267
  ### Half 1 (`identityRoles`): identity → allowed groups
263
268
 
@@ -408,8 +413,7 @@ server, never by the browser.**
408
413
 
409
414
  ## Wiring the provider
410
415
 
411
- The identity your server resolved is carried by the client you build and the
412
- `userId` prop. In a Next.js app, resolve the user in a Server Component and pass
416
+ The identity your server resolved is carried by the authenticated client session. In a Next.js app, resolve the user in a Server Component and pass
413
417
  it down. Build the client once (the schema, `teamIds`, and the `apiKey` resolver
414
418
  live here; entity narrowing rides the minted session's `groups`), then hand
415
419
  it to the provider:
@@ -450,7 +454,7 @@ export function Providers({
450
454
  }) {
451
455
  const ablo = useMemo(() => makeAblo(user), [user.id]);
452
456
  return (
453
- <AbloProvider client={ablo} userId={user.id} fallback={<AppSkeleton />}>
457
+ <AbloProvider client={ablo} fallback={<AppSkeleton />}>
454
458
  {children}
455
459
  </AbloProvider>
456
460
  );
@@ -461,11 +465,11 @@ What carries identity — and just as importantly, what does *not* set the bound
461
465
 
462
466
  | Where | Purpose |
463
467
  | ------------ | ------------------------------------------------------------------------------------------------ |
464
- | `userId` prop | App-level participant id, used for app-owned fields and read by your `identityRole` `source`. **Not** the security boundary: the server enforces scope from the authenticated request. |
468
+ | Application authentication context | Supplies identity for app-owned fields and UI. The provider has no `userId` prop; the server enforces scope from the authenticated session. |
465
469
  | `teamIds` (on the client) | Team ids expanded into team sync groups via your `identityRoles`. |
466
470
  | `groups` (at session mint) | Optional. **Narrows** a minted session's subscription to a subset of what auth already allows: it can never widen it. Passed to `sessions.create({ user \| agent, groups })`; build entries with `syncGroup(kind, id)`. Use it to scope an agent (or a focused page's session) to one entity, e.g. `[syncGroup('workspace', 'abc123')]`. |
467
471
 
468
- Because the server is the boundary, a client that changes `userId` to another
472
+ Because the server is the boundary, a client that changes application identity state to another
469
473
  user's id does not gain their data — the server resolves and enforces the real
470
474
  identity on the connection. These are how your app *tells* Ablo who it
471
475
  already authenticated, not how it *proves* it.
@@ -644,9 +648,9 @@ The best practices Ablo inherits from that lineage:
644
648
  the line precisely: [token parameters are trusted and usable for access
645
649
  control; client parameters are not](https://docs.powersync.com/usage/sync-rules/advanced-topics/client-parameters).
646
650
  In Ablo terms, the identity your server vouches for — and the session's
647
- `groups`, minted server-side — are the *trusted* claims that set scope; the
648
- `userId` prop is *untrusted client input* — convenient for app-owned fields, but
649
- never the boundary. This is why changing `userId` in the browser grants nothing.
651
+ `groups`, minted server-side — are the *trusted* claims that set scope; application
652
+ identity state is *untrusted client input* — convenient for app-owned fields, but
653
+ never the boundary. Changing that state in the browser grants nothing.
650
654
 
651
655
  3. **Scope by a hierarchical naming convention, declared once.** Ablo's `kind:id`
652
656
  group naming (`org:…` / `team:…` from `identityRoles`, `workspace:…` from a model's
package/docs/index.md CHANGED
@@ -27,6 +27,10 @@ interfaces.
27
27
  Keep the authoritative transaction, locks, constraints, and direct SQL paths your application already owns.
28
28
  </Card>
29
29
 
30
+ <Card title="Groups and shared context" icon="share-2" href="/groups">
31
+ Structure which state reaches each participant, from membership and access to loading, updates and removal.
32
+ </Card>
33
+
30
34
  <Card title="Participant identity" icon="fingerprint" href="/identity">
31
35
  Give agents, people, and services distinct scoped credentials instead of treating every worker as the same caller.
32
36
  </Card>
@@ -172,7 +172,7 @@ export const ablo = Ablo({
172
172
 
173
173
  Browser apps should use the React provider or a scoped session token, not a
174
174
  server API key in the bundle. Build the client first, then hand it to the
175
- provider — `AbloProvider` takes `{ client, userId?, onError?, fallback? }`, and
175
+ provider — `AbloProvider` takes `{ client, onError?, fallback? }`, and
176
176
  nothing else (`schema`, `teamIds`, and `apiKey` all live on the
177
177
  client now).
178
178
 
@@ -16,6 +16,12 @@ schema** — your migration tool stays in charge of the shape of your database.
16
16
  > or separate database, and connect your production one when you're ready for it
17
17
  > to be the system of record.
18
18
 
19
+ Groups structure which shared state reaches each person or agent. Declare the
20
+ data's scope and participant authority, then let authorized subscriptions keep
21
+ reactive views current; HTTP agents explicitly read or observe changes. Start
22
+ with [Groups and shared context](./groups.md) to connect membership, access,
23
+ loading and updates.
24
+
19
25
  ## 1. Install and initialize
20
26
 
21
27
  ```bash
@@ -82,6 +88,7 @@ every type is one parameter away — no `typeof schema` re-stating, anywhere:
82
88
 
83
89
  ```ts
84
90
  // ablo/register.ts — scaffolded by `npx ablo init`, sits beside ablo/schema.ts
91
+ import type {} from '@abloatai/ablo';
85
92
  import type { schema } from './schema';
86
93
  declare module '@abloatai/ablo' {
87
94
  interface Register { Schema: typeof schema }
@@ -89,11 +96,11 @@ declare module '@abloatai/ablo' {
89
96
  export {};
90
97
  ```
91
98
 
92
- It's a regular `.ts` module, not a hand-authored `.d.ts`. The top-level
93
- `import type { schema }` makes the `declare module` block *merge* into (augment)
94
- the SDK's `Register` interface instead of colliding with it the same shape
95
- [TanStack Router uses in `src/router.tsx`](https://tanstack.com/router/latest/docs/framework/react/guide/type-safety). Any `.ts` file in your
96
- `tsconfig` `include` works; it never needs to be imported.
99
+ It's a regular `.ts` module, not a hand-authored `.d.ts`. The empty
100
+ `import type {} from '@abloatai/ablo'` loads the SDK's module declaration so the
101
+ `declare module` block augments its existing `Register` interface. The schema
102
+ import supplies your schema's type. Both imports are erased at runtime. Any `.ts`
103
+ file in your `tsconfig` `include` works; it never needs a runtime import.
97
104
 
98
105
  ```ts
99
106
  import type { Model } from '@abloatai/ablo/schema';
package/docs/react.md CHANGED
@@ -110,25 +110,24 @@ import { ablo } from '@/lib/ablo';
110
110
 
111
111
  export function Providers({
112
112
  children,
113
- user, // resolved server-side from YOUR auth
114
113
  }: {
115
114
  children: React.ReactNode;
116
- user: { id: string };
117
115
  }) {
118
116
  return (
119
- <AbloProvider client={ablo} userId={user.id} fallback={<AppSkeleton />}>
117
+ <AbloProvider client={ablo} fallback={<AppSkeleton />}>
120
118
  {children}
121
119
  </AbloProvider>
122
120
  );
123
121
  }
124
122
  ```
125
123
 
126
- `client` is the only required prop. The rest are situational:
124
+ `client` is the only required prop. The removed `userId` prop is no longer accepted;
125
+ read application identity from your authentication context. Ablo authority comes
126
+ from the client session. The remaining props are situational:
127
127
 
128
128
  | Prop | Default | Purpose |
129
129
  | ----------- | ---------------- | --------------------------------------------------------------------------------------------------------- |
130
130
  | `client` |: | **Required.** The `Ablo({ schema, apiKey })` instance. It carries the schema and connection config. |
131
- | `userId` | resolved from auth | App participant id for app-owned fields and your `identityRoles`. Not the security boundary. |
132
131
  | `fallback` | neutral spinner | Rendered during the *first* bootstrap only. Pass a branded skeleton, `null`, or `'passthrough'`. |
133
132
  | `onError` |: | Engine / WebSocket / bootstrap errors. Wire to Sentry / Datadog. |
134
133
 
@@ -146,7 +145,7 @@ session owner calls `await ablo.dispose()` on logout or before replacing that
146
145
  client. Provider remounts can reuse it. Never share a browser singleton across
147
146
  server requests. When changing accounts, remove the old account UI and create a
148
147
  fresh client whose session endpoint grants the newly verified membership.
149
- A query filter and the provider's `userId` prop do not change authorization.
148
+ Query filters and application identity state do not change authorization.
150
149
 
151
150
  For a component-owned client, create and dispose the instance in the same effect.
152
151
  React Strict Mode can replay setup and cleanup, so each setup creates a fresh
package/llms.txt CHANGED
@@ -174,7 +174,7 @@ coordination until the app reports it through Data Source events.
174
174
 
175
175
  ## Change propagation
176
176
 
177
- A change to one row reaches other rows three ways. ROUTING: a write fans out to every sync group the row belongs to, INCLUDING its ancestors' groups (editing a block routes to `block:` + `document:` + `workspace:`), so everyone watching the workspace sees it — delivery, not recomputation. DELETE CASCADE: deleting a parent emits explicit tombstone deltas for its descendants, so open clients never silently hold rows that are gone. VALUE: derived values are NOT recomputed server-side — Ablo surfaces that the source moved and the actor decides. To keep dependent work fresh, pass rows returned by `ablo.<model>.read({ id })` in the mutation's `reads` array. Ablo records compact model/id/readAt evidence, not row contents. At commit the server checks whether anything moved past the read watermark; if so, the mutation does not land. Use `get` when no such relationship exists. To chain A→B→C, put A+B in one group and B+C in another: A's change reaches B, and C hears it only once B ITSELF writes. No transitive auto-recompute, no convergence guarantee for cycles.
177
+ A change to one row reaches other rows three ways. ROUTING: a write fans out to every sync group the row belongs to, including declared ancestor routes for models without `subject`; subject-scoped rows route exclusively through their required subject group, so only eligible subscribers receive them — delivery, not recomputation. DELETE CASCADE: deleting a parent emits explicit tombstone deltas for its descendants, so open clients never silently hold rows that are gone. VALUE: derived values are NOT recomputed server-side — Ablo surfaces that the source moved and the actor decides. To keep dependent work fresh, pass rows returned by `ablo.<model>.read({ id })` in the mutation's `reads` array. Ablo records compact model/id/readAt evidence, not row contents. At commit the server checks whether anything moved past the read watermark; if so, the mutation does not land. Use `get` when no such relationship exists. To chain A→B→C, put A+B in one group and B+C in another: A's change reaches B, and C hears it only once B ITSELF writes. No transitive auto-recompute, no convergence guarantee for cycles.
178
178
 
179
179
  ## Nouns
180
180
 
@@ -322,3 +322,7 @@ Canonical docs to read before integrating, in this order. Read each with `npx ab
322
322
  - [Upgrade Guide](https://docs.abloatai.com/migration): when upgrading an existing integration; every breaking change, what to change, and which version introduced it.
323
323
  - [Session Settings](https://docs.abloatai.com/session-settings): when the customer's database has row-level-security policies; the identity context Ablo sets before every write, and how to map it to the setting names those policies read.
324
324
  - [Every page, one line each](https://docs.abloatai.com/llms.txt), or [the full docs as one file](https://docs.abloatai.com/llms-full.txt).
325
+
326
+ ## Groups and shared context
327
+
328
+ Groups connect data membership to authorized participant subscriptions. Model roots, relations and grants describe routing and membership; policy, subject and capability operations establish access. Subject-scoped rows route exclusively through their subject group. Reactive clients load and maintain local state; HTTP agents read or observe changes explicitly. Group removal currently clears the managed client cache and requests re-bootstrap, rather than selectively evicting rows. Membership does not imply loaded data, activity, or a lock. Start with `ablo docs groups` for the lifecycle and the account multiplayer example; use `ablo docs identity` for authentication and credential issuance.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abloatai/ablo",
3
- "version": "0.64.1",
3
+ "version": "0.64.2",
4
4
  "description": "The public Ablo SDK for coordinated reads, commits, claims, observation, and reactive applications.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -146,8 +146,8 @@
146
146
  "directory": "packages/ablo"
147
147
  },
148
148
  "dependencies": {
149
- "@abloatai/humans": "0.64.1",
150
- "@abloatai/transaction": "0.64.1",
149
+ "@abloatai/humans": "0.64.2",
150
+ "@abloatai/transaction": "0.64.2",
151
151
  "zod": "^4.4.3"
152
152
  },
153
153
  "peerDependencies": {