@amalgm/shell 0.1.164-main.41283098420 → 0.1.164-main.41286451612
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.
- package/dist/git/write-files.js +49 -28
- package/dist/git/write-files.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/user-ground-host.d.ts +8 -2
- package/dist/user-ground-host.js +6 -1
- package/dist/user-ground-host.js.map +1 -1
- package/npm-shrinkwrap.json +7 -16
- package/package.json +5 -5
package/dist/git/write-files.js
CHANGED
|
@@ -9,9 +9,18 @@
|
|
|
9
9
|
* the target holds there. Under the lock the writer reads what stands: the
|
|
10
10
|
* target already means nothing to do, so an interrupted Apply resumes; the
|
|
11
11
|
* basis means it writes; anything else means something moved since the read,
|
|
12
|
-
* and Apply starts again from a new read.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* and Apply starts again from a new read. Nothing standing is an answer: a
|
|
13
|
+
* path that goes while it is read reads as nothing, and a removal that finds
|
|
14
|
+
* nothing has nothing to do. Any other act that finds its path or folder
|
|
15
|
+
* gone, its folder now a file, or a path that becomes another kind while it
|
|
16
|
+
* is read, met ground that moved. Git causes each: it writes and deletes a
|
|
17
|
+
* reflog under its ref's lock rather than the reflog's own, prunes the
|
|
18
|
+
* folders it empties, and writes a ref where such a folder stood.
|
|
19
|
+
* So this writer's lock does not keep Git out of a reflog either: an entry
|
|
20
|
+
* Git appends between Apply's read and its rename is lost, a gap still open.
|
|
21
|
+
* `objects/info/alternates` stands here with this machine's ground in front
|
|
22
|
+
* of each line naming a place in it (@amalgm/live git/alternates.ts), and is
|
|
23
|
+
* judged as it travels. */
|
|
15
24
|
import { lstat, mkdir, open, readFile, readlink, rename, rmdir, symlink, unlink } from "node:fs/promises";
|
|
16
25
|
import { join } from "node:path";
|
|
17
26
|
import { GIT_ALTERNATES_PATH, isGitLockPath, localGitAlternates } from "@amalgm/live";
|
|
@@ -19,19 +28,30 @@ import { blobId, travelling } from "./read-state.js";
|
|
|
19
28
|
const errno = (error) => error.code;
|
|
20
29
|
const same = (left, right) => left === null ? right === null : right !== null && left.mode === right.mode && left.oid === right.oid;
|
|
21
30
|
const moved = (path) => new Error(`${path} changed while Apply wrote it; Apply reads again`);
|
|
22
|
-
|
|
31
|
+
/** Nothing stands at the path: it, or a folder above it, is gone, or that folder is now a file. */
|
|
32
|
+
const gone = (error) => errno(error) === "ENOENT" || errno(error) === "ENOTDIR";
|
|
33
|
+
const alreadyGone = (error) => { if (!gone(error))
|
|
34
|
+
throw error; };
|
|
35
|
+
export function writeGitStep(gitDir, step, travelled, ground) {
|
|
36
|
+
return writeStep(gitDir, step, travelled, ground).catch(error => {
|
|
37
|
+
throw gone(error) ? moved(step.path) : error;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async function writeStep(gitDir, step, travelled, ground) {
|
|
23
41
|
const full = join(gitDir, step.path);
|
|
24
42
|
const { target } = step;
|
|
25
43
|
const bytes = step.path === GIT_ALTERNATES_PATH && target?.mode !== "120000"
|
|
26
44
|
? (oid) => Buffer.from(localGitAlternates(travelled(oid), ground)) : travelled;
|
|
27
|
-
const read = (
|
|
45
|
+
const read = () => readAs(full, step.path, travelling(step.path, ground));
|
|
28
46
|
if (target?.mode === "040000") {
|
|
29
47
|
try {
|
|
30
48
|
await mkdir(full);
|
|
31
49
|
}
|
|
32
50
|
catch (error) {
|
|
33
|
-
if (errno(error) !== "EEXIST"
|
|
51
|
+
if (errno(error) !== "EEXIST")
|
|
34
52
|
throw error;
|
|
53
|
+
if ((await read())?.mode !== "040000")
|
|
54
|
+
throw moved(step.path);
|
|
35
55
|
}
|
|
36
56
|
return;
|
|
37
57
|
}
|
|
@@ -51,16 +71,15 @@ export async function writeGitStep(gitDir, step, travelled, ground) {
|
|
|
51
71
|
// A lock file is itself the lock: Apply creates or removes it exclusively.
|
|
52
72
|
if (isGitLockPath(step.path)) {
|
|
53
73
|
if (target === null) {
|
|
54
|
-
const standing = await read(
|
|
74
|
+
const standing = await read();
|
|
55
75
|
if (standing === null)
|
|
56
76
|
return;
|
|
57
77
|
if (!same(standing, step.basis))
|
|
58
78
|
throw moved(step.path);
|
|
59
|
-
await unlink(full).catch(
|
|
60
|
-
throw error; });
|
|
79
|
+
await unlink(full).catch(alreadyGone);
|
|
61
80
|
return;
|
|
62
81
|
}
|
|
63
|
-
if (!await create(full, target, bytes) && !same(await read(
|
|
82
|
+
if (!await create(full, target, bytes) && !same(await read(), target))
|
|
64
83
|
throw moved(step.path);
|
|
65
84
|
return;
|
|
66
85
|
}
|
|
@@ -68,22 +87,24 @@ export async function writeGitStep(gitDir, step, travelled, ground) {
|
|
|
68
87
|
const content = target ?? { mode: "100644", oid: null };
|
|
69
88
|
if (!await create(lock, content, bytes))
|
|
70
89
|
throw new Error(`${step.path}: Git holds its lock here; Apply retries`);
|
|
90
|
+
let renamed = false;
|
|
71
91
|
try {
|
|
72
|
-
const standing = await read(
|
|
92
|
+
const standing = await read();
|
|
73
93
|
if (same(standing, target))
|
|
74
94
|
return;
|
|
75
95
|
if (!same(standing, step.basis))
|
|
76
96
|
throw moved(step.path);
|
|
77
97
|
if (target === null)
|
|
78
|
-
await unlink(full);
|
|
98
|
+
await unlink(full).catch(alreadyGone);
|
|
79
99
|
else {
|
|
80
100
|
await rename(lock, full);
|
|
81
|
-
|
|
101
|
+
renamed = true;
|
|
82
102
|
}
|
|
83
103
|
}
|
|
84
104
|
finally {
|
|
85
|
-
|
|
86
|
-
|
|
105
|
+
// The rename releases the lock, and a Git command may take it at once.
|
|
106
|
+
if (!renamed)
|
|
107
|
+
await unlink(lock).catch(alreadyGone);
|
|
87
108
|
}
|
|
88
109
|
}
|
|
89
110
|
/** Creates `path` exclusively holding the file's bytes, as Git creates a
|
|
@@ -109,29 +130,29 @@ async function create(path, file, bytes) {
|
|
|
109
130
|
}
|
|
110
131
|
catch (error) {
|
|
111
132
|
await handle.close();
|
|
112
|
-
await unlink(path).catch(
|
|
113
|
-
throw gone; });
|
|
133
|
+
await unlink(path).catch(alreadyGone);
|
|
114
134
|
throw error;
|
|
115
135
|
}
|
|
116
136
|
await handle.close();
|
|
117
137
|
return true;
|
|
118
138
|
}
|
|
119
|
-
/** What stands at `path
|
|
120
|
-
* it travels as. */
|
|
121
|
-
async function readAs(path, travels) {
|
|
122
|
-
let stat;
|
|
139
|
+
/** What stands at `path` (the step's `name`), named as the state names it:
|
|
140
|
+
* a file by the bytes it travels as. */
|
|
141
|
+
async function readAs(path, name, travels) {
|
|
123
142
|
try {
|
|
124
|
-
stat = await lstat(path);
|
|
143
|
+
const stat = await lstat(path);
|
|
144
|
+
if (stat.isDirectory())
|
|
145
|
+
return { mode: "040000", oid: null };
|
|
146
|
+
if (stat.isSymbolicLink())
|
|
147
|
+
return { mode: "120000", oid: blobId(await readlink(path, { encoding: "buffer" })) };
|
|
148
|
+
return { mode: (stat.mode & 0o100) !== 0 ? "100755" : "100644", oid: blobId(travels(await readFile(path))) };
|
|
125
149
|
}
|
|
126
150
|
catch (error) {
|
|
127
|
-
if (
|
|
151
|
+
if (gone(error))
|
|
128
152
|
return null;
|
|
153
|
+
if (errno(error) === "EISDIR" || errno(error) === "EINVAL")
|
|
154
|
+
throw moved(name);
|
|
129
155
|
throw error;
|
|
130
156
|
}
|
|
131
|
-
if (stat.isDirectory())
|
|
132
|
-
return { mode: "040000", oid: null };
|
|
133
|
-
if (stat.isSymbolicLink())
|
|
134
|
-
return { mode: "120000", oid: blobId(await readlink(path, { encoding: "buffer" })) };
|
|
135
|
-
return { mode: (stat.mode & 0o100) !== 0 ? "100755" : "100644", oid: blobId(travels(await readFile(path))) };
|
|
136
157
|
}
|
|
137
158
|
//# sourceMappingURL=write-files.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-files.js","sourceRoot":"","sources":["../../src/git/write-files.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"write-files.js","sourceRoot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AAC,CAAC,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/G,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAC7B,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,QAAQ;YAAE,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9E,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { FileStateEventStore } from "./state-store.js";
|
|
|
10
10
|
export { FileWorkspaceStore } from "./workspace-store.js";
|
|
11
11
|
export { WireClient, WireRequestError } from "./wire-client.js";
|
|
12
12
|
export type { WireClientOptions } from "./wire-client.js";
|
|
13
|
-
export { UserGroundHost } from "./user-ground-host.js";
|
|
13
|
+
export { GroundNotConverged, UserGroundHost } from "./user-ground-host.js";
|
|
14
14
|
export type { DetectScanEvidence, InstallStage, UserGroundCatchUp, UserGroundClosed, UserGroundHostOptions, } from "./user-ground-host.js";
|
|
15
15
|
export { NodeWatchHost } from "./watching/index.js";
|
|
16
16
|
export type { NativeWatchHandle, NodeWatchHostOptions, OpenNativeWatch, WatchGround, WatchCoverageEvidence, WatchHealth, WatchObservation, WatchCloseOptions, } from "./watching/index.js";
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export { createShellAuthorization, loadInstallationDeviceKey, promoteInstallatio
|
|
|
5
5
|
export { FileStateEventStore } from "./state-store.js";
|
|
6
6
|
export { FileWorkspaceStore } from "./workspace-store.js";
|
|
7
7
|
export { WireClient, WireRequestError } from "./wire-client.js";
|
|
8
|
-
export { UserGroundHost } from "./user-ground-host.js";
|
|
8
|
+
export { GroundNotConverged, UserGroundHost } from "./user-ground-host.js";
|
|
9
9
|
export { NodeWatchHost } from "./watching/index.js";
|
|
10
10
|
export { MachineHost, defaultMachineName } from "./machine-host.js";
|
|
11
11
|
export { CONTENT_WIRE_ENCODING, encodeContentWireBytes, } from "./content-wire-codec.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,oCAAoC,EACpC,+BAA+B,EAC/B,4BAA4B,EAC5B,kCAAkC,GACnC,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,oCAAoC,EACpC,+BAA+B,EAC/B,4BAA4B,EAC5B,kCAAkC,GACnC,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAQ3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAWpD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAYpE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -74,6 +74,11 @@ export interface FlushOutcome {
|
|
|
74
74
|
readonly reason: string;
|
|
75
75
|
}[];
|
|
76
76
|
}
|
|
77
|
+
/** A flush asked before login converged, or after convergence failed: no
|
|
78
|
+
* prefix can be proved, so it never answers as success. */
|
|
79
|
+
export declare class GroundNotConverged extends Error {
|
|
80
|
+
constructor();
|
|
81
|
+
}
|
|
77
82
|
export interface UserGroundHostOptions {
|
|
78
83
|
/** Runtime-owned transport. Standalone host examinations may own their client. */
|
|
79
84
|
readonly wire?: WireClient;
|
|
@@ -119,9 +124,10 @@ export interface UserGroundHostOptions {
|
|
|
119
124
|
readonly onDemand?: ApplyWindowHostOptions["onDemand"];
|
|
120
125
|
/** How much Files work this runtime still holds: records the cloud has not
|
|
121
126
|
* accepted, and disk changes not yet recorded. Each reaches zero only when
|
|
122
|
-
* nothing of its kind could be lost if the disk were destroyed now
|
|
127
|
+
* nothing of its kind could be lost if the disk were destroyed now; the
|
|
128
|
+
* unsent count is null while the Outbox cannot be read. */
|
|
123
129
|
readonly activity?: {
|
|
124
|
-
readonly unsent: (count: number) => void;
|
|
130
|
+
readonly unsent: (count: number | null) => void;
|
|
125
131
|
readonly unsettled: (count: number) => void;
|
|
126
132
|
};
|
|
127
133
|
/** A failed background pass (a Send or Receive attempt, an Apply lane, a
|
package/dist/user-ground-host.js
CHANGED
|
@@ -183,6 +183,11 @@ function rootScope(suspicion, result) {
|
|
|
183
183
|
answered: result.differences.filter(difference => difference.reason === "returned").map(difference => difference.path),
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
+
/** A flush asked before login converged, or after convergence failed: no
|
|
187
|
+
* prefix can be proved, so it never answers as success. */
|
|
188
|
+
export class GroundNotConverged extends Error {
|
|
189
|
+
constructor() { super("the user ground has not converged, so flush can prove nothing"); }
|
|
190
|
+
}
|
|
186
191
|
/** The production Files port injected into Core. Portable identity remains in
|
|
187
192
|
* Live; this class owns only Node filesystem, SQLite, Watch, and wire effects. */
|
|
188
193
|
export class UserGroundHost {
|
|
@@ -1283,7 +1288,7 @@ export class UserGroundHost {
|
|
|
1283
1288
|
* their last complete result remains the official one. */
|
|
1284
1289
|
async flush() {
|
|
1285
1290
|
if (!this.converged || !this.activeIdentity || !this.cloudState)
|
|
1286
|
-
|
|
1291
|
+
throw new GroundNotConverged();
|
|
1287
1292
|
const identity = this.activeIdentity;
|
|
1288
1293
|
this.watchHost.suspectAll();
|
|
1289
1294
|
// The complete suspicion above contains everything known at this cutoff.
|