@agent-native/core 0.158.2 → 0.158.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.
@@ -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
  }>>;
@@ -17,11 +17,11 @@ declare const _default: import("../../action.js").ActionDefinition<{
17
17
  id?: undefined;
18
18
  provider?: undefined;
19
19
  } | {
20
- error?: undefined;
21
20
  configured?: undefined;
22
21
  connectPath?: undefined;
23
22
  url: string;
24
23
  id: string;
25
24
  provider: string;
25
+ error?: undefined;
26
26
  }>;
27
27
  export default _default;
@@ -137,13 +137,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
137
137
  inputSchema: {
138
138
  type: string;
139
139
  properties: {
140
- count?: undefined;
141
140
  query?: undefined;
142
141
  minutes?: undefined;
143
142
  limit?: undefined;
144
143
  clientHint?: undefined;
145
144
  timestamp?: undefined;
146
145
  chapterId?: undefined;
146
+ count?: undefined;
147
147
  startAt?: undefined;
148
148
  endAt?: undefined;
149
149
  reason?: undefined;
@@ -159,7 +159,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
159
159
  inputSchema: {
160
160
  type: string;
161
161
  properties: {
162
- count?: undefined;
163
162
  query: {
164
163
  type: string;
165
164
  description: string;
@@ -175,6 +174,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
175
174
  clientHint?: undefined;
176
175
  timestamp?: undefined;
177
176
  chapterId?: undefined;
177
+ count?: undefined;
178
178
  startAt?: undefined;
179
179
  endAt?: undefined;
180
180
  reason?: undefined;
@@ -190,7 +190,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
190
190
  inputSchema: {
191
191
  type: string;
192
192
  properties: {
193
- count?: undefined;
194
193
  minutes: {
195
194
  type: string;
196
195
  description: string;
@@ -200,6 +199,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
200
199
  clientHint?: undefined;
201
200
  timestamp?: undefined;
202
201
  chapterId?: undefined;
202
+ count?: undefined;
203
203
  startAt?: undefined;
204
204
  endAt?: undefined;
205
205
  reason?: undefined;
@@ -216,7 +216,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
216
216
  type: string;
217
217
  required: string[];
218
218
  properties: {
219
- count?: undefined;
220
219
  query: {
221
220
  type: string;
222
221
  description: string;
@@ -235,6 +234,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
235
234
  };
236
235
  timestamp?: undefined;
237
236
  chapterId?: undefined;
237
+ count?: undefined;
238
238
  startAt?: undefined;
239
239
  endAt?: undefined;
240
240
  reason?: undefined;
@@ -250,7 +250,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
250
250
  type: string;
251
251
  required: string[];
252
252
  properties: {
253
- count?: undefined;
254
253
  query?: undefined;
255
254
  minutes?: undefined;
256
255
  limit?: undefined;
@@ -264,6 +263,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
264
263
  description: string;
265
264
  };
266
265
  chapterId?: undefined;
266
+ count?: undefined;
267
267
  startAt?: undefined;
268
268
  endAt?: undefined;
269
269
  includeMicrophone?: undefined;
@@ -314,13 +314,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
314
314
  type: string;
315
315
  required: string[];
316
316
  properties: {
317
- count?: undefined;
318
317
  query?: undefined;
319
318
  minutes?: undefined;
320
319
  limit?: undefined;
321
320
  clientHint?: undefined;
322
321
  timestamp?: undefined;
323
322
  chapterId?: undefined;
323
+ count?: undefined;
324
324
  startAt: {
325
325
  type: string;
326
326
  description: string;
@@ -349,13 +349,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
349
349
  type: string;
350
350
  required: string[];
351
351
  properties: {
352
- count?: undefined;
353
352
  query?: undefined;
354
353
  minutes?: undefined;
355
354
  limit?: undefined;
356
355
  clientHint?: undefined;
357
356
  timestamp?: undefined;
358
357
  chapterId?: undefined;
358
+ count?: undefined;
359
359
  startAt?: undefined;
360
360
  endAt?: undefined;
361
361
  reason?: undefined;
@@ -16,18 +16,18 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
16
16
  error?: undefined;
17
17
  ok?: undefined;
18
18
  } | {
19
- count?: undefined;
20
19
  updated: number;
21
20
  error?: undefined;
22
21
  ok?: undefined;
23
- } | {
24
22
  count?: undefined;
23
+ } | {
25
24
  updated?: undefined;
26
25
  error: string;
27
26
  ok?: undefined;
28
- } | {
29
27
  count?: undefined;
28
+ } | {
30
29
  updated?: undefined;
31
30
  error?: undefined;
32
31
  ok: boolean;
32
+ count?: undefined;
33
33
  }>>;
@@ -42,22 +42,22 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
42
42
  avgEvalScore: number;
43
43
  } | {
44
44
  error?: undefined;
45
- ok?: undefined;
46
45
  summary: import("./types.js").TraceSummary;
47
46
  spans: import("./types.js").TraceSpan[];
48
47
  id?: undefined;
48
+ ok?: undefined;
49
49
  } | {
50
50
  error?: undefined;
51
- ok?: undefined;
52
51
  summary?: undefined;
53
52
  spans?: undefined;
54
53
  id: string;
55
- } | {
56
54
  ok?: undefined;
55
+ } | {
57
56
  summary?: undefined;
58
57
  spans?: undefined;
59
58
  id?: undefined;
60
59
  error: any;
60
+ ok?: undefined;
61
61
  } | {
62
62
  error?: undefined;
63
63
  summary?: undefined;
@@ -34,37 +34,37 @@ export declare function createListSecretsHandler(): import("h3").EventHandlerWit
34
34
  /** POST /_agent-native/secrets/:key — write a secret. */
35
35
  export declare function createWriteSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
36
36
  error: string;
37
- ok?: undefined;
38
37
  status?: undefined;
38
+ ok?: undefined;
39
39
  } | {
40
- error?: undefined;
41
40
  ok: boolean;
42
41
  status: string;
42
+ error?: undefined;
43
43
  } | {
44
- ok?: undefined;
45
44
  error: string;
46
45
  removed?: undefined;
46
+ ok?: undefined;
47
47
  } | {
48
- error?: undefined;
49
48
  ok: boolean;
50
49
  removed: boolean;
50
+ error?: undefined;
51
51
  }>>;
52
52
  /**
53
53
  * POST /_agent-native/secrets/:key/test — validate an optional candidate value
54
54
  * or the current stored value without changing anything.
55
55
  */
56
56
  export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
57
- ok?: undefined;
58
57
  error: string;
59
58
  note?: undefined;
59
+ ok?: undefined;
60
60
  } | {
61
- error?: undefined;
62
61
  ok: boolean;
63
62
  note?: undefined;
64
- } | {
65
63
  error?: undefined;
64
+ } | {
66
65
  ok: boolean;
67
66
  note: string;
67
+ error?: undefined;
68
68
  } | {
69
69
  note?: undefined;
70
70
  ok: boolean;
@@ -95,11 +95,11 @@ export interface AdHocSecretPayload {
95
95
  export declare function createAdHocSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<AdHocSecretPayload[] | {
96
96
  error: string;
97
97
  } | {
98
- error?: undefined;
99
98
  ok: boolean;
100
99
  key: string;
101
- } | {
102
100
  error?: undefined;
101
+ } | {
103
102
  ok: boolean;
104
103
  removed: boolean;
104
+ error?: undefined;
105
105
  }>>;
@@ -1535,6 +1535,21 @@ function escapeHtmlAttr(value) {
1535
1535
  .replace(/>/g, "&gt;")
1536
1536
  .replace(/"/g, "&quot;");
1537
1537
  }
1538
+ const DESKTOP_MAGIC_LINK_CALLBACK_PATH = "/_agent-native/auth/magic-link/desktop-callback";
1539
+ const DESKTOP_MAGIC_LINK_LANDING_PATH = "/_agent-native/auth/magic-link/desktop-landing";
1540
+ const BETTER_AUTH_MAGIC_LINK_VERIFY_PATH = "/_agent-native/auth/ba/magic-link/verify";
1541
+ function desktopMagicLinkLandingPage(verificationUrl) {
1542
+ const safeVerificationUrl = escapeHtmlAttr(verificationUrl);
1543
+ const html = `<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Continue sign-in</title></head><body><main><h1>Continue signing in</h1><p>Click continue to finish signing in to the Agent Native desktop app.</p><form method="get" action="${safeVerificationUrl}"><button type="submit">Continue</button></form></main></body></html>`;
1544
+ return new Response(html, {
1545
+ status: 200,
1546
+ headers: {
1547
+ "cache-control": "no-store",
1548
+ "content-type": "text/html; charset=utf-8",
1549
+ "referrer-policy": "no-referrer",
1550
+ },
1551
+ });
1552
+ }
1538
1553
  function injectLoginSocialImageMeta(loginHtml, event) {
1539
1554
  const headCloseIdx = loginHtml.indexOf("</head>");
1540
1555
  if (headCloseIdx === -1)
@@ -3010,6 +3025,7 @@ async function mountBetterAuthRoutes(app, options) {
3010
3025
  message: entry.error.message,
3011
3026
  code: entry.error.code,
3012
3027
  });
3028
+ setResponseStatus(event, 400);
3013
3029
  return { error: entry.error.message, ...entry.error };
3014
3030
  }
3015
3031
  // Make the exchange itself establish the app session. Older clients
@@ -3033,6 +3049,53 @@ async function mountBetterAuthRoutes(app, options) {
3033
3049
  // Magic-link verification happens in the system browser, so native shells
3034
3050
  // need the verified browser session copied into the same one-time exchange
3035
3051
  // used by Google OAuth before they can establish their own WebView session.
3052
+ // Keep the desktop email URL itself non-consuming: mail security scanners
3053
+ // commonly prefetch GET links, while Better Auth consumes a magic-link token
3054
+ // on the first verification GET. The explicit form action below is the only
3055
+ // request that reaches Better Auth's consuming verification endpoint.
3056
+ app.use(DESKTOP_MAGIC_LINK_LANDING_PATH, defineEventHandler((event) => {
3057
+ if (!isReadMethod(event)) {
3058
+ setResponseStatus(event, 405);
3059
+ return { error: "Method not allowed" };
3060
+ }
3061
+ const query = getQuery(event);
3062
+ const token = typeof query.token === "string" ? query.token.trim() : "";
3063
+ const callbackURL = typeof query.callbackURL === "string" ? query.callbackURL : "";
3064
+ if (!token || !callbackURL) {
3065
+ setResponseStatus(event, 400);
3066
+ return { error: "Invalid desktop magic-link" };
3067
+ }
3068
+ let callback;
3069
+ try {
3070
+ callback = new URL(callbackURL, getOrigin(event));
3071
+ }
3072
+ catch {
3073
+ setResponseStatus(event, 400);
3074
+ return { error: "Invalid desktop magic-link" };
3075
+ }
3076
+ if (callback.origin !== new URL(getOrigin(event)).origin ||
3077
+ !callback.pathname.endsWith(DESKTOP_MAGIC_LINK_CALLBACK_PATH) ||
3078
+ !normalizeDesktopFlowId(callback.searchParams.get("flow_id")) ||
3079
+ !normalizeDesktopFlowVerifier(callback.searchParams.get("verifier"))) {
3080
+ setResponseStatus(event, 400);
3081
+ return { error: "Invalid desktop magic-link" };
3082
+ }
3083
+ const verificationURL = new URL(getOrigin(event));
3084
+ verificationURL.pathname =
3085
+ getAppBasePath() + BETTER_AUTH_MAGIC_LINK_VERIFY_PATH;
3086
+ verificationURL.searchParams.set("token", token);
3087
+ for (const key of [
3088
+ "callbackURL",
3089
+ "newUserCallbackURL",
3090
+ "errorCallbackURL",
3091
+ ]) {
3092
+ const value = query[key];
3093
+ if (typeof value === "string" && value) {
3094
+ verificationURL.searchParams.set(key, value);
3095
+ }
3096
+ }
3097
+ return desktopMagicLinkLandingPage(verificationURL.toString());
3098
+ }));
3036
3099
  app.use("/_agent-native/auth/magic-link/desktop-callback", defineEventHandler(async (event) => {
3037
3100
  if (!isReadMethod(event)) {
3038
3101
  setResponseStatus(event, 405);
@@ -3040,18 +3103,42 @@ async function mountBetterAuthRoutes(app, options) {
3040
3103
  }
3041
3104
  const flowId = normalizeDesktopFlowId(getQuery(event).flow_id);
3042
3105
  const verifier = normalizeDesktopFlowVerifier(getQuery(event).verifier);
3106
+ const callbackError = getQuery(event).error;
3043
3107
  if (!flowId) {
3044
3108
  setResponseStatus(event, 400);
3045
3109
  return { error: "Missing flow_id" };
3046
3110
  }
3047
3111
  if (!verifier) {
3112
+ setDesktopExchangeError(flowId, {
3113
+ message: AUTH_MAGIC_LINK_FALLBACK,
3114
+ code: "missing_verifier",
3115
+ });
3116
+ return oauthErrorPage(AUTH_MAGIC_LINK_FALLBACK);
3117
+ }
3118
+ if (typeof callbackError === "string" && callbackError.trim()) {
3119
+ const code = callbackError
3120
+ .trim()
3121
+ .replace(/[^a-z0-9_-]/gi, "_")
3122
+ .slice(0, 64);
3123
+ setDesktopExchangeError(flowId, {
3124
+ message: AUTH_MAGIC_LINK_FALLBACK,
3125
+ code: code || "callback_error",
3126
+ });
3127
+ logGoogleOAuthDebug(event, "magic-link-callback-error", {
3128
+ flowId,
3129
+ message: callbackError,
3130
+ code: code || "callback_error",
3131
+ });
3048
3132
  return oauthErrorPage(AUTH_MAGIC_LINK_FALLBACK);
3049
3133
  }
3050
3134
  const session = await getSession(event);
3051
3135
  if (!session?.email || !session.token) {
3052
3136
  setDesktopExchangeError(flowId, {
3053
3137
  message: AUTH_MAGIC_LINK_FALLBACK,
3054
- code: "callback_error",
3138
+ code: "callback_session_missing",
3139
+ });
3140
+ logGoogleOAuthDebug(event, "magic-link-callback-session-missing", {
3141
+ flowId,
3055
3142
  });
3056
3143
  return oauthErrorPage(AUTH_MAGIC_LINK_FALLBACK);
3057
3144
  }
@@ -3067,14 +3154,21 @@ async function mountBetterAuthRoutes(app, options) {
3067
3154
  });
3068
3155
  setDesktopExchangeError(flowId, {
3069
3156
  message: AUTH_MAGIC_LINK_FALLBACK,
3070
- code: "callback_error",
3157
+ code: "callback_session_persist_failed",
3158
+ });
3159
+ logGoogleOAuthDebug(event, "magic-link-callback-session-persist-failed", {
3160
+ flowId,
3071
3161
  });
3072
3162
  return oauthErrorPage(AUTH_MAGIC_LINK_FALLBACK);
3073
3163
  }
3074
- if (!(await claimDesktopMagicLinkFlow(flowId, verifier, session.token, session.email))) {
3164
+ const claimed = await claimDesktopMagicLinkFlow(flowId, verifier, session.token, session.email);
3165
+ if (!claimed) {
3166
+ logGoogleOAuthDebug(event, "magic-link-callback-flow-claim-failed", {
3167
+ flowId,
3168
+ });
3075
3169
  return oauthErrorPage(AUTH_MAGIC_LINK_FALLBACK);
3076
3170
  }
3077
- return oauthDesktopExchangePage("Sign-in complete. You can return to the app.");
3171
+ return oauthDesktopExchangePage("Sign-in complete. You can return to the app.", !isElectronRequest(event));
3078
3172
  }));
3079
3173
  // Initialize Better Auth. Forward `googleScopes` into the BetterAuthConfig
3080
3174
  // so the social provider requests the broader product scopes (Gmail,
@@ -152,6 +152,15 @@ export declare function getBetterAuth(config?: BetterAuthConfig): Promise<Better
152
152
  * Use this in hot paths where you know init has already happened.
153
153
  */
154
154
  export declare function getBetterAuthSync(): BetterAuthInstance | undefined;
155
+ /**
156
+ * Email security scanners commonly prefetch ordinary GET links. Better Auth
157
+ * intentionally consumes a magic-link token on that first GET, so a scanner
158
+ * can otherwise spend a desktop flow before the user ever clicks it. Keep the
159
+ * normal web link unchanged and put only desktop flows behind an explicit
160
+ * confirmation page that hands the original verification URL back after the
161
+ * user acts.
162
+ */
163
+ export declare function desktopMagicLinkLandingUrl(value: string): string | undefined;
155
164
  /**
156
165
  * The subset of Better Auth's internal adapter we use for federated-SSO
157
166
  * JIT account linking. Better Auth owns these writes (id + timestamp +
@@ -549,6 +549,53 @@ export async function getBetterAuth(config) {
549
549
  export function getBetterAuthSync() {
550
550
  return _auth;
551
551
  }
552
+ const BETTER_AUTH_MAGIC_LINK_VERIFY_MARKER = "/_agent-native/auth/ba/magic-link/verify";
553
+ const DESKTOP_MAGIC_LINK_CALLBACK_MARKER = "/_agent-native/auth/magic-link/desktop-callback";
554
+ const DESKTOP_MAGIC_LINK_LANDING_MARKER = "/_agent-native/auth/magic-link/desktop-landing";
555
+ /**
556
+ * Email security scanners commonly prefetch ordinary GET links. Better Auth
557
+ * intentionally consumes a magic-link token on that first GET, so a scanner
558
+ * can otherwise spend a desktop flow before the user ever clicks it. Keep the
559
+ * normal web link unchanged and put only desktop flows behind an explicit
560
+ * confirmation page that hands the original verification URL back after the
561
+ * user acts.
562
+ */
563
+ export function desktopMagicLinkLandingUrl(value) {
564
+ try {
565
+ const verificationUrl = new URL(value);
566
+ const callbackValue = verificationUrl.searchParams.get("callbackURL");
567
+ if (!callbackValue)
568
+ return undefined;
569
+ const callbackUrl = new URL(callbackValue, verificationUrl.origin);
570
+ if (callbackUrl.origin !== verificationUrl.origin)
571
+ return undefined;
572
+ if (!callbackUrl.pathname.endsWith(DESKTOP_MAGIC_LINK_CALLBACK_MARKER)) {
573
+ return undefined;
574
+ }
575
+ const verifyMarkerIndex = verificationUrl.pathname.lastIndexOf(BETTER_AUTH_MAGIC_LINK_VERIFY_MARKER);
576
+ if (verifyMarkerIndex < 0)
577
+ return undefined;
578
+ const landingUrl = new URL(verificationUrl.origin);
579
+ landingUrl.pathname =
580
+ verificationUrl.pathname.slice(0, verifyMarkerIndex) +
581
+ DESKTOP_MAGIC_LINK_LANDING_MARKER;
582
+ for (const key of [
583
+ "token",
584
+ "callbackURL",
585
+ "newUserCallbackURL",
586
+ "errorCallbackURL",
587
+ ]) {
588
+ const queryValue = verificationUrl.searchParams.get(key);
589
+ if (queryValue)
590
+ landingUrl.searchParams.set(key, queryValue);
591
+ }
592
+ return landingUrl.toString();
593
+ }
594
+ catch {
595
+ // coercion-ok: malformed provider URLs keep the original link unchanged.
596
+ return undefined;
597
+ }
598
+ }
552
599
  /**
553
600
  * Replace the only unverified credential account and add Google in one
554
601
  * database transaction. The read in ensureGoogleAuthIdentityWithAdapter is
@@ -1118,9 +1165,10 @@ async function createBetterAuthInstance(config) {
1118
1165
  const magicLinkUrl = appBasePath
1119
1166
  ? url.replace(/(\/\/[^/]+)(\/)/, `$1${appBasePath}$2`)
1120
1167
  : url;
1168
+ const deliveredMagicLinkUrl = desktopMagicLinkLandingUrl(magicLinkUrl) ?? magicLinkUrl;
1121
1169
  const { subject, html, text, appSender } = renderMagicLinkEmail({
1122
1170
  email,
1123
- magicLinkUrl,
1171
+ magicLinkUrl: deliveredMagicLinkUrl,
1124
1172
  });
1125
1173
  await sendEmail({ to: email, subject, html, text, appSender });
1126
1174
  },
@@ -208,4 +208,4 @@ export declare function oauthCallbackResponse(event: H3Event, email: string, opt
208
208
  * which can echo upstream provider strings (and historically attacker-
209
209
  * controlled query params via the `error_description` field). */
210
210
  export declare function oauthErrorPage(message: string): Response;
211
- export declare function oauthDesktopExchangePage(message?: string): Response;
211
+ export declare function oauthDesktopExchangePage(message?: string, closeWindow?: boolean): Response;
@@ -693,9 +693,12 @@ export function oauthErrorPage(message) {
693
693
  const safe = escapeHtml(message);
694
694
  return htmlResponse(`<!DOCTYPE html><html><head><meta charset="utf-8"><title>Connection failed</title></head><body style="background:#111;color:#ccc;font-family:system-ui;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;flex-direction:column;text-align:center"><svg width="44" height="44" viewBox="0 0 24 24" fill="none" stroke="#ef4444" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-bottom:14px" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M15 9l-6 6"/><path d="M9 9l6 6"/></svg><p style="font-size:16px;margin:0 0 12px 0;color:#ddd">${safe}</p><p style="font-size:13px;color:#888;margin:0"><a href="/" style="color:#888;text-decoration:underline;text-underline-offset:3px">Back to login</a></p></body></html>`, 400);
695
695
  }
696
- export function oauthDesktopExchangePage(message = "Returning to the app...") {
696
+ export function oauthDesktopExchangePage(message = "Returning to the app...", closeWindow = true) {
697
697
  const safe = escapeHtml(message);
698
- return htmlResponse(`<!DOCTYPE html><html><head><meta charset="utf-8"><title>Returning</title></head><body style="background:#111;color:#aaa;font-family:system-ui;display:flex;align-items:center;justify-content:center;height:100vh;margin:0"><p style="font-size:14px">${safe}</p><script>window.close()</script></body></html>`);
698
+ const closeScript = closeWindow ? "<script>window.close()</script>" : "";
699
+ // guard:allow-raw-color - standalone callback page intentionally uses fixed dark colors.
700
+ const page = `<!DOCTYPE html><html><head><meta charset="utf-8"><title>Returning</title></head><body style="background:#111;color:#aaa;font-family:system-ui;display:flex;align-items:center;justify-content:center;height:100vh;margin:0"><p style="font-size:14px">${safe}</p></body></html>`;
701
+ return htmlResponse(page.replace("</body>", `${closeScript}</body>`));
699
702
  }
700
703
  // ─── Internal ────────────────────────────────────────────────────────────────
701
704
  function resolveOAuthAppName(explicit) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.158.2",
3
+ "version": "0.158.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": {