@jini-ai/devops 0.7.3-next.1 → 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.
Files changed (391) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +16 -0
  3. package/dist/backup/site/archive-extensions.d.ts +73 -0
  4. package/dist/backup/site/archive-extensions.js +129 -0
  5. package/dist/backup/site/archive-manifest.d.ts +85 -0
  6. package/dist/backup/site/archive-manifest.js +176 -0
  7. package/dist/backup/site/archive-media.d.ts +121 -0
  8. package/dist/backup/site/archive-media.js +93 -0
  9. package/dist/backup/site/backup-service.credentials.d.ts +31 -0
  10. package/dist/backup/site/backup-service.credentials.js +161 -0
  11. package/dist/backup/site/backup-service.d.ts +331 -0
  12. package/dist/backup/site/backup-service.js +125 -0
  13. package/dist/backup/site/backup-service.plan.d.ts +64 -0
  14. package/dist/backup/site/backup-service.plan.js +207 -0
  15. package/dist/backup/site/backup-service.push.d.ts +29 -0
  16. package/dist/backup/site/backup-service.push.js +82 -0
  17. package/dist/backup/site/backup-service.shared.d.ts +40 -0
  18. package/dist/backup/site/backup-service.shared.js +37 -0
  19. package/dist/backup/site/bundled-export-file-policy.d.ts +38 -0
  20. package/dist/backup/site/bundled-export-file-policy.js +40 -0
  21. package/dist/backup/site/credential-warnings.d.ts +41 -0
  22. package/dist/backup/site/credential-warnings.js +50 -0
  23. package/dist/backup/site/import-backend-steps.d.ts +167 -0
  24. package/dist/backup/site/import-backend-steps.js +170 -0
  25. package/dist/backup/site/import-backend.d.ts +167 -0
  26. package/dist/backup/site/import-backend.js +298 -0
  27. package/dist/backup/site/import-database.d.ts +118 -0
  28. package/dist/backup/site/import-database.js +167 -0
  29. package/dist/backup/site/import-index/admission.d.ts +54 -0
  30. package/dist/backup/site/import-index/admission.js +46 -0
  31. package/dist/backup/site/import-index/backfill.d.ts +106 -0
  32. package/dist/backup/site/import-index/backfill.js +137 -0
  33. package/dist/backup/site/import-index/errors.d.ts +28 -0
  34. package/dist/backup/site/import-index/errors.js +38 -0
  35. package/dist/backup/site/import-index/migrations/checksums.d.ts +4 -0
  36. package/dist/backup/site/import-index/migrations/checksums.js +4 -0
  37. package/dist/backup/site/import-index/migrations/site-imports-v1.d.ts +2 -0
  38. package/dist/backup/site/import-index/migrations/site-imports-v1.js +10 -0
  39. package/dist/backup/site/import-index/mode.d.ts +191 -0
  40. package/dist/backup/site/import-index/mode.js +272 -0
  41. package/dist/backup/site/import-index/open.d.ts +40 -0
  42. package/dist/backup/site/import-index/open.js +87 -0
  43. package/dist/backup/site/import-index/paging.d.ts +28 -0
  44. package/dist/backup/site/import-index/paging.js +66 -0
  45. package/dist/backup/site/import-index/payload-namespace.d.ts +80 -0
  46. package/dist/backup/site/import-index/payload-namespace.js +156 -0
  47. package/dist/backup/site/import-index/rows.d.ts +32 -0
  48. package/dist/backup/site/import-index/rows.js +61 -0
  49. package/dist/backup/site/import-index/schema.d.ts +8 -0
  50. package/dist/backup/site/import-index/schema.js +31 -0
  51. package/dist/backup/site/import-index/store.d.ts +27 -0
  52. package/dist/backup/site/import-index/store.js +33 -0
  53. package/dist/backup/site/import-index/sweep.d.ts +10 -0
  54. package/dist/backup/site/import-index/sweep.js +26 -0
  55. package/dist/backup/site/import-keep-off.d.ts +128 -0
  56. package/dist/backup/site/import-keep-off.js +204 -0
  57. package/dist/backup/site/import-plugin-state.d.ts +74 -0
  58. package/dist/backup/site/import-plugin-state.js +67 -0
  59. package/dist/backup/site/import-registry.d.ts +110 -0
  60. package/dist/backup/site/import-registry.js +205 -0
  61. package/dist/backup/site/import-restore-placement.d.ts +94 -0
  62. package/dist/backup/site/import-restore-placement.js +158 -0
  63. package/dist/backup/site/import-restore.d.ts +111 -0
  64. package/dist/backup/site/import-restore.js +120 -0
  65. package/dist/backup/site/import-verifier-inventory.d.ts +137 -0
  66. package/dist/backup/site/import-verifier-inventory.js +236 -0
  67. package/dist/backup/site/import-verifier-projection.d.ts +78 -0
  68. package/dist/backup/site/import-verifier-projection.js +100 -0
  69. package/dist/backup/site/import-verifier.d.ts +126 -0
  70. package/dist/backup/site/import-verifier.js +53 -0
  71. package/dist/backup/site/owned-temp-root.d.ts +12 -0
  72. package/dist/backup/site/owned-temp-root.js +2 -0
  73. package/dist/backup/site/package-file-inventory.d.ts +63 -0
  74. package/dist/backup/site/package-file-inventory.js +56 -0
  75. package/dist/backup/site/push-content.d.ts +70 -0
  76. package/dist/backup/site/push-content.js +56 -0
  77. package/dist/backup/site/react/ShowMoreImports.d.ts +21 -0
  78. package/dist/backup/site/react/ShowMoreImports.js +8 -0
  79. package/dist/backup/site/saved-keys-port.d.ts +47 -0
  80. package/dist/backup/site/saved-keys-port.js +3 -0
  81. package/dist/backup/site/saved-keys.d.ts +25 -0
  82. package/dist/backup/site/saved-keys.js +38 -0
  83. package/dist/backup/site/share-backend.d.ts +243 -0
  84. package/dist/backup/site/share-backend.js +284 -0
  85. package/dist/backup/site/share-database/projection.d.ts +195 -0
  86. package/dist/backup/site/share-database/projection.js +90 -0
  87. package/dist/backup/site/share-database/projection.media.d.ts +38 -0
  88. package/dist/backup/site/share-database/projection.media.js +179 -0
  89. package/dist/backup/site/share-database/projection.tables.d.ts +46 -0
  90. package/dist/backup/site/share-database/projection.tables.js +193 -0
  91. package/dist/backup/site/share-expiry.d.ts +75 -0
  92. package/dist/backup/site/share-expiry.js +49 -0
  93. package/dist/backup/site/share-export-failure.d.ts +17 -0
  94. package/dist/backup/site/share-export-failure.js +16 -0
  95. package/dist/backup/site/share-file-policy.d.ts +60 -0
  96. package/dist/backup/site/share-file-policy.js +146 -0
  97. package/dist/backup/site/share-hosting.d.ts +107 -0
  98. package/dist/backup/site/share-hosting.js +148 -0
  99. package/dist/backup/site/share-preparation-steps.d.ts +180 -0
  100. package/dist/backup/site/share-preparation-steps.js +109 -0
  101. package/dist/backup/site/share-preparation.d.ts +122 -0
  102. package/dist/backup/site/share-preparation.js +43 -0
  103. package/dist/backup/site/share-refusal.d.ts +21 -0
  104. package/dist/backup/site/share-refusal.js +20 -0
  105. package/dist/backup/site/share-registry.d.ts +124 -0
  106. package/dist/backup/site/share-registry.js +219 -0
  107. package/dist/backup/site/share-retention.d.ts +62 -0
  108. package/dist/backup/site/share-retention.js +126 -0
  109. package/dist/backup/site/share-service.d.ts +128 -0
  110. package/dist/backup/site/share-service.js +194 -0
  111. package/dist/backup/site/share-zip.d.ts +115 -0
  112. package/dist/backup/site/share-zip.js +144 -0
  113. package/dist/backup/site/sources.d.ts +344 -0
  114. package/dist/backup/site/sources.js +595 -0
  115. package/dist/backup/site/static-copy.d.ts +122 -0
  116. package/dist/backup/site/static-copy.js +165 -0
  117. package/dist/backup/site/static-download-html.d.ts +76 -0
  118. package/dist/backup/site/static-download-html.js +149 -0
  119. package/dist/backup/site/static-download-landing.d.ts +52 -0
  120. package/dist/backup/site/static-download-landing.js +95 -0
  121. package/dist/backup/site/static-download-layout.d.ts +96 -0
  122. package/dist/backup/site/static-download-layout.js +325 -0
  123. package/dist/backup/site/static-export-selection.d.ts +50 -0
  124. package/dist/backup/site/static-export-selection.js +76 -0
  125. package/dist/backup/site/static-site-packager.d.ts +42 -0
  126. package/dist/backup/site/static-site-packager.js +32 -0
  127. package/dist/backup/site/tool-registrations.d.ts +74 -0
  128. package/dist/backup/site/tool-registrations.js +201 -0
  129. package/dist/checks/complexity-debt.d.ts +100 -0
  130. package/dist/checks/complexity-debt.js +131 -0
  131. package/dist/checks/coverage/diff.js +5 -1
  132. package/dist/checks/env-access.d.ts +14 -1
  133. package/dist/checks/env-access.js +92 -6
  134. package/dist/checks/live-verify-checks.d.ts +29 -0
  135. package/dist/checks/live-verify-checks.js +30 -0
  136. package/dist/checks/quality-gates.d.ts +137 -0
  137. package/dist/checks/quality-gates.js +209 -0
  138. package/dist/core/deploy-types.d.ts +2 -0
  139. package/dist/deploy/admin-http/site-update-status.d.ts +8 -0
  140. package/dist/deploy/admin-http/site-update-status.js +15 -0
  141. package/dist/deploy/host-kit.d.ts +3 -0
  142. package/dist/deploy/index.d.ts +6 -0
  143. package/dist/deploy/index.js +6 -0
  144. package/dist/deploy/ops-runner.js +7 -0
  145. package/dist/deploy/ops-tool-contracts.d.ts +10 -1
  146. package/dist/deploy/react/Deployment.d.ts +37 -0
  147. package/dist/deploy/react/Deployment.js +94 -0
  148. package/dist/deploy/react/DockerfileTab.d.ts +72 -0
  149. package/dist/deploy/react/DockerfileTab.js +131 -0
  150. package/dist/deploy/react/HistoryTab.d.ts +43 -0
  151. package/dist/deploy/react/HistoryTab.js +12 -0
  152. package/dist/deploy/react/OverviewTab.d.ts +60 -0
  153. package/dist/deploy/react/OverviewTab.js +75 -0
  154. package/dist/deploy/react/PublishRunResult.d.ts +5 -1
  155. package/dist/deploy/react/PublishRunResult.js +4 -4
  156. package/dist/deploy/react/SiteUpdateNotice.d.ts +22 -0
  157. package/dist/deploy/react/SiteUpdateNotice.js +25 -0
  158. package/dist/deploy/react/StaticCredentialFields.d.ts +36 -0
  159. package/dist/deploy/react/StaticCredentialFields.js +63 -0
  160. package/dist/deploy/react/StaticCredentialSteps.d.ts +23 -0
  161. package/dist/deploy/react/StaticCredentialSteps.js +155 -0
  162. package/dist/deploy/react/StaticExportCard.d.ts +11 -0
  163. package/dist/deploy/react/StaticExportCard.js +97 -0
  164. package/dist/deploy/react/StaticPublishCredentials.d.ts +50 -0
  165. package/dist/deploy/react/StaticPublishCredentials.js +77 -0
  166. package/dist/deploy/react/StaticPublishForm.d.ts +12 -0
  167. package/dist/deploy/react/StaticPublishForm.js +91 -0
  168. package/dist/deploy/react/StaticSiteTab.d.ts +207 -0
  169. package/dist/deploy/react/StaticSiteTab.js +117 -0
  170. package/dist/deploy/react/deployment-visuals.d.ts +207 -0
  171. package/dist/deploy/react/deployment-visuals.js +101 -0
  172. package/dist/deploy/react/download-dockerfile.d.ts +14 -0
  173. package/dist/deploy/react/download-dockerfile.js +15 -0
  174. package/dist/deploy/react/hooks/publish-credential-draft.d.ts +33 -0
  175. package/dist/deploy/react/hooks/publish-credential-draft.js +54 -0
  176. package/dist/deploy/react/hooks/publish-credential-selection.d.ts +13 -0
  177. package/dist/deploy/react/hooks/publish-credential-selection.js +34 -0
  178. package/dist/deploy/react/hooks/publish-credential-writes.d.ts +20 -0
  179. package/dist/deploy/react/hooks/publish-credential-writes.js +99 -0
  180. package/dist/deploy/react/hooks/static-publish-actions.d.ts +10 -0
  181. package/dist/deploy/react/hooks/static-publish-actions.js +62 -0
  182. package/dist/deploy/react/hooks/static-publish-form.hooks.d.ts +38 -0
  183. package/dist/deploy/react/hooks/static-publish-form.hooks.js +103 -0
  184. package/dist/deploy/react/hooks/static-publish-run.hooks.d.ts +28 -0
  185. package/dist/deploy/react/hooks/static-publish-run.hooks.js +92 -0
  186. package/dist/deploy/react/hooks/use-dockerfile-source.hooks.d.ts +148 -0
  187. package/dist/deploy/react/hooks/use-dockerfile-source.hooks.js +155 -0
  188. package/dist/deploy/react/hooks/use-publish-credentials.hooks.d.ts +268 -0
  189. package/dist/deploy/react/hooks/use-publish-credentials.hooks.js +52 -0
  190. package/dist/deploy/react/hooks/use-static-export.hooks.d.ts +128 -0
  191. package/dist/deploy/react/hooks/use-static-export.hooks.js +159 -0
  192. package/dist/deploy/react/hooks/use-static-publish.hooks.d.ts +208 -0
  193. package/dist/deploy/react/hooks/use-static-publish.hooks.js +48 -0
  194. package/dist/deploy/react/index.d.ts +4 -0
  195. package/dist/deploy/react/index.js +2 -0
  196. package/dist/deploy/react/rules.d.ts +363 -0
  197. package/dist/deploy/react/rules.js +314 -0
  198. package/dist/deploy/react/use-deployment-overview.hooks.d.ts +41 -0
  199. package/dist/deploy/react/use-deployment-overview.hooks.js +11 -0
  200. package/dist/deploy/site/agent-tools.d.ts +42 -0
  201. package/dist/deploy/site/agent-tools.js +119 -0
  202. package/dist/deploy/site/deploy-config-registry.d.ts +155 -0
  203. package/dist/deploy/site/deploy-config-registry.js +124 -0
  204. package/dist/deploy/site/deploy-config.d.ts +97 -0
  205. package/dist/deploy/site/deploy-config.js +115 -0
  206. package/dist/deploy/site/deploy-ops/agent-tools.d.ts +22 -0
  207. package/dist/deploy/site/deploy-ops/agent-tools.js +76 -0
  208. package/dist/deploy/site/deploy-ops/registry.d.ts +134 -0
  209. package/dist/deploy/site/deploy-ops/registry.js +106 -0
  210. package/dist/deploy/site/deploy-ops/run-ops.d.ts +66 -0
  211. package/dist/deploy/site/deploy-ops/run-ops.js +34 -0
  212. package/dist/deploy/site/deploy-ops/secret-confirm.d.ts +36 -0
  213. package/dist/deploy/site/deploy-ops/secret-confirm.js +27 -0
  214. package/dist/deploy/site/deploy-targets/host-kit.d.ts +28 -0
  215. package/dist/deploy/site/deploy-targets/host-kit.js +120 -0
  216. package/dist/deploy/site/deploy-targets/registry.d.ts +157 -0
  217. package/dist/deploy/site/deploy-targets/registry.js +132 -0
  218. package/dist/deploy/site/deploy-targets/types.d.ts +27 -0
  219. package/dist/deploy/site/deploy-targets/types.js +2 -0
  220. package/dist/deploy/site/dockerfile.d.ts +137 -0
  221. package/dist/deploy/site/dockerfile.js +101 -0
  222. package/dist/deploy/site/export-run.d.ts +137 -0
  223. package/dist/deploy/site/export-run.js +152 -0
  224. package/dist/deploy/site/ports.d.ts +115 -0
  225. package/dist/deploy/site/ports.js +2 -0
  226. package/dist/deploy/site/publish-agent-tools.d.ts +18 -0
  227. package/dist/deploy/site/publish-agent-tools.js +120 -0
  228. package/dist/deploy/site/publish-candidate.d.ts +26 -0
  229. package/dist/deploy/site/publish-candidate.js +37 -0
  230. package/dist/deploy/site/publish-credentials/account-label-heal-scheduler.d.ts +78 -0
  231. package/dist/deploy/site/publish-credentials/account-label-heal-scheduler.js +88 -0
  232. package/dist/deploy/site/publish-credentials/compatibility-port.d.ts +38 -0
  233. package/dist/deploy/site/publish-credentials/compatibility-port.js +19 -0
  234. package/dist/deploy/site/publish-credentials/execution-mode.d.ts +43 -0
  235. package/dist/deploy/site/publish-credentials/execution-mode.js +19 -0
  236. package/dist/deploy/site/publish-credentials/store-owner.d.ts +11 -0
  237. package/dist/deploy/site/publish-credentials/store-owner.js +9 -0
  238. package/dist/deploy/site/publish-credentials/store-resolution.d.ts +55 -0
  239. package/dist/deploy/site/publish-credentials/store-resolution.js +100 -0
  240. package/dist/deploy/site/publish-credentials/store-validation.d.ts +68 -0
  241. package/dist/deploy/site/publish-credentials/store-validation.js +182 -0
  242. package/dist/deploy/site/publish-credentials/store.d.ts +322 -0
  243. package/dist/deploy/site/publish-credentials/store.js +372 -0
  244. package/dist/deploy/site/publish-credentials/types.d.ts +85 -0
  245. package/dist/deploy/site/publish-credentials/types.js +2 -0
  246. package/dist/deploy/site/publish-tool-capabilities.d.ts +123 -0
  247. package/dist/deploy/site/publish-tool-capabilities.js +175 -0
  248. package/dist/deploy/site/publish-tool-credential.d.ts +48 -0
  249. package/dist/deploy/site/publish-tool-credential.js +284 -0
  250. package/dist/deploy/site/publish-tool-deps.d.ts +205 -0
  251. package/dist/deploy/site/publish-tool-deps.js +15 -0
  252. package/dist/deploy/site/publish-tool-execution.d.ts +78 -0
  253. package/dist/deploy/site/publish-tool-execution.js +313 -0
  254. package/dist/deploy/site/publish-tool-schema.d.ts +29 -0
  255. package/dist/deploy/site/publish-tool-schema.js +38 -0
  256. package/dist/deploy/site/static-publish/adapter-export.d.ts +54 -0
  257. package/dist/deploy/site/static-publish/adapter-export.js +89 -0
  258. package/dist/deploy/site/static-publish/adapter-plan.d.ts +99 -0
  259. package/dist/deploy/site/static-publish/adapter-plan.js +112 -0
  260. package/dist/deploy/site/static-publish/adapter.d.ts +182 -0
  261. package/dist/deploy/site/static-publish/adapter.js +321 -0
  262. package/dist/deploy/site/static-publish/admin-publish-read.d.ts +209 -0
  263. package/dist/deploy/site/static-publish/admin-publish-read.js +116 -0
  264. package/dist/deploy/site/static-publish/credentials.d.ts +110 -0
  265. package/dist/deploy/site/static-publish/credentials.js +290 -0
  266. package/dist/deploy/site/static-publish/domain-publish-rows.d.ts +25 -0
  267. package/dist/deploy/site/static-publish/domain-publish-rows.js +43 -0
  268. package/dist/deploy/site/static-publish/domain-publish-tool.d.ts +19 -0
  269. package/dist/deploy/site/static-publish/domain-publish-tool.js +111 -0
  270. package/dist/deploy/site/static-publish/inspection.d.ts +24 -0
  271. package/dist/deploy/site/static-publish/inspection.js +69 -0
  272. package/dist/deploy/site/static-publish/publish-history.d.ts +197 -0
  273. package/dist/deploy/site/static-publish/publish-history.js +153 -0
  274. package/dist/deploy/site/static-publish/publish-run.d.ts +156 -0
  275. package/dist/deploy/site/static-publish/publish-run.js +186 -0
  276. package/dist/deploy/site/static-publish/types.d.ts +165 -0
  277. package/dist/deploy/site/static-publish/types.js +2 -0
  278. package/dist/deploy/site/static-publish/verify.d.ts +217 -0
  279. package/dist/deploy/site/static-publish/verify.js +248 -0
  280. package/dist/deploy/site/tool-registrations.d.ts +97 -0
  281. package/dist/deploy/site/tool-registrations.js +130 -0
  282. package/dist/deploy/site/types.d.ts +51 -0
  283. package/dist/deploy/site/types.js +2 -0
  284. package/dist/deploy/site-update/check-for-update.d.ts +19 -0
  285. package/dist/deploy/site-update/check-for-update.js +19 -0
  286. package/dist/deploy/site-update/contracts.d.ts +161 -0
  287. package/dist/deploy/site-update/contracts.js +94 -0
  288. package/dist/deploy/site-update/desktop-site-update.d.ts +66 -0
  289. package/dist/deploy/site-update/desktop-site-update.js +43 -0
  290. package/dist/deploy/site-update/fake-site-update.d.ts +39 -0
  291. package/dist/deploy/site-update/fake-site-update.js +52 -0
  292. package/dist/deploy/site-update/run-site-update.d.ts +121 -0
  293. package/dist/deploy/site-update/run-site-update.js +219 -0
  294. package/dist/deploy/site-update/self-hosted-site-update.d.ts +71 -0
  295. package/dist/deploy/site-update/self-hosted-site-update.js +79 -0
  296. package/dist/deploy/target-contracts.d.ts +3 -0
  297. package/dist/deploy/tool.d.ts +5 -8
  298. package/dist/deploy/tool.js +6 -9
  299. package/dist/dns/binding-sweeper.d.ts +72 -0
  300. package/dist/dns/binding-sweeper.js +53 -0
  301. package/dist/dns/index.d.ts +1 -0
  302. package/dist/dns/index.js +1 -0
  303. package/dist/dns/site/binding.repo.d.ts +71 -0
  304. package/dist/dns/site/binding.repo.js +45 -0
  305. package/dist/dns/site/dns-changes.d.ts +90 -0
  306. package/dist/dns/site/dns-changes.js +271 -0
  307. package/dist/dns/site/dns-tools.d.ts +46 -0
  308. package/dist/dns/site/dns-tools.js +204 -0
  309. package/dist/dns/site/mail-dns-status.d.ts +111 -0
  310. package/dist/dns/site/mail-dns-status.js +190 -0
  311. package/dist/dns/site/mail-dns-tools.d.ts +33 -0
  312. package/dist/dns/site/mail-dns-tools.js +62 -0
  313. package/dist/dns/site/mail-requirements.d.ts +30 -0
  314. package/dist/dns/site/mail-requirements.js +78 -0
  315. package/dist/dns/site/tool-deps.d.ts +21 -0
  316. package/dist/dns/site/tool-deps.js +2 -0
  317. package/dist/dns/site/tools.d.ts +74 -0
  318. package/dist/dns/site/tools.js +124 -0
  319. package/dist/local-dev/bind-host.d.ts +80 -0
  320. package/dist/local-dev/bind-host.js +90 -0
  321. package/dist/local-dev/dev-proxy-upstream.d.ts +69 -0
  322. package/dist/local-dev/dev-proxy-upstream.js +63 -0
  323. package/dist/local-dev/index.d.ts +28 -0
  324. package/dist/local-dev/index.js +25 -0
  325. package/dist/packaging/electron/archive.d.ts +2 -9
  326. package/dist/packaging/electron/asar-adapter.d.ts +2 -1
  327. package/dist/packaging/electron/entry.d.ts +2 -0
  328. package/dist/packaging/electron/move-to-applications.d.ts +165 -0
  329. package/dist/packaging/electron/move-to-applications.js +162 -0
  330. package/dist/packaging/electron/policies.d.ts +33 -4
  331. package/dist/packaging/electron/policies.js +29 -10
  332. package/dist/packaging/electron/ports.d.ts +1 -6
  333. package/dist/packaging/electron/staging.d.ts +11 -2
  334. package/dist/packaging/electron/staging.js +15 -5
  335. package/dist/react/site-share-expiry/ShareExpiryControls.d.ts +29 -0
  336. package/dist/react/site-share-expiry/ShareExpiryControls.js +7 -0
  337. package/dist/react/site-share-expiry/index.d.ts +2 -0
  338. package/dist/react/site-share-expiry/index.js +2 -0
  339. package/dist/source-control/react/ProvidersTab.d.ts +98 -0
  340. package/dist/source-control/react/ProvidersTab.js +195 -0
  341. package/dist/source-control/react/SourceControl.d.ts +51 -0
  342. package/dist/source-control/react/SourceControl.js +61 -0
  343. package/dist/source-control/react/hooks/use-source-control-credentials.hooks.d.ts +128 -0
  344. package/dist/source-control/react/hooks/use-source-control-credentials.hooks.js +102 -0
  345. package/dist/source-control/react/rules.d.ts +167 -0
  346. package/dist/source-control/react/rules.js +125 -0
  347. package/dist/source-control/react/source-control-visuals.d.ts +75 -0
  348. package/dist/source-control/react/source-control-visuals.js +48 -0
  349. package/dist/source-control/site/agent-tools.d.ts +5 -0
  350. package/dist/source-control/site/agent-tools.js +30 -0
  351. package/dist/source-control/site/bundled-provider-registry.d.ts +33 -0
  352. package/dist/source-control/site/bundled-provider-registry.js +37 -0
  353. package/dist/source-control/site/commit-schema.d.ts +40 -0
  354. package/dist/source-control/site/commit-schema.js +29 -0
  355. package/dist/source-control/site/commit-target.d.ts +26 -0
  356. package/dist/source-control/site/commit-target.js +58 -0
  357. package/dist/source-control/site/credential-form.d.ts +36 -0
  358. package/dist/source-control/site/credential-form.js +102 -0
  359. package/dist/source-control/site/credential-setup.d.ts +107 -0
  360. package/dist/source-control/site/credential-setup.js +216 -0
  361. package/dist/source-control/site/provider-kit.d.ts +37 -0
  362. package/dist/source-control/site/provider-kit.js +35 -0
  363. package/dist/source-control/site/provider-module.d.ts +251 -0
  364. package/dist/source-control/site/provider-module.js +2 -0
  365. package/dist/source-control/site/saved-key-bindings.d.ts +4 -0
  366. package/dist/source-control/site/saved-key-bindings.js +4 -0
  367. package/dist/source-control/site/static-site-packager-port.d.ts +37 -0
  368. package/dist/source-control/site/static-site-packager-port.js +2 -0
  369. package/dist/source-control/site/store.d.ts +209 -0
  370. package/dist/source-control/site/store.js +374 -0
  371. package/dist/source-control/site/store.validation.d.ts +72 -0
  372. package/dist/source-control/site/store.validation.js +168 -0
  373. package/dist/source-control/site/tool-registrations.d.ts +190 -0
  374. package/dist/source-control/site/tool-registrations.js +379 -0
  375. package/dist/static-export/site/export-preflight.d.ts +48 -0
  376. package/dist/static-export/site/export-preflight.js +82 -0
  377. package/dist/static-export/site/media-original-urls.d.ts +57 -0
  378. package/dist/static-export/site/media-original-urls.js +109 -0
  379. package/dist/static-export/site/ports.d.ts +82 -0
  380. package/dist/static-export/site/ports.js +29 -0
  381. package/dist/static-export/site/public-origin-policy.d.ts +32 -0
  382. package/dist/static-export/site/public-origin-policy.js +68 -0
  383. package/dist/static-export/site/route-manifest.d.ts +65 -0
  384. package/dist/static-export/site/route-manifest.js +139 -0
  385. package/dist/static-export/site/site-exporter.d.ts +158 -0
  386. package/dist/static-export/site/site-exporter.js +112 -0
  387. package/dist/static-export/site/static-security-headers.d.ts +39 -0
  388. package/dist/static-export/site/static-security-headers.js +43 -0
  389. package/dist/static-export/site/theme-preview-manifest.d.ts +35 -0
  390. package/dist/static-export/site/theme-preview-manifest.js +28 -0
  391. package/package.json +912 -8
@@ -0,0 +1,236 @@
1
+ import { createHash } from "node:crypto";
2
+ import { SiteShareRefusal } from "./share-refusal.js";
3
+ import { sharePathAlias } from "./share-file-policy.js";
4
+ import { ARCHIVE_MANIFEST_PATH as SITE_BACKUP_MANIFEST_PATH, ARCHIVE_DATABASE_PATH as SITE_BACKUP_DATABASE_PATH, requireArchiveFileRecord } from "./archive-manifest.js";
5
+ import { SAVED_KEYS_PATH } from "./saved-keys-port.js";
6
+ import { isStaticSitePath } from "./static-copy.js";
7
+ export function refuseArchive({ message }, _optional = {}) { throw new SiteShareRefusal({ code: "INVALID_ARCHIVE", message }); }
8
+ /** Hex SHA-256 of a whole buffer. O(bytes). */
9
+ export function sha256Hex({ bytes }, _optional = {}) { return createHash("sha256").update(bytes).digest("hex"); }
10
+ /**
11
+ * First pass, metadata only: refuses links/special entries and enforces the entry cap, reads only
12
+ * the one manifest (bounded), then claims every entry path, refusing collisions, invalid declared
13
+ * sizes and the declared-size caps. ZIP ordering is never trusted; the manifest may appear anywhere.
14
+ * @throws SiteShareRefusal (INVALID_ARCHIVE, UNSAFE_PATH, LIMIT_EXCEEDED) or the signal's reason.
15
+ * @complexity O(entries × path depth + manifest bytes), at most 2,000 entries.
16
+ */
17
+ export async function scanArchiveMetadata(required, optional = {}) {
18
+ const claims = { aliases: new Map(), fileAliases: new Set(), directories: new Set(), sizes: [] };
19
+ const entries = [];
20
+ let count = 0;
21
+ for await (const entry of required.reader.entries({ archive: required.archive })) {
22
+ optional.signal?.throwIfAborted();
23
+ count++;
24
+ if (count > required.host.limits.maxFiles)
25
+ refuseArchive({ message: "Import exceeds the 2,000-entry cap." });
26
+ const name = entry.entryPath.replace(/\/$/, "");
27
+ validateRawEntry({ entry, name, host: required.host });
28
+ if (!ignoredArchivePath({ path: name }))
29
+ entries.push(entry);
30
+ }
31
+ const wrapper = sharedWrapperFolder({ entries });
32
+ const manifestBytes = await readManifest({ archive: required.archive, reader: required.reader, maxBytes: required.host.limits.maxManifestBytes, path: wrapper + SITE_BACKUP_MANIFEST_PATH }, optional);
33
+ claimNormalizedEntries({ entries, claims, wrapper, host: required.host });
34
+ return { manifestBytes, wrapper, fileAliases: claims.fileAliases, directories: claims.directories };
35
+ }
36
+ /**
37
+ * The Finder wrapper is the one top-level folder that holds every entry; any root file (the root
38
+ * manifest included) or a second top-level folder means there is no wrapper. Deciding it from the
39
+ * whole tree, never from where a `manifest.json` sits, keeps a media file named `manifest.json`
40
+ * from passing for a wrapped manifest. O(entries).
41
+ */
42
+ function sharedWrapperFolder(required) {
43
+ const tops = new Set(required.entries.map(entry => {
44
+ const parts = entry.entryPath.replace(/\/$/, "").split("/");
45
+ return parts.length > 1 || entry.kind === "directory" ? parts[0] : "";
46
+ }));
47
+ const [top] = tops;
48
+ return tops.size === 1 && top ? top + "/" : "";
49
+ }
50
+ /** A separate pass for the manifest alone: the reader closes the ZIP when an iteration ends, so
51
+ * the bounded read must be awaited inside it before iterator cleanup closes the stream. */
52
+ async function readManifest(required, optional) {
53
+ for await (const entry of required.reader.entries({ archive: required.archive })) {
54
+ optional.signal?.throwIfAborted();
55
+ if (entry.kind === "file" && entry.entryPath === required.path)
56
+ return await readBounded({ entry, maxBytes: required.maxBytes, signal: optional.signal });
57
+ }
58
+ return refuseArchive({ message: "A v2 manifest.json at root, or inside one wrapper folder with nothing outside it, is required." });
59
+ }
60
+ /** Finder metadata is discarded identically in both passes, without decompressing it. */
61
+ export function ignoredArchivePath(required, _optional = {}) {
62
+ return required.path.split("/").some(part => part === "__MACOSX" || part === ".DS_Store");
63
+ }
64
+ function stripArchiveWrapper(required) {
65
+ if (!required.path.startsWith(required.wrapper))
66
+ refuseArchive({ message: "Files outside the single wrapper folder are forbidden." });
67
+ const path = required.path.slice(required.wrapper.length);
68
+ required.host.validateSharePath({ path: path.replace(/\/$/, "") });
69
+ return path;
70
+ }
71
+ /** Claims one entry; returns it when it is a file, `undefined` for a directory. */
72
+ function claimEntry(required) {
73
+ const { claims, entry, host } = required;
74
+ if (entry.kind !== "file" && entry.kind !== "directory")
75
+ refuseArchive({ message: "ZIP links and special entries are forbidden." });
76
+ if (entry.kind === "directory") {
77
+ claimDirectory({ claims, name: entry.entryPath.replace(/\/$/, ""), host });
78
+ return undefined;
79
+ }
80
+ claimFile({ claims, entry, host });
81
+ return entry;
82
+ }
83
+ function claimDirectory(required) {
84
+ const { claims, name } = required;
85
+ required.host.claimSharePath({ path: name, directory: true, aliases: claims.aliases, files: claims.fileAliases });
86
+ if (claims.directories.has(name) || claims.fileAliases.has(sharePathAlias({ path: name })))
87
+ refuseArchive({ message: "Duplicate directory or file/directory collision." });
88
+ claims.directories.add(name);
89
+ }
90
+ function claimFile(required) {
91
+ const { claims, entry } = required;
92
+ const name = entry.entryPath;
93
+ required.host.claimSharePath({ path: name, directory: false, aliases: claims.aliases, files: claims.fileAliases });
94
+ if (claims.directories.has(name))
95
+ refuseArchive({ message: "ZIP file/directory collision." });
96
+ const size = entry.declaredSize;
97
+ if (typeof size !== "number" || !Number.isSafeInteger(size) || size < 0)
98
+ refuseArchive({ message: "ZIP has an invalid declared size." });
99
+ claims.sizes.push({ path: name, bytes: size });
100
+ required.host.checkShareLimits({ files: claims.sizes });
101
+ }
102
+ /**
103
+ * Parses the manifest and refuses anything but this build's exact share identity.
104
+ * @throws SiteShareRefusal INVALID_ARCHIVE for invalid JSON or an unsupported identity.
105
+ * @complexity O(manifest bytes).
106
+ */
107
+ export function parseShareManifest(required) {
108
+ return required.host.parseArchiveManifest({ bytes: required.manifestBytes, schema: required.schema });
109
+ }
110
+ /**
111
+ * Validates every manifest record and keys it by exact path. Only the projected database and the
112
+ * recognised portable roots/settings files may be listed; known private paths refuse.
113
+ * @throws SiteShareRefusal (INVALID_ARCHIVE, UNSAFE_PATH, UNSAFE_FILE).
114
+ * @complexity O(records × path length).
115
+ */
116
+ export function buildManifestInventory(required) {
117
+ const inventory = new Map();
118
+ for (const record of required.files) {
119
+ if (typeof record?.path === "string" && isStaticSitePath({ path: record.path }))
120
+ continue;
121
+ const file = requireArchiveFileRecord({ file: record });
122
+ required.host.validateSharePath({ path: file.path });
123
+ if (inventory.has(file.path) || file.path === SITE_BACKUP_MANIFEST_PATH)
124
+ refuseArchive({ message: "Duplicate manifest file." });
125
+ if (refusedInventoryPath({ path: file.path, host: required.host }))
126
+ refuseArchive({ message: "Unrecognized or private file in share inventory." });
127
+ inventory.set(file.path, file);
128
+ }
129
+ return inventory;
130
+ }
131
+ function refusedInventoryPath({ path, host }, _optional = {}) {
132
+ if (path === SITE_BACKUP_DATABASE_PATH || path === SAVED_KEYS_PATH)
133
+ return false;
134
+ const scanPath = host.archiveSecretScanPath({ path, plugins: [] });
135
+ const privateRuntime = host.excludedSharePath({ path: scanPath });
136
+ return privateRuntime || !host.inventoryRoots.test(path) && !host.settingsFiles.includes(path);
137
+ }
138
+ /**
139
+ * The archive holds exactly the manifest plus one file per record (counted by alias), the database
140
+ * is listed, and every directory entry has a listed file below it.
141
+ * @complexity O(directories × records).
142
+ */
143
+ export function checkArchiveMatchesInventory(required) {
144
+ const { inventory } = required;
145
+ if (inventory.size + 1 !== required.fileAliases.size || !inventory.has(SITE_BACKUP_DATABASE_PATH))
146
+ refuseArchive({ message: "ZIP inventory differs from the manifest." });
147
+ for (const dir of required.directories)
148
+ if (![...inventory.keys()].some(file => file.startsWith(dir + "/")))
149
+ refuseArchive({ message: "Unlisted ZIP directory." });
150
+ }
151
+ /**
152
+ * Second pass: reads every listed file under its manifest size and the remaining expanded budget,
153
+ * checks its SHA-256, and secret-scans everything except the database (the sanitizer owns that).
154
+ * @throws SiteShareRefusal (INVALID_ARCHIVE) or the signal's reason.
155
+ * @complexity O(payload bytes), at most 300 MiB buffered.
156
+ */
157
+ export async function readListedFiles(required, optional = {}) {
158
+ const files = new Map();
159
+ let expanded = required.manifestBytes.length;
160
+ for await (const entry of required.reader.entries({ archive: required.archive })) {
161
+ if (entry.kind !== "file" || ignoredArchivePath({ path: entry.entryPath }))
162
+ continue;
163
+ const entryPath = stripArchiveWrapper({ path: entry.entryPath, wrapper: required.wrapper ?? "", host: required.host });
164
+ if (isStaticSitePath({ path: entryPath }))
165
+ continue;
166
+ if (entryPath !== SITE_BACKUP_MANIFEST_PATH) {
167
+ const content = await readListedFile({ entry: { ...entry, entryPath }, inventory: required.inventory, remainingBytes: required.host.limits.maxExpandedBytes - expanded, manifest: required.manifest, modified: required.modified, host: required.host }, optional);
168
+ expanded += content.length;
169
+ retainListedFile({ path: entryPath, content, files, plugins: required.manifest?.plugins ?? [], host: required.host }, optional);
170
+ }
171
+ }
172
+ return files;
173
+ }
174
+ /** Integrity has already passed. Optional ciphertext and projected SQLite have separate owners. */
175
+ function retainListedFile(required, optional = {}) {
176
+ const structured = required.path === SITE_BACKUP_DATABASE_PATH || required.path === SAVED_KEYS_PATH;
177
+ if (!structured)
178
+ required.host.requireShareSecretFree({ path: required.host.archiveSecretScanPath({ path: required.path, plugins: required.plugins }), bytes: required.content }, { ...optional, shownPath: required.path });
179
+ required.files.set(required.path, required.content);
180
+ }
181
+ async function readListedFile(required, optional) {
182
+ const { entry } = required;
183
+ const expected = required.inventory.get(entry.entryPath);
184
+ if (!expected)
185
+ refuseArchive({ message: "Unlisted ZIP file." });
186
+ const unit = required.host.archiveCodeUnit({ path: entry.entryPath });
187
+ if (!unit && expected.bytes !== entry.declaredSize)
188
+ refuseArchive({ message: "ZIP size mismatch." });
189
+ if (typeof entry.declaredSize !== "number" || !Number.isSafeInteger(entry.declaredSize) || entry.declaredSize < 0)
190
+ refuseArchive({ message: "ZIP has an invalid declared size." });
191
+ const content = await readBounded({ entry, maxBytes: Math.min(entry.declaredSize, required.remainingBytes), signal: optional.signal });
192
+ verifyListedIntegrity({ content, expected, unit, modified: required.modified, message: required.host.changedArchiveMessage });
193
+ return content;
194
+ }
195
+ /** Count decompressed bytes before retaining each chunk; metadata is never a memory budget. */
196
+ async function readBounded(required) {
197
+ const chunks = [];
198
+ let size = 0;
199
+ for await (const chunk of required.entry.openReadStream({})) {
200
+ required.signal?.throwIfAborted();
201
+ size += chunk.length;
202
+ if (size > required.maxBytes)
203
+ refuseArchive({ message: "Expanded ZIP bytes exceed the manifest or archive cap (possible ZIP bomb)." });
204
+ chunks.push(Buffer.from(chunk));
205
+ }
206
+ if (size !== required.entry.declaredSize)
207
+ refuseArchive({ message: "ZIP declared and actual size differ." });
208
+ return Buffer.concat(chunks, size);
209
+ }
210
+ function validateRawEntry(required) {
211
+ // Validate traversal/aliases even on ignored metadata. Its known OS name and the database
212
+ // extension are placeholders only during the pre-strip path check, never extraction paths.
213
+ required.host.validateSharePath({ path: required.name.split("/").map(part => part === ".DS_Store" ? "finder-metadata" : part).join("/").replace(/(^|\/)content\.db$/, "$1content-database") });
214
+ if (required.entry.kind !== "file" && required.entry.kind !== "directory")
215
+ refuseArchive({ message: "ZIP links and special entries are forbidden." });
216
+ }
217
+ function claimNormalizedEntries(required) {
218
+ const { entries, claims, wrapper } = required;
219
+ for (const entry of entries) {
220
+ if (entry.kind === "directory" && entry.entryPath.replace(/\/$/, "") === wrapper.slice(0, -1))
221
+ continue;
222
+ const entryPath = stripArchiveWrapper({ path: entry.entryPath, wrapper, host: required.host });
223
+ if (isStaticSitePath({ path: entryPath.replace(/\/$/, "") }))
224
+ continue;
225
+ claimEntry({ claims, entry: { ...entry, entryPath }, host: required.host });
226
+ }
227
+ }
228
+ /** Editable code changes disable their entire unit; data integrity failures always refuse. */
229
+ function verifyListedIntegrity(required) {
230
+ if (required.content.length === required.expected.bytes && sha256Hex({ bytes: required.content }) === required.expected.sha256)
231
+ return;
232
+ if (!required.unit || !required.modified)
233
+ refuseArchive({ message: required.message });
234
+ required.modified.add(required.unit);
235
+ }
236
+ //# sourceMappingURL=import-verifier-inventory.js.map
@@ -0,0 +1,78 @@
1
+ /** The slice of the verified manifest this step reads: the archive's media copies. */
2
+ export interface ProjectionManifest {
3
+ readonly media: readonly {
4
+ readonly path: string;
5
+ readonly sha256: string;
6
+ }[];
7
+ }
8
+ /** One media row of the sanitizer's rebuilt database. */
9
+ export interface ProjectionMedia {
10
+ readonly storageKey: string;
11
+ readonly sha256?: string | undefined;
12
+ readonly destinationStorageKey?: string | undefined;
13
+ }
14
+ /** One Library document row of the sanitizer's rebuilt database. */
15
+ export interface ProjectionDocument {
16
+ readonly storageKey: string;
17
+ readonly sha256: string;
18
+ readonly originalFilename: string;
19
+ }
20
+ /** The slice of the sanitizer's projection this step reconciles against the archive files. */
21
+ export interface ShareProjection {
22
+ readonly media: readonly ProjectionMedia[];
23
+ readonly documents?: readonly ProjectionDocument[] | undefined;
24
+ }
25
+ /** The upload policy a Library document must pass; resolves when admitted, throws when refused. */
26
+ export type DocumentAdmission = (required: {
27
+ filename: string;
28
+ bytes: Buffer;
29
+ }) => Promise<unknown>;
30
+ /** Host rules and refusals the projection step cannot own. */
31
+ export interface ProjectionDeps {
32
+ /** The share path policy; throws on an unsafe path. */
33
+ validateSharePath(required: {
34
+ path: string;
35
+ }): void;
36
+ /** Throws the host's archive refusal with this message. */
37
+ refuseArchive: (required: {
38
+ message: string;
39
+ }) => never;
40
+ sha256Hex(required: {
41
+ bytes: Buffer;
42
+ }): string;
43
+ /** Builds the host's default document upload policy (bounded document archive reader included). */
44
+ createDocumentAdmission(): DocumentAdmission;
45
+ }
46
+ /**
47
+ * @file The database half of `verifySiteImport`: after the isolated sanitizer rebuilt the database,
48
+ * reconcile the verified archive files with what that database references. Mutates only the
49
+ * caller's `files` map, and only after every refusal check for that step passed.
50
+ */
51
+ /**
52
+ * Prunes excluded blobs, refuses unreferenced uploads, checks every referenced media and document
53
+ * blob, then applies the sanitizer's destination remaps.
54
+ * @throws SiteShareRefusal (INVALID_ARCHIVE, UNSAFE_PATH) or the signal's reason.
55
+ * @complexity O(files + media + documents × document validation).
56
+ */
57
+ export declare function applyShareProjection(required: {
58
+ files: Map<string, Buffer>;
59
+ projection: ShareProjection;
60
+ manifest: ProjectionManifest;
61
+ deps: ProjectionDeps;
62
+ }, optional?: {
63
+ signal?: AbortSignal;
64
+ }): Promise<void>;
65
+ /**
66
+ * Every projected Library document must have its exact blob and pass the upload policy.
67
+ * @param optional.admitDocument the upload policy port; defaults to the host's `createDocumentAdmission`
68
+ * (document ingress validation with a bounded document archive reader).
69
+ */
70
+ export declare function admitProjectedDocuments(required: {
71
+ files: ReadonlyMap<string, Buffer>;
72
+ documents: readonly ProjectionDocument[];
73
+ deps: ProjectionDeps;
74
+ }, optional?: {
75
+ signal?: AbortSignal;
76
+ admitDocument?: DocumentAdmission;
77
+ }): Promise<void>;
78
+ //# sourceMappingURL=import-verifier-projection.d.ts.map
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @file The database half of `verifySiteImport`: after the isolated sanitizer rebuilt the database,
3
+ * reconcile the verified archive files with what that database references. Mutates only the
4
+ * caller's `files` map, and only after every refusal check for that step passed.
5
+ */
6
+ /**
7
+ * Prunes excluded blobs, refuses unreferenced uploads, checks every referenced media and document
8
+ * blob, then applies the sanitizer's destination remaps.
9
+ * @throws SiteShareRefusal (INVALID_ARCHIVE, UNSAFE_PATH) or the signal's reason.
10
+ * @complexity O(files + media + documents × document validation).
11
+ */
12
+ export async function applyShareProjection(required, optional = {}) {
13
+ const { files, projection, deps } = required;
14
+ const refuseArchive = deps.refuseArchive;
15
+ placeArchiveMedia({ files, projection, manifest: required.manifest, deps });
16
+ const referencedMedia = new Set(projection.media.map(media => "uploads/" + media.storageKey));
17
+ for (const file of files.keys())
18
+ if (file.startsWith("uploads/") && !referencedMedia.has(file))
19
+ refuseArchive({ message: "Unreferenced uploads are outside the portable share media policy." });
20
+ checkProjectedMedia({ files, projection, deps });
21
+ await admitProjectedDocuments({ files, documents: projection.documents ?? [], deps }, optional);
22
+ applyDestinationMoves({ files, media: projection.media, deps });
23
+ }
24
+ /** The DB already points at the one public copy; only its portable archive path changes. */
25
+ function placeArchiveMedia(required) {
26
+ const { deps } = required;
27
+ const refuseArchive = deps.refuseArchive;
28
+ const byHash = new Map();
29
+ for (const media of required.projection.media) {
30
+ if (media.sha256)
31
+ byHash.set(media.sha256, [...(byHash.get(media.sha256) ?? []), media.storageKey]);
32
+ }
33
+ for (const copy of required.manifest.media) {
34
+ const keys = byHash.get(copy.sha256);
35
+ const bytes = required.files.get(copy.path);
36
+ if (!keys || !bytes)
37
+ refuseArchive({ message: "Archive media is not referenced by the projected database." });
38
+ for (const key of keys) {
39
+ deps.validateSharePath({ path: "uploads/" + key });
40
+ required.files.set("uploads/" + key, bytes);
41
+ }
42
+ required.files.delete(copy.path);
43
+ }
44
+ }
45
+ function checkProjectedMedia(required) {
46
+ const { deps } = required;
47
+ const refuseArchive = deps.refuseArchive;
48
+ const documentKeys = new Set(required.projection.documents?.map(document => document.storageKey));
49
+ for (const media of required.projection.media) {
50
+ deps.validateSharePath({ path: "uploads/" + media.storageKey });
51
+ const content = required.files.get("uploads/" + media.storageKey);
52
+ if (!content || media.sha256 && deps.sha256Hex({ bytes: content }) !== media.sha256)
53
+ refuseArchive({ message: documentKeys.has(media.storageKey) ? "Referenced document blob is missing or corrupt." : "Referenced media is missing or failed its hash." });
54
+ }
55
+ }
56
+ /**
57
+ * Every projected Library document must have its exact blob and pass the upload policy.
58
+ * @param optional.admitDocument the upload policy port; defaults to the host's `createDocumentAdmission`
59
+ * (document ingress validation with a bounded document archive reader).
60
+ */
61
+ export async function admitProjectedDocuments(required, optional = {}) {
62
+ const { deps } = required;
63
+ const refuseArchive = deps.refuseArchive;
64
+ const admitDocument = optional.admitDocument ?? deps.createDocumentAdmission();
65
+ for (const document of required.documents) {
66
+ optional.signal?.throwIfAborted();
67
+ const content = required.files.get("uploads/" + document.storageKey);
68
+ if (!content || deps.sha256Hex({ bytes: content }) !== document.sha256)
69
+ refuseArchive({ message: "Referenced document blob is missing or corrupt." });
70
+ // A valid outer ZIP checksum cannot grant document admission. Reuse upload policy,
71
+ // including bounded DOCX package validation, before staging or creating the new site.
72
+ try {
73
+ await admitDocument({ filename: document.originalFilename, bytes: content });
74
+ }
75
+ catch (error) {
76
+ refuseArchive({ message: `Invalid Library document: ${error instanceof Error ? error.message : "document ingress rejected"}` });
77
+ }
78
+ }
79
+ }
80
+ /**
81
+ * The isolated DB owner has already remapped document keys to the new workspace. Move only
82
+ * fully verified bytes, once per source key, and refuse any conflicting destination claim.
83
+ */
84
+ function applyDestinationMoves(required) {
85
+ const { files, deps } = required;
86
+ const refuseArchive = deps.refuseArchive;
87
+ const moves = new Map(required.media.filter(media => media.destinationStorageKey && media.destinationStorageKey !== media.storageKey).map(media => ["uploads/" + media.storageKey, "uploads/" + media.destinationStorageKey]));
88
+ for (const [source, destination] of moves) {
89
+ deps.validateSharePath({ path: destination });
90
+ const bytes = files.get(source);
91
+ if (bytes === undefined)
92
+ refuseArchive({ message: "Imported document blob is missing." });
93
+ const existing = files.get(destination);
94
+ if (existing !== undefined && !existing.equals(bytes))
95
+ refuseArchive({ message: "Conflicting imported document blob keys." });
96
+ files.set(destination, bytes);
97
+ files.delete(source);
98
+ }
99
+ }
100
+ //# sourceMappingURL=import-verifier-projection.js.map
@@ -0,0 +1,126 @@
1
+ import type { ArchivePlugin } from "./archive-manifest.js";
2
+ import { type CredentialWarning, type CredentialRedactor } from "./credential-warnings.js";
3
+ import type { PackageFileInventory } from "./share-file-policy.js";
4
+ import type { AgentPluginArchiveReaderPort } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
5
+ /** The database projection the host sanitizer returns; the full value travels on to `applyShareProjection`. */
6
+ export interface SiteImportProjection {
7
+ readonly bytes: Buffer;
8
+ readonly notices?: readonly string[] | undefined;
9
+ readonly credentialWarnings?: readonly CredentialWarning[] | undefined;
10
+ }
11
+ /** The parsed manifest fields this verifier reads; the host's manifest value is passed through whole. */
12
+ export interface SiteImportManifest {
13
+ readonly files: unknown;
14
+ readonly plugins: readonly ArchivePlugin[];
15
+ readonly site: {
16
+ readonly name: string;
17
+ };
18
+ }
19
+ type ScanResult = {
20
+ manifestBytes: unknown;
21
+ fileAliases: unknown;
22
+ directories: unknown;
23
+ wrapper: unknown;
24
+ };
25
+ type VerifyOptional = {
26
+ signal?: AbortSignal | undefined;
27
+ packageFiles?: PackageFileInventory | undefined;
28
+ bundledImportPluginIds?: ReadonlySet<string> | undefined;
29
+ };
30
+ /** Host archive inventory, path mapping, limits and redaction. Every member is REQUIRED. */
31
+ export interface SiteImportVerifierHost {
32
+ redactSecretShapes: CredentialRedactor;
33
+ readonly maxArchiveBytes: number;
34
+ readonly archiveTooLargeMessage: string;
35
+ checkShareLimits(required: {
36
+ files: readonly {
37
+ path: string;
38
+ bytes: number;
39
+ }[];
40
+ }): void;
41
+ refuseArchive(required: {
42
+ message: string;
43
+ }): never;
44
+ scanArchiveMetadata(required: {
45
+ archive: Buffer;
46
+ reader: AgentPluginArchiveReaderPort;
47
+ }, optional: VerifyOptional): Promise<ScanResult>;
48
+ parseShareManifest(required: {
49
+ manifestBytes: unknown;
50
+ schema: {
51
+ index: number;
52
+ tag: string;
53
+ };
54
+ }): SiteImportManifest;
55
+ buildManifestInventory(required: {
56
+ files: unknown;
57
+ }): unknown;
58
+ checkArchiveMatchesInventory(required: {
59
+ inventory: unknown;
60
+ fileAliases: unknown;
61
+ directories: unknown;
62
+ }): void;
63
+ readListedFiles(required: {
64
+ archive: Buffer;
65
+ reader: AgentPluginArchiveReaderPort;
66
+ inventory: unknown;
67
+ manifestBytes: unknown;
68
+ wrapper: unknown;
69
+ manifest: SiteImportManifest;
70
+ modified: Set<string>;
71
+ }, optional: VerifyOptional & {
72
+ packageFiles: PackageFileInventory;
73
+ credentialWarnings: CredentialWarning[];
74
+ }): Promise<Map<string, Buffer>>;
75
+ sha256Hex(required: {
76
+ bytes: Buffer;
77
+ }): string;
78
+ applyShareProjection(required: {
79
+ files: Map<string, Buffer>;
80
+ projection: SiteImportProjection;
81
+ manifest: SiteImportManifest;
82
+ }, optional: VerifyOptional): Promise<void>;
83
+ readBundledPackageFiles(): Promise<PackageFileInventory>;
84
+ archiveToRuntimePath(required: {
85
+ path: string;
86
+ files: ReadonlyMap<string, Buffer>;
87
+ }): string;
88
+ editedArchiveWarnings(required: {
89
+ units: Iterable<string>;
90
+ }): string[];
91
+ }
92
+ export interface VerifiedSiteImport {
93
+ encryptedKeys?: Buffer;
94
+ name: string;
95
+ database: Buffer;
96
+ files: Map<string, Buffer>;
97
+ warnings: string[];
98
+ credentialWarnings?: readonly CredentialWarning[];
99
+ modified: ReadonlySet<string>;
100
+ plugins: readonly ArchivePlugin[];
101
+ trustedPlugins: readonly ArchivePlugin[];
102
+ }
103
+ /** Read the bounded root manifest in a metadata-only first pass; never trust ZIP ordering.
104
+ * Then verify the exact inventory and hashes, count actual expanded bytes, and ask the isolated
105
+ * database adapter to rebuild through A's SAME sanitizer. No extraction occurs before success.
106
+ * @throws SiteShareRefusal for malformed, unsupported, incomplete or oversized archives.
107
+ * @complexity O(payload bytes + paths²), at most 2,000 paths/300 MiB; buffered archive.
108
+ */
109
+ export declare function verifySiteImport(required: {
110
+ archive: Buffer;
111
+ reader: AgentPluginArchiveReaderPort;
112
+ sanitize: (required: {
113
+ snapshot: Buffer;
114
+ }, optional: {
115
+ signal?: AbortSignal | undefined;
116
+ }) => Promise<SiteImportProjection>;
117
+ schema: {
118
+ index: number;
119
+ tag: string;
120
+ };
121
+ host: SiteImportVerifierHost;
122
+ }, optional?: VerifyOptional): Promise<VerifiedSiteImport & {
123
+ credentialWarnings: readonly CredentialWarning[];
124
+ }>;
125
+ export {};
126
+ //# sourceMappingURL=import-verifier.d.ts.map
@@ -0,0 +1,53 @@
1
+ import { ARCHIVE_DATABASE_PATH as SITE_BACKUP_DATABASE_PATH } from "./archive-manifest.js";
2
+ import { SAVED_KEYS_PATH } from "./saved-keys-port.js";
3
+ import { addCredentialWarning } from "./credential-warnings.js";
4
+ /** Read the bounded root manifest in a metadata-only first pass; never trust ZIP ordering.
5
+ * Then verify the exact inventory and hashes, count actual expanded bytes, and ask the isolated
6
+ * database adapter to rebuild through A's SAME sanitizer. No extraction occurs before success.
7
+ * @throws SiteShareRefusal for malformed, unsupported, incomplete or oversized archives.
8
+ * @complexity O(payload bytes + paths²), at most 2,000 paths/300 MiB; buffered archive.
9
+ */
10
+ export async function verifySiteImport(required, optional = {}) {
11
+ const { archive, reader, host } = required;
12
+ if (archive.length > host.maxArchiveBytes)
13
+ host.refuseArchive({ message: host.archiveTooLargeMessage });
14
+ optional.signal?.throwIfAborted();
15
+ const scan = await host.scanArchiveMetadata({ archive, reader }, optional);
16
+ const manifest = host.parseShareManifest({ manifestBytes: scan.manifestBytes, schema: required.schema });
17
+ const inventory = host.buildManifestInventory({ files: manifest.files });
18
+ host.checkArchiveMatchesInventory({ inventory, fileAliases: scan.fileAliases, directories: scan.directories });
19
+ // Byte identity still controls execution trust. Scan classification alone tolerates build skew.
20
+ const packageFiles = optional.packageFiles ?? await host.readBundledPackageFiles();
21
+ const modified = new Set();
22
+ const credentialWarnings = [];
23
+ const files = await host.readListedFiles({ archive, reader, inventory, manifestBytes: scan.manifestBytes, wrapper: scan.wrapper, manifest, modified }, { ...optional, packageFiles, credentialWarnings });
24
+ const encryptedKeys = files.get(SAVED_KEYS_PATH);
25
+ files.delete(SAVED_KEYS_PATH);
26
+ const plugins = manifest.plugins;
27
+ const trustedPlugins = plugins.filter(plugin => bundledIdentical({ plugin, files, packageFiles, modified, sha256Hex: host.sha256Hex }));
28
+ const snapshot = files.get(SITE_BACKUP_DATABASE_PATH);
29
+ if (snapshot === undefined)
30
+ return host.refuseArchive({ message: "Import archive has no content database." });
31
+ const projection = await required.sanitize({ snapshot }, { signal: optional.signal });
32
+ for (const warning of projection.credentialWarnings ?? [])
33
+ addCredentialWarning({ ...warning, credentialWarnings, redactSecretShapes: host.redactSecretShapes });
34
+ await host.applyShareProjection({ files, projection, manifest }, optional);
35
+ files.delete(SITE_BACKUP_DATABASE_PATH);
36
+ host.checkShareLimits({ files: [...files].map(([path, content]) => ({ path, bytes: content.length })).concat({ path: SITE_BACKUP_DATABASE_PATH, bytes: projection.bytes.length }) });
37
+ const runtimeFiles = new Map([...files].map(([path, bytes]) => [host.archiveToRuntimePath({ path, files }), bytes]));
38
+ const warnings = [...new Set([...(projection.notices ?? []), ...host.editedArchiveWarnings({ units: modified })])];
39
+ return { name: manifest.site.name.trim(), database: projection.bytes, files: runtimeFiles, warnings, credentialWarnings, modified, plugins, trustedPlugins, ...(encryptedKeys ? { encryptedKeys } : {}) };
40
+ }
41
+ /** A manifest digest alone grants nothing: compare the entire shipped package to this build. */
42
+ function bundledIdentical(required) {
43
+ const { plugin } = required;
44
+ if (plugin.kind !== "agent" || required.modified.has("agent-plugins/" + plugin.id))
45
+ return false;
46
+ const expected = required.packageFiles.get(plugin.digest);
47
+ if (!expected)
48
+ return false;
49
+ const prefix = `agent-plugins/${plugin.id}/package/`;
50
+ const actual = [...required.files].filter(([path]) => path.startsWith(prefix));
51
+ return actual.length === expected.size && actual.every(([path, bytes]) => expected.get(path.slice(prefix.length)) === required.sha256Hex({ bytes }));
52
+ }
53
+ //# sourceMappingURL=import-verifier.js.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A host-owned private temp root, held for the whole of `work`: the host creates it (typically lock,
3
+ * then marker, then folder), keeps it owned while `work` reads and writes inside it, and removes it
4
+ * afterwards. Injected so the host's temp-root tidy can sweep the same parent without ever seeing a
5
+ * live root as abandoned. The engine never chooses a temp parent or lock for an injected scope.
6
+ */
7
+ export type OwnedTempRootScope = <T>(required: {
8
+ work: (owned: {
9
+ root: string;
10
+ }) => Promise<T>;
11
+ }) => Promise<T>;
12
+ //# sourceMappingURL=owned-temp-root.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=owned-temp-root.js.map