@agent-native/core 0.206.0-nightly-20261009153146 → 0.206.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.
Files changed (47) hide show
  1. package/dist/action.d.ts +7 -1
  2. package/dist/client/agent-chat/index.d.ts +1 -1
  3. package/dist/client/agent-chat/index.js +1 -1
  4. package/dist/client/embed-auth.d.ts +2 -0
  5. package/dist/client/embed-auth.js +160 -12
  6. package/dist/client/host/index.d.ts +1 -1
  7. package/dist/client/host/index.js +1 -1
  8. package/dist/client/mcp-app-host.d.ts +1 -0
  9. package/dist/client/mcp-app-host.js +4 -1
  10. package/dist/collab/routes.d.ts +1 -1
  11. package/dist/file-upload/actions/upload-image.d.ts +2 -2
  12. package/dist/mcp/build-server.d.ts +15 -0
  13. package/dist/mcp/build-server.js +307 -91
  14. package/dist/mcp/connect-route.js +1 -0
  15. package/dist/mcp/embed-app.js +291 -31
  16. package/dist/mcp/oauth-route.js +3 -0
  17. package/dist/mcp/oauth-store.d.ts +2 -1
  18. package/dist/mcp/oauth-store.js +5 -6
  19. package/dist/mcp/oauth-token.d.ts +5 -0
  20. package/dist/mcp/oauth-token.js +17 -0
  21. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  22. package/dist/mcp/server.d.ts +2 -2
  23. package/dist/mcp/server.js +2 -2
  24. package/dist/observability/routes.d.ts +5 -5
  25. package/dist/org/handlers.d.ts +1 -1
  26. package/dist/org/workspace-app-access-request.d.ts +8 -0
  27. package/dist/org/workspace-app-access-request.js +20 -0
  28. package/dist/provider-api/actions/custom-provider-registration.d.ts +4 -4
  29. package/dist/resources/handlers.d.ts +1 -1
  30. package/dist/secrets/routes.d.ts +11 -11
  31. package/dist/server/action-routes.d.ts +2 -0
  32. package/dist/server/action-routes.js +187 -31
  33. package/dist/server/agent-chat/mcp-options.d.ts +3 -1
  34. package/dist/server/agent-chat-plugin.js +26 -1
  35. package/dist/server/agent-engine-ollama-models-route.d.ts +2 -2
  36. package/dist/server/auth.js +11 -20
  37. package/dist/server/embed-route.js +5 -3
  38. package/dist/server/embed-session.d.ts +30 -1
  39. package/dist/server/embed-session.js +376 -30
  40. package/dist/server/realtime-token.d.ts +1 -1
  41. package/dist/server/request-context.d.ts +2 -0
  42. package/dist/server/request-context.js +25 -1
  43. package/dist/shared/embed-auth.d.ts +74 -0
  44. package/dist/shared/embed-auth.js +379 -10
  45. package/dist/sharing/actions/list-resource-shares.d.ts +1 -1
  46. package/dist/triggers/actions/manage-automation.d.ts +3 -3
  47. package/package.json +4 -4
@@ -67,6 +67,12 @@ export function parseMcpOAuthOrgIdClaim(payload) {
67
67
  : null;
68
68
  }
69
69
  export async function signMcpOAuthAccessToken(params) {
70
+ if (params.grantCreatedAtMs !== undefined &&
71
+ params.grantCreatedAtMs !== null &&
72
+ (!Number.isSafeInteger(params.grantCreatedAtMs) ||
73
+ params.grantCreatedAtMs < 0)) {
74
+ throw new Error("OAuth grant creation time must be a non-negative integer.");
75
+ }
70
76
  return new jose.SignJWT({
71
77
  typ: MCP_OAUTH_TOKEN_TYPE,
72
78
  credential_version: params.service
@@ -78,6 +84,9 @@ export async function signMcpOAuthAccessToken(params) {
78
84
  scope: params.scope,
79
85
  client_id: params.clientId,
80
86
  resource: params.resource,
87
+ ...(typeof params.grantCreatedAtMs === "number"
88
+ ? { grant_created_at_ms: params.grantCreatedAtMs }
89
+ : {}),
81
90
  ...(params.catalogScope === "full" ? { catalog_scope: "full" } : {}),
82
91
  })
83
92
  .setProtectedHeader({ alg: "HS256" })
@@ -155,6 +164,13 @@ export async function verifyMcpOAuthAccessToken(token, resource) {
155
164
  const orgIdClaim = parseMcpOAuthOrgIdClaim(payload);
156
165
  if (!orgIdClaim)
157
166
  return null;
167
+ const grantCreatedAtMs = payload.grant_created_at_ms;
168
+ if (grantCreatedAtMs !== undefined &&
169
+ (typeof grantCreatedAtMs !== "number" ||
170
+ !Number.isSafeInteger(grantCreatedAtMs) ||
171
+ grantCreatedAtMs < 0)) {
172
+ return null;
173
+ }
158
174
  return {
159
175
  userEmail: payload.sub,
160
176
  orgId: orgIdClaim.orgId,
@@ -162,6 +178,7 @@ export async function verifyMcpOAuthAccessToken(token, resource) {
162
178
  scopes,
163
179
  clientId: payload.client_id,
164
180
  jti: typeof payload.jti === "string" ? payload.jti : undefined,
181
+ ...(typeof grantCreatedAtMs === "number" ? { grantCreatedAtMs } : {}),
165
182
  ...(payload.catalog_scope === "full" ? { catalogScope: "full" } : {}),
166
183
  ...(typeof payload.iat === "number" ? { issuedAt: payload.iat } : {}),
167
184
  };
@@ -140,13 +140,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
140
140
  clientHint?: undefined;
141
141
  timestamp?: undefined;
142
142
  chapterId?: undefined;
143
- count?: undefined;
144
143
  startAt?: undefined;
145
144
  endAt?: undefined;
146
145
  reason?: undefined;
147
146
  includeMicrophone?: undefined;
148
147
  includeSystemAudio?: undefined;
149
148
  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;
175
174
  startAt?: undefined;
176
175
  endAt?: undefined;
177
176
  reason?: undefined;
178
177
  includeMicrophone?: undefined;
179
178
  includeSystemAudio?: undefined;
180
179
  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;
200
199
  startAt?: undefined;
201
200
  endAt?: undefined;
202
201
  reason?: undefined;
203
202
  includeMicrophone?: undefined;
204
203
  includeSystemAudio?: undefined;
205
204
  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;
235
234
  startAt?: undefined;
236
235
  endAt?: undefined;
237
236
  reason?: undefined;
238
237
  includeMicrophone?: undefined;
239
238
  includeSystemAudio?: undefined;
240
239
  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;
264
263
  startAt?: undefined;
265
264
  endAt?: undefined;
266
265
  includeMicrophone?: undefined;
267
266
  includeSystemAudio?: undefined;
268
267
  requestId?: undefined;
268
+ count?: undefined;
269
269
  };
270
270
  };
271
271
  } | {
@@ -317,7 +317,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
317
317
  clientHint?: undefined;
318
318
  timestamp?: undefined;
319
319
  chapterId?: undefined;
320
- count?: undefined;
321
320
  startAt: {
322
321
  type: string;
323
322
  description: string;
@@ -337,6 +336,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
337
336
  type: string;
338
337
  };
339
338
  requestId?: undefined;
339
+ count?: undefined;
340
340
  };
341
341
  };
342
342
  } | {
@@ -352,7 +352,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
352
352
  clientHint?: undefined;
353
353
  timestamp?: undefined;
354
354
  chapterId?: undefined;
355
- count?: undefined;
356
355
  startAt?: undefined;
357
356
  endAt?: undefined;
358
357
  reason?: undefined;
@@ -361,6 +360,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
361
360
  requestId: {
362
361
  type: string;
363
362
  };
363
+ count?: undefined;
364
364
  };
365
365
  };
366
366
  })[];
@@ -1,6 +1,6 @@
1
1
  import type { H3Event } from "h3";
2
- import { createMCPServerForRequest, verifyAuth, getAccessTokens, resolveOrgIdFromDomain, buildLinkArtifacts, selectMcpDirectoryWidgetReadActions, type MCPConfig, type MCPCallerIdentity, type MCPRequestMeta } from "./build-server.js";
3
- export { createMCPServerForRequest, verifyAuth, getAccessTokens, resolveOrgIdFromDomain, buildLinkArtifacts, selectMcpDirectoryWidgetReadActions, };
2
+ import { createMCPServerForRequest, verifyAuth, getAccessTokens, resolveOrgIdFromDomain, buildLinkArtifacts, selectMcpDirectoryWidgetReadActions, selectMcpDirectoryWidgetWriteActions, type MCPConfig, type MCPCallerIdentity, type MCPRequestMeta } from "./build-server.js";
3
+ export { createMCPServerForRequest, verifyAuth, getAccessTokens, resolveOrgIdFromDomain, buildLinkArtifacts, selectMcpDirectoryWidgetReadActions, selectMcpDirectoryWidgetWriteActions, };
4
4
  export type { MCPConfig, MCPCallerIdentity, MCPRequestMeta };
5
5
  export declare function handleMcpRequest(event: H3Event, config: MCPConfig, routePath?: string): Promise<Response | string | {
6
6
  error: string;
@@ -8,10 +8,10 @@ import { getH3App } from "../server/framework-request-handler.js";
8
8
  import { getOrigin } from "../server/google-oauth.js";
9
9
  import { readBody } from "../server/h3-helpers.js";
10
10
  import { trackMcpInitialize } from "./analytics.js";
11
- import { createMCPServerForRequest, verifyAuth, McpIdentityVerificationUnavailableError, getAccessTokens, resolveOrgIdFromDomain, buildLinkArtifacts, McpDirectoryProfileValidationError, validateMcpDirectoryProfile, validateMcpDirectoryWidgetDomain, selectMcpActionSurface, selectMcpDirectoryWidgetReadActions, } from "./build-server.js";
11
+ import { createMCPServerForRequest, verifyAuth, McpIdentityVerificationUnavailableError, getAccessTokens, resolveOrgIdFromDomain, buildLinkArtifacts, McpDirectoryProfileValidationError, validateMcpDirectoryProfile, validateMcpDirectoryWidgetDomain, selectMcpActionSurface, selectMcpDirectoryWidgetReadActions, selectMcpDirectoryWidgetWriteActions, } from "./build-server.js";
12
12
  import { buildMcpOAuthChallenge, getMcpOAuthAudiences, getMcpOAuthIssuer, getMcpOAuthProtectedResourceMetadataUrl, getMcpOAuthResource, } from "./oauth-route.js";
13
13
  import { MCP_DIRECTORY_ROUTE_PREFIX, MCP_PUBLIC_ROUTE_PREFIX, MCP_ROUTE_PREFIXES, joinMcpRoute, } from "./route-paths.js";
14
- export { createMCPServerForRequest, verifyAuth, getAccessTokens, resolveOrgIdFromDomain, buildLinkArtifacts, selectMcpDirectoryWidgetReadActions, };
14
+ export { createMCPServerForRequest, verifyAuth, getAccessTokens, resolveOrgIdFromDomain, buildLinkArtifacts, selectMcpDirectoryWidgetReadActions, selectMcpDirectoryWidgetWriteActions, };
15
15
  function deriveRequestMeta(event) {
16
16
  const forwardedProto = getRequestHeader(event, "x-forwarded-proto");
17
17
  const host = getRequestHeader(event, "x-forwarded-host") ||
@@ -27,39 +27,39 @@ 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;
34
+ ok?: undefined;
35
35
  } | {
36
36
  error?: undefined;
37
- ok?: undefined;
38
37
  message?: undefined;
39
38
  summary: import("./types.js").TraceSummary;
40
39
  spans: import("./types.js").TraceSpan[];
40
+ ok?: undefined;
41
41
  } | {
42
42
  error?: undefined;
43
- ok?: undefined;
44
43
  message?: undefined;
45
44
  summary?: undefined;
46
45
  spans?: undefined;
47
46
  traceMissing: true;
48
47
  id: string;
48
+ ok?: undefined;
49
49
  } | {
50
50
  error?: undefined;
51
- ok?: undefined;
52
51
  message?: undefined;
53
52
  summary?: undefined;
54
53
  spans?: undefined;
55
54
  traceMissing?: undefined;
56
55
  id: string;
57
- } | {
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
64
  error?: undefined;
65
65
  message?: undefined;
@@ -72,8 +72,8 @@ export declare const setWorkspaceAppDefaultVisibilityHandler: import("h3").Event
72
72
  }>>;
73
73
  export declare const createOrgHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
74
74
  success: boolean;
75
- name?: undefined;
76
75
  id?: undefined;
76
+ name?: undefined;
77
77
  role?: undefined;
78
78
  } | {
79
79
  success?: undefined;
@@ -0,0 +1,8 @@
1
+ import { type WorkspaceAppAccessOutcome } from "./workspace-app-access.js";
2
+ export type WorkspaceAppAccessRequest = {
3
+ path: string;
4
+ method: string;
5
+ email: string;
6
+ orgId?: string | null;
7
+ };
8
+ export declare function checkWorkspaceAppAccessForRequest(request: WorkspaceAppAccessRequest): Promise<WorkspaceAppAccessOutcome | null>;
@@ -0,0 +1,20 @@
1
+ import { isWorkspaceAppAccessAllowed, } from "./workspace-app-access.js";
2
+ import { resolveWorkspaceAccessAppId } from "./workspace-app-identity.js";
3
+ function isWorkspaceAccessRecoveryPath(path, method) {
4
+ return (path === "/_agent-native/org/me" ||
5
+ path === "/_agent-native/actions/list-workspace-apps" ||
6
+ (method === "GET" &&
7
+ path === "/_agent-native/actions/list-workspace-app-access") ||
8
+ (method === "POST" &&
9
+ path === "/_agent-native/actions/set-workspace-app-access"));
10
+ }
11
+ export async function checkWorkspaceAppAccessForRequest(request) {
12
+ const appId = resolveWorkspaceAccessAppId();
13
+ if (!appId || isWorkspaceAccessRecoveryPath(request.path, request.method)) {
14
+ return null;
15
+ }
16
+ return isWorkspaceAppAccessAllowed(appId, {
17
+ email: request.email,
18
+ orgId: request.orgId,
19
+ });
20
+ }
@@ -75,10 +75,10 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
75
75
  user: "user";
76
76
  }>>;
77
77
  }, z.core.$strip>>, {
78
+ message?: undefined;
78
79
  deleted?: undefined;
79
80
  id?: undefined;
80
81
  provider?: undefined;
81
- message?: undefined;
82
82
  providers: {
83
83
  id: string;
84
84
  label: string;
@@ -93,9 +93,9 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
93
93
  registered?: undefined;
94
94
  label?: undefined;
95
95
  } | {
96
+ message?: undefined;
96
97
  deleted?: undefined;
97
98
  id?: undefined;
98
- message?: undefined;
99
99
  providers?: undefined;
100
100
  count?: undefined;
101
101
  found: boolean;
@@ -103,9 +103,9 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
103
103
  registered?: undefined;
104
104
  label?: undefined;
105
105
  } | {
106
+ message?: undefined;
106
107
  deleted?: undefined;
107
108
  provider?: undefined;
108
- message?: undefined;
109
109
  providers?: undefined;
110
110
  count?: undefined;
111
111
  found: boolean;
@@ -113,8 +113,8 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
113
113
  registered?: undefined;
114
114
  label?: undefined;
115
115
  } | {
116
- provider?: undefined;
117
116
  message?: undefined;
117
+ provider?: undefined;
118
118
  providers?: undefined;
119
119
  count?: undefined;
120
120
  found?: undefined;
@@ -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;
@@ -58,47 +58,47 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
58
58
  error: string;
59
59
  errorCode?: undefined;
60
60
  retryable?: undefined;
61
- ok?: undefined;
62
61
  status?: undefined;
62
+ ok?: undefined;
63
63
  } | {
64
64
  error: string;
65
65
  errorCode: string;
66
66
  retryable?: undefined;
67
- ok?: undefined;
68
67
  status?: undefined;
68
+ ok?: undefined;
69
69
  } | {
70
70
  error: string;
71
71
  errorCode: string;
72
72
  retryable: boolean;
73
- ok?: undefined;
74
73
  status?: undefined;
74
+ ok?: undefined;
75
75
  } | {
76
- error?: undefined;
77
76
  errorCode?: undefined;
78
77
  retryable?: undefined;
79
78
  ok: boolean;
80
79
  status: string;
80
+ error?: undefined;
81
81
  } | {
82
- ok?: undefined;
83
82
  error: string;
84
83
  removed?: undefined;
84
+ ok?: undefined;
85
85
  } | {
86
- error?: undefined;
87
86
  ok: boolean;
88
87
  removed: boolean;
88
+ error?: undefined;
89
89
  }>>;
90
90
  export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
91
- ok?: undefined;
92
91
  error: string;
93
92
  note?: undefined;
93
+ ok?: undefined;
94
94
  } | {
95
- error?: undefined;
96
95
  ok: boolean;
97
96
  note?: undefined;
98
- } | {
99
97
  error?: undefined;
98
+ } | {
100
99
  ok: boolean;
101
100
  note: string;
101
+ error?: undefined;
102
102
  } | {
103
103
  note?: undefined;
104
104
  ok: boolean;
@@ -126,11 +126,11 @@ export declare function createAdHocSecretHandler(): import("h3").EventHandlerWit
126
126
  } | {
127
127
  error: string;
128
128
  } | {
129
- error?: undefined;
130
129
  ok: boolean;
131
130
  key: string;
132
- } | {
133
131
  error?: undefined;
132
+ } | {
134
133
  ok: boolean;
135
134
  removed: boolean;
135
+ error?: undefined;
136
136
  }>>;
@@ -42,6 +42,8 @@ export interface MountActionRoutesOptions {
42
42
  mcpDirectoryWidgetReadActionSchemaArguments?: Record<string, readonly string[]>;
43
43
  mcpDirectoryWidgetReadOnlyActions?: readonly string[];
44
44
  mcpDirectoryWidgetReadPublicActions?: readonly string[];
45
+ mcpDirectoryWidgetWriteActionArguments?: Record<string, readonly string[]>;
46
+ mcpDirectoryWidgetWriteActionSchemaArguments?: Record<string, readonly string[]>;
45
47
  mcpDirectoryWidgetAppId?: string;
46
48
  mcpDirectoryWidgetResourceUri?: string;
47
49
  getOwnerContextFromEvent?: (event: any) => AgentRunOwnerContext | Promise<AgentRunOwnerContext>;