Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(news): add crypto news API, article reader, and news archive functionality
fudjiab2e01bfd8ca2
diff --git a/STRUCTURE.md b/STRUCTURE.mdindex 277c91311..eab61a273 100644--- a/STRUCTURE.md+++ b/STRUCTURE.md@@ -78,6 +78,7 @@ bottom.| Global markets + coin detail pages | [pages/coins.html](pages/coins.html) + [src/coins-index.js](src/coins-index.js) `→ /coins`, [pages/coin.html](pages/coin.html) + [src/coin-page.js](src/coin-page.js) `→ /coin/:id`, backend [api/coin/](api/coin) (detail, ohlc, markets, news, global over [api/_lib/coingecko.js](api/_lib/coingecko.js)) | In-repo | CoinGecko-style markets index (global stats bar, sortable top-coins table, search, sparklines) + a rich detail page per coin (interactive chart, stats grid, related news, links). Design adopted from cryptocurrency.cv; accepts CoinGecko slugs or Solana mints. Docs: [docs/coin-pages.md](docs/coin-pages.md) || Market tools (heatmap, sentiment, gas, compare) | [pages/heatmap.html](pages/heatmap.html) + [src/heatmap.js](src/heatmap.js) `→ /heatmap`, [pages/fear-greed.html](pages/fear-greed.html) + [src/fear-greed.js](src/fear-greed.js) `→ /fear-greed`, [pages/gas.html](pages/gas.html) + [src/gas.js](src/gas.js) `→ /gas`, [pages/compare.html](pages/compare.html) + [src/compare.js](src/compare.js) `→ /compare`; backend [api/coin/fear-greed.js](api/coin/fear-greed.js), [api/coin/gas.js](api/coin/gas.js) | In-repo | Four tools extending Markets, same design system: treemap heatmap (market-cap-sized tiles), Fear & Greed gauge + history, live Ethereum gas tracker (keyless `eth_feeHistory`), and up-to-4-coin compare (overlay perf + stats). All real key-free data; cross-linked from the markets table. Docs: [docs/coin-pages.md](docs/coin-pages.md) || Market tools II (screener, categories, exchanges, derivatives, converter, DeFi, chains, stablecoins) | Pages+JS `→ /screener /categories /exchanges /derivatives /converter /defi /chains /stablecoins`; backend [api/coin/](api/coin) (categories, exchanges, derivatives, rates) over CoinGecko + [api/defi/](api/defi) (protocols, chains, stablecoins) over DeFiLlama | In-repo | Eight more Markets tools, same design system: token screener + category rankings + exchange/derivatives tables + crypto⇄fiat converter (CoinGecko), plus a DeFiLlama trio — DeFi TVL by protocol, chains by TVL, stablecoins with peg health. All real key-free data; cross-linked from the markets table. Docs: [docs/coin-pages.md](docs/coin-pages.md) |+| Crypto news + archive + markets hub | [pages/markets.html](pages/markets.html) + [src/markets-page.js](src/markets-page.js) `→ /markets`, [pages/markets-news.html](pages/markets-news.html) + [src/markets-news.js](src/markets-news.js) `→ /markets/news`, [pages/news-article.html](pages/news-article.html) + [src/news-article.js](src/news-article.js) `→ /markets/news/article`, [pages/news-archive.html](pages/news-archive.html) + [src/news-archive.js](src/news-archive.js) `→ /markets/archive`; backend [api/news/](api/news) (feed, article, archive) over [api/_lib/news.js](api/_lib/news.js) + [api/_lib/news-sources.js](api/_lib/news-sources.js), corpus on `gs://three-ws-news-archive` | In-repo | The Markets news wing + front door: live news aggregated natively from 37 publisher feeds (category tabs, search, sentiment, ticker chips), a rich article reader (server-side extraction, AI summary/key points with extractive fallback, related coverage), the largest open crypto-news archive (662,047 enriched articles, Sept 2017 → today, EN+中文, GCS-hosted), and the /markets hub aggregating global stats, the top-100 table, breaking news, and every market surface as a hero card. Docs: [docs/coin-pages.md](docs/coin-pages.md), [docs/api-reference.md](docs/api-reference.md) || Liquidations pulse (/coins) | Collector [services/liquidation-collector/](services/liquidation-collector) (standalone always-on Node service, ported from SperaxOS), proxy [api/coin/liquidations.js](api/coin/liquidations.js) `→ GET /api/coin/liquidations`, UI strip in [src/coins-index.js](src/coins-index.js) `→ /coins` | In-repo · collector needs an always-on host | Real-time long/short liquidation pain across Binance, Bybit, and OKX public futures WebSocket streams: dominant-side badge (LONG PAIN / SHORT SQUEEZE / BALANCED), 1h long-vs-short bars, and the 3 largest recent liquidations, polled every 30s (pauses on hidden tab). The collector holds long-lived WebSockets so it can't run as a Vercel function — deploy it separately and point `LIQUIDATION_COLLECTOR_URL` at it. No fallback data: the proxy 503s `collector_offline` (never fabricated numbers) when unset or unreachable, and the strip degrades to a quiet single-line offline state. Docs: [docs/api-reference.md#liquidations](docs/api-reference.md#liquidations) || BNB Chain campaign hub | [pages/bnb.html](pages/bnb.html) + [src/bnb.js](src/bnb.js) `→ /bnb`, pure helpers [src/bnb-hub-helpers.js](src/bnb-hub-helpers.js), live block-time API [api/bnb/block-time.js](api/bnb/block-time.js) over [api/_lib/bnb/chains.js](api/_lib/bnb/chains.js) `probeBlockTime` | In-repo · hub live, tracks rolling out | The campaign's front door: three feature cards (gasless agent onboarding, on-chain-gated 3D vault, real-time on-chain world), each claim traced to `prompts/bnb-chain/00-CONTEXT.md`'s verified facts (0.45s blocks — never 20k TPS or 250ms finality). Embeds a live block-time widget (real RPC measurement on every load). Each card self-detects liveness via a real HTTP probe against its track's route/API on the running deployment — a 404 renders a designed "coming soon" state, never a dead link — so cards auto-light-up as the sibling tracks below ship: gasless registration `→ /create-agent` + `api/bnb/register-agent.js` (prompt 03), vault `→ /vault` (prompt 12), on-chain world `→ /bnb-latency` (prompt 17) + the Explore on-chain toggle (prompt 16). Campaign root: [prompts/bnb-chain/](prompts/bnb-chain) || BABT holder check (BNB Chain) | Lib [api/_lib/bnb/babt.js](api/_lib/bnb/babt.js) `hasBabt()`, free API [api/bnb/babt-check.js](api/bnb/babt-check.js) `→ GET /api/bnb/babt-check?address=` | In-repo · shipped | Free, rate-limited on-chain check for whether a BSC address holds a Binance Account Bound Token (BABT) — a real, live, KYC-backed soulbound token (1.16M+ mainnet holders, verified via `eth_getCode`/`balanceOf` against the real contract `0x2B09d47D...5215D7c8`). Verification writeup + honest comparison vs. Gitcoin Passport/World ID/Coinbase attestations: [docs/bnb-babt-findings.md](docs/bnb-babt-findings.md). Spike prompt: `prompts/bnb-chain/20-babt-verification-spike.md`. |diff --git a/api/news/feed.js b/api/news/feed.jsindex 7e74a10b2..565848d33 100644--- a/api/news/feed.js+++ b/api/news/feed.js@@ -16,8 +16,7 @@// Aggregation results are cached per source for 5 minutes inside// api/_lib/news.js, so this endpoint is cheap under load; CDN caches 120s.-import { cors, json, method, wrap } from '../_lib/http.js';-import { rateLimited } from '../_lib/http.js';+import { cors, json, method, wrap, rateLimited } from '../_lib/http.js';import { limits, clientIp } from '../_lib/rate-limit.js';import { getNews } from '../_lib/news.js';import { NEWS_SOURCES, NEWS_CATEGORIES } from '../_lib/news-sources.js';diff --git a/docs/api-reference.md b/docs/api-reference.mdindex 2bfe284dc..8fddb7e12 100644--- a/docs/api-reference.md+++ b/docs/api-reference.md@@ -2460,9 +2460,74 @@ GET /api/coin/news?q=<coin name>&limit=8```Returns `{ "articles": [{ title, link, description, image, source,-published_at }], "source": "cryptocurrency.cv" | "rss" }`. Primary upstream is-the cryptocurrency.cv aggregator; on failure it reads the same first-party RSS-feeds directly (`source: "rss"`).+published_at }], "source": "three.ws" }`. Served by the native three.ws+aggregator (`api/_lib/news.js` — 37 publisher feeds, per-source 5-minute cache+with serve-stale-on-error).++---++## Crypto News API++The engine behind [/markets/news](https://three.ws/markets/news) and+[/markets/archive](https://three.ws/markets/archive). Free, key-less, CORS `*`.++### Live feed++```+GET /api/news/feed?category=defi&q=etf&source=coindesk&limit=30&offset=0&meta=1+```++Aggregates 37 publisher RSS/Atom feeds natively (registry:+`api/_lib/news-sources.js`). All params optional: `category` (one of the 15+canonical categories — `general`, `bitcoin`, `ethereum`, `layer2`, `solana`,+`defi`, `nft`, `trading`, `research`, `onchain`, `institutional`,+`mainstream`, `asia`, `regulation`, `journalism`), `source` (a single source+key, overrides `category`), `q` (full-text over title/description/tickers),+`limit` ≤ 50, `offset`. Returns+`{ articles: [{ id, title, link, description, image, author, source,+source_key, category, pub_date, tickers[], sentiment: { score, label,+confidence } }], total, sources_ok, sources_total, fetched_at }`; with+`meta=1` it also returns `categories[]` and the `sources[]` registry. Each+source is cached server-side for 5 minutes and served stale (up to 24 h) if+its publisher goes down. CDN cache 120 s.++### Historical archive — 662,047 articles since 2017++```+GET /api/news/archive?q=bitcoin+etf&ticker=BTC&source=odaily&sentiment=positive&lang=zh&start_date=2024-01-01&end_date=2024-01-31&limit=50&offset=0+GET /api/news/archive?stats=true # corpus statistics + month range+GET /api/news/archive?months=true # queryable months+GET /api/news/archive?trending=true # top tickers over the newest archived weeks+```++Queries the platform-hosted corpus (`gs://three-ws-news-archive`: monthly+JSONL, gzip at rest — the CryptoPanic english corpus + the Odaily chinese+corpus + the cryptocurrency.cv live archiver, September 2017 → today). Records+are enriched: `tickers[]`, `tags[]`, `sentiment`, `lang` (`en`/`zh`),+`is_breaking`, and `market_context` (BTC/ETH price + Fear & Greed at+publication) where captured. Query mode scans months **newest → oldest** with+early stop (≤ 12 months per request) and reports coverage honestly:+`{ articles[], total_scanned_matches, has_more, scanned: { months[], from,+to, complete, months_remaining }, hint? }` — pass `start_date`/`end_date` to+reach older years. `sentiment` ∈ `positive|negative|neutral`; `limit` ≤ 100.+CDN cache 300 s (queries) / 3600 s (stats, months, trending).++### Article reader++```+GET /api/news/article?url=<article url>&title=&source=+```++Server-side extraction with SSRF + DNS-rebinding protection. Returns+`{ url, title, source, image, author, published_at, description, extraction,+paragraphs[], content_chars, tickers[], summary, key_points[], sentiment+("bullish"|"bearish"|"neutral"), analysis_provider, related[], fetched_at }`.+`extraction` tells you where the text came from: `"page"` (publisher page),+`"feed"` (the publisher's own `content:encoded` feed body — used when the+page blocks server fetches), or `"preview"` (metadata only; `blocked_reason`+set). `analysis_provider` is `groq`/`openrouter` when the platform LLM chain+is configured, else `heuristic` (extractive summary + lexicon sentiment —+always available). Cached 30 min per URL.---diff --git a/docs/coin-pages.md b/docs/coin-pages.mdindex 174657a4f..6afaf7960 100644--- a/docs/coin-pages.md+++ b/docs/coin-pages.md@@ -218,6 +218,12 @@ text before they reach the client.| Exchanges / Derivatives | `pages/exchanges.html`, `pages/derivatives.html` (+ `src/*.js`, `src/*.css`) || Converter | `pages/converter.html` + `src/converter.js` + `src/converter.css` || DeFi / Chains / Stablecoins | `pages/{defi,chains,stablecoins}.html` (+ `src/*.js`, `src/*.css`), APIs in [`api/defi/`](../api/defi) |+| Markets hub | [`pages/markets.html`](../pages/markets.html) + [`src/markets-page.js`](../src/markets-page.js) |+| Crypto news | [`pages/markets-news.html`](../pages/markets-news.html) + [`src/markets-news.js`](../src/markets-news.js) |+| Article reader | [`pages/news-article.html`](../pages/news-article.html) + [`src/news-article.js`](../src/news-article.js) |+| News archive | [`pages/news-archive.html`](../pages/news-archive.html) + [`src/news-archive.js`](../src/news-archive.js) |+| News engine + sources | [`api/_lib/news.js`](../api/_lib/news.js) + [`api/_lib/news-sources.js`](../api/_lib/news-sources.js), endpoints in [`api/news/`](../api/news) |+| Shared news renderers | [`src/shared/news-render.js`](../src/shared/news-render.js); table primitives in [`src/shared/market-table.js`](../src/shared/market-table.js) || Shared design system | [`src/coin-pages.css`](../src/coin-pages.css) (Source Serif 4 self-hosted in `public/fonts/`) || Shared formatters | [`src/shared/coin-format.js`](../src/shared/coin-format.js) — unit-tested in [`tests/coin-format.test.js`](../tests/coin-format.test.js) || API proxies | [`api/coin/`](../api/coin) — `detail.js`, `ohlc.js`, `markets.js`, `global.js`, `fear-greed.js`, `gas.js`, `news.js`, `liquidations.js` |