@agent-native/core 0.22.18 → 0.22.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/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +19 -6
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/embed-auth.d.ts +5 -0
- package/dist/client/embed-auth.d.ts.map +1 -1
- package/dist/client/embed-auth.js +100 -13
- package/dist/client/embed-auth.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/mcp-app-host.d.ts +5 -0
- package/dist/client/mcp-app-host.d.ts.map +1 -1
- package/dist/client/mcp-app-host.js +267 -2
- package/dist/client/mcp-app-host.js.map +1 -1
- package/dist/client/theme.js +1 -1
- package/dist/client/theme.js.map +1 -1
- package/dist/client/vite-dev-recovery-script.d.ts.map +1 -1
- package/dist/client/vite-dev-recovery-script.js +9 -0
- package/dist/client/vite-dev-recovery-script.js.map +1 -1
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +34 -6
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/embed-app.d.ts.map +1 -1
- package/dist/mcp/embed-app.js +37 -7
- package/dist/mcp/embed-app.js.map +1 -1
- package/dist/server/open-route.d.ts.map +1 -1
- package/dist/server/open-route.js +7 -2
- package/dist/server/open-route.js.map +1 -1
- package/docs/content/client.md +6 -3
- package/docs/content/external-agents.md +34 -40
- package/docs/content/mcp-protocol.md +17 -7
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-chat.d.ts","sourceRoot":"","sources":["../../src/client/agent-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG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AAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CA6D9D"}
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* stay inside the embedded app so its own AgentSidebar can receive them.
|
|
8
8
|
*/
|
|
9
9
|
import { getFrameOrigin, isTrustedFrameMessage } from "./frame.js";
|
|
10
|
-
import {
|
|
10
|
+
import { isEmbedAuthActive, isEmbedMcpChatBridgeActive, markEmbedMcpChatBridgeActive, readEmbedMcpChatBridgeFlagFromUrl, } from "./embed-auth.js";
|
|
11
|
+
import { sendMcpAppHostMessage } from "./mcp-app-host.js";
|
|
11
12
|
import { isInBuilderFrame, isTrustedBuilderMessage, sendToBuilderChat, } from "./builder-frame.js";
|
|
12
13
|
const AGENT_CHAT_MESSAGE_TYPE = "agentNative.submitChat";
|
|
13
14
|
const AGENT_PANEL_PREPARE_EVENT = "agent-panel:prepare";
|
|
@@ -35,10 +36,16 @@ export function generateTabId() {
|
|
|
35
36
|
function isMcpAppChatBridgeEnabled() {
|
|
36
37
|
if (typeof window === "undefined" || window.parent === window)
|
|
37
38
|
return false;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
if (readEmbedMcpChatBridgeFlagFromUrl())
|
|
40
|
+
markEmbedMcpChatBridgeActive();
|
|
41
|
+
return isEmbedMcpChatBridgeActive() && isEmbedAuthActive();
|
|
42
|
+
}
|
|
43
|
+
function isDirectMcpAppEmbedSession() {
|
|
44
|
+
if (typeof window === "undefined" || window.parent === window)
|
|
45
|
+
return false;
|
|
46
|
+
if (readEmbedMcpChatBridgeFlagFromUrl())
|
|
47
|
+
markEmbedMcpChatBridgeActive();
|
|
48
|
+
return isEmbedAuthActive() && !isEmbedMcpChatBridgeActive();
|
|
42
49
|
}
|
|
43
50
|
/**
|
|
44
51
|
* Send a message to the agent chat via postMessage.
|
|
@@ -63,11 +70,17 @@ export function sendToAgentChat(opts) {
|
|
|
63
70
|
data: { ...opts, tabId },
|
|
64
71
|
};
|
|
65
72
|
if (opts.submit !== false && isMcpAppChatBridgeEnabled()) {
|
|
73
|
+
const directHostMessage = sendMcpAppHostMessage({
|
|
74
|
+
message: opts.message,
|
|
75
|
+
context: opts.context,
|
|
76
|
+
});
|
|
77
|
+
if (directHostMessage)
|
|
78
|
+
return tabId;
|
|
66
79
|
window.parent.postMessage(payload, getFrameOrigin() || "*");
|
|
67
80
|
return tabId;
|
|
68
81
|
}
|
|
69
82
|
const shouldOpenSidebar = opts.openSidebar !== false && !opts.background;
|
|
70
|
-
const targetSelf = !isCodeRequest && isInBuilderFrame();
|
|
83
|
+
const targetSelf = !isCodeRequest && (isInBuilderFrame() || isDirectMcpAppEmbedSession());
|
|
71
84
|
const target = targetSelf
|
|
72
85
|
? window
|
|
73
86
|
: window.parent !== window
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-chat.js","sourceRoot":"","sources":["../../src/client/agent-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAyD5B,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AACzD,MAAM,yBAAyB,GAAG,qBAAqB,CAAC;AAExD;;;GAGG;AACH,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IAClC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QAC3C,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC,EAAE,CAAC;YACrE,OAAO;QACT,CAAC;QACD,IACE,KAAK,CAAC,IAAI,EAAE,IAAI,KAAK,yBAAyB;YAC9C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AI,WAAW,CAAC,yBAAyB,CAAC,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAErE,0EAA0E;IAC1E,4EAA4E;IAC5E,2EAA2E;IAC3E,IAAI,CAAC,aAAa,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACxC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;SAAM,CAAC;QACN,YAAY,EAAE,CAAC;IACjB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * Agent Chat Bridge (browser)\n *\n * Sends structured messages to the agent chat from UI interactions.\n * Messages are sent via postMessage to the parent window (or self if top-level).\n * Builder frames are special: code requests go to Builder, but content prompts\n * stay inside the embedded app so its own AgentSidebar can receive them.\n */\n\nimport { getFrameOrigin, isTrustedFrameMessage } from \"./frame.js\";\nimport type { ReasoningEffort } from \"../shared/reasoning-effort.js\";\nimport {\n EMBED_MODE_QUERY_PARAM,\n EMBED_TOKEN_QUERY_PARAM,\n MCP_APP_CHAT_BRIDGE_QUERY_PARAM,\n} from \"../shared/embed-auth.js\";\nimport {\n isInBuilderFrame,\n isTrustedBuilderMessage,\n sendToBuilderChat,\n} from \"./builder-frame.js\";\n\nexport interface AgentChatMessage {\n /** The visible prompt message sent to the chat */\n message: string;\n /** Hidden context appended to the message (not shown in chat UI) */\n context?: string;\n /** true = auto-submit, false = prefill only, omit = use project setting */\n submit?: boolean;\n /** Optional project slug for structured context */\n projectSlug?: string;\n /** Optional preset name for downstream consumers */\n preset?: string;\n /** Optional reference image paths */\n referenceImagePaths?: string[];\n /** Optional uploaded reference images */\n uploadedReferenceImages?: string[];\n /** Stable tab identifier — auto-generated if omitted */\n tabId?: string;\n /**\n * Message routing type:\n * - \"content\" (default): stays in the embedded app agent for content/data operations\n * - \"code\": routes to the code editing frame (Agent Native Desktop or Builder.io)\n *\n * When type is \"code\" and no frame is connected, a dialog is shown.\n * `requiresCode: true` is treated as `type: \"code\"` for backward compatibility.\n */\n type?: \"content\" | \"code\";\n /** @deprecated Use `type: \"code\"` instead. If true, treated as `type: \"code\"`. */\n requiresCode?: boolean;\n /** Model preference for this sub-agent (e.g. \"claude-haiku-4-5\"). Uses default if omitted */\n model?: string;\n /** Engine preference paired with model for cross-provider switches. */\n engine?: string;\n /** Reasoning effort preference paired with model. */\n effort?: ReasoningEffort;\n /** Scoped system prompt additions for this sub-agent */\n instructions?: string;\n /**\n * Whether to open the agent sidebar if it's currently hidden.\n * Defaults to true — submitting a chat should make the response visible.\n * Pass `false` for background/silent sends that shouldn't pop the UI open.\n */\n openSidebar?: boolean;\n /**\n * When true, opens a new chat tab before sending the message.\n * Use for creation requests (create tool, dashboard, etc.) that deserve\n * their own isolated thread rather than cluttering an existing conversation.\n */\n newTab?: boolean;\n /**\n * When true with newTab, creates the tab in the background without\n * focusing it or opening the sidebar. The message runs silently.\n */\n background?: boolean;\n}\n\nconst AGENT_CHAT_MESSAGE_TYPE = \"agentNative.submitChat\";\nconst AGENT_PANEL_PREPARE_EVENT = \"agent-panel:prepare\";\n\n/**\n * Listen for chatRunning messages from the frame (postMessage)\n * and re-dispatch as a CustomEvent so hooks like useAgentChatGenerating() work.\n */\nif (typeof window !== \"undefined\") {\n window.addEventListener(\"message\", (event) => {\n if (!isTrustedFrameMessage(event) && !isTrustedBuilderMessage(event)) {\n return;\n }\n if (\n event.data?.type === \"agentNative.chatRunning\" ||\n event.data?.type === \"builder.chatRunning\"\n ) {\n window.dispatchEvent(\n new CustomEvent(\"agentNative.chatRunning\", {\n detail: event.data.detail ?? event.data.data,\n }),\n );\n }\n });\n}\n\n/** Generate a unique tab ID */\nexport function generateTabId(): string {\n return `chat-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;\n}\n\nfunction isMcpAppChatBridgeEnabled(): boolean {\n if (typeof window === \"undefined\" || window.parent === window) return false;\n const params = new URLSearchParams(window.location.search || \"\");\n return (\n params.get(EMBED_MODE_QUERY_PARAM) === \"1\" &&\n params.has(EMBED_TOKEN_QUERY_PARAM) &&\n params.get(MCP_APP_CHAT_BRIDGE_QUERY_PARAM) === \"1\"\n );\n}\n\n/**\n * Send a message to the agent chat via postMessage.\n */\n/**\n * Send a message to the agent chat via postMessage.\n * Returns the stable tabId for tracking this chat run.\n */\nexport function sendToAgentChat(opts: AgentChatMessage): string {\n const tabId = opts.tabId ?? generateTabId();\n const isCodeRequest = opts.type === \"code\" || opts.requiresCode === true;\n if (isCodeRequest && isInBuilderFrame()) {\n sendToBuilderChat({\n message: opts.message,\n context: opts.context,\n submit: opts.submit,\n });\n return tabId;\n }\n\n const payload = {\n type: AGENT_CHAT_MESSAGE_TYPE,\n data: { ...opts, tabId },\n };\n\n if (opts.submit !== false && isMcpAppChatBridgeEnabled()) {\n window.parent.postMessage(payload, getFrameOrigin() || \"*\");\n return tabId;\n }\n\n const shouldOpenSidebar = opts.openSidebar !== false && !opts.background;\n\n const targetSelf = !isCodeRequest && isInBuilderFrame();\n const target = targetSelf\n ? window\n : window.parent !== window\n ? window.parent\n : window;\n const targetOrigin = targetSelf\n ? window.location.origin\n : getFrameOrigin() || window.location.origin;\n if (shouldOpenSidebar) {\n window.dispatchEvent(\n new CustomEvent(\"agent-panel:set-mode\", {\n detail: { mode: \"chat\" },\n }),\n );\n window.dispatchEvent(new CustomEvent(\"agent-panel:open\"));\n } else if (!isCodeRequest) {\n window.dispatchEvent(new CustomEvent(AGENT_PANEL_PREPARE_EVENT));\n }\n\n const postToTarget = () => target.postMessage(payload, targetOrigin);\n\n // When the local app owns the chat surface, opening/preparing the sidebar\n // may mount the MessageEvent listener that receives this payload. Defer the\n // post one tick so a closed sidebar cannot drop the prompt while mounting.\n if (!isCodeRequest && target === window) {\n setTimeout(postToTarget, 0);\n } else {\n postToTarget();\n }\n return tabId;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"agent-chat.js","sourceRoot":"","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AAC,aAAa,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACxC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;SAAM,CAAC;QACN,YAAY,EAAE,CAAC;IACjB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * Agent Chat Bridge (browser)\n *\n * Sends structured messages to the agent chat from UI interactions.\n * Messages are sent via postMessage to the parent window (or self if top-level).\n * Builder frames are special: code requests go to Builder, but content prompts\n * stay inside the embedded app so its own AgentSidebar can receive them.\n */\n\nimport { getFrameOrigin, isTrustedFrameMessage } from \"./frame.js\";\nimport type { ReasoningEffort } from \"../shared/reasoning-effort.js\";\nimport {\n isEmbedAuthActive,\n isEmbedMcpChatBridgeActive,\n markEmbedMcpChatBridgeActive,\n readEmbedMcpChatBridgeFlagFromUrl,\n} from \"./embed-auth.js\";\nimport { sendMcpAppHostMessage } from \"./mcp-app-host.js\";\nimport {\n isInBuilderFrame,\n isTrustedBuilderMessage,\n sendToBuilderChat,\n} from \"./builder-frame.js\";\n\nexport interface AgentChatMessage {\n /** The visible prompt message sent to the chat */\n message: string;\n /** Hidden context appended to the message (not shown in chat UI) */\n context?: string;\n /** true = auto-submit, false = prefill only, omit = use project setting */\n submit?: boolean;\n /** Optional project slug for structured context */\n projectSlug?: string;\n /** Optional preset name for downstream consumers */\n preset?: string;\n /** Optional reference image paths */\n referenceImagePaths?: string[];\n /** Optional uploaded reference images */\n uploadedReferenceImages?: string[];\n /** Stable tab identifier — auto-generated if omitted */\n tabId?: string;\n /**\n * Message routing type:\n * - \"content\" (default): stays in the embedded app agent for content/data operations\n * - \"code\": routes to the code editing frame (Agent Native Desktop or Builder.io)\n *\n * When type is \"code\" and no frame is connected, a dialog is shown.\n * `requiresCode: true` is treated as `type: \"code\"` for backward compatibility.\n */\n type?: \"content\" | \"code\";\n /** @deprecated Use `type: \"code\"` instead. If true, treated as `type: \"code\"`. */\n requiresCode?: boolean;\n /** Model preference for this sub-agent (e.g. \"claude-haiku-4-5\"). Uses default if omitted */\n model?: string;\n /** Engine preference paired with model for cross-provider switches. */\n engine?: string;\n /** Reasoning effort preference paired with model. */\n effort?: ReasoningEffort;\n /** Scoped system prompt additions for this sub-agent */\n instructions?: string;\n /**\n * Whether to open the agent sidebar if it's currently hidden.\n * Defaults to true — submitting a chat should make the response visible.\n * Pass `false` for background/silent sends that shouldn't pop the UI open.\n */\n openSidebar?: boolean;\n /**\n * When true, opens a new chat tab before sending the message.\n * Use for creation requests (create tool, dashboard, etc.) that deserve\n * their own isolated thread rather than cluttering an existing conversation.\n */\n newTab?: boolean;\n /**\n * When true with newTab, creates the tab in the background without\n * focusing it or opening the sidebar. The message runs silently.\n */\n background?: boolean;\n}\n\nconst AGENT_CHAT_MESSAGE_TYPE = \"agentNative.submitChat\";\nconst AGENT_PANEL_PREPARE_EVENT = \"agent-panel:prepare\";\n\n/**\n * Listen for chatRunning messages from the frame (postMessage)\n * and re-dispatch as a CustomEvent so hooks like useAgentChatGenerating() work.\n */\nif (typeof window !== \"undefined\") {\n window.addEventListener(\"message\", (event) => {\n if (!isTrustedFrameMessage(event) && !isTrustedBuilderMessage(event)) {\n return;\n }\n if (\n event.data?.type === \"agentNative.chatRunning\" ||\n event.data?.type === \"builder.chatRunning\"\n ) {\n window.dispatchEvent(\n new CustomEvent(\"agentNative.chatRunning\", {\n detail: event.data.detail ?? event.data.data,\n }),\n );\n }\n });\n}\n\n/** Generate a unique tab ID */\nexport function generateTabId(): string {\n return `chat-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;\n}\n\nfunction isMcpAppChatBridgeEnabled(): boolean {\n if (typeof window === \"undefined\" || window.parent === window) return false;\n if (readEmbedMcpChatBridgeFlagFromUrl()) markEmbedMcpChatBridgeActive();\n return isEmbedMcpChatBridgeActive() && isEmbedAuthActive();\n}\n\nfunction isDirectMcpAppEmbedSession(): boolean {\n if (typeof window === \"undefined\" || window.parent === window) return false;\n if (readEmbedMcpChatBridgeFlagFromUrl()) markEmbedMcpChatBridgeActive();\n return isEmbedAuthActive() && !isEmbedMcpChatBridgeActive();\n}\n\n/**\n * Send a message to the agent chat via postMessage.\n */\n/**\n * Send a message to the agent chat via postMessage.\n * Returns the stable tabId for tracking this chat run.\n */\nexport function sendToAgentChat(opts: AgentChatMessage): string {\n const tabId = opts.tabId ?? generateTabId();\n const isCodeRequest = opts.type === \"code\" || opts.requiresCode === true;\n if (isCodeRequest && isInBuilderFrame()) {\n sendToBuilderChat({\n message: opts.message,\n context: opts.context,\n submit: opts.submit,\n });\n return tabId;\n }\n\n const payload = {\n type: AGENT_CHAT_MESSAGE_TYPE,\n data: { ...opts, tabId },\n };\n\n if (opts.submit !== false && isMcpAppChatBridgeEnabled()) {\n const directHostMessage = sendMcpAppHostMessage({\n message: opts.message,\n context: opts.context,\n });\n if (directHostMessage) return tabId;\n window.parent.postMessage(payload, getFrameOrigin() || \"*\");\n return tabId;\n }\n\n const shouldOpenSidebar = opts.openSidebar !== false && !opts.background;\n\n const targetSelf =\n !isCodeRequest && (isInBuilderFrame() || isDirectMcpAppEmbedSession());\n const target = targetSelf\n ? window\n : window.parent !== window\n ? window.parent\n : window;\n const targetOrigin = targetSelf\n ? window.location.origin\n : getFrameOrigin() || window.location.origin;\n if (shouldOpenSidebar) {\n window.dispatchEvent(\n new CustomEvent(\"agent-panel:set-mode\", {\n detail: { mode: \"chat\" },\n }),\n );\n window.dispatchEvent(new CustomEvent(\"agent-panel:open\"));\n } else if (!isCodeRequest) {\n window.dispatchEvent(new CustomEvent(AGENT_PANEL_PREPARE_EVENT));\n }\n\n const postToTarget = () => target.postMessage(payload, targetOrigin);\n\n // When the local app owns the chat surface, opening/preparing the sidebar\n // may mount the MessageEvent listener that receives this payload. Defer the\n // post one tick so a closed sidebar cannot drop the prompt while mounting.\n if (!isCodeRequest && target === window) {\n setTimeout(postToTarget, 0);\n } else {\n postToTarget();\n }\n return tabId;\n}\n"]}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
export declare function readEmbedMcpChatBridgeFlagFromUrl(): boolean;
|
|
2
|
+
export declare function markEmbedMcpChatBridgeActive(): void;
|
|
3
|
+
export declare function isEmbedMcpChatBridgeActive(): boolean;
|
|
1
4
|
export declare function getEmbedAuthToken(): string | null;
|
|
2
5
|
export declare function isEmbedAuthActive(): boolean;
|
|
6
|
+
/** Internal test helper. Do not use in app code. */
|
|
7
|
+
export declare function _resetEmbedAuthForTests(): void;
|
|
3
8
|
export declare function ensureEmbedAuthFetchInterceptor(): void;
|
|
4
9
|
//# sourceMappingURL=embed-auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed-auth.d.ts","sourceRoot":"","sources":["../../src/client/embed-auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"embed-auth.d.ts","sourceRoot":"","sources":["../../src/client/embed-auth.ts"],"names":[],"mappings":"AAqDA,wBAAgB,iCAAiC,IAAI,OAAO,CAO3D;AAgBD,wBAAgB,4BAA4B,IAAI,IAAI,CAenD;AAED,wBAAgB,0BAA0B,IAAI,OAAO,CA6BpD;AAoBD,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CASjD;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAM3C;AAED,oDAAoD;AACpD,wBAAgB,uBAAuB,IAAI,IAAI,CAO9C;AAqLD,wBAAgB,+BAA+B,IAAI,IAAI,CAwCtD"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { EMBED_MODE_QUERY_PARAM, EMBED_START_PATH, EMBED_TARGET_HEADER, EMBED_TOKEN_QUERY_PARAM, } from "../shared/embed-auth.js";
|
|
1
|
+
import { EMBED_MODE_QUERY_PARAM, EMBED_START_PATH, EMBED_TARGET_HEADER, EMBED_TOKEN_QUERY_PARAM, MCP_APP_CHAT_BRIDGE_QUERY_PARAM, } from "../shared/embed-auth.js";
|
|
2
2
|
let installed = false;
|
|
3
3
|
let memoryToken = null;
|
|
4
|
+
let mcpChatBridgeActive = false;
|
|
5
|
+
let mcpChatBridgeScope = null;
|
|
4
6
|
const EMBED_TOKEN_STORAGE_KEY = "agent-native:embed-auth-token";
|
|
7
|
+
const MCP_CHAT_BRIDGE_STORAGE_KEY = "agent-native:mcp-chat-bridge";
|
|
5
8
|
const AUTH_FAILURE_COOLDOWN_MS = 60_000;
|
|
6
9
|
const GUARDED_METHODS = new Set(["GET", "HEAD"]);
|
|
7
10
|
const AUTH_FAILURE_HEADER = "x-agent-native-auth-circuit-breaker";
|
|
@@ -10,13 +13,90 @@ let embedAuthFailure = null;
|
|
|
10
13
|
function browserWindow() {
|
|
11
14
|
return typeof window === "undefined" ? null : window;
|
|
12
15
|
}
|
|
16
|
+
function currentUrl(win) {
|
|
17
|
+
try {
|
|
18
|
+
return new URL(win.location.href);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
try {
|
|
22
|
+
return new URL(`${win.location.pathname || "/"}${win.location.search || ""}${win.location.hash || ""}`, win.location.origin || "http://agent-native.invalid");
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
13
29
|
function readTokenFromUrl(win) {
|
|
30
|
+
return currentUrl(win)?.searchParams.get(EMBED_TOKEN_QUERY_PARAM) ?? null;
|
|
31
|
+
}
|
|
32
|
+
export function readEmbedMcpChatBridgeFlagFromUrl() {
|
|
33
|
+
const win = browserWindow();
|
|
34
|
+
if (!win)
|
|
35
|
+
return false;
|
|
36
|
+
const value = currentUrl(win)?.searchParams.get(MCP_APP_CHAT_BRIDGE_QUERY_PARAM);
|
|
37
|
+
return value === "1" || value === "true";
|
|
38
|
+
}
|
|
39
|
+
function currentMcpChatBridgeScope(win) {
|
|
40
|
+
return readTokenFromUrl(win) ?? memoryToken ?? storedToken(win);
|
|
41
|
+
}
|
|
42
|
+
function clearMcpChatBridge(win) {
|
|
43
|
+
mcpChatBridgeActive = false;
|
|
44
|
+
mcpChatBridgeScope = null;
|
|
14
45
|
try {
|
|
15
|
-
|
|
16
|
-
return url.searchParams.get(EMBED_TOKEN_QUERY_PARAM);
|
|
46
|
+
win.sessionStorage?.removeItem(MCP_CHAT_BRIDGE_STORAGE_KEY);
|
|
17
47
|
}
|
|
18
48
|
catch {
|
|
19
|
-
|
|
49
|
+
// ignore unavailable session storage
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export function markEmbedMcpChatBridgeActive() {
|
|
53
|
+
const win = browserWindow();
|
|
54
|
+
const scope = win ? currentMcpChatBridgeScope(win) : null;
|
|
55
|
+
mcpChatBridgeActive = true;
|
|
56
|
+
mcpChatBridgeScope = scope;
|
|
57
|
+
try {
|
|
58
|
+
if (scope) {
|
|
59
|
+
win?.sessionStorage?.setItem(MCP_CHAT_BRIDGE_STORAGE_KEY, scope);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
win?.sessionStorage?.removeItem(MCP_CHAT_BRIDGE_STORAGE_KEY);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// Session storage may be unavailable in some sandboxed hosts. The
|
|
67
|
+
// in-memory fallback still covers the normal single-page boot path.
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export function isEmbedMcpChatBridgeActive() {
|
|
71
|
+
const win = browserWindow();
|
|
72
|
+
if (!win)
|
|
73
|
+
return false;
|
|
74
|
+
if (!isEmbedAuthActive()) {
|
|
75
|
+
clearMcpChatBridge(win);
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
if (readEmbedMcpChatBridgeFlagFromUrl()) {
|
|
79
|
+
markEmbedMcpChatBridgeActive();
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
const scope = currentMcpChatBridgeScope(win);
|
|
83
|
+
if (mcpChatBridgeActive) {
|
|
84
|
+
if (scope && mcpChatBridgeScope === scope)
|
|
85
|
+
return true;
|
|
86
|
+
clearMcpChatBridge(win);
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const storedScope = win.sessionStorage?.getItem(MCP_CHAT_BRIDGE_STORAGE_KEY);
|
|
91
|
+
if (scope && storedScope === scope)
|
|
92
|
+
return true;
|
|
93
|
+
if (storedScope && storedScope !== scope) {
|
|
94
|
+
win.sessionStorage?.removeItem(MCP_CHAT_BRIDGE_STORAGE_KEY);
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return false;
|
|
20
100
|
}
|
|
21
101
|
}
|
|
22
102
|
function storedToken(win) {
|
|
@@ -54,18 +134,23 @@ export function isEmbedAuthActive() {
|
|
|
54
134
|
return false;
|
|
55
135
|
if (getEmbedAuthToken())
|
|
56
136
|
return true;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
137
|
+
const mode = currentUrl(win)?.searchParams.get(EMBED_MODE_QUERY_PARAM);
|
|
138
|
+
return mode === "1" || mode === "true";
|
|
139
|
+
}
|
|
140
|
+
/** Internal test helper. Do not use in app code. */
|
|
141
|
+
export function _resetEmbedAuthForTests() {
|
|
142
|
+
installed = false;
|
|
143
|
+
memoryToken = null;
|
|
144
|
+
mcpChatBridgeActive = false;
|
|
145
|
+
mcpChatBridgeScope = null;
|
|
146
|
+
authFailureCache.clear();
|
|
147
|
+
embedAuthFailure = null;
|
|
65
148
|
}
|
|
66
149
|
function stripTokenFromUrl(win) {
|
|
67
150
|
try {
|
|
68
|
-
const url =
|
|
151
|
+
const url = currentUrl(win);
|
|
152
|
+
if (!url)
|
|
153
|
+
return;
|
|
69
154
|
if (!url.searchParams.has(EMBED_TOKEN_QUERY_PARAM))
|
|
70
155
|
return;
|
|
71
156
|
url.searchParams.delete(EMBED_TOKEN_QUERY_PARAM);
|
|
@@ -205,6 +290,8 @@ export function ensureEmbedAuthFetchInterceptor() {
|
|
|
205
290
|
const win = browserWindow();
|
|
206
291
|
if (!win)
|
|
207
292
|
return;
|
|
293
|
+
if (readEmbedMcpChatBridgeFlagFromUrl())
|
|
294
|
+
markEmbedMcpChatBridgeActive();
|
|
208
295
|
const urlToken = readTokenFromUrl(win);
|
|
209
296
|
if (urlToken) {
|
|
210
297
|
storeToken(urlToken, win);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed-auth.js","sourceRoot":"","sources":["../../src/client/embed-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AAEjC,IAAI,SAAS,GAAG,KAAK,CAAC;AACtB,IAAI,WAAW,GAAkB,IAAI,CAAC;AACtC,MAAM,uBAAuB,GAAG,+BAA+B,CAAC;AAEhE,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AACjD,MAAM,mBAAmB,GAAG,qCAAqC,CAAC;AAUlE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAA6B,CAAC;AAC9D,IAAI,gBAAgB,GAA6B,IAAI,CAAC;AAEtD,SAAS,aAAa;IACpB,OAAO,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AACvD,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW;IACnC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,GAAW;IAC9B,IA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esContent":["import {\n EMBED_MODE_QUERY_PARAM,\n EMBED_START_PATH,\n EMBED_TARGET_HEADER,\n EMBED_TOKEN_QUERY_PARAM,\n} from \"../shared/embed-auth.js\";\n\nlet installed = false;\nlet memoryToken: string | null = null;\nconst EMBED_TOKEN_STORAGE_KEY = \"agent-native:embed-auth-token\";\n\nconst AUTH_FAILURE_COOLDOWN_MS = 60_000;\nconst GUARDED_METHODS = new Set([\"GET\", \"HEAD\"]);\nconst AUTH_FAILURE_HEADER = \"x-agent-native-auth-circuit-breaker\";\n\ntype AuthFailureRecord = {\n status: number;\n statusText: string;\n headers: [string, string][];\n body: string | null;\n expiresAt: number;\n};\n\nconst authFailureCache = new Map<string, AuthFailureRecord>();\nlet embedAuthFailure: AuthFailureRecord | null = null;\n\nfunction browserWindow(): Window | null {\n return typeof window === \"undefined\" ? null : window;\n}\n\nfunction readTokenFromUrl(win: Window): string | null {\n try {\n const url = new URL(win.location.href);\n return url.searchParams.get(EMBED_TOKEN_QUERY_PARAM);\n } catch {\n return null;\n }\n}\n\nfunction storedToken(win: Window): string | null {\n try {\n return win.sessionStorage?.getItem(EMBED_TOKEN_STORAGE_KEY) ?? null;\n } catch {\n return null;\n }\n}\n\nfunction storeToken(token: string, win: Window): void {\n memoryToken = token;\n try {\n win.sessionStorage?.setItem(EMBED_TOKEN_STORAGE_KEY, token);\n } catch {\n // Session storage may be unavailable in some sandboxed hosts. The\n // in-memory fallback still covers the normal single-page boot path.\n }\n}\n\nexport function getEmbedAuthToken(): string | null {\n const win = browserWindow();\n if (!win) return null;\n const fromUrl = readTokenFromUrl(win);\n if (fromUrl) {\n storeToken(fromUrl, win);\n return fromUrl;\n }\n return memoryToken ?? storedToken(win);\n}\n\nexport function isEmbedAuthActive(): boolean {\n const win = browserWindow();\n if (!win) return false;\n if (getEmbedAuthToken()) return true;\n try {\n const url = new URL(win.location.href);\n const mode = url.searchParams.get(EMBED_MODE_QUERY_PARAM);\n return mode === \"1\" || mode === \"true\";\n } catch {\n return false;\n }\n}\n\nfunction stripTokenFromUrl(win: Window): void {\n try {\n const url = new URL(win.location.href);\n if (!url.searchParams.has(EMBED_TOKEN_QUERY_PARAM)) return;\n url.searchParams.delete(EMBED_TOKEN_QUERY_PARAM);\n win.history.replaceState(\n win.history.state,\n \"\",\n `${url.pathname}${url.search}${url.hash}`,\n );\n } catch {\n // best effort only\n }\n}\n\nfunction currentEmbedTarget(win: Window): string {\n return `${win.location.pathname}${win.location.search}`;\n}\n\nfunction inputUrl(input: RequestInfo | URL, win: Window): URL | null {\n try {\n return input instanceof Request\n ? new URL(input.url)\n : new URL(String(input), win.location.origin);\n } catch {\n return null;\n }\n}\n\nfunction sameOrigin(input: RequestInfo | URL, win: Window): boolean {\n const url = inputUrl(input, win);\n return !!url && url.origin === win.location.origin;\n}\n\nfunction requestMethod(input: RequestInfo | URL, init?: RequestInit): string {\n return (\n init?.method ??\n (input instanceof Request ? input.method : undefined) ??\n \"GET\"\n ).toUpperCase();\n}\n\nfunction authFailureKey(method: string, url: URL): string {\n return `${method} ${url.href}`;\n}\n\nfunction isAuthFailureStatus(status: number): boolean {\n return status === 401 || status === 403;\n}\n\nfunction shouldGuardAuthFailure(method: string, url: URL): boolean {\n if (!GUARDED_METHODS.has(method)) return false;\n if (url.pathname === EMBED_START_PATH) return false;\n if (url.pathname === \"/_agent-native/sign-in\") return false;\n return true;\n}\n\nfunction activeAuthFailure(\n record: AuthFailureRecord | null | undefined,\n): AuthFailureRecord | null {\n if (!record) return null;\n if (record.expiresAt > Date.now()) return record;\n return null;\n}\n\nfunction getCachedAuthFailure(\n key: string,\n useEmbedWideFailure: boolean,\n): AuthFailureRecord | null {\n const cached = activeAuthFailure(authFailureCache.get(key));\n if (cached) return cached;\n authFailureCache.delete(key);\n\n if (!useEmbedWideFailure) return null;\n const embedCached = activeAuthFailure(embedAuthFailure);\n if (embedCached) return embedCached;\n embedAuthFailure = null;\n return null;\n}\n\nfunction authFailureResponse(record: AuthFailureRecord): Response {\n const headers = new Headers(record.headers);\n headers.set(AUTH_FAILURE_HEADER, \"1\");\n if (!headers.has(\"retry-after\")) {\n headers.set(\n \"retry-after\",\n String(Math.max(1, Math.ceil((record.expiresAt - Date.now()) / 1000))),\n );\n }\n return new Response(record.body, {\n status: record.status,\n statusText: record.statusText,\n headers,\n });\n}\n\nasync function recordAuthFailure(\n key: string,\n response: Response,\n useEmbedWideFailure: boolean,\n): Promise<void> {\n let body: string | null = null;\n try {\n body = await response.clone().text();\n } catch {\n body = null;\n }\n\n const headers: [string, string][] = [];\n response.headers.forEach((value, name) => {\n const lower = name.toLowerCase();\n if (\n lower === \"content-encoding\" ||\n lower === \"content-length\" ||\n lower === \"transfer-encoding\"\n ) {\n return;\n }\n headers.push([name, value]);\n });\n\n const record: AuthFailureRecord = {\n status: response.status,\n statusText: response.statusText,\n headers,\n body,\n expiresAt: Date.now() + AUTH_FAILURE_COOLDOWN_MS,\n };\n authFailureCache.set(key, record);\n if (useEmbedWideFailure) embedAuthFailure = record;\n}\n\nfunction clearAuthFailure(key: string, useEmbedWideFailure: boolean): void {\n authFailureCache.delete(key);\n if (useEmbedWideFailure) embedAuthFailure = null;\n}\n\nfunction withEmbedAuthHeaders(\n input: RequestInfo | URL,\n init: RequestInit | undefined,\n token: string,\n win: Window,\n): [RequestInfo | URL, RequestInit | undefined] {\n const headers = new Headers(\n init?.headers ?? (input instanceof Request ? input.headers : undefined),\n );\n if (!headers.has(\"Authorization\")) {\n headers.set(\"Authorization\", `Bearer ${token}`);\n }\n if (!headers.has(EMBED_TARGET_HEADER)) {\n headers.set(EMBED_TARGET_HEADER, currentEmbedTarget(win));\n }\n\n if (input instanceof Request) {\n return [new Request(input, { ...init, headers }), undefined];\n }\n return [input, { ...init, headers }];\n}\n\nfunction requestUrlAndKey(\n input: RequestInfo | URL,\n init: RequestInit | undefined,\n win: Window,\n):\n | {\n key: string;\n shouldGuard: boolean;\n }\n | undefined {\n const url = inputUrl(input, win);\n if (!url || url.origin !== win.location.origin) return undefined;\n const method = requestMethod(input, init);\n return {\n key: authFailureKey(method, url),\n shouldGuard: shouldGuardAuthFailure(method, url),\n };\n}\n\nexport function ensureEmbedAuthFetchInterceptor(): void {\n const win = browserWindow();\n if (!win) return;\n\n const urlToken = readTokenFromUrl(win);\n if (urlToken) {\n storeToken(urlToken, win);\n stripTokenFromUrl(win);\n }\n\n if (installed) return;\n if (typeof win.fetch !== \"function\") return;\n installed = true;\n\n const originalFetch = win.fetch.bind(win);\n win.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {\n const request = requestUrlAndKey(input, init, win);\n const embedMode = isEmbedAuthActive();\n if (request?.shouldGuard) {\n const cached = getCachedAuthFailure(request.key, embedMode);\n if (cached) return authFailureResponse(cached);\n }\n\n const token = getEmbedAuthToken();\n let fetchInput = input;\n let fetchInit = init;\n if (token && sameOrigin(input, win)) {\n [fetchInput, fetchInit] = withEmbedAuthHeaders(input, init, token, win);\n }\n\n const response = await originalFetch(fetchInput as any, fetchInit as any);\n if (request?.shouldGuard && isAuthFailureStatus(response.status)) {\n await recordAuthFailure(request.key, response, embedMode || !!token);\n } else if (request?.shouldGuard && response.ok) {\n clearAuthFailure(request.key, embedMode || !!token);\n }\n return response;\n }) as typeof fetch;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"embed-auth.js","sourceRoot":"","sources":["../../src/client/embed-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AAEjC,IAAI,SAAS,GAAG,KAAK,CAAC;AACtB,IAAI,WAAW,GAAkB,IAAI,CAAC;AACtC,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAChC,IAAI,kBAAkB,GAAkB,IAAI,CAAC;AAC7C,MAAM,uBAAuB,GAAG,+BAA+B,CAAC;AAChE,MAAM,2BAA2B,GAAG,8BAA8B,CAAC;AAEnE,MAAM,wBAAwB,GAAG,MAAM,CAA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AM;gBAAE,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;QACjD,CAAC;QAED,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC;QAClC,IAAI,UAAU,GAAG,KAAK,CAAC;QACvB,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,IAAI,KAAK,IAAI,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;YACpC,CAAC,UAAU,EAAE,SAAS,CAAC,GAAG,oBAAoB,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAC1E,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,UAAiB,EAAE,SAAgB,CAAC,CAAC;QAC1E,IAAI,OAAO,EAAE,WAAW,IAAI,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACjE,MAAM,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;QACvE,CAAC;aAAM,IAAI,OAAO,EAAE,WAAW,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;YAC/C,gBAAgB,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAiB,CAAC;AACrB,CAAC","sourcesContent":["import {\n EMBED_MODE_QUERY_PARAM,\n EMBED_START_PATH,\n EMBED_TARGET_HEADER,\n EMBED_TOKEN_QUERY_PARAM,\n MCP_APP_CHAT_BRIDGE_QUERY_PARAM,\n} from \"../shared/embed-auth.js\";\n\nlet installed = false;\nlet memoryToken: string | null = null;\nlet mcpChatBridgeActive = false;\nlet mcpChatBridgeScope: string | null = null;\nconst EMBED_TOKEN_STORAGE_KEY = \"agent-native:embed-auth-token\";\nconst MCP_CHAT_BRIDGE_STORAGE_KEY = \"agent-native:mcp-chat-bridge\";\n\nconst AUTH_FAILURE_COOLDOWN_MS = 60_000;\nconst GUARDED_METHODS = new Set([\"GET\", \"HEAD\"]);\nconst AUTH_FAILURE_HEADER = \"x-agent-native-auth-circuit-breaker\";\n\ntype AuthFailureRecord = {\n status: number;\n statusText: string;\n headers: [string, string][];\n body: string | null;\n expiresAt: number;\n};\n\nconst authFailureCache = new Map<string, AuthFailureRecord>();\nlet embedAuthFailure: AuthFailureRecord | null = null;\n\nfunction browserWindow(): Window | null {\n return typeof window === \"undefined\" ? null : window;\n}\n\nfunction currentUrl(win: Window): URL | null {\n try {\n return new URL(win.location.href);\n } catch {\n try {\n return new URL(\n `${win.location.pathname || \"/\"}${win.location.search || \"\"}${win.location.hash || \"\"}`,\n win.location.origin || \"http://agent-native.invalid\",\n );\n } catch {\n return null;\n }\n }\n}\n\nfunction readTokenFromUrl(win: Window): string | null {\n return currentUrl(win)?.searchParams.get(EMBED_TOKEN_QUERY_PARAM) ?? null;\n}\n\nexport function readEmbedMcpChatBridgeFlagFromUrl(): boolean {\n const win = browserWindow();\n if (!win) return false;\n const value = currentUrl(win)?.searchParams.get(\n MCP_APP_CHAT_BRIDGE_QUERY_PARAM,\n );\n return value === \"1\" || value === \"true\";\n}\n\nfunction currentMcpChatBridgeScope(win: Window): string | null {\n return readTokenFromUrl(win) ?? memoryToken ?? storedToken(win);\n}\n\nfunction clearMcpChatBridge(win: Window): void {\n mcpChatBridgeActive = false;\n mcpChatBridgeScope = null;\n try {\n win.sessionStorage?.removeItem(MCP_CHAT_BRIDGE_STORAGE_KEY);\n } catch {\n // ignore unavailable session storage\n }\n}\n\nexport function markEmbedMcpChatBridgeActive(): void {\n const win = browserWindow();\n const scope = win ? currentMcpChatBridgeScope(win) : null;\n mcpChatBridgeActive = true;\n mcpChatBridgeScope = scope;\n try {\n if (scope) {\n win?.sessionStorage?.setItem(MCP_CHAT_BRIDGE_STORAGE_KEY, scope);\n } else {\n win?.sessionStorage?.removeItem(MCP_CHAT_BRIDGE_STORAGE_KEY);\n }\n } catch {\n // Session storage may be unavailable in some sandboxed hosts. The\n // in-memory fallback still covers the normal single-page boot path.\n }\n}\n\nexport function isEmbedMcpChatBridgeActive(): boolean {\n const win = browserWindow();\n if (!win) return false;\n if (!isEmbedAuthActive()) {\n clearMcpChatBridge(win);\n return false;\n }\n if (readEmbedMcpChatBridgeFlagFromUrl()) {\n markEmbedMcpChatBridgeActive();\n return true;\n }\n const scope = currentMcpChatBridgeScope(win);\n if (mcpChatBridgeActive) {\n if (scope && mcpChatBridgeScope === scope) return true;\n clearMcpChatBridge(win);\n return false;\n }\n try {\n const storedScope = win.sessionStorage?.getItem(\n MCP_CHAT_BRIDGE_STORAGE_KEY,\n );\n if (scope && storedScope === scope) return true;\n if (storedScope && storedScope !== scope) {\n win.sessionStorage?.removeItem(MCP_CHAT_BRIDGE_STORAGE_KEY);\n }\n return false;\n } catch {\n return false;\n }\n}\n\nfunction storedToken(win: Window): string | null {\n try {\n return win.sessionStorage?.getItem(EMBED_TOKEN_STORAGE_KEY) ?? null;\n } catch {\n return null;\n }\n}\n\nfunction storeToken(token: string, win: Window): void {\n memoryToken = token;\n try {\n win.sessionStorage?.setItem(EMBED_TOKEN_STORAGE_KEY, token);\n } catch {\n // Session storage may be unavailable in some sandboxed hosts. The\n // in-memory fallback still covers the normal single-page boot path.\n }\n}\n\nexport function getEmbedAuthToken(): string | null {\n const win = browserWindow();\n if (!win) return null;\n const fromUrl = readTokenFromUrl(win);\n if (fromUrl) {\n storeToken(fromUrl, win);\n return fromUrl;\n }\n return memoryToken ?? storedToken(win);\n}\n\nexport function isEmbedAuthActive(): boolean {\n const win = browserWindow();\n if (!win) return false;\n if (getEmbedAuthToken()) return true;\n const mode = currentUrl(win)?.searchParams.get(EMBED_MODE_QUERY_PARAM);\n return mode === \"1\" || mode === \"true\";\n}\n\n/** Internal test helper. Do not use in app code. */\nexport function _resetEmbedAuthForTests(): void {\n installed = false;\n memoryToken = null;\n mcpChatBridgeActive = false;\n mcpChatBridgeScope = null;\n authFailureCache.clear();\n embedAuthFailure = null;\n}\n\nfunction stripTokenFromUrl(win: Window): void {\n try {\n const url = currentUrl(win);\n if (!url) return;\n if (!url.searchParams.has(EMBED_TOKEN_QUERY_PARAM)) return;\n url.searchParams.delete(EMBED_TOKEN_QUERY_PARAM);\n win.history.replaceState(\n win.history.state,\n \"\",\n `${url.pathname}${url.search}${url.hash}`,\n );\n } catch {\n // best effort only\n }\n}\n\nfunction currentEmbedTarget(win: Window): string {\n return `${win.location.pathname}${win.location.search}`;\n}\n\nfunction inputUrl(input: RequestInfo | URL, win: Window): URL | null {\n try {\n return input instanceof Request\n ? new URL(input.url)\n : new URL(String(input), win.location.origin);\n } catch {\n return null;\n }\n}\n\nfunction sameOrigin(input: RequestInfo | URL, win: Window): boolean {\n const url = inputUrl(input, win);\n return !!url && url.origin === win.location.origin;\n}\n\nfunction requestMethod(input: RequestInfo | URL, init?: RequestInit): string {\n return (\n init?.method ??\n (input instanceof Request ? input.method : undefined) ??\n \"GET\"\n ).toUpperCase();\n}\n\nfunction authFailureKey(method: string, url: URL): string {\n return `${method} ${url.href}`;\n}\n\nfunction isAuthFailureStatus(status: number): boolean {\n return status === 401 || status === 403;\n}\n\nfunction shouldGuardAuthFailure(method: string, url: URL): boolean {\n if (!GUARDED_METHODS.has(method)) return false;\n if (url.pathname === EMBED_START_PATH) return false;\n if (url.pathname === \"/_agent-native/sign-in\") return false;\n return true;\n}\n\nfunction activeAuthFailure(\n record: AuthFailureRecord | null | undefined,\n): AuthFailureRecord | null {\n if (!record) return null;\n if (record.expiresAt > Date.now()) return record;\n return null;\n}\n\nfunction getCachedAuthFailure(\n key: string,\n useEmbedWideFailure: boolean,\n): AuthFailureRecord | null {\n const cached = activeAuthFailure(authFailureCache.get(key));\n if (cached) return cached;\n authFailureCache.delete(key);\n\n if (!useEmbedWideFailure) return null;\n const embedCached = activeAuthFailure(embedAuthFailure);\n if (embedCached) return embedCached;\n embedAuthFailure = null;\n return null;\n}\n\nfunction authFailureResponse(record: AuthFailureRecord): Response {\n const headers = new Headers(record.headers);\n headers.set(AUTH_FAILURE_HEADER, \"1\");\n if (!headers.has(\"retry-after\")) {\n headers.set(\n \"retry-after\",\n String(Math.max(1, Math.ceil((record.expiresAt - Date.now()) / 1000))),\n );\n }\n return new Response(record.body, {\n status: record.status,\n statusText: record.statusText,\n headers,\n });\n}\n\nasync function recordAuthFailure(\n key: string,\n response: Response,\n useEmbedWideFailure: boolean,\n): Promise<void> {\n let body: string | null = null;\n try {\n body = await response.clone().text();\n } catch {\n body = null;\n }\n\n const headers: [string, string][] = [];\n response.headers.forEach((value, name) => {\n const lower = name.toLowerCase();\n if (\n lower === \"content-encoding\" ||\n lower === \"content-length\" ||\n lower === \"transfer-encoding\"\n ) {\n return;\n }\n headers.push([name, value]);\n });\n\n const record: AuthFailureRecord = {\n status: response.status,\n statusText: response.statusText,\n headers,\n body,\n expiresAt: Date.now() + AUTH_FAILURE_COOLDOWN_MS,\n };\n authFailureCache.set(key, record);\n if (useEmbedWideFailure) embedAuthFailure = record;\n}\n\nfunction clearAuthFailure(key: string, useEmbedWideFailure: boolean): void {\n authFailureCache.delete(key);\n if (useEmbedWideFailure) embedAuthFailure = null;\n}\n\nfunction withEmbedAuthHeaders(\n input: RequestInfo | URL,\n init: RequestInit | undefined,\n token: string,\n win: Window,\n): [RequestInfo | URL, RequestInit | undefined] {\n const headers = new Headers(\n init?.headers ?? (input instanceof Request ? input.headers : undefined),\n );\n if (!headers.has(\"Authorization\")) {\n headers.set(\"Authorization\", `Bearer ${token}`);\n }\n if (!headers.has(EMBED_TARGET_HEADER)) {\n headers.set(EMBED_TARGET_HEADER, currentEmbedTarget(win));\n }\n\n if (input instanceof Request) {\n return [new Request(input, { ...init, headers }), undefined];\n }\n return [input, { ...init, headers }];\n}\n\nfunction requestUrlAndKey(\n input: RequestInfo | URL,\n init: RequestInit | undefined,\n win: Window,\n):\n | {\n key: string;\n shouldGuard: boolean;\n }\n | undefined {\n const url = inputUrl(input, win);\n if (!url || url.origin !== win.location.origin) return undefined;\n const method = requestMethod(input, init);\n return {\n key: authFailureKey(method, url),\n shouldGuard: shouldGuardAuthFailure(method, url),\n };\n}\n\nexport function ensureEmbedAuthFetchInterceptor(): void {\n const win = browserWindow();\n if (!win) return;\n\n if (readEmbedMcpChatBridgeFlagFromUrl()) markEmbedMcpChatBridgeActive();\n\n const urlToken = readTokenFromUrl(win);\n if (urlToken) {\n storeToken(urlToken, win);\n stripTokenFromUrl(win);\n }\n\n if (installed) return;\n if (typeof win.fetch !== \"function\") return;\n installed = true;\n\n const originalFetch = win.fetch.bind(win);\n win.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {\n const request = requestUrlAndKey(input, init, win);\n const embedMode = isEmbedAuthActive();\n if (request?.shouldGuard) {\n const cached = getCachedAuthFailure(request.key, embedMode);\n if (cached) return authFailureResponse(cached);\n }\n\n const token = getEmbedAuthToken();\n let fetchInput = input;\n let fetchInit = init;\n if (token && sameOrigin(input, win)) {\n [fetchInput, fetchInit] = withEmbedAuthHeaders(input, init, token, win);\n }\n\n const response = await originalFetch(fetchInput as any, fetchInit as any);\n if (request?.shouldGuard && isAuthFailureStatus(response.status)) {\n await recordAuthFailure(request.key, response, embedMode || !!token);\n } else if (request?.shouldGuard && response.ok) {\n clearAuthFailure(request.key, embedMode || !!token);\n }\n return response;\n }) as typeof fetch;\n}\n"]}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export { useChatModels, type UseChatModelsResult, type EngineModelGroup, } from
|
|
|
11
11
|
export { CodeRequiredDialog, type CodeRequiredDialogProps, } from "./components/CodeRequiredDialog.js";
|
|
12
12
|
export { AgentConversation, AgentConversationMessageView, normalizeCodeAgentTranscriptForConversation, useNearBottomAutoscroll, type CodeAgentConversationTranscriptEvent, type CodeAgentConversationTranscriptEventType, type NormalizeCodeAgentTranscriptOptions, type AgentConversationArtifact, type AgentConversationAttachment, type AgentConversationMessage, type AgentConversationMessagePart, type AgentConversationMessageRole, type AgentConversationNotice, type AgentConversationNoticeTone, type AgentConversationToolCall, type AgentConversationToolState, } from "./conversation/index.js";
|
|
13
13
|
export { McpAppRenderer } from "./mcp-apps/McpAppRenderer.js";
|
|
14
|
-
export { AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES, getMcpAppHostContext, openMcpAppHostLink, requestMcpAppDisplayMode, updateMcpAppModelContext, useMcpAppHostContext, type AgentNativeMcpAppHostMessageType, type McpAppDisplayMode, type McpAppHostCapabilities, type McpAppHostContext, type McpAppHostContextSnapshot, type McpAppModelContextContentPart, type McpAppModelContextUpdate, } from "./mcp-app-host.js";
|
|
14
|
+
export { AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES, getMcpAppHostContext, openMcpAppHostLink, requestMcpAppDisplayMode, sendMcpAppHostMessage, updateMcpAppModelContext, useMcpAppHostContext, type AgentNativeMcpAppHostMessageType, type McpAppDisplayMode, type McpAppHostChatMessage, type McpAppHostCapabilities, type McpAppHostContext, type McpAppHostContextSnapshot, type McpAppModelContextContentPart, type McpAppModelContextUpdate, } from "./mcp-app-host.js";
|
|
15
15
|
export { CodeAgentIndicator, type CodeAgentIndicatorProps, } from "./components/CodeAgentIndicator.js";
|
|
16
16
|
export { useDbSync, useFileWatcher, useScreenRefreshKey, } from "./use-db-sync.js";
|
|
17
17
|
export { useChangeVersion, useChangeVersions, getChangeVersion, bumpChangeVersion, } from "./use-change-version.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EACf,aAAa,EACb,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,UAAU,EACV,WAAW,EACX,OAAO,GACR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,EACjB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,2BAA2B,EAC3B,KAAK,oBAAoB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,sBAAsB,EACtB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,GACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,GACjC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -13,7 +13,7 @@ export { useChatModels, } from "./use-chat-models.js";
|
|
|
13
13
|
export { CodeRequiredDialog, } from "./components/CodeRequiredDialog.js";
|
|
14
14
|
export { AgentConversation, AgentConversationMessageView, normalizeCodeAgentTranscriptForConversation, useNearBottomAutoscroll, } from "./conversation/index.js";
|
|
15
15
|
export { McpAppRenderer } from "./mcp-apps/McpAppRenderer.js";
|
|
16
|
-
export { AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES, getMcpAppHostContext, openMcpAppHostLink, requestMcpAppDisplayMode, updateMcpAppModelContext, useMcpAppHostContext, } from "./mcp-app-host.js";
|
|
16
|
+
export { AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES, getMcpAppHostContext, openMcpAppHostLink, requestMcpAppDisplayMode, sendMcpAppHostMessage, updateMcpAppModelContext, useMcpAppHostContext, } from "./mcp-app-host.js";
|
|
17
17
|
export { CodeAgentIndicator, } from "./components/CodeAgentIndicator.js";
|
|
18
18
|
export { useDbSync, useFileWatcher, useScreenRefreshKey, } from "./use-db-sync.js";
|
|
19
19
|
export { useChangeVersion, useChangeVersions, getChangeVersion, bumpChangeVersion, } from "./use-change-version.js";
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,yBAAyB,EAAE,CAAC;AAE5B,OAAO,EACL,eAAe,EACf,aAAa,GAEd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,UAAU,EACV,WAAW,EACX,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kCAAkC,EAClC,0BAA0B,GAM3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sCAAsC,GAGvC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,8BAA8B,GAG/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAC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B,MAAM,mCAAmC,CAAC;AAC3C,sCAAsC;AACtC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GAKtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["import { installRouteChunkRecovery } from \"./route-chunk-recovery.js\";\n\ninstallRouteChunkRecovery();\n\nexport {\n sendToAgentChat,\n generateTabId,\n type AgentChatMessage,\n} from \"./agent-chat.js\";\nexport { useAgentChatGenerating } from \"./use-agent-chat.js\";\nexport { useDevMode } from \"./use-dev-mode.js\";\nexport {\n agentNativePath,\n appApiPath,\n appBasePath,\n appPath,\n} from \"./api-path.js\";\nexport {\n ensureEmbedAuthFetchInterceptor,\n getEmbedAuthToken,\n isEmbedAuthActive,\n} from \"./embed-auth.js\";\nexport {\n codeAgentTranscriptEventsToContent,\n createCodeAgentChatAdapter,\n type CodeAgentChatController,\n type CodeAgentChatControlResult,\n type CodeAgentChatFollowUpMode,\n type CodeAgentChatTranscriptEvent,\n type CreateCodeAgentChatAdapterOptions,\n} from \"./code-agent-chat-adapter.js\";\nexport {\n buildRepositoryFromCodeAgentTranscript,\n type BuildRepositoryFromCodeAgentTranscriptOptions,\n type CodeAgentThreadTranscriptEvent,\n} from \"../agent/thread-data-builder.js\";\nexport {\n compareCodeAgentTranscriptEvents,\n getCodeAgentTranscriptSeq,\n isCodeAgentRunActive,\n mergeCodeAgentTranscriptEvents,\n type CodeAgentRunStateLike,\n type CodeAgentTranscriptOrderEvent,\n} from \"../code-agents/transcript-order.js\";\nexport { useSendToAgentChat } from \"./use-send-to-agent-chat.js\";\nexport {\n useChatModels,\n type UseChatModelsResult,\n type EngineModelGroup,\n} from \"./use-chat-models.js\";\nexport {\n CodeRequiredDialog,\n type CodeRequiredDialogProps,\n} from \"./components/CodeRequiredDialog.js\";\nexport {\n AgentConversation,\n AgentConversationMessageView,\n normalizeCodeAgentTranscriptForConversation,\n useNearBottomAutoscroll,\n type CodeAgentConversationTranscriptEvent,\n type CodeAgentConversationTranscriptEventType,\n type NormalizeCodeAgentTranscriptOptions,\n type AgentConversationArtifact,\n type AgentConversationAttachment,\n type AgentConversationMessage,\n type AgentConversationMessagePart,\n type AgentConversationMessageRole,\n type AgentConversationNotice,\n type AgentConversationNoticeTone,\n type AgentConversationToolCall,\n type AgentConversationToolState,\n} from \"./conversation/index.js\";\nexport { McpAppRenderer } from \"./mcp-apps/McpAppRenderer.js\";\nexport {\n AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES,\n getMcpAppHostContext,\n openMcpAppHostLink,\n requestMcpAppDisplayMode,\n updateMcpAppModelContext,\n useMcpAppHostContext,\n type AgentNativeMcpAppHostMessageType,\n type McpAppDisplayMode,\n type McpAppHostCapabilities,\n type McpAppHostContext,\n type McpAppHostContextSnapshot,\n type McpAppModelContextContentPart,\n type McpAppModelContextUpdate,\n} from \"./mcp-app-host.js\";\nexport {\n CodeAgentIndicator,\n type CodeAgentIndicatorProps,\n} from \"./components/CodeAgentIndicator.js\";\nexport {\n useDbSync,\n useFileWatcher,\n useScreenRefreshKey,\n} from \"./use-db-sync.js\";\nexport {\n useChangeVersion,\n useChangeVersions,\n getChangeVersion,\n bumpChangeVersion,\n} from \"./use-change-version.js\";\nexport {\n buildDynamicAgentSuggestions,\n dedupeSuggestions,\n mergeAgentSuggestions,\n normalizeAgentDynamicSuggestionsConfig,\n useAgentDynamicSuggestions,\n type AgentDynamicSuggestionContext,\n type AgentDynamicSuggestionsConfig,\n type AgentDynamicSuggestionsOption,\n} from \"./dynamic-suggestions.js\";\nexport { cn } from \"./utils.js\";\nexport { ApiKeySettings } from \"./components/ApiKeySettings.js\";\nexport { useSession, type AuthSession } from \"./use-session.js\";\nexport {\n sendToFrame,\n onFrameMessage,\n requestUserInfo,\n getFrameOrigin,\n getCallbackOrigin,\n oauthRedirectUri,\n isInFrame,\n enterStyleEditing,\n enterTextEditing,\n exitSelectionMode,\n type UserInfo,\n} from \"./frame.js\";\nexport {\n getBuilderParentOrigin,\n isInBuilderFrame,\n sendToBuilderChat,\n type BuilderChatMessage,\n} from \"./builder-frame.js\";\nexport {\n AgentNative,\n useAgentNativeScreenContext,\n type AgentNativeCommandCallback,\n type AgentNativeCommandCallbackInfo,\n type AgentNativeProps,\n} from \"./AgentNative.js\";\nexport {\n AgentNativeEmbedded,\n useAgentNativeEmbeddedBrowserSession,\n type AgentNativeEmbeddedBrowserSessionOptions,\n type AgentNativeEmbeddedCommandCallback,\n type AgentNativeEmbeddedCommandCallbackInfo,\n type AgentNativeEmbeddedProps,\n type UseAgentNativeEmbeddedBrowserSessionOptions,\n} from \"./AgentNativeEmbedded.js\";\nexport {\n defineClientAction,\n type AgentNativeClientActionDefinition,\n type AgentNativeClientActionRunner,\n} from \"./client-action.js\";\nexport {\n AgentNativeFrame,\n type AgentNativeFrameProps,\n} from \"./AgentNativeFrame.js\";\nexport {\n AgentNativeExtensionFrame,\n AgentNativeExtensionSlot,\n type AgentNativeExtensionFrameProps,\n type AgentNativeExtensionPermissionList,\n type AgentNativeExtensionSlotProps,\n type AgentNativeExtensionStorageScopeList,\n} from \"./extensions/AgentNativeExtensionFrame.js\";\nexport {\n AGENT_NATIVE_EXTENSION_MESSAGE_TYPES,\n buildAgentNativeExtensionHtml,\n createHttpAgentNativeExtensionStorage,\n createLocalStorageAgentNativeExtensionStorage,\n getAgentNativeExtensionManifest,\n isAgentNativeExtensionAllowedInSlot,\n normalizeAgentNativeExtensionSandbox,\n type AgentNativeExtensionDefinition,\n type AgentNativeExtensionManifest,\n type AgentNativeExtensionMessageType,\n type AgentNativeExtensionStorage,\n type AgentNativeExtensionStorageContext,\n type AgentNativeExtensionStorageOptions,\n type AgentNativeExtensionStorageRow,\n type AgentNativeExtensionStorageScope,\n type BuildAgentNativeExtensionHtmlOptions,\n type CreateHttpAgentNativeExtensionStorageOptions,\n} from \"./extensions/portable-extension.js\";\nexport {\n AGENT_NATIVE_HOST_BRIDGE_VERSION,\n AGENT_NATIVE_HOST_MESSAGE_TYPES,\n announceAgentNativeFrameReady,\n createAgentNativeHostBridge,\n defaultAgentNativeHostCommands,\n onAgentNativeHostInit,\n readAgentNativeScreenContext,\n requestAgentNativeHostActions,\n requestAgentNativeHostContext,\n runAgentNativeHostAction,\n sendAgentNativeHostCommand,\n type AgentNativeActionAvailability,\n type AgentNativeActionManifestEntry,\n type AgentNativeClientAction,\n type AgentNativeClientActionApprovalConfig,\n type AgentNativeClientActionGetter,\n type AgentNativeClientActionRuntime,\n type AgentNativeClientActions,\n type AgentNativeHostAuth,\n type AgentNativeHostAuthPayload,\n type AgentNativeHostBridge,\n type AgentNativeHostBridgeEvent,\n type AgentNativeHostBridgeOptions,\n type AgentNativeHostCapabilities,\n type AgentNativeHostCommandHandler,\n type AgentNativeHostCommandHandlers,\n type AgentNativeHostCommandRequest,\n type AgentNativeHostContext,\n type AgentNativeHostContextGetter,\n type AgentNativeHostInit,\n type AgentNativeHostMessageType,\n type AgentNativeHostRequestOptions,\n type AgentNativeHostResourceContext,\n type AgentNativeHostRouteContext,\n type AgentNativeHostSelectionContext,\n type AgentNativeHostSession,\n type AgentNativeJsonSchema,\n type AgentNativeScreenSnapshot,\n type AgentNativeScreenSnapshotOptions,\n type BuiltInAgentNativeHostCommand,\n} from \"./host-bridge.js\";\nexport {\n AGENT_NATIVE_HOST_TOOL_NAMES,\n createAgentNativeHostTools,\n type AgentNativeHostToolDefinition,\n type AgentNativeHostToolName,\n type AgentNativeHostToolParameters,\n type AgentNativeHostToolSet,\n type CreateAgentNativeHostToolsOptions,\n type RunAgentNativeHostActionToolInput,\n type SendAgentNativeHostCommandToolInput,\n} from \"./host-tools.js\";\nexport {\n createAgentNativeBrowserSessionBridge,\n startAgentNativeBrowserSessionBridge,\n type AgentNativeBrowserSessionBridge,\n type AgentNativeBrowserSessionBridgeOptions,\n} from \"./browser-session-bridge.js\";\nexport type {\n AgentNativeBrowserSession,\n AgentNativeBrowserSessionAction,\n AgentNativeBrowserSessionRecord,\n AgentNativeBrowserSessionRequest,\n AgentNativeBrowserSessionRequestStatus,\n AgentNativeBrowserSessionRequestType,\n CreateAgentNativeBrowserSessionRequestInput,\n RegisterAgentNativeBrowserSessionInput,\n} from \"../browser-sessions/types.js\";\nexport {\n NewWorkspaceAppFlow,\n type NewWorkspaceAppFlowProps,\n type VaultSecretOption,\n} from \"./NewWorkspaceAppFlow.js\";\nexport {\n AssistantChat,\n clearChatStorage,\n type AssistantChatProps,\n type AssistantChatHandle,\n} from \"./AssistantChat.js\";\nexport {\n MultiTabAssistantChat,\n type MultiTabAssistantChatProps,\n type MultiTabAssistantChatHeaderProps,\n} from \"./MultiTabAssistantChat.js\";\nexport { RunStuckBanner, type RunStuckBannerProps } from \"./RunStuckBanner.js\";\nexport {\n useRunStuckDetection,\n useAbortRun,\n type RunStuckState,\n type UseRunStuckDetectionOptions,\n} from \"./use-run-stuck-detection.js\";\nexport { createAgentChatAdapter } from \"./agent-chat-adapter.js\";\nexport {\n AgentComposerFrame,\n type AgentComposerFrameProps,\n PromptComposer,\n AGENT_PROMPT_MAX_INLINE_IMAGE_BYTES,\n AGENT_PROMPT_MAX_INLINE_TEXT_CHARS,\n escapePromptAttachmentAttribute,\n formatPromptWithAttachments,\n isInlineableAgentPromptFile,\n readAgentPromptAttachment,\n type PromptComposerProps,\n type PromptComposerFile,\n type PromptComposerSubmitOptions,\n type AgentPromptAttachment,\n type ReadAgentPromptAttachmentOptions,\n type AgentComposerLayoutVariant,\n type SlashCommand,\n type SkillResult,\n} from \"./composer/index.js\";\nexport type { TiptapComposerHandle } from \"./composer/TiptapComposer.js\";\nexport {\n GuidedQuestionFlow,\n useGuidedQuestionFlow,\n formatGuidedAnswerValue,\n formatGuidedAnswersForAgent,\n getOtherGuidedAnswerText,\n hasGuidedAnswer,\n isOtherGuidedAnswer,\n makeOtherGuidedAnswer,\n normalizeGuidedAnswers,\n type GuidedQuestion,\n type GuidedQuestionAnswers,\n type GuidedQuestionFlowProps,\n type GuidedQuestionOption,\n type GuidedQuestionPayload,\n type GuidedQuestionType,\n type UseGuidedQuestionFlowOptions,\n} from \"./guided-questions.js\";\nexport {\n useChatThreads,\n type ChatThreadScope,\n type ChatThreadSummary,\n type ChatThreadData,\n} from \"./use-chat-threads.js\";\nexport {\n AgentChatSurface,\n AgentPanel,\n AgentSidebar,\n AgentToggleButton,\n focusAgentChat,\n type AgentChatSurfaceMode,\n type AgentChatSurfaceProps,\n type AgentPanelProps,\n type AgentSidebarProps,\n} from \"./AgentPanel.js\";\nexport {\n SIDEBAR_STATE_CHANGE_EVENT,\n type AgentSidebarStateChangeDetail,\n type AgentSidebarStateMode,\n type AgentSidebarStateSource,\n} from \"./agent-sidebar-state.js\";\nexport { AgentNativeIcon } from \"./components/icons/AgentNativeIcon.js\";\nexport { SettingsPanel, type SettingsPanelProps } from \"./settings/index.js\";\nexport { useBuilderStatus } from \"./settings/useBuilderStatus.js\";\nexport {\n openBuilderConnectPopup,\n useBuilderConnectFlow,\n type BuilderConnectFlow,\n type BuilderConnectFlowOptions,\n type OpenBuilderConnectPopupOptions,\n} from \"./settings/useBuilderStatus.js\";\n// Deprecated — use AgentSidebar + AgentToggleButton instead\nexport {\n ProductionAgentPanel,\n type ProductionAgentPanelProps,\n} from \"./ProductionAgentPanel.js\";\nexport {\n useProductionAgent,\n type ProductionAgentMessage,\n type UseProductionAgentOptions,\n type UseProductionAgentResult,\n} from \"./useProductionAgent.js\";\nexport { Turnstile, type TurnstileProps } from \"./Turnstile.js\";\nexport {\n OpenSourceBadge,\n PoweredByBadge,\n type OpenSourceBadgeProps,\n type PoweredByBadgeProps,\n} from \"./PoweredByBadge.js\";\nexport { FeedbackButton, type FeedbackButtonProps } from \"./FeedbackButton.js\";\nexport { ErrorBoundary } from \"./ErrorBoundary.js\";\nexport { installRouteChunkRecovery } from \"./route-chunk-recovery.js\";\nexport { ClientOnly } from \"./ClientOnly.js\";\nexport { DefaultSpinner } from \"./DefaultSpinner.js\";\nexport {\n getThemeInitScript,\n themeInitScript,\n type ThemePreference,\n} from \"./theme.js\";\nexport {\n APPEARANCE_PRESETS,\n applyAppearance,\n getStoredAppearance,\n useAppearance,\n useAppearanceSync,\n type AppearancePresetId,\n} from \"./appearance.js\";\nexport {\n AppearancePicker,\n type AppearancePickerProps,\n} from \"./AppearancePicker.js\";\nexport { AgentTerminal, type AgentTerminalProps } from \"./terminal/index.js\";\nexport {\n trackEvent,\n trackSessionStatus,\n configureTracking,\n setSentryUser,\n captureError,\n captureClientException,\n type ClientCaptureContext,\n} from \"./analytics.js\";\nexport {\n useCollaborativeDoc,\n emailToColor,\n emailToName,\n type UseCollaborativeDocOptions,\n type UseCollaborativeDocResult,\n type CollabUser,\n} from \"../collab/client.js\";\nexport {\n ResourcesPanel,\n ResourceTree,\n ResourceEditor,\n useResources,\n useResourceTree,\n useResource,\n useCreateResource,\n useUpdateResource,\n useDeleteResource,\n useUploadResource,\n type Resource,\n type ResourceMeta,\n type TreeNode,\n type ResourceScope,\n type ResourceTreeProps,\n type ResourceEditorProps,\n} from \"./resources/index.js\";\nexport type {\n AppToFrameMessage,\n FrameToAppMessage,\n FrameMessage,\n CodeCompleteMessage,\n ChatRunningMessage,\n} from \"./frame-protocol.js\";\nexport {\n CommandMenu,\n useCommandMenuShortcut,\n openAgentSidebar,\n submitToAgent,\n type CommandMenuProps,\n type CommandGroupProps,\n type CommandItemProps,\n type CommandShortcutProps,\n} from \"./CommandMenu.js\";\nexport {\n DevOverlay,\n useDevOverlayShortcut,\n registerDevPanel,\n unregisterDevPanel,\n listDevPanels,\n subscribeDevPanels,\n useDevOption,\n clearAllDevOverlayStorage,\n devOptionKey,\n DEV_OVERLAY_STORAGE_PREFIX,\n type DevOverlayProps,\n type DevPanel,\n type DevOption,\n type DevBooleanOption,\n type DevSelectOption,\n type DevStringOption,\n type DevActionOption,\n type DevOptionValue,\n} from \"./dev-overlay/index.js\";\nexport {\n useActionQuery,\n useActionMutation,\n type ActionRegistry,\n} from \"./use-action.js\";\nexport { usePinchZoom, type UsePinchZoomOptions } from \"./use-pinch-zoom.js\";\nexport {\n ShareButton,\n ShareDialog,\n VisibilityBadge,\n type ShareButtonProps,\n type ShareDialogProps,\n type VisibilityBadgeProps,\n} from \"./sharing/index.js\";\nexport {\n postNavigate,\n isInAgentEmbed,\n AGENT_NAVIGATE_MESSAGE_TYPE,\n type AgentNavigateMessage,\n} from \"./embed.js\";\nexport { IframeEmbed, parseEmbedBody } from \"./IframeEmbed.js\";\nexport {\n useAvatarUrl,\n uploadAvatar,\n invalidateAvatarCache,\n} from \"./use-avatar.js\";\nexport {\n ObservabilityDashboard,\n ThumbsFeedback,\n} from \"./observability/index.js\";\n// Presence UI components\nexport {\n PresenceBar,\n type PresenceBarProps,\n} from \"./components/PresenceBar.js\";\nexport {\n AgentPresenceChip,\n type AgentPresenceChipProps,\n} from \"./components/AgentPresenceChip.js\";\n// Structured data collaboration hooks\nexport {\n useCollaborativeMap,\n useCollaborativeArray,\n type UseCollaborativeMapOptions,\n type UseCollaborativeMapResult,\n type UseCollaborativeArrayOptions,\n type UseCollaborativeArrayResult,\n} from \"../collab/client-struct.js\";\nexport { NotificationsBell } from \"./notifications/index.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,yBAAyB,EAAE,CAAC;AAE5B,OAAO,EACL,eAAe,EACf,aAAa,GAEd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,UAAU,EACV,WAAW,EACX,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kCAAkC,EAClC,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,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,sBAAsB,EACtB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,yBAAyB;AACzB,OAAO,EACL,WAAW,GAEZ,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,GAElB,MAAM,mCAAmC,CAAC;AAC3C,sCAAsC;AACtC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GAKtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["import { installRouteChunkRecovery } from \"./route-chunk-recovery.js\";\n\ninstallRouteChunkRecovery();\n\nexport {\n sendToAgentChat,\n generateTabId,\n type AgentChatMessage,\n} from \"./agent-chat.js\";\nexport { useAgentChatGenerating } from \"./use-agent-chat.js\";\nexport { useDevMode } from \"./use-dev-mode.js\";\nexport {\n agentNativePath,\n appApiPath,\n appBasePath,\n appPath,\n} from \"./api-path.js\";\nexport {\n ensureEmbedAuthFetchInterceptor,\n getEmbedAuthToken,\n isEmbedAuthActive,\n} from \"./embed-auth.js\";\nexport {\n codeAgentTranscriptEventsToContent,\n createCodeAgentChatAdapter,\n type CodeAgentChatController,\n type CodeAgentChatControlResult,\n type CodeAgentChatFollowUpMode,\n type CodeAgentChatTranscriptEvent,\n type CreateCodeAgentChatAdapterOptions,\n} from \"./code-agent-chat-adapter.js\";\nexport {\n buildRepositoryFromCodeAgentTranscript,\n type BuildRepositoryFromCodeAgentTranscriptOptions,\n type CodeAgentThreadTranscriptEvent,\n} from \"../agent/thread-data-builder.js\";\nexport {\n compareCodeAgentTranscriptEvents,\n getCodeAgentTranscriptSeq,\n isCodeAgentRunActive,\n mergeCodeAgentTranscriptEvents,\n type CodeAgentRunStateLike,\n type CodeAgentTranscriptOrderEvent,\n} from \"../code-agents/transcript-order.js\";\nexport { useSendToAgentChat } from \"./use-send-to-agent-chat.js\";\nexport {\n useChatModels,\n type UseChatModelsResult,\n type EngineModelGroup,\n} from \"./use-chat-models.js\";\nexport {\n CodeRequiredDialog,\n type CodeRequiredDialogProps,\n} from \"./components/CodeRequiredDialog.js\";\nexport {\n AgentConversation,\n AgentConversationMessageView,\n normalizeCodeAgentTranscriptForConversation,\n useNearBottomAutoscroll,\n type CodeAgentConversationTranscriptEvent,\n type CodeAgentConversationTranscriptEventType,\n type NormalizeCodeAgentTranscriptOptions,\n type AgentConversationArtifact,\n type AgentConversationAttachment,\n type AgentConversationMessage,\n type AgentConversationMessagePart,\n type AgentConversationMessageRole,\n type AgentConversationNotice,\n type AgentConversationNoticeTone,\n type AgentConversationToolCall,\n type AgentConversationToolState,\n} from \"./conversation/index.js\";\nexport { McpAppRenderer } from \"./mcp-apps/McpAppRenderer.js\";\nexport {\n AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES,\n getMcpAppHostContext,\n openMcpAppHostLink,\n requestMcpAppDisplayMode,\n sendMcpAppHostMessage,\n updateMcpAppModelContext,\n useMcpAppHostContext,\n type AgentNativeMcpAppHostMessageType,\n type McpAppDisplayMode,\n type McpAppHostChatMessage,\n type McpAppHostCapabilities,\n type McpAppHostContext,\n type McpAppHostContextSnapshot,\n type McpAppModelContextContentPart,\n type McpAppModelContextUpdate,\n} from \"./mcp-app-host.js\";\nexport {\n CodeAgentIndicator,\n type CodeAgentIndicatorProps,\n} from \"./components/CodeAgentIndicator.js\";\nexport {\n useDbSync,\n useFileWatcher,\n useScreenRefreshKey,\n} from \"./use-db-sync.js\";\nexport {\n useChangeVersion,\n useChangeVersions,\n getChangeVersion,\n bumpChangeVersion,\n} from \"./use-change-version.js\";\nexport {\n buildDynamicAgentSuggestions,\n dedupeSuggestions,\n mergeAgentSuggestions,\n normalizeAgentDynamicSuggestionsConfig,\n useAgentDynamicSuggestions,\n type AgentDynamicSuggestionContext,\n type AgentDynamicSuggestionsConfig,\n type AgentDynamicSuggestionsOption,\n} from \"./dynamic-suggestions.js\";\nexport { cn } from \"./utils.js\";\nexport { ApiKeySettings } from \"./components/ApiKeySettings.js\";\nexport { useSession, type AuthSession } from \"./use-session.js\";\nexport {\n sendToFrame,\n onFrameMessage,\n requestUserInfo,\n getFrameOrigin,\n getCallbackOrigin,\n oauthRedirectUri,\n isInFrame,\n enterStyleEditing,\n enterTextEditing,\n exitSelectionMode,\n type UserInfo,\n} from \"./frame.js\";\nexport {\n getBuilderParentOrigin,\n isInBuilderFrame,\n sendToBuilderChat,\n type BuilderChatMessage,\n} from \"./builder-frame.js\";\nexport {\n AgentNative,\n useAgentNativeScreenContext,\n type AgentNativeCommandCallback,\n type AgentNativeCommandCallbackInfo,\n type AgentNativeProps,\n} from \"./AgentNative.js\";\nexport {\n AgentNativeEmbedded,\n useAgentNativeEmbeddedBrowserSession,\n type AgentNativeEmbeddedBrowserSessionOptions,\n type AgentNativeEmbeddedCommandCallback,\n type AgentNativeEmbeddedCommandCallbackInfo,\n type AgentNativeEmbeddedProps,\n type UseAgentNativeEmbeddedBrowserSessionOptions,\n} from \"./AgentNativeEmbedded.js\";\nexport {\n defineClientAction,\n type AgentNativeClientActionDefinition,\n type AgentNativeClientActionRunner,\n} from \"./client-action.js\";\nexport {\n AgentNativeFrame,\n type AgentNativeFrameProps,\n} from \"./AgentNativeFrame.js\";\nexport {\n AgentNativeExtensionFrame,\n AgentNativeExtensionSlot,\n type AgentNativeExtensionFrameProps,\n type AgentNativeExtensionPermissionList,\n type AgentNativeExtensionSlotProps,\n type AgentNativeExtensionStorageScopeList,\n} from \"./extensions/AgentNativeExtensionFrame.js\";\nexport {\n AGENT_NATIVE_EXTENSION_MESSAGE_TYPES,\n buildAgentNativeExtensionHtml,\n createHttpAgentNativeExtensionStorage,\n createLocalStorageAgentNativeExtensionStorage,\n getAgentNativeExtensionManifest,\n isAgentNativeExtensionAllowedInSlot,\n normalizeAgentNativeExtensionSandbox,\n type AgentNativeExtensionDefinition,\n type AgentNativeExtensionManifest,\n type AgentNativeExtensionMessageType,\n type AgentNativeExtensionStorage,\n type AgentNativeExtensionStorageContext,\n type AgentNativeExtensionStorageOptions,\n type AgentNativeExtensionStorageRow,\n type AgentNativeExtensionStorageScope,\n type BuildAgentNativeExtensionHtmlOptions,\n type CreateHttpAgentNativeExtensionStorageOptions,\n} from \"./extensions/portable-extension.js\";\nexport {\n AGENT_NATIVE_HOST_BRIDGE_VERSION,\n AGENT_NATIVE_HOST_MESSAGE_TYPES,\n announceAgentNativeFrameReady,\n createAgentNativeHostBridge,\n defaultAgentNativeHostCommands,\n onAgentNativeHostInit,\n readAgentNativeScreenContext,\n requestAgentNativeHostActions,\n requestAgentNativeHostContext,\n runAgentNativeHostAction,\n sendAgentNativeHostCommand,\n type AgentNativeActionAvailability,\n type AgentNativeActionManifestEntry,\n type AgentNativeClientAction,\n type AgentNativeClientActionApprovalConfig,\n type AgentNativeClientActionGetter,\n type AgentNativeClientActionRuntime,\n type AgentNativeClientActions,\n type AgentNativeHostAuth,\n type AgentNativeHostAuthPayload,\n type AgentNativeHostBridge,\n type AgentNativeHostBridgeEvent,\n type AgentNativeHostBridgeOptions,\n type AgentNativeHostCapabilities,\n type AgentNativeHostCommandHandler,\n type AgentNativeHostCommandHandlers,\n type AgentNativeHostCommandRequest,\n type AgentNativeHostContext,\n type AgentNativeHostContextGetter,\n type AgentNativeHostInit,\n type AgentNativeHostMessageType,\n type AgentNativeHostRequestOptions,\n type AgentNativeHostResourceContext,\n type AgentNativeHostRouteContext,\n type AgentNativeHostSelectionContext,\n type AgentNativeHostSession,\n type AgentNativeJsonSchema,\n type AgentNativeScreenSnapshot,\n type AgentNativeScreenSnapshotOptions,\n type BuiltInAgentNativeHostCommand,\n} from \"./host-bridge.js\";\nexport {\n AGENT_NATIVE_HOST_TOOL_NAMES,\n createAgentNativeHostTools,\n type AgentNativeHostToolDefinition,\n type AgentNativeHostToolName,\n type AgentNativeHostToolParameters,\n type AgentNativeHostToolSet,\n type CreateAgentNativeHostToolsOptions,\n type RunAgentNativeHostActionToolInput,\n type SendAgentNativeHostCommandToolInput,\n} from \"./host-tools.js\";\nexport {\n createAgentNativeBrowserSessionBridge,\n startAgentNativeBrowserSessionBridge,\n type AgentNativeBrowserSessionBridge,\n type AgentNativeBrowserSessionBridgeOptions,\n} from \"./browser-session-bridge.js\";\nexport type {\n AgentNativeBrowserSession,\n AgentNativeBrowserSessionAction,\n AgentNativeBrowserSessionRecord,\n AgentNativeBrowserSessionRequest,\n AgentNativeBrowserSessionRequestStatus,\n AgentNativeBrowserSessionRequestType,\n CreateAgentNativeBrowserSessionRequestInput,\n RegisterAgentNativeBrowserSessionInput,\n} from \"../browser-sessions/types.js\";\nexport {\n NewWorkspaceAppFlow,\n type NewWorkspaceAppFlowProps,\n type VaultSecretOption,\n} from \"./NewWorkspaceAppFlow.js\";\nexport {\n AssistantChat,\n clearChatStorage,\n type AssistantChatProps,\n type AssistantChatHandle,\n} from \"./AssistantChat.js\";\nexport {\n MultiTabAssistantChat,\n type MultiTabAssistantChatProps,\n type MultiTabAssistantChatHeaderProps,\n} from \"./MultiTabAssistantChat.js\";\nexport { RunStuckBanner, type RunStuckBannerProps } from \"./RunStuckBanner.js\";\nexport {\n useRunStuckDetection,\n useAbortRun,\n type RunStuckState,\n type UseRunStuckDetectionOptions,\n} from \"./use-run-stuck-detection.js\";\nexport { createAgentChatAdapter } from \"./agent-chat-adapter.js\";\nexport {\n AgentComposerFrame,\n type AgentComposerFrameProps,\n PromptComposer,\n AGENT_PROMPT_MAX_INLINE_IMAGE_BYTES,\n AGENT_PROMPT_MAX_INLINE_TEXT_CHARS,\n escapePromptAttachmentAttribute,\n formatPromptWithAttachments,\n isInlineableAgentPromptFile,\n readAgentPromptAttachment,\n type PromptComposerProps,\n type PromptComposerFile,\n type PromptComposerSubmitOptions,\n type AgentPromptAttachment,\n type ReadAgentPromptAttachmentOptions,\n type AgentComposerLayoutVariant,\n type SlashCommand,\n type SkillResult,\n} from \"./composer/index.js\";\nexport type { TiptapComposerHandle } from \"./composer/TiptapComposer.js\";\nexport {\n GuidedQuestionFlow,\n useGuidedQuestionFlow,\n formatGuidedAnswerValue,\n formatGuidedAnswersForAgent,\n getOtherGuidedAnswerText,\n hasGuidedAnswer,\n isOtherGuidedAnswer,\n makeOtherGuidedAnswer,\n normalizeGuidedAnswers,\n type GuidedQuestion,\n type GuidedQuestionAnswers,\n type GuidedQuestionFlowProps,\n type GuidedQuestionOption,\n type GuidedQuestionPayload,\n type GuidedQuestionType,\n type UseGuidedQuestionFlowOptions,\n} from \"./guided-questions.js\";\nexport {\n useChatThreads,\n type ChatThreadScope,\n type ChatThreadSummary,\n type ChatThreadData,\n} from \"./use-chat-threads.js\";\nexport {\n AgentChatSurface,\n AgentPanel,\n AgentSidebar,\n AgentToggleButton,\n focusAgentChat,\n type AgentChatSurfaceMode,\n type AgentChatSurfaceProps,\n type AgentPanelProps,\n type AgentSidebarProps,\n} from \"./AgentPanel.js\";\nexport {\n SIDEBAR_STATE_CHANGE_EVENT,\n type AgentSidebarStateChangeDetail,\n type AgentSidebarStateMode,\n type AgentSidebarStateSource,\n} from \"./agent-sidebar-state.js\";\nexport { AgentNativeIcon } from \"./components/icons/AgentNativeIcon.js\";\nexport { SettingsPanel, type SettingsPanelProps } from \"./settings/index.js\";\nexport { useBuilderStatus } from \"./settings/useBuilderStatus.js\";\nexport {\n openBuilderConnectPopup,\n useBuilderConnectFlow,\n type BuilderConnectFlow,\n type BuilderConnectFlowOptions,\n type OpenBuilderConnectPopupOptions,\n} from \"./settings/useBuilderStatus.js\";\n// Deprecated — use AgentSidebar + AgentToggleButton instead\nexport {\n ProductionAgentPanel,\n type ProductionAgentPanelProps,\n} from \"./ProductionAgentPanel.js\";\nexport {\n useProductionAgent,\n type ProductionAgentMessage,\n type UseProductionAgentOptions,\n type UseProductionAgentResult,\n} from \"./useProductionAgent.js\";\nexport { Turnstile, type TurnstileProps } from \"./Turnstile.js\";\nexport {\n OpenSourceBadge,\n PoweredByBadge,\n type OpenSourceBadgeProps,\n type PoweredByBadgeProps,\n} from \"./PoweredByBadge.js\";\nexport { FeedbackButton, type FeedbackButtonProps } from \"./FeedbackButton.js\";\nexport { ErrorBoundary } from \"./ErrorBoundary.js\";\nexport { installRouteChunkRecovery } from \"./route-chunk-recovery.js\";\nexport { ClientOnly } from \"./ClientOnly.js\";\nexport { DefaultSpinner } from \"./DefaultSpinner.js\";\nexport {\n getThemeInitScript,\n themeInitScript,\n type ThemePreference,\n} from \"./theme.js\";\nexport {\n APPEARANCE_PRESETS,\n applyAppearance,\n getStoredAppearance,\n useAppearance,\n useAppearanceSync,\n type AppearancePresetId,\n} from \"./appearance.js\";\nexport {\n AppearancePicker,\n type AppearancePickerProps,\n} from \"./AppearancePicker.js\";\nexport { AgentTerminal, type AgentTerminalProps } from \"./terminal/index.js\";\nexport {\n trackEvent,\n trackSessionStatus,\n configureTracking,\n setSentryUser,\n captureError,\n captureClientException,\n type ClientCaptureContext,\n} from \"./analytics.js\";\nexport {\n useCollaborativeDoc,\n emailToColor,\n emailToName,\n type UseCollaborativeDocOptions,\n type UseCollaborativeDocResult,\n type CollabUser,\n} from \"../collab/client.js\";\nexport {\n ResourcesPanel,\n ResourceTree,\n ResourceEditor,\n useResources,\n useResourceTree,\n useResource,\n useCreateResource,\n useUpdateResource,\n useDeleteResource,\n useUploadResource,\n type Resource,\n type ResourceMeta,\n type TreeNode,\n type ResourceScope,\n type ResourceTreeProps,\n type ResourceEditorProps,\n} from \"./resources/index.js\";\nexport type {\n AppToFrameMessage,\n FrameToAppMessage,\n FrameMessage,\n CodeCompleteMessage,\n ChatRunningMessage,\n} from \"./frame-protocol.js\";\nexport {\n CommandMenu,\n useCommandMenuShortcut,\n openAgentSidebar,\n submitToAgent,\n type CommandMenuProps,\n type CommandGroupProps,\n type CommandItemProps,\n type CommandShortcutProps,\n} from \"./CommandMenu.js\";\nexport {\n DevOverlay,\n useDevOverlayShortcut,\n registerDevPanel,\n unregisterDevPanel,\n listDevPanels,\n subscribeDevPanels,\n useDevOption,\n clearAllDevOverlayStorage,\n devOptionKey,\n DEV_OVERLAY_STORAGE_PREFIX,\n type DevOverlayProps,\n type DevPanel,\n type DevOption,\n type DevBooleanOption,\n type DevSelectOption,\n type DevStringOption,\n type DevActionOption,\n type DevOptionValue,\n} from \"./dev-overlay/index.js\";\nexport {\n useActionQuery,\n useActionMutation,\n type ActionRegistry,\n} from \"./use-action.js\";\nexport { usePinchZoom, type UsePinchZoomOptions } from \"./use-pinch-zoom.js\";\nexport {\n ShareButton,\n ShareDialog,\n VisibilityBadge,\n type ShareButtonProps,\n type ShareDialogProps,\n type VisibilityBadgeProps,\n} from \"./sharing/index.js\";\nexport {\n postNavigate,\n isInAgentEmbed,\n AGENT_NAVIGATE_MESSAGE_TYPE,\n type AgentNavigateMessage,\n} from \"./embed.js\";\nexport { IframeEmbed, parseEmbedBody } from \"./IframeEmbed.js\";\nexport {\n useAvatarUrl,\n uploadAvatar,\n invalidateAvatarCache,\n} from \"./use-avatar.js\";\nexport {\n ObservabilityDashboard,\n ThumbsFeedback,\n} from \"./observability/index.js\";\n// Presence UI components\nexport {\n PresenceBar,\n type PresenceBarProps,\n} from \"./components/PresenceBar.js\";\nexport {\n AgentPresenceChip,\n type AgentPresenceChipProps,\n} from \"./components/AgentPresenceChip.js\";\n// Structured data collaboration hooks\nexport {\n useCollaborativeMap,\n useCollaborativeArray,\n type UseCollaborativeMapOptions,\n type UseCollaborativeMapResult,\n type UseCollaborativeArrayOptions,\n type UseCollaborativeArrayResult,\n} from \"../collab/client-struct.js\";\nexport { NotificationsBell } from \"./notifications/index.js\";\n"]}
|
|
@@ -15,6 +15,10 @@ export interface McpAppModelContextUpdate {
|
|
|
15
15
|
content?: McpAppModelContextContentPart[];
|
|
16
16
|
structuredContent?: unknown;
|
|
17
17
|
}
|
|
18
|
+
export interface McpAppHostChatMessage {
|
|
19
|
+
message: string;
|
|
20
|
+
context?: string;
|
|
21
|
+
}
|
|
18
22
|
export interface McpAppHostCapabilities {
|
|
19
23
|
updateModelContext?: boolean;
|
|
20
24
|
openLink?: boolean;
|
|
@@ -30,6 +34,7 @@ export interface McpAppHostContextSnapshot {
|
|
|
30
34
|
capabilities: McpAppHostCapabilities | null;
|
|
31
35
|
version: unknown;
|
|
32
36
|
}
|
|
37
|
+
export declare function sendMcpAppHostMessage(chat: McpAppHostChatMessage): Promise<boolean> | false;
|
|
33
38
|
export declare function getMcpAppHostContext(): McpAppHostContextSnapshot;
|
|
34
39
|
export declare function useMcpAppHostContext(): McpAppHostContextSnapshot;
|
|
35
40
|
export declare function updateMcpAppModelContext(update: McpAppModelContextUpdate): Promise<boolean> | false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-app-host.d.ts","sourceRoot":"","sources":["../../src/client/mcp-app-host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp-app-host.d.ts","sourceRoot":"","sources":["../../src/client/mcp-app-host.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,uCAAuC;;;;;;CAM1C,CAAC;AAEX,MAAM,MAAM,gCAAgC,GAC1C,CAAC,OAAO,uCAAuC,CAAC,CAAC,MAAM,OAAO,uCAAuC,CAAC,CAAC;AAEzG,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,KAAK,GAAG,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEhF,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,6BAA6B,EAAE,CAAC;IAC1C,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;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