@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,205 @@
1
+ /** A framed repository examined around its held ground. Watch's names and
2
+ * Git's own answers choose the examined rows: every row on the way to a name,
3
+ * and every row at or beneath one. Every other row is held: it stands exactly
4
+ * as O and B hold it, answers each question the complete examination would
5
+ * ask of it by index, and is never read, framed or rebuilt.
6
+ *
7
+ * Holding is exact only under the preconditions the host proves; any doubt
8
+ * is HoldRefused, and the complete examination answers instead. The views
9
+ * answer here without protecting what they return, since the territory basis
10
+ * consumes both whole; a row the examination writes is read through `row`. */
11
+ import { sep } from "node:path";
12
+ import { eachStep } from "@amalgm/live";
13
+ import { contentProven } from "../source-signature.js";
14
+ /** The held form cannot answer exactly; the complete form answers instead. */
15
+ export class HoldRefused extends Error {
16
+ reason;
17
+ constructor(reason) {
18
+ super(`held examination refused: ${reason}`);
19
+ this.reason = reason;
20
+ }
21
+ }
22
+ export class HeldTerritory {
23
+ #views;
24
+ #rootAddress;
25
+ #rootPrefix;
26
+ #frames = new Map();
27
+ #examined = { o: new Set(), b: new Set() };
28
+ #consumed = { o: [], b: [] };
29
+ #beneath = new Map();
30
+ #members = null;
31
+ constructor(o, b, rootAddress) {
32
+ this.#views = { o, b };
33
+ this.#rootAddress = rootAddress;
34
+ this.#rootPrefix = rootAddress.endsWith(sep) ? rootAddress : `${rootAddress}${sep}`;
35
+ }
36
+ /** O's members whose payload names a Git index object. */
37
+ get indexed() { return this.#views.o.indexed; }
38
+ /** O's row at this path of the examined root, as stored. */
39
+ at(path) { return this.#views.o.peekAt(this.#address(path))[0]; }
40
+ /** Both inventories' examined rows, read and framed, ordered by UUID. An
41
+ * identity examined in one inventory and held in the other would be
42
+ * decided twice; that is refused. */
43
+ examine(suspects) {
44
+ const o = this.#touching("o", suspects), b = this.#touching("b", suspects);
45
+ for (const [mine, theirs, other] of [[o, b, "b"], [b, o, "o"]]) {
46
+ for (const uuid of mine)
47
+ if (!theirs.has(uuid) && this.#views[other].has(uuid))
48
+ throw new HoldRefused("straddles");
49
+ }
50
+ this.#examined.o = o;
51
+ this.#examined.b = b;
52
+ return { o: this.#read("o", o), b: this.#read("b", b) };
53
+ }
54
+ /** O as the identity resolver asks about it, in the examined root's frame. */
55
+ get prior() {
56
+ const o = this.#views.o;
57
+ return {
58
+ at: path => { const row = o.peekAt(this.#address(path))[0]; return row && this.#framed(row); },
59
+ child: (parentUUID, name) => { const row = o.peekSlot(parentUUID, name)[0]; return row && this.#framed(row); },
60
+ withPhysical: key => o.peekPhysical(key).map(row => this.#framed(row)),
61
+ childCount: uuid => o.childCount(uuid),
62
+ };
63
+ }
64
+ /** Held graph rows directly beneath each examined container that has any,
65
+ * by the container's UUID, framed. B's retired history, the rows only B
66
+ * holds, is no graph row. */
67
+ *beneath(inventory) {
68
+ let held = this.#beneath.get(inventory);
69
+ if (!held) {
70
+ const view = this.#views[inventory], examined = this.#examined[inventory], found = new Map();
71
+ const o = this.#views.o;
72
+ const containers = [];
73
+ yield* eachStep(examined, uuid => { if (view.childCount(uuid) !== 0)
74
+ containers.push(uuid); });
75
+ yield* eachStep(childrenOf(view, containers), ([uuid, row]) => {
76
+ if (examined.has(row.uuid) || !o.has(row.uuid))
77
+ return;
78
+ const children = found.get(uuid);
79
+ if (children)
80
+ children.push(this.#framed(row));
81
+ else
82
+ found.set(uuid, [this.#framed(row)]);
83
+ });
84
+ this.#beneath.set(inventory, held = found);
85
+ }
86
+ return held;
87
+ }
88
+ /** Examined O containers with held rows beneath them, framed. */
89
+ *parents() {
90
+ const parents = [];
91
+ yield* eachStep((yield* this.beneath("o")).keys(), uuid => parents.push(this.#framed(this.#views.o.peek(uuid))));
92
+ return parents;
93
+ }
94
+ /** Every held member of the repository by its path in the examined
95
+ * root's frame, as the repository's identity reads it. */
96
+ *members() {
97
+ if (!this.#members) {
98
+ const o = this.#views.o, examined = this.#examined.o, members = new Map();
99
+ yield* eachStep(o.peekRows(), row => {
100
+ if (examined.has(row.uuid))
101
+ return;
102
+ const relativePath = this.#path(row);
103
+ members.set(relativePath, { uuid: row.uuid, type: row.type, relativePath,
104
+ filesystemMode: row.filesystemMode, payloadVersion: row.payloadVersion });
105
+ });
106
+ this.#members = members;
107
+ }
108
+ return this.#members;
109
+ }
110
+ /** A held leaf the repository's own read found at this fingerprint. While
111
+ * O still holds it as proven content, it stays held, and so does B's: the
112
+ * views agree, so B holds O's fingerprint and either O's boundary or one
113
+ * proven for O's signature. Else both rows are read and O's, framed,
114
+ * re-enters as observed. */
115
+ promoted(uuid, fingerprint) {
116
+ const { o, b } = this.#views, held = o.peek(uuid);
117
+ if (held && held.physicalKey === fingerprint.physicalKey && held.sourceSignature === fingerprint.sourceSignature
118
+ && held.filesystemMode === fingerprint.filesystemMode
119
+ && contentProven(fingerprint.sourceSignature, held.contentVerifiedNs))
120
+ return null;
121
+ const observed = o.row(uuid), shared = b.row(uuid);
122
+ // B holds S(O) for every held row; a row only O holds is no held row.
123
+ if (!shared)
124
+ throw new HoldRefused("unshared");
125
+ this.#consumed.o.push(observed);
126
+ this.#consumed.b.push(shared);
127
+ return this.#framed(observed);
128
+ }
129
+ /** The rows this examination read, as stored: its S0 context. */
130
+ consumed() {
131
+ return { entities: this.#consumed.o, detection_notebook: this.#consumed.b };
132
+ }
133
+ #address(path) {
134
+ return path ? this.#rootPrefix + (sep === "/" ? path : path.replaceAll("/", sep)) : this.#rootAddress;
135
+ }
136
+ #path(row) {
137
+ if (row.absolutePath === this.#rootAddress)
138
+ return "";
139
+ const path = row.absolutePath.slice(this.#rootPrefix.length);
140
+ return sep === "/" ? path : path.split(sep).join("/");
141
+ }
142
+ #framed(row) {
143
+ let framed = this.#frames.get(row);
144
+ if (!framed) {
145
+ const relativePath = this.#path(row);
146
+ this.#frames.set(row, framed = relativePath === row.relativePath ? row : { ...row, relativePath });
147
+ }
148
+ return framed;
149
+ }
150
+ /** The top, every row on the way to a name, every row at or beneath one,
151
+ * and every ancestor of each. O is consistent and B holds each of O's rows
152
+ * where O does, so every active row stands at its parent's address plus
153
+ * its name, and the rows a name touches are the ones its address and its
154
+ * ancestors' addresses reach. Only B's retired history may share an
155
+ * address or stand elsewhere; the complete examination retains it
156
+ * untouched, so reaching it is never required, and its ancestors come by
157
+ * parent. A name for the root itself touches only the top. */
158
+ #touching(inventory, suspects) {
159
+ const view = this.#views[inventory];
160
+ const touched = new Set([view.uuid]), descended = new Set();
161
+ const touch = (row) => {
162
+ for (; row && !touched.has(row.uuid); row = row.parentUUID === null ? undefined : view.peek(row.parentUUID)) {
163
+ touched.add(row.uuid);
164
+ }
165
+ };
166
+ for (const suspect of suspects) {
167
+ if (suspect === "")
168
+ continue;
169
+ let reached = true;
170
+ for (let end = suspect.indexOf("/"); end !== -1 && reached; end = suspect.indexOf("/", end + 1)) {
171
+ const rows = view.peekAt(this.#address(suspect.slice(0, end)));
172
+ rows.forEach(touch);
173
+ reached = rows.length > 0;
174
+ }
175
+ const stack = reached ? [...view.peekAt(this.#address(suspect))] : [];
176
+ stack.forEach(touch);
177
+ while (stack.length) {
178
+ const row = stack.pop();
179
+ touched.add(row.uuid);
180
+ if (descended.has(row.uuid))
181
+ continue;
182
+ descended.add(row.uuid);
183
+ if (view.childCount(row.uuid))
184
+ for (const child of view.peekChildren(row.uuid))
185
+ stack.push(child);
186
+ }
187
+ }
188
+ return touched;
189
+ }
190
+ #read(inventory, uuids) {
191
+ const view = this.#views[inventory], consumed = this.#consumed[inventory];
192
+ return [...uuids].sort().map(uuid => {
193
+ const row = view.row(uuid);
194
+ consumed.push(row);
195
+ return this.#framed(row);
196
+ });
197
+ }
198
+ }
199
+ /** Each child of each container, in container order: one item per child. */
200
+ function* childrenOf(view, containers) {
201
+ for (const uuid of containers)
202
+ for (const row of view.peekChildren(uuid))
203
+ yield [uuid, row];
204
+ }
205
+ //# sourceMappingURL=held-territory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"held-territory.js","sourceRoot":"","sources":["../../src/detection/held-territory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;8EAS8E;AAC9E,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAwC,MAAM,cAAc,CAAC;AAG9E,OAAO,EAAE,aAAa,EAA0B,MAAM,wBAAwB,CAAC;AAG/E,8EAA8E;AAC9E,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,MAAM,CAAS;IACxB,YAAY,MAAc;QACxB,KAAK,CAAC,6BAA6B,MAAM,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAOD,MAAM,OAAO,aAAa;IACf,MAAM,CAA+C;IACrD,YAAY,CAAS;IACrB,WAAW,CAAS;IACpB,OAAO,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC1C,SAAS,GAA2C,EAAE,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IACnF,SAAS,GAAmC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IAC7D,QAAQ,GAAG,IAAI,GAAG,EAAwD,CAAC;IACpF,QAAQ,GAA0C,IAAI,CAAC;IAEvD,YAAY,CAAkB,EAAE,CAAkB,EAAE,WAAmB;QACrE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,GAAG,GAAG,EAAE,C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AAC,MAAM,CAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC1E,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAClC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;YAC5B,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACnB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,4EAA4E;AAC5E,QAAQ,CAAC,CAAC,UAAU,CAAC,IAAqB,EAAE,UAA6B;IACvE,KAAK,MAAM,IAAI,IAAI,UAAU;QAAE,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;YAAE,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC9F,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { type ContentBoundary } from "../content-clock.js";
2
+ export interface IdentityDiscovery {
3
+ readonly database: string;
4
+ /** The root the identities may stand in. */
5
+ readonly rootUUID: string;
6
+ readonly rootPath: string;
7
+ /** The root's content-clock stamp, taken before this discovery's reads. */
8
+ readonly boundary: ContentBoundary | null;
9
+ /** The identities sought, as `device:inode`. */
10
+ readonly keys: readonly string[];
11
+ /** Their rows, whose Apply owners make the answer a gap. */
12
+ readonly uuids: readonly string[];
13
+ }
14
+ export interface DiscoveryStats {
15
+ readonly attempts: number;
16
+ readonly directories: number;
17
+ readonly reused: number;
18
+ readonly listed: number;
19
+ /** Entries stat'ed while listing. */
20
+ readonly entries: number;
21
+ readonly sqlMs: number;
22
+ readonly passAMs: number;
23
+ readonly passBMs: number;
24
+ }
25
+ export type IdentityDiscoveryResult = {
26
+ readonly kind: "closed";
27
+ readonly found: readonly {
28
+ readonly key: string;
29
+ readonly absolutePath: string;
30
+ }[];
31
+ readonly stats: DiscoveryStats;
32
+ } | {
33
+ readonly kind: "gap";
34
+ readonly reason: string;
35
+ readonly stats: DiscoveryStats;
36
+ }
37
+ /** The namespace held still, but a listing in it was racy: after retryMs a
38
+ * later stamp and a fresh discovery can close it. */
39
+ | {
40
+ readonly kind: "racy";
41
+ readonly directory: string;
42
+ readonly retryMs: number;
43
+ readonly stats: DiscoveryStats;
44
+ };
45
+ export declare function discoverIdentities(job: IdentityDiscovery): IdentityDiscoveryResult;
@@ -0,0 +1,287 @@
1
+ /** Identity discovery: where in one root's ground some physical identities
2
+ * stand now. An identity a pass no longer finds where it read may have moved
3
+ * elsewhere in its root. Identity continuity is root-local, so its absence is
4
+ * witnessed by its own root's whole namespace, never another root's; leaving
5
+ * the root is that root's disappearance. The namespace is read here on a
6
+ * content thread: names and objects, never contents or Git. What it finds the
7
+ * caller compares with what its pass observed; it concludes nothing.
8
+ *
9
+ * The namespace closes at one instant. Pass A lists every directory from the
10
+ * root down, following what it finds, and keeps the signature each directory
11
+ * had before its listing. Pass B re-stats every directory Pass A listed, and
12
+ * each must still carry exactly that signature. A name added, removed or
13
+ * renamed in a directory moves the directory's times, so every listing held
14
+ * from its A to its B, and all of them at one instant between the passes. A
15
+ * change during either pass fails the attempt; the next attempt reads again.
16
+ * That rests on each listing's qualification below; a listing no stamp can
17
+ * qualify is instead listed again in Pass B, once its whole Pass A is read,
18
+ * and must name the same entries on both sides of a held signature: the
19
+ * closure ground-proof.ts gives a walk, with its one residual race.
20
+ *
21
+ * A qualified listing is retained for the root's next discovery and reused,
22
+ * without listing again, while its directory still carries the signature it
23
+ * was listed under. Qualified is content-clock.ts's listing rule: the
24
+ * directory's times precede the boundary of the root's stamp taken before
25
+ * that listing, on the same device, so any later change carries a later time
26
+ * and an equal signature is an equal listing. A racy listing, one whose times
27
+ * do not precede it, closes nothing: the discovery answers racy, with how
28
+ * long its caller waits before a later stamp and a fresh listing can close,
29
+ * and never retains it, however old it later looks. A directory's own
30
+ * identity always comes from its own fresh stat, which a mount changes; a
31
+ * leaf's comes from its parent's listing, which its parent's signature covers.
32
+ *
33
+ * Only a root whose filesystem ground-profile.ts trusts has a stamp, and only
34
+ * its own device's listings qualify under it: a mount's objects answer to
35
+ * another filesystem's clock. Neither kind of listing is retained, since no
36
+ * later signature can stand for it. A mount made over an entry a retained
37
+ * listing holds moves no time, and is outside every profile.
38
+ *
39
+ * Ground Apply holds, ground it cannot read, a replaced root, or a namespace
40
+ * that will not hold still is a gap, never an answer. */
41
+ import { lstatSync, readdirSync } from "node:fs";
42
+ import { join } from "node:path";
43
+ import { AMALGM_CONTROL_DIRECTORY } from "@amalgm/live";
44
+ import { listingQualification, listingWaitMs } from "../content-clock.js";
45
+ import { gitMarker, marksRepository } from "../git-repository-host.js";
46
+ import { groundProfile } from "../ground-profile.js";
47
+ import { physicalKey, sourceSignature } from "../source-signature.js";
48
+ import { ApplyOwnershipSnapshot, ownedObject, sqliteApplyOwnership } from "./apply-ownership.js";
49
+ import { threadDatabase } from "./thread-database.js";
50
+ import { vanished, walkSkips } from "./walk-law.js";
51
+ /** The same entries and leaf identities, in whatever order each was read. */
52
+ function sameListing(a, b) {
53
+ if (a.size !== b.size || a.directories.length !== b.directories.length || a.leaves.length !== b.leaves.length)
54
+ return false;
55
+ const directories = new Set(a.directories), leaves = new Map(a.leaves.map((name, index) => [name, a.leafKeys[index]]));
56
+ return b.directories.every(name => directories.has(name))
57
+ && b.leaves.every((name, index) => leaves.get(name) === b.leafKeys[index]);
58
+ }
59
+ /** Attempts before a namespace that will not hold still is a gap. */
60
+ const ATTEMPTS = 3;
61
+ /** Entries retained across every root's discoveries, oldest root dropped first. */
62
+ const RETAINED_ENTRIES = 1_000_000;
63
+ const retained = new Map();
64
+ let retainedEntries = 0;
65
+ function retain(rootPath, entry) {
66
+ const prior = retained.get(rootPath);
67
+ if (prior) {
68
+ retainedEntries -= prior.size;
69
+ retained.delete(rootPath);
70
+ }
71
+ if (entry.size > RETAINED_ENTRIES)
72
+ return;
73
+ retained.set(rootPath, entry);
74
+ retainedEntries += entry.size;
75
+ for (const [path, oldest] of retained) {
76
+ if (retainedEntries <= RETAINED_ENTRIES)
77
+ break;
78
+ retained.delete(path);
79
+ retainedEntries -= oldest.size;
80
+ }
81
+ }
82
+ /** Why an attempt ended: the namespace moved under it, or cannot be read. */
83
+ class Unsettled {
84
+ reason;
85
+ retry;
86
+ constructor(reason, retry) {
87
+ this.reason = reason;
88
+ this.retry = retry;
89
+ }
90
+ }
91
+ const unsettled = (error, path) => {
92
+ if (vanished(error))
93
+ return new Unsettled("moved", true);
94
+ const code = error?.code;
95
+ if (code === "EACCES" || code === "EPERM")
96
+ return new Unsettled(`unread:${path}`, false);
97
+ throw error;
98
+ };
99
+ /** List one directory as the walk law sees it: its control tree and, in a
100
+ * repository, its `.git` are never ground. The root keeps its own type. */
101
+ function list(directory, own, rootType) {
102
+ let names;
103
+ try {
104
+ names = readdirSync(directory);
105
+ }
106
+ catch (error) {
107
+ throw unsettled(error, directory);
108
+ }
109
+ const children = [];
110
+ for (const name of names) {
111
+ if (name === AMALGM_CONTROL_DIRECTORY)
112
+ continue;
113
+ const path = join(directory, name);
114
+ let stats;
115
+ try {
116
+ stats = lstatSync(path, { bigint: true });
117
+ }
118
+ catch (error) {
119
+ throw unsettled(error, path);
120
+ }
121
+ children.push([name, stats]);
122
+ }
123
+ const marker = children.find(([name]) => name === ".git")?.[1];
124
+ const type = (rootType ?? (marksRepository(marker ? gitMarker(marker) : null) ? "repo.git" : "folder"));
125
+ const directories = [], leaves = [], leafKeys = [];
126
+ for (const [name, stats] of children) {
127
+ if (walkSkips(type, name))
128
+ continue;
129
+ if (stats.isDirectory())
130
+ directories.push(name);
131
+ else {
132
+ leaves.push(name);
133
+ leafKeys.push(physicalKey(stats));
134
+ }
135
+ }
136
+ return { signature: sourceSignature(own), directories, leaves, leafKeys, size: children.length + 1 };
137
+ }
138
+ export function discoverIdentities(job) {
139
+ const stats = { attempts: 0, directories: 0, reused: 0, listed: 0, entries: 0, sqlMs: 0, passAMs: 0, passBMs: 0 };
140
+ const gap = (reason) => ({ kind: "gap", reason, stats });
141
+ let at = performance.now();
142
+ const lap = (leg) => {
143
+ const now = performance.now();
144
+ stats[leg] += now - at;
145
+ at = now;
146
+ };
147
+ const { rootPath } = job;
148
+ let profile;
149
+ try {
150
+ profile = groundProfile(rootPath);
151
+ }
152
+ catch (error) {
153
+ return gap(unsettled(error, rootPath).reason);
154
+ }
155
+ // A profile no longer trusted qualifies nothing, whatever its stamp said.
156
+ const boundary = profile.marginNs === null ? null : job.boundary;
157
+ const database = threadDatabase(job.database);
158
+ const read = database.transaction(() => {
159
+ const ownership = new ApplyOwnershipSnapshot(sqliteApplyOwnership(database));
160
+ const owners = ownership.use({ subtrees: [rootPath], uuids: new Set(job.uuids),
161
+ physical: new Set(job.keys.map(key => ownedObject(rootPath, key))) });
162
+ const incarnation = database.prepare("SELECT identity FROM ground_incarnation WHERE singleton = 1").pluck().get();
163
+ return { row: database.prepare(`SELECT type, physical_key AS physicalKey FROM entities
164
+ WHERE uuid = ? AND root_uuid = ? AND relative_path = '' AND status = 'active'`).get(job.rootUUID, job.rootUUID), owned: owners.length > 0, incarnation: String(incarnation) };
165
+ })();
166
+ lap("sqlMs");
167
+ if (read.owned)
168
+ return gap("apply-owner");
169
+ const { row } = read;
170
+ if (!row)
171
+ return gap(`no-root-row:${rootPath}`);
172
+ const ground = `${read.incarnation}\0${profile.id}\0${job.rootUUID}\0${row.type}\0${row.physicalKey}`;
173
+ let prior = boundary === null ? undefined : retained.get(rootPath);
174
+ // A boundary behind the one a listing qualified under is another clock.
175
+ if (prior && (prior.ground !== ground || prior.boundary.dev !== boundary.dev
176
+ || BigInt(boundary.ns) < BigInt(prior.boundary.ns)))
177
+ prior = undefined;
178
+ const keys = new Set(job.keys);
179
+ let visited = new Map();
180
+ let listed = new Map();
181
+ let outcome = null;
182
+ while (outcome === null && stats.attempts < ATTEMPTS) {
183
+ stats.attempts++;
184
+ visited = new Map();
185
+ const unqualified = new Set();
186
+ const found = [];
187
+ let racy = null;
188
+ try {
189
+ // Pass A.
190
+ const pending = [rootPath];
191
+ while (pending.length) {
192
+ const directory = pending.pop();
193
+ let current;
194
+ try {
195
+ current = lstatSync(directory, { bigint: true });
196
+ }
197
+ catch (error) {
198
+ throw unsettled(error, directory);
199
+ }
200
+ if (!current.isDirectory())
201
+ throw new Unsettled("moved", true);
202
+ const key = physicalKey(current);
203
+ if (directory === rootPath) {
204
+ if (key !== row.physicalKey)
205
+ return gap(`root-replaced:${directory}`);
206
+ }
207
+ else if (keys.has(key))
208
+ found.push({ key, absolutePath: directory });
209
+ const signature = sourceSignature(current);
210
+ let listing = listed.get(directory) ?? prior?.listings.get(directory);
211
+ if (listing?.signature === signature)
212
+ stats.reused++;
213
+ else {
214
+ listing = list(directory, current, directory === rootPath ? row.type : null);
215
+ stats.listed++;
216
+ stats.entries += listing.size - 1;
217
+ const qualification = listingQualification(boundary, current);
218
+ if (qualification === "qualified")
219
+ listed.set(directory, listing);
220
+ else if (qualification === "unqualified")
221
+ unqualified.add(directory);
222
+ else {
223
+ const retryMs = listingWaitMs(boundary, current);
224
+ if (racy === null || retryMs > racy.retryMs)
225
+ racy = { directory, retryMs };
226
+ }
227
+ }
228
+ visited.set(directory, listing);
229
+ for (let index = 0; index < listing.leafKeys.length; index++) {
230
+ const leafKey = listing.leafKeys[index];
231
+ if (keys.has(leafKey))
232
+ found.push({ key: leafKey, absolutePath: join(directory, listing.leaves[index]) });
233
+ }
234
+ for (const name of listing.directories)
235
+ pending.push(join(directory, name));
236
+ }
237
+ lap("passAMs");
238
+ // Pass B: every listing still stands under the signature it was read
239
+ // under, and one no stamp qualifies lists again as it did.
240
+ const holds = (directory, listing) => {
241
+ let current;
242
+ try {
243
+ current = lstatSync(directory, { bigint: true });
244
+ }
245
+ catch (error) {
246
+ throw unsettled(error, directory);
247
+ }
248
+ if (sourceSignature(current) !== listing.signature)
249
+ throw new Unsettled("moved", true);
250
+ return current;
251
+ };
252
+ for (const [directory, listing] of visited) {
253
+ const current = holds(directory, listing);
254
+ if (!unqualified.has(directory))
255
+ continue;
256
+ if (!sameListing(list(directory, current, directory === rootPath ? row.type : null), listing)) {
257
+ throw new Unsettled("moved", true);
258
+ }
259
+ holds(directory, listing);
260
+ }
261
+ lap("passBMs");
262
+ outcome = racy ? { kind: "racy", ...racy, stats } : { kind: "closed", found, stats };
263
+ }
264
+ catch (error) {
265
+ if (!(error instanceof Unsettled))
266
+ throw error;
267
+ lap("passAMs");
268
+ if (!error.retry)
269
+ outcome = gap(error.reason);
270
+ }
271
+ }
272
+ stats.directories = visited.size;
273
+ // Only this run's qualified listings are retained; what it no longer
274
+ // reached is gone from the namespace.
275
+ const listings = new Map();
276
+ let size = 0;
277
+ for (const [directory, listing] of visited) {
278
+ if (listed.get(directory) !== listing && prior?.listings.get(directory) !== listing)
279
+ continue;
280
+ listings.set(directory, listing);
281
+ size += listing.size;
282
+ }
283
+ if (boundary !== null)
284
+ retain(rootPath, { ground, boundary, listings, size });
285
+ return outcome ?? gap("unsettled");
286
+ }
287
+ //# sourceMappingURL=identity-discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-discovery.js","sourceRoot":"","sources":["../../src/detection/identity-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yDAuCyD;AACzD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAoB,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAmB,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAwB,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAsB,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,WAAW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