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
fix(ops): stop the ops boards draining the login rate-limit bucket and reporting ok while blind
nirholas2e364658eb3d
diff --git a/api/ops/health.js b/api/ops/health.jsindex b4e36c8bc..52fa6e66d 100644--- a/api/ops/health.js+++ b/api/ops/health.js@@ -1,8 +1,11 @@// GET /api/ops/health — comprehensive internal platform health check.//// Returns live probe results for every critical subsystem + cron heartbeats-// from Redis. Requires x-ops-secret header (OPS_SECRET env var). If the env-// var is unset, falls back to CRON_SECRET so ops pages work without extra setup.+// from Redis. Auth is authorizeOps (api/_lib/ops-auth.js): an admin session, or+// x-ops-secret / Authorization Bearer matching OPS_SECRET. It is deliberately+// never CRON_SECRET, the credential the crons that move real funds carry, so a+// leaked ops password cannot be escalated into triggering a payment job. With no+// OPS_SECRET configured the gate is open off-production and denies in production.import { readFileSync } from 'node:fs';import { CronExpressionParser } from 'cron-parser';@@ -179,7 +182,11 @@ export default wrap(async (req, res) => {// GET (RFC 9110) and sends the Allow header a bare 405 was missing.if (!method(req, res, ['GET'])) return;- const rl = await limits.authIp(clientIp(req));+ // `authedReadIp` (300/5m), not the strict `authIp` credential bucket. This is a+ // polled read board, and every poll used to spend the same 50/10m budget that+ // gates logins from that IP, so watching the dashboard could 429 an operator's+ // sign-in. Same reason `authedReadIp` was split out for authed reads at large.+ const rl = await limits.authedReadIp(clientIp(req));if (!rl.success) return rateLimited(res, rl);// Hardened ops gate: admin session or a dedicateddiff --git a/api/ops/payment-outcomes.js b/api/ops/payment-outcomes.jsindex 3c9b50340..763b7f8f2 100644--- a/api/ops/payment-outcomes.js+++ b/api/ops/payment-outcomes.js@@ -15,11 +15,17 @@// over a stated window) and the runway in days that implies,// including the threshold the scheduled monitor alerts on.//+// The panels are read independently and a failed one does not blank the others.+// `ok` says whether all three rendered (never whether payments are healthy, which+// is a per-panel verdict); the ones that failed are named in `degraded` and the+// response is 207 Multi-Status, matching /api/ops/health.+//// Auth: authorizeOps (admin session, or x-ops-secret / OPS_SECRET): the same// gate as /api/ops/health, so ops tooling reuses one stored secret.// Read-only; moves no funds; reads balances via RPC only.-import { cors, json, method, wrap, error } from '../_lib/http.js';+import { cors, json, method, wrap, error, rateLimited } from '../_lib/http.js';+import { limits, clientIp } from '../_lib/rate-limit.js';import { sql } from '../_lib/db.js';import { authorizeOps } from '../_lib/ops-auth.js';import { gatherX402SettleHealth } from '../_lib/ops/x402-settle-health.js';@@ -162,6 +168,16 @@ async function sponsorBoard() {export default wrap(async (req, res) => {if (cors(req, res, { methods: 'GET,OPTIONS' })) return;if (!method(req, res, ['GET'])) return;++ // Every request here runs a session lookup before the gate can answer, then+ // three aggregate queries and a live RPC balance read, so an unauthorized+ // flood is expensive. `authedReadIp` (300/5m), not the strict `authIp`+ // credential bucket: an ops board is polled, and draining the login budget of+ // the office IP that watches it is exactly the cross-contamination that bucket+ // was split out to end.+ const rl = await limits.authedReadIp(clientIp(req));+ if (!rl.success) return rateLimited(res, rl);+const auth = await authorizeOps(req);if (!auth.ok) return error(res, 401, 'unauthorized', 'ops secret or admin session required');@@ -174,11 +190,23 @@ export default wrap(async (req, res) => {]);const unwrap = (r) => (r.status === 'fulfilled' ? r.value : { error: r.reason?.message || 'unavailable' });- return json(res, 200, {- ok: true,- generated_at: new Date().toISOString(),+ const panels = {inbound: unwrap(inbound),ring_settle: unwrap(ringSettle),sponsor: unwrap(sponsor),+ };+ // `ok` reports whether the BOARD rendered, not whether payments are healthy+ // (that verdict is per panel). It used to be the literal `true`, so a read+ // where all three panels threw still answered 200 ok:true with three error+ // objects in the body: a monitoring surface that reports success while it is+ // blind. A failed panel now names itself in `degraded` and the response is+ // 207 Multi-Status, the same convention /api/ops/health uses.+ const degraded = Object.keys(panels).filter((k) => panels[k]?.error);++ return json(res, degraded.length ? 207 : 200, {+ ok: degraded.length === 0,+ degraded,+ generated_at: new Date().toISOString(),+ ...panels,}, { 'cache-control': 'no-store' });});