@amalgm/shell 0.1.164-preview.36072132286 → 0.1.164-preview.36809057014

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 (475) hide show
  1. package/PURPOSE.md +642 -128
  2. package/README.md +10 -8
  3. package/dist/accepted-tail.d.ts +26 -0
  4. package/dist/accepted-tail.js +37 -0
  5. package/dist/accepted-tail.js.map +1 -0
  6. package/dist/agent-execution.d.ts +16 -1
  7. package/dist/agent-execution.js +13 -5
  8. package/dist/agent-execution.js.map +1 -1
  9. package/dist/apply-cleanup.d.ts +28 -0
  10. package/dist/apply-cleanup.js +166 -0
  11. package/dist/apply-cleanup.js.map +1 -0
  12. package/dist/apply-recovery.d.ts +47 -0
  13. package/dist/apply-recovery.js +99 -0
  14. package/dist/apply-recovery.js.map +1 -0
  15. package/dist/apply-rows.d.ts +72 -0
  16. package/dist/apply-rows.js +150 -0
  17. package/dist/apply-rows.js.map +1 -0
  18. package/dist/apply-saves.d.ts +85 -0
  19. package/dist/apply-saves.js +238 -0
  20. package/dist/apply-saves.js.map +1 -0
  21. package/dist/boot.js +2 -1
  22. package/dist/boot.js.map +1 -1
  23. package/dist/capture-work.d.ts +8 -0
  24. package/dist/capture-work.js +67 -0
  25. package/dist/capture-work.js.map +1 -0
  26. package/dist/cargo-group.d.ts +45 -0
  27. package/dist/cargo-group.js +88 -0
  28. package/dist/cargo-group.js.map +1 -0
  29. package/dist/channel-session.d.ts +4 -2
  30. package/dist/channel-session.js +4 -3
  31. package/dist/channel-session.js.map +1 -1
  32. package/dist/chat-composition.d.ts +2 -0
  33. package/dist/chat-composition.js +1 -0
  34. package/dist/chat-composition.js.map +1 -1
  35. package/dist/cli.js +20 -1
  36. package/dist/cli.js.map +1 -1
  37. package/dist/construct-apply-host.d.ts +4 -2
  38. package/dist/construct-apply-host.js +8 -3
  39. package/dist/construct-apply-host.js.map +1 -1
  40. package/dist/construct-door.js +1 -1
  41. package/dist/construct-door.js.map +1 -1
  42. package/dist/construct-ledger.d.ts +6 -1
  43. package/dist/construct-ledger.js +21 -33
  44. package/dist/construct-ledger.js.map +1 -1
  45. package/dist/content-cache-collection.d.ts +18 -0
  46. package/dist/content-cache-collection.js +99 -0
  47. package/dist/content-cache-collection.js.map +1 -0
  48. package/dist/content-cache-host.d.ts +83 -17
  49. package/dist/content-cache-host.js +335 -95
  50. package/dist/content-cache-host.js.map +1 -1
  51. package/dist/content-cache-namespace.d.ts +59 -0
  52. package/dist/content-cache-namespace.js +210 -0
  53. package/dist/content-cache-namespace.js.map +1 -0
  54. package/dist/content-cache-ownership.d.ts +13 -0
  55. package/dist/content-cache-ownership.js +75 -0
  56. package/dist/content-cache-ownership.js.map +1 -0
  57. package/dist/content-cache-retention.d.ts +23 -0
  58. package/dist/content-cache-retention.js +195 -0
  59. package/dist/content-cache-retention.js.map +1 -0
  60. package/dist/content-capture-pool.d.ts +287 -0
  61. package/dist/content-capture-pool.js +461 -0
  62. package/dist/content-capture-pool.js.map +1 -0
  63. package/dist/content-capture-worker.d.ts +8 -0
  64. package/dist/content-capture-worker.js +109 -0
  65. package/dist/content-capture-worker.js.map +1 -0
  66. package/dist/content-clock.d.ts +42 -0
  67. package/dist/content-clock.js +166 -0
  68. package/dist/content-clock.js.map +1 -0
  69. package/dist/content-direct.d.ts +2 -0
  70. package/dist/content-direct.js +12 -0
  71. package/dist/content-direct.js.map +1 -1
  72. package/dist/content-failure.d.ts +18 -0
  73. package/dist/content-failure.js +38 -0
  74. package/dist/content-failure.js.map +1 -0
  75. package/dist/content-stream-thread.d.ts +60 -0
  76. package/dist/content-stream-thread.js +95 -0
  77. package/dist/content-stream-thread.js.map +1 -0
  78. package/dist/content-stream-worker.d.ts +7 -0
  79. package/dist/content-stream-worker.js +52 -0
  80. package/dist/content-stream-worker.js.map +1 -0
  81. package/dist/declaration-absorption.d.ts +37 -0
  82. package/dist/declaration-absorption.js +119 -0
  83. package/dist/declaration-absorption.js.map +1 -0
  84. package/dist/declaration-chain.d.ts +36 -0
  85. package/dist/declaration-chain.js +96 -0
  86. package/dist/declaration-chain.js.map +1 -0
  87. package/dist/declaration-commit.d.ts +31 -0
  88. package/dist/declaration-commit.js +49 -0
  89. package/dist/declaration-commit.js.map +1 -0
  90. package/dist/declaration-hold.d.ts +22 -0
  91. package/dist/declaration-hold.js +24 -0
  92. package/dist/declaration-hold.js.map +1 -0
  93. package/dist/declaration-journal.d.ts +62 -0
  94. package/dist/declaration-journal.js +99 -0
  95. package/dist/declaration-journal.js.map +1 -0
  96. package/dist/declaration-save.d.ts +31 -0
  97. package/dist/declaration-save.js +134 -0
  98. package/dist/declaration-save.js.map +1 -0
  99. package/dist/detection/accepted-result.d.ts +19 -1
  100. package/dist/detection/accepted-result.js +36 -5
  101. package/dist/detection/accepted-result.js.map +1 -1
  102. package/dist/detection/admission-save.d.ts +55 -0
  103. package/dist/detection/admission-save.js +48 -0
  104. package/dist/detection/admission-save.js.map +1 -0
  105. package/dist/detection/admission-units.d.ts +66 -0
  106. package/dist/detection/admission-units.js +322 -0
  107. package/dist/detection/admission-units.js.map +1 -0
  108. package/dist/detection/alias-discovery.d.ts +12 -0
  109. package/dist/detection/alias-discovery.js +80 -0
  110. package/dist/detection/alias-discovery.js.map +1 -0
  111. package/dist/detection/alias-examination.d.ts +30 -0
  112. package/dist/detection/alias-examination.js +49 -0
  113. package/dist/detection/alias-examination.js.map +1 -0
  114. package/dist/detection/apply-ownership.d.ts +81 -0
  115. package/dist/detection/apply-ownership.js +232 -0
  116. package/dist/detection/apply-ownership.js.map +1 -0
  117. package/dist/detection/basis-advanced.d.ts +11 -0
  118. package/dist/detection/basis-advanced.js +26 -0
  119. package/dist/detection/basis-advanced.js.map +1 -0
  120. package/dist/detection/capture-outcome.d.ts +16 -0
  121. package/dist/detection/capture-outcome.js +92 -0
  122. package/dist/detection/capture-outcome.js.map +1 -0
  123. package/dist/detection/container-membership.d.ts +32 -0
  124. package/dist/detection/container-membership.js +49 -0
  125. package/dist/detection/container-membership.js.map +1 -0
  126. package/dist/detection/detect-cancelled.d.ts +6 -0
  127. package/dist/detection/detect-cancelled.js +10 -0
  128. package/dist/detection/detect-cancelled.js.map +1 -0
  129. package/dist/detection/directory-proof.d.ts +47 -0
  130. package/dist/detection/directory-proof.js +77 -0
  131. package/dist/detection/directory-proof.js.map +1 -0
  132. package/dist/detection/disposition-rows.d.ts +18 -0
  133. package/dist/detection/disposition-rows.js +29 -0
  134. package/dist/detection/disposition-rows.js.map +1 -0
  135. package/dist/detection/dispositions.d.ts +130 -0
  136. package/dist/detection/dispositions.js +248 -0
  137. package/dist/detection/dispositions.js.map +1 -0
  138. package/dist/detection/git-notice.d.ts +88 -0
  139. package/dist/detection/git-notice.js +444 -0
  140. package/dist/detection/git-notice.js.map +1 -0
  141. package/dist/detection/ground-proof.d.ts +130 -0
  142. package/dist/detection/ground-proof.js +274 -0
  143. package/dist/detection/ground-proof.js.map +1 -0
  144. package/dist/detection/ground-reader.d.ts +29 -0
  145. package/dist/detection/ground-reader.js +102 -0
  146. package/dist/detection/ground-reader.js.map +1 -0
  147. package/dist/detection/held-territory.d.ts +51 -0
  148. package/dist/detection/held-territory.js +205 -0
  149. package/dist/detection/held-territory.js.map +1 -0
  150. package/dist/detection/identity-discovery.d.ts +45 -0
  151. package/dist/detection/identity-discovery.js +287 -0
  152. package/dist/detection/identity-discovery.js.map +1 -0
  153. package/dist/detection/maintenance-sweep.d.ts +108 -0
  154. package/dist/detection/maintenance-sweep.js +325 -0
  155. package/dist/detection/maintenance-sweep.js.map +1 -0
  156. package/dist/detection/name-reach.d.ts +12 -0
  157. package/dist/detection/name-reach.js +28 -0
  158. package/dist/detection/name-reach.js.map +1 -0
  159. package/dist/detection/notebook-basis.d.ts +5 -7
  160. package/dist/detection/notebook-basis.js +6 -7
  161. package/dist/detection/notebook-basis.js.map +1 -1
  162. package/dist/detection/owed-selection.d.ts +51 -0
  163. package/dist/detection/owed-selection.js +169 -0
  164. package/dist/detection/owed-selection.js.map +1 -0
  165. package/dist/detection/portable.d.ts +34 -34
  166. package/dist/detection/portable.js +67 -93
  167. package/dist/detection/portable.js.map +1 -1
  168. package/dist/detection/reconciliation-coverage.d.ts +7 -0
  169. package/dist/detection/reconciliation-coverage.js +16 -0
  170. package/dist/detection/reconciliation-coverage.js.map +1 -0
  171. package/dist/detection/repository-publication.d.ts +20 -0
  172. package/dist/detection/repository-publication.js +79 -0
  173. package/dist/detection/repository-publication.js.map +1 -0
  174. package/dist/detection/repository-routes.d.ts +43 -0
  175. package/dist/detection/repository-routes.js +97 -0
  176. package/dist/detection/repository-routes.js.map +1 -0
  177. package/dist/detection/root-examination.d.ts +94 -0
  178. package/dist/detection/root-examination.js +523 -0
  179. package/dist/detection/root-examination.js.map +1 -0
  180. package/dist/detection/runtime.d.ts +131 -64
  181. package/dist/detection/runtime.js +808 -1103
  182. package/dist/detection/runtime.js.map +1 -1
  183. package/dist/detection/scoped-identity-port.d.ts +34 -0
  184. package/dist/detection/scoped-identity-port.js +81 -0
  185. package/dist/detection/scoped-identity-port.js.map +1 -0
  186. package/dist/detection/seal-law.d.ts +66 -0
  187. package/dist/detection/seal-law.js +116 -0
  188. package/dist/detection/seal-law.js.map +1 -0
  189. package/dist/detection/sharing-policy.d.ts +11 -0
  190. package/dist/detection/sharing-policy.js +32 -0
  191. package/dist/detection/sharing-policy.js.map +1 -0
  192. package/dist/detection/thread-database.d.ts +4 -0
  193. package/dist/detection/thread-database.js +30 -0
  194. package/dist/detection/thread-database.js.map +1 -0
  195. package/dist/detection/unreadable.d.ts +11 -0
  196. package/dist/detection/unreadable.js +9 -0
  197. package/dist/detection/unreadable.js.map +1 -0
  198. package/dist/detection/verified-content.d.ts +6 -0
  199. package/dist/detection/verified-content.js +12 -0
  200. package/dist/detection/verified-content.js.map +1 -0
  201. package/dist/detection/walk-law.d.ts +34 -0
  202. package/dist/detection/walk-law.js +55 -0
  203. package/dist/detection/walk-law.js.map +1 -0
  204. package/dist/development/fly-guest.js +2 -1
  205. package/dist/development/fly-guest.js.map +1 -1
  206. package/dist/entity-apply-host.d.ts +29 -13
  207. package/dist/entity-apply-host.js +1426 -461
  208. package/dist/entity-apply-host.js.map +1 -1
  209. package/dist/entity-apply-store.d.ts +77 -30
  210. package/dist/entity-apply-store.js +221 -516
  211. package/dist/entity-apply-store.js.map +1 -1
  212. package/dist/entity-record-observability.js +2 -0
  213. package/dist/entity-record-observability.js.map +1 -1
  214. package/dist/entity-record-saves.d.ts +20 -0
  215. package/dist/entity-record-saves.js +91 -0
  216. package/dist/entity-record-saves.js.map +1 -0
  217. package/dist/entity-record-store.d.ts +15 -7
  218. package/dist/entity-record-store.js +57 -117
  219. package/dist/entity-record-store.js.map +1 -1
  220. package/dist/files-register-host.d.ts +22 -3
  221. package/dist/files-register-host.js +70 -31
  222. package/dist/files-register-host.js.map +1 -1
  223. package/dist/filesystem.js +3 -2
  224. package/dist/filesystem.js.map +1 -1
  225. package/dist/git-binding.d.ts +65 -0
  226. package/dist/git-binding.js +220 -0
  227. package/dist/git-binding.js.map +1 -0
  228. package/dist/git-capture.d.ts +39 -0
  229. package/dist/git-capture.js +86 -0
  230. package/dist/git-capture.js.map +1 -0
  231. package/dist/git-card.d.ts +12 -0
  232. package/dist/git-card.js +123 -0
  233. package/dist/git-card.js.map +1 -0
  234. package/dist/git-checkpoint-construction.d.ts +41 -0
  235. package/dist/git-checkpoint-construction.js +96 -0
  236. package/dist/git-checkpoint-construction.js.map +1 -0
  237. package/dist/git-checkpoint-preparation.d.ts +37 -0
  238. package/dist/git-checkpoint-preparation.js +145 -0
  239. package/dist/git-checkpoint-preparation.js.map +1 -0
  240. package/dist/git-command.d.ts +61 -8
  241. package/dist/git-command.js +217 -63
  242. package/dist/git-command.js.map +1 -1
  243. package/dist/git-configuration.d.ts +40 -0
  244. package/dist/git-configuration.js +217 -0
  245. package/dist/git-configuration.js.map +1 -0
  246. package/dist/git-evidence.d.ts +61 -0
  247. package/dist/git-evidence.js +181 -0
  248. package/dist/git-evidence.js.map +1 -0
  249. package/dist/git-index-entries.d.ts +15 -0
  250. package/dist/git-index-entries.js +44 -0
  251. package/dist/git-index-entries.js.map +1 -0
  252. package/dist/git-index-format.d.ts +35 -0
  253. package/dist/git-index-format.js +293 -0
  254. package/dist/git-index-format.js.map +1 -0
  255. package/dist/git-index-witness.d.ts +33 -0
  256. package/dist/git-index-witness.js +69 -0
  257. package/dist/git-index-witness.js.map +1 -0
  258. package/dist/git-literal-host.d.ts +82 -0
  259. package/dist/git-literal-host.js +172 -0
  260. package/dist/git-literal-host.js.map +1 -0
  261. package/dist/git-literal-read.d.ts +88 -0
  262. package/dist/git-literal-read.js +170 -0
  263. package/dist/git-literal-read.js.map +1 -0
  264. package/dist/git-literal-replay.d.ts +33 -0
  265. package/dist/git-literal-replay.js +268 -0
  266. package/dist/git-literal-replay.js.map +1 -0
  267. package/dist/git-native-file.d.ts +42 -0
  268. package/dist/git-native-file.js +145 -0
  269. package/dist/git-native-file.js.map +1 -0
  270. package/dist/git-native-index.d.ts +21 -0
  271. package/dist/git-native-index.js +44 -0
  272. package/dist/git-native-index.js.map +1 -0
  273. package/dist/git-operation-host.d.ts +48 -0
  274. package/dist/git-operation-host.js +127 -0
  275. package/dist/git-operation-host.js.map +1 -0
  276. package/dist/git-private-index.d.ts +11 -0
  277. package/dist/git-private-index.js +42 -0
  278. package/dist/git-private-index.js.map +1 -0
  279. package/dist/git-private-repository.d.ts +4 -0
  280. package/dist/git-private-repository.js +69 -0
  281. package/dist/git-private-repository.js.map +1 -0
  282. package/dist/git-private-view.d.ts +39 -0
  283. package/dist/git-private-view.js +162 -0
  284. package/dist/git-private-view.js.map +1 -0
  285. package/dist/git-ref-store.d.ts +12 -0
  286. package/dist/git-ref-store.js +68 -0
  287. package/dist/git-ref-store.js.map +1 -0
  288. package/dist/git-registration-host.d.ts +20 -30
  289. package/dist/git-registration-host.js +86 -249
  290. package/dist/git-registration-host.js.map +1 -1
  291. package/dist/git-repository-host.d.ts +148 -22
  292. package/dist/git-repository-host.js +633 -650
  293. package/dist/git-repository-host.js.map +1 -1
  294. package/dist/git-worktree-host.d.ts +2 -0
  295. package/dist/git-worktree-host.js +16 -0
  296. package/dist/git-worktree-host.js.map +1 -0
  297. package/dist/graph-publication.d.ts +75 -0
  298. package/dist/graph-publication.js +203 -0
  299. package/dist/graph-publication.js.map +1 -0
  300. package/dist/ground-basis.d.ts +242 -0
  301. package/dist/ground-basis.js +1023 -0
  302. package/dist/ground-basis.js.map +1 -0
  303. package/dist/ground-checkpoint-worker.d.ts +1 -0
  304. package/dist/ground-checkpoint-worker.js +84 -0
  305. package/dist/ground-checkpoint-worker.js.map +1 -0
  306. package/dist/ground-checkpoints.d.ts +16 -0
  307. package/dist/ground-checkpoints.js +45 -0
  308. package/dist/ground-checkpoints.js.map +1 -0
  309. package/dist/ground-coordination.d.ts +107 -3
  310. package/dist/ground-coordination.js +249 -24
  311. package/dist/ground-coordination.js.map +1 -1
  312. package/dist/ground-database.d.ts +42 -0
  313. package/dist/ground-database.js +290 -0
  314. package/dist/ground-database.js.map +1 -0
  315. package/dist/ground-differences.d.ts +23 -0
  316. package/dist/ground-differences.js +47 -0
  317. package/dist/ground-differences.js.map +1 -0
  318. package/dist/ground-holders.d.ts +4 -0
  319. package/dist/ground-holders.js +15 -0
  320. package/dist/ground-holders.js.map +1 -0
  321. package/dist/ground-initialization-worker.d.ts +1 -0
  322. package/dist/ground-initialization-worker.js +20 -0
  323. package/dist/ground-initialization-worker.js.map +1 -0
  324. package/dist/ground-initialization.d.ts +35 -0
  325. package/dist/ground-initialization.js +102 -0
  326. package/dist/ground-initialization.js.map +1 -0
  327. package/dist/ground-install-saves.d.ts +63 -0
  328. package/dist/ground-install-saves.js +139 -0
  329. package/dist/ground-install-saves.js.map +1 -0
  330. package/dist/ground-inventory-schema.d.ts +18 -0
  331. package/dist/ground-inventory-schema.js +168 -0
  332. package/dist/ground-inventory-schema.js.map +1 -0
  333. package/dist/ground-profile.d.ts +7 -0
  334. package/dist/ground-profile.js +52 -0
  335. package/dist/ground-profile.js.map +1 -0
  336. package/dist/ground-root-index.d.ts +2 -1
  337. package/dist/ground-root-index.js +16 -14
  338. package/dist/ground-root-index.js.map +1 -1
  339. package/dist/ground-row.d.ts +62 -0
  340. package/dist/ground-row.js +70 -0
  341. package/dist/ground-row.js.map +1 -0
  342. package/dist/ground-save-ops.d.ts +44 -0
  343. package/dist/ground-save-ops.js +41 -0
  344. package/dist/ground-save-ops.js.map +1 -0
  345. package/dist/ground-saver-worker.d.ts +1 -0
  346. package/dist/ground-saver-worker.js +156 -0
  347. package/dist/ground-saver-worker.js.map +1 -0
  348. package/dist/ground-saver.d.ts +75 -0
  349. package/dist/ground-saver.js +216 -0
  350. package/dist/ground-saver.js.map +1 -0
  351. package/dist/ground-store.d.ts +84 -0
  352. package/dist/ground-store.js +473 -0
  353. package/dist/ground-store.js.map +1 -0
  354. package/dist/ground-territory.d.ts +130 -0
  355. package/dist/ground-territory.js +511 -0
  356. package/dist/ground-territory.js.map +1 -0
  357. package/dist/index.d.ts +1 -1
  358. package/dist/index.js.map +1 -1
  359. package/dist/installation/ownership.d.ts +0 -2
  360. package/dist/installation/ownership.js +3 -15
  361. package/dist/installation/ownership.js.map +1 -1
  362. package/dist/machine-host.d.ts +3 -2
  363. package/dist/machine-host.js +28 -16
  364. package/dist/machine-host.js.map +1 -1
  365. package/dist/materialized-graph.d.ts +7 -7
  366. package/dist/materialized-graph.js +11 -23
  367. package/dist/materialized-graph.js.map +1 -1
  368. package/dist/module-thread.d.ts +9 -0
  369. package/dist/module-thread.js +10 -0
  370. package/dist/module-thread.js.map +1 -0
  371. package/dist/native/fsevents-stream.node +0 -0
  372. package/dist/physical-path-witness.d.ts +64 -0
  373. package/dist/physical-path-witness.js +168 -0
  374. package/dist/physical-path-witness.js.map +1 -0
  375. package/dist/register-upload-fusion.d.ts +5 -4
  376. package/dist/register-upload-fusion.js +9 -6
  377. package/dist/register-upload-fusion.js.map +1 -1
  378. package/dist/registry-graph.d.ts +3 -2
  379. package/dist/registry-graph.js +9 -6
  380. package/dist/registry-graph.js.map +1 -1
  381. package/dist/registry-page-cache.d.ts +5 -2
  382. package/dist/registry-page-cache.js.map +1 -1
  383. package/dist/repository-identity-steps.d.ts +5 -0
  384. package/dist/repository-identity-steps.js +33 -0
  385. package/dist/repository-identity-steps.js.map +1 -0
  386. package/dist/runtime-node-flags.d.ts +10 -0
  387. package/dist/runtime-node-flags.js +11 -0
  388. package/dist/runtime-node-flags.js.map +1 -0
  389. package/dist/service/adapter.d.ts +1 -1
  390. package/dist/service/adapter.js +1 -1
  391. package/dist/service/adapter.js.map +1 -1
  392. package/dist/service/cli.js +16 -20
  393. package/dist/service/cli.js.map +1 -1
  394. package/dist/service/control.d.ts +2 -2
  395. package/dist/service/keepalive.d.ts +4 -11
  396. package/dist/service/keepalive.js +65 -118
  397. package/dist/service/keepalive.js.map +1 -1
  398. package/dist/service/policy.d.ts +36 -0
  399. package/dist/service/policy.js +25 -0
  400. package/dist/service/policy.js.map +1 -0
  401. package/dist/service/portable.d.ts +1 -1
  402. package/dist/service/portable.js +1 -1
  403. package/dist/service/portable.js.map +1 -1
  404. package/dist/service/recovery.d.ts +10 -9
  405. package/dist/service/recovery.js +29 -19
  406. package/dist/service/recovery.js.map +1 -1
  407. package/dist/service/windows-action.d.ts +5 -3
  408. package/dist/service/windows-action.js +6 -9
  409. package/dist/service/windows-action.js.map +1 -1
  410. package/dist/service/windows-task.js +5 -5
  411. package/dist/service/windows-task.js.map +1 -1
  412. package/dist/sharing-admission.d.ts +17 -0
  413. package/dist/sharing-admission.js +128 -0
  414. package/dist/sharing-admission.js.map +1 -0
  415. package/dist/snapshot-delivery-baseline.d.ts +12 -3
  416. package/dist/snapshot-delivery-baseline.js +41 -42
  417. package/dist/snapshot-delivery-baseline.js.map +1 -1
  418. package/dist/source-proof.d.ts +36 -0
  419. package/dist/source-proof.js +70 -0
  420. package/dist/source-proof.js.map +1 -0
  421. package/dist/source-signature.d.ts +56 -0
  422. package/dist/source-signature.js +56 -0
  423. package/dist/source-signature.js.map +1 -0
  424. package/dist/source-witness.d.ts +15 -0
  425. package/dist/source-witness.js +29 -0
  426. package/dist/source-witness.js.map +1 -0
  427. package/dist/sqlite-durability.d.ts +31 -0
  428. package/dist/sqlite-durability.js +28 -0
  429. package/dist/sqlite-durability.js.map +1 -0
  430. package/dist/sqlite.d.ts +8 -2
  431. package/dist/sqlite.js +27 -4
  432. package/dist/sqlite.js.map +1 -1
  433. package/dist/sync-address.d.ts +19 -0
  434. package/dist/sync-address.js +52 -0
  435. package/dist/sync-address.js.map +1 -0
  436. package/dist/sync-setting.d.ts +15 -0
  437. package/dist/sync-setting.js +13 -0
  438. package/dist/sync-setting.js.map +1 -1
  439. package/dist/turns.d.ts +42 -0
  440. package/dist/turns.js +112 -0
  441. package/dist/turns.js.map +1 -0
  442. package/dist/updates/bootstrap.d.ts +53 -7
  443. package/dist/updates/bootstrap.js +224 -137
  444. package/dist/updates/bootstrap.js.map +1 -1
  445. package/dist/updates/controller.d.ts +8 -0
  446. package/dist/updates/controller.js +27 -3
  447. package/dist/updates/controller.js.map +1 -1
  448. package/dist/updates/store.d.ts +3 -0
  449. package/dist/updates/store.js +12 -0
  450. package/dist/updates/store.js.map +1 -1
  451. package/dist/user-ground-host.d.ts +364 -69
  452. package/dist/user-ground-host.js +5231 -3366
  453. package/dist/user-ground-host.js.map +1 -1
  454. package/dist/watching/fsevents.d.ts +52 -1
  455. package/dist/watching/fsevents.js +60 -25
  456. package/dist/watching/fsevents.js.map +1 -1
  457. package/dist/watching/host.d.ts +129 -5
  458. package/dist/watching/host.js +433 -80
  459. package/dist/watching/host.js.map +1 -1
  460. package/dist/watching/index.d.ts +1 -1
  461. package/dist/wire-binary.d.ts +3 -2
  462. package/dist/wire-binary.js +10 -8
  463. package/dist/wire-binary.js.map +1 -1
  464. package/dist/wire-client.d.ts +3 -4
  465. package/dist/wire-client.js +18 -44
  466. package/dist/wire-client.js.map +1 -1
  467. package/dist/wire-outbox.d.ts +34 -0
  468. package/dist/wire-outbox.js +127 -0
  469. package/dist/wire-outbox.js.map +1 -0
  470. package/dist/workspace-host.d.ts +4 -0
  471. package/dist/workspace-host.js +12 -1
  472. package/dist/workspace-host.js.map +1 -1
  473. package/examinations/fixtures/private-wire-authority.js +133 -10
  474. package/npm-shrinkwrap.json +43 -56
  475. package/package.json +26 -13
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Installation's writes, run only by the ground file's saver thread
3
+ * (ground-saver.ts): rows a login install, direct persist or Add reveal
4
+ * projects, the references Add renders and their parents' membership, the
5
+ * revealed root's refreshed fingerprint, a root's retired rows, and the Add
6
+ * intent that journals one Add. The main thread derives every row and closes
7
+ * every physical witness before it posts.
8
+ */
9
+ import { createHash } from "node:crypto";
10
+ import { canonicalVersion, membershipHash } from "@amalgm/live";
11
+ import { installRepositorySeal } from "./detection/seal-law.js";
12
+ import { groundStore } from "./ground-store.js";
13
+ import { cachedStatement } from "./sqlite.js";
14
+ const sha256Hex = (input) => createHash("sha256").update(input).digest("hex");
15
+ function writeOwner(database, owner) {
16
+ cachedStatement(database, `
17
+ INSERT INTO ground_identity(singleton, user_id, user_email, device_id)
18
+ VALUES(1, ?, ?, ?)
19
+ ON CONFLICT(singleton) DO UPDATE SET
20
+ user_id = excluded.user_id,
21
+ user_email = excluded.user_email,
22
+ device_id = excluded.device_id
23
+ `).run(owner.userId, owner.userEmail, owner.deviceId);
24
+ }
25
+ /** `install.rows`. */
26
+ export function installRows(database, input) {
27
+ groundStore(database).write(writer => {
28
+ writeOwner(database, input.owner);
29
+ for (const pair of input.repositoryObservations)
30
+ writer.observeRepository(pair);
31
+ const replace = (inventory, rows) => {
32
+ const current = new Set(rows.map(row => row.uuid));
33
+ for (const old of input.previous) {
34
+ if (current.has(old.uuid))
35
+ continue;
36
+ const held = writer.get(inventory, old.uuid);
37
+ if (held?.resourceId === input.resourceId && held.rootUUID === old.rootUUID)
38
+ writer.remove(inventory, old.uuid);
39
+ }
40
+ if (inventory === "entities")
41
+ writer.replace(inventory, rows);
42
+ else
43
+ writer.replace(inventory, rows, [], "replace");
44
+ };
45
+ replace("entities", input.rows.observed);
46
+ if (input.rows.shared)
47
+ replace("detection_notebook", input.rows.shared);
48
+ for (const seal of input.seals)
49
+ installRepositorySeal(database, seal);
50
+ });
51
+ }
52
+ /** `install.references`: new references and their parents' derived
53
+ * membership. Each inventory re-derives its own parent version from its own
54
+ * active children, so a notebook never inherits observation-only state. */
55
+ export function installReferences(database, input) {
56
+ groundStore(database).write(writer => {
57
+ writeOwner(database, input.owner);
58
+ writer.replace("entities", input.rows);
59
+ writer.replace("detection_notebook", input.rows, [], "replace");
60
+ for (const parentId of new Set(input.rows.map(row => row.parentUUID))) {
61
+ for (const inventory of ["entities", "detection_notebook"]) {
62
+ const parent = writer.get(inventory, parentId);
63
+ if (!parent)
64
+ throw new Error(`reference parent ${parentId} left ${inventory} during Add`);
65
+ const membership = membershipHash(cachedStatement(database, `SELECT uuid, name FROM ${inventory} WHERE parent_uuid = ? AND status = 'active'`)
66
+ .all(parentId), sha256Hex);
67
+ writer.update(inventory, parentId, {
68
+ version: canonicalVersion({
69
+ type: parent.type,
70
+ parentUUID: parent.parentUUID,
71
+ name: parent.name,
72
+ status: parent.status,
73
+ payloadVersion: membership,
74
+ }, sha256Hex),
75
+ }, inventory === "detection_notebook" ? "replace" : undefined);
76
+ }
77
+ }
78
+ });
79
+ }
80
+ /** `install.refreshRoot`: a same-filesystem rename preserves identity and
81
+ * bytes but may advance the root directory's ctime, so the revealed root's
82
+ * one derived fingerprint is refreshed before its binding makes the committed
83
+ * graph observable. */
84
+ export function refreshRoot(database, input) {
85
+ const { workspaceId, absolutePath, fingerprint } = input;
86
+ groundStore(database).write(writer => {
87
+ const current = writer.get("entities", workspaceId);
88
+ if (!current || current.absolutePath !== absolutePath) {
89
+ throw new Error(`revealed workspace ${workspaceId} has no committed root row`);
90
+ }
91
+ writer.update("entities", workspaceId, fingerprint);
92
+ const notebook = writer.get("detection_notebook", workspaceId);
93
+ if (notebook?.absolutePath === absolutePath)
94
+ writer.update("detection_notebook", workspaceId, fingerprint, "retain-equivalent");
95
+ });
96
+ }
97
+ /** `install.clearRoot`: every row one root holds, in both inventories. */
98
+ export function clearRoot(database, input) {
99
+ groundStore(database).write(writer => {
100
+ for (const inventory of ["entities", "detection_notebook"]) {
101
+ const uuids = cachedStatement(database, `SELECT uuid FROM ${inventory} WHERE resource_id = ? AND root_uuid = ?`)
102
+ .pluck().all(input.resourceId, input.rootUUID);
103
+ for (const uuid of uuids)
104
+ writer.remove(inventory, uuid);
105
+ }
106
+ });
107
+ }
108
+ /** `add.beginIntent`: the proposed intent, or the one already journaled for
109
+ * that workspace. A destination another pending Add owns refuses. */
110
+ export function beginAddIntent(database, proposed) {
111
+ let inserted;
112
+ try {
113
+ inserted = cachedStatement(database, `
114
+ INSERT INTO workspace_add_intents(workspace_uuid, destination_path, intent_json)
115
+ VALUES (?, ?, ?)
116
+ ON CONFLICT(workspace_uuid) DO NOTHING
117
+ `).run(proposed.workspaceId, proposed.destinationPath, proposed.intentJson);
118
+ }
119
+ catch (error) {
120
+ const destinationOwner = cachedStatement(database, "SELECT workspace_uuid AS workspaceId FROM workspace_add_intents WHERE destination_path = ?")
121
+ .get(proposed.destinationPath);
122
+ if (destinationOwner) {
123
+ throw new Error(`workspace Add destination belongs to pending workspace ${destinationOwner.workspaceId}`);
124
+ }
125
+ throw error;
126
+ }
127
+ if (inserted.changes === 1)
128
+ return { intentJson: proposed.intentJson, created: true };
129
+ const existing = cachedStatement(database, "SELECT intent_json AS intentJson FROM workspace_add_intents WHERE workspace_uuid = ?")
130
+ .get(proposed.workspaceId);
131
+ if (!existing)
132
+ throw new Error(`workspace Add intent ${proposed.workspaceId} was not persisted`);
133
+ return { intentJson: existing.intentJson, created: false };
134
+ }
135
+ /** `add.clearIntent`. */
136
+ export function clearAddIntent(database, workspaceId) {
137
+ cachedStatement(database, "DELETE FROM workspace_add_intents WHERE workspace_uuid = ?").run(workspaceId);
138
+ }
139
+ //# sourceMappingURL=ground-install-saves.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ground-install-saves.js","sourceRoot":"","sources":["../src/ground-install-saves.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAgC,MAAM,yBAAyB,CAAC;AAG9F,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,SAAS,GAAG,CAAC,KAA0B,EAAU,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAS3G,SAAS,UAAU,CAAC,QAA2B,EAAE,KAAkB;IACjE,eAAe,CAAC,QAAQ,EAAE;;;;;;;GAOzB,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;AACxD,CAAC;AAeD,sBAAsB;AACtB,MAAM,UAAU,WAAW,CAAC,QAA2B,EAAE,KAAoB;IAC3E,WAAW,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;QACnC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAClC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,sBAAsB;YAAE,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAChF,MAAM,OAAO,GAAG,CAAC,SAA4C,EAAE,IAA0B,EAAQ,EAAE;YACjG,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,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-,-";
5
+ readonly generations: "view,view,table,table,table";
6
+ };
7
+ /** What the migration found, how long converting it took to prove, and how
8
+ * many keys it built. */
9
+ export interface InventoryMigration {
10
+ readonly from: keyof typeof SHAPES;
11
+ readonly validationMs: number;
12
+ readonly keysBuilt: number;
13
+ }
14
+ /** Recognizes one of three coherent states and leaves the generation form
15
+ * with exactly the declared keys. Any other mixture of these objects fails
16
+ * the open unchanged. */
17
+ export declare function ensureInventorySchema(database: Database.Database): InventoryMigration;
18
+ export {};
@@ -0,0 +1,168 @@
1
+ /** The storage of the two ground inventories: base tables holding stored
2
+ * generations, one visible generation per root, and read-only views that
3
+ * every reader uses.
4
+ *
5
+ * `ground_roots` names which stored generation supplies a root's ordinary
6
+ * O/B view. It is storage bookkeeping, never declaration, binding or
7
+ * materialization truth. Generations are opaque identities, never ordered. */
8
+ import { randomUUID } from "node:crypto";
9
+ import { INVENTORY_ROWS, inventoryColumns } from "./ground-row.js";
10
+ const INVENTORIES = ["entities", "detection_notebook"];
11
+ const ROW_COLUMNS = `
12
+ resource_id TEXT NOT NULL,
13
+ root_uuid TEXT NOT NULL,
14
+ type TEXT NOT NULL,
15
+ parent_uuid TEXT,
16
+ name TEXT NOT NULL,
17
+ status TEXT NOT NULL,
18
+ version TEXT NOT NULL,
19
+ payload_version TEXT,
20
+ transport_version TEXT,
21
+ relative_path TEXT NOT NULL,
22
+ absolute_path TEXT NOT NULL,
23
+ physical_key TEXT NOT NULL,
24
+ source_signature TEXT,
25
+ filesystem_mode INTEGER,
26
+ content_verified_ns TEXT`;
27
+ const TABLES = `
28
+ CREATE TABLE ground_roots (
29
+ root_uuid TEXT PRIMARY KEY,
30
+ generation TEXT NOT NULL
31
+ ) WITHOUT ROWID;
32
+ CREATE TABLE entity_rows (
33
+ uuid TEXT NOT NULL,
34
+ generation TEXT NOT NULL,${ROW_COLUMNS},
35
+ git_configuration_observation TEXT,
36
+ PRIMARY KEY(uuid, generation),
37
+ UNIQUE(resource_id, root_uuid, relative_path, generation)
38
+ );
39
+ CREATE TABLE notebook_rows (
40
+ uuid TEXT NOT NULL,
41
+ generation TEXT NOT NULL,${ROW_COLUMNS},
42
+ local_admission_mutation_id TEXT,
43
+ PRIMARY KEY(uuid, generation)
44
+ );`;
45
+ const VIEWS = INVENTORIES.map(inventory => `CREATE VIEW ${inventory}(${inventoryColumns(inventory).join(", ")}) AS
46
+ SELECT ${inventoryColumns(inventory).map(column => `b.${column}`).join(", ")} FROM ${INVENTORY_ROWS[inventory]} b
47
+ JOIN ground_roots r ON r.root_uuid = b.root_uuid AND r.generation = b.generation;`).join("\n");
48
+ /** The stored rows' secondary keys, by name. Every key is the flat
49
+ * inventory's, except the root/path key: led by the root's generation, a
50
+ * root-scoped read visits only the visible generation however many others
51
+ * are stored, and each inventory's slot key: who holds a portable
52
+ * (parent, name) slot is one probe, never a pass over the parent's children.
53
+ * A key also yields its reader's order, since the planner otherwise prefers
54
+ * the key that does: a slot key without UUID loses to the child key. */
55
+ const KEYS = {
56
+ entity_rows_by_root_path: "entity_rows(root_uuid, generation, relative_path)",
57
+ entity_rows_by_absolute_path: "entity_rows(absolute_path)",
58
+ entity_rows_repository_bindings: "entity_rows(uuid) WHERE type = 'repo.git' AND status = 'active'",
59
+ entity_rows_by_physical_identity: "entity_rows(physical_key)",
60
+ entity_rows_by_parent_uuid: "entity_rows(parent_uuid, uuid)",
61
+ entity_rows_by_slot: "entity_rows(parent_uuid, name, uuid)",
62
+ notebook_rows_by_root_path: "notebook_rows(root_uuid, generation, relative_path)",
63
+ notebook_rows_by_absolute_path: "notebook_rows(absolute_path)",
64
+ notebook_rows_by_parent_uuid: "notebook_rows(parent_uuid, uuid)",
65
+ notebook_rows_by_slot: "notebook_rows(parent_uuid, name, uuid)",
66
+ notebook_rows_by_physical_identity: "notebook_rows(physical_key)",
67
+ notebook_rows_by_payload: "notebook_rows(payload_version) WHERE payload_version IS NOT NULL",
68
+ notebook_rows_by_transport: "notebook_rows(transport_version) WHERE transport_version IS NOT NULL",
69
+ };
70
+ /** Keys are derived storage, so every open leaves exactly the declared ones:
71
+ * a key stored under another definition is rebuilt, an undeclared one
72
+ * dropped, a missing one built. Returns how many it built. */
73
+ function ensureInventoryKeys(database) {
74
+ const stored = new Map(database.prepare(`SELECT name, sql FROM sqlite_master
75
+ WHERE type = 'index' AND sql IS NOT NULL AND tbl_name IN ('entity_rows', 'notebook_rows')`)
76
+ .all().map(({ name, sql }) => [name, sql]));
77
+ const declared = new Map(Object.entries(KEYS).map(([name, key]) => [name, `CREATE INDEX ${name} ON ${key}`]));
78
+ const built = [...declared].filter(([name, sql]) => stored.get(name) !== sql);
79
+ const dropped = [...stored].filter(([name, sql]) => declared.get(name) !== sql);
80
+ if (built.length || dropped.length) {
81
+ database.transaction(() => {
82
+ for (const [name] of dropped)
83
+ database.exec(`DROP INDEX ${name}`);
84
+ for (const [, sql] of built)
85
+ database.exec(sql);
86
+ })();
87
+ }
88
+ return built.length;
89
+ }
90
+ const OBJECTS = ["entities", "detection_notebook", "entity_rows", "notebook_rows", "ground_roots"];
91
+ const SHAPES = {
92
+ fresh: "-,-,-,-,-",
93
+ flat: "table,table,-,-,-",
94
+ generations: "view,view,table,table,table",
95
+ };
96
+ /** Recognizes one of three coherent states and leaves the generation form
97
+ * with exactly the declared keys. Any other mixture of these objects fails
98
+ * the open unchanged. */
99
+ export function ensureInventorySchema(database) {
100
+ const found = new Map(database.prepare(`SELECT name, type FROM sqlite_master WHERE name IN (${OBJECTS.map(() => "?").join(", ")})`)
101
+ .all(...OBJECTS).map(({ name, type }) => [name, type]));
102
+ const shape = OBJECTS.map(name => found.get(name) ?? "-").join(",");
103
+ if (shape === SHAPES.generations)
104
+ return { from: "generations", validationMs: 0, keysBuilt: ensureInventoryKeys(database) };
105
+ if (shape === SHAPES.fresh) {
106
+ database.transaction(() => database.exec(TABLES + VIEWS))();
107
+ return { from: "fresh", validationMs: 0, keysBuilt: ensureInventoryKeys(database) };
108
+ }
109
+ if (shape !== SHAPES.flat) {
110
+ throw new Error(`the ground inventories are in an unrecognized schema state (${OBJECTS.join(",")} = ${shape})`);
111
+ }
112
+ const validationMs = convertFlatInventories(database);
113
+ return { from: "flat", validationMs, keysBuilt: ensureInventoryKeys(database) };
114
+ }
115
+ /** One transaction: the flat tables step aside, their rows are copied under
116
+ * one generation per root shared by both inventories, the views must then
117
+ * reproduce both inventories exactly, and only then are the flat tables
118
+ * dropped. A failure rolls everything back. Rows move as storage; no ground
119
+ * write, stamp, history or Record is produced. */
120
+ function convertFlatInventories(database) {
121
+ return database.transaction(() => {
122
+ const flat = { entities: "flat_entities", detection_notebook: "flat_notebook" };
123
+ for (const inventory of INVENTORIES)
124
+ database.exec(`ALTER TABLE ${inventory} RENAME TO ${flat[inventory]}`);
125
+ database.exec(TABLES);
126
+ const place = database.prepare("INSERT INTO ground_roots(root_uuid, generation) VALUES (?, ?)");
127
+ for (const root of database.prepare(`SELECT root_uuid FROM ${flat.entities}
128
+ UNION SELECT root_uuid FROM ${flat.detection_notebook}`).pluck().all())
129
+ place.run(root, randomUUID());
130
+ const stored = {};
131
+ for (const inventory of INVENTORIES) {
132
+ const columns = inventoryColumns(inventory);
133
+ const table = database.prepare(`PRAGMA table_info(${flat[inventory]})`).all();
134
+ const present = table.map(({ name }) => name);
135
+ const unknown = present.filter(column => !columns.includes(column));
136
+ if (unknown.length)
137
+ throw new Error(`the flat ${inventory} inventory has unknown columns: ${unknown.join(", ")}`);
138
+ if (table.filter(({ pk }) => pk > 0).map(({ name }) => name).join() !== "uuid") {
139
+ throw new Error(`the flat ${inventory} inventory is not keyed by its UUID alone`);
140
+ }
141
+ stored[inventory] = present;
142
+ // A column the flat table never gained holds no value in any row.
143
+ database.exec(`INSERT INTO ${INVENTORY_ROWS[inventory]}(generation, ${columns.join(", ")})
144
+ SELECT r.generation, ${columns.map(column => present.includes(column) ? `f.${column}` : "NULL").join(", ")}
145
+ FROM ${flat[inventory]} f JOIN ground_roots r ON r.root_uuid = f.root_uuid`);
146
+ }
147
+ database.exec(VIEWS);
148
+ const validating = performance.now();
149
+ // A flat row is keyed by its UUID, and a visible row is fixed by its UUID
150
+ // and root, so an equal pair matches each side at most once. Every flat
151
+ // row having an equal visible row, with equal counts, makes the visible
152
+ // rows exactly the flat rows, each UUID once.
153
+ for (const inventory of INVENTORIES) {
154
+ const equal = stored[inventory].map(column => `f.${column} IS v.${column}`).join(" AND ");
155
+ const differs = database.prepare(`SELECT
156
+ (SELECT COUNT(*) FROM ${flat[inventory]}) <> (SELECT COUNT(*) FROM ${inventory})
157
+ OR (SELECT COUNT(*) FROM ${flat[inventory]} f JOIN ${inventory} v ON v.uuid = f.uuid WHERE ${equal})
158
+ <> (SELECT COUNT(*) FROM ${flat[inventory]})`).pluck().get();
159
+ if (differs)
160
+ throw new Error(`the converted ${inventory} view does not reproduce its flat inventory`);
161
+ }
162
+ const validationMs = performance.now() - validating;
163
+ for (const inventory of INVENTORIES)
164
+ database.exec(`DROP TABLE ${flat[inventory]}`);
165
+ return validationMs;
166
+ })();
167
+ }
168
+ //# sourceMappingURL=ground-inventory-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ground-inventory-schema.js","sourceRoot":"","sources":["../src/ground-inventory-schema.ts"],"names":[],"mappings":"AAAA;;;;;;8EAM8E;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnE,MAAM,WAAW,GAAG,CAAC,UAAU,EAAE,oBAAoB,CAAU,CAAC;AAGhE,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;+BAeW,CAAC;AAEhC,MAAM,MAAM,GAAG;;;;;;;iCAOkB,WAAW;;;;;;;iCAOX,WAAW;;;OAGrC,CAAC;AAER,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,eAAe,SAAS,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,I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,MAAM,IAAI,KAAK,CAAC,iBAAiB,SAAS,6CAA6C,CAAC,CAAC;QACxG,CAAC;QACD,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC;QACpD,KAAK,MAAM,SAAS,IAAI,WAAW;YAAE,QAAQ,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACpF,OAAO,YAAY,CAAC;IACtB,CAAC,CAAC,EAAE,CAAC;AACP,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface GroundProfile {
2
+ readonly id: string;
3
+ /** How far below the stamp a time must lie; null when untrusted. */
4
+ readonly marginNs: bigint | null;
5
+ }
6
+ /** The profile of the filesystem holding path, read now. */
7
+ export declare function groundProfile(path: string): GroundProfile;
@@ -0,0 +1,52 @@
1
+ /** The filesystems whose own times Detect trusts. Two shortcuts rest on them:
2
+ * an unchanged signature standing for unchanged content, and directory
3
+ * signatures that held still closing a namespace. Both need every change to
4
+ * an object to move its times forward from the kernel's one timestamp source,
5
+ * the same source that writes the root's content-clock stamp. A later change
6
+ * then carries a time at or after the stamp, and a time strictly before it
7
+ * names ground that has held since. Only a filesystem named here is trusted;
8
+ * any other keeps neither shortcut and still reaches every conclusion: its
9
+ * leaves are reread, and its listings close only by being listed again after
10
+ * the walk (see detection/ground-proof.ts). Mounting over an entry moves no
11
+ * time and is outside every profile.
12
+ *
13
+ * A time is kept at its inode's own resolution. Ext inodes without extra
14
+ * time fields hold whole seconds beside inodes that hold nanoseconds, so
15
+ * source-signature.ts reads any time without a subsecond part as covering its
16
+ * whole second. The margin is kept below the stamp as defense against one
17
+ * kernel handing out times from two sources that disagree within a scheduler
18
+ * tick; the proof is the single source, not the margin.
19
+ *
20
+ * statfs names a filesystem by number. On Linux that is the superblock magic,
21
+ * kernel ABI. On macOS it is the number APFS registered in this boot, so it
22
+ * is resolved from the boot volume, which every macOS this runtime supports
23
+ * requires to be APFS. The profile id names the law's version, and the
24
+ * content clock records the id it stamped under, so a changed qualification
25
+ * retires every proof minted under the old one. */
26
+ import { statfsSync } from "node:fs";
27
+ /** Bumped whenever what a trusted profile qualifies changes. */
28
+ const LAW = 2;
29
+ const MARGIN_NS = 10000000n;
30
+ let darwinApfs;
31
+ function trustedName(type) {
32
+ if (process.platform === "darwin")
33
+ return type === (darwinApfs ??= statfsSync("/").type) ? "apfs" : undefined;
34
+ if (process.platform !== "linux")
35
+ return undefined;
36
+ switch (type) {
37
+ // ext2, ext3 and ext4 share one magic.
38
+ case 0xef53: return "ext";
39
+ case 0x58465342: return "xfs";
40
+ case 0x9123683e: return "btrfs";
41
+ case 0x01021994: return "tmpfs";
42
+ default: return undefined;
43
+ }
44
+ }
45
+ /** The profile of the filesystem holding path, read now. */
46
+ export function groundProfile(path) {
47
+ const type = statfsSync(path).type;
48
+ const name = trustedName(type);
49
+ return name === undefined ? { id: `${process.platform}:${type}`, marginNs: null }
50
+ : { id: `${name}@${LAW}`, marginNs: MARGIN_NS };
51
+ }
52
+ //# sourceMappingURL=ground-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ground-profile.js","sourceRoot":"","sources":["../src/ground-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;mDAwBmD;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,gEAAgE;AAChE,MAAM,GAAG,GAAG,CAAC,CAAC;AAQd,MAAM,SAAS,GAAG,SAAW,CAAC;AAE9B,IAAI,UAA8B,CAAC;AAEnC,SAAS,WAAW,CAAC,IAAY;IAC/B,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,KAAK,CAAC,UAAU,KAAK,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9G,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC;IACnD,QAAQ,IAAI,EAAE,CAAC;QACb,uCAAuC;QACvC,KAAK,MAAM,CAAC,CAAC,OAAO,KAAK,CAAC;QAC1B,KAAK,UAAU,CAAC,CAAC,OAAO,KAAK,CAAC;QAC9B,KAAK,UAAU,CAAC,CAAC,OAAO,OAAO,CAAC;QAChC,KAAK,UAAU,CAAC,CAAC,OAAO,OAAO,CAAC;QAChC,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;IACnC,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC/E,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACpD,CAAC"}
@@ -5,7 +5,8 @@ export interface OutermostGroundRoot {
5
5
  /**
6
6
  * Assign materialized rows to disjoint outermost roots in one pass. Walking a
7
7
  * row's ancestors is bounded by path depth; comparing every row with every
8
- * registered root makes restart work grow with roots × entities.
8
+ * registered root makes restart work grow with roots × entities. Each
9
+ * directory's answer is remembered, so siblings share one ancestor walk.
9
10
  */
10
11
  export declare function indexRowsByOutermostRoot<T extends {
11
12
  readonly absolutePath: string;
@@ -2,24 +2,26 @@ import { dirname, resolve } from "node:path";
2
2
  /**
3
3
  * Assign materialized rows to disjoint outermost roots in one pass. Walking a
4
4
  * row's ancestors is bounded by path depth; comparing every row with every
5
- * registered root makes restart work grow with roots × entities.
5
+ * registered root makes restart work grow with roots × entities. Each
6
+ * directory's answer is remembered, so siblings share one ancestor walk.
6
7
  */
7
8
  export function indexRowsByOutermostRoot(roots, rows) {
8
- const rootAtDirectory = new Map(roots.map(({ rootId, directory }) => [resolve(directory), rootId]));
9
+ const owner = new Map(roots.map(({ rootId, directory }) => [resolve(directory), rootId]));
9
10
  const rowsByRoot = new Map(roots.map(({ rootId }) => [rootId, []]));
11
+ const ownerOf = (directory) => {
12
+ const known = owner.get(directory);
13
+ if (known !== undefined)
14
+ return known;
15
+ const parent = dirname(directory);
16
+ const found = parent === directory ? null : ownerOf(parent);
17
+ owner.set(directory, found);
18
+ return found;
19
+ };
10
20
  for (const row of rows) {
11
- let cursor = resolve(row.absolutePath);
12
- while (true) {
13
- const rootId = rootAtDirectory.get(cursor);
14
- if (rootId) {
15
- rowsByRoot.get(rootId)?.push(row);
16
- break;
17
- }
18
- const parent = dirname(cursor);
19
- if (parent === cursor)
20
- break;
21
- cursor = parent;
22
- }
21
+ const path = resolve(row.absolutePath);
22
+ const rootId = owner.get(path) ?? ownerOf(dirname(path));
23
+ if (rootId)
24
+ rowsByRoot.get(rootId)?.push(row);
23
25
  }
24
26
  return rowsByRoot;
25
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ground-root-index.js","sourceRoot":"","sources":["../src/ground-root-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAO7C;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,KAAqC,EACrC,IAAkB;IAElB,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACpG,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAS,CAAC,C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K,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QACtC,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC5D,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IACF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACzD,IAAI,MAAM;YAAE,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { type CloudEntityRecord, type EntityType } from "@amalgm/live";
2
+ export interface GroundRow {
3
+ readonly resourceId: string;
4
+ readonly rootUUID: string;
5
+ readonly uuid: string;
6
+ readonly type: EntityType;
7
+ readonly parentUUID: string | null;
8
+ readonly name: string;
9
+ readonly status: CloudEntityRecord["status"];
10
+ readonly version: string;
11
+ readonly payloadVersion: string | null;
12
+ readonly transportVersion: string | null;
13
+ readonly relativePath: string;
14
+ readonly absolutePath: string;
15
+ /** Exact `device:inode` decimal (source-signature.ts). */
16
+ readonly physicalKey: string;
17
+ /** The exact stat this row was observed at; null is never unchanged. */
18
+ readonly sourceSignature: string | null;
19
+ /** The observed mode: kind and executable posture. */
20
+ readonly filesystemMode: number | null;
21
+ /** Exact nanosecond boundary of the last real content read, in decimal. */
22
+ readonly contentVerifiedNs: string | null;
23
+ /** Machine-local O only. Absence means no qualified repository observation;
24
+ * neither a B row nor imported cargo can establish this source fact. */
25
+ readonly gitConfigurationObservation?: string | null;
26
+ }
27
+ /** Local Record provenance belongs only to the admitted sharing baseline. */
28
+ /** Stored addresses are resolved absolute paths, so one lies at or beneath
29
+ * another exactly when it extends it at a separator; nothing is resolved. */
30
+ export declare const storedWithin: (top: string, address: string) => boolean;
31
+ export interface SharingGroundRow extends GroundRow {
32
+ readonly localAdmissionMutationId: string | null;
33
+ }
34
+ export declare const GROUND_ROW_PROJECTION: string;
35
+ export declare const SHARING_ROW_PROJECTION: string;
36
+ export declare const groundRowProjection: (inventory: "entities" | "detection_notebook") => string;
37
+ /** Every stored column of one inventory row, in its view's order; the order
38
+ * of `groundRowValues(row, inventory)`. */
39
+ export declare const inventoryColumns: (inventory: "entities" | "detection_notebook") => readonly string[];
40
+ /** Each inventory is a read-only view of its base table: a stored row is
41
+ * visible exactly when its generation is its root's visible generation. Only
42
+ * the schema owner and the ground writer name a base table. */
43
+ export declare const INVENTORY_ROWS: {
44
+ readonly entities: "entity_rows";
45
+ readonly detection_notebook: "notebook_rows";
46
+ };
47
+ /** Caller-only convenience fields are not part of the persisted row. */
48
+ export declare function groundRowSnapshot(row: GroundRow, inventory?: "entities" | "detection_notebook"): GroundRow;
49
+ /** Local ground ends at its materialization root: the root's portable parent
50
+ * may lie in a workspace this machine never materialized. */
51
+ export declare const localParentOf: (row: Pick<GroundRow, "uuid" | "rootUUID" | "parentUUID">) => string | null;
52
+ export declare function portableGroundRecord(row: GroundRow): CloudEntityRecord;
53
+ /** Active with no trashed or deleted ancestor up to its materialization root,
54
+ * each ancestor read from the row's own inventory through `lookup`. */
55
+ export declare const effectivelyActive: (row: GroundRow, lookup: (uuid: string) => GroundRow | undefined) => boolean;
56
+ /** The same answer by induction down a proved chain: beneath an effectively
57
+ * active parent, a row is effectively active exactly when it is itself active
58
+ * and that parent is its own. */
59
+ export declare const activeUnder: (row: GroundRow, parent: Pick<GroundRow, "uuid">) => boolean;
60
+ /** O and B read sets include their distinct local facts. An omitted inventory
61
+ * requests only common columns, used when writing B through its admission owner. */
62
+ export declare function groundRowValues(row: GroundRow, inventory?: "entities" | "detection_notebook"): readonly unknown[];
@@ -0,0 +1,70 @@
1
+ /** SQLite row codec shared by observation, sharing admission and verified Apply.
2
+ * Sharing rows and physical rows use the same identity vocabulary; using this
3
+ * codec never grants one inventory the meaning or ownership of the other. */
4
+ import { sep } from "node:path";
5
+ import { effectiveStatusOf, portableFileMode } from "@amalgm/live";
6
+ /** Local Record provenance belongs only to the admitted sharing baseline. */
7
+ /** Stored addresses are resolved absolute paths, so one lies at or beneath
8
+ * another exactly when it extends it at a separator; nothing is resolved. */
9
+ export const storedWithin = (top, address) => address.startsWith(top)
10
+ && (address.length === top.length || top.endsWith(sep) || address[top.length] === sep);
11
+ /** One field-to-column map owns SQL values, reads and detached row evidence. */
12
+ const fields = {
13
+ uuid: "uuid", resourceId: "resource_id", rootUUID: "root_uuid", type: "type",
14
+ parentUUID: "parent_uuid", name: "name", status: "status", version: "version",
15
+ payloadVersion: "payload_version", transportVersion: "transport_version",
16
+ relativePath: "relative_path", absolutePath: "absolute_path", physicalKey: "physical_key",
17
+ sourceSignature: "source_signature", filesystemMode: "filesystem_mode",
18
+ contentVerifiedNs: "content_verified_ns",
19
+ };
20
+ const keys = Object.keys(fields);
21
+ export const GROUND_ROW_PROJECTION = keys.map(key => `${fields[key]} AS ${key}`).join(", ");
22
+ export const SHARING_ROW_PROJECTION = `${GROUND_ROW_PROJECTION}, local_admission_mutation_id AS localAdmissionMutationId`;
23
+ export const groundRowProjection = (inventory) => inventory === "entities" ? `${GROUND_ROW_PROJECTION}, git_configuration_observation AS gitConfigurationObservation` : SHARING_ROW_PROJECTION;
24
+ /** Every stored column of one inventory row, in its view's order; the order
25
+ * of `groundRowValues(row, inventory)`. */
26
+ export const inventoryColumns = (inventory) => [...Object.values(fields), inventory === "entities" ? "git_configuration_observation" : "local_admission_mutation_id"];
27
+ /** Each inventory is a read-only view of its base table: a stored row is
28
+ * visible exactly when its generation is its root's visible generation. Only
29
+ * the schema owner and the ground writer name a base table. */
30
+ export const INVENTORY_ROWS = { entities: "entity_rows", detection_notebook: "notebook_rows" };
31
+ /** Caller-only convenience fields are not part of the persisted row. */
32
+ export function groundRowSnapshot(row, inventory = "entities") {
33
+ return Object.freeze({ ...Object.fromEntries(keys.map(key => [key, row[key]])),
34
+ ...(inventory === "entities" ? { gitConfigurationObservation: row.gitConfigurationObservation ?? null } : {
35
+ localAdmissionMutationId: row.localAdmissionMutationId ?? null,
36
+ }) });
37
+ }
38
+ /** Local ground ends at its materialization root: the root's portable parent
39
+ * may lie in a workspace this machine never materialized. */
40
+ export const localParentOf = (row) => row.uuid === row.rootUUID ? null : row.parentUUID;
41
+ export function portableGroundRecord(row) {
42
+ return {
43
+ uuid: row.uuid,
44
+ type: row.type,
45
+ parentUUID: row.parentUUID,
46
+ name: row.name,
47
+ status: row.status,
48
+ version: row.version,
49
+ payloadVersion: row.payloadVersion,
50
+ fileMode: portableFileMode(row.type, row.filesystemMode),
51
+ transportVersion: row.transportVersion,
52
+ };
53
+ }
54
+ /** Active with no trashed or deleted ancestor up to its materialization root,
55
+ * each ancestor read from the row's own inventory through `lookup`. */
56
+ export const effectivelyActive = (row, lookup) => effectiveStatusOf({ status: row.status, parentUuid: localParentOf(row) }, uuid => {
57
+ const parent = lookup(uuid);
58
+ return parent && { ...portableGroundRecord(parent), parentUuid: localParentOf(parent) };
59
+ }) === "active";
60
+ /** The same answer by induction down a proved chain: beneath an effectively
61
+ * active parent, a row is effectively active exactly when it is itself active
62
+ * and that parent is its own. */
63
+ export const activeUnder = (row, parent) => row.status === "active" && localParentOf(row) === parent.uuid;
64
+ /** O and B read sets include their distinct local facts. An omitted inventory
65
+ * requests only common columns, used when writing B through its admission owner. */
66
+ export function groundRowValues(row, inventory) {
67
+ return [...keys.map(key => row[key]), ...(inventory === "entities" ? [row.gitConfigurationObservation ?? null]
68
+ : inventory === "detection_notebook" ? [row.localAdmissionMutationId ?? null] : [])];
69
+ }
70
+ //# sourceMappingURL=ground-row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ground-row.js","sourceRoot":"","sources":["../src/ground-row.ts"],"names":[],"mappings":"AAAA;;6EAE6E;AAC7E,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAA2C,MAAM,cAAc,CAAC;AA4B5G,6EAA6E;AAC7E;6EAC6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,OAAe,EAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;OACzF,CAAC,OAAO,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;AAOzF,gFAAgF;AAChF,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAC5E,UAAU,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS;IAC7E,cAAc,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,mBAAmB;IACxE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc;IACzF,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB;IACtE,iBAAiB,EAAE,qBAAqB;CACyC,CAAC;AACpF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAA4B,CAAC;AAC5D,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,GAA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