@amalgm/shell 0.1.164-main.40070365614 → 0.1.164-main.40795482467

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 (319) hide show
  1. package/dist/accepted-fold.d.ts +24 -46
  2. package/dist/accepted-fold.js +62 -140
  3. package/dist/accepted-fold.js.map +1 -1
  4. package/dist/accepted-tail.d.ts +3 -3
  5. package/dist/accepted-tail.js +6 -6
  6. package/dist/accepted-tail.js.map +1 -1
  7. package/dist/apply-control.d.ts +9 -4
  8. package/dist/apply-control.js +18 -5
  9. package/dist/apply-control.js.map +1 -1
  10. package/dist/apply-enter-build.d.ts +6 -7
  11. package/dist/apply-enter-build.js +4 -10
  12. package/dist/apply-enter-build.js.map +1 -1
  13. package/dist/apply-enter-plan.d.ts +9 -7
  14. package/dist/apply-enter-plan.js +40 -27
  15. package/dist/apply-enter-plan.js.map +1 -1
  16. package/dist/apply-local-work.d.ts +8 -20
  17. package/dist/apply-local-work.js +18 -95
  18. package/dist/apply-local-work.js.map +1 -1
  19. package/dist/apply-showing.d.ts +15 -1
  20. package/dist/apply-showing.js +26 -4
  21. package/dist/apply-showing.js.map +1 -1
  22. package/dist/apply-window-ground.d.ts +7 -9
  23. package/dist/apply-window-ground.js +16 -11
  24. package/dist/apply-window-ground.js.map +1 -1
  25. package/dist/apply-window-host.d.ts +29 -4
  26. package/dist/apply-window-host.js +212 -280
  27. package/dist/apply-window-host.js.map +1 -1
  28. package/dist/apply-window-line.d.ts +2 -1
  29. package/dist/apply-window-line.js +5 -4
  30. package/dist/apply-window-line.js.map +1 -1
  31. package/dist/apply-window-recovery.js +18 -30
  32. package/dist/apply-window-recovery.js.map +1 -1
  33. package/dist/apply-window-reveal.d.ts +0 -7
  34. package/dist/apply-window-reveal.js +5 -48
  35. package/dist/apply-window-reveal.js.map +1 -1
  36. package/dist/apply-window-rows.d.ts +1 -24
  37. package/dist/apply-window-rows.js.map +1 -1
  38. package/dist/apply-window-saves.d.ts +16 -9
  39. package/dist/apply-window-saves.js +65 -19
  40. package/dist/apply-window-saves.js.map +1 -1
  41. package/dist/apply-window-store.d.ts +6 -6
  42. package/dist/apply-window-store.js +7 -4
  43. package/dist/apply-window-store.js.map +1 -1
  44. package/dist/apply-window-verify.d.ts +4 -7
  45. package/dist/apply-window-verify.js +4 -23
  46. package/dist/apply-window-verify.js.map +1 -1
  47. package/dist/baseline-content.d.ts +3 -5
  48. package/dist/baseline-content.js +7 -44
  49. package/dist/baseline-content.js.map +1 -1
  50. package/dist/content-cache-retention.d.ts +3 -2
  51. package/dist/content-cache-retention.js +11 -11
  52. package/dist/content-cache-retention.js.map +1 -1
  53. package/dist/content-capture-pool.d.ts +4 -47
  54. package/dist/content-capture-pool.js +3 -42
  55. package/dist/content-capture-pool.js.map +1 -1
  56. package/dist/content-capture-worker.d.ts +2 -3
  57. package/dist/content-capture-worker.js +2 -19
  58. package/dist/content-capture-worker.js.map +1 -1
  59. package/dist/declaration-absorption.d.ts +9 -15
  60. package/dist/declaration-absorption.js +14 -32
  61. package/dist/declaration-absorption.js.map +1 -1
  62. package/dist/declaration-commit.d.ts +0 -5
  63. package/dist/declaration-commit.js +1 -6
  64. package/dist/declaration-commit.js.map +1 -1
  65. package/dist/declaration-save.d.ts +0 -4
  66. package/dist/declaration-save.js +0 -4
  67. package/dist/declaration-save.js.map +1 -1
  68. package/dist/detection/accepted-result.js +1 -1
  69. package/dist/detection/accepted-result.js.map +1 -1
  70. package/dist/detection/admission-save.d.ts +7 -17
  71. package/dist/detection/admission-save.js +4 -11
  72. package/dist/detection/admission-save.js.map +1 -1
  73. package/dist/detection/admission-units.d.ts +10 -26
  74. package/dist/detection/admission-units.js +12 -50
  75. package/dist/detection/admission-units.js.map +1 -1
  76. package/dist/detection/apply-ownership.d.ts +2 -2
  77. package/dist/detection/apply-ownership.js +2 -7
  78. package/dist/detection/apply-ownership.js.map +1 -1
  79. package/dist/detection/capture-outcome.js +12 -19
  80. package/dist/detection/capture-outcome.js.map +1 -1
  81. package/dist/detection/dispositions.d.ts +1 -1
  82. package/dist/detection/dispositions.js +3 -4
  83. package/dist/detection/dispositions.js.map +1 -1
  84. package/dist/detection/ground-proof.d.ts +1 -3
  85. package/dist/detection/ground-proof.js +0 -9
  86. package/dist/detection/ground-proof.js.map +1 -1
  87. package/dist/detection/ground-reader.d.ts +1 -5
  88. package/dist/detection/ground-reader.js +1 -31
  89. package/dist/detection/ground-reader.js.map +1 -1
  90. package/dist/detection/notebook-basis.d.ts +1 -2
  91. package/dist/detection/notebook-basis.js +2 -4
  92. package/dist/detection/notebook-basis.js.map +1 -1
  93. package/dist/detection/owed-selection.d.ts +2 -3
  94. package/dist/detection/owed-selection.js +3 -6
  95. package/dist/detection/owed-selection.js.map +1 -1
  96. package/dist/detection/portable.d.ts +7 -48
  97. package/dist/detection/portable.js +46 -155
  98. package/dist/detection/portable.js.map +1 -1
  99. package/dist/detection/repository-state.d.ts +35 -0
  100. package/dist/detection/repository-state.js +51 -0
  101. package/dist/detection/repository-state.js.map +1 -0
  102. package/dist/detection/root-examination.d.ts +1 -11
  103. package/dist/detection/root-examination.js +69 -127
  104. package/dist/detection/root-examination.js.map +1 -1
  105. package/dist/detection/runtime.d.ts +8 -32
  106. package/dist/detection/runtime.js +36 -140
  107. package/dist/detection/runtime.js.map +1 -1
  108. package/dist/detection/scope-frame.d.ts +32 -62
  109. package/dist/detection/scope-frame.js +139 -214
  110. package/dist/detection/scope-frame.js.map +1 -1
  111. package/dist/detection/scoped-identity-port.d.ts +1 -1
  112. package/dist/detection/scoped-identity-port.js +3 -4
  113. package/dist/detection/scoped-identity-port.js.map +1 -1
  114. package/dist/detection/walk-law.d.ts +3 -11
  115. package/dist/detection/walk-law.js +5 -9
  116. package/dist/detection/walk-law.js.map +1 -1
  117. package/dist/git/ground-owners.d.ts +8 -0
  118. package/dist/git/ground-owners.js +25 -0
  119. package/dist/git/ground-owners.js.map +1 -0
  120. package/dist/git/home.d.ts +39 -0
  121. package/dist/git/home.js +81 -0
  122. package/dist/git/home.js.map +1 -0
  123. package/dist/git/marker.d.ts +21 -0
  124. package/dist/git/marker.js +30 -0
  125. package/dist/git/marker.js.map +1 -0
  126. package/dist/git/objects.d.ts +42 -0
  127. package/dist/git/objects.js +144 -0
  128. package/dist/git/objects.js.map +1 -0
  129. package/dist/git/rail.d.ts +90 -0
  130. package/dist/git/rail.js +341 -0
  131. package/dist/git/rail.js.map +1 -0
  132. package/dist/git/read-state.d.ts +21 -0
  133. package/dist/git/read-state.js +143 -0
  134. package/dist/git/read-state.js.map +1 -0
  135. package/dist/git/repository.d.ts +48 -0
  136. package/dist/git/repository.js +110 -0
  137. package/dist/git/repository.js.map +1 -0
  138. package/dist/git/write-files.d.ts +9 -0
  139. package/dist/git/write-files.js +125 -0
  140. package/dist/git/write-files.js.map +1 -0
  141. package/dist/git-binding.d.ts +0 -53
  142. package/dist/git-binding.js +3 -114
  143. package/dist/git-binding.js.map +1 -1
  144. package/dist/git-command.js +11 -2
  145. package/dist/git-command.js.map +1 -1
  146. package/dist/git-index-entries.d.ts +7 -15
  147. package/dist/git-index-entries.js +3 -41
  148. package/dist/git-index-entries.js.map +1 -1
  149. package/dist/git-index-format.d.ts +4 -7
  150. package/dist/git-index-format.js +41 -106
  151. package/dist/git-index-format.js.map +1 -1
  152. package/dist/graph-publication.d.ts +6 -7
  153. package/dist/graph-publication.js +9 -21
  154. package/dist/graph-publication.js.map +1 -1
  155. package/dist/ground-basis.d.ts +1 -37
  156. package/dist/ground-basis.js +5 -162
  157. package/dist/ground-basis.js.map +1 -1
  158. package/dist/ground-database.js +0 -22
  159. package/dist/ground-database.js.map +1 -1
  160. package/dist/ground-install-saves.d.ts +0 -4
  161. package/dist/ground-install-saves.js +0 -4
  162. package/dist/ground-install-saves.js.map +1 -1
  163. package/dist/ground-inventory-schema.js +0 -3
  164. package/dist/ground-inventory-schema.js.map +1 -1
  165. package/dist/ground-marks.d.ts +7 -33
  166. package/dist/ground-marks.js +8 -55
  167. package/dist/ground-marks.js.map +1 -1
  168. package/dist/ground-relations.d.ts +2 -2
  169. package/dist/ground-relations.js +5 -10
  170. package/dist/ground-relations.js.map +1 -1
  171. package/dist/ground-row.d.ts +0 -7
  172. package/dist/ground-row.js +7 -12
  173. package/dist/ground-row.js.map +1 -1
  174. package/dist/ground-save-ops.d.ts +2 -1
  175. package/dist/ground-save-ops.js +2 -1
  176. package/dist/ground-save-ops.js.map +1 -1
  177. package/dist/ground-store.d.ts +0 -10
  178. package/dist/ground-store.js +19 -131
  179. package/dist/ground-store.js.map +1 -1
  180. package/dist/materialize-records.d.ts +19 -20
  181. package/dist/materialize-records.js +123 -244
  182. package/dist/materialize-records.js.map +1 -1
  183. package/dist/materialized-graph.d.ts +3 -22
  184. package/dist/materialized-graph.js +1 -142
  185. package/dist/materialized-graph.js.map +1 -1
  186. package/dist/received-state.d.ts +4 -6
  187. package/dist/received-state.js +6 -11
  188. package/dist/received-state.js.map +1 -1
  189. package/dist/root-install.d.ts +1 -2
  190. package/dist/root-install.js +2 -11
  191. package/dist/root-install.js.map +1 -1
  192. package/dist/sharing-admission.d.ts +1 -2
  193. package/dist/sharing-admission.js +8 -77
  194. package/dist/sharing-admission.js.map +1 -1
  195. package/dist/source-witness.d.ts +1 -7
  196. package/dist/source-witness.js +0 -12
  197. package/dist/source-witness.js.map +1 -1
  198. package/dist/user-ground-host.d.ts +21 -35
  199. package/dist/user-ground-host.js +423 -1484
  200. package/dist/user-ground-host.js.map +1 -1
  201. package/npm-shrinkwrap.json +24 -24
  202. package/package.json +5 -5
  203. package/dist/apply-window-repository.d.ts +0 -97
  204. package/dist/apply-window-repository.js +0 -464
  205. package/dist/apply-window-repository.js.map +0 -1
  206. package/dist/detection/codec-standing.d.ts +0 -27
  207. package/dist/detection/codec-standing.js +0 -86
  208. package/dist/detection/codec-standing.js.map +0 -1
  209. package/dist/detection/git-notice.d.ts +0 -104
  210. package/dist/detection/git-notice.js +0 -483
  211. package/dist/detection/git-notice.js.map +0 -1
  212. package/dist/detection/held-survey.d.ts +0 -39
  213. package/dist/detection/held-survey.js +0 -105
  214. package/dist/detection/held-survey.js.map +0 -1
  215. package/dist/detection/held-territory.d.ts +0 -73
  216. package/dist/detection/held-territory.js +0 -266
  217. package/dist/detection/held-territory.js.map +0 -1
  218. package/dist/detection/name-reach.d.ts +0 -12
  219. package/dist/detection/name-reach.js +0 -28
  220. package/dist/detection/name-reach.js.map +0 -1
  221. package/dist/detection/own-channel.d.ts +0 -17
  222. package/dist/detection/own-channel.js +0 -31
  223. package/dist/detection/own-channel.js.map +0 -1
  224. package/dist/detection/repository-publication.d.ts +0 -22
  225. package/dist/detection/repository-publication.js +0 -81
  226. package/dist/detection/repository-publication.js.map +0 -1
  227. package/dist/detection/repository-routes.d.ts +0 -50
  228. package/dist/detection/repository-routes.js +0 -118
  229. package/dist/detection/repository-routes.js.map +0 -1
  230. package/dist/detection/repository-seals.d.ts +0 -98
  231. package/dist/detection/repository-seals.js +0 -145
  232. package/dist/detection/repository-seals.js.map +0 -1
  233. package/dist/detection/seal-law.d.ts +0 -59
  234. package/dist/detection/seal-law.js +0 -103
  235. package/dist/detection/seal-law.js.map +0 -1
  236. package/dist/git-capture.d.ts +0 -47
  237. package/dist/git-capture.js +0 -153
  238. package/dist/git-capture.js.map +0 -1
  239. package/dist/git-card.d.ts +0 -30
  240. package/dist/git-card.js +0 -136
  241. package/dist/git-card.js.map +0 -1
  242. package/dist/git-checkpoint-construction.d.ts +0 -54
  243. package/dist/git-checkpoint-construction.js +0 -126
  244. package/dist/git-checkpoint-construction.js.map +0 -1
  245. package/dist/git-checkpoint-preparation.d.ts +0 -47
  246. package/dist/git-checkpoint-preparation.js +0 -201
  247. package/dist/git-checkpoint-preparation.js.map +0 -1
  248. package/dist/git-configuration.d.ts +0 -53
  249. package/dist/git-configuration.js +0 -238
  250. package/dist/git-configuration.js.map +0 -1
  251. package/dist/git-evidence.d.ts +0 -50
  252. package/dist/git-evidence.js +0 -114
  253. package/dist/git-evidence.js.map +0 -1
  254. package/dist/git-facts.d.ts +0 -2
  255. package/dist/git-facts.js +0 -35
  256. package/dist/git-facts.js.map +0 -1
  257. package/dist/git-index-witness.d.ts +0 -34
  258. package/dist/git-index-witness.js +0 -85
  259. package/dist/git-index-witness.js.map +0 -1
  260. package/dist/git-literal-batch.d.ts +0 -82
  261. package/dist/git-literal-batch.js +0 -152
  262. package/dist/git-literal-batch.js.map +0 -1
  263. package/dist/git-literal-host.d.ts +0 -76
  264. package/dist/git-literal-host.js +0 -185
  265. package/dist/git-literal-host.js.map +0 -1
  266. package/dist/git-literal-read.d.ts +0 -74
  267. package/dist/git-literal-read.js +0 -186
  268. package/dist/git-literal-read.js.map +0 -1
  269. package/dist/git-literal-replay.d.ts +0 -83
  270. package/dist/git-literal-replay.js +0 -393
  271. package/dist/git-literal-replay.js.map +0 -1
  272. package/dist/git-native-file.d.ts +0 -42
  273. package/dist/git-native-file.js +0 -145
  274. package/dist/git-native-file.js.map +0 -1
  275. package/dist/git-native-index.d.ts +0 -27
  276. package/dist/git-native-index.js +0 -44
  277. package/dist/git-native-index.js.map +0 -1
  278. package/dist/git-operation-host.d.ts +0 -42
  279. package/dist/git-operation-host.js +0 -115
  280. package/dist/git-operation-host.js.map +0 -1
  281. package/dist/git-private-repository.d.ts +0 -4
  282. package/dist/git-private-repository.js +0 -66
  283. package/dist/git-private-repository.js.map +0 -1
  284. package/dist/git-private-view.d.ts +0 -72
  285. package/dist/git-private-view.js +0 -318
  286. package/dist/git-private-view.js.map +0 -1
  287. package/dist/git-records.d.ts +0 -29
  288. package/dist/git-records.js +0 -119
  289. package/dist/git-records.js.map +0 -1
  290. package/dist/git-ref-store.d.ts +0 -12
  291. package/dist/git-ref-store.js +0 -68
  292. package/dist/git-ref-store.js.map +0 -1
  293. package/dist/git-registration-host.d.ts +0 -42
  294. package/dist/git-registration-host.js +0 -98
  295. package/dist/git-registration-host.js.map +0 -1
  296. package/dist/git-repository-host.d.ts +0 -291
  297. package/dist/git-repository-host.js +0 -1291
  298. package/dist/git-repository-host.js.map +0 -1
  299. package/dist/git-spelling.d.ts +0 -41
  300. package/dist/git-spelling.js +0 -233
  301. package/dist/git-spelling.js.map +0 -1
  302. package/dist/git-tree-objects.d.ts +0 -22
  303. package/dist/git-tree-objects.js +0 -205
  304. package/dist/git-tree-objects.js.map +0 -1
  305. package/dist/git-worktree-host.d.ts +0 -2
  306. package/dist/git-worktree-host.js +0 -16
  307. package/dist/git-worktree-host.js.map +0 -1
  308. package/dist/ground-territory.d.ts +0 -106
  309. package/dist/ground-territory.js +0 -340
  310. package/dist/ground-territory.js.map +0 -1
  311. package/dist/repository-checkpoint-file.d.ts +0 -20
  312. package/dist/repository-checkpoint-file.js +0 -129
  313. package/dist/repository-checkpoint-file.js.map +0 -1
  314. package/dist/repository-statement.d.ts +0 -21
  315. package/dist/repository-statement.js +0 -33
  316. package/dist/repository-statement.js.map +0 -1
  317. package/dist/reveal-owner.d.ts +0 -16
  318. package/dist/reveal-owner.js +0 -74
  319. package/dist/reveal-owner.js.map +0 -1
@@ -1,126 +0,0 @@
1
- /** Construct the working-file portion of a Checkpoint from explicit byte
2
- * sources. Source selection belongs to publication; no filesystem lookup or
3
- * invented physical fingerprint is part of construction. */
4
- import { isLocalOnlyPath } from "@amalgm/core/identity";
5
- import { ITEMS_PER_BOUNDARY, sortSteps } from "@amalgm/live";
6
- import { assertGitPath, withinGitBoundary } from "./git-index-entries.js";
7
- import { leafDigest } from "./git-literal-read.js";
8
- import { settleAll } from "./settled.js";
9
- import { eachInTurns, finishStepsInTurns, mapInTurns, turnBoundary } from "./turns.js";
10
- export const independentOf = (boundaries) => path => isLocalOnlyPath(path) || withinGitBoundary(path, boundaries);
11
- const readsTracked = (entry, independent) => entry.mode !== "160000" && !independent(entry.path);
12
- const readsUnmerged = (path, entries, independent) => !entries.every(entry => entry.mode === "160000") && !independent(path);
13
- /** The paths Git's index accounts for with a blob: a stage-zero blob, or a
14
- * conflict with a blob stage. Every other owned leaf, a file where a gitlink
15
- * stands included, is Checkpoint cargo beside Git's index. */
16
- export async function accountedPaths(index, independent) {
17
- const accounted = new Set();
18
- await eachInTurns(index, entry => { if (entry.mode !== "160000" && !independent(entry.path))
19
- accounted.add(entry.path); });
20
- return accounted;
21
- }
22
- /** Index entries by stage: each conflict's stages under its path. */
23
- async function byStage(index) {
24
- const stageZero = [], conflicts = new Map();
25
- await eachInTurns(index, entry => {
26
- if (entry.stage === 0) {
27
- stageZero.push(entry);
28
- return;
29
- }
30
- const stages = conflicts.get(entry.path) ?? [];
31
- stages.push(entry);
32
- conflicts.set(entry.path, stages);
33
- });
34
- return { stageZero, conflicts };
35
- }
36
- const byCodeUnits = (left, right) => left < right ? -1 : left > right ? 1 : 0;
37
- const bytes = (leaf, path) => {
38
- if (leaf.content === null)
39
- throw new Error(`checkpoint working file arrived without its bytes: ${path}`);
40
- return leaf.content;
41
- };
42
- /** Every working path construction reads, and the bytes each may need: a
43
- * tracked leaf's only when they are not its indexed blob. */
44
- export async function checkpointReads(index, boundaries, additionalPaths) {
45
- const independent = independentOf(boundaries);
46
- const { stageZero, conflicts } = await byStage(index);
47
- const reads = [];
48
- await eachInTurns(stageZero, entry => {
49
- if (readsTracked(entry, independent))
50
- reads.push({ path: entry.path, content: { unless: entry.objectId } });
51
- });
52
- await eachInTurns(additionalPaths, path => { reads.push({ path, content: "all" }); });
53
- await eachInTurns(conflicts, ([path, entries]) => {
54
- if (readsUnmerged(path, entries, independent))
55
- reads.push({ path, content: "all" });
56
- });
57
- return reads;
58
- }
59
- /** `additionalPaths` includes every selected leaf the index does not account
60
- * for, including retained shared leaves no longer present in the source
61
- * worktree, in any order: a Checkpoint names its untracked files in path
62
- * order, so one ground has one Checkpoint whoever selected it.
63
- * The same constructor serves ordinary capture and selected publication.
64
- * `base` is HEAD's tree from the Card, null when HEAD is unborn. Both trees
65
- * arrive from one Git process while another writes the changed blobs, and
66
- * both patches come from one diff. The index travels as Git keeps it: its
67
- * listing in the patches, and each flagged stage-zero entry's flags beside
68
- * them in the index's order. */
69
- export async function constructLiteralCheckpoint(input) {
70
- const { view, accounted, boundaries, read } = input;
71
- const independent = independentOf(boundaries);
72
- const { stageZero, conflicts } = await byStage(input.index);
73
- // The worktree listing is the stage-zero listing with each read leaf that
74
- // differs replaced, and each missing one removed.
75
- const worktree = new Map();
76
- const changed = [];
77
- const indexFlags = [];
78
- let visited = 0;
79
- for (const entry of stageZero) {
80
- if (++visited % ITEMS_PER_BOUNDARY === 0)
81
- await turnBoundary();
82
- if (entry.flags)
83
- indexFlags.push({ path: entry.path, flags: entry.flags });
84
- if (!readsTracked(entry, independent))
85
- continue;
86
- const leaf = read(entry.path);
87
- if (!leaf) {
88
- worktree.set(entry.path, null);
89
- continue;
90
- }
91
- if (leaf.objectId !== entry.objectId)
92
- changed.push({ content: bytes(leaf, entry.path), objectId: leaf.objectId });
93
- if (leaf.objectId !== entry.objectId || leaf.mode !== entry.mode) {
94
- worktree.set(entry.path, { path: entry.path, mode: leaf.mode, objectId: leaf.objectId, stage: 0 });
95
- }
96
- }
97
- const paths = new Set();
98
- const untracked = [];
99
- for (const path of await finishStepsInTurns(sortSteps(input.additionalPaths, byCodeUnits))) {
100
- if (++visited % ITEMS_PER_BOUNDARY === 0)
101
- await turnBoundary();
102
- assertGitPath(path);
103
- if (paths.has(path))
104
- throw new Error(`duplicate selected working path: ${path}`);
105
- paths.add(path);
106
- if (accounted.has(path) || independent(path)) {
107
- throw new Error(`selected additional path belongs to another checkpoint owner: ${path}`);
108
- }
109
- const leaf = read(path);
110
- if (leaf)
111
- untracked.push({ path, mode: leaf.mode, content: bytes(leaf, path), sha256: leafDigest(leaf) });
112
- }
113
- const unmerged = await mapInTurns(conflicts, ([path, entries]) => {
114
- const leaf = readsUnmerged(path, entries, independent) ? read(path) : null;
115
- return { path, stages: entries.map(entry => ({ mode: entry.mode, objectId: entry.objectId,
116
- stage: entry.stage })), worktree: leaf === null ? null
117
- : { mode: leaf.mode, content: bytes(leaf, path), sha256: leafDigest(leaf) } };
118
- });
119
- // An unborn HEAD's tree holds no entry.
120
- const unborn = input.base === null ? [new Map(await mapInTurns(stageZero, entry => [entry.path, null]))] : [];
121
- const [[indexTree, worktreeTree, empty]] = await settleAll([view.trees(stageZero, [worktree, ...unborn]), view.rawBlobs(changed)]);
122
- const base = input.base ?? empty;
123
- const [stagedPatch, unstagedPatch] = await view.diffs([[base, indexTree], [indexTree, worktreeTree]]);
124
- return { stagedPatch, unstagedPatch, untracked, unmerged, indexFlags };
125
- }
126
- //# sourceMappingURL=git-checkpoint-construction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-checkpoint-construction.js","sourceRoot":"","sources":["../src/git-checkpoint-construction.ts"],"names":[],"mappings":"AAAA;;4DAE4D;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAA8C,MAAM,cAAc,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAsB,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAuB,MAAM,uBAAuB,CAAC;AAGxE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAYvF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAA6B,EAAe,EAAE,CAC1E,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AACvE,MAAM,YAAY,GAAG,CAAC,KAAoB,EAAE,WAAwB,EAAW,EAAE,CAC/E,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACtD,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,OAAiC,EAAE,WAAwB,EAAW,EAA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,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACnI,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,KAAM,CAAC;IAClC,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,SAAU,CAAC,EAAE,CAAC,SAAU,EAAE,YAAa,CAAC,CAAC,CAAC,CAAC;IACzG,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AACzE,CAAC"}
@@ -1,47 +0,0 @@
1
- import { type RepoIndexFlags, type RepositoryApplyTerritory } from "@amalgm/live";
2
- import { type GitIndexEntry } from "./git-index-entries.js";
3
- import { type ProvenMembers } from "./git-literal-host.js";
4
- import { PrivateGitView } from "./git-private-view.js";
5
- export interface CheckpointLeafSource {
6
- readonly path: string;
7
- readonly mode: string;
8
- readonly sha256: string;
9
- read(): Buffer;
10
- }
11
- export interface LiteralCheckpointSource {
12
- readonly baseCommit: string | null;
13
- readonly stagedPatch: Uint8Array;
14
- readonly unstagedPatch: Uint8Array;
15
- readonly indexFlags: readonly RepoIndexFlags[];
16
- readonly untracked: readonly CheckpointLeafSource[];
17
- readonly unmerged: readonly {
18
- readonly path: string;
19
- readonly stages: readonly {
20
- readonly stage: 1 | 2 | 3;
21
- readonly mode: string;
22
- readonly objectId: string;
23
- }[];
24
- readonly worktree: CheckpointLeafSource | null;
25
- }[];
26
- }
27
- export interface PreparedLiteralCheckpoint {
28
- readonly view: PrivateGitView;
29
- readonly index: readonly GitIndexEntry[];
30
- /** The index the package installs, in Git's order (installedIndex). */
31
- readonly finalIndex: readonly GitIndexEntry[];
32
- readonly physical: ReadonlySet<string>;
33
- readonly directories: ReadonlySet<string>;
34
- /** Every result leaf the reveal writes, as Git names its object. */
35
- readonly leaves: readonly GitIndexEntry[];
36
- /** Exact immutable working bytes, every leaf or only the named paths, in
37
- * one Git batch; no machine-local identity or stat claims. */
38
- readLeaves(consume: (entry: GitIndexEntry, bytes: Buffer) => void, paths?: ReadonlySet<string>): Promise<void>;
39
- close(): Promise<void>;
40
- }
41
- /** Compiles the package (compileCheckpoint) and proves every member it
42
- * reveals on its territory. Silent ground keeps the package's index and
43
- * gains no worktree byte, untracked file or conflict worktree: a reading
44
- * there shows the package with those sections dropped (Live
45
- * shownCheckpointSteps). An object an earlier read classified (`proven`,
46
- * ProvenLeaf) is proven by its id: only the rest are read. */
47
- export declare function prepareLiteralCheckpoint(repository: string, checkpoint: LiteralCheckpointSource, territory: RepositoryApplyTerritory, proven: ProvenMembers | null): Promise<PreparedLiteralCheckpoint>;
@@ -1,201 +0,0 @@
1
- /** Compile and prove a Checkpoint in disposable private Git storage.
2
- * This owner performs no index installation, metadata writes or worktree reveal.
3
- * Its caller owns the returned preparation until close, including on failure. */
4
- import { createHash } from "node:crypto";
5
- import { dirname } from "node:path";
6
- import { classifyFile, } from "@amalgm/live";
7
- import { independentOf } from "./git-checkpoint-construction.js";
8
- import { assertGitPath, withinGitBoundary } from "./git-index-entries.js";
9
- import { resolveGitBinding } from "./git-binding.js";
10
- import { proofsOf } from "./git-literal-host.js";
11
- import { PrivateGitView } from "./git-private-view.js";
12
- /** Batch raw object reads without accumulating a repository in memory. */
13
- async function readBlobs(view, entries, consume) {
14
- if (!entries.length)
15
- return;
16
- const sizes = (await view.blobSizes(entries.map(entry => entry.objectId)))
17
- .toString("utf8").trim().split("\n").map(Number);
18
- if (sizes.length !== entries.length || sizes.some(size => !Number.isSafeInteger(size) || size < 0)) {
19
- throw new Error("repository contains unavailable literal objects");
20
- }
21
- for (let start = 0; start < entries.length;) {
22
- let end = start, bytes = 0;
23
- do {
24
- bytes += sizes[end++];
25
- } while (end < entries.length && end - start < 128 && bytes + sizes[end] <= 16 * 1024 * 1024);
26
- const batch = entries.slice(start, end);
27
- const output = await view.blobs(batch.map(entry => entry.objectId));
28
- let cursor = 0;
29
- for (const entry of batch) {
30
- const lineEnd = output.indexOf(10, cursor);
31
- const [oid, type, length] = output.subarray(cursor, lineEnd).toString("ascii").split(" ");
32
- const size = Number(length);
33
- if (lineEnd < cursor || oid !== entry.objectId || type !== "blob" || !Number.isSafeInteger(size)
34
- || size < 0 || lineEnd + size + 1 >= output.length || output[lineEnd + size + 1] !== 10) {
35
- throw new Error("Git returned invalid literal blob contents");
36
- }
37
- cursor = lineEnd + 1;
38
- consume(entry, output.subarray(cursor, cursor + size));
39
- cursor += size + 1;
40
- }
41
- if (cursor !== output.length)
42
- throw new Error("Git returned trailing literal object data");
43
- start = end;
44
- }
45
- }
46
- /** The index and literal worktree one package compiles to over its base. The
47
- * package never changes what its own owners hold: a gitlink, a Git control
48
- * path or a path within one of its nested repositories reads the same in its
49
- * worktree as in its index. */
50
- async function compileCheckpoint(view, checkpoint, identity) {
51
- const index = await view.apply(checkpoint.baseCommit ?? await view.tree([]), checkpoint.stagedPatch);
52
- const working = await view.apply(await view.tree(index), checkpoint.unstagedPatch);
53
- const independent = independentOf(nestedRepositories(identity));
54
- const indexByPath = new Map(index.map(entry => [entry.path, entry]));
55
- const workingByPath = new Map(working.map(entry => [entry.path, entry]));
56
- for (const entry of [...index, ...working]) {
57
- if (entry.mode !== "160000" && !independent(entry.path))
58
- continue;
59
- const before = indexByPath.get(entry.path), after = workingByPath.get(entry.path);
60
- if (!before || !after || before.mode !== after.mode || before.objectId !== after.objectId) {
61
- throw new Error("repository unstaged patch changed an independently owned or control path");
62
- }
63
- }
64
- return { index, working };
65
- }
66
- /** The index a package installs: its compiled stage-zero listing, each entry
67
- * flagged as the Checkpoint names, merged in Git's order (path bytes, then
68
- * stage) with the conflict stages. Each flag names a stage-zero entry. */
69
- function installedIndex(index, checkpoint) {
70
- const flags = new Map(checkpoint.indexFlags.map(entry => [entry.path, entry.flags]));
71
- const stages = checkpoint.unmerged.flatMap(entry => entry.stages.map(stage => ({ ...stage, path: entry.path })));
72
- const names = stages.map(entry => Buffer.from(entry.path, "utf8"));
73
- const merged = [];
74
- let flagged = 0, next = 0;
75
- for (const entry of index) {
76
- const set = flags.get(entry.path);
77
- if (set)
78
- flagged += 1;
79
- const name = Buffer.from(entry.path, "utf8");
80
- while (next < stages.length && Buffer.compare(names[next], name) < 0)
81
- merged.push(stages[next++]);
82
- merged.push(set ? { ...entry, flags: set } : entry);
83
- }
84
- merged.push(...stages.slice(next));
85
- if (flagged !== flags.size)
86
- throw new Error("repository index flags name a path the index does not hold merged");
87
- return merged;
88
- }
89
- /** The identity's own nested repositories. */
90
- const nestedRepositories = (identity) => identity.filter(entry => entry.type === "repo.git").map(entry => entry.path);
91
- /** Compiles the package (compileCheckpoint) and proves every member it
92
- * reveals on its territory. Silent ground keeps the package's index and
93
- * gains no worktree byte, untracked file or conflict worktree: a reading
94
- * there shows the package with those sections dropped (Live
95
- * shownCheckpointSteps). An object an earlier read classified (`proven`,
96
- * ProvenLeaf) is proven by its id: only the rest are read. */
97
- export async function prepareLiteralCheckpoint(repository, checkpoint, territory, proven) {
98
- const { identity, silent } = territory;
99
- const view = await PrivateGitView.open(await resolveGitBinding(repository));
100
- try {
101
- const { index, working } = await compileCheckpoint(view, checkpoint, identity);
102
- const silenced = (path) => withinGitBoundary(path, silent);
103
- const independent = independentOf(nestedRepositories(identity));
104
- const ordinary = working.filter(entry => entry.mode !== "160000" && !independent(entry.path) && !silenced(entry.path));
105
- const physical = new Set(ordinary.map(entry => entry.path));
106
- const extra = [];
107
- const indexPaths = new Set(index.map(entry => entry.path));
108
- // Where the index holds a blob, Git owns the bytes; a file where only a
109
- // gitlink stands is untracked content beside it.
110
- const accounted = new Set();
111
- for (const entry of index)
112
- if (entry.mode !== "160000")
113
- accounted.add(entry.path);
114
- const conflicts = new Set();
115
- for (const entry of checkpoint.unmerged) {
116
- assertGitPath(entry.path);
117
- if (conflicts.has(entry.path) || indexPaths.has(entry.path))
118
- throw new Error("repository conflict overlaps stage-zero index");
119
- conflicts.add(entry.path);
120
- if (independent(entry.path) || entry.stages.every(stage => stage.mode === "160000")) {
121
- if (entry.worktree !== null)
122
- throw new Error("repository conflict content targets an independent owner");
123
- continue;
124
- }
125
- accounted.add(entry.path);
126
- if (entry.worktree && !silenced(entry.path))
127
- extra.push(entry.worktree);
128
- }
129
- for (const entry of checkpoint.untracked) {
130
- assertGitPath(entry.path);
131
- if (accounted.has(entry.path) || independent(entry.path)) {
132
- throw new Error("repository untracked content overlaps another owner");
133
- }
134
- if (!silenced(entry.path))
135
- extra.push(entry);
136
- }
137
- for (const entry of extra) {
138
- if (physical.has(entry.path))
139
- throw new Error("repository physical path has multiple contents");
140
- physical.add(entry.path);
141
- }
142
- const directories = new Set(identity.filter(entry => entry.type === "folder").map(entry => entry.path));
143
- for (const path of [...physical, ...directories, ...silent]) {
144
- assertGitPath(path);
145
- for (let parent = dirname(path); parent !== "."; parent = dirname(parent))
146
- directories.add(parent);
147
- }
148
- for (const path of physical) {
149
- if (directories.has(path) || silent.some(root => root.startsWith(`${path}/`))) {
150
- throw new Error("repository leaf would replace a directory or independent repository");
151
- }
152
- }
153
- const identities = new Map(identity.map(entry => [entry.path, entry]));
154
- const gitPayload = (path) => identities.get(path)?.payloadVersion?.startsWith("git:") === true;
155
- const verify = (path, type, actual) => {
156
- const entry = identities.get(path);
157
- if (!entry || entry.type !== type || entry.payloadVersion !== actual) {
158
- throw new Error(`repository package does not reproduce its member: ${path}`);
159
- }
160
- };
161
- const verifyBytes = (path, mode, bytes) => verify(path, mode === "120000" ? "link" : classifyFile({ binary: bytes.includes(0) }), gitPayload(path)
162
- ? `git:${view.format}:${createHash(view.format).update(`blob ${bytes.length}\0`).update(bytes).digest("hex")}`
163
- : createHash("sha256").update(bytes).digest("hex"));
164
- // Prove the entire package before revealing any filesystem bytes.
165
- const proofs = proven ? await proofsOf(ordinary.map(entry => entry.path), proven) : [];
166
- const unread = ordinary.filter((entry, index) => {
167
- const proof = proofs[index];
168
- if (!proof || proof.format !== view.format || proof.objectId !== entry.objectId
169
- || (proof.type === "link") !== (entry.mode === "120000") || !gitPayload(entry.path))
170
- return true;
171
- verify(entry.path, proof.type, `git:${view.format}:${entry.objectId}`);
172
- return false;
173
- });
174
- await readBlobs(view, unread, (entry, bytes) => verifyBytes(entry.path, entry.mode, bytes));
175
- // Each content is read once, proven, then written, as Git takes it.
176
- const extraObjects = (await view.writeBlobs(extra.length, index => {
177
- const entry = extra[index], bytes = entry.read();
178
- if (createHash("sha256").update(bytes).digest("hex") !== entry.sha256)
179
- throw new Error(`repository content checksum mismatch: ${entry.path}`);
180
- verifyBytes(entry.path, entry.mode, bytes);
181
- return bytes;
182
- })).map((objectId, index) => ({ path: extra[index].path, mode: extra[index].mode, objectId, stage: 0 }));
183
- for (const entry of identity) {
184
- if (["file.text", "file.binary", "link"].includes(entry.type) && !physical.has(entry.path)) {
185
- throw new Error(`repository package omitted member contents: ${entry.path}`);
186
- }
187
- }
188
- const finalIndex = installedIndex(index, checkpoint);
189
- const leaves = [...ordinary, ...extraObjects];
190
- return {
191
- view, index, finalIndex, physical, directories, leaves,
192
- readLeaves: (consume, paths) => readBlobs(view, paths ? leaves.filter(entry => paths.has(entry.path)) : leaves, consume),
193
- close: () => view.close(),
194
- };
195
- }
196
- catch (error) {
197
- await view.close();
198
- throw error;
199
- }
200
- }
201
- //# sourceMappingURL=git-checkpoint-preparation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-checkpoint-preparation.js","sourceRoot":"","sources":["../src/git-checkpoint-preparation.ts"],"names":[],"mappings":"AAAA;;iFAEiF;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CA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KAAK,CAAC,KAAK,CAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3G,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC7B,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3F,MAAM,IAAI,KAAK,CAAC,+CAA+C,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;YAC/E,CAAC;QACH,CAAC;QACD,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,CAAC,GAAG,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC;QAC9C,OAAO;YACL,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM;YACtD,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAC7B,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC;YAC1F,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE;SAC1B,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -1,53 +0,0 @@
1
- import { type RepoRemote } from "@amalgm/live";
2
- import { type NativeIndexBinding } from "./git-binding.js";
3
- import { type SourceProof } from "./source-proof.js";
4
- export declare function configurationRemotes(bytes: Buffer): readonly RepoRemote[];
5
- /** Every source's witness at observation, and the branch chain's names once
6
- * a conditional include makes them an input. */
7
- export interface GitConfigurationWitness {
8
- readonly kind: "git-configuration";
9
- readonly sources: readonly (readonly [string, string])[];
10
- readonly branch: {
11
- readonly gitDir: string;
12
- readonly names: string;
13
- } | null;
14
- }
15
- export declare function judgeGitConfiguration(witness: GitConfigurationWitness): void;
16
- /** Effective configuration is Git's answer over repository-owned sources
17
- * (local, worktree and their includes) plus the host's fixed command scope;
18
- * machine configuration is never read. */
19
- export interface GitConfigurationAnswer {
20
- /** Equality of original ordered answers and Git host, never a fresh read. */
21
- readonly fingerprint: string;
22
- readonly keys: ReadonlySet<string>;
23
- readonly remotes: readonly RepoRemote[];
24
- /** Git reads this worktree's names precomposed: macOS Git when the
25
- * repository sets `core.precomposeUnicode`, as `git init` does there. */
26
- readonly precomposesUnicode: boolean;
27
- /** Every path the answer depends on, absent include targets included. */
28
- readonly sources: readonly string[];
29
- /** True when the physical witnesses close every input of this answer, so an
30
- * unchanged witness set may stand for a fresh read. */
31
- readonly reusable: boolean;
32
- }
33
- /** An answer under the proof that holds it: Git's own answer again with the
34
- * bytes of every source it depends on, or the native records that decide it
35
- * (git-records.ts). */
36
- export interface GitConfigurationObservation extends SourceProof, Omit<GitConfigurationAnswer, "keys"> {
37
- has(key: string): boolean;
38
- /** This stamp is meaningful only on the actual O result proved by its owner.
39
- * Routing may compare it but must never establish or refresh it. */
40
- stamp(uuid: string, payloadVersion: string, binding: NativeIndexBinding): string;
41
- }
42
- export declare function configurationObservation(answer: GitConfigurationAnswer, proof: SourceProof): GitConfigurationObservation;
43
- /** Git's answer, proven by asking again and by the bytes of every source. */
44
- export declare function askGitConfiguration(repository: string): Promise<{
45
- readonly answer: GitConfigurationAnswer;
46
- readonly proof: SourceProof;
47
- }>;
48
- /** Ground a repository reader depends on beyond its checkout: external Git
49
- * storage and every configuration source, include targets included, each at
50
- * its synchronization address (a source read through a link depends on the
51
- * link and its target). A collection requires all of it in its lease before
52
- * admitting what it read; sources inside the checkout are already covered. */
53
- export declare function repositoryFootprint(binding: NativeIndexBinding, configuration: GitConfigurationObservation): string[];