@agent-native/core 0.157.23 → 0.157.27

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.
@@ -10,8 +10,9 @@
10
10
  * identity assertion server-to-server.
11
11
  *
12
12
  * The browser never receives a JWT, password, or reusable identity assertion.
13
- * The default-off Desktop flag still gates only the packaged Canary path;
14
- * ordinary browser federation remains controlled by the client's explicit
13
+ * The device-local Desktop setting controls whether the parent login surface
14
+ * appears. The per-user Desktop flag still gates session fan-out; ordinary
15
+ * browser federation remains controlled by the client's explicit
15
16
  * identity-hub configuration.
16
17
  */
17
18
 
@@ -47,12 +48,12 @@ import {
47
48
 
48
49
  const AVAILABILITY_PATH = "/_agent-native/identity/availability";
49
50
  const AUTHORIZE_PATH = "/_agent-native/identity/authorize";
50
- const DESKTOP_SSO_CANARY_USER_AGENT = /AgentNativeDesktopSsoCanary\//i;
51
+ const DESKTOP_SSO_USER_AGENT = /AgentNativeDesktop(?:SsoCanary)?\//i;
51
52
 
52
53
  export function isDesktopWorkspaceSsoRequest(
53
54
  userAgent: string | undefined,
54
55
  ): boolean {
55
- return DESKTOP_SSO_CANARY_USER_AGENT.test(userAgent ?? "");
56
+ return DESKTOP_SSO_USER_AGENT.test(userAgent ?? "");
56
57
  }
57
58
 
58
59
  function getRequestUrl(event: H3Event): string {
@@ -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;
@@ -4,6 +4,7 @@ export const EXTENSION_FRAME_ANCESTORS = [
4
4
  "'self'",
5
5
  "https://agent-native.com",
6
6
  "https://*.agent-native.com",
7
+ "https://agent-workspace.builder.io",
7
8
  "http://localhost:*",
8
9
  "http://127.0.0.1:*",
9
10
  "https://*.claudemcpcontent.com",
@@ -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
  }>>;
@@ -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
  }>>;
@@ -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;
@@ -65,7 +65,7 @@ import { getAllowedCorsOrigin, readCorsAllowedOrigins, } from "./cors-origins.js
65
65
  import { readDesktopSso, writeDesktopSso, clearDesktopSso, } from "./desktop-sso.js";
66
66
  import { resolveGoogleSignInCredentials } from "./google-oauth-credentials.js";
67
67
  import { isElectron as isElectronRequest, getAppBasePath, getAppUrl, getOrigin, encodeOAuthState, decodeOAuthState, createOAuthSession, oauthCallbackResponse, oauthDesktopExchangePage, oauthErrorPage, resolveOAuthRedirectUri, isAllowedOAuthRedirectUri, } from "./google-oauth.js";
68
- import { isCanonicalAgentNativeAppRequest, isCanonicalIdentitySsoClientRequest, isDesktopSsoCanaryUserAgent, isIdentitySsoExplicitlyEnabled, } from "./identity-sso-store.js";
68
+ import { isCanonicalAgentNativeAppRequest, isCanonicalIdentitySsoClientRequest, isDesktopSsoUserAgent, isIdentitySsoExplicitlyEnabled, } from "./identity-sso-store.js";
69
69
  import { ensureCanonicalUserForLegacySession } from "./legacy-auth-migration.js";
70
70
  import { encodeMagicLinkSignupAttribution, MAGIC_LINK_ATTRIBUTION_PARAM, } from "./magic-link-attribution.js";
71
71
  import { safeOAuthReturnUrl } from "./oauth-return-url.js";
@@ -1769,12 +1769,12 @@ function createAuthGuardFn(app) {
1769
1769
  // identity subpath.
1770
1770
  const isIdentitySsoEntryPath = p === "/_agent-native/identity/login" ||
1771
1771
  p === "/_agent-native/identity/callback";
1772
- const isDesktopCanaryIdentityRequest = isDesktopSsoCanaryUserAgent(getHeader(event, "user-agent")) &&
1772
+ const isDesktopIdentityRequest = isDesktopSsoUserAgent(getHeader(event, "user-agent")) &&
1773
1773
  isCanonicalAgentNativeAppRequest(getHeader(event, "host"), getHeader(event, "x-forwarded-proto"));
1774
1774
  const isCanonicalHostedIdentityRequest = isCanonicalIdentitySsoClientRequest(getHeader(event, "host"), getHeader(event, "x-forwarded-proto"));
1775
1775
  if (isIdentitySsoEntryPath &&
1776
1776
  (isIdentitySsoExplicitlyEnabled() ||
1777
- isDesktopCanaryIdentityRequest ||
1777
+ isDesktopIdentityRequest ||
1778
1778
  isCanonicalHostedIdentityRequest)) {
1779
1779
  return;
1780
1780
  }
@@ -329,12 +329,49 @@ function safeRequestReturnPath(event) {
329
329
  }
330
330
  }
331
331
  export async function handleIdentitySso(event, subpath) {
332
- const hub = resolveIdentityHubUrl(event);
333
- if (!hub)
334
- return new Response("Not found", { status: 404 });
335
332
  const method = getMethod(event);
336
333
  const sub = ("/" + subpath.replace(/^\/+/, "").replace(/\/+$/, "")).replace(/^\/$/, "");
337
334
  const loginPath = SIGN_IN_ENTRY_PATH;
335
+ // Dispatch is the identity authority, so it has no SSO hub for the
336
+ // browser to federate to. Its authenticated desktop completion page still
337
+ // lives on this route and must be reachable after ordinary sign-in.
338
+ if (sub === "/desktop-complete") {
339
+ if (method !== "GET" && method !== "HEAD") {
340
+ return new Response("Method not allowed", { status: 405 });
341
+ }
342
+ let nonce = "";
343
+ try {
344
+ nonce =
345
+ new URL(requestUrl(event), "http://an.invalid").searchParams.get("nonce") || "";
346
+ }
347
+ catch {
348
+ return new Response("Invalid completion request", { status: 400 });
349
+ }
350
+ if (!DESKTOP_COMPLETION_NONCE.test(nonce)) {
351
+ return new Response("Invalid completion request", { status: 400 });
352
+ }
353
+ const current = await getSession(event).catch((error) => {
354
+ void error;
355
+ return null;
356
+ });
357
+ if (!current?.email) {
358
+ return new Response("Authentication required", { status: 401 });
359
+ }
360
+ return new Response('<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8">' +
361
+ '<meta name="viewport" content="width=device-width,initial-scale=1">' +
362
+ "<title>Signed in</title></head><body>Signed in. You can close this window.</body></html>", {
363
+ status: 200,
364
+ headers: {
365
+ "Cache-Control": "no-store",
366
+ "Content-Security-Policy": "default-src 'none'; style-src 'none'",
367
+ "Content-Type": "text/html; charset=utf-8",
368
+ "Referrer-Policy": "no-referrer",
369
+ },
370
+ });
371
+ }
372
+ const hub = resolveIdentityHubUrl(event);
373
+ if (!hub)
374
+ return new Response("Not found", { status: 404 });
338
375
  if (sub === "/login") {
339
376
  if (method !== "GET" && method !== "HEAD") {
340
377
  return new Response("Method not allowed", { status: 405 });
@@ -437,40 +474,6 @@ export async function handleIdentitySso(event, subpath) {
437
474
  }
438
475
  return redirect(event, safeReturnPath(stateResult.returnPath));
439
476
  }
440
- if (sub === "/desktop-complete") {
441
- if (method !== "GET" && method !== "HEAD") {
442
- return new Response("Method not allowed", { status: 405 });
443
- }
444
- let nonce = "";
445
- try {
446
- nonce =
447
- new URL(requestUrl(event), "http://an.invalid").searchParams.get("nonce") || "";
448
- }
449
- catch {
450
- return new Response("Invalid completion request", { status: 400 });
451
- }
452
- if (!DESKTOP_COMPLETION_NONCE.test(nonce)) {
453
- return new Response("Invalid completion request", { status: 400 });
454
- }
455
- const current = await getSession(event).catch((error) => {
456
- void error;
457
- return null;
458
- });
459
- if (!current?.email) {
460
- return new Response("Authentication required", { status: 401 });
461
- }
462
- return new Response('<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8">' +
463
- '<meta name="viewport" content="width=device-width,initial-scale=1">' +
464
- "<title>Signed in</title></head><body>Signed in. You can close this window.</body></html>", {
465
- status: 200,
466
- headers: {
467
- "Cache-Control": "no-store",
468
- "Content-Security-Policy": "default-src 'none'; style-src 'none'",
469
- "Content-Type": "text/html; charset=utf-8",
470
- "Referrer-Policy": "no-referrer",
471
- },
472
- });
473
- }
474
477
  return new Response("Not found", { status: 404 });
475
478
  }
476
479
  export function isIdentitySsoBypassPath(p) {
@@ -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.23",
3
+ "version": "0.157.27",
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": {