@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,40 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ /**
4
+ * Wire a host byte comparison to the host's selected npm subpaths. Resolve each selected root once per
5
+ * export; read only the corresponding installed file. Custom paths and unavailable copies scan.
6
+ * @returns An export-local policy; no inventory, persistent cache, network or content mutation.
7
+ * @complexity One resolution per encountered plugin, one file read per selected package entry.
8
+ * @example const policy = createBundledExportFilePolicy({ selection, resolve, classifyBundledPluginFile }); await policy({ path, bytes });
9
+ */
10
+ export function createBundledExportFilePolicy(required, optional = {}) {
11
+ const { selection, resolve, classifyBundledPluginFile } = required;
12
+ const read = optional.readFile ?? readFile;
13
+ const roots = new Map();
14
+ const readBundledFile = async ({ pluginId, relativePath }) => {
15
+ const specifier = selection.get(pluginId);
16
+ if (!specifier)
17
+ return null;
18
+ if (!roots.has(pluginId)) {
19
+ try {
20
+ roots.set(pluginId, path.dirname(resolve(`${specifier}/plugin.json`)));
21
+ }
22
+ catch {
23
+ roots.set(pluginId, null);
24
+ }
25
+ }
26
+ const root = roots.get(pluginId);
27
+ if (root === undefined)
28
+ throw new Error(`Bundled plugin ${pluginId} has no resolved root`);
29
+ if (root === null)
30
+ return null;
31
+ return read(path.join(root, relativePath));
32
+ };
33
+ return async ({ path: archivePath, bytes }) => {
34
+ const match = /^agent-plugins\/([^/]+)\/package\/(.+)$/.exec(archivePath);
35
+ if (!match)
36
+ return 'scan';
37
+ return classifyBundledPluginFile({ pluginId: match[1], relativePath: match[2], bytes, readFile: readBundledFile });
38
+ };
39
+ }
40
+ //# sourceMappingURL=bundled-export-file-policy.js.map
@@ -0,0 +1,41 @@
1
+ /** Export/import diagnostics contain locations and classifications, never matched values. */
2
+ export interface CredentialWarning {
3
+ readonly path: string;
4
+ readonly kind: string;
5
+ }
6
+ /**
7
+ * The host's secret-shape scanner (the redaction owner). It replaces each match with a fixed
8
+ * `[REDACTED:<kind>]` marker and counts replacements; this module reads only those markers.
9
+ */
10
+ export type CredentialRedactor = (required: {
11
+ text: string;
12
+ }, optional?: {
13
+ codeAware?: boolean;
14
+ vendorOnly?: boolean;
15
+ }) => {
16
+ readonly text: string;
17
+ readonly redactions: number;
18
+ };
19
+ /** Adapt the existing redaction owner's classifications to CMS archive warnings without altering
20
+ * content. Only fixed kind labels and a redacted location leave this boundary.
21
+ * @complexity O(text bytes + accumulated warnings); duplicate table/column warnings coalesce.
22
+ */
23
+ export declare function warnCredentialContent(required: {
24
+ path: string;
25
+ text: string;
26
+ credentialWarnings: CredentialWarning[];
27
+ redactSecretShapes: CredentialRedactor;
28
+ }, optional?: {
29
+ codeAware?: boolean;
30
+ vendorOnly?: boolean;
31
+ }): void;
32
+ /** Deduplicate by safe shown location/kind. Values embedded in a filename are redacted too.
33
+ * Mutates only the operation-local warning sink; O(path bytes + accumulated warnings).
34
+ */
35
+ export declare function addCredentialWarning(required: {
36
+ path: string;
37
+ kind: string;
38
+ credentialWarnings: CredentialWarning[];
39
+ redactSecretShapes: CredentialRedactor;
40
+ }, _options?: {}): void;
41
+ //# sourceMappingURL=credential-warnings.d.ts.map
@@ -0,0 +1,50 @@
1
+ const MATCH_KINDS = {
2
+ private_key: "private key", labeled_secret: "labeled secret", auth_header: "authorization header",
3
+ high_entropy: "high entropy secret", escaped_secret: "escaped secret",
4
+ bearer_token: "bearer token", url_credentials: "URL credentials", jwt: "JSON web token",
5
+ };
6
+ /** Adapt the existing redaction owner's classifications to CMS archive warnings without altering
7
+ * content. Only fixed kind labels and a redacted location leave this boundary.
8
+ * @complexity O(text bytes + accumulated warnings); duplicate table/column warnings coalesce.
9
+ */
10
+ export function warnCredentialContent(required, optional = {}) {
11
+ const result = required.redactSecretShapes({ text: required.text }, optional);
12
+ if (!result.redactions)
13
+ return;
14
+ const original = existingMarkerCounts({ text: required.text });
15
+ const kinds = new Set();
16
+ for (const match of result.text.matchAll(/\[REDACTED:([a-z_]+)\]/g)) {
17
+ const count = original.get(match[0]) ?? 0;
18
+ if (count > 0) {
19
+ original.set(match[0], count - 1);
20
+ continue;
21
+ }
22
+ kinds.add(MATCH_KINDS[match[1]] ?? "provider key shape");
23
+ }
24
+ // A replacement can absorb an existing tag. Still warn even if no new marker survives.
25
+ if (!kinds.size)
26
+ kinds.add("credential-looking content");
27
+ for (const kind of kinds)
28
+ addCredentialWarning({ ...required, kind });
29
+ }
30
+ /** Count the redaction markers the input already held, so they are not reported as new findings.
31
+ * @complexity O(text bytes).
32
+ */
33
+ function existingMarkerCounts({ text }, _optional = {}) {
34
+ // Read only the scanner's fixed replacement vocabulary; no matched text is ever returned.
35
+ const original = new Map();
36
+ for (const match of text.matchAll(/\[REDACTED:[a-z_]+\]/g)) {
37
+ original.set(match[0], (original.get(match[0]) ?? 0) + 1);
38
+ }
39
+ return original;
40
+ }
41
+ /** Deduplicate by safe shown location/kind. Values embedded in a filename are redacted too.
42
+ * Mutates only the operation-local warning sink; O(path bytes + accumulated warnings).
43
+ */
44
+ export function addCredentialWarning(required, _options = {}) {
45
+ const path = required.redactSecretShapes({ text: required.path }).text.replace(/[\p{Cc}\p{Cf}]/gu, "");
46
+ if (!required.credentialWarnings.some(warning => warning.path === path && warning.kind === required.kind)) {
47
+ required.credentialWarnings.push({ path, kind: required.kind });
48
+ }
49
+ }
50
+ //# sourceMappingURL=credential-warnings.js.map
@@ -0,0 +1,167 @@
1
+ import type { SiteImportRecord, SiteImportSource, SiteImportView } from "@jini-ai/core/contracts/site/site-import-history";
2
+ import { type SecretRedactionOptions } from "@jini-ai/core";
3
+ import type { SiteCreationAllocation } from "@jini-ai/core/contracts/site/platform-site-dir";
4
+ import type { SiteImportRegistry } from "./import-registry.js";
5
+ /**
6
+ * @file The import backend's individual steps: input parsing, the private staging budget, the
7
+ * share download, upload consumption, interrupted-creation recovery and the public row view.
8
+ * Each takes its ports explicitly; `import-backend.ts` sequences them under the import lock.
9
+ */
10
+ /** The guarded HTTP client the share download goes through; the host binds its own egress-policed client. */
11
+ export interface ImportHttpClient {
12
+ send(required: {
13
+ method: "GET";
14
+ url: string;
15
+ headers: Record<string, string>;
16
+ idleTimeoutMs: number;
17
+ totalDeadlineMs: number;
18
+ maxResponseBytes: number;
19
+ bodyAs: "bytes";
20
+ signal: AbortSignal;
21
+ }, optional?: Record<string, never>): Promise<{
22
+ status: number;
23
+ headers: Readonly<Record<string, string>>;
24
+ bodyBytes?: Uint8Array | undefined;
25
+ bodyBytesTruncated?: boolean | undefined;
26
+ }>;
27
+ }
28
+ /** Host-owned refusal copy that quotes the host's byte limits, passed in so the limits and their wording stay together. */
29
+ export interface SiteImportCopy {
30
+ /** Refusal when the sites-home volume cannot take the import's expanded archive. */
31
+ readonly homeSpace: string;
32
+ /** Refusal when the private staging volume cannot take another payload. */
33
+ readonly stagingSpace: string;
34
+ /** Refusal when a share download fails or exceeds `maxArchiveBytes`. */
35
+ readonly downloadFailed: string;
36
+ /** Refusal when an uploaded ZIP exceeds `maxArchiveBytes`. */
37
+ readonly uploadTooLarge: string;
38
+ }
39
+ /** Host values the import steps depend on. Every member is REQUIRED: the engine carries no host defaults.
40
+ * `W` is the host's workspace handle, only ever handed back to `reconcileCreation`.
41
+ */
42
+ export interface SiteImportStepsHost<W = unknown> {
43
+ /** Largest ZIP accepted by upload or download. */
44
+ readonly maxArchiveBytes: number;
45
+ /** Largest expanded archive; free space of three times this is required before retaining payloads. */
46
+ readonly maxExpandedBytes: number;
47
+ readonly copy: SiteImportCopy;
48
+ /** The development default owner password that an import must never reuse. */
49
+ readonly developmentDefaultPassword: string;
50
+ /** Redaction policy applied to the failure text logged when an imported site cannot start. */
51
+ readonly errorLogOptions: SecretRedactionOptions;
52
+ /** The timeout, in milliseconds, when `error` is the HTTP client's timeout failure; otherwise `undefined`. */
53
+ timeoutMsOf(required: {
54
+ error: unknown;
55
+ }): number | undefined;
56
+ /** Throws when `name` cannot be a portable site folder name. */
57
+ assertPortableName(required: {
58
+ name: string;
59
+ }): void;
60
+ /** Settles an interrupted site creation against the workspace. */
61
+ reconcileCreation(required: {
62
+ allocation: SiteCreationAllocation;
63
+ workspace: W;
64
+ }): Promise<"ready" | "failed">;
65
+ }
66
+ export interface ParsedSiteImportInput {
67
+ source: SiteImportSource;
68
+ displayName?: string;
69
+ requestId?: string;
70
+ }
71
+ /** Throws the closed-contract refusal every import step reports; never returns. */
72
+ export declare function refusal({ code, message }: {
73
+ code: string;
74
+ message: string;
75
+ }, _optional?: Record<string, never>): never;
76
+ /** Source union is enforced at every remote boundary; server paths are never accepted. */
77
+ export declare function parseImportInput(required: {
78
+ input: unknown;
79
+ }): ParsedSiteImportInput;
80
+ /** Refuses when the volume holding `dir` has less than three expanded-archive caps free. */
81
+ export declare function requireFreeSpace(required: {
82
+ dir: string;
83
+ message: string;
84
+ maxExpandedBytes: number;
85
+ }): void;
86
+ /** At most four private payloads (uploads or stages) and 900 MiB free before retaining more bytes. */
87
+ export declare function requireStagingBudget(required: {
88
+ registry: SiteImportRegistry;
89
+ host: Pick<SiteImportStepsHost, "maxExpandedBytes" | "copy">;
90
+ }): void;
91
+ /** The caller's signal (when given) combined with this step's own deadline. */
92
+ export declare function deadlineSignal(required: {
93
+ timeoutMs: number;
94
+ }, optional?: {
95
+ signal?: AbortSignal;
96
+ }): AbortSignal;
97
+ /** Marks one unconsumed upload as consumed by `importId` and returns its id. */
98
+ export declare function consumeUpload(required: {
99
+ registry: SiteImportRegistry;
100
+ uploadId: string;
101
+ principalId: string;
102
+ importId: string;
103
+ }): string;
104
+ /**
105
+ * Downloads a share archive through the guarded HTTP port: a bounded identity GET whose body must
106
+ * be complete and labelled ZIP or binary.
107
+ * @complexity O(archive bytes), at most 300 MiB.
108
+ */
109
+ export declare function downloadShareArchive(required: {
110
+ http: ImportHttpClient;
111
+ url: string;
112
+ signal: AbortSignal;
113
+ host: Pick<SiteImportStepsHost, "maxArchiveBytes" | "copy" | "timeoutMsOf">;
114
+ }): Promise<Buffer>;
115
+ /**
116
+ * Only the lock holder may classify a verifying or creating row as interrupted, never a concurrent
117
+ * reader: both statuses exist only while the import lock is held, so the holder finding one means
118
+ * the previous holder crashed. A verifying row failed; a creating row with an allocation is
119
+ * reconciled against the workspace, one without it failed. Either way its stage is discarded.
120
+ */
121
+ export declare function reconcileInterruptedImports<W>(required: {
122
+ registry: SiteImportRegistry;
123
+ workspace: W;
124
+ put: (row: SiteImportRecord) => void;
125
+ host: Pick<SiteImportStepsHost<W>, "reconcileCreation">;
126
+ activeRows: (required: Record<string, never>, optional?: Record<string, never>) => SiteImportRecord[];
127
+ }, _optional?: Record<string, never>): Promise<void>;
128
+ /** A folder-safe site name from the display name; non-Latin names fall back to `imported-site`.
129
+ * @throws {ValidationError} Windows device names or trailing dots/spaces, before or after slugification.
130
+ * @complexity O(display name length), no I/O.
131
+ */
132
+ export declare function importSiteSlug(required: {
133
+ displayName: string;
134
+ host: Pick<SiteImportStepsHost, "assertPortableName">;
135
+ }, _optional?: {}): string;
136
+ /** The owner-setup gate: only a pending import, and never without a new password. */
137
+ export declare function requireOwnerSetup(required: {
138
+ row: SiteImportRecord;
139
+ adminPassword: unknown;
140
+ host: Pick<SiteImportStepsHost, "developmentDefaultPassword">;
141
+ }): void;
142
+ /** Owner and restore are committed; a start failure is recorded, never retried as a new site. */
143
+ export declare function startImportedSite(required: {
144
+ row: SiteImportRecord;
145
+ name: string;
146
+ startSite: (required: {
147
+ name: string;
148
+ }) => Promise<{
149
+ adminUrl: string | null;
150
+ }>;
151
+ host: Pick<SiteImportStepsHost, "errorLogOptions">;
152
+ }): Promise<SiteImportRecord>;
153
+ /**
154
+ * Shows a needs-owner row past its expiry as failed. Lock-free indexed reads (list, page, get,
155
+ * replay) cannot run the expiry sweep, which writes, so they project the expired state instead
156
+ * of persisting it; this is the single source of truth for that projection.
157
+ */
158
+ export declare function projectExpiredOwnerSetup({ row, nowMs }: {
159
+ row: SiteImportRecord;
160
+ nowMs: number;
161
+ }, _optional?: Record<string, never>): SiteImportRecord;
162
+ /** The public view of a stored import row. */
163
+ export declare function siteImportView(required: {
164
+ row: SiteImportRecord;
165
+ setupBase: string;
166
+ }, _optional?: Record<string, never>): SiteImportView;
167
+ //# sourceMappingURL=import-backend-steps.d.ts.map
@@ -0,0 +1,170 @@
1
+ import fs from "node:fs";
2
+ import { formatErrorForLog } from "@jini-ai/core";
3
+ import { SiteShareRefusal } from "./share-refusal.js";
4
+ /** Throws the closed-contract refusal every import step reports; never returns. */
5
+ export function refusal({ code, message }, _optional = {}) { throw new SiteShareRefusal({ code, message }); }
6
+ const INPUT_KEYS = ["url", "uploadId", "displayName", "requestId"];
7
+ const REQUEST_ID = /^[a-zA-Z0-9_-]{1,128}$/;
8
+ const UPLOAD_ID = /^[a-f0-9-]{36}$/;
9
+ const ARCHIVE_CONTENT_TYPES = ["application/zip", "application/x-zip-compressed", "application/octet-stream"];
10
+ /** Source union is enforced at every remote boundary; server paths are never accepted. */
11
+ export function parseImportInput(required) {
12
+ const input = requireSourceShape({ value: required.input });
13
+ if (input.displayName !== undefined && !isDisplayName({ value: input.displayName }))
14
+ refusal({ code: "INVALID_INPUT", message: "displayName must be 1..200 characters." });
15
+ if (input.requestId !== undefined && (typeof input.requestId !== "string" || !REQUEST_ID.test(input.requestId)))
16
+ refusal({ code: "INVALID_INPUT", message: "requestId must be 1..128 letters, digits, dashes or underscores." });
17
+ const source = input.url !== undefined ? parseUrlSource({ url: input.url }) : parseUploadSource({ uploadId: input.uploadId });
18
+ return { source, ...(input.displayName !== undefined ? { displayName: input.displayName } : {}), ...(input.requestId !== undefined ? { requestId: input.requestId } : {}) };
19
+ }
20
+ function requireSourceShape({ value }, _optional = {}) {
21
+ const input = value;
22
+ const invalidRecord = !input || typeof input !== "object" || Array.isArray(input);
23
+ if (invalidRecord || Object.keys(input).some(key => !INPUT_KEYS.includes(key)) ||
24
+ (input.url !== undefined) === (input.uploadId !== undefined))
25
+ refusal({ code: "INVALID_INPUT", message: "Provide exactly one source: url or uploadId; optional displayName and requestId only." });
26
+ return input;
27
+ }
28
+ function isDisplayName({ value }, _optional = {}) {
29
+ return typeof value === "string" && Boolean(value.trim()) && value.length <= 200;
30
+ }
31
+ function parseUrlSource(required) {
32
+ if (typeof required.url !== "string" || required.url.length > 4096)
33
+ refusal({ code: "INVALID_INPUT", message: "url must be an HTTPS share URL." });
34
+ let url;
35
+ try {
36
+ url = new URL(required.url);
37
+ }
38
+ catch {
39
+ refusal({ code: "INVALID_INPUT", message: "url must be an HTTPS share URL." });
40
+ }
41
+ if (url.protocol !== "https:" || url.username || url.password || url.hash)
42
+ refusal({ code: "INVALID_INPUT", message: "Import URLs require HTTPS without credentials or fragments." });
43
+ return { url: url.href };
44
+ }
45
+ function parseUploadSource(required) {
46
+ if (typeof required.uploadId !== "string" || !UPLOAD_ID.test(required.uploadId))
47
+ refusal({ code: "INVALID_INPUT", message: "uploadId must come from the authenticated ZIP upload endpoint." });
48
+ return { uploadId: required.uploadId };
49
+ }
50
+ /** Refuses when the volume holding `dir` has less than three expanded-archive caps free. */
51
+ export function requireFreeSpace(required) {
52
+ const space = fs.statfsSync(required.dir);
53
+ if (space.bavail * space.bsize < required.maxExpandedBytes * 3)
54
+ refusal({ code: "INSUFFICIENT_STORAGE", message: required.message });
55
+ }
56
+ /** At most four private payloads (uploads or stages) and 900 MiB free before retaining more bytes. */
57
+ export function requireStagingBudget(required) {
58
+ required.registry.expirePayloads({});
59
+ // The staging cap counts disposable payloads, not history.
60
+ const payloads = required.registry.countStagedPayloads({});
61
+ if (payloads >= 4)
62
+ refusal({ code: "BUSY", message: "Four imports are staged. Complete owner setup or wait for expiry before uploading another." });
63
+ requireFreeSpace({ dir: required.registry.payloadDirectory, message: required.host.copy.stagingSpace, maxExpandedBytes: required.host.maxExpandedBytes });
64
+ }
65
+ /** The caller's signal (when given) combined with this step's own deadline. */
66
+ export function deadlineSignal(required, optional = {}) {
67
+ return AbortSignal.any([...(optional.signal ? [optional.signal] : []), AbortSignal.timeout(required.timeoutMs)]);
68
+ }
69
+ /** Marks one unconsumed upload as consumed by `importId` and returns its id. */
70
+ export function consumeUpload(required) {
71
+ const upload = required.registry.getUpload({ uploadId: required.uploadId, principalId: required.principalId });
72
+ if (upload.consumedBy)
73
+ refusal({ code: "UPLOAD_USED", message: "This upload was already imported. Use the original requestId or upload again for a separate site." });
74
+ required.registry.saveUpload({ row: { ...upload, consumedBy: required.importId } });
75
+ return upload.uploadId;
76
+ }
77
+ /**
78
+ * Downloads a share archive through the guarded HTTP port: a bounded identity GET whose body must
79
+ * be complete and labelled ZIP or binary.
80
+ * @complexity O(archive bytes), at most 300 MiB.
81
+ */
82
+ export async function downloadShareArchive(required) {
83
+ // Keep the final minute of the import budget for verification and restore.
84
+ const response = await required.http.send({ method: "GET", url: required.url, headers: { Accept: "application/zip", "Accept-Encoding": "identity" }, idleTimeoutMs: 30_000, totalDeadlineMs: 240_000, maxResponseBytes: required.host.maxArchiveBytes, bodyAs: "bytes", signal: required.signal }).catch((error) => {
85
+ const timeoutMs = required.host.timeoutMsOf({ error });
86
+ if (timeoutMs !== undefined)
87
+ refusal({ code: "DOWNLOAD_TIMEOUT", message: `The share download from ${new URL(required.url).origin} timed out after ${timeoutMs / 1000} seconds. Download the ZIP file and import it.` });
88
+ throw error;
89
+ });
90
+ if (response.status !== 200 || !response.bodyBytes || response.bodyBytesTruncated !== false)
91
+ refusal({ code: "DOWNLOAD_FAILED", message: required.host.copy.downloadFailed });
92
+ const contentType = Object.entries(response.headers).find(([name]) => name.toLowerCase() === "content-type")?.[1]?.split(";", 1)[0]?.trim().toLowerCase();
93
+ if (!contentType || !ARCHIVE_CONTENT_TYPES.includes(contentType))
94
+ refusal({ code: "INVALID_CONTENT_TYPE", message: "Share download must have a ZIP or binary Content-Type." });
95
+ return Buffer.isBuffer(response.bodyBytes) ? response.bodyBytes : Buffer.from(response.bodyBytes.buffer, response.bodyBytes.byteOffset, response.bodyBytes.byteLength);
96
+ }
97
+ /**
98
+ * Only the lock holder may classify a verifying or creating row as interrupted, never a concurrent
99
+ * reader: both statuses exist only while the import lock is held, so the holder finding one means
100
+ * the previous holder crashed. A verifying row failed; a creating row with an allocation is
101
+ * reconciled against the workspace, one without it failed. Either way its stage is discarded.
102
+ */
103
+ export async function reconcileInterruptedImports(required, _optional = {}) {
104
+ for (const row of required.activeRows({}, {})) {
105
+ if (row.status === "verifying")
106
+ required.put({ ...row, status: "failed", error: "Archive verification was interrupted. Import the archive again." });
107
+ else if (row.status === "creating")
108
+ required.put(await reconcileCreatingRow({ row, workspace: required.workspace, host: required.host }));
109
+ else
110
+ continue;
111
+ fs.rmSync(required.registry.stagePath(row), { recursive: true, force: true });
112
+ }
113
+ }
114
+ /** The settled row for an interrupted creation: kept when the workspace has the site, else failed. */
115
+ async function reconcileCreatingRow(required) {
116
+ const { row } = required;
117
+ const status = row.creation ? await required.host.reconcileCreation({ allocation: row.creation, workspace: required.workspace }) : "failed";
118
+ return { ...row, status, ...(status === "failed" ? { newSiteId: null, newSiteName: null, error: "Site creation was interrupted and rolled back. Import the archive again." } : {}) };
119
+ }
120
+ /** A folder-safe site name from the display name; non-Latin names fall back to `imported-site`.
121
+ * @throws {ValidationError} Windows device names or trailing dots/spaces, before or after slugification.
122
+ * @complexity O(display name length), no I/O.
123
+ */
124
+ export function importSiteSlug(required, _optional = {}) {
125
+ required.host.assertPortableName({ name: required.displayName });
126
+ const slug = required.displayName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 80) || "imported-site";
127
+ required.host.assertPortableName({ name: slug });
128
+ return slug;
129
+ }
130
+ /** The owner-setup gate: only a pending import, and never without a new password. */
131
+ export function requireOwnerSetup(required) {
132
+ if (required.row.status !== "needs-owner")
133
+ refusal({ code: "INVALID_STATE", message: "This import is not awaiting owner setup. Import the archive again if it failed or expired." });
134
+ if (required.adminPassword === undefined || required.adminPassword === required.host.developmentDefaultPassword)
135
+ refusal({ code: "INVALID_PASSWORD", message: "Choose a new owner password; the development default cannot be used for an import." });
136
+ }
137
+ /** Owner and restore are committed; a start failure is recorded, never retried as a new site. */
138
+ export async function startImportedSite(required) {
139
+ try {
140
+ const started = await required.startSite({ name: required.name });
141
+ return { ...required.row, adminUrl: started.adminUrl, ...(started.adminUrl ? {} : { error: "Site created; start it from Sites to open admin." }) };
142
+ }
143
+ catch (error) {
144
+ console.warn("[site-import] The imported site could not start; the site remains available from Sites.", formatErrorForLog({ error }, required.host.errorLogOptions));
145
+ return { ...required.row, error: "Site created with its owner. Start it from Sites to open admin." };
146
+ }
147
+ }
148
+ /**
149
+ * Shows a needs-owner row past its expiry as failed. Lock-free indexed reads (list, page, get,
150
+ * replay) cannot run the expiry sweep, which writes, so they project the expired state instead
151
+ * of persisting it; this is the single source of truth for that projection.
152
+ */
153
+ export function projectExpiredOwnerSetup({ row, nowMs }, _optional = {}) {
154
+ if (row.status !== "needs-owner" || row.expiresAt >= nowMs)
155
+ return row;
156
+ return { ...row, status: "failed", error: "Owner setup expired", warnings: undefined, credentialWarnings: [] };
157
+ }
158
+ /** The public view of a stored import row. */
159
+ export function siteImportView(required, _optional = {}) {
160
+ const { row } = required;
161
+ const pending = row.status === "needs-owner";
162
+ return {
163
+ importId: row.importId, source: row.source,
164
+ newSiteId: row.newSiteId, newSiteName: row.newSiteName, state: row.status, status: row.status, createdAt: row.createdAt,
165
+ ...(pending ? { setupUrl: required.setupBase + "/" + row.importId + "/owner" } : {}),
166
+ adminUrl: row.adminUrl, error: row.error, warnings: row.warnings, credentialWarnings: row.credentialWarnings ?? [], hasEncryptedKeys: row.hasEncryptedKeys,
167
+ instructions: pending ? "Open setupUrl while signed in as the importing principal and choose a new owner password privately. The site is unavailable until setup completes." : "Open adminUrl when available. Imported extensions remain quarantined and need explicit review before activation.",
168
+ };
169
+ }
170
+ //# sourceMappingURL=import-backend-steps.js.map
@@ -0,0 +1,167 @@
1
+ import type { ImportHistoryUnavailable } from "./import-index/errors.js";
2
+ import type { SiteImportSource, SiteImportView, SiteImportPage, SiteImportPageInput } from "@jini-ai/core/contracts/site/site-import-history";
3
+ import type { Tracker } from "@jini-ai/core/contracts/site/diagnostics-observability";
4
+ import type { AgentPluginArchiveReaderPort } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
5
+ import type { CreateSiteResult, SiteCreationAllocation } from "@jini-ai/core/contracts/site/platform-site-dir";
6
+ import type { CredentialWarning } from "./credential-warnings.js";
7
+ import { type SiteImportRegistry } from "./import-registry.js";
8
+ import type { SiteImportProjection, VerifiedSiteImport } from "./import-verifier.js";
9
+ import { type ImportHttpClient, type ParsedSiteImportInput, type SiteImportStepsHost } from "./import-backend-steps.js";
10
+ export interface SiteImportBackend {
11
+ upload(required: {
12
+ principalId: string;
13
+ archive: Buffer;
14
+ }, optional?: Record<string, never>): Promise<{
15
+ uploadId: string;
16
+ }>;
17
+ importBackup(required: {
18
+ principalId: string;
19
+ source: SiteImportSource;
20
+ displayName?: string;
21
+ requestId?: string;
22
+ }, optional?: {
23
+ signal?: AbortSignal;
24
+ }): Promise<SiteImportView>;
25
+ completeOwner(required: {
26
+ principalId: string;
27
+ importId: string;
28
+ adminPassword: unknown;
29
+ savedKeysPassword?: unknown;
30
+ }, optional?: {
31
+ signal?: AbortSignal;
32
+ }): Promise<SiteImportView>;
33
+ list(required: {
34
+ principalId: string;
35
+ }, optional?: Record<string, never>): Promise<SiteImportView[]>;
36
+ listPage(required: SiteImportPageInput, optional?: Record<string, never>): Promise<SiteImportPage>;
37
+ get(required: {
38
+ principalId: string;
39
+ importId: string;
40
+ }, optional?: Record<string, never>): SiteImportView;
41
+ /** Settles interrupted imports and removes expired or orphaned payloads, with no import to start. */
42
+ tidy(required: Record<string, never>, optional?: Record<string, never>): Promise<void>;
43
+ }
44
+ /** Source union is enforced at every remote boundary; server paths are never accepted. */
45
+ export declare function parseSiteImportInput(required: {
46
+ input: unknown;
47
+ }, _options?: Record<string, never>): ParsedSiteImportInput;
48
+ /** The slice of the host's sites workspace the engine reads itself; the rest is only handed back to the host. */
49
+ export interface SiteImportWorkspace {
50
+ home(required: Record<string, never>): string;
51
+ }
52
+ /** The database sanitizer an archive's snapshot is rebuilt through before anything is staged. */
53
+ export type SiteImportSanitizer = (required: {
54
+ snapshot: Buffer;
55
+ }, optional: {
56
+ signal?: AbortSignal | undefined;
57
+ }) => Promise<SiteImportProjection>;
58
+ /** The extra options the engine hands the host's site-creation function; `W` is the host workspace handle. */
59
+ export interface SiteImportCreateOptions<W> {
60
+ workspace: W;
61
+ collisionSafe: true;
62
+ onAllocated(allocation: SiteCreationAllocation, optional?: Record<string, never>): void;
63
+ beforeRegister(): void;
64
+ verifiedRestore: {
65
+ signal: AbortSignal;
66
+ restore(required: {
67
+ dir: string;
68
+ dbPath: string;
69
+ siteId: string;
70
+ }): Promise<void>;
71
+ };
72
+ }
73
+ /** The host's site-creation function: allocate, restore the verified stage and register one new site. */
74
+ export type SiteImportCreateSite<W> = (required: {
75
+ name: string;
76
+ displayName: string;
77
+ adminPassword: string;
78
+ }, optional: Readonly<Record<string, unknown>> & SiteImportCreateOptions<W>) => Promise<CreateSiteResult>;
79
+ /** Host collaborators, policy and copy. Every member is REQUIRED: the engine carries no host defaults. */
80
+ export interface SiteImportHost<W extends SiteImportWorkspace = SiteImportWorkspace> extends SiteImportStepsHost<W> {
81
+ /** Verifies a share ZIP against the host's archive inventory, path mapping and limits. */
82
+ verifySiteImport(required: {
83
+ archive: Buffer;
84
+ reader: AgentPluginArchiveReaderPort;
85
+ sanitize: SiteImportSanitizer;
86
+ schema: {
87
+ index: number;
88
+ tag: string;
89
+ };
90
+ }, optional: {
91
+ signal?: AbortSignal;
92
+ }): Promise<VerifiedSiteImport & {
93
+ credentialWarnings: readonly CredentialWarning[];
94
+ }>;
95
+ /** Persists verified, freshly projected data into the private stage at `root`. */
96
+ stageVerifiedImport(required: {
97
+ root: string;
98
+ verified: VerifiedSiteImport;
99
+ }, optional?: Record<string, never>): void;
100
+ /** The notices recorded while staging the archive at `root`. */
101
+ stagedImportWarnings(required: {
102
+ root: string;
103
+ }, optional?: Record<string, never>): string[];
104
+ /** The new-site owner password the request supplies, or the host's development default when it supplies none. */
105
+ resolveNewSiteAdminPassword(required: {
106
+ adminPassword?: unknown;
107
+ }, optional?: Record<string, never>): string;
108
+ /** Removes expired or orphaned import databases. */
109
+ tidyImportDatabases(required: Record<string, never>, optional?: Record<string, never>): Promise<void>;
110
+ }
111
+ /** Import-history authority bound by the host (`bindSiteImportIndexState`): latched refusal, tidy-only retirement. */
112
+ export interface SiteImportAuthority {
113
+ refusal(required: Record<string, never>, optional?: Record<string, never>): ImportHistoryUnavailable | undefined;
114
+ retire(required: Record<string, never>, optional?: Record<string, never>): {
115
+ removed: number;
116
+ finished: boolean;
117
+ };
118
+ }
119
+ /** Everything `createSiteImportBackend` needs: the host ports, plus the host collaborators in `host`. */
120
+ export type SiteImportBackendRequired<W extends SiteImportWorkspace> = {
121
+ authority: SiteImportAuthority;
122
+ registry: SiteImportRegistry;
123
+ workspace: W;
124
+ reader: AgentPluginArchiveReaderPort;
125
+ http: ImportHttpClient;
126
+ sanitize: SiteImportSanitizer;
127
+ schema: {
128
+ index: number;
129
+ tag: string;
130
+ };
131
+ startSite: (required: {
132
+ name: string;
133
+ }) => Promise<{
134
+ adminUrl: string | null;
135
+ status: string;
136
+ }>;
137
+ tracker?: Tracker;
138
+ createSite: SiteImportCreateSite<W>;
139
+ restoreStagedImport: (required: {
140
+ root: string;
141
+ dir: string;
142
+ dbPath: string;
143
+ siteId: string;
144
+ }, optional?: {
145
+ pluginSourceRoot?: string;
146
+ savedKeysPassword?: string | undefined;
147
+ signal?: AbortSignal;
148
+ }) => Promise<void>;
149
+ /** Route prefix the owner-setup link is built under. */
150
+ setupBase: string;
151
+ creationOptions?: Readonly<Record<string, unknown>> | undefined;
152
+ host: SiteImportHost<W>;
153
+ };
154
+ /** Optional overrides and observers for `createSiteImportBackend`. */
155
+ export type SiteImportBackendOptional<W extends SiteImportWorkspace> = {
156
+ createSite?: SiteImportCreateSite<W>;
157
+ report?: (required: {
158
+ importId: string;
159
+ status: string;
160
+ }) => void;
161
+ };
162
+ /** Shared HTTP/tool application service. All effects enter as ports; CMS policy stays here.
163
+ * Pending owner setup stores sanitized bytes privately without creating any site directory.
164
+ * @complexity O(archive bytes + registry history), with one buffered job and four staged payloads.
165
+ */
166
+ export declare function createSiteImportBackend<W extends SiteImportWorkspace>(required: SiteImportBackendRequired<W>, optional?: SiteImportBackendOptional<W>): SiteImportBackend;
167
+ //# sourceMappingURL=import-backend.d.ts.map