@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.
Files changed (483) hide show
  1. package/AGENTS.md +2 -1
  2. package/CHANGELOG.md +674 -5
  3. package/README.md +39 -22
  4. package/dist/BaseSyncedStore.d.ts +152 -44
  5. package/dist/BaseSyncedStore.js +300 -184
  6. package/dist/Database.d.ts +9 -24
  7. package/dist/Database.js +37 -22
  8. package/dist/InstanceCache.d.ts +25 -4
  9. package/dist/InstanceCache.js +48 -15
  10. package/dist/LazyReferenceCollection.d.ts +3 -3
  11. package/dist/LazyReferenceCollection.js +4 -4
  12. package/dist/Model.d.ts +6 -6
  13. package/dist/Model.js +10 -10
  14. package/dist/ModelRegistry.d.ts +4 -4
  15. package/dist/ModelRegistry.js +3 -3
  16. package/dist/{SyncEngineContext.d.ts → RuntimeContext.d.ts} +20 -13
  17. package/dist/{SyncEngineContext.js → RuntimeContext.js} +11 -12
  18. package/dist/SyncClient.d.ts +42 -32
  19. package/dist/SyncClient.js +166 -110
  20. package/dist/ai-sdk/coordinatedTool.d.ts +2 -2
  21. package/dist/ai-sdk/coordinatedTool.js +1 -1
  22. package/dist/ai-sdk/coordinationContext.d.ts +2 -2
  23. package/dist/ai-sdk/coordinationContext.js +1 -1
  24. package/dist/ai-sdk/wrap.d.ts +3 -3
  25. package/dist/ai-sdk/wrap.js +2 -2
  26. package/dist/auth/index.d.ts +1 -156
  27. package/dist/auth/index.js +8 -301
  28. package/dist/cli.cjs +3344 -1073
  29. package/dist/client/Ablo.d.ts +42 -287
  30. package/dist/client/Ablo.js +118 -963
  31. package/dist/client/abloClient.d.ts +309 -0
  32. package/dist/client/abloClient.js +13 -0
  33. package/dist/client/clientPrelude.d.ts +52 -0
  34. package/dist/client/clientPrelude.js +60 -0
  35. package/dist/client/consoleLogger.d.ts +2 -2
  36. package/dist/client/coreClient.d.ts +60 -0
  37. package/dist/client/coreClient.js +118 -0
  38. package/dist/client/createInternalComponents.d.ts +4 -4
  39. package/dist/client/createInternalComponents.js +9 -8
  40. package/dist/client/createModelProxy.d.ts +78 -373
  41. package/dist/client/createModelProxy.js +114 -86
  42. package/dist/client/humans.d.ts +48 -0
  43. package/dist/client/humans.js +52 -0
  44. package/dist/client/modelRegistration.d.ts +1 -1
  45. package/dist/client/modelRegistration.js +9 -9
  46. package/dist/client/options.d.ts +73 -17
  47. package/dist/client/reactiveEngine.d.ts +48 -0
  48. package/dist/client/reactiveEngine.js +910 -0
  49. package/dist/client/resourceTypes.d.ts +9 -250
  50. package/dist/client/resourceTypes.js +8 -5
  51. package/dist/client/schemaConfig.d.ts +4 -4
  52. package/dist/client/schemaConfig.js +6 -2
  53. package/dist/client/validateAbloOptions.d.ts +3 -2
  54. package/dist/client/validateAbloOptions.js +1 -1
  55. package/dist/client/wsMutationExecutor.d.ts +3 -3
  56. package/dist/client/wsMutationExecutor.js +3 -3
  57. package/dist/context.d.ts +9 -9
  58. package/dist/context.js +10 -9
  59. package/dist/coordination/ClaimLog.d.ts +26 -0
  60. package/dist/coordination/ClaimLog.js +32 -0
  61. package/dist/coordination/index.d.ts +1 -15
  62. package/dist/coordination/index.js +8 -31
  63. package/dist/core/DatabaseManager.js +1 -1
  64. package/dist/core/QueryView.d.ts +1 -1
  65. package/dist/core/QueryView.js +1 -1
  66. package/dist/core/StoreManager.d.ts +4 -23
  67. package/dist/core/StoreManager.js +5 -55
  68. package/dist/core/index.d.ts +2 -2
  69. package/dist/core/index.js +2 -2
  70. package/dist/core/storeContract.d.ts +2 -2
  71. package/dist/docs/catalog.d.ts +72 -0
  72. package/dist/docs/catalog.js +227 -0
  73. package/dist/docs/index.d.ts +10 -0
  74. package/dist/docs/index.js +10 -0
  75. package/dist/environment.d.ts +1 -40
  76. package/dist/environment.js +8 -37
  77. package/dist/index.d.ts +40 -34
  78. package/dist/index.js +26 -20
  79. package/dist/interfaces/index.d.ts +44 -134
  80. package/dist/keys/index.d.ts +1 -77
  81. package/dist/keys/index.js +8 -190
  82. package/dist/mutators/{RecordingTransaction.d.ts → RecordingMutation.d.ts} +4 -4
  83. package/dist/mutators/{RecordingTransaction.js → RecordingMutation.js} +2 -2
  84. package/dist/mutators/Transaction.d.ts +1 -1
  85. package/dist/mutators/Transaction.js +1 -1
  86. package/dist/mutators/UndoManager.d.ts +6 -6
  87. package/dist/mutators/UndoManager.js +5 -5
  88. package/dist/mutators/defineMutators.d.ts +3 -3
  89. package/dist/mutators/defineMutators.js +1 -1
  90. package/dist/mutators/inverseOp.js +2 -2
  91. package/dist/mutators/mutateActions.d.ts +3 -3
  92. package/dist/mutators/mutateActions.js +1 -1
  93. package/dist/mutators/readerActions.d.ts +1 -1
  94. package/dist/mutators/undoApply.d.ts +1 -1
  95. package/dist/mutators/undoApply.js +1 -1
  96. package/dist/policy/index.d.ts +2 -2
  97. package/dist/policy/index.js +1 -1
  98. package/dist/query/client.d.ts +2 -2
  99. package/dist/query/client.js +4 -4
  100. package/dist/query/types.d.ts +6 -41
  101. package/dist/query/types.js +2 -2
  102. package/dist/react/AbloProvider.d.ts +6 -8
  103. package/dist/react/AbloProvider.js +5 -7
  104. package/dist/react/context.d.ts +1 -1
  105. package/dist/react/context.js +1 -1
  106. package/dist/react/index.d.ts +5 -5
  107. package/dist/react/index.js +3 -3
  108. package/dist/react/internalContext.d.ts +1 -1
  109. package/dist/react/useAblo.d.ts +3 -3
  110. package/dist/react/useAblo.js +1 -1
  111. package/dist/react/useCurrentUserId.js +1 -1
  112. package/dist/react/useErrorListener.js +1 -1
  113. package/dist/react/useMutationFailureListener.d.ts +2 -2
  114. package/dist/react/useMutationFailureListener.js +1 -1
  115. package/dist/react/useMutators.d.ts +3 -3
  116. package/dist/react/useMutators.js +3 -3
  117. package/dist/react/useUndoScope.d.ts +5 -5
  118. package/dist/react/useUndoScope.js +1 -1
  119. package/dist/schema/coordination.d.ts +69 -10
  120. package/dist/schema/coordination.js +86 -9
  121. package/dist/schema/ddl.js +2 -2
  122. package/dist/schema/diff.d.ts +1 -1
  123. package/dist/schema/generate.js +1 -1
  124. package/dist/schema/index.d.ts +10 -10
  125. package/dist/schema/index.js +18 -18
  126. package/dist/schema/queries.d.ts +27 -27
  127. package/dist/schema/queries.js +23 -23
  128. package/dist/schema/select.d.ts +3 -3
  129. package/dist/schema/select.js +3 -3
  130. package/dist/schema/serialize.d.ts +15 -6
  131. package/dist/schema/serialize.js +17 -3
  132. package/dist/schema/sugar.d.ts +6 -7
  133. package/dist/schema/sugar.js +9 -12
  134. package/dist/schema/syncDeltaRow.d.ts +4 -152
  135. package/dist/schema/syncDeltaRow.js +4 -105
  136. package/dist/server/adapter.d.ts +18 -1
  137. package/dist/server/commit.d.ts +10 -16
  138. package/dist/server/index.d.ts +1 -1
  139. package/dist/server/index.js +1 -1
  140. package/dist/server/readConfig.d.ts +1 -1
  141. package/dist/source/adapters/drizzle.d.ts +1 -1
  142. package/dist/source/adapters/drizzle.js +2 -2
  143. package/dist/source/adapters/kysely.d.ts +1 -1
  144. package/dist/source/adapters/kysely.js +1 -1
  145. package/dist/source/adapters/kyselyMutationCore.d.ts +1 -1
  146. package/dist/source/adapters/kyselyMutationCore.js +2 -2
  147. package/dist/source/adapters/memory.js +1 -1
  148. package/dist/source/adapters/prisma.d.ts +8 -3
  149. package/dist/source/adapters/prisma.js +1 -1
  150. package/dist/source/connector.js +1 -1
  151. package/dist/source/connectorProtocol.d.ts +2 -8
  152. package/dist/source/connectorProtocol.js +3 -2
  153. package/dist/source/contract.d.ts +29 -17
  154. package/dist/source/contract.js +27 -22
  155. package/dist/source/factory.d.ts +1 -1
  156. package/dist/source/footprint.d.ts +111 -0
  157. package/dist/source/footprint.js +0 -0
  158. package/dist/source/idempotency.js +2 -2
  159. package/dist/source/index.d.ts +1 -0
  160. package/dist/source/index.js +3 -0
  161. package/dist/source/next.d.ts +1 -1
  162. package/dist/source/signing.d.ts +9 -2
  163. package/dist/source/signing.js +4 -1
  164. package/dist/source/types.d.ts +6 -4
  165. package/dist/source/types.js +1 -1
  166. package/dist/stores/ObjectStore.d.ts +1 -1
  167. package/dist/stores/SyncActionStore.d.ts +1 -1
  168. package/dist/stores/SyncActionStore.js +2 -10
  169. package/dist/stores/syncAction.d.ts +26 -0
  170. package/dist/stores/syncAction.js +16 -0
  171. package/dist/surface.d.ts +3 -3
  172. package/dist/surface.js +6 -4
  173. package/dist/sync/BootstrapFetcher.d.ts +123 -6
  174. package/dist/sync/BootstrapFetcher.js +492 -66
  175. package/dist/sync/ConnectionManager.d.ts +6 -198
  176. package/dist/sync/ConnectionManager.js +6 -677
  177. package/dist/sync/OnDemandLoader.d.ts +2 -2
  178. package/dist/sync/OnDemandLoader.js +60 -21
  179. package/dist/sync/SubscriptionManager.d.ts +13 -2
  180. package/dist/sync/SubscriptionManager.js +23 -5
  181. package/dist/sync/SyncWebSocket.d.ts +27 -510
  182. package/dist/sync/SyncWebSocket.js +76 -954
  183. package/dist/sync/awaitClaimGrant.d.ts +4 -44
  184. package/dist/sync/awaitClaimGrant.js +4 -109
  185. package/dist/sync/commitFrames.d.ts +6 -40
  186. package/dist/sync/commitFrames.js +6 -97
  187. package/dist/sync/contextPorts.d.ts +18 -0
  188. package/dist/sync/contextPorts.js +31 -0
  189. package/dist/sync/createClaimStream.d.ts +5 -49
  190. package/dist/sync/createClaimStream.js +5 -469
  191. package/dist/sync/createPresenceStream.d.ts +26 -4
  192. package/dist/sync/createPresenceStream.js +28 -20
  193. package/dist/sync/createSnapshot.d.ts +2 -2
  194. package/dist/sync/createSnapshot.js +1 -1
  195. package/dist/sync/credentialLifecycle.d.ts +5 -173
  196. package/dist/sync/credentialLifecycle.js +5 -320
  197. package/dist/sync/deltaPipeline.d.ts +1 -1
  198. package/dist/sync/participants.d.ts +5 -4
  199. package/dist/sync/participants.js +29 -22
  200. package/dist/sync/schemaDrift.d.ts +55 -0
  201. package/dist/sync/schemaDrift.js +53 -0
  202. package/dist/sync/schemas.d.ts +21 -32
  203. package/dist/sync/schemas.js +26 -17
  204. package/dist/sync/syncPlan.d.ts +3 -3
  205. package/dist/sync/wsFrameHandlers.d.ts +6 -114
  206. package/dist/sync/wsFrameHandlers.js +6 -392
  207. package/dist/testing/fixtures/bootstrap.d.ts +1 -1
  208. package/dist/testing/fixtures/deltas.d.ts +1 -1
  209. package/dist/testing/fixtures/httpResponses.d.ts +70 -0
  210. package/dist/testing/fixtures/httpResponses.js +90 -0
  211. package/dist/testing/fixtures/models.js +1 -1
  212. package/dist/testing/helpers/wait.js +1 -1
  213. package/dist/testing/mocks/MockMutationExecutor.d.ts +2 -2
  214. package/dist/testing/mocks/MockMutationExecutor.js +8 -14
  215. package/dist/testing/mocks/MockSyncContext.d.ts +11 -11
  216. package/dist/testing/mocks/MockSyncContext.js +10 -9
  217. package/dist/testing/mocks/MockSyncStore.js +1 -1
  218. package/dist/testing/mocks/MockWebSocket.d.ts +2 -2
  219. package/dist/transaction/ablo.d.ts +88 -0
  220. package/dist/transaction/ablo.js +33 -0
  221. package/dist/{client/auth.d.ts → transaction/auth/apiKey.d.ts} +43 -8
  222. package/dist/{client/auth.js → transaction/auth/apiKey.js} +19 -0
  223. package/dist/transaction/auth/bootstrapScope.d.ts +15 -0
  224. package/dist/transaction/auth/bootstrapScope.js +1 -0
  225. package/dist/transaction/auth/capability.d.ts +177 -0
  226. package/dist/transaction/auth/capability.js +199 -0
  227. package/dist/{auth → transaction/auth}/credentialSource.d.ts +8 -1
  228. package/dist/{client → transaction/auth}/identity.d.ts +8 -7
  229. package/dist/{client → transaction/auth}/identity.js +1 -1
  230. package/dist/transaction/auth/index.d.ts +162 -0
  231. package/dist/transaction/auth/index.js +304 -0
  232. package/dist/{auth → transaction/auth}/schemas.d.ts +1 -1
  233. package/dist/{auth → transaction/auth}/schemas.js +13 -13
  234. package/dist/{client → transaction/auth}/sessionMint.d.ts +8 -8
  235. package/dist/{client → transaction/auth}/sessionMint.js +4 -7
  236. package/dist/transaction/coordination/awaitClaimGrant.d.ts +49 -0
  237. package/dist/transaction/coordination/awaitClaimGrant.js +112 -0
  238. package/dist/transaction/coordination/claimMeta.d.ts +49 -0
  239. package/dist/transaction/coordination/claimMeta.js +52 -0
  240. package/dist/transaction/coordination/createClaimStream.d.ts +64 -0
  241. package/dist/transaction/coordination/createClaimStream.js +475 -0
  242. package/dist/transaction/coordination/events.d.ts +74 -0
  243. package/dist/transaction/coordination/events.js +7 -0
  244. package/dist/transaction/coordination/index.d.ts +19 -0
  245. package/dist/transaction/coordination/index.js +44 -0
  246. package/dist/transaction/coordination/locator.d.ts +83 -0
  247. package/dist/transaction/coordination/locator.js +82 -0
  248. package/dist/transaction/coordination/schema.d.ts +1473 -0
  249. package/dist/{coordination → transaction/coordination}/schema.js +490 -55
  250. package/dist/transaction/coordination/targetConflict.d.ts +2 -0
  251. package/dist/transaction/coordination/targetConflict.js +103 -0
  252. package/dist/{coordination → transaction/coordination}/trace.d.ts +7 -18
  253. package/dist/{coordination → transaction/coordination}/trace.js +18 -25
  254. package/dist/transaction/durableWrites.d.ts +62 -0
  255. package/dist/{client → transaction}/durableWrites.js +28 -3
  256. package/dist/transaction/environment.d.ts +105 -0
  257. package/dist/transaction/environment.js +108 -0
  258. package/dist/{errorCodes.d.ts → transaction/errorCodes.d.ts} +11 -11
  259. package/dist/{errorCodes.js → transaction/errorCodes.js} +35 -12
  260. package/dist/{errors.d.ts → transaction/errors.d.ts} +37 -13
  261. package/dist/{errors.js → transaction/errors.js} +85 -16
  262. package/dist/transaction/index.d.ts +20 -0
  263. package/dist/transaction/index.js +20 -0
  264. package/dist/transaction/keys/index.d.ts +87 -0
  265. package/dist/transaction/keys/index.js +207 -0
  266. package/dist/transaction/log/syncDeltaRow.d.ts +158 -0
  267. package/dist/transaction/log/syncDeltaRow.js +95 -0
  268. package/dist/{sync/syncPosition.d.ts → transaction/logPosition.d.ts} +22 -8
  269. package/dist/{sync/syncPosition.js → transaction/logPosition.js} +15 -6
  270. package/dist/transaction/logger.d.ts +16 -0
  271. package/dist/transaction/logger.js +7 -0
  272. package/dist/transaction/observability.d.ts +53 -0
  273. package/dist/transaction/observability.js +19 -0
  274. package/dist/transaction/plugin.d.ts +192 -0
  275. package/dist/transaction/plugin.js +87 -0
  276. package/dist/{policy → transaction/policy}/types.d.ts +3 -3
  277. package/dist/{policy → transaction/policy}/types.js +2 -0
  278. package/dist/transaction/resources/httpResources.d.ts +266 -0
  279. package/dist/transaction/resources/httpResources.js +7 -0
  280. package/dist/transaction/resources/modelOperations.d.ts +319 -0
  281. package/dist/transaction/resources/modelOperations.js +12 -0
  282. package/dist/transaction/resources/mutationOptions.d.ts +66 -0
  283. package/dist/transaction/resources/mutationOptions.js +9 -0
  284. package/dist/transaction/resources/where.d.ts +85 -0
  285. package/dist/transaction/resources/where.js +70 -0
  286. package/dist/{client → transaction/resources}/writeOptionsSchema.d.ts +2 -6
  287. package/dist/{client → transaction/resources}/writeOptionsSchema.js +9 -5
  288. package/dist/{schema → transaction/schema}/field.d.ts +5 -5
  289. package/dist/{schema → transaction/schema}/field.js +5 -5
  290. package/dist/transaction/schema/loadStrategy.d.ts +45 -0
  291. package/dist/transaction/schema/loadStrategy.js +46 -0
  292. package/dist/{schema → transaction/schema}/model.d.ts +50 -35
  293. package/dist/{schema → transaction/schema}/model.js +30 -20
  294. package/dist/transaction/schema/openapi.d.ts +57 -0
  295. package/dist/transaction/schema/openapi.js +340 -0
  296. package/dist/{schema → transaction/schema}/relation.d.ts +14 -14
  297. package/dist/{schema → transaction/schema}/relation.js +7 -7
  298. package/dist/{schema → transaction/schema}/residency.d.ts +0 -9
  299. package/dist/{schema → transaction/schema}/residency.js +0 -5
  300. package/dist/{schema → transaction/schema}/roles.d.ts +5 -5
  301. package/dist/{schema → transaction/schema}/roles.js +5 -5
  302. package/dist/{schema → transaction/schema}/schema.d.ts +12 -10
  303. package/dist/{schema → transaction/schema}/schema.js +4 -3
  304. package/dist/{schema → transaction/schema}/tenancy.d.ts +1 -1
  305. package/dist/{schema → transaction/schema}/tenancy.js +7 -4
  306. package/dist/transaction/transactionLayer.d.ts +82 -0
  307. package/dist/transaction/transactionLayer.js +24 -0
  308. package/dist/{transactions → transaction/transactions/settlement}/commitEnvelope.d.ts +4 -5
  309. package/dist/{transactions → transaction/transactions/settlement}/commitEnvelope.js +9 -13
  310. package/dist/{transactions → transaction/transactions/settlement}/httpCommitEnvelope.d.ts +9 -2
  311. package/dist/{transactions → transaction/transactions/settlement}/httpCommitEnvelope.js +5 -9
  312. package/dist/{transactions/durableWriteStore.d.ts → transaction/transactions/settlement/pendingWrite.d.ts} +10 -36
  313. package/dist/transaction/transactions/settlement/pendingWrite.js +20 -0
  314. package/dist/transaction/transport/commitFrames.d.ts +90 -0
  315. package/dist/transaction/transport/commitFrames.js +134 -0
  316. package/dist/transaction/transport/connectionManager.d.ts +215 -0
  317. package/dist/transaction/transport/connectionManager.js +673 -0
  318. package/dist/transaction/transport/credentialLifecycle.d.ts +177 -0
  319. package/dist/transaction/transport/credentialLifecycle.js +324 -0
  320. package/dist/{sync → transaction/transport}/heartbeat.d.ts +3 -1
  321. package/dist/{sync → transaction/transport}/heartbeat.js +6 -4
  322. package/dist/{client → transaction/transport}/httpClient.d.ts +59 -16
  323. package/dist/{client → transaction/transport}/httpClient.js +5 -5
  324. package/dist/transaction/transport/httpOptions.d.ts +33 -0
  325. package/dist/transaction/transport/httpOptions.js +12 -0
  326. package/dist/{client → transaction/transport}/httpTransport.js +171 -85
  327. package/dist/{sync/NetworkProbe.d.ts → transaction/transport/networkProbe.d.ts} +7 -4
  328. package/dist/{sync/NetworkProbe.js → transaction/transport/networkProbe.js} +14 -13
  329. package/dist/transaction/transport/wsFrameHandlers.d.ts +128 -0
  330. package/dist/transaction/transport/wsFrameHandlers.js +429 -0
  331. package/dist/transaction/transport/wsTransport.d.ts +576 -0
  332. package/dist/transaction/transport/wsTransport.js +1017 -0
  333. package/dist/transaction/types/assertExact.d.ts +17 -0
  334. package/dist/transaction/types/assertExact.js +1 -0
  335. package/dist/{types → transaction/types}/global.d.ts +17 -2
  336. package/dist/{types → transaction/types}/global.js +2 -1
  337. package/dist/{types → transaction/types}/index.d.ts +14 -46
  338. package/dist/{types → transaction/types}/index.js +7 -16
  339. package/dist/{types → transaction/types}/streams.d.ts +63 -45
  340. package/dist/{utils → transaction/utils}/json.d.ts +18 -0
  341. package/dist/transaction/utils/json.js +276 -0
  342. package/dist/transaction/wire/accountResponses.d.ts +351 -0
  343. package/dist/transaction/wire/accountResponses.js +255 -0
  344. package/dist/transaction/wire/auth.d.ts +49 -0
  345. package/dist/transaction/wire/auth.js +57 -0
  346. package/dist/transaction/wire/claimEvent.d.ts +76 -0
  347. package/dist/transaction/wire/claimEvent.js +73 -0
  348. package/dist/transaction/wire/claims.d.ts +463 -0
  349. package/dist/transaction/wire/claims.js +229 -0
  350. package/dist/{wire → transaction/wire}/commit.d.ts +125 -193
  351. package/dist/{wire → transaction/wire}/commit.js +68 -47
  352. package/dist/{wire → transaction/wire}/delta.d.ts +66 -17
  353. package/dist/{wire → transaction/wire}/delta.js +37 -13
  354. package/dist/transaction/wire/errorEnvelope.d.ts +72 -0
  355. package/dist/{wire → transaction/wire}/errorEnvelope.js +36 -5
  356. package/dist/transaction/wire/feedCursor.d.ts +60 -0
  357. package/dist/transaction/wire/feedCursor.js +82 -0
  358. package/dist/transaction/wire/feedEvent.d.ts +177 -0
  359. package/dist/transaction/wire/feedEvent.js +39 -0
  360. package/dist/transaction/wire/frames.d.ts +194 -0
  361. package/dist/transaction/wire/frames.js +50 -0
  362. package/dist/transaction/wire/inboundFrames.d.ts +552 -0
  363. package/dist/transaction/wire/inboundFrames.js +116 -0
  364. package/dist/transaction/wire/index.d.ts +50 -0
  365. package/dist/transaction/wire/index.js +74 -0
  366. package/dist/{wire → transaction/wire}/listEnvelope.d.ts +13 -14
  367. package/dist/transaction/wire/listEnvelope.js +42 -0
  368. package/dist/transaction/wire/modelResponses.d.ts +85 -0
  369. package/dist/transaction/wire/modelResponses.js +43 -0
  370. package/dist/transactions/{TransactionQueue.d.ts → mutations/MutationQueue.d.ts} +79 -38
  371. package/dist/transactions/{TransactionQueue.js → mutations/MutationQueue.js} +110 -59
  372. package/dist/transactions/{TransactionStore.d.ts → mutations/MutationStore.d.ts} +8 -8
  373. package/dist/transactions/{TransactionStore.js → mutations/MutationStore.js} +2 -2
  374. package/dist/transactions/{coalesceRules.d.ts → mutations/coalesceRules.d.ts} +10 -10
  375. package/dist/transactions/{coalesceRules.js → mutations/coalesceRules.js} +1 -1
  376. package/dist/transactions/mutations/commitLatency.d.ts +52 -0
  377. package/dist/transactions/mutations/commitLatency.js +130 -0
  378. package/dist/transactions/{commitOutboxStore.d.ts → mutations/commitOutboxStore.d.ts} +1 -5
  379. package/dist/transactions/{commitOutboxStore.js → mutations/commitOutboxStore.js} +1 -1
  380. package/dist/transactions/{commitPayload.d.ts → mutations/commitPayload.d.ts} +16 -15
  381. package/dist/transactions/{commitPayload.js → mutations/commitPayload.js} +12 -12
  382. package/dist/transactions/{deltaConfirmation.d.ts → mutations/deltaConfirmation.d.ts} +11 -11
  383. package/dist/transactions/{deltaConfirmation.js → mutations/deltaConfirmation.js} +7 -7
  384. package/dist/transactions/mutations/durableWriteStore.d.ts +14 -0
  385. package/dist/transactions/mutations/durableWriteStore.js +12 -0
  386. package/dist/transactions/{optimisticApply.d.ts → mutations/optimisticApply.d.ts} +7 -7
  387. package/dist/transactions/{replayValidation.d.ts → mutations/replayValidation.d.ts} +3 -3
  388. package/dist/transactions/{replayValidation.js → mutations/replayValidation.js} +4 -3
  389. package/dist/utils/mobxSetup.d.ts +1 -1
  390. package/dist/utils/mobxSetup.js +5 -2
  391. package/dist/webhooks/events.d.ts +2 -2
  392. package/dist/wire/index.d.ts +1 -34
  393. package/dist/wire/index.js +8 -49
  394. package/docs/agent-messaging.md +3 -3
  395. package/docs/agents.md +19 -12
  396. package/docs/api-keys.md +8 -4
  397. package/docs/api.md +22 -18
  398. package/docs/audit.md +2 -0
  399. package/docs/cli.md +31 -3
  400. package/docs/client-behavior.md +8 -6
  401. package/docs/concurrency-convention.md +30 -24
  402. package/docs/coordination.md +48 -38
  403. package/docs/data-sources.md +3 -1
  404. package/docs/debugging.md +5 -3
  405. package/docs/deployment.md +267 -0
  406. package/docs/examples/agent-human.md +49 -42
  407. package/docs/examples/ai-sdk-tool.md +69 -44
  408. package/docs/examples/existing-python-backend.md +8 -6
  409. package/docs/examples/nextjs.md +129 -47
  410. package/docs/examples/scoped-agent.md +45 -44
  411. package/docs/examples/server-agent.md +46 -26
  412. package/docs/groups.md +32 -29
  413. package/docs/guarantees.md +4 -2
  414. package/docs/how-it-works.md +9 -7
  415. package/docs/idempotency.md +126 -0
  416. package/docs/identity.md +58 -54
  417. package/docs/index.md +172 -86
  418. package/docs/integration-guide.md +17 -16
  419. package/docs/interaction-model.md +6 -4
  420. package/docs/mcp.md +41 -16
  421. package/docs/migration.md +63 -5
  422. package/docs/operating-on-your-database.md +3 -1
  423. package/docs/projects.md +2 -0
  424. package/docs/quickstart.md +22 -5
  425. package/docs/react.md +12 -10
  426. package/docs/schema-contract.md +5 -3
  427. package/docs/session-settings.md +108 -0
  428. package/docs/sessions.md +3 -1
  429. package/docs/webhooks.md +3 -1
  430. package/llms.txt +47 -17
  431. package/package.json +10 -8
  432. package/dist/agent/Agent.d.ts +0 -366
  433. package/dist/agent/Agent.js +0 -514
  434. package/dist/agent/index.d.ts +0 -115
  435. package/dist/agent/index.js +0 -128
  436. package/dist/agent/session.d.ts +0 -93
  437. package/dist/agent/session.js +0 -149
  438. package/dist/agent/types.d.ts +0 -68
  439. package/dist/agent/types.js +0 -9
  440. package/dist/client/durableWrites.d.ts +0 -21
  441. package/dist/coordination/schema.d.ts +0 -722
  442. package/dist/schema/openapi.d.ts +0 -29
  443. package/dist/schema/openapi.js +0 -124
  444. package/dist/transactions/durableWriteStore.js +0 -30
  445. package/dist/utils/json.js +0 -88
  446. package/dist/wire/errorEnvelope.d.ts +0 -55
  447. package/dist/wire/frames.d.ts +0 -197
  448. package/dist/wire/frames.js +0 -49
  449. package/dist/wire/listEnvelope.js +0 -18
  450. /package/dist/{client → transaction/auth}/credentialEndpoint.d.ts +0 -0
  451. /package/dist/{client → transaction/auth}/credentialEndpoint.js +0 -0
  452. /package/dist/{auth → transaction/auth}/credentialPolicy.d.ts +0 -0
  453. /package/dist/{auth → transaction/auth}/credentialPolicy.js +0 -0
  454. /package/dist/{auth → transaction/auth}/credentialSource.js +0 -0
  455. /package/dist/{client → transaction/auth}/hostedEndpoints.d.ts +0 -0
  456. /package/dist/{client → transaction/auth}/hostedEndpoints.js +0 -0
  457. /package/dist/{client → transaction/coordination}/claimHeartbeatLoop.d.ts +0 -0
  458. /package/dist/{client → transaction/coordination}/claimHeartbeatLoop.js +0 -0
  459. /package/dist/{client → transaction}/persistence.d.ts +0 -0
  460. /package/dist/{client → transaction}/persistence.js +0 -0
  461. /package/dist/{client → transaction/resources}/functionalUpdate.d.ts +0 -0
  462. /package/dist/{client → transaction/resources}/functionalUpdate.js +0 -0
  463. /package/dist/{transactions → transaction/transactions/settlement}/idempotencyKey.d.ts +0 -0
  464. /package/dist/{transactions → transaction/transactions/settlement}/idempotencyKey.js +0 -0
  465. /package/dist/{client → transaction/transport}/httpTransport.d.ts +0 -0
  466. /package/dist/{types → transaction/types}/modelData.d.ts +0 -0
  467. /package/dist/{types → transaction/types}/modelData.js +0 -0
  468. /package/dist/{types → transaction/types}/participant.d.ts +0 -0
  469. /package/dist/{types → transaction/types}/participant.js +0 -0
  470. /package/dist/{types → transaction/types}/streams.js +0 -0
  471. /package/dist/{utils → transaction/utils}/asyncIterator.d.ts +0 -0
  472. /package/dist/{utils → transaction/utils}/asyncIterator.js +0 -0
  473. /package/dist/{utils → transaction/utils}/duration.d.ts +0 -0
  474. /package/dist/{utils → transaction/utils}/duration.js +0 -0
  475. /package/dist/{wire → transaction/wire}/bootstrapReason.d.ts +0 -0
  476. /package/dist/{wire → transaction/wire}/bootstrapReason.js +0 -0
  477. /package/dist/{wire → transaction/wire}/protocol.d.ts +0 -0
  478. /package/dist/{wire → transaction/wire}/protocol.js +0 -0
  479. /package/dist/{wire → transaction/wire}/protocolVersion.d.ts +0 -0
  480. /package/dist/{wire → transaction/wire}/protocolVersion.js +0 -0
  481. /package/dist/transactions/{UnconfirmedWrites.d.ts → mutations/UnconfirmedWrites.d.ts} +0 -0
  482. /package/dist/transactions/{UnconfirmedWrites.js → mutations/UnconfirmedWrites.js} +0 -0
  483. /package/dist/transactions/{optimisticApply.js → mutations/optimisticApply.js} +0 -0
@@ -1,49 +1,8 @@
1
- /**
2
- * The wire contract for the sync protocol: the HTTP envelope shapes and the
3
- * write-path frames, with no dependency on the client runtime. A server — a
4
- * route handler, an edge function can import the envelope producers here
5
- * without pulling in the full sync client.
6
- *
7
- * It has two halves, used across every endpoint:
8
- * - Error responses — {@link errorEnvelope}, {@link ErrorEnvelope}, and
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';
@@ -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.getAll({
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
- Humans get the live plane (WebSocket: presence, optimistic, sub-100ms). Agents
10
- get the stateless plane (HTTP). **Both operate on the same typed, coordinated
11
- state — and coordinate *with each other*.**
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
- `getAll` / `getCount` local reads, `onChange` live subscription) — those need a
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
- ## Humans + agents on one state
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's no separate "agent mode." A human editing a record over their WebSocket
83
- and an agent acting over HTTP share the same typed state and the same coordination
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 `get`/`getAll`/`getCount` (local synced-pool
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 shared
101
- across the whole org.** A schema you push from a test key defines the same
102
- models your live keys see — only the rows differ. This mirrors how Stripe
103
- separates sandbox and production data while keeping the API shape identical.
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 and hit the server (use them when
15
- the row may not be local yet); `get(id)` / `getAll({ where })` / `getCount({ where })`
16
- are synchronous reads off the local graph (use them in render, after data has
17
- synced). **Claims don't lock.** If another writer holds the row, `claim` waits
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.get(id)` reads one row synchronously from the local graph.
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
- `retrieve`/`list` and `get`/`getAll`/`getCount` are not aliases. Use
58
- `retrieve({ id })` or `list({ where })` when the row may not be local yet they
59
- hydrate pool IndexedDB network. Use `get(id)` / `getAll({ where })` /
60
- `getCount({ where })` for a cheap synchronous snapshot of what is already in
61
- the local graph.
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
- | `get(id)` | `T \| undefined` | You want a synchronous snapshot of one local row. |
68
- | `getAll(options?)` | `T[]` | You want a synchronous snapshot of a local collection. |
69
- | `getCount(options?)` | `number` | You want a synchronous count of local rows. |
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. `get` / `getAll` / `getCount` are **synchronous reads**
76
- off the rows a session has already synced, so a cheap re-read needs no round-trip.
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 people and agents see
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/deck`, …, generated from your schema) so each
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) (`@ablo/mcp`) is this same surface
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 + expiry), and server health. |
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, however, is **shared** across the org pushing a schema (from
53
- either environment) defines the same models sandbox and production see; only the rows differ.
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
 
@@ -1,6 +1,8 @@
1
1
  # Client Behavior
2
2
 
3
- When several writers touch the same data at once — a person in the browser, a Server Action, an agent worker — 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.
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 (`get`/`getAll`, `onChange`, `join`) are compile errors rather than runtime gaps. |
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.get('report_stockholm');
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, `get`/`getAll`/`getCount` read the already-synced data instantly with
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
- `getAll` accepts the same practical read options the React selector path uses:
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.get(id))` receive the new row, and selectors
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 read dependency, §4) declares how a stale premise
39
- should be handled. Three modes, split by whether they **force** an outcome:
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 footprints
55
+ ## 3. What is checked: two premises
54
56
 
55
- A conflict is a **footprint intersection** — your operation's footprint overlaps
56
- a concurrent delta. Ablo checks two footprints, and they are independent:
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
- | footprint | declared by | question | scope |
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
- | **Read-set** | batch-level `reads[]` | "did anything I **looked at** change since I read it?" | rows/groups in `reads[]`, even if not written |
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 read-set
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 read-set (`reads[]`)
73
+ ## 4. The batch premise (`reads[]`)
71
74
 
72
- A commit may declare, at the batch level, the premises its writes depended on.
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: 'Slide', id: 's-1', readAt: N, fields?: ['title'] }, // ROW premise
78
- { group: 'deck:abc', readAt: N, onStale: 'notify' }, // GROUP premise
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 (`deck:abc`, `slide:s1`, `org:X`) — the same unit a participant **watches
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 read fires over the whole batch.** A read dependency is a
89
- premise for *all* the writes in the commit, so its disposition governs the batch:
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 read-dep reconciles identically, except `group` is set
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`). **Read-set** conflicts are
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
- - **Read-deps through the policy seam.** Should read-set conflicts also pass
209
- through `ConflictPolicy` (requires a group-aware conflict shape), or stay on
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*. The read-set is a sound premise check,
218
- not a full precedence-graph guarantee; it needs declared reads to catch a
219
- premise, and a caller that declares none gets only write-target checking.
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.