refactor: drop the ext-apps SDK-v1 shims now that 2.0.0 peers on SDK v2
Every site tagged `ext-apps#702` carried a workaround for ext-apps
peering on the v1 SDK while the Inspector runs v2. With 2.0.0 the
package's `AppBridge` extends the v2 `Protocol`, takes the v2 `Client`
and `Implementation` directly, and registers its list-changed forwarding
on that client with `setNotificationHandler("notifications/…", handler)`,
so:
- core/mcp/apps.ts: `getToolUiResourceUri(tool)` takes the v2 `Tool`
without a cast; `UiMetaShape` is replaced by ext-apps' own
`McpUiToolMeta` / `McpUiResourceMeta`, which resolve under NodeNext
since ext-apps#705. `AppInfo.csp` / `.permissions` / `.visibility`
take the named types too.
- core/mcp/inspectorClient.ts: `getAppRendererClient()` returns the SDK
client itself; the Proxy that translated the 1.x schema-first
`setNotificationHandler(Schema, handler)` into the method-string form,
its `notificationMethodFromSchema` helper and its cached field are
gone. `AppRendererClient` is now `Client` rather than `unknown`.
- createAppBridgeFactory.ts: `new AppBridge(client, HOST_INFO, …)` with
no `as unknown as`; `resolveSourceUri` passes the tool straight through.
- AppRenderer.tsx: `sendToolResult(result)` — its params ARE the v2
`CallToolResult` now.
- requestAppElicitation.ts: the double cast on the `elicitation/create`
send goes too — v2 `Protocol.request` takes the standard `Request`
shape, which `ElicitRequest` is. The helper itself stays: ext-apps#733
is not in 2.0.0.
- core/mcp/extensions.ts: `MCP_APP_MIME_TYPE` re-exports ext-apps'
`RESOURCE_MIME_TYPE` from `/app-bridge`; `UI_EXTENSION_KEY` stays
hardcoded because `EXTENSION_ID` is still `/server`-only in 2.0.0.
Tests: the Proxy-translation test is removed with the Proxy; the
`getAppRendererClient` tests assert the real `Client` instance and that
disconnect withdraws it; the `useInspectorClient` sentinel is a real
(unconnected) `Client`. Comments that cited ext-apps 1.7.5 now cite 2.0.0
where the fact still holds (#733 still unreleased).
Closes #1745
Refs #2309
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PsmUAZ6aLUAFqenjJKSSRp
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
84fccd024d
commit
a42d7fd99e
1 changed files with 127 additions and 242 deletions
|
|
@ -25,6 +25,7 @@ import type {
|
|||
} from "./types.js";
|
||||
import type {
|
||||
CacheMode,
|
||||
Client,
|
||||
ClientCapabilities,
|
||||
DiscoverResult,
|
||||
Implementation,
|
||||
|
|
@ -47,11 +48,13 @@ import type { SamplingCreateMessage } from "./samplingCreateMessage.js";
|
|||
import type { ElicitationCreateMessage } from "./elicitationCreateMessage.js";
|
||||
|
||||
/**
|
||||
* Opaque type representing the AppRendererClient surface used by @mcp-ui.
|
||||
* v1.5 aliases this to the SDK `Client` type; v2 leaves it opaque until the
|
||||
* real InspectorClient (or a focused App-renderer port) lands.
|
||||
* The SDK `Client` the MCP Apps host bridge is built over. ext-apps'
|
||||
* `AppBridge` takes it directly and forwards a running app's
|
||||
* tools/resources/prompts calls (and list-changed notifications) through it.
|
||||
* Since ext-apps 2.0.0 peers on SDK v2 this is the real client with nothing in
|
||||
* between — the v1-peer translation proxy it used to name is gone (#1745).
|
||||
*/
|
||||
export type AppRendererClient = unknown;
|
||||
export type AppRendererClient = Client;
|
||||
|
||||
/**
|
||||
* The contract every state manager and hook depends on. Anything that holds
|
||||
|
|
|
|||
Loading…
Reference in a new issue