@amalgm/shell 0.1.110 → 0.1.112
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/cli.js +24 -1
- package/dist/cli.js.map +1 -1
- package/dist/files-trace.d.ts +41 -0
- package/dist/files-trace.js +138 -0
- package/dist/files-trace.js.map +1 -0
- package/dist/gateway.js +7 -1
- package/dist/gateway.js.map +1 -1
- package/dist/machine-host.d.ts +6 -0
- package/dist/machine-host.js +25 -11
- package/dist/machine-host.js.map +1 -1
- package/dist/paged-mutation-submit.d.ts +5 -3
- package/dist/paged-mutation-submit.js +16 -7
- package/dist/paged-mutation-submit.js.map +1 -1
- package/dist/runtime-command-host.js +7 -1
- package/dist/runtime-command-host.js.map +1 -1
- package/dist/user-ground-host.d.ts +41 -0
- package/dist/user-ground-host.js +486 -171
- package/dist/user-ground-host.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,8 +6,10 @@ export const MAX_INLINE_OPERATION_BYTES = 8 * 1024 * 1024;
|
|
|
6
6
|
export const MUTATION_PAGE_BYTES = 4 * 1024 * 1024;
|
|
7
7
|
/** Publishes one mutation operation of any size as ONE atomic commit.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* The operation arrives as its canonical UTF-8 bytes, serialized exactly
|
|
10
|
+
* once by the caller — this function never re-serializes a graph. A small
|
|
11
|
+
* operation travels inline in the submit frame, byte-identical to the
|
|
12
|
+
* pre-paging wire. A larger one stages as byte pages of its canonical
|
|
11
13
|
* JSON, then submits a reference the gateway assembles into the same commit
|
|
12
14
|
* path — transport pages, the operation never does. Every attempt stages
|
|
13
15
|
* afresh, so a replay after a lost acknowledgement or dropped connection is
|
|
@@ -19,13 +21,16 @@ export const MUTATION_PAGE_BYTES = 4 * 1024 * 1024;
|
|
|
19
21
|
* bridge — the gateway reassembles the whole graph and the database journals
|
|
20
22
|
* it as one large operation; the eventual endpoint is immutable graph pages
|
|
21
23
|
* with a small atomically-committed graph-head pointer. */
|
|
22
|
-
export async function submitMutationOperation(wire, envelope, operation) {
|
|
23
|
-
const canonical =
|
|
24
|
+
export async function submitMutationOperation(wire, envelope, operation, onLeg) {
|
|
25
|
+
const canonical = operation;
|
|
26
|
+
const started = performance.now();
|
|
24
27
|
if (canonical.byteLength <= MAX_INLINE_OPERATION_BYTES) {
|
|
25
|
-
|
|
28
|
+
const frame = await wire.request({
|
|
26
29
|
type: "shared.mutation.submit",
|
|
27
|
-
envelope: { ...envelope, operation },
|
|
30
|
+
envelope: { ...envelope, operation: JSON.parse(canonical.toString("utf8")) },
|
|
28
31
|
}, ["shared.mutation.ack"]);
|
|
32
|
+
onLeg?.("submit", performance.now() - started);
|
|
33
|
+
return frame;
|
|
29
34
|
}
|
|
30
35
|
const staged = {
|
|
31
36
|
page_count: Math.ceil(canonical.byteLength / MUTATION_PAGE_BYTES),
|
|
@@ -43,10 +48,14 @@ export async function submitMutationOperation(wire, envelope, operation) {
|
|
|
43
48
|
bytes: page.byteLength,
|
|
44
49
|
}, page, ["shared.mutation.staged"]);
|
|
45
50
|
}
|
|
46
|
-
|
|
51
|
+
const submitStarted = performance.now();
|
|
52
|
+
onLeg?.("stage", submitStarted - started);
|
|
53
|
+
const frame = await wire.request({
|
|
47
54
|
type: "shared.mutation.submit",
|
|
48
55
|
envelope,
|
|
49
56
|
staged,
|
|
50
57
|
}, ["shared.mutation.ack"]);
|
|
58
|
+
onLeg?.("submit", performance.now() - submitStarted);
|
|
59
|
+
return frame;
|
|
51
60
|
}
|
|
52
61
|
//# sourceMappingURL=paged-mutation-submit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paged-mutation-submit.js","sourceRoot":"","sources":["../src/paged-mutation-submit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC;0EAC0E;AAC1E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,GAAG,IAAI,GAAG,IA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AgB,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;KACvE,CAAC;IACF,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAC7B,KAAK,GAAG,mBAAmB,EAC3B,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,mBAAmB,EAAE,SAAS,CAAC,UAAU,CAAC,CAClE,CAAC;QACF,MAAM,IAAI,CAAC,aAAa,CAAC;YACvB,IAAI,EAAE,uBAAuB;YAC7B,WAAW,EAAE,QAAQ,CAAC,UAAU;YAChC,WAAW,EAAE,QAAQ,CAAC,UAAU;YAChC,UAAU,EAAE,KAAK;YACjB,GAAG,MAAM;YACT,KAAK,EAAE,IAAI,CAAC,UAAU;SACvB,EAAE,IAAI,EAAE,CAAC,wBAAwB,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IACxC,KAAK,EAAE,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;QAC/B,IAAI,EAAE,wBAAwB;QAC9B,QAAQ;QACR,MAAM;KACP,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC5B,KAAK,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,aAAa,CAAC,CAAC;IACrD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -53,7 +53,13 @@ export async function callRuntimeCommand(input, path, body) {
|
|
|
53
53
|
const message = payload && typeof payload === "object" && "error" in payload
|
|
54
54
|
? String(payload.error)
|
|
55
55
|
: `runtime responded ${response.statusCode}`;
|
|
56
|
-
|
|
56
|
+
const failure = new Error(message);
|
|
57
|
+
const stages = payload && typeof payload === "object" && "stages" in payload
|
|
58
|
+
? payload.stages
|
|
59
|
+
: undefined;
|
|
60
|
+
if (Array.isArray(stages))
|
|
61
|
+
Object.assign(failure, { stages });
|
|
62
|
+
throw failure;
|
|
57
63
|
}
|
|
58
64
|
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
59
65
|
throw new Error("Files runtime returned an invalid response");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-command-host.js","sourceRoot":"","sources":["../src/runtime-command-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,UAAU,GAAG,YAAY,CAAC;AAyBhC,6EAA6E;AAC7E,MAAM,UAAU,sBAAsB,CAAC,KAAgC;IACrE,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACrD,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC;IAC3E,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE;QACtB,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,KAAK,CAAC,SAAS;QAC3B,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;KAC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|
|
|
1
1
|
import { type UserGroundPort, type UserHomeDeclaration } from "@amalgm/core/identity";
|
|
2
2
|
import { type EntityType, type FilesAddPorts, type FilesRegisterPorts, type UserGroundIdentity } from "@amalgm/live";
|
|
3
|
+
import Database from "better-sqlite3";
|
|
3
4
|
import { type FilesStageObserver } from "./files-observability.js";
|
|
4
5
|
import { type EntityApplyStageEvidence } from "./entity-apply-host.js";
|
|
5
6
|
import { type OpenNativeWatch, type WatchCoverageEvidence, type WatchHealth } from "./watching/index.js";
|
|
@@ -37,6 +38,28 @@ export interface DetectScanEvidence {
|
|
|
37
38
|
readonly plannedRows?: number;
|
|
38
39
|
readonly records?: number;
|
|
39
40
|
readonly recordBytes?: number;
|
|
41
|
+
/** Wall time inside readdir/lstat — the traversal's own cost. */
|
|
42
|
+
readonly walkMs?: number;
|
|
43
|
+
/** Wall time from the first content capture scheduled to the last settled. */
|
|
44
|
+
readonly captureMs?: number;
|
|
45
|
+
/** Summed capture task time. Divided by captureMs it is pool occupancy: at
|
|
46
|
+
* or near 1 the pool is idle-serial, near its width it is saturated. */
|
|
47
|
+
readonly captureBusyMs?: number;
|
|
48
|
+
/** Bytes read and hashed by content capture during this scan. */
|
|
49
|
+
readonly captureBytes?: number;
|
|
50
|
+
/** Wall time inside Git index inspection during the walk. */
|
|
51
|
+
readonly gitMs?: number;
|
|
52
|
+
/** Wall time proving repository identity through Git, across every
|
|
53
|
+
* repository. Repositories are sealed one at a time, so this is serial. */
|
|
54
|
+
readonly repositoryIdentityMs?: number;
|
|
55
|
+
/** Wall time packing repository transport bytes, across every repository. */
|
|
56
|
+
readonly repositoryCaptureMs?: number;
|
|
57
|
+
/** Wall time sealing and re-inspecting repository transport artifacts. */
|
|
58
|
+
readonly repositorySealMs?: number;
|
|
59
|
+
/** Wall time resolving stored UUIDs against what the walk found. */
|
|
60
|
+
readonly reconcileMs?: number;
|
|
61
|
+
/** Wall time planning and persisting rows once identity is settled. */
|
|
62
|
+
readonly persistMs?: number;
|
|
40
63
|
}
|
|
41
64
|
export interface UserGroundHostOptions {
|
|
42
65
|
readonly amalgmRoot: string;
|
|
@@ -66,6 +89,13 @@ export interface UserGroundHostOptions {
|
|
|
66
89
|
}) => Promise<void> | void;
|
|
67
90
|
/** Transient, opt-in evidence for exact stage measurement. */
|
|
68
91
|
readonly onFilesStage?: FilesStageObserver;
|
|
92
|
+
/**
|
|
93
|
+
* Is stage evidence being read right now? An observer may be permanently
|
|
94
|
+
* installed while nothing is listening, so the host asks rather than
|
|
95
|
+
* assumes: counters that cost real work on the critical path are computed
|
|
96
|
+
* only when the answer is yes.
|
|
97
|
+
*/
|
|
98
|
+
readonly filesTraceActive?: () => boolean;
|
|
69
99
|
}
|
|
70
100
|
export type WorkspaceAddStage = "intent-recorded" | "materialization-verified" | "rows-committed" | "ground-revealed" | "binding-created" | "watching";
|
|
71
101
|
export interface UserGroundCloseOptions {
|
|
@@ -101,6 +131,8 @@ export declare class UserGroundHost {
|
|
|
101
131
|
readonly port: UserGroundPort;
|
|
102
132
|
constructor(options: UserGroundHostOptions);
|
|
103
133
|
private stage;
|
|
134
|
+
/** Whether a counter worth real time on the critical path may be computed. */
|
|
135
|
+
private measuring;
|
|
104
136
|
private reportDetectScan;
|
|
105
137
|
databasePath(identity: UserGroundIdentity): string;
|
|
106
138
|
rows(identity: UserGroundIdentity): GroundRow[];
|
|
@@ -179,10 +211,19 @@ export declare class UserGroundHost {
|
|
|
179
211
|
* resource snapshot. */
|
|
180
212
|
private prepareSnapshotPublication;
|
|
181
213
|
private publishMaterializedSnapshot;
|
|
214
|
+
/** Close the graph-preparation stage with every leg it spent, so a slow
|
|
215
|
+
* preparation names the slow part instead of one opaque number. */
|
|
216
|
+
private finishPreparation;
|
|
182
217
|
/** Which of these heads does the authority hold sealed under the current
|
|
183
218
|
* content contract? Batched so a whole workspace costs a handful of
|
|
184
219
|
* frames; the answer is the only permission to skip an upload. */
|
|
185
220
|
private sealedContentHashes;
|
|
186
221
|
private publishPendingSnapshots;
|
|
222
|
+
private publishLoadedSnapshot;
|
|
187
223
|
}
|
|
224
|
+
/** The single opener and schema-migration entry for a user ground database.
|
|
225
|
+
* Exported so the upgrade path is provable in isolation — the journal
|
|
226
|
+
* conversion law test opens a legacy file through this exact entry inside a
|
|
227
|
+
* heap-capped child process. */
|
|
228
|
+
export declare function initializeDatabase(file: string): Database.Database;
|
|
188
229
|
export {};
|