@agent-native/core 0.157.19 → 0.157.20

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.
@@ -62,11 +62,11 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
62
62
  error: string;
63
63
  states?: undefined;
64
64
  } | {
65
- error?: undefined;
66
65
  states: {
67
66
  clientId: number;
68
67
  state: string;
69
68
  }[];
69
+ error?: undefined;
70
70
  }>>;
71
71
  /**
72
72
  * GET /_agent-native/collab/:docId/users
@@ -77,9 +77,9 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
77
77
  error: string;
78
78
  users?: undefined;
79
79
  } | {
80
- error?: undefined;
81
80
  users: {
82
81
  clientId: number;
83
82
  lastSeen: number;
84
83
  }[];
84
+ error?: undefined;
85
85
  }>>;
@@ -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
  }>>;
@@ -15,6 +15,6 @@ export declare function createProgressHandler(): import("h3").EventHandlerWithFe
15
15
  error: string;
16
16
  ok?: undefined;
17
17
  } | {
18
- ok: boolean;
19
18
  error?: undefined;
19
+ ok: boolean;
20
20
  }>>;
@@ -143,7 +143,10 @@ function getAllowedCorsOrigin(origin) {
143
143
  // keeps production from trusting arbitrary localhost callers.
144
144
  });
145
145
  if (allowedOrigin) {
146
- return { origin: allowedOrigin, credentials: true };
146
+ return {
147
+ origin: allowedOrigin,
148
+ credentials: shouldAllowMcpEmbedCredentials(allowedOrigin),
149
+ };
147
150
  }
148
151
  if (origin && isMcpEmbedCorsOrigin(origin)) {
149
152
  return {
@@ -1394,7 +1394,6 @@ function applyCorsHeaders(event) {
1394
1394
  Boolean(getHeader(event, "authorization")));
1395
1395
  const allowedOrigin = getAllowedCorsOrigin(origin, {
1396
1396
  allowedOrigins: readCorsAllowedOrigins(),
1397
- allowLocalhostWhenNoAllowlist: true,
1398
1397
  });
1399
1398
  const responseOrigin = mcpEmbedCorsRequest ? origin : allowedOrigin;
1400
1399
  if (!responseOrigin)
@@ -1103,7 +1103,6 @@ export function createCoreRoutesPlugin(options = {}) {
1103
1103
  : getAllowedCorsOrigin(origin, {
1104
1104
  allowedOrigins: allowlist,
1105
1105
  allowAnyOriginWhenNoAllowlist: false,
1106
- allowLocalhostWhenNoAllowlist: true,
1107
1106
  });
1108
1107
  // Reject preflights from disallowed cross-origin callers BEFORE
1109
1108
  // returning 204. Previously the OPTIONS short-circuit returned 204
@@ -51,6 +51,8 @@ function embedStartCorsOrigin(event) {
51
51
  const origin = getHeader(event, "origin");
52
52
  if (!origin)
53
53
  return null;
54
+ if (origin === "null")
55
+ return origin;
54
56
  if (isMcpEmbedTransplantOrigin(origin))
55
57
  return origin;
56
58
  return readCorsAllowedOrigins().includes(origin) ? origin : null;
@@ -144,8 +146,12 @@ function firstQueryValue(value) {
144
146
  }
145
147
  function wantsTransplantLocationResponse(event) {
146
148
  const origin = getHeader(event, "origin");
149
+ const fetchDestination = getHeader(event, "sec-fetch-dest")?.toLowerCase();
150
+ if (fetchDestination !== "document" && fetchDestination !== "iframe") {
151
+ return false;
152
+ }
147
153
  const canReadLocation = !origin ||
148
- embedStartCorsOrigin(event) !== null ||
154
+ (origin !== "null" && embedStartCorsOrigin(event) !== null) ||
149
155
  isMcpEmbedTransplantOrigin(origin);
150
156
  if (!canReadLocation)
151
157
  return false;
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
26
26
  expiresAt?: undefined;
27
27
  ttlSeconds?: undefined;
28
28
  } | {
29
+ error?: undefined;
29
30
  token: string;
30
31
  expiresAt: string;
31
32
  ttlSeconds: number;
32
- error?: undefined;
33
33
  }>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.157.19",
3
+ "version": "0.157.20",
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": {