@jini-ai/devops 0.7.3-next.2 → 0.7.3-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/dist/backup/site/archive-extensions.d.ts +73 -0
- package/dist/backup/site/archive-extensions.js +129 -0
- package/dist/backup/site/archive-manifest.d.ts +85 -0
- package/dist/backup/site/archive-manifest.js +176 -0
- package/dist/backup/site/archive-media.d.ts +121 -0
- package/dist/backup/site/archive-media.js +93 -0
- package/dist/backup/site/backup-service.credentials.d.ts +31 -0
- package/dist/backup/site/backup-service.credentials.js +161 -0
- package/dist/backup/site/backup-service.d.ts +331 -0
- package/dist/backup/site/backup-service.js +125 -0
- package/dist/backup/site/backup-service.plan.d.ts +64 -0
- package/dist/backup/site/backup-service.plan.js +207 -0
- package/dist/backup/site/backup-service.push.d.ts +29 -0
- package/dist/backup/site/backup-service.push.js +82 -0
- package/dist/backup/site/backup-service.shared.d.ts +40 -0
- package/dist/backup/site/backup-service.shared.js +37 -0
- package/dist/backup/site/bundled-export-file-policy.d.ts +38 -0
- package/dist/backup/site/bundled-export-file-policy.js +40 -0
- package/dist/backup/site/credential-warnings.d.ts +41 -0
- package/dist/backup/site/credential-warnings.js +50 -0
- package/dist/backup/site/import-backend-steps.d.ts +167 -0
- package/dist/backup/site/import-backend-steps.js +170 -0
- package/dist/backup/site/import-backend.d.ts +167 -0
- package/dist/backup/site/import-backend.js +298 -0
- package/dist/backup/site/import-database.d.ts +118 -0
- package/dist/backup/site/import-database.js +167 -0
- package/dist/backup/site/import-index/admission.d.ts +54 -0
- package/dist/backup/site/import-index/admission.js +46 -0
- package/dist/backup/site/import-index/backfill.d.ts +106 -0
- package/dist/backup/site/import-index/backfill.js +137 -0
- package/dist/backup/site/import-index/errors.d.ts +28 -0
- package/dist/backup/site/import-index/errors.js +38 -0
- package/dist/backup/site/import-index/migrations/checksums.d.ts +4 -0
- package/dist/backup/site/import-index/migrations/checksums.js +4 -0
- package/dist/backup/site/import-index/migrations/site-imports-v1.d.ts +2 -0
- package/dist/backup/site/import-index/migrations/site-imports-v1.js +10 -0
- package/dist/backup/site/import-index/mode.d.ts +191 -0
- package/dist/backup/site/import-index/mode.js +272 -0
- package/dist/backup/site/import-index/open.d.ts +40 -0
- package/dist/backup/site/import-index/open.js +87 -0
- package/dist/backup/site/import-index/paging.d.ts +28 -0
- package/dist/backup/site/import-index/paging.js +66 -0
- package/dist/backup/site/import-index/payload-namespace.d.ts +80 -0
- package/dist/backup/site/import-index/payload-namespace.js +156 -0
- package/dist/backup/site/import-index/rows.d.ts +32 -0
- package/dist/backup/site/import-index/rows.js +61 -0
- package/dist/backup/site/import-index/schema.d.ts +8 -0
- package/dist/backup/site/import-index/schema.js +31 -0
- package/dist/backup/site/import-index/store.d.ts +27 -0
- package/dist/backup/site/import-index/store.js +33 -0
- package/dist/backup/site/import-index/sweep.d.ts +10 -0
- package/dist/backup/site/import-index/sweep.js +26 -0
- package/dist/backup/site/import-keep-off.d.ts +128 -0
- package/dist/backup/site/import-keep-off.js +204 -0
- package/dist/backup/site/import-plugin-state.d.ts +74 -0
- package/dist/backup/site/import-plugin-state.js +67 -0
- package/dist/backup/site/import-registry.d.ts +110 -0
- package/dist/backup/site/import-registry.js +205 -0
- package/dist/backup/site/import-restore-placement.d.ts +94 -0
- package/dist/backup/site/import-restore-placement.js +158 -0
- package/dist/backup/site/import-restore.d.ts +111 -0
- package/dist/backup/site/import-restore.js +120 -0
- package/dist/backup/site/import-verifier-inventory.d.ts +137 -0
- package/dist/backup/site/import-verifier-inventory.js +236 -0
- package/dist/backup/site/import-verifier-projection.d.ts +78 -0
- package/dist/backup/site/import-verifier-projection.js +100 -0
- package/dist/backup/site/import-verifier.d.ts +126 -0
- package/dist/backup/site/import-verifier.js +53 -0
- package/dist/backup/site/owned-temp-root.d.ts +12 -0
- package/dist/backup/site/owned-temp-root.js +2 -0
- package/dist/backup/site/package-file-inventory.d.ts +63 -0
- package/dist/backup/site/package-file-inventory.js +56 -0
- package/dist/backup/site/push-content.d.ts +70 -0
- package/dist/backup/site/push-content.js +56 -0
- package/dist/backup/site/react/ShowMoreImports.d.ts +21 -0
- package/dist/backup/site/react/ShowMoreImports.js +8 -0
- package/dist/backup/site/saved-keys-port.d.ts +47 -0
- package/dist/backup/site/saved-keys-port.js +3 -0
- package/dist/backup/site/saved-keys.d.ts +25 -0
- package/dist/backup/site/saved-keys.js +38 -0
- package/dist/backup/site/share-backend.d.ts +243 -0
- package/dist/backup/site/share-backend.js +284 -0
- package/dist/backup/site/share-database/projection.d.ts +195 -0
- package/dist/backup/site/share-database/projection.js +90 -0
- package/dist/backup/site/share-database/projection.media.d.ts +38 -0
- package/dist/backup/site/share-database/projection.media.js +179 -0
- package/dist/backup/site/share-database/projection.tables.d.ts +46 -0
- package/dist/backup/site/share-database/projection.tables.js +193 -0
- package/dist/backup/site/share-expiry.d.ts +75 -0
- package/dist/backup/site/share-expiry.js +49 -0
- package/dist/backup/site/share-export-failure.d.ts +17 -0
- package/dist/backup/site/share-export-failure.js +16 -0
- package/dist/backup/site/share-file-policy.d.ts +60 -0
- package/dist/backup/site/share-file-policy.js +146 -0
- package/dist/backup/site/share-hosting.d.ts +107 -0
- package/dist/backup/site/share-hosting.js +148 -0
- package/dist/backup/site/share-preparation-steps.d.ts +180 -0
- package/dist/backup/site/share-preparation-steps.js +109 -0
- package/dist/backup/site/share-preparation.d.ts +122 -0
- package/dist/backup/site/share-preparation.js +43 -0
- package/dist/backup/site/share-refusal.d.ts +21 -0
- package/dist/backup/site/share-refusal.js +20 -0
- package/dist/backup/site/share-registry.d.ts +124 -0
- package/dist/backup/site/share-registry.js +219 -0
- package/dist/backup/site/share-retention.d.ts +62 -0
- package/dist/backup/site/share-retention.js +126 -0
- package/dist/backup/site/share-service.d.ts +128 -0
- package/dist/backup/site/share-service.js +194 -0
- package/dist/backup/site/share-zip.d.ts +115 -0
- package/dist/backup/site/share-zip.js +144 -0
- package/dist/backup/site/sources.d.ts +344 -0
- package/dist/backup/site/sources.js +595 -0
- package/dist/backup/site/static-copy.d.ts +122 -0
- package/dist/backup/site/static-copy.js +165 -0
- package/dist/backup/site/static-download-html.d.ts +76 -0
- package/dist/backup/site/static-download-html.js +149 -0
- package/dist/backup/site/static-download-landing.d.ts +52 -0
- package/dist/backup/site/static-download-landing.js +95 -0
- package/dist/backup/site/static-download-layout.d.ts +96 -0
- package/dist/backup/site/static-download-layout.js +325 -0
- package/dist/backup/site/static-export-selection.d.ts +50 -0
- package/dist/backup/site/static-export-selection.js +76 -0
- package/dist/backup/site/static-site-packager.d.ts +42 -0
- package/dist/backup/site/static-site-packager.js +32 -0
- package/dist/backup/site/tool-registrations.d.ts +74 -0
- package/dist/backup/site/tool-registrations.js +201 -0
- package/dist/checks/complexity-debt.d.ts +100 -0
- package/dist/checks/complexity-debt.js +131 -0
- package/dist/checks/coverage/diff.js +5 -1
- package/dist/checks/env-access.d.ts +14 -1
- package/dist/checks/env-access.js +92 -6
- package/dist/checks/live-verify-checks.d.ts +29 -0
- package/dist/checks/live-verify-checks.js +30 -0
- package/dist/checks/quality-gates.d.ts +137 -0
- package/dist/checks/quality-gates.js +209 -0
- package/dist/core/deploy-types.d.ts +2 -0
- package/dist/deploy/admin-http/site-update-status.d.ts +8 -0
- package/dist/deploy/admin-http/site-update-status.js +15 -0
- package/dist/deploy/host-kit.d.ts +3 -0
- package/dist/deploy/index.d.ts +6 -0
- package/dist/deploy/index.js +6 -0
- package/dist/deploy/ops-runner.js +7 -0
- package/dist/deploy/ops-tool-contracts.d.ts +10 -1
- package/dist/deploy/react/Deployment.d.ts +37 -0
- package/dist/deploy/react/Deployment.js +94 -0
- package/dist/deploy/react/DockerfileTab.d.ts +72 -0
- package/dist/deploy/react/DockerfileTab.js +131 -0
- package/dist/deploy/react/HistoryTab.d.ts +43 -0
- package/dist/deploy/react/HistoryTab.js +12 -0
- package/dist/deploy/react/OverviewTab.d.ts +60 -0
- package/dist/deploy/react/OverviewTab.js +75 -0
- package/dist/deploy/react/PublishRunResult.d.ts +5 -1
- package/dist/deploy/react/PublishRunResult.js +4 -4
- package/dist/deploy/react/SiteUpdateNotice.d.ts +22 -0
- package/dist/deploy/react/SiteUpdateNotice.js +25 -0
- package/dist/deploy/react/StaticCredentialFields.d.ts +36 -0
- package/dist/deploy/react/StaticCredentialFields.js +63 -0
- package/dist/deploy/react/StaticCredentialSteps.d.ts +23 -0
- package/dist/deploy/react/StaticCredentialSteps.js +155 -0
- package/dist/deploy/react/StaticExportCard.d.ts +11 -0
- package/dist/deploy/react/StaticExportCard.js +97 -0
- package/dist/deploy/react/StaticPublishCredentials.d.ts +50 -0
- package/dist/deploy/react/StaticPublishCredentials.js +77 -0
- package/dist/deploy/react/StaticPublishForm.d.ts +12 -0
- package/dist/deploy/react/StaticPublishForm.js +91 -0
- package/dist/deploy/react/StaticSiteTab.d.ts +207 -0
- package/dist/deploy/react/StaticSiteTab.js +117 -0
- package/dist/deploy/react/deployment-visuals.d.ts +207 -0
- package/dist/deploy/react/deployment-visuals.js +101 -0
- package/dist/deploy/react/download-dockerfile.d.ts +14 -0
- package/dist/deploy/react/download-dockerfile.js +15 -0
- package/dist/deploy/react/hooks/publish-credential-draft.d.ts +33 -0
- package/dist/deploy/react/hooks/publish-credential-draft.js +54 -0
- package/dist/deploy/react/hooks/publish-credential-selection.d.ts +13 -0
- package/dist/deploy/react/hooks/publish-credential-selection.js +34 -0
- package/dist/deploy/react/hooks/publish-credential-writes.d.ts +20 -0
- package/dist/deploy/react/hooks/publish-credential-writes.js +99 -0
- package/dist/deploy/react/hooks/static-publish-actions.d.ts +10 -0
- package/dist/deploy/react/hooks/static-publish-actions.js +62 -0
- package/dist/deploy/react/hooks/static-publish-form.hooks.d.ts +38 -0
- package/dist/deploy/react/hooks/static-publish-form.hooks.js +103 -0
- package/dist/deploy/react/hooks/static-publish-run.hooks.d.ts +28 -0
- package/dist/deploy/react/hooks/static-publish-run.hooks.js +92 -0
- package/dist/deploy/react/hooks/use-dockerfile-source.hooks.d.ts +148 -0
- package/dist/deploy/react/hooks/use-dockerfile-source.hooks.js +155 -0
- package/dist/deploy/react/hooks/use-publish-credentials.hooks.d.ts +268 -0
- package/dist/deploy/react/hooks/use-publish-credentials.hooks.js +52 -0
- package/dist/deploy/react/hooks/use-static-export.hooks.d.ts +128 -0
- package/dist/deploy/react/hooks/use-static-export.hooks.js +159 -0
- package/dist/deploy/react/hooks/use-static-publish.hooks.d.ts +208 -0
- package/dist/deploy/react/hooks/use-static-publish.hooks.js +48 -0
- package/dist/deploy/react/index.d.ts +4 -0
- package/dist/deploy/react/index.js +2 -0
- package/dist/deploy/react/rules.d.ts +363 -0
- package/dist/deploy/react/rules.js +314 -0
- package/dist/deploy/react/use-deployment-overview.hooks.d.ts +41 -0
- package/dist/deploy/react/use-deployment-overview.hooks.js +11 -0
- package/dist/deploy/site/agent-tools.d.ts +42 -0
- package/dist/deploy/site/agent-tools.js +119 -0
- package/dist/deploy/site/deploy-config-registry.d.ts +155 -0
- package/dist/deploy/site/deploy-config-registry.js +124 -0
- package/dist/deploy/site/deploy-config.d.ts +97 -0
- package/dist/deploy/site/deploy-config.js +115 -0
- package/dist/deploy/site/deploy-ops/agent-tools.d.ts +22 -0
- package/dist/deploy/site/deploy-ops/agent-tools.js +76 -0
- package/dist/deploy/site/deploy-ops/registry.d.ts +134 -0
- package/dist/deploy/site/deploy-ops/registry.js +106 -0
- package/dist/deploy/site/deploy-ops/run-ops.d.ts +66 -0
- package/dist/deploy/site/deploy-ops/run-ops.js +34 -0
- package/dist/deploy/site/deploy-ops/secret-confirm.d.ts +36 -0
- package/dist/deploy/site/deploy-ops/secret-confirm.js +27 -0
- package/dist/deploy/site/deploy-targets/host-kit.d.ts +28 -0
- package/dist/deploy/site/deploy-targets/host-kit.js +120 -0
- package/dist/deploy/site/deploy-targets/registry.d.ts +157 -0
- package/dist/deploy/site/deploy-targets/registry.js +132 -0
- package/dist/deploy/site/deploy-targets/types.d.ts +27 -0
- package/dist/deploy/site/deploy-targets/types.js +2 -0
- package/dist/deploy/site/dockerfile.d.ts +137 -0
- package/dist/deploy/site/dockerfile.js +101 -0
- package/dist/deploy/site/export-run.d.ts +137 -0
- package/dist/deploy/site/export-run.js +152 -0
- package/dist/deploy/site/ports.d.ts +115 -0
- package/dist/deploy/site/ports.js +2 -0
- package/dist/deploy/site/publish-agent-tools.d.ts +18 -0
- package/dist/deploy/site/publish-agent-tools.js +120 -0
- package/dist/deploy/site/publish-candidate.d.ts +26 -0
- package/dist/deploy/site/publish-candidate.js +37 -0
- package/dist/deploy/site/publish-credentials/account-label-heal-scheduler.d.ts +78 -0
- package/dist/deploy/site/publish-credentials/account-label-heal-scheduler.js +88 -0
- package/dist/deploy/site/publish-credentials/compatibility-port.d.ts +38 -0
- package/dist/deploy/site/publish-credentials/compatibility-port.js +19 -0
- package/dist/deploy/site/publish-credentials/execution-mode.d.ts +43 -0
- package/dist/deploy/site/publish-credentials/execution-mode.js +19 -0
- package/dist/deploy/site/publish-credentials/store-owner.d.ts +11 -0
- package/dist/deploy/site/publish-credentials/store-owner.js +9 -0
- package/dist/deploy/site/publish-credentials/store-resolution.d.ts +55 -0
- package/dist/deploy/site/publish-credentials/store-resolution.js +100 -0
- package/dist/deploy/site/publish-credentials/store-validation.d.ts +68 -0
- package/dist/deploy/site/publish-credentials/store-validation.js +182 -0
- package/dist/deploy/site/publish-credentials/store.d.ts +322 -0
- package/dist/deploy/site/publish-credentials/store.js +372 -0
- package/dist/deploy/site/publish-credentials/types.d.ts +85 -0
- package/dist/deploy/site/publish-credentials/types.js +2 -0
- package/dist/deploy/site/publish-tool-capabilities.d.ts +123 -0
- package/dist/deploy/site/publish-tool-capabilities.js +175 -0
- package/dist/deploy/site/publish-tool-credential.d.ts +48 -0
- package/dist/deploy/site/publish-tool-credential.js +284 -0
- package/dist/deploy/site/publish-tool-deps.d.ts +205 -0
- package/dist/deploy/site/publish-tool-deps.js +15 -0
- package/dist/deploy/site/publish-tool-execution.d.ts +78 -0
- package/dist/deploy/site/publish-tool-execution.js +313 -0
- package/dist/deploy/site/publish-tool-schema.d.ts +29 -0
- package/dist/deploy/site/publish-tool-schema.js +38 -0
- package/dist/deploy/site/static-publish/adapter-export.d.ts +54 -0
- package/dist/deploy/site/static-publish/adapter-export.js +89 -0
- package/dist/deploy/site/static-publish/adapter-plan.d.ts +99 -0
- package/dist/deploy/site/static-publish/adapter-plan.js +112 -0
- package/dist/deploy/site/static-publish/adapter.d.ts +182 -0
- package/dist/deploy/site/static-publish/adapter.js +321 -0
- package/dist/deploy/site/static-publish/admin-publish-read.d.ts +209 -0
- package/dist/deploy/site/static-publish/admin-publish-read.js +116 -0
- package/dist/deploy/site/static-publish/credentials.d.ts +110 -0
- package/dist/deploy/site/static-publish/credentials.js +290 -0
- package/dist/deploy/site/static-publish/domain-publish-rows.d.ts +25 -0
- package/dist/deploy/site/static-publish/domain-publish-rows.js +43 -0
- package/dist/deploy/site/static-publish/domain-publish-tool.d.ts +19 -0
- package/dist/deploy/site/static-publish/domain-publish-tool.js +111 -0
- package/dist/deploy/site/static-publish/inspection.d.ts +24 -0
- package/dist/deploy/site/static-publish/inspection.js +69 -0
- package/dist/deploy/site/static-publish/publish-history.d.ts +197 -0
- package/dist/deploy/site/static-publish/publish-history.js +153 -0
- package/dist/deploy/site/static-publish/publish-run.d.ts +156 -0
- package/dist/deploy/site/static-publish/publish-run.js +186 -0
- package/dist/deploy/site/static-publish/types.d.ts +165 -0
- package/dist/deploy/site/static-publish/types.js +2 -0
- package/dist/deploy/site/static-publish/verify.d.ts +217 -0
- package/dist/deploy/site/static-publish/verify.js +248 -0
- package/dist/deploy/site/tool-registrations.d.ts +97 -0
- package/dist/deploy/site/tool-registrations.js +130 -0
- package/dist/deploy/site/types.d.ts +51 -0
- package/dist/deploy/site/types.js +2 -0
- package/dist/deploy/site-update/check-for-update.d.ts +19 -0
- package/dist/deploy/site-update/check-for-update.js +19 -0
- package/dist/deploy/site-update/contracts.d.ts +161 -0
- package/dist/deploy/site-update/contracts.js +94 -0
- package/dist/deploy/site-update/desktop-site-update.d.ts +66 -0
- package/dist/deploy/site-update/desktop-site-update.js +43 -0
- package/dist/deploy/site-update/fake-site-update.d.ts +39 -0
- package/dist/deploy/site-update/fake-site-update.js +52 -0
- package/dist/deploy/site-update/run-site-update.d.ts +121 -0
- package/dist/deploy/site-update/run-site-update.js +219 -0
- package/dist/deploy/site-update/self-hosted-site-update.d.ts +71 -0
- package/dist/deploy/site-update/self-hosted-site-update.js +79 -0
- package/dist/deploy/target-contracts.d.ts +3 -0
- package/dist/deploy/tool.d.ts +5 -8
- package/dist/deploy/tool.js +6 -9
- package/dist/dns/binding-sweeper.d.ts +72 -0
- package/dist/dns/binding-sweeper.js +53 -0
- package/dist/dns/index.d.ts +1 -0
- package/dist/dns/index.js +1 -0
- package/dist/dns/site/binding.repo.d.ts +71 -0
- package/dist/dns/site/binding.repo.js +45 -0
- package/dist/dns/site/dns-changes.d.ts +90 -0
- package/dist/dns/site/dns-changes.js +271 -0
- package/dist/dns/site/dns-tools.d.ts +46 -0
- package/dist/dns/site/dns-tools.js +204 -0
- package/dist/dns/site/mail-dns-status.d.ts +111 -0
- package/dist/dns/site/mail-dns-status.js +190 -0
- package/dist/dns/site/mail-dns-tools.d.ts +33 -0
- package/dist/dns/site/mail-dns-tools.js +62 -0
- package/dist/dns/site/mail-requirements.d.ts +30 -0
- package/dist/dns/site/mail-requirements.js +78 -0
- package/dist/dns/site/tool-deps.d.ts +21 -0
- package/dist/dns/site/tool-deps.js +2 -0
- package/dist/dns/site/tools.d.ts +74 -0
- package/dist/dns/site/tools.js +124 -0
- package/dist/local-dev/bind-host.d.ts +80 -0
- package/dist/local-dev/bind-host.js +90 -0
- package/dist/local-dev/dev-proxy-upstream.d.ts +69 -0
- package/dist/local-dev/dev-proxy-upstream.js +63 -0
- package/dist/local-dev/index.d.ts +28 -0
- package/dist/local-dev/index.js +25 -0
- package/dist/packaging/electron/archive.d.ts +2 -9
- package/dist/packaging/electron/asar-adapter.d.ts +2 -1
- package/dist/packaging/electron/entry.d.ts +2 -0
- package/dist/packaging/electron/move-to-applications.d.ts +165 -0
- package/dist/packaging/electron/move-to-applications.js +162 -0
- package/dist/packaging/electron/policies.d.ts +33 -4
- package/dist/packaging/electron/policies.js +29 -10
- package/dist/packaging/electron/ports.d.ts +1 -6
- package/dist/packaging/electron/staging.d.ts +11 -2
- package/dist/packaging/electron/staging.js +15 -5
- package/dist/react/site-share-expiry/ShareExpiryControls.d.ts +29 -0
- package/dist/react/site-share-expiry/ShareExpiryControls.js +7 -0
- package/dist/react/site-share-expiry/index.d.ts +2 -0
- package/dist/react/site-share-expiry/index.js +2 -0
- package/dist/source-control/react/ProvidersTab.d.ts +98 -0
- package/dist/source-control/react/ProvidersTab.js +195 -0
- package/dist/source-control/react/SourceControl.d.ts +51 -0
- package/dist/source-control/react/SourceControl.js +61 -0
- package/dist/source-control/react/hooks/use-source-control-credentials.hooks.d.ts +128 -0
- package/dist/source-control/react/hooks/use-source-control-credentials.hooks.js +102 -0
- package/dist/source-control/react/rules.d.ts +167 -0
- package/dist/source-control/react/rules.js +125 -0
- package/dist/source-control/react/source-control-visuals.d.ts +75 -0
- package/dist/source-control/react/source-control-visuals.js +48 -0
- package/dist/source-control/site/agent-tools.d.ts +5 -0
- package/dist/source-control/site/agent-tools.js +30 -0
- package/dist/source-control/site/bundled-provider-registry.d.ts +33 -0
- package/dist/source-control/site/bundled-provider-registry.js +37 -0
- package/dist/source-control/site/commit-schema.d.ts +40 -0
- package/dist/source-control/site/commit-schema.js +29 -0
- package/dist/source-control/site/commit-target.d.ts +26 -0
- package/dist/source-control/site/commit-target.js +58 -0
- package/dist/source-control/site/credential-form.d.ts +36 -0
- package/dist/source-control/site/credential-form.js +102 -0
- package/dist/source-control/site/credential-setup.d.ts +107 -0
- package/dist/source-control/site/credential-setup.js +216 -0
- package/dist/source-control/site/provider-kit.d.ts +37 -0
- package/dist/source-control/site/provider-kit.js +35 -0
- package/dist/source-control/site/provider-module.d.ts +251 -0
- package/dist/source-control/site/provider-module.js +2 -0
- package/dist/source-control/site/saved-key-bindings.d.ts +4 -0
- package/dist/source-control/site/saved-key-bindings.js +4 -0
- package/dist/source-control/site/static-site-packager-port.d.ts +37 -0
- package/dist/source-control/site/static-site-packager-port.js +2 -0
- package/dist/source-control/site/store.d.ts +209 -0
- package/dist/source-control/site/store.js +374 -0
- package/dist/source-control/site/store.validation.d.ts +72 -0
- package/dist/source-control/site/store.validation.js +168 -0
- package/dist/source-control/site/tool-registrations.d.ts +190 -0
- package/dist/source-control/site/tool-registrations.js +379 -0
- package/dist/static-export/site/export-preflight.d.ts +48 -0
- package/dist/static-export/site/export-preflight.js +82 -0
- package/dist/static-export/site/media-original-urls.d.ts +57 -0
- package/dist/static-export/site/media-original-urls.js +109 -0
- package/dist/static-export/site/ports.d.ts +82 -0
- package/dist/static-export/site/ports.js +29 -0
- package/dist/static-export/site/public-origin-policy.d.ts +32 -0
- package/dist/static-export/site/public-origin-policy.js +68 -0
- package/dist/static-export/site/route-manifest.d.ts +65 -0
- package/dist/static-export/site/route-manifest.js +139 -0
- package/dist/static-export/site/site-exporter.d.ts +158 -0
- package/dist/static-export/site/site-exporter.js +112 -0
- package/dist/static-export/site/static-security-headers.d.ts +39 -0
- package/dist/static-export/site/static-security-headers.js +43 -0
- package/dist/static-export/site/theme-preview-manifest.d.ts +35 -0
- package/dist/static-export/site/theme-preview-manifest.js +28 -0
- package/package.json +911 -7
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Where each staged import file may land: the live site, or the unserved
|
|
3
|
+
* `.import-quarantine/` tree. Untrusted extensions never enter a discovery/activation root.
|
|
4
|
+
*/
|
|
5
|
+
/** The manifest's `build` exactly as staged; its fields are re-checked before use. */
|
|
6
|
+
export type CompiledBuild = {
|
|
7
|
+
readonly sourceDir?: unknown;
|
|
8
|
+
readonly source?: unknown;
|
|
9
|
+
readonly [key: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Host rules the placement cannot own: the theme owner's build/artifact validation and the share path
|
|
13
|
+
* policy. Methods (not properties) so a host function with a narrower parameter type is accepted.
|
|
14
|
+
*/
|
|
15
|
+
export interface ImportPlacementChecks {
|
|
16
|
+
/** Problems with a compiled build's `sourceDir`; empty when contained. */
|
|
17
|
+
checkSourceDirContainment(required: {
|
|
18
|
+
build: CompiledBuild;
|
|
19
|
+
schemaVersion: number;
|
|
20
|
+
}): readonly unknown[];
|
|
21
|
+
/** The theme owner's artifact validation; `status: "invalid"` quarantines. */
|
|
22
|
+
loadTheme(required: {
|
|
23
|
+
themeDir: string;
|
|
24
|
+
id: string;
|
|
25
|
+
source: "site";
|
|
26
|
+
}): {
|
|
27
|
+
readonly status: string;
|
|
28
|
+
};
|
|
29
|
+
/** The share path policy; throws on an unsafe path. */
|
|
30
|
+
validateSharePath(required: {
|
|
31
|
+
path: string;
|
|
32
|
+
}): void;
|
|
33
|
+
}
|
|
34
|
+
/** Theme ids (`<tier>/<name>`) to quarantine, and each compiled theme's authored-source prefix. */
|
|
35
|
+
export interface ThemeManifestFindings {
|
|
36
|
+
readonly quarantinedThemes: ReadonlySet<string>;
|
|
37
|
+
readonly compiledSources: ReadonlyMap<string, string>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Reads every staged static/declarative `theme.json`: a tier that disagrees with its folder, an
|
|
41
|
+
* unreadable manifest, or an unsafe/invalid compiled build quarantines the theme.
|
|
42
|
+
* @complexity O(themes × theme validation).
|
|
43
|
+
*/
|
|
44
|
+
export declare function inspectThemeManifests(required: {
|
|
45
|
+
root: string;
|
|
46
|
+
files: readonly string[];
|
|
47
|
+
checks: ImportPlacementChecks;
|
|
48
|
+
}): ThemeManifestFindings;
|
|
49
|
+
/**
|
|
50
|
+
* Every staged theme tree that may go live: all its files are supported static assets (compiled
|
|
51
|
+
* source excepted) and its manifest was not quarantined.
|
|
52
|
+
* @complexity O(files).
|
|
53
|
+
*/
|
|
54
|
+
export declare function liveThemeTrees(required: {
|
|
55
|
+
files: readonly string[];
|
|
56
|
+
findings: ThemeManifestFindings;
|
|
57
|
+
}): Set<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Why one theme tree would be held back by import, in plain words; empty when import would place
|
|
60
|
+
* it live. The verdict comes from {@link inspectThemeManifests} + {@link liveThemeTrees} themselves
|
|
61
|
+
* (one source of truth); the words only explain it. Unlike import, authored build source is a
|
|
62
|
+
* problem here: import keeps it in quarantine even for a live compiled theme, and a restore moves
|
|
63
|
+
* the whole folder.
|
|
64
|
+
* @param required.root folder holding `themes/<id>/...`; `files` are root-relative.
|
|
65
|
+
* @param required.checks the host theme/path rules (see {@link ImportPlacementChecks}).
|
|
66
|
+
* @complexity O(files), plus one manifest read (and a theme load for a compiled build).
|
|
67
|
+
*/
|
|
68
|
+
export declare function explainThemeTree(required: {
|
|
69
|
+
root: string;
|
|
70
|
+
id: string;
|
|
71
|
+
files: readonly string[];
|
|
72
|
+
checks: ImportPlacementChecks;
|
|
73
|
+
}): string[];
|
|
74
|
+
/**
|
|
75
|
+
* The site-relative destination of one staged file, or `null` when it is never restored.
|
|
76
|
+
* Uploads and live theme files keep their path; everything else lands under `.import-quarantine/`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function restoreDestination(required: {
|
|
79
|
+
file: string;
|
|
80
|
+
liveThemes: ReadonlySet<string>;
|
|
81
|
+
compiledSources: ReadonlyMap<string, string>;
|
|
82
|
+
}): string | null;
|
|
83
|
+
/** Private roots plus exclusive files prevent extraction through pre-existing links or aliases.
|
|
84
|
+
* @param required.validatePath the host share path policy, run before the containment guard.
|
|
85
|
+
*/
|
|
86
|
+
export declare function writeExclusive(required: {
|
|
87
|
+
root: string;
|
|
88
|
+
relative: string;
|
|
89
|
+
bytes: Buffer;
|
|
90
|
+
validatePath: (required: {
|
|
91
|
+
path: string;
|
|
92
|
+
}) => void;
|
|
93
|
+
}, _optional?: Record<string, never>): void;
|
|
94
|
+
//# sourceMappingURL=import-restore-placement.d.ts.map
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
const PLAIN = { kind: "plain" };
|
|
4
|
+
const quarantine = (problem) => ({ kind: "quarantine", problem });
|
|
5
|
+
const UNREADABLE = quarantine("Its theme.json could not be read or checked.");
|
|
6
|
+
const BAD_BUILD = quarantine("Its built files did not pass the theme checks.");
|
|
7
|
+
const THEME_MANIFEST = /^themes\/((?:__original-themes__\/)?(?:static|declarative))\/([^/]+)\/theme.json$/;
|
|
8
|
+
const THEME_FILE = /^themes\/((?:__original-themes__\/)?(?:static|declarative))\/([^/]+)\/(.+)$/;
|
|
9
|
+
const THEME_ID = /^themes\/((?:__original-themes__\/)?(?:static|declarative)\/[^/]+)\//;
|
|
10
|
+
const STATIC_ASSETS = [
|
|
11
|
+
/\.(?:html?|css|m?js|json|webmanifest|xml|liquid|map|png|jpe?g)$/i,
|
|
12
|
+
/\.(?:gif|webp|avif|svg|ico|woff2?|ttf|otf|txt|md|mp4|webm|pdf)$/i,
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* Reads every staged static/declarative `theme.json`: a tier that disagrees with its folder, an
|
|
16
|
+
* unreadable manifest, or an unsafe/invalid compiled build quarantines the theme.
|
|
17
|
+
* @complexity O(themes × theme validation).
|
|
18
|
+
*/
|
|
19
|
+
export function inspectThemeManifests(required) {
|
|
20
|
+
const quarantinedThemes = new Set();
|
|
21
|
+
const compiledSources = new Map();
|
|
22
|
+
for (const file of required.files) {
|
|
23
|
+
const match = THEME_MANIFEST.exec(file);
|
|
24
|
+
if (!match)
|
|
25
|
+
continue;
|
|
26
|
+
const id = match[1] + "/" + match[2];
|
|
27
|
+
const verdict = inspectThemeManifest({ root: required.root, file, tier: match[1], name: match[2], checks: required.checks });
|
|
28
|
+
if (verdict.kind === "quarantine")
|
|
29
|
+
quarantinedThemes.add(id);
|
|
30
|
+
if (verdict.kind === "compiled")
|
|
31
|
+
compiledSources.set(id, verdict.sourcePrefix);
|
|
32
|
+
}
|
|
33
|
+
return { quarantinedThemes, compiledSources };
|
|
34
|
+
}
|
|
35
|
+
function inspectThemeManifest(required) {
|
|
36
|
+
try {
|
|
37
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(required.root, required.file), "utf8"));
|
|
38
|
+
const folderTier = required.tier.split("/").at(-1);
|
|
39
|
+
if (manifest.tier !== folderTier)
|
|
40
|
+
return quarantine(`Its theme.json says it is a ${String(manifest.tier)} theme, but it sits in the ${folderTier} folder.`);
|
|
41
|
+
if (manifest.build?.source !== "compiled")
|
|
42
|
+
return PLAIN;
|
|
43
|
+
return inspectCompiledTheme({ root: required.root, id: required.tier + "/" + required.name, name: required.name, manifest, checks: required.checks });
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return UNREADABLE;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** @throws whatever the share path policy or theme loader throws; the caller quarantines on it. */
|
|
50
|
+
function inspectCompiledTheme(required) {
|
|
51
|
+
const { build } = required.manifest;
|
|
52
|
+
const { checks } = required;
|
|
53
|
+
if (required.manifest.tier !== "static" || typeof build.sourceDir !== "string" || checks.checkSourceDirContainment({ build, schemaVersion: 2 }).length)
|
|
54
|
+
return BAD_BUILD;
|
|
55
|
+
// A trailing '/' is an empty segment, so this refusal also guarantees `sourcePrefix` below.
|
|
56
|
+
checks.validateSharePath({ path: build.sourceDir });
|
|
57
|
+
// The theme owner treats compiled output as static, never as a server code tier. Reuse its
|
|
58
|
+
// artifact validation; preserve authored build source ONLY in the quarantine tree.
|
|
59
|
+
const theme = checks.loadTheme({ themeDir: path.join(required.root, "themes", required.id), id: required.name, source: "site" });
|
|
60
|
+
if (theme.status === "invalid")
|
|
61
|
+
return BAD_BUILD;
|
|
62
|
+
return { kind: "compiled", sourcePrefix: "themes/" + required.id + "/" + build.sourceDir + "/" };
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Every staged theme tree that may go live: all its files are supported static assets (compiled
|
|
66
|
+
* source excepted) and its manifest was not quarantined.
|
|
67
|
+
* @complexity O(files).
|
|
68
|
+
*/
|
|
69
|
+
export function liveThemeTrees(required) {
|
|
70
|
+
const live = new Set();
|
|
71
|
+
const quarantined = new Set(required.findings.quarantinedThemes);
|
|
72
|
+
for (const file of required.files) {
|
|
73
|
+
const match = THEME_FILE.exec(file);
|
|
74
|
+
if (!match)
|
|
75
|
+
continue;
|
|
76
|
+
const id = match[1] + "/" + match[2];
|
|
77
|
+
live.add(id);
|
|
78
|
+
// Browser JS is an ordinary static asset, unlike TS/JS modules in a code theme. The whole
|
|
79
|
+
// tree is quarantined if it includes build source or declares a different executable tier.
|
|
80
|
+
if (!isCompiledSource({ file, theme: id, compiledSources: required.findings.compiledSources }) && !isStaticAsset(match[3]))
|
|
81
|
+
quarantined.add(id);
|
|
82
|
+
}
|
|
83
|
+
for (const id of quarantined)
|
|
84
|
+
live.delete(id);
|
|
85
|
+
return live;
|
|
86
|
+
}
|
|
87
|
+
function isStaticAsset(relative) {
|
|
88
|
+
return STATIC_ASSETS.some(pattern => pattern.test(relative));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Why one theme tree would be held back by import, in plain words; empty when import would place
|
|
92
|
+
* it live. The verdict comes from {@link inspectThemeManifests} + {@link liveThemeTrees} themselves
|
|
93
|
+
* (one source of truth); the words only explain it. Unlike import, authored build source is a
|
|
94
|
+
* problem here: import keeps it in quarantine even for a live compiled theme, and a restore moves
|
|
95
|
+
* the whole folder.
|
|
96
|
+
* @param required.root folder holding `themes/<id>/...`; `files` are root-relative.
|
|
97
|
+
* @param required.checks the host theme/path rules (see {@link ImportPlacementChecks}).
|
|
98
|
+
* @complexity O(files), plus one manifest read (and a theme load for a compiled build).
|
|
99
|
+
*/
|
|
100
|
+
export function explainThemeTree(required) {
|
|
101
|
+
const { root, id, files, checks } = required;
|
|
102
|
+
const findings = inspectThemeManifests({ root, files, checks });
|
|
103
|
+
const problems = themeTreeProblems({ root, id, files, findings, checks });
|
|
104
|
+
if (!liveThemeTrees({ files, findings }).has(id) && !problems.length)
|
|
105
|
+
problems.push("It did not pass the import safety checks.");
|
|
106
|
+
return problems;
|
|
107
|
+
}
|
|
108
|
+
function themeTreeProblems(required) {
|
|
109
|
+
const { root, id, files, findings, checks } = required;
|
|
110
|
+
const manifest = "themes/" + id + "/theme.json";
|
|
111
|
+
const slash = id.lastIndexOf("/");
|
|
112
|
+
const problems = [];
|
|
113
|
+
if (!files.includes(manifest))
|
|
114
|
+
problems.push("It has no theme.json file.");
|
|
115
|
+
else if (findings.quarantinedThemes.has(id)) {
|
|
116
|
+
const verdict = inspectThemeManifest({ root, file: manifest, tier: id.slice(0, slash), name: id.slice(slash + 1), checks });
|
|
117
|
+
if (verdict.kind === "quarantine")
|
|
118
|
+
problems.push(verdict.problem);
|
|
119
|
+
}
|
|
120
|
+
const relative = files.map(file => file.slice(("themes/" + id + "/").length));
|
|
121
|
+
const source = new Set(files.filter(file => isCompiledSource({ file, theme: id, compiledSources: findings.compiledSources })));
|
|
122
|
+
const unsupported = relative.filter((file, index) => !source.has(files[index]) && !isStaticAsset(file));
|
|
123
|
+
if (source.size)
|
|
124
|
+
problems.push(`It includes its build source (${source.size} ${source.size === 1 ? "file" : "files"}), which is never placed live.`);
|
|
125
|
+
if (unsupported.length)
|
|
126
|
+
problems.push(`It holds files that are not plain web files: ${unsupported.slice(0, 5).join(", ")}${unsupported.length > 5 ? ` and ${unsupported.length - 5} more` : ""}.`);
|
|
127
|
+
return problems;
|
|
128
|
+
}
|
|
129
|
+
function isCompiledSource(required) {
|
|
130
|
+
const prefix = required.compiledSources.get(required.theme);
|
|
131
|
+
return prefix !== undefined && required.file.startsWith(prefix);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The site-relative destination of one staged file, or `null` when it is never restored.
|
|
135
|
+
* Uploads and live theme files keep their path; everything else lands under `.import-quarantine/`.
|
|
136
|
+
*/
|
|
137
|
+
export function restoreDestination(required) {
|
|
138
|
+
const { file } = required;
|
|
139
|
+
if (file === "settings.json")
|
|
140
|
+
return null; // Init regenerates host config and fresh identity.
|
|
141
|
+
if (file.startsWith("uploads/"))
|
|
142
|
+
return file;
|
|
143
|
+
const theme = THEME_ID.exec(file)?.[1];
|
|
144
|
+
const live = theme !== undefined && required.liveThemes.has(theme) && !isCompiledSource({ file, theme, compiledSources: required.compiledSources });
|
|
145
|
+
return live ? file : ".import-quarantine/" + file;
|
|
146
|
+
}
|
|
147
|
+
/** Private roots plus exclusive files prevent extraction through pre-existing links or aliases.
|
|
148
|
+
* @param required.validatePath the host share path policy, run before the containment guard.
|
|
149
|
+
*/
|
|
150
|
+
export function writeExclusive(required, _optional = {}) {
|
|
151
|
+
required.validatePath({ path: required.relative });
|
|
152
|
+
const target = path.resolve(required.root, required.relative);
|
|
153
|
+
if (!target.startsWith(path.resolve(required.root) + path.sep))
|
|
154
|
+
throw new Error("Import path escaped staging");
|
|
155
|
+
fs.mkdirSync(path.dirname(target), { recursive: true, mode: 0o700 });
|
|
156
|
+
fs.writeFileSync(target, required.bytes, { flag: "wx", mode: 0o600 });
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=import-restore-placement.js.map
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { AgentPluginLayout } from "@jini-ai/core/contracts/headless/plugin-host";
|
|
2
|
+
import type { ImportedExtensionState } from "./import-plugin-state.js";
|
|
3
|
+
import { type ThemeManifestFindings } from "./import-restore-placement.js";
|
|
4
|
+
import type { VerifiedSiteImport } from "./import-verifier.js";
|
|
5
|
+
import type { SiteSavedKeysPort } from "./saved-keys-port.js";
|
|
6
|
+
/**
|
|
7
|
+
* @file The staged-import restore: persists a verified import into a private stage, then (at the
|
|
8
|
+
* lifecycle's pre-commit point) places it into the new site. The archive path rules, theme
|
|
9
|
+
* validation, plugin lifecycle, content database and fallback-theme lookup are the host's and are
|
|
10
|
+
* injected through {@link ImportRestoreHost}; what stays on, what is quarantined and what is set
|
|
11
|
+
* aside is decided here.
|
|
12
|
+
*/
|
|
13
|
+
/** The host's archive path rules: which runtime path belongs to which code unit, and the notices for it. */
|
|
14
|
+
export interface ImportRestoreArchivePaths {
|
|
15
|
+
/** The code unit that holds every override file. */
|
|
16
|
+
readonly overridesUnit: string;
|
|
17
|
+
/** The code unit of one runtime path; `undefined` for data and originals. */
|
|
18
|
+
archiveCodeUnit(required: {
|
|
19
|
+
path: string;
|
|
20
|
+
}, optional?: Record<string, never>): string | undefined;
|
|
21
|
+
/** Plain-word notices for edited units. */
|
|
22
|
+
editedArchiveWarnings(required: {
|
|
23
|
+
units: Iterable<string>;
|
|
24
|
+
}, optional?: Record<string, never>): string[];
|
|
25
|
+
/** Plain-word notices for units kept switched off. */
|
|
26
|
+
keptOffArchiveWarnings(required: {
|
|
27
|
+
units: Iterable<string>;
|
|
28
|
+
}, optional?: Record<string, never>): string[];
|
|
29
|
+
}
|
|
30
|
+
/** What {@link ImportRestoreHost.keepImportedCodeOff} receives; `K` is the host's content-database handle. */
|
|
31
|
+
export interface ImportKeepOffRequest<K> {
|
|
32
|
+
readonly dbPath: string;
|
|
33
|
+
readonly fallback: string;
|
|
34
|
+
readonly liveThemes: ReadonlySet<string>;
|
|
35
|
+
readonly unrecognised: ReadonlySet<string>;
|
|
36
|
+
readonly setAside: boolean;
|
|
37
|
+
readonly openContent: (required: {
|
|
38
|
+
filePath: string;
|
|
39
|
+
}) => K;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The host values the restore needs and the package must not import. Every field is REQUIRED.
|
|
43
|
+
* `K` is the host's opened content-database handle, handed through untouched.
|
|
44
|
+
*/
|
|
45
|
+
export interface ImportRestoreHost<K> {
|
|
46
|
+
readonly archivePaths: ImportRestoreArchivePaths;
|
|
47
|
+
/** The host's fallback theme id; never replaced by an imported theme of the same id. */
|
|
48
|
+
fallbackThemeId(): string;
|
|
49
|
+
/** Reads every staged static/declarative `theme.json` with the host theme checks. */
|
|
50
|
+
inspectThemeManifests(required: {
|
|
51
|
+
root: string;
|
|
52
|
+
files: readonly string[];
|
|
53
|
+
}, optional?: Record<string, never>): ThemeManifestFindings;
|
|
54
|
+
/** Private roots plus exclusive files, with the host's share path policy applied. */
|
|
55
|
+
writeExclusive(required: {
|
|
56
|
+
root: string;
|
|
57
|
+
relative: string;
|
|
58
|
+
bytes: Buffer;
|
|
59
|
+
}, optional?: Record<string, never>): void;
|
|
60
|
+
/** Seeds this install's code, then applies imported activation choices; returns the files it placed itself. */
|
|
61
|
+
restoreImportedPluginState(required: {
|
|
62
|
+
root: string;
|
|
63
|
+
dir: string;
|
|
64
|
+
layout: AgentPluginLayout;
|
|
65
|
+
state: ImportedExtensionState;
|
|
66
|
+
files: readonly string[];
|
|
67
|
+
}, optional?: {
|
|
68
|
+
sourceRoot?: string | undefined;
|
|
69
|
+
}): Promise<ReadonlySet<string>>;
|
|
70
|
+
/** The step that decides what stays on in the new database; returns plain-word notices. */
|
|
71
|
+
keepImportedCodeOff(required: ImportKeepOffRequest<K>, optional?: Record<string, never>): Promise<string[]>;
|
|
72
|
+
}
|
|
73
|
+
/** Inputs of {@link ImportRestore.restoreStagedImport}. */
|
|
74
|
+
export interface RestoreStagedImportRequest<K> {
|
|
75
|
+
readonly root: string;
|
|
76
|
+
readonly dir: string;
|
|
77
|
+
readonly dbPath: string;
|
|
78
|
+
readonly siteId?: string;
|
|
79
|
+
readonly savedKeys?: Pick<SiteSavedKeysPort, "restore">;
|
|
80
|
+
readonly pluginLayout: AgentPluginLayout;
|
|
81
|
+
readonly openContent: (required: {
|
|
82
|
+
filePath: string;
|
|
83
|
+
}) => K;
|
|
84
|
+
}
|
|
85
|
+
/** Optional inputs of {@link ImportRestore.restoreStagedImport}. */
|
|
86
|
+
export interface RestoreStagedImportOptions {
|
|
87
|
+
readonly pluginSourceRoot?: string;
|
|
88
|
+
readonly savedKeysPassword?: string;
|
|
89
|
+
readonly signal?: AbortSignal;
|
|
90
|
+
}
|
|
91
|
+
/** The three staged-import operations, bound to a host. */
|
|
92
|
+
export interface ImportRestore<K> {
|
|
93
|
+
stageVerifiedImport(required: {
|
|
94
|
+
root: string;
|
|
95
|
+
verified: VerifiedSiteImport;
|
|
96
|
+
}, optional?: Record<string, never>): void;
|
|
97
|
+
restoreStagedImport(required: RestoreStagedImportRequest<K>, optional?: RestoreStagedImportOptions): Promise<void>;
|
|
98
|
+
stagedImportWarnings(required: {
|
|
99
|
+
root: string;
|
|
100
|
+
}, optional?: Record<string, never>): string[];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Binds the staged-import restore to a host's archive rules, theme checks, plugin lifecycle and
|
|
104
|
+
* content database.
|
|
105
|
+
* @returns `stageVerifiedImport`, `restoreStagedImport` and `stagedImportWarnings`.
|
|
106
|
+
* @complexity O(1) wiring; each returned function documents its own cost.
|
|
107
|
+
*/
|
|
108
|
+
export declare function createImportRestore<K>({ host }: {
|
|
109
|
+
host: ImportRestoreHost<K>;
|
|
110
|
+
}, _optional?: {}): ImportRestore<K>;
|
|
111
|
+
//# sourceMappingURL=import-restore.d.ts.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { liveThemeTrees, restoreDestination } from "./import-restore-placement.js";
|
|
4
|
+
import { unrecognisedThemes } from "./import-keep-off.js";
|
|
5
|
+
function createImportStager(host) {
|
|
6
|
+
/** Persist only verified, freshly projected data; the stage is private and never served. */
|
|
7
|
+
function stageVerifiedImport(required, _options = {}) {
|
|
8
|
+
fs.mkdirSync(required.root, { mode: 0o700 });
|
|
9
|
+
host.writeExclusive({ root: required.root, relative: "database/content.db", bytes: required.verified.database });
|
|
10
|
+
for (const [relative, bytes] of required.verified.files)
|
|
11
|
+
host.writeExclusive({ root: required.root, relative, bytes });
|
|
12
|
+
if (required.verified.encryptedKeys)
|
|
13
|
+
host.writeExclusive({ root: required.root, relative: ".saved-keys.json", bytes: required.verified.encryptedKeys });
|
|
14
|
+
const keptOff = keptOffUnits({ root: required.root, verified: required.verified });
|
|
15
|
+
fs.writeFileSync(path.join(required.root, ".archive-state.json"), JSON.stringify({ plugins: required.verified.plugins, trustedPlugins: required.verified.trustedPlugins, modified: [...required.verified.modified], keptOff, warnings: required.verified.warnings }), { flag: "wx", mode: 0o600 });
|
|
16
|
+
fs.writeFileSync(path.join(required.root, ".inventory.json"), JSON.stringify([...required.verified.files.keys()]), { flag: "wx", mode: 0o600 });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Staged code units this install does not recognise, so restore keeps them switched off: every
|
|
20
|
+
* plugin, skill, override and theme tree except live static/declarative themes, trusted agent
|
|
21
|
+
* plugins, and edited units (those already carry their own notice). Reads the staged theme
|
|
22
|
+
* manifests, so it runs after the files are written.
|
|
23
|
+
* @complexity O(files + staged theme validation).
|
|
24
|
+
*/
|
|
25
|
+
function keptOffUnits(required) {
|
|
26
|
+
const files = [...required.verified.files.keys()];
|
|
27
|
+
const live = liveThemeTrees({ files, findings: host.inspectThemeManifests({ root: required.root, files }) });
|
|
28
|
+
const recognised = new Set([...required.verified.modified, ...required.verified.trustedPlugins.map(plugin => "agent-plugins/" + plugin.id)]);
|
|
29
|
+
const units = new Set(files.map(file => stagedCodeUnit({ file, live })));
|
|
30
|
+
return [...units].filter((unit) => unit !== undefined && !recognised.has(unit));
|
|
31
|
+
}
|
|
32
|
+
/** The code unit of one staged (runtime-path) file; `undefined` for data, originals and live themes. */
|
|
33
|
+
function stagedCodeUnit(required) {
|
|
34
|
+
const theme = /^themes\/([^/]+)\/([^/]+)\//.exec(required.file);
|
|
35
|
+
if (theme)
|
|
36
|
+
return theme[1] === "__original-themes__" || required.live.has(theme[1] + "/" + theme[2]) ? undefined : "themes/" + theme[2];
|
|
37
|
+
if (required.file.startsWith("overrides/"))
|
|
38
|
+
return host.archivePaths.overridesUnit;
|
|
39
|
+
return host.archivePaths.archiveCodeUnit({ path: required.file });
|
|
40
|
+
}
|
|
41
|
+
return stageVerifiedImport;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Binds the staged-import restore to a host's archive rules, theme checks, plugin lifecycle and
|
|
45
|
+
* content database.
|
|
46
|
+
* @returns `stageVerifiedImport`, `restoreStagedImport` and `stagedImportWarnings`.
|
|
47
|
+
* @complexity O(1) wiring; each returned function documents its own cost.
|
|
48
|
+
*/
|
|
49
|
+
export function createImportRestore({ host }, _optional = {}) {
|
|
50
|
+
/** Init's pre-commit restore port. Untrusted extensions never enter a discovery/activation root.
|
|
51
|
+
* Static/declarative theme trees are eligible only when the whole tree contains supported assets;
|
|
52
|
+
* executable themes and overrides remain preserved under the unserved quarantine directory.
|
|
53
|
+
* @complexity O(files + bytes), capped by the verified inventory (2,000 entries/300 MiB).
|
|
54
|
+
*/
|
|
55
|
+
async function restoreStagedImport(required, optional = {}) {
|
|
56
|
+
const files = JSON.parse(fs.readFileSync(path.join(required.root, ".inventory.json"), "utf8"));
|
|
57
|
+
const state = JSON.parse(fs.readFileSync(path.join(required.root, ".archive-state.json"), "utf8"));
|
|
58
|
+
const findings = host.inspectThemeManifests({ root: required.root, files });
|
|
59
|
+
const liveThemes = liveThemeTrees({ files, findings });
|
|
60
|
+
for (const id of liveThemes)
|
|
61
|
+
if (state.modified.includes("themes/" + id.split("/").at(-1)))
|
|
62
|
+
liveThemes.delete(id);
|
|
63
|
+
const fallback = host.fallbackThemeId();
|
|
64
|
+
const unrecognised = unrecognisedThemes({ root: required.root, dir: required.dir, files, liveThemes });
|
|
65
|
+
// This site's own fallback theme is never replaced: the archive's copy is set aside and the site keeps rendering with a real theme.
|
|
66
|
+
const setAside = unrecognised.delete(fallback);
|
|
67
|
+
if (setAside)
|
|
68
|
+
liveThemes.delete("static/" + fallback), liveThemes.delete("declarative/" + fallback);
|
|
69
|
+
for (const id of liveThemes)
|
|
70
|
+
fs.rmSync(path.join(required.dir, "themes", id), { recursive: true, force: true });
|
|
71
|
+
// Copy the freshly rebuilt database, never the archived SQLite bytes. Exclusive creation and
|
|
72
|
+
// init's DB-path resolver protect both in-site and app-data placement from overwriting a site.
|
|
73
|
+
fs.copyFileSync(path.join(required.root, "database/content.db"), required.dbPath, fs.constants.COPYFILE_EXCL);
|
|
74
|
+
const placedMemory = await host.restoreImportedPluginState({ root: required.root, dir: required.dir, layout: required.pluginLayout, state, files }, { sourceRoot: optional.pluginSourceRoot });
|
|
75
|
+
placeFiles({ required, files, placedMemory, liveThemes, compiledSources: findings.compiledSources });
|
|
76
|
+
addStagedWarnings({ root: required.root, notices: await host.keepImportedCodeOff({ dbPath: required.dbPath, fallback, liveThemes, unrecognised, setAside, openContent: required.openContent }) });
|
|
77
|
+
await restoreOptionalSavedKeys(required, optional);
|
|
78
|
+
}
|
|
79
|
+
/** Writes each staged file that has a live or quarantine destination; plugin-state files already placed are skipped. */
|
|
80
|
+
function placeFiles(required) {
|
|
81
|
+
for (const file of required.files) {
|
|
82
|
+
if (required.placedMemory.has(file))
|
|
83
|
+
continue;
|
|
84
|
+
const destination = restoreDestination({ file, liveThemes: required.liveThemes, compiledSources: required.compiledSources });
|
|
85
|
+
if (destination !== null)
|
|
86
|
+
host.writeExclusive({ root: required.required.dir, relative: destination, bytes: fs.readFileSync(path.join(required.required.root, file)) });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** Optional keys never prevent an otherwise valid site from being created. The adapter owns
|
|
90
|
+
* authentication, validation and atomic recipient writes; error details must never reach notices.
|
|
91
|
+
*/
|
|
92
|
+
async function restoreOptionalSavedKeys(required, optional) {
|
|
93
|
+
const file = path.join(required.root, ".saved-keys.json");
|
|
94
|
+
if (!fs.existsSync(file))
|
|
95
|
+
return;
|
|
96
|
+
// restore() already turns every non-abort failure into a fixed notice.
|
|
97
|
+
const notices = required.savedKeys && required.siteId
|
|
98
|
+
? (await required.savedKeys.restore({ encryptedKeys: fs.readFileSync(file), ...(optional.savedKeysPassword === undefined ? {} : { password: optional.savedKeysPassword }), siteId: required.siteId, dir: required.dir, dbPath: required.dbPath }, optional.signal === undefined ? {} : { signal: optional.signal })).notices
|
|
99
|
+
: ["Saved keys were left out because their restore service was unavailable."];
|
|
100
|
+
addStagedWarnings({ root: required.root, notices });
|
|
101
|
+
}
|
|
102
|
+
/** Merge notices into the private stage state that `stagedImportWarnings` reads. O(notices). */
|
|
103
|
+
function addStagedWarnings(required) {
|
|
104
|
+
if (!required.notices.length)
|
|
105
|
+
return;
|
|
106
|
+
const stateFile = path.join(required.root, ".archive-state.json");
|
|
107
|
+
const state = JSON.parse(fs.readFileSync(stateFile, "utf8"));
|
|
108
|
+
fs.writeFileSync(stateFile, JSON.stringify({ ...state, warnings: [...new Set([...(state.warnings ?? []), ...required.notices])] }), { mode: 0o600 });
|
|
109
|
+
}
|
|
110
|
+
/** Read bounded safe notices and extension warnings from the private functional stage. */
|
|
111
|
+
function stagedImportWarnings(required, _optional = {}) {
|
|
112
|
+
const file = path.join(required.root, ".archive-state.json");
|
|
113
|
+
if (!fs.existsSync(file))
|
|
114
|
+
return [];
|
|
115
|
+
const state = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
116
|
+
return [...new Set([...(state.warnings ?? []), ...host.archivePaths.editedArchiveWarnings({ units: state.modified }), ...host.archivePaths.keptOffArchiveWarnings({ units: state.keptOff ?? [] })])];
|
|
117
|
+
}
|
|
118
|
+
return { stageVerifiedImport: createImportStager(host), restoreStagedImport, stagedImportWarnings };
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=import-restore.js.map
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { CredentialWarning } from "./credential-warnings.js";
|
|
2
|
+
import { type PackageFileInventory, type ShareFilePolicy } from "./share-file-policy.js";
|
|
3
|
+
import { type ArchiveManifest, type ArchivePlugin, type ArchiveSchemaIdentity } from "./archive-manifest.js";
|
|
4
|
+
import type { AgentPluginArchiveReaderPort } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
|
|
5
|
+
/** One manifest file record after validation: the exact bytes and hash the archive must match. */
|
|
6
|
+
export interface InventoryRecord {
|
|
7
|
+
readonly path: string;
|
|
8
|
+
readonly bytes: number;
|
|
9
|
+
readonly sha256: string;
|
|
10
|
+
}
|
|
11
|
+
/** A manifest that passed the share identity contract; only the fields later steps read are typed. */
|
|
12
|
+
export type SupportedShareManifest = ArchiveManifest;
|
|
13
|
+
/** What the metadata pass learned, before any listed content is read. */
|
|
14
|
+
export interface ArchiveScan {
|
|
15
|
+
readonly manifestBytes: Buffer;
|
|
16
|
+
readonly wrapper: string;
|
|
17
|
+
/** Case/Unicode alias of every file entry, the manifest included. */
|
|
18
|
+
readonly fileAliases: Set<string>;
|
|
19
|
+
readonly directories: Set<string>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* What the host owns: the caps, the share path/secret rules, the manifest codec, the code-unit and
|
|
23
|
+
* scan-path mappings, the portable inventory layout and the sentence for a changed file. Every member is REQUIRED.
|
|
24
|
+
*/
|
|
25
|
+
export interface ImportInventoryHost extends Pick<ShareFilePolicy, "validateSharePath" | "excludedSharePath" | "requireShareSecretFree" | "claimSharePath"> {
|
|
26
|
+
readonly limits: {
|
|
27
|
+
readonly maxFiles: number;
|
|
28
|
+
readonly maxManifestBytes: number;
|
|
29
|
+
readonly maxExpandedBytes: number;
|
|
30
|
+
};
|
|
31
|
+
/** Roots a manifest file record may name, e.g. `/^(?:media|themes)\/.+/`. */
|
|
32
|
+
readonly inventoryRoots: RegExp;
|
|
33
|
+
/** Root-level files a manifest may list besides the roots. */
|
|
34
|
+
readonly settingsFiles: readonly string[];
|
|
35
|
+
/** The plain sentence shown for a file whose contents no longer match what was exported. */
|
|
36
|
+
readonly changedArchiveMessage: string;
|
|
37
|
+
checkShareLimits(required: {
|
|
38
|
+
files: readonly {
|
|
39
|
+
path: string;
|
|
40
|
+
bytes: number;
|
|
41
|
+
}[];
|
|
42
|
+
}): void;
|
|
43
|
+
parseArchiveManifest(required: {
|
|
44
|
+
bytes: Buffer;
|
|
45
|
+
schema: ArchiveSchemaIdentity;
|
|
46
|
+
}): ArchiveManifest;
|
|
47
|
+
/** The unit that must stay off when any of its bytes were edited, or `undefined` for non-code. */
|
|
48
|
+
archiveCodeUnit(required: {
|
|
49
|
+
path: string;
|
|
50
|
+
}): string | undefined;
|
|
51
|
+
/** The scanner's runtime-shaped path for an archive path. */
|
|
52
|
+
archiveSecretScanPath(required: {
|
|
53
|
+
path: string;
|
|
54
|
+
plugins: readonly ArchivePlugin[];
|
|
55
|
+
}): string;
|
|
56
|
+
}
|
|
57
|
+
export declare function refuseArchive({ message }: {
|
|
58
|
+
message: string;
|
|
59
|
+
}, _optional?: Record<string, never>): never;
|
|
60
|
+
/** Hex SHA-256 of a whole buffer. O(bytes). */
|
|
61
|
+
export declare function sha256Hex({ bytes }: {
|
|
62
|
+
bytes: Buffer;
|
|
63
|
+
}, _optional?: Record<string, never>): string;
|
|
64
|
+
/**
|
|
65
|
+
* First pass, metadata only: refuses links/special entries and enforces the entry cap, reads only
|
|
66
|
+
* the one manifest (bounded), then claims every entry path, refusing collisions, invalid declared
|
|
67
|
+
* sizes and the declared-size caps. ZIP ordering is never trusted; the manifest may appear anywhere.
|
|
68
|
+
* @throws SiteShareRefusal (INVALID_ARCHIVE, UNSAFE_PATH, LIMIT_EXCEEDED) or the signal's reason.
|
|
69
|
+
* @complexity O(entries × path depth + manifest bytes), at most 2,000 entries.
|
|
70
|
+
*/
|
|
71
|
+
export declare function scanArchiveMetadata(required: {
|
|
72
|
+
archive: Buffer;
|
|
73
|
+
reader: AgentPluginArchiveReaderPort;
|
|
74
|
+
host: ImportInventoryHost;
|
|
75
|
+
}, optional?: {
|
|
76
|
+
signal?: AbortSignal;
|
|
77
|
+
}): Promise<ArchiveScan>;
|
|
78
|
+
/** Finder metadata is discarded identically in both passes, without decompressing it. */
|
|
79
|
+
export declare function ignoredArchivePath(required: {
|
|
80
|
+
path: string;
|
|
81
|
+
}, _optional?: {}): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Parses the manifest and refuses anything but this build's exact share identity.
|
|
84
|
+
* @throws SiteShareRefusal INVALID_ARCHIVE for invalid JSON or an unsupported identity.
|
|
85
|
+
* @complexity O(manifest bytes).
|
|
86
|
+
*/
|
|
87
|
+
export declare function parseShareManifest(required: {
|
|
88
|
+
manifestBytes: Buffer;
|
|
89
|
+
schema: {
|
|
90
|
+
index: number;
|
|
91
|
+
tag: string;
|
|
92
|
+
};
|
|
93
|
+
host: ImportInventoryHost;
|
|
94
|
+
}): SupportedShareManifest;
|
|
95
|
+
/**
|
|
96
|
+
* Validates every manifest record and keys it by exact path. Only the projected database and the
|
|
97
|
+
* recognised portable roots/settings files may be listed; known private paths refuse.
|
|
98
|
+
* @throws SiteShareRefusal (INVALID_ARCHIVE, UNSAFE_PATH, UNSAFE_FILE).
|
|
99
|
+
* @complexity O(records × path length).
|
|
100
|
+
*/
|
|
101
|
+
export declare function buildManifestInventory(required: {
|
|
102
|
+
files: readonly unknown[];
|
|
103
|
+
host: ImportInventoryHost;
|
|
104
|
+
}): Map<string, InventoryRecord>;
|
|
105
|
+
/**
|
|
106
|
+
* The archive holds exactly the manifest plus one file per record (counted by alias), the database
|
|
107
|
+
* is listed, and every directory entry has a listed file below it.
|
|
108
|
+
* @complexity O(directories × records).
|
|
109
|
+
*/
|
|
110
|
+
export declare function checkArchiveMatchesInventory(required: {
|
|
111
|
+
inventory: ReadonlyMap<string, InventoryRecord>;
|
|
112
|
+
fileAliases: ReadonlySet<string>;
|
|
113
|
+
directories: ReadonlySet<string>;
|
|
114
|
+
}): void;
|
|
115
|
+
/**
|
|
116
|
+
* Second pass: reads every listed file under its manifest size and the remaining expanded budget,
|
|
117
|
+
* checks its SHA-256, and secret-scans everything except the database (the sanitizer owns that).
|
|
118
|
+
* @throws SiteShareRefusal (INVALID_ARCHIVE) or the signal's reason.
|
|
119
|
+
* @complexity O(payload bytes), at most 300 MiB buffered.
|
|
120
|
+
*/
|
|
121
|
+
export declare function readListedFiles(required: {
|
|
122
|
+
archive: Buffer;
|
|
123
|
+
reader: AgentPluginArchiveReaderPort;
|
|
124
|
+
inventory: ReadonlyMap<string, InventoryRecord>;
|
|
125
|
+
manifestBytes: Buffer;
|
|
126
|
+
wrapper?: string;
|
|
127
|
+
manifest?: ArchiveManifest;
|
|
128
|
+
modified?: Set<string>;
|
|
129
|
+
host: ImportInventoryHost;
|
|
130
|
+
}, optional?: {
|
|
131
|
+
signal?: AbortSignal;
|
|
132
|
+
packageFiles?: PackageFileInventory;
|
|
133
|
+
bundledImportPluginIds?: ReadonlySet<string>;
|
|
134
|
+
notices?: string[];
|
|
135
|
+
credentialWarnings?: CredentialWarning[];
|
|
136
|
+
}): Promise<Map<string, Buffer>>;
|
|
137
|
+
//# sourceMappingURL=import-verifier-inventory.d.ts.map
|