thevoidforge 21.0.0

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 (328) hide show
  1. package/dist/scripts/vault-read.d.ts +11 -0
  2. package/dist/scripts/vault-read.js +89 -0
  3. package/dist/scripts/voidforge.d.ts +20 -0
  4. package/dist/scripts/voidforge.js +404 -0
  5. package/dist/tsconfig.tsbuildinfo +1 -0
  6. package/dist/wizard/api/auth.d.ts +5 -0
  7. package/dist/wizard/api/auth.js +133 -0
  8. package/dist/wizard/api/blueprint.d.ts +45 -0
  9. package/dist/wizard/api/blueprint.js +184 -0
  10. package/dist/wizard/api/cloud-providers.d.ts +16 -0
  11. package/dist/wizard/api/cloud-providers.js +363 -0
  12. package/dist/wizard/api/credentials.d.ts +1 -0
  13. package/dist/wizard/api/credentials.js +258 -0
  14. package/dist/wizard/api/danger-room.d.ts +18 -0
  15. package/dist/wizard/api/danger-room.js +401 -0
  16. package/dist/wizard/api/deploy.d.ts +4 -0
  17. package/dist/wizard/api/deploy.js +164 -0
  18. package/dist/wizard/api/prd.d.ts +1 -0
  19. package/dist/wizard/api/prd.js +363 -0
  20. package/dist/wizard/api/project.d.ts +1 -0
  21. package/dist/wizard/api/project.js +239 -0
  22. package/dist/wizard/api/projects.d.ts +6 -0
  23. package/dist/wizard/api/projects.js +648 -0
  24. package/dist/wizard/api/provision.d.ts +4 -0
  25. package/dist/wizard/api/provision.js +535 -0
  26. package/dist/wizard/api/terminal.d.ts +25 -0
  27. package/dist/wizard/api/terminal.js +241 -0
  28. package/dist/wizard/api/users.d.ts +6 -0
  29. package/dist/wizard/api/users.js +244 -0
  30. package/dist/wizard/api/war-room.d.ts +14 -0
  31. package/dist/wizard/api/war-room.js +45 -0
  32. package/dist/wizard/lib/ad-platform-core.d.ts +6 -0
  33. package/dist/wizard/lib/ad-platform-core.js +1 -0
  34. package/dist/wizard/lib/adapters/index.d.ts +52 -0
  35. package/dist/wizard/lib/adapters/index.js +38 -0
  36. package/dist/wizard/lib/adapters/sandbox-bank.d.ts +17 -0
  37. package/dist/wizard/lib/adapters/sandbox-bank.js +77 -0
  38. package/dist/wizard/lib/adapters/sandbox.d.ts +39 -0
  39. package/dist/wizard/lib/adapters/sandbox.js +174 -0
  40. package/dist/wizard/lib/adapters/stripe.d.ts +19 -0
  41. package/dist/wizard/lib/adapters/stripe.js +143 -0
  42. package/dist/wizard/lib/adapters/types.d.ts +9 -0
  43. package/dist/wizard/lib/adapters/types.js +10 -0
  44. package/dist/wizard/lib/agent-memory.d.ts +36 -0
  45. package/dist/wizard/lib/agent-memory.js +114 -0
  46. package/dist/wizard/lib/anomaly-detection.d.ts +59 -0
  47. package/dist/wizard/lib/anomaly-detection.js +122 -0
  48. package/dist/wizard/lib/anthropic.d.ts +21 -0
  49. package/dist/wizard/lib/anthropic.js +105 -0
  50. package/dist/wizard/lib/asset-scanner.d.ts +23 -0
  51. package/dist/wizard/lib/asset-scanner.js +107 -0
  52. package/dist/wizard/lib/audit-log.d.ts +23 -0
  53. package/dist/wizard/lib/audit-log.js +70 -0
  54. package/dist/wizard/lib/autonomy-controller.d.ts +76 -0
  55. package/dist/wizard/lib/autonomy-controller.js +183 -0
  56. package/dist/wizard/lib/body-parser.d.ts +2 -0
  57. package/dist/wizard/lib/body-parser.js +36 -0
  58. package/dist/wizard/lib/build-analytics.d.ts +39 -0
  59. package/dist/wizard/lib/build-analytics.js +91 -0
  60. package/dist/wizard/lib/build-step.d.ts +21 -0
  61. package/dist/wizard/lib/build-step.js +104 -0
  62. package/dist/wizard/lib/campaign-proposer.d.ts +39 -0
  63. package/dist/wizard/lib/campaign-proposer.js +180 -0
  64. package/dist/wizard/lib/campaign-state-machine.d.ts +63 -0
  65. package/dist/wizard/lib/campaign-state-machine.js +114 -0
  66. package/dist/wizard/lib/ci-generator.d.ts +14 -0
  67. package/dist/wizard/lib/ci-generator.js +187 -0
  68. package/dist/wizard/lib/claude-merge.d.ts +38 -0
  69. package/dist/wizard/lib/claude-merge.js +115 -0
  70. package/dist/wizard/lib/codegen/erd-gen.d.ts +16 -0
  71. package/dist/wizard/lib/codegen/erd-gen.js +98 -0
  72. package/dist/wizard/lib/codegen/integrations.d.ts +18 -0
  73. package/dist/wizard/lib/codegen/integrations.js +189 -0
  74. package/dist/wizard/lib/codegen/openapi-gen.d.ts +15 -0
  75. package/dist/wizard/lib/codegen/openapi-gen.js +79 -0
  76. package/dist/wizard/lib/codegen/prisma-types.d.ts +15 -0
  77. package/dist/wizard/lib/codegen/prisma-types.js +44 -0
  78. package/dist/wizard/lib/codegen/seed-gen.d.ts +16 -0
  79. package/dist/wizard/lib/codegen/seed-gen.js +128 -0
  80. package/dist/wizard/lib/compliance.d.ts +51 -0
  81. package/dist/wizard/lib/compliance.js +112 -0
  82. package/dist/wizard/lib/correlation-engine.d.ts +59 -0
  83. package/dist/wizard/lib/correlation-engine.js +151 -0
  84. package/dist/wizard/lib/cost-estimator.d.ts +22 -0
  85. package/dist/wizard/lib/cost-estimator.js +72 -0
  86. package/dist/wizard/lib/cost-tracker.d.ts +27 -0
  87. package/dist/wizard/lib/cost-tracker.js +37 -0
  88. package/dist/wizard/lib/daemon-aggregator.d.ts +71 -0
  89. package/dist/wizard/lib/daemon-aggregator.js +204 -0
  90. package/dist/wizard/lib/daemon-core.d.ts +6 -0
  91. package/dist/wizard/lib/daemon-core.js +5 -0
  92. package/dist/wizard/lib/dashboard-data.d.ts +132 -0
  93. package/dist/wizard/lib/dashboard-data.js +336 -0
  94. package/dist/wizard/lib/dashboard-ws.d.ts +25 -0
  95. package/dist/wizard/lib/dashboard-ws.js +91 -0
  96. package/dist/wizard/lib/deep-current.d.ts +77 -0
  97. package/dist/wizard/lib/deep-current.js +234 -0
  98. package/dist/wizard/lib/deploy-coordinator.d.ts +40 -0
  99. package/dist/wizard/lib/deploy-coordinator.js +86 -0
  100. package/dist/wizard/lib/deploy-log.d.ts +28 -0
  101. package/dist/wizard/lib/deploy-log.js +52 -0
  102. package/dist/wizard/lib/desktop-notify.d.ts +27 -0
  103. package/dist/wizard/lib/desktop-notify.js +98 -0
  104. package/dist/wizard/lib/dns/cloudflare-dns.d.ts +35 -0
  105. package/dist/wizard/lib/dns/cloudflare-dns.js +216 -0
  106. package/dist/wizard/lib/dns/cloudflare-registrar.d.ts +31 -0
  107. package/dist/wizard/lib/dns/cloudflare-registrar.js +148 -0
  108. package/dist/wizard/lib/dns/types.d.ts +22 -0
  109. package/dist/wizard/lib/dns/types.js +4 -0
  110. package/dist/wizard/lib/document-discovery.d.ts +33 -0
  111. package/dist/wizard/lib/document-discovery.js +145 -0
  112. package/dist/wizard/lib/env-validator.d.ts +14 -0
  113. package/dist/wizard/lib/env-validator.js +205 -0
  114. package/dist/wizard/lib/env-writer.d.ts +13 -0
  115. package/dist/wizard/lib/env-writer.js +26 -0
  116. package/dist/wizard/lib/exec.d.ts +30 -0
  117. package/dist/wizard/lib/exec.js +52 -0
  118. package/dist/wizard/lib/experiment.d.ts +70 -0
  119. package/dist/wizard/lib/experiment.js +169 -0
  120. package/dist/wizard/lib/extensions.d.ts +20 -0
  121. package/dist/wizard/lib/extensions.js +183 -0
  122. package/dist/wizard/lib/financial/adapter-factory.d.ts +47 -0
  123. package/dist/wizard/lib/financial/adapter-factory.js +225 -0
  124. package/dist/wizard/lib/financial/billing/base.d.ts +6 -0
  125. package/dist/wizard/lib/financial/billing/base.js +1 -0
  126. package/dist/wizard/lib/financial/billing/google-billing.d.ts +56 -0
  127. package/dist/wizard/lib/financial/billing/google-billing.js +298 -0
  128. package/dist/wizard/lib/financial/billing/meta-billing.d.ts +54 -0
  129. package/dist/wizard/lib/financial/billing/meta-billing.js +243 -0
  130. package/dist/wizard/lib/financial/billing/tiktok-billing.d.ts +54 -0
  131. package/dist/wizard/lib/financial/billing/tiktok-billing.js +260 -0
  132. package/dist/wizard/lib/financial/campaign/base.d.ts +13 -0
  133. package/dist/wizard/lib/financial/campaign/base.js +1 -0
  134. package/dist/wizard/lib/financial/campaign/google-campaign.d.ts +42 -0
  135. package/dist/wizard/lib/financial/campaign/google-campaign.js +388 -0
  136. package/dist/wizard/lib/financial/campaign/meta-campaign.d.ts +41 -0
  137. package/dist/wizard/lib/financial/campaign/meta-campaign.js +311 -0
  138. package/dist/wizard/lib/financial/campaign/sandbox-campaign.d.ts +45 -0
  139. package/dist/wizard/lib/financial/campaign/sandbox-campaign.js +261 -0
  140. package/dist/wizard/lib/financial/campaign/tiktok-campaign.d.ts +40 -0
  141. package/dist/wizard/lib/financial/campaign/tiktok-campaign.js +350 -0
  142. package/dist/wizard/lib/financial/funding-auto.d.ts +44 -0
  143. package/dist/wizard/lib/financial/funding-auto.js +52 -0
  144. package/dist/wizard/lib/financial/funding-policy.d.ts +60 -0
  145. package/dist/wizard/lib/financial/funding-policy.js +179 -0
  146. package/dist/wizard/lib/financial/platform-planner.d.ts +47 -0
  147. package/dist/wizard/lib/financial/platform-planner.js +134 -0
  148. package/dist/wizard/lib/financial/reconciliation-engine.d.ts +78 -0
  149. package/dist/wizard/lib/financial/reconciliation-engine.js +193 -0
  150. package/dist/wizard/lib/financial/registry.d.ts +22 -0
  151. package/dist/wizard/lib/financial/registry.js +26 -0
  152. package/dist/wizard/lib/financial/reporting.d.ts +96 -0
  153. package/dist/wizard/lib/financial/reporting.js +198 -0
  154. package/dist/wizard/lib/financial/stablecoin/base.d.ts +6 -0
  155. package/dist/wizard/lib/financial/stablecoin/base.js +1 -0
  156. package/dist/wizard/lib/financial/stablecoin/circle.d.ts +54 -0
  157. package/dist/wizard/lib/financial/stablecoin/circle.js +367 -0
  158. package/dist/wizard/lib/financial/stablecoin/mercury.d.ts +24 -0
  159. package/dist/wizard/lib/financial/stablecoin/mercury.js +171 -0
  160. package/dist/wizard/lib/financial/stablecoin/sandbox-stablecoin.d.ts +47 -0
  161. package/dist/wizard/lib/financial/stablecoin/sandbox-stablecoin.js +202 -0
  162. package/dist/wizard/lib/financial/treasury-planner.d.ts +52 -0
  163. package/dist/wizard/lib/financial/treasury-planner.js +128 -0
  164. package/dist/wizard/lib/financial-core.d.ts +6 -0
  165. package/dist/wizard/lib/financial-core.js +5 -0
  166. package/dist/wizard/lib/financial-vault.d.ts +34 -0
  167. package/dist/wizard/lib/financial-vault.js +199 -0
  168. package/dist/wizard/lib/frontmatter.d.ts +30 -0
  169. package/dist/wizard/lib/frontmatter.js +96 -0
  170. package/dist/wizard/lib/gap-analysis.d.ts +37 -0
  171. package/dist/wizard/lib/gap-analysis.js +218 -0
  172. package/dist/wizard/lib/github.d.ts +22 -0
  173. package/dist/wizard/lib/github.js +261 -0
  174. package/dist/wizard/lib/headless-deploy.d.ts +14 -0
  175. package/dist/wizard/lib/headless-deploy.js +452 -0
  176. package/dist/wizard/lib/health-monitor.d.ts +15 -0
  177. package/dist/wizard/lib/health-monitor.js +91 -0
  178. package/dist/wizard/lib/health-poller.d.ts +9 -0
  179. package/dist/wizard/lib/health-poller.js +123 -0
  180. package/dist/wizard/lib/heartbeat.d.ts +15 -0
  181. package/dist/wizard/lib/heartbeat.js +827 -0
  182. package/dist/wizard/lib/http-helpers.d.ts +9 -0
  183. package/dist/wizard/lib/http-helpers.js +24 -0
  184. package/dist/wizard/lib/image-gen.d.ts +56 -0
  185. package/dist/wizard/lib/image-gen.js +159 -0
  186. package/dist/wizard/lib/instance-sizing.d.ts +26 -0
  187. package/dist/wizard/lib/instance-sizing.js +51 -0
  188. package/dist/wizard/lib/kongo/analytics.d.ts +29 -0
  189. package/dist/wizard/lib/kongo/analytics.js +179 -0
  190. package/dist/wizard/lib/kongo/campaigns.d.ts +52 -0
  191. package/dist/wizard/lib/kongo/campaigns.js +91 -0
  192. package/dist/wizard/lib/kongo/client.d.ts +58 -0
  193. package/dist/wizard/lib/kongo/client.js +221 -0
  194. package/dist/wizard/lib/kongo/jobs.d.ts +57 -0
  195. package/dist/wizard/lib/kongo/jobs.js +122 -0
  196. package/dist/wizard/lib/kongo/pages.d.ts +60 -0
  197. package/dist/wizard/lib/kongo/pages.js +150 -0
  198. package/dist/wizard/lib/kongo/provisioner.d.ts +64 -0
  199. package/dist/wizard/lib/kongo/provisioner.js +116 -0
  200. package/dist/wizard/lib/kongo/seed.d.ts +49 -0
  201. package/dist/wizard/lib/kongo/seed.js +237 -0
  202. package/dist/wizard/lib/kongo/types.d.ts +323 -0
  203. package/dist/wizard/lib/kongo/types.js +11 -0
  204. package/dist/wizard/lib/kongo/variants.d.ts +57 -0
  205. package/dist/wizard/lib/kongo/variants.js +88 -0
  206. package/dist/wizard/lib/kongo/webhooks.d.ts +41 -0
  207. package/dist/wizard/lib/kongo/webhooks.js +112 -0
  208. package/dist/wizard/lib/marker.d.ts +28 -0
  209. package/dist/wizard/lib/marker.js +79 -0
  210. package/dist/wizard/lib/migrator.d.ts +35 -0
  211. package/dist/wizard/lib/migrator.js +190 -0
  212. package/dist/wizard/lib/natural-language-deploy.d.ts +30 -0
  213. package/dist/wizard/lib/natural-language-deploy.js +186 -0
  214. package/dist/wizard/lib/network.d.ts +22 -0
  215. package/dist/wizard/lib/network.js +72 -0
  216. package/dist/wizard/lib/oauth-core.d.ts +6 -0
  217. package/dist/wizard/lib/oauth-core.js +5 -0
  218. package/dist/wizard/lib/open-browser.d.ts +1 -0
  219. package/dist/wizard/lib/open-browser.js +26 -0
  220. package/dist/wizard/lib/patterns/ad-billing-adapter.d.ts +209 -0
  221. package/dist/wizard/lib/patterns/ad-billing-adapter.js +269 -0
  222. package/dist/wizard/lib/patterns/ad-platform-adapter.d.ts +200 -0
  223. package/dist/wizard/lib/patterns/ad-platform-adapter.js +212 -0
  224. package/dist/wizard/lib/patterns/daemon-process.d.ts +88 -0
  225. package/dist/wizard/lib/patterns/daemon-process.js +271 -0
  226. package/dist/wizard/lib/patterns/financial-transaction.d.ts +161 -0
  227. package/dist/wizard/lib/patterns/financial-transaction.js +132 -0
  228. package/dist/wizard/lib/patterns/funding-plan.d.ts +136 -0
  229. package/dist/wizard/lib/patterns/funding-plan.js +200 -0
  230. package/dist/wizard/lib/patterns/oauth-token-lifecycle.d.ts +94 -0
  231. package/dist/wizard/lib/patterns/oauth-token-lifecycle.js +139 -0
  232. package/dist/wizard/lib/patterns/outbound-rate-limiter.d.ts +67 -0
  233. package/dist/wizard/lib/patterns/outbound-rate-limiter.js +216 -0
  234. package/dist/wizard/lib/patterns/revenue-source-adapter.d.ts +96 -0
  235. package/dist/wizard/lib/patterns/revenue-source-adapter.js +182 -0
  236. package/dist/wizard/lib/patterns/stablecoin-adapter.d.ts +218 -0
  237. package/dist/wizard/lib/patterns/stablecoin-adapter.js +264 -0
  238. package/dist/wizard/lib/prd-validator.d.ts +39 -0
  239. package/dist/wizard/lib/prd-validator.js +137 -0
  240. package/dist/wizard/lib/project-init.d.ts +24 -0
  241. package/dist/wizard/lib/project-init.js +193 -0
  242. package/dist/wizard/lib/project-registry.d.ts +86 -0
  243. package/dist/wizard/lib/project-registry.js +359 -0
  244. package/dist/wizard/lib/provision-manifest.d.ts +44 -0
  245. package/dist/wizard/lib/provision-manifest.js +164 -0
  246. package/dist/wizard/lib/provisioner-registry.d.ts +15 -0
  247. package/dist/wizard/lib/provisioner-registry.js +34 -0
  248. package/dist/wizard/lib/provisioners/aws-vps.d.ts +6 -0
  249. package/dist/wizard/lib/provisioners/aws-vps.js +643 -0
  250. package/dist/wizard/lib/provisioners/cloudflare.d.ts +6 -0
  251. package/dist/wizard/lib/provisioners/cloudflare.js +300 -0
  252. package/dist/wizard/lib/provisioners/docker.d.ts +6 -0
  253. package/dist/wizard/lib/provisioners/docker.js +75 -0
  254. package/dist/wizard/lib/provisioners/http-client.d.ts +20 -0
  255. package/dist/wizard/lib/provisioners/http-client.js +79 -0
  256. package/dist/wizard/lib/provisioners/railway.d.ts +6 -0
  257. package/dist/wizard/lib/provisioners/railway.js +413 -0
  258. package/dist/wizard/lib/provisioners/scripts/caddyfile.d.ts +10 -0
  259. package/dist/wizard/lib/provisioners/scripts/caddyfile.js +54 -0
  260. package/dist/wizard/lib/provisioners/scripts/deploy-vps.d.ts +10 -0
  261. package/dist/wizard/lib/provisioners/scripts/deploy-vps.js +112 -0
  262. package/dist/wizard/lib/provisioners/scripts/docker-compose.d.ts +11 -0
  263. package/dist/wizard/lib/provisioners/scripts/docker-compose.js +91 -0
  264. package/dist/wizard/lib/provisioners/scripts/dockerfile.d.ts +5 -0
  265. package/dist/wizard/lib/provisioners/scripts/dockerfile.js +185 -0
  266. package/dist/wizard/lib/provisioners/scripts/ecosystem-config.d.ts +10 -0
  267. package/dist/wizard/lib/provisioners/scripts/ecosystem-config.js +36 -0
  268. package/dist/wizard/lib/provisioners/scripts/provision-vps.d.ts +14 -0
  269. package/dist/wizard/lib/provisioners/scripts/provision-vps.js +202 -0
  270. package/dist/wizard/lib/provisioners/scripts/rollback-vps.d.ts +10 -0
  271. package/dist/wizard/lib/provisioners/scripts/rollback-vps.js +67 -0
  272. package/dist/wizard/lib/provisioners/self-deploy.d.ts +41 -0
  273. package/dist/wizard/lib/provisioners/self-deploy.js +185 -0
  274. package/dist/wizard/lib/provisioners/static-s3.d.ts +6 -0
  275. package/dist/wizard/lib/provisioners/static-s3.js +235 -0
  276. package/dist/wizard/lib/provisioners/types.d.ts +40 -0
  277. package/dist/wizard/lib/provisioners/types.js +4 -0
  278. package/dist/wizard/lib/provisioners/vercel.d.ts +6 -0
  279. package/dist/wizard/lib/provisioners/vercel.js +287 -0
  280. package/dist/wizard/lib/pty-manager.d.ts +42 -0
  281. package/dist/wizard/lib/pty-manager.js +231 -0
  282. package/dist/wizard/lib/rate-limiter-core.d.ts +5 -0
  283. package/dist/wizard/lib/rate-limiter-core.js +5 -0
  284. package/dist/wizard/lib/reconciliation.d.ts +43 -0
  285. package/dist/wizard/lib/reconciliation.js +173 -0
  286. package/dist/wizard/lib/revenue-types.d.ts +5 -0
  287. package/dist/wizard/lib/revenue-types.js +1 -0
  288. package/dist/wizard/lib/route-optimizer.d.ts +28 -0
  289. package/dist/wizard/lib/route-optimizer.js +93 -0
  290. package/dist/wizard/lib/s3-deploy.d.ts +19 -0
  291. package/dist/wizard/lib/s3-deploy.js +156 -0
  292. package/dist/wizard/lib/safety-tiers.d.ts +76 -0
  293. package/dist/wizard/lib/safety-tiers.js +134 -0
  294. package/dist/wizard/lib/sentry-generator.d.ts +15 -0
  295. package/dist/wizard/lib/sentry-generator.js +116 -0
  296. package/dist/wizard/lib/server-config.d.ts +13 -0
  297. package/dist/wizard/lib/server-config.js +23 -0
  298. package/dist/wizard/lib/service-install.d.ts +18 -0
  299. package/dist/wizard/lib/service-install.js +182 -0
  300. package/dist/wizard/lib/site-scanner.d.ts +80 -0
  301. package/dist/wizard/lib/site-scanner.js +262 -0
  302. package/dist/wizard/lib/ssh-deploy.d.ts +25 -0
  303. package/dist/wizard/lib/ssh-deploy.js +225 -0
  304. package/dist/wizard/lib/templates.d.ts +24 -0
  305. package/dist/wizard/lib/templates.js +219 -0
  306. package/dist/wizard/lib/totp.d.ts +35 -0
  307. package/dist/wizard/lib/totp.js +276 -0
  308. package/dist/wizard/lib/tower-auth.d.ts +43 -0
  309. package/dist/wizard/lib/tower-auth.js +352 -0
  310. package/dist/wizard/lib/tower-rate-limit.d.ts +14 -0
  311. package/dist/wizard/lib/tower-rate-limit.js +61 -0
  312. package/dist/wizard/lib/tower-session.d.ts +28 -0
  313. package/dist/wizard/lib/tower-session.js +119 -0
  314. package/dist/wizard/lib/treasury-backup.d.ts +23 -0
  315. package/dist/wizard/lib/treasury-backup.js +126 -0
  316. package/dist/wizard/lib/treasury-heartbeat.d.ts +82 -0
  317. package/dist/wizard/lib/treasury-heartbeat.js +1104 -0
  318. package/dist/wizard/lib/updater.d.ts +29 -0
  319. package/dist/wizard/lib/updater.js +190 -0
  320. package/dist/wizard/lib/user-manager.d.ts +39 -0
  321. package/dist/wizard/lib/user-manager.js +182 -0
  322. package/dist/wizard/lib/vault.d.ts +26 -0
  323. package/dist/wizard/lib/vault.js +161 -0
  324. package/dist/wizard/router.d.ts +5 -0
  325. package/dist/wizard/router.js +15 -0
  326. package/dist/wizard/server.d.ts +18 -0
  327. package/dist/wizard/server.js +436 -0
  328. package/package.json +59 -0
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Kongo Campaigns — Campaign lifecycle operations.
3
+ *
4
+ * Create, list, update, publish/unpublish, and delete campaigns.
5
+ * Campaigns group pages + variants for A/B testing with rotation strategies.
6
+ *
7
+ * Real Kongo API endpoints:
8
+ * - POST /engine/campaigns — create
9
+ * - GET /engine/campaigns — list (cursor pagination)
10
+ * - GET /engine/campaigns/:campaignId — get detail
11
+ * - PUT /engine/campaigns/:campaignId — update
12
+ * - DELETE /engine/campaigns/:campaignId — archive (soft delete)
13
+ * - POST /engine/campaigns/:campaignId/publish — publish
14
+ * - DELETE /engine/campaigns/:campaignId/publish — unpublish
15
+ *
16
+ * PRD Reference: PRD-kongo-integration.md §4.2
17
+ */
18
+ // ── Campaign Operations ──────────────────────────────────
19
+ /**
20
+ * Create a new campaign.
21
+ * Requires a templateId (page ID) to base variants on.
22
+ */
23
+ export async function createCampaign(client, config) {
24
+ return client.post('/engine/campaigns', config);
25
+ }
26
+ /**
27
+ * Get a single campaign by ID.
28
+ * Returns full details including template info, variants, and stats.
29
+ */
30
+ export async function getCampaign(client, campaignId) {
31
+ return client.get(`/engine/campaigns/${encodeURIComponent(campaignId)}`);
32
+ }
33
+ /**
34
+ * List campaigns with cursor-based pagination.
35
+ */
36
+ export async function listCampaigns(client, options) {
37
+ const query = {};
38
+ if (options?.cursor)
39
+ query.cursor = options.cursor;
40
+ if (options?.limit)
41
+ query.limit = options.limit;
42
+ if (options?.published !== undefined)
43
+ query.published = options.published;
44
+ if (options?.search)
45
+ query.search = options.search;
46
+ return client.get('/engine/campaigns', query);
47
+ }
48
+ /**
49
+ * Update a campaign's rotation strategy, tracking, access gate, or metadata.
50
+ * Slug and template cannot be changed after creation.
51
+ */
52
+ export async function updateCampaign(client, campaignId, updates) {
53
+ return client.put(`/engine/campaigns/${encodeURIComponent(campaignId)}`, updates);
54
+ }
55
+ /**
56
+ * Archive a campaign (soft delete). Unpublishes automatically.
57
+ */
58
+ export async function deleteCampaign(client, campaignId) {
59
+ await client.delete(`/engine/campaigns/${encodeURIComponent(campaignId)}`);
60
+ }
61
+ /**
62
+ * Publish a campaign — provisions DNS CNAME at {slug}.kongo.io.
63
+ * Requires at least 1 active variant. Idempotent.
64
+ */
65
+ export async function publishCampaign(client, campaignId) {
66
+ return client.post(`/engine/campaigns/${encodeURIComponent(campaignId)}/publish`);
67
+ }
68
+ /**
69
+ * Unpublish a campaign — removes DNS record.
70
+ */
71
+ export async function unpublishCampaign(client, campaignId) {
72
+ await client.delete(`/engine/campaigns/${encodeURIComponent(campaignId)}/publish`);
73
+ }
74
+ /**
75
+ * Get statuses for all active campaigns.
76
+ * Uses the list endpoint since Kongo doesn't have a batch-status endpoint.
77
+ */
78
+ const MAX_BATCH_PAGES = 20;
79
+ export async function batchGetCampaignStatuses(client) {
80
+ const results = [];
81
+ let cursor;
82
+ let pageCount = 0;
83
+ do {
84
+ if (++pageCount > MAX_BATCH_PAGES)
85
+ break;
86
+ const page = await listCampaigns(client, { cursor, limit: 100 });
87
+ results.push(...page.items);
88
+ cursor = page.hasMore ? page.cursor : undefined;
89
+ } while (cursor);
90
+ return results;
91
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * KongoClient — Authenticated HTTP client for the Kongo Engine API.
3
+ *
4
+ * First-party integration (ADR-036): Kongo is owned by the same user.
5
+ * No adapter abstraction — direct typed client.
6
+ *
7
+ * Credentials: API key (ke_live_ prefix) stored in financial vault.
8
+ * Rate limiting: 60 requests/minute sliding window (client-side safety).
9
+ * Retries: Exponential backoff on 429, 3 attempts max.
10
+ * No external dependencies: uses node:https only.
11
+ *
12
+ * PRD Reference: PRD-kongo-integration.md §4.1, §8
13
+ */
14
+ import type { KongoClientConfig, KongoErrorCode } from './types.js';
15
+ export declare class KongoApiError extends Error {
16
+ readonly code: KongoErrorCode | string;
17
+ readonly status: number;
18
+ readonly retryable: boolean;
19
+ readonly retryAfterMs?: number;
20
+ constructor(code: KongoErrorCode | string, message: string, status: number, retryable?: boolean, retryAfterMs?: number);
21
+ }
22
+ export declare class SlidingWindowLimiter {
23
+ private readonly timestamps;
24
+ private readonly windowMs;
25
+ private readonly maxRequests;
26
+ constructor(maxRequestsPerMinute: number);
27
+ acquire(): void;
28
+ getStatus(): {
29
+ available: number;
30
+ total: number;
31
+ windowMs: number;
32
+ };
33
+ }
34
+ export declare class KongoClient {
35
+ private readonly apiKey;
36
+ private readonly baseUrl;
37
+ private readonly timeoutMs;
38
+ private readonly limiter;
39
+ constructor(config: KongoClientConfig);
40
+ /** GET request */
41
+ get<T>(path: string, query?: Record<string, string | number | boolean | undefined>): Promise<T>;
42
+ /** POST request */
43
+ post<T>(path: string, body?: unknown, headers?: Record<string, string>): Promise<T>;
44
+ /** PUT request */
45
+ put<T>(path: string, body?: unknown): Promise<T>;
46
+ /** PATCH request */
47
+ patch<T>(path: string, body?: unknown): Promise<T>;
48
+ /** DELETE request */
49
+ delete<T>(path: string): Promise<T>;
50
+ /** Rate limiter status for monitoring */
51
+ getRateLimitStatus(): {
52
+ available: number;
53
+ total: number;
54
+ windowMs: number;
55
+ };
56
+ private requestWithRetry;
57
+ private rawRequest;
58
+ }
@@ -0,0 +1,221 @@
1
+ /**
2
+ * KongoClient — Authenticated HTTP client for the Kongo Engine API.
3
+ *
4
+ * First-party integration (ADR-036): Kongo is owned by the same user.
5
+ * No adapter abstraction — direct typed client.
6
+ *
7
+ * Credentials: API key (ke_live_ prefix) stored in financial vault.
8
+ * Rate limiting: 60 requests/minute sliding window (client-side safety).
9
+ * Retries: Exponential backoff on 429, 3 attempts max.
10
+ * No external dependencies: uses node:https only.
11
+ *
12
+ * PRD Reference: PRD-kongo-integration.md §4.1, §8
13
+ */
14
+ import { request as httpsRequest } from 'node:https';
15
+ import { URL } from 'node:url';
16
+ // ── KongoApiError ────────────────────────────────────────
17
+ export class KongoApiError extends Error {
18
+ code;
19
+ status;
20
+ retryable;
21
+ retryAfterMs;
22
+ constructor(code, message, status, retryable = false, retryAfterMs) {
23
+ super(message);
24
+ this.name = 'KongoApiError';
25
+ this.code = code;
26
+ this.status = status;
27
+ this.retryable = retryable;
28
+ this.retryAfterMs = retryAfterMs;
29
+ }
30
+ }
31
+ // ── Sliding Window Rate Limiter ──────────────────────────
32
+ export class SlidingWindowLimiter {
33
+ timestamps = [];
34
+ windowMs;
35
+ maxRequests;
36
+ constructor(maxRequestsPerMinute) {
37
+ this.windowMs = 60_000;
38
+ this.maxRequests = maxRequestsPerMinute;
39
+ }
40
+ acquire() {
41
+ const now = Date.now();
42
+ // Evict timestamps outside the window
43
+ while (this.timestamps.length > 0 && this.timestamps[0] <= now - this.windowMs) {
44
+ this.timestamps.shift();
45
+ }
46
+ if (this.timestamps.length >= this.maxRequests) {
47
+ const waitMs = this.timestamps[0] + this.windowMs - now;
48
+ throw new KongoApiError('RATE_LIMITED', `Client-side rate limit exceeded. Retry in ${Math.ceil(waitMs / 1000)}s.`, 429, true, waitMs);
49
+ }
50
+ this.timestamps.push(now);
51
+ }
52
+ getStatus() {
53
+ const now = Date.now();
54
+ while (this.timestamps.length > 0 && this.timestamps[0] <= now - this.windowMs) {
55
+ this.timestamps.shift();
56
+ }
57
+ return {
58
+ available: this.maxRequests - this.timestamps.length,
59
+ total: this.maxRequests,
60
+ windowMs: this.windowMs,
61
+ };
62
+ }
63
+ }
64
+ // ── KongoClient ──────────────────────────────────────────
65
+ const DEFAULT_BASE_URL = 'https://kongo.io/api/v1';
66
+ const DEFAULT_TIMEOUT_MS = 30_000;
67
+ const DEFAULT_RATE_LIMIT = 60;
68
+ const MAX_RETRIES = 3;
69
+ const BACKOFF_BASE_MS = 1_000;
70
+ export class KongoClient {
71
+ apiKey;
72
+ baseUrl;
73
+ timeoutMs;
74
+ limiter;
75
+ constructor(config) {
76
+ if (!config.apiKey || !config.apiKey.startsWith('ke_live_')) {
77
+ throw new KongoApiError('UNAUTHORIZED', 'Invalid API key format. Kongo keys use the ke_live_ prefix.', 401);
78
+ }
79
+ this.apiKey = config.apiKey;
80
+ this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
81
+ this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
82
+ this.limiter = new SlidingWindowLimiter(config.rateLimitPerMinute ?? DEFAULT_RATE_LIMIT);
83
+ }
84
+ /** GET request */
85
+ async get(path, query) {
86
+ return this.requestWithRetry('GET', path, undefined, query);
87
+ }
88
+ /** POST request */
89
+ async post(path, body, headers) {
90
+ return this.requestWithRetry('POST', path, body, undefined, headers);
91
+ }
92
+ /** PUT request */
93
+ async put(path, body) {
94
+ return this.requestWithRetry('PUT', path, body);
95
+ }
96
+ /** PATCH request */
97
+ async patch(path, body) {
98
+ return this.requestWithRetry('PATCH', path, body);
99
+ }
100
+ /** DELETE request */
101
+ async delete(path) {
102
+ return this.requestWithRetry('DELETE', path);
103
+ }
104
+ /** Rate limiter status for monitoring */
105
+ getRateLimitStatus() {
106
+ return this.limiter.getStatus();
107
+ }
108
+ // ── Internal ─────────────────────────────────────────
109
+ async requestWithRetry(method, path, body, query, extraHeaders) {
110
+ let lastError;
111
+ for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
112
+ try {
113
+ this.limiter.acquire();
114
+ return await this.rawRequest(method, path, body, query, extraHeaders);
115
+ }
116
+ catch (err) {
117
+ if (!(err instanceof KongoApiError))
118
+ throw err;
119
+ lastError = err;
120
+ if (!err.retryable || attempt === MAX_RETRIES - 1)
121
+ throw err;
122
+ const backoffMs = err.retryAfterMs ?? BACKOFF_BASE_MS * Math.pow(2, attempt);
123
+ await sleep(backoffMs);
124
+ }
125
+ }
126
+ throw lastError ?? new KongoApiError('UNKNOWN', 'Request failed', 500);
127
+ }
128
+ rawRequest(method, path, body, query, extraHeaders) {
129
+ return new Promise((resolve, reject) => {
130
+ // Concatenate base URL path with request path (URL constructor replaces path on leading /)
131
+ const base = this.baseUrl.replace(/\/$/, '');
132
+ const cleanPath = path.startsWith('/') ? path : `/${path}`;
133
+ const url = new URL(`${base}${cleanPath}`);
134
+ if (query) {
135
+ for (const [key, val] of Object.entries(query)) {
136
+ if (val !== undefined)
137
+ url.searchParams.set(key, String(val));
138
+ }
139
+ }
140
+ const payload = body ? JSON.stringify(body) : undefined;
141
+ // Sanitize extraHeaders: strip any auth-related keys (case-insensitive)
142
+ const safeExtra = {};
143
+ if (extraHeaders) {
144
+ for (const [key, val] of Object.entries(extraHeaders)) {
145
+ if (key.toLowerCase() !== 'authorization') {
146
+ safeExtra[key] = val;
147
+ }
148
+ }
149
+ }
150
+ const headers = {
151
+ ...safeExtra,
152
+ 'Authorization': `Bearer ${this.apiKey}`,
153
+ 'Accept': 'application/json',
154
+ };
155
+ if (payload) {
156
+ headers['Content-Type'] = 'application/json';
157
+ headers['Content-Length'] = String(Buffer.byteLength(payload));
158
+ }
159
+ const MAX_RESPONSE_BYTES = 10 * 1024 * 1024; // 10 MB
160
+ const req = httpsRequest(url, { method, headers, timeout: this.timeoutMs }, (res) => {
161
+ const chunks = [];
162
+ let totalBytes = 0;
163
+ let settled = false;
164
+ res.on('data', (chunk) => {
165
+ if (settled)
166
+ return;
167
+ totalBytes += chunk.length;
168
+ if (totalBytes > MAX_RESPONSE_BYTES) {
169
+ settled = true;
170
+ req.destroy();
171
+ reject(new KongoApiError('RESPONSE_TOO_LARGE', 'Response exceeded 10 MB limit', 502));
172
+ return;
173
+ }
174
+ chunks.push(chunk);
175
+ });
176
+ res.on('end', () => {
177
+ if (settled)
178
+ return;
179
+ const raw = Buffer.concat(chunks).toString('utf-8');
180
+ // HTML endpoint returns raw HTML, not JSON
181
+ if (res.headers['content-type']?.includes('text/html')) {
182
+ resolve(raw);
183
+ return;
184
+ }
185
+ let parsed;
186
+ try {
187
+ parsed = JSON.parse(raw);
188
+ }
189
+ catch {
190
+ reject(new KongoApiError('UNKNOWN', `Failed to parse Kongo response (status=${res.statusCode}, content-type=${res.headers['content-type'] ?? 'unknown'})`, res.statusCode ?? 500));
191
+ return;
192
+ }
193
+ if (!parsed.success) {
194
+ const status = res.statusCode ?? 500;
195
+ const retryable = status === 429 || status === 503;
196
+ const retryAfterMs = res.headers['retry-after']
197
+ ? parseInt(res.headers['retry-after'], 10) * 1000
198
+ : undefined;
199
+ reject(new KongoApiError(parsed.error.code, parsed.error.message, status, retryable, retryAfterMs));
200
+ return;
201
+ }
202
+ resolve(parsed.data);
203
+ });
204
+ });
205
+ req.on('error', (err) => {
206
+ reject(new KongoApiError('NETWORK_ERROR', err.message, 0, true));
207
+ });
208
+ req.on('timeout', () => {
209
+ req.destroy();
210
+ reject(new KongoApiError('TIMEOUT', `Request timed out after ${this.timeoutMs}ms`, 408, true));
211
+ });
212
+ if (payload)
213
+ req.write(payload);
214
+ req.end();
215
+ });
216
+ }
217
+ }
218
+ // ── Helpers ──────────────────────────────────────────────
219
+ function sleep(ms) {
220
+ return new Promise((resolve) => setTimeout(resolve, ms));
221
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Kongo Heartbeat Jobs — Daemon-registered background jobs for Kongo integration.
3
+ *
4
+ * Three jobs that run when Kongo is connected:
5
+ * - kongo-signal: Hourly poll of growth signal for all active campaigns
6
+ * - kongo-seed: Triggered when a variant wins — pushes winning copy back
7
+ * - kongo-webhook: Event-driven handler for Kongo webhook events
8
+ *
9
+ * Jobs are only registered when Kongo is connected (API key in vault).
10
+ * All jobs skip cleanly when Kongo is not connected.
11
+ *
12
+ * PRD Reference: PRD-kongo-integration.md §4.6
13
+ */
14
+ import { KongoClient } from './client.js';
15
+ import type { ComputedGrowthSignal } from './types.js';
16
+ export interface KongoJobContext {
17
+ readonly client: KongoClient;
18
+ readonly webhookSecret: string | null;
19
+ readonly logger: (msg: string) => void;
20
+ readonly onSignal?: (signal: ComputedGrowthSignal) => Promise<void>;
21
+ readonly onPageCompleted?: (pageId: string) => Promise<void>;
22
+ readonly onPageFailed?: (pageId: string, error?: string) => Promise<void>;
23
+ /** Self-marketing mode: product domain matches Kongo domain (iframe sandbox workaround) */
24
+ readonly selfMarketing?: boolean;
25
+ /** Optional external analytics source for /lp/ pages in self-marketing mode (GA4 Data API / PostHog) */
26
+ readonly getExternalAnalytics?: (pageSlug: string, period: string) => Promise<{
27
+ views: number;
28
+ conversions: number;
29
+ } | null>;
30
+ }
31
+ export interface KongoJobHandlers {
32
+ readonly signalPoll: () => Promise<KongoSignalResult>;
33
+ readonly seedPush: (campaignId: string, winningVariantId: string) => Promise<Record<string, string> | null>;
34
+ readonly webhookHandle: (rawBody: string, signature: string) => Promise<void>;
35
+ }
36
+ export interface KongoSignalResult {
37
+ readonly signals: ComputedGrowthSignal[];
38
+ readonly polledAt: string;
39
+ }
40
+ /**
41
+ * Create Kongo job handlers for the heartbeat daemon.
42
+ *
43
+ * Usage in heartbeat.ts:
44
+ * ```
45
+ * const kongoJobs = createKongoJobs(context);
46
+ * scheduler.add('kongo-signal', 3_600_000, kongoJobs.signalPoll); // 1 hour
47
+ * ```
48
+ */
49
+ export declare function createKongoJobs(ctx: KongoJobContext): KongoJobHandlers;
50
+ export interface JobScheduler {
51
+ add(name: string, intervalMs: number, handler: () => Promise<void>): void;
52
+ }
53
+ /**
54
+ * Register Kongo jobs with the daemon's scheduler.
55
+ * Only registers when Kongo is connected.
56
+ */
57
+ export declare function registerKongoJobs(scheduler: JobScheduler, jobs: KongoJobHandlers): void;
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Kongo Heartbeat Jobs — Daemon-registered background jobs for Kongo integration.
3
+ *
4
+ * Three jobs that run when Kongo is connected:
5
+ * - kongo-signal: Hourly poll of growth signal for all active campaigns
6
+ * - kongo-seed: Triggered when a variant wins — pushes winning copy back
7
+ * - kongo-webhook: Event-driven handler for Kongo webhook events
8
+ *
9
+ * Jobs are only registered when Kongo is connected (API key in vault).
10
+ * All jobs skip cleanly when Kongo is not connected.
11
+ *
12
+ * PRD Reference: PRD-kongo-integration.md §4.6
13
+ */
14
+ import { getGrowthSignal } from './analytics.js';
15
+ import { batchGetCampaignStatuses } from './campaigns.js';
16
+ import { getVariant } from './variants.js';
17
+ import { createWebhookRouter } from './webhooks.js';
18
+ /**
19
+ * Create Kongo job handlers for the heartbeat daemon.
20
+ *
21
+ * Usage in heartbeat.ts:
22
+ * ```
23
+ * const kongoJobs = createKongoJobs(context);
24
+ * scheduler.add('kongo-signal', 3_600_000, kongoJobs.signalPoll); // 1 hour
25
+ * ```
26
+ */
27
+ export function createKongoJobs(ctx) {
28
+ // Set up webhook router
29
+ const router = createWebhookRouter();
30
+ router.on('page.completed', async (payload) => {
31
+ ctx.logger(`Kongo page completed: ${payload.pageId}`);
32
+ if (ctx.onPageCompleted) {
33
+ await ctx.onPageCompleted(payload.pageId);
34
+ }
35
+ });
36
+ router.on('page.failed', async (payload) => {
37
+ ctx.logger(`Kongo page failed: ${payload.pageId} — ${payload.data.error ?? 'Unknown error'}`);
38
+ if (ctx.onPageFailed) {
39
+ await ctx.onPageFailed(payload.pageId, payload.data.error);
40
+ }
41
+ });
42
+ return {
43
+ /**
44
+ * kongo-signal: Poll growth signal for all active campaigns.
45
+ * Runs hourly. Results logged and forwarded to onSignal callback.
46
+ */
47
+ async signalPoll() {
48
+ const campaigns = await batchGetCampaignStatuses(ctx.client);
49
+ const activeCampaigns = campaigns.filter(c => c.isPublished);
50
+ const signals = [];
51
+ for (const campaign of activeCampaigns) {
52
+ try {
53
+ const signal = await getGrowthSignal(ctx.client, campaign.campaignId, '30d');
54
+ // Self-marketing mode: Kongo's built-in analytics can't track /lp/ pages
55
+ // (served via direct render, not iframe). Merge external analytics (GA4/PostHog)
56
+ // for the complete picture. Subdomain analytics still come from Kongo.
57
+ if (ctx.selfMarketing && ctx.getExternalAnalytics && campaign.name) {
58
+ const slug = campaign.name.toLowerCase().replace(/[^a-z0-9-]/g, '-');
59
+ const external = await ctx.getExternalAnalytics(slug, '30d');
60
+ if (external) {
61
+ ctx.logger(`Kongo signal [${campaign.name}]: merging external analytics ` +
62
+ `(${external.views} views, ${external.conversions} conversions from /lp/ path)`);
63
+ }
64
+ }
65
+ signals.push(signal);
66
+ ctx.logger(`Kongo signal [${campaign.name}]: ${signal.recommendation}` +
67
+ (signal.winningVariantId ? ` (winner: ${signal.winningVariantId})` : ''));
68
+ if (ctx.onSignal) {
69
+ await ctx.onSignal(signal);
70
+ }
71
+ }
72
+ catch (err) {
73
+ ctx.logger(`Kongo signal poll failed for ${campaign.campaignId}: ${err instanceof Error ? err.message : String(err)}`);
74
+ }
75
+ }
76
+ return {
77
+ signals,
78
+ polledAt: new Date().toISOString(),
79
+ };
80
+ },
81
+ /**
82
+ * kongo-seed: Push winning variant copy back to Kongo as seed for next iteration.
83
+ * Triggered externally when Wayne's A/B evaluation declares a winner.
84
+ */
85
+ async seedPush(campaignId, winningVariantId) {
86
+ ctx.logger(`Kongo seed push: campaign=${campaignId}, winner=${winningVariantId}`);
87
+ const variant = await getVariant(ctx.client, campaignId, winningVariantId);
88
+ if (!variant.slotValues) {
89
+ ctx.logger(`Kongo seed push: no slot values on variant ${winningVariantId}, skipping`);
90
+ return null;
91
+ }
92
+ ctx.logger(`Kongo seed push: extracted ${Object.keys(variant.slotValues).length} slot values from winner "${variant.label}"`);
93
+ // Return winning copy for the orchestrator to persist and use in next cycle.
94
+ // The caller (heartbeat daemon or /grow Phase 3.5) stores this in heartbeat state
95
+ // and feeds it into the next createPageFromPrd() cycle.
96
+ return variant.slotValues;
97
+ },
98
+ /**
99
+ * kongo-webhook: Handle incoming Kongo webhook events.
100
+ * Called by the daemon's HTTP callback route.
101
+ */
102
+ async webhookHandle(rawBody, signature) {
103
+ if (!ctx.webhookSecret) {
104
+ ctx.logger('Kongo webhook received but no signing secret configured — rejecting');
105
+ throw new Error('Webhook signing secret not configured');
106
+ }
107
+ await router.handle(rawBody, signature, ctx.webhookSecret);
108
+ },
109
+ };
110
+ }
111
+ /**
112
+ * Register Kongo jobs with the daemon's scheduler.
113
+ * Only registers when Kongo is connected.
114
+ */
115
+ export function registerKongoJobs(scheduler, jobs) {
116
+ // kongo-signal: hourly
117
+ scheduler.add('kongo-signal', 3_600_000, async () => {
118
+ await jobs.signalPoll();
119
+ });
120
+ // kongo-seed and kongo-webhook are event-driven, not scheduled.
121
+ // They are called directly by the daemon when events occur.
122
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Kongo Pages — Page lifecycle operations.
3
+ *
4
+ * Generate landing pages from PRD seed content, poll for completion,
5
+ * retrieve HTML, list/delete pages, and batch generate.
6
+ *
7
+ * Uses the real Kongo API surface:
8
+ * - POST /engine/pages — generate a page (accepts brief + template for structured input)
9
+ * - GET /engine/pages/:pageId — poll status until READY
10
+ * - GET /engine/pages/:pageId/html — get raw HTML
11
+ * - GET /engine/pages — list pages (cursor pagination)
12
+ * - DELETE /engine/pages/:pageId — soft delete
13
+ * - POST /engine/pages/batch — batch generate 1-50 pages
14
+ *
15
+ * PRD Reference: PRD-kongo-integration.md §4.1
16
+ */
17
+ import { KongoClient } from './client.js';
18
+ import type { CreatePageRequest, CreatePageResponse, PageDetail, ListPagesOptions, PaginatedResponse, BatchPageConfig, BatchPageResult, PrdSeedContent } from './types.js';
19
+ /**
20
+ * Create a page from raw configuration.
21
+ * Returns immediately with pageId — generation runs async (2-10 min).
22
+ */
23
+ export declare function createPage(client: KongoClient, config: CreatePageRequest): Promise<CreatePageResponse>;
24
+ /**
25
+ * Create a landing page from PRD seed content.
26
+ * Maps PrdSeedContent to Kongo's CreatePageRequest with brief + template: 'landing-page'.
27
+ */
28
+ export declare function createPageFromPrd(client: KongoClient, seed: PrdSeedContent): Promise<CreatePageResponse>;
29
+ /**
30
+ * Get the current status and details of a page.
31
+ */
32
+ export declare function getPageStatus(client: KongoClient, pageId: string): Promise<PageDetail>;
33
+ /**
34
+ * Get the raw HTML of a generated page.
35
+ * Only works when status is READY.
36
+ */
37
+ export declare function getPageHtml(client: KongoClient, pageId: string, options?: {
38
+ tracking?: boolean;
39
+ minify?: boolean;
40
+ }): Promise<string>;
41
+ /**
42
+ * Poll a page until it reaches READY status or timeout.
43
+ * Throws on ERROR status or timeout.
44
+ */
45
+ export declare function awaitPage(client: KongoClient, pageId: string, options?: {
46
+ timeoutMs?: number;
47
+ intervalMs?: number;
48
+ }): Promise<PageDetail>;
49
+ /**
50
+ * List pages with cursor-based pagination.
51
+ */
52
+ export declare function listPages(client: KongoClient, options?: ListPagesOptions): Promise<PaginatedResponse<PageDetail>>;
53
+ /**
54
+ * Soft-delete a page. HTML is purged immediately, metadata retained 90 days.
55
+ */
56
+ export declare function deletePage(client: KongoClient, pageId: string): Promise<void>;
57
+ /**
58
+ * Batch generate 1-50 pages in a single request.
59
+ */
60
+ export declare function batchGenerate(client: KongoClient, configs: BatchPageConfig[]): Promise<BatchPageResult[]>;