@amalgm/shell 0.1.164-main.41917702222 → 0.1.164-main.41943198184
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/apply-window-line.d.ts +4 -3
- package/dist/apply-window-line.js +7 -3
- package/dist/apply-window-line.js.map +1 -1
- package/dist/apply-window-store.d.ts +2 -2
- package/dist/captured-rows.d.ts +33 -0
- package/dist/captured-rows.js +43 -0
- package/dist/captured-rows.js.map +1 -0
- package/dist/detection/root-walk.d.ts +186 -0
- package/dist/detection/root-walk.js +1308 -0
- package/dist/detection/root-walk.js.map +1 -0
- package/dist/detection/withheld.d.ts +91 -0
- package/dist/detection/withheld.js +117 -0
- package/dist/detection/withheld.js.map +1 -0
- package/dist/git-command.js +7 -1
- package/dist/git-command.js.map +1 -1
- package/dist/ground-reads.d.ts +58 -0
- package/dist/ground-reads.js +200 -0
- package/dist/ground-reads.js.map +1 -0
- package/dist/ground-row.d.ts +2 -0
- package/dist/ground-row.js +2 -0
- package/dist/ground-row.js.map +1 -1
- package/dist/user-ground-host.d.ts +2 -2
- package/dist/user-ground-host.js +28 -1755
- package/dist/user-ground-host.js.map +1 -1
- package/dist/workspace-add-intent.d.ts +41 -0
- package/dist/workspace-add-intent.js +107 -0
- package/dist/workspace-add-intent.js.map +1 -0
- package/examinations/native-service.mjs +1 -6
- package/npm-shrinkwrap.json +6 -6
- package/package.json +5 -5
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* received prefix runs out: a short window reads few rows, a backlog of
|
|
9
9
|
* independent rows reads one full window, and the rows read are at most
|
|
10
10
|
* twice the window's. Writes stay with the saves (apply-window-saves.ts). */
|
|
11
|
-
import { type
|
|
11
|
+
import { type ApplyAhead, type ApplyWindow, type EntityApplyLineStep, type EntityApplyWork } from "@amalgm/live";
|
|
12
12
|
import type Database from "better-sqlite3";
|
|
13
13
|
import { type OnDemand, type PlaceRead } from "./apply-showing.js";
|
|
14
14
|
export declare class ApplyLine {
|
|
@@ -22,7 +22,8 @@ export declare class ApplyLine {
|
|
|
22
22
|
* when Live names an end. */
|
|
23
23
|
step(authorityId: string, before: number | null): EntityApplyLineStep;
|
|
24
24
|
/** The line's unresolved rows after position `after`, within its received
|
|
25
|
-
* prefix, in delivery order
|
|
26
|
-
|
|
25
|
+
* prefix, in delivery order, with the places this computer shows: what
|
|
26
|
+
* fetching ahead reads. */
|
|
27
|
+
ahead(authorityId: string, after: number, limit: number): ApplyAhead;
|
|
27
28
|
window(authorityId: string, before: number | null): ApplyWindow | null;
|
|
28
29
|
}
|
|
@@ -18,6 +18,8 @@ const WINDOW_ROWS = WINDOW_MEMBERS * 2;
|
|
|
18
18
|
/** The rows a step reads first. */
|
|
19
19
|
const FIRST_READ = 64;
|
|
20
20
|
const END = { kind: "end" };
|
|
21
|
+
/** No received prefix: nothing to read ahead. */
|
|
22
|
+
const NOTHING_AHEAD = { rows: [], shownPlace: () => undefined };
|
|
21
23
|
/** The complete received prefix of one authority's line, if it has one. */
|
|
22
24
|
function receivedPrefix(database, authorityId) {
|
|
23
25
|
return cachedStatement(database, `SELECT received_through FROM authority_delivery_cursors
|
|
@@ -62,12 +64,14 @@ export class ApplyLine {
|
|
|
62
64
|
return window === null ? END : { kind: "window", window };
|
|
63
65
|
}
|
|
64
66
|
/** The line's unresolved rows after position `after`, within its received
|
|
65
|
-
* prefix, in delivery order
|
|
67
|
+
* prefix, in delivery order, with the places this computer shows: what
|
|
68
|
+
* fetching ahead reads. */
|
|
66
69
|
ahead(authorityId, after, limit) {
|
|
67
70
|
const prefix = receivedPrefix(this.#database, authorityId);
|
|
68
71
|
if (prefix === undefined)
|
|
69
|
-
return
|
|
70
|
-
|
|
72
|
+
return NOTHING_AHEAD;
|
|
73
|
+
const shown = new ShownGround(this.#database, this.#onDemand);
|
|
74
|
+
return { rows: this.#rows(authorityId, after, prefix, limit), shownPlace: uuid => shown.place(uuid) };
|
|
71
75
|
}
|
|
72
76
|
window(authorityId, before) {
|
|
73
77
|
const open = readOpenWindow(this.#database, authorityId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-window-line.js","sourceRoot":"","sources":["../src/apply-window-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;6EAS6E;AAC7E,OAAO,EACL,YAAY,EACZ,0BAA0B,EAC1B,YAAY,EACZ,UAAU,EACV,cAAc,
|
|
1
|
+
{"version":3,"file":"apply-window-line.js","sourceRoot":"","sources":["../src/apply-window-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;6EAS6E;AAC7E,OAAO,EACL,YAAY,EACZ,0BAA0B,EAC1B,YAAY,EACZ,UAAU,EACV,cAAc,GASf,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,WAAW,EAAkD,MAAM,oBAAoB,CAAC;AAC5G,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;0DAC0D;AAC1D,MAAM,WAAW,GAAG,cAAc,GAAG,CAAC,CAAC;AAEvC,mCAAmC;AACnC,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,KAAK,EAAW,CAAC;AAErC,iDAAiD;AACjD,MAAM,aAAa,GAAe,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC;AAE5E,2EAA2E;AAC3E,SAAS,cAAc,CAAC,QAA2B,EAAE,WAAmB;IACtE,OAAO,eAAe,CAAC,QAAQ,EAAE;4BACP,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,WAAW,CAAuB,CAAC;AAC7E,CAAC;AAED;;qDAEqD;AACrD,SAAS,gBAAgB,CAAC,QAA2B,EAAE,WAAmB,EAAE,QAAgB,EAAE,cAAsB;IAClH,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG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E,CAAC,CAAC,CAAC;IAChI,CAAC;IAED,QAAQ,CAAC,WAAmB,EAAE,QAAgB,EAAE,OAAe;QAE7D,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACzG,MAAM,YAAY,GAAG,KAAK,EAAE,oBAAoB,IAAI,KAAK,CAAC,sBAAsB;YAC9E,CAAC,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,oBAAoB,EAAE,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,EAAE;YAChH,CAAC,CAAC,IAAI,CAAC;QACT,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,gBAAgB,IAAI,IAAI;YAC9E,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,0BAA0B,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;IACpF,CAAC;CACF"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (apply-window-saves.ts). The host stages each member's receipt before the
|
|
4
4
|
* bind and each member's verified rows before the end; the store posts them
|
|
5
5
|
* as one save each. */
|
|
6
|
-
import { type
|
|
6
|
+
import { type ApplyAhead, type ApplyDependencyOutcome, type ApplyStaleProof, type ApplyTerminalCommit, type ApplyWindowIntent, type CloudEntityRecord, type EntityApplyIntent, type EntityApplyLaneStep, type EntityApplyLineStep, type EntityApplyStorePort, type WindowMember, type WindowMemberOutcome } from "@amalgm/live";
|
|
7
7
|
import type Database from "better-sqlite3";
|
|
8
8
|
import { type OnDemand } from "./apply-showing.js";
|
|
9
9
|
import { type WindowMemberReceipt } from "./apply-window-rows.js";
|
|
@@ -48,7 +48,7 @@ export declare class ApplyWindowStore implements EntityApplyStorePort {
|
|
|
48
48
|
readApplyAuthorities(): readonly string[];
|
|
49
49
|
readApplyWindow(authorityId: string, before: number | null): EntityApplyLineStep;
|
|
50
50
|
/** The line's unresolved rows after `after`, for fetching ahead. */
|
|
51
|
-
readApplyAhead(authorityId: string, after: number, limit: number):
|
|
51
|
+
readApplyAhead(authorityId: string, after: number, limit: number): ApplyAhead;
|
|
52
52
|
/** One step of a unit's fetch lane (apply-window-lane.ts); each member's
|
|
53
53
|
* read is remembered for its bind and end. */
|
|
54
54
|
readFetchWindow(unit: string, through: number | null): Promise<EntityApplyLaneStep>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** A walk's captured rows and how one root's rows are saved: each observed
|
|
2
|
+
* and shared row replaces what its inventory held (`install.rows`). */
|
|
3
|
+
import type { CloudEntityRecord, UserGroundIdentity } from "@amalgm/live";
|
|
4
|
+
import type { GroundOwner, InstalledRows } from "./ground-install-saves.js";
|
|
5
|
+
import type { GroundRow } from "./ground-row.js";
|
|
6
|
+
import { type Saved } from "./ground-saver.js";
|
|
7
|
+
import type { SourceProof } from "./source-proof.js";
|
|
8
|
+
export interface CapturedRow {
|
|
9
|
+
readonly record: CloudEntityRecord;
|
|
10
|
+
readonly relativePath: string;
|
|
11
|
+
readonly absolutePath: string;
|
|
12
|
+
readonly physicalKey: string;
|
|
13
|
+
readonly sourceSignature: string | null;
|
|
14
|
+
readonly filesystemMode: number;
|
|
15
|
+
readonly sighting: string | null;
|
|
16
|
+
}
|
|
17
|
+
/** Retained sharing metadata is not a new physical capture. */
|
|
18
|
+
export type PublicationRow = Omit<CapturedRow, "filesystemMode"> & Pick<GroundRow, "filesystemMode">;
|
|
19
|
+
export declare function capturedGroundRow(resourceId: string, rootUUID: string, row: PublicationRow): GroundRow;
|
|
20
|
+
/** One root's observed and shared rows, each replacing what its inventory
|
|
21
|
+
* held before; sharing stands as it was when nothing was selected. A source
|
|
22
|
+
* proof's semantic phase has already answered; its physical phase closes as
|
|
23
|
+
* the save posts. Rows built ahead of a fact they rely on commit only once
|
|
24
|
+
* `after` holds (ground-saver.ts). */
|
|
25
|
+
export declare function persistRows(file: string, identity: UserGroundIdentity, resourceId: string, rootUUID: string, rows: {
|
|
26
|
+
readonly observed: readonly CapturedRow[];
|
|
27
|
+
readonly shared: readonly PublicationRow[] | null;
|
|
28
|
+
}, previousRows?: readonly Pick<GroundRow, "uuid" | "rootUUID" | "resourceId">[], options?: {
|
|
29
|
+
readonly source?: SourceProof;
|
|
30
|
+
readonly verified?: InstalledRows["verified"];
|
|
31
|
+
readonly after?: Promise<unknown>;
|
|
32
|
+
}): Promise<Saved<void>>;
|
|
33
|
+
export declare const groundOwner: ({ userId, userEmail, deviceId }: UserGroundIdentity) => GroundOwner;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { closePhysicallyOffThread } from "./content-capture-pool.js";
|
|
2
|
+
import { save } from "./ground-saver.js";
|
|
3
|
+
export function capturedGroundRow(resourceId, rootUUID, row) {
|
|
4
|
+
return {
|
|
5
|
+
resourceId,
|
|
6
|
+
rootUUID,
|
|
7
|
+
uuid: row.record.uuid,
|
|
8
|
+
type: row.record.type,
|
|
9
|
+
parentUUID: row.record.parentUUID,
|
|
10
|
+
name: row.record.name,
|
|
11
|
+
status: "active",
|
|
12
|
+
version: row.record.version,
|
|
13
|
+
payloadVersion: row.record.payloadVersion,
|
|
14
|
+
transportVersion: row.record.transportVersion,
|
|
15
|
+
relativePath: row.relativePath,
|
|
16
|
+
absolutePath: row.absolutePath,
|
|
17
|
+
physicalKey: row.physicalKey,
|
|
18
|
+
sourceSignature: row.sourceSignature,
|
|
19
|
+
filesystemMode: row.filesystemMode,
|
|
20
|
+
sighting: row.sighting,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** One root's observed and shared rows, each replacing what its inventory
|
|
24
|
+
* held before; sharing stands as it was when nothing was selected. A source
|
|
25
|
+
* proof's semantic phase has already answered; its physical phase closes as
|
|
26
|
+
* the save posts. Rows built ahead of a fact they rely on commit only once
|
|
27
|
+
* `after` holds (ground-saver.ts). */
|
|
28
|
+
export async function persistRows(file, identity, resourceId, rootUUID, rows, previousRows = [], options = {}) {
|
|
29
|
+
if (options.source)
|
|
30
|
+
await closePhysicallyOffThread(options.source, "complete");
|
|
31
|
+
return save(file, "install.rows", {
|
|
32
|
+
owner: groundOwner(identity),
|
|
33
|
+
resourceId,
|
|
34
|
+
rows: {
|
|
35
|
+
observed: rows.observed.map(row => capturedGroundRow(resourceId, rootUUID, row)),
|
|
36
|
+
shared: rows.shared && rows.shared.map(row => capturedGroundRow(resourceId, rootUUID, row)),
|
|
37
|
+
},
|
|
38
|
+
previous: previousRows.map(({ uuid, rootUUID: root, resourceId: held }) => ({ uuid, rootUUID: root, resourceId: held })),
|
|
39
|
+
...(options.verified ? { verified: options.verified } : {}),
|
|
40
|
+
}, options.after ? { after: options.after } : {});
|
|
41
|
+
}
|
|
42
|
+
export const groundOwner = ({ userId, userEmail, deviceId }) => ({ userId, userEmail, deviceId });
|
|
43
|
+
//# sourceMappingURL=captured-rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captured-rows.js","sourceRoot":"","sources":["../src/captured-rows.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAGrE,OAAO,EAAE,IAAI,EAAc,MAAM,mBAAmB,CAAC;AAgBrD,MAAM,UAAU,iBAAiB,CAC/B,UAAkB,EAClB,QAAgB,EAChB,GAAmB;IAEnB,OAAO;QACL,UAAU;QACV,QAAQ;QACR,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI;QACrB,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI;QACrB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,UAAU;QACjC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI;QACrB,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,O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,IAAI,EAAE,CAAC,CAAC;QACxH,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5D,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAsB,EAAe,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Refusal, type DetectionBatchPlan, type SuspicionSnapshot, type UserGroundIdentity } from "@amalgm/live";
|
|
2
|
+
import { type CapturedRow, type PublicationRow } from "../captured-rows.js";
|
|
3
|
+
import { type ContentStamp } from "../content-clock.js";
|
|
4
|
+
import { type GitMarker } from "../git/marker.js";
|
|
5
|
+
import { type GroundRow } from "../ground-row.js";
|
|
6
|
+
import { RegisterUploadFusion } from "../register-upload-fusion.js";
|
|
7
|
+
import { type SourceProof } from "../source-proof.js";
|
|
8
|
+
import { type ApplyOwnershipBlocker } from "./apply-ownership.js";
|
|
9
|
+
import { GroundSourceProof, type GroundObservationProof } from "./ground-proof.js";
|
|
10
|
+
import { readSharingPolicy } from "./sharing-policy.js";
|
|
11
|
+
import { type UnavailableRoot } from "./unreadable.js";
|
|
12
|
+
import { type Withheld } from "./withheld.js";
|
|
13
|
+
export interface MutableScanEvidence {
|
|
14
|
+
entries: number;
|
|
15
|
+
metadataReused: number;
|
|
16
|
+
contentReads: number;
|
|
17
|
+
gitInspections: number;
|
|
18
|
+
repositoryCaptures: number;
|
|
19
|
+
walkMs: number;
|
|
20
|
+
captureMs: number;
|
|
21
|
+
captureBusyMs: number;
|
|
22
|
+
captureBytes: number;
|
|
23
|
+
gitMs: number;
|
|
24
|
+
reconcileMs: number;
|
|
25
|
+
persistMs: number;
|
|
26
|
+
selection?: string;
|
|
27
|
+
}
|
|
28
|
+
/** A bound root standing on another device than the one it was bound on:
|
|
29
|
+
* its drive is unplugged, renumbered, or another is mounted there. As with an
|
|
30
|
+
* absent root, nothing of it is read or published. No timer retries it;
|
|
31
|
+
* later suspicion, or Register adopting the directory, asks again, and the
|
|
32
|
+
* original returning is caught up whole. */
|
|
33
|
+
export declare class RootOffDevice extends Refusal {
|
|
34
|
+
constructor(rootPath: string);
|
|
35
|
+
}
|
|
36
|
+
/** A root this process may not even look at, because a directory above it
|
|
37
|
+
* hides its entries. Like a binding the pass could not follow, it is unread
|
|
38
|
+
* ground, never absent: nothing of it is read or published, the domain's
|
|
39
|
+
* absence decisions wait for it, and access returning is heard. */
|
|
40
|
+
export declare class RootUnreachable extends Error {
|
|
41
|
+
readonly root: UnavailableRoot;
|
|
42
|
+
constructor(root: UnavailableRoot);
|
|
43
|
+
}
|
|
44
|
+
/** A bound root re-created on its device is the same workspace, compared
|
|
45
|
+
* whole: a walk that read less than a complete examination located owes
|
|
46
|
+
* its complete examination. */
|
|
47
|
+
export declare class RootRecreated extends Error {
|
|
48
|
+
constructor(rootPath: string);
|
|
49
|
+
}
|
|
50
|
+
/** What one examined root hands unit admission. */
|
|
51
|
+
export interface RootUnitEvidence {
|
|
52
|
+
/** The walk's retained sources, closed once outside SQLite. */
|
|
53
|
+
readonly walk: GroundSourceProof;
|
|
54
|
+
/** Identities whose collection did not complete, with why. */
|
|
55
|
+
readonly failed: ReadonlyMap<string, Withheld>;
|
|
56
|
+
/** Selection withheld a result for a cross-entity reason. */
|
|
57
|
+
readonly whole: boolean;
|
|
58
|
+
/** Proofs every unit of this root depends on: sharing policy and ownership. */
|
|
59
|
+
readonly rootProofs: readonly SourceProof[];
|
|
60
|
+
/** The sharing policy text this walk selected under; admission closes on it. */
|
|
61
|
+
readonly policy: string;
|
|
62
|
+
/** Regular files the walk read, by physical key. */
|
|
63
|
+
readonly physicalReads: ReadonlySet<string>;
|
|
64
|
+
/** Ground this walk could not read, by absolute address: a directory hides
|
|
65
|
+
* every entry beneath it, a leaf only its own bytes. */
|
|
66
|
+
readonly unread: ReadonlyMap<string, {
|
|
67
|
+
readonly reason: string;
|
|
68
|
+
readonly directory: boolean;
|
|
69
|
+
}>;
|
|
70
|
+
/** Unfinished Apply operations whose cones this walk left unread. */
|
|
71
|
+
readonly owners: readonly ApplyOwnershipBlocker[];
|
|
72
|
+
/** Why this walk's namespace cannot close, when it cannot: a directory it
|
|
73
|
+
* could not list, or listings no stamp can qualify. */
|
|
74
|
+
readonly namespace: string | null;
|
|
75
|
+
}
|
|
76
|
+
export interface RootObservationInput {
|
|
77
|
+
identity: UserGroundIdentity;
|
|
78
|
+
resourceId: string;
|
|
79
|
+
rootUUID: string;
|
|
80
|
+
rootName: string;
|
|
81
|
+
rootPath: string;
|
|
82
|
+
rootType: "workspace" | "folder" | "repo.git";
|
|
83
|
+
/** The `.git` observation that classified this root, when one did. */
|
|
84
|
+
rootMarker?: GitMarker | null;
|
|
85
|
+
rootParentUUID?: string | null;
|
|
86
|
+
database: string;
|
|
87
|
+
cacheDir: string;
|
|
88
|
+
bindingDir: string;
|
|
89
|
+
/** The content clock of the walk's root, stamped before the caller read
|
|
90
|
+
* the rows it hands in. */
|
|
91
|
+
stamp: ContentStamp;
|
|
92
|
+
suspects?: readonly string[] | null;
|
|
93
|
+
/** Drain and abandon collection if its scheduler requests foreground service. */
|
|
94
|
+
checkpoint?: () => void;
|
|
95
|
+
suspicion?: SuspicionSnapshot;
|
|
96
|
+
existingRows?: readonly GroundRow[];
|
|
97
|
+
/** Complete admitted predecessor, never a source of physical identity. */
|
|
98
|
+
sharingRows?: readonly GroundRow[];
|
|
99
|
+
/** Every deliberate binding remains a selectable UUID boundary, while only
|
|
100
|
+
* the outermost binding owns a physical scan. */
|
|
101
|
+
registeredBoundaries?: ReadonlyMap<string, string>;
|
|
102
|
+
evidence?: MutableScanEvidence;
|
|
103
|
+
/** Timing every syscall is itself work. Count cheap facts always, but take
|
|
104
|
+
* per-leg clocks only while a caller is actively reading trace evidence. */
|
|
105
|
+
measureEvidence?: boolean;
|
|
106
|
+
/** Whether this scan's consumer mints per-entity Send records. Only then
|
|
107
|
+
* does the walk select against sharing's admitted predecessor, stage cache
|
|
108
|
+
* bytes and build detection replays. Otherwise it is a declaration, a first
|
|
109
|
+
* login's or Register's: it selects from nothing, and its one complete
|
|
110
|
+
* snapshot reads ground at upload. */
|
|
111
|
+
plansSendRecords: boolean;
|
|
112
|
+
/** Register's walk of one declaration root, with nothing persisted here.
|
|
113
|
+
* The declaration commit admits both inventories beside its journal row. */
|
|
114
|
+
declaring?: boolean;
|
|
115
|
+
/** Workspaces declared but not yet published by Register. A reference to
|
|
116
|
+
* one is part of that declaration, so this scan never selects it. */
|
|
117
|
+
heldDeclarations?: ReadonlySet<string>;
|
|
118
|
+
/** Fused upload rail for a declaring walk: selected non-repository
|
|
119
|
+
* captures ship their bytes from the walk's own read. */
|
|
120
|
+
fusion?: RegisterUploadFusion;
|
|
121
|
+
/** The caller admits in independent units: evidence that moves while one
|
|
122
|
+
* identity is read fails that identity, never the root. Its lanes are rung,
|
|
123
|
+
* so a repository whose Git writer is still at work waits for the ring its
|
|
124
|
+
* lock's release makes, or for Git's longest lock wait to end
|
|
125
|
+
* (repository-state.ts); a cold journey reads through, as Git's own readers
|
|
126
|
+
* do, and its witnesses judge the moment. */
|
|
127
|
+
units?: boolean;
|
|
128
|
+
/** The root's sharing policy, when the caller already read it. */
|
|
129
|
+
policy?: ReturnType<typeof readSharingPolicy>;
|
|
130
|
+
/** Whether a complete examination of the root's present object located
|
|
131
|
+
* this scope (a pooled one), rather than Watch's names. */
|
|
132
|
+
pooled?: boolean;
|
|
133
|
+
/** A root examined only along Watch's names: the walk follows them, and every other row it holds is context, carried as
|
|
134
|
+
* last known and selected exactly as B holds it. */
|
|
135
|
+
folders?: boolean;
|
|
136
|
+
/** A folder scope's tops a pooled examination found vacant, relative to
|
|
137
|
+
* the root, each framed by its own rows alone: one that holds an object
|
|
138
|
+
* again is ground its frame cannot answer. */
|
|
139
|
+
vacant?: readonly string[];
|
|
140
|
+
/** A folder scope's proved returns, relative to the root, each a container
|
|
141
|
+
* on the way (scope-frame.ts answered): its own row observed, its members
|
|
142
|
+
* carried but where a name reaches. */
|
|
143
|
+
answered?: readonly string[];
|
|
144
|
+
/** Asked of each resolved identity the scope does not hold, context apart,
|
|
145
|
+
* before anything is built: both addresses of one that crossed the
|
|
146
|
+
* scope's edge. Any crossing ends the scan unbuilt, since its result could
|
|
147
|
+
* not be admitted. */
|
|
148
|
+
crossing?: (found: Pick<GroundRow, "uuid" | "physicalKey" | "absolutePath">, holds: (uuid: string) => boolean) => readonly string[];
|
|
149
|
+
}
|
|
150
|
+
type RootObservation = {
|
|
151
|
+
readonly kind: "unexamined";
|
|
152
|
+
} | {
|
|
153
|
+
readonly kind: "crossed";
|
|
154
|
+
readonly addresses: readonly string[];
|
|
155
|
+
} | {
|
|
156
|
+
readonly kind: "observed";
|
|
157
|
+
readonly rows: readonly PublicationRow[];
|
|
158
|
+
readonly observedRows: readonly CapturedRow[];
|
|
159
|
+
readonly sourceProof: GroundObservationProof;
|
|
160
|
+
readonly transferable: boolean;
|
|
161
|
+
/** Why this root's result cannot travel yet. A refusal is Git's own stable
|
|
162
|
+
* answer about the ground; anything else is a fault owed a retry. */
|
|
163
|
+
readonly transferFailure: {
|
|
164
|
+
readonly reason: string;
|
|
165
|
+
readonly refused: boolean;
|
|
166
|
+
} | null;
|
|
167
|
+
readonly detection: DetectionBatchPlan | null;
|
|
168
|
+
readonly trashedRows: readonly GroundRow[];
|
|
169
|
+
readonly units: RootUnitEvidence;
|
|
170
|
+
/** A folder scope's context: facts for its results, never results. */
|
|
171
|
+
readonly context: ReadonlySet<string>;
|
|
172
|
+
/** The O rows this observation re-decided, and the active ones among them
|
|
173
|
+
* no observed entry claimed. */
|
|
174
|
+
readonly examined: readonly Pick<GroundRow, "uuid">[];
|
|
175
|
+
readonly absent: readonly string[];
|
|
176
|
+
/** The retained identities observed entries proved returned, as stored;
|
|
177
|
+
* the ones back where they stood, which a reveal shows; and each revealed
|
|
178
|
+
* top with the rows beneath it still absent (ground-store.ts reveal). */
|
|
179
|
+
readonly returned: ReadonlyMap<string, GroundRow>;
|
|
180
|
+
readonly revealed: ReadonlyMap<string, GroundRow>;
|
|
181
|
+
readonly reveals: ReadonlyMap<string, readonly string[]>;
|
|
182
|
+
};
|
|
183
|
+
/** One walk of a root. What its reads staged is named together once the walk
|
|
184
|
+
* needs the names, or removed when the walk ends first (cargo-group.ts). */
|
|
185
|
+
export declare function observeRoot(input: RootObservationInput): Promise<RootObservation>;
|
|
186
|
+
export {};
|