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,388 @@
1
+ /**
2
+ * Google Ads Campaign Adapter — real implementation via node:https (zero new dependencies).
3
+ *
4
+ * Implements AdPlatformAdapter for Google Ads API v17.
5
+ *
6
+ * Google Ads API v17:
7
+ * Base URL: https://googleads.googleapis.com/v17
8
+ * Auth: Authorization: Bearer {accessToken} + developer-token header
9
+ * Campaign CRUD via mutate endpoints
10
+ * Reporting via searchStream
11
+ * Rate limit: 15,000 operations/day
12
+ *
13
+ * PRD Reference: §9.5, §9.19.10, §9.20.4
14
+ * No Stubs Doctrine: every method makes a real API call or returns documented empty.
15
+ */
16
+ import { request as httpsRequest } from 'node:https';
17
+ import { toCents, TokenBucketLimiter } from './base.js';
18
+ const GOOGLE_ADS_HOST = 'googleads.googleapis.com';
19
+ // ── HTTP helpers ─────────────────────────────────────
20
+ async function googleGet(path, accessToken, developerToken) {
21
+ return new Promise((resolve, reject) => {
22
+ const req = httpsRequest({
23
+ hostname: GOOGLE_ADS_HOST,
24
+ path: `/v17${path}`,
25
+ method: 'GET',
26
+ headers: {
27
+ 'Authorization': `Bearer ${accessToken}`,
28
+ 'developer-token': developerToken,
29
+ 'Accept': 'application/json',
30
+ },
31
+ timeout: 15000,
32
+ }, (res) => {
33
+ let data = '';
34
+ res.on('data', (chunk) => { data += chunk.toString(); });
35
+ res.on('end', () => resolve({ status: res.statusCode ?? 500, body: data }));
36
+ });
37
+ req.on('error', reject);
38
+ req.on('timeout', () => { req.destroy(); reject(new Error('Google Ads API timeout')); });
39
+ req.end();
40
+ });
41
+ }
42
+ async function googlePost(path, accessToken, developerToken, body) {
43
+ const payload = JSON.stringify(body);
44
+ return new Promise((resolve, reject) => {
45
+ const req = httpsRequest({
46
+ hostname: GOOGLE_ADS_HOST,
47
+ path: `/v17${path}`,
48
+ method: 'POST',
49
+ headers: {
50
+ 'Authorization': `Bearer ${accessToken}`,
51
+ 'developer-token': developerToken,
52
+ 'Content-Type': 'application/json',
53
+ 'Accept': 'application/json',
54
+ },
55
+ timeout: 15000,
56
+ }, (res) => {
57
+ let data = '';
58
+ res.on('data', (chunk) => { data += chunk.toString(); });
59
+ res.on('end', () => resolve({ status: res.statusCode ?? 500, body: data }));
60
+ });
61
+ req.on('error', reject);
62
+ req.on('timeout', () => { req.destroy(); reject(new Error('Google Ads API timeout')); });
63
+ req.write(payload);
64
+ req.end();
65
+ });
66
+ }
67
+ function safeParseJson(body) {
68
+ try {
69
+ return JSON.parse(body);
70
+ }
71
+ catch {
72
+ return { error: { message: 'Non-JSON response from Google Ads API' } };
73
+ }
74
+ }
75
+ /** Sanitize GAQL parameter — allow only alphanumeric, underscores, hyphens, dots. */
76
+ function sanitizeGaqlParam(value) {
77
+ return value.replace(/[^a-zA-Z0-9_.\-]/g, '');
78
+ }
79
+ /** Sanitize a date string for GAQL — must be YYYY-MM-DD. */
80
+ function sanitizeDate(value) {
81
+ const match = value.match(/^(\d{4}-\d{2}-\d{2})/);
82
+ return match ? match[1] : new Date().toISOString().slice(0, 10);
83
+ }
84
+ function makePlatformError(code, originalCode, message, retryable = false, retryAfter) {
85
+ return { platform: 'google', code, originalCode, message, retryable, retryAfter };
86
+ }
87
+ // ── Adapter Implementation ──────────────────────────
88
+ export class GoogleCampaignAdapter {
89
+ config;
90
+ rateLimiter;
91
+ constructor(config) {
92
+ this.config = config;
93
+ // Google Ads: 15,000 operations/day ≈ 0.17/sec
94
+ this.rateLimiter = new TokenBucketLimiter({ capacity: 100, refillRate: 15000 / 86400 });
95
+ }
96
+ async refreshToken(token) {
97
+ // Google OAuth2 token refresh via googleapis.com
98
+ const payload = JSON.stringify({
99
+ client_id: 'configured-in-vault',
100
+ grant_type: 'refresh_token',
101
+ refresh_token: token.refreshToken,
102
+ });
103
+ const result = await new Promise((resolve, reject) => {
104
+ const req = httpsRequest({
105
+ hostname: 'oauth2.googleapis.com',
106
+ path: '/token',
107
+ method: 'POST',
108
+ headers: { 'Content-Type': 'application/json' },
109
+ timeout: 10000,
110
+ }, (res) => {
111
+ let data = '';
112
+ res.on('data', (chunk) => { data += chunk.toString(); });
113
+ res.on('end', () => resolve({ status: res.statusCode ?? 500, body: data }));
114
+ });
115
+ req.on('error', reject);
116
+ req.on('timeout', () => { req.destroy(); reject(new Error('Google OAuth timeout')); });
117
+ req.write(payload);
118
+ req.end();
119
+ });
120
+ if (result.status !== 200) {
121
+ throw makePlatformError('AUTH_EXPIRED', result.status, 'Google token refresh failed');
122
+ }
123
+ const parsed = safeParseJson(result.body);
124
+ return {
125
+ ...token,
126
+ accessToken: parsed.access_token,
127
+ expiresAt: new Date(Date.now() + (parsed.expires_in ?? 3600) * 1000).toISOString(),
128
+ };
129
+ }
130
+ async createCampaign(config) {
131
+ if (config.complianceStatus !== 'passed') {
132
+ throw makePlatformError('UNKNOWN', 400, 'Campaign compliance not passed — cannot create');
133
+ }
134
+ await this.rateLimiter.acquire();
135
+ const { status, body } = await googlePost(`/customers/${this.config.customerId}/campaigns:mutate`, this.config.accessToken, this.config.developerToken, {
136
+ operations: [{
137
+ create: {
138
+ name: config.name,
139
+ advertisingChannelType: 'SEARCH',
140
+ status: 'PAUSED',
141
+ campaignBudget: `customers/${this.config.customerId}/campaignBudgets/-1`,
142
+ biddingStrategyType: config.objective === 'conversions' ? 'MAXIMIZE_CONVERSIONS' : 'MAXIMIZE_CLICKS',
143
+ },
144
+ }],
145
+ // Idempotency: Google uses request IDs
146
+ requestId: config.idempotencyKey,
147
+ });
148
+ if (status !== 200) {
149
+ this.throwApiError(status, body);
150
+ }
151
+ const parsed = safeParseJson(body);
152
+ const results = parsed.results ?? [];
153
+ const campaignResource = results[0]?.resourceName ?? '';
154
+ const externalId = campaignResource.split('/').pop() ?? '';
155
+ return {
156
+ externalId,
157
+ platform: 'google',
158
+ status: 'created',
159
+ dashboardUrl: `https://ads.google.com/aw/campaigns?campaignId=${externalId}&ocid=${this.config.customerId}`,
160
+ };
161
+ }
162
+ async updateCampaign(id, changes) {
163
+ await this.rateLimiter.acquire();
164
+ const update = {
165
+ resourceName: `customers/${this.config.customerId}/campaigns/${id}`,
166
+ };
167
+ const updateMask = [];
168
+ if (changes.name !== undefined) {
169
+ update.name = changes.name;
170
+ updateMask.push('name');
171
+ }
172
+ if (updateMask.length === 0)
173
+ return;
174
+ const { status, body } = await googlePost(`/customers/${this.config.customerId}/campaigns:mutate`, this.config.accessToken, this.config.developerToken, { operations: [{ update, updateMask: updateMask.join(',') }] });
175
+ if (status !== 200) {
176
+ this.throwApiError(status, body);
177
+ }
178
+ }
179
+ async pauseCampaign(id) {
180
+ await this.rateLimiter.acquire();
181
+ const { status, body } = await googlePost(`/customers/${this.config.customerId}/campaigns:mutate`, this.config.accessToken, this.config.developerToken, {
182
+ operations: [{
183
+ update: {
184
+ resourceName: `customers/${this.config.customerId}/campaigns/${id}`,
185
+ status: 'PAUSED',
186
+ },
187
+ updateMask: 'status',
188
+ }],
189
+ });
190
+ if (status !== 200) {
191
+ this.throwApiError(status, body);
192
+ }
193
+ }
194
+ async resumeCampaign(id) {
195
+ await this.rateLimiter.acquire();
196
+ const { status, body } = await googlePost(`/customers/${this.config.customerId}/campaigns:mutate`, this.config.accessToken, this.config.developerToken, {
197
+ operations: [{
198
+ update: {
199
+ resourceName: `customers/${this.config.customerId}/campaigns/${id}`,
200
+ status: 'ENABLED',
201
+ },
202
+ updateMask: 'status',
203
+ }],
204
+ });
205
+ if (status !== 200) {
206
+ this.throwApiError(status, body);
207
+ }
208
+ }
209
+ async deleteCampaign(id) {
210
+ await this.rateLimiter.acquire();
211
+ const { status, body } = await googlePost(`/customers/${this.config.customerId}/campaigns:mutate`, this.config.accessToken, this.config.developerToken, {
212
+ operations: [{
213
+ remove: `customers/${this.config.customerId}/campaigns/${id}`,
214
+ }],
215
+ });
216
+ if (status !== 200) {
217
+ this.throwApiError(status, body);
218
+ }
219
+ }
220
+ async updateBudget(id, dailyBudget) {
221
+ await this.rateLimiter.acquire();
222
+ // Google budgets are in micros (1/1,000,000 of currency unit)
223
+ // cents → dollars → micros: dailyBudget / 100 * 1,000,000 = dailyBudget * 10,000
224
+ const budgetMicros = dailyBudget * 10000;
225
+ // First, query the campaign's budget resource
226
+ const queryResult = await googlePost(`/customers/${this.config.customerId}/googleAds:searchStream`, this.config.accessToken, this.config.developerToken, {
227
+ query: `SELECT campaign_budget.resource_name FROM campaign WHERE campaign.id = ${sanitizeGaqlParam(id)} LIMIT 1`,
228
+ });
229
+ if (queryResult.status !== 200) {
230
+ this.throwApiError(queryResult.status, queryResult.body);
231
+ }
232
+ const queryParsed = safeParseJson(queryResult.body);
233
+ const queryResults = queryParsed;
234
+ const budgetResource = queryResults[0]?.results?.[0]?.campaignBudget?.resourceName;
235
+ if (!budgetResource) {
236
+ throw makePlatformError('UNKNOWN', 404, `Budget resource not found for campaign ${id}`);
237
+ }
238
+ // Then update the budget
239
+ const { status, body } = await googlePost(`/customers/${this.config.customerId}/campaignBudgets:mutate`, this.config.accessToken, this.config.developerToken, {
240
+ operations: [{
241
+ update: {
242
+ resourceName: budgetResource,
243
+ amountMicros: budgetMicros,
244
+ },
245
+ updateMask: 'amount_micros',
246
+ }],
247
+ });
248
+ if (status !== 200) {
249
+ this.throwApiError(status, body);
250
+ }
251
+ }
252
+ async updateCreative(id, creative) {
253
+ await this.rateLimiter.acquire();
254
+ // Google creative updates go through ad groups and ads, not campaigns directly.
255
+ // Query the first ad group under this campaign, then update its ad.
256
+ const queryResult = await googlePost(`/customers/${this.config.customerId}/googleAds:searchStream`, this.config.accessToken, this.config.developerToken, {
257
+ query: `SELECT ad_group_ad.ad.resource_name, ad_group_ad.ad.id FROM ad_group_ad WHERE campaign.id = ${sanitizeGaqlParam(id)} LIMIT 1`,
258
+ });
259
+ if (queryResult.status !== 200) {
260
+ this.throwApiError(queryResult.status, queryResult.body);
261
+ }
262
+ const queryParsed = safeParseJson(queryResult.body);
263
+ const queryResults = queryParsed;
264
+ const adResource = queryResults[0]?.results?.[0]?.adGroupAd?.ad?.resourceName;
265
+ if (!adResource) {
266
+ throw makePlatformError('CREATIVE_REJECTED', 404, `No ad found for campaign ${id}`);
267
+ }
268
+ const update = { resourceName: adResource };
269
+ const updateMask = [];
270
+ if (creative.headlines) {
271
+ update.responsiveSearchAd = {
272
+ ...(update.responsiveSearchAd ?? {}),
273
+ headlines: creative.headlines.map(h => ({ text: h })),
274
+ };
275
+ updateMask.push('responsive_search_ad.headlines');
276
+ }
277
+ if (creative.descriptions) {
278
+ update.responsiveSearchAd = {
279
+ ...(update.responsiveSearchAd ?? {}),
280
+ descriptions: creative.descriptions.map(d => ({ text: d })),
281
+ };
282
+ updateMask.push('responsive_search_ad.descriptions');
283
+ }
284
+ if (creative.landingUrl) {
285
+ update.finalUrls = [creative.landingUrl];
286
+ updateMask.push('final_urls');
287
+ }
288
+ if (updateMask.length === 0)
289
+ return;
290
+ const { status, body } = await googlePost(`/customers/${this.config.customerId}/ads:mutate`, this.config.accessToken, this.config.developerToken, { operations: [{ update, updateMask: updateMask.join(',') }] });
291
+ if (status !== 200) {
292
+ this.throwApiError(status, body);
293
+ }
294
+ }
295
+ async getSpend(dateRange) {
296
+ await this.rateLimiter.acquire();
297
+ const { status, body } = await googlePost(`/customers/${this.config.customerId}/googleAds:searchStream`, this.config.accessToken, this.config.developerToken, {
298
+ query: [
299
+ 'SELECT campaign.id, metrics.cost_micros, metrics.impressions,',
300
+ 'metrics.clicks, metrics.conversions',
301
+ 'FROM campaign',
302
+ `WHERE segments.date BETWEEN '${sanitizeDate(dateRange.start)}' AND '${sanitizeDate(dateRange.end)}'`,
303
+ ].join(' '),
304
+ });
305
+ if (status !== 200) {
306
+ this.throwApiError(status, body);
307
+ }
308
+ const parsed = safeParseJson(body);
309
+ const results = parsed;
310
+ const rows = results[0]?.results ?? [];
311
+ const campaigns = rows.map(row => ({
312
+ externalId: row.campaign?.id ?? '',
313
+ spend: toCents(parseInt(row.metrics?.costMicros ?? '0') / 1_000_000),
314
+ impressions: parseInt(row.metrics?.impressions ?? '0'),
315
+ clicks: parseInt(row.metrics?.clicks ?? '0'),
316
+ conversions: Math.round(parseFloat(row.metrics?.conversions ?? '0')),
317
+ }));
318
+ const totalSpend = campaigns.reduce((sum, c) => (sum + c.spend), 0);
319
+ return { platform: 'google', dateRange, totalSpend, campaigns };
320
+ }
321
+ async getPerformance(campaignId) {
322
+ await this.rateLimiter.acquire();
323
+ const today = new Date().toISOString().slice(0, 10);
324
+ const { status, body } = await googlePost(`/customers/${this.config.customerId}/googleAds:searchStream`, this.config.accessToken, this.config.developerToken, {
325
+ query: [
326
+ 'SELECT metrics.cost_micros, metrics.impressions, metrics.clicks,',
327
+ 'metrics.conversions, metrics.ctr, metrics.average_cpc',
328
+ 'FROM campaign',
329
+ `WHERE campaign.id = ${sanitizeGaqlParam(campaignId)}`,
330
+ `AND segments.date = '${today}'`,
331
+ ].join(' '),
332
+ });
333
+ if (status !== 200) {
334
+ this.throwApiError(status, body);
335
+ }
336
+ const parsed = safeParseJson(body);
337
+ const results = parsed;
338
+ const m = results[0]?.results?.[0]?.metrics ?? {};
339
+ const spend = toCents(parseInt(m.costMicros ?? '0') / 1_000_000);
340
+ const impressions = parseInt(m.impressions ?? '0');
341
+ const clicks = parseInt(m.clicks ?? '0');
342
+ const conversions = Math.round(parseFloat(m.conversions ?? '0'));
343
+ return {
344
+ campaignId,
345
+ impressions,
346
+ clicks,
347
+ conversions,
348
+ spend,
349
+ ctr: parseFloat(m.ctr ?? '0'),
350
+ cpc: toCents(parseInt(m.averageCpc ?? '0') / 1_000_000),
351
+ roas: (spend > 0 ? 0 : 0), // Revenue from Stripe, not ad platform
352
+ };
353
+ }
354
+ async getInsights(campaignId, metrics) {
355
+ await this.rateLimiter.acquire();
356
+ const metricsQuery = metrics.map(m => `metrics.${sanitizeGaqlParam(m)}`).join(', ');
357
+ const today = new Date().toISOString().slice(0, 10);
358
+ const { status, body } = await googlePost(`/customers/${this.config.customerId}/googleAds:searchStream`, this.config.accessToken, this.config.developerToken, {
359
+ query: `SELECT ${metricsQuery} FROM campaign WHERE campaign.id = ${sanitizeGaqlParam(campaignId)} AND segments.date = '${today}'`,
360
+ });
361
+ if (status !== 200) {
362
+ this.throwApiError(status, body);
363
+ }
364
+ const parsed = safeParseJson(body);
365
+ const results = parsed;
366
+ const row = results[0]?.results?.[0]?.metrics ?? {};
367
+ const result = {};
368
+ for (const metric of metrics) {
369
+ result[metric] = parseFloat(row[metric] ?? '0');
370
+ }
371
+ return { campaignId, metrics: result };
372
+ }
373
+ // ── Private helpers ─────────────────────────────────
374
+ throwApiError(status, body) {
375
+ const parsed = safeParseJson(body);
376
+ const errMsg = parsed.error?.message ?? `HTTP ${status}`;
377
+ if (status === 429) {
378
+ throw makePlatformError('RATE_LIMITED', status, errMsg, true, 60);
379
+ }
380
+ if (status === 401 || status === 403) {
381
+ throw makePlatformError('AUTH_EXPIRED', status, errMsg);
382
+ }
383
+ if (errMsg.toLowerCase().includes('budget') || errMsg.includes('BudgetError')) {
384
+ throw makePlatformError('BUDGET_EXCEEDED', status, errMsg);
385
+ }
386
+ throw makePlatformError('UNKNOWN', status, errMsg);
387
+ }
388
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Meta Marketing Campaign Adapter — real implementation via node:https (zero new dependencies).
3
+ *
4
+ * Implements AdPlatformAdapter for Meta Marketing API v19.0.
5
+ *
6
+ * Meta Marketing API v19.0:
7
+ * Base URL: https://graph.facebook.com/v19.0
8
+ * Auth: access_token query parameter
9
+ * Campaign CRUD via Graph API
10
+ * Reporting via insights endpoint
11
+ * Rate limit: 200 calls/hr/ad account (sliding window)
12
+ *
13
+ * PRD Reference: §9.5, §9.19.10, §9.20.4
14
+ * No Stubs Doctrine: every method makes a real API call or returns documented empty.
15
+ */
16
+ import type { AdPlatformAdapter, CampaignConfig, CampaignResult, CampaignUpdate, CreativeConfig, SpendReport, PerformanceMetrics, InsightData, OAuthTokens, Cents } from './base.js';
17
+ interface MetaCampaignConfig {
18
+ adAccountId: string;
19
+ accessToken: string;
20
+ }
21
+ export declare class MetaCampaignAdapter implements AdPlatformAdapter {
22
+ private readonly config;
23
+ private readonly rateLimiter;
24
+ constructor(config: MetaCampaignConfig);
25
+ refreshToken(token: OAuthTokens): Promise<OAuthTokens>;
26
+ createCampaign(config: CampaignConfig): Promise<CampaignResult>;
27
+ updateCampaign(id: string, changes: CampaignUpdate): Promise<void>;
28
+ pauseCampaign(id: string): Promise<void>;
29
+ resumeCampaign(id: string): Promise<void>;
30
+ deleteCampaign(id: string): Promise<void>;
31
+ updateBudget(id: string, dailyBudget: Cents): Promise<void>;
32
+ updateCreative(id: string, creative: CreativeConfig): Promise<void>;
33
+ getSpend(dateRange: {
34
+ start: string;
35
+ end: string;
36
+ }): Promise<SpendReport>;
37
+ getPerformance(campaignId: string): Promise<PerformanceMetrics>;
38
+ getInsights(campaignId: string, metrics: string[]): Promise<InsightData>;
39
+ private throwApiError;
40
+ }
41
+ export {};