@agent-native/core 0.211.0-nightly-20261020183616 → 0.211.0

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.
@@ -139,8 +139,8 @@ export declare function createAutomationCallbackHandler(runtime: AutomationRunti
139
139
  duplicate?: undefined;
140
140
  eventId?: undefined;
141
141
  } | {
142
- error?: undefined;
143
142
  accepted: boolean;
144
143
  duplicate: boolean;
145
144
  eventId: string;
145
+ error?: undefined;
146
146
  }>;
@@ -38,19 +38,19 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
38
38
  error: string;
39
39
  states?: undefined;
40
40
  } | {
41
+ error?: undefined;
41
42
  states: {
42
43
  clientId: number;
43
44
  state: string;
44
45
  }[];
45
- error?: undefined;
46
46
  }>>;
47
47
  export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
48
48
  error: string;
49
49
  users?: undefined;
50
50
  } | {
51
+ error?: undefined;
51
52
  users: {
52
53
  clientId: number;
53
54
  lastSeen: number;
54
55
  }[];
55
- error?: undefined;
56
56
  }>>;
@@ -1,6 +1,6 @@
1
1
  export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
2
- ok?: undefined;
3
2
  error: string;
3
+ ok?: undefined;
4
4
  } | {
5
5
  error?: undefined;
6
6
  ok: boolean;
@@ -33,9 +33,9 @@ declare const _default: import("../../action.js").ActionDefinition<{
33
33
  idempotencyKey: string;
34
34
  deleted: boolean;
35
35
  } | {
36
- id?: undefined;
37
36
  error: string;
38
37
  url?: undefined;
38
+ id?: undefined;
39
39
  provider?: undefined;
40
40
  configured?: undefined;
41
41
  } | {
@@ -45,8 +45,8 @@ declare const _default: import("../../action.js").ActionDefinition<{
45
45
  configured?: undefined;
46
46
  error?: undefined;
47
47
  } | {
48
- id?: undefined;
49
48
  url?: undefined;
49
+ id?: undefined;
50
50
  provider?: undefined;
51
51
  error: string;
52
52
  configured: boolean;
@@ -2094,10 +2094,23 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
2094
2094
  }
2095
2095
  : {}),
2096
2096
  });
2097
- async function withCallerContext(fn, mcpRequestId) {
2097
+ // A verified user's MCP token names them by email. Browser sessions also
2098
+ // carry the Better Auth user id, and per-user gates such as Clips' hosted
2099
+ // storage key on it, so a tool call resolves it the same way.
2100
+ let callerAuthUserId;
2101
+ function resolveCallerAuthUserId() {
2102
+ if (!hasVerifiedMcpUserIdentity(effectiveIdentity)) {
2103
+ return Promise.resolve(undefined);
2104
+ }
2105
+ const email = effectiveIdentity.userEmail;
2106
+ callerAuthUserId ??= import("../server/better-auth-instance.js").then(({ findBetterAuthUserIdForEmail }) => findBetterAuthUserIdForEmail(email));
2107
+ return callerAuthUserId;
2108
+ }
2109
+ async function withCallerContext(fn, mcpRequestId, authUserId) {
2098
2110
  const orgId = await orgIdPromise;
2099
2111
  return runWithRequestContext({
2100
2112
  userEmail: effectiveIdentity?.userEmail,
2113
+ ...(authUserId ? { authUserId } : {}),
2101
2114
  orgId,
2102
2115
  ...(verifiedServiceIdentity ? { verifiedServiceIdentity } : {}),
2103
2116
  ...(effectiveIdentity?.orgId === null
@@ -2108,6 +2121,9 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
2108
2121
  mcpCredentialIssuedAtMs: effectiveIdentity?.mcpCredentialIssuedAtMs ?? null,
2109
2122
  }, fn);
2110
2123
  }
2124
+ async function withToolCallContext(fn, mcpRequestId) {
2125
+ return withCallerContext(fn, mcpRequestId, await resolveCallerAuthUserId());
2126
+ }
2111
2127
  const actionCallContext = {
2112
2128
  appId: config.appId,
2113
2129
  identity: effectiveIdentity,
@@ -2350,7 +2366,7 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
2350
2366
  : requestMeta?.mcpRetryToken
2351
2367
  ? `stateless:${requestMeta.mcpRetryToken}`
2352
2368
  : undefined;
2353
- const result = await withCallerContext(async () => {
2369
+ const result = await withToolCallContext(async () => {
2354
2370
  const { name, arguments: args } = request.params;
2355
2371
  try {
2356
2372
  const { allowedActions } = await resolveServiceGrant();
@@ -140,13 +140,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
140
140
  clientHint?: undefined;
141
141
  timestamp?: undefined;
142
142
  chapterId?: undefined;
143
+ count?: undefined;
143
144
  startAt?: undefined;
144
145
  endAt?: undefined;
145
146
  reason?: undefined;
146
147
  includeMicrophone?: undefined;
147
148
  includeSystemAudio?: undefined;
148
149
  requestId?: undefined;
149
- count?: undefined;
150
150
  };
151
151
  required?: undefined;
152
152
  };
@@ -171,13 +171,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
171
171
  clientHint?: undefined;
172
172
  timestamp?: undefined;
173
173
  chapterId?: undefined;
174
+ count?: undefined;
174
175
  startAt?: undefined;
175
176
  endAt?: undefined;
176
177
  reason?: undefined;
177
178
  includeMicrophone?: undefined;
178
179
  includeSystemAudio?: undefined;
179
180
  requestId?: undefined;
180
- count?: undefined;
181
181
  };
182
182
  required?: undefined;
183
183
  };
@@ -196,13 +196,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
196
196
  clientHint?: undefined;
197
197
  timestamp?: undefined;
198
198
  chapterId?: undefined;
199
+ count?: undefined;
199
200
  startAt?: undefined;
200
201
  endAt?: undefined;
201
202
  reason?: undefined;
202
203
  includeMicrophone?: undefined;
203
204
  includeSystemAudio?: undefined;
204
205
  requestId?: undefined;
205
- count?: undefined;
206
206
  };
207
207
  required?: undefined;
208
208
  };
@@ -231,13 +231,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
231
231
  };
232
232
  timestamp?: undefined;
233
233
  chapterId?: undefined;
234
+ count?: undefined;
234
235
  startAt?: undefined;
235
236
  endAt?: undefined;
236
237
  reason?: undefined;
237
238
  includeMicrophone?: undefined;
238
239
  includeSystemAudio?: undefined;
239
240
  requestId?: undefined;
240
- count?: undefined;
241
241
  };
242
242
  };
243
243
  } | {
@@ -260,12 +260,12 @@ export declare function screenMemoryMcpToolDefinitions(): ({
260
260
  description: string;
261
261
  };
262
262
  chapterId?: undefined;
263
+ count?: undefined;
263
264
  startAt?: undefined;
264
265
  endAt?: undefined;
265
266
  includeMicrophone?: undefined;
266
267
  includeSystemAudio?: undefined;
267
268
  requestId?: undefined;
268
- count?: undefined;
269
269
  };
270
270
  };
271
271
  } | {
@@ -317,6 +317,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
317
317
  clientHint?: undefined;
318
318
  timestamp?: undefined;
319
319
  chapterId?: undefined;
320
+ count?: undefined;
320
321
  startAt: {
321
322
  type: string;
322
323
  description: string;
@@ -336,7 +337,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
336
337
  type: string;
337
338
  };
338
339
  requestId?: undefined;
339
- count?: undefined;
340
340
  };
341
341
  };
342
342
  } | {
@@ -352,6 +352,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
352
352
  clientHint?: undefined;
353
353
  timestamp?: undefined;
354
354
  chapterId?: undefined;
355
+ count?: undefined;
355
356
  startAt?: undefined;
356
357
  endAt?: undefined;
357
358
  reason?: undefined;
@@ -360,7 +361,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
360
361
  requestId: {
361
362
  type: string;
362
363
  };
363
- count?: undefined;
364
364
  };
365
365
  };
366
366
  })[];
@@ -27,43 +27,43 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
27
27
  thumbsUpRate: number;
28
28
  avgEvalScore: number;
29
29
  } | {
30
- ok?: undefined;
31
30
  error: string;
32
31
  message: string;
33
32
  summary?: undefined;
34
33
  spans?: undefined;
35
- } | {
36
- error?: undefined;
37
34
  ok?: undefined;
35
+ } | {
38
36
  message?: undefined;
39
37
  summary: import("./types.js").TraceSummary;
40
38
  spans: import("./types.js").TraceSpan[];
41
- } | {
42
39
  error?: undefined;
43
40
  ok?: undefined;
41
+ } | {
44
42
  message?: undefined;
45
43
  summary?: undefined;
46
44
  spans?: undefined;
47
45
  traceMissing: true;
48
46
  id: string;
49
- } | {
50
47
  error?: undefined;
51
48
  ok?: undefined;
49
+ } | {
52
50
  message?: undefined;
53
51
  summary?: undefined;
54
52
  spans?: undefined;
55
53
  traceMissing?: undefined;
56
54
  id: string;
57
- } | {
55
+ error?: undefined;
58
56
  ok?: undefined;
57
+ } | {
59
58
  message?: undefined;
60
59
  summary?: undefined;
61
60
  spans?: undefined;
62
61
  error: any;
62
+ ok?: undefined;
63
63
  } | {
64
- error?: undefined;
65
64
  message?: undefined;
66
65
  summary?: undefined;
67
66
  spans?: undefined;
68
67
  ok: boolean;
68
+ error?: undefined;
69
69
  }>>;
@@ -73,9 +73,9 @@ export declare const setWorkspaceAppDefaultVisibilityHandler: import("h3").Event
73
73
  }>>;
74
74
  export declare const createOrgHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
75
75
  success: boolean;
76
- id?: undefined;
77
76
  name?: undefined;
78
77
  role?: undefined;
78
+ id?: undefined;
79
79
  } | {
80
80
  success?: undefined;
81
81
  id: string;
@@ -163,9 +163,9 @@ export declare const getMyOrgHandler: import("h3").EventHandlerWithFetch<import(
163
163
  }>>;
164
164
  export declare const createOrgHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
165
165
  success: boolean;
166
- id?: undefined;
167
166
  name?: undefined;
168
167
  role?: undefined;
168
+ id?: undefined;
169
169
  } | {
170
170
  success?: undefined;
171
171
  id: string;
@@ -39,8 +39,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
39
39
  error: string;
40
40
  }>;
41
41
  export declare function handleDeleteResource(event: any): Promise<{
42
- error: string;
43
42
  ok?: undefined;
43
+ error: string;
44
44
  } | {
45
45
  error?: undefined;
46
46
  ok: boolean;
@@ -57,39 +57,39 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
57
57
  } | {
58
58
  error: string;
59
59
  errorCode?: undefined;
60
- ok?: undefined;
61
60
  status?: undefined;
61
+ ok?: undefined;
62
62
  } | {
63
63
  error: string;
64
64
  errorCode: string;
65
- ok?: undefined;
66
65
  status?: undefined;
66
+ ok?: undefined;
67
67
  } | {
68
- error?: undefined;
69
68
  errorCode?: undefined;
70
69
  ok: boolean;
71
70
  status: string;
71
+ error?: undefined;
72
72
  } | {
73
- ok?: undefined;
74
73
  error: string;
75
74
  removed?: undefined;
75
+ ok?: undefined;
76
76
  } | {
77
- error?: undefined;
78
77
  ok: boolean;
79
78
  removed: boolean;
79
+ error?: undefined;
80
80
  }>>;
81
81
  export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
82
- ok?: undefined;
83
82
  error: string;
84
83
  note?: undefined;
84
+ ok?: undefined;
85
85
  } | {
86
- error?: undefined;
87
86
  ok: boolean;
88
87
  note?: undefined;
89
- } | {
90
88
  error?: undefined;
89
+ } | {
91
90
  ok: boolean;
92
91
  note: string;
92
+ error?: undefined;
93
93
  } | {
94
94
  note?: undefined;
95
95
  ok: boolean;
@@ -117,11 +117,11 @@ export declare function createAdHocSecretHandler(): import("h3").EventHandlerWit
117
117
  } | {
118
118
  error: string;
119
119
  } | {
120
- error?: undefined;
121
120
  ok: boolean;
122
121
  key: string;
123
- } | {
124
122
  error?: undefined;
123
+ } | {
125
124
  ok: boolean;
126
125
  removed: boolean;
126
+ error?: undefined;
127
127
  }>>;
@@ -5,6 +5,12 @@ import { type EmailReadiness } from "./email.js";
5
5
  export declare function resumeIdentityRekeysForEmail(email: string): Promise<void>;
6
6
  export { getAuthLoginMode, resolveAuthLoginMode, resolveAuthLoginModeFromReadiness, type AuthLoginMode, } from "./auth-login-mode.js";
7
7
  export declare function hasBetterAuthUserEmail(email: string): Promise<boolean>;
8
+ /**
9
+ * The Better Auth user id for a verified email, or `undefined` when no
10
+ * account has that email. A failed lookup throws: a caller that treated it as
11
+ * "no account" would tell a signed-in user to sign in.
12
+ */
13
+ export declare function findBetterAuthUserIdForEmail(email: string): Promise<string | undefined>;
8
14
  export declare function getBetterAuthUserIdForEmail(email: string): Promise<string | undefined>;
9
15
  export interface BetterAuthUserCreateContext {
10
16
  headers?: Headers | null;
@@ -106,15 +106,23 @@ export async function hasBetterAuthUserEmail(email) {
106
106
  .catch(() => null);
107
107
  return !!existing?.user?.email;
108
108
  }
109
+ /**
110
+ * The Better Auth user id for a verified email, or `undefined` when no
111
+ * account has that email. A failed lookup throws: a caller that treated it as
112
+ * "no account" would tell a signed-in user to sign in.
113
+ */
114
+ export async function findBetterAuthUserIdForEmail(email) {
115
+ const adapter = await internalAdapterFromContext(await getBetterAuth());
116
+ if (!adapter)
117
+ return undefined;
118
+ const existing = await adapter.findUserByEmail(email.trim().toLowerCase(), {
119
+ includeAccounts: false,
120
+ });
121
+ return existing?.user?.id || undefined;
122
+ }
109
123
  export async function getBetterAuthUserIdForEmail(email) {
110
124
  try {
111
- const adapter = await getBetterAuthInternalAdapter();
112
- if (!adapter)
113
- return undefined;
114
- const existing = await adapter.findUserByEmail(email.trim().toLowerCase(), {
115
- includeAccounts: false,
116
- });
117
- return existing?.user?.id || undefined;
125
+ return await findBetterAuthUserIdForEmail(email);
118
126
  }
119
127
  catch (error) {
120
128
  // coercion-ok: this is analytics enrichment on the sign-in path. Failing
@@ -1069,18 +1077,20 @@ export async function replaceUnverifiedCredentialWithGoogle(input) {
1069
1077
  });
1070
1078
  }
1071
1079
  export async function getBetterAuthInternalAdapter(config) {
1072
- const auth = (await getBetterAuth(config));
1080
+ const auth = await getBetterAuth(config);
1073
1081
  try {
1074
- const ctx = await auth.$context;
1075
- const ia = ctx?.internalAdapter;
1076
- if (ia)
1077
- return normalizeBetterAuthInternalAdapter(ia);
1082
+ return await internalAdapterFromContext(auth);
1078
1083
  }
1079
1084
  catch {
1080
1085
  // Context resolution failed — caller falls back to the signup path.
1081
1086
  }
1082
1087
  return undefined;
1083
1088
  }
1089
+ async function internalAdapterFromContext(auth) {
1090
+ const ctx = await auth.$context;
1091
+ const ia = ctx?.internalAdapter;
1092
+ return ia ? normalizeBetterAuthInternalAdapter(ia) : undefined;
1093
+ }
1084
1094
  const BRIDGED_SESSION_TTL_MS = 60_000;
1085
1095
  const BRIDGED_SESSION_CLEANUP_TIMEOUT_MS = 5_000;
1086
1096
  // ponytail: the short TTL bounds cleanup leaks; add a durable retry queue if failures need stronger guarantees.
@@ -20,6 +20,6 @@ export declare function createTranscribeVoiceHandler(): import("h3").EventHandle
20
20
  error: string;
21
21
  text?: undefined;
22
22
  } | {
23
- text: string;
24
23
  error?: undefined;
24
+ text: string;
25
25
  }>>;
@@ -14,7 +14,6 @@ declare const _default: import("../../action.js").ActionDefinition<{
14
14
  executionCwd?: string;
15
15
  }, {
16
16
  deleted?: undefined;
17
- enabled?: undefined;
18
17
  created: boolean;
19
18
  name: string;
20
19
  scope: "organization" | "personal";
@@ -25,24 +24,25 @@ declare const _default: import("../../action.js").ActionDefinition<{
25
24
  reasoningEffort: "auto" | "high" | "low" | "max" | "medium" | "minimal" | "none" | "xhigh";
26
25
  webhookPath: string;
27
26
  nextRun: string;
27
+ enabled?: undefined;
28
28
  executionHostId?: undefined;
29
29
  executionEngine?: undefined;
30
30
  executionCwd?: undefined;
31
31
  } | {
32
- enabled?: undefined;
33
- nextRun?: undefined;
34
32
  created?: undefined;
35
33
  scope?: undefined;
36
34
  triggerType?: undefined;
37
35
  event?: undefined;
38
36
  deleted: boolean;
39
37
  name: string;
38
+ enabled?: undefined;
40
39
  schedule?: undefined;
41
40
  timezone?: undefined;
42
41
  reasoningEffort?: undefined;
43
42
  executionHostId?: undefined;
44
43
  executionEngine?: undefined;
45
44
  executionCwd?: undefined;
45
+ nextRun?: undefined;
46
46
  webhookPath?: undefined;
47
47
  } | {
48
48
  deleted?: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.211.0-nightly-20261020183616",
3
+ "version": "0.211.0",
4
4
  "description": "The agentic application framework for building autonomous agents with intuitive UIs",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -711,8 +711,8 @@
711
711
  "yaml": "^2.9.0",
712
712
  "yjs": "^13.6.33",
713
713
  "zod": "^4.3.6",
714
- "@agent-native/agentkit": "^0.211.0-nightly-20261020183616",
715
- "@agent-native/recap-cli": "^0.5.77"
714
+ "@agent-native/agentkit": "^0.211.0",
715
+ "@agent-native/recap-cli": "^0.5.78"
716
716
  },
717
717
  "devDependencies": {
718
718
  "@ai-sdk/anthropic": "^3.0.71",
@@ -782,7 +782,7 @@
782
782
  "xlsx": "^0.18.5"
783
783
  },
784
784
  "peerDependencies": {
785
- "@agent-native/core-corpus": "0.211.0-nightly-20261020183616",
785
+ "@agent-native/core-corpus": ">=0.196.0",
786
786
  "@ai-sdk/anthropic": ">=3",
787
787
  "@ai-sdk/cohere": ">=3",
788
788
  "@ai-sdk/google": ">=3",