@guuey/mcp-apps-host 0.7.1 → 0.8.0
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/card-mount.d.ts +2 -2
- package/dist/card-mount.js +2 -2
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -7
- package/dist/react.d.ts +9 -6
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +18 -2
- package/dist/view-host-protocol.d.ts +51 -3
- package/dist/view-host-protocol.d.ts.map +1 -1
- package/dist/view-host-protocol.js +58 -2
- package/dist/view-host.d.ts +45 -1
- package/dist/view-host.d.ts.map +1 -1
- package/dist/view-host.js +32 -1
- package/package.json +1 -1
- package/src/card-mount.ts +2 -2
- package/src/index.ts +5 -17
- package/src/react.tsx +36 -7
- package/src/view-host-protocol.ts +104 -2
- package/src/view-host.ts +77 -0
- package/dist/ggui-render.d.ts +0 -144
- package/dist/ggui-render.d.ts.map +0 -1
- package/dist/ggui-render.js +0 -108
- package/src/ggui-render.ts +0 -188
package/src/ggui-render.ts
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated — the ggui vendor arm is RETIRED (guuey#209, 2026-08-16).
|
|
3
|
-
*
|
|
4
|
-
* Everything in this module is kept exported for ONE MINOR under the
|
|
5
|
-
* post-launch compatibility rule and is removed in the minor after the one
|
|
6
|
-
* that ships this notice. Nothing in `@guuey/mcp-apps-host` calls it any
|
|
7
|
-
* more: `toolResultViewMount` hands a ggui render back as a `ui://`
|
|
8
|
-
* **locator** (`toolResultLocator`, either channel), the mount material
|
|
9
|
-
* comes from a `resources/read` through a `UiResourceReader` (pod door
|
|
10
|
-
* live, persisted door on rehydration), and the `"ggui"` sandbox-trust
|
|
11
|
-
* channel is assigned at resolution from the requested uri
|
|
12
|
-
* (`uiResourceChannel` in `reader.ts`). Migration per symbol:
|
|
13
|
-
*
|
|
14
|
-
* - {@link asGguiRender} / {@link toolResultGguiRender} /
|
|
15
|
-
* {@link blockGguiRender} → `toolResultLocator(block)` — the locator is
|
|
16
|
-
* the recognition signal; there is no descriptor to build.
|
|
17
|
-
* - {@link gguiRenderResource} → resolve the locator through a reader
|
|
18
|
-
* (`resolveViewMount(mount, reader)`); ggui's `resources/read` returns
|
|
19
|
-
* the shell with live-channel material minted FRESH at read time.
|
|
20
|
-
* - {@link GGUI_RENDER_META_KEY} → the wire key is ggui's; import
|
|
21
|
-
* `MCP_APP_AI_GGUI_RENDER_META_KEY` from
|
|
22
|
-
* `@ggui-ai/protocol/integrations/mcp-apps` if you still inspect
|
|
23
|
-
* `_meta` (nothing here does).
|
|
24
|
-
* - {@link asGguiRenderBootstrap} / {@link gguiShellHtml} and their types
|
|
25
|
-
* are pure re-exports of ggui's protocol package — import them from
|
|
26
|
-
* `@ggui-ai/protocol/integrations/mcp-apps` directly.
|
|
27
|
-
*
|
|
28
|
-
* ## Why the arm existed, for the record
|
|
29
|
-
*
|
|
30
|
-
* A ggui render's `tool.done` used to carry two signals: `uiData.resourceUri`
|
|
31
|
-
* (recognition — the only part surviving the fold) and the
|
|
32
|
-
* `_meta["ai.ggui/render"]` bootstrap (mount material: runtime bundle,
|
|
33
|
-
* live channel, seeded props). Because guuey's chat client is not an MCP
|
|
34
|
-
* client (the pod holds the connection), a live locator had no host-side
|
|
35
|
-
* read channel, so the bootstrap was inlined as a read-skipping fast path
|
|
36
|
-
* and this module built ggui's self-contained shell from it. The pod door
|
|
37
|
-
* (`GET <pod>/agent/ui-resource`, guuey#209 C1) closed that gap; ggui's
|
|
38
|
-
* read-time mint (C2) made the read strictly fresher than the inlined
|
|
39
|
-
* copy; the vendor arm's only reason to exist was gone.
|
|
40
|
-
*/
|
|
41
|
-
import type { AgBlock, JsonValue } from "@silverprotocol/core";
|
|
42
|
-
import {
|
|
43
|
-
asGguiRenderBootstrap,
|
|
44
|
-
gguiShellHtml,
|
|
45
|
-
MCP_APP_AI_GGUI_RENDER_META_KEY,
|
|
46
|
-
type GguiRenderBootstrap,
|
|
47
|
-
} from "@ggui-ai/protocol/integrations/mcp-apps";
|
|
48
|
-
import { isJsonObject, type McpUiResourcePayload } from "./block-ui.js";
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
/** @deprecated import from `@ggui-ai/protocol/integrations/mcp-apps` (guuey#209; removed next minor). */
|
|
52
|
-
asGguiRenderBootstrap,
|
|
53
|
-
/** @deprecated import from `@ggui-ai/protocol/integrations/mcp-apps` (guuey#209; removed next minor). */
|
|
54
|
-
gguiShellHtml,
|
|
55
|
-
} from "@ggui-ai/protocol/integrations/mcp-apps";
|
|
56
|
-
export type {
|
|
57
|
-
/** @deprecated import from `@ggui-ai/protocol/integrations/mcp-apps` (guuey#209; removed next minor). */
|
|
58
|
-
GguiRenderBootstrap,
|
|
59
|
-
/** @deprecated import from `@ggui-ai/protocol/integrations/mcp-apps` (guuey#209; removed next minor). */
|
|
60
|
-
GguiShellHtmlOptions,
|
|
61
|
-
} from "@ggui-ai/protocol/integrations/mcp-apps";
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The `_meta` key the ggui render bootstrap rides on. Alias of the
|
|
65
|
-
* protocol package's own constant — one spelling, owned upstream.
|
|
66
|
-
*
|
|
67
|
-
* @deprecated guuey#209 — nothing in this package reads `_meta` any more.
|
|
68
|
-
* Import `MCP_APP_AI_GGUI_RENDER_META_KEY` from
|
|
69
|
-
* `@ggui-ai/protocol/integrations/mcp-apps` if you still need the key.
|
|
70
|
-
* Removed in the minor after the one shipping this notice.
|
|
71
|
-
*/
|
|
72
|
-
export const GGUI_RENDER_META_KEY = MCP_APP_AI_GGUI_RENDER_META_KEY;
|
|
73
|
-
|
|
74
|
-
/** The `ui://` scheme prefix every ggui render resource uri carries. */
|
|
75
|
-
const UI_SCHEME = "ui://";
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* A ggui render recognised on a tool result: its resource uri + mount material.
|
|
79
|
-
* @deprecated guuey#209 — the locator (`toolResultLocator`) is the whole
|
|
80
|
-
* recognition signal now; there is no descriptor to build. Removed next minor.
|
|
81
|
-
*/
|
|
82
|
-
export interface GguiRenderDescriptor {
|
|
83
|
-
/** `uiData.resourceUri` — `ui://ggui/render/<sessionId>/<contractHash>`. */
|
|
84
|
-
resourceUri: string;
|
|
85
|
-
/** `uiData.sessionId`, when present. */
|
|
86
|
-
sessionId?: string;
|
|
87
|
-
/**
|
|
88
|
-
* The `_meta["ai.ggui/render"]` slice, when it reached us. Absent for a
|
|
89
|
-
* persisted history card and for any consumer folding without `fold.ts`'s
|
|
90
|
-
* `_meta` carriage — such a descriptor is recognised but NOT mountable.
|
|
91
|
-
*/
|
|
92
|
-
bootstrap?: GguiRenderBootstrap;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* A tool result's `uiData` (+ its `_meta`, when carried) → a ggui render
|
|
97
|
-
* descriptor, or `undefined` for anything that is not one.
|
|
98
|
-
*
|
|
99
|
-
* The `ui://` scheme gate is deliberate: `uiData` is a general-purpose channel
|
|
100
|
-
* (every `structuredContent` of a `_meta.ui`-stamped tool lands there), so a
|
|
101
|
-
* bare `resourceUri` string is not on its own a claim of generative UI.
|
|
102
|
-
*
|
|
103
|
-
* @deprecated guuey#209 — use `toolResultLocator(block)`; the vendor arm is
|
|
104
|
-
* retired and nothing consumes the descriptor. Removed next minor.
|
|
105
|
-
*/
|
|
106
|
-
export function asGguiRender(
|
|
107
|
-
uiData: JsonValue | undefined,
|
|
108
|
-
meta: JsonValue | undefined,
|
|
109
|
-
): GguiRenderDescriptor | undefined {
|
|
110
|
-
if (!isJsonObject(uiData)) return undefined;
|
|
111
|
-
const resourceUri = uiData.resourceUri;
|
|
112
|
-
if (typeof resourceUri !== "string" || !resourceUri.startsWith(UI_SCHEME)) return undefined;
|
|
113
|
-
const bootstrap = asGguiRenderBootstrap(meta);
|
|
114
|
-
return {
|
|
115
|
-
resourceUri,
|
|
116
|
-
...(typeof uiData.sessionId === "string" ? { sessionId: uiData.sessionId } : {}),
|
|
117
|
-
...(bootstrap ? { bootstrap } : {}),
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* A live `tool-result` AgBlock → its ggui render descriptor, if it is one.
|
|
123
|
-
*
|
|
124
|
-
* NOTE: `@ggui-ai/protocol/integrations/mcp-apps` exports a helper of the
|
|
125
|
-
* same name that narrows a spec-canonical MCP `CallToolResult` instead. This
|
|
126
|
-
* one is the silverprotocol-side twin — the input is the FOLDED block, whose
|
|
127
|
-
* `uiData`/`_meta` carriage is `@silverprotocol/core`'s contract, not ggui's.
|
|
128
|
-
*
|
|
129
|
-
* @deprecated guuey#209 — use `toolResultLocator(block)`. Removed next minor.
|
|
130
|
-
*/
|
|
131
|
-
export function toolResultGguiRender(
|
|
132
|
-
block: Extract<AgBlock, { type: "tool-result" }>,
|
|
133
|
-
): GguiRenderDescriptor | undefined {
|
|
134
|
-
return asGguiRender(block.uiData, block._meta);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* An untyped (persisted-snapshot) block → its ggui render descriptor, if it is one.
|
|
139
|
-
* @deprecated guuey#209 — use `snapshotViewMount(cardSnapshot)`, whose locator
|
|
140
|
-
* arm is the persisted path. Removed next minor.
|
|
141
|
-
*/
|
|
142
|
-
export function blockGguiRender(block: JsonValue): GguiRenderDescriptor | undefined {
|
|
143
|
-
if (!isJsonObject(block)) return undefined;
|
|
144
|
-
if (block.type !== "tool-result") return undefined;
|
|
145
|
-
return asGguiRender(block.uiData, block._meta);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* A ggui render descriptor → the mountable resource the host's existing
|
|
150
|
-
* mcp-ui path already knows how to mount, or `undefined` when the descriptor
|
|
151
|
-
* carries no bootstrap (history cards, and any fold that dropped `_meta`).
|
|
152
|
-
*
|
|
153
|
-
* @deprecated guuey#209 — resolve the locator through a `UiResourceReader`
|
|
154
|
-
* (`resolveViewMount`); ggui's `resources/read` returns the shell with
|
|
155
|
-
* live-channel material minted FRESH at read time, which this inlined
|
|
156
|
-
* copy could never be. Removed next minor.
|
|
157
|
-
*
|
|
158
|
-
* The `uri` is the render's REAL `resourceUri` — the shell is the payload, not
|
|
159
|
-
* a renaming of the resource.
|
|
160
|
-
*
|
|
161
|
-
* The shell is built `background: 'transparent'`: every guuey host that
|
|
162
|
-
* mounts through this adapter (widget, portal web, Studio) draws its own
|
|
163
|
-
* card chrome around the iframe, so the host page composits behind the card.
|
|
164
|
-
* The upstream default (`'surface'`) is for standalone served documents —
|
|
165
|
-
* see `GguiShellHtmlOptions` in `@ggui-ai/protocol/integrations/mcp-apps`.
|
|
166
|
-
*
|
|
167
|
-
* **On `_meta` being required to MOUNT (but never to RECOGNISE).** Recognition
|
|
168
|
-
* — "this tool result is a ggui card" — is keyed on `uiData.resourceUri` alone
|
|
169
|
-
* and never waits for anything (see {@link asGguiRender}); nothing in this
|
|
170
|
-
* package is blocked on an upstream change. Mounting is different, and the
|
|
171
|
-
* requirement is ggui's, not ours: its runtime rejects a slice without
|
|
172
|
-
* `runtimeUrl` AND without at least one mode discriminator (`wsUrl`+`wsToken`,
|
|
173
|
-
* `codeUrl`, or `kind`) as `MALFORMED_BOOTSTRAP` and renders nothing. `uiData`
|
|
174
|
-
* carries none of those fields, so a bootstrap-less descriptor could only ever
|
|
175
|
-
* produce a blank frame; returning `undefined` and letting the host show its
|
|
176
|
-
* own placeholder is the honest answer, not a deferral. `@silverprotocol/core`'s
|
|
177
|
-
* `Reducer` is what puts `_meta` on the block for a live turn, in-repo, today.
|
|
178
|
-
*/
|
|
179
|
-
export function gguiRenderResource(
|
|
180
|
-
render: GguiRenderDescriptor,
|
|
181
|
-
): McpUiResourcePayload | undefined {
|
|
182
|
-
if (!render.bootstrap) return undefined;
|
|
183
|
-
return {
|
|
184
|
-
uri: render.resourceUri,
|
|
185
|
-
mimeType: "text/html",
|
|
186
|
-
text: gguiShellHtml(render.bootstrap, { background: "transparent" }),
|
|
187
|
-
};
|
|
188
|
-
}
|