Skip to content

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.

fix(copy): drop the em-dashes flagged across the alpha-drip files and export the fanout guards for tests

nirholas3ee5775d996f
diff --git a/api/_lib/alpha-drip-stats.js b/api/_lib/alpha-drip-stats.js
index f1fc23a4b..a4e249f77 100644
--- a/api/_lib/alpha-drip-stats.js
+++ b/api/_lib/alpha-drip-stats.js
@@ -1,5 +1,5 @@
/**
- * How fast a leader's edge actually decays — measured, not assumed.
+ * How fast a leader's edge actually decays: measured, not assumed.
*
* Alpha-drip prices latency, so the only honest way to judge a ladder is against
* how long this leader's entry advantage survives in their own history. The
@@ -10,7 +10,7 @@
*
* Median, not mean, because one position held overnight would otherwise justify
* a delay nobody should be sold. Returns null rather than a guess when the
- * leader has too few profitable closes to measure — every caller treats a null
+ * leader has too few profitable closes to measure. Every caller treats a null
* half-life as "cannot judge" and says nothing instead of inventing a number.
*/
diff --git a/api/_lib/alpha-drip.js b/api/_lib/alpha-drip.js
index dfb3c5b88..321fc6116 100644
--- a/api/_lib/alpha-drip.js
+++ b/api/_lib/alpha-drip.js
@@ -1,5 +1,5 @@
/**
- * Alpha-drip — tiered release of a leader's OWN copy signal. PURE: no DB, no network.
+ * Alpha-drip: tiered release of a leader's OWN copy signal. PURE: no DB, no network.
*
* A leader's edge decays in seconds, so the thing worth selling is not only a
* share of the profit but the LATENCY: $THREE holders in higher tiers see the
@@ -11,7 +11,7 @@
*
* 1. A drip delays the REVEAL, never the RECORD. The intent row is written in
* full at fanout time and the leader's public track record is untouched, so
- * there are no hidden trades — only delayed ones. Nothing here can express
+ * there are no hidden trades, only delayed ones. Nothing here can express
* "do not disclose".
* 2. Delay never increases with tier. A higher-tier holder can never wait longer
* than a lower-tier one, so paying more can only ever help.
@@ -38,7 +38,7 @@ const num = (v) => (Number.isFinite(Number(v)) ? Number(v) : NaN);
/**
* Validate + normalize a leader's release schedule.
*
- * Accepts a sparse array — a leader prices the tiers they care about and the rest
+ * Accepts a sparse array: a leader prices the tiers they care about and the rest
* inherit. The result is sorted high→low tier level so `planRelease` can walk it
* once, and is guaranteed monotonic (rule 2 above).
*
@@ -74,7 +74,7 @@ export function normalizeDripConfig(raw = {}) {
entries.push({ tier, delay_sec: delay, max_copy_size_sol: cap });
}
- // High tier first — the order planRelease walks and the order a UI reads best.
+ // High tier first: the order planRelease walks and the order a UI reads best.
entries.sort((a, b) => LEVEL_BY_ID.get(b.tier) - LEVEL_BY_ID.get(a.tier));
// Rule 2: paying more can never buy a longer wait. Checked against the public
@@ -82,7 +82,7 @@ export function normalizeDripConfig(raw = {}) {
let prev = 0;
for (const e of entries) {
if (e.delay_sec < prev) {
- return { ok: false, error: `delay for "${e.tier}" is shorter than a higher tier's — a higher tier can never wait longer` };
+ return { ok: false, error: `delay for "${e.tier}" is shorter than a higher tier's. A higher tier can never wait longer` };
}
prev = e.delay_sec;
}
@@ -153,7 +153,7 @@ export function planReleaseForUsd(config, usdHeld) {
/**
* The disclosure shown to every copier before they subscribe. A leader may
* override the wording, but never the standing sentence that says what a drip is
- * and what it is not — that is appended regardless.
+ * and what it is not. That sentence is appended regardless.
*/
export function dripDisclosure(config) {
const standing =
@@ -179,7 +179,7 @@ export function describeSchedule(config) {
return `${parts.join(', ')}.`;
}
-/** "45s" / "2m 30s" — the one format every drip surface prints. */
+/** "45s" / "2m 30s": the one format every drip surface prints. */
export function formatDelay(sec) {
const s = Math.max(0, int(sec) || 0);
if (s < 60) return `${s}s`;
@@ -191,7 +191,7 @@ export function formatDelay(sec) {
/**
* Fairness check against how fast the leader's edge actually decays. When the
* longest wait outruns the edge's half-life, the slowest tier is being sold a
- * signal that is already spent — say so instead of shipping it quietly.
+ * signal that is already spent. Say so instead of shipping it quietly.
*
* @returns {{ fair: boolean, longest_delay_sec: number, warning: string|null }}
*/
@@ -222,7 +222,7 @@ export function maxDelaySec(config) {
* A leader with real size has finite capacity: if the earliest tier copies the
* full order, the fills the later tiers get are the ones the early tier already
* moved through. `max_copy_size_sol` is how a leader splits that, so it is
- * applied AFTER the copy engine has sized and gated the order, never before —
+ * applied AFTER the copy engine has sized and gated the order, never before:
* the copier's own caps still bind first.
*
* A cap that pushes an order under the copier's minimum is a skip, not a dust
@@ -252,7 +252,7 @@ export function applyCapacityCap(orderSol, capSol, minOrderSol = 0) {
/**
* Hide the tradeable content of an intent the copier's seat has not reached yet.
*
- * The row exists, the copier knows WHO traded and that something fired — what
+ * The row exists, the copier knows WHO traded and that something fired. What
* they do not get early is the coin and the size, which is the whole thing the
* ladder sells. Masking happens on the way OUT rather than in the query so the
* record stays complete in the database and the same row unmasks itself the
diff --git a/api/_lib/copy-drip-runtime.js b/api/_lib/copy-drip-runtime.js
index 5b5cd3513..7db3742fc 100644
--- a/api/_lib/copy-drip-runtime.js
+++ b/api/_lib/copy-drip-runtime.js
@@ -1,12 +1,12 @@
/**
- * Alpha-drip at fanout time — the DB-facing half of the tiered signal release.
+ * Alpha-drip at fanout time: the DB-facing half of the tiered signal release.
*
* `api/_lib/alpha-drip.js` decides WHAT seat a copier gets (pure, exhaustively
* tested). This module is what the copy-fanout cron actually calls: it loads the
* leaders' ladders, prices each copier against their live $THREE balance, and
* later releases the alerts it held back.
*
- * Cost discipline: a leader with the drip off costs nothing here — no config
+ * Cost discipline: a leader with the drip off costs nothing here: no config
* row, no balance read, no branch taken. Balance reads are memoized per wallet
* for the length of one tick, because a copier following three leaders should
* not be priced three times.
diff --git a/api/_lib/copy-eligibility.js b/api/_lib/copy-eligibility.js
index c9a13c201..f4089d309 100644
--- a/api/_lib/copy-eligibility.js
+++ b/api/_lib/copy-eligibility.js
@@ -1,10 +1,10 @@
/**
- * Copy-trading anti-gaming layer — who may be copied, and when copying stops.
+ * Copy-trading anti-gaming layer: who may be copied, and when copying stops.
*
* Copy-trading dies the moment a track record can be faked or a follower can be
* strapped to a runaway leader. Three defenses live here, all of them enforced
* before money is committed and all of them derived from real, closed, on-chain
- * round-trips (agent_sniper_positions) — never from a self-reported number:
+ * round-trips (agent_sniper_positions), never from a self-reported number:
*
* 1. SELF-COPY (wash trading). A user subscribing to an agent they own pays a
* performance fee to themselves, inflates that leader's public copier count,
@@ -12,8 +12,8 @@
* at subscribe time and skipped again in the fanout, so a row that predates
* this rule cannot keep firing.
* 2. SYBIL BAR on copyable status. A brand-new agent with no history could be
- * followed the minute it was created. A leader now needs a real record —
- * closed round-trips, elapsed time, and capital actually deployed — before
+ * followed the minute it was created. A leader now needs a real record:
+ * closed round-trips, elapsed time, and capital actually deployed, before
* anyone can attach money to it, so dust-trading a curve into existence
* buys nothing.
* 3. DRAWDOWN CIRCUIT BREAKER. A copier sets the peak-to-trough loss they are
@@ -70,7 +70,7 @@ const CRITERION_LABELS = {
/**
* Decide whether a leader's record clears the copyable bar. PURE.
*
- * @param {object} record { settled, span_hours, deployed_sol } — real closed-trade stats.
+ * @param {object} record { settled, span_hours, deployed_sol }, real closed-trade stats.
* @param {object} [bar] override thresholds (tests, future per-tier bars).
* @returns {{ eligible:boolean, unmet:Array<{criterion:string,need:number,have:number,label:string}>, met:object }}
*/
@@ -105,7 +105,7 @@ export function evaluateLeaderEligibility(record = {}, bar = LEADER_ELIGIBILITY)
*
* A null tolerance means the copier opted out of the breaker; a null drawdown
* means the leader has no measurable curve yet (no deployed capital), and an
- * unmeasurable leader is never auto-paused — the eligibility bar is what keeps
+ * unmeasurable leader is never auto-paused; the eligibility bar is what keeps
* a history-less leader from being copied in the first place.
*
* @returns {{ breached:boolean, drawdown_pct:number|null, limit_pct:number|null, detail?:string }}
@@ -121,7 +121,7 @@ export function evaluateDrawdownBreaker(sub = {}, leaderDrawdownPct = null) {
breached: true,
drawdown_pct: round2(dd),
limit_pct: limit,
- detail: `Leader drawdown ${round2(dd)}% reached your ${limit}% limit — copying paused.`,
+ detail: `Leader drawdown ${round2(dd)}% reached your ${limit}% limit. Copying paused.`,
};
}
@@ -146,7 +146,7 @@ export async function leaderCopyProfile(agentId, network = 'mainnet') {
}
/**
- * Fold closed round-trips into the copy profile. PURE — exported so the equity
+ * Fold closed round-trips into the copy profile. PURE, and exported so the equity
* curve walk is testable without a database.
*
* @param {Array<{realized_pnl_lamports:*, entry_quote_lamports:*, closed_at:*}>} rows
@@ -190,7 +190,7 @@ export function summarizeCopyProfile(rows = []) {
}
/**
- * Batch the drawdown percentage for a set of leaders in one query — the fanout
+ * Batch the drawdown percentage for a set of leaders in one query. The fanout
* cron checks every leader it is about to mirror, and a leader with a thousand
* copiers must not cost a thousand round-trips.
*
diff --git a/api/_lib/migrations/20260903235500_copy_alpha_drip.sql b/api/_lib/migrations/20260903235500_copy_alpha_drip.sql
index a9b6f7cdd..9b0a649ea 100644
--- a/api/_lib/migrations/20260903235500_copy_alpha_drip.sql
+++ b/api/_lib/migrations/20260903235500_copy_alpha_drip.sql
@@ -1,4 +1,4 @@
--- Migration: alpha-drip — tiered release of a leader's own copy signal.
+-- Migration: alpha-drip, the tiered release of a leader's own copy signal.
-- Apply: psql "$DATABASE_URL" -f api/_lib/migrations/20260903235500_copy_alpha_drip.sql
-- Idempotent.
--
diff --git a/api/_lib/migrations/20260903240000_copy_drawdown_breaker.sql b/api/_lib/migrations/20260903240000_copy_drawdown_breaker.sql
index bb3f007d2..ed23c8b7f 100644
--- a/api/_lib/migrations/20260903240000_copy_drawdown_breaker.sql
+++ b/api/_lib/migrations/20260903240000_copy_drawdown_breaker.sql
@@ -20,7 +20,7 @@
-- existing row had, so no backfill is needed and no live subscription changes.
--
-- paused_reason / paused_at also cover the future auto-pause cases (a leader who
--- goes quiet, a copier whose safety gate keeps rejecting) — any code path that
+-- goes quiet, a copier whose safety gate keeps rejecting): any code path that
-- pauses a subscription on the copier's behalf owes them the reason.
begin;
diff --git a/api/copy/alpha-drip.js b/api/copy/alpha-drip.js
index 95048651c..3dc16b2d3 100644
--- a/api/copy/alpha-drip.js
+++ b/api/copy/alpha-drip.js
@@ -1,9 +1,9 @@
/**
- * Alpha-drip configuration — a leader prices the latency of their own signal.
+ * Alpha-drip configuration: a leader prices the latency of their own signal.
*
* GET /api/copy/alpha-drip?leader_agent_id=<uuid>
* Public read. Returns the leader's release ladder, the standing
- * disclosure, and — for a signed-in caller — the seat THEY would get, so
+ * disclosure, and (for a signed-in caller) the seat THEY would get, so
* a copier sees their real wait before they subscribe rather than after.
*
* POST /api/copy/alpha-drip { leader_agent_id, enabled, schedule,
@@ -13,8 +13,8 @@
* POST /api/copy/alpha-drip { action: 'recommend', leader_agent_id,
* edge_halflife_sec }
* Asks the LLM chain for a ladder tuned to how fast this leader's edge
- * actually decays. It only ever RETURNS a draft — the leader still has to
- * save it — and the draft is validated through the same normalizer as a
+ * actually decays. It only ever RETURNS a draft (the leader still has to
+ * save it), and the draft is validated through the same normalizer as a
* hand-written one, so the model can never talk the ladder past a rule.
*
* The drip delays the reveal, never the record: the intent row is written in
@@ -35,7 +35,7 @@ import {
import { llmComplete, LlmUnavailableError } from '../_lib/llm.js';
import { leaderEdgeHalflifeSec } from '../_lib/alpha-drip-stats.js';
-const RECOMMEND_SYSTEM = `You decide how a LEADER's OWN trade signal is released across the leader's OWN subscriber tiers. You are gating the leader's self-produced signal as a subscription product. You are NOT accessing, delaying, or front-running anyone else's orders — only the leader's own.
+const RECOMMEND_SYSTEM = `You decide how a LEADER's OWN trade signal is released across the leader's OWN subscriber tiers. You are gating the leader's self-produced signal as a subscription product. You are NOT accessing, delaying, or front-running anyone else's orders, only the leader's own.
Reply with STRICT JSON and nothing else:
{
@@ -94,7 +94,7 @@ export default wrap(async (req, res) => {
const params = new URL(req.url, 'http://x').searchParams;
const leaderFromQuery = String(params.get('leader_agent_id') || '').trim();
- // ?mine=1 — every agent the caller owns that someone is actually copying,
+ // ?mine=1: every agent the caller owns that someone is actually copying,
// with its current ladder. This is what the leader's editor lists, and it is
// one query rather than one request per agent.
if (req.method === 'GET' && params.get('mine') === '1') {
@@ -137,7 +137,7 @@ export default wrap(async (req, res) => {
const body = { leader_agent_id: leader.id, leader_name: leader.name, updated_at: updatedAt, drip: present(config) };
// A signed-in caller sees the seat they personally get. Signed-out callers
- // get the ladder only — we have no wallet to price them against.
+ // get the ladder only, because we have no wallet to price them against.
const session = await getSessionUser(req);
if (session) {
const { tier, usd } = await resolveUserTier(session);
diff --git a/api/cron/copy-fanout.js b/api/cron/copy-fanout.js
index e7c29c67e..24667b85a 100644
--- a/api/cron/copy-fanout.js
+++ b/api/cron/copy-fanout.js
@@ -154,8 +154,12 @@ function breakerMessage({ leaderName, drawdownPct, limitPct }) {
* and any subscription whose copier-set drawdown limit the leader has breached is
* flipped to 'paused' here, with the reason and timestamp recorded, before it can
* size a single order.
+ *
+ * Exported so the guards can be exercised directly: they are the money-adjacent
+ * half of this cron, and the fanout itself only runs when a leader traded inside
+ * the last 8 minutes.
*/
-async function activeSubscriptionsByLeader(leaderIds, network, stats) {
+export async function activeSubscriptionsByLeader(leaderIds, network, stats) {
const byLeader = new Map();
if (!leaderIds.length) return byLeader;
diff --git a/src/alpha-drip-panel.js b/src/alpha-drip-panel.js
index b2d5be09f..8d303abe0 100644
--- a/src/alpha-drip-panel.js
+++ b/src/alpha-drip-panel.js
@@ -1,5 +1,5 @@
/**
- * Alpha-drip editor — a leader prices the latency of their own signal.
+ * Alpha-drip editor: a leader prices the latency of their own signal.
*
* Mounted on the copy dashboard for every agent the signed-in user owns that
* someone is actually copying. The leader sets how long each $THREE tier waits
@@ -73,8 +73,8 @@ function ensureStyles() {
document.head.appendChild(tag);
}
-// A CSRF token is single-use — the server burns it on first use and returns it
-// as { data: { token } } — so it is fetched per mutation and never cached.
+// A CSRF token is single-use (the server burns it on first use and returns it
+// as { data: { token } }), so it is fetched per mutation and never cached.
async function csrfToken() {
try {
const r = await fetch('/api/csrf-token', { credentials: 'include' });
@@ -98,7 +98,7 @@ async function api(path, opts = {}) {
return { ok: res.ok, status: res.status, body };
}
-/** "45s" / "2m 30s" — matches formatDelay() in api/_lib/alpha-drip.js. */
+/** "45s" / "2m 30s": matches formatDelay() in api/_lib/alpha-drip.js. */
export function formatDelay(sec) {
const s = Math.max(0, Math.round(Number(sec) || 0));
if (s < 60) return `${s}s`;
@@ -116,7 +116,7 @@ export function validateLadder(rows, publicDelay) {
// rows arrive high tier first
let prev = 0;
for (const r of priced) {
- if (r.delay_sec < prev) return `${r.label} waits less than a higher tier — a higher tier can never wait longer.`;
+ if (r.delay_sec < prev) return `${r.label} waits less than a higher tier. A higher tier can never wait longer.`;
prev = r.delay_sec;
}
if (priced.length && publicDelay < prev) return 'Everyone else must wait at least as long as the slowest paid tier.';
diff --git a/src/copy-panel.js b/src/copy-panel.js
index 5d6581a66..a1844f0a3 100644
--- a/src/copy-panel.js
+++ b/src/copy-panel.js
@@ -51,7 +51,7 @@ export async function mountCopyPanel(el, { leaderAgentId, leaderName, network =
// A leader on an alpha-drip releases to higher $THREE tiers first. Show the
// copier the seat THEY get before they commit, never after: an unexpected
// delay discovered from an empty inbox is the version of this that erodes
- // trust. Best-effort — a drip read must never block copy setup.
+ // trust. Best-effort: a drip read must never block copy setup.
const drip = await fetchDrip(leaderAgentId);
if (existing && existing.status !== 'stopped') {
diff --git a/src/dashboard-next/pages/copy.js b/src/dashboard-next/pages/copy.js
index cc5b69b6e..73ed47394 100644
--- a/src/dashboard-next/pages/copy.js
+++ b/src/dashboard-next/pages/copy.js
@@ -189,7 +189,7 @@ function intentRow(e) {
/**
* An intent this copier's $THREE tier has not reached yet. The leader and the
- * fact that they fired are shown — the coin and the size are not, because that
+ * fact that they fired are shown. The coin and the size are not, because that
* is precisely what the leader's release ladder sells. It unlocks in place: the
* countdown reaches zero and the next poll renders the real row.
*/
@@ -238,7 +238,7 @@ function startCountdowns(host, reload) {
function subRow(s) {
const paused = s.status === 'paused';
// A subscription the drawdown breaker paused was not paused by this user, so
- // the row has to say what happened — "Paused" alone reads as their own doing.
+ // the row has to say what happened: "Paused" alone reads as their own doing.
const tripped = paused && s.paused_reason === 'leader_drawdown_breach';
const ddLimit = s.max_drawdown_pct == null ? null : Number(s.max_drawdown_pct);
return `
diff --git a/tests/alpha-drip.test.js b/tests/alpha-drip.test.js
index f5b7dd2a1..5d7fd9eef 100644
--- a/tests/alpha-drip.test.js
+++ b/tests/alpha-drip.test.js
@@ -1,5 +1,5 @@
/**
- * Alpha-drip — pure release-planning tests.
+ * Alpha-drip: pure release-planning tests.
*
* Money-adjacent and trust-adjacent: a bug here either leaks a leader's signal
* early or sells a holder a slower seat than the one below them, so every rule
@@ -214,7 +214,7 @@ describe('maskUnreleasedIntent', () => {
}
});
- it('still names the leader and the direction — only the trade is held', () => {
+ it('still names the leader and the direction, only the trade is held', () => {
const masked = maskUnreleasedIntent(row(), now);
expect(masked.leader_name).toBe('Nine');
expect(masked.direction).toBe('buy');
diff --git a/tests/copy-eligibility.test.js b/tests/copy-eligibility.test.js
index a7fd82ec0..f4b918ec6 100644
--- a/tests/copy-eligibility.test.js
+++ b/tests/copy-eligibility.test.js
@@ -2,7 +2,7 @@
* The copy-trading anti-gaming layer (api/_lib/copy-eligibility.js).
*
* Three defenses stand between a copier and the two ways copy-trading gets
- * gamed — a manufactured track record, and a leader who keeps trading on the way
+ * gamed: a manufactured track record, and a leader who keeps trading on the way
* down. These are the pure halves; tests/copy-subscribe-guards.test.js covers the
* endpoint that enforces them.
*/
@@ -27,7 +27,7 @@ const close = (pnlSol, entrySol, closedAt) => ({
const hoursAgo = (h) => new Date(Date.UTC(2026, 0, 10) - h * 3_600_000).toISOString();
-describe('evaluateLeaderEligibility — the sybil bar on copyable status', () => {
+describe('evaluateLeaderEligibility: the sybil bar on copyable status', () => {
it('clears a leader with a real record', () => {
const r = evaluateLeaderEligibility({ settled: 30, span_hours: 200, deployed_sol: 2.5 });
expect(r.eligible).toBe(true);
@@ -72,7 +72,7 @@ describe('evaluateLeaderEligibility — the sybil bar on copyable status', () =>
});
});
-describe('evaluateDrawdownBreaker — the copier\'s circuit breaker', () => {
+describe('evaluateDrawdownBreaker: the copier\'s circuit breaker', () => {
it('does nothing when the copier set no limit', () => {
expect(evaluateDrawdownBreaker({ max_drawdown_pct: null }, 90).breached).toBe(false);
expect(evaluateDrawdownBreaker({}, 90).breached).toBe(false);
@@ -100,7 +100,7 @@ describe('evaluateDrawdownBreaker — the copier\'s circuit breaker', () => {
it('never auto-pauses on an unmeasurable leader', () => {
// A null drawdown means no capital was ever deployed. Pausing on "unknown"
- // would freeze every subscription the moment a leader's history is thin —
+ // would freeze every subscription the moment a leader's history is thin;
// the eligibility bar is what keeps a history-less leader uncopyable.
expect(evaluateDrawdownBreaker({ max_drawdown_pct: 10 }, null).breached).toBe(false);
});
@@ -110,7 +110,7 @@ describe('evaluateDrawdownBreaker — the copier\'s circuit breaker', () => {
});
});
-describe('summarizeCopyProfile — the equity curve both defenses read', () => {
+describe('summarizeCopyProfile: the equity curve both defenses read', () => {
it('returns an honest empty record for a leader who has closed nothing', () => {
expect(summarizeCopyProfile([])).toMatchObject({
settled: 0, deployed_sol: 0, span_hours: 0, max_drawdown_pct: null,
diff --git a/tests/copy-subscribe-guards.test.js b/tests/copy-subscribe-guards.test.js
index 6ed5c5fa3..57072ffe3 100644
--- a/tests/copy-subscribe-guards.test.js
+++ b/tests/copy-subscribe-guards.test.js
@@ -98,7 +98,7 @@ describe('self-copy guard', () => {
await subscriptions(post(validBody()), r);
expect(r._json.status).toBe(403);
expect(r._json.body.error).toBe('self_copy');
- // Refused BEFORE any row is written — a wash-trade edge must never exist.
+ // Refused BEFORE any row is written: a wash-trade edge must never exist.
expect(sqlCalls.some((c) => c.text.includes('insert into copy_subscriptions'))).toBe(false);
});