@dsh-enhanced/lark-channel 0.1.48 → 0.1.49
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/README.md +19 -8
- package/docs/rsi-setup.md +123 -11
- package/docs/setup.md +27 -14
- package/docs/supervised-growth.md +2 -0
- package/lib/adapter.d.ts +6 -0
- package/lib/adapter.d.ts.map +1 -1
- package/lib/adapter.js +79 -8
- package/lib/adapter.js.map +1 -1
- package/lib/business-cli-install.d.ts +9 -0
- package/lib/business-cli-install.d.ts.map +1 -0
- package/lib/business-cli-install.js +367 -0
- package/lib/business-cli-install.js.map +1 -0
- package/lib/business-environment.d.ts +2 -0
- package/lib/business-environment.d.ts.map +1 -0
- package/lib/business-environment.js +16 -0
- package/lib/business-environment.js.map +1 -0
- package/lib/business-skill.d.ts +32 -0
- package/lib/business-skill.d.ts.map +1 -0
- package/lib/business-skill.js +202 -0
- package/lib/business-skill.js.map +1 -0
- package/lib/rsi-authority-config.d.ts +29 -0
- package/lib/rsi-authority-config.d.ts.map +1 -0
- package/lib/rsi-authority-config.js +233 -0
- package/lib/rsi-authority-config.js.map +1 -0
- package/lib/rsi-authority-resources.d.ts +36 -0
- package/lib/rsi-authority-resources.d.ts.map +1 -0
- package/lib/rsi-authority-resources.js +139 -0
- package/lib/rsi-authority-resources.js.map +1 -0
- package/lib/rsi-authority-runtime.d.ts +50 -0
- package/lib/rsi-authority-runtime.d.ts.map +1 -0
- package/lib/rsi-authority-runtime.js +393 -0
- package/lib/rsi-authority-runtime.js.map +1 -0
- package/lib/rsi-bootstrap-manifest.d.ts +39 -0
- package/lib/rsi-bootstrap-manifest.d.ts.map +1 -0
- package/lib/rsi-bootstrap-manifest.js +366 -0
- package/lib/rsi-bootstrap-manifest.js.map +1 -0
- package/lib/rsi-bootstrap.d.ts +30 -0
- package/lib/rsi-bootstrap.d.ts.map +1 -0
- package/lib/rsi-bootstrap.js +363 -0
- package/lib/rsi-bootstrap.js.map +1 -0
- package/lib/rsi-build.d.ts +45 -0
- package/lib/rsi-build.d.ts.map +1 -0
- package/lib/rsi-build.js +404 -0
- package/lib/rsi-build.js.map +1 -0
- package/lib/rsi-creation-build.d.ts +47 -0
- package/lib/rsi-creation-build.d.ts.map +1 -0
- package/lib/rsi-creation-build.js +333 -0
- package/lib/rsi-creation-build.js.map +1 -0
- package/lib/rsi-host-authorities.d.ts +18 -0
- package/lib/rsi-host-authorities.d.ts.map +1 -0
- package/lib/rsi-host-authorities.js +129 -0
- package/lib/rsi-host-authorities.js.map +1 -0
- package/lib/rsi-host-update.d.ts +113 -0
- package/lib/rsi-host-update.d.ts.map +1 -0
- package/lib/rsi-host-update.js +316 -0
- package/lib/rsi-host-update.js.map +1 -0
- package/lib/rsi-install-inputs.d.ts +43 -0
- package/lib/rsi-install-inputs.d.ts.map +1 -0
- package/lib/rsi-install-inputs.js +342 -0
- package/lib/rsi-install-inputs.js.map +1 -0
- package/lib/rsi-install.d.ts +54 -0
- package/lib/rsi-install.d.ts.map +1 -0
- package/lib/rsi-install.js +404 -0
- package/lib/rsi-install.js.map +1 -0
- package/lib/rsi-local-activation.d.ts +78 -0
- package/lib/rsi-local-activation.d.ts.map +1 -0
- package/lib/rsi-local-activation.js +485 -0
- package/lib/rsi-local-activation.js.map +1 -0
- package/lib/rsi-local-cohort.d.ts +70 -0
- package/lib/rsi-local-cohort.d.ts.map +1 -0
- package/lib/rsi-local-cohort.js +781 -0
- package/lib/rsi-local-cohort.js.map +1 -0
- package/lib/rsi-local-install.d.ts +40 -0
- package/lib/rsi-local-install.d.ts.map +1 -0
- package/lib/rsi-local-install.js +221 -0
- package/lib/rsi-local-install.js.map +1 -0
- package/lib/rsi-local-pair-install.d.ts +38 -0
- package/lib/rsi-local-pair-install.d.ts.map +1 -0
- package/lib/rsi-local-pair-install.js +200 -0
- package/lib/rsi-local-pair-install.js.map +1 -0
- package/lib/rsi-local-profile-update.d.ts +25 -0
- package/lib/rsi-local-profile-update.d.ts.map +1 -0
- package/lib/rsi-local-profile-update.js +226 -0
- package/lib/rsi-local-profile-update.js.map +1 -0
- package/lib/rsi-local-resources.d.ts +37 -0
- package/lib/rsi-local-resources.d.ts.map +1 -0
- package/lib/rsi-local-resources.js +184 -0
- package/lib/rsi-local-resources.js.map +1 -0
- package/lib/rsi-local-roots-extension.d.ts +11 -0
- package/lib/rsi-local-roots-extension.d.ts.map +1 -0
- package/lib/rsi-local-roots-extension.js +31 -0
- package/lib/rsi-local-roots-extension.js.map +1 -0
- package/lib/rsi-local-update-build.d.ts +18 -0
- package/lib/rsi-local-update-build.d.ts.map +1 -0
- package/lib/rsi-local-update-build.js +37 -0
- package/lib/rsi-local-update-build.js.map +1 -0
- package/lib/rsi-local-update.d.ts +39 -0
- package/lib/rsi-local-update.d.ts.map +1 -0
- package/lib/rsi-local-update.js +205 -0
- package/lib/rsi-local-update.js.map +1 -0
- package/lib/rsi-memory-learning.d.ts +22 -0
- package/lib/rsi-memory-learning.d.ts.map +1 -0
- package/lib/rsi-memory-learning.js +76 -0
- package/lib/rsi-memory-learning.js.map +1 -0
- package/lib/rsi-owner-profile.d.ts +37 -0
- package/lib/rsi-owner-profile.d.ts.map +1 -0
- package/lib/rsi-owner-profile.js +178 -0
- package/lib/rsi-owner-profile.js.map +1 -0
- package/lib/rsi-plugin-creation.d.ts +31 -0
- package/lib/rsi-plugin-creation.d.ts.map +1 -0
- package/lib/rsi-plugin-creation.js +179 -0
- package/lib/rsi-plugin-creation.js.map +1 -0
- package/lib/rsi-profile.d.ts +23 -0
- package/lib/rsi-profile.d.ts.map +1 -1
- package/lib/rsi-profile.js +154 -43
- package/lib/rsi-profile.js.map +1 -1
- package/lib/rsi-release-build.d.ts +41 -0
- package/lib/rsi-release-build.d.ts.map +1 -0
- package/lib/rsi-release-build.js +223 -0
- package/lib/rsi-release-build.js.map +1 -0
- package/lib/rsi-service-environment.d.ts +6 -0
- package/lib/rsi-service-environment.d.ts.map +1 -0
- package/lib/rsi-service-environment.js +113 -0
- package/lib/rsi-service-environment.js.map +1 -0
- package/lib/rsi-service-setup.d.ts +10 -0
- package/lib/rsi-service-setup.d.ts.map +1 -0
- package/lib/rsi-service-setup.js +34 -0
- package/lib/rsi-service-setup.js.map +1 -0
- package/lib/rsi-setup.d.ts +35 -2
- package/lib/rsi-setup.d.ts.map +1 -1
- package/lib/rsi-setup.js +459 -32
- package/lib/rsi-setup.js.map +1 -1
- package/lib/rsi-source-maintenance.d.ts +25 -0
- package/lib/rsi-source-maintenance.d.ts.map +1 -0
- package/lib/rsi-source-maintenance.js +348 -0
- package/lib/rsi-source-maintenance.js.map +1 -0
- package/lib/rsi-source-update.d.ts +26 -0
- package/lib/rsi-source-update.d.ts.map +1 -0
- package/lib/rsi-source-update.js +276 -0
- package/lib/rsi-source-update.js.map +1 -0
- package/lib/rsi-source.d.ts +34 -0
- package/lib/rsi-source.d.ts.map +1 -0
- package/lib/rsi-source.js +375 -0
- package/lib/rsi-source.js.map +1 -0
- package/lib/rsi-systemd-bootstrap.d.ts +46 -0
- package/lib/rsi-systemd-bootstrap.d.ts.map +1 -0
- package/lib/rsi-systemd-bootstrap.js +271 -0
- package/lib/rsi-systemd-bootstrap.js.map +1 -0
- package/lib/sdk.d.ts.map +1 -1
- package/lib/sdk.js +26 -1
- package/lib/sdk.js.map +1 -1
- package/lib/setup-business.d.ts +49 -0
- package/lib/setup-business.d.ts.map +1 -0
- package/lib/setup-business.js +335 -0
- package/lib/setup-business.js.map +1 -0
- package/lib/setup-profile.d.ts +1 -1
- package/lib/setup-profile.d.ts.map +1 -1
- package/lib/setup-profile.js +25 -2
- package/lib/setup-profile.js.map +1 -1
- package/lib/setup.d.ts +12 -1
- package/lib/setup.d.ts.map +1 -1
- package/lib/setup.js +138 -34
- package/lib/setup.js.map +1 -1
- package/lib/systemd.d.ts +10 -0
- package/lib/systemd.d.ts.map +1 -1
- package/lib/systemd.js +23 -6
- package/lib/systemd.js.map +1 -1
- package/lib/types.d.ts +7 -0
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +32 -20
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import { createHash, createPublicKey, verify } from 'node:crypto';
|
|
2
|
+
import { lstat, readdir, realpath } from 'node:fs/promises';
|
|
3
|
+
import { isAbsolute, join, resolve, sep } from 'node:path';
|
|
4
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
5
|
+
import { ControlPlaneDatabaseError, ControlPlaneStore, controlPlaneDigest, hostMaintenanceCanonical, hostMaintenanceDigest, signSourceMaintenanceRecord, sourceBaselineChain, sourceMaintenanceDigest, verifySourceMaintenanceRecords } from '@dsh-enhanced/plugin-control-plane';
|
|
6
|
+
import { rsiBuildResources as io } from './rsi-build.js';
|
|
7
|
+
import { isMap, isScalar, isSeq, parseDocument } from 'yaml';
|
|
8
|
+
import { prepareRsiAuthorityResources } from './rsi-authority-resources.js';
|
|
9
|
+
import { readRsiLocalCohort, verifyRsiLocalInstalledPackages } from './rsi-local-cohort.js';
|
|
10
|
+
import { assertRsiLocalProfileRoots } from './rsi-local-profile-update.js';
|
|
11
|
+
import { readRsiSourceMaintenance } from './rsi-source-maintenance.js';
|
|
12
|
+
const HASH = /^[a-f0-9]{64}$/u;
|
|
13
|
+
const PROFILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u;
|
|
14
|
+
function fail(message) { throw new Error(`rsi local activation: ${message}`); }
|
|
15
|
+
function canonical(path) { return typeof path === 'string' && isAbsolute(path) && resolve(path) === path && !path.includes('\0'); }
|
|
16
|
+
function inside(root, path) { return path === root || path.startsWith(`${root}${sep}`); }
|
|
17
|
+
async function privateHostKey(path) {
|
|
18
|
+
const item = await lstat(path);
|
|
19
|
+
if (!item.isFile() || item.isSymbolicLink() || item.nlink !== 1 || item.size < 1 || item.size > 16_384
|
|
20
|
+
|| (item.mode & 0o077) !== 0 || process.getuid && item.uid !== process.getuid())
|
|
21
|
+
fail(`unsafe Host key: ${path}`);
|
|
22
|
+
return (await io.readStable(path, 16_384, true)).toString('utf8');
|
|
23
|
+
}
|
|
24
|
+
const COORDINATOR_BUNDLES = ['assistant-policy', 'assistant-automations', 'plugin-control-plane'];
|
|
25
|
+
function emptyConfiguration(source, path) {
|
|
26
|
+
const document = parseDocument(source, { uniqueKeys: true,
|
|
27
|
+
customTags: [{ tag: 'tag:yaml.org,2002:js', resolve: (value) => value }] });
|
|
28
|
+
if (document.errors.length || document.warnings.length || !isSeq(document.contents) || document.contents.items.length) {
|
|
29
|
+
fail(`prepared coordinator configuration is not inert: ${path}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function assertPreparedCoordinator(input, home, coordinator, receiptPath, receipt, cohort) {
|
|
33
|
+
const profileRoot = join(home, 'profiles', coordinator);
|
|
34
|
+
await io.directory(profileRoot, false);
|
|
35
|
+
if (!isDeepStrictEqual((await readdir(profileRoot)).sort(), ['cordis.patch.yml', 'cordis.yml', 'node_modules', 'package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml'].sort())) {
|
|
36
|
+
fail(`prepared coordinator profile layout differs: ${profileRoot}`);
|
|
37
|
+
}
|
|
38
|
+
if (!(await io.readStable(receiptPath, 65_536, true)).equals(receipt))
|
|
39
|
+
fail('prepared coordinator receipt changed');
|
|
40
|
+
for (const name of ['cordis.yml', 'cordis.patch.yml']) {
|
|
41
|
+
const path = join(profileRoot, name);
|
|
42
|
+
const bytes = await io.readStable(path, 2_097_152);
|
|
43
|
+
emptyConfiguration(bytes.toString('utf8'), path);
|
|
44
|
+
if (home !== input.logicalHome && !(await io.readStable(join(input.logicalHome, 'profiles', coordinator, name), 2_097_152)).equals(bytes)) {
|
|
45
|
+
fail(`prepared coordinator configuration changed in stage: ${path}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
for (const name of ['package.json', 'pnpm-workspace.yaml', 'pnpm-lock.yaml']) {
|
|
49
|
+
const path = join(profileRoot, name), bytes = await io.readStable(path, 16_777_216);
|
|
50
|
+
if (home !== input.logicalHome && !(await io.readStable(join(input.logicalHome, 'profiles', coordinator, name), 16_777_216)).equals(bytes)) {
|
|
51
|
+
fail(`prepared coordinator installation changed in stage: ${path}`);
|
|
52
|
+
}
|
|
53
|
+
if (name === 'package.json')
|
|
54
|
+
assertRsiLocalProfileRoots({ source: bytes.toString('utf8'), cohort, bundles: COORDINATOR_BUNDLES });
|
|
55
|
+
}
|
|
56
|
+
await verifyRsiLocalInstalledPackages({ cohort, profilePath: profileRoot, bundles: COORDINATOR_BUNDLES });
|
|
57
|
+
}
|
|
58
|
+
async function assertAbsent(path) {
|
|
59
|
+
try {
|
|
60
|
+
await lstat(path);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (error.code === 'ENOENT')
|
|
64
|
+
return;
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
fail(`pre-owner residue exists: ${path}`);
|
|
68
|
+
}
|
|
69
|
+
async function optionalBytes(path, maximum, privateMode = true) {
|
|
70
|
+
try {
|
|
71
|
+
await lstat(path);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (error.code === 'ENOENT')
|
|
75
|
+
return;
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
const item = await lstat(path);
|
|
79
|
+
if (!item.isFile() || item.isSymbolicLink() || item.nlink !== 1 || item.size < 1
|
|
80
|
+
|| item.size > maximum || (item.mode & 0o022) !== 0 || await realpath(path) !== path)
|
|
81
|
+
fail(`unsafe pre-owner file: ${path}`);
|
|
82
|
+
return io.readStable(path, maximum, privateMode);
|
|
83
|
+
}
|
|
84
|
+
const PRE_OWNER_FIELDS = new Set(['sourceJobs', 'sourceApprovals', 'sourceReleases', 'sourceReleaseExecution',
|
|
85
|
+
'sourceAdoptions', 'sourceBuild', 'runtimeObserver', 'foregroundDeployments', 'taskObservations', 'adoptionCoordinator',
|
|
86
|
+
'memoryReviews', 'automaticLearning']);
|
|
87
|
+
function assertPreOwnerConfiguration(source, path, authorityConfig) {
|
|
88
|
+
const document = parseDocument(source, { uniqueKeys: true,
|
|
89
|
+
customTags: [{ tag: 'tag:yaml.org,2002:js', resolve: (value) => value }] });
|
|
90
|
+
if (document.errors.length || document.warnings.length || !isSeq(document.contents))
|
|
91
|
+
throw new Error(`rsi local activation: pre-owner configuration layer is invalid: ${path}`);
|
|
92
|
+
const inspect = (node) => {
|
|
93
|
+
if (isScalar(node)) {
|
|
94
|
+
const value = node.value;
|
|
95
|
+
if (typeof value === 'string' && value.includes(authorityConfig))
|
|
96
|
+
fail(`pre-owner layer references owner authority configuration: ${path}`);
|
|
97
|
+
if (node.tag === 'tag:yaml.org,2002:js' && typeof value === 'string'
|
|
98
|
+
&& [...PRE_OWNER_FIELDS].some(field => new RegExp(`\\b${field}\\b`, 'u').test(value)))
|
|
99
|
+
fail(`pre-owner dynamic owner configuration is unsupported: ${path}`);
|
|
100
|
+
}
|
|
101
|
+
else if (isMap(node))
|
|
102
|
+
for (const pair of node.items) {
|
|
103
|
+
const key = isScalar(pair.key) ? pair.key.value : undefined;
|
|
104
|
+
const value = isScalar(pair.value) ? pair.value.value : pair.value;
|
|
105
|
+
if (typeof key === 'string' && PRE_OWNER_FIELDS.has(key) && value !== null && value !== false)
|
|
106
|
+
fail(`pre-owner layer contains owner source configuration: ${path}`);
|
|
107
|
+
inspect(pair.key);
|
|
108
|
+
inspect(pair.value);
|
|
109
|
+
}
|
|
110
|
+
else if (isSeq(node))
|
|
111
|
+
node.items.forEach(inspect);
|
|
112
|
+
};
|
|
113
|
+
for (const row of document.contents.items) {
|
|
114
|
+
if (!isMap(row))
|
|
115
|
+
fail(`pre-owner dynamic or non-mapping row is unsupported: ${path}`);
|
|
116
|
+
const identity = ['name', 'module', 'id'].map(key => row.get(key, true))
|
|
117
|
+
.filter(isScalar).map(node => String(node.value)).join(' ');
|
|
118
|
+
if (/rsi-setup-/u.test(identity))
|
|
119
|
+
fail(`pre-owner layer contains an RSI owner row: ${path}`);
|
|
120
|
+
if (/cordis-plugin-(?:include|loader)/u.test(identity))
|
|
121
|
+
fail(`pre-owner include or Loader override is unsupported: ${path}`);
|
|
122
|
+
const config = row.get('config', true);
|
|
123
|
+
if (identity.includes('assistant-memory-learning') && (row.get('disabled') !== true || config !== undefined)) {
|
|
124
|
+
fail(`pre-owner memory learner is not inert: ${path}`);
|
|
125
|
+
}
|
|
126
|
+
if (identity.includes('plugin-control-plane') && isScalar(config) && config.tag === 'tag:yaml.org,2002:js')
|
|
127
|
+
fail(`pre-owner dynamic control-plane configuration is unsupported: ${path}`);
|
|
128
|
+
inspect(row);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/** Read-only absence proof for an installation whose authority bootstrap exists
|
|
132
|
+
* but owner grants and control ledger have never been installed. The explicit
|
|
133
|
+
* preparedCoordinator path accepts only the inert, receipt-bound original pair.
|
|
134
|
+
* It neither creates a ledger nor interprets arbitrary partial setup as fresh.
|
|
135
|
+
* Only Home/profile cordis.yml and cordis.patch.yml layers are supported.
|
|
136
|
+
* Alternate formats, dynamic owner rows/config, includes and explicit CLI
|
|
137
|
+
* overlays are rejected. The outer transaction must verify the effective
|
|
138
|
+
* graph and launch arguments, and owns package/Git materialization checks. */
|
|
139
|
+
export async function assertRsiPreOwnerInstallation(input) {
|
|
140
|
+
if (!canonical(input.logicalHome) || !canonical(input.physicalHome) || !PROFILE.test(input.profile))
|
|
141
|
+
fail('invalid pre-owner Home or profile');
|
|
142
|
+
const signal = AbortSignal.any([input.signal ?? new AbortController().signal, AbortSignal.timeout(180_000)]);
|
|
143
|
+
signal.throwIfAborted();
|
|
144
|
+
if (input.extraPatchFiles?.length)
|
|
145
|
+
fail('pre-owner external --patch overrides are unsupported');
|
|
146
|
+
if (await realpath(input.logicalHome) !== input.logicalHome || await realpath(input.physicalHome) !== input.physicalHome)
|
|
147
|
+
fail('pre-owner Homes must be physical');
|
|
148
|
+
const live = await readRsiSourceMaintenance({ logicalHome: input.logicalHome, physicalHome: input.logicalHome, profile: input.profile, signal });
|
|
149
|
+
if (input.anchor && controlPlaneDigest(input.anchor) !== controlPlaneDigest(live.anchor))
|
|
150
|
+
fail('pre-owner installation anchor changed');
|
|
151
|
+
const resources = await prepareRsiAuthorityResources({ dshHome: input.logicalHome, profile: input.profile, existingOnly: true, signal });
|
|
152
|
+
if (resources.installationId !== live.anchor.installationId || resources.ledgerId !== live.anchor.ledger.id
|
|
153
|
+
|| controlPlaneDigest(resources.identities.host.publicKeyPem) !== controlPlaneDigest(live.anchor.hostIdentity.publicKeyPem))
|
|
154
|
+
fail('pre-owner authority anchor changed');
|
|
155
|
+
const digest = (bytes) => createHash('sha256').update(bytes).digest('hex');
|
|
156
|
+
const authorityRelative = join('rsi-authorities', input.profile);
|
|
157
|
+
const sourceRelative = join('rsi-sources', input.profile);
|
|
158
|
+
const authorityBootstrap = await io.readStable(join(input.logicalHome, authorityRelative, 'bootstrap.json'), 65_536, true);
|
|
159
|
+
const sourceBootstrap = await io.readStable(join(input.logicalHome, sourceRelative, 'bootstrap.json'), 65_536, true);
|
|
160
|
+
const profileDigest = createHash('sha256').update(input.profile).digest('hex');
|
|
161
|
+
const coordinator = `rsi-${input.profile.slice(0, 43)}-${profileDigest.slice(0, 12)}`;
|
|
162
|
+
const markerName = `.rsi-coordinator-${profileDigest.slice(0, 16)}.json`;
|
|
163
|
+
const originalCohort = input.preparedCoordinator === true
|
|
164
|
+
? await readRsiLocalCohort({ dshHome: input.logicalHome, profile: input.profile }) : undefined;
|
|
165
|
+
const marker = input.preparedCoordinator === true
|
|
166
|
+
? await io.readStable(join(input.logicalHome, markerName), 65_536, true) : undefined;
|
|
167
|
+
if (originalCohort && marker) {
|
|
168
|
+
let parsed;
|
|
169
|
+
try {
|
|
170
|
+
parsed = JSON.parse(marker.toString('utf8'));
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
fail('prepared coordinator receipt is invalid');
|
|
174
|
+
}
|
|
175
|
+
if (!isDeepStrictEqual(parsed, { schemaVersion: 1, targetProfile: input.profile, coordinatorProfile: coordinator,
|
|
176
|
+
version: originalCohort.version, sourceRepository: originalCohort.sourceRepository })) {
|
|
177
|
+
fail('prepared coordinator receipt differs from the frozen cohort');
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
for (const home of new Set([input.logicalHome, input.physicalHome])) {
|
|
181
|
+
signal.throwIfAborted();
|
|
182
|
+
const authority = join(home, authorityRelative);
|
|
183
|
+
await io.directory(authority);
|
|
184
|
+
await io.directory(join(home, sourceRelative));
|
|
185
|
+
if ((await readdir(authority)).sort().join(',') !== 'bootstrap.json,catalog.json,config,identities,registry,state')
|
|
186
|
+
fail(`pre-owner authority layout differs: ${authority}`);
|
|
187
|
+
for (const name of ['config', 'state', 'registry']) {
|
|
188
|
+
const directory = join(authority, name);
|
|
189
|
+
await io.directory(directory);
|
|
190
|
+
const entries = (await readdir(directory)).sort();
|
|
191
|
+
if (name === 'state' && marker && isDeepStrictEqual(entries, ['creation-adoption-runner', 'creation-review-runner'])) {
|
|
192
|
+
for (const entry of entries) {
|
|
193
|
+
const child = join(directory, entry);
|
|
194
|
+
await io.directory(child);
|
|
195
|
+
if ((await readdir(child)).length)
|
|
196
|
+
fail(`pre-owner state is not empty: ${child}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
else if (entries.length)
|
|
200
|
+
fail(`pre-owner ${name} is not empty: ${directory}`);
|
|
201
|
+
}
|
|
202
|
+
const catalog = JSON.parse((await io.readStable(join(authority, 'catalog.json'), 2_097_152, true)).toString('utf8'));
|
|
203
|
+
if (controlPlaneDigest(catalog) !== controlPlaneDigest({ schemaVersion: 1, entries: [] }))
|
|
204
|
+
fail(`pre-owner catalog is not empty: ${authority}`);
|
|
205
|
+
if (!(await io.readStable(join(authority, 'bootstrap.json'), 65_536, true)).equals(authorityBootstrap)
|
|
206
|
+
|| !(await io.readStable(join(home, sourceRelative, 'bootstrap.json'), 65_536, true)).equals(sourceBootstrap))
|
|
207
|
+
fail('pre-owner live and staged bootstraps differ');
|
|
208
|
+
const keys = join(authority, 'identities');
|
|
209
|
+
await io.directory(keys);
|
|
210
|
+
if ((await readdir(keys)).sort().join(',') !== Object.keys(resources.identities).map(role => `${role}.pem`).sort().join(','))
|
|
211
|
+
fail('pre-owner signing identities differ');
|
|
212
|
+
for (const [role, identity] of Object.entries(resources.identities)) {
|
|
213
|
+
const actual = await privateHostKey(join(keys, `${role}.pem`));
|
|
214
|
+
const expected = await privateHostKey(identity.keyPath);
|
|
215
|
+
if (actual !== expected)
|
|
216
|
+
fail(`pre-owner signing identity differs: ${role}`);
|
|
217
|
+
}
|
|
218
|
+
for (const path of [join(home, 'rsi-coordinators', coordinator), join(home, 'rsi-authorities', coordinator),
|
|
219
|
+
join(home, '.rsi-setup-journal.json')])
|
|
220
|
+
await assertAbsent(path);
|
|
221
|
+
try {
|
|
222
|
+
const coordinators = join(home, 'rsi-coordinators');
|
|
223
|
+
await io.directory(coordinators);
|
|
224
|
+
if ((await readdir(coordinators)).length)
|
|
225
|
+
fail(`unknown coordinator state: ${coordinators}`);
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
if (error.code !== 'ENOENT')
|
|
229
|
+
throw error;
|
|
230
|
+
}
|
|
231
|
+
for (const name of await readdir(home)) {
|
|
232
|
+
if (name.startsWith('.rsi-coordinator-') && (!marker || name !== markerName))
|
|
233
|
+
fail(`unknown coordinator marker: ${name}`);
|
|
234
|
+
}
|
|
235
|
+
if (marker && originalCohort) {
|
|
236
|
+
await assertPreparedCoordinator(input, home, coordinator, join(home, markerName), marker, originalCohort);
|
|
237
|
+
const targetRoot = join(home, 'profiles', input.profile);
|
|
238
|
+
const targetManifest = await io.readStable(join(targetRoot, 'package.json'), 2_097_152);
|
|
239
|
+
assertRsiLocalProfileRoots({ source: targetManifest.toString('utf8'), cohort: originalCohort,
|
|
240
|
+
bundles: originalCohort.bundles });
|
|
241
|
+
if (home !== input.logicalHome && !(await io.readStable(join(input.logicalHome, 'profiles', input.profile, 'package.json'), 2_097_152)).equals(targetManifest))
|
|
242
|
+
fail('prepared target profile manifest changed in stage');
|
|
243
|
+
await verifyRsiLocalInstalledPackages({ cohort: originalCohort, profilePath: targetRoot,
|
|
244
|
+
bundles: originalCohort.bundles });
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
await assertAbsent(join(home, 'profiles', coordinator));
|
|
248
|
+
await assertAbsent(join(home, markerName));
|
|
249
|
+
}
|
|
250
|
+
const profileRoot = join(home, 'profiles', input.profile);
|
|
251
|
+
for (const root of [home, profileRoot]) {
|
|
252
|
+
for (const name of ['cordis.yaml', 'cordis.patch.yaml', 'cordis.json', 'cordis.patch.json']) {
|
|
253
|
+
const unsupported = await optionalBytes(join(root, name), 2_097_152, false);
|
|
254
|
+
if (unsupported)
|
|
255
|
+
fail(`pre-owner configuration layer is unsupported: ${join(root, name)}`);
|
|
256
|
+
}
|
|
257
|
+
for (const name of ['cordis.patch.yml', 'cordis.yml']) {
|
|
258
|
+
const path = join(root, name), bytes = await optionalBytes(path, 2_097_152, false);
|
|
259
|
+
if (bytes)
|
|
260
|
+
assertPreOwnerConfiguration(bytes.toString('utf8'), path, join(input.logicalHome, authorityRelative, 'config'));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const sidecar = await optionalBytes(join(input.physicalHome, sourceRelative, 'maintenance.json'), 4_194_304);
|
|
265
|
+
const parsed = sidecar ? JSON.parse(sidecar.toString('utf8')) : [];
|
|
266
|
+
if (!Array.isArray(parsed) || parsed.length > 256 || sidecar && !parsed.length)
|
|
267
|
+
fail('pre-owner source maintenance sidecar is invalid');
|
|
268
|
+
const records = verifySourceMaintenanceRecords(parsed, live.anchor);
|
|
269
|
+
const expected = input.records ?? live.records;
|
|
270
|
+
verifySourceMaintenanceRecords(expected, live.anchor);
|
|
271
|
+
if (expected.length < live.records.length || expected.length > live.records.length + 1
|
|
272
|
+
|| live.records.some((record, index) => sourceMaintenanceDigest(record) !== sourceMaintenanceDigest(expected[index])))
|
|
273
|
+
fail('pre-owner live sidecar changed or staged chain does not extend it');
|
|
274
|
+
if (records.some(record => record.host !== null) || live.records.some(record => record.host !== null)
|
|
275
|
+
|| expected.some(record => record.host !== null))
|
|
276
|
+
fail('pre-owner maintenance contains owner Host activation evidence');
|
|
277
|
+
if (controlPlaneDigest(records) !== controlPlaneDigest(expected))
|
|
278
|
+
fail('pre-owner sidecar differs from the expected maintenance chain');
|
|
279
|
+
const sourceChainTip = sourceBaselineChain(live.anchor.baseline, [], records).at(-1);
|
|
280
|
+
sourceBaselineChain(live.anchor.baseline, [], live.records);
|
|
281
|
+
signal.throwIfAborted();
|
|
282
|
+
return { mode: 'pre-owner', anchor: live.anchor, records, workspace: live.workspace, sourceChainTip,
|
|
283
|
+
originalBootstrapDigest: live.originalBootstrapDigest, authorityBootstrapDigest: digest(authorityBootstrap),
|
|
284
|
+
...(marker && originalCohort ? { preparedCoordinator: { profile: coordinator, receiptDigest: digest(marker),
|
|
285
|
+
cohortDigest: originalCohort.receiptDigest } } : {}) };
|
|
286
|
+
}
|
|
287
|
+
function openReadOnlyLedger(path, label) {
|
|
288
|
+
try {
|
|
289
|
+
return new ControlPlaneStore({ path, readOnly: true });
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
if (error instanceof ControlPlaneDatabaseError)
|
|
293
|
+
fail(`${label} control ledger is unavailable: ${error.message}`);
|
|
294
|
+
throw error;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
function sameActivationState(left, right) {
|
|
298
|
+
return left.kind === right.kind && (left.kind !== 'watched' || left.planId === right.planId);
|
|
299
|
+
}
|
|
300
|
+
function watchedDeployment(store, input, state) {
|
|
301
|
+
const context = store.currentRuntimeEpochDeployment(join(input.logicalHome, 'profiles', input.profile));
|
|
302
|
+
const { plan, readiness } = context, receipt = readiness.receipt, anchor = input.live.anchor;
|
|
303
|
+
if (!receipt)
|
|
304
|
+
throw new Error('rsi local activation: runtime epoch readiness receipt is absent');
|
|
305
|
+
if (plan.id !== state.planId || plan.installationId !== anchor.installationId
|
|
306
|
+
|| controlPlaneDigest(plan.ledger) !== controlPlaneDigest(anchor.ledger)
|
|
307
|
+
|| plan.target.dshHome !== input.logicalHome || plan.profile !== input.profile
|
|
308
|
+
|| receipt.authority !== anchor.hostIdentity.authority || receipt.keyId !== anchor.hostIdentity.keyId) {
|
|
309
|
+
fail('watched readiness was not issued by the installed Host identity or deployment');
|
|
310
|
+
}
|
|
311
|
+
const { signature, ...unsigned } = receipt;
|
|
312
|
+
if (!verify(null, Buffer.from(hostMaintenanceCanonical(unsigned)), createPublicKey(anchor.hostIdentity.publicKeyPem), Buffer.from(signature, 'base64')))
|
|
313
|
+
fail('watched original Host readiness signature changed');
|
|
314
|
+
return context;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Derive the next Host-signed source maintenance record for a frozen local
|
|
318
|
+
* update, without mutating anything. The caller applies it to the stopped stage
|
|
319
|
+
* and appends it to the staged ledger as one owned transaction.
|
|
320
|
+
*
|
|
321
|
+
* Explicit pre-owner mode uses a read-only absence proof and an empty release
|
|
322
|
+
* history; it signs host:null without creating either ledger. In owner mode,
|
|
323
|
+
* both the live ledger and the copied stage ledger are opened strictly
|
|
324
|
+
* read-only and must already exist at the current schema. Their release history,
|
|
325
|
+
* maintenance rows, and activation classification must agree byte-for-byte.
|
|
326
|
+
* When the stage anchors a watched runtime epoch, the record binds that plan and
|
|
327
|
+
* its original applied readiness receipt; with no watch the record carries
|
|
328
|
+
* `host: null`. Any other activation state, or any failure to read a watched
|
|
329
|
+
* deployment, aborts production — it is never silently downgraded, because the
|
|
330
|
+
* ledger append rejects a mismatched anchor anyway.
|
|
331
|
+
*/
|
|
332
|
+
export async function produceRsiLocalSourceMaintenance(input) {
|
|
333
|
+
const signal = AbortSignal.any([input.signal ?? new AbortController().signal, AbortSignal.timeout(180_000)]);
|
|
334
|
+
if (!canonical(input.logicalHome) || !canonical(input.stagePhysicalHome) || !PROFILE.test(input.profile))
|
|
335
|
+
fail('invalid activation Home or profile');
|
|
336
|
+
const livePhysicalHome = await realpath(input.logicalHome);
|
|
337
|
+
const stagePhysicalHome = await realpath(input.stagePhysicalHome);
|
|
338
|
+
if (stagePhysicalHome !== input.stagePhysicalHome || inside(livePhysicalHome, stagePhysicalHome)
|
|
339
|
+
|| inside(stagePhysicalHome, livePhysicalHome)) {
|
|
340
|
+
fail('activation stage must be a distinct stopped copy outside the live Home');
|
|
341
|
+
}
|
|
342
|
+
signal.throwIfAborted();
|
|
343
|
+
const { preparation } = input;
|
|
344
|
+
if (preparation.dshHome !== input.logicalHome || preparation.profile !== input.profile)
|
|
345
|
+
fail('preparation is bound to another Home');
|
|
346
|
+
const anchor = input.live.anchor;
|
|
347
|
+
const source = preparation.source;
|
|
348
|
+
if (anchor.repository !== join(input.logicalHome, 'rsi-sources', input.profile, 'checkout')
|
|
349
|
+
|| anchor.ledger.path !== join(input.logicalHome, 'rsi-authorities', input.profile, 'state', 'control-plane', 'control.sqlite')
|
|
350
|
+
|| controlPlaneDigest(anchor.baseline) !== controlPlaneDigest(input.live.workspace.baseline))
|
|
351
|
+
fail('source installation anchor changed');
|
|
352
|
+
verifySourceMaintenanceRecords(input.live.records, anchor);
|
|
353
|
+
if (input.live.originalBootstrapDigest !== source.originalBootstrapDigest)
|
|
354
|
+
fail('source bootstrap identity changed');
|
|
355
|
+
if (input.nextCohort.sourceCommit !== source.sourceCommit || input.nextCohort.version !== source.version
|
|
356
|
+
|| !HASH.test(input.nextCohort.receiptDigest))
|
|
357
|
+
fail('next cohort does not match the prepared source');
|
|
358
|
+
// The ledger is the authority for published release edges; the signed sidecar
|
|
359
|
+
// only covers maintenance edges. Live and copied-stage ledgers must agree with
|
|
360
|
+
// the sidecar before the chain is extended.
|
|
361
|
+
const mode = input.maintenanceMode ?? 'owner-ledger';
|
|
362
|
+
if (mode !== 'owner-ledger' && mode !== 'pre-owner')
|
|
363
|
+
fail('invalid maintenance mode');
|
|
364
|
+
if (input.preparedCoordinator && mode !== 'pre-owner')
|
|
365
|
+
fail('prepared coordinator requires pre-owner maintenance mode');
|
|
366
|
+
let currentTip;
|
|
367
|
+
let liveState = { kind: 'none' };
|
|
368
|
+
let liveSnapshotDigest = '';
|
|
369
|
+
let liveDeploymentDigest;
|
|
370
|
+
let liveHistory;
|
|
371
|
+
if (mode === 'pre-owner') {
|
|
372
|
+
const proof = await assertRsiPreOwnerInstallation({ logicalHome: input.logicalHome, physicalHome: stagePhysicalHome,
|
|
373
|
+
profile: input.profile, anchor, records: input.live.records,
|
|
374
|
+
...(input.preparedCoordinator ? { preparedCoordinator: true } : {}), signal });
|
|
375
|
+
if (proof.originalBootstrapDigest !== input.live.originalBootstrapDigest
|
|
376
|
+
|| controlPlaneDigest(proof.workspace) !== controlPlaneDigest(input.live.workspace))
|
|
377
|
+
fail('pre-owner source bootstrap or workspace snapshot changed');
|
|
378
|
+
currentTip = proof.sourceChainTip;
|
|
379
|
+
liveHistory = [];
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
const liveLedger = openReadOnlyLedger(anchor.ledger.path, 'live');
|
|
383
|
+
try {
|
|
384
|
+
const state = liveLedger.readSourceMaintenanceState(anchor.repository);
|
|
385
|
+
const { history, records: ledgerRecords } = state;
|
|
386
|
+
liveHistory = history;
|
|
387
|
+
if (ledgerRecords.length !== input.live.records.length
|
|
388
|
+
|| ledgerRecords.some((record, index) => sourceMaintenanceDigest(record) !== sourceMaintenanceDigest(input.live.records[index]))) {
|
|
389
|
+
fail('live ledger and sidecar source maintenance histories differ');
|
|
390
|
+
}
|
|
391
|
+
currentTip = sourceBaselineChain(anchor.baseline, history, ledgerRecords).at(-1);
|
|
392
|
+
liveSnapshotDigest = controlPlaneDigest({ history, records: ledgerRecords });
|
|
393
|
+
liveState = liveLedger.readSourceMaintenanceActivationState(input.logicalHome);
|
|
394
|
+
if (liveState.kind === 'unsettled')
|
|
395
|
+
fail('live Host activation is unsettled');
|
|
396
|
+
if (liveState.kind === 'watched')
|
|
397
|
+
liveDeploymentDigest = controlPlaneDigest(watchedDeployment(liveLedger, input, liveState));
|
|
398
|
+
}
|
|
399
|
+
finally {
|
|
400
|
+
liveLedger.close();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
signal.throwIfAborted();
|
|
404
|
+
const prior = input.live.records.at(-1);
|
|
405
|
+
const sequence = input.live.records.length + 1;
|
|
406
|
+
const before = prior ? prior.after : { sourceCommit: input.live.workspace.sourceCommit,
|
|
407
|
+
version: input.live.workspace.version, cohortDigest: preparation.originalCohortDigest };
|
|
408
|
+
if (source.repairCommit !== currentTip)
|
|
409
|
+
fail('prepared repair ref is not the current source chain tip');
|
|
410
|
+
if (prior && prior.after.cohortDigest !== preparation.originalCohortDigest)
|
|
411
|
+
fail('prepared original cohort is not the signed current cohort');
|
|
412
|
+
if (!prior && !HASH.test(preparation.originalCohortDigest))
|
|
413
|
+
fail('original cohort digest is invalid');
|
|
414
|
+
// Probe the STOPPED stage ledger read-only: a missing/corrupt/stale stage is
|
|
415
|
+
// an abort, never an excuse to invent host: null.
|
|
416
|
+
const authorityRoot = join('rsi-authorities', input.profile, 'state', 'control-plane');
|
|
417
|
+
const stageLedgerPath = join(stagePhysicalHome, authorityRoot, 'control.sqlite');
|
|
418
|
+
let host = null;
|
|
419
|
+
if (mode === 'owner-ledger') {
|
|
420
|
+
const stageLedger = openReadOnlyLedger(stageLedgerPath, 'staged');
|
|
421
|
+
try {
|
|
422
|
+
const { history: stageHistory, records: stageRecords } = stageLedger.readSourceMaintenanceState(anchor.repository);
|
|
423
|
+
if (stageRecords.length !== input.live.records.length
|
|
424
|
+
|| stageRecords.some((record, index) => sourceMaintenanceDigest(record) !== sourceMaintenanceDigest(input.live.records[index]))) {
|
|
425
|
+
fail('staged ledger and live sidecar source maintenance histories differ');
|
|
426
|
+
}
|
|
427
|
+
if (controlPlaneDigest({ history: stageHistory, records: stageRecords }) !== liveSnapshotDigest) {
|
|
428
|
+
fail('staged ledger and live ledger source histories differ');
|
|
429
|
+
}
|
|
430
|
+
const stageState = stageLedger.readSourceMaintenanceActivationState(input.logicalHome);
|
|
431
|
+
if (!sameActivationState(liveState, stageState))
|
|
432
|
+
fail('live and staged Host activation states differ');
|
|
433
|
+
if (stageState.kind === 'unsettled')
|
|
434
|
+
fail('staged Host activation is unsettled');
|
|
435
|
+
if (stageState.kind === 'watched') {
|
|
436
|
+
// A watched epoch must resolve completely. Invalid/conflicting rows abort
|
|
437
|
+
// production; they are never downgraded to an unanchored record.
|
|
438
|
+
const context = watchedDeployment(stageLedger, input, stageState);
|
|
439
|
+
if (controlPlaneDigest(context) !== liveDeploymentDigest)
|
|
440
|
+
fail('live and staged watched Host deployments differ');
|
|
441
|
+
const receipt = context.readiness.receipt;
|
|
442
|
+
if (!receipt)
|
|
443
|
+
throw new Error('rsi local activation: runtime epoch readiness receipt is absent');
|
|
444
|
+
if (receipt.authority !== anchor.hostIdentity.authority || receipt.keyId !== anchor.hostIdentity.keyId) {
|
|
445
|
+
fail('watched readiness was not issued by the installed Host identity');
|
|
446
|
+
}
|
|
447
|
+
// An owner installation holds exactly one Host key; the watched readiness
|
|
448
|
+
// must have been issued by that same identity for the local key to sign a
|
|
449
|
+
// record the store will accept. The store re-verifies this independently.
|
|
450
|
+
host = { planId: context.plan.id, planDigest: context.plan.digest,
|
|
451
|
+
readinessOperationId: context.readiness.operationId, readinessReceiptDigest: hostMaintenanceDigest(receipt) };
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
finally {
|
|
455
|
+
stageLedger.close();
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
signal.throwIfAborted();
|
|
459
|
+
const signingKey = await privateHostKey(join(stagePhysicalHome, 'rsi-authorities', input.profile, 'identities', 'host.pem'));
|
|
460
|
+
if (createPublicKey(signingKey).export({ format: 'pem', type: 'spki' }).toString() !== anchor.hostIdentity.publicKeyPem) {
|
|
461
|
+
fail('staged Host key does not match the signed installation anchor');
|
|
462
|
+
}
|
|
463
|
+
const now = input.now ?? Date.now;
|
|
464
|
+
const issuedAt = now();
|
|
465
|
+
if (!Number.isSafeInteger(issuedAt) || issuedAt <= 0)
|
|
466
|
+
fail('invalid signing time');
|
|
467
|
+
if (prior && issuedAt < prior.issuedAt)
|
|
468
|
+
fail('clock moved backwards before signing the maintenance record');
|
|
469
|
+
const record = signSourceMaintenanceRecord({ schemaVersion: 1, kind: 'dsh-source-maintenance',
|
|
470
|
+
transactionId: `local-update-${sequence}-${preparation.receiptDigest.slice(0, 16)}`,
|
|
471
|
+
installationId: anchor.installationId, ledger: anchor.ledger, repository: anchor.repository,
|
|
472
|
+
baseline: anchor.baseline, sequence, previousDigest: prior ? sourceMaintenanceDigest(prior) : null,
|
|
473
|
+
previousTip: currentTip, candidateTip: source.sourceCommit, upstreamCommit: source.upstreamCommit,
|
|
474
|
+
sourceTree: source.sourceTree, preparationReceiptDigest: source.receiptDigest,
|
|
475
|
+
originalBootstrapDigest: input.live.originalBootstrapDigest, before,
|
|
476
|
+
after: { sourceCommit: source.sourceCommit, version: source.version, cohortDigest: input.nextCohort.receiptDigest },
|
|
477
|
+
host, issuedAt, authority: anchor.hostIdentity.authority, keyId: anchor.hostIdentity.keyId }, signingKey);
|
|
478
|
+
verifySourceMaintenanceRecords([...input.live.records, record], anchor);
|
|
479
|
+
// Reject a duplicate candidate or fork before handing a signed record to the
|
|
480
|
+
// stage transaction; appendSourceMaintenance independently checks this again.
|
|
481
|
+
sourceBaselineChain(anchor.baseline, liveHistory, [...input.live.records, record]);
|
|
482
|
+
signal.throwIfAborted();
|
|
483
|
+
return record;
|
|
484
|
+
}
|
|
485
|
+
//# sourceMappingURL=rsi-local-activation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rsi-local-activation.js","sourceRoot":"","sources":["../src/rsi-local-activation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,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|
|
4
|
+
path: string;
|
|
5
|
+
bundle: boolean;
|
|
6
|
+
runtimeDependencies: string[];
|
|
7
|
+
tarball: string;
|
|
8
|
+
sha256: string;
|
|
9
|
+
files: {
|
|
10
|
+
path: string;
|
|
11
|
+
sha256: string;
|
|
12
|
+
mode: number;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
export interface RsiLocalCohort {
|
|
16
|
+
schemaVersion: 1;
|
|
17
|
+
root: string;
|
|
18
|
+
sourceCommit: string;
|
|
19
|
+
version: string;
|
|
20
|
+
sourceRepository: string;
|
|
21
|
+
allowBuilds: Record<string, boolean>;
|
|
22
|
+
bundles: string[];
|
|
23
|
+
packages: RsiLocalCohortPackage[];
|
|
24
|
+
receiptDigest: string;
|
|
25
|
+
}
|
|
26
|
+
export interface RsiLocalCohortPorts {
|
|
27
|
+
/** The output contains one slug directory per package, each with one .tgz. */
|
|
28
|
+
build(workspace: string, output: string, packagePaths: readonly string[], signal: AbortSignal): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export declare function readRsiLocalCohort(input: {
|
|
31
|
+
dshHome: string;
|
|
32
|
+
profile: string;
|
|
33
|
+
source?: RsiSourceWorkspace;
|
|
34
|
+
}): Promise<RsiLocalCohort>;
|
|
35
|
+
export declare const rsiLocalCohortPorts: RsiLocalCohortPorts;
|
|
36
|
+
/** The caller holds the DSH_HOME lifecycle lock. A claimed receipt is immutable. */
|
|
37
|
+
export declare function prepareRsiLocalCohort(input: {
|
|
38
|
+
dshHome: string;
|
|
39
|
+
profile: string;
|
|
40
|
+
source: RsiSourceWorkspace;
|
|
41
|
+
bundles: string[];
|
|
42
|
+
signal?: AbortSignal;
|
|
43
|
+
}, ports?: RsiLocalCohortPorts): Promise<RsiLocalCohort>;
|
|
44
|
+
/** A profile's roots and runtime closure define the only eligible peer providers.
|
|
45
|
+
* Peers never expand that closure, including optional peers. Receipt schema 1
|
|
46
|
+
* stays immutable; the peer edges are derived from its exact manifest bytes. */
|
|
47
|
+
export declare function rsiLocalRuntimeClosure(cohort: RsiLocalCohort, bundles: readonly string[]): RsiLocalCohortPackage[];
|
|
48
|
+
export declare function readRsiLocalArtifactManifest(item: Pick<RsiLocalCohortPackage, 'name' | 'tarball' | 'sha256' | 'files' | 'runtimeDependencies'> & {
|
|
49
|
+
version: string;
|
|
50
|
+
}): Promise<{
|
|
51
|
+
peerDependencies: Record<string, string>;
|
|
52
|
+
}>;
|
|
53
|
+
export declare function rsiLocalPeerOverrides(input: {
|
|
54
|
+
cohort: RsiLocalCohort;
|
|
55
|
+
bundles: readonly string[];
|
|
56
|
+
/** During a pair upgrade the original archives have already been replaced.
|
|
57
|
+
* Its installed manifests must still match the original receipt's digest. */
|
|
58
|
+
profilePath?: string;
|
|
59
|
+
}): Promise<Record<string, string>>;
|
|
60
|
+
/** Validate the exact installed files for selected bundles and their own runtime closure. */
|
|
61
|
+
export declare function verifyRsiLocalInstalledPackages(input: {
|
|
62
|
+
cohort: RsiLocalCohort;
|
|
63
|
+
profilePath: string;
|
|
64
|
+
bundles?: string[];
|
|
65
|
+
}): Promise<void>;
|
|
66
|
+
/** A native package add replaces pnpm links while the caller is running.
|
|
67
|
+
* Node caches their old physical targets in that process. Resolve the final
|
|
68
|
+
* installed closure in a new process using this pinned verifier's same checks. */
|
|
69
|
+
export declare function verifyRsiLocalInstalledPackagesFresh(input: Parameters<typeof verifyRsiLocalInstalledPackages>[0], signal?: AbortSignal): Promise<void>;
|
|
70
|
+
//# sourceMappingURL=rsi-local-cohort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rsi-local-cohort.d.ts","sourceRoot":"","sources":["../src/rsi-local-cohort.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAYzD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA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