@abloatai/ablo 0.5.1 → 0.7.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 +61 -0
- package/README.md +248 -124
- package/dist/BaseSyncedStore.d.ts +3 -3
- package/dist/BaseSyncedStore.js +3 -3
- package/dist/api/index.d.ts +3 -3
- package/dist/api/index.js +1 -1
- package/dist/client/Ablo.d.ts +91 -93
- package/dist/client/Ablo.js +122 -60
- package/dist/client/ApiClient.d.ts +14 -14
- package/dist/client/ApiClient.js +81 -55
- package/dist/client/createInternalComponents.d.ts +2 -3
- package/dist/client/createInternalComponents.js +2 -3
- package/dist/client/createModelProxy.d.ts +116 -90
- package/dist/client/createModelProxy.js +128 -128
- package/dist/client/index.d.ts +6 -7
- package/dist/client/index.js +4 -5
- package/dist/client/validateAbloOptions.js +5 -5
- package/dist/coordination/index.d.ts +6 -0
- package/dist/coordination/index.js +6 -0
- package/dist/coordination/schema.d.ts +329 -0
- package/dist/coordination/schema.js +209 -0
- package/dist/core/QueryView.d.ts +4 -1
- package/dist/core/QueryView.js +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +7 -0
- package/dist/core/query-utils.d.ts +7 -10
- package/dist/core/query-utils.js +2 -3
- package/dist/errorCodes.d.ts +264 -0
- package/dist/errorCodes.js +251 -0
- package/dist/errors.d.ts +59 -14
- package/dist/errors.js +73 -12
- package/dist/index.d.ts +11 -9
- package/dist/index.js +8 -12
- package/dist/interfaces/index.d.ts +2 -10
- package/dist/mutators/Transaction.d.ts +2 -2
- package/dist/mutators/Transaction.js +2 -2
- package/dist/mutators/mutateActions.d.ts +44 -0
- package/dist/{react/useMutate.js → mutators/mutateActions.js} +11 -28
- package/dist/mutators/readerActions.d.ts +32 -0
- package/dist/{react/useReader.js → mutators/readerActions.js} +2 -18
- package/dist/policy/index.d.ts +1 -1
- package/dist/policy/index.js +1 -1
- package/dist/policy/types.d.ts +31 -0
- package/dist/policy/types.js +15 -0
- package/dist/query/types.d.ts +1 -1
- package/dist/react/AbloProvider.d.ts +13 -1
- package/dist/react/AbloProvider.js +14 -6
- package/dist/react/context.d.ts +4 -4
- package/dist/react/index.d.ts +4 -5
- package/dist/react/index.js +3 -7
- package/dist/react/useAblo.d.ts +14 -14
- package/dist/react/useAblo.js +26 -26
- package/dist/react/useIntent.d.ts +2 -2
- package/dist/react/useIntent.js +2 -2
- package/dist/react/useMutators.d.ts +1 -1
- package/dist/react/usePresence.d.ts +3 -3
- package/dist/react/usePresence.js +4 -4
- package/dist/react/useUndoScope.d.ts +1 -1
- package/dist/schema/ddl.d.ts +62 -0
- package/dist/schema/ddl.js +317 -0
- package/dist/schema/diff.d.ts +167 -0
- package/dist/schema/diff.js +280 -0
- package/dist/schema/field.d.ts +16 -19
- package/dist/schema/field.js +30 -17
- package/dist/schema/generate.d.ts +19 -0
- package/dist/schema/generate.js +87 -0
- package/dist/schema/index.d.ts +9 -3
- package/dist/schema/index.js +14 -2
- package/dist/schema/model.d.ts +87 -25
- package/dist/schema/model.js +33 -3
- package/dist/schema/relation.d.ts +17 -0
- package/dist/schema/roles.d.ts +148 -0
- package/dist/schema/roles.js +149 -0
- package/dist/schema/schema.d.ts +10 -69
- package/dist/schema/schema.js +58 -24
- package/dist/schema/select.d.ts +25 -0
- package/dist/schema/select.js +55 -0
- package/dist/schema/serialize.d.ts +96 -0
- package/dist/schema/serialize.js +231 -0
- package/dist/schema/sugar.d.ts +20 -3
- package/dist/schema/sugar.js +5 -1
- package/dist/schema/tenancy.d.ts +66 -0
- package/dist/schema/tenancy.js +58 -0
- package/dist/sync/HydrationCoordinator.d.ts +2 -0
- package/dist/sync/HydrationCoordinator.js +23 -17
- package/dist/sync/SyncWebSocket.d.ts +17 -0
- package/dist/sync/SyncWebSocket.js +46 -1
- package/dist/sync/awaitIntentGrant.d.ts +26 -0
- package/dist/sync/awaitIntentGrant.js +60 -0
- package/dist/sync/createIntentStream.d.ts +2 -1
- package/dist/sync/createIntentStream.js +89 -5
- package/dist/sync/createPresenceStream.js +1 -1
- package/dist/sync/participants.d.ts +2 -2
- package/dist/sync/participants.js +9 -18
- package/dist/types/global.d.ts +43 -52
- package/dist/types/global.js +16 -18
- package/dist/types/streams.d.ts +90 -42
- package/docs/api-keys.md +44 -0
- package/docs/api.md +72 -173
- package/docs/audit.md +5 -5
- package/docs/cli.md +212 -0
- package/docs/client-behavior.md +42 -43
- package/docs/coordination.md +343 -0
- package/docs/data-sources.md +16 -16
- package/docs/examples/agent-human.md +30 -32
- package/docs/examples/ai-sdk-tool.md +32 -33
- package/docs/examples/existing-python-backend.md +38 -36
- package/docs/examples/nextjs.md +24 -25
- package/docs/examples/scoped-agent.md +78 -0
- package/docs/examples/server-agent.md +20 -61
- package/docs/guarantees.md +34 -56
- package/docs/identity.md +529 -0
- package/docs/index.md +18 -24
- package/docs/integration-guide.md +130 -144
- package/docs/interaction-model.md +32 -95
- package/docs/mcp/claude-code.md +3 -3
- package/docs/mcp/cursor.md +1 -1
- package/docs/mcp/windsurf.md +1 -1
- package/docs/mcp.md +11 -26
- package/docs/quickstart.md +43 -49
- package/docs/react.md +74 -24
- package/docs/roadmap.md +17 -7
- package/llms.txt +34 -39
- package/package.json +8 -1
- package/dist/react/useMutate.d.ts +0 -83
- package/dist/react/useQuery.d.ts +0 -123
- package/dist/react/useQuery.js +0 -145
- package/dist/react/useReader.d.ts +0 -69
- package/docs/capabilities.md +0 -163
package/docs/guarantees.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Guarantees
|
|
2
2
|
|
|
3
|
-
This page is the short contract for what Ablo
|
|
3
|
+
This page is the short contract for what Ablo guarantees at the state
|
|
4
4
|
boundary.
|
|
5
5
|
|
|
6
6
|
## Confirmed Writes
|
|
@@ -9,19 +9,18 @@ boundary.
|
|
|
9
9
|
the authoritative sync cursor.
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
|
-
const updated = await ablo.
|
|
13
|
-
'
|
|
14
|
-
{ status: '
|
|
12
|
+
const updated = await ablo.weatherReports.update(
|
|
13
|
+
'report_stockholm',
|
|
14
|
+
{ status: 'ready' },
|
|
15
15
|
{ wait: 'confirmed' },
|
|
16
16
|
);
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
If the call resolves, the write was accepted by the server. If it rejects, the
|
|
20
20
|
error explains whether the write was rejected for auth, validation, stale state,
|
|
21
|
-
active
|
|
21
|
+
active claim conflict, idempotency, rate limit, or transport failure.
|
|
22
22
|
|
|
23
|
-
Schema model writes return the updated model row.
|
|
24
|
-
`commits.create(...)` return a receipt with the commit status and sync cursor.
|
|
23
|
+
Schema model writes return the updated model row.
|
|
25
24
|
|
|
26
25
|
## Optimistic Local State
|
|
27
26
|
|
|
@@ -42,11 +41,11 @@ Use `snapshot(...)` and `readAt` when a write depends on state the agent already
|
|
|
42
41
|
read:
|
|
43
42
|
|
|
44
43
|
```ts
|
|
45
|
-
const snap = ablo.snapshot({
|
|
44
|
+
const snap = ablo.snapshot({ weatherReports: 'report_stockholm' });
|
|
46
45
|
|
|
47
|
-
await ablo.
|
|
48
|
-
'
|
|
49
|
-
{ status: '
|
|
46
|
+
await ablo.weatherReports.update(
|
|
47
|
+
'report_stockholm',
|
|
48
|
+
{ status: 'ready' },
|
|
50
49
|
{ readAt: snap.stamp, onStale: 'reject', wait: 'confirmed' },
|
|
51
50
|
);
|
|
52
51
|
```
|
|
@@ -61,45 +60,30 @@ Advanced policies exist for controlled product flows:
|
|
|
61
60
|
- `flag` accepts the write and marks it for product review.
|
|
62
61
|
- `merge` is reserved for server-defined merge behavior.
|
|
63
62
|
|
|
64
|
-
##
|
|
63
|
+
## Claim Coordination
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
> The guarantee, not the how-to. Methods, the claim-state object, and the `queue`
|
|
66
|
+
> live in [Coordination](./coordination.md).
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
behavior:
|
|
68
|
+
Claims are live coordination signals. They are not database locks.
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
Claims are **advisory** and **cooperative**. `ablo.<model>.claim(id, ...)`
|
|
71
|
+
serializes on contention: if another human or agent already holds the row, the
|
|
72
|
+
claim waits for them to finish, then re-reads the row before handing it back, so
|
|
73
|
+
you proceed from fresh state. Reads are open by default —
|
|
74
|
+
`ablo.<model>.claimState(id)` returns the current claim state (or `null`) without
|
|
75
|
+
ever blocking. Server/model reads can opt into `ifClaimed: 'wait'` or
|
|
76
|
+
`ifClaimed: 'fail'` when they should not read through active work.
|
|
74
77
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
A claim does not reject or block other writers; it announces work so peers
|
|
79
|
+
serialize behind it rather than racing. While you hold a claim, the matching
|
|
80
|
+
`ablo.<model>.update(id, ...)` is stale-guarded and rejects with
|
|
81
|
+
`AbloStaleContextError` if the row advanced past your claim point.
|
|
78
82
|
|
|
79
83
|
## Agent Runs
|
|
80
84
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
- `done` — the handler returned successfully.
|
|
85
|
-
- `failed` — the handler threw or the commit failed.
|
|
86
|
-
- `cancelled` — the run signal aborted.
|
|
87
|
-
|
|
88
|
-
Normal schema-backed agents should import the same schema as the app and write
|
|
89
|
-
through `ablo.<model>.update(...)`. The lower-level run envelope exists for
|
|
90
|
-
platform runtimes that need capability and task management without app code.
|
|
91
|
-
|
|
92
|
-
## Capabilities and Tasks
|
|
93
|
-
|
|
94
|
-
Capabilities scope what an agent is allowed to do. Tasks group a run for audit
|
|
95
|
-
and cost attribution.
|
|
96
|
-
|
|
97
|
-
Most users do not create either one manually. The SDK and hosted API manage the
|
|
98
|
-
common case. Manual capability and task APIs are for platform builders, custom
|
|
99
|
-
agent runtimes, and internal infrastructure.
|
|
100
|
-
|
|
101
|
-
Use `lease` as a crash cleanup window. A successful agent run still closes when
|
|
102
|
-
the handler returns, fails, or is cancelled.
|
|
85
|
+
Agents should import the same schema as the app and write through
|
|
86
|
+
`ablo.<model>.claim(...)` plus `ablo.<model>.update(...)`.
|
|
103
87
|
|
|
104
88
|
## Audit Trail
|
|
105
89
|
|
|
@@ -107,19 +91,17 @@ Accepted writes can be attributed to:
|
|
|
107
91
|
|
|
108
92
|
- the actor that wrote,
|
|
109
93
|
- the human or system the actor worked on behalf of,
|
|
110
|
-
- the
|
|
111
|
-
- the task or run that caused it,
|
|
112
|
-
- the resource, operation, and state cursor.
|
|
94
|
+
- the model, operation, and state cursor.
|
|
113
95
|
|
|
114
96
|
For agent work, this is what lets an audit surface answer: "what changed, who
|
|
115
97
|
authorized it, which run did it, and what state was it based on?"
|
|
116
98
|
|
|
117
99
|
## Persistence
|
|
118
100
|
|
|
119
|
-
Ablo defaults to volatile
|
|
101
|
+
Ablo defaults to volatile in-memory persistence. That keeps the SDK focused on
|
|
120
102
|
coordination and audit instead of silently becoming a browser storage product.
|
|
121
103
|
|
|
122
|
-
Opt into durable browser cache
|
|
104
|
+
Opt into a durable browser cache that survives reloads when you need it:
|
|
123
105
|
|
|
124
106
|
```ts
|
|
125
107
|
const ablo = Ablo({
|
|
@@ -137,12 +119,8 @@ Ablo does not need a customer database URL. When your own database is canonical,
|
|
|
137
119
|
Ablo calls a signed Data Source endpoint and records the coordination result for
|
|
138
120
|
receipts, realtime fanout, and audit. See [Connect Your Database](./data-sources.md).
|
|
139
121
|
|
|
140
|
-
##
|
|
141
|
-
|
|
142
|
-
Most apps should use `ablo.<model>.create/update/delete`. Use
|
|
143
|
-
`commits.create(...)` only when you need a low-level batch or a schema-less
|
|
144
|
-
runtime.
|
|
122
|
+
## Writes
|
|
145
123
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
124
|
+
Use `ablo.<model>.create/update/delete` for state changes. The server validates
|
|
125
|
+
authorization, stale state, active claim conflicts, and idempotency before
|
|
126
|
+
accepting the write.
|