@abloatai/transaction 0.57.0 → 0.58.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/CONVENTIONS.md +51 -41
- package/README.md +3 -1
- package/dist/ai-sdk/modelTools.d.ts +3 -3
- package/dist/ai-sdk/modelTools.d.ts.map +1 -1
- package/dist/ai-sdk/modelTools.js +1 -1
- package/dist/ai-sdk/modelTools.js.map +1 -1
- package/dist/ai-sdk/updateTool.d.ts +5 -7
- package/dist/ai-sdk/updateTool.d.ts.map +1 -1
- package/dist/ai-sdk/updateTool.js +3 -5
- package/dist/ai-sdk/updateTool.js.map +1 -1
- package/dist/auth/capability.d.ts +5 -0
- package/dist/auth/capability.d.ts.map +1 -1
- package/dist/auth/capability.js +5 -0
- package/dist/auth/capability.js.map +1 -1
- package/dist/auth/capabilityLifecycle.d.ts +1 -1
- package/dist/auth/capabilityLifecycle.d.ts.map +1 -1
- package/dist/auth/credentialPolicy.d.ts +1 -1
- package/dist/auth/credentialPolicy.d.ts.map +1 -1
- package/dist/auth/identity.d.ts +3 -3
- package/dist/auth/identity.d.ts.map +1 -1
- package/dist/auth/identity.js +5 -5
- package/dist/auth/identity.js.map +1 -1
- package/dist/auth/index.d.ts +4 -208
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +4 -330
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/runtime.d.ts +218 -0
- package/dist/auth/runtime.d.ts.map +1 -0
- package/dist/auth/runtime.js +336 -0
- package/dist/auth/runtime.js.map +1 -0
- package/dist/auth/sessionMint.d.ts +1 -1
- package/dist/auth/sessionMint.d.ts.map +1 -1
- package/dist/auth/sessionMint.js +2 -1
- package/dist/auth/sessionMint.js.map +1 -1
- package/dist/branches.d.ts +25 -21
- package/dist/branches.d.ts.map +1 -1
- package/dist/branches.js +3 -0
- package/dist/branches.js.map +1 -1
- package/dist/{coordination/awaitClaimGrant.d.ts → claims/awaitGrant.d.ts} +1 -1
- package/dist/claims/awaitGrant.d.ts.map +1 -0
- package/dist/{coordination/awaitClaimGrant.js → claims/awaitGrant.js} +4 -4
- package/dist/claims/awaitGrant.js.map +1 -0
- package/dist/{wire/claims.d.ts → claims/contract.d.ts} +1 -1
- package/dist/claims/contract.d.ts.map +1 -0
- package/dist/{wire/claims.js → claims/contract.js} +2 -2
- package/dist/claims/contract.js.map +1 -0
- package/dist/{wire/claimEvent.d.ts → claims/eventContract.d.ts} +1 -1
- package/dist/claims/eventContract.d.ts.map +1 -0
- package/dist/{wire/claimEvent.js → claims/eventContract.js} +1 -1
- package/dist/claims/eventContract.js.map +1 -0
- package/dist/{coordination → claims}/events.d.ts +7 -11
- package/dist/claims/events.d.ts.map +1 -0
- package/dist/claims/events.js +8 -0
- package/dist/claims/events.js.map +1 -0
- package/dist/{coordination/claimHeartbeatLoop.d.ts → claims/heartbeat.d.ts} +1 -1
- package/dist/claims/heartbeat.d.ts.map +1 -0
- package/dist/{coordination/claimHeartbeatLoop.js → claims/heartbeat.js} +1 -1
- package/dist/claims/heartbeat.js.map +1 -0
- package/dist/claims/index.d.ts +17 -0
- package/dist/claims/index.d.ts.map +1 -0
- package/dist/claims/index.js +16 -0
- package/dist/claims/index.js.map +1 -0
- package/dist/claims/lifetime.d.ts +26 -0
- package/dist/claims/lifetime.d.ts.map +1 -0
- package/dist/claims/lifetime.js +62 -0
- package/dist/claims/lifetime.js.map +1 -0
- package/dist/{coordination → claims}/locator.d.ts +1 -1
- package/dist/claims/locator.d.ts.map +1 -0
- package/dist/{coordination → claims}/locator.js +2 -2
- package/dist/claims/locator.js.map +1 -0
- package/dist/{coordination/claimMeta.d.ts → claims/meta.d.ts} +1 -1
- package/dist/claims/meta.d.ts.map +1 -0
- package/dist/{coordination/claimMeta.js → claims/meta.js} +1 -1
- package/dist/claims/meta.js.map +1 -0
- package/dist/claims/routes.d.ts +59 -0
- package/dist/claims/routes.d.ts.map +1 -0
- package/dist/claims/routes.js +69 -0
- package/dist/claims/routes.js.map +1 -0
- package/dist/claims/targetConflict.d.ts.map +1 -0
- package/dist/claims/targetConflict.js.map +1 -0
- package/dist/{coordination → claims}/trace.d.ts +2 -2
- package/dist/claims/trace.d.ts.map +1 -0
- package/dist/{coordination → claims}/trace.js +5 -5
- package/dist/claims/trace.js.map +1 -0
- package/dist/{ablo.d.ts → client/ablo.d.ts} +6 -15
- package/dist/client/ablo.d.ts.map +1 -0
- package/dist/{ablo.js → client/ablo.js} +2 -2
- package/dist/client/ablo.js.map +1 -0
- package/dist/{transactionLayer.d.ts → client/contract.d.ts} +12 -14
- package/dist/client/contract.d.ts.map +1 -0
- package/dist/{transactionLayer.js → client/contract.js} +4 -5
- package/dist/client/contract.js.map +1 -0
- package/dist/{headlessClient.d.ts → client/headless.d.ts} +4 -4
- package/dist/client/headless.d.ts.map +1 -0
- package/dist/{headlessClient.js → client/headless.js} +8 -10
- package/dist/{headlessClient.js.map → client/headless.js.map} +1 -1
- package/dist/client/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +11 -0
- package/dist/client/index.js.map +1 -0
- package/dist/{resources → client/resources}/functionalUpdate.d.ts +4 -4
- package/dist/client/resources/functionalUpdate.d.ts.map +1 -0
- package/dist/{resources → client/resources}/functionalUpdate.js +3 -3
- package/dist/client/resources/functionalUpdate.js.map +1 -0
- package/dist/{resources → client/resources}/httpResources.d.ts +51 -57
- package/dist/client/resources/httpResources.d.ts.map +1 -0
- package/dist/{resources → client/resources}/httpResources.js +1 -1
- package/dist/client/resources/httpResources.js.map +1 -0
- package/dist/{resources → client/resources}/modelCreate.d.ts +1 -1
- package/dist/client/resources/modelCreate.d.ts.map +1 -0
- package/dist/{resources → client/resources}/modelCreate.js +1 -1
- package/dist/client/resources/modelCreate.js.map +1 -0
- package/dist/{resources → client/resources}/modelOperations.d.ts +35 -51
- package/dist/client/resources/modelOperations.d.ts.map +1 -0
- package/dist/{resources → client/resources}/modelOperations.js +1 -1
- package/dist/client/resources/modelOperations.js.map +1 -0
- package/dist/{resources → client/resources}/mutationOptions.d.ts +4 -17
- package/dist/client/resources/mutationOptions.d.ts.map +1 -0
- package/dist/client/resources/mutationOptions.js.map +1 -0
- package/dist/client/resources/where.d.ts.map +1 -0
- package/dist/{resources → client/resources}/where.js +1 -1
- package/dist/client/resources/where.js.map +1 -0
- package/dist/{resources → client/resources}/writeOptionsSchema.d.ts +2 -35
- package/dist/client/resources/writeOptionsSchema.d.ts.map +1 -0
- package/dist/{resources → client/resources}/writeOptionsSchema.js +5 -18
- package/dist/client/resources/writeOptionsSchema.js.map +1 -0
- package/dist/{transactions → commit}/confirmation/commitEnvelope.d.ts +1 -37
- package/dist/commit/confirmation/commitEnvelope.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/commitEnvelope.js +2 -7
- package/dist/commit/confirmation/commitEnvelope.js.map +1 -0
- package/dist/commit/confirmation/httpCommitEnvelope.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.js +1 -1
- package/dist/commit/confirmation/httpCommitEnvelope.js.map +1 -0
- package/dist/commit/confirmation/idempotencyKey.d.ts.map +1 -0
- package/dist/commit/confirmation/idempotencyKey.js.map +1 -0
- package/dist/{transactions → commit}/confirmation/pendingWrite.d.ts +2 -33
- package/dist/commit/confirmation/pendingWrite.d.ts.map +1 -0
- package/dist/{transactions → commit}/confirmation/pendingWrite.js +1 -1
- package/dist/commit/confirmation/pendingWrite.js.map +1 -0
- package/dist/commit/contract.d.ts +1404 -0
- package/dist/commit/contract.d.ts.map +1 -0
- package/dist/{wire/commit.js → commit/contract.js} +13 -20
- package/dist/commit/contract.js.map +1 -0
- package/dist/{durableWrites.d.ts → commit/durableWrites.d.ts} +6 -6
- package/dist/commit/durableWrites.d.ts.map +1 -0
- package/dist/{durableWrites.js → commit/durableWrites.js} +5 -5
- package/dist/commit/durableWrites.js.map +1 -0
- package/dist/{transport/httpCommitRequest.d.ts → commit/httpRequest.d.ts} +6 -6
- package/dist/commit/httpRequest.d.ts.map +1 -0
- package/dist/{transport/httpCommitRequest.js → commit/httpRequest.js} +2 -3
- package/dist/commit/httpRequest.js.map +1 -0
- package/dist/commit/index.d.ts +17 -0
- package/dist/commit/index.d.ts.map +1 -0
- package/dist/commit/index.js +17 -0
- package/dist/commit/index.js.map +1 -0
- package/dist/{readSetContext.d.ts → commit/readSetContext.d.ts} +7 -15
- package/dist/commit/readSetContext.d.ts.map +1 -0
- package/dist/{readSetContext.js → commit/readSetContext.js} +10 -25
- package/dist/commit/readSetContext.js.map +1 -0
- package/dist/{commitRecordRuntime.d.ts → commit/recordRuntime.d.ts} +3 -5
- package/dist/commit/recordRuntime.d.ts.map +1 -0
- package/dist/{commitRecordRuntime.js → commit/recordRuntime.js} +13 -54
- package/dist/commit/recordRuntime.js.map +1 -0
- package/dist/coordination/index.d.ts +6 -8
- package/dist/coordination/index.d.ts.map +1 -1
- package/dist/coordination/index.js +3 -9
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/schema.d.ts +11 -459
- package/dist/coordination/schema.d.ts.map +1 -1
- package/dist/coordination/schema.js +13 -261
- package/dist/coordination/schema.js.map +1 -1
- package/dist/errorCodes.d.ts +15 -9
- package/dist/errorCodes.d.ts.map +1 -1
- package/dist/errorCodes.js +13 -6
- package/dist/errorCodes.js.map +1 -1
- package/dist/errorObservation.d.ts +2 -2
- package/dist/errors.d.ts +3 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +27 -11
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/read-set.d.ts +3 -3
- package/dist/internal/read-set.d.ts.map +1 -1
- package/dist/internal/read-set.js +2 -2
- package/dist/internal/read-set.js.map +1 -1
- package/dist/observability.d.ts +4 -4
- package/dist/observability.d.ts.map +1 -1
- package/dist/observability.js +2 -2
- package/dist/{wire/delta.d.ts → observation/contract.d.ts} +8 -8
- package/dist/observation/contract.d.ts.map +1 -0
- package/dist/{wire/delta.js → observation/contract.js} +3 -3
- package/dist/observation/contract.js.map +1 -0
- package/dist/{wire/feedCursor.d.ts → observation/cursor.d.ts} +1 -1
- package/dist/observation/cursor.d.ts.map +1 -0
- package/dist/{wire/feedCursor.js → observation/cursor.js} +1 -1
- package/dist/observation/cursor.js.map +1 -0
- package/dist/{wire/deltaDelivery.d.ts → observation/deliveryContract.d.ts} +1 -1
- package/dist/observation/deliveryContract.d.ts.map +1 -0
- package/dist/{wire/deltaDelivery.js → observation/deliveryContract.js} +1 -1
- package/dist/observation/deliveryContract.js.map +1 -0
- package/dist/{wire/feedEvent.d.ts → observation/feedContract.d.ts} +10 -10
- package/dist/observation/feedContract.d.ts.map +1 -0
- package/dist/{wire/feedEvent.js → observation/feedContract.js} +4 -4
- package/dist/observation/feedContract.js.map +1 -0
- package/dist/observation/httpFeed.d.ts +4 -0
- package/dist/observation/httpFeed.d.ts.map +1 -0
- package/dist/{transport → observation}/httpFeed.js +1 -1
- package/dist/{transport → observation}/httpFeed.js.map +1 -1
- package/dist/observation/index.d.ts +13 -0
- package/dist/observation/index.d.ts.map +1 -0
- package/dist/observation/index.js +13 -0
- package/dist/observation/index.js.map +1 -0
- package/dist/{log → observation/persistence}/syncDeltaRow.d.ts +8 -8
- package/dist/observation/persistence/syncDeltaRow.d.ts.map +1 -0
- package/dist/{log → observation/persistence}/syncDeltaRow.js +4 -4
- package/dist/observation/persistence/syncDeltaRow.js.map +1 -0
- package/dist/pricing.d.ts +20 -12
- package/dist/pricing.d.ts.map +1 -1
- package/dist/pricing.js +46 -26
- package/dist/pricing.js.map +1 -1
- package/dist/schema/index.d.ts +5 -6
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +4 -7
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/model.d.ts +0 -27
- package/dist/schema/model.d.ts.map +1 -1
- package/dist/schema/model.js +0 -2
- package/dist/schema/model.js.map +1 -1
- package/dist/schema/openapi.d.ts.map +1 -1
- package/dist/schema/openapi.js +45 -6
- package/dist/schema/openapi.js.map +1 -1
- package/dist/schema/schema.d.ts +11 -3
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +9 -2
- package/dist/schema/schema.js.map +1 -1
- package/dist/schema/serialize.d.ts +1 -4
- package/dist/schema/serialize.d.ts.map +1 -1
- package/dist/schema/serialize.js +0 -4
- package/dist/schema/serialize.js.map +1 -1
- package/dist/schema/tenancy.d.ts +1 -1
- package/dist/server/adapter.d.ts +1 -1
- package/dist/server/adapter.d.ts.map +1 -1
- package/dist/server/commit.d.ts +6 -14
- package/dist/server/commit.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/storageMode.d.ts +1 -1
- package/dist/source/{adapter.d.ts → adapters/adapter.d.ts} +10 -4
- package/dist/source/adapters/adapter.d.ts.map +1 -0
- package/dist/source/adapters/adapter.js.map +1 -0
- package/dist/source/adapters/adapterFactory.d.ts.map +1 -0
- package/dist/source/{adapterFactory.js → adapters/adapterFactory.js} +1 -1
- package/dist/source/adapters/adapterFactory.js.map +1 -0
- package/dist/source/adapters/adapterProfile.d.ts.map +1 -0
- package/dist/source/adapters/adapterProfile.js.map +1 -0
- package/dist/source/{conformance.d.ts → adapters/conformance.d.ts} +1 -1
- package/dist/source/adapters/conformance.d.ts.map +1 -0
- package/dist/source/{conformance.js → adapters/conformance.js} +1 -1
- package/dist/source/adapters/conformance.js.map +1 -0
- package/dist/source/{contract.d.ts → adapters/contract.d.ts} +8 -77
- package/dist/source/adapters/contract.d.ts.map +1 -0
- package/dist/source/{contract.js → adapters/contract.js} +12 -57
- package/dist/source/adapters/contract.js.map +1 -0
- package/dist/source/adapters/drizzle.d.ts +1 -1
- package/dist/source/adapters/drizzle.d.ts.map +1 -1
- package/dist/source/adapters/drizzle.js +21 -23
- package/dist/source/adapters/drizzle.js.map +1 -1
- package/dist/source/adapters/idempotency.d.ts.map +1 -0
- package/dist/source/{idempotency.js → adapters/idempotency.js} +2 -2
- package/dist/source/adapters/idempotency.js.map +1 -0
- package/dist/source/adapters/index.d.ts +21 -0
- package/dist/source/adapters/index.d.ts.map +1 -0
- package/dist/source/adapters/index.js +21 -0
- package/dist/source/adapters/index.js.map +1 -0
- package/dist/source/adapters/kysely.d.ts +1 -1
- package/dist/source/adapters/kysely.d.ts.map +1 -1
- package/dist/source/adapters/kysely.js +18 -20
- package/dist/source/adapters/kysely.js.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.d.ts +2 -2
- package/dist/source/adapters/kyselyMutationCore.d.ts.map +1 -1
- package/dist/source/adapters/kyselyMutationCore.js +1 -1
- package/dist/source/adapters/kyselyMutationCore.js.map +1 -1
- package/dist/source/adapters/memory.d.ts +3 -3
- package/dist/source/adapters/memory.d.ts.map +1 -1
- package/dist/source/adapters/memory.js +19 -7
- package/dist/source/adapters/memory.js.map +1 -1
- package/dist/source/adapters/migration.d.ts +8 -0
- package/dist/source/adapters/migration.d.ts.map +1 -0
- package/dist/source/adapters/migration.js +9 -0
- package/dist/source/adapters/migration.js.map +1 -0
- package/dist/source/{migrations.d.ts → adapters/migrations.d.ts} +3 -4
- package/dist/source/adapters/migrations.d.ts.map +1 -0
- package/dist/source/{migrations.js → adapters/migrations.js} +4 -52
- package/dist/source/adapters/migrations.js.map +1 -0
- package/dist/source/adapters/prisma.d.ts +1 -1
- package/dist/source/adapters/prisma.d.ts.map +1 -1
- package/dist/source/adapters/prisma.js +21 -28
- package/dist/source/adapters/prisma.js.map +1 -1
- package/dist/source/{subjectAuthorization.d.ts → adapters/subjectAuthorization.d.ts} +1 -1
- package/dist/source/adapters/subjectAuthorization.d.ts.map +1 -0
- package/dist/source/{subjectAuthorization.js → adapters/subjectAuthorization.js} +2 -2
- package/dist/source/adapters/subjectAuthorization.js.map +1 -0
- package/dist/source/{connector.d.ts → connector/client.d.ts} +6 -1
- package/dist/source/connector/client.d.ts.map +1 -0
- package/dist/source/{connector.js → connector/client.js} +28 -11
- package/dist/source/connector/client.js.map +1 -0
- package/dist/source/connector/index.d.ts +4 -0
- package/dist/source/connector/index.d.ts.map +1 -0
- package/dist/source/connector/index.js +4 -0
- package/dist/source/connector/index.js.map +1 -0
- package/dist/source/{connectorProtocol.d.ts → connector/protocol.d.ts} +8 -1
- package/dist/source/connector/protocol.d.ts.map +1 -0
- package/dist/source/{connectorProtocol.js → connector/protocol.js} +10 -3
- package/dist/source/connector/protocol.js.map +1 -0
- package/dist/source/delivery/index.d.ts +3 -0
- package/dist/source/delivery/index.d.ts.map +1 -0
- package/dist/source/delivery/index.js +3 -0
- package/dist/source/delivery/index.js.map +1 -0
- package/dist/source/{pushQueue.d.ts → delivery/pushQueue.d.ts} +1 -1
- package/dist/source/delivery/pushQueue.d.ts.map +1 -0
- package/dist/source/{pushQueue.js → delivery/pushQueue.js} +1 -1
- package/dist/source/delivery/pushQueue.js.map +1 -0
- package/dist/source/{factory.d.ts → endpoint/factory.d.ts} +3 -3
- package/dist/source/endpoint/factory.d.ts.map +1 -0
- package/dist/source/{factory.js → endpoint/factory.js} +9 -4
- package/dist/source/endpoint/factory.js.map +1 -0
- package/dist/source/endpoint/index.d.ts +5 -0
- package/dist/source/endpoint/index.d.ts.map +1 -0
- package/dist/source/endpoint/index.js +5 -0
- package/dist/source/endpoint/index.js.map +1 -0
- package/dist/source/{next.d.ts → endpoint/next.d.ts} +2 -2
- package/dist/source/endpoint/next.d.ts.map +1 -0
- package/dist/source/{next.js → endpoint/next.js} +1 -1
- package/dist/source/endpoint/next.js.map +1 -0
- package/dist/source/{signing.d.ts → endpoint/signing.d.ts} +1 -1
- package/dist/source/endpoint/signing.d.ts.map +1 -0
- package/dist/source/{signing.js → endpoint/signing.js} +1 -1
- package/dist/source/endpoint/signing.js.map +1 -0
- package/dist/source/index.d.ts +14 -12
- package/dist/source/index.d.ts.map +1 -1
- package/dist/source/index.js +13 -11
- package/dist/source/index.js.map +1 -1
- package/dist/source/outbox/contract.d.ts +50 -0
- package/dist/source/outbox/contract.d.ts.map +1 -0
- package/dist/source/outbox/contract.js +50 -0
- package/dist/source/outbox/contract.js.map +1 -0
- package/dist/source/outbox/envelope.d.ts +9 -0
- package/dist/source/outbox/envelope.d.ts.map +1 -0
- package/dist/source/outbox/envelope.js +36 -0
- package/dist/source/outbox/envelope.js.map +1 -0
- package/dist/source/outbox/index.d.ts +11 -0
- package/dist/source/outbox/index.d.ts.map +1 -0
- package/dist/source/outbox/index.js +11 -0
- package/dist/source/outbox/index.js.map +1 -0
- package/dist/source/outbox/migrations.d.ts +4 -0
- package/dist/source/outbox/migrations.d.ts.map +1 -0
- package/dist/source/outbox/migrations.js +67 -0
- package/dist/source/outbox/migrations.js.map +1 -0
- package/dist/source/outbox/retention.d.ts +3 -0
- package/dist/source/outbox/retention.d.ts.map +1 -0
- package/dist/source/outbox/retention.js +3 -0
- package/dist/source/outbox/retention.js.map +1 -0
- package/dist/source/types.d.ts +16 -17
- package/dist/source/types.d.ts.map +1 -1
- package/dist/source/types.js +1 -0
- package/dist/source/types.js.map +1 -1
- package/dist/syncLog/contract.d.ts +19 -2
- package/dist/syncLog/contract.d.ts.map +1 -1
- package/dist/syncLog/contract.js +19 -2
- package/dist/syncLog/contract.js.map +1 -1
- package/dist/transport/{credentialLifecycle.d.ts → connection/credentialLifecycle.d.ts} +3 -3
- package/dist/transport/connection/credentialLifecycle.d.ts.map +1 -0
- package/dist/transport/{credentialLifecycle.js → connection/credentialLifecycle.js} +2 -2
- package/dist/transport/connection/credentialLifecycle.js.map +1 -0
- package/dist/transport/connection/index.d.ts +5 -0
- package/dist/transport/connection/index.d.ts.map +1 -0
- package/dist/transport/connection/index.js +5 -0
- package/dist/transport/connection/index.js.map +1 -0
- package/dist/transport/{connectionManager.d.ts → connection/manager.d.ts} +13 -5
- package/dist/transport/connection/manager.d.ts.map +1 -0
- package/dist/transport/{connectionManager.js → connection/manager.js} +6 -4
- package/dist/transport/connection/manager.js.map +1 -0
- package/dist/transport/{networkProbe.d.ts → connection/networkProbe.d.ts} +2 -2
- package/dist/transport/connection/networkProbe.d.ts.map +1 -0
- package/dist/transport/{networkProbe.js → connection/networkProbe.js} +4 -4
- package/dist/transport/connection/networkProbe.js.map +1 -0
- package/dist/transport/{httpClient.d.ts → http/client.d.ts} +26 -45
- package/dist/transport/http/client.d.ts.map +1 -0
- package/dist/transport/{httpClient.js → http/client.js} +84 -124
- package/dist/transport/http/client.js.map +1 -0
- package/dist/transport/{httpTransportHelpers.d.ts → http/helpers.d.ts} +5 -5
- package/dist/transport/http/helpers.d.ts.map +1 -0
- package/dist/transport/{httpTransportHelpers.js → http/helpers.js} +5 -5
- package/dist/transport/http/helpers.js.map +1 -0
- package/dist/transport/http/index.d.ts +6 -0
- package/dist/transport/http/index.d.ts.map +1 -0
- package/dist/transport/http/index.js +6 -0
- package/dist/transport/http/index.js.map +1 -0
- package/dist/transport/{httpOptions.d.ts → http/options.d.ts} +7 -7
- package/dist/transport/{httpOptions.d.ts.map → http/options.d.ts.map} +1 -1
- package/dist/transport/{httpOptions.js → http/options.js} +1 -1
- package/dist/transport/http/options.js.map +1 -0
- package/dist/transport/http/subscription.d.ts +16 -0
- package/dist/transport/http/subscription.d.ts.map +1 -0
- package/dist/transport/http/subscription.js +146 -0
- package/dist/transport/http/subscription.js.map +1 -0
- package/dist/transport/{httpTransport.d.ts → http/transport.d.ts} +9 -6
- package/dist/transport/http/transport.d.ts.map +1 -0
- package/dist/transport/{httpTransport.js → http/transport.js} +95 -93
- package/dist/transport/http/transport.js.map +1 -0
- package/dist/transport/index.d.ts +8 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +8 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/{commitFrames.d.ts → websocket/commitFrames.d.ts} +8 -20
- package/dist/transport/websocket/commitFrames.d.ts.map +1 -0
- package/dist/transport/{commitFrames.js → websocket/commitFrames.js} +6 -25
- package/dist/transport/websocket/commitFrames.js.map +1 -0
- package/dist/transport/{wsFrameHandlers.d.ts → websocket/frameHandlers.d.ts} +5 -5
- package/dist/transport/websocket/frameHandlers.d.ts.map +1 -0
- package/dist/transport/{wsFrameHandlers.js → websocket/frameHandlers.js} +10 -51
- package/dist/transport/websocket/frameHandlers.js.map +1 -0
- package/dist/transport/{heartbeat.d.ts → websocket/heartbeat.d.ts} +1 -1
- package/dist/transport/websocket/heartbeat.d.ts.map +1 -0
- package/dist/transport/{heartbeat.js → websocket/heartbeat.js} +2 -2
- package/dist/transport/websocket/heartbeat.js.map +1 -0
- package/dist/transport/websocket/index.d.ts +6 -0
- package/dist/transport/websocket/index.d.ts.map +1 -0
- package/dist/transport/websocket/index.js +6 -0
- package/dist/transport/websocket/index.js.map +1 -0
- package/dist/transport/{wsTransport.d.ts → websocket/transport.d.ts} +13 -25
- package/dist/transport/websocket/transport.d.ts.map +1 -0
- package/dist/transport/{wsTransport.js → websocket/transport.js} +14 -14
- package/dist/transport/websocket/transport.js.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/streams.d.ts +8 -48
- package/dist/types/streams.d.ts.map +1 -1
- package/dist/types/streams.js +2 -2
- package/dist/wire/accountResponses.d.ts +4 -72
- package/dist/wire/accountResponses.d.ts.map +1 -1
- package/dist/wire/accountResponses.js +2 -10
- package/dist/wire/accountResponses.js.map +1 -1
- package/dist/wire/frames.d.ts +6 -83
- package/dist/wire/frames.d.ts.map +1 -1
- package/dist/wire/frames.js +4 -11
- package/dist/wire/frames.js.map +1 -1
- package/dist/wire/inboundFrames.d.ts +6 -131
- package/dist/wire/inboundFrames.d.ts.map +1 -1
- package/dist/wire/inboundFrames.js +3 -3
- package/dist/wire/inboundFrames.js.map +1 -1
- package/dist/wire/index.d.ts +17 -15
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +11 -8
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/modelMutations.d.ts +1 -32
- package/dist/wire/modelMutations.d.ts.map +1 -1
- package/dist/wire/modelMutations.js +1 -8
- package/dist/wire/modelMutations.js.map +1 -1
- package/package.json +130 -10
- package/src/ai-sdk/modelTools.ts +5 -5
- package/src/ai-sdk/updateTool.ts +5 -7
- package/src/auth/capability.ts +5 -0
- package/src/auth/capabilityLifecycle.ts +1 -1
- package/src/auth/credentialPolicy.ts +1 -1
- package/src/auth/identity.ts +7 -7
- package/src/auth/index.ts +4 -663
- package/src/auth/runtime.ts +669 -0
- package/src/auth/sessionMint.ts +3 -2
- package/src/branches.ts +3 -0
- package/src/{coordination/awaitClaimGrant.ts → claims/awaitGrant.ts} +4 -4
- package/src/{wire/claims.ts → claims/contract.ts} +1 -1
- package/src/{coordination → claims}/events.ts +7 -11
- package/src/claims/index.ts +21 -0
- package/src/claims/lifetime.ts +78 -0
- package/src/{coordination → claims}/locator.ts +3 -3
- package/src/claims/routes.ts +81 -0
- package/src/{coordination → claims}/trace.ts +5 -5
- package/src/{ablo.ts → client/ablo.ts} +8 -20
- package/src/{transactionLayer.ts → client/contract.ts} +11 -13
- package/src/{headlessClient.ts → client/headless.ts} +13 -15
- package/src/client/index.ts +10 -0
- package/src/{resources → client/resources}/functionalUpdate.ts +4 -4
- package/src/{resources → client/resources}/httpResources.ts +48 -68
- package/src/{resources → client/resources}/modelCreate.ts +2 -2
- package/src/{resources → client/resources}/modelOperations.ts +46 -55
- package/src/{resources → client/resources}/mutationOptions.ts +4 -17
- package/src/{resources → client/resources}/where.ts +1 -1
- package/src/{resources → client/resources}/writeOptionsSchema.ts +7 -27
- package/src/{transactions → commit}/confirmation/commitEnvelope.ts +2 -12
- package/src/{transactions → commit}/confirmation/httpCommitEnvelope.ts +1 -1
- package/src/{transactions → commit}/confirmation/pendingWrite.ts +1 -1
- package/src/{wire/commit.ts → commit/contract.ts} +11 -25
- package/src/{durableWrites.ts → commit/durableWrites.ts} +7 -7
- package/src/{transport/httpCommitRequest.ts → commit/httpRequest.ts} +6 -7
- package/src/commit/index.ts +16 -0
- package/src/{readSetContext.ts → commit/readSetContext.ts} +16 -41
- package/src/{commitRecordRuntime.ts → commit/recordRuntime.ts} +12 -67
- package/src/coordination/index.ts +4 -52
- package/src/coordination/schema.ts +15 -302
- package/src/errorCodes.ts +56 -10
- package/src/errors.ts +32 -10
- package/src/index.ts +8 -8
- package/src/internal/read-set.ts +3 -6
- package/src/observability.ts +4 -4
- package/src/{wire/delta.ts → observation/contract.ts} +2 -2
- package/src/{wire/feedEvent.ts → observation/feedContract.ts} +3 -4
- package/src/{transport → observation}/httpFeed.ts +3 -3
- package/src/observation/index.ts +12 -0
- package/src/{log → observation/persistence}/syncDeltaRow.ts +6 -7
- package/src/pricing.ts +46 -25
- package/src/schema/index.ts +4 -20
- package/src/schema/model.ts +0 -33
- package/src/schema/openapi.ts +47 -7
- package/src/schema/schema.ts +23 -3
- package/src/schema/serialize.ts +0 -8
- package/src/server/adapter.ts +1 -1
- package/src/server/commit.ts +6 -14
- package/src/server/index.ts +1 -1
- package/src/source/{adapter.ts → adapters/adapter.ts} +9 -5
- package/src/source/{adapterFactory.ts → adapters/adapterFactory.ts} +1 -1
- package/src/source/{conformance.ts → adapters/conformance.ts} +1 -1
- package/src/source/{contract.ts → adapters/contract.ts} +16 -64
- package/src/source/adapters/drizzle.ts +29 -27
- package/src/source/{idempotency.ts → adapters/idempotency.ts} +2 -2
- package/src/source/adapters/index.ts +20 -0
- package/src/source/adapters/kysely.ts +32 -25
- package/src/source/adapters/kyselyMutationCore.ts +3 -3
- package/src/source/adapters/memory.ts +25 -9
- package/src/source/adapters/migration.ts +11 -0
- package/src/source/{migrations.ts → adapters/migrations.ts} +6 -54
- package/src/source/adapters/prisma.ts +33 -32
- package/src/source/{subjectAuthorization.ts → adapters/subjectAuthorization.ts} +2 -2
- package/src/source/{connector.ts → connector/client.ts} +35 -12
- package/src/source/connector/index.ts +3 -0
- package/src/source/{connectorProtocol.ts → connector/protocol.ts} +10 -2
- package/src/source/delivery/index.ts +2 -0
- package/src/source/{pushQueue.ts → delivery/pushQueue.ts} +2 -2
- package/src/source/{factory.ts → endpoint/factory.ts} +13 -8
- package/src/source/endpoint/index.ts +4 -0
- package/src/source/{next.ts → endpoint/next.ts} +2 -2
- package/src/source/{signing.ts → endpoint/signing.ts} +1 -1
- package/src/source/index.ts +22 -19
- package/src/source/outbox/contract.ts +56 -0
- package/src/source/outbox/envelope.ts +47 -0
- package/src/source/outbox/index.ts +15 -0
- package/src/source/outbox/migrations.ts +71 -0
- package/src/source/outbox/retention.ts +2 -0
- package/src/source/types.ts +17 -17
- package/src/syncLog/contract.ts +19 -2
- package/src/transport/{credentialLifecycle.ts → connection/credentialLifecycle.ts} +3 -3
- package/src/transport/connection/index.ts +4 -0
- package/src/transport/{connectionManager.ts → connection/manager.ts} +13 -4
- package/src/transport/{networkProbe.ts → connection/networkProbe.ts} +4 -4
- package/src/transport/{httpClient.ts → http/client.ts} +128 -209
- package/src/transport/{httpTransportHelpers.ts → http/helpers.ts} +7 -7
- package/src/transport/http/index.ts +5 -0
- package/src/transport/{httpOptions.ts → http/options.ts} +6 -6
- package/src/transport/http/subscription.ts +174 -0
- package/src/transport/{httpTransport.ts → http/transport.ts} +127 -113
- package/src/transport/index.ts +7 -0
- package/src/transport/{commitFrames.ts → websocket/commitFrames.ts} +14 -46
- package/src/transport/{wsFrameHandlers.ts → websocket/frameHandlers.ts} +11 -54
- package/src/transport/{heartbeat.ts → websocket/heartbeat.ts} +2 -2
- package/src/transport/websocket/index.ts +5 -0
- package/src/transport/{wsTransport.ts → websocket/transport.ts} +16 -30
- package/src/types/index.ts +2 -6
- package/src/types/streams.ts +7 -61
- package/src/webhooks/events.ts +1 -1
- package/src/wire/accountResponses.ts +3 -12
- package/src/wire/frames.ts +5 -15
- package/src/wire/inboundFrames.ts +3 -3
- package/src/wire/index.ts +19 -15
- package/src/wire/modelMutations.ts +1 -14
- package/dist/ablo.d.ts.map +0 -1
- package/dist/ablo.js.map +0 -1
- package/dist/commitRecordRuntime.d.ts.map +0 -1
- package/dist/commitRecordRuntime.js.map +0 -1
- package/dist/coordination/awaitClaimGrant.d.ts.map +0 -1
- package/dist/coordination/awaitClaimGrant.js.map +0 -1
- package/dist/coordination/claimHeartbeatLoop.d.ts.map +0 -1
- package/dist/coordination/claimHeartbeatLoop.js.map +0 -1
- package/dist/coordination/claimMeta.d.ts.map +0 -1
- package/dist/coordination/claimMeta.js.map +0 -1
- package/dist/coordination/events.d.ts.map +0 -1
- package/dist/coordination/events.js +0 -8
- package/dist/coordination/events.js.map +0 -1
- package/dist/coordination/locator.d.ts.map +0 -1
- package/dist/coordination/locator.js.map +0 -1
- package/dist/coordination/targetConflict.d.ts.map +0 -1
- package/dist/coordination/targetConflict.js.map +0 -1
- package/dist/coordination/trace.d.ts.map +0 -1
- package/dist/coordination/trace.js.map +0 -1
- package/dist/durableWrites.d.ts.map +0 -1
- package/dist/durableWrites.js.map +0 -1
- package/dist/headlessClient.d.ts.map +0 -1
- package/dist/log/syncDeltaRow.d.ts.map +0 -1
- package/dist/log/syncDeltaRow.js.map +0 -1
- package/dist/policy/types.d.ts +0 -226
- package/dist/policy/types.d.ts.map +0 -1
- package/dist/policy/types.js +0 -127
- package/dist/policy/types.js.map +0 -1
- package/dist/readSetContext.d.ts.map +0 -1
- package/dist/readSetContext.js.map +0 -1
- package/dist/resources/functionalUpdate.d.ts.map +0 -1
- package/dist/resources/functionalUpdate.js.map +0 -1
- package/dist/resources/httpResources.d.ts.map +0 -1
- package/dist/resources/httpResources.js.map +0 -1
- package/dist/resources/modelCreate.d.ts.map +0 -1
- package/dist/resources/modelCreate.js.map +0 -1
- package/dist/resources/modelOperations.d.ts.map +0 -1
- package/dist/resources/modelOperations.js.map +0 -1
- package/dist/resources/mutationOptions.d.ts.map +0 -1
- package/dist/resources/mutationOptions.js.map +0 -1
- package/dist/resources/where.d.ts.map +0 -1
- package/dist/resources/where.js.map +0 -1
- package/dist/resources/writeOptionsSchema.d.ts.map +0 -1
- package/dist/resources/writeOptionsSchema.js.map +0 -1
- package/dist/schema/coordination.d.ts +0 -113
- package/dist/schema/coordination.d.ts.map +0 -1
- package/dist/schema/coordination.js +0 -134
- package/dist/schema/coordination.js.map +0 -1
- package/dist/source/adapter.d.ts.map +0 -1
- package/dist/source/adapter.js.map +0 -1
- package/dist/source/adapterFactory.d.ts.map +0 -1
- package/dist/source/adapterFactory.js.map +0 -1
- package/dist/source/adapterProfile.d.ts.map +0 -1
- package/dist/source/adapterProfile.js.map +0 -1
- package/dist/source/conformance.d.ts.map +0 -1
- package/dist/source/conformance.js.map +0 -1
- package/dist/source/connector.d.ts.map +0 -1
- package/dist/source/connector.js.map +0 -1
- package/dist/source/connectorProtocol.d.ts.map +0 -1
- package/dist/source/connectorProtocol.js.map +0 -1
- package/dist/source/contract.d.ts.map +0 -1
- package/dist/source/contract.js.map +0 -1
- package/dist/source/drizzle.d.ts +0 -2
- package/dist/source/drizzle.d.ts.map +0 -1
- package/dist/source/drizzle.js +0 -2
- package/dist/source/drizzle.js.map +0 -1
- package/dist/source/factory.d.ts.map +0 -1
- package/dist/source/factory.js.map +0 -1
- package/dist/source/idempotency.d.ts.map +0 -1
- package/dist/source/idempotency.js.map +0 -1
- package/dist/source/kysely.d.ts +0 -3
- package/dist/source/kysely.d.ts.map +0 -1
- package/dist/source/kysely.js +0 -3
- package/dist/source/kysely.js.map +0 -1
- package/dist/source/migrations.d.ts.map +0 -1
- package/dist/source/migrations.js.map +0 -1
- package/dist/source/next.d.ts.map +0 -1
- package/dist/source/next.js.map +0 -1
- package/dist/source/pushQueue.d.ts.map +0 -1
- package/dist/source/pushQueue.js.map +0 -1
- package/dist/source/signing.d.ts.map +0 -1
- package/dist/source/signing.js.map +0 -1
- package/dist/source/subjectAuthorization.d.ts.map +0 -1
- package/dist/source/subjectAuthorization.js.map +0 -1
- package/dist/transactionLayer.d.ts.map +0 -1
- package/dist/transactionLayer.js.map +0 -1
- package/dist/transactions/confirmation/commitEnvelope.d.ts.map +0 -1
- package/dist/transactions/confirmation/commitEnvelope.js.map +0 -1
- package/dist/transactions/confirmation/httpCommitEnvelope.d.ts.map +0 -1
- package/dist/transactions/confirmation/httpCommitEnvelope.js.map +0 -1
- package/dist/transactions/confirmation/idempotencyKey.d.ts.map +0 -1
- package/dist/transactions/confirmation/idempotencyKey.js.map +0 -1
- package/dist/transactions/confirmation/pendingWrite.d.ts.map +0 -1
- package/dist/transactions/confirmation/pendingWrite.js.map +0 -1
- package/dist/transport/commitFrames.d.ts.map +0 -1
- package/dist/transport/commitFrames.js.map +0 -1
- package/dist/transport/connectionManager.d.ts.map +0 -1
- package/dist/transport/connectionManager.js.map +0 -1
- package/dist/transport/credentialLifecycle.d.ts.map +0 -1
- package/dist/transport/credentialLifecycle.js.map +0 -1
- package/dist/transport/heartbeat.d.ts.map +0 -1
- package/dist/transport/heartbeat.js.map +0 -1
- package/dist/transport/httpClient.d.ts.map +0 -1
- package/dist/transport/httpClient.js.map +0 -1
- package/dist/transport/httpCommitRequest.d.ts.map +0 -1
- package/dist/transport/httpCommitRequest.js.map +0 -1
- package/dist/transport/httpFeed.d.ts +0 -4
- package/dist/transport/httpFeed.d.ts.map +0 -1
- package/dist/transport/httpOptions.js.map +0 -1
- package/dist/transport/httpTransport.d.ts.map +0 -1
- package/dist/transport/httpTransport.js.map +0 -1
- package/dist/transport/httpTransportHelpers.d.ts.map +0 -1
- package/dist/transport/httpTransportHelpers.js.map +0 -1
- package/dist/transport/networkProbe.d.ts.map +0 -1
- package/dist/transport/networkProbe.js.map +0 -1
- package/dist/transport/wsFrameHandlers.d.ts.map +0 -1
- package/dist/transport/wsFrameHandlers.js.map +0 -1
- package/dist/transport/wsTransport.d.ts.map +0 -1
- package/dist/transport/wsTransport.js.map +0 -1
- package/dist/wire/claimEvent.d.ts.map +0 -1
- package/dist/wire/claimEvent.js.map +0 -1
- package/dist/wire/claims.d.ts.map +0 -1
- package/dist/wire/claims.js.map +0 -1
- package/dist/wire/commit.d.ts +0 -2866
- package/dist/wire/commit.d.ts.map +0 -1
- package/dist/wire/commit.js.map +0 -1
- package/dist/wire/delta.d.ts.map +0 -1
- package/dist/wire/delta.js.map +0 -1
- package/dist/wire/deltaDelivery.d.ts.map +0 -1
- package/dist/wire/deltaDelivery.js.map +0 -1
- package/dist/wire/feedCursor.d.ts.map +0 -1
- package/dist/wire/feedCursor.js.map +0 -1
- package/dist/wire/feedEvent.d.ts.map +0 -1
- package/dist/wire/feedEvent.js.map +0 -1
- package/src/policy/types.ts +0 -300
- package/src/schema/coordination.ts +0 -161
- package/src/source/drizzle.ts +0 -1
- package/src/source/kysely.ts +0 -2
- /package/dist/{coordination → claims}/targetConflict.d.ts +0 -0
- /package/dist/{coordination → claims}/targetConflict.js +0 -0
- /package/dist/{resources → client/resources}/mutationOptions.js +0 -0
- /package/dist/{resources → client/resources}/where.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/idempotencyKey.d.ts +0 -0
- /package/dist/{transactions → commit}/confirmation/idempotencyKey.js +0 -0
- /package/dist/source/{adapter.js → adapters/adapter.js} +0 -0
- /package/dist/source/{adapterFactory.d.ts → adapters/adapterFactory.d.ts} +0 -0
- /package/dist/source/{adapterProfile.d.ts → adapters/adapterProfile.d.ts} +0 -0
- /package/dist/source/{adapterProfile.js → adapters/adapterProfile.js} +0 -0
- /package/dist/source/{idempotency.d.ts → adapters/idempotency.d.ts} +0 -0
- /package/src/{wire/claimEvent.ts → claims/eventContract.ts} +0 -0
- /package/src/{coordination/claimHeartbeatLoop.ts → claims/heartbeat.ts} +0 -0
- /package/src/{coordination/claimMeta.ts → claims/meta.ts} +0 -0
- /package/src/{coordination → claims}/targetConflict.ts +0 -0
- /package/src/{transactions → commit}/confirmation/idempotencyKey.ts +0 -0
- /package/src/{wire/feedCursor.ts → observation/cursor.ts} +0 -0
- /package/src/{wire/deltaDelivery.ts → observation/deliveryContract.ts} +0 -0
- /package/src/source/{adapterProfile.ts → adapters/adapterProfile.ts} +0 -0
|
@@ -7,18 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
// The wire types for the outgoing commit frame. Importing them lets the
|
|
9
9
|
// compiler enforce the frame shape, so the client and server can't drift apart.
|
|
10
|
-
import type { CommitMessage, WireCommitOperation } from '
|
|
11
|
-
import type { CommitAck as CanonicalCommitAck } from '
|
|
12
|
-
import type {
|
|
13
|
-
|
|
14
|
-
StaleNotification,
|
|
15
|
-
ReadDependency,
|
|
16
|
-
TrackDependency,
|
|
17
|
-
} from '../coordination/schema.js';
|
|
18
|
-
import {
|
|
19
|
-
claimEventReasonSchema,
|
|
20
|
-
staleNotificationSchema,
|
|
21
|
-
} from '../coordination/schema.js';
|
|
10
|
+
import type { CommitMessage, WireCommitOperation } from '../../wire/index.js';
|
|
11
|
+
import type { CommitAck as CanonicalCommitAck } from '../../commit/contract.js';
|
|
12
|
+
import type { ReadDependency } from '../../coordination/schema.js';
|
|
13
|
+
import { claimEventReasonSchema } from '../../coordination/schema.js';
|
|
22
14
|
import type {
|
|
23
15
|
ClaimAcquired,
|
|
24
16
|
ClaimGranted,
|
|
@@ -26,20 +18,15 @@ import type {
|
|
|
26
18
|
ClaimLost,
|
|
27
19
|
ClaimRejection,
|
|
28
20
|
ClaimExpired,
|
|
29
|
-
} from '
|
|
30
|
-
import type { ClaimEvent, ClaimCounterparty } from '
|
|
31
|
-
import type { AssertExact } from '
|
|
32
|
-
import { formatClaim } from '
|
|
33
|
-
import { modelTarget } from '
|
|
34
|
-
import type { Logger } from '
|
|
35
|
-
import type { SocketObservability } from '
|
|
21
|
+
} from '../../coordination/schema.js';
|
|
22
|
+
import type { ClaimEvent, ClaimCounterparty } from '../../claims/events.js';
|
|
23
|
+
import type { AssertExact } from '../../types/assertExact.js';
|
|
24
|
+
import { formatClaim } from '../../claims/trace.js';
|
|
25
|
+
import { modelTarget } from '../../claims/locator.js';
|
|
26
|
+
import type { Logger } from '../../logger.js';
|
|
27
|
+
import type { SocketObservability } from '../../observability.js';
|
|
36
28
|
|
|
37
|
-
/**
|
|
38
|
-
* The value a commit acknowledgement resolves to. `notifications` is present
|
|
39
|
-
* only when a guarded write (`onStale: 'notify'`) met a concurrent change; it
|
|
40
|
-
* carries the advisory signal that lets the writer self-heal, and the same
|
|
41
|
-
* signal also arrives on the `conflict:notified` event.
|
|
42
|
-
*/
|
|
29
|
+
/** The value a commit acknowledgement resolves to. */
|
|
43
30
|
export type CommitAck = CanonicalCommitAck;
|
|
44
31
|
|
|
45
32
|
/**
|
|
@@ -55,7 +42,6 @@ export interface CommitFrameOperation {
|
|
|
55
42
|
readonly transactionId?: string;
|
|
56
43
|
readonly claimId?: string | null;
|
|
57
44
|
readonly readAt?: number | null;
|
|
58
|
-
readonly onStale?: OnStaleMode | null;
|
|
59
45
|
readonly fenceToken?: number | null;
|
|
60
46
|
}
|
|
61
47
|
|
|
@@ -72,7 +58,6 @@ export function buildCommitFrame(
|
|
|
72
58
|
operations: readonly CommitFrameOperation[],
|
|
73
59
|
clientTxId: string,
|
|
74
60
|
reads?: readonly ReadDependency[] | null,
|
|
75
|
-
track?: readonly TrackDependency[] | null,
|
|
76
61
|
): CommitMessage {
|
|
77
62
|
const payload: CommitMessage['payload'] = {
|
|
78
63
|
operations: operations.map((op) => ({
|
|
@@ -83,7 +68,6 @@ export function buildCommitFrame(
|
|
|
83
68
|
transactionId: op.transactionId,
|
|
84
69
|
claimId: op.claimId,
|
|
85
70
|
readAt: op.readAt,
|
|
86
|
-
onStale: op.onStale,
|
|
87
71
|
fenceToken: op.fenceToken,
|
|
88
72
|
})),
|
|
89
73
|
clientTxId,
|
|
@@ -92,25 +76,9 @@ export function buildCommitFrame(
|
|
|
92
76
|
// and omission are distinct inputs even when today's server treats each as
|
|
93
77
|
// "none"; the WebSocket path must not silently erase a field the caller set.
|
|
94
78
|
if (reads !== undefined) payload.reads = reads === null ? null : [...reads];
|
|
95
|
-
if (track !== undefined) payload.track = track === null ? null : [...track];
|
|
96
79
|
return { type: 'commit', payload };
|
|
97
80
|
}
|
|
98
81
|
|
|
99
|
-
/**
|
|
100
|
-
* Defensively validate the optional `notifications` array off a commit ack.
|
|
101
|
-
* Untrusted wire data — a malformed entry is dropped rather than throwing,
|
|
102
|
-
* so a bad notification never sinks an otherwise-successful commit.
|
|
103
|
-
*/
|
|
104
|
-
export function parseNotifications(raw: unknown): StaleNotification[] | undefined {
|
|
105
|
-
if (!Array.isArray(raw) || raw.length === 0) return undefined;
|
|
106
|
-
const out: StaleNotification[] = [];
|
|
107
|
-
for (const entry of raw) {
|
|
108
|
-
const parsed = staleNotificationSchema.safeParse(entry);
|
|
109
|
-
if (parsed.success) out.push(parsed.data);
|
|
110
|
-
}
|
|
111
|
-
return out.length > 0 ? out : undefined;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
82
|
/** The reporting ports a claim trace writes through — supplied by the caller
|
|
115
83
|
* (the frame dispatch passes its session's own ports). */
|
|
116
84
|
export interface ClaimTracePorts {
|
|
@@ -209,8 +177,8 @@ export function recordClaim<P extends keyof ClaimFrameByPhase>(
|
|
|
209
177
|
: {}),
|
|
210
178
|
...('position' in frame ? { position: frame.position } : {}),
|
|
211
179
|
...(parsedReason?.success ? { reason: parsedReason.data } : {}),
|
|
212
|
-
...('
|
|
213
|
-
? {
|
|
180
|
+
...('message' in frame && frame.message !== undefined
|
|
181
|
+
? { message: frame.message }
|
|
214
182
|
: {}),
|
|
215
183
|
...(Object.keys(counterparty).length > 0 ? { heldBy: counterparty } : {}),
|
|
216
184
|
};
|
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
CapabilityError,
|
|
14
14
|
errorFromWire,
|
|
15
15
|
type RequiredCapability,
|
|
16
|
-
} from '
|
|
16
|
+
} from '../../errors.js';
|
|
17
17
|
import {
|
|
18
18
|
commitAckSchema,
|
|
19
19
|
commitReceiptSchema,
|
|
20
20
|
type CommitReceiptWire,
|
|
21
|
-
} from '
|
|
22
|
-
import { subscriptionAckPayloadSchema } from '
|
|
21
|
+
} from '../../commit/contract.js';
|
|
22
|
+
import { subscriptionAckPayloadSchema } from '../../coordination/schema.js';
|
|
23
23
|
import {
|
|
24
24
|
WS_INBOUND_FRAMES,
|
|
25
25
|
isKnownInboundFrame,
|
|
@@ -27,11 +27,11 @@ import {
|
|
|
27
27
|
wsInboundEnvelopeSchema,
|
|
28
28
|
type SchemaValidatedFrameType,
|
|
29
29
|
type WsInboundEnvelope,
|
|
30
|
-
} from '
|
|
31
|
-
import { formatConflict } from '
|
|
32
|
-
import {
|
|
33
|
-
import type { Logger } from '
|
|
34
|
-
import type { SocketObservability } from '
|
|
30
|
+
} from '../../wire/inboundFrames.js';
|
|
31
|
+
import { formatConflict } from '../../claims/trace.js';
|
|
32
|
+
import { recordClaim, type CommitAck } from './commitFrames.js';
|
|
33
|
+
import type { Logger } from '../../logger.js';
|
|
34
|
+
import type { SocketObservability } from '../../observability.js';
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* In-flight `commit` request record, keyed by clientTxId in the session.
|
|
@@ -139,11 +139,6 @@ export type WsFrameHandler = (session: WsSession, message: WsInboundFrame) => vo
|
|
|
139
139
|
const handleMutationResult: WsFrameHandler = (session, message) => {
|
|
140
140
|
const p = (message.payload ?? message) as Record<string, unknown>;
|
|
141
141
|
const { clientTxId, success, error } = p;
|
|
142
|
-
// Defensive: validate notifications against the canonical schema —
|
|
143
|
-
// untrusted wire data from a possibly-older/newer server.
|
|
144
|
-
const notifications = parseNotifications(
|
|
145
|
-
(p as { notifications?: unknown } | undefined)?.notifications,
|
|
146
|
-
);
|
|
147
142
|
const missingIds = Array.isArray(p.missingIds)
|
|
148
143
|
? [
|
|
149
144
|
...new Set(
|
|
@@ -164,7 +159,6 @@ const handleMutationResult: WsFrameHandler = (session, message) => {
|
|
|
164
159
|
if (success) {
|
|
165
160
|
const parsedReceipt = commitReceiptSchema.safeParse({
|
|
166
161
|
...p,
|
|
167
|
-
notifications,
|
|
168
162
|
missingIds,
|
|
169
163
|
});
|
|
170
164
|
if (!parsedReceipt.success) {
|
|
@@ -177,35 +171,6 @@ const handleMutationResult: WsFrameHandler = (session, message) => {
|
|
|
177
171
|
return;
|
|
178
172
|
}
|
|
179
173
|
const receipt = parsedReceipt.data;
|
|
180
|
-
// The write succeeded, but a guarded premise shifted underneath it.
|
|
181
|
-
// Emit the advisory signal so a caller can react, and still resolve
|
|
182
|
-
// the receipt, since the commit itself went through.
|
|
183
|
-
if (receipt.notifications && receipt.notifications.length > 0) {
|
|
184
|
-
const txId = receipt.clientTxId;
|
|
185
|
-
const event = {
|
|
186
|
-
clientTxId: txId,
|
|
187
|
-
rows: receipt.notifications.map((n) => ({
|
|
188
|
-
// The row that moved, in both scopes. A group notification used to
|
|
189
|
-
// report its group key here, so the log named a row that does not
|
|
190
|
-
// exist; the premise it breached is reported as `group` instead.
|
|
191
|
-
model: n.target.model,
|
|
192
|
-
id: n.target.id,
|
|
193
|
-
fields: n.target.fields ?? [],
|
|
194
|
-
writtenBy: n.writtenBy.kind,
|
|
195
|
-
...(n.scope === 'group'
|
|
196
|
-
? { group: n.group, ...(n.propagation ? { via: n.propagation.via } : {}) }
|
|
197
|
-
: {}),
|
|
198
|
-
})),
|
|
199
|
-
};
|
|
200
|
-
const message = formatConflict(event);
|
|
201
|
-
session.logger.warn(message);
|
|
202
|
-
session.observability.breadcrumb(message, 'sync.coordination', 'warning');
|
|
203
|
-
session.observability.captureConflict(event);
|
|
204
|
-
session.emit('conflict:notified', {
|
|
205
|
-
clientTxId: txId,
|
|
206
|
-
notifications: receipt.notifications,
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
174
|
pending.resolve(
|
|
210
175
|
pending.returnReceipt
|
|
211
176
|
? receipt
|
|
@@ -216,9 +181,6 @@ const handleMutationResult: WsFrameHandler = (session, message) => {
|
|
|
216
181
|
: {}),
|
|
217
182
|
statusAt: receipt.statusAt,
|
|
218
183
|
lastSyncId: receipt.lastSyncId,
|
|
219
|
-
...(receipt.notifications && receipt.notifications.length > 0
|
|
220
|
-
? { notifications: receipt.notifications }
|
|
221
|
-
: {}),
|
|
222
184
|
...(receipt.missingIds && receipt.missingIds.length > 0
|
|
223
185
|
? { missingIds: receipt.missingIds }
|
|
224
186
|
: {}),
|
|
@@ -279,17 +241,12 @@ const handleMutationResult: WsFrameHandler = (session, message) => {
|
|
|
279
241
|
} else {
|
|
280
242
|
errorMessage = 'mutation failed on server';
|
|
281
243
|
}
|
|
282
|
-
//
|
|
283
|
-
//
|
|
284
|
-
// The success-with-notifications path above records the conflict, and a
|
|
285
|
-
// hard rejection must record it too, or the collision count would miss
|
|
286
|
-
// every rejected write. The conflicting rows ride along on the typed
|
|
287
|
-
// error's `conflicts` detail.
|
|
244
|
+
// Stale-context and foreign-claim rejections are coordination collisions.
|
|
245
|
+
// The conflicting rows ride on the typed error's `conflicts` detail.
|
|
288
246
|
if (
|
|
289
247
|
errorCode === 'stale_context' ||
|
|
290
248
|
errorCode === 'claim_conflict' ||
|
|
291
|
-
errorCode === 'entity_claimed'
|
|
292
|
-
errorCode?.startsWith('policy:') === true
|
|
249
|
+
errorCode === 'entity_claimed'
|
|
293
250
|
) {
|
|
294
251
|
const rawConflicts =
|
|
295
252
|
error != null &&
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
* merely guarantees that something arrives even on an otherwise idle stream.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { PING_INTERVAL_MS } from '
|
|
15
|
+
import { PING_INTERVAL_MS } from '../../wire/protocol.js';
|
|
16
16
|
import {
|
|
17
17
|
noopSocketObservability,
|
|
18
18
|
type TransportObservability,
|
|
19
|
-
} from '
|
|
19
|
+
} from '../../observability.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The interval between application-level pings, shared with both sides of the
|
|
@@ -19,20 +19,20 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import { EventEmitter } from 'events';
|
|
22
|
-
import type { ParticipantKind } from '
|
|
22
|
+
import type { ParticipantKind } from '../../types/participant.js';
|
|
23
23
|
import {
|
|
24
24
|
AbloConnectionError,
|
|
25
25
|
AbloError,
|
|
26
26
|
AbloSessionError,
|
|
27
27
|
AbloValidationError,
|
|
28
28
|
toAbloError,
|
|
29
|
-
} from '
|
|
29
|
+
} from '../../errors.js';
|
|
30
30
|
import {
|
|
31
31
|
participantClaimPayloadSchema,
|
|
32
32
|
updateSubscriptionPayloadSchema,
|
|
33
|
-
} from '
|
|
34
|
-
import type { BootstrapReason } from '
|
|
35
|
-
import type { ClientSyncDelta } from '
|
|
33
|
+
} from '../../coordination/schema.js';
|
|
34
|
+
import type { BootstrapReason } from '../../wire/bootstrapReason.js';
|
|
35
|
+
import type { ClientSyncDelta } from '../../observation/contract.js';
|
|
36
36
|
import type {
|
|
37
37
|
ClaimAcquired,
|
|
38
38
|
PresenceUpdate,
|
|
@@ -44,19 +44,17 @@ import type {
|
|
|
44
44
|
ClaimQueued,
|
|
45
45
|
ClaimRejection,
|
|
46
46
|
ParticipantClaimPayload,
|
|
47
|
-
StaleNotification,
|
|
48
47
|
ReadDependency,
|
|
49
|
-
TrackDependency,
|
|
50
48
|
WireClaim,
|
|
51
|
-
} from '
|
|
52
|
-
import { PROTOCOL_VERSION, WS_CLOSE_PROTOCOL_VERSION } from '
|
|
49
|
+
} from '../../coordination/schema.js';
|
|
50
|
+
import { PROTOCOL_VERSION, WS_CLOSE_PROTOCOL_VERSION } from '../../wire/protocolVersion.js';
|
|
53
51
|
import {
|
|
54
52
|
WS_BEARER_SUBPROTOCOL_PREFIX,
|
|
55
53
|
WS_SYNC_SUBPROTOCOL,
|
|
56
54
|
type AuthTokenGetter,
|
|
57
|
-
} from '
|
|
55
|
+
} from '../../auth/credentialSource.js';
|
|
58
56
|
import { buildCommitFrame, type CommitAck, type CommitFrameOperation } from './commitFrames.js';
|
|
59
|
-
import type { CommitReceiptWire } from '
|
|
57
|
+
import type { CommitReceiptWire } from '../../commit/contract.js';
|
|
60
58
|
import {
|
|
61
59
|
dispatchWsFrame,
|
|
62
60
|
readWsInboundFrame,
|
|
@@ -64,14 +62,14 @@ import {
|
|
|
64
62
|
type PendingCommit,
|
|
65
63
|
type PendingClaim,
|
|
66
64
|
type PendingSubscription,
|
|
67
|
-
} from './
|
|
65
|
+
} from './frameHandlers.js';
|
|
68
66
|
import { HeartbeatController } from './heartbeat.js';
|
|
69
|
-
import { noopLogger, type Logger } from '
|
|
67
|
+
import { noopLogger, type Logger } from '../../logger.js';
|
|
70
68
|
import {
|
|
71
69
|
noopSocketObservability,
|
|
72
70
|
type SocketObservability,
|
|
73
|
-
} from '
|
|
74
|
-
import type { DeliveryPartitionRoute } from '
|
|
71
|
+
} from '../../observability.js';
|
|
72
|
+
import type { DeliveryPartitionRoute } from '../../auth/deliveryPartition.js';
|
|
75
73
|
|
|
76
74
|
/**
|
|
77
75
|
* Ceiling for the exponential reconnect backoff (`reconnectDelay * 2^n`,
|
|
@@ -254,15 +252,6 @@ export interface CoreSyncEventMap {
|
|
|
254
252
|
* claim stream.
|
|
255
253
|
*/
|
|
256
254
|
claim_heartbeat_ack: [ClaimHeartbeatAckPayload];
|
|
257
|
-
/**
|
|
258
|
-
* A committed write guarded with `onStale: 'notify'` collided with a
|
|
259
|
-
* concurrent change. Rather than forcing an outcome, the engine returns the
|
|
260
|
-
* conflicting field's current value so the actor — an agent reasoning over the
|
|
261
|
-
* change, or a person watching the row — can reconcile it. The commit itself
|
|
262
|
-
* succeeded; the held operations were not written, and the actor re-issues
|
|
263
|
-
* them once it has reconciled.
|
|
264
|
-
*/
|
|
265
|
-
'conflict:notified': [{ clientTxId: string; notifications: StaleNotification[] }];
|
|
266
255
|
}
|
|
267
256
|
|
|
268
257
|
/**
|
|
@@ -1025,7 +1014,6 @@ export class WsTransport<
|
|
|
1025
1014
|
clientTxId: string,
|
|
1026
1015
|
timeoutMs = 15_000,
|
|
1027
1016
|
reads?: readonly ReadDependency[] | null,
|
|
1028
|
-
track?: readonly TrackDependency[] | null,
|
|
1029
1017
|
): Promise<CommitAck> {
|
|
1030
1018
|
if (this.ws?.readyState !== WebSocket.OPEN) {
|
|
1031
1019
|
return Promise.reject(this.notConnectedError('commit'));
|
|
@@ -1047,7 +1035,7 @@ export class WsTransport<
|
|
|
1047
1035
|
timeout,
|
|
1048
1036
|
});
|
|
1049
1037
|
try {
|
|
1050
|
-
const frame = buildCommitFrame(operations, clientTxId, reads
|
|
1038
|
+
const frame = buildCommitFrame(operations, clientTxId, reads);
|
|
1051
1039
|
this.ws!.send(JSON.stringify(frame));
|
|
1052
1040
|
} catch (error) {
|
|
1053
1041
|
clearTimeout(timeout);
|
|
@@ -1063,7 +1051,6 @@ export class WsTransport<
|
|
|
1063
1051
|
clientTxId: string,
|
|
1064
1052
|
timeoutMs = 15_000,
|
|
1065
1053
|
reads?: readonly ReadDependency[] | null,
|
|
1066
|
-
track?: readonly TrackDependency[] | null,
|
|
1067
1054
|
): Promise<CommitReceiptWire> {
|
|
1068
1055
|
if (this.ws?.readyState !== WebSocket.OPEN) {
|
|
1069
1056
|
return Promise.reject(this.notConnectedError('commit'));
|
|
@@ -1083,7 +1070,7 @@ export class WsTransport<
|
|
|
1083
1070
|
returnReceipt: true,
|
|
1084
1071
|
});
|
|
1085
1072
|
try {
|
|
1086
|
-
const frame = buildCommitFrame(operations, clientTxId, reads
|
|
1073
|
+
const frame = buildCommitFrame(operations, clientTxId, reads);
|
|
1087
1074
|
this.ws!.send(JSON.stringify(frame));
|
|
1088
1075
|
} catch (error) {
|
|
1089
1076
|
clearTimeout(timeout);
|
|
@@ -1105,12 +1092,11 @@ export class WsTransport<
|
|
|
1105
1092
|
operations: readonly CommitFrameOperation[],
|
|
1106
1093
|
clientTxId: string,
|
|
1107
1094
|
reads?: readonly ReadDependency[] | null,
|
|
1108
|
-
track?: readonly TrackDependency[] | null,
|
|
1109
1095
|
): void {
|
|
1110
1096
|
if (this.ws?.readyState !== WebSocket.OPEN) {
|
|
1111
1097
|
throw this.notConnectedError('commit');
|
|
1112
1098
|
}
|
|
1113
|
-
const frame = buildCommitFrame(operations, clientTxId, reads
|
|
1099
|
+
const frame = buildCommitFrame(operations, clientTxId, reads);
|
|
1114
1100
|
this.ws.send(JSON.stringify(frame));
|
|
1115
1101
|
}
|
|
1116
1102
|
|
package/src/types/index.ts
CHANGED
|
@@ -228,9 +228,8 @@ export interface PartialIndexInfo {
|
|
|
228
228
|
path: string[];
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
// Re-export the stream
|
|
232
|
-
//
|
|
233
|
-
// rest), reached through `Ablo({...}).presence`, `.claims`, and `.snapshot()`.
|
|
231
|
+
// Re-export the stream and coordination types that make up the engine's public
|
|
232
|
+
// surface, reached through `Ablo({...}).presence` and `.claims`.
|
|
234
233
|
//
|
|
235
234
|
// The list is written out by name rather than `export *` so that adding a
|
|
236
235
|
// symbol here is always a deliberate decision, and new types don't become
|
|
@@ -238,7 +237,6 @@ export interface PartialIndexInfo {
|
|
|
238
237
|
export type {
|
|
239
238
|
// Coordination wire shapes, defined in `../coordination/schema` and
|
|
240
239
|
// re-exported through streams.ts.
|
|
241
|
-
OnStaleMode,
|
|
242
240
|
WireClaim,
|
|
243
241
|
ClaimRejection,
|
|
244
242
|
PresenceKind,
|
|
@@ -250,8 +248,6 @@ export type {
|
|
|
250
248
|
ConfirmationState,
|
|
251
249
|
Delta,
|
|
252
250
|
AgentDelta,
|
|
253
|
-
Snapshot,
|
|
254
|
-
ContextChange,
|
|
255
251
|
ClaimTarget,
|
|
256
252
|
PresenceTarget,
|
|
257
253
|
PresenceStream,
|
package/src/types/streams.ts
CHANGED
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Ablo treats people and AI agents alike as participants working on live
|
|
5
5
|
* application entities. A participant announces what it is reading or editing,
|
|
6
|
-
* claims an entity before writing to it, and
|
|
7
|
-
*
|
|
6
|
+
* claims an entity before writing to it, and carries exact reads into later
|
|
7
|
+
* writes. You keep your own schema, agent stack, tools,
|
|
8
8
|
* prompts, and product rules; this package provides the shared coordination
|
|
9
9
|
* layer underneath.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import type { InferModel, Schema } from '../schema/schema.js';
|
|
13
|
-
|
|
14
12
|
// The shape of a claim's application metadata is declared once, on `Register`.
|
|
15
13
|
// This module reads it back rather than restating it, so the default of every
|
|
16
14
|
// `M` parameter below is the one the program declared.
|
|
@@ -20,7 +18,6 @@ import type { ResolveClaimMeta } from './global.js';
|
|
|
20
18
|
// They are imported here so the rest of this file can reference them, and
|
|
21
19
|
// re-exported so consumers can keep importing them from this module.
|
|
22
20
|
import type {
|
|
23
|
-
OnStaleMode,
|
|
24
21
|
WireClaim,
|
|
25
22
|
ClaimRejection,
|
|
26
23
|
ClaimLost,
|
|
@@ -30,7 +27,6 @@ import type {
|
|
|
30
27
|
PresenceUpdatePayload,
|
|
31
28
|
} from '../coordination/schema.js';
|
|
32
29
|
export type {
|
|
33
|
-
OnStaleMode,
|
|
34
30
|
WireClaim,
|
|
35
31
|
ClaimRejection,
|
|
36
32
|
ClaimLost,
|
|
@@ -60,9 +56,9 @@ import type { ParticipantRef } from './participant.js';
|
|
|
60
56
|
export type { ParticipantRef } from './participant.js';
|
|
61
57
|
|
|
62
58
|
// The delta and approval-stage vocabulary are declared once in
|
|
63
|
-
// `
|
|
64
|
-
import type { Delta } from '../
|
|
65
|
-
export type { ConfirmationState, Delta } from '../
|
|
59
|
+
// `observation/contract.ts`; this module re-serves them for source compatibility.
|
|
60
|
+
import type { Delta } from '../observation/contract.js';
|
|
61
|
+
export type { ConfirmationState, Delta } from '../observation/contract.js';
|
|
66
62
|
|
|
67
63
|
/**
|
|
68
64
|
* @deprecated Renamed to {@link Delta} — the authoritative change feed serves
|
|
@@ -71,56 +67,6 @@ export type { ConfirmationState, Delta } from '../wire/delta.js';
|
|
|
71
67
|
*/
|
|
72
68
|
export type AgentDelta = Delta;
|
|
73
69
|
|
|
74
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
75
|
-
// Snapshots — context watermarks for long-running work
|
|
76
|
-
// ─────────────────────────────────────────────────────────────────────
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* A flat, point-in-time view of application data returned by
|
|
80
|
-
* `participant.snapshot(...)`. Capture it before long-running AI work, then
|
|
81
|
-
* detect whether the data changed underneath while that work ran.
|
|
82
|
-
*
|
|
83
|
-
* - Per-model buckets: `snap.<modelName>[id]` returns the entity, typed from
|
|
84
|
-
* your schema (via `InferModel`) rather than as `unknown` — so, for
|
|
85
|
-
* example, `snap.clauses[clauseId].text` is a `string`.
|
|
86
|
-
* - `stamp` — an opaque version marker. Thread it into writes as
|
|
87
|
-
* `{ readAt: snap.stamp }` so the server can reject a write made against
|
|
88
|
-
* stale data.
|
|
89
|
-
* - `signal` — an `AbortSignal` that fires if any captured entity receives a
|
|
90
|
-
* change during the window. Pass it into your LLM call so a mid-generation
|
|
91
|
-
* change aborts the token stream instead of completing against a snapshot
|
|
92
|
-
* that is no longer current.
|
|
93
|
-
* - `onChange(fn)` — a callback alternative to `signal` for cases that don't
|
|
94
|
-
* abort, such as logging, UI flags, or partial regeneration. Returns an
|
|
95
|
-
* unsubscribe function.
|
|
96
|
-
*
|
|
97
|
-
* The per-model buckets share the object with `stamp`, `signal`, and
|
|
98
|
-
* `onChange`, so naming a model `stamp`, `signal`, or `onChange` collides.
|
|
99
|
-
* Snapshot creation throws a clear error in that case.
|
|
100
|
-
*/
|
|
101
|
-
export type Snapshot<
|
|
102
|
-
TSchema extends Schema = Schema,
|
|
103
|
-
ModelName extends keyof TSchema['models'] = keyof TSchema['models'],
|
|
104
|
-
> = {
|
|
105
|
-
readonly stamp: number;
|
|
106
|
-
readonly signal: AbortSignal;
|
|
107
|
-
onChange(listener: (change: ContextChange) => void): () => void;
|
|
108
|
-
} & {
|
|
109
|
-
readonly [M in ModelName]: Readonly<Record<string, InferModel<TSchema, M>>>;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export interface ContextChange {
|
|
113
|
-
readonly model: string;
|
|
114
|
-
readonly id: string;
|
|
115
|
-
readonly severity: 'semantic' | 'metadata';
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* The staleness mode for a write that follows a snapshot. When `readAt` is
|
|
120
|
-
* provided without an `onStale` mode, it defaults to `'reject'`.
|
|
121
|
-
*/
|
|
122
|
-
// `OnStaleMode` is defined in `../coordination/schema` and re-exported above.
|
|
123
|
-
|
|
124
70
|
// ─────────────────────────────────────────────────────────────────────
|
|
125
71
|
// Coordination primitives — a live stream, not polling
|
|
126
72
|
// ─────────────────────────────────────────────────────────────────────
|
|
@@ -484,8 +430,8 @@ export interface ClaimStream {
|
|
|
484
430
|
/**
|
|
485
431
|
* Observe losing a claim you held — distinct from `onRejected`, which is a
|
|
486
432
|
* claim the server refused to grant. Fires when the server reports the loss,
|
|
487
|
-
* carrying why: `'preempted'` (
|
|
488
|
-
* `'expired'` (your lease lapsed). This lets a holder react — re-plan or
|
|
433
|
+
* carrying why: `'preempted'` (the fairness ceiling advanced a queued waiter)
|
|
434
|
+
* or `'expired'` (your lease lapsed). This lets a holder react — re-plan or
|
|
489
435
|
* re-claim — rather than discovering the lease gone through presence.
|
|
490
436
|
*
|
|
491
437
|
* ```ts
|
package/src/webhooks/events.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* skip a change it has already processed, and to apply changes in the order they
|
|
12
12
|
* were committed.
|
|
13
13
|
*/
|
|
14
|
-
import type { SyncDeltaAction } from '
|
|
14
|
+
import type { SyncDeltaAction } from '../observation/contract.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Maps each delta action code to the verb that appears in an event type. Only
|
|
@@ -19,12 +19,11 @@ import { listEnvelopeSchema } from './listEnvelope.js';
|
|
|
19
19
|
// hand-written mirror here would be a second copy of the exact record this
|
|
20
20
|
// response exists to stop withholding.
|
|
21
21
|
import { fieldMetaSchema, relationMetaSchema } from './modelShape.js';
|
|
22
|
-
import { onStaleModeSchema } from '../coordination/schema.js';
|
|
23
22
|
// The price's own vocabulary. A dashboard that restated the tier names or the
|
|
24
23
|
// meter set would be a second definition of what the invoice is computed from.
|
|
25
24
|
import { meterEventSchema, planTierSchema, rateBracketSchema } from './pricing.js';
|
|
26
|
-
import type { SyncDeltaAction } from '
|
|
27
|
-
import { deltaSchema } from '
|
|
25
|
+
import type { SyncDeltaAction } from '../observation/contract.js';
|
|
26
|
+
import { deltaSchema } from '../observation/contract.js';
|
|
28
27
|
// Kept for the {@link ListEnvelope} references below; `GET /v1/logs`'s own
|
|
29
28
|
// envelope moved to `feedEvent.ts`, which owns the union it wraps.
|
|
30
29
|
import type { ListEnvelope } from './listEnvelope.js';
|
|
@@ -85,22 +84,14 @@ export type ProvisionKeyResponse = z.infer<typeof provisionKeyResponseSchema>;
|
|
|
85
84
|
* three members as a TypeScript interface: `wire/` holds runtime-validatable
|
|
86
85
|
* schemas, and it is the protocol leaf — everything depends on it and it depends
|
|
87
86
|
* on nothing. The check that the two never drift therefore lives on the policy
|
|
88
|
-
* side of that edge, next to the interface, in `../policy
|
|
87
|
+
* side of that edge, next to the interface, in `../claims/policy.ts`.
|
|
89
88
|
*/
|
|
90
|
-
export const conflictAxisWireSchema = z.object({
|
|
91
|
-
user: onStaleModeSchema.optional(),
|
|
92
|
-
agent: onStaleModeSchema.optional(),
|
|
93
|
-
system: onStaleModeSchema.optional(),
|
|
94
|
-
});
|
|
95
|
-
|
|
96
89
|
/** One model in the deployed schema, as the schema read reports it. */
|
|
97
90
|
export const schemaModelResponseSchema = z.object({
|
|
98
91
|
/** The key local code addresses (`ablo.records`). */
|
|
99
92
|
key: z.string(),
|
|
100
93
|
/** The wire typename the engine routes and gates on. */
|
|
101
94
|
typename: z.string(),
|
|
102
|
-
/** Declared disposition, or null for the engine default. */
|
|
103
|
-
conflict: conflictAxisWireSchema.nullable(),
|
|
104
95
|
/**
|
|
105
96
|
* Per-model content hash — the unit of the client's drift check, and the
|
|
106
97
|
* revalidation key for everything below it.
|
package/src/wire/frames.ts
CHANGED
|
@@ -15,12 +15,9 @@ import { z } from 'zod';
|
|
|
15
15
|
// schema module to keep this file's runtime dependencies limited to Zod.
|
|
16
16
|
import {
|
|
17
17
|
commitOperationSchema as coordinationCommitOperationSchema,
|
|
18
|
-
MAX_READ_SET_ENTRIES,
|
|
19
18
|
readDependencyListSchema,
|
|
20
|
-
readSetProjectionEntryCount,
|
|
21
|
-
trackDependencyListSchema,
|
|
22
19
|
} from '../coordination/schema.js';
|
|
23
|
-
import type { MutationResultMessageWire } from '
|
|
20
|
+
import type { MutationResultMessageWire } from '../commit/contract.js';
|
|
24
21
|
|
|
25
22
|
// ── Client → Server ────────────────────────────────────────────────────────
|
|
26
23
|
|
|
@@ -31,13 +28,10 @@ import type { MutationResultMessageWire } from './commit.js';
|
|
|
31
28
|
* Both commit transports — the WebSocket `commit` frame and the HTTP
|
|
32
29
|
* `/v1/commits` endpoint — run this check
|
|
33
30
|
* on every operation before it is applied, so a malformed operation is rejected
|
|
34
|
-
* at the edge.
|
|
35
|
-
*
|
|
36
|
-
* the runtime and compile-time contracts have one definition site.
|
|
31
|
+
* at the edge. The TypeScript type is inferred from the shared coordination
|
|
32
|
+
* schema so runtime and compile-time contracts have one definition site.
|
|
37
33
|
*/
|
|
38
|
-
export const wireCommitOperationSchema = coordinationCommitOperationSchema
|
|
39
|
-
bypass: z.boolean().nullish(),
|
|
40
|
-
});
|
|
34
|
+
export const wireCommitOperationSchema = coordinationCommitOperationSchema;
|
|
41
35
|
export type WireCommitOperation = z.infer<typeof wireCommitOperationSchema>;
|
|
42
36
|
|
|
43
37
|
/**
|
|
@@ -59,10 +53,6 @@ export const commitPayloadSchema = z.object({
|
|
|
59
53
|
operations: z.array(wireCommitOperationSchema),
|
|
60
54
|
clientTxId: z.string(),
|
|
61
55
|
reads: readDependencyListSchema.nullish(),
|
|
62
|
-
track: trackDependencyListSchema.nullish(),
|
|
63
|
-
}).refine((value) => readSetProjectionEntryCount(value) <= MAX_READ_SET_ENTRIES, {
|
|
64
|
-
path: ['reads'],
|
|
65
|
-
message: `reads and track may contain at most ${MAX_READ_SET_ENTRIES} entries combined`,
|
|
66
56
|
});
|
|
67
57
|
|
|
68
58
|
/** A client-to-server frame that asks the server to commit a batch atomically. */
|
|
@@ -76,7 +66,7 @@ export type CommitMessage = z.infer<typeof commitMessageSchema>;
|
|
|
76
66
|
|
|
77
67
|
/**
|
|
78
68
|
* The server's acknowledgement of a {@link CommitMessage}. Runtime shape and
|
|
79
|
-
* TypeScript type are both owned by `
|
|
69
|
+
* TypeScript type are both owned by `commit/contract.ts`; HTTP, WebSocket, and
|
|
80
70
|
* cached replay no longer maintain parallel receipt declarations.
|
|
81
71
|
*/
|
|
82
72
|
export type MutationResultMessage = MutationResultMessageWire;
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import { z } from 'zod';
|
|
27
|
-
import { commitReceiptSchema } from '
|
|
28
|
-
import { clientSyncDeltaSchema } from '
|
|
27
|
+
import { commitReceiptSchema } from '../commit/contract.js';
|
|
28
|
+
import { clientSyncDeltaSchema } from '../observation/contract.js';
|
|
29
29
|
import {
|
|
30
30
|
claimAcquiredSchema,
|
|
31
31
|
claimExpiredSchema,
|
|
@@ -106,7 +106,7 @@ export const WS_INBOUND_FRAMES = {
|
|
|
106
106
|
// ── Commit ─────────────────────────────────────────────────────────────
|
|
107
107
|
mutation_result: {
|
|
108
108
|
validation: 'handler',
|
|
109
|
-
where: 'handleMutationResult — it
|
|
109
|
+
where: 'handleMutationResult — it validates missingIds alongside the payload before this can parse',
|
|
110
110
|
checkedBy: commitReceiptSchema,
|
|
111
111
|
},
|
|
112
112
|
|