@agent-native/core 0.80.1 → 0.80.2

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.
@@ -1,5 +1,25 @@
1
1
  # @agent-native/core
2
2
 
3
+ ## 0.80.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 7b44f20: Fix MCP App embeds never becoming visible in ChatGPT/Codex (stuck on "Loading
8
+ app", then the fallback panel). Two shell bugs in the inline-embed render path:
9
+ 1. `launchEmbed` called `setMessage("Loading app")` before the dedupe check, so
10
+ the constant `openai:set_globals`-driven relaunches wiped the just-mounted
11
+ iframe out of the stage on every cycle — the app rendered and was instantly
12
+ blanked, never reaching its ready handshake. The loading message now only
13
+ shows when no frame is mounted.
14
+ 2. The `openai:set_globals` handler re-synced unconditionally, and the sync
15
+ itself called `notifyHostHeight()`/`sendHostContext()`, which the host
16
+ reflected back as another `set_globals` — an infinite feedback storm that
17
+ starved the host into its sad-face placeholder. `syncOpenAiBridge` now
18
+ short-circuits when the relevant globals (tool input, open URLs, display
19
+ mode, theme, locale) are unchanged.
20
+
21
+ Bumps the embed shell version so hosts refetch the fixed shell.
22
+
3
23
  ## 0.80.1
4
24
 
5
25
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.80.1",
3
+ "version": "0.80.2",
4
4
  "description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -750,7 +750,7 @@ function safeUiSegment(value: string | undefined, fallback: string): string {
750
750
 
751
751
  // ChatGPT and Claude cache MCP App resource HTML by `ui://` URI. Bump this
752
752
  // when the shared shell changes in a way that must invalidate host caches.
753
- const MCP_APP_RESOURCE_SHELL_VERSION = "shell-v53";
753
+ const MCP_APP_RESOURCE_SHELL_VERSION = "shell-v54";
754
754
 
755
755
  function legacyDefaultMcpAppUri(config: MCPConfig, actionName: string): string {
756
756
  const app = safeUiSegment(config.appId ?? config.name, "agent-native");
@@ -124,6 +124,7 @@ export function embedApp(
124
124
  let app = null;
125
125
  let appConnectPromise = null;
126
126
  let openAiBridge = null;
127
+ let lastOpenAiSyncSignature = null;
127
128
  let wrapperRequestId = 0;
128
129
  const wrapperRequests = new Map();
129
130
  let toolInput = {};
@@ -1533,11 +1534,19 @@ export function embedApp(
1533
1534
  setMessage("Ready to open.");
1534
1535
  return;
1535
1536
  }
1536
- setMessage("Loading app");
1537
1537
  try {
1538
1538
  const selfNavigate = shouldSelfNavigateToApp();
1539
1539
  if (startedFor === launchUrl) return;
1540
1540
  startedFor = launchUrl;
1541
+ // Only show the loading message when no frame is mounted yet. ChatGPT
1542
+ // fires openai:set_globals (and thus re-launch) constantly; calling
1543
+ // setMessage() unconditionally here wiped the just-mounted iframe out of
1544
+ // the stage on every redundant launch, so the app rendered and was
1545
+ // instantly blanked back to "Loading app" forever. renderFrame()/
1546
+ // transplant replace the stage themselves when they actually (re)mount.
1547
+ if (!appFrame) {
1548
+ setMessage("Loading app");
1549
+ }
1541
1550
  const embedUrl = withChatBridgeParam(launchUrl);
1542
1551
  if (selfNavigate && isEmbedStartUrl(embedUrl)) {
1543
1552
  if (shouldTransplantAppDocument()) {
@@ -1662,6 +1671,31 @@ export function embedApp(
1662
1671
  toolResultData = objectValue(data);
1663
1672
  openUrl = openLinkFrom(params, data);
1664
1673
  openStartUrl = embedStartUrlFrom(params, data);
1674
+ // ChatGPT/Codex fire openai:set_globals extremely often, and the listener
1675
+ // that calls this re-syncs on each one. Because this function calls
1676
+ // notifyHostHeight()/sendHostContext() (which the host reflects back as a
1677
+ // fresh set_globals), an unguarded sync becomes an infinite feedback storm
1678
+ // that starves the host until it shows its sad-face placeholder. Only do
1679
+ // the host round-trips + (re)launch when something we care about changed.
1680
+ // Deliberately EXCLUDE bridge.maxHeight: the host mutates it on every
1681
+ // set_globals as it echoes our height back, which would defeat the guard.
1682
+ let signature;
1683
+ try {
1684
+ signature = JSON.stringify([
1685
+ toolInput,
1686
+ openUrl,
1687
+ openStartUrl,
1688
+ bridge.displayMode,
1689
+ bridge.theme,
1690
+ bridge.locale
1691
+ ]);
1692
+ } catch {
1693
+ signature = null;
1694
+ }
1695
+ if (signature !== null && signature === lastOpenAiSyncSignature) {
1696
+ return true;
1697
+ }
1698
+ lastOpenAiSyncSignature = signature;
1665
1699
  updateTitle(data);
1666
1700
  updateOpenButton();
1667
1701
  updateDisplayButton();
@@ -41,8 +41,8 @@ export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import
41
41
  * Body: { text: string, fieldName?: string, requestSource?: string }
42
42
  */
43
43
  export declare const postCollabText: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
44
- text?: undefined;
45
44
  ok?: undefined;
45
+ text?: undefined;
46
46
  error: string;
47
47
  } | {
48
48
  error?: undefined;
@@ -3,18 +3,18 @@ declare const _default: import("../../action.js").ActionDefinition<{
3
3
  url?: string;
4
4
  filename?: string;
5
5
  }, {
6
+ id?: undefined;
6
7
  error: string;
7
8
  configured?: undefined;
8
9
  connectPath?: undefined;
9
10
  url?: undefined;
10
- id?: undefined;
11
11
  provider?: undefined;
12
12
  } | {
13
+ id?: undefined;
13
14
  error: string;
14
15
  configured: boolean;
15
16
  connectPath: string;
16
17
  url?: undefined;
17
- id?: undefined;
18
18
  provider?: undefined;
19
19
  } | {
20
20
  error?: undefined;
@@ -494,7 +494,7 @@ function safeUiSegment(value, fallback) {
494
494
  }
495
495
  // ChatGPT and Claude cache MCP App resource HTML by `ui://` URI. Bump this
496
496
  // when the shared shell changes in a way that must invalidate host caches.
497
- const MCP_APP_RESOURCE_SHELL_VERSION = "shell-v53";
497
+ const MCP_APP_RESOURCE_SHELL_VERSION = "shell-v54";
498
498
  function legacyDefaultMcpAppUri(config, actionName) {
499
499
  const app = safeUiSegment(config.appId ?? config.name, "agent-native");
500
500
  const action = safeUiSegment(actionName, "tool");