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.
- package/dist/scripts/vault-read.d.ts +11 -0
- package/dist/scripts/vault-read.js +89 -0
- package/dist/scripts/voidforge.d.ts +20 -0
- package/dist/scripts/voidforge.js +404 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/wizard/api/auth.d.ts +5 -0
- package/dist/wizard/api/auth.js +133 -0
- package/dist/wizard/api/blueprint.d.ts +45 -0
- package/dist/wizard/api/blueprint.js +184 -0
- package/dist/wizard/api/cloud-providers.d.ts +16 -0
- package/dist/wizard/api/cloud-providers.js +363 -0
- package/dist/wizard/api/credentials.d.ts +1 -0
- package/dist/wizard/api/credentials.js +258 -0
- package/dist/wizard/api/danger-room.d.ts +18 -0
- package/dist/wizard/api/danger-room.js +401 -0
- package/dist/wizard/api/deploy.d.ts +4 -0
- package/dist/wizard/api/deploy.js +164 -0
- package/dist/wizard/api/prd.d.ts +1 -0
- package/dist/wizard/api/prd.js +363 -0
- package/dist/wizard/api/project.d.ts +1 -0
- package/dist/wizard/api/project.js +239 -0
- package/dist/wizard/api/projects.d.ts +6 -0
- package/dist/wizard/api/projects.js +648 -0
- package/dist/wizard/api/provision.d.ts +4 -0
- package/dist/wizard/api/provision.js +535 -0
- package/dist/wizard/api/terminal.d.ts +25 -0
- package/dist/wizard/api/terminal.js +241 -0
- package/dist/wizard/api/users.d.ts +6 -0
- package/dist/wizard/api/users.js +244 -0
- package/dist/wizard/api/war-room.d.ts +14 -0
- package/dist/wizard/api/war-room.js +45 -0
- package/dist/wizard/lib/ad-platform-core.d.ts +6 -0
- package/dist/wizard/lib/ad-platform-core.js +1 -0
- package/dist/wizard/lib/adapters/index.d.ts +52 -0
- package/dist/wizard/lib/adapters/index.js +38 -0
- package/dist/wizard/lib/adapters/sandbox-bank.d.ts +17 -0
- package/dist/wizard/lib/adapters/sandbox-bank.js +77 -0
- package/dist/wizard/lib/adapters/sandbox.d.ts +39 -0
- package/dist/wizard/lib/adapters/sandbox.js +174 -0
- package/dist/wizard/lib/adapters/stripe.d.ts +19 -0
- package/dist/wizard/lib/adapters/stripe.js +143 -0
- package/dist/wizard/lib/adapters/types.d.ts +9 -0
- package/dist/wizard/lib/adapters/types.js +10 -0
- package/dist/wizard/lib/agent-memory.d.ts +36 -0
- package/dist/wizard/lib/agent-memory.js +114 -0
- package/dist/wizard/lib/anomaly-detection.d.ts +59 -0
- package/dist/wizard/lib/anomaly-detection.js +122 -0
- package/dist/wizard/lib/anthropic.d.ts +21 -0
- package/dist/wizard/lib/anthropic.js +105 -0
- package/dist/wizard/lib/asset-scanner.d.ts +23 -0
- package/dist/wizard/lib/asset-scanner.js +107 -0
- package/dist/wizard/lib/audit-log.d.ts +23 -0
- package/dist/wizard/lib/audit-log.js +70 -0
- package/dist/wizard/lib/autonomy-controller.d.ts +76 -0
- package/dist/wizard/lib/autonomy-controller.js +183 -0
- package/dist/wizard/lib/body-parser.d.ts +2 -0
- package/dist/wizard/lib/body-parser.js +36 -0
- package/dist/wizard/lib/build-analytics.d.ts +39 -0
- package/dist/wizard/lib/build-analytics.js +91 -0
- package/dist/wizard/lib/build-step.d.ts +21 -0
- package/dist/wizard/lib/build-step.js +104 -0
- package/dist/wizard/lib/campaign-proposer.d.ts +39 -0
- package/dist/wizard/lib/campaign-proposer.js +180 -0
- package/dist/wizard/lib/campaign-state-machine.d.ts +63 -0
- package/dist/wizard/lib/campaign-state-machine.js +114 -0
- package/dist/wizard/lib/ci-generator.d.ts +14 -0
- package/dist/wizard/lib/ci-generator.js +187 -0
- package/dist/wizard/lib/claude-merge.d.ts +38 -0
- package/dist/wizard/lib/claude-merge.js +115 -0
- package/dist/wizard/lib/codegen/erd-gen.d.ts +16 -0
- package/dist/wizard/lib/codegen/erd-gen.js +98 -0
- package/dist/wizard/lib/codegen/integrations.d.ts +18 -0
- package/dist/wizard/lib/codegen/integrations.js +189 -0
- package/dist/wizard/lib/codegen/openapi-gen.d.ts +15 -0
- package/dist/wizard/lib/codegen/openapi-gen.js +79 -0
- package/dist/wizard/lib/codegen/prisma-types.d.ts +15 -0
- package/dist/wizard/lib/codegen/prisma-types.js +44 -0
- package/dist/wizard/lib/codegen/seed-gen.d.ts +16 -0
- package/dist/wizard/lib/codegen/seed-gen.js +128 -0
- package/dist/wizard/lib/compliance.d.ts +51 -0
- package/dist/wizard/lib/compliance.js +112 -0
- package/dist/wizard/lib/correlation-engine.d.ts +59 -0
- package/dist/wizard/lib/correlation-engine.js +151 -0
- package/dist/wizard/lib/cost-estimator.d.ts +22 -0
- package/dist/wizard/lib/cost-estimator.js +72 -0
- package/dist/wizard/lib/cost-tracker.d.ts +27 -0
- package/dist/wizard/lib/cost-tracker.js +37 -0
- package/dist/wizard/lib/daemon-aggregator.d.ts +71 -0
- package/dist/wizard/lib/daemon-aggregator.js +204 -0
- package/dist/wizard/lib/daemon-core.d.ts +6 -0
- package/dist/wizard/lib/daemon-core.js +5 -0
- package/dist/wizard/lib/dashboard-data.d.ts +132 -0
- package/dist/wizard/lib/dashboard-data.js +336 -0
- package/dist/wizard/lib/dashboard-ws.d.ts +25 -0
- package/dist/wizard/lib/dashboard-ws.js +91 -0
- package/dist/wizard/lib/deep-current.d.ts +77 -0
- package/dist/wizard/lib/deep-current.js +234 -0
- package/dist/wizard/lib/deploy-coordinator.d.ts +40 -0
- package/dist/wizard/lib/deploy-coordinator.js +86 -0
- package/dist/wizard/lib/deploy-log.d.ts +28 -0
- package/dist/wizard/lib/deploy-log.js +52 -0
- package/dist/wizard/lib/desktop-notify.d.ts +27 -0
- package/dist/wizard/lib/desktop-notify.js +98 -0
- package/dist/wizard/lib/dns/cloudflare-dns.d.ts +35 -0
- package/dist/wizard/lib/dns/cloudflare-dns.js +216 -0
- package/dist/wizard/lib/dns/cloudflare-registrar.d.ts +31 -0
- package/dist/wizard/lib/dns/cloudflare-registrar.js +148 -0
- package/dist/wizard/lib/dns/types.d.ts +22 -0
- package/dist/wizard/lib/dns/types.js +4 -0
- package/dist/wizard/lib/document-discovery.d.ts +33 -0
- package/dist/wizard/lib/document-discovery.js +145 -0
- package/dist/wizard/lib/env-validator.d.ts +14 -0
- package/dist/wizard/lib/env-validator.js +205 -0
- package/dist/wizard/lib/env-writer.d.ts +13 -0
- package/dist/wizard/lib/env-writer.js +26 -0
- package/dist/wizard/lib/exec.d.ts +30 -0
- package/dist/wizard/lib/exec.js +52 -0
- package/dist/wizard/lib/experiment.d.ts +70 -0
- package/dist/wizard/lib/experiment.js +169 -0
- package/dist/wizard/lib/extensions.d.ts +20 -0
- package/dist/wizard/lib/extensions.js +183 -0
- package/dist/wizard/lib/financial/adapter-factory.d.ts +47 -0
- package/dist/wizard/lib/financial/adapter-factory.js +225 -0
- package/dist/wizard/lib/financial/billing/base.d.ts +6 -0
- package/dist/wizard/lib/financial/billing/base.js +1 -0
- package/dist/wizard/lib/financial/billing/google-billing.d.ts +56 -0
- package/dist/wizard/lib/financial/billing/google-billing.js +298 -0
- package/dist/wizard/lib/financial/billing/meta-billing.d.ts +54 -0
- package/dist/wizard/lib/financial/billing/meta-billing.js +243 -0
- package/dist/wizard/lib/financial/billing/tiktok-billing.d.ts +54 -0
- package/dist/wizard/lib/financial/billing/tiktok-billing.js +260 -0
- package/dist/wizard/lib/financial/campaign/base.d.ts +13 -0
- package/dist/wizard/lib/financial/campaign/base.js +1 -0
- package/dist/wizard/lib/financial/campaign/google-campaign.d.ts +42 -0
- package/dist/wizard/lib/financial/campaign/google-campaign.js +388 -0
- package/dist/wizard/lib/financial/campaign/meta-campaign.d.ts +41 -0
- package/dist/wizard/lib/financial/campaign/meta-campaign.js +311 -0
- package/dist/wizard/lib/financial/campaign/sandbox-campaign.d.ts +45 -0
- package/dist/wizard/lib/financial/campaign/sandbox-campaign.js +261 -0
- package/dist/wizard/lib/financial/campaign/tiktok-campaign.d.ts +40 -0
- package/dist/wizard/lib/financial/campaign/tiktok-campaign.js +350 -0
- package/dist/wizard/lib/financial/funding-auto.d.ts +44 -0
- package/dist/wizard/lib/financial/funding-auto.js +52 -0
- package/dist/wizard/lib/financial/funding-policy.d.ts +60 -0
- package/dist/wizard/lib/financial/funding-policy.js +179 -0
- package/dist/wizard/lib/financial/platform-planner.d.ts +47 -0
- package/dist/wizard/lib/financial/platform-planner.js +134 -0
- package/dist/wizard/lib/financial/reconciliation-engine.d.ts +78 -0
- package/dist/wizard/lib/financial/reconciliation-engine.js +193 -0
- package/dist/wizard/lib/financial/registry.d.ts +22 -0
- package/dist/wizard/lib/financial/registry.js +26 -0
- package/dist/wizard/lib/financial/reporting.d.ts +96 -0
- package/dist/wizard/lib/financial/reporting.js +198 -0
- package/dist/wizard/lib/financial/stablecoin/base.d.ts +6 -0
- package/dist/wizard/lib/financial/stablecoin/base.js +1 -0
- package/dist/wizard/lib/financial/stablecoin/circle.d.ts +54 -0
- package/dist/wizard/lib/financial/stablecoin/circle.js +367 -0
- package/dist/wizard/lib/financial/stablecoin/mercury.d.ts +24 -0
- package/dist/wizard/lib/financial/stablecoin/mercury.js +171 -0
- package/dist/wizard/lib/financial/stablecoin/sandbox-stablecoin.d.ts +47 -0
- package/dist/wizard/lib/financial/stablecoin/sandbox-stablecoin.js +202 -0
- package/dist/wizard/lib/financial/treasury-planner.d.ts +52 -0
- package/dist/wizard/lib/financial/treasury-planner.js +128 -0
- package/dist/wizard/lib/financial-core.d.ts +6 -0
- package/dist/wizard/lib/financial-core.js +5 -0
- package/dist/wizard/lib/financial-vault.d.ts +34 -0
- package/dist/wizard/lib/financial-vault.js +199 -0
- package/dist/wizard/lib/frontmatter.d.ts +30 -0
- package/dist/wizard/lib/frontmatter.js +96 -0
- package/dist/wizard/lib/gap-analysis.d.ts +37 -0
- package/dist/wizard/lib/gap-analysis.js +218 -0
- package/dist/wizard/lib/github.d.ts +22 -0
- package/dist/wizard/lib/github.js +261 -0
- package/dist/wizard/lib/headless-deploy.d.ts +14 -0
- package/dist/wizard/lib/headless-deploy.js +452 -0
- package/dist/wizard/lib/health-monitor.d.ts +15 -0
- package/dist/wizard/lib/health-monitor.js +91 -0
- package/dist/wizard/lib/health-poller.d.ts +9 -0
- package/dist/wizard/lib/health-poller.js +123 -0
- package/dist/wizard/lib/heartbeat.d.ts +15 -0
- package/dist/wizard/lib/heartbeat.js +827 -0
- package/dist/wizard/lib/http-helpers.d.ts +9 -0
- package/dist/wizard/lib/http-helpers.js +24 -0
- package/dist/wizard/lib/image-gen.d.ts +56 -0
- package/dist/wizard/lib/image-gen.js +159 -0
- package/dist/wizard/lib/instance-sizing.d.ts +26 -0
- package/dist/wizard/lib/instance-sizing.js +51 -0
- package/dist/wizard/lib/kongo/analytics.d.ts +29 -0
- package/dist/wizard/lib/kongo/analytics.js +179 -0
- package/dist/wizard/lib/kongo/campaigns.d.ts +52 -0
- package/dist/wizard/lib/kongo/campaigns.js +91 -0
- package/dist/wizard/lib/kongo/client.d.ts +58 -0
- package/dist/wizard/lib/kongo/client.js +221 -0
- package/dist/wizard/lib/kongo/jobs.d.ts +57 -0
- package/dist/wizard/lib/kongo/jobs.js +122 -0
- package/dist/wizard/lib/kongo/pages.d.ts +60 -0
- package/dist/wizard/lib/kongo/pages.js +150 -0
- package/dist/wizard/lib/kongo/provisioner.d.ts +64 -0
- package/dist/wizard/lib/kongo/provisioner.js +116 -0
- package/dist/wizard/lib/kongo/seed.d.ts +49 -0
- package/dist/wizard/lib/kongo/seed.js +237 -0
- package/dist/wizard/lib/kongo/types.d.ts +323 -0
- package/dist/wizard/lib/kongo/types.js +11 -0
- package/dist/wizard/lib/kongo/variants.d.ts +57 -0
- package/dist/wizard/lib/kongo/variants.js +88 -0
- package/dist/wizard/lib/kongo/webhooks.d.ts +41 -0
- package/dist/wizard/lib/kongo/webhooks.js +112 -0
- package/dist/wizard/lib/marker.d.ts +28 -0
- package/dist/wizard/lib/marker.js +79 -0
- package/dist/wizard/lib/migrator.d.ts +35 -0
- package/dist/wizard/lib/migrator.js +190 -0
- package/dist/wizard/lib/natural-language-deploy.d.ts +30 -0
- package/dist/wizard/lib/natural-language-deploy.js +186 -0
- package/dist/wizard/lib/network.d.ts +22 -0
- package/dist/wizard/lib/network.js +72 -0
- package/dist/wizard/lib/oauth-core.d.ts +6 -0
- package/dist/wizard/lib/oauth-core.js +5 -0
- package/dist/wizard/lib/open-browser.d.ts +1 -0
- package/dist/wizard/lib/open-browser.js +26 -0
- package/dist/wizard/lib/patterns/ad-billing-adapter.d.ts +209 -0
- package/dist/wizard/lib/patterns/ad-billing-adapter.js +269 -0
- package/dist/wizard/lib/patterns/ad-platform-adapter.d.ts +200 -0
- package/dist/wizard/lib/patterns/ad-platform-adapter.js +212 -0
- package/dist/wizard/lib/patterns/daemon-process.d.ts +88 -0
- package/dist/wizard/lib/patterns/daemon-process.js +271 -0
- package/dist/wizard/lib/patterns/financial-transaction.d.ts +161 -0
- package/dist/wizard/lib/patterns/financial-transaction.js +132 -0
- package/dist/wizard/lib/patterns/funding-plan.d.ts +136 -0
- package/dist/wizard/lib/patterns/funding-plan.js +200 -0
- package/dist/wizard/lib/patterns/oauth-token-lifecycle.d.ts +94 -0
- package/dist/wizard/lib/patterns/oauth-token-lifecycle.js +139 -0
- package/dist/wizard/lib/patterns/outbound-rate-limiter.d.ts +67 -0
- package/dist/wizard/lib/patterns/outbound-rate-limiter.js +216 -0
- package/dist/wizard/lib/patterns/revenue-source-adapter.d.ts +96 -0
- package/dist/wizard/lib/patterns/revenue-source-adapter.js +182 -0
- package/dist/wizard/lib/patterns/stablecoin-adapter.d.ts +218 -0
- package/dist/wizard/lib/patterns/stablecoin-adapter.js +264 -0
- package/dist/wizard/lib/prd-validator.d.ts +39 -0
- package/dist/wizard/lib/prd-validator.js +137 -0
- package/dist/wizard/lib/project-init.d.ts +24 -0
- package/dist/wizard/lib/project-init.js +193 -0
- package/dist/wizard/lib/project-registry.d.ts +86 -0
- package/dist/wizard/lib/project-registry.js +359 -0
- package/dist/wizard/lib/provision-manifest.d.ts +44 -0
- package/dist/wizard/lib/provision-manifest.js +164 -0
- package/dist/wizard/lib/provisioner-registry.d.ts +15 -0
- package/dist/wizard/lib/provisioner-registry.js +34 -0
- package/dist/wizard/lib/provisioners/aws-vps.d.ts +6 -0
- package/dist/wizard/lib/provisioners/aws-vps.js +643 -0
- package/dist/wizard/lib/provisioners/cloudflare.d.ts +6 -0
- package/dist/wizard/lib/provisioners/cloudflare.js +300 -0
- package/dist/wizard/lib/provisioners/docker.d.ts +6 -0
- package/dist/wizard/lib/provisioners/docker.js +75 -0
- package/dist/wizard/lib/provisioners/http-client.d.ts +20 -0
- package/dist/wizard/lib/provisioners/http-client.js +79 -0
- package/dist/wizard/lib/provisioners/railway.d.ts +6 -0
- package/dist/wizard/lib/provisioners/railway.js +413 -0
- package/dist/wizard/lib/provisioners/scripts/caddyfile.d.ts +10 -0
- package/dist/wizard/lib/provisioners/scripts/caddyfile.js +54 -0
- package/dist/wizard/lib/provisioners/scripts/deploy-vps.d.ts +10 -0
- package/dist/wizard/lib/provisioners/scripts/deploy-vps.js +112 -0
- package/dist/wizard/lib/provisioners/scripts/docker-compose.d.ts +11 -0
- package/dist/wizard/lib/provisioners/scripts/docker-compose.js +91 -0
- package/dist/wizard/lib/provisioners/scripts/dockerfile.d.ts +5 -0
- package/dist/wizard/lib/provisioners/scripts/dockerfile.js +185 -0
- package/dist/wizard/lib/provisioners/scripts/ecosystem-config.d.ts +10 -0
- package/dist/wizard/lib/provisioners/scripts/ecosystem-config.js +36 -0
- package/dist/wizard/lib/provisioners/scripts/provision-vps.d.ts +14 -0
- package/dist/wizard/lib/provisioners/scripts/provision-vps.js +202 -0
- package/dist/wizard/lib/provisioners/scripts/rollback-vps.d.ts +10 -0
- package/dist/wizard/lib/provisioners/scripts/rollback-vps.js +67 -0
- package/dist/wizard/lib/provisioners/self-deploy.d.ts +41 -0
- package/dist/wizard/lib/provisioners/self-deploy.js +185 -0
- package/dist/wizard/lib/provisioners/static-s3.d.ts +6 -0
- package/dist/wizard/lib/provisioners/static-s3.js +235 -0
- package/dist/wizard/lib/provisioners/types.d.ts +40 -0
- package/dist/wizard/lib/provisioners/types.js +4 -0
- package/dist/wizard/lib/provisioners/vercel.d.ts +6 -0
- package/dist/wizard/lib/provisioners/vercel.js +287 -0
- package/dist/wizard/lib/pty-manager.d.ts +42 -0
- package/dist/wizard/lib/pty-manager.js +231 -0
- package/dist/wizard/lib/rate-limiter-core.d.ts +5 -0
- package/dist/wizard/lib/rate-limiter-core.js +5 -0
- package/dist/wizard/lib/reconciliation.d.ts +43 -0
- package/dist/wizard/lib/reconciliation.js +173 -0
- package/dist/wizard/lib/revenue-types.d.ts +5 -0
- package/dist/wizard/lib/revenue-types.js +1 -0
- package/dist/wizard/lib/route-optimizer.d.ts +28 -0
- package/dist/wizard/lib/route-optimizer.js +93 -0
- package/dist/wizard/lib/s3-deploy.d.ts +19 -0
- package/dist/wizard/lib/s3-deploy.js +156 -0
- package/dist/wizard/lib/safety-tiers.d.ts +76 -0
- package/dist/wizard/lib/safety-tiers.js +134 -0
- package/dist/wizard/lib/sentry-generator.d.ts +15 -0
- package/dist/wizard/lib/sentry-generator.js +116 -0
- package/dist/wizard/lib/server-config.d.ts +13 -0
- package/dist/wizard/lib/server-config.js +23 -0
- package/dist/wizard/lib/service-install.d.ts +18 -0
- package/dist/wizard/lib/service-install.js +182 -0
- package/dist/wizard/lib/site-scanner.d.ts +80 -0
- package/dist/wizard/lib/site-scanner.js +262 -0
- package/dist/wizard/lib/ssh-deploy.d.ts +25 -0
- package/dist/wizard/lib/ssh-deploy.js +225 -0
- package/dist/wizard/lib/templates.d.ts +24 -0
- package/dist/wizard/lib/templates.js +219 -0
- package/dist/wizard/lib/totp.d.ts +35 -0
- package/dist/wizard/lib/totp.js +276 -0
- package/dist/wizard/lib/tower-auth.d.ts +43 -0
- package/dist/wizard/lib/tower-auth.js +352 -0
- package/dist/wizard/lib/tower-rate-limit.d.ts +14 -0
- package/dist/wizard/lib/tower-rate-limit.js +61 -0
- package/dist/wizard/lib/tower-session.d.ts +28 -0
- package/dist/wizard/lib/tower-session.js +119 -0
- package/dist/wizard/lib/treasury-backup.d.ts +23 -0
- package/dist/wizard/lib/treasury-backup.js +126 -0
- package/dist/wizard/lib/treasury-heartbeat.d.ts +82 -0
- package/dist/wizard/lib/treasury-heartbeat.js +1104 -0
- package/dist/wizard/lib/updater.d.ts +29 -0
- package/dist/wizard/lib/updater.js +190 -0
- package/dist/wizard/lib/user-manager.d.ts +39 -0
- package/dist/wizard/lib/user-manager.js +182 -0
- package/dist/wizard/lib/vault.d.ts +26 -0
- package/dist/wizard/lib/vault.js +161 -0
- package/dist/wizard/router.d.ts +5 -0
- package/dist/wizard/router.js +15 -0
- package/dist/wizard/server.d.ts +18 -0
- package/dist/wizard/server.js +436 -0
- package/package.json +59 -0
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kongo Engine API types — matched to the real Kongo API surface at kongo.io/api/v1.
|
|
3
|
+
*
|
|
4
|
+
* These types represent the actual API request/response shapes, not abstract
|
|
5
|
+
* interfaces. Kongo is a first-party integration (ADR-036): the user owns both
|
|
6
|
+
* VoidForge and Kongo, so no adapter abstraction is needed.
|
|
7
|
+
*
|
|
8
|
+
* Base URL: https://kongo.io/api/v1
|
|
9
|
+
* Auth: Bearer token with ke_live_ prefix
|
|
10
|
+
*/
|
|
11
|
+
export type PageStatus = 'GENERATING' | 'READY' | 'ERROR';
|
|
12
|
+
export type PageTemplate = 'PITCH' | 'landing-page' | 'company-overview' | 'product-launch' | 'event-page' | 'one-pager';
|
|
13
|
+
export interface PageStyle {
|
|
14
|
+
readonly colors?: {
|
|
15
|
+
primary?: string;
|
|
16
|
+
secondary?: string;
|
|
17
|
+
accent?: string;
|
|
18
|
+
};
|
|
19
|
+
readonly fonts?: {
|
|
20
|
+
heading?: string;
|
|
21
|
+
body?: string;
|
|
22
|
+
};
|
|
23
|
+
readonly designSystem?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface AccessGate {
|
|
26
|
+
readonly password?: string;
|
|
27
|
+
readonly emailCapture?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface CreatePageRequest {
|
|
30
|
+
readonly companyName: string;
|
|
31
|
+
readonly content: string;
|
|
32
|
+
readonly brief?: Record<string, unknown>;
|
|
33
|
+
readonly template?: PageTemplate;
|
|
34
|
+
readonly style?: PageStyle;
|
|
35
|
+
readonly hosted?: boolean;
|
|
36
|
+
readonly callbackUrl?: string;
|
|
37
|
+
readonly metadata?: Record<string, unknown>;
|
|
38
|
+
readonly accessGate?: AccessGate;
|
|
39
|
+
readonly seoTitle?: string;
|
|
40
|
+
readonly seoDescription?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface CreatePageResponse {
|
|
43
|
+
readonly pageId: string;
|
|
44
|
+
readonly status: 'GENERATING';
|
|
45
|
+
readonly statusUrl: string;
|
|
46
|
+
readonly createdAt: string;
|
|
47
|
+
}
|
|
48
|
+
export interface PageGenerationStats {
|
|
49
|
+
readonly durationSec: number;
|
|
50
|
+
readonly inputTokens: number;
|
|
51
|
+
readonly outputTokens: number;
|
|
52
|
+
readonly costUsd: number;
|
|
53
|
+
readonly promptVersion?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface PageProgressStep {
|
|
56
|
+
readonly step: string;
|
|
57
|
+
readonly status: string;
|
|
58
|
+
readonly timestamp?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface PageErrorDetail {
|
|
61
|
+
readonly code: string;
|
|
62
|
+
readonly message: string;
|
|
63
|
+
}
|
|
64
|
+
export interface PageDetail {
|
|
65
|
+
readonly pageId: string;
|
|
66
|
+
readonly status: PageStatus;
|
|
67
|
+
readonly companyName: string;
|
|
68
|
+
readonly html?: string;
|
|
69
|
+
readonly hostedUrl?: string;
|
|
70
|
+
readonly progress?: PageProgressStep[];
|
|
71
|
+
readonly generation?: PageGenerationStats;
|
|
72
|
+
readonly error?: PageErrorDetail;
|
|
73
|
+
readonly createdAt: string;
|
|
74
|
+
readonly updatedAt?: string;
|
|
75
|
+
readonly metadata?: Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
export interface ListPagesOptions {
|
|
78
|
+
readonly cursor?: string;
|
|
79
|
+
readonly limit?: number;
|
|
80
|
+
readonly status?: PageStatus;
|
|
81
|
+
readonly sort?: 'createdAt' | 'updatedAt';
|
|
82
|
+
readonly order?: 'asc' | 'desc';
|
|
83
|
+
}
|
|
84
|
+
export interface PaginatedResponse<T> {
|
|
85
|
+
readonly items: T[];
|
|
86
|
+
readonly cursor?: string;
|
|
87
|
+
readonly hasMore: boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface BatchPageConfig {
|
|
90
|
+
readonly companyName: string;
|
|
91
|
+
readonly content: string;
|
|
92
|
+
readonly brief?: Record<string, unknown>;
|
|
93
|
+
readonly template?: PageTemplate;
|
|
94
|
+
readonly style?: PageStyle;
|
|
95
|
+
readonly hosted?: boolean;
|
|
96
|
+
readonly callbackUrl?: string;
|
|
97
|
+
readonly metadata?: Record<string, unknown>;
|
|
98
|
+
readonly accessGate?: AccessGate;
|
|
99
|
+
readonly seoTitle?: string;
|
|
100
|
+
readonly seoDescription?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface BatchGenerateRequest {
|
|
103
|
+
readonly pages: BatchPageConfig[];
|
|
104
|
+
}
|
|
105
|
+
export interface BatchPageResult {
|
|
106
|
+
readonly pageId: string;
|
|
107
|
+
readonly status: 'GENERATING';
|
|
108
|
+
readonly statusUrl: string;
|
|
109
|
+
readonly createdAt: string;
|
|
110
|
+
}
|
|
111
|
+
export type RotationStrategy = 'weighted' | 'equal' | 'bandit';
|
|
112
|
+
export interface SourceRule {
|
|
113
|
+
readonly source: string;
|
|
114
|
+
readonly variantId: string;
|
|
115
|
+
}
|
|
116
|
+
export interface CreateCampaignRequest {
|
|
117
|
+
readonly name: string;
|
|
118
|
+
readonly templateId: string;
|
|
119
|
+
readonly slug: string;
|
|
120
|
+
readonly rotationStrategy?: RotationStrategy;
|
|
121
|
+
readonly trackingEnabled?: boolean;
|
|
122
|
+
readonly accessGate?: AccessGate;
|
|
123
|
+
readonly metadata?: Record<string, unknown>;
|
|
124
|
+
readonly sourceRules?: SourceRule[];
|
|
125
|
+
}
|
|
126
|
+
export interface CampaignDetail {
|
|
127
|
+
readonly campaignId: string;
|
|
128
|
+
readonly name: string;
|
|
129
|
+
readonly templateId: string;
|
|
130
|
+
readonly slug: string;
|
|
131
|
+
readonly rotationStrategy: RotationStrategy;
|
|
132
|
+
readonly isPublished: boolean;
|
|
133
|
+
readonly trackingEnabled: boolean;
|
|
134
|
+
readonly accessGate?: {
|
|
135
|
+
passwordProtected: boolean;
|
|
136
|
+
emailCapture: boolean;
|
|
137
|
+
};
|
|
138
|
+
readonly metadata?: Record<string, unknown>;
|
|
139
|
+
readonly sourceRules?: SourceRule[];
|
|
140
|
+
readonly createdAt: string;
|
|
141
|
+
readonly updatedAt?: string;
|
|
142
|
+
}
|
|
143
|
+
export interface UpdateCampaignRequest {
|
|
144
|
+
readonly rotationStrategy?: RotationStrategy;
|
|
145
|
+
readonly trackingEnabled?: boolean;
|
|
146
|
+
readonly accessGate?: AccessGate;
|
|
147
|
+
readonly metadata?: Record<string, unknown>;
|
|
148
|
+
readonly sourceRules?: SourceRule[];
|
|
149
|
+
}
|
|
150
|
+
export interface PublishResult {
|
|
151
|
+
readonly campaignId: string;
|
|
152
|
+
readonly slug: string;
|
|
153
|
+
readonly domain: string;
|
|
154
|
+
readonly publishedAt: string;
|
|
155
|
+
}
|
|
156
|
+
export interface ListCampaignsOptions {
|
|
157
|
+
readonly cursor?: string;
|
|
158
|
+
readonly limit?: number;
|
|
159
|
+
readonly published?: boolean;
|
|
160
|
+
readonly search?: string;
|
|
161
|
+
}
|
|
162
|
+
export interface CreateVariantRequest {
|
|
163
|
+
readonly label: string;
|
|
164
|
+
readonly slotValues: Record<string, string>;
|
|
165
|
+
readonly weight?: number;
|
|
166
|
+
readonly source?: string;
|
|
167
|
+
}
|
|
168
|
+
export interface VariantDetail {
|
|
169
|
+
readonly variantId: string;
|
|
170
|
+
readonly label: string;
|
|
171
|
+
readonly order: number;
|
|
172
|
+
readonly slotCount: number;
|
|
173
|
+
readonly slotValues?: Record<string, string>;
|
|
174
|
+
readonly compiledHtml?: string;
|
|
175
|
+
readonly weight: number;
|
|
176
|
+
readonly source?: string;
|
|
177
|
+
readonly isActive: boolean;
|
|
178
|
+
readonly views: number;
|
|
179
|
+
readonly conversions: number;
|
|
180
|
+
readonly cvr: number;
|
|
181
|
+
readonly createdAt: string;
|
|
182
|
+
readonly updatedAt?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface UpdateVariantRequest {
|
|
185
|
+
readonly label?: string;
|
|
186
|
+
readonly slotValues?: Record<string, string>;
|
|
187
|
+
readonly weight?: number;
|
|
188
|
+
readonly isActive?: boolean;
|
|
189
|
+
}
|
|
190
|
+
export interface GenerateVariantsRequest {
|
|
191
|
+
readonly count: number;
|
|
192
|
+
readonly vary: string[];
|
|
193
|
+
readonly baseValues?: Record<string, string>;
|
|
194
|
+
readonly context?: string;
|
|
195
|
+
readonly sources?: string[];
|
|
196
|
+
}
|
|
197
|
+
export interface GenerateVariantsResult {
|
|
198
|
+
readonly variants: Array<{
|
|
199
|
+
variantId: string;
|
|
200
|
+
label: string;
|
|
201
|
+
order: number;
|
|
202
|
+
slotCount: number;
|
|
203
|
+
source?: string;
|
|
204
|
+
createdAt: string;
|
|
205
|
+
}>;
|
|
206
|
+
readonly generation: {
|
|
207
|
+
inputTokens: number;
|
|
208
|
+
outputTokens: number;
|
|
209
|
+
costUsd: number;
|
|
210
|
+
durationMs: number;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
export interface RegenerateVariantRequest {
|
|
214
|
+
readonly slots: string[];
|
|
215
|
+
readonly direction?: string;
|
|
216
|
+
}
|
|
217
|
+
export type AnalyticsPeriod = '7d' | '30d' | '90d' | 'all';
|
|
218
|
+
export interface CampaignAnalytics {
|
|
219
|
+
readonly period: AnalyticsPeriod;
|
|
220
|
+
readonly summary: {
|
|
221
|
+
totalViews: number;
|
|
222
|
+
totalConversions: number;
|
|
223
|
+
cvr: number;
|
|
224
|
+
};
|
|
225
|
+
readonly byVariant: Array<{
|
|
226
|
+
variantId: string;
|
|
227
|
+
label: string;
|
|
228
|
+
order: number;
|
|
229
|
+
views: number;
|
|
230
|
+
conversions: number;
|
|
231
|
+
cvr: number;
|
|
232
|
+
weight: number;
|
|
233
|
+
}>;
|
|
234
|
+
readonly bySource: Array<{
|
|
235
|
+
source: string;
|
|
236
|
+
views: number;
|
|
237
|
+
conversions: number;
|
|
238
|
+
cvr: number;
|
|
239
|
+
}>;
|
|
240
|
+
readonly byDay: Array<{
|
|
241
|
+
date: string;
|
|
242
|
+
views: number;
|
|
243
|
+
conversions: number;
|
|
244
|
+
}>;
|
|
245
|
+
}
|
|
246
|
+
export type GrowthRecommendation = 'scale' | 'iterate' | 'kill' | 'wait';
|
|
247
|
+
export interface ComputedGrowthSignal {
|
|
248
|
+
readonly campaignId: string;
|
|
249
|
+
readonly timestamp: string;
|
|
250
|
+
readonly winningVariantId: string | null;
|
|
251
|
+
readonly confidence: number;
|
|
252
|
+
readonly conversionRateDelta: number;
|
|
253
|
+
readonly recommendation: GrowthRecommendation;
|
|
254
|
+
readonly reasoning: string;
|
|
255
|
+
readonly sampleSize: {
|
|
256
|
+
control: number;
|
|
257
|
+
variant: number;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
export type ConversionEventType = 'view' | 'click' | 'form_submit' | 'purchase';
|
|
261
|
+
export interface ConversionEvent {
|
|
262
|
+
readonly campaignId: string;
|
|
263
|
+
readonly variantId: string;
|
|
264
|
+
readonly visitorId: string;
|
|
265
|
+
readonly type: ConversionEventType;
|
|
266
|
+
readonly eventName?: string;
|
|
267
|
+
readonly value?: number;
|
|
268
|
+
readonly utmSource?: string;
|
|
269
|
+
readonly utmMedium?: string;
|
|
270
|
+
readonly utmCampaign?: string;
|
|
271
|
+
readonly scrollDepth?: number;
|
|
272
|
+
readonly durationSec?: number;
|
|
273
|
+
}
|
|
274
|
+
export type WebhookEventType = 'page.completed' | 'page.failed';
|
|
275
|
+
export interface WebhookPayload {
|
|
276
|
+
readonly event: WebhookEventType;
|
|
277
|
+
readonly pageId: string;
|
|
278
|
+
readonly data: {
|
|
279
|
+
companyName: string;
|
|
280
|
+
status: 'READY' | 'ERROR';
|
|
281
|
+
durationSec?: number;
|
|
282
|
+
costUsd?: number;
|
|
283
|
+
htmlLength?: number;
|
|
284
|
+
error?: string;
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
export interface KongoSuccessResponse<T> {
|
|
288
|
+
readonly success: true;
|
|
289
|
+
readonly data: T;
|
|
290
|
+
}
|
|
291
|
+
export interface KongoErrorResponse {
|
|
292
|
+
readonly success: false;
|
|
293
|
+
readonly error: {
|
|
294
|
+
code: string;
|
|
295
|
+
message: string;
|
|
296
|
+
details?: Record<string, unknown>;
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
export type KongoResponse<T> = KongoSuccessResponse<T> | KongoErrorResponse;
|
|
300
|
+
export type KongoErrorCode = 'UNAUTHORIZED' | 'TIER_RESTRICTED' | 'PERMISSION_DENIED' | 'RATE_LIMITED' | 'MONTHLY_LIMIT' | 'CONCURRENT_LIMIT' | 'SERVICE_BUSY' | 'VALIDATION_ERROR' | 'CONTENT_BLOCKED' | 'NOT_FOUND' | 'NOT_READY';
|
|
301
|
+
export interface KongoClientConfig {
|
|
302
|
+
readonly apiKey: string;
|
|
303
|
+
readonly baseUrl?: string;
|
|
304
|
+
readonly timeoutMs?: number;
|
|
305
|
+
readonly rateLimitPerMinute?: number;
|
|
306
|
+
}
|
|
307
|
+
export interface PrdSeedContent {
|
|
308
|
+
readonly projectName: string;
|
|
309
|
+
readonly headline: string;
|
|
310
|
+
readonly subheadline: string;
|
|
311
|
+
readonly valueProps: string[];
|
|
312
|
+
readonly ctaText: string;
|
|
313
|
+
readonly ctaUrl: string;
|
|
314
|
+
readonly brandColors: {
|
|
315
|
+
primary: string;
|
|
316
|
+
secondary: string;
|
|
317
|
+
accent: string;
|
|
318
|
+
};
|
|
319
|
+
readonly logoUrl?: string;
|
|
320
|
+
readonly socialProof?: string[];
|
|
321
|
+
readonly campaignId?: string;
|
|
322
|
+
readonly platform?: string;
|
|
323
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kongo Engine API types — matched to the real Kongo API surface at kongo.io/api/v1.
|
|
3
|
+
*
|
|
4
|
+
* These types represent the actual API request/response shapes, not abstract
|
|
5
|
+
* interfaces. Kongo is a first-party integration (ADR-036): the user owns both
|
|
6
|
+
* VoidForge and Kongo, so no adapter abstraction is needed.
|
|
7
|
+
*
|
|
8
|
+
* Base URL: https://kongo.io/api/v1
|
|
9
|
+
* Auth: Bearer token with ke_live_ prefix
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kongo Variants — Variant lifecycle and AI generation.
|
|
3
|
+
*
|
|
4
|
+
* Create, list, update, delete variants within campaigns.
|
|
5
|
+
* AI-powered bulk variant generation and slot regeneration.
|
|
6
|
+
*
|
|
7
|
+
* Real Kongo API endpoints:
|
|
8
|
+
* - POST /engine/campaigns/:campaignId/variants — create variant
|
|
9
|
+
* - GET /engine/campaigns/:campaignId/variants — list variants
|
|
10
|
+
* - GET /engine/campaigns/:campaignId/variants/:variantId — get variant
|
|
11
|
+
* - PATCH /engine/campaigns/:campaignId/variants/:variantId — update
|
|
12
|
+
* - DELETE /engine/campaigns/:campaignId/variants/:variantId — deactivate
|
|
13
|
+
* - POST /engine/campaigns/:campaignId/variants/generate — AI generate N variants
|
|
14
|
+
* - POST /engine/campaigns/:campaignId/variants/:variantId/regenerate — regen slots
|
|
15
|
+
*
|
|
16
|
+
* PRD Reference: PRD-kongo-integration.md §4.2
|
|
17
|
+
*/
|
|
18
|
+
import { KongoClient } from './client.js';
|
|
19
|
+
import type { CreateVariantRequest, VariantDetail, UpdateVariantRequest, GenerateVariantsRequest, GenerateVariantsResult, RegenerateVariantRequest } from './types.js';
|
|
20
|
+
/**
|
|
21
|
+
* Create a single variant with explicit slot values.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createVariant(client: KongoClient, campaignId: string, config: CreateVariantRequest): Promise<VariantDetail>;
|
|
24
|
+
/**
|
|
25
|
+
* List all variants for a campaign.
|
|
26
|
+
* Returns view counts, conversions, CVR, weights, and direct URLs.
|
|
27
|
+
*/
|
|
28
|
+
export declare function listVariants(client: KongoClient, campaignId: string): Promise<VariantDetail[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Get a single variant with full details including slotValues and compiledHtml.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getVariant(client: KongoClient, campaignId: string, variantId: string): Promise<VariantDetail>;
|
|
33
|
+
/**
|
|
34
|
+
* Update a variant's label, slot values, weight, or active status.
|
|
35
|
+
* Slot value updates are merged (existing preserved, new override).
|
|
36
|
+
*/
|
|
37
|
+
export declare function updateVariant(client: KongoClient, campaignId: string, variantId: string, updates: UpdateVariantRequest): Promise<VariantDetail>;
|
|
38
|
+
/**
|
|
39
|
+
* Deactivate a variant (soft delete).
|
|
40
|
+
*/
|
|
41
|
+
export declare function deleteVariant(client: KongoClient, campaignId: string, variantId: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* AI-generate multiple variants in a single call.
|
|
44
|
+
* Uses Claude Sonnet to produce N variants varying specified slots.
|
|
45
|
+
* ~$0.01, ~3s for 5 variants.
|
|
46
|
+
*/
|
|
47
|
+
export declare function generateVariants(client: KongoClient, campaignId: string, config: GenerateVariantsRequest): Promise<GenerateVariantsResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Regenerate specific slots of an existing variant using AI.
|
|
50
|
+
* Merged values are recompiled into HTML.
|
|
51
|
+
*/
|
|
52
|
+
export declare function regenerateVariantSlots(client: KongoClient, campaignId: string, variantId: string, config: RegenerateVariantRequest): Promise<VariantDetail>;
|
|
53
|
+
/**
|
|
54
|
+
* Set rotation strategy for a campaign.
|
|
55
|
+
* Convenience wrapper around updateCampaign — updates only rotationStrategy.
|
|
56
|
+
*/
|
|
57
|
+
export declare function setRotation(client: KongoClient, campaignId: string, strategy: 'weighted' | 'equal' | 'bandit'): Promise<void>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kongo Variants — Variant lifecycle and AI generation.
|
|
3
|
+
*
|
|
4
|
+
* Create, list, update, delete variants within campaigns.
|
|
5
|
+
* AI-powered bulk variant generation and slot regeneration.
|
|
6
|
+
*
|
|
7
|
+
* Real Kongo API endpoints:
|
|
8
|
+
* - POST /engine/campaigns/:campaignId/variants — create variant
|
|
9
|
+
* - GET /engine/campaigns/:campaignId/variants — list variants
|
|
10
|
+
* - GET /engine/campaigns/:campaignId/variants/:variantId — get variant
|
|
11
|
+
* - PATCH /engine/campaigns/:campaignId/variants/:variantId — update
|
|
12
|
+
* - DELETE /engine/campaigns/:campaignId/variants/:variantId — deactivate
|
|
13
|
+
* - POST /engine/campaigns/:campaignId/variants/generate — AI generate N variants
|
|
14
|
+
* - POST /engine/campaigns/:campaignId/variants/:variantId/regenerate — regen slots
|
|
15
|
+
*
|
|
16
|
+
* PRD Reference: PRD-kongo-integration.md §4.2
|
|
17
|
+
*/
|
|
18
|
+
import { KongoApiError } from './client.js';
|
|
19
|
+
// ── Variant Operations ───────────────────────────────────
|
|
20
|
+
function campaignVariantsPath(campaignId) {
|
|
21
|
+
return `/engine/campaigns/${encodeURIComponent(campaignId)}/variants`;
|
|
22
|
+
}
|
|
23
|
+
function variantPath(campaignId, variantId) {
|
|
24
|
+
return `${campaignVariantsPath(campaignId)}/${encodeURIComponent(variantId)}`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create a single variant with explicit slot values.
|
|
28
|
+
*/
|
|
29
|
+
export async function createVariant(client, campaignId, config) {
|
|
30
|
+
return client.post(campaignVariantsPath(campaignId), config);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* List all variants for a campaign.
|
|
34
|
+
* Returns view counts, conversions, CVR, weights, and direct URLs.
|
|
35
|
+
*/
|
|
36
|
+
export async function listVariants(client, campaignId) {
|
|
37
|
+
return client.get(campaignVariantsPath(campaignId));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get a single variant with full details including slotValues and compiledHtml.
|
|
41
|
+
*/
|
|
42
|
+
export async function getVariant(client, campaignId, variantId) {
|
|
43
|
+
return client.get(variantPath(campaignId, variantId));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Update a variant's label, slot values, weight, or active status.
|
|
47
|
+
* Slot value updates are merged (existing preserved, new override).
|
|
48
|
+
*/
|
|
49
|
+
export async function updateVariant(client, campaignId, variantId, updates) {
|
|
50
|
+
return client.patch(variantPath(campaignId, variantId), updates);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Deactivate a variant (soft delete).
|
|
54
|
+
*/
|
|
55
|
+
export async function deleteVariant(client, campaignId, variantId) {
|
|
56
|
+
await client.delete(variantPath(campaignId, variantId));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* AI-generate multiple variants in a single call.
|
|
60
|
+
* Uses Claude Sonnet to produce N variants varying specified slots.
|
|
61
|
+
* ~$0.01, ~3s for 5 variants.
|
|
62
|
+
*/
|
|
63
|
+
export async function generateVariants(client, campaignId, config) {
|
|
64
|
+
if (config.count < 1 || config.count > 20) {
|
|
65
|
+
throw new KongoApiError('VALIDATION_ERROR', `Variant count must be 1-20, got ${config.count}`, 400);
|
|
66
|
+
}
|
|
67
|
+
if (config.vary.length === 0) {
|
|
68
|
+
throw new KongoApiError('VALIDATION_ERROR', 'At least one slot name must be specified in vary', 400);
|
|
69
|
+
}
|
|
70
|
+
return client.post(`${campaignVariantsPath(campaignId)}/generate`, config);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Regenerate specific slots of an existing variant using AI.
|
|
74
|
+
* Merged values are recompiled into HTML.
|
|
75
|
+
*/
|
|
76
|
+
export async function regenerateVariantSlots(client, campaignId, variantId, config) {
|
|
77
|
+
if (config.slots.length === 0) {
|
|
78
|
+
throw new KongoApiError('VALIDATION_ERROR', 'At least one slot name must be specified', 400);
|
|
79
|
+
}
|
|
80
|
+
return client.post(`${variantPath(campaignId, variantId)}/regenerate`, config);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Set rotation strategy for a campaign.
|
|
84
|
+
* Convenience wrapper around updateCampaign — updates only rotationStrategy.
|
|
85
|
+
*/
|
|
86
|
+
export async function setRotation(client, campaignId, strategy) {
|
|
87
|
+
await client.put(`/engine/campaigns/${encodeURIComponent(campaignId)}`, { rotationStrategy: strategy });
|
|
88
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kongo Webhooks — Signature verification and event routing.
|
|
3
|
+
*
|
|
4
|
+
* Kongo sends webhooks for page.completed and page.failed events
|
|
5
|
+
* via the callbackUrl specified on page creation.
|
|
6
|
+
*
|
|
7
|
+
* Signature format: X-Kongo-Signature: t=timestamp,v1=signature
|
|
8
|
+
* Verification: HMAC-SHA256 of "timestamp.body" with webhook signing secret.
|
|
9
|
+
*
|
|
10
|
+
* PRD Reference: PRD-kongo-integration.md §4.3, §11
|
|
11
|
+
*/
|
|
12
|
+
import type { WebhookPayload, WebhookEventType } from './types.js';
|
|
13
|
+
export interface WebhookVerificationResult {
|
|
14
|
+
readonly valid: boolean;
|
|
15
|
+
readonly reason?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Verify a Kongo webhook signature.
|
|
19
|
+
*
|
|
20
|
+
* Uses timing-safe comparison to prevent timing attacks.
|
|
21
|
+
* Rejects replayed webhooks older than 5 minutes.
|
|
22
|
+
*
|
|
23
|
+
* @param rawBody - The raw request body as a string (must not be parsed)
|
|
24
|
+
* @param signature - The X-Kongo-Signature header value
|
|
25
|
+
* @param secret - The webhook signing secret from vault
|
|
26
|
+
*/
|
|
27
|
+
export declare function verifyWebhookSignature(rawBody: string, signature: string, secret: string): WebhookVerificationResult;
|
|
28
|
+
/**
|
|
29
|
+
* Parse a verified webhook body into a typed payload.
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseWebhookPayload(rawBody: string): WebhookPayload;
|
|
32
|
+
export type WebhookHandler = (payload: WebhookPayload) => Promise<void>;
|
|
33
|
+
export interface WebhookRouter {
|
|
34
|
+
readonly handlers: Map<WebhookEventType, WebhookHandler>;
|
|
35
|
+
on(event: WebhookEventType, handler: WebhookHandler): void;
|
|
36
|
+
handle(rawBody: string, signature: string, secret: string): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Create a webhook router that verifies signatures and routes events to handlers.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createWebhookRouter(): WebhookRouter;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kongo Webhooks — Signature verification and event routing.
|
|
3
|
+
*
|
|
4
|
+
* Kongo sends webhooks for page.completed and page.failed events
|
|
5
|
+
* via the callbackUrl specified on page creation.
|
|
6
|
+
*
|
|
7
|
+
* Signature format: X-Kongo-Signature: t=timestamp,v1=signature
|
|
8
|
+
* Verification: HMAC-SHA256 of "timestamp.body" with webhook signing secret.
|
|
9
|
+
*
|
|
10
|
+
* PRD Reference: PRD-kongo-integration.md §4.3, §11
|
|
11
|
+
*/
|
|
12
|
+
import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
13
|
+
// ── Signature Verification ───────────────────────────────
|
|
14
|
+
// Maximum age for webhook timestamp (5 minutes)
|
|
15
|
+
const MAX_WEBHOOK_AGE_MS = 5 * 60 * 1000;
|
|
16
|
+
// Maximum webhook body size (1 MB — defense in depth, HTTP layer should also limit)
|
|
17
|
+
const MAX_WEBHOOK_BODY_BYTES = 1 * 1024 * 1024;
|
|
18
|
+
/**
|
|
19
|
+
* Verify a Kongo webhook signature.
|
|
20
|
+
*
|
|
21
|
+
* Uses timing-safe comparison to prevent timing attacks.
|
|
22
|
+
* Rejects replayed webhooks older than 5 minutes.
|
|
23
|
+
*
|
|
24
|
+
* @param rawBody - The raw request body as a string (must not be parsed)
|
|
25
|
+
* @param signature - The X-Kongo-Signature header value
|
|
26
|
+
* @param secret - The webhook signing secret from vault
|
|
27
|
+
*/
|
|
28
|
+
export function verifyWebhookSignature(rawBody, signature, secret) {
|
|
29
|
+
if (!signature || !rawBody || !secret) {
|
|
30
|
+
return { valid: false, reason: 'Missing signature, body, or secret' };
|
|
31
|
+
}
|
|
32
|
+
if (Buffer.byteLength(rawBody) > MAX_WEBHOOK_BODY_BYTES) {
|
|
33
|
+
return { valid: false, reason: 'Webhook body too large' };
|
|
34
|
+
}
|
|
35
|
+
// Parse signature: t=timestamp,v1=hash
|
|
36
|
+
const parts = signature.split(',');
|
|
37
|
+
if (parts.length !== 2) {
|
|
38
|
+
return { valid: false, reason: 'Invalid signature format' };
|
|
39
|
+
}
|
|
40
|
+
const tPart = parts[0];
|
|
41
|
+
const vPart = parts[1];
|
|
42
|
+
if (!tPart.startsWith('t=') || !vPart.startsWith('v1=')) {
|
|
43
|
+
return { valid: false, reason: 'Invalid signature format: missing t= or v1= prefix' };
|
|
44
|
+
}
|
|
45
|
+
const timestamp = tPart.slice(2);
|
|
46
|
+
const providedHash = vPart.slice(3);
|
|
47
|
+
// Check timestamp freshness
|
|
48
|
+
const timestampMs = parseInt(timestamp, 10) * 1000;
|
|
49
|
+
if (isNaN(timestampMs)) {
|
|
50
|
+
return { valid: false, reason: 'Invalid timestamp' };
|
|
51
|
+
}
|
|
52
|
+
const age = Date.now() - timestampMs;
|
|
53
|
+
if (age < -60_000) {
|
|
54
|
+
return { valid: false, reason: 'Webhook timestamp is in the future' };
|
|
55
|
+
}
|
|
56
|
+
if (age > MAX_WEBHOOK_AGE_MS) {
|
|
57
|
+
return { valid: false, reason: `Webhook too old: ${Math.round(age / 1000)}s (max ${MAX_WEBHOOK_AGE_MS / 1000}s)` };
|
|
58
|
+
}
|
|
59
|
+
// Compute expected signature
|
|
60
|
+
const payload = `${timestamp}.${rawBody}`;
|
|
61
|
+
const expectedHash = createHmac('sha256', secret)
|
|
62
|
+
.update(payload)
|
|
63
|
+
.digest('hex');
|
|
64
|
+
// Timing-safe comparison
|
|
65
|
+
const providedBuf = Buffer.from(providedHash, 'hex');
|
|
66
|
+
const expectedBuf = Buffer.from(expectedHash, 'hex');
|
|
67
|
+
if (providedBuf.length !== expectedBuf.length) {
|
|
68
|
+
return { valid: false, reason: 'Signature length mismatch' };
|
|
69
|
+
}
|
|
70
|
+
const valid = timingSafeEqual(providedBuf, expectedBuf);
|
|
71
|
+
return valid ? { valid: true } : { valid: false, reason: 'Signature mismatch' };
|
|
72
|
+
}
|
|
73
|
+
// ── Event Parsing ────────────────────────────────────────
|
|
74
|
+
/**
|
|
75
|
+
* Parse a verified webhook body into a typed payload.
|
|
76
|
+
*/
|
|
77
|
+
export function parseWebhookPayload(rawBody) {
|
|
78
|
+
const parsed = JSON.parse(rawBody);
|
|
79
|
+
if (!parsed.event || !parsed.pageId || !parsed.data) {
|
|
80
|
+
throw new Error('Invalid webhook payload: missing event, pageId, or data');
|
|
81
|
+
}
|
|
82
|
+
const validEvents = ['page.completed', 'page.failed'];
|
|
83
|
+
if (!validEvents.includes(parsed.event)) {
|
|
84
|
+
throw new Error(`Unknown webhook event type: ${parsed.event}`);
|
|
85
|
+
}
|
|
86
|
+
return parsed;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Create a webhook router that verifies signatures and routes events to handlers.
|
|
90
|
+
*/
|
|
91
|
+
export function createWebhookRouter() {
|
|
92
|
+
const handlers = new Map();
|
|
93
|
+
return {
|
|
94
|
+
handlers,
|
|
95
|
+
on(event, handler) {
|
|
96
|
+
handlers.set(event, handler);
|
|
97
|
+
},
|
|
98
|
+
async handle(rawBody, signature, secret) {
|
|
99
|
+
const verification = verifyWebhookSignature(rawBody, signature, secret);
|
|
100
|
+
if (!verification.valid) {
|
|
101
|
+
throw new Error(`Webhook verification failed: ${verification.reason}`);
|
|
102
|
+
}
|
|
103
|
+
const payload = parseWebhookPayload(rawBody);
|
|
104
|
+
const handler = handlers.get(payload.event);
|
|
105
|
+
if (!handler) {
|
|
106
|
+
// Log but don't throw — unknown event types should be ignored gracefully
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
await handler(payload);
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .voidforge marker file — project identity and CLI detection.
|
|
3
|
+
*
|
|
4
|
+
* Every VoidForge project has a `.voidforge` JSON file at root.
|
|
5
|
+
* The CLI walks up from cwd to find it, determining the project root.
|
|
6
|
+
*/
|
|
7
|
+
export interface VoidForgeMarker {
|
|
8
|
+
id: string;
|
|
9
|
+
version: string;
|
|
10
|
+
created: string;
|
|
11
|
+
tier: 'full' | 'methodology';
|
|
12
|
+
extensions: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare const MARKER_FILE = ".voidforge";
|
|
15
|
+
export declare function readMarker(dir: string): Promise<VoidForgeMarker | null>;
|
|
16
|
+
export declare function writeMarker(dir: string, marker: VoidForgeMarker): Promise<void>;
|
|
17
|
+
export declare function createMarker(version: string, tier?: VoidForgeMarker['tier'], extensions?: string[]): VoidForgeMarker;
|
|
18
|
+
/**
|
|
19
|
+
* Walk up from `startDir` to find the nearest `.voidforge` marker.
|
|
20
|
+
* Returns the directory containing the marker, or null if none found.
|
|
21
|
+
*/
|
|
22
|
+
export declare function findProjectRoot(startDir?: string): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Like findProjectRoot but throws with a user-friendly message.
|
|
25
|
+
*/
|
|
26
|
+
export declare function requireProjectRoot(startDir?: string): string;
|
|
27
|
+
export declare function getGlobalDir(): string;
|
|
28
|
+
export declare function getVaultPath(): string;
|