@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 @@
|
|
|
1
|
+
{"version":3,"file":"rsi-bootstrap.d.ts","sourceRoot":"","sources":["../src/rsi-bootstrap.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEzE,OAAO,EAA8B,KAAK,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACpG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAgC,KAAK,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEvG,OAAO,EAAE,6BAA6B,EAAwD,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAIhJ,KAAK,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,GAAG,iBAAiB,GAC5F,kBAAkB,GAAG,sBAAsB,GAAG,iBAAiB,CAAC,CAAA;AACpE,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,sBAAsB,CAAA;IAC/B,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AACD,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,CAAC,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AACD,UAAU,OAAO;IACf,aAAa,EAAE,CAAC,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,iBAAiB,EAAE,MAAM,CAAA;IACzB,MAAM,EAAE,qBAAqB,CAAA;CAC9B;AA4CD,oGAAoG;AACpG,wBAAsB,mCAAmC,CAAC,KAAK,EAAE;IAC/D,SAAS,EAAE,qBAAqB,CAAA;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,WAAW,CAAA;CACpB,GAAG,OAAO,CAAC;IACV,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAA;IACzD,SAAS,EAAE,OAAO,GAAG,eAAe,CAAA;CACrC,CAAC,CAiCD;AAED,+DAA+D;AAC/D,wBAAsB,4BAA4B,CAAC,KAAK,EAAE;IACxD,QAAQ,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAAC,SAAS,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAC/F,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAC7E,GAAG,OAAO,CAAC,IAAI,CAAC,CAgDhB;AAED;;;+EAG+E;AAC/E,wBAAsB,4BAA4B,CAAC,KAAK,EAAE,uBAAuB,EAC/E,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAkMvE;AAED;;;;;;GAMG;AACH,wBAAsB,gCAAgC,CAAC,KAAK,EAAE,uBAAuB,EACnF,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAmJvE"}
|
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { constants } from 'node:fs';
|
|
10
|
+
import { lstat, mkdir, open, readdir, realpath, rename, rmdir, unlink } from 'node:fs/promises';
|
|
11
|
+
import { createHash, randomBytes, randomUUID } from 'node:crypto';
|
|
12
|
+
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
13
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
14
|
+
import { pathToFileURL } from 'node:url';
|
|
15
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
16
|
+
import { ControlPlaneStore, controlPlaneSchemaVersion } from '@dsh-ray/plugin-control-plane';
|
|
17
|
+
import { compileRsiAuthorityConfigs } from './rsi-authority-config.js';
|
|
18
|
+
import { compileRsiProfiles } from './rsi-profile.js';
|
|
19
|
+
import { validateRsiAuthorities } from './rsi-setup.js';
|
|
20
|
+
import { prepareRsiAuthorityResources } from './rsi-authority-resources.js';
|
|
21
|
+
import { prepareRsiAuthorityRuntime, RSI_AUTHORITY_RUNTIME_RECEIPT_MAX_BYTES } from './rsi-authority-runtime.js';
|
|
22
|
+
import { readRsiHostUpdateOverlayChain, rsiHostUpdateOverlayDigest, signRsiHostUpdateOverlay } from './rsi-host-update.js';
|
|
23
|
+
import { readRsiSourceMaintenance } from './rsi-source-maintenance.js';
|
|
24
|
+
import { rsiBuildResources as io } from './rsi-build.js';
|
|
25
|
+
function sameOwnedFile(stat, file) {
|
|
26
|
+
return stat.dev === file.dev && stat.ino === file.ino && stat.size === file.size
|
|
27
|
+
&& stat.mtimeNs === file.mtimeNs && stat.ctimeNs === file.ctimeNs;
|
|
28
|
+
}
|
|
29
|
+
const hash = (value) => createHash('sha256').update(value).digest('hex');
|
|
30
|
+
const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
|
|
31
|
+
function fail(message) { throw new Error(`rsi bootstrap: ${message}`); }
|
|
32
|
+
function within(path, root) {
|
|
33
|
+
return isAbsolute(path) && resolve(path) === path && path.startsWith(`${root}/`) && !path.includes('\0') && !/[\r\n]/u.test(path);
|
|
34
|
+
}
|
|
35
|
+
async function exists(path) {
|
|
36
|
+
try {
|
|
37
|
+
await lstat(path);
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error.code === 'ENOENT')
|
|
42
|
+
return false;
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function privateFile(path, maximum = 2_097_152) {
|
|
47
|
+
if (await realpath(path) !== path)
|
|
48
|
+
fail(`noncanonical file: ${path}`);
|
|
49
|
+
const stat = await lstat(path);
|
|
50
|
+
if (stat.nlink !== 1 || !stat.isFile())
|
|
51
|
+
fail(`unsafe file: ${path}`);
|
|
52
|
+
await io.directory(dirname(path));
|
|
53
|
+
return io.readStable(path, maximum, true);
|
|
54
|
+
}
|
|
55
|
+
async function verifyOwnerChangeReceipts(overlay, home, profile) {
|
|
56
|
+
const after = overlay.kind === 'rsi-owner-repair-overlay' ? overlay.repair.after : overlay.update.after;
|
|
57
|
+
if (hash(await privateFile(join(home, '.rsi-setup-journal.json'))) !== after.journalDigest
|
|
58
|
+
|| hash(await privateFile(join(home, 'rsi-creation-builds', profile, 'bootstrap.json'), 65_536))
|
|
59
|
+
!== after.creationReceiptDigest)
|
|
60
|
+
fail('signed owner change receipts changed');
|
|
61
|
+
}
|
|
62
|
+
async function atomicWritePrivate(path, bytes) {
|
|
63
|
+
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
64
|
+
const descriptor = await open(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
|
|
65
|
+
try {
|
|
66
|
+
await descriptor.writeFile(bytes);
|
|
67
|
+
await descriptor.sync();
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
await descriptor.close();
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
await rename(temporary, path);
|
|
74
|
+
await io.syncDirectory(dirname(path));
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
await unlink(temporary).catch(() => { });
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** Verify existing bootstrap receipt, overlay chain, and persisted config files before mutating. */
|
|
82
|
+
export async function verifyExistingRsiOwnerConfiguration(input) {
|
|
83
|
+
input.signal.throwIfAborted();
|
|
84
|
+
const { resources, dshHome, targetProfile, observerKeyPath, signal } = input;
|
|
85
|
+
const bootstrapSource = (await privateFile(join(resources.configRoot, 'bootstrap.json'))).toString('utf8');
|
|
86
|
+
const receipt = JSON.parse(bootstrapSource);
|
|
87
|
+
const overlayPath = join(resources.configRoot, 'host-update-overlays.json');
|
|
88
|
+
const overlay = readRsiHostUpdateOverlayChain({
|
|
89
|
+
source: await exists(overlayPath) ? (await privateFile(overlayPath)).toString('utf8') : undefined,
|
|
90
|
+
resources, dshHome, profile: targetProfile, bootstrapSource,
|
|
91
|
+
});
|
|
92
|
+
const effective = overlay.latest ?? receipt;
|
|
93
|
+
if (receipt.schemaVersion !== 1 || !effective.files || typeof effective.files !== 'object'
|
|
94
|
+
|| Array.isArray(effective.files) || Object.keys(effective.files).length > 512) {
|
|
95
|
+
fail('existing owner receipt differs before stopping Hosts');
|
|
96
|
+
}
|
|
97
|
+
const roots = [resources.configRoot, resources.stateRoot, resources.registry.root];
|
|
98
|
+
for (const [path, digest] of Object.entries(effective.files)) {
|
|
99
|
+
signal.throwIfAborted();
|
|
100
|
+
if (!roots.some(root => within(path, root)) || !/^[a-f0-9]{64}$/u.test(digest)
|
|
101
|
+
|| hash(await privateFile(path)) !== digest) {
|
|
102
|
+
fail('existing configuration changed before stopping Hosts');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const key = await privateFile(observerKeyPath, 32);
|
|
106
|
+
if (key.length !== 32 || hash(key) !== receipt.observerKeyDigest) {
|
|
107
|
+
fail('observer identity changed before stopping Hosts');
|
|
108
|
+
}
|
|
109
|
+
const ownerChange = overlay.records.findLast(record => record.kind === 'rsi-owner-repair-overlay'
|
|
110
|
+
|| record.kind === 'rsi-owner-program-update-overlay');
|
|
111
|
+
if (ownerChange?.kind === 'rsi-owner-repair-overlay' || ownerChange?.kind === 'rsi-owner-program-update-overlay') {
|
|
112
|
+
await verifyOwnerChangeReceipts(ownerChange, dshHome, targetProfile);
|
|
113
|
+
}
|
|
114
|
+
return { bootstrapSource, receipt, overlay, effective };
|
|
115
|
+
}
|
|
116
|
+
/** Read-only retry admission before either Host is stopped. */
|
|
117
|
+
export async function inspectRsiOwnerConfiguration(input) {
|
|
118
|
+
input.signal.throwIfAborted();
|
|
119
|
+
const { manifest, resources, patches } = input;
|
|
120
|
+
const manifestPath = join(resources.configRoot, 'manifest.json');
|
|
121
|
+
const bootstrapSource = (await privateFile(join(resources.configRoot, 'bootstrap.json'))).toString('utf8');
|
|
122
|
+
const receipt = JSON.parse(bootstrapSource);
|
|
123
|
+
const home = dirname(dirname(manifest.controlPlane.runtimeObserver.profilePath));
|
|
124
|
+
const overlayPath = join(resources.configRoot, 'host-update-overlays.json');
|
|
125
|
+
const overlay = readRsiHostUpdateOverlayChain({ source: await exists(overlayPath)
|
|
126
|
+
? (await privateFile(overlayPath)).toString('utf8') : undefined,
|
|
127
|
+
resources, dshHome: home, profile: manifest.targetProfile, bootstrapSource });
|
|
128
|
+
const effective = overlay.latest ?? receipt;
|
|
129
|
+
const expectedResult = { schemaVersion: 1, manifestPath,
|
|
130
|
+
manifestDigest: hash(json(manifest)), targetProfile: manifest.targetProfile,
|
|
131
|
+
coordinatorProfile: manifest.coordinatorProfile };
|
|
132
|
+
if (receipt.schemaVersion !== 1 || !isDeepStrictEqual(effective.result, expectedResult)
|
|
133
|
+
|| !effective.files || typeof effective.files !== 'object' || Array.isArray(effective.files)
|
|
134
|
+
|| Object.keys(effective.files).length > 512
|
|
135
|
+
|| effective.files[manifestPath] !== expectedResult.manifestDigest)
|
|
136
|
+
fail('existing owner receipt differs before stopping Hosts');
|
|
137
|
+
const roots = [resources.configRoot, resources.stateRoot, resources.registry.root];
|
|
138
|
+
for (const [path, digest] of Object.entries(effective.files)) {
|
|
139
|
+
input.signal.throwIfAborted();
|
|
140
|
+
if (!roots.some(root => within(path, root)) || !/^[a-f0-9]{64}$/u.test(digest)
|
|
141
|
+
|| hash(await privateFile(path)) !== digest)
|
|
142
|
+
fail('existing configuration changed before stopping Hosts');
|
|
143
|
+
}
|
|
144
|
+
const key = await privateFile(manifest.controlPlane.runtimeObserver.keyPath, 32);
|
|
145
|
+
if (key.length !== 32 || hash(key) !== receipt.observerKeyDigest)
|
|
146
|
+
fail('observer identity changed before stopping Hosts');
|
|
147
|
+
const ownerChange = overlay.records.findLast(record => record.kind === 'rsi-owner-repair-overlay'
|
|
148
|
+
|| record.kind === 'rsi-owner-program-update-overlay');
|
|
149
|
+
if (ownerChange?.kind === 'rsi-owner-repair-overlay' || ownerChange?.kind === 'rsi-owner-program-update-overlay')
|
|
150
|
+
await verifyOwnerChangeReceipts(ownerChange, home, manifest.targetProfile);
|
|
151
|
+
if (overlay.latest) {
|
|
152
|
+
const patchDigests = { [manifest.targetProfile]: hash(patches.targetPatch),
|
|
153
|
+
[manifest.coordinatorProfile]: hash(patches.coordinatorPatch) };
|
|
154
|
+
for (const [profile, digest] of Object.entries(overlay.latest.patches)) {
|
|
155
|
+
const path = join(home, 'profiles', profile, 'cordis.patch.yml');
|
|
156
|
+
if (!within(path, join(home, 'profiles')) || hash(await privateFile(path)) !== digest)
|
|
157
|
+
fail('signed owner profile changed before stopping Hosts');
|
|
158
|
+
}
|
|
159
|
+
if (Object.entries(patchDigests).some(([profile, digest]) => overlay.latest?.patches[profile] !== digest)
|
|
160
|
+
|| hash(json({ files: effective.files, patches: overlay.latest.patches })) !== overlay.latest.planDigest
|
|
161
|
+
|| overlay.latest.runtimeReceiptDigest !== hash(await privateFile(join(home, 'rsi-authority-runtimes', manifest.targetProfile, 'receipt.json'), RSI_AUTHORITY_RUNTIME_RECEIPT_MAX_BYTES)))
|
|
162
|
+
fail('signed owner profiles changed before stopping Hosts');
|
|
163
|
+
}
|
|
164
|
+
else if (hash(json({ files: effective.files, patches })) !== receipt.planDigest) {
|
|
165
|
+
fail('owner receipt digest changed before stopping Hosts');
|
|
166
|
+
}
|
|
167
|
+
input.signal.throwIfAborted();
|
|
168
|
+
}
|
|
169
|
+
/** Prepare runnable owner-bound configurations, without changing either Host.
|
|
170
|
+
* The installer must hold the DSH_HOME lifecycle lock and reread the current
|
|
171
|
+
* owner/profile sources before calling. Configurations and grants are immutable
|
|
172
|
+
* for this preparation; retry never renews a grant or resets a live ledger. */
|
|
173
|
+
export async function prepareRsiOwnerConfiguration(input, context) {
|
|
174
|
+
const signal = AbortSignal.any([context.signal ?? new AbortController().signal, AbortSignal.timeout(120_000)]);
|
|
175
|
+
signal.throwIfAborted();
|
|
176
|
+
const { manifest, resources } = input;
|
|
177
|
+
if (context.binding.status !== 'active' || context.binding.owner.status !== 'active'
|
|
178
|
+
|| context.binding.owner.role !== 'owner' || context.binding.conversation.kind !== 'dm'
|
|
179
|
+
|| !isDeepStrictEqual(context.binding.principal, context.binding.owner.principal))
|
|
180
|
+
fail('active owner DM binding is required');
|
|
181
|
+
const observer = manifest.controlPlane.runtimeObserver;
|
|
182
|
+
if (!observer)
|
|
183
|
+
fail('runtime observer is required');
|
|
184
|
+
const home = dirname(dirname(observer.profilePath));
|
|
185
|
+
if (observer.profilePath !== join(home, 'profiles', manifest.targetProfile)
|
|
186
|
+
|| resources.root !== join(home, 'rsi-authorities', manifest.targetProfile))
|
|
187
|
+
fail('installation paths differ');
|
|
188
|
+
// Revalidate persisted identities and program copies before writing grants.
|
|
189
|
+
// These calls preserve the installation IDs; they do not adopt foreign state.
|
|
190
|
+
const actualResources = await prepareRsiAuthorityResources({ dshHome: home, profile: manifest.targetProfile, signal });
|
|
191
|
+
if (!isDeepStrictEqual(actualResources, resources))
|
|
192
|
+
fail('signing resources differ from the installation');
|
|
193
|
+
const runtime = await prepareRsiAuthorityRuntime({ dshHome: home, profile: manifest.targetProfile, signal });
|
|
194
|
+
if (!isDeepStrictEqual(runtime, input.runtime))
|
|
195
|
+
fail('authority runtime differs from the installation');
|
|
196
|
+
const compiled = compileRsiAuthorityConfigs(input);
|
|
197
|
+
const manifestPath = join(resources.configRoot, 'manifest.json');
|
|
198
|
+
const receiptPath = join(resources.configRoot, 'bootstrap.json');
|
|
199
|
+
const overlayPath = join(resources.configRoot, 'host-update-overlays.json');
|
|
200
|
+
const files = { ...compiled.files };
|
|
201
|
+
if (Object.hasOwn(files, manifestPath) || Object.hasOwn(files, receiptPath) || Object.hasOwn(files, overlayPath))
|
|
202
|
+
fail('reserved configuration path');
|
|
203
|
+
files[manifestPath] = json(manifest);
|
|
204
|
+
if (Object.keys(files).length > 64 || Object.entries(files).some(([path, value]) => !within(path, resources.configRoot) || typeof value !== 'string' || Buffer.byteLength(value) > 2_097_152))
|
|
205
|
+
fail('configuration output exceeds its bounds');
|
|
206
|
+
if (!within(observer.keyPath, resources.configRoot) || Object.hasOwn(files, observer.keyPath)
|
|
207
|
+
|| [manifestPath, receiptPath, overlayPath].includes(observer.keyPath))
|
|
208
|
+
fail('observer key must have a separate private configuration path');
|
|
209
|
+
const ledgerPath = join(manifest.controlPlane.statePath, 'control.sqlite');
|
|
210
|
+
if (!within(ledgerPath, resources.stateRoot) || !within(observer.socketPath, resources.stateRoot))
|
|
211
|
+
fail('runtime state must stay in the installation state root');
|
|
212
|
+
const readSourceMaintenance = async () => {
|
|
213
|
+
const path = join(home, 'rsi-sources', manifest.targetProfile, 'maintenance.json');
|
|
214
|
+
if (!await exists(path))
|
|
215
|
+
return [];
|
|
216
|
+
const maintained = await readRsiSourceMaintenance({ logicalHome: home, physicalHome: home,
|
|
217
|
+
profile: manifest.targetProfile, signal });
|
|
218
|
+
if (maintained.workspace.repository !== manifest.controlPlane.sourceJobs?.repository
|
|
219
|
+
|| !isDeepStrictEqual(maintained.workspace.baseline, manifest.controlPlane.sourceJobs.baseline)) {
|
|
220
|
+
fail('source maintenance differs from owner configuration');
|
|
221
|
+
}
|
|
222
|
+
return maintained.records;
|
|
223
|
+
};
|
|
224
|
+
const sourceMaintenance = await readSourceMaintenance();
|
|
225
|
+
const directories = [...new Set([...compiled.directories, dirname(ledgerPath), dirname(observer.keyPath),
|
|
226
|
+
...Object.keys(files).map(dirname)])].sort((left, right) => left.length - right.length || left.localeCompare(right));
|
|
227
|
+
const roots = [resources.configRoot, resources.stateRoot, resources.registry.root];
|
|
228
|
+
if (directories.some(path => !roots.some(root => path === root || within(path, root))))
|
|
229
|
+
fail('generated directory is outside prepared resources');
|
|
230
|
+
const expectedFiles = Object.fromEntries(Object.entries(files).sort(([left], [right]) => left.localeCompare(right)).map(([path, value]) => [path, hash(value)]));
|
|
231
|
+
const result = { schemaVersion: 1, manifestPath, manifestDigest: hash(files[manifestPath]),
|
|
232
|
+
targetProfile: manifest.targetProfile, coordinatorProfile: manifest.coordinatorProfile };
|
|
233
|
+
const verify = async (rememberSqliteSidecars) => {
|
|
234
|
+
signal.throwIfAborted();
|
|
235
|
+
for (const directory of directories)
|
|
236
|
+
await io.directory(directory);
|
|
237
|
+
await privateFile(ledgerPath, 268_435_456);
|
|
238
|
+
const database = new DatabaseSync(ledgerPath, { readOnly: true });
|
|
239
|
+
try {
|
|
240
|
+
const row = database.prepare('PRAGMA user_version').get();
|
|
241
|
+
if (row.user_version !== controlPlaneSchemaVersion)
|
|
242
|
+
fail('control ledger schema differs from the installed runtime');
|
|
243
|
+
const stored = database.prepare('SELECT record_json FROM source_maintenance WHERE repository=? ORDER BY sequence')
|
|
244
|
+
.all(manifest.controlPlane.sourceJobs.repository).map(row => JSON.parse(String(row.record_json)));
|
|
245
|
+
if (!isDeepStrictEqual(stored, sourceMaintenance)
|
|
246
|
+
|| !isDeepStrictEqual(await readSourceMaintenance(), sourceMaintenance))
|
|
247
|
+
fail('source maintenance ledger differs from retained history');
|
|
248
|
+
}
|
|
249
|
+
finally {
|
|
250
|
+
database.close();
|
|
251
|
+
await rememberSqliteSidecars?.();
|
|
252
|
+
}
|
|
253
|
+
const patches = await compileRsiProfiles({ manifest, dshHome: home, ...context.profiles, owner: context.binding, upgradeExistingOwner: context.upgradeExistingOwner === true });
|
|
254
|
+
await validateRsiAuthorities(manifest, context.binding, manifest.serviceEnvironment?.target);
|
|
255
|
+
for (const phase of Object.keys(runtime.releaseAdapters)) {
|
|
256
|
+
signal.throwIfAborted();
|
|
257
|
+
const adapter = await import(__rewriteRelativeImportExtension(pathToFileURL(runtime.releaseAdapters[phase].path).href));
|
|
258
|
+
if (typeof adapter.inspectLocalReleaseAdapterConfiguration !== 'function')
|
|
259
|
+
fail('installed release adapter lacks configuration inspection');
|
|
260
|
+
const actual = adapter.inspectLocalReleaseAdapterConfiguration(manifest.serviceEnvironment.target, phase);
|
|
261
|
+
const expected = compiled.trust.releaseAdapters[phase];
|
|
262
|
+
if (!isDeepStrictEqual(actual, { id: expected.id, phase, executablePath: expected.path,
|
|
263
|
+
authority: expected.authority, keyId: expected.keyId }))
|
|
264
|
+
fail('release adapter configuration differs from trust');
|
|
265
|
+
}
|
|
266
|
+
signal.throwIfAborted();
|
|
267
|
+
return patches;
|
|
268
|
+
};
|
|
269
|
+
if (await exists(receiptPath)) {
|
|
270
|
+
if (context.upgradeExistingOwner === true) {
|
|
271
|
+
return reconfigureRsiOwnerConfiguration(input, context);
|
|
272
|
+
}
|
|
273
|
+
const bootstrapSource = (await privateFile(receiptPath)).toString('utf8');
|
|
274
|
+
const receipt = JSON.parse(bootstrapSource);
|
|
275
|
+
const overlay = readRsiHostUpdateOverlayChain({ source: await exists(overlayPath)
|
|
276
|
+
? (await privateFile(overlayPath)).toString('utf8') : undefined,
|
|
277
|
+
resources, dshHome: home, profile: manifest.targetProfile, bootstrapSource });
|
|
278
|
+
const effective = overlay.latest ?? receipt;
|
|
279
|
+
if (receipt.schemaVersion !== 1 || !isDeepStrictEqual(effective.files, expectedFiles)
|
|
280
|
+
|| !isDeepStrictEqual(effective.result, result))
|
|
281
|
+
fail('existing owner configuration differs; retain it for reconciliation');
|
|
282
|
+
for (const [path, digest] of Object.entries(expectedFiles))
|
|
283
|
+
if (hash(await privateFile(path)) !== digest)
|
|
284
|
+
fail('existing configuration changed');
|
|
285
|
+
const key = await privateFile(observer.keyPath, 32);
|
|
286
|
+
if (key.length !== 32 || hash(key) !== receipt.observerKeyDigest)
|
|
287
|
+
fail('observer identity changed');
|
|
288
|
+
const patches = await verify();
|
|
289
|
+
const ownerChange = overlay.records.findLast(record => record.kind === 'rsi-owner-repair-overlay'
|
|
290
|
+
|| record.kind === 'rsi-owner-program-update-overlay');
|
|
291
|
+
if (ownerChange?.kind === 'rsi-owner-repair-overlay' || ownerChange?.kind === 'rsi-owner-program-update-overlay')
|
|
292
|
+
await verifyOwnerChangeReceipts(ownerChange, home, manifest.targetProfile);
|
|
293
|
+
if (overlay.latest) {
|
|
294
|
+
const patchDigests = { [manifest.targetProfile]: hash(patches.targetPatch),
|
|
295
|
+
[manifest.coordinatorProfile]: hash(patches.coordinatorPatch) };
|
|
296
|
+
for (const [profile, digest] of Object.entries(overlay.latest.patches)) {
|
|
297
|
+
const path = join(home, 'profiles', profile, 'cordis.patch.yml');
|
|
298
|
+
if (!within(path, join(home, 'profiles')) || hash(await privateFile(path)) !== digest)
|
|
299
|
+
fail('signed owner profile changed');
|
|
300
|
+
}
|
|
301
|
+
if (Object.entries(patchDigests).some(([profile, digest]) => overlay.latest?.patches[profile] !== digest)
|
|
302
|
+
|| hash(json({ files: expectedFiles, patches: overlay.latest.patches })) !== overlay.latest.planDigest
|
|
303
|
+
|| overlay.latest.runtimeReceiptDigest !== hash(await privateFile(join(home, 'rsi-authority-runtimes', manifest.targetProfile, 'receipt.json'), RSI_AUTHORITY_RUNTIME_RECEIPT_MAX_BYTES)))
|
|
304
|
+
fail('signed Host update differs from compiled configuration');
|
|
305
|
+
}
|
|
306
|
+
else if (hash(json({ files: expectedFiles, patches })) !== receipt.planDigest)
|
|
307
|
+
fail('owner or compiled profiles changed');
|
|
308
|
+
return result;
|
|
309
|
+
}
|
|
310
|
+
// First preparation must not overwrite an operator's configuration or attach
|
|
311
|
+
// new installation IDs to an existing ledger. A crash leaves inspectable
|
|
312
|
+
// partial resources; it is never interpreted as a fresh installation.
|
|
313
|
+
const sqliteSidecars = [`${ledgerPath}-wal`, `${ledgerPath}-shm`];
|
|
314
|
+
if ((await readdir(resources.configRoot)).length || await exists(ledgerPath)
|
|
315
|
+
|| (await Promise.all(sqliteSidecars.map(exists))).some(Boolean))
|
|
316
|
+
fail('unregistered configuration or ledger already exists');
|
|
317
|
+
const ownedFiles = [];
|
|
318
|
+
const ownedDirectories = [];
|
|
319
|
+
const remember = async (path) => {
|
|
320
|
+
const stat = await lstat(path, { bigint: true });
|
|
321
|
+
const digest = hash(await privateFile(path, 268_435_456));
|
|
322
|
+
const after = await lstat(path, { bigint: true });
|
|
323
|
+
if (stat.dev !== after.dev || stat.ino !== after.ino || stat.size !== after.size
|
|
324
|
+
|| stat.mtimeNs !== after.mtimeNs || stat.ctimeNs !== after.ctimeNs)
|
|
325
|
+
fail('created file changed while recording cleanup ownership');
|
|
326
|
+
const previous = ownedFiles.find(file => file.path === path);
|
|
327
|
+
if (previous) {
|
|
328
|
+
if (!sameOwnedFile(stat, previous) || digest !== previous.digest)
|
|
329
|
+
fail('created file changed after cleanup ownership was recorded');
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
ownedFiles.push({ path, dev: stat.dev, ino: stat.ino, size: stat.size,
|
|
333
|
+
mtimeNs: stat.mtimeNs, ctimeNs: stat.ctimeNs, digest });
|
|
334
|
+
};
|
|
335
|
+
const rememberSqliteSidecars = async () => {
|
|
336
|
+
for (const path of sqliteSidecars)
|
|
337
|
+
if (await exists(path))
|
|
338
|
+
await remember(path);
|
|
339
|
+
};
|
|
340
|
+
const directory = async (path) => {
|
|
341
|
+
if (roots.includes(path)) {
|
|
342
|
+
await io.directory(path);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
await directory(dirname(path));
|
|
346
|
+
try {
|
|
347
|
+
await mkdir(path, { mode: 0o700 });
|
|
348
|
+
const stat = await lstat(path);
|
|
349
|
+
ownedDirectories.push({ path, dev: stat.dev, ino: stat.ino });
|
|
350
|
+
}
|
|
351
|
+
catch (error) {
|
|
352
|
+
if (error.code !== 'EEXIST')
|
|
353
|
+
throw error;
|
|
354
|
+
}
|
|
355
|
+
await io.directory(path);
|
|
356
|
+
};
|
|
357
|
+
const write = async (path, bytes) => {
|
|
358
|
+
signal.throwIfAborted();
|
|
359
|
+
const descriptor = await open(path, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
|
|
360
|
+
try {
|
|
361
|
+
await descriptor.writeFile(bytes);
|
|
362
|
+
await descriptor.sync();
|
|
363
|
+
}
|
|
364
|
+
finally {
|
|
365
|
+
await descriptor.close();
|
|
366
|
+
await remember(path);
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
try {
|
|
370
|
+
for (const path of directories) {
|
|
371
|
+
signal.throwIfAborted();
|
|
372
|
+
await directory(path);
|
|
373
|
+
}
|
|
374
|
+
await write(observer.keyPath, randomBytes(32));
|
|
375
|
+
// Create the real schema. No empty-file stand-in is accepted as a ledger.
|
|
376
|
+
const store = new ControlPlaneStore({ path: ledgerPath });
|
|
377
|
+
try {
|
|
378
|
+
if (sourceMaintenance.length) {
|
|
379
|
+
const baseline = manifest.controlPlane.sourceJobs?.baseline;
|
|
380
|
+
if (!baseline)
|
|
381
|
+
fail('retained source maintenance requires the original baseline');
|
|
382
|
+
await store.importSourceMaintenanceRecords(sourceMaintenance, { trust: compiled.trust, baseline });
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
finally {
|
|
386
|
+
store.close();
|
|
387
|
+
await remember(ledgerPath);
|
|
388
|
+
await rememberSqliteSidecars();
|
|
389
|
+
}
|
|
390
|
+
for (const [path, bytes] of Object.entries(files))
|
|
391
|
+
await write(path, bytes);
|
|
392
|
+
const planDigest = hash(json({ files: expectedFiles, patches: await verify(rememberSqliteSidecars) }));
|
|
393
|
+
const receipt = { schemaVersion: 1, planDigest, files: expectedFiles,
|
|
394
|
+
observerKeyDigest: hash(await privateFile(observer.keyPath, 32)), result };
|
|
395
|
+
await write(receiptPath, json(receipt));
|
|
396
|
+
for (const path of [...directories].reverse())
|
|
397
|
+
await io.syncDirectory(path);
|
|
398
|
+
return result;
|
|
399
|
+
}
|
|
400
|
+
catch (error) {
|
|
401
|
+
// Only remove exact resources created by this invocation. A changed file or
|
|
402
|
+
// nonempty directory survives for reconciliation instead of being erased.
|
|
403
|
+
for (const file of ownedFiles.reverse()) {
|
|
404
|
+
try {
|
|
405
|
+
const stat = await lstat(file.path, { bigint: true });
|
|
406
|
+
if (sameOwnedFile(stat, file) && hash(await privateFile(file.path, 268_435_456)) === file.digest
|
|
407
|
+
&& sameOwnedFile(await lstat(file.path, { bigint: true }), file))
|
|
408
|
+
await unlink(file.path);
|
|
409
|
+
}
|
|
410
|
+
catch { }
|
|
411
|
+
}
|
|
412
|
+
for (const entry of ownedDirectories.reverse()) {
|
|
413
|
+
try {
|
|
414
|
+
const stat = await lstat(entry.path);
|
|
415
|
+
if (stat.dev === entry.dev && stat.ino === entry.ino)
|
|
416
|
+
await rmdir(entry.path);
|
|
417
|
+
}
|
|
418
|
+
catch { }
|
|
419
|
+
}
|
|
420
|
+
throw error;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Owner-authorized in-place upgrade/reconfiguration transition.
|
|
425
|
+
* Verifies existing bootstrap receipt, overlay chain, and SQLite control ledger
|
|
426
|
+
* integrity before mutating, preserves `control.sqlite` and observer identity
|
|
427
|
+
* intact, and atomically updates `manifest.json`, authority configs, and receipt/overlay
|
|
428
|
+
* with full backup/rollback on error.
|
|
429
|
+
*/
|
|
430
|
+
export async function reconfigureRsiOwnerConfiguration(input, context) {
|
|
431
|
+
const signal = AbortSignal.any([context.signal ?? new AbortController().signal, AbortSignal.timeout(120_000)]);
|
|
432
|
+
signal.throwIfAborted();
|
|
433
|
+
const { manifest, resources } = input;
|
|
434
|
+
if (context.binding.status !== 'active' || context.binding.owner.status !== 'active'
|
|
435
|
+
|| context.binding.owner.role !== 'owner' || context.binding.conversation.kind !== 'dm'
|
|
436
|
+
|| !isDeepStrictEqual(context.binding.principal, context.binding.owner.principal))
|
|
437
|
+
fail('active owner DM binding is required');
|
|
438
|
+
const observer = manifest.controlPlane.runtimeObserver;
|
|
439
|
+
if (!observer)
|
|
440
|
+
fail('runtime observer is required');
|
|
441
|
+
const home = dirname(dirname(observer.profilePath));
|
|
442
|
+
if (observer.profilePath !== join(home, 'profiles', manifest.targetProfile)
|
|
443
|
+
|| resources.root !== join(home, 'rsi-authorities', manifest.targetProfile))
|
|
444
|
+
fail('installation paths differ');
|
|
445
|
+
const actualResources = await prepareRsiAuthorityResources({ dshHome: home, profile: manifest.targetProfile, signal });
|
|
446
|
+
if (!isDeepStrictEqual(actualResources, resources))
|
|
447
|
+
fail('signing resources differ from the installation');
|
|
448
|
+
const runtime = await prepareRsiAuthorityRuntime({ dshHome: home, profile: manifest.targetProfile, signal });
|
|
449
|
+
if (!isDeepStrictEqual(runtime, input.runtime))
|
|
450
|
+
fail('authority runtime differs from the installation');
|
|
451
|
+
const compiled = compileRsiAuthorityConfigs(input);
|
|
452
|
+
const manifestPath = join(resources.configRoot, 'manifest.json');
|
|
453
|
+
const receiptPath = join(resources.configRoot, 'bootstrap.json');
|
|
454
|
+
const overlayPath = join(resources.configRoot, 'host-update-overlays.json');
|
|
455
|
+
const files = { ...compiled.files };
|
|
456
|
+
if (Object.hasOwn(files, manifestPath) || Object.hasOwn(files, receiptPath) || Object.hasOwn(files, overlayPath))
|
|
457
|
+
fail('reserved configuration path');
|
|
458
|
+
files[manifestPath] = json(manifest);
|
|
459
|
+
if (Object.keys(files).length > 64 || Object.entries(files).some(([path, value]) => !within(path, resources.configRoot) || typeof value !== 'string' || Buffer.byteLength(value) > 2_097_152))
|
|
460
|
+
fail('configuration output exceeds its bounds');
|
|
461
|
+
if (!within(observer.keyPath, resources.configRoot) || Object.hasOwn(files, observer.keyPath)
|
|
462
|
+
|| [manifestPath, receiptPath, overlayPath].includes(observer.keyPath))
|
|
463
|
+
fail('observer key must have a separate private configuration path');
|
|
464
|
+
const ledgerPath = join(manifest.controlPlane.statePath, 'control.sqlite');
|
|
465
|
+
if (!within(ledgerPath, resources.stateRoot) || !within(observer.socketPath, resources.stateRoot))
|
|
466
|
+
fail('runtime state must stay in the installation state root');
|
|
467
|
+
const readSourceMaintenance = async () => {
|
|
468
|
+
const path = join(home, 'rsi-sources', manifest.targetProfile, 'maintenance.json');
|
|
469
|
+
if (!await exists(path))
|
|
470
|
+
return [];
|
|
471
|
+
const maintained = await readRsiSourceMaintenance({ logicalHome: home, physicalHome: home,
|
|
472
|
+
profile: manifest.targetProfile, signal });
|
|
473
|
+
if (maintained.workspace.repository !== manifest.controlPlane.sourceJobs?.repository
|
|
474
|
+
|| !isDeepStrictEqual(maintained.workspace.baseline, manifest.controlPlane.sourceJobs.baseline)) {
|
|
475
|
+
fail('source maintenance differs from owner configuration');
|
|
476
|
+
}
|
|
477
|
+
return maintained.records;
|
|
478
|
+
};
|
|
479
|
+
const sourceMaintenance = await readSourceMaintenance();
|
|
480
|
+
const directories = [...new Set([...compiled.directories, dirname(ledgerPath), dirname(observer.keyPath),
|
|
481
|
+
...Object.keys(files).map(dirname)])].sort((left, right) => left.length - right.length || left.localeCompare(right));
|
|
482
|
+
const roots = [resources.configRoot, resources.stateRoot, resources.registry.root];
|
|
483
|
+
if (directories.some(path => !roots.some(root => path === root || within(path, root))))
|
|
484
|
+
fail('generated directory is outside prepared resources');
|
|
485
|
+
const expectedFiles = Object.fromEntries(Object.entries(files).sort(([left], [right]) => left.localeCompare(right)).map(([path, value]) => [path, hash(value)]));
|
|
486
|
+
const result = { schemaVersion: 1, manifestPath, manifestDigest: hash(files[manifestPath]),
|
|
487
|
+
targetProfile: manifest.targetProfile, coordinatorProfile: manifest.coordinatorProfile };
|
|
488
|
+
const existing = await verifyExistingRsiOwnerConfiguration({
|
|
489
|
+
resources, dshHome: home, targetProfile: manifest.targetProfile, observerKeyPath: observer.keyPath, signal,
|
|
490
|
+
});
|
|
491
|
+
for (const directory of directories) {
|
|
492
|
+
signal.throwIfAborted();
|
|
493
|
+
await mkdir(directory, { mode: 0o700 }).catch(error => { if (error.code !== 'EEXIST')
|
|
494
|
+
throw error; });
|
|
495
|
+
await io.directory(directory);
|
|
496
|
+
}
|
|
497
|
+
await privateFile(ledgerPath, 268_435_456);
|
|
498
|
+
const database = new DatabaseSync(ledgerPath, { readOnly: true });
|
|
499
|
+
try {
|
|
500
|
+
const row = database.prepare('PRAGMA user_version').get();
|
|
501
|
+
if (row.user_version !== controlPlaneSchemaVersion)
|
|
502
|
+
fail('control ledger schema differs from the installed runtime');
|
|
503
|
+
const stored = database.prepare('SELECT record_json FROM source_maintenance WHERE repository=? ORDER BY sequence')
|
|
504
|
+
.all(manifest.controlPlane.sourceJobs.repository).map(row => JSON.parse(String(row.record_json)));
|
|
505
|
+
if (!isDeepStrictEqual(stored, sourceMaintenance)
|
|
506
|
+
|| !isDeepStrictEqual(await readSourceMaintenance(), sourceMaintenance))
|
|
507
|
+
fail('source maintenance ledger differs from retained history');
|
|
508
|
+
}
|
|
509
|
+
finally {
|
|
510
|
+
database.close();
|
|
511
|
+
}
|
|
512
|
+
const managedPaths = new Set([...Object.keys(existing.effective.files), ...Object.keys(files), receiptPath, overlayPath]);
|
|
513
|
+
const backups = new Map();
|
|
514
|
+
for (const path of managedPaths) {
|
|
515
|
+
if (!within(path, resources.configRoot))
|
|
516
|
+
fail(`managed path outside config root: ${path}`);
|
|
517
|
+
backups.set(path, await exists(path) ? await privateFile(path) : null);
|
|
518
|
+
}
|
|
519
|
+
try {
|
|
520
|
+
for (const [path, bytes] of Object.entries(files)) {
|
|
521
|
+
signal.throwIfAborted();
|
|
522
|
+
await atomicWritePrivate(path, bytes);
|
|
523
|
+
}
|
|
524
|
+
for (const oldPath of Object.keys(existing.effective.files)) {
|
|
525
|
+
if (!Object.hasOwn(files, oldPath)) {
|
|
526
|
+
await unlink(oldPath).catch(error => { if (error.code !== 'ENOENT')
|
|
527
|
+
throw error; });
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
const patches = await compileRsiProfiles({ manifest, dshHome: home, ...context.profiles, owner: context.binding, upgradeExistingOwner: true });
|
|
531
|
+
await validateRsiAuthorities(manifest, context.binding, manifest.serviceEnvironment?.target);
|
|
532
|
+
for (const phase of Object.keys(runtime.releaseAdapters)) {
|
|
533
|
+
signal.throwIfAborted();
|
|
534
|
+
const adapter = await import(__rewriteRelativeImportExtension(pathToFileURL(runtime.releaseAdapters[phase].path).href));
|
|
535
|
+
if (typeof adapter.inspectLocalReleaseAdapterConfiguration !== 'function')
|
|
536
|
+
fail('installed release adapter lacks configuration inspection');
|
|
537
|
+
const actual = adapter.inspectLocalReleaseAdapterConfiguration(manifest.serviceEnvironment.target, phase);
|
|
538
|
+
const expected = compiled.trust.releaseAdapters[phase];
|
|
539
|
+
if (!isDeepStrictEqual(actual, { id: expected.id, phase, executablePath: expected.path,
|
|
540
|
+
authority: expected.authority, keyId: expected.keyId }))
|
|
541
|
+
fail('release adapter configuration differs from trust');
|
|
542
|
+
}
|
|
543
|
+
signal.throwIfAborted();
|
|
544
|
+
if (existing.overlay.records.length > 0) {
|
|
545
|
+
const runtimeReceiptDigest = hash(await privateFile(join(home, 'rsi-authority-runtimes', manifest.targetProfile, 'receipt.json'), RSI_AUTHORITY_RUNTIME_RECEIPT_MAX_BYTES));
|
|
546
|
+
const hostPrivateKey = (await privateFile(resources.identities.host.keyPath)).toString('utf8');
|
|
547
|
+
const patchDigests = { [manifest.targetProfile]: hash(patches.targetPatch),
|
|
548
|
+
[manifest.coordinatorProfile]: hash(patches.coordinatorPatch) };
|
|
549
|
+
const nextOverlay = signRsiHostUpdateOverlay({
|
|
550
|
+
schemaVersion: 1, kind: 'rsi-host-update-overlay',
|
|
551
|
+
transactionId: `owner-upgrade-${randomUUID()}`, dshHome: home,
|
|
552
|
+
targetProfile: manifest.targetProfile, installationId: resources.installationId,
|
|
553
|
+
currentPlanId: 'owner-upgrade', activationId: `owner-upgrade-${randomUUID()}`,
|
|
554
|
+
sequence: existing.overlay.records.length + 1,
|
|
555
|
+
previousDigest: rsiHostUpdateOverlayDigest(existing.overlay.latest),
|
|
556
|
+
bootstrapDigest: hash(existing.bootstrapSource),
|
|
557
|
+
files: expectedFiles, patches: patchDigests, runtimeReceiptDigest,
|
|
558
|
+
planDigest: hash(json({ files: expectedFiles, patches: patchDigests })), result,
|
|
559
|
+
issuedAt: Math.max(Date.now(), existing.overlay.latest.issuedAt),
|
|
560
|
+
authority: resources.identities.host.authority, keyId: resources.identities.host.keyId,
|
|
561
|
+
}, hostPrivateKey, resources, existing.bootstrapSource, existing.overlay.records);
|
|
562
|
+
await atomicWritePrivate(overlayPath, json({
|
|
563
|
+
schemaVersion: 1, kind: 'rsi-host-update-overlays',
|
|
564
|
+
records: [...existing.overlay.records, nextOverlay],
|
|
565
|
+
}));
|
|
566
|
+
}
|
|
567
|
+
else {
|
|
568
|
+
const nextReceipt = {
|
|
569
|
+
schemaVersion: 1,
|
|
570
|
+
planDigest: hash(json({ files: expectedFiles, patches })),
|
|
571
|
+
files: expectedFiles,
|
|
572
|
+
observerKeyDigest: existing.receipt.observerKeyDigest,
|
|
573
|
+
result,
|
|
574
|
+
};
|
|
575
|
+
await atomicWritePrivate(receiptPath, json(nextReceipt));
|
|
576
|
+
}
|
|
577
|
+
for (const path of [...directories].reverse())
|
|
578
|
+
await io.syncDirectory(path);
|
|
579
|
+
return result;
|
|
580
|
+
}
|
|
581
|
+
catch (error) {
|
|
582
|
+
for (const [path, original] of backups) {
|
|
583
|
+
try {
|
|
584
|
+
if (original === null)
|
|
585
|
+
await unlink(path).catch(err => { if (err.code !== 'ENOENT')
|
|
586
|
+
throw err; });
|
|
587
|
+
else
|
|
588
|
+
await atomicWritePrivate(path, original);
|
|
589
|
+
}
|
|
590
|
+
catch { }
|
|
591
|
+
}
|
|
592
|
+
for (const path of [...directories].reverse())
|
|
593
|
+
await io.syncDirectory(path).catch(() => { });
|
|
594
|
+
throw error;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
//# sourceMappingURL=rsi-bootstrap.js.map
|