@agent-native/core 0.22.13 → 0.22.17
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/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +13 -1
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +5 -6
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +13 -0
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/embed-auth.d.ts.map +1 -1
- package/dist/client/embed-auth.js +161 -20
- package/dist/client/embed-auth.js.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/mcp-app-host.d.ts +40 -0
- package/dist/client/mcp-app-host.d.ts.map +1 -0
- package/dist/client/mcp-app-host.js +165 -0
- package/dist/client/mcp-app-host.js.map +1 -0
- package/dist/client/sharing/ShareButton.d.ts +9 -0
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +19 -2
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +13 -0
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/use-chat-models.d.ts.map +1 -1
- package/dist/client/use-chat-models.js +4 -5
- package/dist/client/use-chat-models.js.map +1 -1
- package/dist/client/use-db-sync.d.ts.map +1 -1
- package/dist/client/use-db-sync.js +58 -3
- package/dist/client/use-db-sync.js.map +1 -1
- package/dist/client/use-db-sync.spec.js +27 -0
- package/dist/client/use-db-sync.spec.js.map +1 -1
- package/dist/deploy/build.d.ts +30 -0
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +31 -16
- package/dist/deploy/build.js.map +1 -1
- package/dist/index.browser.d.ts +2 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +2 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/builtin-tools.d.ts.map +1 -1
- package/dist/mcp/builtin-tools.js +0 -1
- package/dist/mcp/builtin-tools.js.map +1 -1
- package/dist/mcp/embed-app.d.ts +2 -0
- package/dist/mcp/embed-app.d.ts.map +1 -1
- package/dist/mcp/embed-app.js +180 -6
- package/dist/mcp/embed-app.js.map +1 -1
- package/dist/mcp/embed-route.d.ts +26 -0
- package/dist/mcp/embed-route.d.ts.map +1 -0
- package/dist/mcp/embed-route.js +38 -0
- package/dist/mcp/embed-route.js.map +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.d.ts.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.js +18 -12
- package/dist/scripts/agent-engines/list-agent-engines.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +9 -1
- package/dist/server/auth.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +22 -1
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/embed-route.d.ts.map +1 -1
- package/dist/server/embed-route.js +36 -7
- package/dist/server/embed-route.js.map +1 -1
- package/dist/server/embed-session.d.ts.map +1 -1
- package/dist/server/embed-session.js +11 -1
- package/dist/server/embed-session.js.map +1 -1
- package/dist/server/security-headers.d.ts +6 -1
- package/dist/server/security-headers.d.ts.map +1 -1
- package/dist/server/security-headers.js +10 -2
- package/dist/server/security-headers.js.map +1 -1
- package/dist/shared/embed-auth.d.ts +1 -0
- package/dist/shared/embed-auth.d.ts.map +1 -1
- package/dist/shared/embed-auth.js +1 -0
- package/dist/shared/embed-auth.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +28 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/actions.md +22 -7
- package/docs/content/client.md +43 -0
- package/docs/content/external-agents.md +40 -1
- package/docs/content/mcp-protocol.md +25 -0
- 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;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-chat.d.ts","sourceRoot":"","sources":["../../src/client/agent-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAYrE,MAAM,WAAW,gBAAgB;IAC/B,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,yCAAyC;IACzC,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;IACnC,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC1B,kFAAkF;IAClF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,6FAA6F;IAC7F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AA2BD,+BAA+B;AAC/B,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAYD;;GAEG;AACH;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAuD9D"}
|
|
@@ -7,6 +7,7 @@
|
|
|
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 { EMBED_MODE_QUERY_PARAM, EMBED_TOKEN_QUERY_PARAM, MCP_APP_CHAT_BRIDGE_QUERY_PARAM, } from "../shared/embed-auth.js";
|
|
10
11
|
import { isInBuilderFrame, isTrustedBuilderMessage, sendToBuilderChat, } from "./builder-frame.js";
|
|
11
12
|
const AGENT_CHAT_MESSAGE_TYPE = "agentNative.submitChat";
|
|
12
13
|
const AGENT_PANEL_PREPARE_EVENT = "agent-panel:prepare";
|
|
@@ -31,6 +32,14 @@ if (typeof window !== "undefined") {
|
|
|
31
32
|
export function generateTabId() {
|
|
32
33
|
return `chat-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
33
34
|
}
|
|
35
|
+
function isMcpAppChatBridgeEnabled() {
|
|
36
|
+
if (typeof window === "undefined" || window.parent === window)
|
|
37
|
+
return false;
|
|
38
|
+
const params = new URLSearchParams(window.location.search || "");
|
|
39
|
+
return (params.get(EMBED_MODE_QUERY_PARAM) === "1" &&
|
|
40
|
+
params.has(EMBED_TOKEN_QUERY_PARAM) &&
|
|
41
|
+
params.get(MCP_APP_CHAT_BRIDGE_QUERY_PARAM) === "1");
|
|
42
|
+
}
|
|
34
43
|
/**
|
|
35
44
|
* Send a message to the agent chat via postMessage.
|
|
36
45
|
*/
|
|
@@ -53,6 +62,10 @@ export function sendToAgentChat(opts) {
|
|
|
53
62
|
type: AGENT_CHAT_MESSAGE_TYPE,
|
|
54
63
|
data: { ...opts, tabId },
|
|
55
64
|
};
|
|
65
|
+
if (opts.submit !== false && isMcpAppChatBridgeEnabled()) {
|
|
66
|
+
window.parent.postMessage(payload, getFrameOrigin() || "*");
|
|
67
|
+
return tabId;
|
|
68
|
+
}
|
|
56
69
|
const shouldOpenSidebar = opts.openSidebar !== false && !opts.background;
|
|
57
70
|
const targetSelf = !isCodeRequest && isInBuilderFrame();
|
|
58
71
|
const target = targetSelf
|
|
@@ -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,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,KAAK,CAAC,IAAI,EAAE,IAAI,KAAK,qBAAqB,EAC1C,CAAC;YACD,MA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AC;IACb,MAAM,YAAY,GAAG,UAAU;QAC7B,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM;QACxB,CAAC,CAAC,cAAc,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC/C,IAAI,iBAAiB,EAAE,CAAC;QACtB,MAAM,CAAC,aAAa,CAClB,IAAI,WAAW,CAAC,sBAAsB,EAAE;YACtC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACzB,CAAC,CACH,CAAC;QACF,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC5D,CAAC;SAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC1B,MAAM,CAAC,aAAa,CAAC,IAAI,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 +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":"AAyDA,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CASjD;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAW3C;AAoLD,wBAAgB,+BAA+B,IAAI,IAAI,CAsCtD"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { EMBED_MODE_QUERY_PARAM, 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, } from "../shared/embed-auth.js";
|
|
2
2
|
let installed = false;
|
|
3
3
|
let memoryToken = null;
|
|
4
|
+
const EMBED_TOKEN_STORAGE_KEY = "agent-native:embed-auth-token";
|
|
5
|
+
const AUTH_FAILURE_COOLDOWN_MS = 60_000;
|
|
6
|
+
const GUARDED_METHODS = new Set(["GET", "HEAD"]);
|
|
7
|
+
const AUTH_FAILURE_HEADER = "x-agent-native-auth-circuit-breaker";
|
|
8
|
+
const authFailureCache = new Map();
|
|
9
|
+
let embedAuthFailure = null;
|
|
4
10
|
function browserWindow() {
|
|
5
11
|
return typeof window === "undefined" ? null : window;
|
|
6
12
|
}
|
|
@@ -13,17 +19,34 @@ function readTokenFromUrl(win) {
|
|
|
13
19
|
return null;
|
|
14
20
|
}
|
|
15
21
|
}
|
|
16
|
-
function
|
|
22
|
+
function storedToken(win) {
|
|
23
|
+
try {
|
|
24
|
+
return win.sessionStorage?.getItem(EMBED_TOKEN_STORAGE_KEY) ?? null;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function storeToken(token, win) {
|
|
17
31
|
memoryToken = token;
|
|
32
|
+
try {
|
|
33
|
+
win.sessionStorage?.setItem(EMBED_TOKEN_STORAGE_KEY, token);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Session storage may be unavailable in some sandboxed hosts. The
|
|
37
|
+
// in-memory fallback still covers the normal single-page boot path.
|
|
38
|
+
}
|
|
18
39
|
}
|
|
19
40
|
export function getEmbedAuthToken() {
|
|
20
41
|
const win = browserWindow();
|
|
21
42
|
if (!win)
|
|
22
43
|
return null;
|
|
23
44
|
const fromUrl = readTokenFromUrl(win);
|
|
24
|
-
if (fromUrl)
|
|
45
|
+
if (fromUrl) {
|
|
46
|
+
storeToken(fromUrl, win);
|
|
25
47
|
return fromUrl;
|
|
26
|
-
|
|
48
|
+
}
|
|
49
|
+
return memoryToken ?? storedToken(win);
|
|
27
50
|
}
|
|
28
51
|
export function isEmbedAuthActive() {
|
|
29
52
|
const win = browserWindow();
|
|
@@ -55,16 +78,128 @@ function stripTokenFromUrl(win) {
|
|
|
55
78
|
function currentEmbedTarget(win) {
|
|
56
79
|
return `${win.location.pathname}${win.location.search}`;
|
|
57
80
|
}
|
|
58
|
-
function
|
|
81
|
+
function inputUrl(input, win) {
|
|
59
82
|
try {
|
|
60
|
-
|
|
83
|
+
return input instanceof Request
|
|
61
84
|
? new URL(input.url)
|
|
62
85
|
: new URL(String(input), win.location.origin);
|
|
63
|
-
return url.origin === win.location.origin;
|
|
64
86
|
}
|
|
65
87
|
catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function sameOrigin(input, win) {
|
|
92
|
+
const url = inputUrl(input, win);
|
|
93
|
+
return !!url && url.origin === win.location.origin;
|
|
94
|
+
}
|
|
95
|
+
function requestMethod(input, init) {
|
|
96
|
+
return (init?.method ??
|
|
97
|
+
(input instanceof Request ? input.method : undefined) ??
|
|
98
|
+
"GET").toUpperCase();
|
|
99
|
+
}
|
|
100
|
+
function authFailureKey(method, url) {
|
|
101
|
+
return `${method} ${url.href}`;
|
|
102
|
+
}
|
|
103
|
+
function isAuthFailureStatus(status) {
|
|
104
|
+
return status === 401 || status === 403;
|
|
105
|
+
}
|
|
106
|
+
function shouldGuardAuthFailure(method, url) {
|
|
107
|
+
if (!GUARDED_METHODS.has(method))
|
|
108
|
+
return false;
|
|
109
|
+
if (url.pathname === EMBED_START_PATH)
|
|
110
|
+
return false;
|
|
111
|
+
if (url.pathname === "/_agent-native/sign-in")
|
|
66
112
|
return false;
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
function activeAuthFailure(record) {
|
|
116
|
+
if (!record)
|
|
117
|
+
return null;
|
|
118
|
+
if (record.expiresAt > Date.now())
|
|
119
|
+
return record;
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
function getCachedAuthFailure(key, useEmbedWideFailure) {
|
|
123
|
+
const cached = activeAuthFailure(authFailureCache.get(key));
|
|
124
|
+
if (cached)
|
|
125
|
+
return cached;
|
|
126
|
+
authFailureCache.delete(key);
|
|
127
|
+
if (!useEmbedWideFailure)
|
|
128
|
+
return null;
|
|
129
|
+
const embedCached = activeAuthFailure(embedAuthFailure);
|
|
130
|
+
if (embedCached)
|
|
131
|
+
return embedCached;
|
|
132
|
+
embedAuthFailure = null;
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
function authFailureResponse(record) {
|
|
136
|
+
const headers = new Headers(record.headers);
|
|
137
|
+
headers.set(AUTH_FAILURE_HEADER, "1");
|
|
138
|
+
if (!headers.has("retry-after")) {
|
|
139
|
+
headers.set("retry-after", String(Math.max(1, Math.ceil((record.expiresAt - Date.now()) / 1000))));
|
|
140
|
+
}
|
|
141
|
+
return new Response(record.body, {
|
|
142
|
+
status: record.status,
|
|
143
|
+
statusText: record.statusText,
|
|
144
|
+
headers,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
async function recordAuthFailure(key, response, useEmbedWideFailure) {
|
|
148
|
+
let body = null;
|
|
149
|
+
try {
|
|
150
|
+
body = await response.clone().text();
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
body = null;
|
|
67
154
|
}
|
|
155
|
+
const headers = [];
|
|
156
|
+
response.headers.forEach((value, name) => {
|
|
157
|
+
const lower = name.toLowerCase();
|
|
158
|
+
if (lower === "content-encoding" ||
|
|
159
|
+
lower === "content-length" ||
|
|
160
|
+
lower === "transfer-encoding") {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
headers.push([name, value]);
|
|
164
|
+
});
|
|
165
|
+
const record = {
|
|
166
|
+
status: response.status,
|
|
167
|
+
statusText: response.statusText,
|
|
168
|
+
headers,
|
|
169
|
+
body,
|
|
170
|
+
expiresAt: Date.now() + AUTH_FAILURE_COOLDOWN_MS,
|
|
171
|
+
};
|
|
172
|
+
authFailureCache.set(key, record);
|
|
173
|
+
if (useEmbedWideFailure)
|
|
174
|
+
embedAuthFailure = record;
|
|
175
|
+
}
|
|
176
|
+
function clearAuthFailure(key, useEmbedWideFailure) {
|
|
177
|
+
authFailureCache.delete(key);
|
|
178
|
+
if (useEmbedWideFailure)
|
|
179
|
+
embedAuthFailure = null;
|
|
180
|
+
}
|
|
181
|
+
function withEmbedAuthHeaders(input, init, token, win) {
|
|
182
|
+
const headers = new Headers(init?.headers ?? (input instanceof Request ? input.headers : undefined));
|
|
183
|
+
if (!headers.has("Authorization")) {
|
|
184
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
185
|
+
}
|
|
186
|
+
if (!headers.has(EMBED_TARGET_HEADER)) {
|
|
187
|
+
headers.set(EMBED_TARGET_HEADER, currentEmbedTarget(win));
|
|
188
|
+
}
|
|
189
|
+
if (input instanceof Request) {
|
|
190
|
+
return [new Request(input, { ...init, headers }), undefined];
|
|
191
|
+
}
|
|
192
|
+
return [input, { ...init, headers }];
|
|
193
|
+
}
|
|
194
|
+
function requestUrlAndKey(input, init, win) {
|
|
195
|
+
const url = inputUrl(input, win);
|
|
196
|
+
if (!url || url.origin !== win.location.origin)
|
|
197
|
+
return undefined;
|
|
198
|
+
const method = requestMethod(input, init);
|
|
199
|
+
return {
|
|
200
|
+
key: authFailureKey(method, url),
|
|
201
|
+
shouldGuard: shouldGuardAuthFailure(method, url),
|
|
202
|
+
};
|
|
68
203
|
}
|
|
69
204
|
export function ensureEmbedAuthFetchInterceptor() {
|
|
70
205
|
const win = browserWindow();
|
|
@@ -72,7 +207,7 @@ export function ensureEmbedAuthFetchInterceptor() {
|
|
|
72
207
|
return;
|
|
73
208
|
const urlToken = readTokenFromUrl(win);
|
|
74
209
|
if (urlToken) {
|
|
75
|
-
storeToken(urlToken);
|
|
210
|
+
storeToken(urlToken, win);
|
|
76
211
|
stripTokenFromUrl(win);
|
|
77
212
|
}
|
|
78
213
|
if (installed)
|
|
@@ -81,22 +216,28 @@ export function ensureEmbedAuthFetchInterceptor() {
|
|
|
81
216
|
return;
|
|
82
217
|
installed = true;
|
|
83
218
|
const originalFetch = win.fetch.bind(win);
|
|
84
|
-
win.fetch = ((input, init) => {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
219
|
+
win.fetch = (async (input, init) => {
|
|
220
|
+
const request = requestUrlAndKey(input, init, win);
|
|
221
|
+
const embedMode = isEmbedAuthActive();
|
|
222
|
+
if (request?.shouldGuard) {
|
|
223
|
+
const cached = getCachedAuthFailure(request.key, embedMode);
|
|
224
|
+
if (cached)
|
|
225
|
+
return authFailureResponse(cached);
|
|
88
226
|
}
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
227
|
+
const token = getEmbedAuthToken();
|
|
228
|
+
let fetchInput = input;
|
|
229
|
+
let fetchInit = init;
|
|
230
|
+
if (token && sameOrigin(input, win)) {
|
|
231
|
+
[fetchInput, fetchInit] = withEmbedAuthHeaders(input, init, token, win);
|
|
92
232
|
}
|
|
93
|
-
|
|
94
|
-
|
|
233
|
+
const response = await originalFetch(fetchInput, fetchInit);
|
|
234
|
+
if (request?.shouldGuard && isAuthFailureStatus(response.status)) {
|
|
235
|
+
await recordAuthFailure(request.key, response, embedMode || !!token);
|
|
95
236
|
}
|
|
96
|
-
if (
|
|
97
|
-
|
|
237
|
+
else if (request?.shouldGuard && response.ok) {
|
|
238
|
+
clearAuthFailure(request.key, embedMode || !!token);
|
|
98
239
|
}
|
|
99
|
-
return
|
|
240
|
+
return response;
|
|
100
241
|
});
|
|
101
242
|
}
|
|
102
243
|
//# sourceMappingURL=embed-auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed-auth.js","sourceRoot":"","sources":["../../src/client/embed-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AAEjC,IAAI,SAAS,GAAG,KAAK,CAAC;AACtB,IAAI,WAAW,GAAkB,IAAI,CAAC;AAEtC,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,CA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embed-auth.js\";\n\nlet installed = false;\nlet memoryToken: string | 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 storeToken(token: string): void {\n memoryToken = token;\n}\n\nexport function getEmbedAuthToken(): string | null {\n const win = browserWindow();\n if (!win) return null;\n const fromUrl = readTokenFromUrl(win);\n if (fromUrl) return fromUrl;\n return memoryToken;\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 sameOrigin(input: RequestInfo | URL, win: Window): boolean {\n try {\n const url =\n input instanceof Request\n ? new URL(input.url)\n : new URL(String(input), win.location.origin);\n return url.origin === win.location.origin;\n } catch {\n return false;\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);\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 = ((input: RequestInfo | URL, init?: RequestInit) => {\n const token = getEmbedAuthToken();\n if (!token || !sameOrigin(input, win)) {\n return originalFetch(input as any, init as any);\n }\n\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 originalFetch(new Request(input, { ...init, headers }));\n }\n return originalFetch(input as any, { ...init, headers });\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,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,M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AAK,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} 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"]}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -11,6 +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
15
|
export { CodeAgentIndicator, type CodeAgentIndicatorProps, } from "./components/CodeAgentIndicator.js";
|
|
15
16
|
export { useDbSync, useFileWatcher, useScreenRefreshKey, } from "./use-db-sync.js";
|
|
16
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,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kCAAkC,EAClC,0BAA0B,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,GACvC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sCA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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,6 +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
17
|
export { CodeAgentIndicator, } from "./components/CodeAgentIndicator.js";
|
|
17
18
|
export { useDbSync, useFileWatcher, useScreenRefreshKey, } from "./use-db-sync.js";
|
|
18
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,EAA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,cAAc,EACd,2BAA2B,GAE5B,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;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 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,GA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,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;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 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"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES: {
|
|
2
|
+
readonly HOST_CONTEXT: "agentNative.mcpHostContext";
|
|
3
|
+
readonly UPDATE_MODEL_CONTEXT: "agentNative.mcpHost.updateModelContext";
|
|
4
|
+
readonly OPEN_LINK: "agentNative.mcpHost.openLink";
|
|
5
|
+
readonly REQUEST_DISPLAY_MODE: "agentNative.mcpHost.requestDisplayMode";
|
|
6
|
+
readonly RESPONSE: "agentNative.mcpHost.response";
|
|
7
|
+
};
|
|
8
|
+
export type AgentNativeMcpAppHostMessageType = (typeof AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES)[keyof typeof AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES];
|
|
9
|
+
export type McpAppDisplayMode = "inline" | "pip" | "fullscreen" | (string & {});
|
|
10
|
+
export interface McpAppModelContextContentPart {
|
|
11
|
+
type: string;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface McpAppModelContextUpdate {
|
|
15
|
+
content?: McpAppModelContextContentPart[];
|
|
16
|
+
structuredContent?: unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface McpAppHostCapabilities {
|
|
19
|
+
updateModelContext?: boolean;
|
|
20
|
+
openLink?: boolean;
|
|
21
|
+
displayModes?: McpAppDisplayMode[];
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface McpAppHostContext {
|
|
25
|
+
capabilities?: McpAppHostCapabilities;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
export interface McpAppHostContextSnapshot {
|
|
29
|
+
context: McpAppHostContext | null;
|
|
30
|
+
capabilities: McpAppHostCapabilities | null;
|
|
31
|
+
version: unknown;
|
|
32
|
+
}
|
|
33
|
+
export declare function getMcpAppHostContext(): McpAppHostContextSnapshot;
|
|
34
|
+
export declare function useMcpAppHostContext(): McpAppHostContextSnapshot;
|
|
35
|
+
export declare function updateMcpAppModelContext(update: McpAppModelContextUpdate): Promise<boolean> | false;
|
|
36
|
+
export declare function openMcpAppHostLink(url: string): Promise<boolean> | false;
|
|
37
|
+
export declare function requestMcpAppDisplayMode(mode: McpAppDisplayMode): Promise<boolean> | false;
|
|
38
|
+
/** Internal test helper. Do not use in app code. */
|
|
39
|
+
export declare function _resetMcpAppHostForTests(): void;
|
|
40
|
+
//# sourceMappingURL=mcp-app-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-app-host.d.ts","sourceRoot":"","sources":["../../src/client/mcp-app-host.ts"],"names":[],"mappings":"AAOA,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,sBAAsB;IACrC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC5C,OAAO,EAAE,OAAO,CAAC;CAClB;AA4JD,wBAAgB,oBAAoB,IAAI,yBAAyB,CAGhE;AAED,wBAAgB,oBAAoB,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