@abloatai/ablo 0.10.1 → 0.11.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 +10 -0
- package/README.md +2 -1
- package/dist/BaseSyncedStore.d.ts +75 -0
- package/dist/BaseSyncedStore.js +193 -8
- package/dist/Database.d.ts +10 -2
- package/dist/Database.js +15 -1
- package/dist/SyncClient.d.ts +12 -1
- package/dist/SyncClient.js +110 -26
- package/dist/agent/Agent.d.ts +9 -9
- package/dist/agent/Agent.js +16 -16
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +2 -2
- package/dist/agent/types.d.ts +1 -1
- package/dist/agent/types.js +1 -1
- package/dist/ai-sdk/{intent-broadcast.d.ts → claim-broadcast.d.ts} +10 -10
- package/dist/ai-sdk/{intent-broadcast.js → claim-broadcast.js} +6 -6
- package/dist/ai-sdk/coordination-context.d.ts +9 -9
- package/dist/ai-sdk/coordination-context.js +8 -8
- package/dist/ai-sdk/index.d.ts +1 -1
- package/dist/ai-sdk/index.js +1 -1
- package/dist/ai-sdk/wrap.d.ts +4 -4
- package/dist/ai-sdk/wrap.js +4 -4
- package/dist/api/index.d.ts +2 -2
- package/dist/cli.cjs +254 -48
- package/dist/client/Ablo.d.ts +30 -63
- package/dist/client/Ablo.js +108 -102
- package/dist/client/ApiClient.d.ts +6 -5
- package/dist/client/ApiClient.js +83 -62
- package/dist/client/createModelProxy.d.ts +16 -54
- package/dist/client/createModelProxy.js +44 -16
- package/dist/client/httpClient.d.ts +2 -0
- package/dist/client/httpClient.js +1 -1
- package/dist/client/index.d.ts +3 -3
- package/dist/client/writeOptionsSchema.d.ts +4 -4
- package/dist/client/writeOptionsSchema.js +4 -4
- package/dist/coordination/schema.d.ts +249 -38
- package/dist/coordination/schema.js +172 -39
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +4 -4
- package/dist/errorCodes.d.ts +9 -9
- package/dist/errorCodes.js +15 -15
- package/dist/errors.d.ts +51 -2
- package/dist/errors.js +94 -5
- package/dist/interfaces/index.d.ts +8 -4
- package/dist/policy/index.d.ts +1 -1
- package/dist/policy/types.d.ts +13 -13
- package/dist/policy/types.js +8 -8
- package/dist/react/AbloProvider.d.ts +51 -4
- package/dist/react/AbloProvider.js +95 -11
- package/dist/react/context.d.ts +26 -9
- package/dist/react/context.js +2 -2
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +4 -4
- package/dist/react/useAblo.js +5 -5
- package/dist/react/{useIntent.d.ts → useClaim.d.ts} +9 -9
- package/dist/react/useClaim.js +42 -0
- package/dist/schema/index.js +1 -1
- package/dist/schema/sugar.d.ts +3 -3
- package/dist/schema/sugar.js +3 -3
- package/dist/schema/sync-delta-wire.d.ts +8 -8
- package/dist/server/commit.d.ts +2 -2
- package/dist/sync/AreaOfInterestManager.d.ts +162 -0
- package/dist/sync/AreaOfInterestManager.js +233 -0
- package/dist/sync/BootstrapHelper.d.ts +9 -1
- package/dist/sync/BootstrapHelper.js +15 -5
- package/dist/sync/NetworkProbe.d.ts +1 -1
- package/dist/sync/NetworkProbe.js +1 -1
- package/dist/sync/SyncWebSocket.d.ts +59 -25
- package/dist/sync/SyncWebSocket.js +123 -26
- package/dist/sync/awaitClaimGrant.d.ts +40 -0
- package/dist/sync/awaitClaimGrant.js +86 -0
- package/dist/sync/createClaimStream.d.ts +34 -0
- package/dist/sync/{createIntentStream.js → createClaimStream.js} +92 -81
- package/dist/sync/createPresenceStream.js +3 -2
- package/dist/sync/participants.d.ts +10 -10
- package/dist/sync/participants.js +17 -10
- package/dist/sync/schemas.d.ts +8 -8
- package/dist/transactions/TransactionQueue.d.ts +12 -0
- package/dist/transactions/TransactionQueue.js +126 -8
- package/dist/types/global.d.ts +10 -10
- package/dist/types/global.js +3 -3
- package/dist/types/index.d.ts +9 -7
- package/dist/types/index.js +2 -2
- package/dist/types/streams.d.ts +114 -98
- package/dist/types/streams.js +1 -1
- package/dist/utils/asyncIterator.d.ts +1 -1
- package/dist/utils/asyncIterator.js +1 -1
- package/dist/wire/frames.d.ts +2 -2
- package/package.json +3 -2
- package/dist/react/useIntent.js +0 -42
- package/dist/sync/awaitIntentGrant.d.ts +0 -40
- package/dist/sync/awaitIntentGrant.js +0 -62
- package/dist/sync/createIntentStream.d.ts +0 -34
|
@@ -6,7 +6,7 @@ import { z } from 'zod';
|
|
|
6
6
|
* one decision") for the conceptual model. The layers, outer-to-inner:
|
|
7
7
|
*
|
|
8
8
|
* 1. PRESENCE (observation) — who is working where; NEVER enforces.
|
|
9
|
-
* 2. PESSIMISTIC (claims/leases) — `
|
|
9
|
+
* 2. PESSIMISTIC (claims/leases) — `claim_begin`/`claim_abandon`;
|
|
10
10
|
* mutual exclusion between participants.
|
|
11
11
|
* 3. OPTIMISTIC (stale-context) — `readAt` + `onStale` write-guard;
|
|
12
12
|
* last-writer-wins lost-update detection.
|
|
@@ -14,8 +14,8 @@ import { z } from 'zod';
|
|
|
14
14
|
* Both the SDK (`types/streams.ts`) and the sync-server (`hub/types.ts`,
|
|
15
15
|
* `presence/*`) derive their TypeScript types from THESE schemas via
|
|
16
16
|
* `z.infer`, instead of re-declaring overlapping shapes. That collapses the
|
|
17
|
-
* field drift this surface accreted — e.g. the SDK's
|
|
18
|
-
* `status`/`error`, `onStale` declared 5×, `
|
|
17
|
+
* field drift this surface accreted — e.g. the SDK's claim view dropping
|
|
18
|
+
* `status`/`error`, `onStale` declared 5×, `ClaimStatus` declared 2× — into
|
|
19
19
|
* a single definition that the wire ingest can also validate at runtime.
|
|
20
20
|
*/
|
|
21
21
|
/** A line/column span within a text-bearing field (slide body, doc, cell). */
|
|
@@ -33,7 +33,36 @@ export declare const participantKindSchema: z.ZodEnum<{
|
|
|
33
33
|
}>;
|
|
34
34
|
export type ParticipantKind = z.infer<typeof participantKindSchema>;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Wire-tolerant participant kind for INGEST. The claim/presence streams
|
|
37
|
+
* historically labelled a non-agent participant `'human'`, while the
|
|
38
|
+
* capability/identity/lease surfaces all say `'user'` — the same participant,
|
|
39
|
+
* two dialects. This normalizes the legacy `'human'` to the canonical `'user'`
|
|
40
|
+
* on read so every consumer switches on ONE vocabulary. Producers emit
|
|
41
|
+
* canonical {@link participantKindSchema} values; this only forgives an older
|
|
42
|
+
* frame still carrying `'human'`. Additive — never widens the output union.
|
|
43
|
+
*/
|
|
44
|
+
export declare const wireParticipantKindSchema: z.ZodPreprocess<z.ZodEnum<{
|
|
45
|
+
user: "user";
|
|
46
|
+
agent: "agent";
|
|
47
|
+
system: "system";
|
|
48
|
+
}>>;
|
|
49
|
+
/**
|
|
50
|
+
* Resolve a peer's kind from an inbound presence/claim frame. Prefers the
|
|
51
|
+
* server-stamped `participantKind` (normalized via
|
|
52
|
+
* {@link wireParticipantKindSchema}); frames from servers that predate the
|
|
53
|
+
* field fall back to the lossy `isAgent` boolean — which can say 'agent' or
|
|
54
|
+
* 'user' but never 'system' (the flatten this field exists to remove).
|
|
55
|
+
*/
|
|
56
|
+
export declare function participantKindFromWire(wireKind: unknown, isAgent: boolean | undefined): ParticipantKind;
|
|
57
|
+
/**
|
|
58
|
+
* The peer-visible explanation a claim/claim carries, lifted from its opaque
|
|
59
|
+
* `meta.description`. One place for the `typeof meta?.description === 'string'`
|
|
60
|
+
* unfold that the claim/claim/presence surfaces each re-implemented — callers
|
|
61
|
+
* with an explicit `description` field still prefer it (`explicit ?? fromMeta`).
|
|
62
|
+
*/
|
|
63
|
+
export declare function descriptionFromMeta(meta: Record<string, unknown> | undefined | null): string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* What a claim / claim / activity points at. The common locator shared by
|
|
37
66
|
* all three layers — an entity, optionally narrowed to a path, range, or
|
|
38
67
|
* field, with opaque app metadata.
|
|
39
68
|
*/
|
|
@@ -82,32 +111,54 @@ export declare const writeGuardSchema: z.ZodObject<{
|
|
|
82
111
|
}, z.core.$strip>;
|
|
83
112
|
export type WriteGuard = z.infer<typeof writeGuardSchema>;
|
|
84
113
|
/**
|
|
85
|
-
* Lifecycle of an
|
|
114
|
+
* Lifecycle of an claim — the Stripe `PaymentIntent.status` shape. Absent on
|
|
86
115
|
* the wire ⇒ `'active'` (additive back-compat). The server stamps `'active'`
|
|
87
|
-
* on `
|
|
116
|
+
* on `claim_begin` and emits a single terminal frame (`committed` /
|
|
88
117
|
* `canceled` / `expired`) as the claim ends, so contenders learn *how* it
|
|
89
118
|
* resolved, not merely that it vanished.
|
|
90
119
|
*/
|
|
91
|
-
export declare const
|
|
120
|
+
export declare const claimStatusSchema: z.ZodEnum<{
|
|
92
121
|
active: "active";
|
|
93
122
|
committed: "committed";
|
|
94
123
|
expired: "expired";
|
|
95
124
|
canceled: "canceled";
|
|
96
125
|
}>;
|
|
97
|
-
export type
|
|
126
|
+
export type ClaimStatus = z.infer<typeof claimStatusSchema>;
|
|
127
|
+
export declare const wireClaimSummarySchema: z.ZodObject<{
|
|
128
|
+
field: z.ZodOptional<z.ZodString>;
|
|
129
|
+
entityType: z.ZodString;
|
|
130
|
+
entityId: z.ZodString;
|
|
131
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
132
|
+
claimId: z.ZodString;
|
|
133
|
+
action: z.ZodString;
|
|
134
|
+
declaredAt: z.ZodNumber;
|
|
135
|
+
expiresAt: z.ZodNumber;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
export type WireClaimSummary = z.infer<typeof wireClaimSummarySchema>;
|
|
98
138
|
/** Why a claim ended in a non-success terminal state. */
|
|
99
|
-
export declare const
|
|
139
|
+
export declare const claimErrorSchema: z.ZodObject<{
|
|
100
140
|
code: z.ZodString;
|
|
101
141
|
message: z.ZodOptional<z.ZodString>;
|
|
102
142
|
heldBy: z.ZodOptional<z.ZodString>;
|
|
103
|
-
|
|
143
|
+
heldByClaimId: z.ZodOptional<z.ZodString>;
|
|
104
144
|
heldByExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
heldByClaim: z.ZodOptional<z.ZodObject<{
|
|
146
|
+
field: z.ZodOptional<z.ZodString>;
|
|
147
|
+
entityType: z.ZodString;
|
|
148
|
+
entityId: z.ZodString;
|
|
149
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
150
|
+
claimId: z.ZodString;
|
|
151
|
+
action: z.ZodString;
|
|
152
|
+
declaredAt: z.ZodNumber;
|
|
153
|
+
expiresAt: z.ZodNumber;
|
|
154
|
+
}, z.core.$strip>>;
|
|
155
|
+
policyReason: z.ZodOptional<z.ZodString>;
|
|
105
156
|
}, z.core.$strip>;
|
|
106
|
-
export type
|
|
157
|
+
export type ClaimError = z.infer<typeof claimErrorSchema>;
|
|
107
158
|
/**
|
|
108
|
-
* A declared pending-mutation
|
|
109
|
-
* `
|
|
110
|
-
* `action`, and a chosen `
|
|
159
|
+
* A declared pending-mutation claim — the unit broadcast in presence
|
|
160
|
+
* `activeClaims`. Clients supply the descriptive `targetRef` fields, an
|
|
161
|
+
* `action`, and a chosen `claimId`; the SERVER stamps `declaredAt` /
|
|
111
162
|
* `expiresAt` and may set `status` / `error`.
|
|
112
163
|
*
|
|
113
164
|
* `status` and `error` are OPTIONAL: this single shape serves both the
|
|
@@ -116,7 +167,7 @@ export type IntentError = z.infer<typeof intentErrorSchema>;
|
|
|
116
167
|
* was used, so the two prior copies collapse into this one without breaking
|
|
117
168
|
* SDK consumers.
|
|
118
169
|
*/
|
|
119
|
-
export declare const
|
|
170
|
+
export declare const wireClaimSchema: z.ZodObject<{
|
|
120
171
|
entityType: z.ZodString;
|
|
121
172
|
entityId: z.ZodString;
|
|
122
173
|
path: z.ZodOptional<z.ZodString>;
|
|
@@ -128,7 +179,7 @@ export declare const intentClaimSchema: z.ZodObject<{
|
|
|
128
179
|
}, z.core.$strip>>;
|
|
129
180
|
field: z.ZodOptional<z.ZodString>;
|
|
130
181
|
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
131
|
-
|
|
182
|
+
claimId: z.ZodString;
|
|
132
183
|
action: z.ZodString;
|
|
133
184
|
declaredAt: z.ZodNumber;
|
|
134
185
|
expiresAt: z.ZodNumber;
|
|
@@ -142,18 +193,125 @@ export declare const intentClaimSchema: z.ZodObject<{
|
|
|
142
193
|
code: z.ZodString;
|
|
143
194
|
message: z.ZodOptional<z.ZodString>;
|
|
144
195
|
heldBy: z.ZodOptional<z.ZodString>;
|
|
145
|
-
|
|
196
|
+
heldByClaimId: z.ZodOptional<z.ZodString>;
|
|
146
197
|
heldByExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
198
|
+
heldByClaim: z.ZodOptional<z.ZodObject<{
|
|
199
|
+
field: z.ZodOptional<z.ZodString>;
|
|
200
|
+
entityType: z.ZodString;
|
|
201
|
+
entityId: z.ZodString;
|
|
202
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
203
|
+
claimId: z.ZodString;
|
|
204
|
+
action: z.ZodString;
|
|
205
|
+
declaredAt: z.ZodNumber;
|
|
206
|
+
expiresAt: z.ZodNumber;
|
|
207
|
+
}, z.core.$strip>>;
|
|
208
|
+
policyReason: z.ZodOptional<z.ZodString>;
|
|
147
209
|
}, z.core.$strip>>;
|
|
148
210
|
}, z.core.$strip>;
|
|
149
|
-
export type
|
|
211
|
+
export type WireClaim = z.infer<typeof wireClaimSchema>;
|
|
212
|
+
export declare const claimRejectionSchema: z.ZodObject<{
|
|
213
|
+
claimId: z.ZodString;
|
|
214
|
+
reason: z.ZodString;
|
|
215
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
216
|
+
entityType: z.ZodString;
|
|
217
|
+
entityId: z.ZodString;
|
|
218
|
+
path: z.ZodOptional<z.ZodString>;
|
|
219
|
+
range: z.ZodOptional<z.ZodObject<{
|
|
220
|
+
startLine: z.ZodNumber;
|
|
221
|
+
endLine: z.ZodNumber;
|
|
222
|
+
startColumn: z.ZodOptional<z.ZodNumber>;
|
|
223
|
+
endColumn: z.ZodOptional<z.ZodNumber>;
|
|
224
|
+
}, z.core.$strip>>;
|
|
225
|
+
field: z.ZodOptional<z.ZodString>;
|
|
226
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
227
|
+
}, z.core.$strip>>;
|
|
228
|
+
heldBy: z.ZodOptional<z.ZodString>;
|
|
229
|
+
heldByClaimId: z.ZodOptional<z.ZodString>;
|
|
230
|
+
heldByExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
231
|
+
heldByClaim: z.ZodOptional<z.ZodObject<{
|
|
232
|
+
field: z.ZodOptional<z.ZodString>;
|
|
233
|
+
entityType: z.ZodString;
|
|
234
|
+
entityId: z.ZodString;
|
|
235
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
236
|
+
claimId: z.ZodString;
|
|
237
|
+
action: z.ZodString;
|
|
238
|
+
declaredAt: z.ZodNumber;
|
|
239
|
+
expiresAt: z.ZodNumber;
|
|
240
|
+
}, z.core.$strip>>;
|
|
241
|
+
policyReason: z.ZodOptional<z.ZodString>;
|
|
242
|
+
}, z.core.$strip>;
|
|
243
|
+
export type ClaimRejection = z.infer<typeof claimRejectionSchema>;
|
|
244
|
+
/**
|
|
245
|
+
* What a {@link ModelClaim} points at — the SDK-facing target locator, keyed by
|
|
246
|
+
* `model`/`id` (the `ablo.<model>` vocabulary) rather than the wire's
|
|
247
|
+
* `entityType`/`entityId`. Structurally the public `ModelTarget`.
|
|
248
|
+
*/
|
|
249
|
+
export declare const modelTargetSchema: z.ZodReadonly<z.ZodObject<{
|
|
250
|
+
model: z.ZodString;
|
|
251
|
+
id: z.ZodString;
|
|
252
|
+
path: z.ZodOptional<z.ZodString>;
|
|
253
|
+
range: z.ZodOptional<z.ZodObject<{
|
|
254
|
+
startLine: z.ZodNumber;
|
|
255
|
+
endLine: z.ZodNumber;
|
|
256
|
+
startColumn: z.ZodOptional<z.ZodNumber>;
|
|
257
|
+
endColumn: z.ZodOptional<z.ZodNumber>;
|
|
258
|
+
}, z.core.$strip>>;
|
|
259
|
+
field: z.ZodOptional<z.ZodString>;
|
|
260
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
261
|
+
}, z.core.$strip>>;
|
|
262
|
+
export type ModelTarget = z.infer<typeof modelTargetSchema>;
|
|
263
|
+
/**
|
|
264
|
+
* A claim as surfaced to SDK callers and the HTTP claim routes
|
|
265
|
+
* (`ablo.<model>.claim.state`, `/v1/claims`) — the resolved, peer-readable
|
|
266
|
+
* view of one active or queued claim. The ONE canonical shape: the client
|
|
267
|
+
* (`Ablo.ts`) derives its `ModelClaim` from this, and the sync-server's two
|
|
268
|
+
* route copies adopt it once the engine dist is rebuilt.
|
|
269
|
+
*
|
|
270
|
+
* `expiresAt` is **epoch-ms** (a number) here — the same representation as the
|
|
271
|
+
* WS `WireClaim`, so there is ONE timestamp encoding across wire, SDK, HTTP,
|
|
272
|
+
* and errors (Stripe-style integer unix timestamps; no ISO string anywhere).
|
|
273
|
+
* `participantKind` ingests via {@link wireParticipantKindSchema} so a legacy
|
|
274
|
+
* `'human'` frame normalizes to `'user'`.
|
|
275
|
+
*/
|
|
276
|
+
export declare const modelClaimSchema: z.ZodReadonly<z.ZodObject<{
|
|
277
|
+
id: z.ZodString;
|
|
278
|
+
actor: z.ZodString;
|
|
279
|
+
participantKind: z.ZodPreprocess<z.ZodEnum<{
|
|
280
|
+
user: "user";
|
|
281
|
+
agent: "agent";
|
|
282
|
+
system: "system";
|
|
283
|
+
}>>;
|
|
284
|
+
action: z.ZodString;
|
|
285
|
+
description: z.ZodOptional<z.ZodString>;
|
|
286
|
+
field: z.ZodOptional<z.ZodString>;
|
|
287
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
288
|
+
active: "active";
|
|
289
|
+
queued: "queued";
|
|
290
|
+
}>>;
|
|
291
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
292
|
+
expiresAt: z.ZodNumber;
|
|
293
|
+
target: z.ZodReadonly<z.ZodObject<{
|
|
294
|
+
model: z.ZodString;
|
|
295
|
+
id: z.ZodString;
|
|
296
|
+
path: z.ZodOptional<z.ZodString>;
|
|
297
|
+
range: z.ZodOptional<z.ZodObject<{
|
|
298
|
+
startLine: z.ZodNumber;
|
|
299
|
+
endLine: z.ZodNumber;
|
|
300
|
+
startColumn: z.ZodOptional<z.ZodNumber>;
|
|
301
|
+
endColumn: z.ZodOptional<z.ZodNumber>;
|
|
302
|
+
}, z.core.$strip>>;
|
|
303
|
+
field: z.ZodOptional<z.ZodString>;
|
|
304
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
305
|
+
}, z.core.$strip>>;
|
|
306
|
+
}, z.core.$strip>>;
|
|
307
|
+
export type ModelClaim = z.infer<typeof modelClaimSchema>;
|
|
150
308
|
/**
|
|
151
|
-
* `
|
|
309
|
+
* `claim_begin` payload (client → server). The descriptive target + action,
|
|
152
310
|
* plus an optional duration hint and the opt-in fair-queue flag. The server
|
|
153
311
|
* stamps the lifecycle/timestamp fields, so they are NOT part of the inbound
|
|
154
312
|
* shape — this is exactly what the WS ingest validates.
|
|
155
313
|
*/
|
|
156
|
-
export declare const
|
|
314
|
+
export declare const claimBeginPayloadSchema: z.ZodObject<{
|
|
157
315
|
entityType: z.ZodString;
|
|
158
316
|
entityId: z.ZodString;
|
|
159
317
|
path: z.ZodOptional<z.ZodString>;
|
|
@@ -165,43 +323,72 @@ export declare const intentBeginPayloadSchema: z.ZodObject<{
|
|
|
165
323
|
}, z.core.$strip>>;
|
|
166
324
|
field: z.ZodOptional<z.ZodString>;
|
|
167
325
|
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
168
|
-
|
|
326
|
+
claimId: z.ZodString;
|
|
169
327
|
action: z.ZodString;
|
|
170
328
|
estimatedMs: z.ZodOptional<z.ZodNumber>;
|
|
171
329
|
queue: z.ZodOptional<z.ZodBoolean>;
|
|
172
330
|
}, z.core.$strip>;
|
|
173
|
-
export type
|
|
331
|
+
export type ClaimBeginPayload = z.infer<typeof claimBeginPayloadSchema>;
|
|
174
332
|
/**
|
|
175
|
-
* `
|
|
176
|
-
* carried so the server can DEQUEUE a still-*waiting* (not held)
|
|
177
|
-
* the FIFO line — the held-
|
|
333
|
+
* `claim_abandon` payload (client → server). `entityType`/`entityId` are
|
|
334
|
+
* carried so the server can DEQUEUE a still-*waiting* (not held) claim from
|
|
335
|
+
* the FIFO line — the held-claim path needs only `claimId`. (The previous
|
|
178
336
|
* wire type omitted these two even though the handler reads them; the schema
|
|
179
337
|
* documents what the code actually uses.)
|
|
180
338
|
*/
|
|
181
|
-
export declare const
|
|
182
|
-
|
|
339
|
+
export declare const claimAbandonPayloadSchema: z.ZodObject<{
|
|
340
|
+
claimId: z.ZodString;
|
|
183
341
|
entityType: z.ZodOptional<z.ZodString>;
|
|
184
342
|
entityId: z.ZodOptional<z.ZodString>;
|
|
185
343
|
}, z.core.$strip>;
|
|
186
|
-
export type
|
|
344
|
+
export type ClaimAbandonPayload = z.infer<typeof claimAbandonPayloadSchema>;
|
|
187
345
|
/**
|
|
188
|
-
* `
|
|
346
|
+
* `claim_reorder` payload (client → server). A privileged participant (e.g. a
|
|
189
347
|
* supervisor over its sub-agents) re-ranks the FIFO wait queue for an entity:
|
|
190
|
-
* `order` lists waiters by `heldBy`+`
|
|
348
|
+
* `order` lists waiters by `heldBy`+`claimId` in the desired priority. Waiters
|
|
191
349
|
* not listed keep their relative order behind the listed ones. The server gates
|
|
192
|
-
* who may call this; an unauthorized sender is dropped. Unlike `
|
|
350
|
+
* who may call this; an unauthorized sender is dropped. Unlike `claim_abandon`
|
|
193
351
|
* (acts on the caller's own entry), reorder acts on OTHER participants' queue
|
|
194
352
|
* positions — hence the authorization gate.
|
|
195
353
|
*/
|
|
196
|
-
export declare const
|
|
354
|
+
export declare const claimReorderPayloadSchema: z.ZodObject<{
|
|
197
355
|
entityType: z.ZodString;
|
|
198
356
|
entityId: z.ZodString;
|
|
199
357
|
order: z.ZodArray<z.ZodObject<{
|
|
200
358
|
heldBy: z.ZodString;
|
|
201
|
-
|
|
359
|
+
claimId: z.ZodString;
|
|
202
360
|
}, z.core.$strip>>;
|
|
203
361
|
}, z.core.$strip>;
|
|
204
|
-
export type
|
|
362
|
+
export type ClaimReorderPayload = z.infer<typeof claimReorderPayloadSchema>;
|
|
363
|
+
/**
|
|
364
|
+
* `update_subscription` payload (client → server). Replaces the connection's
|
|
365
|
+
* connection-level read interest with the COMPLETE set of sync groups — the
|
|
366
|
+
* READ counterpart to a claim (no write-claim, no TTL). Each entry is a
|
|
367
|
+
* {@link syncGroupInputSchema} (`'default'` or a branded `kind:id`), so a
|
|
368
|
+
* malformed group is rejected at ingest instead of being silently indexed.
|
|
369
|
+
* This is untrusted client input, so the element type is strict.
|
|
370
|
+
*/
|
|
371
|
+
export declare const updateSubscriptionPayloadSchema: z.ZodObject<{
|
|
372
|
+
syncGroups: z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"default">, z.core.$ZodBranded<z.ZodTemplateLiteral<`${string}:${string}`>, "SyncGroup", "out">]>>;
|
|
373
|
+
}, z.core.$strip>;
|
|
374
|
+
export type UpdateSubscriptionPayload = z.infer<typeof updateSubscriptionPayloadSchema>;
|
|
375
|
+
/**
|
|
376
|
+
* `subscription_ack` payload (server → client). Echoes the connection's
|
|
377
|
+
* effective read set after the update (unchanged on rejection — the update is
|
|
378
|
+
* atomic). `error` is present iff `success` is false (e.g. a scoped key
|
|
379
|
+
* requesting a group outside its grant). `syncGroups` is lenient
|
|
380
|
+
* (`z.string()`) here, not branded: it is the server's own echo for display,
|
|
381
|
+
* not untrusted input, and includes base anchors like `org:<id>`.
|
|
382
|
+
*/
|
|
383
|
+
export declare const subscriptionAckPayloadSchema: z.ZodObject<{
|
|
384
|
+
success: z.ZodBoolean;
|
|
385
|
+
syncGroups: z.ZodArray<z.ZodString>;
|
|
386
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
387
|
+
code: z.ZodString;
|
|
388
|
+
message: z.ZodString;
|
|
389
|
+
}, z.core.$strip>>;
|
|
390
|
+
}, z.core.$strip>;
|
|
391
|
+
export type SubscriptionAckPayload = z.infer<typeof subscriptionAckPayloadSchema>;
|
|
205
392
|
export declare const commitOperationTypeSchema: z.ZodEnum<{
|
|
206
393
|
CREATE: "CREATE";
|
|
207
394
|
UPDATE: "UPDATE";
|
|
@@ -238,6 +425,14 @@ export declare const commitOperationSchema: z.ZodObject<{
|
|
|
238
425
|
transactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
239
426
|
}, z.core.$strip>;
|
|
240
427
|
export type CommitOperation = z.infer<typeof commitOperationSchema>;
|
|
428
|
+
/**
|
|
429
|
+
* Any commit op on the wire — the runtime-validated ingest contract. Commit
|
|
430
|
+
* ops carry replace (last-write-wins) semantics, guarded by the optimistic
|
|
431
|
+
* `writeGuard`. Kept as a distinct alias from {@link CommitOperation} so the
|
|
432
|
+
* ingest boundary in the server reads as "any op on the wire" even though the
|
|
433
|
+
* two are currently structurally identical.
|
|
434
|
+
*/
|
|
435
|
+
export type AnyCommitOperation = CommitOperation;
|
|
241
436
|
export declare const presenceKindSchema: z.ZodEnum<{
|
|
242
437
|
enter: "enter";
|
|
243
438
|
update: "update";
|
|
@@ -263,7 +458,7 @@ export declare const presenceActivitySchema: z.ZodObject<{
|
|
|
263
458
|
export type PresenceActivity = z.infer<typeof presenceActivitySchema>;
|
|
264
459
|
/**
|
|
265
460
|
* Full `presence_update` frame as the server broadcasts it. The activity +
|
|
266
|
-
* `
|
|
461
|
+
* `activeClaims` are the observation surface for the other two layers —
|
|
267
462
|
* rendered, never acted on as enforcement.
|
|
268
463
|
*/
|
|
269
464
|
export declare const presenceUpdateFrameSchema: z.ZodObject<{
|
|
@@ -294,7 +489,12 @@ export declare const presenceUpdateFrameSchema: z.ZodObject<{
|
|
|
294
489
|
detail: z.ZodOptional<z.ZodString>;
|
|
295
490
|
}, z.core.$strip>>;
|
|
296
491
|
isAgent: z.ZodOptional<z.ZodBoolean>;
|
|
297
|
-
|
|
492
|
+
participantKind: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
|
|
493
|
+
user: "user";
|
|
494
|
+
agent: "agent";
|
|
495
|
+
system: "system";
|
|
496
|
+
}>>>;
|
|
497
|
+
activeClaims: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
298
498
|
entityType: z.ZodString;
|
|
299
499
|
entityId: z.ZodString;
|
|
300
500
|
path: z.ZodOptional<z.ZodString>;
|
|
@@ -306,7 +506,7 @@ export declare const presenceUpdateFrameSchema: z.ZodObject<{
|
|
|
306
506
|
}, z.core.$strip>>;
|
|
307
507
|
field: z.ZodOptional<z.ZodString>;
|
|
308
508
|
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
309
|
-
|
|
509
|
+
claimId: z.ZodString;
|
|
310
510
|
action: z.ZodString;
|
|
311
511
|
declaredAt: z.ZodNumber;
|
|
312
512
|
expiresAt: z.ZodNumber;
|
|
@@ -320,8 +520,19 @@ export declare const presenceUpdateFrameSchema: z.ZodObject<{
|
|
|
320
520
|
code: z.ZodString;
|
|
321
521
|
message: z.ZodOptional<z.ZodString>;
|
|
322
522
|
heldBy: z.ZodOptional<z.ZodString>;
|
|
323
|
-
|
|
523
|
+
heldByClaimId: z.ZodOptional<z.ZodString>;
|
|
324
524
|
heldByExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
525
|
+
heldByClaim: z.ZodOptional<z.ZodObject<{
|
|
526
|
+
field: z.ZodOptional<z.ZodString>;
|
|
527
|
+
entityType: z.ZodString;
|
|
528
|
+
entityId: z.ZodString;
|
|
529
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
530
|
+
claimId: z.ZodString;
|
|
531
|
+
action: z.ZodString;
|
|
532
|
+
declaredAt: z.ZodNumber;
|
|
533
|
+
expiresAt: z.ZodNumber;
|
|
534
|
+
}, z.core.$strip>>;
|
|
535
|
+
policyReason: z.ZodOptional<z.ZodString>;
|
|
325
536
|
}, z.core.$strip>>;
|
|
326
537
|
}, z.core.$strip>>>;
|
|
327
538
|
delegatedFrom: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|