@abloatai/ablo 0.34.0 → 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 +4 -1
  2. package/CHANGELOG.md +684 -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 +3459 -1126
  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 -84
  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 +111 -0
  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
@@ -0,0 +1,1473 @@
1
+ import { z } from 'zod';
2
+ import type { ParticipantKind } from '../types/participant.js';
3
+ /**
4
+ * The wire schemas for coordination — the shapes that keep agents and people
5
+ * from overwriting each other on a shared row. Coordination works in three
6
+ * layers, from outermost to innermost:
7
+ *
8
+ * 1. Presence (observation): who is working where. It reports, never blocks.
9
+ * 2. Claims (pessimistic leases): `claim_begin` / `claim_abandon` grant one
10
+ * participant exclusive intent on a target while others wait.
11
+ * 3. Stale-context (optimistic): a `readAt` watermark plus an `onStale` write
12
+ * guard that catches a lost update when the row moved after you read it.
13
+ *
14
+ * These Zod schemas are the single definition of each shape. Both the client
15
+ * SDK and the server derive their TypeScript types from them with `z.infer`
16
+ * rather than re-declaring the shapes, and the server validates inbound frames
17
+ * against them at runtime.
18
+ */
19
+ /** A line/column span within a text-bearing field (section body, doc, cell). */
20
+ export declare const targetRangeSchema: z.ZodObject<{
21
+ startLine: z.ZodNumber;
22
+ endLine: z.ZodNumber;
23
+ startColumn: z.ZodOptional<z.ZodNumber>;
24
+ endColumn: z.ZodOptional<z.ZodNumber>;
25
+ }, z.core.$strip>;
26
+ export type TargetRange = z.infer<typeof targetRangeSchema>;
27
+ export declare const participantKindSchema: z.ZodEnum<{
28
+ user: "user";
29
+ agent: "agent";
30
+ system: "system";
31
+ }>;
32
+ export type { ParticipantKind } from '../types/participant.js';
33
+ /**
34
+ * Parses a participant kind from an inbound frame, tolerating an older wire
35
+ * dialect. Some presence and claim frames label a non-agent participant
36
+ * `'human'`, while the rest of the surface uses `'user'` for the same
37
+ * participant. This normalizes `'human'` to `'user'` on read so every consumer
38
+ * switches on one vocabulary. Producers emit the canonical
39
+ * {@link participantKindSchema} values, and the output union is never widened.
40
+ */
41
+ export declare const wireParticipantKindSchema: z.ZodPreprocess<z.ZodEnum<{
42
+ user: "user";
43
+ agent: "agent";
44
+ system: "system";
45
+ }>>;
46
+ /**
47
+ * Resolves a peer's kind from an inbound presence or claim frame. It prefers
48
+ * the server-stamped `participantKind` (normalized through
49
+ * {@link wireParticipantKindSchema}). A frame from an older server that omits
50
+ * that field falls back to the `isAgent` boolean, which can tell 'agent' from
51
+ * 'user' but can never report 'system'.
52
+ */
53
+ export declare function participantKindFromWire(wireKind: unknown, isAgent: boolean | undefined): ParticipantKind;
54
+ /**
55
+ * Reads the peer-visible description a claim or presence frame carries in its
56
+ * opaque `meta.description`. This is the single place that unpacks that field.
57
+ * A caller that has an explicit `description` should prefer it
58
+ * (`explicit ?? fromMeta`).
59
+ *
60
+ * The parameter is `unknown` because that is the honest requirement: this reads
61
+ * one optional string off a value it does not own. Demanding the wire's open
62
+ * record instead forced every caller holding a claim's *declared* `meta` — the
63
+ * shape registered on `Register`'s `ClaimMeta` slot — through a conversion to
64
+ * ask a question that never needed one.
65
+ */
66
+ export declare function descriptionFromMeta(meta: unknown): string | undefined;
67
+ /** The default a claim carries when its holder describes no work. */
68
+ export declare const DEFAULT_CLAIM_DESCRIPTION = "editing";
69
+ /**
70
+ * Resolves the peer-visible description of a claim from the places a caller may
71
+ * have put it, falling back to a plain default.
72
+ *
73
+ * `reason` was this field's name before it was renamed, and the rename shipped
74
+ * without leaving anything behind — so the wire kept accepting both spellings
75
+ * while the SDK type quietly offered only one, and two branches "fixed" the
76
+ * gap in opposite directions without either being contradicted by a compiler.
77
+ * The precedence is declared once, here, and both the client and the server
78
+ * read it from this function rather than each spelling out the same `??` chain.
79
+ *
80
+ * A caller whose default differs — a claim taken around a `create` describes
81
+ * itself as `'creating'` — passes that word as `fallback`; the precedence above
82
+ * it stays this function's.
83
+ */
84
+ export declare function claimDescription(source: {
85
+ description?: string | null;
86
+ reason?: string | null;
87
+ /** Wire-shaped or declared — see {@link descriptionFromMeta}. */
88
+ meta?: unknown;
89
+ }, fallback?: string): string;
90
+ /**
91
+ * What a coordination event points at — the locator shared by all three
92
+ * layers. It names an entity, optionally narrowed to a path, range, or field,
93
+ * and carries opaque application metadata.
94
+ */
95
+ export declare const targetRefSchema: z.ZodObject<{
96
+ entityType: z.ZodString;
97
+ entityId: z.ZodString;
98
+ path: z.ZodOptional<z.ZodString>;
99
+ range: z.ZodOptional<z.ZodObject<{
100
+ startLine: z.ZodNumber;
101
+ endLine: z.ZodNumber;
102
+ startColumn: z.ZodOptional<z.ZodNumber>;
103
+ endColumn: z.ZodOptional<z.ZodNumber>;
104
+ }, z.core.$strip>>;
105
+ field: z.ZodOptional<z.ZodString>;
106
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
107
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
108
+ }, z.core.$strip>;
109
+ export type TargetRef = z.infer<typeof targetRefSchema>;
110
+ /**
111
+ * How the server treats a write whose snapshot watermark (`readAt`) is older
112
+ * than the target row's latest change. There are three dispositions:
113
+ * • `notify` — hold the write and return a {@link StaleNotification}
114
+ * carrying the current value, so the actor (agent or human)
115
+ * can resolve it.
116
+ * • `reject` — throw `AbloStaleContextError`, the default when `readAt`
117
+ * is present.
118
+ * • `overwrite` — apply the write blindly, last write wins, with no signal.
119
+ */
120
+ export declare const onStaleModeSchema: z.ZodEnum<{
121
+ reject: "reject";
122
+ overwrite: "overwrite";
123
+ notify: "notify";
124
+ }>;
125
+ export type OnStaleMode = z.infer<typeof onStaleModeSchema>;
126
+ /**
127
+ * The optimistic guard carried on a commit operation. `readAt` is the
128
+ * snapshot watermark from `context.capture` (null/absent ⇒ unguarded write).
129
+ * `bypass` is the explicit, recorded override of a *foreign* pessimistic
130
+ * claim — see the claim layer below.
131
+ */
132
+ export declare const writeGuardSchema: z.ZodObject<{
133
+ readAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
134
+ onStale: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
135
+ reject: "reject";
136
+ overwrite: "overwrite";
137
+ notify: "notify";
138
+ }>>>;
139
+ bypass: z.ZodOptional<z.ZodBoolean>;
140
+ }, z.core.$strip>;
141
+ export type WriteGuard = z.infer<typeof writeGuardSchema>;
142
+ /**
143
+ * The advisory returned to a committer whose write hit a stale-context
144
+ * conflict under `onStale: 'notify'` — it reports that the value the committer
145
+ * reasoned against changed while they were away. Rather than throwing, the
146
+ * server hands back the conflicting field's current value as data so the
147
+ * actor — an agent or a human — can reconcile and re-commit. A claim is the
148
+ * prospective form of the same idea (coordinate before acting); this
149
+ * notification is the in-flight form (here is what changed, you resolve). It
150
+ * rides on the commit acknowledgement alongside `lastSyncId`; an empty or
151
+ * absent array means nothing the committer depended on moved.
152
+ *
153
+ * Only `onStale: 'notify'` produces this. The conflicting operation was held,
154
+ * not written, and the actor reconciles against `currentValues` and
155
+ * re-commits. `reject` throws instead, and `overwrite` proceeds silently —
156
+ * neither notifies.
157
+ */
158
+ export declare const staleNotificationSchema: z.ZodObject<{
159
+ object: z.ZodOptional<z.ZodLiteral<"stale_notification">>;
160
+ model: z.ZodString;
161
+ id: z.ZodString;
162
+ readAt: z.ZodNumber;
163
+ observedSyncId: z.ZodNumber;
164
+ conflictingFields: z.ZodArray<z.ZodString>;
165
+ currentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
166
+ writtenBy: z.ZodObject<{
167
+ kind: z.ZodEnum<{
168
+ user: "user";
169
+ agent: "agent";
170
+ system: "system";
171
+ }>;
172
+ id: z.ZodString;
173
+ }, z.core.$strip>;
174
+ group: z.ZodOptional<z.ZodString>;
175
+ }, z.core.$strip>;
176
+ export type StaleNotification = z.infer<typeof staleNotificationSchema>;
177
+ /**
178
+ * One entry in a commit's batch premise — a read it was based on, so the
179
+ * server can ask "did anything I looked at change?" — broader than the
180
+ * write-target check, which only validates the rows being written. The server
181
+ * re-runs stale detection against each entry at its `readAt`; a moved premise
182
+ * fires the entry's `onStale` disposition (default `reject`) across the whole
183
+ * batch (`notify` holds every write and notifies, `reject` aborts, `overwrite`
184
+ * proceeds silently). An entry comes at one of two granularities:
185
+ *
186
+ * • Row — `{ model, id, readAt, fields? }`: did this specific row, or these
187
+ * specific fields, change?
188
+ * • Group — `{ group, readAt }`: did anything in this sync group change?
189
+ * `group` is a sync-group key such as `report:abc` or `section:s1`, the
190
+ * same unit a participant watches and claims.
191
+ *
192
+ * See `packages/sync-engine/docs/concurrency-convention.md` (§4) for the
193
+ * governing convention and the receive → reconcile loop.
194
+ */
195
+ export declare const readDependencySchema: z.ZodUnion<readonly [z.ZodObject<{
196
+ model: z.ZodString;
197
+ id: z.ZodString;
198
+ readAt: z.ZodNumber;
199
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
200
+ onStale: z.ZodOptional<z.ZodEnum<{
201
+ reject: "reject";
202
+ overwrite: "overwrite";
203
+ notify: "notify";
204
+ }>>;
205
+ }, z.core.$strip>, z.ZodObject<{
206
+ group: z.ZodString;
207
+ readAt: z.ZodNumber;
208
+ onStale: z.ZodOptional<z.ZodEnum<{
209
+ reject: "reject";
210
+ overwrite: "overwrite";
211
+ notify: "notify";
212
+ }>>;
213
+ }, z.core.$strip>]>;
214
+ export type ReadDependency = z.infer<typeof readDependencySchema>;
215
+ /**
216
+ * A durable premise — what a participant is watching so that a later
217
+ * change to it opens a {@link StaleNotification}. It is the persisted sibling of
218
+ * a {@link ReadDependency}: the same reference shape, minus the disposition (a
219
+ * track always notifies — that is what tracking is), with an optional `readAt`
220
+ * that defaults to the watermark of the commit that registered it. The row form
221
+ * watches one object; the group form watches a whole sync group ("anything in
222
+ * `report:abc`"). Where a `ReadDependency` is checked once at commit and
223
+ * discarded, a `TrackDependency` is kept and re-checked against every future
224
+ * delta. See `packages/sync-engine/docs/groups.md` for how it drives change
225
+ * propagation.
226
+ */
227
+ export declare const trackDependencySchema: z.ZodUnion<readonly [z.ZodObject<{
228
+ model: z.ZodString;
229
+ id: z.ZodString;
230
+ readAt: z.ZodOptional<z.ZodNumber>;
231
+ }, z.core.$strip>, z.ZodObject<{
232
+ group: z.ZodString;
233
+ readAt: z.ZodOptional<z.ZodNumber>;
234
+ }, z.core.$strip>]>;
235
+ export type TrackDependency = z.infer<typeof trackDependencySchema>;
236
+ /**
237
+ * The lifecycle of a claim. When absent on the wire it means `'active'` (an
238
+ * additive back-compat default). The server stamps `'active'` on `claim_begin`
239
+ * and emits one terminal frame — `committed`, `canceled`, or `expired` — as the
240
+ * claim ends, so contenders learn how it resolved, not merely that it vanished.
241
+ */
242
+ export declare const wireClaimStatusSchema: z.ZodEnum<{
243
+ active: "active";
244
+ committed: "committed";
245
+ expired: "expired";
246
+ canceled: "canceled";
247
+ }>;
248
+ export type WireClaimStatus = z.infer<typeof wireClaimStatusSchema>;
249
+ /**
250
+ * Every lifecycle state of a claim, as a caller sees it.
251
+ *
252
+ * `active` is the current holder — the lock itself. `queued` is waiting in line
253
+ * behind the holder and carries an advisory `position`. The rest are terminal
254
+ * and drop the claim from the synced set.
255
+ *
256
+ * Distinct from {@link wireClaimStatusSchema}, which never carries `queued`
257
+ * because the wire frame for a waiter is a different message. This is the one a
258
+ * published contract describes, so it is a schema rather than a bare TS union —
259
+ * a union cannot be derived into the API reference.
260
+ */
261
+ export declare const publicClaimStatusSchema: z.ZodEnum<{
262
+ active: "active";
263
+ committed: "committed";
264
+ expired: "expired";
265
+ canceled: "canceled";
266
+ queued: "queued";
267
+ }>;
268
+ export type PublicClaimStatus = z.infer<typeof publicClaimStatusSchema>;
269
+ /**
270
+ * @deprecated Renamed to {@link wireClaimStatusSchema} — this is the wire enum,
271
+ * which never carries `'queued'`; the five-state public status lives in
272
+ * types/streams. Removed in 0.36.0.
273
+ */
274
+ export declare const claimStatusSchema: z.ZodEnum<{
275
+ active: "active";
276
+ committed: "committed";
277
+ expired: "expired";
278
+ canceled: "canceled";
279
+ }>;
280
+ /** @deprecated Renamed to {@link WireClaimStatus}. Removed in 0.36.0. */
281
+ export type ClaimStatus = WireClaimStatus;
282
+ /**
283
+ * A holder as the participant blocked behind them sees it: who has the row,
284
+ * what they said they are doing, and until when.
285
+ *
286
+ * This is the smaller half of a claim, so it is declared first and the full
287
+ * claim extends it — the waiter's view cannot omit a member the holder's view
288
+ * has, because there is nowhere for it to be omitted. Listing what to keep was
289
+ * the bug: this named `field` and not `path`, `range`, or `fields`, so a waiter
290
+ * could see that a row was held but never which part of it, and every locator
291
+ * member added later would have been missing here too.
292
+ */
293
+ export declare const wireClaimSummarySchema: z.ZodObject<{
294
+ entityType: z.ZodString;
295
+ entityId: z.ZodString;
296
+ path: z.ZodOptional<z.ZodString>;
297
+ range: z.ZodOptional<z.ZodObject<{
298
+ startLine: z.ZodNumber;
299
+ endLine: z.ZodNumber;
300
+ startColumn: z.ZodOptional<z.ZodNumber>;
301
+ endColumn: z.ZodOptional<z.ZodNumber>;
302
+ }, z.core.$strip>>;
303
+ field: z.ZodOptional<z.ZodString>;
304
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
305
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
306
+ claimId: z.ZodString;
307
+ description: z.ZodOptional<z.ZodString>;
308
+ declaredAt: z.ZodNumber;
309
+ expiresAt: z.ZodNumber;
310
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
311
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
312
+ user: "user";
313
+ agent: "agent";
314
+ system: "system";
315
+ }>>>>;
316
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
317
+ }, z.core.$strip>;
318
+ export type WireClaimSummary = z.infer<typeof wireClaimSummarySchema>;
319
+ /** Why a claim ended in a non-success terminal state. */
320
+ export declare const claimErrorSchema: z.ZodObject<{
321
+ code: z.ZodString;
322
+ message: z.ZodOptional<z.ZodString>;
323
+ heldBy: z.ZodOptional<z.ZodString>;
324
+ heldByClaimId: z.ZodOptional<z.ZodString>;
325
+ heldByExpiresAt: z.ZodOptional<z.ZodNumber>;
326
+ heldByClaim: z.ZodOptional<z.ZodObject<{
327
+ entityType: z.ZodString;
328
+ entityId: z.ZodString;
329
+ path: z.ZodOptional<z.ZodString>;
330
+ range: z.ZodOptional<z.ZodObject<{
331
+ startLine: z.ZodNumber;
332
+ endLine: z.ZodNumber;
333
+ startColumn: z.ZodOptional<z.ZodNumber>;
334
+ endColumn: z.ZodOptional<z.ZodNumber>;
335
+ }, z.core.$strip>>;
336
+ field: z.ZodOptional<z.ZodString>;
337
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
338
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
339
+ claimId: z.ZodString;
340
+ description: z.ZodOptional<z.ZodString>;
341
+ declaredAt: z.ZodNumber;
342
+ expiresAt: z.ZodNumber;
343
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
344
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
345
+ user: "user";
346
+ agent: "agent";
347
+ system: "system";
348
+ }>>>>;
349
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
350
+ }, z.core.$strip>>;
351
+ policyReason: z.ZodOptional<z.ZodString>;
352
+ }, z.core.$strip>;
353
+ export type ClaimError = z.infer<typeof claimErrorSchema>;
354
+ /**
355
+ * A declared, pending-mutation claim — the unit broadcast inside a presence
356
+ * frame's `activeClaims`. The client supplies the descriptive `targetRef`
357
+ * fields, a `description` of the work, and a chosen `claimId`; the server stamps
358
+ * `declaredAt` and `expiresAt` and may set `status` and `error`. Those last
359
+ * two are optional, so one shape serves both the server, which sets them, and
360
+ * the leaner SDK view, which reads a claim without them.
361
+ */
362
+ export declare const wireClaimSchema: z.ZodObject<{
363
+ entityType: z.ZodString;
364
+ entityId: z.ZodString;
365
+ path: z.ZodOptional<z.ZodString>;
366
+ range: z.ZodOptional<z.ZodObject<{
367
+ startLine: z.ZodNumber;
368
+ endLine: z.ZodNumber;
369
+ startColumn: z.ZodOptional<z.ZodNumber>;
370
+ endColumn: z.ZodOptional<z.ZodNumber>;
371
+ }, z.core.$strip>>;
372
+ field: z.ZodOptional<z.ZodString>;
373
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
374
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
375
+ claimId: z.ZodString;
376
+ description: z.ZodOptional<z.ZodString>;
377
+ declaredAt: z.ZodNumber;
378
+ expiresAt: z.ZodNumber;
379
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
380
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
381
+ user: "user";
382
+ agent: "agent";
383
+ system: "system";
384
+ }>>>>;
385
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
386
+ fenceToken: z.ZodOptional<z.ZodNumber>;
387
+ acquiredAt: z.ZodOptional<z.ZodNumber>;
388
+ status: z.ZodOptional<z.ZodEnum<{
389
+ active: "active";
390
+ committed: "committed";
391
+ expired: "expired";
392
+ canceled: "canceled";
393
+ }>>;
394
+ error: z.ZodOptional<z.ZodObject<{
395
+ code: z.ZodString;
396
+ message: z.ZodOptional<z.ZodString>;
397
+ heldBy: z.ZodOptional<z.ZodString>;
398
+ heldByClaimId: z.ZodOptional<z.ZodString>;
399
+ heldByExpiresAt: z.ZodOptional<z.ZodNumber>;
400
+ heldByClaim: z.ZodOptional<z.ZodObject<{
401
+ entityType: z.ZodString;
402
+ entityId: z.ZodString;
403
+ path: z.ZodOptional<z.ZodString>;
404
+ range: z.ZodOptional<z.ZodObject<{
405
+ startLine: z.ZodNumber;
406
+ endLine: z.ZodNumber;
407
+ startColumn: z.ZodOptional<z.ZodNumber>;
408
+ endColumn: z.ZodOptional<z.ZodNumber>;
409
+ }, z.core.$strip>>;
410
+ field: z.ZodOptional<z.ZodString>;
411
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
412
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
413
+ claimId: z.ZodString;
414
+ description: z.ZodOptional<z.ZodString>;
415
+ declaredAt: z.ZodNumber;
416
+ expiresAt: z.ZodNumber;
417
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
418
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
419
+ user: "user";
420
+ agent: "agent";
421
+ system: "system";
422
+ }>>>>;
423
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
424
+ }, z.core.$strip>>;
425
+ policyReason: z.ZodOptional<z.ZodString>;
426
+ }, z.core.$strip>>;
427
+ }, z.core.$strip>;
428
+ export type WireClaim = z.infer<typeof wireClaimSchema>;
429
+ export declare const claimRejectionSchema: z.ZodObject<{
430
+ claimId: z.ZodString;
431
+ reason: z.ZodString;
432
+ target: z.ZodOptional<z.ZodObject<{
433
+ entityType: z.ZodString;
434
+ entityId: z.ZodString;
435
+ path: z.ZodOptional<z.ZodString>;
436
+ range: z.ZodOptional<z.ZodObject<{
437
+ startLine: z.ZodNumber;
438
+ endLine: z.ZodNumber;
439
+ startColumn: z.ZodOptional<z.ZodNumber>;
440
+ endColumn: z.ZodOptional<z.ZodNumber>;
441
+ }, z.core.$strip>>;
442
+ field: z.ZodOptional<z.ZodString>;
443
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
444
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
445
+ }, z.core.$strip>>;
446
+ heldBy: z.ZodOptional<z.ZodString>;
447
+ heldByKind: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
448
+ user: "user";
449
+ agent: "agent";
450
+ system: "system";
451
+ }>>>;
452
+ heldByClaimId: z.ZodOptional<z.ZodString>;
453
+ heldByExpiresAt: z.ZodOptional<z.ZodNumber>;
454
+ heldByClaim: z.ZodOptional<z.ZodObject<{
455
+ entityType: z.ZodString;
456
+ entityId: z.ZodString;
457
+ path: z.ZodOptional<z.ZodString>;
458
+ range: z.ZodOptional<z.ZodObject<{
459
+ startLine: z.ZodNumber;
460
+ endLine: z.ZodNumber;
461
+ startColumn: z.ZodOptional<z.ZodNumber>;
462
+ endColumn: z.ZodOptional<z.ZodNumber>;
463
+ }, z.core.$strip>>;
464
+ field: z.ZodOptional<z.ZodString>;
465
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
466
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
467
+ claimId: z.ZodString;
468
+ description: z.ZodOptional<z.ZodString>;
469
+ declaredAt: z.ZodNumber;
470
+ expiresAt: z.ZodNumber;
471
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
472
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
473
+ user: "user";
474
+ agent: "agent";
475
+ system: "system";
476
+ }>>>>;
477
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
478
+ }, z.core.$strip>>;
479
+ policyReason: z.ZodOptional<z.ZodString>;
480
+ }, z.core.$strip>;
481
+ export type ClaimRejection = z.infer<typeof claimRejectionSchema>;
482
+ /**
483
+ * The point-to-point notification sent to a holder whose lease ended without
484
+ * a successful commit. This remains a wire-shaped target because it arrives
485
+ * directly from the WebSocket; the schema is the single validation boundary
486
+ * before the event reaches public `claims.onLost` listeners.
487
+ */
488
+ export declare const claimLostSchema: z.ZodObject<{
489
+ claimId: z.ZodString;
490
+ reason: z.ZodEnum<{
491
+ expired: "expired";
492
+ preempted: "preempted";
493
+ }>;
494
+ target: z.ZodObject<{
495
+ entityType: z.ZodString;
496
+ entityId: z.ZodString;
497
+ path: z.ZodOptional<z.ZodString>;
498
+ range: z.ZodOptional<z.ZodObject<{
499
+ startLine: z.ZodNumber;
500
+ endLine: z.ZodNumber;
501
+ startColumn: z.ZodOptional<z.ZodNumber>;
502
+ endColumn: z.ZodOptional<z.ZodNumber>;
503
+ }, z.core.$strip>>;
504
+ field: z.ZodOptional<z.ZodString>;
505
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
506
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
507
+ }, z.core.$strip>;
508
+ }, z.core.$strip>;
509
+ export type ClaimLost = z.infer<typeof claimLostSchema>;
510
+ /**
511
+ * The lease is ours without waiting — the target was free when the claim
512
+ * arrived. `fenceToken` is present whenever the coordinator minted one, and a
513
+ * write carries it back so a lapsed lease cannot apply late.
514
+ */
515
+ export declare const claimAcquiredSchema: z.ZodObject<{
516
+ claimId: z.ZodString;
517
+ fenceToken: z.ZodOptional<z.ZodNumber>;
518
+ target: z.ZodObject<{
519
+ entityType: z.ZodString;
520
+ entityId: z.ZodString;
521
+ path: z.ZodOptional<z.ZodString>;
522
+ range: z.ZodOptional<z.ZodObject<{
523
+ startLine: z.ZodNumber;
524
+ endLine: z.ZodNumber;
525
+ startColumn: z.ZodOptional<z.ZodNumber>;
526
+ endColumn: z.ZodOptional<z.ZodNumber>;
527
+ }, z.core.$strip>>;
528
+ field: z.ZodOptional<z.ZodString>;
529
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
530
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
531
+ }, z.core.$strip>;
532
+ }, z.core.$strip>;
533
+ export type ClaimAcquired = z.infer<typeof claimAcquiredSchema>;
534
+ /**
535
+ * A queued claim reached the head of the line and the lease is now ours. The
536
+ * shape matches {@link claimAcquiredSchema} exactly — the two frames differ
537
+ * only in whether the caller waited — but they stay separate declarations
538
+ * because they are separate wire contracts, and collapsing them would let a
539
+ * change to one silently redefine the other.
540
+ */
541
+ export declare const claimGrantedSchema: z.ZodObject<{
542
+ claimId: z.ZodString;
543
+ fenceToken: z.ZodOptional<z.ZodNumber>;
544
+ target: z.ZodObject<{
545
+ entityType: z.ZodString;
546
+ entityId: z.ZodString;
547
+ path: z.ZodOptional<z.ZodString>;
548
+ range: z.ZodOptional<z.ZodObject<{
549
+ startLine: z.ZodNumber;
550
+ endLine: z.ZodNumber;
551
+ startColumn: z.ZodOptional<z.ZodNumber>;
552
+ endColumn: z.ZodOptional<z.ZodNumber>;
553
+ }, z.core.$strip>>;
554
+ field: z.ZodOptional<z.ZodString>;
555
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
556
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
557
+ }, z.core.$strip>;
558
+ }, z.core.$strip>;
559
+ export type ClaimGranted = z.infer<typeof claimGrantedSchema>;
560
+ /**
561
+ * Our claim is waiting in line behind a live holder — the same conflict
562
+ * {@link claimRejectionSchema} reports, delivered as a wait rather than a
563
+ * refusal, plus the caller's `position`.
564
+ *
565
+ * `reason` is the one member that does not carry over as required. A refusal
566
+ * states why it refused; a wait has only ever named the conflict through
567
+ * `heldBy`/`heldByClaim`, and no server has ever stamped `reason` on this
568
+ * frame. Requiring it here — inherited silently by extending the rejection
569
+ * schema — made the parse boundary reject every genuine `claim_queued` as
570
+ * malformed the moment frame validation went in. Optional is what the wire
571
+ * actually is, and it stays derived from the rejection field so the two cannot
572
+ * describe the value differently.
573
+ *
574
+ * `position` is advisory: a privileged reorder can move it up, so a caller
575
+ * that asserts monotonic position will fail in production. Only the arrival of
576
+ * a grant is authoritative.
577
+ */
578
+ export declare const claimQueuedSchema: z.ZodObject<{
579
+ claimId: z.ZodString;
580
+ target: z.ZodOptional<z.ZodObject<{
581
+ entityType: z.ZodString;
582
+ entityId: z.ZodString;
583
+ path: z.ZodOptional<z.ZodString>;
584
+ range: z.ZodOptional<z.ZodObject<{
585
+ startLine: z.ZodNumber;
586
+ endLine: z.ZodNumber;
587
+ startColumn: z.ZodOptional<z.ZodNumber>;
588
+ endColumn: z.ZodOptional<z.ZodNumber>;
589
+ }, z.core.$strip>>;
590
+ field: z.ZodOptional<z.ZodString>;
591
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
592
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
593
+ }, z.core.$strip>>;
594
+ heldBy: z.ZodOptional<z.ZodString>;
595
+ heldByKind: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
596
+ user: "user";
597
+ agent: "agent";
598
+ system: "system";
599
+ }>>>;
600
+ heldByClaimId: z.ZodOptional<z.ZodString>;
601
+ heldByExpiresAt: z.ZodOptional<z.ZodNumber>;
602
+ heldByClaim: z.ZodOptional<z.ZodObject<{
603
+ entityType: z.ZodString;
604
+ entityId: z.ZodString;
605
+ path: z.ZodOptional<z.ZodString>;
606
+ range: z.ZodOptional<z.ZodObject<{
607
+ startLine: z.ZodNumber;
608
+ endLine: z.ZodNumber;
609
+ startColumn: z.ZodOptional<z.ZodNumber>;
610
+ endColumn: z.ZodOptional<z.ZodNumber>;
611
+ }, z.core.$strip>>;
612
+ field: z.ZodOptional<z.ZodString>;
613
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
614
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
615
+ claimId: z.ZodString;
616
+ description: z.ZodOptional<z.ZodString>;
617
+ declaredAt: z.ZodNumber;
618
+ expiresAt: z.ZodNumber;
619
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
620
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
621
+ user: "user";
622
+ agent: "agent";
623
+ system: "system";
624
+ }>>>>;
625
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
626
+ }, z.core.$strip>>;
627
+ policyReason: z.ZodOptional<z.ZodString>;
628
+ position: z.ZodNumber;
629
+ reason: z.ZodOptional<z.ZodString>;
630
+ }, z.core.$strip>;
631
+ export type ClaimQueued = z.infer<typeof claimQueuedSchema>;
632
+ /**
633
+ * One entry in a wait-line snapshot.
634
+ *
635
+ * NOTE — this is the third spelling of a target locator on the wire: here it is
636
+ * `{ type, id }`, the HTTP claim DTO uses `{ model, id }`
637
+ * ({@link modelTargetSchema}), and the claim frames use
638
+ * `{ entityType, entityId }` ({@link targetRefSchema}). The schema describes
639
+ * what the server sends today rather than what it should send; unifying the
640
+ * three is a coordinated protocol change scheduled behind the protocol version.
641
+ * Until it happens, the translation between the spellings lives in one place —
642
+ * `wireTarget`, `modelTarget` and `streamTarget` in ./locator.ts — so no hop
643
+ * gets to invent a fourth.
644
+ */
645
+ export declare const claimQueueEntrySchema: z.ZodObject<{
646
+ object: z.ZodLiteral<"claim">;
647
+ id: z.ZodString;
648
+ status: z.ZodLiteral<"queued">;
649
+ target: z.ZodObject<{
650
+ field: z.ZodOptional<z.ZodString>;
651
+ path: z.ZodOptional<z.ZodString>;
652
+ range: z.ZodOptional<z.ZodObject<{
653
+ startLine: z.ZodNumber;
654
+ endLine: z.ZodNumber;
655
+ startColumn: z.ZodOptional<z.ZodNumber>;
656
+ endColumn: z.ZodOptional<z.ZodNumber>;
657
+ }, z.core.$strip>>;
658
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
659
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
660
+ type: z.ZodString;
661
+ id: z.ZodString;
662
+ }, z.core.$strip>;
663
+ description: z.ZodDefault<z.ZodString>;
664
+ heldBy: z.ZodOptional<z.ZodString>;
665
+ participantKind: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
666
+ user: "user";
667
+ agent: "agent";
668
+ system: "system";
669
+ }>>>;
670
+ position: z.ZodNumber;
671
+ expiresAt: z.ZodNumber;
672
+ }, z.core.$strip>;
673
+ export type ClaimQueueEntry = z.infer<typeof claimQueueEntrySchema>;
674
+ /**
675
+ * The whole wait line for one row, rebroadcast to that row's peers on every
676
+ * queue mutation. This is what backs the reactive
677
+ * `ablo.<model>.claim.queue({ id })` read, which is why it carries the full
678
+ * line rather than a delta against it.
679
+ */
680
+ export declare const claimQueueSchema: z.ZodObject<{
681
+ target: z.ZodObject<{
682
+ type: z.ZodString;
683
+ id: z.ZodString;
684
+ }, z.core.$strip>;
685
+ queue: z.ZodArray<z.ZodObject<{
686
+ object: z.ZodLiteral<"claim">;
687
+ id: z.ZodString;
688
+ status: z.ZodLiteral<"queued">;
689
+ target: z.ZodObject<{
690
+ field: z.ZodOptional<z.ZodString>;
691
+ path: z.ZodOptional<z.ZodString>;
692
+ range: z.ZodOptional<z.ZodObject<{
693
+ startLine: z.ZodNumber;
694
+ endLine: z.ZodNumber;
695
+ startColumn: z.ZodOptional<z.ZodNumber>;
696
+ endColumn: z.ZodOptional<z.ZodNumber>;
697
+ }, z.core.$strip>>;
698
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
699
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
700
+ type: z.ZodString;
701
+ id: z.ZodString;
702
+ }, z.core.$strip>;
703
+ description: z.ZodDefault<z.ZodString>;
704
+ heldBy: z.ZodOptional<z.ZodString>;
705
+ participantKind: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
706
+ user: "user";
707
+ agent: "agent";
708
+ system: "system";
709
+ }>>>;
710
+ position: z.ZodNumber;
711
+ expiresAt: z.ZodNumber;
712
+ }, z.core.$strip>>;
713
+ }, z.core.$strip>;
714
+ export type ClaimQueue = z.infer<typeof claimQueueSchema>;
715
+ /**
716
+ * A held claim's TTL lapsed server-side. The claim is already inactive by the
717
+ * time this arrives, so a consumer either re-claims with a fresh credential or
718
+ * accepts the drop; there is nothing to release.
719
+ */
720
+ export declare const claimExpiredSchema: z.ZodObject<{
721
+ claimId: z.ZodString;
722
+ }, z.core.$strip>;
723
+ export type ClaimExpired = z.infer<typeof claimExpiredSchema>;
724
+ /**
725
+ * Why a claim ended without its holder releasing it, or was refused.
726
+ *
727
+ * A closed set, because the two refusals are different guarantees and a reader
728
+ * has to be able to tell them apart: `conflict` means someone holds the row
729
+ * right now and you may queue behind them, while `coordination_unavailable`
730
+ * means the coordinator could not answer, so nothing is known about the row.
731
+ * `expired` and `preempted` are the two ways a lease you held ends.
732
+ *
733
+ * The rejection frame's `reason` stays a plain string on the wire — it is
734
+ * frozen, and an older server may send a word not listed here. This is the
735
+ * reader's side of it: a value that parses becomes the typed reason, and one
736
+ * that does not is simply absent rather than smuggled through as prose.
737
+ * {@link claimExpiredSchema} and {@link claimLostSchema} already spelled their
738
+ * reasons as enums; this brings the refusals into line.
739
+ */
740
+ export declare const claimEventReasonSchema: z.ZodEnum<{
741
+ conflict: "conflict";
742
+ expired: "expired";
743
+ preempted: "preempted";
744
+ coordination_unavailable: "coordination_unavailable";
745
+ }>;
746
+ export type ClaimEventReason = z.infer<typeof claimEventReasonSchema>;
747
+ /**
748
+ * What a {@link ModelClaim} points at — the target locator as SDK callers see
749
+ * it, keyed by `model` and `id` rather than the wire schema's `entityType` and
750
+ * `entityId`. This is the public `ModelTarget` shape.
751
+ */
752
+ export declare const modelTargetSchema: z.ZodReadonly<z.ZodObject<{
753
+ model: z.ZodString;
754
+ id: z.ZodString;
755
+ path: z.ZodOptional<z.ZodString>;
756
+ range: z.ZodOptional<z.ZodObject<{
757
+ startLine: z.ZodNumber;
758
+ endLine: z.ZodNumber;
759
+ startColumn: z.ZodOptional<z.ZodNumber>;
760
+ endColumn: z.ZodOptional<z.ZodNumber>;
761
+ }, z.core.$strip>>;
762
+ field: z.ZodOptional<z.ZodString>;
763
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
764
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
765
+ }, z.core.$strip>>;
766
+ export type ModelTarget = z.infer<typeof modelTargetSchema>;
767
+ /**
768
+ * The two states a claim can be observed in while it still exists.
769
+ *
770
+ * Derived from {@link publicClaimStatusSchema} rather than spelled again: the
771
+ * other three are terminal and drop the claim from the observable set, so a
772
+ * listing or a peer's view can only ever see these. Extracting them by name
773
+ * means a state added to the public vocabulary is a deliberate decision about
774
+ * whether it is observable, not a silent omission.
775
+ */
776
+ export declare const heldClaimStatusSchema: z.ZodEnum<{
777
+ active: "active";
778
+ queued: "queued";
779
+ }>;
780
+ export type HeldClaimStatus = z.infer<typeof heldClaimStatusSchema>;
781
+ /**
782
+ * ONE CLAIM — everything true about a lease at a moment: what it points at, who
783
+ * holds it, what they said they are doing, where it stands, and until when.
784
+ *
785
+ * Every caller-facing surface that answers a question about a claim is a
786
+ * PROJECTION of this record, never a second object: {@link modelClaimSchema} is
787
+ * what a peer may see, and `claimStateSchema` (`wire/claims.ts`) is what a
788
+ * caller polls about a claim of its own. Each is pinned to this record, so a
789
+ * field added here either reaches the people it was declared for or fails to
790
+ * compile.
791
+ *
792
+ * Before this, the peer-visible shape was a standalone `z.object` deriving from
793
+ * nothing, and the polling shape was a third. That is why it took reading four
794
+ * files to answer whether a heartbeat's progress reaches an asker — the
795
+ * declaring surface and the observing surface were kept in step by hand, and
796
+ * three of their shared fields had already drifted on how strictly they parse.
797
+ *
798
+ * What this record deliberately does NOT unify is the socket family
799
+ * ({@link wireClaimSchema} and its base). Those carry the same claim under the
800
+ * `entityType`/`entityId` locator rather than `model`/`id`, and they already
801
+ * derive from one another; collapsing the two locator spellings is a wire
802
+ * rename, not a projection.
803
+ */
804
+ export declare const claimRecordSchema: z.ZodObject<{
805
+ id: z.ZodString;
806
+ actor: z.ZodString;
807
+ participantKind: z.ZodPreprocess<z.ZodEnum<{
808
+ user: "user";
809
+ agent: "agent";
810
+ system: "system";
811
+ }>>;
812
+ onBehalfOfId: z.ZodNullable<z.ZodString>;
813
+ onBehalfOfKind: z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
814
+ user: "user";
815
+ agent: "agent";
816
+ system: "system";
817
+ }>>>;
818
+ capabilityId: z.ZodNullable<z.ZodString>;
819
+ description: z.ZodString;
820
+ status: z.ZodEnum<{
821
+ active: "active";
822
+ queued: "queued";
823
+ }>;
824
+ position: z.ZodNumber;
825
+ expiresAt: z.ZodNumber;
826
+ fenceToken: z.ZodNumber;
827
+ target: z.ZodReadonly<z.ZodObject<{
828
+ model: z.ZodString;
829
+ id: z.ZodString;
830
+ path: z.ZodOptional<z.ZodString>;
831
+ range: z.ZodOptional<z.ZodObject<{
832
+ startLine: z.ZodNumber;
833
+ endLine: z.ZodNumber;
834
+ startColumn: z.ZodOptional<z.ZodNumber>;
835
+ endColumn: z.ZodOptional<z.ZodNumber>;
836
+ }, z.core.$strip>>;
837
+ field: z.ZodOptional<z.ZodString>;
838
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
839
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
840
+ }, z.core.$strip>>;
841
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
842
+ }, z.core.$strip>;
843
+ export type ClaimRecord = z.infer<typeof claimRecordSchema>;
844
+ /**
845
+ * A claim as SDK callers and the HTTP claim routes see it
846
+ * (`ablo.<model>.claim.state`, `GET /v1/claims`) — the resolved, peer-readable
847
+ * view of one active or queued claim. The client's `ModelClaim` type derives
848
+ * from this shape.
849
+ *
850
+ * Everything but the deprecated `field` is projected from
851
+ * {@link claimRecordSchema}. Four members are optional here and required on the
852
+ * record, and the split is the same in each case: the record says what a claim
853
+ * IS, while a peer's view of one may legitimately have been built without them
854
+ * — a queued claim has no `fenceToken`, a held one has no `position`, an older
855
+ * producer sends no `status`, and a claim may be declared with no description.
856
+ */
857
+ export declare const modelClaimSchema: z.ZodReadonly<z.ZodObject<{
858
+ id: z.ZodString;
859
+ actor: z.ZodString;
860
+ participantKind: z.ZodPreprocess<z.ZodEnum<{
861
+ user: "user";
862
+ agent: "agent";
863
+ system: "system";
864
+ }>>;
865
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
866
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
867
+ user: "user";
868
+ agent: "agent";
869
+ system: "system";
870
+ }>>>>;
871
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
872
+ description: z.ZodOptional<z.ZodString>;
873
+ status: z.ZodOptional<z.ZodEnum<{
874
+ active: "active";
875
+ queued: "queued";
876
+ }>>;
877
+ position: z.ZodOptional<z.ZodNumber>;
878
+ expiresAt: z.ZodNumber;
879
+ fenceToken: z.ZodOptional<z.ZodNumber>;
880
+ target: z.ZodReadonly<z.ZodObject<{
881
+ model: z.ZodString;
882
+ id: z.ZodString;
883
+ path: z.ZodOptional<z.ZodString>;
884
+ range: z.ZodOptional<z.ZodObject<{
885
+ startLine: z.ZodNumber;
886
+ endLine: z.ZodNumber;
887
+ startColumn: z.ZodOptional<z.ZodNumber>;
888
+ endColumn: z.ZodOptional<z.ZodNumber>;
889
+ }, z.core.$strip>>;
890
+ field: z.ZodOptional<z.ZodString>;
891
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
892
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
893
+ }, z.core.$strip>>;
894
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
895
+ field: z.ZodOptional<z.ZodString>;
896
+ }, z.core.$strip>>;
897
+ export type ModelClaim = z.infer<typeof modelClaimSchema>;
898
+ /**
899
+ * The `claim_begin` payload a client sends. It carries the descriptive target
900
+ * and a `description` of the work, an optional duration hint, and the opt-in
901
+ * fair-queue flag. The server stamps the lifecycle and timestamp fields, so they
902
+ * are not part of this inbound shape — this is exactly what the server validates
903
+ * on ingest.
904
+ */
905
+ export declare const claimBeginPayloadSchema: z.ZodObject<{
906
+ entityType: z.ZodString;
907
+ entityId: z.ZodString;
908
+ path: z.ZodOptional<z.ZodString>;
909
+ range: z.ZodOptional<z.ZodObject<{
910
+ startLine: z.ZodNumber;
911
+ endLine: z.ZodNumber;
912
+ startColumn: z.ZodOptional<z.ZodNumber>;
913
+ endColumn: z.ZodOptional<z.ZodNumber>;
914
+ }, z.core.$strip>>;
915
+ field: z.ZodOptional<z.ZodString>;
916
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
917
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
918
+ claimId: z.ZodString;
919
+ description: z.ZodOptional<z.ZodString>;
920
+ estimatedMs: z.ZodOptional<z.ZodNumber>;
921
+ queue: z.ZodOptional<z.ZodBoolean>;
922
+ }, z.core.$strip>;
923
+ export type ClaimBeginPayload = z.infer<typeof claimBeginPayloadSchema>;
924
+ /**
925
+ * The `claim_abandon` payload a client sends. `entityType` and `entityId` let
926
+ * the server dequeue a claim that is still waiting (not yet held) from the FIFO
927
+ * line; abandoning a claim that is already held needs only `claimId`.
928
+ */
929
+ export declare const claimAbandonPayloadSchema: z.ZodObject<{
930
+ claimId: z.ZodString;
931
+ entityType: z.ZodOptional<z.ZodString>;
932
+ entityId: z.ZodOptional<z.ZodString>;
933
+ }, z.core.$strip>;
934
+ export type ClaimAbandonPayload = z.infer<typeof claimAbandonPayloadSchema>;
935
+ /**
936
+ * The `claim_reorder` payload a client sends. A privileged participant, such as
937
+ * a supervisor over its sub-agents, re-ranks the FIFO wait queue for an entity:
938
+ * `order` lists waiters by `heldBy` and `claimId` in the desired priority, and
939
+ * any waiter not listed keeps its relative order behind those that are. The
940
+ * server gates who may call this and drops an unauthorized sender. Where
941
+ * `claim_abandon` acts on the caller's own entry, a reorder acts on other
942
+ * participants' queue positions — which is why it is gated.
943
+ */
944
+ export declare const claimReorderPayloadSchema: z.ZodObject<{
945
+ entityType: z.ZodString;
946
+ entityId: z.ZodString;
947
+ order: z.ZodArray<z.ZodObject<{
948
+ heldBy: z.ZodString;
949
+ claimId: z.ZodString;
950
+ }, z.core.$strip>>;
951
+ }, z.core.$strip>;
952
+ export type ClaimReorderPayload = z.infer<typeof claimReorderPayloadSchema>;
953
+ /**
954
+ * The `claim_heartbeat` payload a client sends to extend a lease it holds (or
955
+ * refresh its slot in the wait queue) past the liveness window — the
956
+ * work-duration signal for long-running holders, distinct from the connection
957
+ * keepalive.
958
+ *
959
+ * The claim is identified either way: by `claimId`, or — since a claim is
960
+ * singular per (actor, entity) — by the full `entityType`/`entityId` target
961
+ * ("my claim on this row"). At least one of the two must be present. The
962
+ * target also lets the server resolve without a scan and is required to
963
+ * refresh a *queued* claim (a waiter is not in the holder set the server
964
+ * would otherwise search).
965
+ */
966
+ export declare const claimHeartbeatPayloadSchema: z.ZodObject<{
967
+ claimId: z.ZodOptional<z.ZodString>;
968
+ entityType: z.ZodOptional<z.ZodString>;
969
+ entityId: z.ZodOptional<z.ZodString>;
970
+ ttlMs: z.ZodOptional<z.ZodNumber>;
971
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
972
+ }, z.core.$strip>;
973
+ export type ClaimHeartbeatPayload = z.infer<typeof claimHeartbeatPayloadSchema>;
974
+ /**
975
+ * The server's reply to a `claim_heartbeat`. For a socketless worker the
976
+ * heartbeat reply is the only inbound signal path, so it carries the lease's
977
+ * fate rather than a bare ok: `held` (extended to `expiresAt`), `queued`
978
+ * (slot refreshed; `position` is the current place in line), or `lost` (the
979
+ * lease expired and the queue moved on — the worker should abandon or
980
+ * re-queue, and any write it still attempts is caught by its `readAt` guard).
981
+ */
982
+ export declare const claimHeartbeatAckPayloadSchema: z.ZodObject<{
983
+ claimId: z.ZodString;
984
+ status: z.ZodEnum<{
985
+ queued: "queued";
986
+ held: "held";
987
+ lost: "lost";
988
+ }>;
989
+ expiresAt: z.ZodOptional<z.ZodNumber>;
990
+ position: z.ZodOptional<z.ZodNumber>;
991
+ queueDepth: z.ZodOptional<z.ZodNumber>;
992
+ }, z.core.$strip>;
993
+ export type ClaimHeartbeatAckPayload = z.infer<typeof claimHeartbeatAckPayloadSchema>;
994
+ /**
995
+ * The batched heartbeat — one request extends every lease the caller holds
996
+ * on its plane (the socketless twin of the WebSocket keepalive, which renews
997
+ * all held leases on every ping). For a worker holding many rows this is one
998
+ * round trip per cadence instead of one per claim. Queued slots are not
999
+ * batch-refreshed: a waiter knows its target and beats it directly.
1000
+ */
1001
+ export declare const claimHeartbeatBatchPayloadSchema: z.ZodObject<{
1002
+ ttlMs: z.ZodOptional<z.ZodNumber>;
1003
+ }, z.core.$strip>;
1004
+ export type ClaimHeartbeatBatchPayload = z.infer<typeof claimHeartbeatBatchPayloadSchema>;
1005
+ /** Reply to a batched heartbeat: one ack entry per lease that was extended. */
1006
+ export declare const claimHeartbeatBatchAckPayloadSchema: z.ZodObject<{
1007
+ results: z.ZodArray<z.ZodObject<{
1008
+ claimId: z.ZodString;
1009
+ status: z.ZodEnum<{
1010
+ queued: "queued";
1011
+ held: "held";
1012
+ lost: "lost";
1013
+ }>;
1014
+ expiresAt: z.ZodOptional<z.ZodNumber>;
1015
+ position: z.ZodOptional<z.ZodNumber>;
1016
+ queueDepth: z.ZodOptional<z.ZodNumber>;
1017
+ }, z.core.$strip>>;
1018
+ }, z.core.$strip>;
1019
+ export type ClaimHeartbeatBatchAckPayload = z.infer<typeof claimHeartbeatBatchAckPayloadSchema>;
1020
+ /**
1021
+ * The `update_subscription` payload a client sends. It replaces the
1022
+ * connection's read interest with the complete set of sync groups — the read
1023
+ * counterpart to a claim, with no write lock and no TTL. Each entry is a
1024
+ * {@link syncGroupInputSchema} (`'default'` or a branded `kind:id`), so a
1025
+ * malformed group is rejected on ingest rather than silently indexed. The
1026
+ * element type is strict because this is untrusted client input.
1027
+ */
1028
+ export declare const updateSubscriptionPayloadSchema: z.ZodObject<{
1029
+ syncGroups: z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"default">, z.core.$ZodBranded<z.ZodTemplateLiteral<`${string}:${string}`>, "SyncGroup", "out">]>>;
1030
+ }, z.core.$strip>;
1031
+ export type UpdateSubscriptionPayload = z.infer<typeof updateSubscriptionPayloadSchema>;
1032
+ /**
1033
+ * `subscription_ack` payload (server → client). Echoes the connection's
1034
+ * effective read set after the update (unchanged on rejection — the update is
1035
+ * atomic). `error` is present iff `success` is false (e.g. a scoped key
1036
+ * requesting a group outside its grant). `syncGroups` is lenient
1037
+ * (`z.string()`) here, not branded: it is the server's own echo for display,
1038
+ * not untrusted input, and includes base anchors like `org:<id>`.
1039
+ */
1040
+ export declare const subscriptionAckPayloadSchema: z.ZodObject<{
1041
+ success: z.ZodBoolean;
1042
+ syncGroups: z.ZodArray<z.ZodString>;
1043
+ error: z.ZodOptional<z.ZodObject<{
1044
+ code: z.ZodString;
1045
+ message: z.ZodString;
1046
+ }, z.core.$strip>>;
1047
+ }, z.core.$strip>;
1048
+ export type SubscriptionAckPayload = z.infer<typeof subscriptionAckPayloadSchema>;
1049
+ export declare const commitOperationTypeSchema: z.ZodEnum<{
1050
+ CREATE: "CREATE";
1051
+ UPDATE: "UPDATE";
1052
+ DELETE: "DELETE";
1053
+ ARCHIVE: "ARCHIVE";
1054
+ UNARCHIVE: "UNARCHIVE";
1055
+ }>;
1056
+ export type CommitOperationType = z.infer<typeof commitOperationTypeSchema>;
1057
+ /**
1058
+ * A single mutation in a commit batch, as it arrives on the wire. Extends the
1059
+ * optimistic `writeGuard` (`readAt`/`onStale`/`bypass`) — the structural link
1060
+ * that makes "every write is stale-guarded" legible in the type, not just in
1061
+ * prose.
1062
+ */
1063
+ export declare const commitOperationSchema: z.ZodObject<{
1064
+ readAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1065
+ onStale: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
1066
+ reject: "reject";
1067
+ overwrite: "overwrite";
1068
+ notify: "notify";
1069
+ }>>>;
1070
+ bypass: z.ZodOptional<z.ZodBoolean>;
1071
+ type: z.ZodEnum<{
1072
+ CREATE: "CREATE";
1073
+ UPDATE: "UPDATE";
1074
+ DELETE: "DELETE";
1075
+ ARCHIVE: "ARCHIVE";
1076
+ UNARCHIVE: "UNARCHIVE";
1077
+ }>;
1078
+ model: z.ZodString;
1079
+ id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1080
+ input: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1081
+ transactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1082
+ fenceToken: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1083
+ }, z.core.$strip>;
1084
+ export type CommitOperation = z.infer<typeof commitOperationSchema>;
1085
+ /**
1086
+ * Any commit operation on the wire — the runtime-validated ingest contract.
1087
+ * Commit operations carry replace (last-write-wins) semantics, guarded by the
1088
+ * optimistic write guard. It is a distinct alias from {@link CommitOperation}
1089
+ * so the server's ingest boundary reads as "any op on the wire", even though
1090
+ * the two shapes are identical.
1091
+ */
1092
+ export type AnyCommitOperation = CommitOperation;
1093
+ export declare const presenceKindSchema: z.ZodEnum<{
1094
+ enter: "enter";
1095
+ update: "update";
1096
+ leave: "leave";
1097
+ }>;
1098
+ export type PresenceKind = z.infer<typeof presenceKindSchema>;
1099
+ /**
1100
+ * What a participant is actively working on (agents fill this in).
1101
+ *
1102
+ * The two backpressure fields are part of the frame, not an extension of it:
1103
+ * an agent worker announces them on every step, and an orchestrator reading
1104
+ * peer activity routes work by them. They are declared here because a reader
1105
+ * that validates this frame would otherwise drop them on the floor — the
1106
+ * server passes both through without interpreting either.
1107
+ */
1108
+ export declare const presenceActivitySchema: z.ZodObject<{
1109
+ entityType: z.ZodString;
1110
+ entityId: z.ZodString;
1111
+ path: z.ZodOptional<z.ZodString>;
1112
+ range: z.ZodOptional<z.ZodObject<{
1113
+ startLine: z.ZodNumber;
1114
+ endLine: z.ZodNumber;
1115
+ startColumn: z.ZodOptional<z.ZodNumber>;
1116
+ endColumn: z.ZodOptional<z.ZodNumber>;
1117
+ }, z.core.$strip>>;
1118
+ field: z.ZodOptional<z.ZodString>;
1119
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
1120
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1121
+ action: z.ZodString;
1122
+ detail: z.ZodOptional<z.ZodString>;
1123
+ loadFactor: z.ZodOptional<z.ZodNumber>;
1124
+ acceptingNewWork: z.ZodOptional<z.ZodBoolean>;
1125
+ }, z.core.$strip>;
1126
+ export type PresenceActivity = z.infer<typeof presenceActivitySchema>;
1127
+ /**
1128
+ * Full `presence_update` frame as the server broadcasts it. The activity +
1129
+ * `activeClaims` are the observation surface for the other two layers —
1130
+ * rendered, never acted on as enforcement.
1131
+ *
1132
+ * Open for the same reason {@link presenceUpdatePayloadSchema} is, and it has to
1133
+ * be the same in both directions: whatever vocabulary an application announces
1134
+ * through presence, it reads back off its peers' frames. A reader that parsed
1135
+ * this strictly would validate the frame and quietly discard the part the
1136
+ * application actually came for.
1137
+ */
1138
+ export declare const presenceUpdateSchema: z.ZodObject<{
1139
+ kind: z.ZodEnum<{
1140
+ enter: "enter";
1141
+ update: "update";
1142
+ leave: "leave";
1143
+ }>;
1144
+ userId: z.ZodString;
1145
+ syncGroups: z.ZodOptional<z.ZodArray<z.ZodString>>;
1146
+ timestamp: z.ZodOptional<z.ZodNumber>;
1147
+ status: z.ZodString;
1148
+ timezone: z.ZodOptional<z.ZodString>;
1149
+ customStatus: z.ZodOptional<z.ZodString>;
1150
+ activity: z.ZodOptional<z.ZodObject<{
1151
+ entityType: z.ZodString;
1152
+ entityId: z.ZodString;
1153
+ path: z.ZodOptional<z.ZodString>;
1154
+ range: z.ZodOptional<z.ZodObject<{
1155
+ startLine: z.ZodNumber;
1156
+ endLine: z.ZodNumber;
1157
+ startColumn: z.ZodOptional<z.ZodNumber>;
1158
+ endColumn: z.ZodOptional<z.ZodNumber>;
1159
+ }, z.core.$strip>>;
1160
+ field: z.ZodOptional<z.ZodString>;
1161
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
1162
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1163
+ action: z.ZodString;
1164
+ detail: z.ZodOptional<z.ZodString>;
1165
+ loadFactor: z.ZodOptional<z.ZodNumber>;
1166
+ acceptingNewWork: z.ZodOptional<z.ZodBoolean>;
1167
+ }, z.core.$strip>>;
1168
+ isAgent: z.ZodOptional<z.ZodBoolean>;
1169
+ participantKind: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
1170
+ user: "user";
1171
+ agent: "agent";
1172
+ system: "system";
1173
+ }>>>;
1174
+ activeClaims: z.ZodOptional<z.ZodArray<z.ZodObject<{
1175
+ entityType: z.ZodString;
1176
+ entityId: z.ZodString;
1177
+ path: z.ZodOptional<z.ZodString>;
1178
+ range: z.ZodOptional<z.ZodObject<{
1179
+ startLine: z.ZodNumber;
1180
+ endLine: z.ZodNumber;
1181
+ startColumn: z.ZodOptional<z.ZodNumber>;
1182
+ endColumn: z.ZodOptional<z.ZodNumber>;
1183
+ }, z.core.$strip>>;
1184
+ field: z.ZodOptional<z.ZodString>;
1185
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
1186
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1187
+ claimId: z.ZodString;
1188
+ description: z.ZodOptional<z.ZodString>;
1189
+ declaredAt: z.ZodNumber;
1190
+ expiresAt: z.ZodNumber;
1191
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1192
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
1193
+ user: "user";
1194
+ agent: "agent";
1195
+ system: "system";
1196
+ }>>>>;
1197
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1198
+ fenceToken: z.ZodOptional<z.ZodNumber>;
1199
+ acquiredAt: z.ZodOptional<z.ZodNumber>;
1200
+ status: z.ZodOptional<z.ZodEnum<{
1201
+ active: "active";
1202
+ committed: "committed";
1203
+ expired: "expired";
1204
+ canceled: "canceled";
1205
+ }>>;
1206
+ error: z.ZodOptional<z.ZodObject<{
1207
+ code: z.ZodString;
1208
+ message: z.ZodOptional<z.ZodString>;
1209
+ heldBy: z.ZodOptional<z.ZodString>;
1210
+ heldByClaimId: z.ZodOptional<z.ZodString>;
1211
+ heldByExpiresAt: z.ZodOptional<z.ZodNumber>;
1212
+ heldByClaim: z.ZodOptional<z.ZodObject<{
1213
+ entityType: z.ZodString;
1214
+ entityId: z.ZodString;
1215
+ path: z.ZodOptional<z.ZodString>;
1216
+ range: z.ZodOptional<z.ZodObject<{
1217
+ startLine: z.ZodNumber;
1218
+ endLine: z.ZodNumber;
1219
+ startColumn: z.ZodOptional<z.ZodNumber>;
1220
+ endColumn: z.ZodOptional<z.ZodNumber>;
1221
+ }, z.core.$strip>>;
1222
+ field: z.ZodOptional<z.ZodString>;
1223
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
1224
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1225
+ claimId: z.ZodString;
1226
+ description: z.ZodOptional<z.ZodString>;
1227
+ declaredAt: z.ZodNumber;
1228
+ expiresAt: z.ZodNumber;
1229
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1230
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
1231
+ user: "user";
1232
+ agent: "agent";
1233
+ system: "system";
1234
+ }>>>>;
1235
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1236
+ }, z.core.$strip>>;
1237
+ policyReason: z.ZodOptional<z.ZodString>;
1238
+ }, z.core.$strip>>;
1239
+ }, z.core.$strip>>>;
1240
+ delegatedFrom: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1241
+ }, z.core.$catchall<z.ZodUnknown>>;
1242
+ export type PresenceUpdate = z.infer<typeof presenceUpdateSchema>;
1243
+ /**
1244
+ * @deprecated Renamed to {@link presenceUpdateSchema}. Removed in 0.36.0.
1245
+ *
1246
+ * `Frame` was the only such suffix in this vocabulary: every other frame the
1247
+ * server sends is named plainly — {@link claimLostSchema},
1248
+ * {@link claimAcquiredSchema}, {@link claimRejectionSchema} — and the client's
1249
+ * half carries `Payload`. One name did not follow the rule the other fifteen do.
1250
+ */
1251
+ export declare const presenceUpdateFrameSchema: z.ZodObject<{
1252
+ kind: z.ZodEnum<{
1253
+ enter: "enter";
1254
+ update: "update";
1255
+ leave: "leave";
1256
+ }>;
1257
+ userId: z.ZodString;
1258
+ syncGroups: z.ZodOptional<z.ZodArray<z.ZodString>>;
1259
+ timestamp: z.ZodOptional<z.ZodNumber>;
1260
+ status: z.ZodString;
1261
+ timezone: z.ZodOptional<z.ZodString>;
1262
+ customStatus: z.ZodOptional<z.ZodString>;
1263
+ activity: z.ZodOptional<z.ZodObject<{
1264
+ entityType: z.ZodString;
1265
+ entityId: z.ZodString;
1266
+ path: z.ZodOptional<z.ZodString>;
1267
+ range: z.ZodOptional<z.ZodObject<{
1268
+ startLine: z.ZodNumber;
1269
+ endLine: z.ZodNumber;
1270
+ startColumn: z.ZodOptional<z.ZodNumber>;
1271
+ endColumn: z.ZodOptional<z.ZodNumber>;
1272
+ }, z.core.$strip>>;
1273
+ field: z.ZodOptional<z.ZodString>;
1274
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
1275
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1276
+ action: z.ZodString;
1277
+ detail: z.ZodOptional<z.ZodString>;
1278
+ loadFactor: z.ZodOptional<z.ZodNumber>;
1279
+ acceptingNewWork: z.ZodOptional<z.ZodBoolean>;
1280
+ }, z.core.$strip>>;
1281
+ isAgent: z.ZodOptional<z.ZodBoolean>;
1282
+ participantKind: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
1283
+ user: "user";
1284
+ agent: "agent";
1285
+ system: "system";
1286
+ }>>>;
1287
+ activeClaims: z.ZodOptional<z.ZodArray<z.ZodObject<{
1288
+ entityType: z.ZodString;
1289
+ entityId: z.ZodString;
1290
+ path: z.ZodOptional<z.ZodString>;
1291
+ range: z.ZodOptional<z.ZodObject<{
1292
+ startLine: z.ZodNumber;
1293
+ endLine: z.ZodNumber;
1294
+ startColumn: z.ZodOptional<z.ZodNumber>;
1295
+ endColumn: z.ZodOptional<z.ZodNumber>;
1296
+ }, z.core.$strip>>;
1297
+ field: z.ZodOptional<z.ZodString>;
1298
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
1299
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1300
+ claimId: z.ZodString;
1301
+ description: z.ZodOptional<z.ZodString>;
1302
+ declaredAt: z.ZodNumber;
1303
+ expiresAt: z.ZodNumber;
1304
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1305
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
1306
+ user: "user";
1307
+ agent: "agent";
1308
+ system: "system";
1309
+ }>>>>;
1310
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1311
+ fenceToken: z.ZodOptional<z.ZodNumber>;
1312
+ acquiredAt: z.ZodOptional<z.ZodNumber>;
1313
+ status: z.ZodOptional<z.ZodEnum<{
1314
+ active: "active";
1315
+ committed: "committed";
1316
+ expired: "expired";
1317
+ canceled: "canceled";
1318
+ }>>;
1319
+ error: z.ZodOptional<z.ZodObject<{
1320
+ code: z.ZodString;
1321
+ message: z.ZodOptional<z.ZodString>;
1322
+ heldBy: z.ZodOptional<z.ZodString>;
1323
+ heldByClaimId: z.ZodOptional<z.ZodString>;
1324
+ heldByExpiresAt: z.ZodOptional<z.ZodNumber>;
1325
+ heldByClaim: z.ZodOptional<z.ZodObject<{
1326
+ entityType: z.ZodString;
1327
+ entityId: z.ZodString;
1328
+ path: z.ZodOptional<z.ZodString>;
1329
+ range: z.ZodOptional<z.ZodObject<{
1330
+ startLine: z.ZodNumber;
1331
+ endLine: z.ZodNumber;
1332
+ startColumn: z.ZodOptional<z.ZodNumber>;
1333
+ endColumn: z.ZodOptional<z.ZodNumber>;
1334
+ }, z.core.$strip>>;
1335
+ field: z.ZodOptional<z.ZodString>;
1336
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
1337
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1338
+ claimId: z.ZodString;
1339
+ description: z.ZodOptional<z.ZodString>;
1340
+ declaredAt: z.ZodNumber;
1341
+ expiresAt: z.ZodNumber;
1342
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1343
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
1344
+ user: "user";
1345
+ agent: "agent";
1346
+ system: "system";
1347
+ }>>>>;
1348
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1349
+ }, z.core.$strip>>;
1350
+ policyReason: z.ZodOptional<z.ZodString>;
1351
+ }, z.core.$strip>>;
1352
+ }, z.core.$strip>>>;
1353
+ delegatedFrom: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1354
+ }, z.core.$catchall<z.ZodUnknown>>;
1355
+ /** @deprecated Renamed to {@link PresenceUpdate}. Removed in 0.36.0. */
1356
+ export type PresenceUpdateFrame = PresenceUpdate;
1357
+ /**
1358
+ * The `presence_update` payload a client SENDS — deliberately much smaller
1359
+ * than the frame the server broadcasts back.
1360
+ *
1361
+ * Everything that identifies or situates the participant is stamped by the
1362
+ * server and cannot be declared here: `userId`, `participantKind`, `isAgent`,
1363
+ * `syncGroups`, `timestamp`, `kind`, and `delegatedFrom` all come from the
1364
+ * connection's own identity. A client that sends them is not believed — an
1365
+ * older SDK once hardcoded `isAgent: true` on every announce, and because the
1366
+ * payload was spread into the broadcast unfiltered, every human session
1367
+ * rendered to its peers as an agent. Parsing an inbound payload through this
1368
+ * schema and broadcasting the *result* is what makes that structurally
1369
+ * impossible rather than a rule the broadcast has to remember.
1370
+ *
1371
+ * `status` is a plain string, matching the outbound frame: the three canonical
1372
+ * values are conventions the presence UI understands, not a closed set the
1373
+ * protocol enforces.
1374
+ *
1375
+ * The payload is deliberately OPEN — `catchall` keeps keys this schema does not
1376
+ * name. Presence is the one frame an application extends: an agent mesh
1377
+ * announces its own coordination vocabulary through it and reads it back off
1378
+ * peer frames, without the protocol having to learn each app's words. So the
1379
+ * fields named here are validated and typed, and anything else rides along
1380
+ * untouched. Openness is not the same as trust: the server-stamped identity
1381
+ * fields are applied AFTER this payload is spread into the broadcast, so a
1382
+ * client that sends its own `userId` or `isAgent` is overwritten either way.
1383
+ */
1384
+ export declare const presenceUpdatePayloadSchema: z.ZodObject<{
1385
+ status: z.ZodOptional<z.ZodString>;
1386
+ activity: z.ZodOptional<z.ZodObject<{
1387
+ entityType: z.ZodString;
1388
+ entityId: z.ZodString;
1389
+ path: z.ZodOptional<z.ZodString>;
1390
+ range: z.ZodOptional<z.ZodObject<{
1391
+ startLine: z.ZodNumber;
1392
+ endLine: z.ZodNumber;
1393
+ startColumn: z.ZodOptional<z.ZodNumber>;
1394
+ endColumn: z.ZodOptional<z.ZodNumber>;
1395
+ }, z.core.$strip>>;
1396
+ field: z.ZodOptional<z.ZodString>;
1397
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
1398
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1399
+ action: z.ZodString;
1400
+ detail: z.ZodOptional<z.ZodString>;
1401
+ loadFactor: z.ZodOptional<z.ZodNumber>;
1402
+ acceptingNewWork: z.ZodOptional<z.ZodBoolean>;
1403
+ }, z.core.$strip>>;
1404
+ activeClaims: z.ZodOptional<z.ZodArray<z.ZodObject<{
1405
+ entityType: z.ZodString;
1406
+ entityId: z.ZodString;
1407
+ path: z.ZodOptional<z.ZodString>;
1408
+ range: z.ZodOptional<z.ZodObject<{
1409
+ startLine: z.ZodNumber;
1410
+ endLine: z.ZodNumber;
1411
+ startColumn: z.ZodOptional<z.ZodNumber>;
1412
+ endColumn: z.ZodOptional<z.ZodNumber>;
1413
+ }, z.core.$strip>>;
1414
+ field: z.ZodOptional<z.ZodString>;
1415
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
1416
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1417
+ claimId: z.ZodString;
1418
+ description: z.ZodOptional<z.ZodString>;
1419
+ declaredAt: z.ZodNumber;
1420
+ expiresAt: z.ZodNumber;
1421
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1422
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
1423
+ user: "user";
1424
+ agent: "agent";
1425
+ system: "system";
1426
+ }>>>>;
1427
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1428
+ fenceToken: z.ZodOptional<z.ZodNumber>;
1429
+ acquiredAt: z.ZodOptional<z.ZodNumber>;
1430
+ status: z.ZodOptional<z.ZodEnum<{
1431
+ active: "active";
1432
+ committed: "committed";
1433
+ expired: "expired";
1434
+ canceled: "canceled";
1435
+ }>>;
1436
+ error: z.ZodOptional<z.ZodObject<{
1437
+ code: z.ZodString;
1438
+ message: z.ZodOptional<z.ZodString>;
1439
+ heldBy: z.ZodOptional<z.ZodString>;
1440
+ heldByClaimId: z.ZodOptional<z.ZodString>;
1441
+ heldByExpiresAt: z.ZodOptional<z.ZodNumber>;
1442
+ heldByClaim: z.ZodOptional<z.ZodObject<{
1443
+ entityType: z.ZodString;
1444
+ entityId: z.ZodString;
1445
+ path: z.ZodOptional<z.ZodString>;
1446
+ range: z.ZodOptional<z.ZodObject<{
1447
+ startLine: z.ZodNumber;
1448
+ endLine: z.ZodNumber;
1449
+ startColumn: z.ZodOptional<z.ZodNumber>;
1450
+ endColumn: z.ZodOptional<z.ZodNumber>;
1451
+ }, z.core.$strip>>;
1452
+ field: z.ZodOptional<z.ZodString>;
1453
+ fields: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
1454
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1455
+ claimId: z.ZodString;
1456
+ description: z.ZodOptional<z.ZodString>;
1457
+ declaredAt: z.ZodNumber;
1458
+ expiresAt: z.ZodNumber;
1459
+ onBehalfOfId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1460
+ onBehalfOfKind: z.ZodOptional<z.ZodNullable<z.ZodPreprocess<z.ZodEnum<{
1461
+ user: "user";
1462
+ agent: "agent";
1463
+ system: "system";
1464
+ }>>>>;
1465
+ capabilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1466
+ }, z.core.$strip>>;
1467
+ policyReason: z.ZodOptional<z.ZodString>;
1468
+ }, z.core.$strip>>;
1469
+ }, z.core.$strip>>>;
1470
+ timezone: z.ZodOptional<z.ZodString>;
1471
+ customStatus: z.ZodOptional<z.ZodString>;
1472
+ }, z.core.$catchall<z.ZodUnknown>>;
1473
+ export type PresenceUpdatePayload = z.infer<typeof presenceUpdatePayloadSchema>;