@agent-native/core 0.175.1 → 0.175.2-nightly-20260826150235

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.
@@ -291,8 +291,10 @@ function isOpaqueOriginFrame(win) {
291
291
  function stripTokenFromUrl(win) {
292
292
  // Keep the token in the URL for opaque-origin frames — see
293
293
  // isOpaqueOriginFrame. Stripping it there breaks re-auth on any document
294
- // reload. Referrer-Policy is set to no-referrer on embed responses, so the
295
- // retained token does not leak via the Referer header.
294
+ // reload. Embed responses now use Referrer-Policy: same-origin, but that
295
+ // never leaks the retained token here: an opaque origin never equals any
296
+ // other origin (including its own), so "same-origin" requests from this
297
+ // document never qualify and no Referer is sent at all.
296
298
  if (isOpaqueOriginFrame(win))
297
299
  return;
298
300
  try {
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
26
26
  * Body: { update: string (base64), requestSource?: string }
27
27
  */
28
28
  export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
29
- ok?: undefined;
30
29
  error: string;
30
+ ok?: undefined;
31
31
  } | {
32
32
  error?: undefined;
33
33
  ok: boolean;
@@ -13,8 +13,8 @@
13
13
  * Body: { json: any, fieldName?: string, type?: "map"|"array", requestSource?: string }
14
14
  */
15
15
  export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
16
- ok?: undefined;
17
16
  error: string;
17
+ ok?: undefined;
18
18
  } | {
19
19
  error?: undefined;
20
20
  ok: boolean;
@@ -62,6 +62,6 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
62
62
  summary?: undefined;
63
63
  spans?: undefined;
64
64
  id?: undefined;
65
- error?: undefined;
66
65
  ok: boolean;
66
+ error?: undefined;
67
67
  }>>;
@@ -761,7 +761,7 @@ export async function resolveEmbedSessionFromRequest(event) {
761
761
  if (candidate.source === "query" && candidate.token) {
762
762
  try {
763
763
  setEmbedSessionCookie(event, candidate.token);
764
- setResponseHeader(event, "Referrer-Policy", "no-referrer");
764
+ setResponseHeader(event, "Referrer-Policy", "same-origin");
765
765
  }
766
766
  catch {
767
767
  // Some tests and edge runtimes expose read-only request shims. The
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
26
26
  expiresAt?: undefined;
27
27
  ttlSeconds?: undefined;
28
28
  } | {
29
- error?: undefined;
30
29
  token: string;
31
30
  expiresAt: string;
32
31
  ttlSeconds: number;
32
+ error?: undefined;
33
33
  }>>;
@@ -19,6 +19,9 @@
19
19
  * - `Referrer-Policy: strict-origin-when-cross-origin` — strips path/query
20
20
  * from outbound Referer headers when the request crosses origin, so a
21
21
  * public-share viewer's outbound link clicks never leak the share token.
22
+ * Validated embed-session responses tighten this to `same-origin`, which
23
+ * sends nothing cross-origin at all while keeping the same-origin Referer
24
+ * that parent-vs-child app checks depend on.
22
25
  * - `Permissions-Policy: camera=*, microphone=(self), geolocation=(),
23
26
  * screen-wake-lock=()` — allows microphone access for composer dictation
24
27
  * and camera access for media-capture UI (the Clips recorder, and the
@@ -19,6 +19,9 @@
19
19
  * - `Referrer-Policy: strict-origin-when-cross-origin` — strips path/query
20
20
  * from outbound Referer headers when the request crosses origin, so a
21
21
  * public-share viewer's outbound link clicks never leak the share token.
22
+ * Validated embed-session responses tighten this to `same-origin`, which
23
+ * sends nothing cross-origin at all while keeping the same-origin Referer
24
+ * that parent-vs-child app checks depend on.
22
25
  * - `Permissions-Policy: camera=*, microphone=(self), geolocation=(),
23
26
  * screen-wake-lock=()` — allows microphone access for composer dictation
24
27
  * and camera access for media-capture UI (the Clips recorder, and the
@@ -112,7 +115,13 @@ export function createSecurityHeadersMiddleware() {
112
115
  const iframeNavigationRequest = isIframeNavigationRequest(event);
113
116
  const requestOrigin = getHeader(event, "origin");
114
117
  setResponseHeader(event, "X-Content-Type-Options", "nosniff");
115
- setResponseHeader(event, "Referrer-Policy", embedFrameRequest ? "no-referrer" : "strict-origin-when-cross-origin");
118
+ setResponseHeader(event, "Referrer-Policy",
119
+ /**
120
+ * Dispatch is served as an embed, and the parent page's path cannot be forged by a
121
+ * same-origin child app, so stripping it made minting an app session from Dispatch
122
+ * impossible.
123
+ */
124
+ embedFrameRequest ? "same-origin" : "strict-origin-when-cross-origin");
116
125
  setResponseHeader(event, "Permissions-Policy", PERMISSIONS_POLICY);
117
126
  setResponseHeader(event, "Cross-Origin-Opener-Policy", "same-origin");
118
127
  if (embedFrameRequest || iframeNavigationRequest) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.175.1",
3
+ "version": "0.175.2-nightly-20260826150235",
4
4
  "description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {