@abloatai/humans 0.57.0 → 0.59.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/Ablo.d.ts +8 -18
- package/dist/client.d.ts +6 -19
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/local/Database.d.ts +1 -1
- package/dist/local/Model.js +10 -1
- package/dist/local/SyncClient.js +5 -0
- package/dist/local/client/createInternalComponents.d.ts +1 -1
- package/dist/local/client/createInternalComponents.js +1 -1
- package/dist/local/client/{createModelProxy.d.ts → createModelOperations.d.ts} +11 -10
- package/dist/local/client/{createModelProxy.js → createModelOperations.js} +240 -313
- package/dist/local/client/options.d.ts +2 -2
- package/dist/local/client/reactiveEngine.js +34 -45
- package/dist/local/client/resourceTypes.d.ts +3 -3
- package/dist/local/client/resourceTypes.js +1 -1
- package/dist/local/client/schemaConfig.js +1 -0
- package/dist/local/client/wsMutationExecutor.d.ts +4 -4
- package/dist/local/client/wsMutationExecutor.js +3 -5
- package/dist/local/coordination/ClaimLog.d.ts +3 -3
- package/dist/local/coordination/ClaimLog.js +2 -2
- package/dist/local/interfaces/index.d.ts +10 -7
- package/dist/local/mutators/mutateActions.d.ts +3 -2
- package/dist/local/query/types.d.ts +2 -2
- package/dist/local/stores/syncAction.d.ts +1 -1
- package/dist/local/stores/syncAction.js +1 -1
- package/dist/local/sync/BootstrapFetcher.js +4 -4
- package/dist/local/sync/ConnectionManager.d.ts +1 -1
- package/dist/local/sync/ConnectionManager.js +1 -1
- package/dist/local/sync/OnDemandLoader.d.ts +1 -1
- package/dist/local/sync/OnDemandLoader.js +1 -1
- package/dist/local/sync/SyncWebSocket.d.ts +3 -3
- package/dist/local/sync/SyncWebSocket.js +2 -2
- package/dist/local/sync/commitFrames.d.ts +1 -1
- package/dist/local/sync/commitFrames.js +1 -1
- package/dist/local/sync/contextOnChange.d.ts +8 -0
- package/dist/local/sync/contextOnChange.js +65 -0
- package/dist/local/sync/createClaimStream.d.ts +1 -1
- package/dist/local/sync/createClaimStream.js +47 -28
- package/dist/local/sync/credentialLifecycle.d.ts +1 -1
- package/dist/local/sync/credentialLifecycle.js +1 -1
- package/dist/local/sync/participants.d.ts +1 -1
- package/dist/local/sync/schemaDrift.d.ts +15 -1
- package/dist/local/sync/schemaDrift.js +30 -13
- package/dist/local/sync/schemas.d.ts +2 -2
- package/dist/local/sync/schemas.js +1 -1
- package/dist/local/sync/wsFrameHandlers.d.ts +1 -1
- package/dist/local/sync/wsFrameHandlers.js +1 -1
- package/dist/local/transactions/databaseCommitOutbox.d.ts +2 -2
- package/dist/local/transactions/mutations/MutationQueue.d.ts +4 -19
- package/dist/local/transactions/mutations/MutationQueue.js +5 -70
- package/dist/local/transactions/mutations/batchProcessing.d.ts +2 -13
- package/dist/local/transactions/mutations/batchProcessing.js +0 -20
- package/dist/local/transactions/mutations/commitApi.d.ts +2 -3
- package/dist/local/transactions/mutations/commitApi.js +0 -4
- package/dist/local/transactions/mutations/commitLane.d.ts +3 -8
- package/dist/local/transactions/mutations/commitLane.js +0 -11
- package/dist/local/transactions/mutations/commitPayload.d.ts +2 -4
- package/dist/local/transactions/mutations/commitPayload.js +2 -6
- package/dist/local/transactions/mutations/commitTransport.d.ts +3 -4
- package/dist/local/transactions/mutations/commitTransport.js +2 -5
- package/dist/local/transactions/mutations/durableCommitRestore.d.ts +1 -1
- package/dist/local/transactions/mutations/durableCommitRestore.js +1 -4
- package/dist/local/transactions/mutations/durableWriteStore.d.ts +5 -5
- package/dist/local/transactions/mutations/durableWriteStore.js +3 -3
- package/dist/local/transactions/mutations/failurePolicy.d.ts +2 -2
- 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/replayValidation.d.ts +0 -20
- package/dist/local/transactions/mutations/replayValidation.js +1 -3
- package/dist/local/transactions/persistedTransaction.d.ts +0 -2
- package/dist/plugin.d.ts +2 -2
- package/dist/presenceStream.d.ts +1 -1
- package/dist/react/createAbloReact.d.ts +1 -1
- package/dist/react/useAblo.d.ts +2 -2
- package/dist/react/useAblo.js +1 -1
- package/dist/surface.d.ts +1 -1
- package/dist/surface.js +1 -2
- package/package.json +2 -2
- package/src/Ablo.ts +9 -27
- package/src/client.ts +6 -22
- package/src/core.ts +1 -1
- package/src/local/Database.ts +1 -1
- package/src/local/Model.ts +12 -1
- package/src/local/SyncClient.ts +5 -0
- package/src/local/client/createInternalComponents.ts +2 -2
- package/src/local/client/{createModelProxy.ts → createModelOperations.ts} +292 -367
- package/src/local/client/options.ts +2 -2
- package/src/local/client/reactiveEngine.ts +63 -55
- package/src/local/client/resourceTypes.ts +4 -4
- package/src/local/client/schemaConfig.ts +3 -0
- package/src/local/client/wsMutationExecutor.ts +3 -9
- package/src/local/coordination/ClaimLog.ts +3 -3
- package/src/local/interfaces/index.ts +7 -7
- package/src/local/mutators/mutateActions.ts +3 -2
- package/src/local/query/types.ts +2 -2
- package/src/local/stores/syncAction.ts +1 -1
- package/src/local/sync/BootstrapFetcher.ts +5 -4
- package/src/local/sync/ConnectionManager.ts +1 -1
- package/src/local/sync/OnDemandLoader.ts +1 -1
- package/src/local/sync/SyncWebSocket.ts +3 -3
- package/src/local/sync/commitFrames.ts +1 -2
- package/src/local/sync/contextOnChange.ts +92 -0
- package/src/local/sync/createClaimStream.ts +77 -39
- package/src/local/sync/credentialLifecycle.ts +1 -1
- package/src/local/sync/participants.ts +1 -1
- package/src/local/sync/schemaDrift.ts +32 -16
- package/src/local/sync/schemas.ts +1 -1
- package/src/local/sync/wsFrameHandlers.ts +1 -1
- package/src/local/transactions/databaseCommitOutbox.ts +2 -2
- package/src/local/transactions/mutations/MutationQueue.ts +8 -95
- package/src/local/transactions/mutations/batchProcessing.ts +2 -38
- package/src/local/transactions/mutations/commitApi.ts +3 -7
- package/src/local/transactions/mutations/commitLane.ts +3 -17
- package/src/local/transactions/mutations/commitPayload.ts +3 -11
- package/src/local/transactions/mutations/commitTransport.ts +3 -7
- package/src/local/transactions/mutations/durableCommitRestore.ts +2 -5
- package/src/local/transactions/mutations/durableWriteStore.ts +5 -5
- package/src/local/transactions/mutations/failurePolicy.ts +2 -2
- 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 +1 -3
- package/src/local/transactions/persistedTransaction.ts +0 -3
- package/src/plugin.ts +2 -2
- package/src/presenceStream.ts +2 -2
- package/src/react/createAbloReact.ts +1 -1
- package/src/react/useAblo.ts +2 -2
- package/src/surface.ts +2 -3
- package/dist/local/sync/createSnapshot.d.ts +0 -29
- package/dist/local/sync/createSnapshot.js +0 -116
- package/src/local/sync/createSnapshot.ts +0 -160
package/src/client.ts
CHANGED
|
@@ -18,19 +18,21 @@ import type {
|
|
|
18
18
|
InferCreate,
|
|
19
19
|
InferRow,
|
|
20
20
|
} from '@abloatai/transaction/schema/schema';
|
|
21
|
-
import type { PresenceStream
|
|
21
|
+
import type { PresenceStream } from '@abloatai/transaction/types/streams';
|
|
22
22
|
import type { InstanceCache } from './local/InstanceCache.js';
|
|
23
23
|
import type { SyncStoreContract } from './react/context.js';
|
|
24
24
|
import type { SyncWebSocket, CoreSyncEventMap } from './local/sync/SyncWebSocket.js';
|
|
25
25
|
import type { SyncStatus } from './local/BaseSyncedStore.js';
|
|
26
|
-
import type { ModelOperations } from './local/client/
|
|
26
|
+
import type { ModelOperations } from './local/client/createModelOperations.js';
|
|
27
27
|
import type {
|
|
28
28
|
ClaimResource,
|
|
29
29
|
CommitResource,
|
|
30
30
|
CreateAgentClientParams,
|
|
31
31
|
SessionResource,
|
|
32
|
-
} from '@abloatai/transaction/resources/httpResources';
|
|
32
|
+
} from '@abloatai/transaction/client/resources/httpResources';
|
|
33
33
|
import type { EffectiveAuthority } from '@abloatai/transaction/auth';
|
|
34
|
+
import type { ReadDependency } from '@abloatai/transaction/coordination';
|
|
35
|
+
import type { CapturedRow } from '@abloatai/transaction/transport/http';
|
|
34
36
|
export type { LocalReadOptions } from './local/client/resourceTypes.js';
|
|
35
37
|
|
|
36
38
|
/** The typed sync engine client — one property per model in the schema */
|
|
@@ -310,25 +312,7 @@ export type AbloClient<S extends SchemaRecord> = {
|
|
|
310
312
|
* Canonical low-level mutation API. Every untyped model write compiles
|
|
311
313
|
* down to `commits.create(...)`.
|
|
312
314
|
*/
|
|
313
|
-
readonly commits: CommitResource
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Capture a context-staleness watermark over a set of entities.
|
|
317
|
-
* Returns a flat snapshot with `stamp` (thread into writes as
|
|
318
|
-
* `readAt`), `signal` (aborts on any captured-entity delta), and
|
|
319
|
-
* `onChange` (callback form). Reads from the engine's InstanceCache;
|
|
320
|
-
* subscription is on the engine's existing transport.
|
|
321
|
-
*
|
|
322
|
-
* Use before an LLM call to prevent the model from completing
|
|
323
|
-
* against now-stale data:
|
|
324
|
-
* ```ts
|
|
325
|
-
* const snap = engine.snapshot({ sections: report.sectionIds });
|
|
326
|
-
* await streamText({ messages, signal: snap.signal });
|
|
327
|
-
* ```
|
|
328
|
-
*/
|
|
329
|
-
snapshot<ModelName extends keyof S & string>(
|
|
330
|
-
entities: Readonly<Record<ModelName, string | readonly string[]>>,
|
|
331
|
-
): Snapshot<Schema<S>, ModelName>;
|
|
315
|
+
readonly commits: CommitResource<ReadDependency | CapturedRow>;
|
|
332
316
|
|
|
333
317
|
/**
|
|
334
318
|
* Subscribe to pushed frames — deltas, presence updates, claim grants and
|
package/src/core.ts
CHANGED
|
@@ -92,7 +92,7 @@ export {
|
|
|
92
92
|
export {
|
|
93
93
|
awaitClaimGrant,
|
|
94
94
|
type GrantTransport,
|
|
95
|
-
} from '@abloatai/transaction/
|
|
95
|
+
} from '@abloatai/transaction/claims';
|
|
96
96
|
|
|
97
97
|
// An enum naming the strategies for loading a model's data. Referenced when
|
|
98
98
|
// registering models in extension code.
|
package/src/local/Database.ts
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import type { BootstrapFetcher, BootstrapData } from './sync/BootstrapFetcher.js';
|
|
22
22
|
import { InMemoryObjectStore } from './adapters/inMemoryStorage.js';
|
|
23
23
|
import { logPositionSnapshotSchema } from './logPosition.js';
|
|
24
|
-
import type { SyncDeltaAction } from '@abloatai/transaction/
|
|
24
|
+
import type { SyncDeltaAction } from '@abloatai/transaction/observation';
|
|
25
25
|
import type { BootstrapType } from '@abloatai/transaction/types';
|
|
26
26
|
import { highestPersistedPrefixSyncId } from './sync/persistedPrefix.js';
|
|
27
27
|
import {
|
package/src/local/Model.ts
CHANGED
|
@@ -281,7 +281,18 @@ export abstract class Model {
|
|
|
281
281
|
* Track property changes
|
|
282
282
|
*/
|
|
283
283
|
propertyChanged(propertyName: string, oldValue: unknown, newValue: unknown): void {
|
|
284
|
-
|
|
284
|
+
// `createdAt` and `updatedAt` are server-managed bookkeeping, not
|
|
285
|
+
// user-authored model changes. In particular, every real field change
|
|
286
|
+
// advances `updatedAt` below. When a schema explicitly declares that
|
|
287
|
+
// timestamp, MobX observes the assignment and calls this method again;
|
|
288
|
+
// treating that callback as another edit recursively stamps `updatedAt`
|
|
289
|
+
// until the stack overflows. Ignore both timestamps at this boundary so
|
|
290
|
+
// they remain observable without entering the mutation payload.
|
|
291
|
+
if (
|
|
292
|
+
oldValue === newValue ||
|
|
293
|
+
propertyName === 'createdAt' ||
|
|
294
|
+
propertyName === 'updatedAt'
|
|
295
|
+
) return;
|
|
285
296
|
|
|
286
297
|
runInAction(() => {
|
|
287
298
|
// Preserve the earliest captured `old` for this field until the entry
|
package/src/local/SyncClient.ts
CHANGED
|
@@ -1489,6 +1489,11 @@ export class SyncClient extends EventEmitter {
|
|
|
1489
1489
|
dispose(): void {
|
|
1490
1490
|
this.isDisposed = true;
|
|
1491
1491
|
this.disconnect();
|
|
1492
|
+
// The queue owns commit retry, replication-lag, offline-grace, and
|
|
1493
|
+
// per-mutation timers. A disposed client must release those resources too;
|
|
1494
|
+
// otherwise an atomic commit can keep a worker process alive after the
|
|
1495
|
+
// public client has been disposed.
|
|
1496
|
+
this.mutationQueue.dispose();
|
|
1492
1497
|
this.networkMonitor.dispose();
|
|
1493
1498
|
this.observers.clear();
|
|
1494
1499
|
this.pendingStages.clear();
|
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
import type {
|
|
26
26
|
DurableWriteStore,
|
|
27
27
|
DurableWritesConfig,
|
|
28
|
-
} from '@abloatai/transaction/
|
|
28
|
+
} from '@abloatai/transaction/commit';
|
|
29
29
|
import type { RuntimeContext } from '../RuntimeContext.js';
|
|
30
30
|
import { globalRuntime } from '../context.js';
|
|
31
|
-
import { resolveDurableWrites } from '@abloatai/transaction/
|
|
31
|
+
import { resolveDurableWrites } from '@abloatai/transaction/commit';
|
|
32
32
|
|
|
33
33
|
export interface InternalComponentsInput<S extends SchemaRecord> {
|
|
34
34
|
readonly schema: Schema<S>;
|