@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,217 @@
1
+ /** One value-bearing configuration observation supplies both Card remotes and
2
+ * the machine-local certificate attached to its actual observed result. */
3
+ import { createHash } from "node:crypto";
4
+ import { readFileSync, realpathSync, statSync } from "node:fs";
5
+ import { dirname, join, resolve } from "node:path";
6
+ import { refusal } from "@amalgm/live";
7
+ import { CaptureSourceChangedError } from "./content-cache-host.js";
8
+ import { externalGitStorage, gitCommonDirectory, gitStorageDirectory } from "./git-binding.js";
9
+ import { gitHost, runGit } from "./git-command.js";
10
+ import { readThroughAddresses } from "./sync-address.js";
11
+ const digest = (bytes) => createHash("sha256").update(bytes).digest("hex");
12
+ const missing = (error) => ["ENOENT", "ENOTDIR"].includes(error.code ?? "");
13
+ function configurationEntries(bytes) {
14
+ if (bytes.length === 0)
15
+ return [];
16
+ const text = bytes.toString("utf8");
17
+ if (bytes.at(-1) !== 0 || !Buffer.from(text).equals(bytes))
18
+ throw new Error("invalid native Git configuration framing");
19
+ const fields = text.split("\0");
20
+ fields.pop();
21
+ if (fields.length % 3 !== 0)
22
+ throw new Error("invalid native Git configuration framing");
23
+ const entries = [];
24
+ for (let i = 0; i < fields.length; i += 3) {
25
+ if (!fields[i] || !fields[i + 1])
26
+ throw new Error("invalid native Git configuration origin");
27
+ const entry = fields[i + 2], separator = entry.indexOf("\n");
28
+ const key = separator < 0 ? entry : entry.slice(0, separator);
29
+ if (!key)
30
+ throw new Error("invalid native Git configuration key");
31
+ entries.push({ origin: fields[i + 1], key, value: separator < 0 ? "" : entry.slice(separator + 1) });
32
+ }
33
+ return entries;
34
+ }
35
+ function remotesFromEntries(entries) {
36
+ return Object.freeze(entries.flatMap(({ key, value }) => {
37
+ const match = /^remote\.(.+)\.url$/.exec(key);
38
+ return match ? [Object.freeze({ name: match[1], url: value })] : [];
39
+ }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
40
+ }
41
+ export function configurationRemotes(bytes) {
42
+ return remotesFromEntries(configurationEntries(bytes));
43
+ }
44
+ /** Git opens configuration by lexical path, so beneath the host's fixed scope
45
+ * its answer is decided by the bytes at each path it consults, absence and
46
+ * emptiness included, and by where that path really lies: a relative
47
+ * `gitdir:` condition matches against its including file's real directory. */
48
+ function sourceWitness(path) {
49
+ let stat, real;
50
+ try {
51
+ stat = statSync(path);
52
+ real = realpathSync(path);
53
+ }
54
+ catch (error) {
55
+ if (missing(error))
56
+ return "absent";
57
+ throw error;
58
+ }
59
+ if (!stat.isFile())
60
+ return JSON.stringify([real, `kind:${stat.mode & 0o170000}`]);
61
+ try {
62
+ return JSON.stringify([real, digest(readFileSync(path))]);
63
+ }
64
+ catch (error) {
65
+ if (missing(error) || error.code === "EISDIR") {
66
+ throw new CaptureSourceChangedError(`Git configuration source changed while read: ${path}`, { cause: error });
67
+ }
68
+ throw error;
69
+ }
70
+ }
71
+ /** A branch condition reads the checked-out branch's name: HEAD and each
72
+ * symbolic ref it follows, to Git's symref depth. A packed ref is never
73
+ * symbolic, so a missing or direct loose ref ends the chain; commits that
74
+ * move a branch leave its name, and this witness, unchanged. */
75
+ const SYMREF_DEPTH = 5;
76
+ const perWorktreeRef = (name) => name === "HEAD"
77
+ || ["refs/worktree/", "refs/bisect/", "refs/rewritten/"].some(prefix => name.startsWith(prefix));
78
+ function branchChain(gitDir) {
79
+ const common = gitCommonDirectory(gitDir);
80
+ const names = [], paths = [];
81
+ for (let name = "HEAD", depth = 0; depth <= SYMREF_DEPTH; depth += 1) {
82
+ const path = join(perWorktreeRef(name) ? gitDir : common, name);
83
+ paths.push(path);
84
+ let text;
85
+ try {
86
+ text = readFileSync(path, "utf8");
87
+ }
88
+ catch (error) {
89
+ if (missing(error) || error.code === "EISDIR")
90
+ break;
91
+ throw error;
92
+ }
93
+ const target = /^ref:\s*(\S+)\s*$/.exec(text)?.[1];
94
+ if (!target)
95
+ break;
96
+ names.push(target);
97
+ name = target;
98
+ }
99
+ return { names, paths };
100
+ }
101
+ /** Sources Git consults whether or not they contribute: the storage route
102
+ * (marker and commondir) and the local and worktree defaults. */
103
+ function defaultSources(repository) {
104
+ let gitDir;
105
+ try {
106
+ gitDir = gitStorageDirectory(repository).directory;
107
+ }
108
+ catch (error) {
109
+ if (missing(error))
110
+ throw new CaptureSourceChangedError("repository marker disappeared", { cause: error });
111
+ throw error;
112
+ }
113
+ return { gitDir, paths: [join(repository, ".git"), join(gitDir, "commondir"),
114
+ join(gitCommonDirectory(gitDir), "config"), join(gitDir, "config.worktree")] };
115
+ }
116
+ /** Git resolves a relative include against its including file's directory. */
117
+ function includeTarget(including, value) {
118
+ if (value.startsWith("~/")) {
119
+ const home = gitHost().environment.HOME;
120
+ if (!home)
121
+ throw new Error(`Git configuration include needs HOME: ${value}`);
122
+ return resolve(home, value.slice(2));
123
+ }
124
+ // Git expands these against another user's home or its install prefix;
125
+ // Amalgm cannot witness that source, so it declines the repository.
126
+ if (value.startsWith("~") || value.startsWith("%(prefix)/")) {
127
+ throw refusal(`unsupported Git configuration include path: ${value}`);
128
+ }
129
+ return resolve(dirname(including), value);
130
+ }
131
+ /** Sources a read names: every contributing file and every include target,
132
+ * missing ones included. A conditional include's branch input is the
133
+ * separate branch-chain witness. */
134
+ function namedSources(repository, entries) {
135
+ const paths = [];
136
+ for (const { origin, key, value } of entries) {
137
+ if (origin === "command line:")
138
+ continue; // the host's fixed scope
139
+ if (!origin.startsWith("file:"))
140
+ throw new Error(`unexpected Git configuration origin: ${origin}`);
141
+ const file = resolve(repository, origin.slice("file:".length));
142
+ paths.push(file);
143
+ if (key === "include.path" || /^includeif\..*\.path$/.test(key))
144
+ paths.push(includeTarget(file, value));
145
+ }
146
+ return paths;
147
+ }
148
+ /** Conditions whose inputs these witnesses close: the storage route (held by
149
+ * the binding's association) and the branch chain. `hasconfig:` looks ahead
150
+ * through every include, so its answer is never reused from witnesses. */
151
+ const witnessedCondition = (key) => !key.startsWith("includeif.")
152
+ || /^includeif\.(gitdir|gitdir\/i|onbranch):/.test(key);
153
+ const sourcesUnchanged = ({ sources, branch }) => sources.every(([path, before]) => sourceWitness(path) === before)
154
+ && (branch === null || JSON.stringify(branchChain(branch.gitDir).names) === branch.names);
155
+ export function judgeGitConfiguration(witness) {
156
+ if (!sourcesUnchanged(witness)) {
157
+ throw new CaptureSourceChangedError("repository Git configuration source changed after observation");
158
+ }
159
+ }
160
+ export async function observeGitConfiguration(repository) {
161
+ const read = (closing) => runGit(repository, ["config", "--null", "--list", "--includes", "--show-origin", "--show-scope"], { purpose: "configuration", closing });
162
+ const { gitDir, paths } = defaultSources(repository);
163
+ const sources = new Map();
164
+ const remember = (candidates) => {
165
+ for (const path of candidates)
166
+ if (!sources.has(path))
167
+ sources.set(path, sourceWitness(path));
168
+ };
169
+ // Every witness precedes the read that depends on it; the branch chain is
170
+ // compared only once a conditional include makes it an input.
171
+ const branch = branchChain(gitDir), branchNames = JSON.stringify(branch.names);
172
+ let conditional = false;
173
+ const witnessed = () => ({ sources: [...sources],
174
+ branch: conditional ? { gitDir, names: branchNames } : null });
175
+ const unchanged = () => sourcesUnchanged(witnessed());
176
+ remember(paths);
177
+ // One read names every source it followed; a second read covers sources the
178
+ // first discovered. Discovery after that means the sources moved while read.
179
+ let bytes, entries;
180
+ for (let reads = 1;; reads += 1) {
181
+ bytes = await read(false);
182
+ entries = configurationEntries(bytes);
183
+ conditional = entries.some(entry => entry.key.startsWith("includeif."));
184
+ if (!unchanged())
185
+ throw new CaptureSourceChangedError("repository Git configuration changed during observation");
186
+ const known = sources.size;
187
+ remember(namedSources(repository, entries));
188
+ if (sources.size === known)
189
+ break;
190
+ if (reads === 2)
191
+ throw new CaptureSourceChangedError("repository Git configuration sources changed during observation");
192
+ }
193
+ const configuration = digest(bytes), size = bytes.length, remotes = remotesFromEntries(entries);
194
+ const keys = new Set(entries.map(entry => entry.key));
195
+ const fingerprint = digest(JSON.stringify(["amalgm.git-configuration@2", gitHost().key, size, configuration]));
196
+ const semantic = async () => {
197
+ if (digest(await read(true)) !== configuration) {
198
+ throw new CaptureSourceChangedError("repository Git configuration changed after observation");
199
+ }
200
+ };
201
+ const witness = Object.freeze({ kind: "git-configuration", ...witnessed() });
202
+ return Object.freeze({ remotes, semantic, witnesses: Object.freeze([witness]), fingerprint,
203
+ sources: Object.freeze([...sources.keys(), ...(conditional ? branch.paths : [])]),
204
+ reusable: [...keys].every(witnessedCondition),
205
+ has: (key) => keys.has(key),
206
+ stamp: (uuid, payloadVersion, binding) => digest(JSON.stringify(["amalgm.git-configuration-observation@1", uuid, payloadVersion, binding, fingerprint])),
207
+ });
208
+ }
209
+ /** Ground a repository reader depends on beyond its checkout: external Git
210
+ * storage and every configuration source, include targets included, each at
211
+ * its synchronization address (a source read through a link depends on the
212
+ * link and its target). A collection requires all of it in its lease before
213
+ * admitting what it read; sources inside the checkout are already covered. */
214
+ export function repositoryFootprint(binding, configuration) {
215
+ return [...new Set([...externalGitStorage(binding), ...configuration.sources.flatMap(readThroughAddresses)])];
216
+ }
217
+ //# sourceMappingURL=git-configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-configuration.js","sourceRoot":"","sources":["../src/git-configuration.ts"],"names":[],"mappings":"AAAA;2EAC2E;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,EAAmB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,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AAkB,CAAC,OAAO,CAAC,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;AAChH,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { type CaptureFailure } from "./content-failure.js";
2
+ import type { NativeIndexBinding } from "./git-binding.js";
3
+ import type { GitCapture } from "./git-capture.js";
4
+ import type { GitConfigurationObservation } from "./git-configuration.js";
5
+ import { type SourceProof } from "./source-proof.js";
6
+ import type { SourceWitness } from "./source-witness.js";
7
+ export interface GitEvidenceObservation {
8
+ readonly fingerprint: string;
9
+ readonly configuration: GitConfigurationObservation;
10
+ readonly binding: NativeIndexBinding;
11
+ /** The capture whose shared answers this digest names. */
12
+ readonly capture: GitCapture;
13
+ /** Unclosed: the shared answers and the native witnesses together. */
14
+ readonly proof: SourceProof;
15
+ /** Only the native files and namespaces this collection read. */
16
+ readonly witnesses: SourceProof;
17
+ /** Physical keys of the native Git files this collection opened and read. */
18
+ readonly physical: readonly string[];
19
+ }
20
+ /** Why a repository's Git state cannot certify reuse. Every refusal means the
21
+ * full reader observes; the reason is evidence, never a different answer. */
22
+ export type GitSealRefusalReason = "marker" | "storage-layout" | "worktree" | "unsupported-storage" | "config-include" | "operation" | "reveal" | "result-mismatch" | "changed" | "unreadable";
23
+ export interface GitSealRefusal {
24
+ readonly refused: GitSealRefusalReason;
25
+ readonly detail?: string;
26
+ }
27
+ export type GitEvidence = GitEvidenceObservation | GitSealRefusal;
28
+ export declare const sealRefused: (evidence: GitEvidence) => evidence is GitSealRefusal;
29
+ export declare function reportSeal(repository: string, outcome: "unreached" | "reuse" | "miss" | "reuse-selected" | "write" | "write-refused", reason: string | null): void;
30
+ /**
31
+ * A digest of the Git state a capture proves: the checkout's binding (the
32
+ * effective worktree, a gitfile's bytes and its route included), the Git host,
33
+ * effective configuration, HEAD, every loose ref, packed-refs content, config,
34
+ * the shallow boundary, an unfinished merge's heads, message, mode and
35
+ * AUTO_MERGE, and the index's meaning (git-native-index.ts). Config
36
+ * and shallow matter because the Card carries remotes and the shallow
37
+ * boundary; the merge files because the Checkpoint carries the merge.
38
+ * AUTO_MERGE is not reproduced; it only invalidates. Equal digests mean Git's
39
+ * own records are unchanged since the digest was taken, so a sealed capture
40
+ * bound to it still holds. Absent members are digested as absent, so their
41
+ * later appearance breaks the seal. The supported profile is one private
42
+ * storage directory (a `.git` directory or a gitfile naming it) whose
43
+ * effective worktree is the enrolled root. Anything else — split or linked
44
+ * storage, reftable, config includes, an operation the Checkpoint does not
45
+ * carry, unreadable metadata — is a typed refusal and the caller captures in
46
+ * full. Git evaluates effective configuration itself so global, system and
47
+ * conditional sources cannot escape this digest. The configuration, stash
48
+ * and binding are the capture's shared answers, so the digest and the result
49
+ * it certifies name the same answers. The evidence is unclosed: reuse retains
50
+ * its proof in the enclosing admission, and a seal is written only with the
51
+ * capture it certifies (closeRepositorySeal).
52
+ */
53
+ export declare function collectGitEvidence(capture: GitCapture): Promise<GitEvidence>;
54
+ /** A seal names one capture's result. Its shared answers close at the
55
+ * admission that installs the seal, together with that result's proof; here
56
+ * the digest's own native witnesses must still hold after the capture.
57
+ * They carry no admission, so `judge` samples them again wherever the
58
+ * caller reads ground: on a content thread, never the admitting one. */
59
+ export declare function closeRepositorySeal(evidence: GitEvidence, captured: {
60
+ readonly capture: GitCapture;
61
+ }, judge: (witnesses: readonly SourceWitness[]) => Promise<CaptureFailure | null>): Promise<string | GitSealRefusal>;
@@ -0,0 +1,181 @@
1
+ /** Git evidence: the digest of every Git record a repository capture proves,
2
+ * with the native witnesses that hold it. Equal digests certify that a sealed
3
+ * capture still describes the repository. */
4
+ import { createHash } from "node:crypto";
5
+ import { channel } from "node:diagnostics_channel";
6
+ import { lstatSync } from "node:fs";
7
+ import { join } from "node:path";
8
+ import { CaptureSourceChangedError } from "./content-cache-host.js";
9
+ import { restoreFailure } from "./content-failure.js";
10
+ import { gitHost } from "./git-command.js";
11
+ import { observeNativeGitFile } from "./git-native-file.js";
12
+ import { REVEAL_MARKER, UNSUPPORTED_GIT_OPERATIONS, unsupportedGitOperation } from "./git-operation-host.js";
13
+ import { observeNamespace } from "./physical-path-witness.js";
14
+ import { sourceProofs, witnessProof } from "./source-proof.js";
15
+ export const sealRefused = (evidence) => "refused" in evidence;
16
+ const refuse = (refused, detail) => Object.freeze(detail === undefined ? { refused } : { refused, detail });
17
+ const failureRefusal = (error) => error instanceof CaptureSourceChangedError
18
+ || ["ENOENT", "ENOTDIR"].includes(error.code ?? "")
19
+ ? refuse("changed", error.message) : refuse("unreadable", error.message);
20
+ /** How one repository's seal served a Detect: `unreached` (no Watch name
21
+ * reached it, so its seal stood without asking Git), `reuse`, `miss`, then
22
+ * after a fresh observation `reuse-selected` (sharing already held the
23
+ * selected result), `write` or `write-refused`, with its literal reason.
24
+ * Published only while someone listens; evidence only, never an input to a
25
+ * decision. */
26
+ const sealOutcomes = channel("amalgm:git-seal");
27
+ export function reportSeal(repository, outcome, reason) {
28
+ if (sealOutcomes.hasSubscribers)
29
+ sealOutcomes.publish({ repository, outcome, reason });
30
+ }
31
+ /**
32
+ * A digest of the Git state a capture proves: the checkout's binding (the
33
+ * effective worktree, a gitfile's bytes and its route included), the Git host,
34
+ * effective configuration, HEAD, every loose ref, packed-refs content, config,
35
+ * the shallow boundary, an unfinished merge's heads, message, mode and
36
+ * AUTO_MERGE, and the index's meaning (git-native-index.ts). Config
37
+ * and shallow matter because the Card carries remotes and the shallow
38
+ * boundary; the merge files because the Checkpoint carries the merge.
39
+ * AUTO_MERGE is not reproduced; it only invalidates. Equal digests mean Git's
40
+ * own records are unchanged since the digest was taken, so a sealed capture
41
+ * bound to it still holds. Absent members are digested as absent, so their
42
+ * later appearance breaks the seal. The supported profile is one private
43
+ * storage directory (a `.git` directory or a gitfile naming it) whose
44
+ * effective worktree is the enrolled root. Anything else — split or linked
45
+ * storage, reftable, config includes, an operation the Checkpoint does not
46
+ * carry, unreadable metadata — is a typed refusal and the caller captures in
47
+ * full. Git evaluates effective configuration itself so global, system and
48
+ * conditional sources cannot escape this digest. The configuration, stash
49
+ * and binding are the capture's shared answers, so the digest and the result
50
+ * it certifies name the same answers. The evidence is unclosed: reuse retains
51
+ * its proof in the enclosing admission, and a seal is written only with the
52
+ * capture it certifies (closeRepositorySeal).
53
+ */
54
+ export async function collectGitEvidence(capture) {
55
+ const marker = join(capture.repository, ".git");
56
+ try {
57
+ const markerKind = lstatSync(marker);
58
+ if (!markerKind.isDirectory() && !markerKind.isFile())
59
+ return refuse("marker");
60
+ const configuration = await capture.configuration();
61
+ const stashFact = await capture.stash();
62
+ const stash = JSON.stringify(stashFact.value);
63
+ if (configuration.has("extensions.refstorage"))
64
+ return refuse("unsupported-storage", "extensions.refstorage");
65
+ const files = [];
66
+ const bindingProof = await capture.binding();
67
+ const binding = bindingProof.binding;
68
+ // One private storage directory: a directory marker is that storage; a
69
+ // gitfile names it, and the binding retains its route. Git's effective
70
+ // worktree (core.worktree included) must be the enrolled root.
71
+ if (binding.common !== binding.gitDir || binding.index !== join(binding.gitDir, "index")
72
+ || (markerKind.isDirectory() && binding.gitDir !== join(binding.repository, ".git")))
73
+ return refuse("storage-layout");
74
+ if (binding.worktree !== binding.repository)
75
+ return refuse("worktree");
76
+ const gitDir = binding.gitDir;
77
+ const operation = unsupportedGitOperation(gitDir);
78
+ if (operation)
79
+ return refuse("operation", operation);
80
+ const markerFile = markerKind.isFile() ? observeNativeGitFile(marker) : null;
81
+ if (markerFile)
82
+ files.push(markerFile);
83
+ const namespaces = [];
84
+ const directory = (path) => {
85
+ const namespace = observeNamespace(path);
86
+ namespaces.push(namespace);
87
+ return namespace.names;
88
+ };
89
+ const read = (name) => {
90
+ const observed = observeNativeGitFile(join(gitDir, name));
91
+ files.push(observed);
92
+ return observed;
93
+ };
94
+ // Negative witnesses: each absent marker's later appearance breaks the seal.
95
+ for (const refused of ["commondir", "config.worktree", "reftable"]) {
96
+ if (read(refused).bytes !== null)
97
+ return refuse("unsupported-storage", refused);
98
+ }
99
+ for (const [refused, name] of UNSUPPORTED_GIT_OPERATIONS) {
100
+ if (read(refused).bytes !== null)
101
+ return refuse("operation", name);
102
+ }
103
+ if (read(REVEAL_MARKER).bytes !== null)
104
+ return refuse("reveal");
105
+ const digest = createHash("sha256");
106
+ digest.update("literal-worktree-v7-card4-native-index-v6-seal4\0");
107
+ digest.update(gitHost().key + "\0");
108
+ // Seal reuse also preserves O's configuration/result pairing. Equal settings
109
+ // at another checkout or replaced Git directory cannot inherit that proof.
110
+ digest.update(JSON.stringify(binding) + "\0");
111
+ digest.update(configuration.fingerprint + "\0");
112
+ digest.update(stash + "\0");
113
+ const file = (name) => {
114
+ const observed = read(name);
115
+ // Presence and length are explicit. Present bytes spelling "absent"
116
+ // cannot impersonate a missing metadata file.
117
+ digest.update(JSON.stringify([name, observed.bytes !== null, observed.bytes?.length ?? 0]) + "\0");
118
+ if (observed.bytes)
119
+ digest.update(observed.bytes);
120
+ return observed.bytes;
121
+ };
122
+ if (markerFile) {
123
+ digest.update(JSON.stringify([".git", true, markerFile.bytes.length]) + "\0");
124
+ digest.update(markerFile.bytes);
125
+ }
126
+ file("HEAD");
127
+ file("packed-refs");
128
+ file("MERGE_HEAD");
129
+ file("MERGE_MSG");
130
+ file("MERGE_MODE");
131
+ file("AUTO_MERGE");
132
+ const config = file("config");
133
+ if (config !== null && /^\s*\[include/im.test(config.toString("utf8")))
134
+ return refuse("config-include");
135
+ file("shallow");
136
+ const walkRefs = (relative) => {
137
+ for (const name of directory(join(gitDir, relative))) {
138
+ const child = `${relative}/${name}`;
139
+ if (lstatSync(join(gitDir, child)).isDirectory())
140
+ walkRefs(child);
141
+ else
142
+ file(child);
143
+ }
144
+ };
145
+ walkRefs("refs");
146
+ file("logs/refs/stash");
147
+ const index = await capture.index();
148
+ digest.update(JSON.stringify(["index", index.witness.meaning]) + "\0");
149
+ // Only original witnesses survive: never a worktree view or cargo.
150
+ const witnesses = witnessProof([...files.map(observed => observed.witness), ...namespaces, index.witness]);
151
+ return Object.freeze({ fingerprint: digest.digest("hex"), configuration, binding, capture, witnesses,
152
+ proof: sourceProofs([configuration, stashFact.proof, bindingProof, witnesses]),
153
+ physical: Object.freeze([...files.flatMap(observed => observed.physical ?? []), ...index.physical]) });
154
+ }
155
+ catch (error) {
156
+ // Missing ancestors, changed proof or unreadable metadata mean this fast
157
+ // path cannot certify reuse. The full reader must observe.
158
+ return failureRefusal(error);
159
+ }
160
+ }
161
+ /** A seal names one capture's result. Its shared answers close at the
162
+ * admission that installs the seal, together with that result's proof; here
163
+ * the digest's own native witnesses must still hold after the capture.
164
+ * They carry no admission, so `judge` samples them again wherever the
165
+ * caller reads ground: on a content thread, never the admitting one. */
166
+ export async function closeRepositorySeal(evidence, captured, judge) {
167
+ if (sealRefused(evidence))
168
+ return evidence;
169
+ if (evidence.capture !== captured.capture)
170
+ return refuse("result-mismatch");
171
+ // Optional reuse evidence never weakens full capture.
172
+ let failure;
173
+ try {
174
+ failure = await judge(evidence.witnesses.witnesses);
175
+ }
176
+ catch (error) {
177
+ return failureRefusal(error);
178
+ }
179
+ return failure ? failureRefusal(restoreFailure(failure)) : evidence.fingerprint;
180
+ }
181
+ //# sourceMappingURL=git-evidence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-evidence.js","sourceRoot":"","sources":["../src/git-evidence.ts"],"names":[],"mappings":"AAAA;;6CAE6C;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAuB,MAAM,sBAAsB,CAAC;AAG3E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAA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CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;AAClF,CAAC"}
@@ -0,0 +1,15 @@
1
+ export interface GitIndexEntry {
2
+ readonly path: string;
3
+ readonly mode: string;
4
+ readonly objectId: string;
5
+ readonly stage: 0 | 1 | 2 | 3;
6
+ }
7
+ export declare const withinGitBoundary: (path: string, boundaries: readonly string[]) => boolean;
8
+ export declare const isGitControlPath: (path: string) => boolean;
9
+ export declare function assertGitPath(path: string): void;
10
+ /** `ls-files --stage -z` entries, parsed in bounded slices over a private
11
+ * copy: each entry decodes from its own byte range (NUL never occurs inside
12
+ * a UTF-8 sequence, so this equals splitting the whole decoded text), and the
13
+ * parse yields at the dispatcher's turn boundary, so a large index never
14
+ * holds the thread in one long step. */
15
+ export declare function parseGitIndex(bytes: Uint8Array): Promise<GitIndexEntry[]>;
@@ -0,0 +1,44 @@
1
+ /** Validated, literal Git index entries shared by capture and replay. */
2
+ import { ITEMS_PER_BOUNDARY } from "@amalgm/live";
3
+ import { turnBoundary } from "./turns.js";
4
+ export const withinGitBoundary = (path, boundaries) => boundaries.some(boundary => path === boundary || path.startsWith(`${boundary}/`));
5
+ export const isGitControlPath = (path) => path.split("/").some(part => part.toLowerCase() === ".amalgm");
6
+ export function assertGitPath(path) {
7
+ if (!path || path.startsWith("/") || path.includes("\0")
8
+ || path.split("/").some(part => !part || part === "." || part === ".." || part.toLowerCase() === ".git")) {
9
+ throw new Error(`unsafe repository path: ${path}`);
10
+ }
11
+ }
12
+ const MODES = new Set(["100644", "100755", "120000", "160000"]);
13
+ const OBJECT_ID = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
14
+ function parseEntry(field) {
15
+ const separator = field.indexOf("\t");
16
+ const [mode, objectId, rawStage] = field.slice(0, separator).split(" ");
17
+ const path = field.slice(separator + 1);
18
+ const stage = Number(rawStage);
19
+ assertGitPath(path);
20
+ if (separator < 0 || !MODES.has(mode ?? "") || !OBJECT_ID.test(objectId ?? "")
21
+ || ![0, 1, 2, 3].includes(stage))
22
+ throw new Error("invalid Git index entry");
23
+ return { path, mode: mode, objectId: objectId, stage: stage };
24
+ }
25
+ /** `ls-files --stage -z` entries, parsed in bounded slices over a private
26
+ * copy: each entry decodes from its own byte range (NUL never occurs inside
27
+ * a UTF-8 sequence, so this equals splitting the whole decoded text), and the
28
+ * parse yields at the dispatcher's turn boundary, so a large index never
29
+ * holds the thread in one long step. */
30
+ export async function parseGitIndex(bytes) {
31
+ const buffer = Buffer.from(bytes);
32
+ const entries = [];
33
+ for (let start = 0, fields = 0; start < buffer.length; fields += 1) {
34
+ const found = buffer.indexOf(0, start);
35
+ const end = found < 0 ? buffer.length : found;
36
+ if (end > start)
37
+ entries.push(parseEntry(buffer.toString("utf8", start, end)));
38
+ start = end + 1;
39
+ if (fields % ITEMS_PER_BOUNDARY === ITEMS_PER_BOUNDARY - 1)
40
+ await turnBoundary();
41
+ }
42
+ return entries;
43
+ }
44
+ //# sourceMappingURL=git-index-entries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-index-entries.js","sourceRoot":"","sources":["../src/git-index-entries.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,UAA6B,EAAW,EAAE,CACxF,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAW,EAAE,CACxD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,CAAC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AAQ,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/E,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAK,EAAE,QAAQ,EAAE,QAAS,EAAE,KAAK,EAAE,KAA+B,EAAE,CAAC;AAC5F,CAAC;AAED;;;;wCAIwC;AACxC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAiB;IACnD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,OAAO,GAAoB,EAAE,CAAC;IACpC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,CAAC;QACnE,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,GAAG,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;QAC9C,IAAI,GAAG,GAAG,KAAK;YAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QAC/E,KAAK,GAAG,GAAG,GAAG,CAAC,CAAC;QAChB,IAAI,MAAM,GAAG,kBAAkB,KAAK,kBAAkB,GAAG,CAAC;YAAE,MAAM,YAAY,EAAE,CAAC;IACnF,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,35 @@
1
+ /** Git's index file, read as Git reads it (read-cache.c, split-index.c)
2
+ * without a Git process. To capture an index means its stage listing: every
3
+ * entry's mode, object, stage and path in the order Git holds them, written
4
+ * as `git ls-files --stage -z` writes them. Capture asks nothing else of an
5
+ * index: its private view is built from the listing, and Git lists
6
+ * untracked names over copied bytes. The rest of an index file — the stat
7
+ * data each refresh re-stamps, entry flags and optional extensions — caches
8
+ * that meaning, serves Git's speed, or steers commands capture never runs
9
+ * over the index, so equal listings give capture equal answers whatever
10
+ * their bytes. A capture that came to read a flag would make it meaning.
11
+ *
12
+ * Every form Git writes is read: versions 2 to 4, extended flags,
13
+ * prefix-compressed paths, and a split index over its shared base. A form
14
+ * Git never writes is refused rather than guessed, as is a required
15
+ * extension Git would not understand. A split index resolves as Git's own
16
+ * merge does, which assumes its shared base and its additions each hold
17
+ * Git's order, so both must. Paths stay Git's to name: capture refuses any
18
+ * path Git itself would refuse (git-index-entries.ts). */
19
+ import { type Steps } from "@amalgm/live";
20
+ export declare class GitIndexFormatError extends Error {
21
+ }
22
+ declare const WIDTH: {
23
+ readonly sha1: 20;
24
+ readonly sha256: 32;
25
+ };
26
+ export type GitObjectFormat = keyof typeof WIDTH;
27
+ /** An index's stage listing, and the shared base it was read over. */
28
+ export interface StageListing {
29
+ readonly listing: Buffer;
30
+ readonly base: string | null;
31
+ }
32
+ /** The stage listing of an index file's bytes. A split index reads its
33
+ * shared base, by name, through `shared`. */
34
+ export declare function stageListing(bytes: Buffer, format: GitObjectFormat, shared: (name: string) => Buffer): Steps<StageListing>;
35
+ export {};