Commit a402e6b
committed
feat(app-bridge): warn when View sends requests before initialized
Host-side complement to the App-side guard: AppBridge now console.warns
when it receives any request (tools/call, ui/message, resources/read,
etc.) before the View has sent ui/notifications/initialized.
Unlike the App side this never throws — throwing here would cause the
very teardown→hidden-iframe symptom we're diagnosing. The warn surfaces
in the host's DevTools (where developers debugging "iframe stays hidden"
look first) and catches hand-rolled Views that don't use the SDK.
Implemented by overriding replaceRequestHandler to wrap every host-bound
handler in one place. ui/initialize and ping use setRequestHandler
directly and remain exempt; notifications are unaffected.
Refs anthropics/claude-ai-mcp#61, anthropics/claude-ai-mcp#149.1 parent 18164de commit a402e6b
2 files changed
Lines changed: 71 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
840 | 840 | | |
841 | 841 | | |
842 | 842 | | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
843 | 877 | | |
844 | 878 | | |
845 | 879 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
307 | 308 | | |
308 | 309 | | |
309 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
310 | 342 | | |
311 | 343 | | |
312 | 344 | | |
| |||
357 | 389 | | |
358 | 390 | | |
359 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
360 | 396 | | |
361 | 397 | | |
362 | 398 | | |
| |||
1758 | 1794 | | |
1759 | 1795 | | |
1760 | 1796 | | |
| 1797 | + | |
1761 | 1798 | | |
1762 | 1799 | | |
1763 | 1800 | | |
| |||
0 commit comments