@abloatai/ablo 0.7.0 → 0.8.0
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/CHANGELOG.md +32 -0
- package/README.md +54 -45
- package/dist/BaseSyncedStore.js +7 -3
- package/dist/SyncEngineContext.d.ts +2 -1
- package/dist/SyncEngineContext.js +5 -3
- package/dist/agent/session.js +3 -2
- package/dist/auth/index.js +39 -11
- package/dist/client/Ablo.d.ts +111 -3
- package/dist/client/Ablo.js +143 -10
- package/dist/client/ApiClient.d.ts +32 -0
- package/dist/client/ApiClient.js +76 -44
- package/dist/client/auth.d.ts +11 -1
- package/dist/client/auth.js +21 -2
- package/dist/client/createModelProxy.d.ts +107 -63
- package/dist/client/createModelProxy.js +65 -33
- package/dist/client/identity.js +14 -0
- package/dist/client/registerDataSource.d.ts +19 -0
- package/dist/client/registerDataSource.js +57 -0
- package/dist/client/validateAbloOptions.d.ts +2 -1
- package/dist/client/validateAbloOptions.js +8 -7
- package/dist/errorCodes.d.ts +23 -1
- package/dist/errorCodes.js +34 -1
- package/dist/errors.d.ts +52 -1
- package/dist/errors.js +140 -42
- package/dist/index.d.ts +9 -5
- package/dist/index.js +9 -5
- package/dist/keys/index.d.ts +61 -0
- package/dist/keys/index.js +151 -0
- package/dist/query/client.js +19 -8
- package/dist/react/AbloProvider.d.ts +25 -0
- package/dist/react/AbloProvider.js +97 -2
- package/dist/react/ClientSideSuspense.d.ts +1 -1
- package/dist/react/DefaultFallback.d.ts +1 -1
- package/dist/react/SyncGroupProvider.d.ts +1 -1
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +3 -2
- package/dist/react/useAblo.d.ts +4 -4
- package/dist/react/useAblo.js +10 -5
- package/dist/react/useReactive.js +16 -3
- package/dist/schema/serialize.d.ts +3 -3
- package/dist/schema/serialize.js +2 -2
- package/dist/sync/BootstrapHelper.js +46 -27
- package/dist/sync/ConnectionManager.d.ts +3 -1
- package/dist/sync/ConnectionManager.js +37 -1
- package/dist/sync/HydrationCoordinator.js +3 -2
- package/dist/sync/NetworkProbe.d.ts +8 -0
- package/dist/sync/NetworkProbe.js +24 -2
- package/dist/sync/SyncWebSocket.d.ts +1 -1
- package/dist/sync/SyncWebSocket.js +43 -53
- package/dist/sync/participants.js +5 -2
- package/dist/transactions/TransactionQueue.js +13 -1
- package/docs/api-keys.md +5 -5
- package/docs/api.md +101 -44
- package/docs/audit.md +16 -9
- package/docs/cli.md +27 -17
- package/docs/client-behavior.md +34 -20
- package/docs/coordination.md +40 -51
- package/docs/data-sources.md +21 -19
- package/docs/examples/agent-human.md +72 -28
- package/docs/examples/ai-sdk-tool.md +14 -11
- package/docs/examples/existing-python-backend.md +27 -16
- package/docs/examples/nextjs.md +21 -8
- package/docs/examples/scoped-agent.md +42 -27
- package/docs/examples/server-agent.md +27 -5
- package/docs/guarantees.md +26 -17
- package/docs/identity.md +65 -59
- package/docs/index.md +30 -19
- package/docs/integration-guide.md +52 -52
- package/docs/interaction-model.md +38 -26
- package/docs/mcp/claude-code.md +9 -17
- package/docs/mcp/cursor.md +6 -24
- package/docs/mcp/windsurf.md +6 -19
- package/docs/mcp.md +103 -26
- package/docs/quickstart.md +31 -39
- package/docs/react.md +15 -11
- package/docs/roadmap.md +13 -13
- package/docs/schema-contract.md +109 -0
- package/examples/README.md +8 -4
- package/examples/data-source/README.md +6 -2
- package/examples/data-source/run.ts +4 -3
- package/examples/quickstart.ts +1 -1
- package/llms.txt +27 -16
- package/package.json +6 -1
package/llms.txt
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Ablo is the state coordination layer for apps where humans and agents edit the same data.
|
|
4
4
|
|
|
5
|
+
Here is the problem it solves. Two writers touch `report_stockholm` at once. The agent claims the row, does slow work (an LLM call, a fetch), and commits; the human's UI sees the claim live and never clobbers it. Claims don't lock. If another writer holds the row, `claim` waits for them, re-reads the fresh row, then hands it to you — so two writers serialize instead of clobbering.
|
|
6
|
+
|
|
5
7
|
Use AI SDK for the agent loop. Use Ablo when agent reads and writes must persist, coordinate with concurrent work, and leave an audit trail.
|
|
6
8
|
|
|
7
9
|
## Use this API
|
|
@@ -21,7 +23,7 @@ const schema = defineSchema({
|
|
|
21
23
|
|
|
22
24
|
const ablo = Ablo({ schema, apiKey: process.env.ABLO_API_KEY });
|
|
23
25
|
|
|
24
|
-
const
|
|
26
|
+
const report = await ablo.weatherReports.retrieve('report_stockholm');
|
|
25
27
|
if (!report) throw new Error('Row not found');
|
|
26
28
|
|
|
27
29
|
const updated = await ablo.weatherReports.claim('report_stockholm', async (report) => {
|
|
@@ -33,20 +35,29 @@ const updated = await ablo.weatherReports.claim('report_stockholm', async (repor
|
|
|
33
35
|
});
|
|
34
36
|
```
|
|
35
37
|
|
|
36
|
-
That is the normal app path: declare models in a schema, then use `ablo.<model>.
|
|
38
|
+
That is the normal app path: declare models in a schema, then use `ablo.<model>.retrieve(...)`, `ablo.<model>.create(...)`, `ablo.<model>.update(...)`, and `ablo.<model>.delete(...)`.
|
|
39
|
+
|
|
40
|
+
Treat the schema as the integration contract. It drives typed model clients,
|
|
41
|
+
React selectors, server and agent writes, Data Source request/response shape,
|
|
42
|
+
hosted schema push, and schema-version gating. Do not invent a parallel
|
|
43
|
+
string-keyed write path for rows that belong to a schema model.
|
|
37
44
|
|
|
38
45
|
For full integrations, use `integration-guide` as the canonical doc. It covers
|
|
39
46
|
the same model API across Ablo-managed state, Data Source-backed app databases,
|
|
40
47
|
React selectors, multiplayer, and future agent workers.
|
|
41
48
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
Reads come in two flavors, and you pick by whether you can wait. `retrieve(id)`
|
|
50
|
+
(one row) and `list({ where })` (many) are async — they hit the server and return
|
|
51
|
+
a Promise, so await them. `get(id)`, `getAll({ where })`, and `getCount({ where })`
|
|
52
|
+
are synchronous — they read the local graph and are reactive in render, so no
|
|
53
|
+
await. The query reads accept `where`, `filter`, `orderBy`, `limit`, `offset`,
|
|
54
|
+
and `state`; state defaults to `'live'`, with `'archived'` and `'all'` to include
|
|
55
|
+
retired rows.
|
|
45
56
|
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
Workers that can't import the app schema can use a schema-less mode (covered in
|
|
58
|
+
`integration-guide`).
|
|
48
59
|
|
|
49
|
-
React reads should use selector `useAblo`: `useAblo((ablo) => ablo.weatherReports.
|
|
60
|
+
React reads should use selector `useAblo`: `useAblo((ablo) => ablo.weatherReports.get(id))` (synchronous local read, reactive in render).
|
|
50
61
|
Use zero-argument `useAblo()` only when a component needs the client for an
|
|
51
62
|
event handler or effect. Treat `useQuery`, `useOne`, `useReader`, and
|
|
52
63
|
`useMutate` as compatibility hooks for older string-keyed integrations, not the
|
|
@@ -57,7 +68,7 @@ first integration path.
|
|
|
57
68
|
Multiplayer is not a separate mode. When human UI, server actions, and agents use
|
|
58
69
|
the same schema client and write through `ablo.<model>`, Ablo coordinates the
|
|
59
70
|
shared model stream: confirmed deltas fan out to subscribers, active claims are
|
|
60
|
-
visible through `
|
|
71
|
+
visible through `claim.state(id)`, and stale writes can be rejected with `readAt`.
|
|
61
72
|
|
|
62
73
|
If an app writes directly to its own database outside Ablo, that write bypasses
|
|
63
74
|
coordination until the app reports it through Data Source events.
|
|
@@ -65,7 +76,7 @@ coordination until the app reports it through Data Source events.
|
|
|
65
76
|
## Nouns
|
|
66
77
|
|
|
67
78
|
- `Model client` is the typed `ablo.<model>` object generated from schema.
|
|
68
|
-
- `Claim` holds a model row while slow work runs; `
|
|
79
|
+
- `Claim` holds a model row while slow work runs; `claim.state(id)` observes it.
|
|
69
80
|
- `Commit` is the durable protocol write behind `ablo.<model>.update(...)`.
|
|
70
81
|
- `Receipt` confirms the commit.
|
|
71
82
|
|
|
@@ -76,23 +87,23 @@ Server reads through `ablo.model(name)` can pass `ifClaimed: 'return'` to
|
|
|
76
87
|
receive active claims, `ifClaimed: 'fail'` to throw `AbloClaimedError`, or
|
|
77
88
|
`ifClaimed: 'wait'` to wait until the active claim clears.
|
|
78
89
|
|
|
79
|
-
Schema clients
|
|
90
|
+
Schema clients learn when a claim clears by listening to the live claim stream, so they don't need to poll. Schema-less HTTP callers must provide an explicit `claimedPollInterval` when using `ifClaimed: 'wait'`; Ablo does not hide a hard-coded polling loop.
|
|
80
91
|
|
|
81
92
|
Use `claimedTimeout` only as a maximum wait, not as the coordination mechanism.
|
|
82
93
|
|
|
83
94
|
## Guarantees
|
|
84
95
|
|
|
85
|
-
`wait: 'confirmed'` means the server accepted the write. Schema model writes are optimistic by default; server rejection rolls back local state.
|
|
96
|
+
`wait: 'confirmed'` means the server accepted the write. Schema model writes are optimistic by default; server rejection rolls back local state. To prevent lost updates, read with `snapshot(...)` to capture a `readAt`, then write with `onStale: 'reject'` — the server rejects your update if someone else changed the row after that `readAt`.
|
|
86
97
|
|
|
87
98
|
Claims coordinate writers; they do not block readers. Most users should stay on
|
|
88
|
-
schema-backed reads/writes and `claim(...)`;
|
|
89
|
-
|
|
99
|
+
schema-backed reads/writes and `claim(...)`; manual protocol bookkeeping is not
|
|
100
|
+
part of the happy path.
|
|
90
101
|
|
|
91
102
|
All SDK errors extend `AbloError`. Important classes: `AbloClaimedError`, `AbloStaleContextError`, `AbloAuthenticationError`, `AbloPermissionError`, `AbloRateLimitError`, `AbloIdempotencyError`, `AbloConnectionError`, `AbloValidationError`, and `AbloServerError`.
|
|
92
103
|
|
|
93
104
|
## Schema Scope
|
|
94
105
|
|
|
95
|
-
|
|
106
|
+
A schema is model fields and relations. Advanced schema helpers such as `mutable`, `readOnly`, `field`, `indexed`, queries, and load strategies exist for offline/cache/indexing-heavy apps; reach for them only after the basic field/relation schema is working.
|
|
96
107
|
|
|
97
108
|
## Storage Boundary
|
|
98
109
|
|
|
@@ -135,4 +146,4 @@ Import from these public paths only:
|
|
|
135
146
|
|
|
136
147
|
Do not teach `/api`, `/agent`, `/ai-sdk`, `/core`, `/realtime`, `/source`, or internal subpaths.
|
|
137
148
|
|
|
138
|
-
Canonical docs to read before integrating: `quickstart`, `integration-guide`, `guarantees`, `client-behavior`, `data-sources`, `examples/existing-python-backend`, `api`, `examples/ai-sdk-tool`, and `examples/server-agent`.
|
|
149
|
+
Canonical docs to read before integrating: `quickstart`, `schema-contract`, `integration-guide`, `guarantees`, `client-behavior`, `data-sources`, `examples/existing-python-backend`, `api`, `examples/ai-sdk-tool`, and `examples/server-agent`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abloatai/ablo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "State control API for AI agents and collaborative apps.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -54,6 +54,11 @@
|
|
|
54
54
|
"types": "./dist/source/index.d.ts",
|
|
55
55
|
"import": "./dist/source/index.js",
|
|
56
56
|
"default": "./dist/source/index.js"
|
|
57
|
+
},
|
|
58
|
+
"./keys": {
|
|
59
|
+
"types": "./dist/keys/index.d.ts",
|
|
60
|
+
"import": "./dist/keys/index.js",
|
|
61
|
+
"default": "./dist/keys/index.js"
|
|
57
62
|
}
|
|
58
63
|
},
|
|
59
64
|
"files": [
|