@abloatai/ablo 0.27.0 → 0.29.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 +59 -3
- package/README.md +1 -1
- package/dist/BaseSyncedStore.js +8 -9
- package/dist/Database.d.ts +14 -1
- package/dist/Database.js +228 -28
- package/dist/Model.d.ts +17 -0
- package/dist/Model.js +32 -1
- package/dist/SyncClient.d.ts +10 -6
- package/dist/SyncClient.js +390 -75
- package/dist/adapters/inMemoryStorage.d.ts +1 -0
- package/dist/adapters/inMemoryStorage.js +29 -13
- package/dist/ai-sdk/coordinatedTool.d.ts +15 -2
- package/dist/auth/schemas.d.ts +6 -0
- package/dist/auth/schemas.js +7 -0
- package/dist/cli.cjs +821 -402
- package/dist/client/Ablo.d.ts +53 -24
- package/dist/client/Ablo.js +12 -199
- package/dist/client/claimHeartbeatLoop.d.ts +1 -1
- package/dist/client/claimHeartbeatLoop.js +1 -1
- package/dist/client/createInternalComponents.d.ts +4 -0
- package/dist/client/createInternalComponents.js +3 -1
- package/dist/client/durableWrites.d.ts +21 -0
- package/dist/client/durableWrites.js +46 -0
- package/dist/client/httpClient.d.ts +21 -45
- package/dist/client/httpClient.js +104 -26
- package/dist/client/httpTransport.d.ts +8 -0
- package/dist/client/{ApiClient.js → httpTransport.js} +361 -308
- package/dist/client/modelRegistration.js +11 -0
- package/dist/client/options.d.ts +54 -7
- package/dist/client/options.js +3 -2
- package/dist/client/resourceTypes.d.ts +9 -85
- package/dist/client/resourceTypes.js +1 -1
- package/dist/client/sessionMint.d.ts +5 -6
- package/dist/client/sessionMint.js +4 -5
- package/dist/client/validateAbloOptions.js +3 -3
- package/dist/client/wsMutationExecutor.d.ts +3 -2
- package/dist/client/wsMutationExecutor.js +3 -2
- package/dist/coordination/schema.d.ts +30 -0
- package/dist/coordination/schema.js +14 -0
- package/dist/core/StoreManager.d.ts +2 -0
- package/dist/core/StoreManager.js +12 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/errorCodes.js +6 -2
- package/dist/errors.d.ts +4 -40
- package/dist/errors.js +5 -5
- package/dist/index.d.ts +20 -8
- package/dist/index.js +9 -5
- package/dist/interfaces/index.d.ts +5 -2
- package/dist/mutators/UndoManager.d.ts +2 -0
- package/dist/mutators/UndoManager.js +32 -0
- package/dist/mutators/defineMutators.d.ts +18 -0
- package/dist/mutators/defineMutators.js +4 -8
- package/dist/react/index.d.ts +1 -1
- package/dist/react/useAblo.d.ts +6 -4
- package/dist/react/useAblo.js +25 -3
- package/dist/schema/index.d.ts +2 -2
- package/dist/schema/index.js +1 -1
- package/dist/schema/schema.d.ts +31 -1
- package/dist/schema/select.d.ts +15 -0
- package/dist/schema/select.js +27 -3
- package/dist/source/connector.d.ts +3 -3
- package/dist/source/factory.d.ts +4 -6
- package/dist/source/factory.js +4 -7
- package/dist/source/index.d.ts +4 -4
- package/dist/source/index.js +2 -2
- package/dist/source/signing.d.ts +0 -3
- package/dist/source/types.d.ts +0 -26
- package/dist/stores/ObjectStore.d.ts +14 -1
- package/dist/stores/ObjectStore.js +33 -10
- package/dist/stores/ObjectStoreContract.d.ts +2 -0
- package/dist/surface.d.ts +1 -1
- package/dist/surface.js +3 -0
- package/dist/sync/BootstrapFetcher.d.ts +10 -0
- package/dist/sync/BootstrapFetcher.js +27 -4
- package/dist/sync/SyncWebSocket.d.ts +2 -1
- package/dist/sync/createClaimStream.d.ts +11 -2
- package/dist/sync/createClaimStream.js +4 -3
- package/dist/sync/persistedPrefix.d.ts +12 -0
- package/dist/sync/persistedPrefix.js +22 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.js +1 -0
- package/dist/testing/mocks/FakeDatabase.d.ts +18 -0
- package/dist/testing/mocks/FakeDatabase.js +10 -0
- package/dist/testing/mocks/MockWebSocket.d.ts +2 -1
- package/dist/transactions/TransactionQueue.d.ts +66 -8
- package/dist/transactions/TransactionQueue.js +607 -89
- package/dist/transactions/commitEnvelope.d.ts +132 -0
- package/dist/transactions/commitEnvelope.js +139 -0
- package/dist/transactions/commitOutboxStore.d.ts +32 -0
- package/dist/transactions/commitOutboxStore.js +26 -0
- package/dist/transactions/commitPayload.d.ts +15 -0
- package/dist/transactions/commitPayload.js +6 -0
- package/dist/transactions/durableWriteStore.d.ts +123 -0
- package/dist/transactions/durableWriteStore.js +30 -0
- package/dist/transactions/httpCommitEnvelope.d.ts +44 -0
- package/dist/transactions/httpCommitEnvelope.js +181 -0
- package/dist/transactions/idempotencyKey.d.ts +10 -0
- package/dist/transactions/idempotencyKey.js +9 -0
- package/dist/transactions/replayValidation.d.ts +83 -0
- package/dist/transactions/replayValidation.js +46 -1
- package/dist/types/global.d.ts +10 -29
- package/dist/types/global.js +4 -7
- package/dist/types/streams.d.ts +2 -28
- package/dist/wire/bootstrapReason.d.ts +9 -0
- package/dist/wire/bootstrapReason.js +8 -0
- package/dist/wire/frames.d.ts +6 -21
- package/dist/wire/frames.js +4 -4
- package/dist/wire/index.d.ts +6 -3
- package/dist/wire/index.js +3 -2
- package/dist/wire/protocolVersion.d.ts +30 -17
- package/dist/wire/protocolVersion.js +34 -18
- package/docs/agents.md +8 -3
- package/docs/api.md +16 -14
- package/docs/client-behavior.md +6 -3
- package/docs/coordination.md +4 -5
- package/docs/data-sources.md +5 -8
- package/docs/guarantees.md +21 -0
- package/docs/integration-guide.md +1 -0
- package/docs/mcp.md +1 -1
- package/docs/migration.md +21 -1
- package/docs/quickstart.md +11 -0
- package/docs/react.md +0 -46
- package/examples/README.md +6 -5
- package/llms.txt +15 -15
- package/package.json +3 -3
- package/dist/client/ApiClient.d.ts +0 -177
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The stateless API client behind `Ablo({ apiKey })`. It carries no schema,
|
|
3
|
-
* object pool, local database, or WebSocket, and maps the public Model, Claim,
|
|
4
|
-
* and Commit nouns directly to HTTP routes on the server. This is the transport
|
|
5
|
-
* used for server-side agents, workers, and serverless code.
|
|
6
|
-
*/
|
|
7
|
-
import type { AbloOptions } from './options.js';
|
|
8
|
-
import type { CommitResource, ClaimCreateOptions, ClaimWaitOptions, ModelClient, ModelClaim, ModelTarget, CreateSessionParams, AbloSession } from './resourceTypes.js';
|
|
9
|
-
import type { SchemaRecord } from '../schema/schema.js';
|
|
10
|
-
import type { Duration } from '../utils/duration.js';
|
|
11
|
-
import type { Claim, ClaimHeartbeat } from '../types/streams.js';
|
|
12
|
-
import type { SyncObservabilityProvider } from '../interfaces/index.js';
|
|
13
|
-
export type AbloApiClientOptions = Omit<AbloOptions, 'schema'> & {
|
|
14
|
-
readonly schema?: null | undefined;
|
|
15
|
-
readonly bootstrapBaseUrl?: string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* The observability provider forwarded from `Ablo({ observability })`. The HTTP
|
|
18
|
-
* transport emits the same claim and conflict events as the WebSocket transport,
|
|
19
|
-
* so a `ClaimLog` works identically for headless server-agent evaluations.
|
|
20
|
-
*/
|
|
21
|
-
readonly observability?: SyncObservabilityProvider;
|
|
22
|
-
/**
|
|
23
|
-
* Per-request deadline in milliseconds for the stateless HTTP transport.
|
|
24
|
-
* Every request this client issues is aborted after this long and surfaces
|
|
25
|
-
* as a retryable connection error — without it a black-holed server hangs
|
|
26
|
-
* a headless agent forever (browsers never time fetch out on their own).
|
|
27
|
-
* Pass `0` to disable the deadline.
|
|
28
|
-
*
|
|
29
|
-
* @default 30_000
|
|
30
|
-
*/
|
|
31
|
-
readonly timeoutMs?: number;
|
|
32
|
-
};
|
|
33
|
-
/** Default per-request deadline for the stateless HTTP transport. */
|
|
34
|
-
export declare const DEFAULT_REQUEST_TIMEOUT_MS = 30000;
|
|
35
|
-
export interface AbloApiClaims {
|
|
36
|
-
create(options: ClaimCreateOptions): Promise<Claim>;
|
|
37
|
-
list(target?: Partial<ModelTarget>): Promise<readonly ModelClaim[]>;
|
|
38
|
-
waitFor(target: Partial<ModelTarget>, options?: ClaimWaitOptions): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* The batched beat — extend every lease this credential holds in one
|
|
41
|
-
* request (`POST /v1/claims/heartbeat`), the stateless twin of the
|
|
42
|
-
* WebSocket keepalive. One round trip per cadence for a worker holding
|
|
43
|
-
* many rows. Returns one {@link ClaimHeartbeat} per extended lease,
|
|
44
|
-
* tagged with its claim id — no separate result type to learn.
|
|
45
|
-
*/
|
|
46
|
-
heartbeatAll(options?: {
|
|
47
|
-
ttl?: Duration;
|
|
48
|
-
}): Promise<readonly (ClaimHeartbeat & {
|
|
49
|
-
readonly claimId: string;
|
|
50
|
-
})[]>;
|
|
51
|
-
}
|
|
52
|
-
export type CapabilityParticipantKind = 'agent' | 'system';
|
|
53
|
-
export interface CapabilityCreateBaseOptions {
|
|
54
|
-
readonly participantKind?: CapabilityParticipantKind;
|
|
55
|
-
readonly participantId?: string;
|
|
56
|
-
readonly syncGroups: readonly string[];
|
|
57
|
-
readonly operations: readonly string[];
|
|
58
|
-
readonly label?: string;
|
|
59
|
-
readonly wideScope?: boolean;
|
|
60
|
-
readonly userMeta?: Record<string, unknown>;
|
|
61
|
-
}
|
|
62
|
-
export interface CapabilityCreateOptions extends CapabilityCreateBaseOptions {
|
|
63
|
-
/**
|
|
64
|
-
* Preferred public name. A capability is a lease; the SDK and server
|
|
65
|
-
* clean it up when the run finishes or when the lease expires.
|
|
66
|
-
*/
|
|
67
|
-
readonly lease?: Duration;
|
|
68
|
-
readonly leaseSeconds?: number;
|
|
69
|
-
/** @deprecated Use `lease`. */
|
|
70
|
-
readonly ttl?: Duration;
|
|
71
|
-
/** @deprecated Use `leaseSeconds`. */
|
|
72
|
-
readonly ttlSeconds?: number;
|
|
73
|
-
}
|
|
74
|
-
export interface CapabilityScope {
|
|
75
|
-
readonly organizationId: string;
|
|
76
|
-
readonly syncGroups: readonly string[];
|
|
77
|
-
readonly operations: readonly string[];
|
|
78
|
-
readonly participantKind: CapabilityParticipantKind;
|
|
79
|
-
readonly participantId: string;
|
|
80
|
-
}
|
|
81
|
-
export interface Capability {
|
|
82
|
-
readonly id: string;
|
|
83
|
-
readonly token: string;
|
|
84
|
-
readonly expiresAt: string;
|
|
85
|
-
readonly organizationId: string;
|
|
86
|
-
readonly scope: CapabilityScope;
|
|
87
|
-
readonly userMeta?: Record<string, unknown>;
|
|
88
|
-
client(): AbloApi;
|
|
89
|
-
}
|
|
90
|
-
export interface CapabilityRecord {
|
|
91
|
-
readonly id: string;
|
|
92
|
-
readonly organizationId: string;
|
|
93
|
-
readonly participantKind: CapabilityParticipantKind;
|
|
94
|
-
readonly participantId: string;
|
|
95
|
-
readonly label: string | null;
|
|
96
|
-
readonly status: 'active' | 'expired' | 'revoked';
|
|
97
|
-
readonly issuedAt: string;
|
|
98
|
-
readonly expiresAt: string;
|
|
99
|
-
readonly revokedAt: string | null;
|
|
100
|
-
readonly lastUsedAt: string | null;
|
|
101
|
-
readonly operations: readonly string[];
|
|
102
|
-
readonly syncGroups: readonly string[];
|
|
103
|
-
}
|
|
104
|
-
export interface CapabilityRevocation {
|
|
105
|
-
readonly id: string;
|
|
106
|
-
readonly deleted: boolean;
|
|
107
|
-
readonly activeSessionsClosed?: number;
|
|
108
|
-
}
|
|
109
|
-
export interface CapabilityRotateOptions {
|
|
110
|
-
/**
|
|
111
|
-
* The overlap window — the old token keeps authenticating for this long after
|
|
112
|
-
* rotation, so you can deploy the replacement with zero downtime. Defaults to
|
|
113
|
-
* 24h on the server.
|
|
114
|
-
*/
|
|
115
|
-
readonly grace?: Duration;
|
|
116
|
-
readonly graceSeconds?: number;
|
|
117
|
-
/**
|
|
118
|
-
* The lifetime of the replacement capability. Omit to inherit the original's
|
|
119
|
-
* lifetime.
|
|
120
|
-
*/
|
|
121
|
-
readonly lease?: Duration;
|
|
122
|
-
readonly leaseSeconds?: number;
|
|
123
|
-
}
|
|
124
|
-
/** The fresh capability returned by `rotate`, plus a pointer to the old one. */
|
|
125
|
-
export interface RotatedCapability extends Capability {
|
|
126
|
-
/**
|
|
127
|
-
* The capability that was rotated out. Its token keeps working until
|
|
128
|
-
* `expiresAt` (the end of the grace window), then expires.
|
|
129
|
-
*/
|
|
130
|
-
readonly rotatedFrom: {
|
|
131
|
-
readonly id: string;
|
|
132
|
-
readonly expiresAt: string;
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
export interface CapabilityResource {
|
|
136
|
-
create(options: CapabilityCreateOptions): Promise<Capability>;
|
|
137
|
-
retrieve(id: string): Promise<CapabilityRecord>;
|
|
138
|
-
revoke(id: string): Promise<CapabilityRevocation>;
|
|
139
|
-
/**
|
|
140
|
-
* Rotate with overlap: mint a fresh capability that carries the same scope, and
|
|
141
|
-
* keep the old token working for a grace window so you can roll out the
|
|
142
|
-
* replacement without downtime.
|
|
143
|
-
*/
|
|
144
|
-
rotate(id: string, options?: CapabilityRotateOptions): Promise<RotatedCapability>;
|
|
145
|
-
/**
|
|
146
|
-
* Alias for `create`. Kept because "mint" is common capability-token
|
|
147
|
-
* language, but `create` is the canonical SDK verb.
|
|
148
|
-
*/
|
|
149
|
-
mint(options: CapabilityCreateOptions): Promise<Capability>;
|
|
150
|
-
}
|
|
151
|
-
export interface AbloApi {
|
|
152
|
-
ready(): Promise<void>;
|
|
153
|
-
waitForFlush(): Promise<void>;
|
|
154
|
-
dispose(): Promise<void>;
|
|
155
|
-
purge(): Promise<void>;
|
|
156
|
-
readonly capabilities: CapabilityResource;
|
|
157
|
-
readonly claims: AbloApiClaims;
|
|
158
|
-
readonly commits: CommitResource;
|
|
159
|
-
model<T = Record<string, unknown>>(name: string): ModelClient<T>;
|
|
160
|
-
/**
|
|
161
|
-
* Resolve the active bearer credential this client authenticates with — the
|
|
162
|
-
* same token its own requests carry in `Authorization`. Returns `null` when
|
|
163
|
-
* no credential is configured. Async because the API key may be supplied as
|
|
164
|
-
* an async setter. Use it to authenticate a side-band request to the same
|
|
165
|
-
* server with the credential this client already holds — no re-mint.
|
|
166
|
-
*/
|
|
167
|
-
getAuthToken(): Promise<string | null>;
|
|
168
|
-
/**
|
|
169
|
-
* Mint a short-lived scoped session. Minting is a control-plane HTTP call (no
|
|
170
|
-
* socket), so it lives on this stateless client too, not only the realtime one.
|
|
171
|
-
* `{ user }` mints an `ek_`; `{ agent, can }` mints an `rk_`.
|
|
172
|
-
*/
|
|
173
|
-
readonly sessions: {
|
|
174
|
-
create(params: CreateSessionParams<SchemaRecord>): Promise<AbloSession>;
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
export declare function createProtocolClient(options: AbloApiClientOptions): AbloApi;
|