@amalgm/live 0.2.8 → 0.2.9
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/PURPOSE.md
CHANGED
|
@@ -96,11 +96,10 @@ its cutover.
|
|
|
96
96
|
registered root with valid `.git` evidence is `repo.git`, as is any nested
|
|
97
97
|
directory with that evidence; the UUID does not change when the type does.
|
|
98
98
|
`.git` itself is repository transport metadata and never receives an
|
|
99
|
-
entity row. Worktree children retain local UUID rows,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
new machine never depends on an object outside the transport.
|
|
99
|
+
entity row. Worktree children retain local UUID rows, while their
|
|
100
|
+
identities ride in the repository state manifest rather than becoming
|
|
101
|
+
individual cloud records. A shallow repository carries its declared Git
|
|
102
|
+
history boundary, so a new machine never invents history beyond it.
|
|
104
103
|
22. **Transfer moves content; it never discovers state.** `upload` moves one
|
|
105
104
|
already-registered immutable artifact toward cloud storage and `download`
|
|
106
105
|
moves that same artifact toward a machine cache. Neither operation scans,
|
|
@@ -108,15 +107,26 @@ its cutover.
|
|
|
108
107
|
publishes a registry snapshot.
|
|
109
108
|
23. **Entity type selects the artifact, not a second lifecycle.** Text and
|
|
110
109
|
binary files travel as file bytes, links travel as their literal target,
|
|
111
|
-
and repositories travel as
|
|
110
|
+
and repositories travel as a small state manifest plus Git-native packs.
|
|
112
111
|
Workspace and folder membership travels in the entity graph; references
|
|
113
112
|
carry a UUID and therefore have no separate content artifact.
|
|
114
|
-
24. **Transfer is verified, missing-only, and commit-last.**
|
|
115
|
-
content-addressed and verified at each boundary; an uploader
|
|
116
|
-
|
|
117
|
-
machine cache lacks, and the
|
|
118
|
-
|
|
119
|
-
that the destination already has.
|
|
113
|
+
24. **Transfer is verified, missing-only, and commit-last.** File chunks and
|
|
114
|
+
Git packs are content-addressed and verified at each boundary; an uploader
|
|
115
|
+
sends only content the authority reports missing, a downloader fetches
|
|
116
|
+
only content its machine cache lacks, and the new state becomes visible
|
|
117
|
+
only after every dependency is durable. Repeating either operation is safe
|
|
118
|
+
and moves no bytes that the destination already has.
|
|
119
|
+
25. **Cold repository transfer is native Git work.** An empty destination
|
|
120
|
+
receives one binary pack containing exactly the objects reachable from the
|
|
121
|
+
repository's declared refs, plus bounded Amalgm state metadata. A Git pack
|
|
122
|
+
is never embedded in JSON or base64 and is never unpacked into per-file
|
|
123
|
+
upload requests.
|
|
124
|
+
26. **Incremental repository transfer is negotiated Git work.** The
|
|
125
|
+
destination's existing object frontier is the exclusion set for Git's
|
|
126
|
+
packer. A new repository state links to its prior transport and carries
|
|
127
|
+
only objects the prior state cannot supply; download follows and imports
|
|
128
|
+
only the missing links, oldest first. A one-file commit can never cause the
|
|
129
|
+
previously uploaded repository history to travel again.
|
|
120
130
|
|
|
121
131
|
## Five surfaces, one behavior
|
|
122
132
|
|
|
@@ -1,33 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* registration/repo-states.js + repocard/capture.js). A `repo.git`
|
|
4
|
-
* entity's semantic head is `stateId = sha256(cardId + checkpointId)`;
|
|
5
|
-
* this module owns those derivations and the exact JSON the state travels
|
|
6
|
-
* and persists as, byte for byte.
|
|
2
|
+
* Portable repository state and binary transport.
|
|
7
3
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* never names itself: its SHA-256 IS the immutable cloud content head,
|
|
14
|
-
* so bundle packing can vary without changing repository identity;
|
|
15
|
-
* - the identity map (worktree path → { uuid, type }) is transport cargo
|
|
16
|
-
* too: repo children never travel as individual cloud records, so
|
|
17
|
-
* their permanent UUIDs ride inside the one state parcel;
|
|
18
|
-
* - ids derive deterministically — remotes are seed metadata, not
|
|
19
|
-
* identity, and bundle bytes are excluded because packing is not
|
|
20
|
-
* deterministic. Equal ids are silence.
|
|
21
|
-
*
|
|
22
|
-
* `unpack` trusts its input to be `pack`'s output (the host's own durable
|
|
23
|
-
* row or transport parcel); it is a codec, not a wire validator.
|
|
24
|
-
*
|
|
25
|
-
* JSON parity note: derivations and `pack` serialize host-built objects,
|
|
26
|
-
* so nested key order follows the host's object insertion order. Build
|
|
27
|
-
* cards and checkpoints in the field order these interfaces declare (the
|
|
28
|
-
* engine capture order) and the bytes match the engine's exactly.
|
|
4
|
+
* Git object bytes remain a native PACK stream. Amalgm metadata is a short
|
|
5
|
+
* UTF-8 JSON header followed by raw checkpoint cargo; no byte field is ever
|
|
6
|
+
* base64 encoded. Successive transports name their parent and carry an
|
|
7
|
+
* identity-map delta, so one new commit never embeds old repository history
|
|
8
|
+
* or the unchanged per-path identity map again.
|
|
29
9
|
*/
|
|
30
10
|
import type { Sha256Hex } from './types.js';
|
|
11
|
+
export declare const REPOSITORY_TRANSPORT_CONTRACT = "amalgm.repo-transport.v2";
|
|
31
12
|
export interface RepoHead {
|
|
32
13
|
readonly branch: string | null;
|
|
33
14
|
readonly commit: string | null;
|
|
@@ -41,7 +22,8 @@ export interface RepoRemote {
|
|
|
41
22
|
readonly name: string;
|
|
42
23
|
readonly url: string;
|
|
43
24
|
}
|
|
44
|
-
|
|
25
|
+
/** A native Git pack. It may be thin when a parent transport supplies bases. */
|
|
26
|
+
export interface RepoPack {
|
|
45
27
|
readonly bytes: Uint8Array;
|
|
46
28
|
readonly sha256: string;
|
|
47
29
|
}
|
|
@@ -51,15 +33,9 @@ export interface RepoCard {
|
|
|
51
33
|
readonly branches: readonly RepoRef[];
|
|
52
34
|
readonly tags: readonly RepoRef[];
|
|
53
35
|
readonly remotes: readonly RepoRemote[];
|
|
54
|
-
/** Git's declared history horizon.
|
|
55
|
-
* parents intentionally are not; an empty receiver must install this
|
|
56
|
-
* boundary before importing the bundle. Transport metadata, not identity. */
|
|
36
|
+
/** Git's declared history horizon. */
|
|
57
37
|
readonly shallow?: readonly string[];
|
|
58
|
-
readonly bundle: RepoBundle | null;
|
|
59
38
|
}
|
|
60
|
-
/** `content: null` marks a reused (unopened) entry; ids derive from
|
|
61
|
-
* (path, mode, sha256) alone, so a scoped capture's ids are byte-identical
|
|
62
|
-
* to a from-scratch one over the same ground. */
|
|
63
39
|
export interface RepoUntrackedFile {
|
|
64
40
|
readonly path: string;
|
|
65
41
|
readonly mode: string;
|
|
@@ -74,52 +50,59 @@ export interface RepoCheckpoint {
|
|
|
74
50
|
readonly unstagedPatch: Uint8Array;
|
|
75
51
|
readonly untracked: readonly RepoUntrackedFile[];
|
|
76
52
|
}
|
|
77
|
-
/** One enrolled worktree entity inside the
|
|
53
|
+
/** One enrolled worktree entity inside the repository identity map. */
|
|
78
54
|
export interface RepoIdentityEntry {
|
|
79
55
|
readonly path: string;
|
|
80
56
|
readonly uuid: string;
|
|
81
57
|
readonly type: string;
|
|
82
58
|
}
|
|
59
|
+
export interface RepoIdentityDelta {
|
|
60
|
+
/** True only for a chain root. Its upserts are the complete identity map. */
|
|
61
|
+
readonly reset: boolean;
|
|
62
|
+
readonly upsert: readonly RepoIdentityEntry[];
|
|
63
|
+
readonly remove: readonly string[];
|
|
64
|
+
}
|
|
83
65
|
export interface RepoState {
|
|
84
66
|
readonly stateId: string;
|
|
85
67
|
readonly cardId: string;
|
|
86
68
|
readonly checkpointId: string;
|
|
87
|
-
readonly transportVersion?: string | null;
|
|
88
|
-
readonly identity?: readonly RepoIdentityEntry[] | null;
|
|
89
69
|
readonly card: RepoCard;
|
|
90
70
|
readonly checkpoint: RepoCheckpoint;
|
|
71
|
+
readonly pack: RepoPack | null;
|
|
91
72
|
}
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
readonly
|
|
96
|
-
readonly
|
|
73
|
+
/** One immutable node in a repository transport chain. */
|
|
74
|
+
export interface RepositoryTransport extends RepoState {
|
|
75
|
+
readonly parentTransportVersion: string | null;
|
|
76
|
+
readonly identityHash: string;
|
|
77
|
+
readonly identityDelta: RepoIdentityDelta;
|
|
97
78
|
}
|
|
98
|
-
export interface
|
|
99
|
-
readonly
|
|
100
|
-
readonly
|
|
101
|
-
readonly
|
|
79
|
+
export interface RepositoryTransportInput {
|
|
80
|
+
readonly parentTransportVersion: string | null;
|
|
81
|
+
readonly identityHash: string;
|
|
82
|
+
readonly identityDelta: RepoIdentityDelta;
|
|
102
83
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
export declare function
|
|
115
|
-
/**
|
|
116
|
-
|
|
117
|
-
|
|
84
|
+
export declare function repositoryIdentityHash(identity: readonly RepoIdentityEntry[], sha256Hex: Sha256Hex): string;
|
|
85
|
+
/** Derive the smallest path-keyed change from one identity map to the next. */
|
|
86
|
+
export declare function planRepositoryIdentity(current: readonly RepoIdentityEntry[], previous: readonly RepoIdentityEntry[] | null, sha256Hex: Sha256Hex): {
|
|
87
|
+
readonly identityHash: string;
|
|
88
|
+
readonly identityDelta: RepoIdentityDelta;
|
|
89
|
+
};
|
|
90
|
+
/** Apply and verify one identity-map chain node. */
|
|
91
|
+
export declare function applyRepositoryIdentity(previous: readonly RepoIdentityEntry[] | null, transport: Pick<RepositoryTransport, 'identityHash' | 'identityDelta'>, sha256Hex: Sha256Hex): readonly RepoIdentityEntry[];
|
|
92
|
+
/** Encode metadata followed by raw Git/checkpoint bytes. */
|
|
93
|
+
export declare function encodeRepositoryTransport(state: RepoState, input: RepositoryTransportInput): Uint8Array;
|
|
94
|
+
/** Decode the binary envelope without interpreting Git's native pack bytes. */
|
|
95
|
+
export declare function decodeRepositoryTransport(bytes: Uint8Array): RepositoryTransport;
|
|
96
|
+
/** Separate Git work from Amalgm metadata/checkpoint overhead in benchmarks. */
|
|
97
|
+
export declare function repositoryTransportSizes(bytes: Uint8Array): {
|
|
98
|
+
readonly totalBytes: number;
|
|
99
|
+
readonly metadataBytes: number;
|
|
100
|
+
readonly gitPackBytes: number;
|
|
101
|
+
readonly checkpointBytes: number;
|
|
102
|
+
};
|
|
103
|
+
/** Card identity from the ledger only. Remotes and transport data are absent. */
|
|
118
104
|
export declare function deriveCardId(card: Pick<RepoCard, 'version' | 'head' | 'branches' | 'tags'>, sha256Hex: Sha256Hex): string;
|
|
119
|
-
/** Checkpoint identity from
|
|
120
|
-
* untracked (path, mode, sha256) — never the untracked contents, so reused
|
|
121
|
-
* entries derive identically. */
|
|
105
|
+
/** Checkpoint identity from its hashes, never duplicated byte encodings. */
|
|
122
106
|
export declare function deriveCheckpointId(checkpoint: Pick<RepoCheckpoint, 'baseCommit' | 'stagedPatch' | 'unstagedPatch' | 'untracked'>, sha256Hex: Sha256Hex): string;
|
|
123
|
-
/** The repository's semantic head: sha256(cardId + checkpointId). */
|
|
124
107
|
export declare const deriveStateId: (cardId: string, checkpointId: string, sha256Hex: Sha256Hex) => string;
|
|
125
108
|
//# sourceMappingURL=repo-states.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-states.d.ts","sourceRoot":"","sources":["../../src/entities/repo-states.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"repo-states.d.ts","sourceRoot":"","sources":["../../src/entities/repo-states.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,eAAO,MAAM,6BAA6B,6BAA6B,CAAC;AAKxE,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,I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
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* registration/repo-states.js + repocard/capture.js). A `repo.git`
|
|
4
|
-
* entity's semantic head is `stateId = sha256(cardId + checkpointId)`;
|
|
5
|
-
* this module owns those derivations and the exact JSON the state travels
|
|
6
|
-
* and persists as, byte for byte.
|
|
2
|
+
* Portable repository state and binary transport.
|
|
7
3
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* never names itself: its SHA-256 IS the immutable cloud content head,
|
|
14
|
-
* so bundle packing can vary without changing repository identity;
|
|
15
|
-
* - the identity map (worktree path → { uuid, type }) is transport cargo
|
|
16
|
-
* too: repo children never travel as individual cloud records, so
|
|
17
|
-
* their permanent UUIDs ride inside the one state parcel;
|
|
18
|
-
* - ids derive deterministically — remotes are seed metadata, not
|
|
19
|
-
* identity, and bundle bytes are excluded because packing is not
|
|
20
|
-
* deterministic. Equal ids are silence.
|
|
21
|
-
*
|
|
22
|
-
* `unpack` trusts its input to be `pack`'s output (the host's own durable
|
|
23
|
-
* row or transport parcel); it is a codec, not a wire validator.
|
|
24
|
-
*
|
|
25
|
-
* JSON parity note: derivations and `pack` serialize host-built objects,
|
|
26
|
-
* so nested key order follows the host's object insertion order. Build
|
|
27
|
-
* cards and checkpoints in the field order these interfaces declare (the
|
|
28
|
-
* engine capture order) and the bytes match the engine's exactly.
|
|
4
|
+
* Git object bytes remain a native PACK stream. Amalgm metadata is a short
|
|
5
|
+
* UTF-8 JSON header followed by raw checkpoint cargo; no byte field is ever
|
|
6
|
+
* base64 encoded. Successive transports name their parent and carry an
|
|
7
|
+
* identity-map delta, so one new commit never embeds old repository history
|
|
8
|
+
* or the unchanged per-path identity map again.
|
|
29
9
|
*/
|
|
30
|
-
import {
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
10
|
+
import { utf8Decode, utf8Encode } from './bytes.js';
|
|
11
|
+
export const REPOSITORY_TRANSPORT_CONTRACT = 'amalgm.repo-transport.v2';
|
|
12
|
+
const MAGIC = utf8Encode('AMGREPO2');
|
|
13
|
+
const HEADER_BYTES = MAGIC.byteLength + 4;
|
|
14
|
+
const sortedIdentity = (identity) => [...identity].sort((left, right) => left.path < right.path ? -1 : left.path > right.path ? 1 : 0);
|
|
15
|
+
export function repositoryIdentityHash(identity, sha256Hex) {
|
|
16
|
+
return sha256Hex(JSON.stringify(sortedIdentity(identity)));
|
|
17
|
+
}
|
|
18
|
+
/** Derive the smallest path-keyed change from one identity map to the next. */
|
|
19
|
+
export function planRepositoryIdentity(current, previous, sha256Hex) {
|
|
20
|
+
const next = sortedIdentity(current);
|
|
21
|
+
if (new Set(next.map((entry) => entry.path)).size !== next.length) {
|
|
22
|
+
throw new Error('repository identity map has duplicate paths');
|
|
23
|
+
}
|
|
24
|
+
if (previous === null) {
|
|
25
|
+
return {
|
|
26
|
+
identityHash: repositoryIdentityHash(next, sha256Hex),
|
|
27
|
+
identityDelta: { reset: true, upsert: next, remove: [] },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const prior = new Map(previous.map((entry) => [entry.path, entry]));
|
|
31
|
+
const currentPaths = new Set(next.map((entry) => entry.path));
|
|
32
|
+
const upsert = next.filter((entry) => {
|
|
33
|
+
const old = prior.get(entry.path);
|
|
34
|
+
return old === undefined || old.uuid !== entry.uuid || old.type !== entry.type;
|
|
35
|
+
});
|
|
36
|
+
const remove = [...prior.keys()].filter((path) => !currentPaths.has(path)).sort();
|
|
37
|
+
return {
|
|
38
|
+
identityHash: repositoryIdentityHash(next, sha256Hex),
|
|
39
|
+
identityDelta: { reset: false, upsert, remove },
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Apply and verify one identity-map chain node. */
|
|
43
|
+
export function applyRepositoryIdentity(previous, transport, sha256Hex) {
|
|
44
|
+
if (transport.identityDelta.reset !== (previous === null)) {
|
|
45
|
+
throw new Error('repository identity delta has the wrong chain boundary');
|
|
46
|
+
}
|
|
47
|
+
const entries = new Map((previous ?? []).map((entry) => [entry.path, entry]));
|
|
48
|
+
for (const path of transport.identityDelta.remove)
|
|
49
|
+
entries.delete(path);
|
|
50
|
+
for (const entry of transport.identityDelta.upsert)
|
|
51
|
+
entries.set(entry.path, entry);
|
|
52
|
+
const result = sortedIdentity([...entries.values()]);
|
|
53
|
+
if (repositoryIdentityHash(result, sha256Hex) !== transport.identityHash) {
|
|
54
|
+
throw new Error('repository identity delta does not produce its declared map');
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
const descriptor = (bytes) => ({ bytes: bytes.byteLength });
|
|
59
|
+
/** Encode metadata followed by raw Git/checkpoint bytes. */
|
|
60
|
+
export function encodeRepositoryTransport(state, input) {
|
|
61
|
+
const header = {
|
|
62
|
+
contract: REPOSITORY_TRANSPORT_CONTRACT,
|
|
38
63
|
stateId: state.stateId,
|
|
39
64
|
cardId: state.cardId,
|
|
40
65
|
checkpointId: state.checkpointId,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
...state.card.bundle,
|
|
47
|
-
bytes: encodeBytes(state.card.bundle.bytes),
|
|
48
|
-
} : null,
|
|
49
|
-
},
|
|
66
|
+
parentTransportVersion: input.parentTransportVersion,
|
|
67
|
+
identityHash: input.identityHash,
|
|
68
|
+
identityDelta: input.identityDelta,
|
|
69
|
+
card: state.card,
|
|
70
|
+
pack: state.pack ? { sha256: state.pack.sha256, bytes: state.pack.bytes.byteLength } : null,
|
|
50
71
|
checkpoint: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
72
|
+
baseCommit: state.checkpoint.baseCommit,
|
|
73
|
+
branch: state.checkpoint.branch,
|
|
74
|
+
stagedPatch: descriptor(state.checkpoint.stagedPatch),
|
|
75
|
+
unstagedPatch: descriptor(state.checkpoint.unstagedPatch),
|
|
54
76
|
untracked: state.checkpoint.untracked.map((file) => ({
|
|
55
|
-
|
|
56
|
-
|
|
77
|
+
path: file.path,
|
|
78
|
+
mode: file.mode,
|
|
79
|
+
sha256: file.sha256,
|
|
80
|
+
...(file.reused === undefined ? {} : { reused: file.reused }),
|
|
81
|
+
content: file.content === null ? null : descriptor(file.content),
|
|
57
82
|
})),
|
|
58
83
|
},
|
|
59
|
-
}
|
|
84
|
+
};
|
|
85
|
+
const metadata = utf8Encode(JSON.stringify(header));
|
|
86
|
+
if (metadata.byteLength > 0xffff_ffff)
|
|
87
|
+
throw new Error('repository transport metadata is too large');
|
|
88
|
+
const cargo = [
|
|
89
|
+
...(state.pack ? [state.pack.bytes] : []),
|
|
90
|
+
state.checkpoint.stagedPatch,
|
|
91
|
+
state.checkpoint.unstagedPatch,
|
|
92
|
+
...state.checkpoint.untracked.flatMap((file) => file.content === null ? [] : [file.content]),
|
|
93
|
+
];
|
|
94
|
+
const cargoBytes = cargo.reduce((total, bytes) => total + bytes.byteLength, 0);
|
|
95
|
+
const output = new Uint8Array(HEADER_BYTES + metadata.byteLength + cargoBytes);
|
|
96
|
+
output.set(MAGIC, 0);
|
|
97
|
+
new DataView(output.buffer).setUint32(MAGIC.byteLength, metadata.byteLength, false);
|
|
98
|
+
output.set(metadata, HEADER_BYTES);
|
|
99
|
+
let cursor = HEADER_BYTES + metadata.byteLength;
|
|
100
|
+
for (const bytes of cargo) {
|
|
101
|
+
output.set(bytes, cursor);
|
|
102
|
+
cursor += bytes.byteLength;
|
|
103
|
+
}
|
|
104
|
+
return output;
|
|
60
105
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
106
|
+
const byteCount = (value, label) => {
|
|
107
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
108
|
+
throw new Error(`repository transport has invalid ${label} byte count`);
|
|
109
|
+
}
|
|
110
|
+
return value;
|
|
111
|
+
};
|
|
112
|
+
/** Decode the binary envelope without interpreting Git's native pack bytes. */
|
|
113
|
+
export function decodeRepositoryTransport(bytes) {
|
|
114
|
+
if (bytes.byteLength < HEADER_BYTES
|
|
115
|
+
|| MAGIC.some((value, index) => bytes[index] !== value)) {
|
|
116
|
+
throw new Error('repository transport has an invalid binary header');
|
|
117
|
+
}
|
|
118
|
+
const metadataBytes = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)
|
|
119
|
+
.getUint32(MAGIC.byteLength, false);
|
|
120
|
+
const cargoStart = HEADER_BYTES + metadataBytes;
|
|
121
|
+
if (cargoStart > bytes.byteLength)
|
|
122
|
+
throw new Error('repository transport metadata is truncated');
|
|
123
|
+
const header = JSON.parse(utf8Decode(bytes.subarray(HEADER_BYTES, cargoStart)));
|
|
124
|
+
if (header.contract !== REPOSITORY_TRANSPORT_CONTRACT) {
|
|
125
|
+
throw new Error('repository transport contract is unsupported');
|
|
126
|
+
}
|
|
127
|
+
let cursor = cargoStart;
|
|
128
|
+
const take = (count, label) => {
|
|
129
|
+
const length = byteCount(count, label);
|
|
130
|
+
const end = cursor + length;
|
|
131
|
+
if (!Number.isSafeInteger(end) || end > bytes.byteLength) {
|
|
132
|
+
throw new Error(`repository transport ${label} is truncated`);
|
|
133
|
+
}
|
|
134
|
+
const value = bytes.slice(cursor, end);
|
|
135
|
+
cursor = end;
|
|
136
|
+
return value;
|
|
137
|
+
};
|
|
138
|
+
const pack = header.pack === null ? null : {
|
|
139
|
+
sha256: header.pack.sha256,
|
|
140
|
+
bytes: take(header.pack.bytes, 'Git pack'),
|
|
141
|
+
};
|
|
142
|
+
const stagedPatch = take(header.checkpoint.stagedPatch.bytes, 'staged patch');
|
|
143
|
+
const unstagedPatch = take(header.checkpoint.unstagedPatch.bytes, 'unstaged patch');
|
|
144
|
+
const untracked = header.checkpoint.untracked.map((file) => ({
|
|
145
|
+
...file,
|
|
146
|
+
content: file.content === null ? null : take(file.content.bytes, `untracked file ${file.path}`),
|
|
147
|
+
}));
|
|
148
|
+
if (cursor !== bytes.byteLength)
|
|
149
|
+
throw new Error('repository transport has trailing cargo');
|
|
64
150
|
return {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
},
|
|
151
|
+
stateId: header.stateId,
|
|
152
|
+
cardId: header.cardId,
|
|
153
|
+
checkpointId: header.checkpointId,
|
|
154
|
+
parentTransportVersion: header.parentTransportVersion,
|
|
155
|
+
identityHash: header.identityHash,
|
|
156
|
+
identityDelta: header.identityDelta,
|
|
157
|
+
card: header.card,
|
|
158
|
+
pack,
|
|
75
159
|
checkpoint: {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
content: decodeBytes(file.content),
|
|
82
|
-
})),
|
|
160
|
+
baseCommit: header.checkpoint.baseCommit,
|
|
161
|
+
branch: header.checkpoint.branch,
|
|
162
|
+
stagedPatch,
|
|
163
|
+
unstagedPatch,
|
|
164
|
+
untracked,
|
|
83
165
|
},
|
|
84
166
|
};
|
|
85
167
|
}
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
* shed, the settled transport head recorded. */
|
|
93
|
-
export function localState(state, transportVersion) {
|
|
168
|
+
/** Separate Git work from Amalgm metadata/checkpoint overhead in benchmarks. */
|
|
169
|
+
export function repositoryTransportSizes(bytes) {
|
|
170
|
+
const transport = decodeRepositoryTransport(bytes);
|
|
171
|
+
const metadataBytes = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)
|
|
172
|
+
.getUint32(MAGIC.byteLength, false) + HEADER_BYTES;
|
|
173
|
+
const gitPackBytes = transport.pack?.bytes.byteLength ?? 0;
|
|
94
174
|
return {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
175
|
+
totalBytes: bytes.byteLength,
|
|
176
|
+
metadataBytes,
|
|
177
|
+
gitPackBytes,
|
|
178
|
+
checkpointBytes: bytes.byteLength - metadataBytes - gitPackBytes,
|
|
99
179
|
};
|
|
100
180
|
}
|
|
101
|
-
/** Card identity from the ledger only.
|
|
102
|
-
* Remotes deliberately absent: seed metadata, not identity.
|
|
103
|
-
* Bundle bytes deliberately absent: packing is not deterministic. */
|
|
181
|
+
/** Card identity from the ledger only. Remotes and transport data are absent. */
|
|
104
182
|
export function deriveCardId(card, sha256Hex) {
|
|
105
183
|
return sha256Hex(JSON.stringify({
|
|
106
184
|
version: card.version,
|
|
@@ -109,9 +187,7 @@ export function deriveCardId(card, sha256Hex) {
|
|
|
109
187
|
tags: card.tags,
|
|
110
188
|
}));
|
|
111
189
|
}
|
|
112
|
-
/** Checkpoint identity from
|
|
113
|
-
* untracked (path, mode, sha256) — never the untracked contents, so reused
|
|
114
|
-
* entries derive identically. */
|
|
190
|
+
/** Checkpoint identity from its hashes, never duplicated byte encodings. */
|
|
115
191
|
export function deriveCheckpointId(checkpoint, sha256Hex) {
|
|
116
192
|
return sha256Hex(JSON.stringify({
|
|
117
193
|
baseCommit: checkpoint.baseCommit,
|
|
@@ -122,6 +198,5 @@ export function deriveCheckpointId(checkpoint, sha256Hex) {
|
|
|
122
198
|
})),
|
|
123
199
|
}));
|
|
124
200
|
}
|
|
125
|
-
/** The repository's semantic head: sha256(cardId + checkpointId). */
|
|
126
201
|
export const deriveStateId = (cardId, checkpointId, sha256Hex) => sha256Hex(cardId + checkpointId);
|
|
127
202
|
//# sourceMappingURL=repo-states.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-states.js","sourceRoot":"","sources":["../../src/entities/repo-states.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"repo-states.js","sourceRoot":"","sources":["../../src/entities/repo-states.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,CAAC,MAAM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AC,SAAS,CAAC;QAC9B,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,WAAW,EAAE,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC;QAC9C,aAAa,EAAE,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC;QAClD,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM;SACtD,CAAC,CAAC;KACJ,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,YAAoB,EAAE,SAAoB,EAAU,EAAE,CAClG,SAAS,CAAC,MAAM,GAAG,YAAY,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amalgm/live",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Portable realtime SDK for Amalgm — wire contracts, mutation discipline, and delivery state machines behind host-injected adapters.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|