@agent-native/core 0.157.16 → 0.157.17

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.
@@ -21,7 +21,11 @@ import {
21
21
  isFeatureFlagEnabled,
22
22
  } from "@agent-native/core/feature-flags";
23
23
  import { getOrgDomain } from "@agent-native/core/org";
24
- import { getH3App, getSession } from "@agent-native/core/server";
24
+ import {
25
+ getH3App,
26
+ getSession,
27
+ hasGoogleAuthIdentity,
28
+ } from "@agent-native/core/server";
25
29
  import { signInJourney } from "@agent-native/core/shared";
26
30
  import { defineEventHandler, getHeader, getMethod, readBody } from "h3";
27
31
  import type { H3Event } from "h3";
@@ -324,6 +328,9 @@ export const tokenHandler = defineEventHandler(
324
328
  name: identity.name,
325
329
  orgDomain: identity.orgDomain,
326
330
  });
331
+ const identityAuthProvider = (await hasGoogleAuthIdentity(identity.email))
332
+ ? "google"
333
+ : undefined;
327
334
  let assertion: string;
328
335
  try {
329
336
  assertion = await signA2AToken(
@@ -337,6 +344,9 @@ export const tokenHandler = defineEventHandler(
337
344
  extraClaims: {
338
345
  email: claims.email,
339
346
  ...(claims.name ? { name: claims.name } : {}),
347
+ ...(identityAuthProvider
348
+ ? { identity_auth_provider: identityAuthProvider }
349
+ : {}),
340
350
  scope: IDENTITY_SCOPE,
341
351
  jti: identity.jti,
342
352
  redirect_uri: redirectUri,
@@ -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
  }>>;
@@ -15,6 +15,6 @@ export declare function createProgressHandler(): import("h3").EventHandlerWithFe
15
15
  error: string;
16
16
  ok?: undefined;
17
17
  } | {
18
- error?: undefined;
19
18
  ok: boolean;
19
+ error?: undefined;
20
20
  }>>;
@@ -48,8 +48,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
48
48
  }>;
49
49
  /** DELETE /_agent-native/resources/:id — delete a resource */
50
50
  export declare function handleDeleteResource(event: any): Promise<{
51
- ok?: undefined;
52
51
  error: string;
52
+ ok?: undefined;
53
53
  } | {
54
54
  error?: undefined;
55
55
  ok: boolean;
@@ -8,6 +8,8 @@
8
8
  import { type BetterAuthOptions } from "better-auth";
9
9
  export { getAuthLoginMode, resolveAuthLoginMode, resolveAuthLoginModeFromReadiness, type AuthLoginMode, } from "./auth-login-mode.js";
10
10
  export declare function hasBetterAuthUserEmail(email: string): Promise<boolean>;
11
+ /** Return whether the canonical user has a verified Google account link. */
12
+ export declare function hasGoogleAuthIdentity(email: string): Promise<boolean | undefined>;
11
13
  export declare function trackSignupEvent({ authProvider, authUserId, email, name, attribution, anonymousId, }: {
12
14
  authProvider: string;
13
15
  authUserId?: string;
@@ -54,6 +54,17 @@ export async function hasBetterAuthUserEmail(email) {
54
54
  .catch(() => null);
55
55
  return !!existing?.user?.email;
56
56
  }
57
+ /** Return whether the canonical user has a verified Google account link. */
58
+ export async function hasGoogleAuthIdentity(email) {
59
+ const adapter = await getBetterAuthInternalAdapter();
60
+ if (!adapter)
61
+ return undefined;
62
+ const existing = await adapter.findUserByEmail(email.trim().toLowerCase(), {
63
+ includeAccounts: true,
64
+ });
65
+ return (existing?.accounts.some((account) => account.providerId === "google") ??
66
+ false);
67
+ }
57
68
  export async function trackSignupEvent({ authProvider, authUserId, email, name, attribution, anonymousId, }) {
58
69
  identify(email, {
59
70
  email,
@@ -218,6 +218,7 @@ async function verifyIdentityAssertion(assertion, binding) {
218
218
  orgDomain: typeof payload.org_domain === "string" && payload.org_domain
219
219
  ? payload.org_domain
220
220
  : undefined,
221
+ authProvider: payload.identity_auth_provider === "google" ? "google" : undefined,
221
222
  sub: typeof payload.sub === "string" && payload.sub ? payload.sub : email,
222
223
  jti,
223
224
  };
@@ -416,7 +417,8 @@ export async function handleIdentitySso(event, subpath) {
416
417
  if (!identity || (await isJtiReplayed(identity.jti))) {
417
418
  return errorPage("We could not verify the sign-in response. Please try again.", loginPath);
418
419
  }
419
- if (await isGoogleSignInRequiredForEmail(identity.email)) {
420
+ if ((await isGoogleSignInRequiredForEmail(identity.email)) &&
421
+ identity.authProvider !== "google") {
420
422
  return errorPage(GOOGLE_AUTH_REQUIRED_MESSAGE, loginPath);
421
423
  }
422
424
  try {
@@ -9,6 +9,7 @@ export { createEmbedSessionTicket, consumeEmbedSessionTicket, normalizeEmbedTarg
9
9
  export { createSSEHandler, type SSEHandlerOptions } from "./sse.js";
10
10
  export { mountAuthMiddleware, autoMountAuth, registerAuthPublicPaths, getSession, COOKIE_NAME, addSession, removeSession, getSessionEmail, getFrameworkSessionCookieValues, setFrameworkSessionCookie, clearFrameworkSessionCookies, runAuthGuard, setDesktopExchange, setDesktopExchangeError, safeReturnPath, type DesktopExchangeErrorPayload, type AuthSession, type AuthOptions, } from "./auth.js";
11
11
  export { handleIdentitySso, getIdentityHubUrl, isIdentitySsoEnabled, isIdentitySsoBypassPath, identitySsoLoginButtonHtml, IDENTITY_SSO_PROVIDER_ID, IDENTITY_SSO_SCOPE, IDENTITY_SSO_DESKTOP_COMPLETE_PATH, } from "./identity-sso.js";
12
+ export { hasGoogleAuthIdentity } from "./better-auth-instance.js";
12
13
  export { requireEnvKey, type MissingKeyResponse } from "./missing-key.js";
13
14
  export { assertCurrentRequestUserIsOrgAdmin, currentRequestUserIsOrgAdmin, } from "./org-admin.js";
14
15
  export { verifyCaptcha, type CaptchaVerifyResult } from "./captcha.js";
@@ -9,6 +9,7 @@ export { createEmbedSessionTicket, consumeEmbedSessionTicket, normalizeEmbedTarg
9
9
  export { createSSEHandler } from "./sse.js";
10
10
  export { mountAuthMiddleware, autoMountAuth, registerAuthPublicPaths, getSession, COOKIE_NAME, addSession, removeSession, getSessionEmail, getFrameworkSessionCookieValues, setFrameworkSessionCookie, clearFrameworkSessionCookies, runAuthGuard, setDesktopExchange, setDesktopExchangeError, safeReturnPath, } from "./auth.js";
11
11
  export { handleIdentitySso, getIdentityHubUrl, isIdentitySsoEnabled, isIdentitySsoBypassPath, identitySsoLoginButtonHtml, IDENTITY_SSO_PROVIDER_ID, IDENTITY_SSO_SCOPE, IDENTITY_SSO_DESKTOP_COMPLETE_PATH, } from "./identity-sso.js";
12
+ export { hasGoogleAuthIdentity } from "./better-auth-instance.js";
12
13
  export { requireEnvKey } from "./missing-key.js";
13
14
  export { assertCurrentRequestUserIsOrgAdmin, currentRequestUserIsOrgAdmin, } from "./org-admin.js";
14
15
  export { verifyCaptcha } from "./captcha.js";
@@ -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
  }>>;
@@ -20,6 +20,6 @@ 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
  }>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.157.16",
3
+ "version": "0.157.17",
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": {