@abloatai/humans 0.47.0 → 0.49.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/dist/client.d.ts +6 -0
- package/dist/humans.d.ts +1 -1
- package/dist/local/BaseSyncedStore.d.ts +1 -1
- package/dist/local/Database.js +1 -1
- package/dist/local/RuntimeContext.d.ts +1 -1
- package/dist/local/SyncClient.d.ts +1 -1
- package/dist/local/SyncClient.js +3 -3
- package/dist/local/client/createModelProxy.d.ts +7 -1
- package/dist/local/client/createModelProxy.js +146 -39
- package/dist/local/client/options.d.ts +2 -2
- package/dist/local/client/reactiveEngine.js +64 -7
- package/dist/local/client/resourceTypes.d.ts +1 -1
- package/dist/local/client/resourceTypes.js +1 -1
- package/dist/local/client/storeCluster.d.ts +3 -0
- package/dist/local/client/storeCluster.js +4 -2
- package/dist/local/client/storeLifecycle.d.ts +2 -0
- package/dist/local/client/storeLifecycle.js +1 -0
- package/dist/local/client/wsMutationExecutor.d.ts +4 -1
- package/dist/local/client/wsMutationExecutor.js +26 -2
- package/dist/local/context.js +5 -1
- package/dist/local/interfaces/index.d.ts +3 -1
- package/dist/local/mutators/UndoManager.d.ts +1 -1
- package/dist/local/mutators/UndoManager.js +1 -1
- package/dist/local/query/client.js +15 -0
- package/dist/local/query/types.d.ts +14 -0
- package/dist/local/stores/syncAction.d.ts +1 -1
- package/dist/local/stores/syncAction.js +1 -1
- package/dist/local/sync/ConnectionManager.d.ts +1 -1
- package/dist/local/sync/ConnectionManager.js +1 -1
- package/dist/local/sync/OnDemandLoader.d.ts +3 -0
- package/dist/local/sync/OnDemandLoader.js +15 -2
- package/dist/local/sync/SyncWebSocket.d.ts +1 -1
- package/dist/local/sync/SyncWebSocket.js +1 -1
- package/dist/local/sync/commitFrames.d.ts +1 -1
- package/dist/local/sync/commitFrames.js +1 -1
- package/dist/local/sync/contextPorts.d.ts +1 -1
- package/dist/local/sync/contextPorts.js +1 -1
- package/dist/local/sync/credentialLifecycle.d.ts +1 -1
- package/dist/local/sync/credentialLifecycle.js +1 -1
- package/dist/local/sync/initialize.js +2 -2
- package/dist/local/sync/wsFrameHandlers.d.ts +1 -1
- package/dist/local/sync/wsFrameHandlers.js +1 -1
- package/dist/local/transactions/databaseCommitOutbox.d.ts +1 -1
- package/dist/local/transactions/localMutation.d.ts +1 -1
- package/dist/local/transactions/localMutation.js +1 -1
- package/dist/local/transactions/mutations/MutationQueue.d.ts +2 -2
- package/dist/local/transactions/mutations/MutationQueue.js +4 -4
- package/dist/local/transactions/mutations/batchProcessing.d.ts +1 -1
- package/dist/local/transactions/mutations/commitApi.d.ts +1 -1
- package/dist/local/transactions/mutations/commitLane.d.ts +1 -1
- package/dist/local/transactions/mutations/commitPayload.d.ts +2 -1
- package/dist/local/transactions/mutations/commitPayload.js +8 -0
- package/dist/local/transactions/mutations/commitTransport.d.ts +1 -1
- package/dist/local/transactions/mutations/commitTransport.js +1 -1
- package/dist/local/transactions/mutations/durableCommitRestore.d.ts +1 -1
- package/dist/local/transactions/mutations/durableCommitRestore.js +1 -1
- package/dist/local/transactions/mutations/durableWriteStore.d.ts +4 -4
- package/dist/local/transactions/mutations/durableWriteStore.js +3 -3
- package/dist/local/transactions/mutations/localMutation.d.ts +1 -1
- package/dist/local/transactions/mutations/mutationPersistence.d.ts +1 -1
- package/dist/local/transactions/mutations/pendingDrain.d.ts +2 -2
- package/dist/local/transactions/mutations/pendingDrain.js +1 -1
- package/dist/local/transactions/mutations/replayValidation.d.ts +13 -1
- package/dist/local/transactions/mutations/replayValidation.js +3 -2
- package/dist/local/transactions/reconnectDrain.d.ts +1 -1
- package/dist/react/useSyncStatus.d.ts +1 -1
- package/dist/react/useSyncStatus.js +1 -1
- package/package.json +2 -2
- package/src/Ablo.ts +1 -1
- package/src/client.ts +7 -0
- package/src/humans.ts +1 -1
- package/src/local/BaseSyncedStore.ts +1 -1
- package/src/local/Database.ts +1 -1
- package/src/local/RuntimeContext.ts +1 -1
- package/src/local/SyncClient.ts +3 -3
- package/src/local/client/createModelProxy.ts +236 -55
- package/src/local/client/options.ts +2 -2
- package/src/local/client/reactiveEngine.ts +75 -4
- package/src/local/client/resourceTypes.ts +1 -1
- package/src/local/client/storeCluster.ts +12 -2
- package/src/local/client/storeLifecycle.ts +3 -0
- package/src/local/client/wsMutationExecutor.ts +43 -1
- package/src/local/context.ts +5 -1
- package/src/local/interfaces/index.ts +7 -5
- package/src/local/mutators/UndoManager.ts +1 -1
- package/src/local/query/client.ts +17 -0
- package/src/local/query/types.ts +16 -1
- package/src/local/stores/syncAction.ts +1 -1
- package/src/local/sync/ConnectionManager.ts +1 -1
- package/src/local/sync/OnDemandLoader.ts +20 -3
- package/src/local/sync/SyncWebSocket.ts +1 -1
- package/src/local/sync/commitFrames.ts +1 -1
- package/src/local/sync/contextPorts.ts +1 -1
- package/src/local/sync/credentialLifecycle.ts +1 -1
- package/src/local/sync/initialize.ts +2 -2
- package/src/local/sync/wsFrameHandlers.ts +1 -1
- package/src/local/transactions/databaseCommitOutbox.ts +1 -1
- package/src/local/transactions/localMutation.ts +1 -1
- package/src/local/transactions/mutations/MutationQueue.ts +4 -4
- package/src/local/transactions/mutations/batchProcessing.ts +1 -1
- package/src/local/transactions/mutations/commitApi.ts +1 -1
- package/src/local/transactions/mutations/commitLane.ts +1 -1
- package/src/local/transactions/mutations/commitPayload.ts +10 -1
- package/src/local/transactions/mutations/commitTransport.ts +1 -1
- package/src/local/transactions/mutations/durableCommitRestore.ts +2 -2
- package/src/local/transactions/mutations/durableWriteStore.ts +4 -4
- package/src/local/transactions/mutations/localMutation.ts +1 -1
- package/src/local/transactions/mutations/mutationPersistence.ts +1 -1
- package/src/local/transactions/mutations/pendingDrain.ts +2 -2
- package/src/local/transactions/mutations/replayValidation.ts +3 -2
- package/src/local/transactions/reconnectDrain.ts +1 -1
- package/src/react/useSyncStatus.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbloConnectionError, AbloError, AbloIdempotencyError, } from '@abloatai/transaction/errors';
|
|
2
2
|
import { mutationCommitResultSchema, } from '@abloatai/transaction/wire/commit';
|
|
3
|
-
import { createDurableCommitEnvelope, commitEnvelopeRecordId, durableCommitEnvelopeSchema, } from '@abloatai/transaction/transactions/
|
|
3
|
+
import { createDurableCommitEnvelope, commitEnvelopeRecordId, durableCommitEnvelopeSchema, } from '@abloatai/transaction/transactions/confirmation/commitEnvelope';
|
|
4
4
|
export async function sealDurableCommit(ctx, input, pendingMutationRecordId) {
|
|
5
5
|
const sourceMutationIds = [...new Set(input.sourceMutationIds ?? [])];
|
|
6
6
|
const envelope = createDurableCommitEnvelope({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RuntimeContext } from '../../RuntimeContext.js';
|
|
2
2
|
import type { CommitTransaction } from './commitLane.js';
|
|
3
|
-
import type { CommitOutboxScope } from '@abloatai/transaction/transactions/
|
|
3
|
+
import type { CommitOutboxScope } from '@abloatai/transaction/transactions/confirmation/commitEnvelope';
|
|
4
4
|
import type { DurableWriteStore } from './durableWriteStore.js';
|
|
5
5
|
export interface DurableCommitRestoreContext {
|
|
6
6
|
readonly config: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbloIdempotencyError, AbloValidationError } from '@abloatai/transaction/errors';
|
|
2
|
-
import { durableCommitEnvelopeSchema } from '@abloatai/transaction/transactions/
|
|
2
|
+
import { durableCommitEnvelopeSchema } from '@abloatai/transaction/transactions/confirmation/commitEnvelope';
|
|
3
3
|
export async function restoreDurableCommits(ctx) {
|
|
4
4
|
if (!ctx.config.enablePersistence)
|
|
5
5
|
return new Set();
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The durable-write port moved to the
|
|
2
|
+
* The durable-write port moved to the confirmation core (ADR 0016): it is a
|
|
3
3
|
* contract over commit envelopes and holds no local rows. Re-exported here so
|
|
4
4
|
* the existing `transactions/mutations/durableWriteStore` import path keeps
|
|
5
5
|
* resolving for the queue, the outbox, and the client options.
|
|
6
6
|
*
|
|
7
7
|
* The port and its config live in the core's `durableWrites` module (a behavior
|
|
8
8
|
* contract, not a persisted shape); the records that cross it are owned by
|
|
9
|
-
* `transactions/
|
|
9
|
+
* `transactions/confirmation/pendingWrite`.
|
|
10
10
|
*/
|
|
11
11
|
export { durableWriteStoreSchema, durableWritesConfigSchema, } from '@abloatai/transaction/durableWrites';
|
|
12
12
|
export type { DurableWriteStore, DurableWritesConfig, } from '@abloatai/transaction/durableWrites';
|
|
13
|
-
export { pendingWriteSchema } from '@abloatai/transaction/transactions/
|
|
14
|
-
export type { PendingWrite } from '@abloatai/transaction/transactions/
|
|
13
|
+
export { pendingWriteSchema } from '@abloatai/transaction/transactions/confirmation/pendingWrite';
|
|
14
|
+
export type { PendingWrite } from '@abloatai/transaction/transactions/confirmation/pendingWrite';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The durable-write port moved to the
|
|
2
|
+
* The durable-write port moved to the confirmation core (ADR 0016): it is a
|
|
3
3
|
* contract over commit envelopes and holds no local rows. Re-exported here so
|
|
4
4
|
* the existing `transactions/mutations/durableWriteStore` import path keeps
|
|
5
5
|
* resolving for the queue, the outbox, and the client options.
|
|
6
6
|
*
|
|
7
7
|
* The port and its config live in the core's `durableWrites` module (a behavior
|
|
8
8
|
* contract, not a persisted shape); the records that cross it are owned by
|
|
9
|
-
* `transactions/
|
|
9
|
+
* `transactions/confirmation/pendingWrite`.
|
|
10
10
|
*/
|
|
11
11
|
export { durableWriteStoreSchema, durableWritesConfigSchema, } from '@abloatai/transaction/durableWrites';
|
|
12
|
-
export { pendingWriteSchema } from '@abloatai/transaction/transactions/
|
|
12
|
+
export { pendingWriteSchema } from '@abloatai/transaction/transactions/confirmation/pendingWrite';
|
|
@@ -26,7 +26,7 @@ export interface OptimisticUpdateEntry {
|
|
|
26
26
|
export interface OptimisticEmitter {
|
|
27
27
|
emit(event: string, payload: unknown): void;
|
|
28
28
|
}
|
|
29
|
-
/** Materializer capability consumed by
|
|
29
|
+
/** Materializer capability consumed by confirmation; implementation belongs to the local layer. */
|
|
30
30
|
export interface LocalMutationPort {
|
|
31
31
|
readonly updates: Map<string, OptimisticUpdateEntry>;
|
|
32
32
|
applyCreate(model: Model, transaction: QueuedMutation): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RuntimeContext } from '../../RuntimeContext.js';
|
|
2
2
|
import type { MutationPersistencePort } from '../../mutationPersistence.js';
|
|
3
3
|
import type { MutationQueueConfig } from './MutationQueue.js';
|
|
4
|
-
import type { CommitOutboxScope } from '@abloatai/transaction/transactions/
|
|
4
|
+
import type { CommitOutboxScope } from '@abloatai/transaction/transactions/confirmation/commitEnvelope';
|
|
5
5
|
import type { QueuedMutation } from './commitPayload.js';
|
|
6
6
|
import { MutationStore } from './MutationStore.js';
|
|
7
7
|
import { deserializePersistedTransaction } from './replayValidation.js';
|
|
@@ -3,7 +3,7 @@ import type { QueuedMutation } from './commitPayload.js';
|
|
|
3
3
|
import type { MutationStore } from './MutationStore.js';
|
|
4
4
|
import type { OptimisticUpdateEntry } from './localMutation.js';
|
|
5
5
|
import type { MutationCommitResult } from '@abloatai/transaction/wire/commit';
|
|
6
|
-
import type { DurableCommitEnvelope } from '@abloatai/transaction/transactions/
|
|
6
|
+
import type { DurableCommitEnvelope } from '@abloatai/transaction/transactions/confirmation/commitEnvelope';
|
|
7
7
|
export interface PendingDrainContext {
|
|
8
8
|
readonly runtime: RuntimeContext;
|
|
9
9
|
readonly config: {
|
|
@@ -30,4 +30,4 @@ export interface PendingDrainContext {
|
|
|
30
30
|
readonly recentDeltaCorrelations: Map<string, number>;
|
|
31
31
|
readonly emit: (event: string, payload: object) => boolean;
|
|
32
32
|
}
|
|
33
|
-
export declare function
|
|
33
|
+
export declare function drainPendingConfirmations(ctx: PendingDrainContext): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { applyWriteOptions, TX_TYPE_TO_MUTATION_OP } from './commitPayload.js';
|
|
2
|
-
export async function
|
|
2
|
+
export async function drainPendingConfirmations(ctx) {
|
|
3
3
|
ctx.assertDurableReplayOpen();
|
|
4
4
|
// Kick the commit lane too: atomic envelopes from `commits.create()` may
|
|
5
5
|
// have been left at the head of the lane while the connection was down.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Rows read back from the on-disk transaction store may have been written by an
|
|
5
5
|
* earlier run — possibly by an older version of this package, possibly
|
|
6
6
|
* corrupted. Rather than trust them, the schemas here validate exactly the
|
|
7
|
-
* fields the
|
|
7
|
+
* fields the confirmation queue and the local journal restore read during
|
|
8
8
|
* replay. A row that fails to parse is dropped and reported, never replayed as
|
|
9
9
|
* a malformed commit.
|
|
10
10
|
*
|
|
@@ -64,6 +64,9 @@ export declare const persistedTransactionSchema: z.ZodObject<{
|
|
|
64
64
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
65
65
|
label: z.ZodOptional<z.ZodString>;
|
|
66
66
|
fenceToken: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
67
|
+
claimRef: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
68
|
+
id: z.ZodString;
|
|
69
|
+
}, z.core.$strip>]>>>;
|
|
67
70
|
}, z.core.$loose>>;
|
|
68
71
|
localOnly: z.ZodOptional<z.ZodBoolean>;
|
|
69
72
|
}, z.core.$loose>;
|
|
@@ -107,6 +110,9 @@ export declare const persistedMutationSchema: z.ZodObject<{
|
|
|
107
110
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
108
111
|
label: z.ZodOptional<z.ZodString>;
|
|
109
112
|
fenceToken: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
113
|
+
claimRef: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
}, z.core.$strip>]>>>;
|
|
110
116
|
}, z.core.$loose>>;
|
|
111
117
|
}, z.core.$loose>;
|
|
112
118
|
export type PersistedQueuedMutation = z.infer<typeof persistedMutationSchema>;
|
|
@@ -143,6 +149,9 @@ export declare const legacyPendingMutationRecordSchema: z.ZodObject<{
|
|
|
143
149
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
144
150
|
label: z.ZodOptional<z.ZodString>;
|
|
145
151
|
fenceToken: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
152
|
+
claimRef: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
153
|
+
id: z.ZodString;
|
|
154
|
+
}, z.core.$strip>]>>>;
|
|
146
155
|
}, z.core.$loose>>;
|
|
147
156
|
mutationId: z.ZodString;
|
|
148
157
|
}, z.core.$loose>;
|
|
@@ -178,6 +187,9 @@ export declare const pendingMutationRecordSchema: z.ZodObject<{
|
|
|
178
187
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
179
188
|
label: z.ZodOptional<z.ZodString>;
|
|
180
189
|
fenceToken: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
190
|
+
claimRef: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
191
|
+
id: z.ZodString;
|
|
192
|
+
}, z.core.$strip>]>>>;
|
|
181
193
|
}, z.core.$loose>>;
|
|
182
194
|
mutationId: z.ZodString;
|
|
183
195
|
}, z.core.$loose>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Rows read back from the on-disk transaction store may have been written by an
|
|
5
5
|
* earlier run — possibly by an older version of this package, possibly
|
|
6
6
|
* corrupted. Rather than trust them, the schemas here validate exactly the
|
|
7
|
-
* fields the
|
|
7
|
+
* fields the confirmation queue and the local journal restore read during
|
|
8
8
|
* replay. A row that fails to parse is dropped and reported, never replayed as
|
|
9
9
|
* a malformed commit.
|
|
10
10
|
*
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { z } from 'zod';
|
|
18
18
|
import { computePriorityScore, normalizeModelKey } from './commitPayload.js';
|
|
19
19
|
import { globalRuntime } from '../../context.js';
|
|
20
|
-
import { commitEnvelopeMemberSchema, commitOutboxScopeSchema, } from '@abloatai/transaction/transactions/
|
|
20
|
+
import { commitEnvelopeMemberSchema, commitOutboxScopeSchema, } from '@abloatai/transaction/transactions/confirmation/commitEnvelope';
|
|
21
21
|
import { onStaleModeSchema } from '@abloatai/transaction/coordination/schema';
|
|
22
22
|
/** The subset of a write's options that is stored with each transaction or queued mutation. */
|
|
23
23
|
const persistedWriteOptionsSchema = z
|
|
@@ -32,6 +32,7 @@ const persistedWriteOptionsSchema = z
|
|
|
32
32
|
// write. Declared (not just loose-passthrough) so it is validated as a
|
|
33
33
|
// number on rehydration.
|
|
34
34
|
fenceToken: z.number().nullable().optional(),
|
|
35
|
+
claimRef: z.union([z.string().min(1), z.object({ id: z.string().min(1) })]).nullable().optional(),
|
|
35
36
|
})
|
|
36
37
|
.loose();
|
|
37
38
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Human-side reconnect adapter.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
4
|
+
* The confirmation callback owns ordering and receipts. This adapter owns the
|
|
5
5
|
* local client's reconnect concurrency: repeated online/connect signals join
|
|
6
6
|
* the same drain instead of starting competing local recovery passes.
|
|
7
7
|
*/
|
|
@@ -15,5 +15,5 @@ export type SyncStatusSnapshot = {
|
|
|
15
15
|
} | {
|
|
16
16
|
readonly name: 'needs-auth';
|
|
17
17
|
};
|
|
18
|
-
/** Reactively exposes the local store's connection and
|
|
18
|
+
/** Reactively exposes the local store's connection and confirmation status. */
|
|
19
19
|
export declare function useSyncStatus(): SyncStatusSnapshot;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { useSyncContext, } from './context.js';
|
|
4
4
|
import { useReactive } from '../useReactive.js';
|
|
5
|
-
/** Reactively exposes the local store's connection and
|
|
5
|
+
/** Reactively exposes the local store's connection and confirmation status. */
|
|
6
6
|
export function useSyncStatus() {
|
|
7
7
|
const { store } = useSyncContext();
|
|
8
8
|
const compute = useCallback(() => deriveStatus(store), [store]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abloatai/humans",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"description": "The optional human-facing local-state package for Ablo: presence, live queries, and React bindings.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"directory": "packages/humans"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@abloatai/transaction": "^0.
|
|
87
|
+
"@abloatai/transaction": "^0.49.0",
|
|
88
88
|
"mobx": "^6.13.7",
|
|
89
89
|
"uuid": "^11.1.0",
|
|
90
90
|
"zod": "^4.4.3"
|
package/src/Ablo.ts
CHANGED
|
@@ -64,7 +64,7 @@ export type {
|
|
|
64
64
|
} from './local/client/options.js';
|
|
65
65
|
export type { AbloReads } from './client.js';
|
|
66
66
|
// `ModelTarget` (the model/id locator) and `ModelClaim` (the resolved claim
|
|
67
|
-
// view) are defined once in the
|
|
67
|
+
// view) are defined once in the confirmation core, derived from a single zod
|
|
68
68
|
// schema so the typed client, the HTTP client, and the server share one
|
|
69
69
|
// definition. They reach consumers through `./resourceTypes` with the rest of
|
|
70
70
|
// the resource surface; re-exported here so `ablo.ModelTarget` and
|
package/src/client.ts
CHANGED
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
CreateAgentClientParams,
|
|
31
31
|
SessionResource,
|
|
32
32
|
} from '@abloatai/transaction/resources/httpResources';
|
|
33
|
+
import type { EffectiveAuthority } from '@abloatai/transaction/auth';
|
|
33
34
|
export type { LocalReadOptions } from './local/client/resourceTypes.js';
|
|
34
35
|
|
|
35
36
|
/** The typed sync engine client — one property per model in the schema */
|
|
@@ -182,6 +183,12 @@ export type AbloClient<S extends SchemaRecord> = {
|
|
|
182
183
|
*/
|
|
183
184
|
readonly organizationId: string | null;
|
|
184
185
|
|
|
186
|
+
/**
|
|
187
|
+
* The effective authority of this running participant, confirmed by the
|
|
188
|
+
* server credential exchange/identity endpoint. `null` until `ready()`.
|
|
189
|
+
*/
|
|
190
|
+
readonly identity: EffectiveAuthority | null;
|
|
191
|
+
|
|
185
192
|
/**
|
|
186
193
|
* Destroy every IndexedDB database owned by this engine. Disconnects
|
|
187
194
|
* the WebSocket, releases timers, and deletes all `ablo_*` / `ablo-*`
|
package/src/humans.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Public human-facing local-state capability.
|
|
3
3
|
*
|
|
4
4
|
* The plugin and its local-state runtime belong to @abloatai/humans. The
|
|
5
|
-
* shared
|
|
5
|
+
* shared confirmation package supplies only the handoff identity and wire
|
|
6
6
|
* contracts.
|
|
7
7
|
*/
|
|
8
8
|
import type { AbloPlugin, PluginContext, AppliedChange } from './plugin.js';
|
|
@@ -178,7 +178,7 @@ export interface UserContext {
|
|
|
178
178
|
* - `'none'`: open the WebSocket and process live deltas only.
|
|
179
179
|
* Reads go through `model.get()` / filtered subscriptions
|
|
180
180
|
* backfilled by `Covering` deltas. Suitable for transactional
|
|
181
|
-
* participants —
|
|
181
|
+
* participants — headless workers, video pipelines, routine runners —
|
|
182
182
|
* that don't need a local replica of the org's tenant plane.
|
|
183
183
|
*/
|
|
184
184
|
bootstrapMode?: 'full' | 'none';
|
package/src/local/Database.ts
CHANGED
|
@@ -1125,7 +1125,7 @@ export class Database {
|
|
|
1125
1125
|
// ── inMemory short-circuit ───────────────────────────────────────
|
|
1126
1126
|
//
|
|
1127
1127
|
// The batched IDB transaction path below assumes `this.storeManager`
|
|
1128
|
-
// and `workspaceDb`. In inMemory mode (
|
|
1128
|
+
// and `workspaceDb`. In inMemory mode (headless workers, tests) those
|
|
1129
1129
|
// don't exist. Without this branch, every live delta arriving over
|
|
1130
1130
|
// the WebSocket is silently dropped — the local pool never updates,
|
|
1131
1131
|
// `subscribe()` autoruns never re-fire, lazy-model dispatchers
|
|
@@ -48,7 +48,7 @@ export interface RuntimeContext {
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Model metadata lookup. Injected by the client (it wires this from its
|
|
51
|
-
* `ModelRegistry`) so the
|
|
51
|
+
* `ModelRegistry`) so the confirmation core can resolve a model's metadata
|
|
52
52
|
* without importing the registry — the dependency inversion that keeps the
|
|
53
53
|
* core free of the client's `Model` layer (ADR 0013).
|
|
54
54
|
*/
|
package/src/local/SyncClient.ts
CHANGED
|
@@ -1280,7 +1280,7 @@ export class SyncClient extends EventEmitter {
|
|
|
1280
1280
|
if (this.pendingStages.size > 0) {
|
|
1281
1281
|
await Promise.all([...this.pendingStages]);
|
|
1282
1282
|
}
|
|
1283
|
-
await this.
|
|
1283
|
+
await this.drainPendingConfirmations();
|
|
1284
1284
|
}
|
|
1285
1285
|
|
|
1286
1286
|
/**
|
|
@@ -1511,7 +1511,7 @@ export class SyncClient extends EventEmitter {
|
|
|
1511
1511
|
// Browser online state may have marked the client connected before the
|
|
1512
1512
|
// WebSocket itself was ready. Always kick both durable lanes on the real
|
|
1513
1513
|
// socket event, even when the high-level state did not change.
|
|
1514
|
-
void this.
|
|
1514
|
+
void this.drainPendingConfirmations().catch((error: unknown) => {
|
|
1515
1515
|
this.runtime.observability.captureMutationFailure({
|
|
1516
1516
|
context: 'restore-commit-outbox',
|
|
1517
1517
|
error: error instanceof Error ? error : new Error(String(error)),
|
|
@@ -1520,7 +1520,7 @@ export class SyncClient extends EventEmitter {
|
|
|
1520
1520
|
void this.processPendingMutations();
|
|
1521
1521
|
}
|
|
1522
1522
|
|
|
1523
|
-
private
|
|
1523
|
+
private drainPendingConfirmations(): Promise<void> {
|
|
1524
1524
|
return this.reconnectDrain.drain(() => this.mutationQueue.drainPending());
|
|
1525
1525
|
}
|
|
1526
1526
|
|