amalgm 0.1.239 → 0.1.241
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/lib/shared-realtime-tunnel.js +18 -4
- package/package.json +1 -1
- package/runtime/scripts/amalgm-mcp/browser/cookie-jar.js +68 -20
- package/runtime/scripts/amalgm-mcp/project-context/store.js +87 -19
- package/runtime/scripts/amalgm-mcp/server/routes/state.js +13 -0
- package/runtime/scripts/amalgm-mcp/state/attachments.js +40 -12
- package/runtime/scripts/amalgm-mcp/state/db.js +216 -17
- package/runtime/scripts/amalgm-mcp/state/doc-disk.js +550 -0
- package/runtime/scripts/amalgm-mcp/state/docs.js +1101 -301
- package/runtime/scripts/amalgm-mcp/state/mutation-contracts.js +99 -0
- package/runtime/scripts/amalgm-mcp/state/mutations.js +507 -130
- package/runtime/scripts/amalgm-mcp/state/promotions.js +21 -1
- package/runtime/scripts/amalgm-mcp/state/replicas.js +134 -13
- package/runtime/scripts/amalgm-mcp/state/shared-rest.js +14 -8
- package/runtime/scripts/amalgm-mcp/tests/browser-cookie-cloud.test.js +193 -0
- package/runtime/scripts/amalgm-mcp/tests/code-project-stream.test.js +313 -94
- package/runtime/scripts/amalgm-mcp/tests/fixtures/code-project-stream-v2.json +1 -0
- package/runtime/scripts/amalgm-mcp/tests/project-context.test.js +32 -17
- package/runtime/scripts/amalgm-mcp/tests/shared-tunnel-rehydration.test.js +84 -0
- package/runtime/scripts/amalgm-mcp/tests/state-docs.test.js +376 -13
- package/runtime/scripts/amalgm-mcp/tests/state-mutations.test.js +309 -0
- package/runtime/scripts/amalgm-mcp/tests/state-shared-replica.test.js +758 -30
- package/runtime/scripts/amalgm-mcp/tests/workspace-cards-store.test.js +72 -3
- package/runtime/scripts/amalgm-mcp/tests/workspace-cards.test.js +33 -6
- package/runtime/scripts/amalgm-mcp/tests/workspace-checkpoint-reducer.test.js +27 -0
- package/runtime/scripts/amalgm-mcp/tests/workspace-checkpoint.test.js +334 -191
- package/runtime/scripts/amalgm-mcp/tests/workspace-durable.test.js +24 -0
- package/runtime/scripts/amalgm-mcp/tests/workspace-local-intent.test.js +1999 -0
- package/runtime/scripts/amalgm-mcp/tests/workspace-native-file-transaction.test.js +364 -0
- package/runtime/scripts/amalgm-mcp/tests/workspace-object-tunnel.test.js +98 -4
- package/runtime/scripts/amalgm-mcp/tests/workspace-objects.test.js +156 -8
- package/runtime/scripts/amalgm-mcp/tests/workspace-provenance.test.js +185 -0
- package/runtime/scripts/amalgm-mcp/tests/workspace-publication-invariants.test.js +174 -269
- package/runtime/scripts/amalgm-mcp/tests/workspace-reducer-liveness.test.js +26 -0
- package/runtime/scripts/amalgm-mcp/tests/workspace-reducer.test.js +2060 -407
- package/runtime/scripts/amalgm-mcp/tests/workspace-sync-stats.test.js +119 -0
- package/runtime/scripts/amalgm-mcp/tests/workspace-transition.test.js +1446 -0
- package/runtime/scripts/amalgm-mcp/tests/workspace-tree-cloud.test.js +5319 -3
- package/runtime/scripts/amalgm-mcp/tests/workspace-tree-core.test.js +191 -1
- package/runtime/scripts/amalgm-mcp/tests/workspace-tree-store.test.js +3140 -17
- package/runtime/scripts/amalgm-mcp/tests/workspace-wall.test.js +135 -637
- package/runtime/scripts/amalgm-mcp/workspace/access-store.js +5 -1
- package/runtime/scripts/amalgm-mcp/workspace/card.js +7 -7
- package/runtime/scripts/amalgm-mcp/workspace/cards.js +36 -12
- package/runtime/scripts/amalgm-mcp/workspace/checkpoint.js +436 -173
- package/runtime/scripts/amalgm-mcp/workspace/content.js +32 -0
- package/runtime/scripts/amalgm-mcp/workspace/durable.js +45 -0
- package/runtime/scripts/amalgm-mcp/workspace/git.js +391 -37
- package/runtime/scripts/amalgm-mcp/workspace/intent.js +535 -0
- package/runtime/scripts/amalgm-mcp/workspace/merge.js +89 -6
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/BUILD.md +31 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/bin/darwin-arm64/amalgm-file-transaction +0 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/bin/linux-x64/amalgm-file-transaction +0 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/build.mjs +72 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/client.js +165 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/go.mod +5 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/go.sum +2 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/main.go +2201 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/manifest.json +19 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/move_darwin.go +18 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/move_linux.go +18 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/process_darwin.go +33 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/process_linux.go +47 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/verify.mjs +43 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/writers_darwin.go +114 -0
- package/runtime/scripts/amalgm-mcp/workspace/native-file-transaction/writers_linux.go +84 -0
- package/runtime/scripts/amalgm-mcp/workspace/objects.js +185 -55
- package/runtime/scripts/amalgm-mcp/workspace/project-stream.js +616 -168
- package/runtime/scripts/amalgm-mcp/workspace/provenance.js +240 -0
- package/runtime/scripts/amalgm-mcp/workspace/reducer.js +1979 -570
- package/runtime/scripts/amalgm-mcp/workspace/rest.js +49 -28
- package/runtime/scripts/amalgm-mcp/workspace/store.js +77 -4
- package/runtime/scripts/amalgm-mcp/workspace/sync-stats.js +240 -0
- package/runtime/scripts/amalgm-mcp/workspace/transition.js +1729 -192
- package/runtime/scripts/amalgm-mcp/workspace/tree/floor.js +100 -0
- package/runtime/scripts/amalgm-mcp/workspace/tree/inclusion.js +7 -1
- package/runtime/scripts/amalgm-mcp/workspace/tree/local-state.js +73 -61
- package/runtime/scripts/amalgm-mcp/workspace/tree/observation-holds.js +127 -0
- package/runtime/scripts/amalgm-mcp/workspace/tree/path-state.js +12 -0
- package/runtime/scripts/amalgm-mcp/workspace/tree/reducer.js +51 -6
- package/runtime/scripts/amalgm-mcp/workspace/tree/root-binding.js +125 -0
- package/runtime/scripts/amalgm-mcp/workspace/tree/snapshot.js +79 -8
- package/runtime/scripts/amalgm-mcp/workspace/tree/symlinks.js +76 -0
- package/runtime/scripts/amalgm-mcp/workspace/tree-cloud.js +3480 -165
- package/runtime/scripts/amalgm-mcp/workspace/tree-materialization.js +3766 -0
- package/runtime/scripts/amalgm-mcp/workspace/tree-store.js +899 -71
- package/runtime/scripts/amalgm-mcp/workspace/wall.js +352 -497
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('node:assert/strict');
|
|
4
|
+
const test = require('node:test');
|
|
5
|
+
const {
|
|
6
|
+
autoUpdateDisabled,
|
|
7
|
+
digest,
|
|
8
|
+
folderFor,
|
|
9
|
+
pendingIntentValue,
|
|
10
|
+
syncFingerprintFiles,
|
|
11
|
+
verificationFor,
|
|
12
|
+
} = require('../workspace/sync-stats')._test;
|
|
13
|
+
|
|
14
|
+
test('snapshot digest is content-derived rather than key-order-derived', () => {
|
|
15
|
+
assert.equal(
|
|
16
|
+
digest({ version: 7, records: [{ machine: 'm', cards: [] }] }),
|
|
17
|
+
digest({ records: [{ cards: [], machine: 'm' }], version: 7 }),
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('registered folder UUID and exact path identify the listening checkout', () => {
|
|
22
|
+
const project = { repoKey: 'repo', path: '/code/repo' };
|
|
23
|
+
const cards = [{
|
|
24
|
+
kind: 'primary',
|
|
25
|
+
path: '/wrong',
|
|
26
|
+
repo: { remote: 'repo' },
|
|
27
|
+
}];
|
|
28
|
+
const workspaces = [{ id: 'folder-uuid', path: '/code/repo' }];
|
|
29
|
+
assert.deepEqual(folderFor(project, cards, workspaces), {
|
|
30
|
+
card: cards[0],
|
|
31
|
+
folderPath: '/code/repo',
|
|
32
|
+
folderUuid: 'folder-uuid',
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('verification exposes one pending intent and named waits without hidden branches', () => {
|
|
37
|
+
const pendingIntent = {
|
|
38
|
+
baseThrough: 4,
|
|
39
|
+
semanticDigest: 'intent',
|
|
40
|
+
mutationId: null,
|
|
41
|
+
terminalCode: null,
|
|
42
|
+
};
|
|
43
|
+
const value = verificationFor({
|
|
44
|
+
verificationContract: 'verified-repo-state@1',
|
|
45
|
+
appliedThrough: 4,
|
|
46
|
+
materialized: false,
|
|
47
|
+
targetDigest: 'target',
|
|
48
|
+
expectedPhysicalDigest: 'expected',
|
|
49
|
+
observedPhysicalDigest: 'observed',
|
|
50
|
+
}, {
|
|
51
|
+
state: 'waiting',
|
|
52
|
+
reason: 'physical-state-mismatch',
|
|
53
|
+
}, pendingIntent);
|
|
54
|
+
assert.equal(value.appliedThrough, 4);
|
|
55
|
+
assert.equal(value.materialized, false);
|
|
56
|
+
assert.equal(value.pendingIntent, pendingIntent);
|
|
57
|
+
assert.equal(Object.hasOwn(value, 'pendingCard'), false);
|
|
58
|
+
assert.equal(Object.hasOwn(value, 'pendingRefs'), false);
|
|
59
|
+
assert.equal(Object.hasOwn(value, 'pendingCheckpoint'), false);
|
|
60
|
+
assert.deepEqual(value.waiting, [
|
|
61
|
+
{ state: 'waiting', reason: 'physical-state-mismatch' },
|
|
62
|
+
]);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('verification keeps the open successor visible after its predecessor is numbered', () => {
|
|
66
|
+
assert.deepEqual(pendingIntentValue({
|
|
67
|
+
base: { through: 4 },
|
|
68
|
+
semanticDigest: 'predecessor',
|
|
69
|
+
publication: { mutationId: 'mutation-a' },
|
|
70
|
+
terminal: null,
|
|
71
|
+
successor: {
|
|
72
|
+
predecessorSemanticDigest: 'predecessor',
|
|
73
|
+
semanticDigest: 'successor',
|
|
74
|
+
terminal: null,
|
|
75
|
+
},
|
|
76
|
+
}, false), {
|
|
77
|
+
baseThrough: 4,
|
|
78
|
+
semanticDigest: 'predecessor',
|
|
79
|
+
mutationId: 'mutation-a',
|
|
80
|
+
terminalCode: null,
|
|
81
|
+
successor: {
|
|
82
|
+
predecessorSemanticDigest: 'predecessor',
|
|
83
|
+
semanticDigest: 'successor',
|
|
84
|
+
mutationId: null,
|
|
85
|
+
terminalCode: null,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('auto-update state reflects only the runtime launch policy', () => {
|
|
91
|
+
assert.equal(autoUpdateDisabled({ AMALGM_DISABLE_AUTO_UPDATE: '1' }), true);
|
|
92
|
+
assert.equal(autoUpdateDisabled({ AMALGM_AUTO_UPDATE: 'off' }), true);
|
|
93
|
+
assert.equal(autoUpdateDisabled({ AMALGM_AUTO_UPDATE: '1' }), false);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('the sync fingerprint follows the complete state and workspace trees', () => {
|
|
97
|
+
for (const file of [
|
|
98
|
+
'state/doc-disk.js',
|
|
99
|
+
'state/docs.js',
|
|
100
|
+
'workspace/native-file-transaction/client.js',
|
|
101
|
+
'workspace/native-file-transaction/main.go',
|
|
102
|
+
'workspace/native-file-transaction/manifest.json',
|
|
103
|
+
'workspace/transition.js',
|
|
104
|
+
]) {
|
|
105
|
+
assert.ok(syncFingerprintFiles.includes(file), `${file} must be release-bound`);
|
|
106
|
+
}
|
|
107
|
+
assert.ok(
|
|
108
|
+
syncFingerprintFiles.some((file) => (
|
|
109
|
+
file === 'workspace/native-file-transaction/bin/darwin-arm64/amalgm-file-transaction'
|
|
110
|
+
)),
|
|
111
|
+
'the Darwin helper must be release-bound',
|
|
112
|
+
);
|
|
113
|
+
assert.ok(
|
|
114
|
+
syncFingerprintFiles.some((file) => (
|
|
115
|
+
file === 'workspace/native-file-transaction/bin/linux-x64/amalgm-file-transaction'
|
|
116
|
+
)),
|
|
117
|
+
'the Linux helper must be release-bound',
|
|
118
|
+
);
|
|
119
|
+
});
|