mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-11-29 15:51:52 +00:00
- next 16.3.8 -> 16.4.3 (GHSA-2464-fhr4-w9xw, GHSA-673q-mjm6-r5xr) - every workspace dependency to latest; majors: express 5, @simplewebauthn 14, imapflow 2 (status() may return false), nodemailer 10, libsodium-wrappers 0.8, commander 15, vite 8, @vitejs/plugin-react 6, typescript 7 (base tsconfig lists types: ["node"]), @logicsrc/validators 0.6, openmcp 0.4, hqtui 0.11, stack 0.5, x402-gateway 0.13 - bun 1.4.4 (image + packageManager) - bun audit: 3 critical / 34 high -> 0 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| src | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
@logicsrc/agentad
Reference implementation of the AgentAd Marketplace (AgentBBS milestone M5),
built on the AgentAd primitive family in @logicsrc/schemas.
- Standard:
docs/agentad.md - Product spec / PRD:
docs/agentad-marketplace.md
It provides a two-sided exchange over the canonical schemas:
match → auction (second price) → pace (budget) → serve → meter → settle
Every served unit is disclosed (disclosure.sponsored: true) and carries a
machine_readable payload for agent consumers. Metering is token-driven: serving
mints a single-use, HMAC-signed impression_token; confirming the impression mints
a click_token. Settlement is pluggable — InMemorySettlement here, CoinPay in
production.
Usage
import {
AgentAdExchange,
createAd,
createCampaign,
createPlacement,
createAdRequest,
InMemorySettlement
} from "@logicsrc/agentad";
const exchange = new AgentAdExchange({
secret: process.env.AGENTAD_SECRET!,
settlement: new InMemorySettlement({ networkFeeRate: 0.15 })
});
// Advertiser side
exchange.registerCampaign(
createCampaign({
advertiser_did: "railway.app",
name: "CLI launch",
status: "active",
budget: { total: 100, currency: "USD" }
})
);
exchange.registerAd(
createAd({
advertiser_did: "railway.app",
campaign_id: /* campaign.id */ "cmp-...",
format: "json",
title: "Ship your CLI to production in 60s",
url: "https://railway.app/?ref=cl1s",
pricing: { model: "cpc", bid: 0.5, currency: "USD" },
machine_readable: { product: "railway", install: "npm i -g @railway/cli" }
})
);
// Publisher side
const placement = exchange.registerPlacement(
createPlacement({
publisher_did: "agentbbs.sh",
surface: "agent",
accepted_formats: ["json"],
frequency_cap: { max_per_session: 1 }
})
);
// Serve → meter
const res = exchange.requestAds(
createAdRequest({ placement_id: placement.id, consumer: "agent" })
);
const { impression_token } = res.ads[0];
const { click_token } = exchange.confirmImpression(impression_token);
exchange.confirmClick(click_token, { action: "open_url" });
exchange.earnings("agentbbs.sh"); // publisher payout, net of network fee
Scripts
npm --workspace @logicsrc/agentad run build
npm --workspace @logicsrc/agentad run test