@agent-native/core 0.115.3 → 0.115.4

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.
@@ -20,7 +20,7 @@ export declare function createTranscribeVoiceHandler(): import("h3").EventHandle
20
20
  error: string;
21
21
  text?: undefined;
22
22
  } | {
23
- error?: undefined;
24
23
  text: string;
24
+ error?: undefined;
25
25
  }>>;
26
26
  //# sourceMappingURL=transcribe-voice.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.115.3",
3
+ "version": "0.115.4",
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": {
@@ -385,8 +385,8 @@
385
385
  "y-protocols": "^1.0.7",
386
386
  "yjs": "^13.6.31",
387
387
  "zod": "^4.3.6",
388
- "@agent-native/toolkit": "^0.9.0",
389
- "@agent-native/recap-cli": "0.5.0"
388
+ "@agent-native/recap-cli": "0.5.0",
389
+ "@agent-native/toolkit": "^0.9.0"
390
390
  },
391
391
  "devDependencies": {
392
392
  "@ai-sdk/anthropic": "^3.0.71",
@@ -26,6 +26,8 @@ export const BUILDER_RELAY_STATE_PARAM = "_an_relay";
26
26
  export const BUILDER_RELAY_SECRET_ENV = "AGENT_NATIVE_BUILDER_RELAY_SECRET";
27
27
  export const BUILDER_RELAY_TARGET_ORIGINS_ENV =
28
28
  "AGENT_NATIVE_BUILDER_RELAY_TARGET_ORIGINS";
29
+ export const BUILDER_RELAY_TARGET_DOMAIN_SUFFIXES_ENV =
30
+ "AGENT_NATIVE_BUILDER_RELAY_TARGET_DOMAIN_SUFFIXES";
29
31
  export const BUILDER_RELAY_TIMESTAMP_HEADER = "x-agent-native-relay-timestamp";
30
32
  export const BUILDER_RELAY_FLOW_HEADER = "x-agent-native-relay-flow";
31
33
  export const BUILDER_RELAY_SIGNATURE_HEADER = "x-agent-native-relay-signature";
@@ -151,15 +153,18 @@ export function isTrustedBuilderRelayTargetOrigin(value: string): boolean {
151
153
  ) {
152
154
  return false;
153
155
  }
154
- const configured = process.env[BUILDER_RELAY_TARGET_ORIGINS_ENV];
155
- if (!configured) return false;
156
- return configured
156
+ const exactOriginMatch = (process.env[BUILDER_RELAY_TARGET_ORIGINS_ENV] ?? "")
157
157
  .split(",")
158
158
  .map((origin) => origin.trim())
159
159
  .filter(Boolean)
160
160
  .some((origin) => origin === value && !origin.includes("*"));
161
+ return (
162
+ exactOriginMatch ||
163
+ builderRelayTargetDomainSuffixes().some((suffix) =>
164
+ hostname.endsWith(suffix),
165
+ )
166
+ );
161
167
  }
162
-
163
168
  export function signBuilderPreviewRelayState(input: {
164
169
  ownerEmail: string;
165
170
  targetOrigin: string;
@@ -191,6 +196,31 @@ export function signBuilderPreviewRelayState(input: {
191
196
  return { state: `${encoded}.${builderRelayMac(encoded)}`, payload };
192
197
  }
193
198
 
199
+ function builderRelayTargetDomainSuffixes(): string[] {
200
+ return (process.env[BUILDER_RELAY_TARGET_DOMAIN_SUFFIXES_ENV] ?? "")
201
+ .split(",")
202
+ .map((suffix) => suffix.trim().toLowerCase())
203
+ .filter((suffix) => {
204
+ if (!suffix.startsWith(".") || suffix.includes("*")) return false;
205
+ const hostname = suffix.slice(1);
206
+ if (!hostname.includes(".") || hostname.length > 253) return false;
207
+ if (
208
+ !hostname
209
+ .split(".")
210
+ .every((label) =>
211
+ /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(label),
212
+ )
213
+ ) {
214
+ return false;
215
+ }
216
+ try {
217
+ return new URL(`https://${hostname}`).hostname === hostname;
218
+ } catch {
219
+ return false;
220
+ }
221
+ });
222
+ }
223
+
194
224
  export function verifyBuilderPreviewRelayState(
195
225
  state: string | null | undefined,
196
226
  options: { now?: number } = {},
@@ -2345,7 +2345,7 @@ export function createCoreRoutesPlugin(
2345
2345
  timestamp: getHeader(event, BUILDER_RELAY_TIMESTAMP_HEADER),
2346
2346
  flowId: getHeader(event, BUILDER_RELAY_FLOW_HEADER),
2347
2347
  signature: getHeader(event, BUILDER_RELAY_SIGNATURE_HEADER),
2348
- requestOrigin: getFrameworkRouteRequestUrl(event).origin,
2348
+ requestOrigin: getBuilderBrowserOriginForEvent(event),
2349
2349
  requestBasePath: getAppBasePath(),
2350
2350
  },
2351
2351
  {