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,173 @@
1
+ /**
2
+ * Reconciliation Engine — Two-pass financial reconciliation (§9.17).
3
+ *
4
+ * Compares VoidForge's recorded spend/revenue against platform-reported values.
5
+ * Runs daily: preliminary at midnight UTC, authoritative at 06:00 UTC.
6
+ *
7
+ * PRD Reference: §9.4 (reconciliation), §9.9 (ReconciliationReport), §9.17 (two-pass)
8
+ */
9
+ import { readFile, mkdir } from 'node:fs/promises';
10
+ import { join } from 'node:path';
11
+ import { existsSync } from 'node:fs';
12
+ import { randomUUID } from 'node:crypto';
13
+ import { atomicWrite, SPEND_LOG, REVENUE_LOG, TREASURY_DIR } from './financial-core.js';
14
+ // ── Threshold Configuration (§9.17) ───────────────────
15
+ const DISCREPANCY_IGNORE_THRESHOLD = 500; // $5 — timing noise
16
+ const DISCREPANCY_ALERT_PERCENT = 5; // 5% relative threshold
17
+ const DISCREPANCY_ALWAYS_ALERT = 5000; // $50 — always alert
18
+ const TREND_DAYS = 7; // 7-day trend detection
19
+ const TREND_THRESHOLD_PERCENT = 3; // 3-4% consistent discrepancy
20
+ async function readSpendLogForDate(date) {
21
+ const platformTotals = new Map();
22
+ if (!existsSync(SPEND_LOG))
23
+ return platformTotals;
24
+ const content = await readFile(SPEND_LOG, 'utf-8');
25
+ const lines = content.trim().split('\n').filter(Boolean);
26
+ for (const line of lines) {
27
+ try {
28
+ const entry = JSON.parse(line);
29
+ if (!entry.data.timestamp.startsWith(date))
30
+ continue;
31
+ if (entry.data.action !== 'spend_check' && entry.data.action !== 'spend_execute')
32
+ continue;
33
+ const current = platformTotals.get(entry.data.platform) ?? 0;
34
+ platformTotals.set(entry.data.platform, (current + entry.data.amount));
35
+ }
36
+ catch { /* malformed line — skip */ }
37
+ }
38
+ return platformTotals;
39
+ }
40
+ async function readRevenueLogForDate(date) {
41
+ const sourceTotals = new Map();
42
+ if (!existsSync(REVENUE_LOG))
43
+ return sourceTotals;
44
+ const content = await readFile(REVENUE_LOG, 'utf-8');
45
+ const lines = content.trim().split('\n').filter(Boolean);
46
+ for (const line of lines) {
47
+ try {
48
+ const entry = JSON.parse(line);
49
+ if (!entry.data.timestamp.startsWith(date))
50
+ continue;
51
+ const current = sourceTotals.get(entry.data.source) ?? 0;
52
+ sourceTotals.set(entry.data.source, (current + entry.data.amount));
53
+ }
54
+ catch { /* malformed line */ }
55
+ }
56
+ return sourceTotals;
57
+ }
58
+ // ── Discrepancy Classification ────────────────────────
59
+ function classifyDiscrepancy(recorded, reported) {
60
+ const diff = Math.abs(recorded - reported);
61
+ // Ignore <$5 (timing noise)
62
+ if (diff < DISCREPANCY_IGNORE_THRESHOLD)
63
+ return 'matched';
64
+ // Always alert >$50
65
+ if (diff >= DISCREPANCY_ALWAYS_ALERT)
66
+ return 'discrepancy';
67
+ // Alert on >5% relative discrepancy
68
+ const base = Math.max(recorded, reported, 1); // avoid division by zero
69
+ const percent = (diff / base) * 100;
70
+ if (percent >= DISCREPANCY_ALERT_PERCENT)
71
+ return 'discrepancy';
72
+ return 'matched';
73
+ }
74
+ // ── Main Reconciliation Function ──────────────────────
75
+ export async function runReconciliation(projectId, date, type, platformSpendReports, // Platform-reported spend per platform
76
+ revenueSourceReports) {
77
+ // Read VoidForge's own logs for this date
78
+ const vfSpend = await readSpendLogForDate(date);
79
+ const vfRevenue = await readRevenueLogForDate(date);
80
+ const alerts = [];
81
+ // ── Reconcile Spend ──────────────────
82
+ const spendResults = [];
83
+ const allPlatforms = new Set([...vfSpend.keys(), ...platformSpendReports.keys()]);
84
+ for (const platform of allPlatforms) {
85
+ const recorded = vfSpend.get(platform) ?? 0;
86
+ const reported = platformSpendReports.get(platform);
87
+ if (reported === undefined) {
88
+ spendResults.push({
89
+ platform: platform,
90
+ voidforgeRecorded: recorded,
91
+ platformReported: 0,
92
+ discrepancy: recorded,
93
+ status: 'unavailable',
94
+ });
95
+ alerts.push(`${platform}: platform data unavailable. Using VoidForge recorded spend + daily cap as worst-case estimate.`);
96
+ continue;
97
+ }
98
+ const discrepancy = Math.abs(recorded - reported);
99
+ const status = classifyDiscrepancy(recorded, reported);
100
+ spendResults.push({
101
+ platform: platform,
102
+ voidforgeRecorded: recorded,
103
+ platformReported: reported,
104
+ discrepancy,
105
+ status,
106
+ });
107
+ if (status === 'discrepancy' && type === 'final') {
108
+ alerts.push(`Reconciliation discrepancy: ${platform} reports $${(reported / 100).toFixed(2)} spent, ` +
109
+ `VoidForge recorded $${(recorded / 100).toFixed(2)} — $${(discrepancy / 100).toFixed(2)} difference`);
110
+ }
111
+ }
112
+ // ── Reconcile Revenue ────────────────
113
+ const revenueResults = [];
114
+ const allSources = new Set([...vfRevenue.keys(), ...revenueSourceReports.keys()]);
115
+ for (const source of allSources) {
116
+ const recorded = vfRevenue.get(source) ?? 0;
117
+ const reported = revenueSourceReports.get(source);
118
+ if (reported === undefined) {
119
+ revenueResults.push({
120
+ source: source,
121
+ recorded,
122
+ reported: 0,
123
+ discrepancy: recorded,
124
+ status: 'unavailable',
125
+ });
126
+ continue;
127
+ }
128
+ const discrepancy = Math.abs(recorded - reported);
129
+ const status = classifyDiscrepancy(recorded, reported);
130
+ revenueResults.push({
131
+ source: source,
132
+ recorded,
133
+ reported,
134
+ discrepancy,
135
+ status,
136
+ });
137
+ if (status === 'discrepancy' && type === 'final') {
138
+ alerts.push(`Revenue discrepancy: ${source} reports $${(reported / 100).toFixed(2)}, ` +
139
+ `VoidForge recorded $${(recorded / 100).toFixed(2)}`);
140
+ }
141
+ }
142
+ // ── Calculate Aggregates ─────────────
143
+ const totalRevenue = revenueResults.reduce((sum, r) => sum + (r.reported || r.recorded), 0);
144
+ const totalSpend = spendResults.reduce((sum, s) => sum + (s.platformReported || s.voidforgeRecorded), 0);
145
+ const netPosition = (totalRevenue - totalSpend);
146
+ const blendedRoas = totalSpend > 0 ? (totalRevenue / totalSpend) : 0;
147
+ // ── Build Report ─────────────────────
148
+ const report = {
149
+ id: randomUUID(),
150
+ date,
151
+ type,
152
+ projectId,
153
+ spend: spendResults,
154
+ revenue: revenueResults,
155
+ netPosition,
156
+ blendedRoas,
157
+ alerts,
158
+ };
159
+ // ── Write Report ─────────────────────
160
+ const reportDir = join(TREASURY_DIR, 'reconciliation');
161
+ await mkdir(reportDir, { recursive: true });
162
+ const reportPath = join(reportDir, `${date}.json`);
163
+ await atomicWrite(reportPath, JSON.stringify(report, null, 2));
164
+ return report;
165
+ }
166
+ // ── Currency Enforcement (ADR-6) ──────────────────────
167
+ export function enforceCurrency(currency, platform) {
168
+ if (currency !== 'USD') {
169
+ throw new Error(`This ${platform} account uses ${currency}. VoidForge v11.x requires USD. ` +
170
+ `Change the account currency in the ${platform} dashboard, ` +
171
+ `or wait for multi-currency support (planned post-v11.3).`);
172
+ }
173
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Revenue types — re-exports from the revenue-source-adapter pattern for wizard runtime use.
3
+ * ARCH-R2-012: Production code should not import from docs/patterns/ directly.
4
+ */
5
+ export type { RevenueSourceAdapter, RevenueCredentials, ConnectionResult, TransactionPage, BalanceResult, DateRange } from './patterns/revenue-source-adapter.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Paris's Route Optimizer — ROI-weighted campaign sequencing (v12.3).
3
+ *
4
+ * Given multiple possible campaigns (from the proposal generator), Paris
5
+ * computes the optimal execution order based on estimated ROI, dependencies,
6
+ * risk, and urgency.
7
+ *
8
+ * PRD Reference: ROADMAP v12.3, DEEP_CURRENT.md Paris's role
9
+ */
10
+ import type { CampaignProposal } from './campaign-proposer.js';
11
+ import type { SituationModel } from './deep-current.js';
12
+ interface RouteScore {
13
+ proposal: CampaignProposal;
14
+ roiScore: number;
15
+ urgencyScore: number;
16
+ riskScore: number;
17
+ totalScore: number;
18
+ }
19
+ /**
20
+ * Score and rank campaign proposals by optimal execution order.
21
+ * Returns proposals sorted by total score (highest first = execute first).
22
+ */
23
+ export declare function optimizeRoute(proposals: CampaignProposal[], model: SituationModel): RouteScore[];
24
+ /**
25
+ * Pick the single best campaign to execute next.
26
+ */
27
+ export declare function pickBestCampaign(proposals: CampaignProposal[], model: SituationModel): CampaignProposal | null;
28
+ export type { RouteScore };
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Paris's Route Optimizer — ROI-weighted campaign sequencing (v12.3).
3
+ *
4
+ * Given multiple possible campaigns (from the proposal generator), Paris
5
+ * computes the optimal execution order based on estimated ROI, dependencies,
6
+ * risk, and urgency.
7
+ *
8
+ * PRD Reference: ROADMAP v12.3, DEEP_CURRENT.md Paris's role
9
+ */
10
+ // ── Scoring Weights ───────────────────────────────────
11
+ const WEIGHTS = {
12
+ roi: 0.40,
13
+ urgency: 0.35,
14
+ risk: 0.25, // Inverted — lower risk gets higher score
15
+ };
16
+ // ── ROI Estimation ────────────────────────────────────
17
+ function estimateRoi(proposal, model) {
18
+ // ROI = (dimension improvement potential) / (estimated effort)
19
+ const currentScore = proposal.dimensionScore;
20
+ const potentialGain = Math.min(30, 100 - currentScore); // Cap at 30-point improvement
21
+ const effort = proposal.estimatedSessions;
22
+ // Higher gain per session = higher ROI
23
+ const roiRatio = potentialGain / Math.max(effort, 1);
24
+ return Math.min(100, Math.round(roiRatio * 10)); // Scale to 0-100
25
+ }
26
+ // ── Urgency Scoring ───────────────────────────────────
27
+ function scoreUrgency(proposal, model) {
28
+ const dim = proposal.dimension;
29
+ const score = proposal.dimensionScore;
30
+ // Critical defects are always urgent
31
+ if (dim === 'quality' && score < 30)
32
+ return 100;
33
+ // Security issues are urgent
34
+ if (dim === 'performance' && model.lastSiteScan && !model.lastSiteScan.security.https)
35
+ return 90;
36
+ // Low scores are more urgent
37
+ if (score < 20)
38
+ return 80;
39
+ if (score < 40)
40
+ return 60;
41
+ if (score < 60)
42
+ return 40;
43
+ // Revenue is urgent for OPERATING projects
44
+ if (dim === 'revenuePotential' && model.projectState === 'OPERATING')
45
+ return 70;
46
+ return 20; // Low urgency by default
47
+ }
48
+ // ── Risk Scoring ──────────────────────────────────────
49
+ function scoreRisk(proposal) {
50
+ // Revenue/payment campaigns are higher risk (real money)
51
+ if (proposal.dimension === 'revenuePotential')
52
+ return 70;
53
+ // Feature campaigns have moderate risk (new code)
54
+ if (proposal.dimension === 'featureCompleteness')
55
+ return 50;
56
+ // Quality and performance campaigns are low risk
57
+ if (proposal.dimension === 'quality')
58
+ return 20;
59
+ if (proposal.dimension === 'performance')
60
+ return 25;
61
+ // Growth foundation is low risk (additive, no existing code modified)
62
+ if (proposal.dimension === 'growthReadiness')
63
+ return 30;
64
+ return 40;
65
+ }
66
+ // ── Route Optimization ────────────────────────────────
67
+ /**
68
+ * Score and rank campaign proposals by optimal execution order.
69
+ * Returns proposals sorted by total score (highest first = execute first).
70
+ */
71
+ export function optimizeRoute(proposals, model) {
72
+ const scored = proposals.map(proposal => {
73
+ const roiScore = estimateRoi(proposal, model);
74
+ const urgencyScore = scoreUrgency(proposal, model);
75
+ const riskScore = 100 - scoreRisk(proposal); // Invert: low risk = high score
76
+ const totalScore = Math.round(roiScore * WEIGHTS.roi +
77
+ urgencyScore * WEIGHTS.urgency +
78
+ riskScore * WEIGHTS.risk);
79
+ return { proposal, roiScore, urgencyScore, riskScore, totalScore };
80
+ });
81
+ // Sort by total score descending (best first)
82
+ scored.sort((a, b) => b.totalScore - a.totalScore);
83
+ return scored;
84
+ }
85
+ /**
86
+ * Pick the single best campaign to execute next.
87
+ */
88
+ export function pickBestCampaign(proposals, model) {
89
+ if (proposals.length === 0)
90
+ return null;
91
+ const ranked = optimizeRoute(proposals, model);
92
+ return ranked[0].proposal;
93
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * S3 deploy — upload build directory to S3 bucket via SDK.
3
+ * No AWS CLI dependency (ADR-014). Uses @aws-sdk/client-s3 already in project.
4
+ */
5
+ import type { ProvisionEmitter } from './provisioners/types.js';
6
+ export interface S3DeployResult {
7
+ success: boolean;
8
+ deployUrl?: string;
9
+ filesUploaded?: number;
10
+ error?: string;
11
+ }
12
+ /**
13
+ * Upload all files from a build directory to an S3 bucket.
14
+ * Deletes stale files that no longer exist in the build directory.
15
+ */
16
+ export declare function s3Deploy(bucket: string, buildDir: string, region: string, credentials: {
17
+ accessKeyId: string;
18
+ secretAccessKey: string;
19
+ }, websiteUrl: string, emit: ProvisionEmitter): Promise<S3DeployResult>;
@@ -0,0 +1,156 @@
1
+ /**
2
+ * S3 deploy — upload build directory to S3 bucket via SDK.
3
+ * No AWS CLI dependency (ADR-014). Uses @aws-sdk/client-s3 already in project.
4
+ */
5
+ import { readdir, readFile, stat } from 'node:fs/promises';
6
+ import { join, extname, relative } from 'node:path';
7
+ /** MIME type mapping for common static site file types. */
8
+ const MIME_TYPES = {
9
+ '.html': 'text/html',
10
+ '.css': 'text/css',
11
+ '.js': 'application/javascript',
12
+ '.mjs': 'application/javascript',
13
+ '.json': 'application/json',
14
+ '.xml': 'text/xml',
15
+ '.svg': 'image/svg+xml',
16
+ '.png': 'image/png',
17
+ '.jpg': 'image/jpeg',
18
+ '.jpeg': 'image/jpeg',
19
+ '.gif': 'image/gif',
20
+ '.webp': 'image/webp',
21
+ '.avif': 'image/avif',
22
+ '.ico': 'image/x-icon',
23
+ '.woff': 'font/woff',
24
+ '.woff2': 'font/woff2',
25
+ '.ttf': 'font/ttf',
26
+ '.eot': 'application/vnd.ms-fontobject',
27
+ '.otf': 'font/otf',
28
+ '.txt': 'text/plain',
29
+ '.map': 'application/json',
30
+ '.webmanifest': 'application/manifest+json',
31
+ };
32
+ function getMimeType(filePath) {
33
+ return MIME_TYPES[extname(filePath).toLowerCase()] || 'application/octet-stream';
34
+ }
35
+ /** Cache control: immutable for hashed assets, revalidate for HTML/SW. */
36
+ function getCacheControl(filePath) {
37
+ const ext = extname(filePath).toLowerCase();
38
+ if (ext === '.html' || filePath.endsWith('sw.js') || filePath.endsWith('manifest.json') || filePath.endsWith('.webmanifest')) {
39
+ return 'public, max-age=0, must-revalidate';
40
+ }
41
+ return 'public, max-age=31536000, immutable';
42
+ }
43
+ /** Recursively list all files in a directory. */
44
+ async function walkDir(dir) {
45
+ const files = [];
46
+ const entries = await readdir(dir, { withFileTypes: true });
47
+ for (const entry of entries) {
48
+ const full = join(dir, entry.name);
49
+ if (entry.isDirectory()) {
50
+ files.push(...await walkDir(full));
51
+ }
52
+ else if (entry.isFile()) {
53
+ files.push(full);
54
+ }
55
+ }
56
+ return files;
57
+ }
58
+ /**
59
+ * Upload all files from a build directory to an S3 bucket.
60
+ * Deletes stale files that no longer exist in the build directory.
61
+ */
62
+ export async function s3Deploy(bucket, buildDir, region, credentials, websiteUrl, emit) {
63
+ // Dynamic import of AWS SDK
64
+ let S3Client;
65
+ let s3Commands;
66
+ try {
67
+ const s3Mod = await import('@aws-sdk/client-s3');
68
+ S3Client = s3Mod.S3Client;
69
+ s3Commands = s3Mod;
70
+ }
71
+ catch {
72
+ emit({ step: 's3-deploy', status: 'error', message: 'AWS SDK not installed. Run: npm install @aws-sdk/client-s3' });
73
+ return { success: false, error: 'AWS SDK not installed' };
74
+ }
75
+ const s3 = new S3Client({ region, credentials });
76
+ // Step 1: Validate build directory exists
77
+ emit({ step: 's3-deploy', status: 'started', message: `Uploading ${buildDir} to s3://${bucket}` });
78
+ try {
79
+ const dirStat = await stat(buildDir);
80
+ if (!dirStat.isDirectory()) {
81
+ emit({ step: 's3-deploy', status: 'error', message: `Build directory "${buildDir}" is not a directory` });
82
+ return { success: false, error: 'Build directory is not a directory' };
83
+ }
84
+ }
85
+ catch {
86
+ emit({ step: 's3-deploy', status: 'error', message: `Build directory "${buildDir}" does not exist. Run your build command first (e.g., npm run build).` });
87
+ return { success: false, error: 'Build directory does not exist' };
88
+ }
89
+ // Step 2: List local files
90
+ const localFiles = await walkDir(buildDir);
91
+ if (localFiles.length === 0) {
92
+ emit({ step: 's3-deploy', status: 'error', message: `Build directory "${buildDir}" is empty` });
93
+ return { success: false, error: 'Build directory is empty' };
94
+ }
95
+ // Step 3: Upload all files
96
+ let uploaded = 0;
97
+ const localKeys = new Set();
98
+ for (const filePath of localFiles) {
99
+ const key = relative(buildDir, filePath).replace(/\\/g, '/'); // Windows compat
100
+ localKeys.add(key);
101
+ try {
102
+ const body = await readFile(filePath);
103
+ await s3.send(new s3Commands.PutObjectCommand({
104
+ Bucket: bucket,
105
+ Key: key,
106
+ Body: body,
107
+ ContentType: getMimeType(filePath),
108
+ CacheControl: getCacheControl(filePath),
109
+ }));
110
+ uploaded++;
111
+ }
112
+ catch (err) {
113
+ emit({ step: 's3-deploy', status: 'error', message: `Failed to upload ${key}`, detail: err.message });
114
+ return { success: false, error: `Upload failed for ${key}: ${err.message}` };
115
+ }
116
+ // Progress every 20 files
117
+ if (uploaded % 20 === 0) {
118
+ emit({ step: 's3-deploy', status: 'started', message: `Uploaded ${uploaded}/${localFiles.length} files...` });
119
+ }
120
+ }
121
+ // Step 4: Delete stale files from S3
122
+ emit({ step: 's3-cleanup', status: 'started', message: 'Removing stale files from S3' });
123
+ try {
124
+ let deleted = 0;
125
+ let continuationToken;
126
+ do {
127
+ const listRes = await s3.send(new s3Commands.ListObjectsV2Command({
128
+ Bucket: bucket,
129
+ ContinuationToken: continuationToken,
130
+ }));
131
+ const staleKeys = (listRes.Contents ?? [])
132
+ .map(obj => obj.Key)
133
+ .filter(key => !localKeys.has(key));
134
+ if (staleKeys.length > 0) {
135
+ await s3.send(new s3Commands.DeleteObjectsCommand({
136
+ Bucket: bucket,
137
+ Delete: { Objects: staleKeys.map(Key => ({ Key })) },
138
+ }));
139
+ deleted += staleKeys.length;
140
+ }
141
+ continuationToken = listRes.IsTruncated ? listRes.NextContinuationToken : undefined;
142
+ } while (continuationToken);
143
+ if (deleted > 0) {
144
+ emit({ step: 's3-cleanup', status: 'done', message: `Removed ${deleted} stale files` });
145
+ }
146
+ else {
147
+ emit({ step: 's3-cleanup', status: 'done', message: 'No stale files to remove' });
148
+ }
149
+ }
150
+ catch (err) {
151
+ emit({ step: 's3-cleanup', status: 'error', message: 'Failed to clean stale files', detail: err.message });
152
+ // Non-fatal — upload succeeded
153
+ }
154
+ emit({ step: 's3-deploy', status: 'done', message: `Uploaded ${uploaded} files to s3://${bucket}` });
155
+ return { success: true, deployUrl: websiteUrl, filesUploaded: uploaded };
156
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Safety Tier Schema — Budget authorization and spend control.
3
+ *
4
+ * Half-open intervals for budget tiers (§9.17):
5
+ * [0, 2500) cents/day: auto-approve (ongoing spend only — new campaigns need vault password)
6
+ * [2500, 10000) cents/day: agent approval (Dockson + Steris)
7
+ * [10000, 50000) cents/day: human confirmation + TOTP
8
+ * >= 50000 cents/day: hard stop + TOTP + vault password
9
+ *
10
+ * Aggregate auto-approve limit: $100/day across all campaigns (§9.17)
11
+ * Hard stop buffer: platform cap set 10% below VoidForge hard stop (§9.17)
12
+ *
13
+ * Campaign creation rate limits (§9.19.14 + §9.20.3d):
14
+ * Max 5 daemon-initiated campaigns per 24h
15
+ * Max 10 active campaigns per platform
16
+ * Burst detection: >3 within 15 minutes → pause and alert
17
+ *
18
+ * PRD Reference: §9.4, §9.17, §9.19.5, §9.19.14, §9.20.5
19
+ */
20
+ type Cents = number & {
21
+ readonly __brand: 'Cents';
22
+ };
23
+ type SafetyTier = 'auto_approve' | 'agent_approve' | 'human_confirm' | 'hard_stop';
24
+ interface SafetyTierConfig {
25
+ autoApproveBelow: Cents;
26
+ agentApproveBelow: Cents;
27
+ humanConfirmBelow: Cents;
28
+ hardStopAbove: Cents;
29
+ aggregateAutoApproveMax: Cents;
30
+ hardStopBuffer: number;
31
+ }
32
+ declare const DEFAULT_TIERS: SafetyTierConfig;
33
+ interface TierResult {
34
+ tier: SafetyTier;
35
+ requiresVaultPassword: boolean;
36
+ requiresTotp: boolean;
37
+ reason: string;
38
+ }
39
+ /**
40
+ * Classify a daily budget amount into its safety tier.
41
+ * Also considers aggregate spend across all campaigns.
42
+ */
43
+ declare function classifyTier(dailyBudget: Cents, aggregateDailySpend: Cents, config?: SafetyTierConfig): TierResult;
44
+ /**
45
+ * Calculate the platform-level daily cap (10% below VoidForge hard stop).
46
+ * This is set on the ad platform side so the platform enforces the cap
47
+ * even if VoidForge crashes.
48
+ */
49
+ declare function platformDailyCap(config?: SafetyTierConfig): Cents;
50
+ interface RateLimitConfig {
51
+ maxPerDay: number;
52
+ maxActivePerPlatform: number;
53
+ burstThreshold: number;
54
+ burstWindowMs: number;
55
+ }
56
+ declare const DEFAULT_RATE_LIMITS: RateLimitConfig;
57
+ interface RateLimitState {
58
+ creationsToday: number;
59
+ creationTimestamps: number[];
60
+ activeCampaignsByPlatform: Record<string, number>;
61
+ }
62
+ interface RateLimitResult {
63
+ allowed: boolean;
64
+ reason?: string;
65
+ burst?: boolean;
66
+ }
67
+ /**
68
+ * Check if a campaign creation is allowed by rate limits.
69
+ * Only applies to daemon-initiated creation (Tier 1/3).
70
+ * Human-triggered /grow Phase 4 is exempt (§9.20.3d).
71
+ */
72
+ declare function checkCreationRateLimit(state: RateLimitState, platform: string, isDaemonInitiated: boolean, config?: RateLimitConfig): RateLimitResult;
73
+ type AutonomousAction = 'pause_campaign' | 'kill_campaign' | 'evaluate_ab_test' | 'rebalance_budget' | 'generate_report' | 'refresh_token' | 'create_campaign' | 'resume_campaign' | 'increase_budget' | 'unfreeze' | 'modify_code';
74
+ declare function isAutonomouslyAllowed(action: AutonomousAction): boolean;
75
+ export type { SafetyTierConfig, TierResult, RateLimitConfig, RateLimitState, RateLimitResult, AutonomousAction, Cents };
76
+ export { DEFAULT_TIERS, DEFAULT_RATE_LIMITS, classifyTier, platformDailyCap, checkCreationRateLimit, isAutonomouslyAllowed };