@superbee/core 0.2.0-pre.2 → 0.2.0-pre.20

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 (517) hide show
  1. package/README.md +1000 -0
  2. package/dist/artifact-contract.d.ts +90 -0
  3. package/dist/artifact-contract.d.ts.map +1 -0
  4. package/dist/artifact-contract.js +205 -0
  5. package/dist/artifact-contract.js.map +1 -0
  6. package/dist/backend.d.ts +19 -1
  7. package/dist/backend.d.ts.map +1 -1
  8. package/dist/backend.js +83 -36
  9. package/dist/backend.js.map +1 -1
  10. package/dist/blob-contract.d.ts +80 -0
  11. package/dist/blob-contract.d.ts.map +1 -0
  12. package/dist/blob-contract.js +131 -0
  13. package/dist/blob-contract.js.map +1 -0
  14. package/dist/blob-journal.d.ts +302 -0
  15. package/dist/blob-journal.d.ts.map +1 -0
  16. package/dist/blob-journal.js +540 -0
  17. package/dist/blob-journal.js.map +1 -0
  18. package/dist/body-replace-guards.d.ts +50 -0
  19. package/dist/body-replace-guards.d.ts.map +1 -0
  20. package/dist/body-replace-guards.js +158 -0
  21. package/dist/body-replace-guards.js.map +1 -0
  22. package/dist/builtin-recipes/content.d.ts +93 -0
  23. package/dist/builtin-recipes/content.d.ts.map +1 -0
  24. package/dist/builtin-recipes/content.js +288 -0
  25. package/dist/builtin-recipes/content.js.map +1 -0
  26. package/dist/builtin-recipes.d.ts +10 -0
  27. package/dist/builtin-recipes.d.ts.map +1 -0
  28. package/dist/builtin-recipes.js +97 -0
  29. package/dist/builtin-recipes.js.map +1 -0
  30. package/dist/bundle-health/index.d.ts +14 -0
  31. package/dist/bundle-health/index.d.ts.map +1 -0
  32. package/dist/bundle-health/index.js +12 -0
  33. package/dist/bundle-health/index.js.map +1 -0
  34. package/dist/bundle-health/kind-findings.d.ts +44 -0
  35. package/dist/bundle-health/kind-findings.d.ts.map +1 -0
  36. package/dist/bundle-health/kind-findings.js +68 -0
  37. package/dist/bundle-health/kind-findings.js.map +1 -0
  38. package/dist/bundle-health/legacy-page.d.ts +39 -0
  39. package/dist/bundle-health/legacy-page.d.ts.map +1 -0
  40. package/dist/bundle-health/legacy-page.js +50 -0
  41. package/dist/bundle-health/legacy-page.js.map +1 -0
  42. package/dist/bundle-health/report.d.ts +202 -0
  43. package/dist/bundle-health/report.d.ts.map +1 -0
  44. package/dist/bundle-health/report.js +438 -0
  45. package/dist/bundle-health/report.js.map +1 -0
  46. package/dist/bundle-ops.d.ts +1 -1
  47. package/dist/bundle-ops.d.ts.map +1 -1
  48. package/dist/bundle-ops.js +2 -2
  49. package/dist/bundle-ops.js.map +1 -1
  50. package/dist/bundle.d.ts +2 -1
  51. package/dist/bundle.d.ts.map +1 -1
  52. package/dist/bundle.js +3 -3
  53. package/dist/bundle.js.map +1 -1
  54. package/dist/code-point-order.d.ts +8 -0
  55. package/dist/code-point-order.d.ts.map +1 -0
  56. package/dist/code-point-order.js +20 -0
  57. package/dist/code-point-order.js.map +1 -0
  58. package/dist/connectors.d.ts +230 -0
  59. package/dist/connectors.d.ts.map +1 -0
  60. package/dist/connectors.js +1150 -0
  61. package/dist/connectors.js.map +1 -0
  62. package/dist/cross-bundle.d.ts +135 -0
  63. package/dist/cross-bundle.d.ts.map +1 -0
  64. package/dist/cross-bundle.js +186 -0
  65. package/dist/cross-bundle.js.map +1 -0
  66. package/dist/dependencies.d.ts +94 -0
  67. package/dist/dependencies.d.ts.map +1 -0
  68. package/dist/dependencies.js +180 -0
  69. package/dist/dependencies.js.map +1 -0
  70. package/dist/document-codec.d.ts +6 -1
  71. package/dist/document-codec.d.ts.map +1 -1
  72. package/dist/document-codec.js +8 -4
  73. package/dist/document-codec.js.map +1 -1
  74. package/dist/document-field-actions.d.ts +31 -1
  75. package/dist/document-field-actions.d.ts.map +1 -1
  76. package/dist/document-field-actions.js +137 -34
  77. package/dist/document-field-actions.js.map +1 -1
  78. package/dist/document-mutation.d.ts +22 -10
  79. package/dist/document-mutation.d.ts.map +1 -1
  80. package/dist/document-mutation.js +58 -27
  81. package/dist/document-mutation.js.map +1 -1
  82. package/dist/document-write-policy.d.ts.map +1 -1
  83. package/dist/document-write-policy.js +4 -2
  84. package/dist/document-write-policy.js.map +1 -1
  85. package/dist/engine.d.ts +9 -2
  86. package/dist/engine.d.ts.map +1 -1
  87. package/dist/engine.js +11 -4
  88. package/dist/engine.js.map +1 -1
  89. package/dist/file-journaled-backend-internal.d.ts +21 -0
  90. package/dist/file-journaled-backend-internal.d.ts.map +1 -0
  91. package/dist/file-journaled-backend-internal.js +12 -0
  92. package/dist/file-journaled-backend-internal.js.map +1 -0
  93. package/dist/file-journaled-backend.d.ts +200 -0
  94. package/dist/file-journaled-backend.d.ts.map +1 -0
  95. package/dist/file-journaled-backend.js +1334 -0
  96. package/dist/file-journaled-backend.js.map +1 -0
  97. package/dist/filesystem-host.d.ts +15 -0
  98. package/dist/filesystem-host.d.ts.map +1 -0
  99. package/dist/filesystem-host.js +20 -0
  100. package/dist/filesystem-host.js.map +1 -0
  101. package/dist/filesystem-identity.d.ts +86 -4
  102. package/dist/filesystem-identity.d.ts.map +1 -1
  103. package/dist/filesystem-identity.js +338 -102
  104. package/dist/filesystem-identity.js.map +1 -1
  105. package/dist/filesystem-lock.d.ts +16 -3
  106. package/dist/filesystem-lock.d.ts.map +1 -1
  107. package/dist/filesystem-lock.js +323 -77
  108. package/dist/filesystem-lock.js.map +1 -1
  109. package/dist/filesystem-push-role.d.ts +77 -0
  110. package/dist/filesystem-push-role.d.ts.map +1 -0
  111. package/dist/filesystem-push-role.js +165 -0
  112. package/dist/filesystem-push-role.js.map +1 -0
  113. package/dist/filesystem.d.ts +17 -0
  114. package/dist/filesystem.d.ts.map +1 -0
  115. package/dist/filesystem.js +18 -0
  116. package/dist/filesystem.js.map +1 -0
  117. package/dist/frontmatter.d.ts +8 -0
  118. package/dist/frontmatter.d.ts.map +1 -1
  119. package/dist/frontmatter.js +14 -4
  120. package/dist/frontmatter.js.map +1 -1
  121. package/dist/governed-body-write.d.ts +106 -0
  122. package/dist/governed-body-write.d.ts.map +1 -0
  123. package/dist/governed-body-write.js +251 -0
  124. package/dist/governed-body-write.js.map +1 -0
  125. package/dist/host-policy-snapshot.d.ts +9 -0
  126. package/dist/host-policy-snapshot.d.ts.map +1 -0
  127. package/dist/host-policy-snapshot.js +33 -0
  128. package/dist/host-policy-snapshot.js.map +1 -0
  129. package/dist/host-text.d.ts +31 -0
  130. package/dist/host-text.d.ts.map +1 -0
  131. package/dist/host-text.js +77 -0
  132. package/dist/host-text.js.map +1 -0
  133. package/dist/hosted-client/binding.d.ts +7 -0
  134. package/dist/hosted-client/binding.d.ts.map +1 -0
  135. package/dist/hosted-client/binding.js +10 -0
  136. package/dist/hosted-client/binding.js.map +1 -0
  137. package/dist/hosted-client/blob-delivery.d.ts +67 -0
  138. package/dist/hosted-client/blob-delivery.d.ts.map +1 -0
  139. package/dist/hosted-client/blob-delivery.js +169 -0
  140. package/dist/hosted-client/blob-delivery.js.map +1 -0
  141. package/dist/hosted-client/blob-write.d.ts +386 -0
  142. package/dist/hosted-client/blob-write.d.ts.map +1 -0
  143. package/dist/hosted-client/blob-write.js +770 -0
  144. package/dist/hosted-client/blob-write.js.map +1 -0
  145. package/dist/hosted-client/bundle-listing.d.ts +46 -0
  146. package/dist/hosted-client/bundle-listing.d.ts.map +1 -0
  147. package/dist/hosted-client/bundle-listing.js +36 -0
  148. package/dist/hosted-client/bundle-listing.js.map +1 -0
  149. package/dist/hosted-client/client.d.ts +219 -0
  150. package/dist/hosted-client/client.d.ts.map +1 -0
  151. package/dist/hosted-client/client.js +309 -0
  152. package/dist/hosted-client/client.js.map +1 -0
  153. package/dist/hosted-client/directory.d.ts +46 -0
  154. package/dist/hosted-client/directory.d.ts.map +1 -0
  155. package/dist/hosted-client/directory.js +74 -0
  156. package/dist/hosted-client/directory.js.map +1 -0
  157. package/dist/hosted-client/errors.d.ts +26 -0
  158. package/dist/hosted-client/errors.d.ts.map +1 -0
  159. package/dist/hosted-client/errors.js +35 -0
  160. package/dist/hosted-client/errors.js.map +1 -0
  161. package/dist/hosted-client/inbox.d.ts +320 -0
  162. package/dist/hosted-client/inbox.d.ts.map +1 -0
  163. package/dist/hosted-client/inbox.js +379 -0
  164. package/dist/hosted-client/inbox.js.map +1 -0
  165. package/dist/hosted-client/index.d.ts +30 -0
  166. package/dist/hosted-client/index.d.ts.map +1 -0
  167. package/dist/hosted-client/index.js +32 -0
  168. package/dist/hosted-client/index.js.map +1 -0
  169. package/dist/hosted-client/journal.d.ts +103 -0
  170. package/dist/hosted-client/journal.d.ts.map +1 -0
  171. package/dist/hosted-client/journal.js +464 -0
  172. package/dist/hosted-client/journal.js.map +1 -0
  173. package/dist/hosted-client/node.d.ts +74 -0
  174. package/dist/hosted-client/node.d.ts.map +1 -0
  175. package/dist/hosted-client/node.js +219 -0
  176. package/dist/hosted-client/node.js.map +1 -0
  177. package/dist/hosted-client/reference.d.ts +12 -0
  178. package/dist/hosted-client/reference.d.ts.map +1 -0
  179. package/dist/hosted-client/reference.js +29 -0
  180. package/dist/hosted-client/reference.js.map +1 -0
  181. package/dist/hosted-client/write.d.ts +217 -0
  182. package/dist/hosted-client/write.d.ts.map +1 -0
  183. package/dist/hosted-client/write.js +418 -0
  184. package/dist/hosted-client/write.js.map +1 -0
  185. package/dist/hosted-transport/answer-rows.d.ts +243 -0
  186. package/dist/hosted-transport/answer-rows.d.ts.map +1 -0
  187. package/dist/hosted-transport/answer-rows.js +454 -0
  188. package/dist/hosted-transport/answer-rows.js.map +1 -0
  189. package/dist/hosted-transport/blob-reads.d.ts +35 -0
  190. package/dist/hosted-transport/blob-reads.d.ts.map +1 -0
  191. package/dist/hosted-transport/blob-reads.js +179 -0
  192. package/dist/hosted-transport/blob-reads.js.map +1 -0
  193. package/dist/hosted-transport/blob-write.d.ts +34 -0
  194. package/dist/hosted-transport/blob-write.d.ts.map +1 -0
  195. package/dist/hosted-transport/blob-write.js +115 -0
  196. package/dist/hosted-transport/blob-write.js.map +1 -0
  197. package/dist/hosted-transport/carrier.d.ts +151 -0
  198. package/dist/hosted-transport/carrier.d.ts.map +1 -0
  199. package/dist/hosted-transport/carrier.js +260 -0
  200. package/dist/hosted-transport/carrier.js.map +1 -0
  201. package/dist/hosted-transport/history-pages.d.ts +55 -0
  202. package/dist/hosted-transport/history-pages.d.ts.map +1 -0
  203. package/dist/hosted-transport/history-pages.js +69 -0
  204. package/dist/hosted-transport/history-pages.js.map +1 -0
  205. package/dist/hosted-transport/index.d.ts +18 -0
  206. package/dist/hosted-transport/index.d.ts.map +1 -0
  207. package/dist/hosted-transport/index.js +18 -0
  208. package/dist/hosted-transport/index.js.map +1 -0
  209. package/dist/hosted-transport/operations.d.ts +85 -0
  210. package/dist/hosted-transport/operations.d.ts.map +1 -0
  211. package/dist/hosted-transport/operations.js +128 -0
  212. package/dist/hosted-transport/operations.js.map +1 -0
  213. package/dist/hosted-transport/paged-reads.d.ts +87 -0
  214. package/dist/hosted-transport/paged-reads.d.ts.map +1 -0
  215. package/dist/hosted-transport/paged-reads.js +238 -0
  216. package/dist/hosted-transport/paged-reads.js.map +1 -0
  217. package/dist/hosted-transport/read-adapter.d.ts +256 -0
  218. package/dist/hosted-transport/read-adapter.d.ts.map +1 -0
  219. package/dist/hosted-transport/read-adapter.js +568 -0
  220. package/dist/hosted-transport/read-adapter.js.map +1 -0
  221. package/dist/hosted-transport/root-write.d.ts +114 -0
  222. package/dist/hosted-transport/root-write.d.ts.map +1 -0
  223. package/dist/hosted-transport/root-write.js +171 -0
  224. package/dist/hosted-transport/root-write.js.map +1 -0
  225. package/dist/hosted-transport/whole-document-transport.d.ts +204 -0
  226. package/dist/hosted-transport/whole-document-transport.d.ts.map +1 -0
  227. package/dist/hosted-transport/whole-document-transport.js +447 -0
  228. package/dist/hosted-transport/whole-document-transport.js.map +1 -0
  229. package/dist/index.d.ts +34 -10
  230. package/dist/index.d.ts.map +1 -1
  231. package/dist/index.js +26 -8
  232. package/dist/index.js.map +1 -1
  233. package/dist/indexeddb-backend.d.ts +28 -6
  234. package/dist/indexeddb-backend.d.ts.map +1 -1
  235. package/dist/indexeddb-backend.js +471 -92
  236. package/dist/indexeddb-backend.js.map +1 -1
  237. package/dist/journaled-backend.d.ts +247 -10
  238. package/dist/journaled-backend.d.ts.map +1 -1
  239. package/dist/journaled-backend.js +302 -1
  240. package/dist/journaled-backend.js.map +1 -1
  241. package/dist/kind-authoring.d.ts +170 -0
  242. package/dist/kind-authoring.d.ts.map +1 -0
  243. package/dist/kind-authoring.js +451 -0
  244. package/dist/kind-authoring.js.map +1 -0
  245. package/dist/kind-conformance-error.d.ts +15 -0
  246. package/dist/kind-conformance-error.d.ts.map +1 -0
  247. package/dist/kind-conformance-error.js +20 -0
  248. package/dist/kind-conformance-error.js.map +1 -0
  249. package/dist/kind-coverage.d.ts +99 -0
  250. package/dist/kind-coverage.d.ts.map +1 -0
  251. package/dist/kind-coverage.js +186 -0
  252. package/dist/kind-coverage.js.map +1 -0
  253. package/dist/kind-field-mutation.d.ts +4 -0
  254. package/dist/kind-field-mutation.d.ts.map +1 -1
  255. package/dist/kind-field-mutation.js +28 -3
  256. package/dist/kind-field-mutation.js.map +1 -1
  257. package/dist/kinds-load.js +4 -4
  258. package/dist/kinds-load.js.map +1 -1
  259. package/dist/kinds.d.ts +65 -2
  260. package/dist/kinds.d.ts.map +1 -1
  261. package/dist/kinds.js +341 -21
  262. package/dist/kinds.js.map +1 -1
  263. package/dist/link-types.d.ts +26 -0
  264. package/dist/link-types.d.ts.map +1 -0
  265. package/dist/link-types.js +57 -0
  266. package/dist/link-types.js.map +1 -0
  267. package/dist/links.d.ts +21 -3
  268. package/dist/links.d.ts.map +1 -1
  269. package/dist/links.js +213 -14
  270. package/dist/links.js.map +1 -1
  271. package/dist/managed-document-metadata.d.ts +2 -0
  272. package/dist/managed-document-metadata.d.ts.map +1 -0
  273. package/dist/managed-document-metadata.js +9 -0
  274. package/dist/managed-document-metadata.js.map +1 -0
  275. package/dist/memory-backend.d.ts +2 -2
  276. package/dist/memory-backend.d.ts.map +1 -1
  277. package/dist/memory-backend.js +26 -11
  278. package/dist/memory-backend.js.map +1 -1
  279. package/dist/paths.d.ts +16 -0
  280. package/dist/paths.d.ts.map +1 -1
  281. package/dist/paths.js +25 -0
  282. package/dist/paths.js.map +1 -1
  283. package/dist/platform.d.ts +13 -2
  284. package/dist/platform.d.ts.map +1 -1
  285. package/dist/platform.js +16 -0
  286. package/dist/platform.js.map +1 -1
  287. package/dist/portable-export.d.ts +119 -0
  288. package/dist/portable-export.d.ts.map +1 -0
  289. package/dist/portable-export.js +501 -0
  290. package/dist/portable-export.js.map +1 -0
  291. package/dist/publication-filesystem.d.ts +1 -1
  292. package/dist/publication-filesystem.d.ts.map +1 -1
  293. package/dist/publication-filesystem.js +1 -1
  294. package/dist/publication-filesystem.js.map +1 -1
  295. package/dist/qualified-links.d.ts +67 -0
  296. package/dist/qualified-links.d.ts.map +1 -0
  297. package/dist/qualified-links.js +117 -0
  298. package/dist/qualified-links.js.map +1 -0
  299. package/dist/query-filter.d.ts +16 -2
  300. package/dist/query-filter.d.ts.map +1 -1
  301. package/dist/query-filter.js +40 -1
  302. package/dist/query-filter.js.map +1 -1
  303. package/dist/query-order.d.ts +22 -0
  304. package/dist/query-order.d.ts.map +1 -0
  305. package/dist/query-order.js +42 -0
  306. package/dist/query-order.js.map +1 -0
  307. package/dist/recipe-lifecycle/errors.d.ts +94 -0
  308. package/dist/recipe-lifecycle/errors.d.ts.map +1 -0
  309. package/dist/recipe-lifecycle/errors.js +122 -0
  310. package/dist/recipe-lifecycle/errors.js.map +1 -0
  311. package/dist/recipe-lifecycle/evolution.d.ts +75 -0
  312. package/dist/recipe-lifecycle/evolution.d.ts.map +1 -0
  313. package/dist/recipe-lifecycle/evolution.js +789 -0
  314. package/dist/recipe-lifecycle/evolution.js.map +1 -0
  315. package/dist/recipe-lifecycle/index.d.ts +24 -0
  316. package/dist/recipe-lifecycle/index.d.ts.map +1 -0
  317. package/dist/recipe-lifecycle/index.js +20 -0
  318. package/dist/recipe-lifecycle/index.js.map +1 -0
  319. package/dist/recipe-lifecycle/install.d.ts +126 -0
  320. package/dist/recipe-lifecycle/install.d.ts.map +1 -0
  321. package/dist/recipe-lifecycle/install.js +511 -0
  322. package/dist/recipe-lifecycle/install.js.map +1 -0
  323. package/dist/recipe-lifecycle/legacy-aliases.d.ts +16 -0
  324. package/dist/recipe-lifecycle/legacy-aliases.d.ts.map +1 -0
  325. package/dist/recipe-lifecycle/legacy-aliases.js +51 -0
  326. package/dist/recipe-lifecycle/legacy-aliases.js.map +1 -0
  327. package/dist/recipe-lifecycle/stamp.d.ts +136 -0
  328. package/dist/recipe-lifecycle/stamp.d.ts.map +1 -0
  329. package/dist/recipe-lifecycle/stamp.js +326 -0
  330. package/dist/recipe-lifecycle/stamp.js.map +1 -0
  331. package/dist/recipes.d.ts +29 -1
  332. package/dist/recipes.d.ts.map +1 -1
  333. package/dist/recipes.js +137 -1
  334. package/dist/recipes.js.map +1 -1
  335. package/dist/record-overlay/apply.d.ts +43 -0
  336. package/dist/record-overlay/apply.d.ts.map +1 -0
  337. package/dist/record-overlay/apply.js +527 -0
  338. package/dist/record-overlay/apply.js.map +1 -0
  339. package/dist/record-overlay/canonical.d.ts +22 -0
  340. package/dist/record-overlay/canonical.d.ts.map +1 -0
  341. package/dist/record-overlay/canonical.js +47 -0
  342. package/dist/record-overlay/canonical.js.map +1 -0
  343. package/dist/record-overlay/digest.d.ts +4 -0
  344. package/dist/record-overlay/digest.d.ts.map +1 -0
  345. package/dist/record-overlay/digest.js +11 -0
  346. package/dist/record-overlay/digest.js.map +1 -0
  347. package/dist/record-overlay/errors.d.ts +44 -0
  348. package/dist/record-overlay/errors.d.ts.map +1 -0
  349. package/dist/record-overlay/errors.js +55 -0
  350. package/dist/record-overlay/errors.js.map +1 -0
  351. package/dist/record-overlay/findings.d.ts +5 -0
  352. package/dist/record-overlay/findings.d.ts.map +1 -0
  353. package/dist/record-overlay/findings.js +83 -0
  354. package/dist/record-overlay/findings.js.map +1 -0
  355. package/dist/record-overlay/index.d.ts +23 -0
  356. package/dist/record-overlay/index.d.ts.map +1 -0
  357. package/dist/record-overlay/index.js +21 -0
  358. package/dist/record-overlay/index.js.map +1 -0
  359. package/dist/record-overlay/plan.d.ts +12 -0
  360. package/dist/record-overlay/plan.d.ts.map +1 -0
  361. package/dist/record-overlay/plan.js +285 -0
  362. package/dist/record-overlay/plan.js.map +1 -0
  363. package/dist/record-overlay/policy.d.ts +69 -0
  364. package/dist/record-overlay/policy.d.ts.map +1 -0
  365. package/dist/record-overlay/policy.js +228 -0
  366. package/dist/record-overlay/policy.js.map +1 -0
  367. package/dist/record-overlay/redact.d.ts +3 -0
  368. package/dist/record-overlay/redact.d.ts.map +1 -0
  369. package/dist/record-overlay/redact.js +27 -0
  370. package/dist/record-overlay/redact.js.map +1 -0
  371. package/dist/record-overlay/signal-kind.d.ts +30 -0
  372. package/dist/record-overlay/signal-kind.d.ts.map +1 -0
  373. package/dist/record-overlay/signal-kind.js +38 -0
  374. package/dist/record-overlay/signal-kind.js.map +1 -0
  375. package/dist/record-overlay/signal-text.d.ts +45 -0
  376. package/dist/record-overlay/signal-text.d.ts.map +1 -0
  377. package/dist/record-overlay/signal-text.js +116 -0
  378. package/dist/record-overlay/signal-text.js.map +1 -0
  379. package/dist/record-overlay/source-index.d.ts +19 -0
  380. package/dist/record-overlay/source-index.d.ts.map +1 -0
  381. package/dist/record-overlay/source-index.js +102 -0
  382. package/dist/record-overlay/source-index.js.map +1 -0
  383. package/dist/record-overlay/types.d.ts +291 -0
  384. package/dist/record-overlay/types.d.ts.map +1 -0
  385. package/dist/record-overlay/types.js +2 -0
  386. package/dist/record-overlay/types.js.map +1 -0
  387. package/dist/remote-backend.d.ts +67 -67
  388. package/dist/remote-backend.d.ts.map +1 -1
  389. package/dist/remote-backend.js +169 -201
  390. package/dist/remote-backend.js.map +1 -1
  391. package/dist/remote-document-codec.d.ts +15 -0
  392. package/dist/remote-document-codec.d.ts.map +1 -0
  393. package/dist/remote-document-codec.js +103 -0
  394. package/dist/remote-document-codec.js.map +1 -0
  395. package/dist/remote-error.d.ts +38 -0
  396. package/dist/remote-error.d.ts.map +1 -0
  397. package/dist/remote-error.js +59 -0
  398. package/dist/remote-error.js.map +1 -0
  399. package/dist/remote-operations.d.ts +6 -3
  400. package/dist/remote-operations.d.ts.map +1 -1
  401. package/dist/remote-operations.js +23 -5
  402. package/dist/remote-operations.js.map +1 -1
  403. package/dist/remote-parsers.d.ts +86 -0
  404. package/dist/remote-parsers.d.ts.map +1 -0
  405. package/dist/remote-parsers.js +181 -0
  406. package/dist/remote-parsers.js.map +1 -0
  407. package/dist/remote.d.ts +5 -2
  408. package/dist/remote.d.ts.map +1 -1
  409. package/dist/remote.js +5 -1
  410. package/dist/remote.js.map +1 -1
  411. package/dist/search/backend-source.d.ts +6 -0
  412. package/dist/search/backend-source.d.ts.map +1 -0
  413. package/dist/search/backend-source.js +33 -0
  414. package/dist/search/backend-source.js.map +1 -0
  415. package/dist/search/contract.d.ts +151 -0
  416. package/dist/search/contract.d.ts.map +1 -0
  417. package/dist/search/contract.js +78 -0
  418. package/dist/search/contract.js.map +1 -0
  419. package/dist/search/errors.d.ts +30 -0
  420. package/dist/search/errors.d.ts.map +1 -0
  421. package/dist/search/errors.js +50 -0
  422. package/dist/search/errors.js.map +1 -0
  423. package/dist/search/identity.d.ts +12 -0
  424. package/dist/search/identity.d.ts.map +1 -0
  425. package/dist/search/identity.js +90 -0
  426. package/dist/search/identity.js.map +1 -0
  427. package/dist/search/index.d.ts +16 -0
  428. package/dist/search/index.d.ts.map +1 -0
  429. package/dist/search/index.js +15 -0
  430. package/dist/search/index.js.map +1 -0
  431. package/dist/search/memory-source.d.ts +36 -0
  432. package/dist/search/memory-source.d.ts.map +1 -0
  433. package/dist/search/memory-source.js +235 -0
  434. package/dist/search/memory-source.js.map +1 -0
  435. package/dist/search/rank.d.ts +34 -0
  436. package/dist/search/rank.d.ts.map +1 -0
  437. package/dist/search/rank.js +129 -0
  438. package/dist/search/rank.js.map +1 -0
  439. package/dist/search/row-text.d.ts +38 -0
  440. package/dist/search/row-text.d.ts.map +1 -0
  441. package/dist/search/row-text.js +88 -0
  442. package/dist/search/row-text.js.map +1 -0
  443. package/dist/search/search.d.ts +28 -0
  444. package/dist/search/search.d.ts.map +1 -0
  445. package/dist/search/search.js +257 -0
  446. package/dist/search/search.js.map +1 -0
  447. package/dist/search/source.d.ts +67 -0
  448. package/dist/search/source.d.ts.map +1 -0
  449. package/dist/search/source.js +2 -0
  450. package/dist/search/source.js.map +1 -0
  451. package/dist/search/text.d.ts +47 -0
  452. package/dist/search/text.d.ts.map +1 -0
  453. package/dist/search/text.js +148 -0
  454. package/dist/search/text.js.map +1 -0
  455. package/dist/site-capabilities.d.ts +339 -0
  456. package/dist/site-capabilities.d.ts.map +1 -0
  457. package/dist/site-capabilities.js +717 -0
  458. package/dist/site-capabilities.js.map +1 -0
  459. package/dist/source-engine/guard.d.ts +82 -0
  460. package/dist/source-engine/guard.d.ts.map +1 -0
  461. package/dist/source-engine/guard.js +396 -0
  462. package/dist/source-engine/guard.js.map +1 -0
  463. package/dist/source-engine/index.d.ts +24 -0
  464. package/dist/source-engine/index.d.ts.map +1 -0
  465. package/dist/source-engine/index.js +20 -0
  466. package/dist/source-engine/index.js.map +1 -0
  467. package/dist/source-engine/machine-state.d.ts +74 -0
  468. package/dist/source-engine/machine-state.d.ts.map +1 -0
  469. package/dist/source-engine/machine-state.js +48 -0
  470. package/dist/source-engine/machine-state.js.map +1 -0
  471. package/dist/source-engine/observe.d.ts +18 -0
  472. package/dist/source-engine/observe.d.ts.map +1 -0
  473. package/dist/source-engine/observe.js +598 -0
  474. package/dist/source-engine/observe.js.map +1 -0
  475. package/dist/source-engine/robots.d.ts +53 -0
  476. package/dist/source-engine/robots.d.ts.map +1 -0
  477. package/dist/source-engine/robots.js +158 -0
  478. package/dist/source-engine/robots.js.map +1 -0
  479. package/dist/source-engine/types.d.ts +285 -0
  480. package/dist/source-engine/types.d.ts.map +1 -0
  481. package/dist/source-engine/types.js +2 -0
  482. package/dist/source-engine/types.js.map +1 -0
  483. package/dist/source-harness/conformance.d.ts +16 -0
  484. package/dist/source-harness/conformance.d.ts.map +1 -0
  485. package/dist/source-harness/conformance.js +265 -0
  486. package/dist/source-harness/conformance.js.map +1 -0
  487. package/dist/source-harness/fixture.d.ts +95 -0
  488. package/dist/source-harness/fixture.d.ts.map +1 -0
  489. package/dist/source-harness/fixture.js +261 -0
  490. package/dist/source-harness/fixture.js.map +1 -0
  491. package/dist/source-harness/index.d.ts +22 -0
  492. package/dist/source-harness/index.d.ts.map +1 -0
  493. package/dist/source-harness/index.js +19 -0
  494. package/dist/source-harness/index.js.map +1 -0
  495. package/dist/source-harness/peer.d.ts +74 -0
  496. package/dist/source-harness/peer.d.ts.map +1 -0
  497. package/dist/source-harness/peer.js +106 -0
  498. package/dist/source-harness/peer.js.map +1 -0
  499. package/dist/storage.d.ts +6 -2
  500. package/dist/storage.d.ts.map +1 -1
  501. package/dist/storage.js +4 -1
  502. package/dist/storage.js.map +1 -1
  503. package/dist/types.d.ts +33 -5
  504. package/dist/types.d.ts.map +1 -1
  505. package/dist/uncertain-write.d.ts +156 -19
  506. package/dist/uncertain-write.d.ts.map +1 -1
  507. package/dist/uncertain-write.js +90 -31
  508. package/dist/uncertain-write.js.map +1 -1
  509. package/dist/versioning.d.ts +9 -4
  510. package/dist/versioning.d.ts.map +1 -1
  511. package/dist/versioning.js +9 -4
  512. package/dist/versioning.js.map +1 -1
  513. package/dist/write-identity.d.ts +5 -0
  514. package/dist/write-identity.d.ts.map +1 -0
  515. package/dist/write-identity.js +9 -0
  516. package/dist/write-identity.js.map +1 -0
  517. package/package.json +94 -2
package/dist/types.d.ts CHANGED
@@ -140,7 +140,8 @@ export interface ReadBlobResult {
140
140
  export interface VersionInfo {
141
141
  /** Opaque content-addressed version token for this revision. */
142
142
  version: Version;
143
- /** Who wrote this revision. Defaults to a local identity when the write was unattributed. */
143
+ /** Who wrote this revision. History-keeping backends default at write time to a local identity.
144
+ * FilesystemBackend reports `unattributed` when document bytes carry no mutation attribution. */
144
145
  actor: string;
145
146
  /** ISO-8601 instant this revision was recorded. */
146
147
  timestamp: string;
@@ -349,11 +350,16 @@ export interface StorageBackend {
349
350
  * a facet it chooses to honor. A backend that does not implement this method
350
351
  * (FilesystemBackend / MemoryBackend — both local to their data, where a head projection
351
352
  * saves nothing) is served by the engine's fallback (`list` +
352
- * `readMany`, bodies read then dropped), which additionally honors the scan's
353
- * malformed-doc resilience (`QueryOptions.onSkip`); the push-down path does not — a
354
- * malformed doc fails the server-side scan, exactly as the wire `list` always has.
353
+ * `readMany`, bodies read then dropped). Both paths honor the scan's malformed-doc
354
+ * resilience: given `onSkip`, a backend reports each document it could not parse there and
355
+ * leaves it out; without it, a malformed document fails the scan.
355
356
  */
356
- queryHeads?(filter?: QueryFilter): Promise<HeadResult[]>;
357
+ queryHeads?(filter?: QueryFilter, options?: {
358
+ onSkip?: (skip: {
359
+ id: ConceptId;
360
+ reason: string;
361
+ }) => void;
362
+ }): Promise<HeadResult[]>;
357
363
  /**
358
364
  * OPTIONAL capabilities self-declaration. `StorageBackend` carries
359
365
  * no capabilities descriptor by default, so a wire router that wants to report an adapter's
@@ -395,6 +401,23 @@ export interface QueryFilter {
395
401
  * (e.g. `tags: [a,b]`) matches on membership. A field the doc lacks never matches (empty set).
396
402
  */
397
403
  fields?: Record<string, string>;
404
+ /**
405
+ * Restrict to concepts whose `sources` list holds at least one entry carrying this identity
406
+ * (see {@link SourceIdentity}). A selector naming neither key imposes no constraint, like an
407
+ * empty `tags` list.
408
+ */
409
+ sources?: SourceIdentity;
410
+ }
411
+ /**
412
+ * An OKF `sources[]` identity: `resource` names the provider namespace and `id` the record within
413
+ * it. Each supplied key must equal the entry's own property of the same name by exact,
414
+ * case-sensitive string comparison: no trimming, URL normalization, or `String()` coercion. An
415
+ * entry that is not a mapping, or whose property is absent or not a string, never matches, and
416
+ * neither does a `sources` value that is not a list.
417
+ */
418
+ export interface SourceIdentity {
419
+ resource?: string;
420
+ id?: string;
398
421
  }
399
422
  /** A single resolved outbound cross-link (a standard markdown link, never a wikilink). */
400
423
  export interface Link {
@@ -406,6 +429,11 @@ export interface Link {
406
429
  text: string;
407
430
  /** The raw target as written in the markdown, before resolution (e.g. `/a/b.md`, `./x.md`). */
408
431
  href: string;
432
+ /**
433
+ * Set only on a cross-bundle edge (`okf://<alias>/<path>.md`): the declared alias of the bundle
434
+ * `to` lives in. Absent on every local link, so local edge output is unchanged.
435
+ */
436
+ bundle?: string;
409
437
  }
410
438
  /**
411
439
  * Filter for {@link queryEdges} — the whole-bundle derived edge list, filtered. `from`/`to` each
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,uJAAuJ;IACvJ,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iHAAiH;IACjH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,qFAAqF;AACrF,MAAM,WAAW,WAAW;IAC1B,qDAAqD;IACrD,EAAE,EAAE,SAAS,CAAC;IACd,+BAA+B;IA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AAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3D,+CAA+C;AAC/C,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iGAAiG;IACjG,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,mDAAmD;AACnD,MAAM,WAAW,eAAe;IAC9B,uFAAuF;IACvF,OAAO,EAAE,gBAAgB,CAAC;IAC1B,yGAAyG;IACzG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -16,8 +16,11 @@
16
16
  * injectable clock, and a transport's own latency is real.
17
17
  */
18
18
  import type { Version } from "./types.js";
19
- /** The operation an intent performs. Only document writes exist today; the union is open. */
20
- export type OperationKind = "document.write" | (string & {});
19
+ /**
20
+ * The operation an intent performs: a whole-document write, or `document.delete` (the document
21
+ * leaves at exactly the intent's base). The union is open.
22
+ */
23
+ export type OperationKind = "document.write" | "document.delete" | (string & {});
21
24
  /**
22
25
  * The journal states of an intent. `unknown` is the primitive's own classification of an
23
26
  * exhausted attempt: the authority may or may not hold the write, and a later attempt begins
@@ -31,6 +34,15 @@ export interface OperationIntent {
31
34
  kind: OperationKind;
32
35
  /** The target the operation applies to; a concept id for `document.write`. */
33
36
  target: string;
37
+ /**
38
+ * The tombstone a create acknowledges it re-creates: the id's latest deletion, as the
39
+ * authority named it. Set only by an explicit decision to re-create a deleted document (the
40
+ * caller's own observed delete, or `keep` on a "deleted remotely" conflict), and only on a
41
+ * create recorded after that decision; never inferred by a transport. An authority whose latest
42
+ * deletion of the id is another one refuses the create, and the refusal comes back as a
43
+ * conflict.
44
+ */
45
+ recreates?: Version;
34
46
  /** The shared version the local edit was made against, or `null` for a create. */
35
47
  base: Version | null;
36
48
  /** The content-addressed version of `content`. */
@@ -50,28 +62,115 @@ export interface OperationIntent {
50
62
  export type Outcome = {
51
63
  kind: "committed";
52
64
  version: Version;
53
- } | {
65
+ }
66
+ /**
67
+ * The shared head moved. `actual` is the version the authority serves now, or `null` when it
68
+ * serves none ("deleted remotely"). With `actual: null`, `tombstone` names the deletion the
69
+ * authority reported, when it reported one: the acknowledgement a deliberate re-create sends.
70
+ * It is never a version any read serves, so it is never a base or a remote version.
71
+ */
72
+ | {
54
73
  kind: "conflict";
55
74
  actual: Version | null;
56
- } | {
75
+ tombstone?: Version;
76
+ }
77
+ /**
78
+ * `executed` is present only on a refusal that is not the identity's recorded answer: `false`
79
+ * when this attempt was refused before it could execute (nothing was sent, or the authority
80
+ * refused it before dispatch), `"unknown"` when the authority's answer does not say. Such a
81
+ * refusal is evidence about this attempt only, never about an earlier delivery of the identity.
82
+ */
83
+ | {
57
84
  kind: "refused";
58
85
  code: string;
59
86
  message: string;
60
- } | {
87
+ executed?: false | "unknown";
88
+ }
89
+ /**
90
+ * `refusal` names the attempt-only refusal that ended the call, when one did: a resend refused
91
+ * before execution while an earlier delivery may still be held. The identity stays unknown;
92
+ * the refusal says why it could not be settled now (for example, access withdrawn).
93
+ */
94
+ | {
61
95
  kind: "unknown";
96
+ refusal?: {
97
+ code: string;
98
+ message: string;
99
+ };
62
100
  };
101
+ /**
102
+ * A lookup's answer that the authority holds the identity without a result yet: a delivery of
103
+ * it was admitted and may still commit. Distinct from `null`, which says it was never admitted.
104
+ */
105
+ export interface LookupPending {
106
+ kind: "pending";
107
+ }
108
+ /** The one {@link LookupPending} answer. */
109
+ export declare const LOOKUP_PENDING: LookupPending;
63
110
  /** A transport to a shared authority that records outcomes by request identity. */
64
111
  export interface OperationTransport {
65
112
  /** Deliver the intent once; a repeated `requestId` must return the recorded outcome unchanged. */
66
113
  submit(intent: OperationIntent, options?: {
67
114
  signal?: AbortSignal;
68
115
  }): Promise<Outcome>;
69
- /** The recorded outcome for `requestId`, or `null` when the authority never recorded it. */
70
- lookup(requestId: string): Promise<Outcome | null>;
116
+ /**
117
+ * The recorded outcome for `requestId`; {@link LookupPending} when the authority holds it
118
+ * unanswered; or `null` when the authority never recorded it. A transport that cannot tell
119
+ * pending from absent answers `null` for both.
120
+ */
121
+ lookup(requestId: string): Promise<Outcome | LookupPending | null>;
122
+ }
123
+ /** Minimal classification for recorded-only delivery. A commit need not invent a new-head
124
+ * version (for example, an identified blob delete can carry its complete absence receipt). */
125
+ export interface NonExecutedAttempt {
126
+ kind: "not-executed";
127
+ attempts: number;
128
+ details: unknown;
129
+ }
130
+ export type RecordedWriteOutcome = NonExecutedAttempt | {
131
+ kind: "committed";
132
+ } | {
133
+ kind: "conflict";
134
+ } | {
135
+ kind: "refused";
136
+ code: string;
137
+ message: string;
138
+ } | {
139
+ kind: "unknown";
140
+ };
141
+ export type RecordedWriteIntent = Pick<OperationIntent, "requestId" | "kind" | "target" | "createdAt" | "attempts" | "state"> & {
142
+ /** Opt-in qualification; old no-prefix explicit callers retain their contract. */
143
+ notAppliedThrough?: number;
144
+ };
145
+ export interface RecordedWriteTransport<I extends RecordedWriteIntent, O extends RecordedWriteOutcome> {
146
+ submit(intent: I, options?: {
147
+ signal?: AbortSignal;
148
+ }): Promise<O>;
149
+ /** Null/absence is inconclusive and NEVER grants this path permission to submit. */
150
+ lookup(requestId: string): Promise<O | null>;
151
+ }
152
+ /** Explicit starts are for callers that own persistence, not proof minted by this primitive.
153
+ * submit-claimed requires a freshly successful durable in_flight CAS, held under the checkout
154
+ * lock, immediately before this call; its counted attempt is sent at most once. After reopening,
155
+ * or when that freshness cannot be established, use lookup. Replaying a stored claim is NOT a
156
+ * fresh CAS. Nor does a new CAS prove an earlier unclear delivery cannot still commit: those
157
+ * identities must use lookup. This function creates no ticket or journal persistence itself. */
158
+ export type RecordedWriteOptions = Omit<UncertainWriteOptions, "settlement" | "maxSubmissions" | "earlierDeliveryUnclear"> & {
159
+ settlement: "recorded-only";
160
+ start: "submit-claimed" | "lookup";
161
+ };
162
+ export interface RecordedWriteResult<I extends RecordedWriteIntent, O extends RecordedWriteOutcome> {
163
+ intent: Omit<I, "attempts" | "state"> & Pick<RecordedWriteIntent, "attempts" | "state">;
164
+ outcome: O | {
165
+ kind: "unknown";
166
+ };
167
+ lookups: number;
71
168
  }
72
169
  /** Wait `ms`, resolving early and harmlessly when `signal` aborts. Injected by tests. */
73
170
  export type Sleep = (ms: number, signal?: AbortSignal) => Promise<void>;
74
171
  export interface UncertainWriteOptions {
172
+ /** Exact-content writes may settle matching conflicts; governed writes require recorded evidence. */
173
+ settlement?: "exact-content" | "recorded-only";
75
174
  /** How long one submission may take before its outcome is treated as unknown. */
76
175
  deadlineMs?: number;
77
176
  /** Lookups attempted after an unknown submission before giving up (default 3). */
@@ -82,6 +181,20 @@ export interface UncertainWriteOptions {
82
181
  maxSubmissions?: number;
83
182
  /** Timer; defaults to a `setTimeout` sleep. */
84
183
  sleep?: Sleep;
184
+ /**
185
+ * Ends the call early once aborted: no further lookup or resubmission starts, the wait between
186
+ * lookups is cut short, and the outcome is `unknown` unless one was already known. Absent, the
187
+ * call runs every lookup and submission it is permitted.
188
+ */
189
+ signal?: AbortSignal;
190
+ /**
191
+ * The intent's earlier submission, made by an earlier call, ended without a definitive answer
192
+ * (its outcome was unknown, or the call stopped while it was in flight). A resubmission refused
193
+ * before execution is then `unknown`, as one after an unclear submission in this call is.
194
+ * Default false: an earlier submission answered with such a refusal (a paused intent requeued)
195
+ * may be resent and refused again definitively.
196
+ */
197
+ earlierDeliveryUnclear?: boolean;
85
198
  }
86
199
  export interface UncertainWriteResult {
87
200
  /** The intent with `attempts` and `state` advanced to reflect this call. */
@@ -90,12 +203,16 @@ export interface UncertainWriteResult {
90
203
  /** How many times `lookup` was called in this call. */
91
204
  lookups: number;
92
205
  }
93
- /** Refusal codes that mean the caller's authorization is gone rather than the content wrong. */
206
+ /**
207
+ * Refusal codes that pause shared operations rather than say the content is wrong: the caller's
208
+ * authorization is gone, or a hosted sync quota (`REQUEST_CAPACITY_*`, one per scope the host
209
+ * names) is spent. Nothing is lost; the refused intents are requeued when the store resumes.
210
+ */
94
211
  export declare const AUTHORIZATION_REFUSAL_CODES: ReadonlySet<string>;
95
212
  /** True when a refusal reports lost permission, which pauses further shared operations. */
96
- export declare function isAuthorizationRefusal(outcome: Outcome): boolean;
213
+ export declare function isAuthorizationRefusal(outcome: Outcome | RecordedWriteOutcome): boolean;
97
214
  /** The journal state an outcome settles an intent into. */
98
- export declare function stateForOutcome(outcome: Outcome): OperationState;
215
+ export declare function stateForOutcome(outcome: Outcome | RecordedWriteOutcome): OperationState;
99
216
  /** The longest request identity the wire accepts as `Idempotency-Key`. */
100
217
  export declare const REQUEST_ID_MAX_LENGTH = 128;
101
218
  /**
@@ -114,10 +231,12 @@ export declare function mintRequestId(): string;
114
231
  * at that version. This is the wire's post-expiry compare-and-swap property: a committed write
115
232
  * whose acknowledgement was lost and whose recorded outcome expired from the authority's
116
233
  * retention window is resubmitted with its original `base`, which no longer matches, and the
117
- * authority answers a conflict against the version the client itself committed. The mapping
118
- * depends only on the outcome and the intent, so the primitive owns it and every consumer
119
- * settles such a write as acknowledged rather than presenting it as a concurrent edit. Every
120
- * other conflict, including one against an absent head (`actual: null`), is returned unchanged.
234
+ * authority answers a conflict against the version the client itself committed. If the head
235
+ * has meanwhile returned to `base` exactly, the premise matches and the resubmission is applied
236
+ * again instead (see {@link performUncertainWrite}). The mapping depends only on the outcome and
237
+ * the intent, so the primitive owns it and every consumer settles such a write as acknowledged
238
+ * rather than presenting it as a concurrent edit. Every other conflict, including one against
239
+ * an absent head (`actual: null`), is returned unchanged.
121
240
  */
122
241
  export declare function settleAgainstIntent(outcome: Outcome, intent: OperationIntent): Outcome;
123
242
  /**
@@ -125,9 +244,9 @@ export declare function settleAgainstIntent(outcome: Outcome, intent: OperationI
125
244
  *
126
245
  * Flow: when the intent has never been submitted, submit it; when it has (`attempts > 0`), or
127
246
  * when a submission's outcome is unknown, look the request identity up. A positive lookup
128
- * settles the intent. A `null` lookup proves the authority never recorded the request, so a
129
- * resubmission with the same `requestId` is the first delivery and is allowed, up to
130
- * `maxSubmissions`. A lookup that fails leaves the outcome unknown and the intent for a later
247
+ * settles the intent. A `null` lookup is taken as proof that the authority never recorded the
248
+ * request, so a resubmission with the same `requestId` is the first delivery and is allowed, up
249
+ * to `maxSubmissions`. A lookup that fails leaves the outcome unknown and the intent for a later
131
250
  * call.
132
251
  *
133
252
  * No resubmission happens without a `null` lookup because a blind retry after an unknown
@@ -135,8 +254,26 @@ export declare function settleAgainstIntent(outcome: Outcome, intent: OperationI
135
254
  * twice, and even on one with it the retry can only ever learn what the lookup already knew.
136
255
  * The lookup is what turns "unknown" into a fact before any second delivery.
137
256
  *
138
- * Every outcome passes through {@link settleAgainstIntent} before it is returned, so a conflict
139
- * that names the intent's own version is reported as committed at that version.
257
+ * That fact is only as good as the transport's `null`. An authority that has expired or lost a
258
+ * record answers as if it never recorded it, and the reference wire transport returns `null`
259
+ * then. The resubmission is guarded only by its `base`, and versions are content hashes: if the
260
+ * write had landed and a third party has since restored `base` exactly, the premise matches, the
261
+ * write is applied a second time over that revert, and the outcome is `committed`. The hosted
262
+ * transport never answers `null` for an absent record once the intent is older than the host's
263
+ * stated retention window, less a skew margin, so it does not resubmit there.
264
+ *
265
+ * A refusal before execution ({@link isAuthorizationRefusal}) of a resubmission that follows an
266
+ * unclear submission (in this call, or an earlier one per `earlierDeliveryUnclear`) is `unknown`,
267
+ * carrying that refusal, not settled: a `null` lookup cannot prove an earlier delivery will not
268
+ * still arrive, and the delivery can still commit. After a {@link LookupPending} answer, which
269
+ * says a delivery is held, the same holds for every refusal the transport marks `executed`
270
+ * (a gateway's `400` included). A pending lookup still permits the resubmission.
271
+ *
272
+ * By default every outcome passes through {@link settleAgainstIntent}, so a conflict naming the
273
+ * intent's own version is committed. `recorded-only` preserves the recorded outcome instead.
140
274
  */
275
+ export declare function performUncertainWrite<I extends RecordedWriteIntent, O extends RecordedWriteOutcome>(transport: RecordedWriteTransport<I, O>, intent: I, options: RecordedWriteOptions): Promise<RecordedWriteResult<I, O>>;
276
+ /** Compatibility path: a complete document intent, with the existing counters/resubmission
277
+ * defaults. Body delivery's recorded-only call without start remains on this path. */
141
278
  export declare function performUncertainWrite(transport: OperationTransport, intent: OperationIntent, options?: UncertainWriteOptions): Promise<UncertainWriteResult>;
142
279
  //# sourceMappingURL=uncertain-write.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uncertain-write.d.ts","sourceRoot":"","sources":["../src/uncertain-write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,6FAA6F;AAC7F,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAE7D;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAE3G,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,4FAA4F;IAC5F,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC;IACpB,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IACrB,kDAAkD;IAClD,KAAK,EAAE,OAAO,CAAC;IACf,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,cAAc,CAAC;CACvB;AAED,uDAAuD;AACvD,MAAM,MAAM,OAAO,GACf;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GACvC;IA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c,CAavF;AAED,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGxD;AAED,mGAAmG;AACnG,wBAAgB,aAAa,IAAI,MAAM,CAItC;AAqBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAKtF;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,mBAAmB,EAAE,CAAC,SAAS,oBAAoB,EACjG,SAAS,EAAE,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,oBAAoB,GAChF,OAAO,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACtC;sFACsF;AACtF,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,kBAAkB,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,qBAAqB,GACtF,OAAO,CAAC,oBAAoB,CAAC,CAAC"}
@@ -15,12 +15,36 @@
15
15
  * `sleep` used for the submission deadline and the delay between lookups; there is no
16
16
  * injectable clock, and a transport's own latency is real.
17
17
  */
18
- /** Refusal codes that mean the caller's authorization is gone rather than the content wrong. */
19
- export const AUTHORIZATION_REFUSAL_CODES = new Set(["AUTH_REQUIRED", "FORBIDDEN", "UNAUTHORIZED", "PERMISSION_DENIED"]);
18
+ /** The one {@link LookupPending} answer. */
19
+ export const LOOKUP_PENDING = Object.freeze({ kind: "pending" });
20
+ /**
21
+ * Refusal codes that pause shared operations rather than say the content is wrong: the caller's
22
+ * authorization is gone, or a hosted sync quota (`REQUEST_CAPACITY_*`, one per scope the host
23
+ * names) is spent. Nothing is lost; the refused intents are requeued when the store resumes.
24
+ */
25
+ export const AUTHORIZATION_REFUSAL_CODES = new Set([
26
+ "AUTH_REQUIRED",
27
+ "FORBIDDEN",
28
+ "UNAUTHORIZED",
29
+ "PERMISSION_DENIED",
30
+ "REQUEST_CAPACITY_PRINCIPAL",
31
+ "REQUEST_CAPACITY_BUNDLE",
32
+ ]);
20
33
  /** True when a refusal reports lost permission, which pauses further shared operations. */
21
34
  export function isAuthorizationRefusal(outcome) {
22
35
  return outcome.kind === "refused" && AUTHORIZATION_REFUSAL_CODES.has(outcome.code);
23
36
  }
37
+ /**
38
+ * True when a resend's refusal cannot settle an identity whose earlier delivery is unclear. An
39
+ * authorization refusal never can: access lost now says nothing about a delivery authorized
40
+ * earlier. Once a lookup answered {@link LookupPending}, an earlier delivery is known to be held,
41
+ * so no refusal the transport marks as attempt-only (`executed`) can either. Without that
42
+ * answer, a marked refusal of the same bytes (a schema `400`, the mass-delete hold) settles, as
43
+ * it would refuse a delayed first delivery too.
44
+ */
45
+ function refusalLeavesUnknown(outcome, held) {
46
+ return outcome.kind === "refused" && (isAuthorizationRefusal(outcome) || (held && outcome.executed !== undefined));
47
+ }
24
48
  /** The journal state an outcome settles an intent into. */
25
49
  export function stateForOutcome(outcome) {
26
50
  switch (outcome.kind) {
@@ -30,6 +54,8 @@ export function stateForOutcome(outcome) {
30
54
  return "conflict";
31
55
  case "refused":
32
56
  return "refused";
57
+ case "not-executed":
58
+ return "pending";
33
59
  case "unknown":
34
60
  return "unknown";
35
61
  }
@@ -77,10 +103,12 @@ const UNKNOWN = { kind: "unknown" };
77
103
  * at that version. This is the wire's post-expiry compare-and-swap property: a committed write
78
104
  * whose acknowledgement was lost and whose recorded outcome expired from the authority's
79
105
  * retention window is resubmitted with its original `base`, which no longer matches, and the
80
- * authority answers a conflict against the version the client itself committed. The mapping
81
- * depends only on the outcome and the intent, so the primitive owns it and every consumer
82
- * settles such a write as acknowledged rather than presenting it as a concurrent edit. Every
83
- * other conflict, including one against an absent head (`actual: null`), is returned unchanged.
106
+ * authority answers a conflict against the version the client itself committed. If the head
107
+ * has meanwhile returned to `base` exactly, the premise matches and the resubmission is applied
108
+ * again instead (see {@link performUncertainWrite}). The mapping depends only on the outcome and
109
+ * the intent, so the primitive owns it and every consumer settles such a write as acknowledged
110
+ * rather than presenting it as a concurrent edit. Every other conflict, including one against
111
+ * an absent head (`actual: null`), is returned unchanged.
84
112
  */
85
113
  export function settleAgainstIntent(outcome, intent) {
86
114
  if (outcome.kind === "conflict" && outcome.actual !== null && outcome.actual === intent.local) {
@@ -107,53 +135,76 @@ async function submitOnce(transport, intent, deadlineMs, sleep) {
107
135
  controller.abort();
108
136
  return UNKNOWN;
109
137
  }
110
- /**
111
- * Deliver `intent` and settle it against the authority's recorded outcome.
112
- *
113
- * Flow: when the intent has never been submitted, submit it; when it has (`attempts > 0`), or
114
- * when a submission's outcome is unknown, look the request identity up. A positive lookup
115
- * settles the intent. A `null` lookup proves the authority never recorded the request, so a
116
- * resubmission with the same `requestId` is the first delivery and is allowed, up to
117
- * `maxSubmissions`. A lookup that fails leaves the outcome unknown and the intent for a later
118
- * call.
119
- *
120
- * No resubmission happens without a `null` lookup because a blind retry after an unknown
121
- * outcome is unsound: on an authority without request identity the retry applies the write
122
- * twice, and even on one with it the retry can only ever learn what the lookup already knew.
123
- * The lookup is what turns "unknown" into a fact before any second delivery.
124
- *
125
- * Every outcome passes through {@link settleAgainstIntent} before it is returned, so a conflict
126
- * that names the intent's own version is reported as committed at that version.
127
- */
128
138
  export async function performUncertainWrite(transport, intent, options = {}) {
139
+ const explicitStart = "start" in options;
140
+ if (explicitStart) {
141
+ if (options.settlement !== "recorded-only" || (options.start !== "submit-claimed" && options.start !== "lookup") ||
142
+ !Number.isSafeInteger(intent.attempts) || intent.attempts < 0 ||
143
+ !["pending", "in_flight", "acknowledged", "conflict", "refused", "unknown"].includes(intent.state) ||
144
+ (options.start === "submit-claimed" && (intent.state !== "in_flight" || intent.attempts < 1)))
145
+ throw new Error("Invalid recorded-only delivery start or durable claim.");
146
+ if (intent.notAppliedThrough !== undefined && (!Number.isSafeInteger(intent.notAppliedThrough) || intent.notAppliedThrough < 0 || intent.notAppliedThrough > intent.attempts || options.start === "submit-claimed" && intent.notAppliedThrough !== intent.attempts - 1))
147
+ throw new Error("Invalid recorded-only non-execution prefix or durable claim.");
148
+ // Capture the descriptor before the first asynchronous boundary. Additional prepared data
149
+ // belongs to the typed caller; the primitive neither fabricates nor interprets its fields.
150
+ intent = { ...intent };
151
+ options = { ...options };
152
+ }
153
+ if (options.settlement !== undefined && options.settlement !== "exact-content" && options.settlement !== "recorded-only") {
154
+ throw new Error("Unknown uncertain-write settlement mode.");
155
+ }
129
156
  const sleep = options.sleep ?? defaultSleep;
130
157
  const maxLookups = Math.max(1, options.maxLookups ?? 3);
131
- const maxSubmissions = Math.max(1, options.maxSubmissions ?? 2);
158
+ const maxSubmissions = explicitStart ? 1 : Math.max(1, options.maxSubmissions ?? 2);
132
159
  const lookupDelayMs = options.lookupDelayMs ?? 250;
160
+ const { signal } = options;
161
+ // Whether a submission of this identity may still be held by the authority unanswered.
162
+ let unclear = options.earlierDeliveryUnclear === true && intent.attempts > 0;
163
+ // Whether any lookup in this call answered pending: a delivery of this identity was held, so
164
+ // a later absent answer in the same call does not undo it.
165
+ let held = false;
133
166
  let attempts = intent.attempts;
134
167
  let submissions = 0;
135
168
  let lookups = 0;
136
169
  const finish = (raw) => {
137
- const outcome = settleAgainstIntent(raw, intent);
170
+ // Only the compatibility overload admits exact-content settlement and it requires the
171
+ // original full OperationIntent/Outcome contract. Explicit starts never use those fields.
172
+ const outcome = options.settlement === "recorded-only" ? raw : settleAgainstIntent(raw, intent);
138
173
  return { intent: { ...intent, attempts, state: stateForOutcome(outcome) }, outcome, lookups };
139
174
  };
140
175
  // A previously submitted intent starts at the lookup, never at a submission.
141
- let needSubmission = attempts === 0;
176
+ let needSubmission = explicitStart ? options.start === "submit-claimed" : attempts === 0;
142
177
  for (;;) {
143
178
  if (needSubmission) {
144
- if (submissions >= maxSubmissions)
179
+ if (submissions >= maxSubmissions || ((explicitStart || submissions > 0) && signal?.aborted))
145
180
  return finish(UNKNOWN);
146
181
  submissions += 1;
147
- attempts += 1;
182
+ if (!explicitStart)
183
+ attempts += 1;
148
184
  const outcome = await submitOnce(transport, { ...intent, attempts, state: "in_flight" }, options.deadlineMs, sleep);
185
+ if (outcome.kind === "not-executed") {
186
+ if (!explicitStart || intent.notAppliedThrough === undefined || intent.notAppliedThrough !== attempts - 1 || outcome.attempts !== attempts || signal?.aborted)
187
+ return finish(UNKNOWN);
188
+ return finish(outcome);
189
+ }
190
+ // A resend refused before it reached execution (no credential, access withdrawn, a spent
191
+ // quota, a gateway's schema check) is evidence about that resend only: an earlier, unclear delivery may still be held
192
+ // by the authority and commit, so the identity stays unknown and the intent is kept.
193
+ if (unclear && refusalLeavesUnknown(outcome, held))
194
+ return finish(explicitStart ? UNKNOWN : { kind: "unknown", refusal: { code: outcome.code, message: outcome.message } });
149
195
  if (outcome.kind !== "unknown")
150
196
  return finish(outcome);
197
+ unclear = true;
151
198
  }
152
199
  needSubmission = false;
153
200
  let recorded;
154
201
  for (let round = 0; round < maxLookups; round++) {
202
+ if (signal?.aborted)
203
+ break;
155
204
  if (round > 0)
156
- await sleep(lookupDelayMs);
205
+ await sleep(lookupDelayMs, signal);
206
+ if (signal?.aborted)
207
+ break;
157
208
  lookups += 1;
158
209
  try {
159
210
  recorded = await transport.lookup(intent.requestId);
@@ -166,8 +217,16 @@ export async function performUncertainWrite(transport, intent, options = {}) {
166
217
  }
167
218
  if (recorded === undefined)
168
219
  return finish(UNKNOWN);
220
+ if (recorded !== null && recorded.kind === "pending") {
221
+ // Held unanswered: a delivery of this identity was admitted and may still commit.
222
+ unclear = true;
223
+ held = true;
224
+ recorded = null;
225
+ }
169
226
  if (recorded !== null)
170
- return finish(recorded);
227
+ return finish(recorded.kind === "not-executed" ? UNKNOWN : recorded);
228
+ if (explicitStart)
229
+ return finish(UNKNOWN);
171
230
  needSubmission = true;
172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X,CAAC;YACD,MAAM;QACR,CAAC;QACD,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACrD,kFAAkF;YAClF,OAAO,GAAG,IAAI,CAAC;YACf,IAAI,GAAG,IAAI,CAAC;YACZ,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC;QACD,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAC5F,IAAI,aAAa;YAAE,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1C,cAAc,GAAG,IAAI,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -4,10 +4,15 @@
4
4
  * These make the seam's "hardest case" (content-addressed versions, compare-and-swap
5
5
  * writes, actor attribution) implementable uniformly across adapters:
6
6
  * - {@link contentVersion} defines the opaque {@link Version} token as a SHA-256 over
7
- * the canonically serialized document, so identical content yields the same token
8
- * REGARDLESS of backend. The filesystem adapter hashes the on-disk bytes; the
9
- * in-memory adapter hashes the same serialization — an engine-written document
10
- * therefore carries the same version token in either store.
7
+ * the canonically serialized document. A version token is a property of a backend,
8
+ * not of the content: the filesystem adapter hashes the on-disk bytes exactly as
9
+ * written, so a hand-authored file keeps its bytes and its token; the in-memory and
10
+ * wire adapters hash a re-serialization, which folds long strings, expands flow
11
+ * sequences and normalizes timestamps, so content Superbee did not author may carry a
12
+ * different token there. An engine-written document carries the same token in either
13
+ * store, because the engine wrote the canonical bytes. Bytes are the promise that
14
+ * travels between backends (decision of 2026-09-17, "bytes win"); no promise rests on
15
+ * cross-backend token equality.
11
16
  * - {@link blobVersion} is the SAME idea for opaque blob bytes, but hashes the raw
12
17
  * `Uint8Array` directly with no string/UTF-8 step — a doc-shaped hash would corrupt
13
18
  * binary content, so blobs get their own primitive rather than reusing `contentVersion`
@@ -1 +1 @@
1
- {"version":3,"file":"versioning.d.ts","sourceRoot":"","sources":["../src/versioning.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE7F,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAExD;AAED,gGAAgG;AAChG,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAGrC"}
1
+ {"version":3,"file":"versioning.d.ts","sourceRoot":"","sources":["../src/versioning.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE7F,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAExD;AAED,gGAAgG;AAChG,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAGrC"}