@jini-ai/devops 0.7.3-next.2 → 0.7.4

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 (402) hide show
  1. package/CHANGELOG.md +7 -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 +158 -0
  11. package/dist/backup/site/backup-service.d.ts +336 -0
  12. package/dist/backup/site/backup-service.js +127 -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 +94 -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 +39 -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 +197 -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 +210 -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 +107 -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 +75 -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 +204 -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/coverage/lcov.js +1 -1
  133. package/dist/checks/env-access.d.ts +14 -1
  134. package/dist/checks/env-access.js +92 -6
  135. package/dist/checks/live-verify-checks.d.ts +29 -0
  136. package/dist/checks/live-verify-checks.js +30 -0
  137. package/dist/checks/quality-gates.d.ts +137 -0
  138. package/dist/checks/quality-gates.js +209 -0
  139. package/dist/core/deploy-types.d.ts +2 -0
  140. package/dist/deploy/admin-http/site-update-status.d.ts +8 -0
  141. package/dist/deploy/admin-http/site-update-status.js +15 -0
  142. package/dist/deploy/host-kit.d.ts +3 -0
  143. package/dist/deploy/index.d.ts +6 -0
  144. package/dist/deploy/index.js +6 -0
  145. package/dist/deploy/ops-runner.js +7 -0
  146. package/dist/deploy/ops-tool-contracts.d.ts +10 -1
  147. package/dist/deploy/react/Deployment.d.ts +37 -0
  148. package/dist/deploy/react/Deployment.js +94 -0
  149. package/dist/deploy/react/DockerfileTab.d.ts +72 -0
  150. package/dist/deploy/react/DockerfileTab.js +131 -0
  151. package/dist/deploy/react/HistoryTab.d.ts +43 -0
  152. package/dist/deploy/react/HistoryTab.js +12 -0
  153. package/dist/deploy/react/OverviewTab.d.ts +60 -0
  154. package/dist/deploy/react/OverviewTab.js +75 -0
  155. package/dist/deploy/react/PublishRunResult.d.ts +5 -1
  156. package/dist/deploy/react/PublishRunResult.js +4 -4
  157. package/dist/deploy/react/SiteUpdateNotice.d.ts +22 -0
  158. package/dist/deploy/react/SiteUpdateNotice.js +25 -0
  159. package/dist/deploy/react/StaticCredentialFields.d.ts +36 -0
  160. package/dist/deploy/react/StaticCredentialFields.js +63 -0
  161. package/dist/deploy/react/StaticCredentialSteps.d.ts +23 -0
  162. package/dist/deploy/react/StaticCredentialSteps.js +152 -0
  163. package/dist/deploy/react/StaticExportCard.d.ts +11 -0
  164. package/dist/deploy/react/StaticExportCard.js +97 -0
  165. package/dist/deploy/react/StaticPublishCredentials.d.ts +50 -0
  166. package/dist/deploy/react/StaticPublishCredentials.js +77 -0
  167. package/dist/deploy/react/StaticPublishForm.d.ts +12 -0
  168. package/dist/deploy/react/StaticPublishForm.js +91 -0
  169. package/dist/deploy/react/StaticSiteTab.d.ts +207 -0
  170. package/dist/deploy/react/StaticSiteTab.js +117 -0
  171. package/dist/deploy/react/deployment-visuals.d.ts +207 -0
  172. package/dist/deploy/react/deployment-visuals.js +101 -0
  173. package/dist/deploy/react/download-dockerfile.d.ts +14 -0
  174. package/dist/deploy/react/download-dockerfile.js +15 -0
  175. package/dist/deploy/react/hooks/publish-credential-draft.d.ts +33 -0
  176. package/dist/deploy/react/hooks/publish-credential-draft.js +54 -0
  177. package/dist/deploy/react/hooks/publish-credential-selection.d.ts +13 -0
  178. package/dist/deploy/react/hooks/publish-credential-selection.js +34 -0
  179. package/dist/deploy/react/hooks/publish-credential-writes.d.ts +20 -0
  180. package/dist/deploy/react/hooks/publish-credential-writes.js +99 -0
  181. package/dist/deploy/react/hooks/static-publish-actions.d.ts +10 -0
  182. package/dist/deploy/react/hooks/static-publish-actions.js +62 -0
  183. package/dist/deploy/react/hooks/static-publish-form.hooks.d.ts +38 -0
  184. package/dist/deploy/react/hooks/static-publish-form.hooks.js +103 -0
  185. package/dist/deploy/react/hooks/static-publish-run.hooks.d.ts +28 -0
  186. package/dist/deploy/react/hooks/static-publish-run.hooks.js +92 -0
  187. package/dist/deploy/react/hooks/use-dockerfile-source.hooks.d.ts +148 -0
  188. package/dist/deploy/react/hooks/use-dockerfile-source.hooks.js +155 -0
  189. package/dist/deploy/react/hooks/use-publish-credentials.hooks.d.ts +268 -0
  190. package/dist/deploy/react/hooks/use-publish-credentials.hooks.js +52 -0
  191. package/dist/deploy/react/hooks/use-static-export.hooks.d.ts +128 -0
  192. package/dist/deploy/react/hooks/use-static-export.hooks.js +159 -0
  193. package/dist/deploy/react/hooks/use-static-publish.hooks.d.ts +208 -0
  194. package/dist/deploy/react/hooks/use-static-publish.hooks.js +48 -0
  195. package/dist/deploy/react/index.d.ts +4 -0
  196. package/dist/deploy/react/index.js +2 -0
  197. package/dist/deploy/react/rules.d.ts +363 -0
  198. package/dist/deploy/react/rules.js +314 -0
  199. package/dist/deploy/react/use-deployment-overview.hooks.d.ts +41 -0
  200. package/dist/deploy/react/use-deployment-overview.hooks.js +11 -0
  201. package/dist/deploy/site/agent-tools.d.ts +42 -0
  202. package/dist/deploy/site/agent-tools.js +119 -0
  203. package/dist/deploy/site/deploy-config-registry.d.ts +155 -0
  204. package/dist/deploy/site/deploy-config-registry.js +124 -0
  205. package/dist/deploy/site/deploy-config.d.ts +97 -0
  206. package/dist/deploy/site/deploy-config.js +115 -0
  207. package/dist/deploy/site/deploy-ops/agent-tools.d.ts +22 -0
  208. package/dist/deploy/site/deploy-ops/agent-tools.js +76 -0
  209. package/dist/deploy/site/deploy-ops/registry.d.ts +134 -0
  210. package/dist/deploy/site/deploy-ops/registry.js +106 -0
  211. package/dist/deploy/site/deploy-ops/run-ops.d.ts +66 -0
  212. package/dist/deploy/site/deploy-ops/run-ops.js +34 -0
  213. package/dist/deploy/site/deploy-ops/secret-confirm.d.ts +36 -0
  214. package/dist/deploy/site/deploy-ops/secret-confirm.js +27 -0
  215. package/dist/deploy/site/deploy-targets/host-kit.d.ts +28 -0
  216. package/dist/deploy/site/deploy-targets/host-kit.js +120 -0
  217. package/dist/deploy/site/deploy-targets/registry.d.ts +157 -0
  218. package/dist/deploy/site/deploy-targets/registry.js +130 -0
  219. package/dist/deploy/site/deploy-targets/types.d.ts +27 -0
  220. package/dist/deploy/site/deploy-targets/types.js +2 -0
  221. package/dist/deploy/site/dockerfile.d.ts +137 -0
  222. package/dist/deploy/site/dockerfile.js +101 -0
  223. package/dist/deploy/site/export-run.d.ts +137 -0
  224. package/dist/deploy/site/export-run.js +152 -0
  225. package/dist/deploy/site/ports.d.ts +115 -0
  226. package/dist/deploy/site/ports.js +2 -0
  227. package/dist/deploy/site/publish-agent-tools.d.ts +18 -0
  228. package/dist/deploy/site/publish-agent-tools.js +120 -0
  229. package/dist/deploy/site/publish-candidate.d.ts +26 -0
  230. package/dist/deploy/site/publish-candidate.js +37 -0
  231. package/dist/deploy/site/publish-credentials/account-label-heal-scheduler.d.ts +78 -0
  232. package/dist/deploy/site/publish-credentials/account-label-heal-scheduler.js +88 -0
  233. package/dist/deploy/site/publish-credentials/compatibility-port.d.ts +38 -0
  234. package/dist/deploy/site/publish-credentials/compatibility-port.js +19 -0
  235. package/dist/deploy/site/publish-credentials/execution-mode.d.ts +43 -0
  236. package/dist/deploy/site/publish-credentials/execution-mode.js +19 -0
  237. package/dist/deploy/site/publish-credentials/store-owner.d.ts +11 -0
  238. package/dist/deploy/site/publish-credentials/store-owner.js +9 -0
  239. package/dist/deploy/site/publish-credentials/store-resolution.d.ts +55 -0
  240. package/dist/deploy/site/publish-credentials/store-resolution.js +100 -0
  241. package/dist/deploy/site/publish-credentials/store-validation.d.ts +68 -0
  242. package/dist/deploy/site/publish-credentials/store-validation.js +182 -0
  243. package/dist/deploy/site/publish-credentials/store.d.ts +321 -0
  244. package/dist/deploy/site/publish-credentials/store.js +367 -0
  245. package/dist/deploy/site/publish-credentials/types.d.ts +85 -0
  246. package/dist/deploy/site/publish-credentials/types.js +2 -0
  247. package/dist/deploy/site/publish-tool-capabilities.d.ts +123 -0
  248. package/dist/deploy/site/publish-tool-capabilities.js +175 -0
  249. package/dist/deploy/site/publish-tool-credential.d.ts +48 -0
  250. package/dist/deploy/site/publish-tool-credential.js +284 -0
  251. package/dist/deploy/site/publish-tool-deps.d.ts +205 -0
  252. package/dist/deploy/site/publish-tool-deps.js +15 -0
  253. package/dist/deploy/site/publish-tool-execution.d.ts +78 -0
  254. package/dist/deploy/site/publish-tool-execution.js +313 -0
  255. package/dist/deploy/site/publish-tool-schema.d.ts +29 -0
  256. package/dist/deploy/site/publish-tool-schema.js +38 -0
  257. package/dist/deploy/site/static-publish/adapter-export.d.ts +54 -0
  258. package/dist/deploy/site/static-publish/adapter-export.js +89 -0
  259. package/dist/deploy/site/static-publish/adapter-plan.d.ts +99 -0
  260. package/dist/deploy/site/static-publish/adapter-plan.js +112 -0
  261. package/dist/deploy/site/static-publish/adapter.d.ts +182 -0
  262. package/dist/deploy/site/static-publish/adapter.js +321 -0
  263. package/dist/deploy/site/static-publish/admin-publish-read.d.ts +209 -0
  264. package/dist/deploy/site/static-publish/admin-publish-read.js +118 -0
  265. package/dist/deploy/site/static-publish/credentials.d.ts +114 -0
  266. package/dist/deploy/site/static-publish/credentials.js +298 -0
  267. package/dist/deploy/site/static-publish/domain-publish-rows.d.ts +25 -0
  268. package/dist/deploy/site/static-publish/domain-publish-rows.js +43 -0
  269. package/dist/deploy/site/static-publish/domain-publish-tool.d.ts +19 -0
  270. package/dist/deploy/site/static-publish/domain-publish-tool.js +111 -0
  271. package/dist/deploy/site/static-publish/inspection.d.ts +24 -0
  272. package/dist/deploy/site/static-publish/inspection.js +69 -0
  273. package/dist/deploy/site/static-publish/publish-history.d.ts +197 -0
  274. package/dist/deploy/site/static-publish/publish-history.js +153 -0
  275. package/dist/deploy/site/static-publish/publish-run.d.ts +156 -0
  276. package/dist/deploy/site/static-publish/publish-run.js +186 -0
  277. package/dist/deploy/site/static-publish/types.d.ts +168 -0
  278. package/dist/deploy/site/static-publish/types.js +2 -0
  279. package/dist/deploy/site/static-publish/verify.d.ts +237 -0
  280. package/dist/deploy/site/static-publish/verify.js +284 -0
  281. package/dist/deploy/site/tool-registrations.d.ts +97 -0
  282. package/dist/deploy/site/tool-registrations.js +130 -0
  283. package/dist/deploy/site/types.d.ts +51 -0
  284. package/dist/deploy/site/types.js +2 -0
  285. package/dist/deploy/site-update/check-for-update.d.ts +19 -0
  286. package/dist/deploy/site-update/check-for-update.js +19 -0
  287. package/dist/deploy/site-update/contracts.d.ts +161 -0
  288. package/dist/deploy/site-update/contracts.js +94 -0
  289. package/dist/deploy/site-update/desktop-site-update.d.ts +66 -0
  290. package/dist/deploy/site-update/desktop-site-update.js +43 -0
  291. package/dist/deploy/site-update/fake-site-update.d.ts +39 -0
  292. package/dist/deploy/site-update/fake-site-update.js +52 -0
  293. package/dist/deploy/site-update/run-site-update.d.ts +121 -0
  294. package/dist/deploy/site-update/run-site-update.js +219 -0
  295. package/dist/deploy/site-update/self-hosted-site-update.d.ts +71 -0
  296. package/dist/deploy/site-update/self-hosted-site-update.js +79 -0
  297. package/dist/deploy/target-contracts.d.ts +3 -0
  298. package/dist/deploy/tool.d.ts +5 -8
  299. package/dist/deploy/tool.js +6 -9
  300. package/dist/dns/binding-sweeper.d.ts +72 -0
  301. package/dist/dns/binding-sweeper.js +53 -0
  302. package/dist/dns/index.d.ts +1 -0
  303. package/dist/dns/index.js +1 -0
  304. package/dist/dns/site/binding.repo.d.ts +71 -0
  305. package/dist/dns/site/binding.repo.js +45 -0
  306. package/dist/dns/site/dns-changes.d.ts +90 -0
  307. package/dist/dns/site/dns-changes.js +271 -0
  308. package/dist/dns/site/dns-tools.d.ts +46 -0
  309. package/dist/dns/site/dns-tools.js +204 -0
  310. package/dist/dns/site/mail-dns-status.d.ts +111 -0
  311. package/dist/dns/site/mail-dns-status.js +190 -0
  312. package/dist/dns/site/mail-dns-tools.d.ts +33 -0
  313. package/dist/dns/site/mail-dns-tools.js +62 -0
  314. package/dist/dns/site/mail-requirements.d.ts +30 -0
  315. package/dist/dns/site/mail-requirements.js +78 -0
  316. package/dist/dns/site/tool-deps.d.ts +21 -0
  317. package/dist/dns/site/tool-deps.js +2 -0
  318. package/dist/dns/site/tools.d.ts +74 -0
  319. package/dist/dns/site/tools.js +124 -0
  320. package/dist/local-dev/bind-host.d.ts +80 -0
  321. package/dist/local-dev/bind-host.js +90 -0
  322. package/dist/local-dev/dev-proxy-upstream.d.ts +69 -0
  323. package/dist/local-dev/dev-proxy-upstream.js +63 -0
  324. package/dist/local-dev/index.d.ts +28 -0
  325. package/dist/local-dev/index.js +25 -0
  326. package/dist/packaging/electron/archive.d.ts +2 -9
  327. package/dist/packaging/electron/asar-adapter.d.ts +2 -1
  328. package/dist/packaging/electron/entry.d.ts +2 -0
  329. package/dist/packaging/electron/move-to-applications.d.ts +165 -0
  330. package/dist/packaging/electron/move-to-applications.js +162 -0
  331. package/dist/packaging/electron/policies.d.ts +33 -4
  332. package/dist/packaging/electron/policies.js +29 -10
  333. package/dist/packaging/electron/ports.d.ts +1 -6
  334. package/dist/packaging/electron/staging.d.ts +11 -2
  335. package/dist/packaging/electron/staging.js +15 -5
  336. package/dist/packaging/electron/update-manifest-merge.js +0 -2
  337. package/dist/react/site-share-expiry/ShareExpiryControls.d.ts +29 -0
  338. package/dist/react/site-share-expiry/ShareExpiryControls.js +7 -0
  339. package/dist/react/site-share-expiry/index.d.ts +2 -0
  340. package/dist/react/site-share-expiry/index.js +2 -0
  341. package/dist/source-control/react/ProvidersTab.d.ts +98 -0
  342. package/dist/source-control/react/ProvidersTab.js +195 -0
  343. package/dist/source-control/react/SourceControl.d.ts +51 -0
  344. package/dist/source-control/react/SourceControl.js +61 -0
  345. package/dist/source-control/react/hooks/use-source-control-credentials.hooks.d.ts +128 -0
  346. package/dist/source-control/react/hooks/use-source-control-credentials.hooks.js +102 -0
  347. package/dist/source-control/react/rules.d.ts +167 -0
  348. package/dist/source-control/react/rules.js +125 -0
  349. package/dist/source-control/react/source-control-visuals.d.ts +75 -0
  350. package/dist/source-control/react/source-control-visuals.js +48 -0
  351. package/dist/source-control/site/agent-tools.d.ts +5 -0
  352. package/dist/source-control/site/agent-tools.js +30 -0
  353. package/dist/source-control/site/bundled-provider-registry.d.ts +33 -0
  354. package/dist/source-control/site/bundled-provider-registry.js +37 -0
  355. package/dist/source-control/site/commit-schema.d.ts +40 -0
  356. package/dist/source-control/site/commit-schema.js +29 -0
  357. package/dist/source-control/site/commit-target.d.ts +26 -0
  358. package/dist/source-control/site/commit-target.js +58 -0
  359. package/dist/source-control/site/credential-form.d.ts +36 -0
  360. package/dist/source-control/site/credential-form.js +102 -0
  361. package/dist/source-control/site/credential-setup.d.ts +107 -0
  362. package/dist/source-control/site/credential-setup.js +216 -0
  363. package/dist/source-control/site/provider-kit.d.ts +37 -0
  364. package/dist/source-control/site/provider-kit.js +35 -0
  365. package/dist/source-control/site/provider-module.d.ts +251 -0
  366. package/dist/source-control/site/provider-module.js +2 -0
  367. package/dist/source-control/site/saved-key-bindings.d.ts +4 -0
  368. package/dist/source-control/site/saved-key-bindings.js +4 -0
  369. package/dist/source-control/site/static-site-packager-port.d.ts +37 -0
  370. package/dist/source-control/site/static-site-packager-port.js +2 -0
  371. package/dist/source-control/site/store.d.ts +209 -0
  372. package/dist/source-control/site/store.js +374 -0
  373. package/dist/source-control/site/store.validation.d.ts +72 -0
  374. package/dist/source-control/site/store.validation.js +168 -0
  375. package/dist/source-control/site/tool-registrations.d.ts +190 -0
  376. package/dist/source-control/site/tool-registrations.js +379 -0
  377. package/dist/static-export/asset-crawl.d.ts +30 -0
  378. package/dist/static-export/asset-crawl.js +71 -0
  379. package/dist/static-export/dynamic-asset-locations.d.ts +23 -0
  380. package/dist/static-export/dynamic-asset-locations.js +34 -0
  381. package/dist/static-export/html-url-locations.d.ts +3 -1
  382. package/dist/static-export/html-url-locations.js +43 -9
  383. package/dist/static-export/runner.js +26 -27
  384. package/dist/static-export/site/export-preflight.d.ts +48 -0
  385. package/dist/static-export/site/export-preflight.js +82 -0
  386. package/dist/static-export/site/media-original-urls.d.ts +57 -0
  387. package/dist/static-export/site/media-original-urls.js +109 -0
  388. package/dist/static-export/site/ports.d.ts +82 -0
  389. package/dist/static-export/site/ports.js +29 -0
  390. package/dist/static-export/site/public-origin-policy.d.ts +32 -0
  391. package/dist/static-export/site/public-origin-policy.js +68 -0
  392. package/dist/static-export/site/route-manifest.d.ts +65 -0
  393. package/dist/static-export/site/route-manifest.js +139 -0
  394. package/dist/static-export/site/site-exporter.d.ts +158 -0
  395. package/dist/static-export/site/site-exporter.js +112 -0
  396. package/dist/static-export/site/static-security-headers.d.ts +39 -0
  397. package/dist/static-export/site/static-security-headers.js +43 -0
  398. package/dist/static-export/site/theme-preview-manifest.d.ts +35 -0
  399. package/dist/static-export/site/theme-preview-manifest.js +28 -0
  400. package/dist/static-export/transforms.d.ts +1 -1
  401. package/dist/static-export/transforms.js +3 -3
  402. package/package.json +911 -7
@@ -0,0 +1,175 @@
1
+ import { deployTargetsLoader } from './publish-tool-execution.js';
2
+ import { requireNoInput } from '@jini-ai/core';
3
+ import { adaptLegacyAuthorize } from '@jini-ai/core';
4
+ import { listPublishCredentials } from './publish-credentials/store.js';
5
+ import {} from './static-publish/verify.js';
6
+ const DEPLOYMENTS_READ_PERMISSION = "deployments.read";
7
+ const SITE_PUBLISH_ENTITY = "site-publish";
8
+ /**
9
+ * Builds `deployment_get_static_publish_capabilities`'s per-provider `guidance` string — extracted
10
+ * from that handler's own `providers.map()` purely for readability (the four cases read as one flat
11
+ * decision this way rather than a nested ternary inline). `undefined` means "nothing to tell the
12
+ * human" (the provider is fully ready).
13
+ *
14
+ * The `"invalid"` and `"unreachable"` branches are deliberately worded differently, per code review:
15
+ * an `"invalid"` credential (the provider affirmatively rejected it) tells the human to fix it;
16
+ * an `"unreachable"` one (a network failure/timeout/5xx during the last check — says NOTHING about
17
+ * whether the credential itself is good) must never suggest replacing a possibly-fine credential
18
+ * over what may have been a transient blip. Collapsing the two into one "update it" message would
19
+ * risk sending someone to regenerate a working token — the same false-negative shape Defect A (this
20
+ * same finding session) was filed for, one layer up.
21
+ *
22
+ * @complexity O(1) — fixed string interpolation, no iteration.
23
+ * @overallScore 100
24
+ */
25
+ function buildCapabilityGuidance({ providerId, readiness, verification, credentialOrigin }, _options = {}) {
26
+ if (!readiness.configured)
27
+ return readiness.reason;
28
+ if (credentialOrigin === "environment") {
29
+ return `A ${providerId} key is configured on this server (environment). Publish with it; don't ask for or save another key.`;
30
+ }
31
+ if (verification === undefined) {
32
+ return `This ${providerId} credential is saved but has not been verified against ${providerId} yet — verify it in the Static Site tab before relying on it.`;
33
+ }
34
+ if (verification.status === "invalid") {
35
+ return `The saved ${providerId} credential was rejected by ${providerId} (checked ${verification.checkedAt}): ${verification.message} Update it in the Static Site tab.`;
36
+ }
37
+ if (verification.status === "unreachable") {
38
+ return `The last check of this ${providerId} credential could not reach ${providerId} (checked ${verification.checkedAt}): ${verification.message} This does not mean the credential is bad — try verifying again in the Static Site tab.`;
39
+ }
40
+ return undefined;
41
+ }
42
+ /** {@link buildProviderCapability}'s `savedCredentials` entries: no secret, only the token's last 4. */
43
+ function mapSavedCredentials(saved) {
44
+ return saved.map(({ id, label, isDefault, createdAt, updatedAt, tokenTail, tokenHint, credentialType, worksFor }) => ({ id, label, isDefault, createdAt, updatedAt, tokenTail, tokenHint, credentialType, worksFor }));
45
+ }
46
+ /**
47
+ * {@link buildProviderCapability}'s result-object assembly, split out from the value computation so
48
+ * neither half alone carries every branch in the original 100-line closure. `verifiedAt`/`accountLabel`
49
+ * are the two fields this handler still needs beyond what {@link buildCapabilityGuidance} itself reads.
50
+ *
51
+ * accountLabel prefers the default credential's stored column, healed by post-save verification,
52
+ * and falls back to cached verification only when that column is null (an unhealed or env-only row).
53
+ * Stored identity survives restart while the cache does not, and prevents guessing a GitHub account
54
+ * from the human's email instead of using the verified token's actual account.
55
+ */
56
+ function buildProviderCapabilityResult(spec, _options = {}) {
57
+ const { descriptor, ready, readiness, verified, verification, defaultCredential, lastPublish, savedCredentials, credentialOrigin, guidance } = spec;
58
+ return {
59
+ providerId: descriptor.id,
60
+ label: descriptor.label,
61
+ // What a publish to this host takes, besides `target` and `projectName`: pass each as a
62
+ // top-level string property of the same name.
63
+ configFields: descriptor.configFields.map(({ name, label, required, help }) => ({ name, label, required, ...(help !== undefined ? { help } : {}) })),
64
+ ready,
65
+ credentialConfigured: readiness.configured,
66
+ credentialOrigin,
67
+ verified,
68
+ verifiedAt: verification?.checkedAt ?? null,
69
+ // The verified credential's own public account login/username, when the host's verifier
70
+ // reports one — `null` when not yet verified, or for a provider whose verifier has no reviewed
71
+ // account field to read (see `verify.ts`'s header).
72
+ accountLabel: defaultCredential?.accountLabel ?? verification?.accountLabel ?? null,
73
+ lastPublish,
74
+ savedCredentials,
75
+ ...(guidance !== undefined ? { guidance } : {}),
76
+ };
77
+ }
78
+ /**
79
+ * Computes one provider's `deployment_get_static_publish_capabilities` entry — extracted from that
80
+ * handler's own `PROVIDER_IDS.map()` callback purely to keep this domain's complexity gates: this was
81
+ * previously a single ~100-line inline async arrow.
82
+ *
83
+ * `savedCredentials` include only this host's explicitly compatible keys, with defaults selected
84
+ * after compatibility and token-only shape filtering. `credentialConfigured` comes from
85
+ * `credentialSource.isConfigured` (a saved default, or in self-hosted mode an env var).
86
+ *
87
+ * `ready` means "will actually work," not merely "a credential is saved" (2026-08-16 fix: a saved
88
+ * GitHub token GitHub rejected outright with 401 used to still report `ready: true`) — a credential
89
+ * that is configured but never verified, that failed its last verification, or whose last check could
90
+ * not reach the provider is NOT ready.
91
+ *
92
+ * `verification` is a cached, non-decrypting read only — NEVER `verifyPublishCredential` from here
93
+ * (that decrypts and makes a real provider call; see `static-publish/verify.ts`'s own header for why
94
+ * this handler must never be its caller).
95
+ */
96
+ async function buildProviderCapability(loaded, ctx) {
97
+ const providerId = loaded.descriptor.id;
98
+ const savedForVendor = ctx.saved.filter(credential => credential.publishHosts.includes(providerId))
99
+ .map(credential => ({ ...credential, isDefault: credential.defaultFor.includes(providerId) }));
100
+ const savedCredentials = mapSavedCredentials(savedForVendor);
101
+ const defaultCredential = savedForVendor.find((credential) => credential.isDefault);
102
+ const readiness = await ctx.credentialSource.isConfigured({ workspaceId: ctx.deps.workspaceId, target: providerId });
103
+ // 2026-08-16, Defect 2: the last successful publish to this provider, if any — see
104
+ // `publish-history.ts`'s own header for the storage design. `null` means never published (from
105
+ // this server, in this history store) rather than an absent key, so an agent-facing JSON result
106
+ // always carries the field.
107
+ const lastPublish = await ctx.historyStore.getLast({ workspaceId: ctx.deps.workspaceId, target: providerId });
108
+ const verification = readiness.configured ? ctx.deps.publishCredentialVerificationCache.get({ workspaceId: ctx.deps.workspaceId, target: providerId, basis: readiness.basis }) : undefined;
109
+ const verified = verification ? verification.status : null;
110
+ const ready = readiness.configured && verified === "valid";
111
+ const fallbackOrigin = readiness.configured ? "environment" : null;
112
+ const credentialOrigin = savedCredentials.length ? "saved" : fallbackOrigin;
113
+ const guidance = buildCapabilityGuidance({ providerId, readiness, verification, credentialOrigin });
114
+ return { ...buildProviderCapabilityResult({ descriptor: loaded.descriptor, ready, readiness, verified, verification, defaultCredential, lastPublish, savedCredentials, credentialOrigin, guidance }),
115
+ defaultForNewDestination: loaded.module.defaultForNewDestination === true,
116
+ authenticatedPreview: loaded.module.preview !== undefined };
117
+ }
118
+ /** Preserve enabled-host readiness while exposing disabled/unknown hosts without claiming their
119
+ * credentials were inspected. Only activation permits executable use; loader refusals remain visible.
120
+ * @returns One host choice with explicit installation, activation and readiness states.
121
+ * @complexity O(1) metadata; enabled hosts delegate to the existing credential/history read model.
122
+ */
123
+ async function buildInstalledProviderCapability({ installed, registry, context }, _optional = {}) {
124
+ const loaded = registry.get(installed.descriptor.id);
125
+ const identity = { pluginId: installed.pluginId, enabled: installed.enabled };
126
+ if (installed.enabled === true && loaded?.pluginId === installed.pluginId) {
127
+ return { ...await buildProviderCapability(loaded, context), ...identity, executable: true };
128
+ }
129
+ return { providerId: installed.descriptor.id, label: installed.descriptor.label, ...identity,
130
+ executable: false, ready: false, credentialConfigured: null, savedCredentials: null,
131
+ guidance: installed.enabled === true
132
+ ? "The hosting plugin is enabled but its target could not be loaded. Inspect refusals before publishing."
133
+ : `Turn on Agent Plugin '${installed.pluginId}' under Admin → Agent Plugins, then call deployment_get_static_publish_capabilities again. Credentials and readiness have not been inspected for this host.` };
134
+ }
135
+ function hostsMissingSavedKey({ providers, installed }, _options = {}) {
136
+ return providers.filter(provider => !provider.savedCredentials?.length).map(provider => {
137
+ if (provider.executable)
138
+ return { id: provider.providerId, worksForIds: [] };
139
+ const vendorId = installed.find(item => item.descriptor.id === provider.providerId)?.descriptor.credential?.vendorId;
140
+ return { id: provider.providerId, worksForIds: [provider.providerId, vendorId].filter((id) => !!id).map(id => id.toLowerCase()) };
141
+ });
142
+ }
143
+ /**
144
+ * Never decrypts — reads through `listPublishCredentials` (a pure DB read of
145
+ * `vendor_credential_sets`; see its own "read model only" doc) and `credentialSource.isConfigured`
146
+ * (this file's own preview handler already relies on the identical never-decrypting contract).
147
+ * Structurally cannot reach `resolveForPublish`/`resolveDefaultForPublish`: this handler never
148
+ * hands them a `SecretSealerPort`. `tokenTail` is the stored last 4 characters, never derived by
149
+ * decrypting.
150
+ */
151
+ export async function getStaticPublishCapabilities({ deps, credentialSource, historyStore, ctx }) {
152
+ requireNoInput({ input: ctx.input });
153
+ await deps.requireToolPermission({ authorize: adaptLegacyAuthorize({ authorize: deps.authorize }), workspaceId: deps.workspaceId, principalId: ctx.principal.id, permission: DEPLOYMENTS_READ_PERMISSION }, { entityType: SITE_PUBLISH_ENTITY });
154
+ const loadDeployTargets = deployTargetsLoader(deps);
155
+ // Owner policy: unseal only server-side to derive the safe hint.
156
+ // Readiness still uses isConfigured(); no usable credential or provider probe reaches this result.
157
+ const saved = await listPublishCredentials({ ...deps.credentialStorePorts, repo: deps.vendorCredentialSetRepo, sealer: deps.siteAssistantSecretSealer, loadDeployTargets }, {
158
+ workspaceId: deps.workspaceId,
159
+ });
160
+ const registry = await loadDeployTargets({ workspaceId: deps.workspaceId });
161
+ const providerCapabilityContext = { deps, credentialSource, historyStore, saved };
162
+ const inventory = deps.loadInstalledDeployTargets
163
+ ? await deps.loadInstalledDeployTargets({ workspaceId: deps.workspaceId })
164
+ : { items: registry.list().map(({ descriptor, pluginId }) => ({ descriptor, pluginId, enabled: true })), refusals: [] };
165
+ const providers = await Promise.all(inventory.items.map(installed => buildInstalledProviderCapability({ installed, registry, context: providerCapabilityContext })));
166
+ const refusals = [...new Set([...inventory.refusals, ...registry.refusals])];
167
+ const missing = hostsMissingSavedKey({ providers, installed: inventory.items });
168
+ if (missing.length)
169
+ return { executionMode: deps.publishExecutionMode, providers, refusals,
170
+ credentialSetup: deps.vendorCredentialSetRepo.project
171
+ ? { toolId: "credential_copy_from_project", message: "Use a saved key to choose from Shared Keys, or enter a new key in the secure card." }
172
+ : { toolId: "credential_save", kind: "publish-host", message: "Open the secure key card to save a publishing key for this site." } };
173
+ return { executionMode: deps.publishExecutionMode, providers, refusals };
174
+ }
175
+ //# sourceMappingURL=publish-tool-capabilities.js.map
@@ -0,0 +1,48 @@
1
+ import { type ToolHandler } from '@jini-ai/core';
2
+ import type { StaticPublishToolDeps } from './publish-tool-deps.js';
3
+ import type { AssistantSurfaceDeps } from '@jini-ai/core/contracts/site/daemon-surface-exchanges';
4
+ import type { DeployTargetDescriptor } from './deploy-targets/types.js';
5
+ /**
6
+ * The agent's non-secret credential-field values (form pre-fill, or hosting-setup input). Refuses a
7
+ * secret field, so a secret can never come from the chat, and a field the host does not declare. A
8
+ * blank value is left out.
9
+ *
10
+ * @throws {ToolInputError} naming the first refused key.
11
+ * @complexity O(k·f) input keys by credential fields.
12
+ */
13
+ export declare function readCredentialHints({ raw, descriptor, deps }: {
14
+ raw: Record<string, unknown>;
15
+ descriptor: DeployTargetDescriptor;
16
+ deps: StaticPublishToolDeps;
17
+ }, _optional?: Record<string, never>): Record<string, string>;
18
+ /**
19
+ * Builds this domain's `ToolRegistration[]` — the same shape every other domain's
20
+ * `build<Domain>Registrations` produces (see e.g. `recovery/tool-registrations.ts`'s
21
+ * `buildRecoveryRegistrations`). Called by `assistant/tool-registrations.ts`, which imports
22
+ * `buildStaticPublishRegistrations`/`staticPublishDerivedRisk` from this file and lists them as
23
+ * their own `"static-publish"` entry in `DOMAIN_SLICES` — see that file's own comment on that entry
24
+ * for why static-publish stays a separate slice rather than folding into this directory's sibling
25
+ * `deployments`/`agent-tools.ts` slice.
26
+ *
27
+ * @param deps - `StaticPublishToolDeps` plus this file's own test-only overrides (`credentialSource`,
28
+ * `buildTarget`). `credentialSource` defaults to the same DB-first, env-fallback-only-in-
29
+ * `"self-hosted-cli"`-mode composition `publish-site.ts`'s route constructs.
30
+ * @param surfaces - The held-open confirmation exchange store `deployment_execute_static_publish`
31
+ * parks on — see this file's header. Required, matching `buildPostRegistrations`' own shape (the
32
+ * other domain whose gate needs this), since a domain with no store at all could never wire this
33
+ * tool's gate at all.
34
+ * @complexity O(1) registration-time cost; each wired handler's own cost is documented at its call
35
+ * site above (preview/capabilities: O(1) plus the provider count; execute: one `exportSite` pass
36
+ * plus one provider API call, only after a human confirms).
37
+ */
38
+ /** Bind publish credential saving to its existing descriptor, permission and sealed-store owner.
39
+ * @param required - Existing publish dependencies and shared surface exchanges.
40
+ * @returns An internal save adapter, never a retired tool registration.
41
+ * @example buildPublishHostCredentialHandler({ deps, surfaces });
42
+ * @complexity O(1) binding; invocation reads the provider registry and saved credential summaries.
43
+ */
44
+ export declare function buildPublishHostCredentialHandler({ deps, surfaces }: {
45
+ deps: StaticPublishToolDeps;
46
+ surfaces: AssistantSurfaceDeps;
47
+ }, _optional?: {}): ToolHandler;
48
+ //# sourceMappingURL=publish-tool-credential.d.ts.map
@@ -0,0 +1,284 @@
1
+ import { PublishCredentialValidationError } from './publish-credentials/store-validation.js';
2
+ import { deployTargetsLoader, requireStaticPublishTarget } from './publish-tool-execution.js';
3
+ import { ToolInputError, requireInputRecord } from '@jini-ai/core';
4
+ import { adaptLegacyAuthorize } from '@jini-ai/core';
5
+ import { nowIso as clockNowIso } from '@jini-ai/core/primitives';
6
+ import { PublishCredentialDuplicateLabelError, listPublishCredentials, createPublishCredential, updatePublishCredential } from './publish-credentials/store.js';
7
+ import { verifyPublishCredentialById, verifySubmittedPublishCredential } from './static-publish/verify.js';
8
+ const SITE_PUBLISH_ENTITY = "site-publish";
9
+ /** The host whose credential the propose-credential tool saves: it must be loaded and declare one.
10
+ * @throws {ToolInputError} unknown host, or a host that takes no saved credential.
11
+ * @complexity O(1) — one registry lookup. */
12
+ function requireCredentialTarget(raw, registry) {
13
+ const { descriptor } = requireStaticPublishTarget(raw, registry);
14
+ if (descriptor.credential === undefined)
15
+ throw new ToolInputError({ message: `${descriptor.id} takes no saved credential.` });
16
+ return { descriptor, credential: descriptor.credential };
17
+ }
18
+ /**
19
+ * The agent's non-secret credential-field values (form pre-fill, or hosting-setup input). Refuses a
20
+ * secret field, so a secret can never come from the chat, and a field the host does not declare. A
21
+ * blank value is left out.
22
+ *
23
+ * @throws {ToolInputError} naming the first refused key.
24
+ * @complexity O(k·f) input keys by credential fields.
25
+ */
26
+ export function readCredentialHints({ raw, descriptor, deps }, _optional = {}) {
27
+ const fields = descriptor.credential?.fields ?? [];
28
+ const hints = {};
29
+ for (const [key, value] of Object.entries(raw)) {
30
+ if (key === "target")
31
+ continue;
32
+ const field = fields.find((candidate) => candidate.name === key);
33
+ if (field === undefined) {
34
+ const takes = fields.length > 0 ? `It takes: ${fields.map((candidate) => candidate.name).join(", ")}.` : "It takes none.";
35
+ throw new ToolInputError({ message: `'${key}' is not a credential field of ${descriptor.id}. ${takes}` });
36
+ }
37
+ const hint = readCredentialHint({ deps, key, value, field, tokenField: descriptor.credential?.tokenField });
38
+ if (hint.trim() !== "")
39
+ hints[key] = hint;
40
+ }
41
+ return hints;
42
+ }
43
+ /** Validate a declared chat hint before allowing it into a credential form. */
44
+ function readCredentialHint({ deps, key, value, field, tokenField }, _options = {}) {
45
+ if (field.secret === true || key === tokenField)
46
+ throw new ToolInputError({ message: `'${key}' is secret: the person types it into the form, never into the chat.` });
47
+ if (typeof value !== "string")
48
+ throw new ToolInputError({ message: `'${key}' must be a string.` });
49
+ deps.assertCredentialFreeField({ value, field: key });
50
+ return value;
51
+ }
52
+ /** The propose-credential form, built from the host's credential spec. Posts back on cancel rather
53
+ * than closing silently: with the call parked, a silent close would strand the handler for the full
54
+ * TTL. */
55
+ function buildProposeCredentialForm(required, _optional = {}) {
56
+ const { deps, descriptor, credential, prefill, updating } = required;
57
+ return {
58
+ title: `Connect ${descriptor.label}`,
59
+ ...(credential.help !== undefined ? { description: credential.help } : {}),
60
+ submitLabel: "Save connection",
61
+ fields: credential.fields.flatMap((field) => {
62
+ const base = { kind: "string", name: field.name, label: field.label,
63
+ ...(field.help !== undefined ? { hint: field.help } : {}), required: field.required };
64
+ if (field.secret === true || field.name === credential.tokenField) {
65
+ // The store keeps exact blank secrets on update; the form must permit that submission too.
66
+ const secret = { ...base, secret: true, required: updating ? false : field.required, allowBlank: updating || !field.required };
67
+ if (updating && !field.required && field.name !== credential.tokenField) {
68
+ return [secret, { kind: "boolean", name: `clear-${field.name}`, label: `Remove ${field.label}`, value: false,
69
+ hint: "Remove the saved value when this connection is saved. Leave unchecked to keep or replace it." }];
70
+ }
71
+ return [secret];
72
+ }
73
+ return [{ ...base, ...(prefill[field.name] !== undefined ? { value: prefill[field.name] } : {}) }];
74
+ }),
75
+ ...(deps.credentialFormApp === undefined ? {} : { app: deps.credentialFormApp }),
76
+ preferredFrameSize: ["100%", "560px"],
77
+ };
78
+ }
79
+ /** Only declared host fields enter the persisted connection; blank secrets keep their prior value. */
80
+ function publishConnectionValues({ targetId, credential, values }, _optional = {}) {
81
+ const connection = { providerId: targetId };
82
+ for (const field of credential.fields) {
83
+ // The form submits a blank optional secret as ""; omitted, the store reads it as not provided
84
+ // on create and keeps the stored one on update.
85
+ const blankOptionalSecret = values[field.name] === "" && field.secret === true && !field.required;
86
+ // The explicit remove choice wins over typed text; blank alone still keeps the saved secret.
87
+ if (values[`clear-${field.name}`] === true) {
88
+ connection[field.name] = null;
89
+ continue;
90
+ }
91
+ if (typeof values[field.name] === "string" && !blankOptionalSecret)
92
+ connection[field.name] = values[field.name];
93
+ }
94
+ return connection;
95
+ }
96
+ /** An explicit default wins; a sole visible row is also an unambiguous update target. */
97
+ function publishCredentialToUpdate({ rows, targetId }, _optional = {}) {
98
+ const candidates = rows.filter(row => row.providerId === targetId);
99
+ return candidates.find(row => row.isDefault) ?? (candidates.length === 1 ? candidates[0] : undefined);
100
+ }
101
+ /**
102
+ * Saves the submitted form as the host's connection: updates its default or sole visible row,
103
+ * otherwise creates a distinct project key. Only the host's declared
104
+ * fields are forwarded; `publish-credentials/store.ts` is the one place that decides what is valid
105
+ * (the form ships `novalidate`, so this is the real enforcement point). Its messages name fields,
106
+ * never values.
107
+ *
108
+ * @complexity O(n) in the workspace's saved credential count.
109
+ */
110
+ async function saveProposedCredential(required, _optional = {}) {
111
+ const { deps, targetId, credential, values, signal } = required;
112
+ const connection = publishConnectionValues({ targetId, credential, values });
113
+ const repo = deps.abortGuardedCredentialRepo({ store: deps.vendorCredentialSetRepo, signal });
114
+ const writeDeps = {
115
+ ...deps.credentialStorePorts,
116
+ repo,
117
+ // Only this submitted secret card receives the trusted, grant-checked replacement port.
118
+ allowSharedKeyReplacement: true,
119
+ loadDeployTargets: deployTargetsLoader(deps),
120
+ sealer: deps.siteAssistantSecretSealer,
121
+ keyring: deps.siteAssistantSecretKeyring,
122
+ clock: deps.clock,
123
+ idGen: deps.idGen,
124
+ };
125
+ const saved = await listPublishCredentials(writeDeps, { workspaceId: deps.workspaceId });
126
+ const existing = publishCredentialToUpdate({ rows: saved, targetId });
127
+ // A failed replacement check must leave the working default key intact, before any seal/write.
128
+ if (existing)
129
+ await checkPublishReplacement({ deps, targetId, credential, connection });
130
+ // Cancellation may arrive during the metadata read or probe; refuse before invoking persistence.
131
+ signal.throwIfAborted();
132
+ const stored = existing
133
+ ? await updatePublishCredential(writeDeps, { workspaceId: deps.workspaceId, id: existing.id, connection })
134
+ : await createPublishCredential(writeDeps, { workspaceId: deps.workspaceId, label: `${deps.credentialRowLabel}-${deps.idGen.newId()}`, connection,
135
+ // New project keys stay non-default while the shared save-result path attaches them to this site.
136
+ ...(deps.vendorCredentialSetRepo.project ? { isDefault: false } : {}) });
137
+ return { credentialId: stored.id, tokenHint: stored.tokenHint ?? null, usedByThisSite: existing !== undefined || stored.scope !== "project" };
138
+ }
139
+ /** Reuse the provider-owned verifier only where replacement would destroy an existing key.
140
+ * @throws PublishCredentialValidationError with fixed copy on refusal/unavailability; preserves legacy hosts without checks.
141
+ * @complexity One registry lookup/load plus one bounded provider check, no persistence.
142
+ */
143
+ async function checkPublishReplacement({ deps, targetId, credential, connection }, _options = {}) {
144
+ // A blank secret keeps the stored one (store.ts updatedConnection), so no working key is replaced.
145
+ // A blank OPTIONAL secret is no reason to skip checking a replaced token.
146
+ if (credential.fields.some(field => (field.secret === true && field.required || field.name === credential.tokenField) && !connection[field.name]))
147
+ return;
148
+ const registry = await deployTargetsLoader(deps)({ workspaceId: deps.workspaceId });
149
+ if (!registry.get(targetId)?.module.verifyCredential)
150
+ return;
151
+ const verification = await verifySubmittedPublishCredential({
152
+ deps: { ...deps.verificationPorts, loadDeployTargets: async () => registry, clock: { nowIso: () => clockNowIso({ clock: deps.clock }) },
153
+ ...(deps.fetchFn === undefined ? {} : { fetchFn: deps.fetchFn }), ...(deps.observability === undefined ? {} : { observability: deps.observability }) },
154
+ workspaceId: deps.workspaceId, target: targetId, spec: credential,
155
+ connection: connection,
156
+ });
157
+ if (verification.status === 'valid')
158
+ return;
159
+ throw new PublishCredentialValidationError(verification.status === 'invalid'
160
+ ? 'This key was refused for this purpose. Nothing was saved. The previous key was kept.'
161
+ : "The service couldn't be reached. Nothing was saved. The previous key was kept.");
162
+ }
163
+ /**
164
+ * `deployment_propose_custom_provider_credential`'s domain save and post-save probe — kept separate
165
+ * so their cost is measured independently of the engine's exchange lifecycle.
166
+ * @complexity One existing credential write plus an optional provider verification.
167
+ */
168
+ async function saveProposeCredential(required, _optional = {}) {
169
+ const { deps, targetId, locale } = required;
170
+ const saveResult = await saveProposedCredential(required);
171
+ // NEVER echoes a field value, secret or not. Owner 2026-10-07: the submitted human card
172
+ // now authorizes the same post-save read-only check as the admin form. Model-only reads stay probe-free.
173
+ let connection = 'saved';
174
+ try {
175
+ const registry = await deployTargetsLoader(deps)({ workspaceId: deps.workspaceId });
176
+ if (saveResult.usedByThisSite && registry.get(targetId)?.module.verifyCredential) {
177
+ const verification = await verifyPublishCredentialById({
178
+ ...deps.verificationPorts, ...deps.credentialSourceStorePorts, repo: deps.vendorCredentialSetRepo, sealer: deps.siteAssistantSecretSealer,
179
+ cache: deps.publishCredentialVerificationCache, clock: { nowIso: () => clockNowIso({ clock: deps.clock }) },
180
+ loadDeployTargets: deployTargetsLoader(deps),
181
+ ...(deps.observability === undefined ? {} : { observability: deps.observability }), ...(deps.fetchFn === undefined ? {} : { fetchFn: deps.fetchFn }),
182
+ }, { workspaceId: deps.workspaceId, id: saveResult.credentialId });
183
+ connection = credentialConnectionStatus({ verification, deps });
184
+ }
185
+ }
186
+ catch {
187
+ connection = 'unreachable';
188
+ }
189
+ const hint = deps.formatCredentialHint({ hint: saveResult.tokenHint, locale });
190
+ return { saved: true, credentialId: saveResult.credentialId, providerId: targetId, connected: connection === 'connected', connection,
191
+ tokenHint: saveResult.tokenHint, message: `${hint ? hint + '. ' : ''}${deps.credentialText({ id: connection, locale })}` };
192
+ }
193
+ /** Translate verification into the credential card's existing connection vocabulary. */
194
+ function credentialConnectionStatus({ verification, deps }, _options = {}) {
195
+ if (verification?.status === 'valid')
196
+ return 'connected';
197
+ if (verification?.status === 'invalid')
198
+ return 'auth';
199
+ return verification?.message === deps.credentialText({ id: 'timeout' }) ? 'timeout' : 'unreachable';
200
+ }
201
+ /**
202
+ * Builds this domain's `ToolRegistration[]` — the same shape every other domain's
203
+ * `build<Domain>Registrations` produces (see e.g. `recovery/tool-registrations.ts`'s
204
+ * `buildRecoveryRegistrations`). Called by `assistant/tool-registrations.ts`, which imports
205
+ * `buildStaticPublishRegistrations`/`staticPublishDerivedRisk` from this file and lists them as
206
+ * their own `"static-publish"` entry in `DOMAIN_SLICES` — see that file's own comment on that entry
207
+ * for why static-publish stays a separate slice rather than folding into this directory's sibling
208
+ * `deployments`/`agent-tools.ts` slice.
209
+ *
210
+ * @param deps - `StaticPublishToolDeps` plus this file's own test-only overrides (`credentialSource`,
211
+ * `buildTarget`). `credentialSource` defaults to the same DB-first, env-fallback-only-in-
212
+ * `"self-hosted-cli"`-mode composition `publish-site.ts`'s route constructs.
213
+ * @param surfaces - The held-open confirmation exchange store `deployment_execute_static_publish`
214
+ * parks on — see this file's header. Required, matching `buildPostRegistrations`' own shape (the
215
+ * other domain whose gate needs this), since a domain with no store at all could never wire this
216
+ * tool's gate at all.
217
+ * @complexity O(1) registration-time cost; each wired handler's own cost is documented at its call
218
+ * site above (preview/capabilities: O(1) plus the provider count; execute: one `exportSite` pass
219
+ * plus one provider API call, only after a human confirms).
220
+ */
221
+ /** Bind publish credential saving to its existing descriptor, permission and sealed-store owner.
222
+ * @param required - Existing publish dependencies and shared surface exchanges.
223
+ * @returns An internal save adapter, never a retired tool registration.
224
+ * @example buildPublishHostCredentialHandler({ deps, surfaces });
225
+ * @complexity O(1) binding; invocation reads the provider registry and saved credential summaries.
226
+ */
227
+ export function buildPublishHostCredentialHandler({ deps, surfaces }, _optional = {}) {
228
+ return async (ctx, optional = {}) => {
229
+ const raw = requireInputRecord({ input: ctx.input });
230
+ const { descriptor, credential } = requireCredentialTarget(raw, await deployTargetsLoader(deps)({ workspaceId: deps.workspaceId }));
231
+ const prefill = readCredentialHints({ raw, descriptor, deps });
232
+ await deps.requireToolPermission({ authorize: adaptLegacyAuthorize({ authorize: deps.authorize }), workspaceId: deps.workspaceId, principalId: ctx.principal.id, permission: "deployments.credentials.write" }, { entityType: SITE_PUBLISH_ENTITY });
233
+ // Fail closed rather than degrade — identical posture to the execute-publish guard above.
234
+ // The engine supplies a ToolInputError so the refusal remains caller-safe through transport.
235
+ const stored = await listPublishCredentials({ ...deps.credentialStorePorts, repo: deps.vendorCredentialSetRepo, loadDeployTargets: deployTargetsLoader(deps) }, { workspaceId: deps.workspaceId });
236
+ const updating = publishCredentialToUpdate({ rows: stored, targetId: descriptor.id }) !== undefined;
237
+ const locale = await deps.resolveOperatorLocale({ deps, workspaceId: deps.workspaceId, principalId: ctx.principal.id });
238
+ const pluginCard = await deps.findPluginCredentialCard({ loadCards: deps.loadPluginCredentialCards, workspaceId: deps.workspaceId, saveKind: 'publish-host', target: descriptor.id });
239
+ const card = deps.defineSecretCardTool({
240
+ toolId: deps.credentialSaveToolId,
241
+ prepare: async () => ({ descriptor, credential, prefill, updating, locale }),
242
+ // New project keys need explicit attachment; an update changes the saved row where it lives.
243
+ form: ({ prep }) => deps.applyPluginCredentialCard({ ...(pluginCard === undefined ? {} : { card: pluginCard }), form: buildProposeCredentialForm({ ...prep, deps }) }),
244
+ save: ({ values, prep, signal }) => saveProposeCredential({ deps, targetId: prep.descriptor.id, credential: prep.credential, values, signal, locale: prep.locale }),
245
+ result: ({ prep, run }) => {
246
+ if (run.status === 'saved')
247
+ return run.saved;
248
+ if (run.status === 'cancelled')
249
+ return { saved: false, cancelled: true };
250
+ if (run.status === 'blank' || run.status === 'failed')
251
+ return { saved: false, cancelled: false, reason: 'invalid',
252
+ message: run.status === 'blank' ? deps.credentialText({ id: 'blank', locale: prep.locale }) : run.safeMessage };
253
+ return { saved: false, cancelled: false, reason: run.status,
254
+ note: run.status === 'expired' ? "The user did not respond to the credential form before it expired. Nothing was saved." : "The credential form was closed because the run ended. Nothing was saved." };
255
+ },
256
+ outcome: ({ prep, run }) => {
257
+ if (run.status === 'cancelled' || run.status === 'expired' || run.status === 'abandoned')
258
+ return undefined;
259
+ const saved = run.status === 'saved';
260
+ let message;
261
+ if (run.status === 'saved')
262
+ message = run.saved.message;
263
+ else if (run.status === 'blank')
264
+ message = deps.credentialText({ id: 'blank', locale: prep.locale });
265
+ else if (run.status === 'failed')
266
+ message = run.safeMessage;
267
+ else
268
+ message = deps.credentialText({ id: 'unreachable', locale: prep.locale });
269
+ return { title: deps.credentialText({ id: saved ? 'savedTitle' : 'unreachable', locale: prep.locale }), state: saved ? 'success' : 'failure', message };
270
+ },
271
+ }, {
272
+ ...deps.secretCardOptions,
273
+ text: { ...deps.secretCardOptions.text, saveFailure: deps.credentialText({ id: 'unreachable', locale }) },
274
+ safeError: err => {
275
+ if (err instanceof PublishCredentialDuplicateLabelError)
276
+ return err.message;
277
+ return err instanceof PublishCredentialValidationError ? deps.translateCredentialMessage({ message: err.message, locale }) : undefined;
278
+ },
279
+ logFailure: metadata => deps.staticPublishPorts.warn(JSON.stringify(metadata)),
280
+ });
281
+ return card.handler({ surfaceExchanges: surfaces.surfaceExchanges, askThenReport: deps.askThenReport })(ctx, optional);
282
+ };
283
+ }
284
+ //# sourceMappingURL=publish-tool-credential.js.map