Files
seo-agent/injector/wrangler.example.jsonc
Alan Wizemann 5ae6222cd2 feat: resource overrides + llms.txt generation and edge serving
New override kind `resource:<path>` (JSON {contentType, body}) with paths
and content types pinned per field (RESOURCE_FIELDS) so the proposal flow
can't publish arbitrary bytes at arbitrary keys. buildLlmsTxt generates a
markdown page index from crawl snapshots (200-entry cap, per-entry clipping,
markdown escaping, noindex/error skips); createLlmsTxtProposal reuses the
proposals lifecycle (field 'llms_txt') — approve journals + publishes,
revert restores or deletes. Injector serves resource overrides for an
allowlist (/llms.txt, /llms-full.txt) in KV and remote mode, never
shadowing an origin-served file, fail-open as always.
2026-08-01 15:55:19 -04:00

43 lines
2.2 KiB
JSON

{
// Copy to wrangler.jsonc and fill in. Deploy this Worker on a route in FRONT
// of the site you want the seo-agent to optimize (a static Pages site, an S3
// origin, etc. — anything behind Cloudflare you can't add middleware to).
"$schema": "node_modules/wrangler/config-schema.json",
"name": "seo-injector",
"main": "./src/index.ts",
"compatibility_date": "2025-06-17",
"observability": { "enabled": true },
// The hostname to front. The Worker intercepts these requests, proxies them
// to ORIGIN_HOST, and patches the <head> when an override exists.
"routes": [{ "pattern": "www.example.com/*", "zone_name": "example.com" }],
// The SAME KV namespace your seo-agent writes overrides to.
// REMOTE MODE alternative: if the agent's KV can't be bound from this zone
// (agent in another account, or a hosted service), delete this binding and
// set OVERRIDES_URL (+ EDGE_TOKEN as a secret) in vars instead — the
// injector fetches `${OVERRIDES_URL}/override?path=<pathname>` over HTTPS
// with a 300s edge cache. Same JSON contract. A KV binding, if present, wins.
// Resource overrides (llms.txt, llms-full.txt) have the same remote twin:
// `${OVERRIDES_URL}/resource?path=<pathname>`, same bearer, same edge cache.
// Telemetry has the same twin: set TELEMETRY_URL instead of the D1 binding.
"kv_namespaces": [{ "binding": "SEO_OVERRIDES", "id": "REPLACE_WITH_YOUR_KV_NAMESPACE_ID" }],
// OPTIONAL — AEO telemetry tap: bind the seo-agent's D1 database and the
// injector records AI-relevant traffic (AI-crawler hits, AI referrals,
// markdown-lane responses) into its aeo_hits table. Remove to disable.
// "d1_databases": [
// { "binding": "TELEMETRY", "database_name": "seo-agent-db", "database_id": "REPLACE_WITH_YOUR_D1_DATABASE_ID" }
// ],
"vars": {
// Origin to proxy to — where the real content is served from. Must be a
// DIFFERENT host than the route above (no proxy loop).
"ORIGIN_HOST": "example-origin.pages.dev",
// Markdown lane: answer `Accept: text/markdown` on clean URLs with the
// origin's pregenerated `<path>.md` twin when one exists (on by default;
// "false" disables). See README "Markdown for agents".
"MARKDOWN_LANE": "true"
}
}