@abloatai/ablo 0.34.1 → 0.35.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/AGENTS.md +2 -1
- package/CHANGELOG.md +674 -5
- package/README.md +39 -22
- package/dist/BaseSyncedStore.d.ts +152 -44
- package/dist/BaseSyncedStore.js +300 -184
- package/dist/Database.d.ts +9 -24
- package/dist/Database.js +37 -22
- package/dist/InstanceCache.d.ts +25 -4
- package/dist/InstanceCache.js +48 -15
- package/dist/LazyReferenceCollection.d.ts +3 -3
- package/dist/LazyReferenceCollection.js +4 -4
- package/dist/Model.d.ts +6 -6
- package/dist/Model.js +10 -10
- package/dist/ModelRegistry.d.ts +4 -4
- package/dist/ModelRegistry.js +3 -3
- package/dist/{SyncEngineContext.d.ts → RuntimeContext.d.ts} +20 -13
- package/dist/{SyncEngineContext.js → RuntimeContext.js} +11 -12
- package/dist/SyncClient.d.ts +42 -32
- package/dist/SyncClient.js +166 -110
- package/dist/ai-sdk/coordinatedTool.d.ts +2 -2
- package/dist/ai-sdk/coordinatedTool.js +1 -1
- package/dist/ai-sdk/coordinationContext.d.ts +2 -2
- package/dist/ai-sdk/coordinationContext.js +1 -1
- package/dist/ai-sdk/wrap.d.ts +3 -3
- package/dist/ai-sdk/wrap.js +2 -2
- package/dist/auth/index.d.ts +1 -156
- package/dist/auth/index.js +8 -301
- package/dist/cli.cjs +3344 -1073
- package/dist/client/Ablo.d.ts +42 -287
- package/dist/client/Ablo.js +118 -963
- package/dist/client/abloClient.d.ts +309 -0
- package/dist/client/abloClient.js +13 -0
- package/dist/client/clientPrelude.d.ts +52 -0
- package/dist/client/clientPrelude.js +60 -0
- package/dist/client/consoleLogger.d.ts +2 -2
- package/dist/client/coreClient.d.ts +60 -0
- package/dist/client/coreClient.js +118 -0
- package/dist/client/createInternalComponents.d.ts +4 -4
- package/dist/client/createInternalComponents.js +9 -8
- package/dist/client/createModelProxy.d.ts +78 -373
- package/dist/client/createModelProxy.js +114 -86
- package/dist/client/humans.d.ts +48 -0
- package/dist/client/humans.js +52 -0
- package/dist/client/modelRegistration.d.ts +1 -1
- package/dist/client/modelRegistration.js +9 -9
- package/dist/client/options.d.ts +73 -17
- package/dist/client/reactiveEngine.d.ts +48 -0
- package/dist/client/reactiveEngine.js +910 -0
- package/dist/client/resourceTypes.d.ts +9 -250
- package/dist/client/resourceTypes.js +8 -5
- package/dist/client/schemaConfig.d.ts +4 -4
- package/dist/client/schemaConfig.js +6 -2
- package/dist/client/validateAbloOptions.d.ts +3 -2
- package/dist/client/validateAbloOptions.js +1 -1
- package/dist/client/wsMutationExecutor.d.ts +3 -3
- package/dist/client/wsMutationExecutor.js +3 -3
- package/dist/context.d.ts +9 -9
- package/dist/context.js +10 -9
- package/dist/coordination/ClaimLog.d.ts +26 -0
- package/dist/coordination/ClaimLog.js +32 -0
- package/dist/coordination/index.d.ts +1 -15
- package/dist/coordination/index.js +8 -31
- package/dist/core/DatabaseManager.js +1 -1
- package/dist/core/QueryView.d.ts +1 -1
- package/dist/core/QueryView.js +1 -1
- package/dist/core/StoreManager.d.ts +4 -23
- package/dist/core/StoreManager.js +5 -55
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/core/storeContract.d.ts +2 -2
- package/dist/docs/catalog.d.ts +72 -0
- package/dist/docs/catalog.js +227 -0
- package/dist/docs/index.d.ts +10 -0
- package/dist/docs/index.js +10 -0
- package/dist/environment.d.ts +1 -40
- package/dist/environment.js +8 -37
- package/dist/index.d.ts +40 -34
- package/dist/index.js +26 -20
- package/dist/interfaces/index.d.ts +44 -134
- package/dist/keys/index.d.ts +1 -77
- package/dist/keys/index.js +8 -190
- package/dist/mutators/{RecordingTransaction.d.ts → RecordingMutation.d.ts} +4 -4
- package/dist/mutators/{RecordingTransaction.js → RecordingMutation.js} +2 -2
- package/dist/mutators/Transaction.d.ts +1 -1
- package/dist/mutators/Transaction.js +1 -1
- package/dist/mutators/UndoManager.d.ts +6 -6
- package/dist/mutators/UndoManager.js +5 -5
- package/dist/mutators/defineMutators.d.ts +3 -3
- package/dist/mutators/defineMutators.js +1 -1
- package/dist/mutators/inverseOp.js +2 -2
- package/dist/mutators/mutateActions.d.ts +3 -3
- package/dist/mutators/mutateActions.js +1 -1
- package/dist/mutators/readerActions.d.ts +1 -1
- package/dist/mutators/undoApply.d.ts +1 -1
- package/dist/mutators/undoApply.js +1 -1
- package/dist/policy/index.d.ts +2 -2
- package/dist/policy/index.js +1 -1
- package/dist/query/client.d.ts +2 -2
- package/dist/query/client.js +4 -4
- package/dist/query/types.d.ts +6 -41
- package/dist/query/types.js +2 -2
- package/dist/react/AbloProvider.d.ts +6 -8
- package/dist/react/AbloProvider.js +5 -7
- package/dist/react/context.d.ts +1 -1
- package/dist/react/context.js +1 -1
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +3 -3
- package/dist/react/internalContext.d.ts +1 -1
- package/dist/react/useAblo.d.ts +3 -3
- package/dist/react/useAblo.js +1 -1
- package/dist/react/useCurrentUserId.js +1 -1
- package/dist/react/useErrorListener.js +1 -1
- package/dist/react/useMutationFailureListener.d.ts +2 -2
- package/dist/react/useMutationFailureListener.js +1 -1
- package/dist/react/useMutators.d.ts +3 -3
- package/dist/react/useMutators.js +3 -3
- package/dist/react/useUndoScope.d.ts +5 -5
- package/dist/react/useUndoScope.js +1 -1
- package/dist/schema/coordination.d.ts +69 -10
- package/dist/schema/coordination.js +86 -9
- package/dist/schema/ddl.js +2 -2
- package/dist/schema/diff.d.ts +1 -1
- package/dist/schema/generate.js +1 -1
- package/dist/schema/index.d.ts +10 -10
- package/dist/schema/index.js +18 -18
- package/dist/schema/queries.d.ts +27 -27
- package/dist/schema/queries.js +23 -23
- package/dist/schema/select.d.ts +3 -3
- package/dist/schema/select.js +3 -3
- package/dist/schema/serialize.d.ts +15 -6
- package/dist/schema/serialize.js +17 -3
- package/dist/schema/sugar.d.ts +6 -7
- package/dist/schema/sugar.js +9 -12
- package/dist/schema/syncDeltaRow.d.ts +4 -152
- package/dist/schema/syncDeltaRow.js +4 -105
- package/dist/server/adapter.d.ts +18 -1
- package/dist/server/commit.d.ts +10 -16
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/readConfig.d.ts +1 -1
- package/dist/source/adapters/drizzle.d.ts +1 -1
- package/dist/source/adapters/drizzle.js +2 -2
- package/dist/source/adapters/kysely.d.ts +1 -1
- package/dist/source/adapters/kysely.js +1 -1
- package/dist/source/adapters/kyselyMutationCore.d.ts +1 -1
- package/dist/source/adapters/kyselyMutationCore.js +2 -2
- package/dist/source/adapters/memory.js +1 -1
- package/dist/source/adapters/prisma.d.ts +8 -3
- package/dist/source/adapters/prisma.js +1 -1
- package/dist/source/connector.js +1 -1
- package/dist/source/connectorProtocol.d.ts +2 -8
- package/dist/source/connectorProtocol.js +3 -2
- package/dist/source/contract.d.ts +29 -17
- package/dist/source/contract.js +27 -22
- package/dist/source/factory.d.ts +1 -1
- package/dist/source/footprint.d.ts +111 -0
- package/dist/source/footprint.js +0 -0
- package/dist/source/idempotency.js +2 -2
- package/dist/source/index.d.ts +1 -0
- package/dist/source/index.js +3 -0
- package/dist/source/next.d.ts +1 -1
- package/dist/source/signing.d.ts +9 -2
- package/dist/source/signing.js +4 -1
- package/dist/source/types.d.ts +6 -4
- package/dist/source/types.js +1 -1
- package/dist/stores/ObjectStore.d.ts +1 -1
- package/dist/stores/SyncActionStore.d.ts +1 -1
- package/dist/stores/SyncActionStore.js +2 -10
- package/dist/stores/syncAction.d.ts +26 -0
- package/dist/stores/syncAction.js +16 -0
- package/dist/surface.d.ts +3 -3
- package/dist/surface.js +6 -4
- package/dist/sync/BootstrapFetcher.d.ts +123 -6
- package/dist/sync/BootstrapFetcher.js +492 -66
- package/dist/sync/ConnectionManager.d.ts +6 -198
- package/dist/sync/ConnectionManager.js +6 -677
- package/dist/sync/OnDemandLoader.d.ts +2 -2
- package/dist/sync/OnDemandLoader.js +60 -21
- package/dist/sync/SubscriptionManager.d.ts +13 -2
- package/dist/sync/SubscriptionManager.js +23 -5
- package/dist/sync/SyncWebSocket.d.ts +27 -510
- package/dist/sync/SyncWebSocket.js +76 -954
- package/dist/sync/awaitClaimGrant.d.ts +4 -44
- package/dist/sync/awaitClaimGrant.js +4 -109
- package/dist/sync/commitFrames.d.ts +6 -40
- package/dist/sync/commitFrames.js +6 -97
- package/dist/sync/contextPorts.d.ts +18 -0
- package/dist/sync/contextPorts.js +31 -0
- package/dist/sync/createClaimStream.d.ts +5 -49
- package/dist/sync/createClaimStream.js +5 -469
- package/dist/sync/createPresenceStream.d.ts +26 -4
- package/dist/sync/createPresenceStream.js +28 -20
- package/dist/sync/createSnapshot.d.ts +2 -2
- package/dist/sync/createSnapshot.js +1 -1
- package/dist/sync/credentialLifecycle.d.ts +5 -173
- package/dist/sync/credentialLifecycle.js +5 -320
- package/dist/sync/deltaPipeline.d.ts +1 -1
- package/dist/sync/participants.d.ts +5 -4
- package/dist/sync/participants.js +29 -22
- package/dist/sync/schemaDrift.d.ts +55 -0
- package/dist/sync/schemaDrift.js +53 -0
- package/dist/sync/schemas.d.ts +21 -32
- package/dist/sync/schemas.js +26 -17
- package/dist/sync/syncPlan.d.ts +3 -3
- package/dist/sync/wsFrameHandlers.d.ts +6 -114
- package/dist/sync/wsFrameHandlers.js +6 -392
- package/dist/testing/fixtures/bootstrap.d.ts +1 -1
- package/dist/testing/fixtures/deltas.d.ts +1 -1
- package/dist/testing/fixtures/httpResponses.d.ts +70 -0
- package/dist/testing/fixtures/httpResponses.js +90 -0
- package/dist/testing/fixtures/models.js +1 -1
- package/dist/testing/helpers/wait.js +1 -1
- package/dist/testing/mocks/MockMutationExecutor.d.ts +2 -2
- package/dist/testing/mocks/MockMutationExecutor.js +8 -14
- package/dist/testing/mocks/MockSyncContext.d.ts +11 -11
- package/dist/testing/mocks/MockSyncContext.js +10 -9
- package/dist/testing/mocks/MockSyncStore.js +1 -1
- package/dist/testing/mocks/MockWebSocket.d.ts +2 -2
- package/dist/transaction/ablo.d.ts +88 -0
- package/dist/transaction/ablo.js +33 -0
- package/dist/{client/auth.d.ts → transaction/auth/apiKey.d.ts} +43 -8
- package/dist/{client/auth.js → transaction/auth/apiKey.js} +19 -0
- package/dist/transaction/auth/bootstrapScope.d.ts +15 -0
- package/dist/transaction/auth/bootstrapScope.js +1 -0
- package/dist/transaction/auth/capability.d.ts +177 -0
- package/dist/transaction/auth/capability.js +199 -0
- package/dist/{auth → transaction/auth}/credentialSource.d.ts +8 -1
- package/dist/{client → transaction/auth}/identity.d.ts +8 -7
- package/dist/{client → transaction/auth}/identity.js +1 -1
- package/dist/transaction/auth/index.d.ts +162 -0
- package/dist/transaction/auth/index.js +304 -0
- package/dist/{auth → transaction/auth}/schemas.d.ts +1 -1
- package/dist/{auth → transaction/auth}/schemas.js +13 -13
- package/dist/{client → transaction/auth}/sessionMint.d.ts +8 -8
- package/dist/{client → transaction/auth}/sessionMint.js +4 -7
- package/dist/transaction/coordination/awaitClaimGrant.d.ts +49 -0
- package/dist/transaction/coordination/awaitClaimGrant.js +112 -0
- package/dist/transaction/coordination/claimMeta.d.ts +49 -0
- package/dist/transaction/coordination/claimMeta.js +52 -0
- package/dist/transaction/coordination/createClaimStream.d.ts +64 -0
- package/dist/transaction/coordination/createClaimStream.js +475 -0
- package/dist/transaction/coordination/events.d.ts +74 -0
- package/dist/transaction/coordination/events.js +7 -0
- package/dist/transaction/coordination/index.d.ts +19 -0
- package/dist/transaction/coordination/index.js +44 -0
- package/dist/transaction/coordination/locator.d.ts +83 -0
- package/dist/transaction/coordination/locator.js +82 -0
- package/dist/transaction/coordination/schema.d.ts +1473 -0
- package/dist/{coordination → transaction/coordination}/schema.js +490 -55
- package/dist/transaction/coordination/targetConflict.d.ts +2 -0
- package/dist/transaction/coordination/targetConflict.js +103 -0
- package/dist/{coordination → transaction/coordination}/trace.d.ts +7 -18
- package/dist/{coordination → transaction/coordination}/trace.js +18 -25
- package/dist/transaction/durableWrites.d.ts +62 -0
- package/dist/{client → transaction}/durableWrites.js +28 -3
- package/dist/transaction/environment.d.ts +105 -0
- package/dist/transaction/environment.js +108 -0
- package/dist/{errorCodes.d.ts → transaction/errorCodes.d.ts} +11 -11
- package/dist/{errorCodes.js → transaction/errorCodes.js} +35 -12
- package/dist/{errors.d.ts → transaction/errors.d.ts} +37 -13
- package/dist/{errors.js → transaction/errors.js} +85 -16
- package/dist/transaction/index.d.ts +20 -0
- package/dist/transaction/index.js +20 -0
- package/dist/transaction/keys/index.d.ts +87 -0
- package/dist/transaction/keys/index.js +207 -0
- package/dist/transaction/log/syncDeltaRow.d.ts +158 -0
- package/dist/transaction/log/syncDeltaRow.js +95 -0
- package/dist/{sync/syncPosition.d.ts → transaction/logPosition.d.ts} +22 -8
- package/dist/{sync/syncPosition.js → transaction/logPosition.js} +15 -6
- package/dist/transaction/logger.d.ts +16 -0
- package/dist/transaction/logger.js +7 -0
- package/dist/transaction/observability.d.ts +53 -0
- package/dist/transaction/observability.js +19 -0
- package/dist/transaction/plugin.d.ts +192 -0
- package/dist/transaction/plugin.js +87 -0
- package/dist/{policy → transaction/policy}/types.d.ts +3 -3
- package/dist/{policy → transaction/policy}/types.js +2 -0
- package/dist/transaction/resources/httpResources.d.ts +266 -0
- package/dist/transaction/resources/httpResources.js +7 -0
- package/dist/transaction/resources/modelOperations.d.ts +319 -0
- package/dist/transaction/resources/modelOperations.js +12 -0
- package/dist/transaction/resources/mutationOptions.d.ts +66 -0
- package/dist/transaction/resources/mutationOptions.js +9 -0
- package/dist/transaction/resources/where.d.ts +85 -0
- package/dist/transaction/resources/where.js +70 -0
- package/dist/{client → transaction/resources}/writeOptionsSchema.d.ts +2 -6
- package/dist/{client → transaction/resources}/writeOptionsSchema.js +9 -5
- package/dist/{schema → transaction/schema}/field.d.ts +5 -5
- package/dist/{schema → transaction/schema}/field.js +5 -5
- package/dist/transaction/schema/loadStrategy.d.ts +45 -0
- package/dist/transaction/schema/loadStrategy.js +46 -0
- package/dist/{schema → transaction/schema}/model.d.ts +50 -35
- package/dist/{schema → transaction/schema}/model.js +30 -20
- package/dist/transaction/schema/openapi.d.ts +57 -0
- package/dist/transaction/schema/openapi.js +340 -0
- package/dist/{schema → transaction/schema}/relation.d.ts +14 -14
- package/dist/{schema → transaction/schema}/relation.js +7 -7
- package/dist/{schema → transaction/schema}/residency.d.ts +0 -9
- package/dist/{schema → transaction/schema}/residency.js +0 -5
- package/dist/{schema → transaction/schema}/roles.d.ts +5 -5
- package/dist/{schema → transaction/schema}/roles.js +5 -5
- package/dist/{schema → transaction/schema}/schema.d.ts +12 -10
- package/dist/{schema → transaction/schema}/schema.js +4 -3
- package/dist/{schema → transaction/schema}/tenancy.d.ts +1 -1
- package/dist/{schema → transaction/schema}/tenancy.js +7 -4
- package/dist/transaction/transactionLayer.d.ts +82 -0
- package/dist/transaction/transactionLayer.js +24 -0
- package/dist/{transactions → transaction/transactions/settlement}/commitEnvelope.d.ts +4 -5
- package/dist/{transactions → transaction/transactions/settlement}/commitEnvelope.js +9 -13
- package/dist/{transactions → transaction/transactions/settlement}/httpCommitEnvelope.d.ts +9 -2
- package/dist/{transactions → transaction/transactions/settlement}/httpCommitEnvelope.js +5 -9
- package/dist/{transactions/durableWriteStore.d.ts → transaction/transactions/settlement/pendingWrite.d.ts} +10 -36
- package/dist/transaction/transactions/settlement/pendingWrite.js +20 -0
- package/dist/transaction/transport/commitFrames.d.ts +90 -0
- package/dist/transaction/transport/commitFrames.js +134 -0
- package/dist/transaction/transport/connectionManager.d.ts +215 -0
- package/dist/transaction/transport/connectionManager.js +673 -0
- package/dist/transaction/transport/credentialLifecycle.d.ts +177 -0
- package/dist/transaction/transport/credentialLifecycle.js +324 -0
- package/dist/{sync → transaction/transport}/heartbeat.d.ts +3 -1
- package/dist/{sync → transaction/transport}/heartbeat.js +6 -4
- package/dist/{client → transaction/transport}/httpClient.d.ts +59 -16
- package/dist/{client → transaction/transport}/httpClient.js +5 -5
- package/dist/transaction/transport/httpOptions.d.ts +33 -0
- package/dist/transaction/transport/httpOptions.js +12 -0
- package/dist/{client → transaction/transport}/httpTransport.js +171 -85
- package/dist/{sync/NetworkProbe.d.ts → transaction/transport/networkProbe.d.ts} +7 -4
- package/dist/{sync/NetworkProbe.js → transaction/transport/networkProbe.js} +14 -13
- package/dist/transaction/transport/wsFrameHandlers.d.ts +128 -0
- package/dist/transaction/transport/wsFrameHandlers.js +429 -0
- package/dist/transaction/transport/wsTransport.d.ts +576 -0
- package/dist/transaction/transport/wsTransport.js +1017 -0
- package/dist/transaction/types/assertExact.d.ts +17 -0
- package/dist/transaction/types/assertExact.js +1 -0
- package/dist/{types → transaction/types}/global.d.ts +17 -2
- package/dist/{types → transaction/types}/global.js +2 -1
- package/dist/{types → transaction/types}/index.d.ts +14 -46
- package/dist/{types → transaction/types}/index.js +7 -16
- package/dist/{types → transaction/types}/streams.d.ts +63 -45
- package/dist/{utils → transaction/utils}/json.d.ts +18 -0
- package/dist/transaction/utils/json.js +276 -0
- package/dist/transaction/wire/accountResponses.d.ts +351 -0
- package/dist/transaction/wire/accountResponses.js +255 -0
- package/dist/transaction/wire/auth.d.ts +49 -0
- package/dist/transaction/wire/auth.js +57 -0
- package/dist/transaction/wire/claimEvent.d.ts +76 -0
- package/dist/transaction/wire/claimEvent.js +73 -0
- package/dist/transaction/wire/claims.d.ts +463 -0
- package/dist/transaction/wire/claims.js +229 -0
- package/dist/{wire → transaction/wire}/commit.d.ts +125 -193
- package/dist/{wire → transaction/wire}/commit.js +68 -47
- package/dist/{wire → transaction/wire}/delta.d.ts +66 -17
- package/dist/{wire → transaction/wire}/delta.js +37 -13
- package/dist/transaction/wire/errorEnvelope.d.ts +72 -0
- package/dist/{wire → transaction/wire}/errorEnvelope.js +36 -5
- package/dist/transaction/wire/feedCursor.d.ts +60 -0
- package/dist/transaction/wire/feedCursor.js +82 -0
- package/dist/transaction/wire/feedEvent.d.ts +177 -0
- package/dist/transaction/wire/feedEvent.js +39 -0
- package/dist/transaction/wire/frames.d.ts +194 -0
- package/dist/transaction/wire/frames.js +50 -0
- package/dist/transaction/wire/inboundFrames.d.ts +552 -0
- package/dist/transaction/wire/inboundFrames.js +116 -0
- package/dist/transaction/wire/index.d.ts +50 -0
- package/dist/transaction/wire/index.js +74 -0
- package/dist/{wire → transaction/wire}/listEnvelope.d.ts +13 -14
- package/dist/transaction/wire/listEnvelope.js +42 -0
- package/dist/transaction/wire/modelResponses.d.ts +85 -0
- package/dist/transaction/wire/modelResponses.js +43 -0
- package/dist/transactions/{TransactionQueue.d.ts → mutations/MutationQueue.d.ts} +79 -38
- package/dist/transactions/{TransactionQueue.js → mutations/MutationQueue.js} +110 -59
- package/dist/transactions/{TransactionStore.d.ts → mutations/MutationStore.d.ts} +8 -8
- package/dist/transactions/{TransactionStore.js → mutations/MutationStore.js} +2 -2
- package/dist/transactions/{coalesceRules.d.ts → mutations/coalesceRules.d.ts} +10 -10
- package/dist/transactions/{coalesceRules.js → mutations/coalesceRules.js} +1 -1
- package/dist/transactions/mutations/commitLatency.d.ts +52 -0
- package/dist/transactions/mutations/commitLatency.js +130 -0
- package/dist/transactions/{commitOutboxStore.d.ts → mutations/commitOutboxStore.d.ts} +1 -5
- package/dist/transactions/{commitOutboxStore.js → mutations/commitOutboxStore.js} +1 -1
- package/dist/transactions/{commitPayload.d.ts → mutations/commitPayload.d.ts} +16 -15
- package/dist/transactions/{commitPayload.js → mutations/commitPayload.js} +12 -12
- package/dist/transactions/{deltaConfirmation.d.ts → mutations/deltaConfirmation.d.ts} +11 -11
- package/dist/transactions/{deltaConfirmation.js → mutations/deltaConfirmation.js} +7 -7
- package/dist/transactions/mutations/durableWriteStore.d.ts +14 -0
- package/dist/transactions/mutations/durableWriteStore.js +12 -0
- package/dist/transactions/{optimisticApply.d.ts → mutations/optimisticApply.d.ts} +7 -7
- package/dist/transactions/{replayValidation.d.ts → mutations/replayValidation.d.ts} +3 -3
- package/dist/transactions/{replayValidation.js → mutations/replayValidation.js} +4 -3
- package/dist/utils/mobxSetup.d.ts +1 -1
- package/dist/utils/mobxSetup.js +5 -2
- package/dist/webhooks/events.d.ts +2 -2
- package/dist/wire/index.d.ts +1 -34
- package/dist/wire/index.js +8 -49
- package/docs/agent-messaging.md +3 -3
- package/docs/agents.md +19 -12
- package/docs/api-keys.md +8 -4
- package/docs/api.md +22 -18
- package/docs/audit.md +2 -0
- package/docs/cli.md +31 -3
- package/docs/client-behavior.md +8 -6
- package/docs/concurrency-convention.md +30 -24
- package/docs/coordination.md +48 -38
- package/docs/data-sources.md +3 -1
- package/docs/debugging.md +5 -3
- package/docs/deployment.md +267 -0
- package/docs/examples/agent-human.md +49 -42
- package/docs/examples/ai-sdk-tool.md +69 -44
- package/docs/examples/existing-python-backend.md +8 -6
- package/docs/examples/nextjs.md +129 -47
- package/docs/examples/scoped-agent.md +45 -44
- package/docs/examples/server-agent.md +46 -26
- package/docs/groups.md +32 -29
- package/docs/guarantees.md +4 -2
- package/docs/how-it-works.md +9 -7
- package/docs/idempotency.md +126 -0
- package/docs/identity.md +58 -54
- package/docs/index.md +172 -86
- package/docs/integration-guide.md +17 -16
- package/docs/interaction-model.md +6 -4
- package/docs/mcp.md +41 -16
- package/docs/migration.md +63 -5
- package/docs/operating-on-your-database.md +3 -1
- package/docs/projects.md +2 -0
- package/docs/quickstart.md +22 -5
- package/docs/react.md +12 -10
- package/docs/schema-contract.md +5 -3
- package/docs/session-settings.md +108 -0
- package/docs/sessions.md +3 -1
- package/docs/webhooks.md +3 -1
- package/llms.txt +47 -17
- package/package.json +10 -8
- package/dist/agent/Agent.d.ts +0 -366
- package/dist/agent/Agent.js +0 -514
- package/dist/agent/index.d.ts +0 -115
- package/dist/agent/index.js +0 -128
- package/dist/agent/session.d.ts +0 -93
- package/dist/agent/session.js +0 -149
- package/dist/agent/types.d.ts +0 -68
- package/dist/agent/types.js +0 -9
- package/dist/client/durableWrites.d.ts +0 -21
- package/dist/coordination/schema.d.ts +0 -722
- package/dist/schema/openapi.d.ts +0 -29
- package/dist/schema/openapi.js +0 -124
- package/dist/transactions/durableWriteStore.js +0 -30
- package/dist/utils/json.js +0 -88
- package/dist/wire/errorEnvelope.d.ts +0 -55
- package/dist/wire/frames.d.ts +0 -197
- package/dist/wire/frames.js +0 -49
- package/dist/wire/listEnvelope.js +0 -18
- /package/dist/{client → transaction/auth}/credentialEndpoint.d.ts +0 -0
- /package/dist/{client → transaction/auth}/credentialEndpoint.js +0 -0
- /package/dist/{auth → transaction/auth}/credentialPolicy.d.ts +0 -0
- /package/dist/{auth → transaction/auth}/credentialPolicy.js +0 -0
- /package/dist/{auth → transaction/auth}/credentialSource.js +0 -0
- /package/dist/{client → transaction/auth}/hostedEndpoints.d.ts +0 -0
- /package/dist/{client → transaction/auth}/hostedEndpoints.js +0 -0
- /package/dist/{client → transaction/coordination}/claimHeartbeatLoop.d.ts +0 -0
- /package/dist/{client → transaction/coordination}/claimHeartbeatLoop.js +0 -0
- /package/dist/{client → transaction}/persistence.d.ts +0 -0
- /package/dist/{client → transaction}/persistence.js +0 -0
- /package/dist/{client → transaction/resources}/functionalUpdate.d.ts +0 -0
- /package/dist/{client → transaction/resources}/functionalUpdate.js +0 -0
- /package/dist/{transactions → transaction/transactions/settlement}/idempotencyKey.d.ts +0 -0
- /package/dist/{transactions → transaction/transactions/settlement}/idempotencyKey.js +0 -0
- /package/dist/{client → transaction/transport}/httpTransport.d.ts +0 -0
- /package/dist/{types → transaction/types}/modelData.d.ts +0 -0
- /package/dist/{types → transaction/types}/modelData.js +0 -0
- /package/dist/{types → transaction/types}/participant.d.ts +0 -0
- /package/dist/{types → transaction/types}/participant.js +0 -0
- /package/dist/{types → transaction/types}/streams.js +0 -0
- /package/dist/{utils → transaction/utils}/asyncIterator.d.ts +0 -0
- /package/dist/{utils → transaction/utils}/asyncIterator.js +0 -0
- /package/dist/{utils → transaction/utils}/duration.d.ts +0 -0
- /package/dist/{utils → transaction/utils}/duration.js +0 -0
- /package/dist/{wire → transaction/wire}/bootstrapReason.d.ts +0 -0
- /package/dist/{wire → transaction/wire}/bootstrapReason.js +0 -0
- /package/dist/{wire → transaction/wire}/protocol.d.ts +0 -0
- /package/dist/{wire → transaction/wire}/protocol.js +0 -0
- /package/dist/{wire → transaction/wire}/protocolVersion.d.ts +0 -0
- /package/dist/{wire → transaction/wire}/protocolVersion.js +0 -0
- /package/dist/transactions/{UnconfirmedWrites.d.ts → mutations/UnconfirmedWrites.d.ts} +0 -0
- /package/dist/transactions/{UnconfirmedWrites.js → mutations/UnconfirmedWrites.js} +0 -0
- /package/dist/transactions/{optimisticApply.js → mutations/optimisticApply.js} +0 -0
package/dist/wire/index.js
CHANGED
|
@@ -1,49 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
* {@link statusForType} turn any thrown value into the uniform
|
|
10
|
-
* `{ type, code, param, message, doc_url, request_id }` body.
|
|
11
|
-
* - List responses — {@link listEnvelope} and {@link ListEnvelope} stamp the
|
|
12
|
-
* uniform `{ object: 'list', data, has_more, next_cursor }` collection.
|
|
13
|
-
*
|
|
14
|
-
* The {@link AbloError} hierarchy, {@link docUrlForCode}, and the wire-parsing
|
|
15
|
-
* helpers are re-exported too, so a single import lets a route throw the right
|
|
16
|
-
* typed error and serialize it back out.
|
|
17
|
-
*/
|
|
18
|
-
export { errorEnvelope, statusForType } from './errorEnvelope.js';
|
|
19
|
-
export { listEnvelope } from './listEnvelope.js';
|
|
20
|
-
export { bootstrapReasonSchema } from './bootstrapReason.js';
|
|
21
|
-
// The write-path frame contract: the message shapes shared by the client and
|
|
22
|
-
// the server. The runtime Zod validators sit beside the interfaces and are
|
|
23
|
-
// pinned to them, and they gate every operation and payload on both commit
|
|
24
|
-
// transports.
|
|
25
|
-
export { commitOperationSchema, commitPayloadSchema, } from './frames.js';
|
|
26
|
-
// Protocol versioning: the single integer the client and server compare to
|
|
27
|
-
// confirm they can speak to each other, plus the WebSocket close code used to
|
|
28
|
-
// reject a mismatch. See protocolVersion.ts for the changelog and deploy rules.
|
|
29
|
-
export { PROTOCOL_VERSION, MIN_SUPPORTED_PROTOCOL_VERSION, DEFAULT_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, WS_CLOSE_PROTOCOL_VERSION, PROTOCOL_VERSION_HEADER, protocolVersionProblem, resolveProtocolVersion, } from './protocolVersion.js';
|
|
30
|
-
// Commit settlement backbone. The transport receipt, server execution cache,
|
|
31
|
-
// and normalized client acknowledgement are different envelopes composed from
|
|
32
|
-
// this one discriminated settlement vocabulary.
|
|
33
|
-
export { COMMIT_CORRELATION_ID_MAX_LENGTH, correlationIdSchema, commitStatusSchema, commitSettlementSchema, commitReceiptSchema, legacyCompatibleCommitReceiptSchema, rejectedCommitReceiptSchema, mutationResultPayloadSchema, mutationResultMessageSchema, commitAckSchema, mutationCommitResultSchema, } from './commit.js';
|
|
34
|
-
// The read-path delta contract: the shape the server broadcasts to clients as the
|
|
35
|
-
// payload of a `delta` or `sync_response` frame, together with the shared
|
|
36
|
-
// participant vocabulary it carries. Both ends derive their delta type from these
|
|
37
|
-
// schemas, so the client and server cannot drift apart.
|
|
38
|
-
export { participantKindSchema, confirmationStateSchema, syncDeltaActionSchema, wireDeltaDataSchema, participantRefSchema, syncDeltaWireCoreSchema, clientSyncDeltaSchema, serverSyncDeltaSchema, } from './delta.js';
|
|
39
|
-
// The error surface a wire consumer needs to throw, classify, and serialize.
|
|
40
|
-
export { AbloError, AbloAuthenticationError, AbloPermissionError, AbloValidationError, AbloRateLimitError, AbloIdempotencyError, AbloConnectionError, AbloServerError, AbloStaleContextError, AbloClaimedError, CapabilityError, SyncSessionError, docUrlForCode, translateHttpError, errorFromWire, toAbloError, ERROR_CONTRACT_VERSION,
|
|
41
|
-
// The table mapping each error code to its HTTP status and retryable flag —
|
|
42
|
-
// plain data a server can use to resolve a code's canonical status the same
|
|
43
|
-
// way the client's error serializer does.
|
|
44
|
-
errorCodeSpec, } from '../errors.js';
|
|
45
|
-
// Protocol timing constants — the 30-second ping cadence and the lease window
|
|
46
|
-
// derived from it, shared by the client heartbeat and the server keepalive,
|
|
47
|
-
// claim leasing, and presence expiry (see protocol.ts) — plus the WebSocket
|
|
48
|
-
// subprotocols used during the authenticated handshake.
|
|
49
|
-
export { PING_INTERVAL_MS, LEASE_TTL_MS, WS_BEARER_SUBPROTOCOL_PREFIX, WS_SYNC_SUBPROTOCOL, } from './protocol.js';
|
|
1
|
+
// Moved to @ablo/transaction (ADR 0013 — the settlement core extraction).
|
|
2
|
+
// This shim re-exports it at the original path so in-package importers of
|
|
3
|
+
// `wire/index.js` keep working; rewire to `@ablo/transaction/wire`
|
|
4
|
+
// and delete this shim once the core package is fully wired.
|
|
5
|
+
//
|
|
6
|
+
// Line comments on purpose: tsc copies a leading JSDoc block into the
|
|
7
|
+
// published `.d.ts`, and this note names a package npm has never heard of.
|
|
8
|
+
export * from '../transaction/wire/index.js';
|
package/docs/agent-messaging.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Agent Messaging
|
|
2
2
|
|
|
3
|
+
> Durable handoffs between agents, linked to the claim they are about.
|
|
4
|
+
|
|
3
5
|
Use a normal model when agents or humans need durable communication inside a
|
|
4
6
|
syncGroup. Use claim `description` and `meta` for live coordination context.
|
|
5
7
|
Use a `messages` row when the information must survive reconnects, work over
|
|
@@ -32,7 +34,6 @@ export const schema = defineSchema({
|
|
|
32
34
|
status: z.string(),
|
|
33
35
|
teamId: z.string(),
|
|
34
36
|
},
|
|
35
|
-
{},
|
|
36
37
|
{ entityRoles: [entityRole({ kind: "team", source: "teamId" })] },
|
|
37
38
|
),
|
|
38
39
|
|
|
@@ -47,7 +48,6 @@ export const schema = defineSchema({
|
|
|
47
48
|
aboutEntityId: z.string().optional(),
|
|
48
49
|
aboutIntentId: z.string().optional(),
|
|
49
50
|
},
|
|
50
|
-
{},
|
|
51
51
|
{ entityRoles: [entityRole({ kind: "team", source: "teamId" })] },
|
|
52
52
|
),
|
|
53
53
|
});
|
|
@@ -121,7 +121,7 @@ Peers outside that syncGroup do not.
|
|
|
121
121
|
Live clients read locally and update when deltas arrive:
|
|
122
122
|
|
|
123
123
|
```ts
|
|
124
|
-
const rows = ablo.messages.
|
|
124
|
+
const rows = ablo.messages.local.list({
|
|
125
125
|
where: { teamId },
|
|
126
126
|
orderBy: { createdAt: "asc" },
|
|
127
127
|
});
|
package/docs/agents.md
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
# Agents
|
|
2
2
|
|
|
3
|
+
> The stateless participant: wake on a trigger, read, claim, commit, go idle.
|
|
4
|
+
|
|
3
5
|
An agent is a **reactive** participant: it wakes on something happening, reads
|
|
4
6
|
what it needs, writes a result, and goes idle. That's a request/response
|
|
5
7
|
workload — so agents talk to Ablo over **plain HTTP**, holding no WebSocket. The
|
|
6
8
|
credential *is* the identity; the server resolves the org, scope, and actor from
|
|
7
9
|
the key on every request (the Stripe server-SDK / Liveblocks-node shape).
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
get the
|
|
11
|
-
state — and coordinate *with each
|
|
11
|
+
Agents get the stateless plane (HTTP). People — when you add the `humans()`
|
|
12
|
+
plugin — get the live plane (WebSocket: presence, optimistic, sub-100ms).
|
|
13
|
+
**Both operate on the same typed, coordinated state — and coordinate *with each
|
|
14
|
+
other*.**
|
|
12
15
|
|
|
13
16
|
<Note>
|
|
14
17
|
Agents transact against your **pushed schema**, same as everyone — `ablo.tasks`
|
|
@@ -40,7 +43,7 @@ await ablo.tasks.update({ id: task.id, data: { status: "done" } });
|
|
|
40
43
|
|
|
41
44
|
It exposes `retrieve` / `list` / `create` / `update` / `delete`, plus `commits`
|
|
42
45
|
and `claim`. It does **not** expose the stateful-only surface (`get` /
|
|
43
|
-
`
|
|
46
|
+
`local` reads, `onChange` live subscription) — those need a
|
|
44
47
|
live connection, so with `transport: 'http'` the return type narrows and they
|
|
45
48
|
are a *compile error*, not a runtime surprise.
|
|
46
49
|
|
|
@@ -77,14 +80,18 @@ a message back to the claim it discusses.
|
|
|
77
80
|
|
|
78
81
|
See [Agent Messaging](/agent-messaging) for the schema and setup details.
|
|
79
82
|
|
|
80
|
-
##
|
|
83
|
+
## When a person is in the loop
|
|
84
|
+
|
|
85
|
+
There's no separate "agent mode" — and no separate human mode either. The bare
|
|
86
|
+
client is the coordination layer; `humans()` is the plugin that adds the live
|
|
87
|
+
plane on top of it. An agent acting over HTTP and a person editing over their
|
|
88
|
+
socket share the same typed state and the same coordination: the agent can claim
|
|
89
|
+
the row that person is holding (and wait in line), and they see the agent's
|
|
90
|
+
committed changes stream in **live** over their own socket, even though the
|
|
91
|
+
agent committed over HTTP.
|
|
81
92
|
|
|
82
|
-
There
|
|
83
|
-
|
|
84
|
-
plane: the agent can claim the row a human is editing (and wait in line), and the
|
|
85
|
-
human sees the agent's committed changes stream in **live** — over the human's
|
|
86
|
-
own socket, even though the agent committed over HTTP. You write the agent once;
|
|
87
|
-
it's a first-class participant, not a bolt-on.
|
|
93
|
+
There is no `agents()` plugin, and the absence is the point — an agent is the
|
|
94
|
+
default caller here, not a bolt-on.
|
|
88
95
|
|
|
89
96
|
## How an agent runs
|
|
90
97
|
|
|
@@ -101,7 +108,7 @@ agents costs nothing on the live plane — that capacity stays for humans.
|
|
|
101
108
|
|
|
102
109
|
## What stays on the live (human) plane
|
|
103
110
|
|
|
104
|
-
`onChange` (live subscriptions) and `
|
|
111
|
+
`onChange` (live subscriptions) and the `local` reads (local synced-pool
|
|
105
112
|
reads) require a WebSocket and a local store — they're for interactive UIs, not
|
|
106
113
|
stateless agents. An agent reacts to an external trigger (a job/queue/webhook),
|
|
107
114
|
then reads with `list`/`retrieve`. See [client behavior](/client-behavior) for
|
package/docs/api-keys.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# API Keys
|
|
2
2
|
|
|
3
|
+
> The credential that carries an agent's identity and bounds what it may write.
|
|
4
|
+
|
|
3
5
|
Authenticate a server-side client — a route handler, worker, or CLI — by passing an API key when you create the client.
|
|
4
6
|
|
|
5
7
|
```ts
|
|
@@ -97,10 +99,12 @@ Test and live keys are the same shape; the prefix names the environment:
|
|
|
97
99
|
- `sk_live_…` — a key against your live data.
|
|
98
100
|
|
|
99
101
|
Every org has a default sandbox, plus any number of additional
|
|
100
|
-
sandboxes you create. **Data is isolated per sandbox; the schema is
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
separates sandbox and production data while keeping
|
|
102
|
+
sandboxes you create. **Data is isolated per sandbox; the schema is one
|
|
103
|
+
definition serving both.** A sandbox reads the production schema until it is
|
|
104
|
+
pushed one of its own, so your test and live keys see the same models and only
|
|
105
|
+
the rows differ — how Stripe separates sandbox and production data while keeping
|
|
106
|
+
the API shape identical. A schema change reaches production when you push it
|
|
107
|
+
with a live key ([Deployment](./deployment.md)).
|
|
104
108
|
|
|
105
109
|
## Scopes
|
|
106
110
|
|
package/docs/api.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# API
|
|
2
2
|
|
|
3
|
+
> The per-method reference for every model call an agent or an interface can make.
|
|
4
|
+
|
|
3
5
|
> **Upgrading?** Every breaking change and its migration is on the
|
|
4
6
|
> [Version History & Migration Guide](./migration.md).
|
|
5
7
|
|
|
@@ -11,10 +13,12 @@ row, you can optionally `claim` it so they serialize instead of clobbering
|
|
|
11
13
|
each other.
|
|
12
14
|
|
|
13
15
|
Two things to know before the method list. **Reads come in two flavors:**
|
|
14
|
-
`retrieve({ id })` / `list({ where })` are async
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
`retrieve({ id })` / `list({ where })` are async — they answer from what is
|
|
17
|
+
already local and fall back to the server. Put `local.` in front of either and
|
|
18
|
+
you get the same read restricted to what is already here, which is why it can
|
|
19
|
+
return a value rather than a promise: `local.retrieve(id)`, `local.list({ where })`,
|
|
20
|
+
`local.count({ where })`. Use those in render, after data has synced.
|
|
21
|
+
**Claims don't lock.** If another writer holds the row, `claim` waits
|
|
18
22
|
for them, re-reads the fresh row, then hands it to you — so two writers
|
|
19
23
|
serialize instead of clobbering.
|
|
20
24
|
|
|
@@ -49,31 +53,31 @@ Each schema model becomes a typed model on the client:
|
|
|
49
53
|
|
|
50
54
|
- `ablo.weatherReports.retrieve({ id })` reads one row asynchronously (server read).
|
|
51
55
|
- `ablo.weatherReports.list({ where })` reads a collection asynchronously (server read).
|
|
52
|
-
- `ablo.weatherReports.
|
|
56
|
+
- `ablo.weatherReports.local.retrieve(id)` reads one row synchronously from the local graph.
|
|
53
57
|
- `ablo.weatherReports.create({ data })` creates a row.
|
|
54
58
|
- `ablo.weatherReports.update({ id, data, ...options })` updates a row.
|
|
55
59
|
- `ablo.weatherReports.delete({ id, ...options })` deletes a row.
|
|
56
60
|
|
|
57
|
-
`
|
|
58
|
-
`
|
|
59
|
-
|
|
60
|
-
`
|
|
61
|
-
|
|
61
|
+
`local.` narrows a read to what has already synced. `retrieve({ id })` and
|
|
62
|
+
`list({ where })` answer from the local graph and fall back to IndexedDB and
|
|
63
|
+
then the network, so reach for them when the row may not be here yet.
|
|
64
|
+
`local.retrieve(id)` and `local.list({ where })` are the same reads with the
|
|
65
|
+
fallback removed — nothing to await, so they return a value.
|
|
62
66
|
|
|
63
67
|
| Method | Returns | Use when |
|
|
64
68
|
|---|---|---|
|
|
65
69
|
| `retrieve({ id })` | `Promise<T \| undefined>` | You need one row, hydrating from local store and server. |
|
|
66
70
|
| `list({ where })` | `Promise<T[]>` | You need to hydrate a collection from local store and server. |
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
71
|
+
| `local.retrieve(id)` | `T \| undefined` | You want a synchronous snapshot of one local row. |
|
|
72
|
+
| `local.list(options?)` | `T[]` | You want a synchronous snapshot of a local collection. |
|
|
73
|
+
| `local.count(options?)` | `number` | You want a synchronous count of local rows. |
|
|
70
74
|
| `create({ data, ...options })` | `Promise<T>` | You want to create through the schema model. |
|
|
71
75
|
| `update({ id, data, ...options })` | `Promise<T>` | You want to update through the schema model. |
|
|
72
76
|
| `delete({ id, ...options })` | `Promise<void>` | You want to delete through the schema model. |
|
|
73
77
|
|
|
74
78
|
`retrieve`, `list`, `create`, `update`, and `delete` are the main path — they go
|
|
75
|
-
through the server. `
|
|
76
|
-
|
|
79
|
+
through the server. The `local` reads work off the rows a session has already
|
|
80
|
+
synced, so a cheap re-read needs no round-trip.
|
|
77
81
|
|
|
78
82
|
## Protected Writes
|
|
79
83
|
|
|
@@ -103,7 +107,7 @@ Protected write options:
|
|
|
103
107
|
|
|
104
108
|
## Claims
|
|
105
109
|
|
|
106
|
-
Before anyone writes a row, they can claim it so other
|
|
110
|
+
Before anyone writes a row, they can claim it so other agents and people see
|
|
107
111
|
who is editing it in real time. Claims don't lock. If another writer holds the
|
|
108
112
|
row, `claim` waits for them, re-reads the fresh row, then hands it to you — so
|
|
109
113
|
two writers serialize instead of clobbering. A claim is temporary: it expires
|
|
@@ -206,7 +210,7 @@ The SDK is a convenience wrapper over a model-scoped HTTP surface — the same
|
|
|
206
210
|
noun (`model`) and verbs as `ablo.<model>.…`. Non-JS callers (or curl) use it
|
|
207
211
|
directly. The table below shows the shape with `{model}` as a placeholder; the
|
|
208
212
|
[OpenAPI spec](./openapi.json) expands it into one **typed** path per model
|
|
209
|
-
(`/api/v1/models/task`, `/api/v1/models/
|
|
213
|
+
(`/api/v1/models/task`, `/api/v1/models/workspace`, …, generated from your schema) so each
|
|
210
214
|
endpoint documents that model's real field contract instead of a generic blob.
|
|
211
215
|
|
|
212
216
|
| SDK call | HTTP |
|
|
@@ -232,7 +236,7 @@ error `code` (e.g. `stale_context`, `intent_conflict`) to act on.
|
|
|
232
236
|
operations across rows/models that must commit together) — the per-model routes
|
|
233
237
|
above are the one-record path. Both run the identical guarded-write engine.
|
|
234
238
|
|
|
235
|
-
The [coordination MCP server](./mcp.md) (`@
|
|
239
|
+
The [coordination MCP server](./mcp.md) (`@abloatai/mcp`) is this same surface
|
|
236
240
|
rendered as agent tools.
|
|
237
241
|
|
|
238
242
|
## Errors
|
package/docs/audit.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Audit log
|
|
2
2
|
|
|
3
|
+
> Trace any committed change back to the key that made it, and to the person behind that key.
|
|
4
|
+
|
|
3
5
|
The audit log records who changed what in your org, and when — including
|
|
4
6
|
changes an AI agent made on a person's behalf. Every change is one row, and the
|
|
5
7
|
rows are chained with a keyed hash (HMAC-SHA256) so you can later prove the
|
package/docs/cli.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# CLI
|
|
2
2
|
|
|
3
|
+
> Scaffold a schema, connect a database, push it, and watch it sync.
|
|
4
|
+
|
|
3
5
|
The `ablo` CLI gets you from an empty project to live-syncing data: scaffold a
|
|
4
6
|
schema, authenticate, push the schema, and watch it sync. Your
|
|
5
7
|
`defineSchema(...)` is the single source of truth: whether you run the CLI
|
|
@@ -34,7 +36,7 @@ This mirrors `stripe login`.
|
|
|
34
36
|
| `ablo login` | Authorize in the browser; provisions + stores a test and a live key. |
|
|
35
37
|
| `ablo login --project <slug>` | Same, but scope (and mint) the pair to a project, and make it active. |
|
|
36
38
|
| `ablo logout` | Remove the stored keys. |
|
|
37
|
-
| `ablo status` | Show the active org, mode, both keys (prefix
|
|
39
|
+
| `ablo status` | Show the active org, mode, both keys (prefix, what each can do, expiry), and server health. |
|
|
38
40
|
| `ablo mode [sandbox\|production]` | Switch the active environment. With no argument, prompts. |
|
|
39
41
|
|
|
40
42
|
Keys live in `~/.config/ablo/credentials.json` (mode `0600`), keyed by project
|
|
@@ -49,8 +51,11 @@ belongs to one of them. Test keys are bound to an isolated sandbox: their reads
|
|
|
49
51
|
and writes never touch production data. Switch with `ablo mode`; `ablo dev` is always
|
|
50
52
|
the sandbox by design.
|
|
51
53
|
|
|
52
|
-
The schema
|
|
53
|
-
|
|
54
|
+
The schema is **one definition serving both**: a sandbox reads the production
|
|
55
|
+
schema until it is pushed one of its own, so your test and live keys see the same
|
|
56
|
+
models and only the rows differ. Each plane keeps its own copy once pushed, so a
|
|
57
|
+
schema change reaches production when you push it with a live key — see
|
|
58
|
+
[Deployment](./deployment.md).
|
|
54
59
|
|
|
55
60
|
## Projects
|
|
56
61
|
|
|
@@ -100,6 +105,29 @@ profiles entirely: it acts in whatever project it was minted for.
|
|
|
100
105
|
| `ablo pull` | **Direct Postgres** — generate `defineSchema(...)` from your existing tables (read-only, like `prisma db pull`). | `--out <path>`, `--app-schema <name>`, `--import <pkg>`, `--force` |
|
|
101
106
|
| `ablo check` | **Direct Postgres** — verify your _existing_ tables fit the schema (read-only, no schema changes). | `--schema <path>`, `--export <name>`, `--app-schema <name>` |
|
|
102
107
|
| `ablo generate` | Emit TypeScript types from the schema. | `--out <path>`, `--schema`, `--export` |
|
|
108
|
+
| `ablo docs` | Read these pages for the version you installed — offline, no network (see [`ablo docs`](#ablo-docs)). | `--json` |
|
|
109
|
+
|
|
110
|
+
## `ablo docs`
|
|
111
|
+
|
|
112
|
+
The documentation for the version in your `node_modules`, not the version on the
|
|
113
|
+
website.
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npx ablo docs # every page, with what it covers
|
|
117
|
+
npx ablo docs coordination # one page, as markdown
|
|
118
|
+
npx ablo docs --json # the page list, machine-readable
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
These pages ship inside the npm package, so they describe the code beside them
|
|
122
|
+
and stay reachable with no network — the sandboxes and CI runners agents work in
|
|
123
|
+
often have none. That matters most when a project is pinned: `get` / `getAll` /
|
|
124
|
+
`getCount` became `retrieve` / `list` in 0.35.0, and a website always describes
|
|
125
|
+
the newest release, so an agent on an earlier version reads the new name and
|
|
126
|
+
writes a call its own package doesn't have.
|
|
127
|
+
|
|
128
|
+
Pass a slug (`coordination`), a path (`docs/coordination.md`), or a file name
|
|
129
|
+
(`AGENTS.md`). A miss names the closest page. The same pages are served over
|
|
130
|
+
HTTP at `/api/docs/<slug>` and through the docs MCP server.
|
|
103
131
|
|
|
104
132
|
## `ablo dev`
|
|
105
133
|
|
package/docs/client-behavior.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Client Behavior
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Per-write options, claim behavior, and which errors are safe to retry.
|
|
4
|
+
|
|
5
|
+
When several writers touch the same data at once — an agent worker, a Server Action, a person in the browser — the SDK decides whose write lands and how the others find out. This page is the reference for that: per-write options like `wait` and `onStale`, claiming a record so your slow work runs uninterrupted, and which errors are safe to retry.
|
|
4
6
|
|
|
5
7
|
Claims don't lock. If another writer holds the row, `claim` waits for them, re-reads the fresh row, then hands it to you — so two writers serialize instead of clobbering.
|
|
6
8
|
|
|
@@ -32,7 +34,7 @@ Common options:
|
|
|
32
34
|
| `baseURL` | Override the hosted sync endpoint for staging or private deployments. |
|
|
33
35
|
| `persistence` | `memory` by default. Use `indexeddb` for a durable browser cache that survives reloads. |
|
|
34
36
|
| `durableWrites` | Optional crash recovery for unacknowledged agent/worker writes. Independent of the default memory cache; accepts `{ store, namespace? }`. |
|
|
35
|
-
| `transport` | `'websocket'` (default) is the live, stateful client — a persistent socket, a local synced pool, and `onChange` subscriptions. `'http'` returns the **stateless** client for server-side actors (agents, workers, serverless): the same `ablo.<model>` read/write/claim surface, but each call is one HTTP round-trip with no socket. Under `'http'` the return type narrows to `AbloHttpClient`, so stateful-only methods (`
|
|
37
|
+
| `transport` | `'websocket'` (default) is the live, stateful client — a persistent socket, a local synced pool, and `onChange` subscriptions. `'http'` returns the **stateless** client for server-side actors (agents, workers, serverless): the same `ablo.<model>` read/write/claim surface, but each call is one HTTP round-trip with no socket. Under `'http'` the return type narrows to `AbloHttpClient`, so stateful-only methods (the `local` reads, `onChange`, `join`) are compile errors rather than runtime gaps. |
|
|
36
38
|
| `fetch` | Custom fetch implementation for tests or non-standard runtimes. |
|
|
37
39
|
| `defaultHeaders` | Extra headers attached to every HTTP request. |
|
|
38
40
|
| `defaultQuery` | Extra query parameters attached to every HTTP request. |
|
|
@@ -52,7 +54,7 @@ Each schema model becomes a typed model:
|
|
|
52
54
|
await ablo.ready();
|
|
53
55
|
|
|
54
56
|
const report = await ablo.weatherReports.retrieve({ id: 'report_stockholm' });
|
|
55
|
-
const local = ablo.weatherReports.
|
|
57
|
+
const local = ablo.weatherReports.local.retrieve('report_stockholm');
|
|
56
58
|
|
|
57
59
|
await ablo.weatherReports.create({ data: { location: 'Stockholm', status: 'pending' } });
|
|
58
60
|
await ablo.weatherReports.update({ id: 'report_stockholm', data: { status: 'ready' }, wait: 'confirmed' });
|
|
@@ -60,11 +62,11 @@ await ablo.weatherReports.delete({ id: 'report_stockholm', wait: 'confirmed' });
|
|
|
60
62
|
```
|
|
61
63
|
|
|
62
64
|
Call `retrieve`/`list` first — they fetch from the server and you `await` them.
|
|
63
|
-
After that, `
|
|
65
|
+
After that, `local.retrieve`/`local.list`/`local.count` read the already-synced data instantly with
|
|
64
66
|
no `await`, and stay reactive in render. Use the async pair to load, the sync trio
|
|
65
67
|
to read.
|
|
66
68
|
|
|
67
|
-
`
|
|
69
|
+
`local.list` accepts the same practical read options the React selector path uses:
|
|
68
70
|
`where`, `filter`, `orderBy`, `limit`, `offset`, and `state`. The `state`
|
|
69
71
|
lifecycle filter defaults to `'live'`; pass `'archived'` or `'all'` when you
|
|
70
72
|
intentionally want non-live rows.
|
|
@@ -91,7 +93,7 @@ await ablo.weatherReports.update({
|
|
|
91
93
|
|
|
92
94
|
Once the server accepts the write, every other connected client gets the new row
|
|
93
95
|
automatically — no polling or manual refresh on your side. React clients that use
|
|
94
|
-
`useAblo((ablo) => ablo.weatherReports.
|
|
96
|
+
`useAblo((ablo) => ablo.weatherReports.local.retrieve(id))` receive the new row, and selectors
|
|
95
97
|
such as `useAblo((ablo) => ablo.weatherReports.claim.state({ id }))`
|
|
96
98
|
receive active claim state. There is
|
|
97
99
|
no extra multiplayer setup beyond routing shared state through Ablo.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Concurrency Convention
|
|
2
2
|
|
|
3
|
+
> The governing rule for how Ablo resolves concurrent writes to shared state.
|
|
4
|
+
|
|
3
5
|
> The governing convention for how Ablo resolves concurrent writes to shared
|
|
4
6
|
> state, and the boundaries of that convention. This is the contract; the
|
|
5
7
|
> three-layer mechanics live in [`coordination.md`](./coordination.md).
|
|
@@ -35,8 +37,8 @@ notification when you didn't, and the premise moved under you.
|
|
|
35
37
|
|
|
36
38
|
## 2. The dispositions (`onStale`)
|
|
37
39
|
|
|
38
|
-
Every guarded write (and every
|
|
39
|
-
|
|
40
|
+
Every guarded write (and every premise declared in §4) says what should happen
|
|
41
|
+
when it goes stale. Three modes, split by whether they **force** an outcome:
|
|
40
42
|
|
|
41
43
|
| mode | coercive? | what the engine does | who resolves | use when |
|
|
42
44
|
|---|---|---|---|---|
|
|
@@ -50,43 +52,44 @@ should be handled. Three modes, split by whether they **force** an outcome:
|
|
|
50
52
|
|
|
51
53
|
---
|
|
52
54
|
|
|
53
|
-
## 3. What is checked: two
|
|
55
|
+
## 3. What is checked: two premises
|
|
54
56
|
|
|
55
|
-
A conflict is a **
|
|
56
|
-
a concurrent delta. Ablo checks two
|
|
57
|
+
A conflict is a **premise intersection** — what your operation was based on
|
|
58
|
+
overlaps a concurrent delta. Ablo checks two premises, and they are independent.
|
|
59
|
+
They differ only in what declared them:
|
|
57
60
|
|
|
58
|
-
|
|
|
61
|
+
| premise | declared by | question | scope |
|
|
59
62
|
|---|---|---|---|
|
|
60
63
|
| **Write-target** | per-op `readAt` | "did a row I'm **writing** change since I read it?" | the rows in `operations[]` |
|
|
61
|
-
| **
|
|
64
|
+
| **Batch** | batch-level `reads[]` | "did anything I **looked at** change since I read it?" | rows/groups in `reads[]`, even if not written |
|
|
62
65
|
|
|
63
66
|
The write-target check alone is the narrow case the canary anomaly defeats: an
|
|
64
67
|
agent reads `deal.stage`, writes `task.status`, and a peer moves `deal.stage` —
|
|
65
|
-
`task` never changed, so a write-target-only check waves it through. The
|
|
66
|
-
closes that gap.
|
|
68
|
+
`task` never changed, so a write-target-only check waves it through. The batch
|
|
69
|
+
premise closes that gap.
|
|
67
70
|
|
|
68
71
|
---
|
|
69
72
|
|
|
70
|
-
## 4. The
|
|
73
|
+
## 4. The batch premise (`reads[]`)
|
|
71
74
|
|
|
72
|
-
A commit may declare, at the batch level,
|
|
75
|
+
A commit may declare, at the batch level, what its writes were based on.
|
|
73
76
|
Two granularities, developer's choice per entry:
|
|
74
77
|
|
|
75
78
|
```ts
|
|
76
79
|
reads: [
|
|
77
|
-
{ model: '
|
|
78
|
-
{ group: '
|
|
80
|
+
{ model: 'Document', id: 's-1', readAt: N, fields?: ['title'] }, // ROW premise
|
|
81
|
+
{ group: 'workspace:abc', readAt: N, onStale: 'notify' }, // GROUP premise
|
|
79
82
|
]
|
|
80
83
|
```
|
|
81
84
|
|
|
82
85
|
- **Row** — did this specific row (optionally these fields) change? The literal
|
|
83
86
|
per-object premise.
|
|
84
87
|
- **Group** — did *anything* in this sync group change? `group` is a sync-group
|
|
85
|
-
key (`
|
|
88
|
+
key (`workspace:abc`, `document:s1`, `org:X`) — the same unit a participant **watches
|
|
86
89
|
and claims**. This is the more Ablo-native granularity.
|
|
87
90
|
|
|
88
|
-
**Boundary — a stale
|
|
89
|
-
|
|
91
|
+
**Boundary — a stale premise fires over the whole batch.** Each entry covers
|
|
92
|
+
*all* the writes in the commit, so its disposition governs the batch:
|
|
90
93
|
`reject` aborts it, `notify` holds **every** write and notifies, `overwrite`
|
|
91
94
|
lets them land. Per-entry `onStale` defaults to `reject`.
|
|
92
95
|
|
|
@@ -152,7 +155,7 @@ function reconcile(n: StaleNotification) {
|
|
|
152
155
|
|
|
153
156
|
The loop **terminates** because each retry advances `readAt` to `observedSyncId`;
|
|
154
157
|
a peer that keeps writing only ever notifies you against a *newer* baseline, never
|
|
155
|
-
the same one twice. A group
|
|
158
|
+
the same one twice. A group premise reconciles identically, except `group` is set
|
|
156
159
|
and `currentValues` is empty (re-read the group).
|
|
157
160
|
|
|
158
161
|
---
|
|
@@ -186,7 +189,7 @@ What the convention **guarantees**, and where it **stops**:
|
|
|
186
189
|
(back-compat). *Open decision (§7).*
|
|
187
190
|
|
|
188
191
|
6. **Policy seam.** Custom `ConflictPolicy` functions see **write-target**
|
|
189
|
-
conflicts (`stale_context` / `claim_held`). **
|
|
192
|
+
conflicts (`stale_context` / `claim_held`). **Batch-premise** conflicts are
|
|
190
193
|
currently resolved directly via each entry's `onStale`, not through the policy
|
|
191
194
|
seam. *Open decision (§7).*
|
|
192
195
|
|
|
@@ -205,18 +208,21 @@ These are deliberately left open; they change behavior and are the user's call.
|
|
|
205
208
|
default to `notify` (philosophy-aligned: surface, don't overwrite) instead of
|
|
206
209
|
`reject` (back-compat)? Trade-off: alignment vs. a behavior change for existing
|
|
207
210
|
agent callers.
|
|
208
|
-
- **
|
|
209
|
-
through `ConflictPolicy` (requires a group-aware conflict shape), or stay
|
|
210
|
-
the direct `onStale` mapping?
|
|
211
|
+
- **Batch premises through the policy seam.** Should premise conflicts also
|
|
212
|
+
pass through `ConflictPolicy` (requires a group-aware conflict shape), or stay
|
|
213
|
+
on the direct `onStale` mapping?
|
|
211
214
|
|
|
212
215
|
---
|
|
213
216
|
|
|
214
217
|
## 8. Out of scope
|
|
215
218
|
|
|
216
219
|
- Irreversible external side-effects (§6.4) — not gated by this convention.
|
|
217
|
-
- Cross-object *serializability proof*.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
+
- Cross-object *serializability proof*. A batch premise is a sound check, not
|
|
221
|
+
a full precedence-graph guarantee; it catches only what the caller declared.
|
|
222
|
+
A caller that declares nothing gets **no check at all** — not write-target
|
|
223
|
+
checking, which needs a `readAt` to check against. A plain write is
|
|
224
|
+
last-writer-wins, as §6.5 says. The floor is zero, and closing that gap is the
|
|
225
|
+
subject of ADR 0018.
|
|
220
226
|
- Identity → participant-kind mapping. `writtenBy.kind` reports whatever
|
|
221
227
|
authenticated (an `sk_` key resolves to `system`, not `agent`); how identities
|
|
222
228
|
map to kinds is a separate concern.
|