@agent-native/core 0.157.18 → 0.157.19
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/dist/a2a/index.d.ts +1 -0
- package/dist/a2a/index.js +1 -0
- package/dist/observability/routes.d.ts +6 -6
- package/dist/progress/routes.d.ts +1 -1
- package/dist/secrets/routes.d.ts +3 -3
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/embed-route.js +13 -2
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/shared/mcp-embed-headers.d.ts +7 -0
- package/dist/shared/mcp-embed-headers.js +28 -5
- package/package.json +1 -1
package/dist/a2a/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type { A2ATokenPayload } from "./server.js";
|
|
|
3
3
|
export { generateAgentCard } from "./agent-card.js";
|
|
4
4
|
export { A2A_AGENT_ACTIVITY_KIND, A2A_AGENT_ACTIVITY_VERSION, MAX_A2A_ACTIVITY_REASONING_CHARS, MAX_A2A_ACTIVITY_REASONING_SEGMENTS, MAX_A2A_ACTIVITY_RESPONSE_CHARS, MAX_A2A_ACTIVITY_TOOL_CALLS, MAX_A2A_ACTIVITY_TOTAL_CHARS, MAX_A2A_ACTIVITY_TOOL_ID_CHARS, MAX_A2A_ACTIVITY_TOOL_INPUT_CHARS, MAX_A2A_ACTIVITY_TOOL_NAME_CHARS, MAX_A2A_ACTIVITY_TOOL_PAYLOAD_CHARS, MAX_A2A_ACTIVITY_TOOL_RESULT_CHARS, applyA2AAgentActivityEvent, buildA2AAgentActivityPart, buildA2AAgentActivitySnapshot, createA2AAgentActivityState, parseA2AAgentActivityPart, } from "./activity.js";
|
|
5
5
|
export { A2AClient, callAction, callAgent, signA2AToken } from "./client.js";
|
|
6
|
+
export { canonicalA2AAudience } from "./audience.js";
|
|
6
7
|
export { resolveA2ACallerAuth } from "./caller-auth.js";
|
|
7
8
|
export type { A2ACallerAuth } from "./caller-auth.js";
|
|
8
9
|
export { AgentInvocationError, buildAgentInvocationPrompt, invokeAgent, invokeAgentAction, looksLikeAgentUrl, resolveAgentInvocationTarget, } from "./invoke.js";
|
package/dist/a2a/index.js
CHANGED
|
@@ -4,5 +4,6 @@ export { generateAgentCard } from "./agent-card.js";
|
|
|
4
4
|
export { A2A_AGENT_ACTIVITY_KIND, A2A_AGENT_ACTIVITY_VERSION, MAX_A2A_ACTIVITY_REASONING_CHARS, MAX_A2A_ACTIVITY_REASONING_SEGMENTS, MAX_A2A_ACTIVITY_RESPONSE_CHARS, MAX_A2A_ACTIVITY_TOOL_CALLS, MAX_A2A_ACTIVITY_TOTAL_CHARS, MAX_A2A_ACTIVITY_TOOL_ID_CHARS, MAX_A2A_ACTIVITY_TOOL_INPUT_CHARS, MAX_A2A_ACTIVITY_TOOL_NAME_CHARS, MAX_A2A_ACTIVITY_TOOL_PAYLOAD_CHARS, MAX_A2A_ACTIVITY_TOOL_RESULT_CHARS, applyA2AAgentActivityEvent, buildA2AAgentActivityPart, buildA2AAgentActivitySnapshot, createA2AAgentActivityState, parseA2AAgentActivityPart, } from "./activity.js";
|
|
5
5
|
// Client
|
|
6
6
|
export { A2AClient, callAction, callAgent, signA2AToken } from "./client.js";
|
|
7
|
+
export { canonicalA2AAudience } from "./audience.js";
|
|
7
8
|
export { resolveA2ACallerAuth } from "./caller-auth.js";
|
|
8
9
|
export { AgentInvocationError, buildAgentInvocationPrompt, invokeAgent, invokeAgentAction, looksLikeAgentUrl, resolveAgentInvocationTarget, } from "./invoke.js";
|
|
@@ -41,27 +41,27 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
-
ok?: undefined;
|
|
45
|
-
error?: undefined;
|
|
46
44
|
summary: import("./types.js").TraceSummary;
|
|
47
45
|
spans: import("./types.js").TraceSpan[];
|
|
48
46
|
id?: undefined;
|
|
49
|
-
} | {
|
|
50
|
-
ok?: undefined;
|
|
51
47
|
error?: undefined;
|
|
48
|
+
ok?: undefined;
|
|
49
|
+
} | {
|
|
52
50
|
summary?: undefined;
|
|
53
51
|
spans?: undefined;
|
|
54
52
|
id: string;
|
|
55
|
-
|
|
53
|
+
error?: undefined;
|
|
56
54
|
ok?: undefined;
|
|
55
|
+
} | {
|
|
57
56
|
summary?: undefined;
|
|
58
57
|
spans?: undefined;
|
|
59
58
|
id?: undefined;
|
|
60
59
|
error: any;
|
|
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
|
}>>;
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -34,16 +34,16 @@ export declare function createListSecretsHandler(): import("h3").EventHandlerWit
|
|
|
34
34
|
/** POST /_agent-native/secrets/:key — write a secret. */
|
|
35
35
|
export declare function createWriteSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
36
36
|
error: string;
|
|
37
|
-
ok?: undefined;
|
|
38
37
|
status?: undefined;
|
|
38
|
+
ok?: undefined;
|
|
39
39
|
} | {
|
|
40
40
|
ok: boolean;
|
|
41
41
|
status: string;
|
|
42
42
|
error?: undefined;
|
|
43
43
|
} | {
|
|
44
|
-
ok?: undefined;
|
|
45
44
|
error: string;
|
|
46
45
|
removed?: undefined;
|
|
46
|
+
ok?: undefined;
|
|
47
47
|
} | {
|
|
48
48
|
ok: boolean;
|
|
49
49
|
removed: boolean;
|
|
@@ -54,9 +54,9 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
|
|
|
54
54
|
* or the current stored value without changing anything.
|
|
55
55
|
*/
|
|
56
56
|
export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
57
|
-
ok?: undefined;
|
|
58
57
|
error: string;
|
|
59
58
|
note?: undefined;
|
|
59
|
+
ok?: undefined;
|
|
60
60
|
} | {
|
|
61
61
|
ok: boolean;
|
|
62
62
|
note?: undefined;
|
|
@@ -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 {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { defineEventHandler, getHeader, getMethod, getQuery, setResponseHeader, } from "h3";
|
|
2
2
|
import { withCollapsedAgentSidebarParam } from "../shared/agent-sidebar-url.js";
|
|
3
3
|
import { EMBED_MODE_QUERY_PARAM, EMBED_START_PATH, EMBED_TOKEN_QUERY_PARAM, MCP_APP_CHAT_BRIDGE_QUERY_PARAM, } from "../shared/embed-auth.js";
|
|
4
|
-
import {
|
|
4
|
+
import { isMcpEmbedTransplantOrigin, MCP_EMBED_CORS_ALLOW_HEADERS, } from "../shared/mcp-embed-headers.js";
|
|
5
5
|
import { getConfiguredAppBasePath } from "./app-base-path.js";
|
|
6
|
+
import { readCorsAllowedOrigins } from "./cors-origins.js";
|
|
6
7
|
import { consumeEmbedSessionTicket, isEmbedCapabilityScope, normalizeEmbedTargetPath, setEmbedSessionCookie, signEmbedSessionToken, } from "./embed-session.js";
|
|
7
8
|
function withConfiguredBasePath(path) {
|
|
8
9
|
const base = getConfiguredAppBasePath();
|
|
@@ -48,7 +49,11 @@ function setEmbedStartResponseHeaders(event) {
|
|
|
48
49
|
}
|
|
49
50
|
function embedStartCorsOrigin(event) {
|
|
50
51
|
const origin = getHeader(event, "origin");
|
|
51
|
-
|
|
52
|
+
if (!origin)
|
|
53
|
+
return null;
|
|
54
|
+
if (isMcpEmbedTransplantOrigin(origin))
|
|
55
|
+
return origin;
|
|
56
|
+
return readCorsAllowedOrigins().includes(origin) ? origin : null;
|
|
52
57
|
}
|
|
53
58
|
function embedStartResponseHeaders(event, init = {}) {
|
|
54
59
|
const headers = new Headers({
|
|
@@ -138,6 +143,12 @@ function firstQueryValue(value) {
|
|
|
138
143
|
: "";
|
|
139
144
|
}
|
|
140
145
|
function wantsTransplantLocationResponse(event) {
|
|
146
|
+
const origin = getHeader(event, "origin");
|
|
147
|
+
const canReadLocation = !origin ||
|
|
148
|
+
embedStartCorsOrigin(event) !== null ||
|
|
149
|
+
isMcpEmbedTransplantOrigin(origin);
|
|
150
|
+
if (!canReadLocation)
|
|
151
|
+
return false;
|
|
141
152
|
if (getHeader(event, "x-agent-native-embed-transplant") === "1") {
|
|
142
153
|
return true;
|
|
143
154
|
}
|
|
@@ -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
|
}>>;
|
|
@@ -7,6 +7,13 @@ export declare function isMcpProductHostOrigin(origin: string | null | undefined
|
|
|
7
7
|
export declare function isAgentNativeFirstPartyAppOrigin(origin: string | null | undefined): boolean;
|
|
8
8
|
export declare function isBuilderIoEmbedOrigin(origin: string | null | undefined): boolean;
|
|
9
9
|
export declare function isMcpEmbedCorsOrigin(origin: string | null | undefined): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Origins allowed to read the one-time embed location returned by a browser
|
|
12
|
+
* transplant request. Builder and localhost origins may use the broader MCP
|
|
13
|
+
* CORS surface, but must not receive a reusable session location unless they
|
|
14
|
+
* are explicitly configured through CORS_ALLOWED_ORIGINS.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isMcpEmbedTransplantOrigin(origin: string | null | undefined): boolean;
|
|
10
17
|
export declare function shouldAllowMcpEmbedCredentials(origin: string | null | undefined): boolean;
|
|
11
18
|
export declare const MCP_EMBED_STATIC_ASSET_HEADERS: {
|
|
12
19
|
readonly "Access-Control-Allow-Origin": "*";
|
|
@@ -8,6 +8,14 @@ const MCP_PRODUCT_HOST_ORIGINS = new Set([
|
|
|
8
8
|
"https://chatgpt.com",
|
|
9
9
|
"https://claude.ai",
|
|
10
10
|
]);
|
|
11
|
+
const TRUSTED_NATIVE_APP_ORIGIN_RE = /^(?:tauri:\/\/localhost|https?:\/\/tauri\.localhost(?::\d+)?)$/;
|
|
12
|
+
function isExplicitCorsAllowedOrigin(origin) {
|
|
13
|
+
return (process.env.CORS_ALLOWED_ORIGINS ?? "")
|
|
14
|
+
.split(",")
|
|
15
|
+
.map((value) => value.trim())
|
|
16
|
+
.filter(Boolean)
|
|
17
|
+
.includes(origin);
|
|
18
|
+
}
|
|
11
19
|
export function isLocalMcpEmbedOrigin(origin) {
|
|
12
20
|
if (!origin)
|
|
13
21
|
return false;
|
|
@@ -97,12 +105,27 @@ export function isMcpEmbedCorsOrigin(origin) {
|
|
|
97
105
|
isAgentNativeFirstPartyAppOrigin(origin) ||
|
|
98
106
|
isBuilderIoEmbedOrigin(origin));
|
|
99
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Origins allowed to read the one-time embed location returned by a browser
|
|
110
|
+
* transplant request. Builder and localhost origins may use the broader MCP
|
|
111
|
+
* CORS surface, but must not receive a reusable session location unless they
|
|
112
|
+
* are explicitly configured through CORS_ALLOWED_ORIGINS.
|
|
113
|
+
*/
|
|
114
|
+
export function isMcpEmbedTransplantOrigin(origin) {
|
|
115
|
+
return (isClaudeMcpContentOrigin(origin) ||
|
|
116
|
+
isChatGptMcpSandboxOrigin(origin) ||
|
|
117
|
+
isMcpProductHostOrigin(origin) ||
|
|
118
|
+
isAgentNativeFirstPartyAppOrigin(origin));
|
|
119
|
+
}
|
|
100
120
|
export function shouldAllowMcpEmbedCredentials(origin) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
121
|
+
if (!origin || origin === "null")
|
|
122
|
+
return false;
|
|
123
|
+
// Credentialed CORS is an explicit deployment decision. MCP product,
|
|
124
|
+
// Builder, localhost, and arbitrary origins use bearer/embed credentials;
|
|
125
|
+
// only the configured browser allowlist and the framework's exact native
|
|
126
|
+
// app origins may receive cookies.
|
|
127
|
+
return (TRUSTED_NATIVE_APP_ORIGIN_RE.test(origin) ||
|
|
128
|
+
isExplicitCorsAllowedOrigin(origin));
|
|
106
129
|
}
|
|
107
130
|
// These paths are served straight off the CDN, so the security-headers h3
|
|
108
131
|
// middleware never runs for them — anything it sets that must also hold for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.157.
|
|
3
|
+
"version": "0.157.19",
|
|
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": {
|