Astro Integration / Prefetch // CHROME BUILT-IN AI

astro-prefetch-ai-brief

15-word predictive floating briefs generated on hover via Chrome Summarizer API.

01. Architectural Specifications STATUS: PRODUCTION READY
[ 01 // CAPABILITY ]

Hover Intelligence

Background fetches linked routes on mouseenter/focus and parses content to summarize destination before navigation.

[ 02 // CAPABILITY ]

On-Device Summarizer

Employs window.ai.summarizer for zero-latency, zero-cost AI summaries with no external API keys.

[ 03 // CAPABILITY ]

Built-In LRU Cache

Caches generated briefs in client memory to guarantee instantaneous display on repeated hovers.

02. Implementation & Usage BUN / ASTRO 5+
// Installation CLI
bun add astro-prefetch-ai-brief
# or
pnpm add astro-prefetch-ai-brief
// Configuration astro.config.mjs
// astro.config.mjs
import { defineConfig } from "astro/config";
import prefetchAiBrief from "astro-prefetch-ai-brief";

export default defineConfig({
  integrations: [
    prefetchAiBrief({
      wordCount: 15,
      contentSelector: "main, article",
      hoverDelayMs: 150,
      cacheSize: 50
    })
  ]
});

// Chrome Built-in AI Prerequisites

  • 1. Open chrome://flags in Google Chrome 128+
  • 2. Set #prompt-api-for-gemini-nano to Enabled
  • 3. Set #optimization-guide-on-device-model to Enabled ByPassPerfRequirement
  • 4. Restart Chrome and verify model status at chrome://components