@abloatai/ablo 0.5.0 → 0.5.1
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 +6 -0
- package/README.md +54 -42
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ silently overwrite each other, expose who's working on what, and leave a record
|
|
|
8
8
|
of who changed what.
|
|
9
9
|
|
|
10
10
|
```txt
|
|
11
|
-
schema -> ablo.<model>.create/load/update(...)
|
|
11
|
+
schema -> ablo.<model>.create/retrieve/load/update/intent(...)
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Install
|
|
@@ -29,8 +29,7 @@ export ABLO_API_KEY=sk_test_...
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
In the browser, connect through the React provider (`<AbloProvider>`), which
|
|
32
|
-
authenticates with the signed-in user's session — never the raw API key.
|
|
33
|
-
ship `ABLO_API_KEY` in a browser bundle.
|
|
32
|
+
authenticates with the signed-in user's session — never the raw API key.
|
|
34
33
|
|
|
35
34
|
## Quick Start
|
|
36
35
|
|
|
@@ -78,13 +77,58 @@ Pass `schema` to get typed models like `ablo.weatherReports.update(...)`. Omit i
|
|
|
78
77
|
only for the lower-level client used by custom agents and MCP routes that can't
|
|
79
78
|
import your app's schema.
|
|
80
79
|
|
|
81
|
-
|
|
80
|
+
## React
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
In a React app it's the **same `ablo.<model>` API** — just mounted through a
|
|
83
|
+
provider and read with hooks, from `@abloatai/ablo/react`. Wrap your tree once;
|
|
84
|
+
everything inside is live.
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { AbloProvider, useAblo } from '@abloatai/ablo/react';
|
|
88
|
+
import { schema } from './ablo.schema';
|
|
89
|
+
|
|
90
|
+
function App() {
|
|
91
|
+
return (
|
|
92
|
+
<AbloProvider schema={schema}>
|
|
93
|
+
<Report id="report_stockholm" />
|
|
94
|
+
</AbloProvider>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function Report({ id }: { id: string }) {
|
|
99
|
+
// Reactive read: this re-renders whenever the row changes — whether you,
|
|
100
|
+
// a teammate, or an agent changed it.
|
|
101
|
+
const report = useAblo((ablo) => ablo.weatherReports.retrieve(id));
|
|
102
|
+
const ablo = useAblo();
|
|
103
|
+
|
|
104
|
+
if (!report) return null;
|
|
105
|
+
|
|
106
|
+
// Write: same method as the server example above. Optimistic; fans out.
|
|
107
|
+
return (
|
|
108
|
+
<button onClick={() => ablo?.weatherReports.update(id, { status: 'ready' })}>
|
|
109
|
+
{report.status}
|
|
110
|
+
</button>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
86
113
|
```
|
|
87
114
|
|
|
115
|
+
`<AbloProvider>` owns the connection and authenticates with the signed-in user's
|
|
116
|
+
session — no API key in the browser. That's the whole loop: read with
|
|
117
|
+
`useAblo(selector)`, write with `ablo.<model>`, and every other client (human or
|
|
118
|
+
agent) on that row sees it in real time. See [React](./docs/react.md) for
|
|
119
|
+
`fallback`, `bootstrapMode`, presence, and status hooks.
|
|
120
|
+
|
|
121
|
+
## Set up with Claude Code
|
|
122
|
+
|
|
123
|
+
The package ships an `llms.txt` — a compact, LLM-readable map of the whole API.
|
|
124
|
+
Point your coding agent at it and let it do the integration:
|
|
125
|
+
|
|
126
|
+
> Read `node_modules/@abloatai/ablo/llms.txt`, then add an Ablo schema and
|
|
127
|
+
> `<AbloProvider>` to this app and wire up my first create / retrieve / update.
|
|
128
|
+
|
|
129
|
+
It scaffolds the schema, sets up the provider, and writes your first
|
|
130
|
+
`ablo.<model>` calls — the same shape as the Quick Start above.
|
|
131
|
+
|
|
88
132
|
For a production integration with React, an existing backend, Data Source, and
|
|
89
133
|
future agents, read [Integration Guide](./docs/integration-guide.md).
|
|
90
134
|
|
|
@@ -190,24 +234,6 @@ Most reads are `retrieve` — it's the everyday path, especially inside `useAblo
|
|
|
190
234
|
guarantee a row is hydrated before you read it — initial fetch, SSR, scripts, or
|
|
191
235
|
any non-reactive runtime.
|
|
192
236
|
|
|
193
|
-
## Persistence
|
|
194
|
-
|
|
195
|
-
Ablo keeps local state in memory by default. That keeps the SDK focused on
|
|
196
|
-
coordinating shared state, rather than silently turning every browser app into
|
|
197
|
-
an offline database it didn't ask for.
|
|
198
|
-
|
|
199
|
-
Opt into a durable browser cache and offline write queue when you want it:
|
|
200
|
-
|
|
201
|
-
```ts
|
|
202
|
-
const ablo = Ablo({
|
|
203
|
-
schema,
|
|
204
|
-
apiKey: process.env.ABLO_API_KEY,
|
|
205
|
-
persistence: 'indexeddb',
|
|
206
|
-
});
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
Node, SSR, tests, and agents use volatile in-memory persistence automatically.
|
|
210
|
-
|
|
211
237
|
## Connect Your Database
|
|
212
238
|
|
|
213
239
|
Every schema model has a backing store. By default, Ablo stores rows for the
|
|
@@ -216,30 +242,16 @@ write to Ablo-managed state.
|
|
|
216
242
|
|
|
217
243
|
If your existing database stays the source of truth, connect it as a Data
|
|
218
244
|
Source: Ablo sends signed commit requests to an endpoint you host, and your app
|
|
219
|
-
writes its own database.
|
|
220
|
-
API key
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
# stays in your app — Ablo never receives this
|
|
224
|
-
DATABASE_URL=postgres://...
|
|
225
|
-
|
|
226
|
-
# the only Ablo credential your app needs
|
|
227
|
-
ABLO_API_KEY=sk_live_...
|
|
228
|
-
```
|
|
245
|
+
writes its own database. Your `DATABASE_URL` stays in your app — Ablo only ever
|
|
246
|
+
sees the API key.
|
|
229
247
|
|
|
230
248
|
See [Connect Your Database](./docs/data-sources.md) for the route and commit shape.
|
|
231
249
|
|
|
232
|
-
## Agent Runs
|
|
233
|
-
|
|
234
|
-
Most agent workers should import the same schema and use
|
|
235
|
-
`ablo.<model>.load(...)` plus `ablo.<model>.update(...)`. The schema-less
|
|
236
|
-
`agent.run(...)` wrapper exists for advanced workers that intentionally cannot
|
|
237
|
-
import the app schema.
|
|
238
|
-
|
|
239
250
|
## Production Reference
|
|
240
251
|
|
|
241
252
|
- [Guarantees](./docs/guarantees.md) — confirmed writes, stale-write protection, intent coordination, and agent lifecycle.
|
|
242
253
|
- [Integration Guide](./docs/integration-guide.md) — pick the backing mode and integrate React, Data Source, multiplayer, and agents.
|
|
254
|
+
- [React](./docs/react.md) — `<AbloProvider>`, `useAblo`, presence, status, and bootstrap gating.
|
|
243
255
|
- [Client Behavior](./docs/client-behavior.md) — options, errors, retries, timeouts, and public imports.
|
|
244
256
|
- [Connect Your Database](./docs/data-sources.md) — keep canonical rows in your app database without giving Ablo database credentials.
|
|
245
257
|
- [Existing Python Backend](./docs/examples/existing-python-backend.md) — migrate existing Python endpoints to multiplayer and agent-safe writes gradually.
|