@agent-native/core 0.157.15 → 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.
- package/corpus/templates/dispatch/server/plugins/identity-sso.ts +11 -1
- package/dist/a2a/server.d.ts +4 -1
- package/dist/a2a/server.js +4 -0
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +3 -3
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/better-auth-instance.d.ts +2 -0
- package/dist/server/better-auth-instance.js +11 -0
- package/dist/server/identity-sso.js +3 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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 {
|
|
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,
|
package/dist/a2a/server.d.ts
CHANGED
|
@@ -2,11 +2,14 @@ import type { A2AConfig, AgentSkill } from "./types.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Result of verifying an inbound A2A JWT. `email` is the caller identity from
|
|
4
4
|
* the token's `sub` claim (null when verification fails), `orgDomain` mirrors
|
|
5
|
-
* the verified `org_domain` claim when present
|
|
5
|
+
* the verified `org_domain` claim when present, and `orgId` mirrors the
|
|
6
|
+
* optional verified `org_id` claim used when a sender knows its exact org but
|
|
7
|
+
* cannot resolve that org's domain.
|
|
6
8
|
*/
|
|
7
9
|
export interface A2ATokenPayload {
|
|
8
10
|
email: string | null;
|
|
9
11
|
orgDomain: string | null;
|
|
12
|
+
orgId?: string;
|
|
10
13
|
}
|
|
11
14
|
/**
|
|
12
15
|
* Verify an inbound A2A bearer token (HS256) exactly as the
|
package/dist/a2a/server.js
CHANGED
|
@@ -166,9 +166,13 @@ export async function verifyA2AToken(token, event, audienceOptions) {
|
|
|
166
166
|
for (const secret of candidateSecrets) {
|
|
167
167
|
try {
|
|
168
168
|
const { payload } = await jose.jwtVerify(token, new TextEncoder().encode(secret), verifyOptions);
|
|
169
|
+
const orgId = typeof payload.org_id === "string" && payload.org_id.trim()
|
|
170
|
+
? payload.org_id.trim()
|
|
171
|
+
: undefined;
|
|
169
172
|
return {
|
|
170
173
|
email: payload.sub ?? null,
|
|
171
174
|
orgDomain: payload.org_domain ?? null,
|
|
175
|
+
...(orgId ? { orgId } : {}),
|
|
172
176
|
};
|
|
173
177
|
}
|
|
174
178
|
catch {
|
|
@@ -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
|
-
error: string;
|
|
17
16
|
ok?: undefined;
|
|
17
|
+
error: string;
|
|
18
18
|
} | {
|
|
19
19
|
error?: undefined;
|
|
20
20
|
ok: boolean;
|
|
@@ -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
|
}>>;
|
|
@@ -41,16 +41,16 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
-
error?: undefined;
|
|
45
44
|
summary: import("./types.js").TraceSummary;
|
|
46
45
|
spans: import("./types.js").TraceSpan[];
|
|
47
46
|
id?: undefined;
|
|
47
|
+
error?: undefined;
|
|
48
48
|
ok?: undefined;
|
|
49
49
|
} | {
|
|
50
|
-
error?: undefined;
|
|
51
50
|
summary?: undefined;
|
|
52
51
|
spans?: undefined;
|
|
53
52
|
id: string;
|
|
53
|
+
error?: undefined;
|
|
54
54
|
ok?: undefined;
|
|
55
55
|
} | {
|
|
56
56
|
summary?: undefined;
|
|
@@ -59,9 +59,9 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
59
59
|
error: any;
|
|
60
60
|
ok?: undefined;
|
|
61
61
|
} | {
|
|
62
|
-
error?: undefined;
|
|
63
62
|
summary?: undefined;
|
|
64
63
|
spans?: undefined;
|
|
65
64
|
id?: undefined;
|
|
65
|
+
error?: undefined;
|
|
66
66
|
ok: boolean;
|
|
67
67
|
}>>;
|
|
@@ -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;
|
|
@@ -27,10 +27,10 @@ export declare function resolveAgentEngineApiKeyWriteTarget(event: H3Event, scop
|
|
|
27
27
|
export declare function createAgentEngineApiKeyHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
28
28
|
error: any;
|
|
29
29
|
} | {
|
|
30
|
-
error?: undefined;
|
|
31
30
|
ok: boolean;
|
|
32
31
|
key: string;
|
|
33
32
|
baseUrlKey?: string;
|
|
34
33
|
scope: AgentEngineApiKeyScope;
|
|
34
|
+
error?: undefined;
|
|
35
35
|
}>>;
|
|
36
36
|
export {};
|
|
@@ -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 {
|
package/dist/server/index.d.ts
CHANGED
|
@@ -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";
|
package/dist/server/index.js
CHANGED
|
@@ -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
|
}>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.157.
|
|
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": {
|