{"_id":"@affectively/aeon-pages","_rev":"5-0503ba2a2af96d31abb426d8c45db266","name":"@affectively/aeon-pages","dist-tags":{"latest":"1.5.0"},"versions":{"1.3.0":{"name":"@affectively/aeon-pages","version":"1.3.0","keywords":["aeon","flux","crdt","framework","collaborative","cms","real-time","bun","cloudflare","d1","durable-objects","wasm","skeleton","zero-cls","performance"],"author":{"name":"AFFECTIVELY"},"license":"MIT","_id":"@affectively/aeon-pages@1.3.0","maintainers":[{"name":"buley","email":"buley@outlook.com"}],"homepage":"https://github.com/affectively-ai/aeon-flux#readme","bugs":{"url":"https://github.com/affectively-ai/aeon-flux/issues"},"bin":{"aeon":"packages/cli/dist/index.js"},"dist":{"shasum":"129ee08a1e4363ff97597243a257040021f2e63a","tarball":"https://registry.npmjs.org/@affectively/aeon-pages/-/aeon-pages-1.3.0.tgz","fileCount":124,"integrity":"sha512-0XaYXyz3HcHXB6ayTXPdyN+623bj5XUPnO1G/bz2maYsQoJH8NxDByrgR6+MDgGwAr5r72ACI5mQKUNnjxFULw==","signatures":[{"sig":"MEUCIAc5Fp6SWjWTpc5KmFU8d+MEnwCaFfsoQcx2nItOLbARAiEAp4RR4e30Jnbmn/hN/J8ZAMOCZskvms8IxlJaw+aTVvU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3976891},"main":"./packages/runtime/dist/index.js","type":"module","types":"./packages/runtime/dist/index.d.ts","engines":{"bun":">=1.0.0"},"exports":{".":{"types":"./packages/runtime/dist/index.d.ts","import":"./packages/runtime/dist/index.js"},"./esi":{"types":"./packages/runtime/dist/router/index.d.ts","import":"./packages/runtime/dist/router/index.js"},"./auth":{"types":"@affectively/auth","import":"@affectively/auth"},"./react":{"types":"./packages/react/dist/index.d.ts","import":"./packages/react/dist/index.js"},"./server":{"types":"./packages/runtime/dist/server.d.ts","import":"./packages/runtime/dist/server.js"},"./runtime":{"types":"./packages/runtime/dist/index.d.ts","import":"./packages/runtime/dist/index.js"},"./directives":{"types":"./packages/directives/dist/use-aeon.d.ts","import":"./packages/directives/dist/use-aeon.js"}},"gitHead":"8f86b03b7266c4009fd952b1124f8f336be9e12a","scripts":{"dev":"bun run packages/cli/src/dev.ts","test":"bun test","build":"bun run build:wasm && bun run build:ts","clean":"rm -rf packages/*/dist packages/runtime/wasm","build:ts":"bun run --filter='./packages/*' build","build:wasm":"cd packages/runtime-wasm && wasm-pack build --target web --out-dir ../runtime/wasm"},"_npmUser":{"name":"buley","email":"buley@outlook.com"},"deprecated":"This package is deprecated and no longer supported. Do not use.","repository":{"url":"git+https://github.com/affectively-ai/aeon-flux.git","type":"git"},"workspaces":["packages/*"],"_npmVersion":"11.8.0","description":"Collaborative page surface with CRDT-based flux state, Edge Side Inference, and zero-CLS rendering. Pages that think.","directories":{},"_nodeVersion":"25.5.0","dependencies":{"@affectively/aeon":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"wasm-pack":"^0.13.0","@types/bun":"latest","typescript":"^5.7.0","@types/react":"^18.0.0"},"peerDependencies":{"bun":">=1.0.0","react":">=18.0.0","@affectively/auth":">=0.1.0"},"peerDependenciesMeta":{"@affectively/auth":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/aeon-pages_1.3.0_1770792645182_0.508965762759886","host":"s3://npm-registry-packages-npm-production"}},"1.4.0":{"name":"@affectively/aeon-pages","version":"1.4.0","keywords":["aeon","flux","crdt","framework","collaborative","cms","real-time","bun","cloudflare","d1","durable-objects","wasm","skeleton","zero-cls","performance"],"author":{"name":"AFFECTIVELY"},"license":"MIT","_id":"@affectively/aeon-pages@1.4.0","maintainers":[{"name":"buley","email":"buley@outlook.com"}],"homepage":"https://github.com/affectively-ai/aeon-flux#readme","bugs":{"url":"https://github.com/affectively-ai/aeon-flux/issues"},"bin":{"aeon":"packages/cli/dist/index.js"},"dist":{"shasum":"4002c76f3f99cc21288f86107079c391812d52b8","tarball":"https://registry.npmjs.org/@affectively/aeon-pages/-/aeon-pages-1.4.0.tgz","fileCount":125,"integrity":"sha512-ZduTOXNYVxuYy/28SdFiCm3k1ldpVo9IUDnMS2KuZYgH9zyBU50Qf4gqUGnLPzQdooHUfFgegvQAI5bItE4Tpw==","signatures":[{"sig":"MEYCIQCDZvKpGU2T04Ar8Xe73YwQxbUwYJ/G7JSiEnuZoMaGgwIhAOFcuDO3kRFbEx3nrdy0GBfFTjSp2V5UGLSPcY6CExv0","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4044616},"main":"./packages/runtime/dist/index.js","type":"module","types":"./packages/runtime/dist/index.d.ts","engines":{"bun":">=1.0.0"},"exports":{".":{"types":"./packages/runtime/dist/index.d.ts","import":"./packages/runtime/dist/index.js"},"./esi":{"types":"./packages/runtime/dist/router/index.d.ts","import":"./packages/runtime/dist/router/index.js"},"./auth":{"types":"@affectively/auth","import":"@affectively/auth"},"./react":{"types":"./packages/react/dist/index.d.ts","import":"./packages/react/dist/index.js"},"./server":{"types":"./packages/runtime/dist/server.d.ts","import":"./packages/runtime/dist/server.js"},"./runtime":{"types":"./packages/runtime/dist/index.d.ts","import":"./packages/runtime/dist/index.js"},"./directives":{"types":"./packages/directives/dist/use-aeon.d.ts","import":"./packages/directives/dist/use-aeon.js"}},"gitHead":"bb1338854cc76c0863a7b6dbf129a564646412ee","scripts":{"dev":"bun run packages/cli/src/dev.ts","test":"bun test","build":"bun run build:wasm && bun run build:ts","clean":"rm -rf packages/*/dist packages/runtime/wasm","build:ts":"bun run --filter='./packages/*' build","build:wasm":"cd packages/runtime-wasm && wasm-pack build --target web --out-dir ../runtime/wasm"},"_npmUser":{"name":"buley","email":"buley@outlook.com"},"deprecated":"This package is deprecated and no longer supported. Do not use.","repository":{"url":"git+https://github.com/affectively-ai/aeon-flux.git","type":"git"},"workspaces":["packages/*"],"_npmVersion":"11.8.0","description":"Collaborative page surface with CRDT-based flux state, Edge Side Inference, and zero-CLS rendering. Pages that think.","directories":{},"_nodeVersion":"25.5.0","dependencies":{"@affectively/aeon":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"wasm-pack":"^0.13.0","@types/bun":"latest","typescript":"^5.7.0","@types/react":"^18.0.0"},"peerDependencies":{"bun":">=1.0.0","react":">=18.0.0","@affectively/auth":">=0.1.0"},"peerDependenciesMeta":{"@affectively/auth":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/aeon-pages_1.4.0_1770950482747_0.3884838772561767","host":"s3://npm-registry-packages-npm-production"}},"1.5.0":{"name":"@affectively/aeon-pages","version":"1.5.0","keywords":["aeon","flux","crdt","framework","collaborative","cms","real-time","bun","cloudflare","d1","durable-objects","wasm","skeleton","zero-cls","performance"],"author":{"name":"AFFECTIVELY"},"license":"MIT","_id":"@affectively/aeon-pages@1.5.0","maintainers":[{"name":"buley","email":"buley@outlook.com"}],"homepage":"https://github.com/affectively-ai/aeon-flux#readme","bugs":{"url":"https://github.com/affectively-ai/aeon-flux/issues"},"bin":{"aeon":"packages/cli/dist/index.js"},"dist":{"shasum":"34b62c7ffcb0f8d1802834f55944a6514f2e417c","tarball":"https://registry.npmjs.org/@affectively/aeon-pages/-/aeon-pages-1.5.0.tgz","fileCount":129,"integrity":"sha512-4b/OUS0e0hQcYAIl/fKxvw2cDeloeezoCIatOVTtRAqwz2k54hjDOJg0rrGYoGPFCHnMuJl70ntwzY3mcIGmkg==","signatures":[{"sig":"MEUCIQCczWmt3ltfOGpno7e+6wBaeTAJVdz0GCs7zXqDlCKt9AIgUpTknPV275CGAHVRwSJizEnlbUHs55pHV9YGA8JXN90=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4099997},"main":"./packages/runtime/dist/index.js","type":"module","types":"./packages/runtime/dist/index.d.ts","engines":{"bun":">=1.0.0"},"exports":{".":{"types":"./packages/runtime/dist/index.d.ts","import":"./packages/runtime/dist/index.js"},"./esi":{"types":"./packages/runtime/dist/router/index.d.ts","import":"./packages/runtime/dist/router/index.js"},"./auth":{"types":"@affectively/auth","import":"@affectively/auth"},"./react":{"types":"./packages/react/dist/index.d.ts","import":"./packages/react/dist/index.js"},"./server":{"types":"./packages/runtime/dist/server.d.ts","import":"./packages/runtime/dist/server.js"},"./runtime":{"types":"./packages/runtime/dist/index.d.ts","import":"./packages/runtime/dist/index.js"},"./directives":{"types":"./packages/directives/dist/use-aeon.d.ts","import":"./packages/directives/dist/use-aeon.js"}},"gitHead":"d08cd8ec2f940640c8570d5a191c2fc254c190b2","scripts":{"dev":"bun run packages/cli/src/dev.ts","test":"bun test","build":"bun run build:wasm && bun run build:ts","clean":"rm -rf packages/*/dist packages/runtime/wasm","build:ts":"bun run --filter='./packages/*' build","build:wasm":"cd packages/runtime-wasm && wasm-pack build --target web --out-dir ../runtime/wasm"},"_npmUser":{"name":"buley","email":"buley@outlook.com"},"deprecated":"This package is deprecated and no longer supported. Do not use.","repository":{"url":"git+https://github.com/affectively-ai/aeon-flux.git","type":"git"},"workspaces":["packages/*"],"_npmVersion":"11.8.0","description":"Collaborative page surface with CRDT-based flux state, Edge Side Inference, and zero-CLS rendering. Pages that think.","directories":{},"_nodeVersion":"25.5.0","dependencies":{"@affectively/aeon":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"wasm-pack":"^0.13.0","@types/bun":"latest","typescript":"^5.7.0","@types/react":"^18.0.0"},"peerDependencies":{"bun":">=1.0.0","react":">=18.0.0","@affectively/auth":">=0.1.0"},"peerDependenciesMeta":{"@affectively/auth":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/aeon-pages_1.5.0_1771290872571_0.38207731062869277","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-02-11T06:50:45.075Z","modified":"2026-03-27T19:58:45.261Z","1.3.0":"2026-02-11T06:50:45.373Z","1.4.0":"2026-02-13T02:41:22.993Z","1.5.0":"2026-02-17T01:14:32.924Z"},"bugs":{"url":"https://github.com/affectively-ai/aeon-flux/issues"},"author":{"name":"AFFECTIVELY"},"license":"MIT","homepage":"https://github.com/affectively-ai/aeon-flux#readme","keywords":["aeon","flux","crdt","framework","collaborative","cms","real-time","bun","cloudflare","d1","durable-objects","wasm","skeleton","zero-cls","performance"],"repository":{"url":"git+https://github.com/affectively-ai/aeon-flux.git","type":"git"},"description":"Collaborative page surface with CRDT-based flux state, Edge Side Inference, and zero-CLS rendering. Pages that think.","maintainers":[{"name":"buley","email":"buley@outlook.com"}],"readme":"# @affectively/aeon-flux\n\n**The CMS IS the website.** Collaborative page framework with CRDT-based flux state and hyperpersonalized routing.\n\n```\n'use aeon';  // One directive enables everything\n```\n\n## What is Aeon Flux?\n\nAeon Flux is a lightweight, collaborative page framework that unifies:\n\n- **CMS = Website** - No separate admin panel, edit in place\n- **Editor = Viewer** - Click to edit, changes are live\n- **Backend = Frontend** - One runtime, runs on edge\n- **Pages from D1** - No file system, pure database\n- **AI Everywhere** - Edge Side Inference (ESI) brings AI to any component\n\nThe name comes from:\n1. **Flux** - CRDT-based data model for conflict-free collaboration\n2. **Aeon Flux** - The classic anime (a syzygy of human and machine)\n\n## Key Features\n\n| Feature | Description |\n|---------|-------------|\n| **Zero-Dependency Rendering** | Single HTML with inline CSS, assets, fonts |\n| **Hyperpersonalized Routing** | The website comes to the person |\n| **Edge Side Inference (ESI)** | AI inference at render time |\n| **Pages from D1** | No file system in production |\n| **~20KB WASM runtime** | vs 500KB+ Next.js |\n| **Multi-layer caching** | KV (1ms) → D1 (5ms) → Session (50ms) |\n| **Speculative pre-rendering** | Zero-latency navigation |\n| **Built-in collaboration** | Real-time editing with presence |\n| **GitHub PR Publishing** | Visual edits → TSX → Git → Deploy |\n| **Lazy hydration** | Only hydrate interactive components on visibility |\n\n## Live Infrastructure\n\n```\nhttps://aeon-flux.taylorbuley.workers.dev\n```\n\n| Endpoint | Description |\n|----------|-------------|\n| `/health` | Health check |\n| `/session/:id` | WebSocket for real-time collab |\n| `/session/:id/session` | Session state (GET/PUT) |\n| `/session/:id/presence` | Active users |\n| `/routes` | Route registry |\n\n## Quick Start\n\n```bash\n# Install\nbun add @affectively/aeon-pages-runtime\n\n# Or use the worker directly\ncurl https://aeon-flux.taylorbuley.workers.dev/health\n```\n\n## Hyperpersonalized Routing\n\n**\"The website comes to the person\"** - Routes adapt based on user context.\n\n```typescript\nimport { HeuristicAdapter, extractUserContext } from '@affectively/aeon-pages-runtime';\n\nconst adapter = new HeuristicAdapter({\n  defaultPaths: ['/', '/chat', '/settings'],\n  signals: {\n    deriveTheme: (ctx) => ctx.localHour > 18 ? 'dark' : 'light',\n    deriveAccent: (ctx) => ctx.emotionState?.primary === 'happy' ? '#FFD700' : '#6366f1',\n  },\n});\n\n// Route decision includes personalization\nconst decision = await adapter.route('/dashboard', userContext, componentTree);\n// { theme: 'dark', accent: '#FFD700', prefetch: ['/chat'], density: 'comfortable', ... }\n```\n\n### Performance\n\n| Operation | 100 nodes | 500 nodes |\n|-----------|-----------|-----------|\n| `route()` | 0.014ms | 0.05ms |\n| `speculate()` | 0.003ms | 0.007ms |\n| `personalizeTree()` | 0.026ms | 0.109ms |\n\nSub-millisecond routing on every request.\n\n## Edge Side Inference (ESI)\n\nBring AI to any component at render time. Like Varnish ESI, but for inference.\n\n```tsx\nimport { ESI, ESIProvider } from '@affectively/aeon-pages-runtime/router';\n\n// Basic inference\n<ESI.Infer model=\"llm\" cache={300}>\n  Summarize this page for {user.name}\n</ESI.Infer>\n\n// Structured output with Zod\n<ESI.Structured schema={z.object({ sentiment: z.enum(['positive', 'negative']) })}>\n  Analyze: {userMessage}\n</ESI.Structured>\n\n// Conditional rendering\n<ESI.If\n  prompt=\"Should we show a discount?\"\n  schema={z.object({ show: z.boolean() })}\n  when={(r) => r.show}\n>\n  <DiscountBanner />\n</ESI.If>\n\n// Presence-aware (adapts for multiple viewers)\n<ESI.Collaborative schema={summarySchema}>\n  Summarize for {presence.length} viewers: {content}\n</ESI.Collaborative>\n\n// Self-optimizing (improves when user is alone)\n<ESI.Optimize\n  schema={contentSchema}\n  maxIterations={3}\n  goal=\"Improve clarity and engagement\"\n>\n  {draftContent}\n</ESI.Optimize>\n\n// Format transformations - wrap any ESI output\n<ESI.Markdown gfm>\n  <ESI.Infer>Generate API documentation</ESI.Infer>\n</ESI.Markdown>\n\n<ESI.Latex displayMode>\n  <ESI.Infer>Write the quadratic formula</ESI.Infer>\n</ESI.Latex>\n\n<ESI.Json indent={4} copyable>\n  <ESI.Structured schema={dataSchema}>Analyze this</ESI.Structured>\n</ESI.Json>\n\n// Text-to-code with coding models\n<ESI.Code\n  generateFrom=\"A debounce utility function\"\n  language=\"typescript\"\n  model=\"codestral\"\n  lineNumbers\n  copyable\n/>\n```\n\n### ESI Format Components\n\nTransform inference output before rendering:\n\n| Component | Purpose |\n|-----------|---------|\n| `ESI.Markdown` | Render markdown as HTML (GFM support) |\n| `ESI.Latex` | Render LaTeX math expressions |\n| `ESI.Json` | Pretty-print JSON with syntax highlighting |\n| `ESI.Plaintext` | Plain text with whitespace control |\n| `ESI.Code` | Code blocks with text-to-code generation |\n| `ESI.Semantic` | Extract topics/entities → structured HTML/microdata |\n\n### ESI.Code with Coding Models\n\n`ESI.Code` supports specialized coding models for text-to-code generation:\n\n```tsx\n// Text-to-code: generate from natural language\n<ESI.Code\n  generateFrom=\"A React hook that fetches user data with loading state\"\n  language=\"typescript\"\n  model=\"codestral\"\n  lineNumbers\n  copyable\n/>\n\n// Available models\ntype CodeModel =\n  | 'codestral'      // Mistral Codestral (default)\n  | 'deepseek'       // DeepSeek Coder\n  | 'starcoder'      // StarCoder\n  | 'codellama'      // Code Llama\n  | 'qwen-coder'     // Qwen Coder\n  | 'claude'         // Claude\n  | 'gpt-4';         // GPT-4\n\n// Auto-detect language\n<ESI.Code autoDetect model=\"deepseek\">\n  {someCodeString}\n</ESI.Code>\n```\n\n### ESI.Semantic - Embeddings to Structured HTML\n\nExtract semantic topics, entities, and emotions → generate Schema.org microdata:\n\n```tsx\n// Extract topics as JSON-LD structured data\n<ESI.Semantic format=\"jsonld\" schemaType=\"Article\" extractEntities extractEmotion>\n  {articleText}\n</ESI.Semantic>\n\n// Display as interactive tags\n<ESI.Semantic format=\"tags\" maxTopics={5} extractEmotion>\n  <ESI.Infer>Summarize this news article</ESI.Infer>\n</ESI.Semantic>\n\n// Output formats: microdata | jsonld | rdfa | tags\n// Uses: embed model (embeddings), classify model (entities), emotion model\n```\n\n## Zero-Dependency Rendering\n\nEvery page is a **completely self-contained HTML document**. No external requests needed.\n\n```\nSingle Request → Instant Render\n├── Inline CSS (tree-shaken, only used classes)\n├── Inline assets (SVG, images as data URIs)\n├── Inline fonts (@font-face with embedded data)\n├── Minimal hydration script (lazy, on visibility)\n└── WASM-rendered at edge (~7ms total)\n```\n\n### Multi-Layer Caching\n\n```\nRequest → KV Cache (1ms) → D1 Cache (5ms) → Session Render (50ms)\n                ↓                 ↓                  ↓\n           Return HTML       Cache to KV        Cache to KV + D1\n```\n\nAll pages are pre-rendered at build time and cached. First request for any route is a cache hit.\n\n### Speculative Pre-Rendering\n\nPages are pre-rendered **before the user clicks**, based on:\n- Link visibility (IntersectionObserver)\n- Hover intent\n- Navigation prediction (Markov chain, community patterns)\n- Browser Speculation Rules API\n\n```typescript\nimport { initSpeculativeRendering } from '@affectively/aeon-pages-runtime';\n\n// Enable instant navigation\ninitSpeculativeRendering({\n  maxCachedPages: 5,\n  prerenderOnHover: true,\n});\n```\n\n### Performance\n\n| Metric | Before | After |\n|--------|--------|-------|\n| Requests | 15-30 | 1 |\n| Total bytes | ~655KB | ~110KB |\n| TTFB | 100ms | 50ms |\n| First Paint | 500ms | <100ms |\n| Time to Interactive | 2000ms | <300ms |\n| CLS | 0.05 | 0 |\n\n## GitHub PR Publishing\n\nVisual edits compile to TSX and create PRs automatically.\n\n```\nEdit in browser → Durable Object → \"Publish\" → TSX → PR → CI deploys\n```\n\n### WebSocket Commands\n\n```javascript\nconst ws = new WebSocket('wss://aeon-flux.taylorbuley.workers.dev/session/my-page?userId=user1');\n\n// Publish current tree → creates PR\nws.send(JSON.stringify({ type: 'publish' }));\n// Response: { type: 'publish', payload: { prNumber: 123, autoMerged: false } }\n\n// Merge a PR\nws.send(JSON.stringify({ type: 'merge', payload: { prNumber: 123 } }));\n```\n\n### Generated TSX\n\n```tsx\n'use aeon';\n\n/**\n * AboutPage\n * Route: /about\n *\n * @generated by aeon-flux visual editor\n */\n\nimport type { FC } from 'react';\nimport { Hero } from '@/components/Hero';\nimport { Section } from '@/components/Section';\n\nconst AboutPage: FC = () => {\n  return (\n    <Page>\n      <Hero title=\"About Us\" />\n      <Section>\n        <Text>We believe in...</Text>\n      </Section>\n    </Page>\n  );\n};\n\nexport default AboutPage;\n```\n\n### Configuration\n\n```toml\n# wrangler.toml\n[vars]\nGITHUB_REPO = \"owner/repo\"\nGITHUB_TREE_PATH = \"apps/web/pages\"\nGITHUB_BASE_BRANCH = \"staging\"\nGITHUB_DEV_BRANCH = \"development\"\nGITHUB_AUTO_MERGE = \"false\"\n```\n\n## Production Architecture\n\n```\n┌─────────────────────────────────────────────────────────────────────────┐\n│                         AEON FLUX ARCHITECTURE                           │\n├─────────────────────────────────────────────────────────────────────────┤\n│                                                                          │\n│   Request + User Context                                                 │\n│          │                                                               │\n│          ▼                                                               │\n│   ┌──────────────────┐     ┌──────────────────┐                         │\n│   │ HeuristicAdapter │     │       ESI        │                         │\n│   │  (personalize)   │     │   (inference)    │                         │\n│   └────────┬─────────┘     └────────┬─────────┘                         │\n│            │                        │                                    │\n│            ▼                        ▼                                    │\n│   ┌──────────────────────────────────────────────────┐                  │\n│   │              Durable Objects                      │                  │\n│   │    (sessions, presence, real-time sync)          │                  │\n│   └──────────────────────────────────────────────────┘                  │\n│            │                        │                                    │\n│            ▼                        ▼                                    │\n│   ┌──────────────┐          ┌──────────────┐                            │\n│   │      D1      │          │    GitHub    │                            │\n│   │  (storage)   │          │  (publish)   │                            │\n│   └──────────────┘          └──────────────┘                            │\n│                                                                          │\n│   Edit visually → Sync via DO → Publish → TSX → PR → Deploy             │\n│                                                                          │\n└─────────────────────────────────────────────────────────────────────────┘\n```\n\n## Local-First with Dash\n\nData lives client-side. No backend services needed.\n\n```typescript\nimport { DashStorageAdapter } from '@affectively/aeon-pages-runtime';\n\nconst storage = new DashStorageAdapter(dashClient, {\n  routesCollection: 'aeon-routes',\n  sessionsCollection: 'aeon-sessions',\n});\n\n// Reads: instant (local)\n// Writes: instant (local), syncs via DO\n// Collab: Durable Objects\n// AI: ESI at edge\n```\n\n## Speculation & Prefetching\n\nPredict and prefetch likely next pages.\n\n```typescript\nimport { SpeculationManager, createSpeculationHook } from '@affectively/aeon-pages-runtime/router';\n\n// Client-side\nconst manager = new SpeculationManager({\n  maxPrefetch: 5,\n  hoverDelay: 100,\n});\n\n// Prefetch on hover\nmanager.observeLinks();\n\n// Or use the hook\nconst useSpeculation = createSpeculationHook(manager);\n```\n\nSupports [Speculation Rules API](https://developer.chrome.com/docs/web-platform/prerender-pages) with link prefetch fallback.\n\n## Zero-Instrumentation Analytics\n\nAutomatic click tracking with Merkle tree node identification. Every click tracked without writing a single line of instrumentation code.\n\n```typescript\nimport {\n  initClickTracker,\n  initContextBridgeWithRetry,\n  pushPageView,\n} from '@affectively/aeon-pages-analytics';\n\n// Initialize on client\ninitContextBridgeWithRetry({ maxRetries: 3, retryDelayMs: 500 });\ninitClickTracker({\n  debounceMs: 100,\n  maxTextLength: 150,\n  excludeSelectors: ['.no-track'],\n});\npushPageView();\n```\n\n### What Gets Tracked\n\nEvery click automatically includes:\n\n| Data | Description |\n|------|-------------|\n| **Merkle Hash** | Content-addressable ID (stable across renders) |\n| **Tree Path** | `['root', 'layout', 'header', 'nav', 'button']` |\n| **ESI Context** | User tier, emotion state, features, session |\n| **Element Info** | Tag, text, aria-label, role, href |\n| **Position** | Viewport and document coordinates |\n\n### DataLayer Events\n\n```javascript\n// Click event pushed to dataLayer\n{\n  event: 'aeon.click',\n  click: {\n    merkleHash: 'a1b2c3d4e5f6',\n    treePath: ['root', 'layout', 'header', 'settings-btn'],\n    element: { tagName: 'BUTTON', text: 'Settings' }\n  },\n  context: {\n    userTier: 'pro',\n    emotionState: { primary: 'focused', valence: 0.3 }\n  }\n}\n```\n\nWorks with GTM + GA4 out of the box. Set `GTM_CONTAINER_ID` in your environment.\n\n## The `'use aeon'` Directive\n\n```tsx\n'use aeon';\n\nexport default function Page() {\n  const {\n    presence,    // Who's viewing/editing\n    sync,        // Sync state and controls\n    version,     // Schema version info\n    data,        // Collaborative data store\n    setData,     // Update data\n  } = useAeonPage();\n\n  return <div>...</div>;\n}\n```\n\n## Hooks\n\n| Hook | Purpose |\n|------|---------|\n| `useAeonPage()` | Full page context |\n| `usePresence()` | Who's here, cursors, editing |\n| `useAeonData<T>(key)` | Collaborative typed data |\n| `useCollaborativeInput(key)` | Ready-to-use collab input |\n| `useOfflineStatus()` | Offline awareness |\n| `useESI()` | ESI context |\n| `useESIInfer()` | Programmatic inference |\n| `useESITier()` | User tier for feature gating |\n| `useESIEmotionState()` | Current emotional context |\n| `useESIFeature(name)` | Check feature availability |\n| `useIsAdmin()` | Check if user is admin |\n| `useMeetsTierRequirement(tier)` | Check if user meets tier |\n| `useGlobalESIState()` | Full ESI state object |\n\n## ESI Global State Injection\n\nFor zero-CLS tier-aware rendering, inject ESI state in the `<head>`:\n\n```html\n<script>\n  window.__AEON_ESI_STATE__ = {\n    userTier: 'pro',           // free | starter | pro | enterprise\n    emotionState: {\n      primary: 'focused',\n      valence: 0.3,\n      arousal: 0.6\n    },\n    preferences: {\n      theme: 'dark',\n      reducedMotion: false\n    },\n    sessionId: 'abc123',\n    localHour: 14,\n    timezone: 'America/New_York'\n  };\n</script>\n```\n\nThen use in components:\n\n```tsx\nimport { useESITier } from '@affectively/aeon-flux/esi';\n\nfunction PremiumFeature() {\n  const tier = useESITier();\n\n  if (tier === 'free') {\n    return <UpgradePrompt />;\n  }\n\n  return <AdvancedAnalytics />;\n}\n\n## Configuration\n\n```typescript\n// aeon.config.ts\nexport default {\n  pagesDir: './pages',\n  runtime: 'cloudflare',\n\n  router: {\n    adapter: 'heuristic',\n    speculation: {\n      enabled: true,\n      depth: 2,\n      prerenderTop: 1,\n    },\n    personalization: {\n      featureGating: true,\n      emotionTheming: true,\n      componentOrdering: true,\n    },\n  },\n\n  esi: {\n    enabled: true,\n    endpoint: process.env.ESI_ENDPOINT,\n    timeout: 5000,\n    defaultCacheTtl: 300,\n  },\n\n  github: {\n    repo: 'owner/repo',\n    treePath: 'apps/web/pages',\n    baseBranch: 'staging',\n    devBranch: 'development',\n    autoMerge: false,\n  },\n};\n```\n\n## Packages\n\n| Package | Description |\n|---------|-------------|\n| `@affectively/aeon-flux` | Main package (npm) |\n| `@affectively/aeon-flux/esi` | ESI hooks for tier gating |\n| `@affectively/aeon-flux/react` | React bindings |\n| `@affectively/aeon-flux/server` | Server utilities |\n| `@affectively/aeon-pages-runtime` | Runtime (npm) |\n| `@affectively/aeon-pages-runtime/router` | Personalized routing + ESI |\n| `@affectively/aeon-pages-runtime/server` | Server utilities |\n| `@affectively/aeon-pages-analytics` | Zero-instrumentation analytics with Merkle tree tracking |\n\n## Deploy Your Own\n\n```bash\ncd packages/runtime\n\n# Deploy worker\nwrangler deploy\n\n# Set GitHub token\nwrangler secret put GITHUB_TOKEN\n\n# Create D1 database (optional)\nwrangler d1 create aeon-flux\nwrangler d1 execute aeon-flux --file=./schema.sql\n```\n\n## vs Next.js\n\n| | Next.js | Aeon Flux |\n|-|---------|-----------|\n| **Runtime** | ~500KB | ~187KB |\n| **Routing** | Static | Personalized |\n| **AI** | Add-on | ESI built-in |\n| **CMS** | Separate | It IS the site |\n| **Collaboration** | Add-on | Built-in |\n| **Publish** | Manual | Visual → PR |\n| **Edge** | Partial | Full |\n\n## Requirements\n\n- Bun >= 1.0.0\n- React >= 18.0.0\n- Zod >= 3.0.0\n- Cloudflare account (for production)\n\n## License\n\nMIT\n\n---\n\n*The CMS is the website. The website comes to the person. Visual edits become code.*\n","readmeFilename":"README.md"}