The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(conversations): inject the scroll affordance into every widget document
oxoxDev8bf32ac49d39
diff --git a/app/src/features/conversations/tools/mcpUi/mcpAppBridge.test.ts b/app/src/features/conversations/tools/mcpUi/mcpAppBridge.test.tsindex 51e7459106..893fc41917 100644--- a/app/src/features/conversations/tools/mcpUi/mcpAppBridge.test.ts+++ b/app/src/features/conversations/tools/mcpUi/mcpAppBridge.test.ts@@ -6,6 +6,7 @@ import {McpAppBridge,readRpcMessage,} from './mcpAppBridge';+import { SCROLL_AFFORDANCE_SOURCE } from './scrollAffordance';import type { McpUiPresentation } from './types';const flush = () => new Promise(resolve => setTimeout(resolve, 0));@@ -76,10 +77,21 @@ describe('McpAppBridge', () => {send({ jsonrpc: '2.0', method: 'ui/notifications/sandbox-proxy-ready', params: {} });send({ jsonrpc: '2.0', method: 'ui/notifications/sandbox-proxy-ready', params: {} });expect(posted).toHaveLength(1);- expect(posted[0]).toMatchObject({- method: 'ui/notifications/sandbox-resource-ready',- params: { html: '<html><head></head><body>cart</body></html>' },- });+ expect(posted[0]).toMatchObject({ method: 'ui/notifications/sandbox-resource-ready' });+ const html = (posted[0].params as { html: string }).html;+ expect(html.startsWith('<html><head><script>')).toBe(true);+ expect(html.endsWith('</head><body>cart</body></html>')).toBe(true);+ });++ it('injects the scroll affordance for both flavors, the shim only for Apps SDK', () => {+ for (const flavor of ['mcp_apps', 'apps_sdk'] as const) {+ const { send, posted } = setup({ flavor });+ send({ jsonrpc: '2.0', method: 'ui/notifications/sandbox-proxy-ready' });+ const html = (posted[0].params as { html: string }).html;+ expect(html).toContain(SCROLL_AFFORDANCE_SOURCE.slice(0, 40));+ expect(html.includes('window.openai')).toBe(flavor === 'apps_sdk');+ expect(html.lastIndexOf('</script>')).toBeLessThan(html.indexOf('cart'));+ }});it('injects the Apps SDK shim for Apps SDK widgets', () => {diff --git a/app/src/features/conversations/tools/mcpUi/mcpAppBridge.ts b/app/src/features/conversations/tools/mcpUi/mcpAppBridge.tsindex 516922a485..c2735980d4 100644--- a/app/src/features/conversations/tools/mcpUi/mcpAppBridge.ts+++ b/app/src/features/conversations/tools/mcpUi/mcpAppBridge.ts@@ -11,6 +11,7 @@ import debug from 'debug';import { classifyHref } from '../../utils/format';import { APPS_SDK_SHIM_SOURCE, injectScript } from './appsSdkShim';+import { SCROLL_AFFORDANCE_SOURCE } from './scrollAffordance';import type { McpUiPresentation } from './types';const log = debug('mcp-ui:bridge');@@ -200,10 +201,11 @@ export class McpAppBridge {private deliverDocument(): void {if (this.delivered) return;this.delivered = true;+ const withAffordance = injectScript(this.options.html, SCROLL_AFFORDANCE_SOURCE);const html =this.flavor === 'apps_sdk'- ? injectScript(this.options.html, APPS_SDK_SHIM_SOURCE)- : this.options.html;+ ? injectScript(withAffordance, APPS_SDK_SHIM_SOURCE)+ : withAffordance;log('delivering widget document (%s)', this.flavor);this.post({ method: 'ui/notifications/sandbox-resource-ready', params: { html } });}