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): schedule the @trythreews content queue on Cloud Scheduler and gate pack text drift
Nicholasa5c797d295fc
diff --git a/CLAUDE.md b/CLAUDE.mdindex bcb4e326c..f84ef6eef 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -311,7 +311,7 @@ The whole build + submit + purge in one command: `npm run deploy:gcp:full`.- Frontend: vanilla JS modules + Vite (`npm run dev`, port 3000).- 3D: Three.js with glTF/GLB.- Backend touchpoints: serverless-style handlers in `api/`, workers in `workers/`.-- **Production runs on Google Cloud Run, NOT Vercel** (migrated 2026-07-07 after Vercel disabled the deployment). One container ([server/index.mjs](server/index.mjs)) serves the static frontend, the vercel.json route table, and all `api/**` handlers; the crons (117 as of 2026-09-08, see vercel.json) run on Cloud Scheduler. `vercel.json` is a LIVE config file: `server/index.mjs` reads its `routes` array on boot (split at the `{handle:"filesystem"}` marker into pre- and post-filesystem phases), and `scripts/create-gcp-scheduler.mjs` reads its `crons` array to sync Cloud Scheduler jobs. The server itself never reads `crons`. Never delete `vercel.json` as a leftover. GCP builds/deploys must pin the `three-ws-build@` (build) and `three-ws@` (runtime) service accounts; the project's default compute SA was deleted. Deploys: see the "Deploy runbook" section above.+- **Production runs on Google Cloud Run, NOT Vercel** (migrated 2026-07-07 after Vercel disabled the deployment). One container ([server/index.mjs](server/index.mjs)) serves the static frontend, the vercel.json route table, and all `api/**` handlers; the crons (118 as of 2026-09-16, see vercel.json) run on Cloud Scheduler. `vercel.json` is a LIVE config file: `server/index.mjs` reads its `routes` array on boot (split at the `{handle:"filesystem"}` marker into pre- and post-filesystem phases), and `scripts/create-gcp-scheduler.mjs` reads its `crons` array to sync Cloud Scheduler jobs. The server itself never reads `crons`. Never delete `vercel.json` as a leftover. GCP builds/deploys must pin the `three-ws-build@` (build) and `three-ws@` (runtime) service accounts; the project's default compute SA was deleted. Deploys: see the "Deploy runbook" section above.- **Env-var trap:** `vercel env pull` returns EMPTY for secret-type vars. Never trust a Vercel env export as complete. Production env lives on the Cloud Run service (`gcloud run services describe/update three-ws-api --region us-central1`).- Solana/agent SDKs in `sdk/`, `solana-agent-sdk/`, `agent-payments-sdk/`.- Real APIs in use: Pump.fun feed, Solana RPC, OpenAI/Anthropic via worker proxies. Never mock these.diff --git a/STRUCTURE.md b/STRUCTURE.mdindex f5abfa48f..c284c29f2 100644--- a/STRUCTURE.md+++ b/STRUCTURE.md@@ -295,6 +295,7 @@ bottom.| Atlas (site-wide Cmd+K search + route map) | Palette [public/atlas.js](public/atlas.js) `-> /atlas.js`, ranking [public/atlas/score.js](public/atlas/score.js), map page [pages/atlas.html](pages/atlas.html) + [src/atlas-page.js](src/atlas-page.js) `-> /atlas`, index [scripts/build-atlas-index.mjs](scripts/build-atlas-index.mjs) `-> public/atlas-index.json`, task catalog [data/atlas-intents.json](data/atlas-intents.json), coverage [scripts/inject-atlas.mjs](scripts/inject-atlas.mjs) | Live | **Discovery layer for 650+ routes.** Cmd+K (or `/`) opens a search over every page in `data/pages.json` plus a curated set of TASKS that answer with ordered steps rather than one link, because "which page starts the get-paid flow" is a harder question than "where is /x402/studio". Zero-dependency single file so it runs identically on 250+ standalone HTML entry points; the index is fetched on first open, not page load. Every task step target is resolved against the real route table at build time, so an onboarding path cannot dead-end on a 404. Injected by a Vite `three-ws-atlas` plugin plus a post-build `dist/` walk (same belt-and-suspenders as [scripts/inject-tour-boot.mjs](scripts/inject-tour-boot.mjs), for the same plugin-ordering reason). Embeds and the nav/footer fragments are excluded. Doc: [docs/atlas.md](docs/atlas.md). Tests: [tests/atlas.test.js](tests/atlas.test.js). || Internationalization (i18n) | Runtime [src/i18n.js](src/i18n.js) `→ /i18n.js`; catalogs [public/locales/](public/locales) (`en` + 84 locales, `manifest.json`, `localized-pages.json`); pipeline [scripts/i18n-annotate.mjs](scripts/i18n-annotate.mjs) · [i18n-extract.mjs](scripts/i18n-extract.mjs) · [i18n-translate.mjs](scripts/i18n-translate.mjs) (Vertex Gemini, glossary-locked) · [i18n-backfill.mjs](scripts/i18n-backfill.mjs) (re-translates copy that was baked to English during a backend outage); hreflang in [api/sitemap/[type].js](api/sitemap/%5Btype%5D.js) | Live (85 languages) | LobeHub-model client-side copy swap. `npm run i18n:annotate` auto-injects `data-i18n*` into static HTML (byte-surgical), `i18n:extract` builds `en.json`, `i18n:translate` fans it out to every locale via Vertex with brand/protocol terms masked. `i18n:backfill` finds keys whose value is still byte-identical to English (the silent failure mode: a baked fallback is present, so every later run skips it) and re-translates them. Runtime auto-detects locale, mounts a floating `<lang-switcher>`, and injects hreflang. Doc: [docs/i18n.md](docs/i18n.md). Tests: [tests/i18n.test.js](tests/i18n.test.js), [tests/i18n-annotate.test.js](tests/i18n-annotate.test.js), [tests/i18n-backfill.test.js](tests/i18n-backfill.test.js). || Shared utilities (import instead of hand-rolling) | Frontend [src/shared/markdown.js](src/shared/markdown.js) · [src/shared/toast.js](src/shared/toast.js) · [src/shared/fuzzy.js](src/shared/fuzzy.js) · `timeAgo`/`toEpochMs` in [src/shared/coin-format.js](src/shared/coin-format.js); backend [api/_lib/resilience.js](api/_lib/resilience.js) · [api/_lib/mem-cache.js](api/_lib/mem-cache.js) · [api/_lib/pool.js](api/_lib/pool.js) · [api/_lib/csv.js](api/_lib/csv.js); ops [scripts/check-cron-drift.mjs](scripts/check-cron-drift.mjs) | Live · doc [docs/shared-utilities.md](docs/shared-utilities.md) | Thin layers over vetted packages, each replacing a family of hand-rolled copies that had drifted. `markdown.js` = `marked` + `DOMPurify`, the single sanitized path for model/user text reaching `innerHTML` (the concierge SDK carries its own copy at [concierge-sdk/src/markdown.js](concierge-sdk/src/markdown.js) because it ships as an independent bundle). `toast.js` = one aria-live region with a real queue. `fuzzy.js` = `@leeoniya/ufuzzy` ranking + typo tolerance + match ranges for both command palettes. `resilience.js` = `cockatiel` circuit breakers **and** jittered retry (`withRetry`, `parseRetryAfter`, `isRetryableError`). `mem-cache.js` = `lru-cache` with true recency eviction and single-flight `cached()`. `pool.js` = `p-limit` bounded concurrency. `csv.js` = RFC 4180 quoting **plus** spreadsheet formula-injection neutralization. `check-cron-drift.mjs` = `cron-parser` validation of every cron declared in vercel.json against live Cloud Scheduler, sharing its job-id derivation with [scripts/create-gcp-scheduler.mjs](scripts/create-gcp-scheduler.mjs) so the two can never disagree. Tests: [tests/shared-markdown.test.js](tests/shared-markdown.test.js), [tests/fuzzy.test.js](tests/fuzzy.test.js), [tests/csv.test.js](tests/csv.test.js), [tests/resilience-shared.test.js](tests/resilience-shared.test.js) |+| X content pipeline (internal) | Queue [data/x-content/queue.json](data/x-content/queue.json), engine [api/_lib/x-content/](api/_lib/x-content), cron [api/cron/x-content.js](api/cron/x-content.js), CLI [scripts/x-content.mjs](scripts/x-content.mjs), media `public/x-media/` | Internal, owner-gated · doc [docs/x-content-pipeline.md](docs/x-content-pipeline.md) | The reviewed @trythreews publishing queue: posts and threads with native images, GIFs, and captioned video, blog or external pages imported as native posts or full X Articles (via the X Articles API), a copy lint against automated-feed tells, jittered cadence with lane rotation, and a database ledger that resumes a half-sent thread instead of reposting. Previews only until `X_CONTENT_AUTO_PUBLISH=true`. Tests: [tests/x-content.test.js](tests/x-content.test.js) || X post archive + engagement analysis (internal) | Snapshots [data/x-archive/](data/x-archive), schema [api/_lib/migrations/20260814120000_x_account_archive.sql](api/_lib/migrations/20260814120000_x_account_archive.sql), normalization + analysis [scripts/x-archive-lib.mjs](scripts/x-archive-lib.mjs), commands [scripts/x-archive-import.mjs](scripts/x-archive-import.mjs) · [scripts/x-archive-refresh.mjs](scripts/x-archive-refresh.mjs) · [scripts/x-archive-analyze.mjs](scripts/x-archive-analyze.mjs), report [docs/x-archive/](docs/x-archive) | Internal · doc [docs/x-archive.md](docs/x-archive.md) | Every post our own X accounts published, kept as raw snapshot files and indexed into `x_account_posts` / `x_account_post_snapshots` so engagement is a measured time series rather than a memory. `npm run x:archive:analyze` regenerates a report ranking posts by engagement and by engagement *rate*, and scores every measurable signal (media, mentions, length, subject, hour) as lift against the corpus median. Two scraper defects are handled rather than inherited: a profile scrape returns reposts of other accounts with `isRetweet: false` (authorship is read from the permalink instead), and X renders like counts lazily so real posts arrive at "0 likes" (those are archived, named, and excluded from the medians until `npm run x:archive:refresh` replaces them with exact X API counters). Distinct from `x_posts`, which is what platform users publish through [api/x/post.js](api/x/post.js). Tests: [tests/x-archive.test.js](tests/x-archive.test.js) || Interactive 3D history timeline | [pages/timeline.html](pages/timeline.html) `→ /timeline`, [src/timeline.js](src/timeline.js), data [data/timeline.json](data/timeline.json) | Live | three.ws's public history (launches, partnerships, listings, press, product ships) as an explorable 3D scene: 60+ milestones as glowing markers along a curved path, 360° free-orbit or a marker-to-marker Walk mode with a guide beacon (reuses the shared `AnimationManager` + default rig from [src/walk.js](src/walk.js)'s pattern), a synced bottom scrubber, category filters, and a detail panel linking to the original source where one exists (IBM Community, NVIDIA Developer Forums, Yahoo Finance, Phemex, CoinGecko, HackerNoon). Real accessible HTML-list fallback for no-WebGL or fetch-failure. || Upstream resilience toolkit | [scripts/resilience/](scripts/resilience) + [scripts/audit-upstreams.mjs](scripts/audit-upstreams.mjs) `→ npm run audit:upstreams`, baseline [data/upstream-baseline.json](data/upstream-baseline.json), generated map [docs/resilience.md](docs/resilience.md) | Live | Answers the question a fallback alone cannot: when a third-party service is down, what is each endpoint ALLOWED to say? An AST pass grades every outbound call site on five protections (deadline, retry, failover, last-good, breaker) and ratchets against a committed baseline, so a new unbounded call fails the build while the existing tail is paid down at its own pace. On top of it, endpoints declare a degradation contract (`may-serve-stale`, `must-refuse`, `must-not-serve-stale`) that [tests/upstream-degradation.test.js](tests/upstream-degradation.test.js) proves by replacing fetch with a dead upstream and judging the real response. Built after four fallbacks that each passed review turned out to serve remembered data on paths where staleness costs money or grants access. Complements [scripts/check-fetch-timeouts.mjs](scripts/check-fetch-timeouts.mjs), which enforces the deadline floor. Docs: [scripts/resilience/README.md](scripts/resilience/README.md) |diff --git a/api/_lib/x-content/quality.js b/api/_lib/x-content/quality.jsindex 60e74d163..d242e0ef6 100644--- a/api/_lib/x-content/quality.js+++ b/api/_lib/x-content/quality.js@@ -78,7 +78,7 @@ export const BANNED_PHRASES = [];// Acronyms and tickers that are legitimately written in capitals.-const ALLCAPS_TERMS = new Set(['THREE', 'HTTP', 'HTTPS', 'JSON', 'GLTF', 'USDC', 'HTML', 'WEBP', 'NVIDIA', 'OAUTH', 'MCP', 'GPU', 'GPUS']);+const ALLCAPS_TERMS = new Set(['THREE', 'HTTP', 'HTTPS', 'JSON', 'GLTF', 'HTML', 'WEBP', 'NVIDIA', 'OAUTH', 'MCP', 'GPU', 'GPUS']);// `minimum` applies to the head of a post; replies may be short. `requireUrl`// is false for parts whose item carries its link somewhere else (a reply, or a@@ -92,7 +92,7 @@ export function copyProblems(text, { minimum = 100, maximum = 280, requireUrl =if (weight > maximum) problems.push(`copy is ${weight} weighted characters; maximum is ${maximum}`);if (/(^|\s)#\w/.test(copy)) problems.push('hashtags are outside the @trythreews voice');if (/[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}]/u.test(copy)) problems.push('emoji are outside the @trythreews voice');- if (/[–—]/.test(copy)) problems.push('en-dashes and em-dashes are banned');+ if (/[\u2013\u2014]/.test(copy)) problems.push('en-dashes and em-dashes are banned');if (/!{2,}|(?:!.*){3,}/s.test(copy)) problems.push('stacked exclamation marks read as automated hype');if ((copy.match(/\b[A-Z]{4,}\b/g) || []).filter((word) => !ALLCAPS_TERMS.has(word)).length > 1) {problems.push('more than one all-caps word reads as shouting');diff --git a/api/_lib/x-content/queue.js b/api/_lib/x-content/queue.jsindex 6ba29eacf..2d3099742 100644--- a/api/_lib/x-content/queue.js+++ b/api/_lib/x-content/queue.js@@ -44,6 +44,17 @@ export function loadArticle(root, article) {return markdownToContentState(markdown, { articlePath: article.body });}+// A post may name the announcement-pack file its copy was reviewed in+// (docs/announcements/<slug>.post.txt). In a checkout the inline text must match+// that file byte for byte, so a pack edit cannot drift from what ships. The+// production image carries no docs/, so the check is skipped there.+function textFromProblems(post, root) {+ if (!post.textFrom) return [];+ const path = resolve(root, post.textFrom);+ if (!existsSync(path)) return root === process.cwd() && existsSync(resolve(root, 'docs')) ? [`textFrom ${post.textFrom} is missing`] : [];+ return readFileSync(path, 'utf8').trim() === String(post.text || '').trim() ? [] : [`text differs from ${post.textFrom}; copy the reviewed pack text into the queue`];+}+function postProblems(item, root, { headMinimum, headNeedsUrl }) {const problems = [];const posts = item.posts || [];@@ -52,6 +63,7 @@ function postProblems(item, root, { headMinimum, headNeedsUrl }) {posts.forEach((post, index) => {const label = index === 0 ? 'head' : `reply ${index}`;+ problems.push(...textFromProblems(post, root).map((problem) => `${label}: ${problem}`));for (const problem of copyProblems(post.text, { minimum: index === 0 ? headMinimum : 1, requireUrl: false })) {problems.push(`${label}: ${problem}`);}@@ -68,7 +80,7 @@ function articleProblems(item, root) {const title = String(article.title || '').trim();if (!title) problems.push('article title is empty');if (title.length > MAX_ARTICLE_TITLE) problems.push(`article title is ${title.length} characters; keep it under ${MAX_ARTICLE_TITLE}`);- if (/[–—]/.test(title)) problems.push('article title: en-dashes and em-dashes are banned');+ if (/[\u2013\u2014]/.test(title)) problems.push('article title: en-dashes and em-dashes are banned');if (!article.cover?.path) problems.push('article needs a cover image; X shows it on the card in every feed');else {@@ -86,7 +98,7 @@ function articleProblems(item, root) {const converted = loadArticle(root, article);const { blocks } = converted.content_state;if (blocks.length < 3) problems.push(`article body has ${blocks.length} blocks; that is a post, not an Article`);- if (/[–—]/.test(blocks.map((block) => block.text).join('\n'))) problems.push('article body: en-dashes and em-dashes are banned');+ if (/[\u2013\u2014]/.test(blocks.map((block) => block.text).join('\n'))) problems.push('article body: en-dashes and em-dashes are banned');if (converted.markdownWeight > MARKDOWN_ENTITY_BUDGET) {problems.push(`code blocks and tables total ${converted.markdownWeight} characters; X allows ${MARKDOWN_ENTITY_BUDGET} per Article`);}diff --git a/data/x-content/articles/web-component-article.md b/data/x-content/articles/web-component-article.mddeleted file mode 100644index 4d8f3e204..000000000--- a/data/x-content/articles/web-component-article.md+++ /dev/null@@ -1,56 +0,0 @@-**Drop one `<agent-3d>` web component on your site and give any page an AI with a body.** LLM brain with memory and emotions. Physical DOM awareness. An on-chain identity that persists forever. And it covers its eyes when you type a password.--```-<script src="https://three.ws/agent.js"></script>-<agent-3d agent-id="your-agent-id"></agent-3d>-```--That's it. The component is a standard HTML custom element, no framework, no build step, no bundler. It renders in any browser that supports WebGL, which is all of them.--## What <agent-3d> ships with--### An LLM brain with memory and emotions--The agent runs on the LLM you configure in the three.ws studio, Claude, GPT, and others. It has persistent memory across sessions so it remembers who it's talking to. Its emotion state, happy, curious, concerned, excited, is updated by the LLM with each response and drives the avatar's body language in real time.--### Physical DOM awareness--The agent knows what's on the page. It can read element content, observe DOM mutations, understand layout, and physically react to it. In demos: watch it hop from card to card as you scroll. It can point to specific UI elements when explaining them. It moves through the page's actual space, not floating in a fixed corner disconnected from the content.--### Password field privacy--When the browser's focus moves to an `input[type="password"]` element, the agent covers its eyes. It's a small interaction, but it immediately communicates that the agent is aware of what's happening, respects user privacy, and has social intelligence, not just chat capability.--### An on-chain identity that lives--Every agent is minted as a Solana NFT with an ERC-8004 cross-chain wallet. The on-chain identity is the agent's persistent self, it carries the agent's history, reputation, and accumulated interactions. The agent doesn't disappear when you close the tab. Its identity is on-chain and it persists anywhere it's embedded.--## Why a web component--Web components work everywhere HTML works. No React. No Next.js. No framework lock-in. You can drop `<agent-3d>` into a WordPress page, a Webflow site, a vanilla HTML file, or a React component tree, it behaves identically in all of them. The shadow DOM keeps the agent's internal structure isolated from the host page's styles, and the custom element API lets the host page communicate with the agent through standard attributes and events.--This was a deliberate choice. The internet is mostly not React. The 3D layer for the internet has to work on the whole internet.--## The action bridge--The agent communicates bidirectionally with the host page through a secure postMessage bridge. The host page can:--- Send events to the agent ("user clicked checkout", "price alert triggered", "form submitted")-- Set the agent's emotion or animation state from page JavaScript-- Receive events from the agent ("agent completed task", "user wants to pay", "agent needs clarification")--The bridge is gated by allowed origins, you configure which domains the agent will accept messages from in the Widget Studio. This is required: add your embedding domain to the allowed origins list or the action bridge will be blocked by CORS.--## CORS note for embedders--Add the domain you're embedding on to the widget's allowed origins list in the three.ws studio before going live. Without it, the action bridge is blocked and the agent won't be able to communicate with your page, it will still render and chat, but page-level integrations won't work.--## Get started--- Widget Studio: [three.ws/widget-studio](https://three.ws/widget-studio)-- Web component docs: [three.ws/docs](https://three.ws/docs)-- Open source: [github.com/nirholas/three.ws](https://github.com/nirholas/three.ws)-------Originally published at [three.ws/blog/agent-3d-web-component](https://three.ws/blog/agent-3d-web-component).diff --git a/data/x-content/queue.json b/data/x-content/queue.jsonindex 5f1d62dfb..3660a5c44 100644--- a/data/x-content/queue.json+++ b/data/x-content/queue.json@@ -30,6 +30,7 @@"posts": [{"text": "A sentence or a selfie becomes a rigged 3D agent holding its own custodial @solana wallet, a persona, and a voice. It walks and emotes on arrival: three.ws/genesis",+ "textFrom": "docs/announcements/genesis.post.txt","media": [{"path": "public/announce/img/genesis-hero.webp",@@ -52,6 +53,7 @@"posts": [{"text": "Approved for GitHub's Open Source Friday. Rig Doctor knows 11 rig conventions. Teaching it the 12th is an open first issue, and we merge it live on stream: three.ws/rig-doctor",+ "textFrom": "docs/announcements/open-source-friday.post.txt","media": [{"path": "public/announce/img/rig-doctor-hero.webp",@@ -74,6 +76,7 @@"posts": [{"text": "How we authorize autonomous spend, and the $THREE layer, on @awscloud: https://builder.aws.com/content/3JAVvvItd3ZSVjYCDb4qjj5VBb9/budgets-entitlements-and-the-dollarthree-token-layer-how-we-authorize-autonomous-agent-spending-or-threews-an-aws-partner",+ "textFrom": "docs/announcements/aws-builder-center-authorization-spine.post.txt","media": [{"path": "public/announce/img/aws-builder-center-authorization-spine.webp",@@ -82,30 +85,6 @@]}]- },- {- "id": "web-component-article",- "status": "draft",- "kind": "article",- "lane": "article",- "pattern": "longform",- "notBefore": "2026-09-17T17:00:00.000Z",- "source": {- "url": "https://three.ws/blog/agent-3d-web-component",- "importedAt": "2026-09-16T16:33:45.221Z"- },- "article": {- "title": "We Just Shipped the 3D Layer for the Internet: <agent-3d>",- "body": "data/x-content/articles/web-component-article.md",- "cover": {- "path": "public/x-media/web-component-article/00-cover.png"- }- },- "posts": [- {- "text": "One web component. An AI with a body, memory, emotions, and DOM awareness. Covers its eyes when you type a password. Lives on-chain."- }- ]}]}diff --git a/docs/announcements/README.md b/docs/announcements/README.mdindex 68dbed6bb..c31207e68 100644--- a/docs/announcements/README.md+++ b/docs/announcements/README.md@@ -54,12 +54,17 @@ affected files are kept out of the tree by `.gitignore` until approval is record## PostingNothing here posts. Publishing to an external channel is owner-gated every time. A finished pack-means the owner runs one command:+becomes an item in the [X content queue](../x-content-pipeline.md): its post names the pack file in+`textFrom`, so `npm run x:content:check` fails if the queued text drifts from the reviewed bytes,+and its media points at the captured frame. Preview exactly what would be sent:```bash-node scripts/post-tweet.mjs --file docs/announcements/<slug>.post.txt --dry-run+npm run x:content -- run --dry-run --id <slug>```+The queue publishes an item only after the owner sets it to `approved`. For a one-off post outside+the queue, `node scripts/post-tweet.mjs --file docs/announcements/<slug>.post.txt --dry-run` still works.+## Packs| Pack | Surface | Stage |diff --git a/docs/start-here.md b/docs/start-here.mdindex 35100b4f5..f8fe39e09 100644--- a/docs/start-here.md+++ b/docs/start-here.md@@ -224,6 +224,7 @@ Deeper references that don't fit a track above but answer real questions:- [The 3D viewer](./viewer.md): the rendering layer reference (model loading, cameras, animation, lighting)- [Avatar Artifact](./avatar-artifact.md): the standalone viewer page, its ?agent= and ?model= parameters, and the iframe you paste anywhere- [Farcaster memory seeding](./farcaster-memory-seeding.md): give an agent your Farcaster voice, proved with a wallet the account already verified, and revoke it in one click+- [X content pipeline](./x-content-pipeline.md): how @trythreews publishes native video, images, threads, blog shares, and full X Articles from one reviewed queue on a human cadence- [X memory seeding](./x-memory-seeding.md): seed an agent from your public X posts behind an explicit, versioned consent you can revoke (revocation deletes what the seed wrote)- [GitHub memory seeding](./github-memory-seeding.md): tick the profile, repositories, and READMEs your agent may read, and nothing outside that list is ever fetched or stored (disconnecting deletes every fact it wrote)- [Memory seed connectors](./api-reference.md#memory-seed-connectors-api): the public read-only lane behind the seeding demo. Turn a GitHub, X, or Farcaster handle into a footprint payload, then synthesize a memory seed from any subset of themdiff --git a/docs/x-content-pipeline.md b/docs/x-content-pipeline.mdnew file mode 100644index 000000000..f2da1101c--- /dev/null+++ b/docs/x-content-pipeline.md@@ -0,0 +1,130 @@+# The X content pipeline++How @trythreews publishes posts, threads, native video, blog shares, and full X+Articles on a human cadence, from one reviewed queue.++This is internal marketing infrastructure. Nothing reaches X without two owner+decisions: an item's `status` set to `approved`, and auto-publishing switched on+for the Cloud Run service (or the owner running one publish by hand).++---++## Why it exists++Posting to X from a script is easy. Posting in a way that does not read as a+bot is the hard part. Most automated accounts give themselves away the same way:+a link card instead of real media, a launch-deck opener, a hashtag, a post at+14:00:00 every day, the same format three times in a row, and a thread that+double-posts when the job retries. Every one of those is a rule in this+pipeline, enforced before anything is sent:++| Tell | What the pipeline does |+|---|---|+| Link cards and text-only posts | The head post must carry a native image, GIF, or video (`"textOnly": true` opts out on purpose). Media is uploaded to X, not linked. |+| Missing alt text | Every image and GIF needs alt text, sent to X as media metadata. |+| Silent autoplay | `prepare-video` burns captions into the clip, because most of the feed watches muted. |+| Hype copy | [api/_lib/x-content/quality.js](../api/_lib/x-content/quality.js) rejects launch openers ("Introducing", "We're excited"), hype vocabulary, hashtags, emoji, stacked exclamation marks, all-caps shouting, and en or em dashes. |+| Repeats | A head that reads too much like another queued item, or like anything @trythreews already posted (the scraped archive in `data/archives/` plus everything this pipeline published), is rejected. |+| Clockwork timing | Each item lands at a stable, jittered minute inside a window after its `notBefore`, with a minimum gap, a daily cap, and quiet hours. |+| Same format on repeat | Lane (audience) and pattern (post shape) rotate. A due item waits if it would repeat the previous lane or pattern too many times, unless it has been waiting a full day. |+| Retry double-posts | Every created media id, post id, and Article id is written to the ledger the moment X returns it. A crash mid-thread resumes at the next unposted reply. |++## What it can publish++| Kind | What goes out |+|---|---|+| `post` | One post, or a thread when `posts` has more than one entry. Each post may carry up to four images, or exactly one GIF or one video. |+| `post` imported from a blog or any URL | A native-image post with the page's own image and the canonical link, drafted by `import --as post`. |+| `article` | A full X Article (title, cover, headings, lists, quotes, links, inline images, code, tables) created with `POST /2/articles/draft` and published with `POST /2/articles/:id/publish`, followed by posts that quote it. |+| `article` imported from a blog or any URL | The page converted to Markdown with its images saved locally, drafted by `import --as article`, ending with an "Originally published at" link to the canonical page. |++X Articles require the posting account to be on X Premium.++## Where things live++| Path | Role |+|---|---|+| [data/x-content/queue.json](../data/x-content/queue.json) | The queue: cadence, quality limits, and every item. |+| `data/x-content/articles/<id>.md` | Article bodies, in Markdown. |+| `public/x-media/<id>/` | Media for queue items. Media must live under `public/` or `data/` so it ships inside the production image. |+| [api/_lib/x-content/](../api/_lib/x-content/) | The engine: quality lint, media rules, Markdown to Article conversion, scheduler, publisher, ledger. |+| [api/cron/x-content.js](../api/cron/x-content.js) | The Cloud Scheduler tick, every 15 minutes. |+| [scripts/x-content.mjs](../scripts/x-content.mjs) | The operator CLI. |+| `app_settings` row `x_content` | The publish ledger, shared by the cron and the CLI. |++## Queue item format++```json+{+ "id": "rig-doctor-clip",+ "status": "review",+ "kind": "post",+ "lane": "developer",+ "pattern": "clip",+ "notBefore": "2026-09-20T15:00:00Z",+ "windowMinutes": 90,+ "posts": [+ {+ "text": "Drop a GLB on Rig Doctor and it names the skeleton convention before the bones finish loading: three.ws/rig-doctor",+ "textFrom": "docs/announcements/open-source-friday.post.txt",+ "media": [{ "path": "public/x-media/rig-doctor-clip/clip.mp4", "probe": { "durationSec": 18.2, "width": 1920, "height": 1080, "fps": 60, "videoCodec": "h264", "pixFmt": "yuv420p", "audioCodec": "aac" } }]+ },+ { "text": "Eleven rig conventions so far. The twelfth is an open first issue." }+ ]+}+```++- `status`: `draft` (may be unfinished), `review` (must pass `check`), `approved` (eligible to publish), `paused`, `posted`.+- `lane` and `pattern` are free-form labels; rotation compares them against what was published last.+- `textFrom` is optional. When set, `check` fails if the inline text differs from that announcement-pack file, so the copy that was reviewed is the copy that ships.+- An `article` item carries `"article": { "title", "body", "cover": { "path" } }`, and its optional `posts` quote the published Article.++Cadence lives at the top of the file: `windowMinutes`, `minimumMinutesApart`, `dailyCap`, and `quietHoursUtc` (a `["HH:MM", "HH:MM"]` pair, which may wrap midnight). `quality` sets the similarity limits and the maximum same-lane and same-pattern runs.++## Workflow++```bash+# 1. Draft from something that already exists+npm run x:content -- import agent-3d-web-component --as post --id web-component-share+npm run x:content -- import https://three.ws/blog/agent-3d-web-component --as article --id web-component-article+npm run x:content -- import https://example.com/our-guest-post --as article --id guest-post++# 2. Video: transcode to X's spec, burn in captions, and record the probe on the item+npm run x:content -- prepare-video ~/Desktop/rig-doctor.mov --out public/x-media/rig-doctor-clip/clip.mp4 --captions ~/Desktop/rig-doctor.srt --item rig-doctor-clip++# 3. Rewrite the imported copy in your own voice, then validate+npm run x:content:check++# 4. See exactly what would be sent, and when the queue will send it+npm run x:content -- run --dry-run --id web-component-article+npm run x:content:plan+```++`import` accepts a blog slug from `blog/`, a three.ws URL (read from this checkout, so it works before a deploy), or any public URL. SVG and AVIF images are rasterized, and oversized images are recompressed to fit X's 5 MB limit. Imports always land as `draft`: the importer cannot know your voice, and the lint cannot either, so a human rewrites the copy before it moves to `review`.++Images for other channels come from [the announcement capture tool](./announcements/README.md) (`npm run announce:media`), which records frames from the live product; point queue media at those files.++## Going live++Posting is owner-gated. The cron ships in preview mode: with `X_CONTENT_AUTO_PUBLISH` unset, each tick returns the exact API calls it would make, which is how the queue is verified in production first.++1. The @trythreews user tokens must be on the Cloud Run service. `X_API_KEY` and `X_API_SECRET` are already there; `X_ACCESS_TOKEN` and `X_ACCESS_SECRET` (generated for @trythreews in the X developer portal, with Read and Write) must be added with `gcloud run services update three-ws-api --region us-central1 --update-secrets` or `--update-env-vars`.+2. Deploy, which bakes the queue and media into the image, and sync the Cloud Scheduler job from `vercel.json` with [scripts/create-gcp-scheduler.mjs](../scripts/create-gcp-scheduler.mjs).+3. Read a preview tick: the scheduler job's response, or `gcloud logging read 'resource.type="cloud_run_revision" resource.labels.service_name="three-ws-api" textPayload:"x-content"' --freshness=1h`.+4. Set items to `approved` and deploy. To publish one item by hand instead of waiting: `npm run x:content -- run --id <slug>` (needs `DATABASE_URL`, so the ledger prevents a double post).+5. To publish automatically: `gcloud run services update three-ws-api --region us-central1 --update-env-vars X_CONTENT_AUTO_PUBLISH=true`.++Queue edits reach production with the next deploy, because the cron reads the queue from the image. The ledger is in the database, so a redeploy never republishes anything.++## Limits enforced++| Media | Limit |+|---|---|+| Image (JPG, PNG, WEBP) | 5 MB, up to four per post, alt text up to 1,000 characters |+| GIF | 15 MB, alone on its post |+| Video (MP4, MOV) | 512 MB, 0.5 to 140 s, 32 px to 1920x1200, aspect 1:3 to 3:1, up to 60 fps, H.264 yuv420p with AAC audio, alone on its post |+| Article | Title under 100 characters, a cover image, at least three blocks, code and tables totalling 10,000 characters or fewer |++## Tests++[tests/x-content.test.js](../tests/x-content.test.js) covers the lint, the media rules, the Markdown to Article offsets, the scheduler's jitter, spacing, cap, rotation, and resume rules, and the publisher's thread chaining, crash resume, and Article draft, publish, and quote sequence.diff --git a/public/x-media/web-component-article/00-cover.png b/public/x-media/web-component-article/00-cover.pngdeleted file mode 100644index fd935a083..000000000Binary files a/public/x-media/web-component-article/00-cover.png and /dev/null differdiff --git a/scripts/audit-docs.mjs b/scripts/audit-docs.mjsindex 160af62fd..a0961b69a 100644--- a/scripts/audit-docs.mjs+++ b/scripts/audit-docs.mjs@@ -367,6 +367,7 @@ const UNPUBLISHED_DOCS = new Map([['trading-experiment', 'owner-gated: names a crypto project other than $THREE'],['trading-hub', 'in-flight: landed mid-session, register with its /trading page'],['x402-solana-july-roundup-response', 'internal: ready-to-paste X reply draft; posting is owner-gated'],+ ['x-content-pipeline', 'internal: owner-gated @trythreews publishing queue runbook'],['x-archive', 'internal: marketing analytics over our own X timeline, not a reader-facing product doc'],['x-accounts', 'internal: which X handle is live and what the unposted drafts do about it; account operations, not a reader-facing product doc'],['x-account-appeal', 'internal: the founder account suspension appeal packet; account operations, not a reader-facing product doc'],diff --git a/tests/x-content.test.js b/tests/x-content.test.jsnew file mode 100644index 000000000..18a15d3d4--- /dev/null+++ b/tests/x-content.test.js@@ -0,0 +1,254 @@+import { describe, it, expect } from 'vitest';+import { mkdtempSync, mkdirSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';++import { copyProblems, weightedLength } from '../api/_lib/x-content/quality.js';+import { attachmentProblems, mediaProblems, parseFfmpegProbe } from '../api/_lib/x-content/media.js';+import { markdownToContentState, attachArticleMedia } from '../api/_lib/x-content/articles.js';+import { dueAt, inQuietHours, jitterMinutes, pickDue } from '../api/_lib/x-content/schedule.js';+import { validateItem, validateQueue, loadQueue } from '../api/_lib/x-content/queue.js';+import { previewClient, publishItem } from '../api/_lib/x-content/publisher.js';++const root = process.cwd();+const HOUR = 3_600_000;++function sandbox() {+ const dir = mkdtempSync(join(tmpdir(), 'x-content-'));+ mkdirSync(join(dir, 'public/x-media/t'), { recursive: true });+ mkdirSync(join(dir, 'data/x-content/articles'), { recursive: true });+ writeFileSync(join(dir, 'public/x-media/t/a.png'), Buffer.alloc(64));+ writeFileSync(join(dir, 'public/x-media/t/b.png'), Buffer.alloc(64));+ writeFileSync(join(dir, 'public/x-media/t/clip.mp4'), Buffer.alloc(64));+ return dir;+}++const HEAD = 'Rig Doctor names the skeleton convention of any humanoid GLB, then lists which bones animate and which stay put: three.ws/rig-doctor';++describe('quality', () => {+ it('weights URLs as 23 characters', () => {+ expect(weightedLength('see https://three.ws/a/very/long/path/that/keeps/going')).toBe(4 + 23);+ });++ it('flags the tells of an automated feed', () => {+ const problems = copyProblems('Introducing our REVOLUTIONARY AMAZING tool!!! #ai', { minimum: 1 });+ expect(problems.join('\n')).toMatch(/banned opening/);+ expect(problems.join('\n')).toMatch(/hashtags/);+ expect(problems.join('\n')).toMatch(/exclamation/);+ expect(problems.join('\n')).toMatch(/shouting/);+ expect(problems.join('\n')).toMatch(/must link/);+ });++ it('allows tickers and acronyms in capitals', () => {+ expect(copyProblems('$THREE holders get GLTF exports over HTTP on three.ws/pay', { minimum: 1 })).toEqual([]);+ });++ it('does not require a link when the item links elsewhere', () => {+ expect(copyProblems('The rig runs on our own GPU workers.', { minimum: 1, requireUrl: false })).toEqual([]);+ });+});++describe('media', () => {+ it('allows four images, or one video or GIF alone', () => {+ const img = (n) => ({ path: `public/x-media/t/${n}.png` });+ expect(attachmentProblems([img(1), img(2), img(3), img(4)])).toEqual([]);+ expect(attachmentProblems([img(1), img(2), img(3), img(4), img(5)])).toHaveLength(1);+ expect(attachmentProblems([{ path: 'public/x-media/t/clip.mp4' }, img(1)])).toHaveLength(1);+ });++ it('requires alt text on images and media inside the image', () => {+ const dir = sandbox();+ expect(mediaProblems({ path: 'public/x-media/t/a.png' }, dir)).toEqual(['public/x-media/t/a.png: needs alt text']);+ expect(mediaProblems({ path: 'public/x-media/t/a.png', alt: 'a hero shot' }, dir)).toEqual([]);+ expect(mediaProblems({ path: 'docs/a.png', alt: 'x' }, dir).join('\n')).toMatch(/must live under/);+ });++ it('requires a probe within X video limits', () => {+ const dir = sandbox();+ const path = 'public/x-media/t/clip.mp4';+ expect(mediaProblems({ path }, dir).join('\n')).toMatch(/no probe/);+ const good = { durationSec: 12, width: 1280, height: 720, fps: 30, videoCodec: 'h264', pixFmt: 'yuv420p', audioCodec: 'aac' };+ expect(mediaProblems({ path, probe: good }, dir)).toEqual([]);+ const bad = mediaProblems({ path, probe: { ...good, durationSec: 200, width: 3840, videoCodec: 'hevc' } }, dir).join('\n');+ expect(bad).toMatch(/duration/);+ expect(bad).toMatch(/3840x720/);+ expect(bad).toMatch(/h264/);+ });++ it('parses ffmpeg stream info into a probe', () => {+ const stderr = [+ ' Duration: 00:00:06.03, start: 0.000000, bitrate: 6112 kb/s',+ ' Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 5972 kb/s, 60 fps, 60 tbr, 15360 tbn (default)',+ ' Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)',+ ].join('\n');+ expect(parseFfmpegProbe(stderr)).toEqual({ durationSec: 6.03, width: 1920, height: 1080, fps: 60, videoCodec: 'h264', pixFmt: 'yuv420p', audioCodec: 'aac' });+ });+});++describe('articles', () => {+ it('maps inline styles and links onto correct offsets', () => {+ const { content_state } = markdownToContentState('Drop one `<agent-3d>` tag & go. **Bold [link](https://three.ws) text** and ~~old~~.');+ const [block] = content_state.blocks;+ expect(block.text).toBe('Drop one <agent-3d> tag & go. Bold link text and old.');+ const bold = block.inline_style_ranges.find((range) => range.style === 'bold');+ expect(block.text.substr(bold.offset, bold.length)).toBe('Bold link text');+ const strike = block.inline_style_ranges.find((range) => range.style === 'strikethrough');+ expect(block.text.substr(strike.offset, strike.length)).toBe('old');+ const [link] = block.entity_ranges;+ expect(block.text.substr(link.offset, link.length)).toBe('link');+ expect(content_state.entities[link.key].value).toEqual({ type: 'link', mutability: 'mutable', data: { url: 'https://three.ws' } });+ });++ it('turns structure into block types and atomic embeds', () => {+ const md = '# One\n\n## Two\n\n### Three\n\n- a\n- b\n\n1. c\n\n> quote\n\n---\n\n```js\nx()\n```\n\n| a | b |\n|---|---|\n| 1 | 2 |';+ const { content_state, markdownWeight } = markdownToContentState(md);+ expect(content_state.blocks.map((block) => block.type)).toEqual([+ 'header-one', 'header-two', 'header-three', 'unordered-list-item', 'unordered-list-item', 'ordered-list-item', 'blockquote', 'atomic', 'atomic', 'atomic',+ ]);+ expect(content_state.entities.map((entity) => entity.value.type)).toEqual(['divider', 'markdown', 'markdown']);+ expect(markdownWeight).toBeGreaterThan(0);+ });++ it('resolves local images and attaches uploaded media ids', () => {+ const { content_state, images, warnings } = markdownToContentState('\n\n', {+ articlePath: 'data/x-content/articles/demo.md',+ });+ expect(images).toEqual([{ entityIndex: 0, path: 'public/x-media/t/a.png', caption: 'Hero' }]);+ expect(warnings).toHaveLength(1);+ const attached = attachArticleMedia(content_state, images, ['123']);+ expect(attached.entities[0].value.data.media_items).toEqual([{ media_category: 'tweet_image', media_id: '123' }]);+ expect(content_state.entities[0].value.data.media_items).toEqual([]);+ });+});++describe('schedule', () => {+ const item = (id, over = {}) => ({ id, status: 'approved', kind: 'post', lane: 'community', pattern: 'mechanism', notBefore: '2026-09-17T14:00:00Z', ...over });+ const cadence = { windowMinutes: 60, minimumMinutesApart: 240, dailyCap: 3 };++ it('jitters deterministically inside the window', () => {+ expect(jitterMinutes('genesis', 60)).toBe(jitterMinutes('genesis', 60));+ const at = dueAt(item('genesis'), cadence);+ expect(at).toBeGreaterThanOrEqual(Date.parse('2026-09-17T14:00:00Z'));+ expect(at).toBeLessThan(Date.parse('2026-09-17T15:00:00Z'));+ });++ it('handles quiet hours that wrap midnight', () => {+ expect(inQuietHours(Date.parse('2026-09-17T23:30:00Z'), ['22:00', '06:00'])).toBe(true);+ expect(inQuietHours(Date.parse('2026-09-17T12:00:00Z'), ['22:00', '06:00'])).toBe(false);+ });++ it('waits for the jittered moment, then spacing, then the daily cap', () => {+ const now = Date.parse('2026-09-17T16:00:00Z');+ expect(pickDue({ items: [item('a')], state: {}, now: Date.parse('2026-09-17T13:00:00Z'), cadence }).item).toBeNull();+ expect(pickDue({ items: [item('a')], state: {}, now, cadence }).item.id).toBe('a');+ const recent = { published: [{ id: 'z', lane: 'x', pattern: 'y', publishedAt: new Date(now - HOUR).toISOString() }] };+ expect(pickDue({ items: [item('a')], state: recent, now, cadence }).reason).toMatch(/spacing/);+ const capped = { published: [5, 11, 17].map((h, i) => ({ id: `p${i}`, lane: 'x', pattern: 'y', publishedAt: new Date(now - h * HOUR).toISOString() })) };+ expect(pickDue({ items: [item('a')], state: capped, now, cadence }).reason).toMatch(/daily cap/);+ });++ it('rotates lanes and patterns but never starves a one-lane queue', () => {+ const now = Date.parse('2026-09-17T16:00:00Z');+ const state = { published: [{ id: 'p', lane: 'community', pattern: 'mechanism', publishedAt: new Date(now - 5 * HOUR).toISOString() }] };+ const quality = { maximumSameLaneInARow: 2, maximumSamePatternInARow: 1 };+ const picked = pickDue({ items: [item('same'), item('fresh', { pattern: 'number', notBefore: '2026-09-17T14:30:00Z' })], state, now, cadence, quality });+ expect(picked.item.id).toBe('fresh');+ expect(pickDue({ items: [item('same')], state, now, cadence, quality }).item).toBeNull();+ expect(pickDue({ items: [item('same')], state, now: now + 26 * HOUR, cadence, quality }).item.id).toBe('same');+ });++ it('resumes a half-published item ahead of pacing', () => {+ const now = Date.parse('2026-09-17T16:00:00Z');+ const state = {+ published: [{ id: 'p', lane: 'x', pattern: 'y', publishedAt: new Date(now - 10 * 60_000).toISOString() }],+ inflight: { a: { media: {}, postIds: ['1'] } },+ };+ expect(pickDue({ items: [item('a')], state, now, cadence }).resuming).toBe(true);+ });+});++describe('queue', () => {+ it('keeps the committed queue valid for every item headed to X', () => {+ const queue = loadQueue(root);+ const { problems } = validateQueue(queue, root);+ for (const item of queue.items.filter((row) => row.status === 'approved')) expect(problems[item.id]).toEqual([]);+ });++ it('requires media on the head post unless text-only is explicit', () => {+ const dir = sandbox();+ const base = { id: 'demo', status: 'review', kind: 'post', lane: 'l', pattern: 'p', notBefore: '2026-09-17T14:00:00Z' };+ expect(validateItem({ ...base, posts: [{ text: HEAD }] }, dir).join('\n')).toMatch(/no media/);+ expect(validateItem({ ...base, textOnly: true, posts: [{ text: HEAD }] }, dir)).toEqual([]);+ });++ it('validates an Article end to end', () => {+ const dir = sandbox();+ writeFileSync(join(dir, 'data/x-content/articles/demo.md'), '## Why\n\nBecause.\n\n\n\nThe end.');+ const item = {+ id: 'demo', status: 'review', kind: 'article', lane: 'article', pattern: 'longform', notBefore: '2026-09-17T14:00:00Z',+ article: { title: 'How rigs get named', body: 'data/x-content/articles/demo.md', cover: { path: 'public/x-media/t/a.png' } },+ posts: [{ text: 'The long version of how Rig Doctor reads a skeleton.' }],+ };+ expect(validateItem(item, dir)).toEqual([]);+ expect(validateItem({ ...item, article: { ...item.article, cover: undefined } }, dir).join('\n')).toMatch(/cover/);+ });+});++describe('publisher', () => {+ const store = (log) => ({ save: async (state) => log.push(structuredClone(state)) });++ it('chains a thread with media and alt text on the head', async () => {+ const dir = sandbox();+ const client = previewClient();+ const state = { published: [], inflight: {} };+ const item = {+ id: 'demo', kind: 'post', lane: 'l', pattern: 'p',+ posts: [{ text: HEAD, media: [{ path: 'public/x-media/t/a.png', alt: 'alt one' }] }, { text: 'second' }],+ };+ const row = await publishItem({ item, client, root: dir, state, store: store([]) });+ expect(client.calls.map((call) => call.call)).toEqual(['media.upload', 'media.metadata', 'tweets.create', 'tweets.create']);+ expect(client.calls[3].reply.in_reply_to_tweet_id).toBe(row.postIds[0]);+ expect(state.inflight).toEqual({});+ expect(state.published[0].url).toBe(`https://x.com/trythreews/status/${row.postIds[0]}`);+ });++ it('resumes after a failure without reposting what already went out', async () => {+ const dir = sandbox();+ const state = { published: [], inflight: {} };+ const item = { id: 'demo', kind: 'post', lane: 'l', pattern: 'p', posts: [{ text: HEAD }, { text: 'two' }, { text: 'three' }] };+ const flaky = previewClient();+ const tweet = flaky.tweet;+ let calls = 0;+ flaky.tweet = async (payload) => {+ if (++calls === 2) throw new Error('X 503');+ return tweet(payload);+ };+ await expect(publishItem({ item, client: flaky, root: dir, state, store: store([]) })).rejects.toThrow('X 503');+ expect(state.inflight.demo.postIds).toHaveLength(1);++ const retry = previewClient();+ await publishItem({ item, client: retry, root: dir, state, store: store([]) });+ expect(retry.calls.map((call) => call.text)).toEqual(['two', 'three']);+ expect(retry.calls[0].reply.in_reply_to_tweet_id).toBe(state.published[0].postIds[0]);+ });++ it('drafts, publishes, then quotes an Article', async () => {+ const dir = sandbox();+ writeFileSync(join(dir, 'data/x-content/articles/demo.md'), '## Why\n\n\n\nText.');+ const client = previewClient();+ const state = { published: [], inflight: {} };+ const item = {+ id: 'demo', kind: 'article', lane: 'article', pattern: 'longform',+ article: { title: 'Title', body: 'data/x-content/articles/demo.md', cover: { path: 'public/x-media/t/a.png' } },+ posts: [{ text: 'Quote post' }],+ };+ const row = await publishItem({ item, client, root: dir, state, store: store([]) });+ const draft = client.calls.find((call) => call.call === 'POST /2/articles/draft');+ expect(draft.body.cover_media.media_category).toBe('tweet_image');+ const image = draft.body.content_state.entities.find((entity) => entity.value.type === 'image');+ expect(image.value.data.media_items[0].media_id).toMatch(/^preview-media/);+ const quote = client.calls.at(-1);+ expect(quote.quote_tweet_id).toBe(row.articlePostId);+ expect(row.url).toBe(`https://x.com/trythreews/status/${row.articlePostId}`);+ });+});diff --git a/vercel.json b/vercel.jsonindex eb0a4588c..c1ba0c29d 100644--- a/vercel.json+++ b/vercel.json@@ -6539,6 +6539,10 @@"path": "/api/cron/changelog-push","schedule": "*/20 * * * *"},+ {+ "path": "/api/cron/x-content",+ "schedule": "*/15 * * * *"+ },{"path": "/api/cron/commit-feed-push","schedule": "*/5 * * * *"