@dsh-ray/lark-channel 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +207 -2
- package/bin/dsh-lark-setup.js +37 -0
- package/bin/dsh-ray-setup.js +34 -0
- package/bin/dsh-supervised-growth-setup.js +34 -0
- package/cordis.patch.yml +23 -0
- package/docs/operations.md +133 -0
- package/docs/progress-security.md +125 -0
- package/docs/rsi-setup.md +216 -0
- package/docs/setup.md +358 -0
- package/docs/supervised-growth.md +95 -0
- package/lib/adapter.d.ts +185 -0
- package/lib/adapter.d.ts.map +1 -0
- package/lib/adapter.js +2072 -0
- package/lib/adapter.js.map +1 -0
- package/lib/answer-card.d.ts +40 -0
- package/lib/answer-card.d.ts.map +1 -0
- package/lib/answer-card.js +262 -0
- package/lib/answer-card.js.map +1 -0
- package/lib/approval.d.ts +26 -0
- package/lib/approval.d.ts.map +1 -0
- package/lib/approval.js +104 -0
- package/lib/approval.js.map +1 -0
- 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/command-card.d.ts +3 -0
- package/lib/command-card.d.ts.map +1 -0
- package/lib/command-card.js +480 -0
- package/lib/command-card.js.map +1 -0
- package/lib/config.d.ts +32 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +115 -0
- package/lib/config.js.map +1 -0
- package/lib/group-thread.d.ts +20 -0
- package/lib/group-thread.d.ts.map +1 -0
- package/lib/group-thread.js +36 -0
- package/lib/group-thread.js.map +1 -0
- package/lib/index.d.ts +34 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +53 -0
- package/lib/index.js.map +1 -0
- package/lib/launchd-control.d.ts +24 -0
- package/lib/launchd-control.d.ts.map +1 -0
- package/lib/launchd-control.js +68 -0
- package/lib/launchd-control.js.map +1 -0
- package/lib/launchd-identity.d.ts +34 -0
- package/lib/launchd-identity.d.ts.map +1 -0
- package/lib/launchd-identity.js +184 -0
- package/lib/launchd-identity.js.map +1 -0
- package/lib/launchd-target-lock.d.ts +6 -0
- package/lib/launchd-target-lock.d.ts.map +1 -0
- package/lib/launchd-target-lock.js +48 -0
- package/lib/launchd-target-lock.js.map +1 -0
- package/lib/launchd.d.ts +62 -0
- package/lib/launchd.d.ts.map +1 -0
- package/lib/launchd.js +370 -0
- package/lib/launchd.js.map +1 -0
- package/lib/model-picker.d.ts +24 -0
- package/lib/model-picker.d.ts.map +1 -0
- package/lib/model-picker.js +95 -0
- package/lib/model-picker.js.map +1 -0
- package/lib/normalize.d.ts +12 -0
- package/lib/normalize.d.ts.map +1 -0
- package/lib/normalize.js +85 -0
- package/lib/normalize.js.map +1 -0
- package/lib/permission-picker.d.ts +29 -0
- package/lib/permission-picker.d.ts.map +1 -0
- package/lib/permission-picker.js +145 -0
- package/lib/permission-picker.js.map +1 -0
- package/lib/progress.d.ts +34 -0
- package/lib/progress.d.ts.map +1 -0
- package/lib/progress.js +354 -0
- package/lib/progress.js.map +1 -0
- package/lib/resident.d.ts +13 -0
- package/lib/resident.d.ts.map +1 -0
- package/lib/resident.js +41 -0
- package/lib/resident.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 +51 -0
- package/lib/rsi-authority-runtime.d.ts.map +1 -0
- package/lib/rsi-authority-runtime.js +496 -0
- package/lib/rsi-authority-runtime.js.map +1 -0
- package/lib/rsi-bootstrap-manifest.d.ts +53 -0
- package/lib/rsi-bootstrap-manifest.d.ts.map +1 -0
- package/lib/rsi-bootstrap-manifest.js +507 -0
- package/lib/rsi-bootstrap-manifest.js.map +1 -0
- package/lib/rsi-bootstrap.d.ts +61 -0
- package/lib/rsi-bootstrap.d.ts.map +1 -0
- package/lib/rsi-bootstrap.js +597 -0
- package/lib/rsi-bootstrap.js.map +1 -0
- package/lib/rsi-build.d.ts +76 -0
- package/lib/rsi-build.d.ts.map +1 -0
- package/lib/rsi-build.js +210 -0
- package/lib/rsi-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 +179 -0
- package/lib/rsi-host-update.d.ts.map +1 -0
- package/lib/rsi-host-update.js +568 -0
- package/lib/rsi-host-update.js.map +1 -0
- package/lib/rsi-install-inputs.d.ts +45 -0
- package/lib/rsi-install-inputs.d.ts.map +1 -0
- package/lib/rsi-install-inputs.js +345 -0
- package/lib/rsi-install-inputs.js.map +1 -0
- package/lib/rsi-install.d.ts +117 -0
- package/lib/rsi-install.d.ts.map +1 -0
- package/lib/rsi-install.js +791 -0
- package/lib/rsi-install.js.map +1 -0
- package/lib/rsi-linux-cgroup-roots.d.ts +3 -0
- package/lib/rsi-linux-cgroup-roots.d.ts.map +1 -0
- package/lib/rsi-linux-cgroup-roots.js +3 -0
- package/lib/rsi-linux-cgroup-roots.js.map +1 -0
- package/lib/rsi-linux-creation-build.d.ts +36 -0
- package/lib/rsi-linux-creation-build.d.ts.map +1 -0
- package/lib/rsi-linux-creation-build.js +213 -0
- package/lib/rsi-linux-creation-build.js.map +1 -0
- package/lib/rsi-linux-native-materialize.d.ts +31 -0
- package/lib/rsi-linux-native-materialize.d.ts.map +1 -0
- package/lib/rsi-linux-native-materialize.js +162 -0
- package/lib/rsi-linux-native-materialize.js.map +1 -0
- package/lib/rsi-linux-native-relocation.d.ts +124 -0
- package/lib/rsi-linux-native-relocation.d.ts.map +1 -0
- package/lib/rsi-linux-native-relocation.js +1571 -0
- package/lib/rsi-linux-native-relocation.js.map +1 -0
- package/lib/rsi-linux-native-resources.d.ts +97 -0
- package/lib/rsi-linux-native-resources.d.ts.map +1 -0
- package/lib/rsi-linux-native-resources.js +521 -0
- package/lib/rsi-linux-native-resources.js.map +1 -0
- package/lib/rsi-linux-repository-bootstrap.d.ts +17 -0
- package/lib/rsi-linux-repository-bootstrap.d.ts.map +1 -0
- package/lib/rsi-linux-repository-bootstrap.js +317 -0
- package/lib/rsi-linux-repository-bootstrap.js.map +1 -0
- package/lib/rsi-linux-runner-states.d.ts +20 -0
- package/lib/rsi-linux-runner-states.d.ts.map +1 -0
- package/lib/rsi-linux-runner-states.js +70 -0
- package/lib/rsi-linux-runner-states.js.map +1 -0
- package/lib/rsi-linux-runtime-bootstrap.d.ts +10 -0
- package/lib/rsi-linux-runtime-bootstrap.d.ts.map +1 -0
- package/lib/rsi-linux-runtime-bootstrap.js +38 -0
- package/lib/rsi-linux-runtime-bootstrap.js.map +1 -0
- package/lib/rsi-linux-source-build.d.ts +28 -0
- package/lib/rsi-linux-source-build.d.ts.map +1 -0
- package/lib/rsi-linux-source-build.js +43 -0
- package/lib/rsi-linux-source-build.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 +486 -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 +810 -0
- package/lib/rsi-local-cohort.js.map +1 -0
- package/lib/rsi-local-install.d.ts +70 -0
- package/lib/rsi-local-install.d.ts.map +1 -0
- package/lib/rsi-local-install.js +363 -0
- package/lib/rsi-local-install.js.map +1 -0
- package/lib/rsi-local-pair-install.d.ts +53 -0
- package/lib/rsi-local-pair-install.d.ts.map +1 -0
- package/lib/rsi-local-pair-install.js +215 -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-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 +37 -0
- package/lib/rsi-local-update-build.d.ts.map +1 -0
- package/lib/rsi-local-update-build.js +75 -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 +36 -0
- package/lib/rsi-memory-learning.d.ts.map +1 -0
- package/lib/rsi-memory-learning.js +111 -0
- package/lib/rsi-memory-learning.js.map +1 -0
- package/lib/rsi-native-install.d.ts +38 -0
- package/lib/rsi-native-install.d.ts.map +1 -0
- package/lib/rsi-native-install.js +312 -0
- package/lib/rsi-native-install.js.map +1 -0
- package/lib/rsi-native-launchd.d.ts +7 -0
- package/lib/rsi-native-launchd.d.ts.map +1 -0
- package/lib/rsi-native-launchd.js +49 -0
- package/lib/rsi-native-launchd.js.map +1 -0
- package/lib/rsi-native-profile.d.ts +76 -0
- package/lib/rsi-native-profile.d.ts.map +1 -0
- package/lib/rsi-native-profile.js +530 -0
- package/lib/rsi-native-profile.js.map +1 -0
- package/lib/rsi-native-runtime-bootstrap.d.ts +44 -0
- package/lib/rsi-native-runtime-bootstrap.d.ts.map +1 -0
- package/lib/rsi-native-runtime-bootstrap.js +619 -0
- package/lib/rsi-native-runtime-bootstrap.js.map +1 -0
- package/lib/rsi-ordinary-use-learning.d.ts +60 -0
- package/lib/rsi-ordinary-use-learning.d.ts.map +1 -0
- package/lib/rsi-ordinary-use-learning.js +103 -0
- package/lib/rsi-ordinary-use-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 +46 -0
- package/lib/rsi-plugin-creation.d.ts.map +1 -0
- package/lib/rsi-plugin-creation.js +227 -0
- package/lib/rsi-plugin-creation.js.map +1 -0
- package/lib/rsi-plugin-revision.d.ts +38 -0
- package/lib/rsi-plugin-revision.d.ts.map +1 -0
- package/lib/rsi-plugin-revision.js +221 -0
- package/lib/rsi-plugin-revision.js.map +1 -0
- package/lib/rsi-profile.d.ts +81 -0
- package/lib/rsi-profile.d.ts.map +1 -0
- package/lib/rsi-profile.js +551 -0
- package/lib/rsi-profile.js.map +1 -0
- package/lib/rsi-release-build.d.ts +59 -0
- package/lib/rsi-release-build.d.ts.map +1 -0
- package/lib/rsi-release-build.js +219 -0
- package/lib/rsi-release-build.js.map +1 -0
- package/lib/rsi-scanner-retirement-config.d.ts +34 -0
- package/lib/rsi-scanner-retirement-config.d.ts.map +1 -0
- package/lib/rsi-scanner-retirement-config.js +272 -0
- package/lib/rsi-scanner-retirement-config.js.map +1 -0
- package/lib/rsi-scanner-retirement-runtime.d.ts +23 -0
- package/lib/rsi-scanner-retirement-runtime.d.ts.map +1 -0
- package/lib/rsi-scanner-retirement-runtime.js +98 -0
- package/lib/rsi-scanner-retirement-runtime.js.map +1 -0
- package/lib/rsi-scanner-retirement-stage.d.ts +55 -0
- package/lib/rsi-scanner-retirement-stage.d.ts.map +1 -0
- package/lib/rsi-scanner-retirement-stage.js +181 -0
- package/lib/rsi-scanner-retirement-stage.js.map +1 -0
- package/lib/rsi-scanner-retirement-transition.d.ts +57 -0
- package/lib/rsi-scanner-retirement-transition.d.ts.map +1 -0
- package/lib/rsi-scanner-retirement-transition.js +330 -0
- package/lib/rsi-scanner-retirement-transition.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 +92 -0
- package/lib/rsi-setup.d.ts.map +1 -0
- package/lib/rsi-setup.js +908 -0
- package/lib/rsi-setup.js.map +1 -0
- package/lib/rsi-source-maintenance.d.ts +33 -0
- package/lib/rsi-source-maintenance.d.ts.map +1 -0
- package/lib/rsi-source-maintenance.js +407 -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 +487 -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 +216 -0
- package/lib/sdk.d.ts.map +1 -0
- package/lib/sdk.js +1990 -0
- package/lib/sdk.js.map +1 -0
- package/lib/service.d.ts +63 -0
- package/lib/service.d.ts.map +1 -0
- package/lib/service.js +599 -0
- package/lib/service.js.map +1 -0
- 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-materialization.d.ts +15 -0
- package/lib/setup-materialization.d.ts.map +1 -0
- package/lib/setup-materialization.js +221 -0
- package/lib/setup-materialization.js.map +1 -0
- package/lib/setup-profile.d.ts +23 -0
- package/lib/setup-profile.d.ts.map +1 -0
- package/lib/setup-profile.js +1248 -0
- package/lib/setup-profile.js.map +1 -0
- package/lib/setup.d.ts +298 -0
- package/lib/setup.d.ts.map +1 -0
- package/lib/setup.js +3310 -0
- package/lib/setup.js.map +1 -0
- package/lib/supervised-growth-profile.d.ts +111 -0
- package/lib/supervised-growth-profile.d.ts.map +1 -0
- package/lib/supervised-growth-profile.js +903 -0
- package/lib/supervised-growth-profile.js.map +1 -0
- package/lib/supervised-growth-setup.d.ts +201 -0
- package/lib/supervised-growth-setup.d.ts.map +1 -0
- package/lib/supervised-growth-setup.js +1005 -0
- package/lib/supervised-growth-setup.js.map +1 -0
- package/lib/systemd.d.ts +70 -0
- package/lib/systemd.d.ts.map +1 -0
- package/lib/systemd.js +308 -0
- package/lib/systemd.js.map +1 -0
- package/lib/tool-approval.d.ts +22 -0
- package/lib/tool-approval.d.ts.map +1 -0
- package/lib/tool-approval.js +107 -0
- package/lib/tool-approval.js.map +1 -0
- package/lib/types.d.ts +351 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +11 -0
- package/lib/types.js.map +1 -0
- package/lib/user-question.d.ts +31 -0
- package/lib/user-question.d.ts.map +1 -0
- package/lib/user-question.js +161 -0
- package/lib/user-question.js.map +1 -0
- package/lib/version.d.ts +2 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +2 -0
- package/lib/version.js.map +1 -0
- package/lib/windows-task.d.ts +42 -0
- package/lib/windows-task.d.ts.map +1 -0
- package/lib/windows-task.js +143 -0
- package/lib/windows-task.js.map +1 -0
- package/lib/ws-card-callback.d.ts +7 -0
- package/lib/ws-card-callback.d.ts.map +1 -0
- package/lib/ws-card-callback.js +51 -0
- package/lib/ws-card-callback.js.map +1 -0
- package/package.json +169 -3
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { createPrivateKey, createPublicKey } from 'node:crypto';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
6
|
+
import { validateCreationAcceptanceAuthorityRef } from '@dsh-ray/assistant-growth-contract';
|
|
7
|
+
const limits = {
|
|
8
|
+
creates: 32, verifications: 32, adoptions: 32, cases: 4, tools: 8,
|
|
9
|
+
callsPerAdoption: 30, callRecords: 960, inputBytes: 65_536,
|
|
10
|
+
reviewInputBytes: 262_144, reviewOutputTokens: 8_192, reviewDurationMs: 300_000,
|
|
11
|
+
receiptTtlMs: 86_400_000, runnerDurationMs: 30_000,
|
|
12
|
+
reviewRuns: 160, adoptionRuns: 1_024,
|
|
13
|
+
retentionLifetimeMs: 30 * 86_400_000,
|
|
14
|
+
};
|
|
15
|
+
const uuid = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u;
|
|
16
|
+
function fail(message) { throw new Error(`rsi plugin creation: ${message}`); }
|
|
17
|
+
const requirePeer = createRequire(import.meta.url);
|
|
18
|
+
function installedPeer(name) {
|
|
19
|
+
try {
|
|
20
|
+
requirePeer.resolve(name);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
if (error.code === 'MODULE_NOT_FOUND'
|
|
24
|
+
|| error.code === 'ERR_MODULE_NOT_FOUND')
|
|
25
|
+
fail(`opted-in plugin creation requires installed peer ${name}`);
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
return requirePeer(name);
|
|
29
|
+
}
|
|
30
|
+
/** Optional peers are loaded only for an opted-in creation setup. */
|
|
31
|
+
export function getRsiPluginCreationValidators() {
|
|
32
|
+
const verifier = installedPeer('@dsh-ray/assistant-verifier');
|
|
33
|
+
const controlPlane = installedPeer('@dsh-ray/plugin-control-plane');
|
|
34
|
+
if (typeof verifier.compileCreationReviewConfig !== 'function'
|
|
35
|
+
|| typeof controlPlane.validateCreationCapabilityConfig !== 'function') {
|
|
36
|
+
fail('installed creation validators are unavailable; update the verifier and control-plane peers');
|
|
37
|
+
}
|
|
38
|
+
return { compileCreationReviewConfig: verifier.compileCreationReviewConfig,
|
|
39
|
+
validateCreationCapabilityConfig: controlPlane.validateCreationCapabilityConfig };
|
|
40
|
+
}
|
|
41
|
+
function exact(value, fields) {
|
|
42
|
+
if (!value || typeof value !== 'object' || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype)
|
|
43
|
+
return false;
|
|
44
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
45
|
+
return Reflect.ownKeys(value).length === fields.length
|
|
46
|
+
&& Object.keys(descriptors).sort().join('\0') === [...fields].sort().join('\0')
|
|
47
|
+
&& Object.values(descriptors).every(field => field.enumerable && 'value' in field);
|
|
48
|
+
}
|
|
49
|
+
function publicKeyAt(path) {
|
|
50
|
+
return createPublicKey(createPrivateKey(readFileSync(path))).export({ format: 'pem', type: 'spki' }).toString();
|
|
51
|
+
}
|
|
52
|
+
/** The review and adoption runners must be the same native backend. Linux
|
|
53
|
+
* native runners additionally pin the delegated cgroup roots; macOS runners
|
|
54
|
+
* pin the runtime. Docker-era runners are historical-only and never match. */
|
|
55
|
+
function pairedRunnerMatches(reviews, capabilities) {
|
|
56
|
+
const reviewBackend = 'backend' in reviews ? reviews.backend : undefined;
|
|
57
|
+
const capabilityBackend = 'backend' in capabilities ? capabilities.backend : undefined;
|
|
58
|
+
if (reviewBackend !== capabilityBackend)
|
|
59
|
+
return false;
|
|
60
|
+
if ('backend' in reviews && 'backend' in capabilities
|
|
61
|
+
&& reviews.backend === 'linux-native' && capabilities.backend === 'linux-native') {
|
|
62
|
+
return isDeepStrictEqual(reviews.runtime, capabilities.runtime)
|
|
63
|
+
&& isDeepStrictEqual(reviews.cgroupRoots, capabilities.cgroupRoots);
|
|
64
|
+
}
|
|
65
|
+
if ('backend' in reviews && 'backend' in capabilities
|
|
66
|
+
&& reviews.backend === 'macos-seatbelt' && capabilities.backend === 'macos-seatbelt') {
|
|
67
|
+
return isDeepStrictEqual(reviews.runtime, capabilities.runtime);
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
/** Project the prepared immutable build receipt onto the backend-specific
|
|
72
|
+
* runner binding shared by review and adoption. */
|
|
73
|
+
function creationRunnerBackend(build) {
|
|
74
|
+
if (build.schemaVersion === 2)
|
|
75
|
+
return { backend: 'macos-seatbelt', runtime: build.runtime };
|
|
76
|
+
return { backend: 'linux-native', runtime: build.behavior, cgroupRoots: build.cgroupRoots };
|
|
77
|
+
}
|
|
78
|
+
/** Admission of a complete finite chain; no resource is created or reset here. */
|
|
79
|
+
export function validateRsiPluginCreationSetup(input, expectedOwner, now = Date.now()) {
|
|
80
|
+
if (!Number.isSafeInteger(now) || now < 0)
|
|
81
|
+
fail('invalid validation time');
|
|
82
|
+
if (!exact(expectedOwner, ['authorityId', 'authorityHash', 'principalId', 'principalRecordId',
|
|
83
|
+
'principalVersion', 'workspace', 'agentPreset']))
|
|
84
|
+
fail('invalid expected owner');
|
|
85
|
+
if (!exact(input, ['reviews', 'creation', 'capabilities', 'verifications']))
|
|
86
|
+
fail('invalid setup fields');
|
|
87
|
+
const setup = input;
|
|
88
|
+
const validators = getRsiPluginCreationValidators();
|
|
89
|
+
const { config: reviews, authority, publicKey } = validators.compileCreationReviewConfig(setup.reviews);
|
|
90
|
+
validators.validateCreationCapabilityConfig(setup.capabilities);
|
|
91
|
+
const capabilities = structuredClone(setup.capabilities);
|
|
92
|
+
if (!isDeepStrictEqual(reviews.owner, expectedOwner) || !isDeepStrictEqual(capabilities.owner, expectedOwner)) {
|
|
93
|
+
fail('creation owner differs from current owner route');
|
|
94
|
+
}
|
|
95
|
+
if (!exact(setup.creation, ['id', 'expiresAt', 'maxCreates', 'namePrefix'])
|
|
96
|
+
|| typeof setup.creation.id !== 'string'
|
|
97
|
+
|| !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(setup.creation.id)
|
|
98
|
+
|| !Number.isSafeInteger(setup.creation.expiresAt)
|
|
99
|
+
|| setup.creation.expiresAt <= now
|
|
100
|
+
|| setup.creation.maxCreates !== limits.creates)
|
|
101
|
+
fail('invalid finite source creation grant');
|
|
102
|
+
const creation = structuredClone(setup.creation);
|
|
103
|
+
const installationId = creation.id.startsWith('creation-source-') ? creation.id.slice('creation-source-'.length) : '';
|
|
104
|
+
if (!uuid.test(installationId)
|
|
105
|
+
|| creation.namePrefix !== `owner-${installationId.slice(0, 8)}-`
|
|
106
|
+
|| reviews.namePrefix !== creation.namePrefix || capabilities.namePrefix !== creation.namePrefix) {
|
|
107
|
+
fail('creation namespace differs');
|
|
108
|
+
}
|
|
109
|
+
if (reviews.expiresAt !== creation.expiresAt || capabilities.expiresAt !== creation.expiresAt
|
|
110
|
+
|| reviews.runner.expiresAt !== creation.expiresAt || capabilities.runner.expiresAt !== creation.expiresAt) {
|
|
111
|
+
fail('creation authority expiry differs');
|
|
112
|
+
}
|
|
113
|
+
if (reviews.authorityId !== `creation-review-${installationId}`
|
|
114
|
+
|| capabilities.authorityId !== `creation-adoption-${installationId}`
|
|
115
|
+
|| reviews.keyId !== `${reviews.authorityId}-key` || capabilities.keyId !== `${capabilities.authorityId}-key`
|
|
116
|
+
|| new Set([creation.id, reviews.authorityId, capabilities.authorityId, expectedOwner.authorityId]).size !== 4
|
|
117
|
+
|| reviews.keyPath === capabilities.keyPath) {
|
|
118
|
+
fail('creation authorities must be independent');
|
|
119
|
+
}
|
|
120
|
+
const authorityRoot = dirname(dirname(reviews.keyPath));
|
|
121
|
+
if (reviews.keyPath !== join(authorityRoot, 'identities', 'review.pem')
|
|
122
|
+
|| capabilities.keyPath !== join(authorityRoot, 'identities', 'adoption.pem')
|
|
123
|
+
|| reviews.runner.stateRoot !== join(authorityRoot, 'state', 'creation-review-runner')
|
|
124
|
+
|| capabilities.runner.stateRoot !== join(authorityRoot, 'state', 'creation-adoption-runner')) {
|
|
125
|
+
fail('creation private roots differ from prepared identities');
|
|
126
|
+
}
|
|
127
|
+
if (reviews.maxVerifications !== limits.verifications || reviews.maxCases !== limits.cases
|
|
128
|
+
|| reviews.maxInputBytes !== limits.reviewInputBytes || reviews.maxOutputTokens !== limits.reviewOutputTokens
|
|
129
|
+
|| reviews.maxDurationMs !== limits.reviewDurationMs || reviews.receiptTtlMs !== limits.receiptTtlMs
|
|
130
|
+
|| capabilities.maxAdoptions !== limits.adoptions || capabilities.maxTools !== limits.tools
|
|
131
|
+
|| capabilities.maxCallsPerAdoption !== limits.callsPerAdoption
|
|
132
|
+
|| capabilities.maxCallRecords !== limits.callRecords || capabilities.maxInputBytes !== limits.inputBytes) {
|
|
133
|
+
fail('creation finite limits differ');
|
|
134
|
+
}
|
|
135
|
+
// Old manifests retain their original certificate-bound lifetime. A new
|
|
136
|
+
// installation explicitly grants bounded use after the authoring window.
|
|
137
|
+
if (capabilities.retention !== undefined
|
|
138
|
+
&& capabilities.retention.maximumLifetimeMs !== limits.retentionLifetimeMs) {
|
|
139
|
+
fail('creation retention lifetime differs');
|
|
140
|
+
}
|
|
141
|
+
if (reviews.runner.maxRuns !== limits.reviewRuns || reviews.runner.maxDurationMs !== limits.runnerDurationMs
|
|
142
|
+
|| reviews.runner.maxTotalDurationMs !== limits.reviewRuns * limits.runnerDurationMs
|
|
143
|
+
|| reviews.runner.maxOutputBytes !== 262_144
|
|
144
|
+
|| capabilities.runner.maxRuns !== limits.adoptionRuns || capabilities.runner.maxDurationMs !== limits.runnerDurationMs
|
|
145
|
+
|| capabilities.runner.maxTotalDurationMs !== 86_400_000 || capabilities.runner.maxOutputBytes !== 65_536
|
|
146
|
+
|| reviews.runner.maxRuns < reviews.maxVerifications * (reviews.maxCases + 1)
|
|
147
|
+
|| capabilities.runner.maxRuns < capabilities.maxAdoptions + capabilities.maxCallRecords
|
|
148
|
+
|| capabilities.maxCallRecords < capabilities.maxAdoptions * capabilities.maxCallsPerAdoption
|
|
149
|
+
|| !pairedRunnerMatches(reviews.runner, capabilities.runner)) {
|
|
150
|
+
fail('creation runner limits cannot cover finite grants');
|
|
151
|
+
}
|
|
152
|
+
if (!exact(setup.verifications, ['authority', 'publicKey']))
|
|
153
|
+
fail('invalid creation verification fields');
|
|
154
|
+
validateCreationAcceptanceAuthorityRef(setup.verifications.authority);
|
|
155
|
+
if (!isDeepStrictEqual(setup.verifications.authority, authority)
|
|
156
|
+
|| setup.verifications.publicKey !== publicKey)
|
|
157
|
+
fail('creation verification authority digest or key differs');
|
|
158
|
+
if (publicKeyAt(capabilities.keyPath) === publicKey)
|
|
159
|
+
fail('verification and adoption signing keys must be separate');
|
|
160
|
+
return { reviews, creation, capabilities, verifications: { authority, publicKey } };
|
|
161
|
+
}
|
|
162
|
+
/** Compile one stable installation grant from the already prepared private identities. */
|
|
163
|
+
export function createRsiPluginCreationSetup(input) {
|
|
164
|
+
const { resources, build, owner, expiresAt, now } = input;
|
|
165
|
+
if (input.stateSeals && (build.schemaVersion !== 3 || !exact(input.stateSeals, ['review', 'adoption'])))
|
|
166
|
+
fail('state seals require the complete Linux runner pair');
|
|
167
|
+
if (resources?.schemaVersion !== 1 || ![1, 2, 3].includes(build?.schemaVersion)
|
|
168
|
+
|| !uuid.test(resources.installationId)
|
|
169
|
+
|| !Number.isSafeInteger(expiresAt) || expiresAt <= now)
|
|
170
|
+
fail('invalid installation or expiry');
|
|
171
|
+
const prefix = `owner-${resources.installationId.slice(0, 8)}-`;
|
|
172
|
+
const creation = { id: `creation-source-${resources.installationId}`, expiresAt,
|
|
173
|
+
maxCreates: limits.creates, namePrefix: prefix };
|
|
174
|
+
const runnerBackend = creationRunnerBackend(build);
|
|
175
|
+
const reviews = {
|
|
176
|
+
authorityId: `creation-review-${resources.installationId}`, owner, namePrefix: prefix,
|
|
177
|
+
keyId: `creation-review-${resources.installationId}-key`, keyPath: resources.identities.review.keyPath,
|
|
178
|
+
expiresAt, maxVerifications: limits.verifications,
|
|
179
|
+
runner: { stateRoot: join(resources.stateRoot, 'creation-review-runner'), ...runnerBackend,
|
|
180
|
+
...(input.stateSeals ? { stateSeal: input.stateSeals.review } : {}),
|
|
181
|
+
expiresAt, maxRuns: limits.reviewRuns,
|
|
182
|
+
maxTotalDurationMs: limits.reviewRuns * limits.runnerDurationMs, maxDurationMs: limits.runnerDurationMs,
|
|
183
|
+
maxOutputBytes: 262_144 },
|
|
184
|
+
policy: 'Derive concrete held-out behavior cases from the current authenticated task and feedback. Independently check exact outputs and the checked source patch. Reject ambiguous behavior, unsafe scope, and missing evidence.',
|
|
185
|
+
maxInputBytes: limits.reviewInputBytes, maxOutputTokens: limits.reviewOutputTokens,
|
|
186
|
+
maxDurationMs: limits.reviewDurationMs, maxCases: limits.cases, receiptTtlMs: limits.receiptTtlMs,
|
|
187
|
+
};
|
|
188
|
+
const capabilities = {
|
|
189
|
+
authorityId: `creation-adoption-${resources.installationId}`,
|
|
190
|
+
keyId: `creation-adoption-${resources.installationId}-key`, keyPath: resources.identities.adoption.keyPath,
|
|
191
|
+
owner, namePrefix: prefix, expiresAt, maxAdoptions: limits.adoptions,
|
|
192
|
+
maxTools: limits.tools, maxCallsPerAdoption: limits.callsPerAdoption,
|
|
193
|
+
maxCallRecords: limits.callRecords, maxInputBytes: limits.inputBytes,
|
|
194
|
+
retention: { maximumLifetimeMs: limits.retentionLifetimeMs },
|
|
195
|
+
runner: { stateRoot: join(resources.stateRoot, 'creation-adoption-runner'), ...runnerBackend,
|
|
196
|
+
...(input.stateSeals ? { stateSeal: input.stateSeals.adoption } : {}),
|
|
197
|
+
expiresAt, maxRuns: limits.adoptionRuns,
|
|
198
|
+
maxTotalDurationMs: 86_400_000, maxDurationMs: limits.runnerDurationMs, maxOutputBytes: 65_536 },
|
|
199
|
+
};
|
|
200
|
+
const { compileCreationReviewConfig } = getRsiPluginCreationValidators();
|
|
201
|
+
const { authority, publicKey } = compileCreationReviewConfig(reviews);
|
|
202
|
+
const setup = validateRsiPluginCreationSetup({ reviews, creation, capabilities,
|
|
203
|
+
verifications: { authority, publicKey } }, owner, now);
|
|
204
|
+
if (setup.verifications.publicKey !== resources.identities.review.publicKeyPem
|
|
205
|
+
|| publicKeyAt(setup.capabilities.keyPath) !== resources.identities.adoption.publicKeyPem) {
|
|
206
|
+
fail('prepared signing identities differ');
|
|
207
|
+
}
|
|
208
|
+
return setup;
|
|
209
|
+
}
|
|
210
|
+
/** Re-derive the adoption grant identity from a compiled capability config.
|
|
211
|
+
* A migrated runner grant must carry exactly the identity the control-plane
|
|
212
|
+
* service will sync, and that identity binds the logical authority state path. */
|
|
213
|
+
export function creationAdoptionAuthorityDigest(input) {
|
|
214
|
+
const { resources, capabilities } = input;
|
|
215
|
+
if (resources?.schemaVersion !== 1 || !capabilities || typeof capabilities !== 'object'
|
|
216
|
+
|| typeof capabilities.keyPath !== 'string')
|
|
217
|
+
fail('invalid adoption authority input');
|
|
218
|
+
const controlPlane = installedPeer('@dsh-ray/plugin-control-plane');
|
|
219
|
+
if (typeof controlPlane.creationCapabilityAuthorityDigest !== 'function') {
|
|
220
|
+
fail('installed control-plane cannot derive the adoption authority digest');
|
|
221
|
+
}
|
|
222
|
+
return controlPlane.creationCapabilityAuthorityDigest({
|
|
223
|
+
path: join(resources.stateRoot, 'control-plane', 'creation-adoptions.sqlite'),
|
|
224
|
+
config: capabilities,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=rsi-plugin-creation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rsi-plugin-creation.js","sourceRoot":"","sources":["../src/rsi-plugin-creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAA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,2BAA2B,CAAC;QAC7E,MAAM,EAAE,YAAY;KACrB,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type RevisionAcceptanceAuthorityRef, type RevisionRegressionAcceptanceAuthorityRef } from '@dsh-ray/assistant-growth-contract';
|
|
2
|
+
import type { RevisionReviewConfig, RevisionRegressionReviewConfig } from '@dsh-ray/assistant-verifier';
|
|
3
|
+
import type { LinuxRunnerStateSeal } from '@dsh-ray/assistant-isolation';
|
|
4
|
+
import type { Config as ControlPlaneConfig, CreationCapabilityOwner } from '@dsh-ray/plugin-control-plane';
|
|
5
|
+
import { type RsiAuthorityResources } from './rsi-authority-resources.js';
|
|
6
|
+
import type { LinuxRsiCreationBuildEnvironment } from './rsi-linux-creation-build.js';
|
|
7
|
+
import type { NativeRsiCreationBuildEnvironment } from './rsi-native-runtime-bootstrap.js';
|
|
8
|
+
export type SourceRevisionGrant = NonNullable<NonNullable<ControlPlaneConfig['sourceJobs']>['revision']>;
|
|
9
|
+
export interface RsiPluginRevisionSetup {
|
|
10
|
+
reviews: RevisionReviewConfig;
|
|
11
|
+
regressions: RevisionRegressionReviewConfig;
|
|
12
|
+
revision: SourceRevisionGrant;
|
|
13
|
+
verifications: {
|
|
14
|
+
authority: RevisionAcceptanceAuthorityRef;
|
|
15
|
+
publicKey: string;
|
|
16
|
+
};
|
|
17
|
+
regressionVerifications: {
|
|
18
|
+
authority: RevisionRegressionAcceptanceAuthorityRef;
|
|
19
|
+
publicKey: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** Recompute both purpose-separated authorities from normalized public peer compilers. */
|
|
23
|
+
export declare function validateRsiPluginRevisionSetup(input: unknown, expectedOwner: CreationCapabilityOwner, now?: number): RsiPluginRevisionSetup;
|
|
24
|
+
/** This produces a candidate grant; installation decides whether new revision authority is authorized. */
|
|
25
|
+
export type RsiPluginRevisionBuild = LinuxRsiCreationBuildEnvironment | NativeRsiCreationBuildEnvironment;
|
|
26
|
+
/** Synthesize and verify the private authority and runner pair for plugin revision. */
|
|
27
|
+
export declare function createRsiPluginRevisionSetup(input: {
|
|
28
|
+
resources: RsiAuthorityResources;
|
|
29
|
+
build: RsiPluginRevisionBuild;
|
|
30
|
+
owner: CreationCapabilityOwner;
|
|
31
|
+
now: number;
|
|
32
|
+
expiresAt: number;
|
|
33
|
+
stateSeals?: {
|
|
34
|
+
review: LinuxRunnerStateSeal;
|
|
35
|
+
regression: LinuxRunnerStateSeal;
|
|
36
|
+
};
|
|
37
|
+
}): RsiPluginRevisionSetup;
|
|
38
|
+
//# sourceMappingURL=rsi-plugin-revision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rsi-plugin-revision.d.ts","sourceRoot":"","sources":["../src/rsi-plugin-revision.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,8BAA8B,EAAE,KAAK,wCAAwC,EAAE,MAAM,oCAAoC,CAAA;AAChI,OAAO,KAAK,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA;AACvG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACxE,OAAO,KAAK,EAAE,MAAM,IAAI,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AAC1G,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAC5F,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAA;AACrF,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,mCAAmC,CAAA;AAE1F,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,WAAW,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA;AACxG,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,oBAAoB,CAAA;IAC7B,WAAW,EAAE,8BAA8B,CAAA;IAC3C,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,aAAa,EAAE;QAAE,SAAS,EAAE,8BAA8B,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;IAC/E,uBAAuB,EAAE;QAAE,SAAS,EAAE,wCAAwC,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;CACpG;AA6ED,0FAA0F;AAC1F,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,uBAAuB,EACnG,GAAG,SAAa,GAAG,sBAAsB,CAuD1C;AAED,0GAA0G;AAC1G,MAAM,MAAM,sBAAsB,GAAG,gCAAgC,GAAG,iCAAiC,CAAA;AAEzG,uFAAuF;AACvF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,SAAS,EAAE,qBAAqB,CAAC;IAAC,KAAK,EAAE,sBAAsB,CAAC;IAAC,KAAK,EAAE,uBAAuB,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;IAC/H,UAAU,CAAC,EAAE;QAAE,MAAM,EAAE,oBAAoB,CAAC;QAAC,UAAU,EAAE,oBAAoB,CAAA;KAAE,CAAA;CAChF,GAAG,sBAAsB,CAoDzB"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { createPrivateKey, createPublicKey } from 'node:crypto';
|
|
2
|
+
import { lstatSync, readFileSync, realpathSync } from 'node:fs';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
5
|
+
import { pathToFileURL } from 'node:url';
|
|
6
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
7
|
+
import { validateRevisionAcceptanceAuthorityRef, validateRevisionRegressionAcceptanceAuthorityRef } from '@dsh-ray/assistant-growth-contract';
|
|
8
|
+
import { rsiAuthorityRoles } from './rsi-authority-resources.js';
|
|
9
|
+
const limits = { revisions: 32, verifications: 32, cases: 4, reviewRuns: 160, regressionRuns: 320,
|
|
10
|
+
runnerDurationMs: 30_000, outputBytes: 262_144, reviewInputBytes: 262_144, reviewOutputTokens: 8_192,
|
|
11
|
+
durationMs: 300_000, receiptTtlMs: 86_400_000 };
|
|
12
|
+
const policy = 'Derive concrete held-out behavior cases from the current authenticated task and feedback. Independently check the exact adopted parent, candidate patch, outputs, scope and lifecycle ownership. Reject ambiguous behavior, unsafe scope and missing evidence; retained parent cases are independently checked by the paired regression authority.';
|
|
13
|
+
const uuid = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u;
|
|
14
|
+
const ownerFields = ['authorityId', 'authorityHash', 'principalId', 'principalRecordId', 'principalVersion', 'workspace', 'agentPreset'];
|
|
15
|
+
function fail(message) { throw new Error(`rsi plugin revision: ${message}`); }
|
|
16
|
+
function exact(value, fields) {
|
|
17
|
+
if (!value || typeof value !== 'object' || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype)
|
|
18
|
+
return false;
|
|
19
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
20
|
+
return Reflect.ownKeys(value).length === fields.length
|
|
21
|
+
&& Object.keys(descriptors).sort().join('\0') === [...fields].sort().join('\0')
|
|
22
|
+
&& Object.values(descriptors).every(field => field.enumerable && 'value' in field);
|
|
23
|
+
}
|
|
24
|
+
function privateDirectory(path) {
|
|
25
|
+
if (typeof path !== 'string' || !isAbsolute(path) || resolve(path) !== path || /[\p{Cc}\\]/u.test(path)
|
|
26
|
+
|| realpathSync(path) !== path)
|
|
27
|
+
fail('private directory differs');
|
|
28
|
+
const info = lstatSync(path);
|
|
29
|
+
if (!info.isDirectory() || info.isSymbolicLink() || info.mode & 0o077 || process.getuid && info.uid !== process.getuid()) {
|
|
30
|
+
fail('private directory differs');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function publicKeyAt(path) {
|
|
34
|
+
if (typeof path !== 'string' || !isAbsolute(path) || resolve(path) !== path || /[\p{Cc}\\]/u.test(path)
|
|
35
|
+
|| realpathSync(path) !== path)
|
|
36
|
+
fail('signing identity path differs');
|
|
37
|
+
const info = lstatSync(path);
|
|
38
|
+
if (!info.isFile() || info.isSymbolicLink() || info.nlink !== 1 || info.size < 1 || info.size > 8192
|
|
39
|
+
|| info.mode & 0o077 || process.getuid && info.uid !== process.getuid())
|
|
40
|
+
fail('signing identity is not private');
|
|
41
|
+
const key = createPrivateKey(readFileSync(path));
|
|
42
|
+
if (key.asymmetricKeyType !== 'ed25519')
|
|
43
|
+
fail('signing identity must be Ed25519');
|
|
44
|
+
return createPublicKey(key).export({ format: 'pem', type: 'spki' }).toString();
|
|
45
|
+
}
|
|
46
|
+
const requirePeer = createRequire(import.meta.url);
|
|
47
|
+
function validators() {
|
|
48
|
+
const name = '@dsh-ray/assistant-verifier';
|
|
49
|
+
try {
|
|
50
|
+
requirePeer.resolve(name);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ERR_MODULE_NOT_FOUND') {
|
|
54
|
+
fail(`opted-in plugin revision requires installed peer ${name}`);
|
|
55
|
+
}
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
const peer = requirePeer(name);
|
|
59
|
+
if (typeof peer.compileRevisionReviewConfig !== 'function' || typeof peer.compileRevisionRegressionReviewConfig !== 'function') {
|
|
60
|
+
fail('installed revision validators are unavailable; update the verifier peer');
|
|
61
|
+
}
|
|
62
|
+
return { compileRevisionReviewConfig: peer.compileRevisionReviewConfig,
|
|
63
|
+
compileRevisionRegressionReviewConfig: peer.compileRevisionRegressionReviewConfig };
|
|
64
|
+
}
|
|
65
|
+
/** Validate only existing private resources; compilation never creates a ledger or a key. */
|
|
66
|
+
function preparedIdentities(resources) {
|
|
67
|
+
if (!exact(resources, ['schemaVersion', 'root', 'installationId', 'ledgerId', 'identities', 'registry', 'catalog', 'stateRoot', 'configRoot'])
|
|
68
|
+
|| resources.schemaVersion !== 1 || typeof resources.root !== 'string' || !uuid.test(resources.installationId) || !uuid.test(resources.ledgerId)
|
|
69
|
+
|| resources.installationId === resources.ledgerId || !exact(resources.identities, rsiAuthorityRoles)
|
|
70
|
+
|| resources.stateRoot !== join(resources.root, 'state') || resources.configRoot !== join(resources.root, 'config')
|
|
71
|
+
|| !exact(resources.registry, ['id', 'root', 'locator']) || resources.registry.id !== `registry-${resources.installationId}`
|
|
72
|
+
|| resources.registry.root !== join(resources.root, 'registry') || resources.registry.locator !== pathToFileURL(resources.registry.root).href
|
|
73
|
+
|| !exact(resources.catalog, ['id', 'path']) || resources.catalog.id !== `catalog-${resources.installationId}`
|
|
74
|
+
|| resources.catalog.path !== join(resources.root, 'catalog.json'))
|
|
75
|
+
fail('prepared resource identity differs');
|
|
76
|
+
privateDirectory(resources.root);
|
|
77
|
+
privateDirectory(resources.stateRoot);
|
|
78
|
+
privateDirectory(resources.configRoot);
|
|
79
|
+
for (const role of rsiAuthorityRoles) {
|
|
80
|
+
const identity = resources.identities[role], authority = `${role}-${resources.installationId}`;
|
|
81
|
+
if (!exact(identity, ['authority', 'keyId', 'keyPath', 'publicKeyPem']) || identity.authority !== authority
|
|
82
|
+
|| identity.keyId !== `${authority}-key` || identity.keyPath !== join(resources.root, 'identities', `${role}.pem`)
|
|
83
|
+
|| typeof identity.publicKeyPem !== 'string')
|
|
84
|
+
fail('prepared signing identity differs');
|
|
85
|
+
}
|
|
86
|
+
const review = publicKeyAt(resources.identities.review.keyPath), adoption = publicKeyAt(resources.identities.adoption.keyPath);
|
|
87
|
+
if (review !== resources.identities.review.publicKeyPem || adoption !== resources.identities.adoption.publicKeyPem
|
|
88
|
+
|| review === adoption)
|
|
89
|
+
fail('prepared signing identities differ or are not independent');
|
|
90
|
+
}
|
|
91
|
+
/** Recompute both purpose-separated authorities from normalized public peer compilers. */
|
|
92
|
+
export function validateRsiPluginRevisionSetup(input, expectedOwner, now = Date.now()) {
|
|
93
|
+
if (!Number.isSafeInteger(now) || now < 0)
|
|
94
|
+
fail('invalid validation time');
|
|
95
|
+
if (!exact(expectedOwner, ownerFields))
|
|
96
|
+
fail('invalid expected owner');
|
|
97
|
+
if (!exact(input, ['reviews', 'regressions', 'revision', 'verifications', 'regressionVerifications']))
|
|
98
|
+
fail('invalid setup fields');
|
|
99
|
+
const setup = input;
|
|
100
|
+
const peer = validators();
|
|
101
|
+
const reviewed = peer.compileRevisionReviewConfig(setup.reviews);
|
|
102
|
+
const regressed = peer.compileRevisionRegressionReviewConfig(setup.regressions);
|
|
103
|
+
const { config: reviews } = reviewed, { config: regressions } = regressed;
|
|
104
|
+
if (!isDeepStrictEqual(reviews.owner, expectedOwner) || !isDeepStrictEqual(regressions.owner, expectedOwner))
|
|
105
|
+
fail('revision owner differs');
|
|
106
|
+
if (!exact(setup.revision, ['id', 'expiresAt', 'maxRevisions', 'namePrefix'])
|
|
107
|
+
|| typeof setup.revision.id !== 'string' || !Number.isSafeInteger(setup.revision.expiresAt)
|
|
108
|
+
|| setup.revision.expiresAt <= now || setup.revision.maxRevisions !== limits.revisions)
|
|
109
|
+
fail('invalid finite source revision grant');
|
|
110
|
+
const revision = structuredClone(setup.revision);
|
|
111
|
+
const installation = revision.id.startsWith('revision-source-') ? revision.id.slice('revision-source-'.length) : '';
|
|
112
|
+
if (!uuid.test(installation) || revision.namePrefix !== `owner-${installation.slice(0, 8)}-`
|
|
113
|
+
|| reviews.namePrefix !== revision.namePrefix || regressions.namePrefix !== revision.namePrefix)
|
|
114
|
+
fail('revision namespace differs');
|
|
115
|
+
if (reviews.expiresAt !== revision.expiresAt || regressions.expiresAt !== revision.expiresAt
|
|
116
|
+
|| reviews.runner.expiresAt !== revision.expiresAt || regressions.runner.expiresAt !== revision.expiresAt)
|
|
117
|
+
fail('revision authority expiry differs');
|
|
118
|
+
if (reviews.authorityId !== `revision-review-${installation}` || regressions.authorityId !== `revision-regression-${installation}`
|
|
119
|
+
|| reviews.keyId !== `${reviews.authorityId}-key` || regressions.keyId !== `${regressions.authorityId}-key`
|
|
120
|
+
|| new Set([revision.id, reviews.authorityId, regressions.authorityId, expectedOwner.authorityId]).size !== 4)
|
|
121
|
+
fail('revision authority identity differs');
|
|
122
|
+
const root = dirname(dirname(reviews.keyPath));
|
|
123
|
+
if (reviews.keyPath !== join(root, 'identities', 'review.pem') || regressions.keyPath !== reviews.keyPath
|
|
124
|
+
|| reviews.runner.stateRoot !== join(root, 'state', 'revision-review-runner')
|
|
125
|
+
|| regressions.runner.stateRoot !== join(root, 'state', 'revision-regression-runner'))
|
|
126
|
+
fail('revision private roots differ');
|
|
127
|
+
privateDirectory(reviews.runner.stateRoot);
|
|
128
|
+
privateDirectory(regressions.runner.stateRoot);
|
|
129
|
+
if (reviews.maxVerifications !== limits.verifications || regressions.maxVerifications !== limits.verifications
|
|
130
|
+
|| reviews.maxCases !== limits.cases || regressions.maxCases !== limits.cases
|
|
131
|
+
|| reviews.maxDurationMs !== limits.durationMs || regressions.maxDurationMs !== limits.durationMs
|
|
132
|
+
|| reviews.receiptTtlMs !== limits.receiptTtlMs || regressions.receiptTtlMs !== limits.receiptTtlMs
|
|
133
|
+
|| reviews.maxInputBytes !== limits.reviewInputBytes || reviews.maxOutputTokens !== limits.reviewOutputTokens
|
|
134
|
+
|| reviews.policy !== policy)
|
|
135
|
+
fail('revision finite limits or policy differ');
|
|
136
|
+
for (const [runner, runs] of [[reviews.runner, limits.reviewRuns], [regressions.runner, limits.regressionRuns]]) {
|
|
137
|
+
if (runner.maxRuns !== runs || runner.maxDurationMs !== limits.runnerDurationMs
|
|
138
|
+
|| runner.maxTotalDurationMs !== runs * limits.runnerDurationMs || runner.maxOutputBytes !== limits.outputBytes)
|
|
139
|
+
fail('revision runner limits differ');
|
|
140
|
+
}
|
|
141
|
+
const reviewRunner = reviews.runner, regressionRunner = regressions.runner;
|
|
142
|
+
const macosPair = 'backend' in reviewRunner && reviewRunner.backend === 'macos-seatbelt'
|
|
143
|
+
&& 'backend' in regressionRunner && regressionRunner.backend === 'macos-seatbelt';
|
|
144
|
+
const linuxPair = 'backend' in reviewRunner && reviewRunner.backend === 'linux-native'
|
|
145
|
+
&& 'backend' in regressionRunner && regressionRunner.backend === 'linux-native';
|
|
146
|
+
if (macosPair) {
|
|
147
|
+
if (!isDeepStrictEqual(reviewRunner.runtime, regressionRunner.runtime))
|
|
148
|
+
fail('revision runners must share the macOS native family');
|
|
149
|
+
}
|
|
150
|
+
else if (!linuxPair || !isDeepStrictEqual(reviewRunner.runtime, regressionRunner.runtime)
|
|
151
|
+
|| !isDeepStrictEqual(reviewRunner.cgroupRoots, regressionRunner.cgroupRoots))
|
|
152
|
+
fail('revision runners must share the Linux native family');
|
|
153
|
+
if (!exact(setup.verifications, ['authority', 'publicKey']) || !exact(setup.regressionVerifications, ['authority', 'publicKey']))
|
|
154
|
+
fail('invalid revision verification fields');
|
|
155
|
+
validateRevisionAcceptanceAuthorityRef(setup.verifications.authority);
|
|
156
|
+
validateRevisionRegressionAcceptanceAuthorityRef(setup.regressionVerifications.authority);
|
|
157
|
+
if (!isDeepStrictEqual(setup.verifications.authority, reviewed.authority) || setup.verifications.publicKey !== reviewed.publicKey
|
|
158
|
+
|| !isDeepStrictEqual(setup.regressionVerifications.authority, regressed.authority)
|
|
159
|
+
|| setup.regressionVerifications.publicKey !== regressed.publicKey || reviewed.publicKey !== regressed.publicKey)
|
|
160
|
+
fail('revision verification authority digest or key differs');
|
|
161
|
+
if (publicKeyAt(join(root, 'identities', 'adoption.pem')) === reviewed.publicKey)
|
|
162
|
+
fail('revision review and adoption signing keys must be independent');
|
|
163
|
+
return { reviews, regressions, revision, verifications: { authority: reviewed.authority, publicKey: reviewed.publicKey },
|
|
164
|
+
regressionVerifications: { authority: regressed.authority, publicKey: regressed.publicKey } };
|
|
165
|
+
}
|
|
166
|
+
/** Synthesize and verify the private authority and runner pair for plugin revision. */
|
|
167
|
+
export function createRsiPluginRevisionSetup(input) {
|
|
168
|
+
const { resources, build, owner, now, expiresAt } = input;
|
|
169
|
+
if (input.stateSeals && (build?.schemaVersion !== 3 || !exact(input.stateSeals, ['review', 'regression'])))
|
|
170
|
+
fail('incomplete revision state seals');
|
|
171
|
+
preparedIdentities(resources);
|
|
172
|
+
if (!Number.isSafeInteger(expiresAt) || !Number.isSafeInteger(now) || now < 0 || expiresAt <= now)
|
|
173
|
+
fail('invalid native build or expiry');
|
|
174
|
+
let runnerBackend;
|
|
175
|
+
let buildCommit;
|
|
176
|
+
if (build && typeof build === 'object' && build.schemaVersion === 2) {
|
|
177
|
+
if (!exact(build, ['schemaVersion', 'backend', 'sourceCommit', 'runtime'])
|
|
178
|
+
|| build.backend !== 'macos-seatbelt' || !/^[a-f0-9]{40}$/u.test(build.sourceCommit))
|
|
179
|
+
fail('invalid native build or expiry');
|
|
180
|
+
buildCommit = build.sourceCommit;
|
|
181
|
+
runnerBackend = { backend: 'macos-seatbelt', runtime: build.runtime };
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
const hasBuildDigest = !!build && typeof build === 'object' && Object.hasOwn(build, 'buildRuntimeDigest');
|
|
185
|
+
const buildDigest = hasBuildDigest ? Object.getOwnPropertyDescriptor(build, 'buildRuntimeDigest')?.value : undefined;
|
|
186
|
+
if (!exact(build, ['schemaVersion', 'backend', 'sourceCommit', 'behavior', 'cgroupRoots', ...(hasBuildDigest ? ['buildRuntimeDigest'] : [])])
|
|
187
|
+
|| build.schemaVersion !== 3 || build.backend !== 'linux-native' || !/^[a-f0-9]{40}$/u.test(build.sourceCommit)
|
|
188
|
+
|| hasBuildDigest && (typeof buildDigest !== 'string' || !/^[a-f0-9]{64}$/u.test(buildDigest)))
|
|
189
|
+
fail('invalid native build or expiry');
|
|
190
|
+
buildCommit = build.sourceCommit;
|
|
191
|
+
runnerBackend = { backend: 'linux-native', runtime: build.behavior, cgroupRoots: build.cgroupRoots };
|
|
192
|
+
}
|
|
193
|
+
const installation = resources.installationId, namePrefix = `owner-${installation.slice(0, 8)}-`;
|
|
194
|
+
const runner = { ...runnerBackend, expiresAt, maxDurationMs: limits.runnerDurationMs, maxOutputBytes: limits.outputBytes };
|
|
195
|
+
const reviews = { authorityId: `revision-review-${installation}`, owner, namePrefix,
|
|
196
|
+
keyId: `revision-review-${installation}-key`, keyPath: resources.identities.review.keyPath, expiresAt,
|
|
197
|
+
maxVerifications: limits.verifications, runner: { ...runner, stateRoot: join(resources.stateRoot, 'revision-review-runner'),
|
|
198
|
+
...(input.stateSeals ? { stateSeal: input.stateSeals.review } : {}),
|
|
199
|
+
maxRuns: limits.reviewRuns, maxTotalDurationMs: limits.reviewRuns * limits.runnerDurationMs },
|
|
200
|
+
policy, maxInputBytes: limits.reviewInputBytes, maxOutputTokens: limits.reviewOutputTokens,
|
|
201
|
+
maxDurationMs: limits.durationMs, maxCases: limits.cases, receiptTtlMs: limits.receiptTtlMs };
|
|
202
|
+
const regressions = { authorityId: `revision-regression-${installation}`, owner, namePrefix,
|
|
203
|
+
keyId: `revision-regression-${installation}-key`, keyPath: resources.identities.review.keyPath, expiresAt,
|
|
204
|
+
maxVerifications: limits.verifications, runner: { ...runner, stateRoot: join(resources.stateRoot, 'revision-regression-runner'),
|
|
205
|
+
...(input.stateSeals ? { stateSeal: input.stateSeals.regression } : {}),
|
|
206
|
+
maxRuns: limits.regressionRuns, maxTotalDurationMs: limits.regressionRuns * limits.runnerDurationMs },
|
|
207
|
+
maxDurationMs: limits.durationMs, maxCases: limits.cases, receiptTtlMs: limits.receiptTtlMs };
|
|
208
|
+
const peer = validators(), reviewed = peer.compileRevisionReviewConfig(reviews), regressed = peer.compileRevisionRegressionReviewConfig(regressions);
|
|
209
|
+
const setup = validateRsiPluginRevisionSetup({ reviews: reviewed.config, regressions: regressed.config,
|
|
210
|
+
revision: { id: `revision-source-${installation}`, expiresAt, maxRevisions: limits.revisions, namePrefix },
|
|
211
|
+
verifications: { authority: reviewed.authority, publicKey: reviewed.publicKey },
|
|
212
|
+
regressionVerifications: { authority: regressed.authority, publicKey: regressed.publicKey } }, owner, now);
|
|
213
|
+
const native = setup.reviews.runner;
|
|
214
|
+
const runtimeMatches = 'backend' in native && ((native.backend === 'macos-seatbelt' && build.schemaVersion === 2 && isDeepStrictEqual(native.runtime, build.runtime))
|
|
215
|
+
|| (native.backend === 'linux-native' && build.schemaVersion === 3 && native.runtime.runtime.sourceCommit === buildCommit));
|
|
216
|
+
if (!runtimeMatches || setup.verifications.publicKey !== resources.identities.review.publicKeyPem) {
|
|
217
|
+
fail('prepared revision build or signing identity differs');
|
|
218
|
+
}
|
|
219
|
+
return setup;
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=rsi-plugin-revision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rsi-plugin-revision.js","sourceRoot":"","sources":["../src/rsi-plugin-revision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,sCAAsC,EAAE,gDAAgD,EACX,MAAM,oCAAoC,CAAA;AAIhI,OAAO,EAAE,iBAAiB,EAA8B,MAAM,8BAA8B,CAAA;AAa5F,MAAM,MAAM,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG;IAC/F,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,kB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from '@dsh-ray/assistant-growth-driver';
|
|
3
|
+
import { type Config as ControlPlaneConfig } from '@dsh-ray/plugin-control-plane';
|
|
4
|
+
import { type SourceReviewConfig } from '@dsh-ray/assistant-verifier';
|
|
5
|
+
import type { RsiServiceEnvironments } from './rsi-service-setup.js';
|
|
6
|
+
import { type RsiMemoryLearningSetup } from './rsi-memory-learning.js';
|
|
7
|
+
import { type RsiOrdinaryUseLearningSetup } from './rsi-ordinary-use-learning.js';
|
|
8
|
+
import { type RsiPluginCreationSetup } from './rsi-plugin-creation.js';
|
|
9
|
+
import { type RsiPluginRevisionSetup } from './rsi-plugin-revision.js';
|
|
10
|
+
/** Private, owner supplied input for the two-host RSI overlay. */
|
|
11
|
+
export interface RsiSetupManifest {
|
|
12
|
+
schemaVersion: 1;
|
|
13
|
+
targetProfile: string;
|
|
14
|
+
coordinatorProfile: string;
|
|
15
|
+
serviceEnvironment?: RsiServiceEnvironments;
|
|
16
|
+
controlPlane: ControlPlaneConfig;
|
|
17
|
+
growthDriver: AssistantGrowthDriverConfig;
|
|
18
|
+
sourceReviews: SourceReviewConfig;
|
|
19
|
+
memoryLearning?: RsiMemoryLearningSetup;
|
|
20
|
+
/** Fresh-install ordinary-use rings that need no new signing-key material. */
|
|
21
|
+
ordinaryUseLearning?: RsiOrdinaryUseLearningSetup;
|
|
22
|
+
pluginCreation?: RsiPluginCreationSetup;
|
|
23
|
+
pluginRevision?: RsiPluginRevisionSetup;
|
|
24
|
+
/** Frozen initial Linux build/observer pairing; retained generations require a separate handoff. */
|
|
25
|
+
linuxBuild?: {
|
|
26
|
+
schemaVersion: 1;
|
|
27
|
+
sourceBuildDigest: string;
|
|
28
|
+
behaviorRuntimeDigest?: string;
|
|
29
|
+
};
|
|
30
|
+
coordinator: {
|
|
31
|
+
budgetId: string;
|
|
32
|
+
budgetAmount: number;
|
|
33
|
+
timeoutMs: number;
|
|
34
|
+
};
|
|
35
|
+
limits: {
|
|
36
|
+
periodMs: number;
|
|
37
|
+
reviews: number;
|
|
38
|
+
discovery: number;
|
|
39
|
+
source: number;
|
|
40
|
+
observations: number;
|
|
41
|
+
coordinator: number;
|
|
42
|
+
qualification?: number;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare const SELF_ITERATION_MANAGED_ROW_IDS: ReadonlySet<string>;
|
|
46
|
+
/** Match the target compiler's exact embedded Personal Assistant options for Host attestation. */
|
|
47
|
+
export declare function compileRsiPersonalAssistantOptions(input: {
|
|
48
|
+
effectiveConfig: Record<string, unknown>;
|
|
49
|
+
manifest: RsiSetupManifest;
|
|
50
|
+
scope: {
|
|
51
|
+
workspace: string;
|
|
52
|
+
preset: string;
|
|
53
|
+
principal: string;
|
|
54
|
+
};
|
|
55
|
+
budgetIds: {
|
|
56
|
+
reviews: string;
|
|
57
|
+
discovery: string;
|
|
58
|
+
source: string;
|
|
59
|
+
observations: string;
|
|
60
|
+
};
|
|
61
|
+
upgradeExistingOwner?: boolean;
|
|
62
|
+
}): Record<string, unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* Read-only profile compiler. The caller owns private manifest I/O, lifecycle locks,
|
|
65
|
+
* atomic writes and post-write DSH composition checks.
|
|
66
|
+
*/
|
|
67
|
+
export declare function compileRsiProfiles(input: {
|
|
68
|
+
manifest: RsiSetupManifest;
|
|
69
|
+
dshHome: string;
|
|
70
|
+
targetPatch: string;
|
|
71
|
+
targetEffective: string;
|
|
72
|
+
coordinatorPatch: string;
|
|
73
|
+
coordinatorEffective: string;
|
|
74
|
+
coordinatorBase: string;
|
|
75
|
+
owner: ActiveLarkOwnerBinding;
|
|
76
|
+
upgradeExistingOwner?: boolean;
|
|
77
|
+
}): Promise<{
|
|
78
|
+
targetPatch: string;
|
|
79
|
+
coordinatorPatch: string;
|
|
80
|
+
}>;
|
|
81
|
+
//# sourceMappingURL=rsi-profile.d.ts.map
|