@agent-native/core 0.157.13 → 0.157.14

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.
@@ -17,11 +17,11 @@ declare const _default: import("../../action.js").ActionDefinition<{
17
17
  id?: undefined;
18
18
  provider?: undefined;
19
19
  } | {
20
+ error?: undefined;
20
21
  configured?: undefined;
21
22
  connectPath?: undefined;
22
23
  url: string;
23
24
  id: string;
24
25
  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;
140
141
  query?: undefined;
141
142
  minutes?: undefined;
142
143
  limit?: undefined;
143
144
  clientHint?: undefined;
144
145
  timestamp?: undefined;
145
146
  chapterId?: undefined;
146
- count?: undefined;
147
147
  startAt?: undefined;
148
148
  endAt?: undefined;
149
149
  reason?: undefined;
@@ -159,6 +159,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
159
159
  inputSchema: {
160
160
  type: string;
161
161
  properties: {
162
+ count?: undefined;
162
163
  query: {
163
164
  type: string;
164
165
  description: string;
@@ -174,7 +175,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
174
175
  clientHint?: undefined;
175
176
  timestamp?: undefined;
176
177
  chapterId?: undefined;
177
- count?: undefined;
178
178
  startAt?: undefined;
179
179
  endAt?: undefined;
180
180
  reason?: undefined;
@@ -190,6 +190,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
190
190
  inputSchema: {
191
191
  type: string;
192
192
  properties: {
193
+ count?: undefined;
193
194
  minutes: {
194
195
  type: string;
195
196
  description: string;
@@ -199,7 +200,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
199
200
  clientHint?: undefined;
200
201
  timestamp?: undefined;
201
202
  chapterId?: undefined;
202
- count?: undefined;
203
203
  startAt?: undefined;
204
204
  endAt?: undefined;
205
205
  reason?: undefined;
@@ -216,6 +216,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
216
216
  type: string;
217
217
  required: string[];
218
218
  properties: {
219
+ count?: undefined;
219
220
  query: {
220
221
  type: string;
221
222
  description: string;
@@ -234,7 +235,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
234
235
  };
235
236
  timestamp?: undefined;
236
237
  chapterId?: undefined;
237
- count?: undefined;
238
238
  startAt?: undefined;
239
239
  endAt?: undefined;
240
240
  reason?: undefined;
@@ -250,6 +250,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
250
250
  type: string;
251
251
  required: string[];
252
252
  properties: {
253
+ count?: undefined;
253
254
  query?: undefined;
254
255
  minutes?: undefined;
255
256
  limit?: undefined;
@@ -263,7 +264,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
263
264
  description: string;
264
265
  };
265
266
  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;
317
318
  query?: undefined;
318
319
  minutes?: undefined;
319
320
  limit?: undefined;
320
321
  clientHint?: undefined;
321
322
  timestamp?: undefined;
322
323
  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;
352
353
  query?: undefined;
353
354
  minutes?: undefined;
354
355
  limit?: undefined;
355
356
  clientHint?: undefined;
356
357
  timestamp?: undefined;
357
358
  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;
19
20
  updated: number;
20
21
  error?: undefined;
21
22
  ok?: undefined;
22
- count?: undefined;
23
23
  } | {
24
+ count?: undefined;
24
25
  updated?: undefined;
25
26
  error: string;
26
27
  ok?: undefined;
27
- count?: undefined;
28
28
  } | {
29
+ count?: undefined;
29
30
  updated?: undefined;
30
31
  error?: undefined;
31
32
  ok: boolean;
32
- count?: undefined;
33
33
  }>>;
@@ -41,14 +41,14 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
- ok?: undefined;
45
44
  error?: undefined;
45
+ ok?: undefined;
46
46
  summary: import("./types.js").TraceSummary;
47
47
  spans: import("./types.js").TraceSpan[];
48
48
  id?: undefined;
49
49
  } | {
50
- ok?: undefined;
51
50
  error?: undefined;
51
+ ok?: undefined;
52
52
  summary?: undefined;
53
53
  spans?: undefined;
54
54
  id: string;
@@ -37,17 +37,17 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
37
37
  ok?: undefined;
38
38
  status?: undefined;
39
39
  } | {
40
+ error?: undefined;
40
41
  ok: boolean;
41
42
  status: string;
42
- error?: undefined;
43
43
  } | {
44
44
  ok?: undefined;
45
45
  error: string;
46
46
  removed?: undefined;
47
47
  } | {
48
+ error?: undefined;
48
49
  ok: boolean;
49
50
  removed: boolean;
50
- error?: undefined;
51
51
  }>>;
52
52
  /**
53
53
  * POST /_agent-native/secrets/:key/test — validate an optional candidate value
@@ -58,13 +58,13 @@ export declare function createTestSecretHandler(): import("h3").EventHandlerWith
58
58
  error: string;
59
59
  note?: undefined;
60
60
  } | {
61
+ error?: undefined;
61
62
  ok: boolean;
62
63
  note?: undefined;
63
- error?: undefined;
64
64
  } | {
65
+ error?: undefined;
65
66
  ok: boolean;
66
67
  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;
98
99
  ok: boolean;
99
100
  key: string;
100
- error?: undefined;
101
101
  } | {
102
+ error?: undefined;
102
103
  ok: boolean;
103
104
  removed: boolean;
104
- error?: undefined;
105
105
  }>>;
@@ -238,6 +238,7 @@ async function resolveRequestAuthCapability(event) {
238
238
  */
239
239
  export function mountActionRoutes(nitroApp, actions, options) {
240
240
  const mounted = [];
241
+ const app = getH3App(nitroApp);
241
242
  for (const [name, entry] of Object.entries(actions)) {
242
243
  // Skip agent-only actions
243
244
  if (entry.http === false)
@@ -250,9 +251,9 @@ export function mountActionRoutes(nitroApp, actions, options) {
250
251
  // auth guard rejects it; the action route still fails closed on invalid
251
252
  // or missing credentials.
252
253
  if (name === "list-feature-flags" || name === "set-feature-flag") {
253
- registerAuthPublicPaths([routePath]);
254
+ registerAuthPublicPaths([routePath], app);
254
255
  }
255
- getH3App(nitroApp).use(routePath, defineEventHandler(async (event) => {
256
+ app.use(routePath, defineEventHandler(async (event) => {
256
257
  const reqMethod = getMethod(event);
257
258
  const effectiveMethod = reqMethod === "HEAD" && method === "GET" ? "GET" : reqMethod;
258
259
  if (reqMethod === "OPTIONS") {
@@ -229,7 +229,7 @@ export declare function getSessionEmail(token: string): Promise<string | null>;
229
229
  * routes can be mounted after the auth plugin and must also work in custom
230
230
  * workspace deployments that do not own a template auth file.
231
231
  */
232
- export declare function registerAuthPublicPaths(paths: readonly string[]): void;
232
+ export declare function registerAuthPublicPaths(paths: readonly string[], app?: object): void;
233
233
  export interface DesktopExchangeErrorPayload {
234
234
  message: string;
235
235
  code?: string;
@@ -960,7 +960,29 @@ export async function getSessionEmail(token) {
960
960
  // ---------------------------------------------------------------------------
961
961
  let customGetSession = null;
962
962
  let _authGuardConfig = null;
963
+ // Pin the registry to globalThis so template plugins and framework routes that
964
+ // load Core through different SSR bundle or pnpm peer graphs still share it.
965
+ // Scope entries by H3 app so a route registered by one app cannot become public
966
+ // in another app that happens to share the same Node realm.
967
+ const AUTH_PUBLIC_PATHS_REGISTRY_KEY = Symbol.for("@agent-native/core/auth.publicPaths");
963
968
  const _registeredAuthPublicPaths = new Set();
969
+ function getAuthPublicPathRegistry() {
970
+ const globals = globalThis;
971
+ return (globals[AUTH_PUBLIC_PATHS_REGISTRY_KEY] ??= {
972
+ pathsByApp: new WeakMap(),
973
+ });
974
+ }
975
+ function getRegisteredAuthPublicPaths(app) {
976
+ if (!app)
977
+ return _registeredAuthPublicPaths;
978
+ const registry = getAuthPublicPathRegistry();
979
+ let paths = registry.pathsByApp.get(app);
980
+ if (!paths) {
981
+ paths = new Set();
982
+ registry.pathsByApp.set(app, paths);
983
+ }
984
+ return paths;
985
+ }
964
986
  const _genericGoogleOAuthRoutesEnabled = new WeakMap();
965
987
  /**
966
988
  * Allow framework routes with their own non-cookie authentication to reach
@@ -970,20 +992,23 @@ const _genericGoogleOAuthRoutesEnabled = new WeakMap();
970
992
  * routes can be mounted after the auth plugin and must also work in custom
971
993
  * workspace deployments that do not own a template auth file.
972
994
  */
973
- export function registerAuthPublicPaths(paths) {
995
+ export function registerAuthPublicPaths(paths, app) {
996
+ const registeredPaths = getRegisteredAuthPublicPaths(app);
974
997
  for (const path of paths) {
975
998
  const normalized = typeof path === "string" ? path.trim() : "";
976
999
  if (!normalized.startsWith("/"))
977
1000
  continue;
978
- _registeredAuthPublicPaths.add(normalized);
979
- if (_authGuardConfig &&
980
- !_authGuardConfig.publicPaths.includes(normalized)) {
981
- _authGuardConfig.publicPaths.push(normalized);
982
- }
1001
+ registeredPaths.add(normalized);
983
1002
  }
984
1003
  }
985
- function resolveAuthPublicPaths(paths) {
986
- return [...new Set([...(paths ?? []), ..._registeredAuthPublicPaths])];
1004
+ function resolveAuthPublicPaths(paths, app) {
1005
+ return [
1006
+ ...new Set([
1007
+ ...(paths ?? []),
1008
+ ..._registeredAuthPublicPaths,
1009
+ ...(app ? getRegisteredAuthPublicPaths(app) : []),
1010
+ ]),
1011
+ ];
987
1012
  }
988
1013
  function getRequestHost(event) {
989
1014
  return (getHeader(event, "x-forwarded-host") ??
@@ -1564,12 +1589,14 @@ function isHtmlDocumentRequest(event, pathname) {
1564
1589
  const accept = getHeader(event, "accept")?.toLowerCase();
1565
1590
  return !accept || accept.includes("text/html") || accept.includes("*/*");
1566
1591
  }
1567
- function createAuthGuardFn() {
1592
+ function createAuthGuardFn(app) {
1568
1593
  return async (event) => {
1569
1594
  const config = _authGuardConfig;
1570
1595
  if (!config)
1571
1596
  return;
1572
- const { publicPaths } = config;
1597
+ // Resolve on every request because a framework route can be mounted by a
1598
+ // different Core module instance after this auth guard is initialized.
1599
+ const publicPaths = resolveAuthPublicPaths(config.publicPaths, app);
1573
1600
  const url = event.node?.req?.url ?? event.path ?? "/";
1574
1601
  const queryStart = url.indexOf("?");
1575
1602
  const rawPath = queryStart >= 0 ? url.slice(0, queryStart) : url;
@@ -2602,7 +2629,7 @@ function getCustomAuthRequiredHtml() {
2602
2629
  // mountBetterAuthRoutes — Better Auth powered auth with backward-compat routes
2603
2630
  // ---------------------------------------------------------------------------
2604
2631
  async function mountBetterAuthRoutes(app, options) {
2605
- const publicPaths = resolveAuthPublicPaths(options.publicPaths);
2632
+ const publicPaths = resolveAuthPublicPaths(options.publicPaths, app);
2606
2633
  const workspaceAppAudience = resolveWorkspaceAppAudience(options);
2607
2634
  const workspaceAppRouteAccess = resolveWorkspaceAppRouteAccess(options);
2608
2635
  // The A2A agent card is part of an open protocol — other agents must be
@@ -3612,7 +3639,7 @@ async function mountBetterAuthRoutes(app, options) {
3612
3639
  workspaceAppPublicPaths: workspaceAppRouteAccess.publicPaths,
3613
3640
  workspaceAppProtectedPaths: workspaceAppRouteAccess.protectedPaths,
3614
3641
  };
3615
- const guardFn = createAuthGuardFn();
3642
+ const guardFn = createAuthGuardFn(app);
3616
3643
  _authGuardFn = guardFn;
3617
3644
  app.use(defineEventHandler(guardFn));
3618
3645
  }
@@ -3835,7 +3862,7 @@ export async function autoMountAuth(app, options = {}) {
3835
3862
  // Reset globals
3836
3863
  customGetSession = null;
3837
3864
  sessionMaxAge = options.maxAge ?? DEFAULT_MAX_AGE;
3838
- const publicPaths = resolveAuthPublicPaths(options.publicPaths);
3865
+ const publicPaths = resolveAuthPublicPaths(options.publicPaths, app);
3839
3866
  const workspaceAppAudience = resolveWorkspaceAppAudience(options);
3840
3867
  const workspaceAppRouteAccess = resolveWorkspaceAppRouteAccess(options);
3841
3868
  mountAuthCorsMiddleware(app);
@@ -3880,7 +3907,7 @@ export async function autoMountAuth(app, options = {}) {
3880
3907
  workspaceAppPublicPaths: workspaceAppRouteAccess.publicPaths,
3881
3908
  workspaceAppProtectedPaths: workspaceAppRouteAccess.protectedPaths,
3882
3909
  };
3883
- const guardFn = createAuthGuardFn();
3910
+ const guardFn = createAuthGuardFn(app);
3884
3911
  _authGuardFn = guardFn;
3885
3912
  app.use(defineEventHandler(guardFn));
3886
3913
  if (process.env.DEBUG)
@@ -3907,7 +3934,7 @@ export async function autoMountAuth(app, options = {}) {
3907
3934
  workspaceAppPublicPaths: workspaceAppRouteAccess.publicPaths,
3908
3935
  workspaceAppProtectedPaths: workspaceAppRouteAccess.protectedPaths,
3909
3936
  };
3910
- const guardFn = createAuthGuardFn();
3937
+ const guardFn = createAuthGuardFn(app);
3911
3938
  _authGuardFn = guardFn;
3912
3939
  app.use(defineEventHandler(guardFn));
3913
3940
  console.log("[agent-native] Auth guard registered despite init failure — app is locked.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.157.13",
3
+ "version": "0.157.14",
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": {