@amalgm/shell 0.1.164-main.41987694940 → 0.1.164-main.42004338907

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 (98) hide show
  1. package/dist/apply-window-cargo.d.ts +10 -7
  2. package/dist/apply-window-cargo.js +27 -19
  3. package/dist/apply-window-cargo.js.map +1 -1
  4. package/dist/apply-window-host.js +44 -7
  5. package/dist/apply-window-host.js.map +1 -1
  6. package/dist/apply-window-verify.js +1 -1
  7. package/dist/apply-window-verify.js.map +1 -1
  8. package/dist/content-cache-retention.js +1 -1
  9. package/dist/content-cache-retention.js.map +1 -1
  10. package/dist/content-capture-pool.d.ts +1 -2
  11. package/dist/content-capture-pool.js +4 -4
  12. package/dist/content-capture-pool.js.map +1 -1
  13. package/dist/content-capture-worker.js +1 -1
  14. package/dist/content-capture-worker.js.map +1 -1
  15. package/dist/declaration-chain.d.ts +4 -19
  16. package/dist/declaration-chain.js +34 -74
  17. package/dist/declaration-chain.js.map +1 -1
  18. package/dist/declaration-commit.d.ts +0 -7
  19. package/dist/declaration-commit.js +10 -23
  20. package/dist/declaration-commit.js.map +1 -1
  21. package/dist/declaration-hold.d.ts +10 -22
  22. package/dist/declaration-hold.js +2 -34
  23. package/dist/declaration-hold.js.map +1 -1
  24. package/dist/declaration-journal.d.ts +17 -6
  25. package/dist/declaration-journal.js +48 -10
  26. package/dist/declaration-journal.js.map +1 -1
  27. package/dist/declaration-save.d.ts +2 -12
  28. package/dist/declaration-save.js +13 -46
  29. package/dist/declaration-save.js.map +1 -1
  30. package/dist/detection/owed-selection.d.ts +2 -4
  31. package/dist/detection/owed-selection.js +3 -18
  32. package/dist/detection/owed-selection.js.map +1 -1
  33. package/dist/detection/policy-owed.d.ts +1 -1
  34. package/dist/detection/policy-owed.js +2 -2
  35. package/dist/detection/policy-owed.js.map +1 -1
  36. package/dist/detection/root-examination.d.ts +0 -4
  37. package/dist/detection/root-examination.js +7 -20
  38. package/dist/detection/root-examination.js.map +1 -1
  39. package/dist/detection/root-walk.js +6 -18
  40. package/dist/detection/root-walk.js.map +1 -1
  41. package/dist/detection/runtime.js +4 -3
  42. package/dist/detection/runtime.js.map +1 -1
  43. package/dist/detection/scope-frame.d.ts +0 -3
  44. package/dist/detection/scope-frame.js +2 -2
  45. package/dist/detection/scope-frame.js.map +1 -1
  46. package/dist/detection/walk-law.d.ts +0 -8
  47. package/dist/detection/walk-law.js +0 -23
  48. package/dist/detection/walk-law.js.map +1 -1
  49. package/dist/entity-access-wire.d.ts +1 -1
  50. package/dist/entity-channel-holdings.d.ts +7 -7
  51. package/dist/entity-channel-holdings.js +49 -8
  52. package/dist/entity-channel-holdings.js.map +1 -1
  53. package/dist/entity-grant-watch.d.ts +6 -4
  54. package/dist/entity-grant-watch.js +13 -17
  55. package/dist/entity-grant-watch.js.map +1 -1
  56. package/dist/files-register-host.d.ts +5 -17
  57. package/dist/files-register-host.js +35 -37
  58. package/dist/files-register-host.js.map +1 -1
  59. package/dist/git/rail.d.ts +1 -1
  60. package/dist/git/rail.js +8 -7
  61. package/dist/git/rail.js.map +1 -1
  62. package/dist/git/read-state.d.ts +4 -2
  63. package/dist/git/read-state.js +20 -8
  64. package/dist/git/read-state.js.map +1 -1
  65. package/dist/git/write-files.js +6 -2
  66. package/dist/git/write-files.js.map +1 -1
  67. package/dist/graph-heads.d.ts +6 -0
  68. package/dist/graph-heads.js +8 -0
  69. package/dist/graph-heads.js.map +1 -1
  70. package/dist/ground-database.js +7 -2
  71. package/dist/ground-database.js.map +1 -1
  72. package/dist/ground-install-saves.d.ts +22 -8
  73. package/dist/ground-install-saves.js +23 -11
  74. package/dist/ground-install-saves.js.map +1 -1
  75. package/dist/ground-save-ops.d.ts +4 -3
  76. package/dist/ground-save-ops.js +4 -3
  77. package/dist/ground-save-ops.js.map +1 -1
  78. package/dist/materialize-records.js +1 -1
  79. package/dist/materialize-records.js.map +1 -1
  80. package/dist/native/cloud-files.node +0 -0
  81. package/dist/reference-placement.d.ts +62 -0
  82. package/dist/reference-placement.js +283 -0
  83. package/dist/reference-placement.js.map +1 -0
  84. package/dist/source-signature.d.ts +16 -3
  85. package/dist/source-signature.js +16 -3
  86. package/dist/source-signature.js.map +1 -1
  87. package/dist/user-ground-host.d.ts +47 -22
  88. package/dist/user-ground-host.js +278 -341
  89. package/dist/user-ground-host.js.map +1 -1
  90. package/dist/wire-client.d.ts +2 -3
  91. package/dist/wire-client.js +18 -13
  92. package/dist/wire-client.js.map +1 -1
  93. package/dist/wire-request-scope.d.ts +0 -1
  94. package/dist/wire-request-scope.js +0 -1
  95. package/dist/wire-request-scope.js.map +1 -1
  96. package/examinations/fixtures/private-wire-authority.js +13 -11
  97. package/npm-shrinkwrap.json +6 -6
  98. package/package.json +5 -5
@@ -0,0 +1,283 @@
1
+ /**
2
+ * How managed references, and the folders on their way, reach disk in core
3
+ * ground. Every one placed here is accepted: Add places the references its
4
+ * pinned head holds that this computer never materialized, and Register
5
+ * places what its declaration added in core once the authority accepts the
6
+ * head naming it. Nothing stands on disk before then, so ordinary Detect has
7
+ * nothing of a declaration to observe while Register runs.
8
+ *
9
+ * Each placement judges every step before its first effect and ends in one
10
+ * `install.placement` save (ground-install-saves.ts): core Detect then finds
11
+ * ground equal to its notebook, and Apply finds the history through the
12
+ * placed prefix resolved. A declaration's save also clears its journal row,
13
+ * which releases its root W to ordinary Detect.
14
+ *
15
+ * A placement runs inside the host's ground scope over core ground, so no
16
+ * Detect pass reads its effects before their rows commit. A process that
17
+ * stops between its first effect and that commit leaves ground no row names
18
+ * until the next placement adopts it.
19
+ */
20
+ import { lstatSync, mkdirSync, realpathSync, rmdirSync, rmSync, symlinkSync } from "node:fs";
21
+ import { dirname, join, relative } from "node:path";
22
+ import { sameRecords } from "@amalgm/live";
23
+ import { hasLocalWorkAfter } from "./apply-local-work.js";
24
+ import { capturedGroundRow, groundOwner } from "./captured-rows.js";
25
+ import { sightingUnder, stampContentClock } from "./content-clock.js";
26
+ import { enclosedSpine, pathExists, rendersReference } from "./files-register-host.js";
27
+ import { groundDatabase } from "./ground-database.js";
28
+ import { readGroundRowsByUUIDs } from "./ground-reads.js";
29
+ import { eachInventory, portableGroundRecord, slashPath } from "./ground-row.js";
30
+ import { save } from "./ground-saver.js";
31
+ import { coreRootsAt, isOnDemandRoot } from "./on-demand-roots.js";
32
+ import { sourceFingerprint } from "./source-signature.js";
33
+ import { cachedStatement } from "./sqlite.js";
34
+ /** Place the accepted references this machine has never materialized. Paths
35
+ * and bindings are local; UUIDs, parents, names, and versions are the same
36
+ * cloud entities on every machine. A reference this machine already knows is
37
+ * on its rails: Apply owns accepted transitions and Detect owns local ones. A
38
+ * new reference whose placement carries newer local work, or whose address is
39
+ * occupied by unsettled local ground, is likewise left alone. Add never
40
+ * writes an older accepted state over local ground or its notebook; every
41
+ * reference it leaves is reported as still syncing. Under a home this
42
+ * computer's drive serves, a new reference whose parent this computer does
43
+ * not show stands in folders the drive only lists: it is reported as listed,
44
+ * and the drive places it when something opens it. */
45
+ export async function placeAcceptedReferences(input) {
46
+ const { identity, userRoot, database, bindingDir, resourceId, workspace, references, deliveryWatermark } = input;
47
+ // A reference rendered after this stamp stays racy until it is next read.
48
+ // It precedes every read below, so nothing it waits on can move them.
49
+ const { boundary: clock } = await stampContentClock(database, userRoot);
50
+ const involved = new Set(references.flatMap(({ uuid, parentUUID }) => parentUUID ? [uuid, parentUUID] : [uuid]));
51
+ const observed = byUUID(readGroundRowsByUUIDs(database, "entities", involved));
52
+ const noted = byUUID(readGroundRowsByUUIDs(database, "detection_notebook", involved));
53
+ const ground = groundDatabase(database);
54
+ const localWork = new Set([...involved].filter((uuid) => hasLocalWorkAfter(ground, resourceId, uuid, deliveryWatermark)));
55
+ const onDemand = coreRootsAt(ground, userRoot).some((root) => isOnDemandRoot(ground, root));
56
+ const installed = [];
57
+ const syncingReferences = [];
58
+ const listedReferences = [];
59
+ const rendered = [];
60
+ try {
61
+ for (const reference of references) {
62
+ if (reference.type !== "reference" || reference.status !== "active" || !reference.payloadVersion
63
+ || reference.parentUUID === null) {
64
+ throw new Error("cloud registry has an invalid durable reference");
65
+ }
66
+ const known = [observed.get(reference.uuid), noted.get(reference.uuid)];
67
+ if (known.some(Boolean)) {
68
+ const current = known.every((row) => row && sameRecords([portableGroundRecord(row)], [reference]))
69
+ && rendersReference(known[0].absolutePath, bindingDir, reference.payloadVersion);
70
+ if (current)
71
+ installed.push(reference);
72
+ else
73
+ syncingReferences.push(reference.uuid);
74
+ continue;
75
+ }
76
+ const parent = observed.get(reference.parentUUID);
77
+ if (!parent && onDemand && !localWork.has(reference.uuid) && !localWork.has(reference.parentUUID)) {
78
+ listedReferences.push(reference.uuid);
79
+ continue;
80
+ }
81
+ const placeable = parent && [parent, noted.get(reference.parentUUID)].every((row) => row
82
+ && row.status === "active" && (row.type === "workspace" || row.type === "folder"));
83
+ if (!placeable || localWork.has(reference.uuid) || localWork.has(reference.parentUUID)) {
84
+ syncingReferences.push(reference.uuid);
85
+ continue;
86
+ }
87
+ const target = join(parent.absolutePath, reference.name);
88
+ const binding = join(bindingDir, reference.payloadVersion);
89
+ const created = !pathExists(target);
90
+ if (created) {
91
+ if (reference.payloadVersion === workspace.uuid && !pathExists(binding)) {
92
+ throw new Error(`workspace ${workspace.uuid} has no machine binding`);
93
+ }
94
+ symlinkSync(relative(dirname(target), binding), target);
95
+ }
96
+ else if (!rendersReference(target, bindingDir, reference.payloadVersion)) {
97
+ syncingReferences.push(reference.uuid);
98
+ continue;
99
+ }
100
+ const stats = lstatSync(target, { bigint: true });
101
+ rendered.push({ created, parent, row: { record: reference, relativePath: slashPath(relative(userRoot, target)),
102
+ absolutePath: target, sighting: sightingUnder(clock, stats), ...sourceFingerprint(stats) } });
103
+ installed.push(reference);
104
+ }
105
+ if (rendered.length > 0) {
106
+ await save(database, "install.placement", {
107
+ owner: groundOwner(identity),
108
+ placed: rendered.map(({ parent, row }) => capturedGroundRow(resourceId, parent.rootUUID, row)),
109
+ removed: [],
110
+ trashed: [],
111
+ materialization: { authorityId: resourceId, watermark: deliveryWatermark, resolvedAt: Date.now() },
112
+ cleared: null,
113
+ });
114
+ }
115
+ }
116
+ catch (error) {
117
+ for (const entry of rendered) {
118
+ if (entry.created && pathExists(entry.row.absolutePath))
119
+ rmSync(entry.row.absolutePath, { force: true });
120
+ }
121
+ throw error;
122
+ }
123
+ return { references: installed, syncingReferences, listedReferences };
124
+ }
125
+ const STANDING_AT = eachInventory((inventory) => `SELECT uuid, type FROM ${inventory}
126
+ WHERE resource_id = ? AND root_uuid = ? AND relative_path = ? AND status = 'active'`);
127
+ const BENEATH = `SELECT uuid FROM entities WHERE resource_id = ? AND root_uuid = ?
128
+ AND (relative_path = ? OR (relative_path > ? AND relative_path < ?))`;
129
+ /** Place what one accepted declaration added in core: the folders on the way
130
+ * to W's reference, top-down, and the reference itself, as `view` holds them.
131
+ * A step standing in both inventories and on disk stays; an absent one is
132
+ * created; a folder already on disk, or a reference already rendering W, is
133
+ * adopted. The reference replaces a spine holding only references to
134
+ * workspaces W's ground encloses: the spine its declaration put in Trash. */
135
+ export async function placeDeclaredWay(input) {
136
+ const { identity, database, userRoot, bindingDir, resourceId, coreRootId, entry, view } = input;
137
+ const workspaceId = entry.declarationRoot;
138
+ const clear = () => save(database, "register.cleared", entry.mutationId);
139
+ const conflict = async (reason, uuids = []) => {
140
+ await clear();
141
+ return { kind: "conflict", reason, uuids };
142
+ };
143
+ const held = await view.fold.locate(entry.declaredIds[0]);
144
+ if (!held || held.root !== coreRootId || held.record.status !== "active" || held.record.type !== "reference"
145
+ || held.record.payloadVersion !== workspaceId) {
146
+ if (!input.unseenIsGone)
147
+ return { kind: "unseen" };
148
+ await clear();
149
+ return { kind: "gone", uuids: [] };
150
+ }
151
+ const way = [held.record];
152
+ for (let parent = held.record.parentUUID; parent !== coreRootId;) {
153
+ const above = parent === null || way.some(({ uuid }) => uuid === parent) ? null : await view.fold.locate(parent);
154
+ if (!above || above.root !== coreRootId || above.record.status !== "active" || above.record.type !== "folder") {
155
+ return conflict(`the accepted way to workspace ${workspaceId}'s reference is not active folders in core`);
156
+ }
157
+ way.unshift(above.record);
158
+ parent = above.record.parentUUID;
159
+ }
160
+ const steps = way.map((record, index) => {
161
+ const names = way.slice(0, index + 1).map(({ name }) => name);
162
+ return { record, relativePath: names.join("/"), absolutePath: join(userRoot, ...names) };
163
+ });
164
+ const reference = steps.at(-1);
165
+ const declared = new Set(entry.declaredIds);
166
+ const replaced = new Map();
167
+ for (const uuid of entry.declaredIds) {
168
+ if (way.some((record) => record.uuid === uuid))
169
+ continue;
170
+ const located = await view.fold.locate(uuid);
171
+ if (located && located.root === coreRootId && located.record.status !== "active")
172
+ replaced.set(uuid, located.record);
173
+ }
174
+ // Every read precedes every judgment, and the stamp precedes every read.
175
+ const { boundary: clock } = await stampContentClock(database, userRoot);
176
+ const involved = new Set([...steps.map(({ record }) => record.uuid), ...replaced.keys()]);
177
+ const observed = byUUID(readGroundRowsByUUIDs(database, "entities", involved));
178
+ const noted = byUUID(readGroundRowsByUUIDs(database, "detection_notebook", involved));
179
+ const ground = groundDatabase(database);
180
+ const onDemand = isOnDemandRoot(ground, coreRootId);
181
+ let boundGround;
182
+ try {
183
+ boundGround = realpathSync(join(bindingDir, workspaceId));
184
+ }
185
+ catch {
186
+ return conflict(`workspace ${workspaceId} has no machine binding`);
187
+ }
188
+ for (const step of steps) {
189
+ const { record, relativePath, absolutePath } = step;
190
+ const isReference = step === reference;
191
+ for (const inventory of ["entities", "detection_notebook"]) {
192
+ const occupant = cachedStatement(ground, STANDING_AT[inventory])
193
+ .all(resourceId, coreRootId, relativePath)
194
+ .find(({ uuid }) => uuid !== record.uuid && !(isReference && replaced.has(uuid)));
195
+ if (occupant)
196
+ return conflict(`${absolutePath} is ${occupant.type} ${occupant.uuid} here, not ${record.type} ${record.uuid}`);
197
+ }
198
+ const own = [observed.get(record.uuid), noted.get(record.uuid)];
199
+ if (own.some((row) => row && (row.rootUUID !== coreRootId || row.relativePath !== relativePath
200
+ || row.status !== "active" || row.type !== record.type))) {
201
+ return conflict(`${record.type} ${record.uuid} stands here elsewhere than ${absolutePath}`);
202
+ }
203
+ // Every folder a declaration adds lies below every folder it found, so a
204
+ // folder the drive only lists has nothing of this placement above it.
205
+ if (onDemand && !own[0] && !declared.has(record.uuid)) {
206
+ await clear();
207
+ return { kind: "listed", uuids: [held.record.uuid] };
208
+ }
209
+ const shown = isReference ? rendersReference(absolutePath, bindingDir, workspaceId) : isDirectory(absolutePath);
210
+ if (shown)
211
+ step.action = own.every(Boolean) ? "stand" : "adopt";
212
+ else if (!pathExists(absolutePath))
213
+ step.action = "create";
214
+ else if (isReference && enclosedSpine(absolutePath, bindingDir, boundGround))
215
+ step.action = "replace";
216
+ else
217
+ return conflict(`${absolutePath} already holds ground of its own`);
218
+ }
219
+ const binding = join(bindingDir, workspaceId);
220
+ const created = [];
221
+ const placed = [];
222
+ let removed = [];
223
+ try {
224
+ for (const step of steps) {
225
+ if (step.action === "stand")
226
+ continue;
227
+ const isReference = step === reference;
228
+ if (step.action === "replace") {
229
+ removed = cachedStatement(ground, BENEATH).pluck().all(resourceId, coreRootId, step.relativePath, `${step.relativePath}/`, `${step.relativePath}0`);
230
+ rmSync(step.absolutePath, { recursive: true });
231
+ }
232
+ if (step.action === "create" || step.action === "replace") {
233
+ if (isReference)
234
+ symlinkSync(relative(dirname(step.absolutePath), binding), step.absolutePath);
235
+ else
236
+ mkdirSync(step.absolutePath, { mode: 0o755 });
237
+ created.push({ path: step.absolutePath, link: isReference });
238
+ }
239
+ const stats = lstatSync(step.absolutePath, { bigint: true });
240
+ placed.push(capturedGroundRow(resourceId, coreRootId, { record: step.record, relativePath: step.relativePath,
241
+ absolutePath: step.absolutePath, sighting: sightingUnder(clock, stats), ...sourceFingerprint(stats) }));
242
+ }
243
+ const trashed = [...replaced].flatMap(([uuid, record]) => {
244
+ const row = noted.get(uuid);
245
+ return row ? [{ ...row, status: record.status, version: record.version }] : [];
246
+ });
247
+ await save(database, "install.placement", {
248
+ owner: groundOwner(identity),
249
+ placed,
250
+ removed,
251
+ trashed,
252
+ materialization: { authorityId: resourceId, watermark: view.tail.through, resolvedAt: Date.now() },
253
+ cleared: entry.mutationId,
254
+ });
255
+ return { kind: "placed", uuids: [...placed, ...trashed].map(({ uuid }) => uuid) };
256
+ }
257
+ catch (error) {
258
+ for (const { path, link } of created.reverse()) {
259
+ try {
260
+ if (link)
261
+ rmSync(path, { force: true });
262
+ else
263
+ rmdirSync(path);
264
+ }
265
+ catch {
266
+ // A folder something else wrote into stays for Detect to observe.
267
+ }
268
+ }
269
+ throw error;
270
+ }
271
+ }
272
+ function byUUID(rows) {
273
+ return new Map(rows.map((row) => [row.uuid, row]));
274
+ }
275
+ function isDirectory(path) {
276
+ try {
277
+ return lstatSync(path).isDirectory();
278
+ }
279
+ catch {
280
+ return false;
281
+ }
282
+ }
283
+ //# sourceMappingURL=reference-placement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference-placement.js","sourceRoot":"","sources":["../src/reference-placement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,WAAW,EAAmD,MAAM,cAAc,CAAC;AAE5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAoB,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEvF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;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WAAW,CAAC,IAAY;IAC/B,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -37,13 +37,26 @@ export interface SourceFingerprint {
37
37
  physicalKey: string;
38
38
  sourceSignature: string;
39
39
  /** Beyond the signature, the mode is the object's kind and the file's
40
- * executable posture; every bit fits a number exactly. */
40
+ * executable posture as shownMode reads it; every bit fits a number
41
+ * exactly. */
41
42
  filesystemMode: number;
42
43
  }
44
+ /** Whether this computer's disk keeps a file's executable posture. Windows'
45
+ * does not: Node reads every file there with no run bits. */
46
+ export declare const DISK_SHOWS_POSTURE: boolean;
47
+ /** The mode an object stands at whose posture this computer last recorded as
48
+ * `recorded` (a row's mode, or a record's file mode; null when never
49
+ * recorded). A disk that keeps posture shows its own. On one that keeps none,
50
+ * the object keeps its kind and permissions with the recorded run bits, as
51
+ * Git's `core.fileMode=false` keeps the index's mode: a mode alone is never a
52
+ * change there, and a file never recorded is not executable. */
53
+ export declare const shownMode: (mode: number, recorded: number | null | undefined, shows?: boolean) => number;
43
54
  /** How many names the signed object had when signed; unknown without one. */
44
55
  export declare const signedLinks: (signature: string | null) => bigint | null;
45
- /** The row facts one stat establishes. */
46
- export declare const sourceFingerprint: (stat: SourceStat) => SourceFingerprint;
56
+ /** The row facts one stat establishes, its posture shown over the one
57
+ * `recorded` (shownMode). The signature keeps the stat's own mode: it judges
58
+ * whether the object moved, never what it means. */
59
+ export declare const sourceFingerprint: (stat: SourceStat, recorded?: number | null) => SourceFingerprint;
47
60
  /** A time precedes a boundary when every instant it may stand for does. A
48
61
  * time with no subsecond part may be a whole-second inode's truncation of any
49
62
  * instant in its second, so the whole second must precede the boundary. The
@@ -31,11 +31,24 @@ export const signedStat = (signature) => {
31
31
  export const sourceUnchanged = (signature, stat) => signature !== null && signature === sourceSignature(stat);
32
32
  /** Two stats of one address name the same unchanged object. */
33
33
  export const sameSource = (left, right) => sourceSignature(left) === sourceSignature(right);
34
+ /** Whether this computer's disk keeps a file's executable posture. Windows'
35
+ * does not: Node reads every file there with no run bits. */
36
+ export const DISK_SHOWS_POSTURE = process.platform !== "win32";
37
+ /** The mode an object stands at whose posture this computer last recorded as
38
+ * `recorded` (a row's mode, or a record's file mode; null when never
39
+ * recorded). A disk that keeps posture shows its own. On one that keeps none,
40
+ * the object keeps its kind and permissions with the recorded run bits, as
41
+ * Git's `core.fileMode=false` keeps the index's mode: a mode alone is never a
42
+ * change there, and a file never recorded is not executable. */
43
+ export const shownMode = (mode, recorded, shows = DISK_SHOWS_POSTURE) => shows ? mode : (mode & ~0o111) | ((recorded ?? 0) & 0o111);
34
44
  /** How many names the signed object had when signed; unknown without one. */
35
45
  export const signedLinks = (signature) => signature === null ? null : BigInt(signature.slice(signature.lastIndexOf(":") + 1));
36
- /** The row facts one stat establishes. */
37
- export const sourceFingerprint = (stat) => ({
38
- physicalKey: physicalKey(stat), sourceSignature: sourceSignature(stat), filesystemMode: Number(stat.mode),
46
+ /** The row facts one stat establishes, its posture shown over the one
47
+ * `recorded` (shownMode). The signature keeps the stat's own mode: it judges
48
+ * whether the object moved, never what it means. */
49
+ export const sourceFingerprint = (stat, recorded = null) => ({
50
+ physicalKey: physicalKey(stat), sourceSignature: sourceSignature(stat),
51
+ filesystemMode: shownMode(Number(stat.mode), recorded),
39
52
  });
40
53
  const SECOND_NS = 1000000000n;
41
54
  /** A time precedes a boundary when every instant it may stand for does. A
@@ -1 +1 @@
1
- {"version":3,"file":"source-signature.js","sourceRoot":"","sources":["../src/source-signature.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAMlD,MAAM,SAAS,GAAG,MAA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QAAQ,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAClH,MAAM,IAAI,GAAG,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpG,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACnC,CAAC"}
@@ -255,8 +255,12 @@ export declare class UserGroundHost {
255
255
  /** Roots whose repository Git itself will not open, with the reason. Every
256
256
  * examination re-derives the answer, so restart finds each one again. */
257
257
  private readonly rootRefusals;
258
- /** The committed head this machine last read or published. */
259
- private cloudState;
258
+ /** The authority this ground follows, bound before convergence reads
259
+ * anything (bindGroundAuthority). */
260
+ private authorityId;
261
+ /** One declaration resolution at a time: a lookup's and the one starting
262
+ * leaves in the background (resolveDeclarations). */
263
+ private declarationTurn;
260
264
  private converged;
261
265
  /** keptComputerFolder's answer, once read or chosen. */
262
266
  private computer;
@@ -297,6 +301,9 @@ export declare class UserGroundHost {
297
301
  private releaseGrantWatch;
298
302
  private applyRail;
299
303
  private applyHost;
304
+ /** The last placement of accepted declarations (reference-placement.ts);
305
+ * the next one starts after it. */
306
+ private placing;
300
307
  /** Pays the placement notes every notebook writer leaves (placement-tidy.ts). */
301
308
  private placementTidy;
302
309
  /** The maps of the roots this computer serves on demand (apply-map.ts),
@@ -472,11 +479,13 @@ export declare class UserGroundHost {
472
479
  * already stands. */
473
480
  private installPendingRoot;
474
481
  /** Register W: publish its declaration D, W's walked subtree and the core
475
- * records that reach it, in one graph head. Locally Register admits D and
476
- * the bookkeeping that installs it, and nothing else: every other
477
- * observation stays owed to ordinary Detect, and W stays held from it until
478
- * the authority accepts D. Live's binding and reference stay durable if a
479
- * later stage fails, so a retry declares the same W again. */
482
+ * records that reach it, in one graph head. Locally Register admits W's
483
+ * ground beside D's journal row, and nothing else: core gains D's folders
484
+ * and reference only once the authority accepts D, placed as the accepted
485
+ * view holds them, and W stays held from ordinary Detect until then. A
486
+ * declaration an earlier Register left accepted but unplaced is placed
487
+ * first. Live's binding stays durable if a later stage fails, so a retry
488
+ * declares the same W again. */
480
489
  completeWorkspaceRegistration(workspaceId: string): Promise<{
481
490
  readonly registered: true;
482
491
  readonly alreadyRegistered?: true;
@@ -505,8 +514,9 @@ export declare class UserGroundHost {
505
514
  * folds onto the newer view beside a new journal row, with no new walk. */
506
515
  private declareWorkspace;
507
516
  /** Fold D onto a fresh accepted view and admit it beside a new journal
508
- * row. The commit reads the chain's addresses again, so core Detect working
509
- * beside Register is never overwritten; a chain that moved folds again. */
517
+ * row. D's core records are records alone: nothing of them stands on disk
518
+ * until the authority accepts them, so core Detect working beside Register
519
+ * has nothing of D's to see or overwrite. */
510
520
  private declarationFold;
511
521
  /** W's ground on this machine: its binding, and every bound workspace it
512
522
  * encloses, whose identities it keeps. */
@@ -679,6 +689,10 @@ export declare class UserGroundHost {
679
689
  private keepComputerFolderId;
680
690
  private computerFolderIdFile;
681
691
  private cloudPort;
692
+ /** The authority's head as it stands, selected to the scope and kept, read
693
+ * once every declaration whose outcome this process never learned has
694
+ * resolved; null when the authority holds no graph for this person. */
695
+ private readHead;
682
696
  /** The graph an install reads (AGENTS.md §5): the head at N plus the
683
697
  * complete accepted tail the Inbox holds after N, folded by the one reducer
684
698
  * and selected to the operation's roots, at the tail's watermark T. Login
@@ -849,10 +863,19 @@ export declare class UserGroundHost {
849
863
  private directScope;
850
864
  private syncLocalChangesUnlocked;
851
865
  /** Declarations whose outcome this process never learned resolve before a
852
- * lookup reads the head. A submitted row may already be accepted: its exact
853
- * mutation recovers the receipt. A conclusive refusal settles the row as
854
- * rejected, and its ground stays held until Register declares it again. */
855
- private resolveDeclarationsBeforeLookup;
866
+ * lookup reads the head, one resolution at a time. A submitted row may
867
+ * already be accepted: its exact mutation recovers the receipt, and its way
868
+ * in core is placed once the lookup is done. A conclusive refusal settles
869
+ * the row as rejected, and its ground stays held until Register declares it
870
+ * again. `only` limits it to those rows. */
871
+ private resolveDeclarations;
872
+ /** Declarations a stop left behind finish in the background once the
873
+ * authority answers, so starting waits on no network: an unanswered one
874
+ * resolves, and every accepted one is placed. An attempt that fails is
875
+ * reported, waits its backoff and tries again, until shutdown. Only the
876
+ * rows standing now: a later one is its Register's, which submits and
877
+ * places it itself. */
878
+ private resolveLeftDeclarations;
856
879
  /** AV: the authority's current head H plus every accepted result Receive
857
880
  * has delivered after its watermark M. The head is read fresh, because a
858
881
  * graph-head commit is never an entity delivery. `beyond` is a delivery a
@@ -876,14 +899,16 @@ export declare class UserGroundHost {
876
899
  private uploadGraphPages;
877
900
  /** Seal a journaled declaration's pages and submit its exact head commit.
878
901
  * Its content sealed before the row was journaled, so only pages move here.
879
- * Acceptance clears the row and wakes the ground it held: acceptance is not
880
- * an entity delivery, so no delivery would wake it. A non-retryable answer
881
- * settles the row as rejected; every other failure leaves it pending with
882
- * its outcome unknown. */
902
+ * Acceptance keeps the committed head and leaves the row owing placement:
903
+ * W stays held until the folders on its way and its reference stand
904
+ * (`placeAcceptedDeclarations`). A non-retryable answer settles the row as rejected;
905
+ * every other failure leaves it pending with its outcome unknown. */
883
906
  private submitDeclaration;
884
- /** The accepted declaration no longer holds its ground. Acceptance is not
885
- * an entity delivery and rings no filesystem event, so it wakes what the
886
- * declaration held itself: the core records it added are suspected, and
887
- * every lane parked on its root reruns with whatever W owes. */
888
- private wakeDeclaration;
907
+ /** Place what every accepted declaration added in core, one placement at a
908
+ * time: each holds core ground, so two never wait on each other. `given` is
909
+ * a view the caller just read. A declaration it does not show may have been
910
+ * accepted after that read, so it is placed again on a fresh view; a fresh
911
+ * view read after its acceptance that still does not show it proves it gone. */
912
+ private placeAcceptedDeclarations;
913
+ private placeDeclarations;
889
914
  }