@amalgm/live 0.2.54 → 0.2.55
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 +6 -0
- package/dist/contracts/binding.d.ts +3 -2
- package/dist/contracts/binding.d.ts.map +1 -1
- package/dist/contracts/deployments.d.ts +39 -0
- package/dist/contracts/deployments.d.ts.map +1 -0
- package/dist/contracts/deployments.js +75 -0
- package/dist/contracts/deployments.js.map +1 -0
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +1 -0
- package/dist/contracts/index.js.map +1 -1
- package/dist/detection/adapter-contract.d.ts +0 -33
- package/dist/detection/adapter-contract.d.ts.map +1 -1
- package/dist/detection/adapter-contract.js +0 -32
- package/dist/detection/adapter-contract.js.map +1 -1
- package/dist/detection/diff.d.ts +5 -87
- package/dist/detection/diff.d.ts.map +1 -1
- package/dist/detection/diff.js +5 -111
- package/dist/detection/diff.js.map +1 -1
- package/dist/detection/enrollment.d.ts +8 -17
- package/dist/detection/enrollment.d.ts.map +1 -1
- package/dist/detection/enrollment.js +8 -73
- package/dist/detection/enrollment.js.map +1 -1
- package/dist/detection/index.d.ts +5 -8
- package/dist/detection/index.d.ts.map +1 -1
- package/dist/detection/index.js +5 -8
- package/dist/detection/index.js.map +1 -1
- package/dist/detection/territory.d.ts +1 -27
- package/dist/detection/territory.d.ts.map +1 -1
- package/dist/detection/territory.js +1 -77
- package/dist/detection/territory.js.map +1 -1
- package/dist/transfer/cargo.d.ts +46 -12
- package/dist/transfer/cargo.d.ts.map +1 -1
- package/dist/transfer/cargo.js +52 -18
- package/dist/transfer/cargo.js.map +1 -1
- package/dist-cjs/contracts/deployments.js +81 -0
- package/dist-cjs/contracts/deployments.js.map +1 -0
- package/dist-cjs/contracts/index.js +1 -0
- package/dist-cjs/contracts/index.js.map +1 -1
- package/dist-cjs/detection/adapter-contract.js +1 -34
- package/dist-cjs/detection/adapter-contract.js.map +1 -1
- package/dist-cjs/detection/diff.js +5 -113
- package/dist-cjs/detection/diff.js.map +1 -1
- package/dist-cjs/detection/enrollment.js +9 -75
- package/dist-cjs/detection/enrollment.js.map +1 -1
- package/dist-cjs/detection/index.js +5 -8
- package/dist-cjs/detection/index.js.map +1 -1
- package/dist-cjs/detection/territory.js +1 -79
- package/dist-cjs/detection/territory.js.map +1 -1
- package/dist-cjs/transfer/cargo.js +55 -20
- package/dist-cjs/transfer/cargo.js.map +1 -1
- package/package.json +1 -1
- package/dist/detection/continuity.d.ts +0 -54
- package/dist/detection/continuity.d.ts.map +0 -1
- package/dist/detection/continuity.js +0 -85
- package/dist/detection/continuity.js.map +0 -1
- package/dist-cjs/detection/continuity.js +0 -88
- package/dist-cjs/detection/continuity.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployments.js","sourceRoot":"","sources":["../../src/contracts/deployments.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AA4BH,8DAkBC;AAsBD,8DAmBC;AAED,0DAMC;AA7FD,+CAA0F;AAE7E,QAAA,oBAAoB,GAAG,qBAA8B,CAAC;AAqBnE,MAAM,OAAO,GAAG,6GAA6G,CAAC;AAE9H,+EAA+E;AAC/E,SAAgB,yBAAyB,CACvC,KAAc;IAEd,IAAI,CAAC,IAAA,sBAAQ,EAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,4BAAoB,IAAI,CAAC,IAAA,sBAAQ,EAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3F,OAAO,IAAA,uBAAS,EAAC,OAAO,EAAE,uCAAuC,CAAC,CAAC;IACrE,CAAC;IACD,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACpC,IAAI,CAAC,IAAA,8BAAgB,EAAC,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,IAAA,8BAAgB,EAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAChF,OAAO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exportStar(require("./snapshot.js"), exports);
|
|
27
27
|
__exportStar(require("./binding.js"), exports);
|
|
28
|
+
__exportStar(require("./deployments.js"), exports);
|
|
28
29
|
__exportStar(require("./presence.js"), exports);
|
|
29
30
|
__exportStar(require("./docs.js"), exports);
|
|
30
31
|
__exportStar(require("./content.js"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,gDAA8B;AAC9B,iDAA+B;AAC/B,8CAA4B;AAC5B,gDAA8B;AAC9B,+CAA6B;AAC7B,gDAA8B;AAC9B,4CAA0B;AAC1B,+CAA6B;AAC7B,kDAAgC;AAChC,qDAAmC;AACnC,sDAAoC;AACpC,qDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,gDAA8B;AAC9B,iDAA+B;AAC/B,8CAA4B;AAC5B,gDAA8B;AAC9B,+CAA6B;AAC7B,mDAAiC;AACjC,gDAA8B;AAC9B,4CAA0B;AAC1B,+CAA6B;AAC7B,kDAAgC;AAChC,qDAAmC;AACnC,sDAAoC;AACpC,qDAAmC"}
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* behavior differs by type — never for symmetry.
|
|
35
35
|
*/
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.
|
|
37
|
+
exports.SOCKETS = exports.RAILS = void 0;
|
|
38
38
|
exports.assertAdapter = assertAdapter;
|
|
39
39
|
exports.buildTypeMap = buildTypeMap;
|
|
40
40
|
/** The seven rails, declared once, frozen, in journey order. */
|
|
@@ -132,37 +132,4 @@ function buildTypeMap(adapters, alphabet) {
|
|
|
132
132
|
}
|
|
133
133
|
return byType;
|
|
134
134
|
}
|
|
135
|
-
/**
|
|
136
|
-
* The three-state vocabulary's one shared judgment: what a FAILED look
|
|
137
|
-
* at ground means. ENOENT and ENOTDIR are the filesystem itself saying
|
|
138
|
-
* "not there" — honest ABSENCE, a fact. Every other failure means the
|
|
139
|
-
* LOOK failed, not the ground — UNSETTLED: no conclusion, read again.
|
|
140
|
-
*
|
|
141
|
-
* Every truth reader classifies through this one function so no reader
|
|
142
|
-
* can invent its own idea of absence: mistaking "could not look" for
|
|
143
|
-
* "not there" is the exact lie axiom 4 forbids. Only present or absent
|
|
144
|
-
* may produce a conclusion.
|
|
145
|
-
*/
|
|
146
|
-
const lookFailed = (error) => error.code === 'ENOENT' || error.code === 'ENOTDIR'
|
|
147
|
-
? { truth: 'absent' }
|
|
148
|
-
: { truth: 'unsettled', reason: error.code };
|
|
149
|
-
exports.lookFailed = lookFailed;
|
|
150
|
-
/**
|
|
151
|
-
* The managed-reference adapter: Amalgm's OWN link kind, never
|
|
152
|
-
* conflated with a filesystem symlink. Its payload is the target
|
|
153
|
-
* entity's UUID — identity, not an address — and its local rendering as
|
|
154
|
-
* an ordinary symlink is DERIVED state (entity-model.md, symlink
|
|
155
|
-
* section). ASSIGNED, NOT YET OPERATIONAL — and that absence is the
|
|
156
|
-
* honest truth: no rail is bound because the projection lives inside
|
|
157
|
-
* the registration boundary today; its detect socket is ratified from
|
|
158
|
-
* that seam when the projection is extracted, never invented ahead of
|
|
159
|
-
* it.
|
|
160
|
-
*/
|
|
161
|
-
exports.referenceAdapter = Object.freeze({
|
|
162
|
-
name: 'reference',
|
|
163
|
-
types: Object.freeze({
|
|
164
|
-
reference: "its target entity's UUID — identity, not an address; the rendered symlink is derived state",
|
|
165
|
-
}),
|
|
166
|
-
rails: Object.freeze({}),
|
|
167
|
-
});
|
|
168
135
|
//# sourceMappingURL=adapter-contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-contract.js","sourceRoot":"","sources":["../../src/detection/adapter-contract.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;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,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrB,MAAM,IAAI,KAAK,CAAC,WAAW,OAAO,CAAC,IAAI,WAAW,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;YACrH,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAChC,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,uBAAuB,MAAM,CAAC,IAAI,QAAQ,OAAO,CAAC,IAAI,yBAAyB,CAAC,CAAC;YACtI,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;QACjG,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -6,27 +6,19 @@
|
|
|
6
6
|
* verdicts live here. Ratified by entity-model.md ("Address and
|
|
7
7
|
* physical continuity are the two identity witnesses, never content").
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* absorb that churn.
|
|
14
|
-
* - Directories: physical continuity claims first; the address claims
|
|
15
|
-
* what no inode claims. Nothing replaces a directory's inode in
|
|
16
|
-
* place, so a known inode at a new address IS the directory, moved.
|
|
17
|
-
* - Links: the FILE rules, for the file reason — retarget is unlink +
|
|
18
|
-
* recreate, so the inode churns exactly like an atomic save.
|
|
9
|
+
* Directories order the two witnesses opposite to files: physical
|
|
10
|
+
* continuity claims first and the address claims what no inode claims,
|
|
11
|
+
* because nothing replaces a directory's inode in place. So a known inode
|
|
12
|
+
* at a new address IS the directory, moved.
|
|
19
13
|
*/
|
|
20
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
15
|
exports.matchByInode = matchByInode;
|
|
22
16
|
exports.diffDirState = diffDirState;
|
|
23
|
-
exports.diffLinkState = diffLinkState;
|
|
24
|
-
exports.diffRootState = diffRootState;
|
|
25
17
|
/**
|
|
26
18
|
* Physical continuity, shared by every compare function: a row and an
|
|
27
19
|
* entry sharing one device:inode, exactly one match on both sides → the
|
|
28
20
|
* same physical thing. Anything else is never guessed. For files this
|
|
29
|
-
* rescues path-orphans
|
|
21
|
+
* rescues path-orphans; for directories it is the first rule.
|
|
30
22
|
*/
|
|
31
23
|
function matchByInode(rows, entries) {
|
|
32
24
|
const one = (map, key, value) => map.set(key, map.has(key) ? 'many' : value);
|
|
@@ -90,104 +82,4 @@ function diffDirState(rows, entries) {
|
|
|
90
82
|
deletes: [...rowsByPath.values()],
|
|
91
83
|
};
|
|
92
84
|
}
|
|
93
|
-
/**
|
|
94
|
-
* The compare function for link channels — the FILE identity rules, for
|
|
95
|
-
* the file reason: a symlink cannot be retargeted in place (retarget is
|
|
96
|
-
* unlink + recreate, so the inode churns exactly like an atomic save),
|
|
97
|
-
* so the path absorbs that churn and claims first; the inode rescues
|
|
98
|
-
* path-orphans (`mv` preserves a symlink's inode). The payload is the
|
|
99
|
-
* target string, already read at walk time. A consequence worth naming:
|
|
100
|
-
* two links exchanging names read as two retargets (path-first),
|
|
101
|
-
* because a link's meaning IS its written address.
|
|
102
|
-
* 1. Path claims the channel: same target = continued (a new inode
|
|
103
|
-
* under an old name with an old target is silent recreation),
|
|
104
|
-
* different target = changed.
|
|
105
|
-
* 2. Inode rescues path-orphans: renames.
|
|
106
|
-
* 3. Leftover entries are creates; leftover rows are deletes.
|
|
107
|
-
*/
|
|
108
|
-
function diffLinkState(rows, entries) {
|
|
109
|
-
const changes = [];
|
|
110
|
-
const retags = [];
|
|
111
|
-
const rowsByPath = new Map(rows.map((row) => [row.relPath, row]));
|
|
112
|
-
const claimedRowIds = new Set();
|
|
113
|
-
const orphanEntries = [];
|
|
114
|
-
for (const entry of entries) {
|
|
115
|
-
const row = rowsByPath.get(entry.relPath);
|
|
116
|
-
if (!row) {
|
|
117
|
-
orphanEntries.push(entry);
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
claimedRowIds.add(row.linkId);
|
|
121
|
-
if (row.target !== entry.target)
|
|
122
|
-
changes.push({ row, entry });
|
|
123
|
-
else if (row.device !== entry.device || row.inode !== entry.inode)
|
|
124
|
-
retags.push({ row, entry });
|
|
125
|
-
}
|
|
126
|
-
const orphanRows = rows.filter((row) => !claimedRowIds.has(row.linkId));
|
|
127
|
-
const renames = matchByInode(orphanRows, orphanEntries);
|
|
128
|
-
const renamedRowIds = new Set(renames.map((pair) => pair.row.linkId));
|
|
129
|
-
const renamedEntries = new Set(renames.map((pair) => pair.entry));
|
|
130
|
-
return {
|
|
131
|
-
changes,
|
|
132
|
-
retags,
|
|
133
|
-
renames,
|
|
134
|
-
creates: orphanEntries.filter((entry) => !renamedEntries.has(entry)),
|
|
135
|
-
deletes: orphanRows.filter((row) => !renamedRowIds.has(row.linkId)),
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* The compare function for file channels — doorbells and rescans both
|
|
140
|
-
* end here. Hashing is deferred — `checks` name the files whose content
|
|
141
|
-
* must be read before an event may be claimed.
|
|
142
|
-
*
|
|
143
|
-
* Identity rules, in order:
|
|
144
|
-
* 1. Path claims the channel. Same rel_path = same file_id, even when
|
|
145
|
-
* the inode changed (atomic saves replace the inode on every
|
|
146
|
-
* write).
|
|
147
|
-
* 2. Inode rescues path-orphans (matchByInode above).
|
|
148
|
-
* 3. Leftover entries are creates; leftover rows are deletes.
|
|
149
|
-
*
|
|
150
|
-
* The single stat-shortcut this layer allows itself: a (size, mtime,
|
|
151
|
-
* inode) triple identical to the stored one is skipped as unchanged —
|
|
152
|
-
* but only when the mtime is strictly older than the moment we last
|
|
153
|
-
* read the bytes (git's "racily clean" rule), and only when nothing
|
|
154
|
-
* pointed at the file. A path named in `mustCheck` (the doorbell said
|
|
155
|
-
* so) is always hashed: timestamps can lie, a delivered watcher event
|
|
156
|
-
* cannot be un-delivered.
|
|
157
|
-
*/
|
|
158
|
-
function diffRootState(rows, entries, mustCheck = null) {
|
|
159
|
-
const checks = [];
|
|
160
|
-
let unchanged = 0;
|
|
161
|
-
const rowsByPath = new Map(rows.map((row) => [row.relPath, row]));
|
|
162
|
-
const claimedRowIds = new Set();
|
|
163
|
-
const orphanEntries = [];
|
|
164
|
-
for (const entry of entries) {
|
|
165
|
-
const row = rowsByPath.get(entry.relPath);
|
|
166
|
-
if (!row) {
|
|
167
|
-
orphanEntries.push(entry);
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
claimedRowIds.add(row.fileId);
|
|
171
|
-
const statsMatch = row.size === entry.size && row.mtimeMs === entry.mtimeMs && row.inode === entry.inode;
|
|
172
|
-
const provablyBeforeLastRead = typeof row.hashedAtMs === 'number' && entry.mtimeMs < row.hashedAtMs;
|
|
173
|
-
const named = mustCheck !== null && mustCheck.has(entry.relPath);
|
|
174
|
-
if (statsMatch && provablyBeforeLastRead && !named) {
|
|
175
|
-
unchanged += 1;
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
checks.push({ row, entry });
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
const orphanRows = rows.filter((row) => !claimedRowIds.has(row.fileId));
|
|
182
|
-
const renames = matchByInode(orphanRows, orphanEntries);
|
|
183
|
-
const renamedRowIds = new Set(renames.map((pair) => pair.row.fileId));
|
|
184
|
-
const renamedEntries = new Set(renames.map((pair) => pair.entry));
|
|
185
|
-
return {
|
|
186
|
-
checks,
|
|
187
|
-
renames,
|
|
188
|
-
creates: orphanEntries.filter((entry) => !renamedEntries.has(entry)),
|
|
189
|
-
deletes: orphanRows.filter((row) => !renamedRowIds.has(row.fileId)),
|
|
190
|
-
unchanged,
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
85
|
//# sourceMappingURL=diff.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/detection/diff.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/detection/diff.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AA6BH,oCAiBC;AA2BD,oCAwBC;AA1ED;;;;;GAKG;AACH,SAAgB,YAAY,CAC1B,IAAoB,EACpB,OAAyB;IAEzB,MAAM,GAAG,GAAG,CAAQ,GAAgC,EAAE,GAAW,EAAE,KAAY,EAAE,EAAE,CACjF,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,IAAI,GAAG,EAAwB,CAAC;IACpD,KAAK,MAAM,GAAG,IAAI,IAAI;QAAE,GAAG,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,CAAC,CAAC;IAC5E,MAAM,cAAc,GAAG,IAAI,GAAG,EAA0B,CAAC;IACzD,KAAK,MAAM,KAAK,IAAI,OAAO;QAAE,GAAG,CAAC,cAAc,EAAE,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IAC1F,MAAM,OAAO,GAA6B,EAAE,CAAC;IAC7C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAA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C,CAAC;QAC1C,IAAI,GAAG,EAAE,CAAC;YACR,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACjC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAC1E,MAAM;QACN,OAAO;QACP,OAAO,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;KAClC,CAAC;AACJ,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Detection enrollment
|
|
3
|
+
* Detection enrollment policy.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
5
|
+
* User ground enrolls everything except structural local state and paths
|
|
6
|
+
* excluded by its tracked `.amalgmignore`; `.gitignore` never decides Amalgm
|
|
7
|
+
* enrollment, and there are no implicit dependency, dotfile, cache, or secret
|
|
8
|
+
* exclusions. Portable paths already use `/`; a host converts its native
|
|
9
|
+
* separator at the boundary. A literal `\\` is therefore preserved as part of
|
|
10
|
+
* a POSIX filename. The policy is pure strings-in/verdict-out and never
|
|
11
|
+
* inspects disk itself.
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
14
|
+
exports.DEFAULT_AMALGM_IGNORE = exports.AMALGM_IGNORE_FILE = exports.AMALGM_CONTROL_DIRECTORY = void 0;
|
|
15
15
|
exports.normalizedRelativePath = normalizedRelativePath;
|
|
16
16
|
exports.isAmalgmControlPath = isAmalgmControlPath;
|
|
17
17
|
exports.isSqliteCoordinationPath = isSqliteCoordinationPath;
|
|
@@ -22,72 +22,6 @@ exports.createUserGroundEnrollmentPolicy = createUserGroundEnrollmentPolicy;
|
|
|
22
22
|
exports.AMALGM_CONTROL_DIRECTORY = '.amalgm';
|
|
23
23
|
exports.AMALGM_IGNORE_FILE = '.amalgmignore';
|
|
24
24
|
exports.DEFAULT_AMALGM_IGNORE = `/${exports.AMALGM_CONTROL_DIRECTORY}/\n`;
|
|
25
|
-
const EXCLUDED_DIRECTORIES = new Set([
|
|
26
|
-
'.amalgm',
|
|
27
|
-
'.aws',
|
|
28
|
-
'.cache',
|
|
29
|
-
'.docker',
|
|
30
|
-
'.git',
|
|
31
|
-
'.gnupg',
|
|
32
|
-
'.gradle',
|
|
33
|
-
'.hg',
|
|
34
|
-
'.kube',
|
|
35
|
-
'.mypy_cache',
|
|
36
|
-
'.next',
|
|
37
|
-
'.nyc_output',
|
|
38
|
-
'.parcel-cache',
|
|
39
|
-
'.pytest_cache',
|
|
40
|
-
'.ruff_cache',
|
|
41
|
-
'.ssh',
|
|
42
|
-
'.svn',
|
|
43
|
-
'.svelte-kit',
|
|
44
|
-
'.turbo',
|
|
45
|
-
'.venv',
|
|
46
|
-
'.vite',
|
|
47
|
-
'__pycache__',
|
|
48
|
-
'coverage',
|
|
49
|
-
'node_modules',
|
|
50
|
-
]);
|
|
51
|
-
const EXCLUDED_FILES = new Set([
|
|
52
|
-
'.DS_Store',
|
|
53
|
-
'Thumbs.db',
|
|
54
|
-
'desktop.ini',
|
|
55
|
-
'npm-debug.log',
|
|
56
|
-
'pnpm-debug.log',
|
|
57
|
-
'yarn-debug.log',
|
|
58
|
-
'yarn-error.log',
|
|
59
|
-
]);
|
|
60
|
-
function isPrivateFile(name) {
|
|
61
|
-
if (/^\.env(?:\..+)?$/i.test(name) && !/\.example$/i.test(name))
|
|
62
|
-
return true;
|
|
63
|
-
if (/^(?:credentials?|secrets?)\.(?:json|ya?ml|toml|ini|conf)$/i.test(name))
|
|
64
|
-
return true;
|
|
65
|
-
if (/^id_(?:dsa|ecdsa|ed25519|rsa)$/i.test(name))
|
|
66
|
-
return true;
|
|
67
|
-
if (/^(?:\.git-credentials|\.netrc|\.npmrc|\.pypirc|auth\.json|kubeconfig)$/i.test(name))
|
|
68
|
-
return true;
|
|
69
|
-
if (/^(?:service[-_]?account|firebase[-_]?adminsdk).*\.json$/i.test(name))
|
|
70
|
-
return true;
|
|
71
|
-
return /\.(?:key|keystore|kdbx|p12|pfx|pem|ppk|tfstate(?:\.backup)?)$/i.test(name);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Legacy explicit-registration policy retained for additive API compatibility.
|
|
75
|
-
* Current user-ground Detect must use {@link createUserGroundEnrollmentPolicy};
|
|
76
|
-
* there are no implicit dependency, dotfile, cache, or secret exclusions.
|
|
77
|
-
* Both separators are path separators; '' never enrolls.
|
|
78
|
-
*
|
|
79
|
-
* @deprecated Use `createUserGroundEnrollmentPolicy` for current user ground.
|
|
80
|
-
*/
|
|
81
|
-
const defaultShouldEnroll = (relPath) => {
|
|
82
|
-
const parts = normalizedRelativePath(String(relPath || '').replace(/\\/g, '/')).split('/').filter(Boolean);
|
|
83
|
-
const name = parts.at(-1);
|
|
84
|
-
if (name === undefined || parts.some((part) => EXCLUDED_DIRECTORIES.has(part)))
|
|
85
|
-
return false;
|
|
86
|
-
if (EXCLUDED_FILES.has(name) || isPrivateFile(name))
|
|
87
|
-
return false;
|
|
88
|
-
return !name.startsWith('.#') && !name.endsWith('~') && !/\.(?:swp|swo)$/i.test(name);
|
|
89
|
-
};
|
|
90
|
-
exports.defaultShouldEnroll = defaultShouldEnroll;
|
|
91
25
|
/**
|
|
92
26
|
* One normalized spelling for portable enrollment and ignore matching.
|
|
93
27
|
* Portable relative paths use `/`. Do not reinterpret `\\`: it is a valid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrollment.js","sourceRoot":"","sources":["../../src/detection/enrollment.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;
|
|
1
|
+
{"version":3,"file":"enrollment.js","sourceRoot":"","sources":["../../src/detection/enrollment.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAiBH,wDAKC;AAGD,kDAEC;AAID,4DAGC;AA4DD,4EAaC;AAtGD;;qEAEqE;AACxD,QAAA,wBAAwB,GAAG,SAAS,CAAC;AACrC,QAAA,kBAAkB,GAAG,eAAe,CAAC;AACrC,QAAA,qBAAqB,GAAG,IAAI,gCAAwB,KAAK,CAAC;AAEvE;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,OAAe;IACpD,OAAO,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;SACzB,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;SACpB,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;SACzB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED,8EAA8E;AAC9E,SAAgB,mBAAmB,CAAC,OAAe;IACjD,OAAO,sBAAsB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,gCAAwB,CAAC,CAAC;AACvF,CAAC;AAED;8EAC8E;AAC9E,SAAgB,wBAAwB,CAAC,OAAe;IACtD,MAAM,IAAI,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACrE,OAAO,+CAA+C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACpE,CAAC;AAOD,SAAS,WAAW,CAAC,SAAiB;IACpC,OAAO,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7E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;YAAE,OAAO,IAAI,CAAC;QAChD,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;gBAAE,QAAQ,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;QAC9D,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Detection — the pure cores that turn observed disk evidence into facts.
|
|
4
4
|
* Normative sources:
|
|
5
|
-
* entity-model.md (identity axioms, the two
|
|
5
|
+
* entity-model.md (identity axioms, the two identity witnesses) and
|
|
6
6
|
* entity-implementation.md (the ratified seams).
|
|
7
7
|
*
|
|
8
8
|
* Everything here is rows and entries in, verdicts out. Walking disk,
|
|
@@ -11,15 +11,13 @@
|
|
|
11
11
|
* policy) and this layer owns only the laws:
|
|
12
12
|
*
|
|
13
13
|
* - `adapter-contract` the seven rails, the ratified detect socket,
|
|
14
|
-
* descriptor conviction
|
|
15
|
-
* judgment, the reference adapter
|
|
14
|
+
* and descriptor conviction
|
|
16
15
|
* - `classify` text/binary from detect's own read evidence
|
|
17
16
|
* - `refusal` declined-vs-broken, named where it is raised
|
|
18
|
-
* - `enrollment` tracked user-ground policy
|
|
19
|
-
* - `diff`
|
|
20
|
-
* - `continuity` root rescue and the undecided address
|
|
17
|
+
* - `enrollment` the tracked user-ground policy
|
|
18
|
+
* - `diff` directory channel identity from inode and address
|
|
21
19
|
* - `watch-boundary` generation-safe Watch input and coverage output
|
|
22
|
-
* - `territory` nearest-repository
|
|
20
|
+
* - `territory` nearest-repository ownership, indexed per graph
|
|
23
21
|
* - `record-proposal` the exact Detect-to-Record contract
|
|
24
22
|
* - `batch` net-difference planning and Watch settlement
|
|
25
23
|
* - `content` text/binary/link replay from one captured read
|
|
@@ -44,7 +42,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
44
42
|
__exportStar(require("./adapter-contract.js"), exports);
|
|
45
43
|
__exportStar(require("./batch.js"), exports);
|
|
46
44
|
__exportStar(require("./classify.js"), exports);
|
|
47
|
-
__exportStar(require("./continuity.js"), exports);
|
|
48
45
|
__exportStar(require("./content.js"), exports);
|
|
49
46
|
__exportStar(require("./diff.js"), exports);
|
|
50
47
|
__exportStar(require("./echo.js"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/detection/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/detection/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;;;;;;;;;;;;;;AAEH,wDAAsC;AACtC,6CAA2B;AAC3B,gDAA8B;AAC9B,+CAA6B;AAC7B,4CAA0B;AAC1B,4CAA0B;AAC1B,kDAAgC;AAChC,uDAAqC;AACrC,kDAAgC;AAChC,+CAA6B;AAC7B,iDAA+B;AAC/B,sDAAoC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/** Nearest-repository ownership for
|
|
2
|
+
/** Nearest-repository ownership, indexed once for a whole graph. */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.indexRepositoryTerritory = indexRepositoryTerritory;
|
|
5
|
-
exports.nearestRepository = nearestRepository;
|
|
6
|
-
exports.recorderTargets = recorderTargets;
|
|
7
5
|
/**
|
|
8
6
|
* Index nearest-repository territory once for a complete or boundary-trimmed
|
|
9
7
|
* graph. Hosts use this when one scan needs ownership for every row: repeated
|
|
@@ -54,80 +52,4 @@ function indexRepositoryTerritory(nodes) {
|
|
|
54
52
|
ownedBy: (repositoryId) => Object.freeze([...(owned.get(repositoryId) ?? [])]),
|
|
55
53
|
});
|
|
56
54
|
}
|
|
57
|
-
/** The nearest repo at or above `uuid`; nested repositories win. */
|
|
58
|
-
function nearestRepository(uuid, byUuid) {
|
|
59
|
-
const seen = new Set();
|
|
60
|
-
let cursor = uuid;
|
|
61
|
-
while (cursor !== null) {
|
|
62
|
-
if (seen.has(cursor))
|
|
63
|
-
throw new Error(`registry corrupt: parent cycle at ${cursor}`);
|
|
64
|
-
seen.add(cursor);
|
|
65
|
-
const row = byUuid(cursor);
|
|
66
|
-
if (!row)
|
|
67
|
-
throw new Error(`no entity ${cursor}`);
|
|
68
|
-
if (row.type === 'repo.git')
|
|
69
|
-
return row;
|
|
70
|
-
cursor = row.parentUuid;
|
|
71
|
-
}
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Name every recorder whose state a transition can change.
|
|
76
|
-
*
|
|
77
|
-
* Ordinary changes outside repository territory publish on the entity UUID.
|
|
78
|
-
* A change wholly inside one repository publishes only the repository parcel.
|
|
79
|
-
* Crossing a repository boundary also publishes the entity graph transition,
|
|
80
|
-
* plus the source and/or destination repositories whose identity maps and
|
|
81
|
-
* Checkpoints changed.
|
|
82
|
-
*/
|
|
83
|
-
function recorderTargets(transition, byUuid) {
|
|
84
|
-
const { base, result } = transition;
|
|
85
|
-
if (base !== null && base.uuid !== result.uuid) {
|
|
86
|
-
throw new Error('a recorder transition cannot change entity UUID');
|
|
87
|
-
}
|
|
88
|
-
const before = nearestRepository(base?.parentUUID ?? null, byUuid);
|
|
89
|
-
const after = nearestRepository(result.parentUUID, byUuid);
|
|
90
|
-
const add = (targets, target) => {
|
|
91
|
-
if (!targets.some((candidate) => candidate.resourceId === target.resourceId))
|
|
92
|
-
targets.push(target);
|
|
93
|
-
};
|
|
94
|
-
// Every `.git` boundary starts its own repository rail, even when nested.
|
|
95
|
-
// Its enclosing repository changes only when the boundary's graph entry
|
|
96
|
-
// changes; ordinary Card/Checkpoint advancement remains on the inner rail.
|
|
97
|
-
if (base?.type === 'repo.git' || result.type === 'repo.git') {
|
|
98
|
-
const targets = [];
|
|
99
|
-
add(targets, {
|
|
100
|
-
kind: result.type === 'repo.git' ? 'repository' : 'entity',
|
|
101
|
-
resourceId: result.uuid,
|
|
102
|
-
});
|
|
103
|
-
const boundaryChanged = base === null
|
|
104
|
-
|| base.type !== result.type
|
|
105
|
-
|| base.parentUUID !== result.parentUUID
|
|
106
|
-
|| base.name !== result.name
|
|
107
|
-
|| base.status !== result.status;
|
|
108
|
-
if (boundaryChanged) {
|
|
109
|
-
if (before)
|
|
110
|
-
add(targets, { kind: 'repository', resourceId: before.uuid });
|
|
111
|
-
if (after)
|
|
112
|
-
add(targets, { kind: 'repository', resourceId: after.uuid });
|
|
113
|
-
}
|
|
114
|
-
return Object.freeze(targets);
|
|
115
|
-
}
|
|
116
|
-
if (base === null) {
|
|
117
|
-
return Object.freeze(after
|
|
118
|
-
? [{ kind: 'repository', resourceId: after.uuid }]
|
|
119
|
-
: [{ kind: 'entity', resourceId: result.uuid }]);
|
|
120
|
-
}
|
|
121
|
-
if (before?.uuid === after?.uuid) {
|
|
122
|
-
return Object.freeze(before
|
|
123
|
-
? [{ kind: 'repository', resourceId: before.uuid }]
|
|
124
|
-
: [{ kind: 'entity', resourceId: result.uuid }]);
|
|
125
|
-
}
|
|
126
|
-
const targets = [{ kind: 'entity', resourceId: result.uuid }];
|
|
127
|
-
for (const repository of [before, after]) {
|
|
128
|
-
if (repository)
|
|
129
|
-
add(targets, { kind: 'repository', resourceId: repository.uuid });
|
|
130
|
-
}
|
|
131
|
-
return Object.freeze(targets);
|
|
132
|
-
}
|
|
133
55
|
//# sourceMappingURL=territory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"territory.js","sourceRoot":"","sources":["../../src/detection/territory.ts"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"territory.js","sourceRoot":"","sources":["../../src/detection/territory.ts"],"names":[],"mappings":";AAAA,oEAAoE;;AAwBpE,4DAyCC;AAhDD;;;;;;GAMG;AACH,SA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A register journey moves file counts, not just bytes: tens of thousands
|
|
6
6
|
* of small artifacts whose per-artifact negotiation frames would dwarf the
|
|
7
|
-
* payload.
|
|
8
|
-
*
|
|
9
|
-
* count
|
|
10
|
-
*
|
|
7
|
+
* payload. The set streams as self-contained segments. Each segment carries
|
|
8
|
+
* whole artifacts — every chunk and the manifest identity — so the frame
|
|
9
|
+
* count scales with bytes moved, never with file count. Segments flow
|
|
10
|
+
* through one bounded window and never wait on one another's durability
|
|
11
|
+
* acknowledgements; the authority verifies and seals each segment
|
|
12
|
+
* independently, so an interruption loses only unacknowledged segments and
|
|
13
|
+
* a rerun resumes from the sealed inventory. Only artifacts at or below the
|
|
14
|
+
* segment byte bound ride the stream; larger artifacts keep per-artifact
|
|
15
|
+
* transfer where chunk reuse pays.
|
|
11
16
|
*/
|
|
12
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
18
|
+
exports.CARGO_STREAM_IN_FLIGHT_BYTES = exports.CARGO_SEGMENT_ARTIFACTS = exports.CARGO_SEGMENT_BYTES = void 0;
|
|
19
|
+
exports.planCargoSegments = planCargoSegments;
|
|
20
|
+
exports.streamCargo = streamCargo;
|
|
15
21
|
const batches_js_1 = require("./batches.js");
|
|
16
|
-
|
|
22
|
+
const parallel_js_1 = require("./parallel.js");
|
|
23
|
+
exports.CARGO_SEGMENT_BYTES = batches_js_1.FILE_TRANSFER_BATCH_BYTES;
|
|
17
24
|
/** Bounded by the 64KiB binary-frame header law: every artifact declaration
|
|
18
25
|
* (content hash, bytes, chunk list) rides the JSON header, and 256 worst-case
|
|
19
26
|
* declarations stay under the bound with margin. The byte bound, not this
|
|
20
|
-
* count, decides the
|
|
21
|
-
exports.
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
* count, decides the segment tally on real grounds. */
|
|
28
|
+
exports.CARGO_SEGMENT_ARTIFACTS = 256;
|
|
29
|
+
/** Four full segments may be in flight at once. The window keeps the wire
|
|
30
|
+
* busy while earlier segments await the authority's per-segment durability
|
|
31
|
+
* fan-out, and worst-case payload residency (plaintext plus one encoded
|
|
32
|
+
* copy per in-flight segment) stays comfortably inside a 1-GiB runtime. */
|
|
33
|
+
exports.CARGO_STREAM_IN_FLIGHT_BYTES = 4 * exports.CARGO_SEGMENT_BYTES;
|
|
34
|
+
/** Pack items in order into segments within the byte and artifact bounds. */
|
|
35
|
+
function planCargoSegments(items) {
|
|
36
|
+
const segments = [];
|
|
25
37
|
let current = [];
|
|
26
38
|
let bytes = 0;
|
|
27
39
|
for (const item of items) {
|
|
40
|
+
if (typeof item.contentHash !== 'string' || item.contentHash.length === 0) {
|
|
41
|
+
throw new Error('cargo item is missing its content identity');
|
|
42
|
+
}
|
|
28
43
|
if (!Number.isSafeInteger(item.bytes) || item.bytes < 0) {
|
|
29
|
-
throw new Error('cargo
|
|
44
|
+
throw new Error('cargo item byte count is invalid');
|
|
30
45
|
}
|
|
31
|
-
if (item.bytes > exports.
|
|
32
|
-
throw new Error('cargo
|
|
46
|
+
if (item.bytes > exports.CARGO_SEGMENT_BYTES) {
|
|
47
|
+
throw new Error('cargo item exceeds the segment byte bound');
|
|
33
48
|
}
|
|
34
49
|
if (current.length > 0
|
|
35
|
-
&& (bytes + item.bytes > exports.
|
|
36
|
-
|
|
50
|
+
&& (bytes + item.bytes > exports.CARGO_SEGMENT_BYTES || current.length >= exports.CARGO_SEGMENT_ARTIFACTS)) {
|
|
51
|
+
segments.push({ items: current, bytes });
|
|
37
52
|
current = [];
|
|
38
53
|
bytes = 0;
|
|
39
54
|
}
|
|
@@ -41,7 +56,27 @@ function planCargoWaves(items) {
|
|
|
41
56
|
bytes += item.bytes;
|
|
42
57
|
}
|
|
43
58
|
if (current.length > 0)
|
|
44
|
-
|
|
45
|
-
return
|
|
59
|
+
segments.push({ items: current, bytes });
|
|
60
|
+
return segments;
|
|
61
|
+
}
|
|
62
|
+
/** Stream one cold set of small artifacts as bounded pipelined segments.
|
|
63
|
+
* Every item must come back sealed or the stream fails; a failure stops new
|
|
64
|
+
* admission, lets in-flight segments settle, and leaves their sealed work
|
|
65
|
+
* durable for the resuming rerun. */
|
|
66
|
+
async function streamCargo(items, ports, options = {}) {
|
|
67
|
+
const segments = planCargoSegments(items);
|
|
68
|
+
let artifacts = 0;
|
|
69
|
+
let bytes = 0;
|
|
70
|
+
await (0, parallel_js_1.weightedParallelForEach)(segments, options.lanes ?? parallel_js_1.DEFAULT_TRANSFER_CONCURRENCY, options.maxInFlightBytes ?? exports.CARGO_STREAM_IN_FLIGHT_BYTES, (segment) => Math.max(segment.bytes, 1), async (segment) => {
|
|
71
|
+
const sealed = new Set(await ports.send(segment));
|
|
72
|
+
for (const item of segment.items) {
|
|
73
|
+
if (!sealed.has(item.contentHash)) {
|
|
74
|
+
throw new Error(`cargo authority did not seal ${item.contentHash}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
artifacts += segment.items.length;
|
|
78
|
+
bytes += segment.bytes;
|
|
79
|
+
});
|
|
80
|
+
return { segments: segments.length, artifacts, bytes };
|
|
46
81
|
}
|
|
47
82
|
//# sourceMappingURL=cargo.js.map
|