Skip to content

feat: ad exchange — sponsored slots, live revenue, advertiser portal - #105

Merged
distroinfinity merged 35 commits into
mainfrom
ad-exchange
Sep 19, 2026
Merged

distroinfinity merged 35 commits into
mainfrom
ad-exchange

Conversation

@distroinfinity

Copy link
Copy Markdown
Owner

Turns Distro TV into an ad exchange for AI agent surfaces. The terminal is the first surface.

What ships

  • Ads in the terminal: sponsored slots in the Claude Code status line while the agent works; they clear on the first keystroke. The click URL is printed in full so the terminal makes it cmd/ctrl-clickable — no key capture.
  • Supply: advertiser-written ads served highest bid first → Carbon (opt-in in production) → house ads (own promos only in production).
  • Accounting: every served ad is a row in ad_impressions (the delivery record). A view pays only if it was on screen ≥ 1s and not skipped; replays never double-pay; other users' deliveries are rejected. Click redirects (/c/:code, /ads/click/:id) take their target only from the server-side row.
  • Revenue dashboard: live balance, per-agent-hour rate, 1h / 24h / 30d chart, recent ads. "Payouts — coming soon". All money is labelled estimated; the split and rates are never shown.
  • Advertiser portal (/advertisers/portal): write an ad, set a bid, watch views and clicks, pause. Google Ads / Meta Ads / Amazon Ads import tiles are "coming soon".
  • Channels are opt-in: news and markets rotate in only when enabled (enabled_feeds, default {ads}).
  • Site: four-section landing page with an interactive terminal demo; reworked /advertisers.
  • CLI 0.3.0: sponsored panel, ledger + seconds-fast sync, feeds preference, ads-first init, preview of the real panel. uninstall no longer restores a stale settings backup.

Production guards

  • Sponsored slots go only to clients that declare CLI ≥ 0.3.0 (?v=), so older installs never receive something they cannot draw.
  • Submitted ads start in review unless the author is in ADMIN_EMAILS (or AD_AUTO_APPROVE is on). Review via GET /admin/ads and PATCH /admin/ads/:id.
  • Carbon's sandbox zone does not serve in production unless CARBON_ZONE_KEY or CARBON_ENABLED=1 is set.
  • Live dashboard pages stay inside the rate limits (one overview request; per-user 240/min, per-IP 600/min).

Database

Four additive migrations (0023–0026): ad_impressions, ad_campaigns, preferences.enabled_feeds, beacon + seen_at columns. No drops.

Verification

  • shared 6, api 91, cli 174 unit tests; lint + typecheck clean.
  • 67-check end-to-end run against a live stack: auth, feed mixing, the pay rule checked in the database, cross-user protection, click redirects (incl. junk / open-redirect attempts), earnings vs database sums, advertiser CRUD, bid order, pause.
  • Production build compiles all routes.

Docs: gitbook-docs/architecture/ads.md, docs/demo-script.md.

@vercel

vercel Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devdrip Ready Ready Preview Sep 19, 2026 8:35pm UTC

@gitguardian

gitguardian Bot commented Sep 19, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
37457466 Triggered Generic High Entropy Secret 64dd67d packages/api/src/tests/ad-impression.test.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@distroinfinity
distroinfinity merged commit 7cc426c into main Sep 19, 2026
4 of 5 checks passed
distroinfinity added a commit that referenced this pull request Sep 19, 2026
…105)

Sponsored slots in the terminal served by bid, viewability-based accounting, tracked clicks, a live revenue dashboard, an advertiser portal, opt-in channels, the repositioned site, and CLI 0.3.0. Four additive migrations. Production guards: version-gated ads, admin ad review, own house ads, explicit carbon.

This branch was successfully deployed

1 active deployment
Preview — 318fe794 Deployed Sep 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant