@agent-native/core 0.32.0 → 0.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,6 +47,7 @@ import { isEnvVarWriteAllowed } from "./env-var-writes.js";
47
47
  import { llmConnectionTrackingProperties } from "../shared/llm-connection.js";
48
48
  import { mountBrowserSessionRoutes } from "../browser-sessions/routes.js";
49
49
  import { mountDbAdminRoutes } from "../db-admin/routes.js";
50
+ import { DEFAULT_SSR_CACHE_CONTROL, EMPTY_SPECULATION_RULES, } from "../shared/cache-control.js";
50
51
  /**
51
52
  * The base path prefix for all framework-level routes.
52
53
  * All agent-native core routes live under this namespace to avoid
@@ -479,6 +480,15 @@ export function createCoreRoutesPlugin(options = {}) {
479
480
  message: process.env.PING_MESSAGE ?? "pong",
480
481
  })));
481
482
  }
483
+ getH3App(nitroApp).use(`${P}/speculation-rules.json`, defineEventHandler((event) => {
484
+ // `createH3SSRHandler` points the Speculation-Rules response header
485
+ // here to prevent Cloudflare Speed Brain from injecting its own
486
+ // edge prefetch rules. Keep this route public and side-effect free:
487
+ // browsers may request it while parsing any SSR HTML document.
488
+ setResponseHeader(event, "content-type", "application/speculationrules+json; charset=utf-8");
489
+ setResponseHeader(event, "cache-control", DEFAULT_SSR_CACHE_CONTROL);
490
+ return EMPTY_SPECULATION_RULES;
491
+ }));
482
492
  mountBrowserSessionRoutes(nitroApp, { routePrefix: P });
483
493
  // Dev-mode DB admin (Supabase-Studio-like). Mounted unconditionally; every
484
494
  // handler self-gates on dev + localhost (the authoritative gate lives in