@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,146 @@
1
+ import { SiteShareRefusal, archiveRefusalName } from "./share-refusal.js";
2
+ import { warnCredentialContent, addCredentialWarning } from "./credential-warnings.js";
3
+ /** The seven-segment root of an installed plugin package payload (matched against the lowercased path). */
4
+ const PACKAGE_CONTENT_ROOT = /^agent-plugins\/ws\/[^/]+\/[^/]+\/package\/sha256\/[a-f0-9]{64}\//;
5
+ /** Names an installed package ships as content (MCP declarations, credential schemes), never runtime secrets. */
6
+ const PACKAGE_MANIFEST_NAMES = ["mcp.json", "jini-credential-schemes.json"];
7
+ /** The plugin memory a share carries. Every other folder under a plugin's `memory/` is private runtime
8
+ * state: export excludes it ({@link excludedSharePath}) and import refuses it (`archive-manifest.ts`). */
9
+ export const SHARED_PLUGIN_MEMORY = String.raw `memory\/(?:notes|learned)`;
10
+ const PRIVATE_PLUGIN_MEMORY = String.raw `memory\/(?!(?:notes|learned)(?:\/|$))`;
11
+ const AGENT_PLUGIN_RUNTIME = new RegExp(String.raw `^agent-plugins\/ws\/[^/]+\/[^/]+\/(?:data(?:\/|$)|${PRIVATE_PLUGIN_MEMORY})`);
12
+ function excludedRuntimeSharePath({ path, parts }, _options = {}) {
13
+ // Plugin runtime data/memory have fixed roots. A package's src/data or docs/notes is content.
14
+ // A site plugin needs no rule here: the share walks only the files Jini lists as its package
15
+ // (`sources.ts` walkSitePlugins), so its data/ and private memory are never reached.
16
+ const roots = [
17
+ /^agent-plugins\/ws\/[^/]+\/(?:data|staging)(?:\/|$)/,
18
+ AGENT_PLUGIN_RUNTIME,
19
+ /^uploads\/chat-attachments(?:\/|$)/,
20
+ ];
21
+ return roots.some(root => root.test(path)) ||
22
+ parts.some(part => /^chat\.db(?:$|[.-])/.test(part));
23
+ }
24
+ /** A name that only hints at a secret; below a package root the file's bytes are scanned too (see requireShareSecretFree). */
25
+ const CREDENTIAL_NAME = /(?:credential|vault|keyring|site-key|private[-_]?key)/;
26
+ /** Non-credential private/runtime names that still refuse; credential names produce warnings only. */
27
+ function suspiciousSharePart({ part }, _options = {}) {
28
+ const names = [".git", "node_modules", ".publish-staging", ".publish-previous", ".ds_store", "_share", ".fs-custom-root.json"];
29
+ const prefixes = [".share-", "restore-point-", "superseded-"];
30
+ return names.includes(part) || prefixes.some(prefix => part.startsWith(prefix)) || /\.(?:db|sqlite|sqlite3)(?:$|[.-])/.test(part);
31
+ }
32
+ /** Credential names produce warnings; traversal and containment remain validation errors.
33
+ * Package manifests and credential labels are public package metadata, not runtime stores.
34
+ */
35
+ function secretSharePath({ deps, path: candidate, packageContent = false }) {
36
+ const required = { path: candidate };
37
+ if (deps.redactSecretShapes({ text: required.path }, { vendorOnly: true }).redactions > 0)
38
+ return true;
39
+ const p = required.path.toLowerCase();
40
+ const root = PACKAGE_CONTENT_ROOT.test(p);
41
+ return p.split("/").some((part, index) => {
42
+ const inPackage = root && index >= 7;
43
+ if (inPackage && PACKAGE_MANIFEST_NAMES.includes(part))
44
+ return false;
45
+ // A package's credential LABEL name is allowed; key-file rules (.pem, id_rsa…) still apply.
46
+ return credentialFileName({ part }, { credentialNameAllowed: inPackage && packageContent });
47
+ });
48
+ }
49
+ /** Fixed name rules are independent of path containment and package execution trust. */
50
+ function credentialFileName(required, { credentialNameAllowed = false } = {}) {
51
+ const rules = [/^\.env/, /^\.(?:npmrc|netrc|storage-secret\.json)$/, /^mcp\.json$/,
52
+ /^\.mcp(?:\..*)?\.json$/, /^id_(?:rsa|dsa|ecdsa|ed25519)(?:\.|$)/, /\.(?:pem|key|p12|pfx)(?:[.-]|$)/];
53
+ return (!credentialNameAllowed && CREDENTIAL_NAME.test(required.part)) || rules.some(rule => rule.test(required.part));
54
+ }
55
+ /** Excludes private runtime trees, preserving credential-looking files. */
56
+ function excludedSharePath(required, _optional = {}) {
57
+ const p = required.path.toLowerCase(), packageRoot = PACKAGE_CONTENT_ROOT.test(p);
58
+ if (excludedRuntimeSharePath({ path: p, parts: p.split("/") }))
59
+ return true;
60
+ const unsafe = p.split("/").some((part, index) => {
61
+ if (packageRoot && index >= 7 && PACKAGE_MANIFEST_NAMES.includes(part))
62
+ return false;
63
+ return suspiciousSharePart({ part });
64
+ });
65
+ if (unsafe) {
66
+ throw new SiteShareRefusal({ code: "UNSAFE_FILE", message: `Share refuses suspicious required path '${archiveRefusalName({ name: required.path })}'. Remove it before sharing.` });
67
+ }
68
+ return false;
69
+ }
70
+ /** True for a spelling some supported recipient filesystem rejects, rewrites or aliases. O(path). */
71
+ function hasUnportableSpelling(required) {
72
+ const p = required.path;
73
+ const parts = p.split("/");
74
+ if (/[:%\x00-\x1f\x7f\\]/.test(p) || p.normalize("NFC") !== p || p.normalize("NFKC") !== p || /[<>"|?*]/.test(p))
75
+ return true;
76
+ return parts.some(part => /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(part)) ||
77
+ parts.length > required.maxPathSegments || parts.some(part => /[. ]$/.test(part));
78
+ }
79
+ /** A ZIP path has one canonical spelling on every supported recipient filesystem. O(path). */
80
+ function validateSharePath(deps, required) {
81
+ const p = required.path;
82
+ // This one exact path is produced by trusted projection, never by a filesystem walk.
83
+ // The publish owner mixes secret names with path-shape checks. Mask only credential
84
+ // names here, retaining separators, dot segments and length for structural checks.
85
+ const structural = p.split("/").map(part => secretSharePath({ deps, path: part }) ? "x".repeat(part.length) : part).join("/");
86
+ const reason = ["database/content.db", "content.db"].includes(p) ? null : deps.checkTreePath({ relPath: structural });
87
+ if (reason || hasUnportableSpelling({ path: p, maxPathSegments: deps.maxPathSegments })) {
88
+ const shownPath = archiveRefusalName({ name: p });
89
+ // A callback treats archive '$&'/'$`' spellings as text, never replacement tokens.
90
+ const suffix = reason ? `: ${reason.replaceAll(structural, () => shownPath)}` : ".";
91
+ throw new SiteShareRefusal({ code: "UNSAFE_PATH", message: `Share path '${shownPath}' is unsafe${suffix}` });
92
+ }
93
+ }
94
+ /** Record content/name warnings and always include the file. Path integrity is checked separately.
95
+ * `shownPath` is the portable archive location, never the synthetic runtime scan path.
96
+ * Package identity remains an execution-trust concern, independent of content warnings.
97
+ * @complexity O(bytes + accumulated warnings); no I/O or source mutation.
98
+ */
99
+ function requireShareSecretFree(deps, required, optional = {}) {
100
+ const { redactSecretShapes } = deps;
101
+ const credentialWarnings = optional.credentialWarnings ?? [];
102
+ const path = optional.shownPath ?? required.path;
103
+ warnCredentialContent({ path, text: Buffer.from(required.bytes).toString("latin1"), credentialWarnings, redactSecretShapes }, { codeAware: /\.(?:js|mjs|cjs|ts|tsx|jsx)$/i.test(required.path) });
104
+ if (!required.path.startsWith("media/") && secretSharePath({ deps, path: required.path })) {
105
+ addCredentialWarning({ path, kind: "credential filename", credentialWarnings, redactSecretShapes });
106
+ }
107
+ return true;
108
+ }
109
+ function unsafeSharePath({ message }, _optional = {}) { throw new SiteShareRefusal({ code: "UNSAFE_PATH", message }); }
110
+ /** Upper/lower expansion also catches sharp-s/SS and final-sigma aliases, including ancestors. */
111
+ export function sharePathAlias(required, _options = {}) { return required.path.normalize("NFKC").toUpperCase().toLowerCase().normalize("NFC"); }
112
+ /** Reject aliases, including aliases in directory ancestors, before any content is read.
113
+ * Mutates only the caller's per-archive claim sets; throws UNSAFE_PATH on conflicts.
114
+ * @complexity O(path depth² + prior claims), bounded by 32 segments and 2,000 ZIP entries.
115
+ */
116
+ function claimSharePath(deps, required) {
117
+ validateSharePath(deps, { path: required.path });
118
+ const parts = required.path.split("/");
119
+ for (let index = 1; index <= parts.length; index++) {
120
+ const spelling = parts.slice(0, index).join("/");
121
+ const alias = sharePathAlias({ path: spelling });
122
+ const prior = required.aliases.get(alias);
123
+ if (prior !== undefined && prior !== spelling)
124
+ unsafeSharePath({ message: "ZIP contains unsafe case or Unicode aliases." });
125
+ required.aliases.set(alias, spelling);
126
+ if (index < parts.length && required.files.has(alias))
127
+ unsafeSharePath({ message: "ZIP file/directory collision." });
128
+ }
129
+ const key = sharePathAlias(required);
130
+ if (!required.directory) {
131
+ if (required.files.has(key) || [...required.aliases.keys()].some(alias => alias.startsWith(key + "/")))
132
+ unsafeSharePath({ message: "Duplicate file or file/directory collision." });
133
+ required.files.add(key);
134
+ }
135
+ }
136
+ /** Binds the share path/secret rules to REQUIRED host policy (see {@link ShareFilePolicyDeps}). */
137
+ export function createShareFilePolicy(deps, _optional = {}) {
138
+ return {
139
+ secretSharePath: (required, { packageContent = false } = {}) => secretSharePath({ deps, path: required.path, packageContent }),
140
+ excludedSharePath: (required, optional = {}) => excludedSharePath(required, optional),
141
+ validateSharePath: (required) => validateSharePath(deps, required),
142
+ requireShareSecretFree: (required, optional = {}) => requireShareSecretFree(deps, required, optional),
143
+ claimSharePath: (required) => claimSharePath(deps, required),
144
+ };
145
+ }
146
+ //# sourceMappingURL=share-file-policy.js.map
@@ -0,0 +1,107 @@
1
+ import type { ArtifactStorePort } from "@jini-ai/core/contracts/site/devops-deploy";
2
+ import { type HttpClientPort, type Logger } from "@jini-ai/core/primitives";
3
+ /** A prepared share destination: where an artifact is stored, plus the binding a saved record must still match. */
4
+ export interface ShareDelivery {
5
+ readonly provider: string;
6
+ readonly binding?: string;
7
+ readonly store: ArtifactStorePort;
8
+ }
9
+ /** The slice of a share registry this module reads and writes; the host's registry class satisfies it structurally. */
10
+ export interface ShareHostingRegistry {
11
+ readonly directory: string;
12
+ findToken(required: {
13
+ token: string;
14
+ file: string;
15
+ }): Promise<{
16
+ site: string;
17
+ sha256: string;
18
+ } | null | undefined>;
19
+ list(required: {
20
+ site: string;
21
+ }): Promise<readonly {
22
+ token: string;
23
+ file: string;
24
+ shareId: string;
25
+ site: string;
26
+ }[]>;
27
+ disable(required: {
28
+ shareId: string;
29
+ site: string;
30
+ }): Promise<unknown>;
31
+ deleteArtifact(required: {
32
+ shareId: string;
33
+ }): Promise<unknown>;
34
+ }
35
+ /** The connected peer's credential, as far as artifact paths and revocation need it. */
36
+ export interface SharePeerDeps {
37
+ readonly credential: {
38
+ readonly baseUrl: string;
39
+ readonly remoteWorkspaceId: string;
40
+ };
41
+ }
42
+ /** One request to the connected peer; the host's bound transport accepts this shape. */
43
+ export interface SharePeerRequest {
44
+ method: "PUT" | "DELETE";
45
+ path: string;
46
+ archive?: Uint8Array | undefined;
47
+ signal?: AbortSignal | undefined;
48
+ }
49
+ /** Host values and collaborators the share hosting cannot own. */
50
+ export interface ShareHostingDeps<R extends ShareHostingRegistry, P extends SharePeerDeps> {
51
+ /** The host's guarded outbound call to the connected peer. */
52
+ callPeer: (required: {
53
+ deps: P;
54
+ request: SharePeerRequest;
55
+ }) => Promise<unknown>;
56
+ /** Joins a peer base URL and path. */
57
+ peerUrl: (required: {
58
+ baseUrl: string;
59
+ path: string;
60
+ }) => string;
61
+ /** Records a received artifact in the registry; the one receiver for locally generated and management-uploaded artifacts. */
62
+ receiveArtifact: (required: {
63
+ registry: R;
64
+ site: string;
65
+ token: string;
66
+ file: string;
67
+ archive: Buffer;
68
+ }) => Promise<unknown>;
69
+ /** Regex source of a share token (the token capture group of an artifact key). */
70
+ tokenPattern: string;
71
+ /** Regex source of an artifact file name (the file capture group of an artifact key). */
72
+ artifactFilePattern: string;
73
+ /** Provider id recorded for artifacts this server (or its connected peer) delivers itself. */
74
+ serverProvider: string;
75
+ /** Name of the operator setting holding the public origin, quoted in the refusal when it is invalid. */
76
+ publicOriginSetting: string;
77
+ }
78
+ type ShareDeliverySources<P extends SharePeerDeps> = {
79
+ peer: () => Promise<P | undefined>;
80
+ http: HttpClientPort;
81
+ objectStore: () => Promise<ShareDelivery | undefined>;
82
+ runtime?: () => ShareDelivery;
83
+ /** Where a skipped runtime delivery is reported; defaults to the console. */
84
+ logger?: Pick<Logger, "warn">;
85
+ };
86
+ type SavedShareDelivery = {
87
+ provider?: string | undefined;
88
+ binding?: string | undefined;
89
+ };
90
+ /** The delivery constructors and selection a host binds once. */
91
+ export interface ShareHosting<R extends ShareHostingRegistry, P extends SharePeerDeps> {
92
+ createRuntimeShareDelivery(required: {
93
+ registry: R;
94
+ site: string;
95
+ publicOrigin: string;
96
+ http: HttpClientPort;
97
+ }, optional?: Record<string, never>): ShareDelivery;
98
+ createPeerShareDelivery(required: {
99
+ peer: P;
100
+ http: HttpClientPort;
101
+ }, optional?: Record<string, never>): ShareDelivery;
102
+ resolveShareDelivery(required: ShareDeliverySources<P>, optional?: SavedShareDelivery): Promise<ShareDelivery | undefined>;
103
+ }
104
+ /** Builds the share delivery constructors and the delivery selection from host values and collaborators. */
105
+ export declare function createShareHosting<R extends ShareHostingRegistry, P extends SharePeerDeps>(deps: ShareHostingDeps<R, P>, _optional?: Record<string, never>): ShareHosting<R, P>;
106
+ export {};
107
+ //# sourceMappingURL=share-hosting.d.ts.map
@@ -0,0 +1,148 @@
1
+ import { createHash } from "node:crypto";
2
+ import { createConsoleLogger } from "@jini-ai/core/primitives";
3
+ import { SiteShareRefusal } from "./share-refusal.js";
4
+ /** A 200 anonymous attachment of exactly `bytes`, served uncached, unsniffed and unindexed. */
5
+ function isPublicAttachment(required) {
6
+ const headers = new Headers(required.response.headers);
7
+ if (required.response.status !== 200 || Number(headers.get("content-length")) !== required.bytes || headers.get("cache-control") !== "no-store")
8
+ return false;
9
+ return headers.get("x-content-type-options") === "nosniff" && headers.get("x-robots-tag") === "noindex, nofollow" && /^attachment(?:;|$)/i.test(headers.get("content-disposition") ?? "");
10
+ }
11
+ /** No saved binding accepts any delivery; a saved one must name this delivery's own binding. */
12
+ function bindingMatches(required) {
13
+ return required.saved === undefined || required.saved === required.actual;
14
+ }
15
+ /** The configured object-store delivery when its provider and binding match the saved ones. */
16
+ async function resolveObjectStoreDelivery(required, optional = {}) {
17
+ try {
18
+ const objectStore = await required.objectStore();
19
+ if (!objectStore || (optional.provider && optional.provider !== objectStore.provider))
20
+ return undefined;
21
+ return bindingMatches({ saved: optional.binding, actual: objectStore.binding }) ? objectStore : undefined;
22
+ }
23
+ catch {
24
+ return undefined;
25
+ } // Failed credential resolution still leaves a private ZIP download.
26
+ }
27
+ /** This server's runtime delivery; a misconfigured public origin leaves the object-store/ZIP fallback.
28
+ * The warning carries the refusal code only: the configured origin may hold credentials. */
29
+ function runtimeDelivery(required) {
30
+ try {
31
+ return required.runtime?.();
32
+ }
33
+ catch (error) {
34
+ const code = error instanceof SiteShareRefusal ? error.code : "UNEXPECTED";
35
+ (required.logger ?? createConsoleLogger({ prefix: "" })).warn({ message: "[site-share] runtime share delivery is misconfigured; falling back to object storage or a private ZIP." }, { meta: { code } });
36
+ return undefined;
37
+ }
38
+ }
39
+ function createServerShareVerification(deps) {
40
+ const artifactKey = new RegExp(`^_share/(${deps.tokenPattern})/(${deps.artifactFilePattern})$`);
41
+ /** Validates a share artifact key and returns its token and file; refuses INVALID_INPUT otherwise. O(key). */
42
+ function parseArtifactKey({ key }, _optional = {}) {
43
+ const match = artifactKey.exec(key);
44
+ const [, token, file] = match ?? [];
45
+ if (!token || !file)
46
+ throw new SiteShareRefusal({ code: "INVALID_INPUT", message: "Invalid share artifact key." });
47
+ return { token, file };
48
+ }
49
+ /** Both delivery variants verify through the same anonymous attachment contract. */
50
+ async function verifyServerShare(required, optional = {}) {
51
+ parseArtifactKey({ key: required.key });
52
+ if (required.url !== required.expectedUrl)
53
+ return false;
54
+ // Never send a destination credential to the anonymous download endpoint.
55
+ const response = await required.http.send({ request: { method: "HEAD", url: required.url, headers: {}, idleTimeoutMs: 15_000, totalDeadlineMs: 20_000, maxResponseBytes: 1024, ...(optional.signal ? { signal: optional.signal } : {}) } }, { redirect: "error" });
56
+ if (!required.present)
57
+ return response.status === 404 || response.status === 410;
58
+ return isPublicAttachment({ response, bytes: required.bytes });
59
+ }
60
+ return { parseArtifactKey, verifyServerShare };
61
+ }
62
+ function createServerShareDeliveries(deps) {
63
+ const { parseArtifactKey, verifyServerShare } = createServerShareVerification(deps);
64
+ /** Public origin is an explicit operator capability, never inferred from a local request Host. */
65
+ function createRuntimeShareDelivery(required, _optional = {}) {
66
+ const origin = URL.parse(required.publicOrigin);
67
+ const invalidOrigin = !origin || origin.protocol !== "https:" || origin.username || origin.password;
68
+ if (invalidOrigin || origin.pathname !== "/" || origin.search || origin.hash)
69
+ throw new SiteShareRefusal({ code: "STORAGE_SETUP", message: `${deps.publicOriginSetting} must be a public HTTPS origin without a path or credentials.` });
70
+ const store = {
71
+ async upload({ key, bytes }, _optional = {}) {
72
+ const { token, file } = parseArtifactKey({ key });
73
+ const existing = await required.registry.findToken({ token, file });
74
+ if (existing && (existing.site !== required.site || existing.sha256 !== createHash("sha256").update(bytes).digest("hex")))
75
+ throw new SiteShareRefusal({ code: "ARTIFACT_CHANGED", message: "This token already names a different artifact." });
76
+ if (!existing)
77
+ await deps.receiveArtifact({ registry: required.registry, site: required.site, token, file, archive: Buffer.from(bytes) });
78
+ return { url: `${origin.origin}/${key}` };
79
+ },
80
+ async delete({ key }, _optional = {}) {
81
+ parseArtifactKey({ key });
82
+ const row = (await required.registry.list({ site: required.site })).find(row => key === `_share/${row.token}/${row.file}`);
83
+ if (!row)
84
+ return;
85
+ await required.registry.disable({ shareId: row.shareId, site: row.site });
86
+ await required.registry.deleteArtifact({ shareId: row.shareId });
87
+ },
88
+ verify: (input, options = {}) => verifyServerShare({ ...input, http: required.http, expectedUrl: `${origin.origin}/${input.key}` }, options),
89
+ };
90
+ return { provider: deps.serverProvider, binding: required.registry.directory, store };
91
+ }
92
+ /** Connected deployment artifact adapter. Reuses publishing credentials and guarded transport;
93
+ * the deployed receiver needs no environment opt-in. The base URL pins revocation to that site. */
94
+ function createPeerShareDelivery(required, _optional = {}) {
95
+ const baseUrl = required.peer.credential.baseUrl;
96
+ const artifactPath = ({ key }, _optional = {}) => {
97
+ const { token, file } = parseArtifactKey({ key });
98
+ return `/api/admin/v1/workspaces/${encodeURIComponent(required.peer.credential.remoteWorkspaceId)}/site-shares/artifacts/${token}/${file}`;
99
+ };
100
+ return { provider: deps.serverProvider, binding: baseUrl, store: {
101
+ async upload({ key, bytes }, options = {}) {
102
+ await deps.callPeer({ deps: required.peer, request: { method: "PUT", path: artifactPath({ key }), archive: bytes, signal: options.signal } });
103
+ return { url: deps.peerUrl({ baseUrl, path: `/${key}` }) };
104
+ },
105
+ async delete({ key }, options = {}) {
106
+ // DELETE is idempotent, including after a previous successful remote cleanup.
107
+ try {
108
+ await deps.callPeer({ deps: required.peer, request: { method: "DELETE", path: artifactPath({ key }), signal: options.signal } });
109
+ }
110
+ catch (error) {
111
+ if (error.peerStatus !== 404)
112
+ throw error;
113
+ }
114
+ },
115
+ verify: (input, options = {}) => verifyServerShare({ ...input, http: required.http, expectedUrl: deps.peerUrl({ baseUrl, path: `/${input.key}` }) }, options),
116
+ } };
117
+ }
118
+ return { createRuntimeShareDelivery, createPeerShareDelivery };
119
+ }
120
+ /** Builds the share delivery constructors and the delivery selection from host values and collaborators. */
121
+ export function createShareHosting(deps, _optional = {}) {
122
+ const { createRuntimeShareDelivery, createPeerShareDelivery } = createServerShareDeliveries(deps);
123
+ /** The connected deployed peer, else this server's runtime delivery, when its binding matches. */
124
+ async function resolveServerDelivery(required, optional = {}) {
125
+ try {
126
+ const peer = await required.peer();
127
+ if (peer && bindingMatches({ saved: optional.binding, actual: peer.credential.baseUrl }))
128
+ return createPeerShareDelivery({ peer, http: required.http });
129
+ }
130
+ catch { /* An unavailable connection still permits the configured object-store/ZIP fallback. */ }
131
+ const runtime = runtimeDelivery(required);
132
+ return runtime && bindingMatches({ saved: optional.binding, actual: runtime.binding }) ? runtime : undefined;
133
+ }
134
+ /** Selection is shared by create and revoke: connected deployed peer, object store, then ZIP only.
135
+ * A saved binding is mandatory on revoke; a changed default may never delete another site's ZIP. */
136
+ async function resolveShareDelivery(required, optional = {}) {
137
+ if (!optional.provider || optional.provider === deps.serverProvider) {
138
+ const server = await resolveServerDelivery(required, optional);
139
+ if (server || optional.provider)
140
+ return server;
141
+ }
142
+ // Any object-store provider exposing an artifact store may deliver (not one hard-coded vendor);
143
+ // a saved provider must be the one the site's object store resolves to now.
144
+ return resolveObjectStoreDelivery(required, optional);
145
+ }
146
+ return { createRuntimeShareDelivery, createPeerShareDelivery, resolveShareDelivery };
147
+ }
148
+ //# sourceMappingURL=share-hosting.js.map
@@ -0,0 +1,180 @@
1
+ import type { DbOpsPort } from "@jini-ai/core/contracts/site/gated-mutations-ports";
2
+ import type { CredentialWarning } from "./credential-warnings.js";
3
+ import type { SiteSavedKeysPort } from "./saved-keys-port.js";
4
+ /**
5
+ * @file The steps of `prepareShareContent`: the projected database, the collected site files, the
6
+ * referenced media read through the blob store, and the regenerated portable settings. The host
7
+ * owns every size cap, its wording, the file walker and the snapshot reader; they arrive as
8
+ * {@link ShareStepsDeps} through {@link createShareSteps}.
9
+ */
10
+ /** The blob-store slice the share reads: bytes by key, and the size without reading them. */
11
+ export interface ShareBlobStore {
12
+ get(required: {
13
+ storageKey: string;
14
+ }): Promise<Uint8Array>;
15
+ sizeOf?(required: {
16
+ storageKey: string;
17
+ }): Promise<number | null>;
18
+ }
19
+ /** Every byte the share will carry, checked against the archive caps on each addition. */
20
+ export interface ShareLedger {
21
+ readonly sizes: {
22
+ path: string;
23
+ bytes: number;
24
+ }[];
25
+ readonly buffered: {
26
+ path: string;
27
+ content: Buffer;
28
+ }[];
29
+ readonly notices?: string[];
30
+ }
31
+ /** One media record of the projected database the share reads bytes for. */
32
+ export interface ShareMediaReference {
33
+ readonly storageKey: string;
34
+ readonly sha256?: string;
35
+ readonly destinationStorageKey?: string;
36
+ }
37
+ /** What the sanitizer returns: fresh database bytes plus the media the copy still references. */
38
+ export interface ShareDatabaseProjection<TArchiveMedia = unknown> {
39
+ readonly credentialWarnings?: readonly CredentialWarning[];
40
+ readonly notices?: readonly string[];
41
+ readonly archiveMedia?: readonly TArchiveMedia[];
42
+ readonly bytes: Buffer;
43
+ readonly media: readonly ShareMediaReference[];
44
+ /** Original document policies travel separately from deduplicated blob references. */
45
+ readonly documents?: readonly {
46
+ storageKey: string;
47
+ sha256: string;
48
+ originalFilename: string;
49
+ }[];
50
+ }
51
+ export type ShareDatabaseSanitizer<TProjection = ShareDatabaseProjection> = (required: {
52
+ snapshot: Buffer;
53
+ omittedMediaIds?: readonly string[];
54
+ }, optional?: {
55
+ signal?: AbortSignal | undefined;
56
+ }) => Promise<TProjection>;
57
+ /** The slice of a planned on-disk file the steps read. */
58
+ export interface SharePlannedFile {
59
+ readonly path: string;
60
+ readonly bytes: number;
61
+ }
62
+ /** The collector's answer: the planned files, and any file it refused to plan. */
63
+ export interface ShareCollectedFiles<TFile extends SharePlannedFile = SharePlannedFile> {
64
+ readonly files: readonly TFile[];
65
+ readonly skipped: readonly {
66
+ readonly path: string;
67
+ readonly reason: string;
68
+ }[];
69
+ }
70
+ /** The database snapshot reader's answer: bytes, or a caller-safe refusal message. */
71
+ export type ShareSnapshotResult = {
72
+ ok: true;
73
+ bytes: Buffer;
74
+ watermarkAtCapture: number;
75
+ } | {
76
+ ok: false;
77
+ message: string;
78
+ };
79
+ /** What the host owns: caps and their copy, the file walker, the snapshot reader and the planned-file reader. */
80
+ export interface ShareStepsDeps<TSources extends {
81
+ siteDir: string;
82
+ }, TInclude extends object, TFile extends SharePlannedFile, TCollected extends ShareCollectedFiles<TFile>> {
83
+ /** The byte caps the steps enforce: the expanded cap bounds the snapshot, the manifest cap bounds each settings file, the document cap bounds a library document blob. */
84
+ readonly limits: {
85
+ readonly maxExpandedBytes: number;
86
+ readonly maxManifestBytes: number;
87
+ readonly maxDocumentBytes: number;
88
+ };
89
+ /** Host wording for the refusals whose text names a cap. */
90
+ readonly messages: {
91
+ readonly settingsTooLarge: (required: {
92
+ path: string;
93
+ }) => string;
94
+ readonly invalidDocument: string;
95
+ };
96
+ /** Throws a {@link SiteShareRefusal} when the listed files break the archive caps. */
97
+ readonly checkShareLimits: (required: {
98
+ files: readonly {
99
+ path: string;
100
+ bytes: number;
101
+ }[];
102
+ }) => void;
103
+ readonly captureDatabaseSnapshot: (required: {
104
+ dbOps: DbOpsPort;
105
+ scopeId: string;
106
+ }, optional: {
107
+ maxBytes: number;
108
+ snapshotRoot: string;
109
+ }) => Promise<ShareSnapshotResult>;
110
+ readonly collectFiles: (required: {
111
+ sources: TSources;
112
+ include: TInclude;
113
+ }, optional: {
114
+ profile: "share";
115
+ }) => Promise<TCollected>;
116
+ readonly readPlannedFile: (file: TFile) => Promise<{
117
+ ok: true;
118
+ bytes: Buffer;
119
+ } | {
120
+ ok: false;
121
+ message: string;
122
+ }>;
123
+ }
124
+ /** The bound steps; build one with {@link createShareSteps}. */
125
+ export interface ShareSteps<TSources extends {
126
+ siteDir: string;
127
+ }, TInclude extends object, TFile extends SharePlannedFile, TCollected extends ShareCollectedFiles<TFile>> {
128
+ addBuffered(required: {
129
+ ledger: ShareLedger;
130
+ file: {
131
+ path: string;
132
+ content: Buffer;
133
+ };
134
+ }): void;
135
+ captureProjectedDatabase<TProjection>(required: {
136
+ dbOps: DbOpsPort;
137
+ sanitize: ShareDatabaseSanitizer<TProjection>;
138
+ snapshotRoot: string;
139
+ savedKeys?: Pick<SiteSavedKeysPort, "capture">;
140
+ shareId?: string;
141
+ workspaceId?: string;
142
+ includeSavedKeys?: boolean;
143
+ }, optional?: {
144
+ signal?: AbortSignal;
145
+ }): Promise<{
146
+ projected: TProjection;
147
+ watermarkAtCapture: number;
148
+ savedKeys?: Awaited<ReturnType<SiteSavedKeysPort["capture"]>>;
149
+ }>;
150
+ collectShareFiles(required: {
151
+ sources: TSources;
152
+ include: TInclude;
153
+ }): Promise<TCollected>;
154
+ reportedBlobSize(required: {
155
+ blobStore: ShareBlobStore;
156
+ storageKey: string;
157
+ document: boolean;
158
+ }): Promise<number>;
159
+ fetchVerifiedBlob(required: {
160
+ blobStore: ShareBlobStore;
161
+ media: {
162
+ storageKey: string;
163
+ sha256?: string;
164
+ };
165
+ size: number;
166
+ }): Promise<Buffer>;
167
+ addPortableSettings(required: {
168
+ files: readonly TFile[];
169
+ siteDir: string;
170
+ ledger: ShareLedger;
171
+ }): Promise<string>;
172
+ }
173
+ /**
174
+ * Binds the share steps to a host's caps, file walker and snapshot reader.
175
+ * @returns the steps; each refuses with a {@link SiteShareRefusal} instead of returning a partial share.
176
+ */
177
+ export declare function createShareSteps<TSources extends {
178
+ siteDir: string;
179
+ }, TInclude extends object, TFile extends SharePlannedFile, TCollected extends ShareCollectedFiles<TFile>>(deps: ShareStepsDeps<TSources, TInclude, TFile, TCollected>): ShareSteps<TSources, TInclude, TFile, TCollected>;
180
+ //# sourceMappingURL=share-preparation-steps.d.ts.map