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(x-content): give the partner spotlight its own daily slot and release it by policy
nirholas83587c78180d
diff --git a/api/_lib/x-content/approval.js b/api/_lib/x-content/approval.jsindex 7877693ee..bdb159d2c 100644--- a/api/_lib/x-content/approval.js+++ b/api/_lib/x-content/approval.js@@ -26,6 +26,16 @@// other condition still applies, including a tag anywhere in the body. An// Article that does carry a scenario must still have a current proof.//+// A series has its own rule too, `approval.series` (owner, 2026-10-11: one+// partner spotlight a day, released without the owner). A partner spotlight is+// tier 1 because it names a partner, so the tier rule would hold every one of+// them. What stands in for the owner's eye on the partner's name is the series+// lint (partners.js): the thread must state the designation exactly as the+// partner's registry entry gives it, must not use any phrase that would+// overstate the relationship, and every fact in it comes from the registry's+// evidence. Every other condition still applies: it must be filmed, tag no one,+// and pass on the editor's own verdict.+//// A release by policy is never immediate. The post is embargoed for// `vetoHours`, and the release is written to the ops alerts, so there is always// a window in which `npm run x:content -- pause <id>` takes it back.@@ -37,7 +47,7 @@ import { existsSync, readFileSync } from 'node:fs';import { join } from 'node:path';const HOUR = 3_600_000;-export const DEFAULT_APPROVAL = { mode: 'owner', tiers: [2, 3], vetoHours: 24, articles: false };+export const DEFAULT_APPROVAL = { mode: 'owner', tiers: [2, 3], vetoHours: 24, articles: false, series: [] };export const MIN_VETO_HOURS = 1;export function approvalPolicy(queue) {@@ -49,6 +59,7 @@ export function approvalPolicy(queue) {tiers,vetoHours: Number.isFinite(veto) && veto >= MIN_VETO_HOURS ? veto : DEFAULT_APPROVAL.vetoHours,articles: raw.articles === true,+ series: Array.isArray(raw.series) ? raw.series.filter((name) => typeof name === 'string' && name) : [],};}@@ -57,7 +68,8 @@ export function policyBlockers(item, record, policy, root, now = Date.now()) {if (policy.mode !== 'auto') return ['the queue leaves approval to the owner'];const reasons = [];const article = item.kind === 'article' && policy.articles;- if (!article && !policy.tiers.includes(tierOf(item))) reasons.push(`tier ${tierOf(item)} posts are approved by the owner`);+ const listedSeries = typeof item.series === 'string' && (policy.series || []).includes(item.series);+ if (!article && !listedSeries && !policy.tiers.includes(tierOf(item))) reasons.push(`tier ${tierOf(item)} posts are approved by the owner`);if (item.scenario) reasons.push(...proofProblems(item, root, now).map((problem) => `proof: ${problem}`));else if (!article) reasons.push('it was never filmed against the product');const tagged = mentionsIn([...(item.posts || []).map((post) => post.text), ...(item.kind === 'article' ? [item.article?.title, articleBody(item, root)] : [])].filter(Boolean).join('\n'));diff --git a/api/_lib/x-content/runner.js b/api/_lib/x-content/runner.jsindex 825831e8f..0b86c5432 100644--- a/api/_lib/x-content/runner.js+++ b/api/_lib/x-content/runner.js@@ -14,7 +14,7 @@// reads the timeline again if the stored record has gone stale.import { loadQueue, validateQueue } from './queue.js';-import { DEFAULT_CADENCE, SLOT_OPEN_MINUTES, TIERS, isKindSlot, pickDue, reservedKinds, slotLabel, slotOpenings, tierOf } from './schedule.js';+import { DEFAULT_CADENCE, SLOT_OPEN_MINUTES, TIERS, isKindSlot, pickDue, reservedKinds, reservedSeries, seriesOf, slotLabel, slotOpenings, tierOf } from './schedule.js';import { loadLifts } from './priority.js';import { loadReview, contentHash } from './review.js';import { previewClient, publishItem, xClientFromEnv } from './publisher.js';@@ -86,10 +86,13 @@ export function inventory(items, state, root, now = Date.now(), cadence = {}) {const reserved = reservedKinds(cadence);const counts = new Map(TIERS.map((tier) => [tier, 0]));const byKind = new Map([...reserved].map((kind) => [kind, 0]));+ const series = reservedSeries(cadence);+ const bySeries = new Map([...series].map((name) => [name, 0]));for (const item of items) {if (item.status !== 'approved' || publishedIds.has(item.id) || held.has(item.id)) continue;if (item.expiresAt && Date.parse(item.expiresAt) <= now) continue;if (reserved.has(item.kind)) byKind.set(item.kind, byKind.get(item.kind) + 1);+ else if (series.has(seriesOf(item))) bySeries.set(seriesOf(item), bySeries.get(seriesOf(item)) + 1);else counts.set(tierOf(item), counts.get(tierOf(item)) + 1);}const tiers = TIERS.map((tier) => ({ tier, days: counts.get(tier), low: counts.get(tier) < INVENTORY_WARN_DAYS }));@@ -97,10 +100,12 @@ export function inventory(items, state, root, now = Date.now(), cadence = {}) {const days = byKind.get(slot.kind) * Math.max(1, Math.floor(Number(slot.everyDays) || 1));return { kind: slot.kind, count: byKind.get(slot.kind), days, low: days < INVENTORY_WARN_DAYS };});- return [...tiers, ...kinds];+ // A series posts once a day, so a series post is a day of stock.+ const serial = [...series].map((name) => ({ series: name, count: bySeries.get(name), days: bySeries.get(name), low: bySeries.get(name) < INVENTORY_WARN_DAYS }));+ return [...tiers, ...kinds, ...serial];}-export const stockLabel = (row) => (row.kind ? `${row.kind}: ${row.count} (${row.days} day(s))` : `T${row.tier}: ${row.days} day(s)`);+export const stockLabel = (row) => (row.kind ? `${row.kind}: ${row.count} (${row.days} day(s))` : row.series ? `${row.series}: ${row.days} day(s)` : `T${row.tier}: ${row.days} day(s)`);async function alertLowInventory(state, store, stock, now) {const today = new Date(now).toISOString().slice(0, 10);@@ -307,7 +312,7 @@ async function fillSlot({ queue, state, store, root, now, requestedId, client, c}try {- const meta = decision.slot ? { slot: decision.slot.key, tier: decision.tier, slotTier: decision.slot.tier, ...(decision.slot.kind ? { slotKind: decision.slot.kind } : {}) } : {};+ const meta = decision.slot ? { slot: decision.slot.key, tier: decision.tier, slotTier: decision.slot.tier, ...(decision.slot.kind ? { slotKind: decision.slot.kind } : {}), ...(decision.series ? { series: decision.series } : {}) } : {};const row = await publishItem({ item, client, root, state, store, account: queue.account, meta, now });if (state.holds?.[item.id]) {delete state.holds[item.id];diff --git a/api/_lib/x-content/schedule.js b/api/_lib/x-content/schedule.jsindex 1f368c549..410d619b2 100644--- a/api/_lib/x-content/schedule.js+++ b/api/_lib/x-content/schedule.js@@ -111,9 +111,22 @@ export const isWeekend = (timestamp) => [0, 6].includes(new Date(timestamp).getU// morning's slot shut. `from` is the first day the slot opens; it then opens on// every `everyDays`-th UTC day after it (and, by the same arithmetic, before).export const isKindSlot = (slot) => Boolean(slot?.kind);-export const slotLabel = (slot) => (isKindSlot(slot) ? slot.kind : `T${slot.tier}`);+export const slotLabel = (slot) => (isKindSlot(slot) ? slot.kind : `T${slot.tier}${slot.series ? ` ${slot.series}` : ''}`);export const reservedKinds = (cadence = {}) => new Set((cadence.slots || []).filter(isKindSlot).map((slot) => slot.kind));+// ── Series slots ────────────────────────────────────────────────────────────+// A tiered slot may also belong to a series: `{ tier: 1, series: 'partners',+// at: '15:30' }` is the daily partner spotlight (owner, 2026-10-11: one post a+// day about a partner and the feature three.ws built on it). The slot takes+// the series' best ready post first, ranked across every tier, and when the+// series has nothing ready it is the tier's slot exactly as before, so the+// prime-time flagship is never left without a home. Posts of a series that+// owns a slot are kept for it, so the series goes out once a day and never+// twice. A series slot is a daily slot: it counts toward the daily cap.+export const isSeriesSlot = (slot) => Boolean(slot?.series) && !isKindSlot(slot);+export const seriesOf = (item) => (typeof item?.series === 'string' && item.series ? item.series : null);+export const reservedSeries = (cadence = {}) => new Set((cadence.slots || []).filter(isSeriesSlot).map((slot) => slot.series));+export function slotOpensOn(slot, day) {const every = Math.max(1, Math.floor(Number(slot.everyDays) || 1));if (every === 1) return true;@@ -135,7 +148,7 @@ export function slotOpenings(now, cadence = DEFAULT_CADENCE, seed = null) {if (cadence.flagshipWeekdaysOnly && Number(slot.tier) === 1 && isWeekend(day)) return;if (!slotOpensOn(slot, day)) return;const key = `${dayKey(day)}#${index}`;- const owner = isKindSlot(slot) ? { kind: String(slot.kind), tier: null } : { tier: Number(slot.tier) };+ const owner = isKindSlot(slot) ? { kind: String(slot.kind), tier: null } : { tier: Number(slot.tier), ...(isSeriesSlot(slot) ? { series: String(slot.series) } : {}) };openings.push({ key, ...owner, opensAt: day + (atMinutes(slot.at) + jitterMinutes(`slot:${key}`, window, seed)) * MINUTE });});}@@ -235,13 +248,17 @@ export function pickDue({// A kind slot takes only its kind; the tiered slots take everything a kind// slot does not own.const reserved = reservedKinds(cadence);- const fits = (item) => (isKindSlot(slot) ? item.kind === slot.kind : !reserved.has(item.kind));+ const series = reservedSeries(cadence);+ // A series post that a kind slot does not own is kept for its series slot.+ const keptForSeries = (item) => !reserved.has(item.kind) && series.has(seriesOf(item));+ const fits = (item) => (isKindSlot(slot) ? item.kind === slot.kind : !reserved.has(item.kind) && (!keptForSeries(item) || seriesOf(item) === slot.series));const candidates = unpublished.filter((item) => fits(item) && !exclude.has(item.id) && !(holdFlagship && tierOf(item) === 1));const ready = candidates.filter((item) => Date.parse(item.notBefore) <= now);const context = { lifts, published, quality, reviews, now };- const choose = (pool, order, how) => {- // A kind slot ranks its kind across every tier at once.- for (const tier of isKindSlot(slot) ? [null] : order) {+ const choose = (pool, order, how, { acrossTiers = isKindSlot(slot) } = {}) => {+ // A kind slot ranks its kind across every tier at once, and so does a+ // series slot ranking its series.+ for (const tier of acrossTiers ? [null] : order) {const ranked = rankItems(tier == null ? pool : pool.filter((item) => tierOf(item) === tier), context);if (!ranked.length) continue;const [top] = ranked;@@ -252,6 +269,7 @@ export function pickDue({filledDown: tier != null && tier > slot.tier,filledUp: tier != null && tier < slot.tier,vetoYielded: how === 'veto',+ ...(seriesOf(top.item) && seriesOf(top.item) === slot.series ? { series: slot.series } : {}),score: top.score,parts: top.parts,ranking: ranked.map((row) => ({ id: row.item.id, score: row.score })),@@ -261,6 +279,12 @@ export function pickDue({};const countByTier = (pool) => new Map(TIERS.map((tier) => [tier, pool.filter((item) => tierOf(item) === tier).length]));+ // A series slot spends its series first. The rest of the pool is the tier's+ // usual one, so a dry series lends the slot to its tier.+ if (isSeriesSlot(slot)) {+ const own = choose(ready.filter((item) => seriesOf(item) === slot.series), [], 'usual', { acrossTiers: true });+ if (own) return own;+ }const usual = choose(ready, isKindSlot(slot) ? [] : tierOrder(slot.tier, countByTier(ready)), 'usual');if (usual || !quota) return usual || empty();// Three a day is a quota, not a ceiling (owner, 2026-09-30), so a slot isdiff --git a/data/x-content/queue.json b/data/x-content/queue.jsonindex 3143b18b2..2dcd29255 100644--- a/data/x-content/queue.json+++ b/data/x-content/queue.json@@ -13,6 +13,7 @@},{"tier": 1,+ "series": "partners","at": "15:30"},{@@ -89,7 +90,10 @@3],"vetoHours": 2,- "articles": true+ "articles": true,+ "series": [+ "partners"+ ]},"items": [{diff --git a/scripts/x-content.mjs b/scripts/x-content.mjsindex a1d878de1..4a7e89444 100644--- a/scripts/x-content.mjs+++ b/scripts/x-content.mjs@@ -37,7 +37,7 @@ import { spawnSync } from 'node:child_process';import { fileURLToPath } from 'node:url';import { QUEUE_PATH, loadQueue, validateItem, validateQueue } from '../api/_lib/x-content/queue.js';-import { DEFAULT_CADENCE, TIERS, currentSlot, pickDue, reservedKinds, slotLabel, slotOpenings, tierOf } from '../api/_lib/x-content/schedule.js';+import { DEFAULT_CADENCE, TIERS, currentSlot, pickDue, reservedKinds, reservedSeries, seriesOf, slotLabel, slotOpenings, tierOf } from '../api/_lib/x-content/schedule.js';import { loadLifts, rankItems } from '../api/_lib/x-content/priority.js';import { activeHolds, inventory, stockLabel } from '../api/_lib/x-content/runner.js';import { runTick } from '../api/_lib/x-content/runner.js';@@ -143,10 +143,13 @@ async function plan() {const recent = withFormats(state.published, queue.items).slice(-6).map((row) => row.format || '?');if (recent.length) console.log(` last sent: ${recent.join(' > ')} (at most ${queue.quality?.maximumSameFormatInARow ?? 'any'} of one format in a row)`);- // Items a kind slot owns are ranked for that slot, not for their tier.+ // Items a kind or series slot owns are ranked for that slot, not for their tier.const reserved = reservedKinds(cadence);+ const series = reservedSeries(cadence);+ const ownSlot = (item) => reserved.has(item.kind) || series.has(seriesOf(item));const groups = [- ...TIERS.map((tier) => ({ label: `T${tier}`, match: (item) => !reserved.has(item.kind) && tierOf(item) === tier })),+ ...TIERS.map((tier) => ({ label: `T${tier}`, match: (item) => !ownSlot(item) && tierOf(item) === tier })),+ ...[...series].map((name) => ({ label: `${name} series`, match: (item) => !reserved.has(item.kind) && seriesOf(item) === name })),...[...reserved].map((kind) => ({ label: `${kind} slot`, match: (item) => item.kind === kind })),];for (const group of groups) {diff --git a/tests/x-content-approval.test.js b/tests/x-content-approval.test.jsindex 992d9772b..ca332e997 100644--- a/tests/x-content-approval.test.js+++ b/tests/x-content-approval.test.js@@ -62,7 +62,8 @@ describe('approval policy', () => {it('leaves approval with the owner unless the queue says otherwise', () => {expect(approvalPolicy({})).toEqual(DEFAULT_APPROVAL);expect(approvalPolicy({ approval: { mode: 'automatic' } }).mode).toBe('owner');- expect(approvalPolicy({ approval: { mode: 'auto', tiers: [1, 2, 9, 'x'], vetoHours: 6 } })).toEqual({ mode: 'auto', tiers: [1, 2], vetoHours: 6, articles: false });+ expect(approvalPolicy({ approval: { mode: 'auto', tiers: [1, 2, 9, 'x'], vetoHours: 6 } })).toEqual({ mode: 'auto', tiers: [1, 2], vetoHours: 6, articles: false, series: [] });+ expect(approvalPolicy({ approval: { mode: 'auto', series: ['partners', '', 7] } }).series).toEqual(['partners']);expect(approvalPolicy({ approval: { mode: 'auto', articles: 'yes' } }).articles).toBe(false);expect(approvalPolicy({ approval: { mode: 'auto', articles: true } }).articles).toBe(true);});@@ -85,6 +86,17 @@ describe('approval policy', () => {expect(policyBlockers(item({ tier: 1 }), PASSED, { ...AUTO, tiers: [1, 2, 3] }, sandbox(), NOW)).toEqual([]);});+ it('releases a listed series by policy whatever its tier, and holds it to every other rule', () => {+ const spotlight = item({ tier: 1, series: 'partners' });+ const policy = { ...AUTO, series: ['partners'] };+ expect(policyBlockers(spotlight, PASSED, AUTO, sandbox(), NOW)).toEqual(['tier 1 posts are approved by the owner']);+ expect(policyBlockers(spotlight, PASSED, policy, sandbox(), NOW)).toEqual([]);+ expect(policyBlockers(item({ tier: 1, series: 'other' }), PASSED, policy, sandbox(), NOW)).toEqual(['tier 1 posts are approved by the owner']);+ expect(policyBlockers({ ...spotlight, scenario: undefined }, PASSED, policy, sandbox(), NOW)).toEqual(['it was never filmed against the product']);+ const tagged = { ...spotlight, posts: [{ ...spotlight.posts[0], text: `${spotlight.posts[0].text} with @nvidia` }] };+ expect(policyBlockers(tagged, PASSED, policy, sandbox(), NOW)).toEqual(['it tags @nvidia']);+ });+it('never releases a post that was not filmed', () => {expect(policyBlockers(item({ scenario: undefined }), PASSED, AUTO, sandbox(), NOW)).toEqual(['it was never filmed against the product']);});diff --git a/tests/x-content.test.js b/tests/x-content.test.jsindex 8e786cc48..ab003c186 100644--- a/tests/x-content.test.js+++ b/tests/x-content.test.js@@ -236,6 +236,42 @@ describe('schedule', () => {expect(pickDue({ items: [item('demo', { tier: 3 })], state: sent, now: morning, cadence: withArticles }).item.id).toBe('demo');});+ it('gives a series its own daily slot, keeps its posts for that slot, and lends the slot to its tier when the series is dry', () => {+ const withSeries = { ...cadence, slots: cadence.slots.map((slot) => (slot.tier === 1 ? { ...slot, series: 'partners' } : slot)) };+ expect(slotLabel(slotOpenings(primeTime, withSeries).find((slot) => slot.series))).toBe('T1 partners');++ const spotlight = item('nvidia-gpu-fleet', { tier: 2, series: 'partners' });+ const flagship = item('flagship', { tier: 1, priority: 50 });+ // The series slot takes the series post ahead of a higher-ranked flagship.+ const pick = pickDue({ items: [spotlight, flagship], state: {}, now: primeTime, cadence: withSeries });+ expect([pick.item.id, pick.slot.series, pick.series]).toEqual(['nvidia-gpu-fleet', 'partners', 'partners']);+ // With no series post ready, the slot is the tier's slot as before.+ expect(pickDue({ items: [flagship], state: {}, now: primeTime, cadence: withSeries }).item.id).toBe('flagship');++ // Every other slot leaves the series post alone, even when it would sit empty.+ const morning = Date.parse('2026-09-17T08:50:00Z');+ expect(pickDue({ items: [spotlight], state: {}, now: morning, cadence: withSeries, quota: true }).item).toBeNull();+ expect(pickDue({ items: [spotlight, item('feature', { tier: 2 })], state: {}, now: morning, cadence: withSeries, quota: true }).item.id).toBe('feature');+ // Without a series slot a series post is an ordinary item of its tier.+ expect(pickDue({ items: [spotlight], state: {}, now: morning, cadence, quota: true }).item.id).toBe('nvidia-gpu-fleet');+ });++ it('counts a series stock on its own line', () => {+ const dir = sandbox();+ const items = [+ { id: 'a', status: 'approved', tier: 1, kind: 'post', posts: [{ text: 'a' }] },+ { id: 's1', status: 'approved', tier: 2, kind: 'post', series: 'partners', posts: [{ text: 's1' }] },+ { id: 's2', status: 'approved', tier: 2, kind: 'post', series: 'partners', posts: [{ text: 's2' }] },+ ];+ const cadence = { slots: [{ tier: 1, series: 'partners', at: '15:30' }, { tier: 2, at: '12:00' }] };+ expect(inventory(items, { published: [] }, dir, Date.now(), cadence)).toEqual([+ { tier: 1, days: 1, low: true },+ { tier: 2, days: 0, low: true },+ { tier: 3, days: 0, low: true },+ { series: 'partners', count: 2, days: 2, low: true },+ ]);+ });+it('resumes a half-published item ahead of pacing and priority', () => {const state = { published: [{ id: 'p', publishedAt: new Date(primeTime - 10 * 60_000).toISOString() }], inflight: { a: { media: {}, postIds: ['1'] } } };expect(pickDue({ items: [item('a'), item('b', { priority: 50 })], state, now: primeTime, cadence }).resuming).toBe(true);