@ggui-ai/protocol 0.1.0-rc.3 → 0.2.0-alpha.1
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/README.md +3 -3
- package/dist/bridge/invoke-agent.d.ts +8 -8
- package/dist/bridge/invoke-agent.d.ts.map +1 -1
- package/dist/bridge/invoke-agent.js +12 -12
- package/dist/envelopes/builders.d.ts +2 -4
- package/dist/envelopes/builders.d.ts.map +1 -1
- package/dist/envelopes/builders.js +2 -6
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/integrations/mcp-apps.d.ts +354 -711
- package/dist/integrations/mcp-apps.d.ts.map +1 -1
- package/dist/integrations/mcp-apps.js +266 -208
- package/dist/recommended-prompts.d.ts +1 -1
- package/dist/recommended-prompts.js +1 -1
- package/dist/schemas/data-contract.d.ts +4 -3
- package/dist/schemas/data-contract.d.ts.map +1 -1
- package/dist/schemas/data-contract.js +4 -3
- package/dist/schemas/invoke.d.ts +2 -2
- package/dist/schemas/invoke.js +2 -2
- package/dist/schemas/mcp.d.ts +60 -79
- package/dist/schemas/mcp.d.ts.map +1 -1
- package/dist/schemas/mcp.js +93 -116
- package/dist/schemas/sync-check.js +1 -1
- package/dist/stream/stream-parser.d.ts +4 -4
- package/dist/stream/stream-parser.d.ts.map +1 -1
- package/dist/stream/stream-parser.js +9 -9
- package/dist/transport/websocket.d.ts +14 -49
- package/dist/transport/websocket.d.ts.map +1 -1
- package/dist/types/app-config.d.ts +17 -32
- package/dist/types/app-config.d.ts.map +1 -1
- package/dist/types/canvas-lifecycle.d.ts +13 -13
- package/dist/types/canvas-lifecycle.d.ts.map +1 -1
- package/dist/types/canvas-lifecycle.js +3 -3
- package/dist/types/contract-inference.d.ts +4 -7
- package/dist/types/contract-inference.d.ts.map +1 -1
- package/dist/types/data-bindings.d.ts +1 -1
- package/dist/types/data-bindings.d.ts.map +1 -1
- package/dist/types/data-contract.d.ts +10 -10
- package/dist/types/data-contract.d.ts.map +1 -1
- package/dist/types/events.d.ts +14 -56
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/events.js +1 -8
- package/dist/types/feedback.d.ts +2 -4
- package/dist/types/feedback.d.ts.map +1 -1
- package/dist/types/handshake-suggestion.d.ts +1 -1
- package/dist/types/host-context.d.ts +5 -15
- package/dist/types/host-context.d.ts.map +1 -1
- package/dist/types/host-context.js +1 -1
- package/dist/types/live-channel.d.ts +128 -191
- package/dist/types/live-channel.d.ts.map +1 -1
- package/dist/types/llm-route.d.ts +233 -0
- package/dist/types/llm-route.d.ts.map +1 -0
- package/dist/types/llm-route.js +433 -0
- package/dist/types/llm.d.ts +34 -16
- package/dist/types/llm.d.ts.map +1 -1
- package/dist/types/llm.js +34 -38
- package/dist/types/mcp.d.ts +47 -137
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/mcp.js +2 -2
- package/dist/types/openrouter-models.d.ts +3 -2
- package/dist/types/openrouter-models.d.ts.map +1 -1
- package/dist/types/render-event.d.ts +119 -0
- package/dist/types/render-event.d.ts.map +1 -0
- package/dist/types/render-event.js +38 -0
- package/dist/types/session.d.ts +216 -342
- package/dist/types/session.d.ts.map +1 -1
- package/dist/types/ui-generator.d.ts +8 -9
- package/dist/types/ui-generator.d.ts.map +1 -1
- package/dist/validation/contract-validator.d.ts +60 -4
- package/dist/validation/contract-validator.d.ts.map +1 -1
- package/dist/validation/contract-validator.js +101 -5
- package/dist/validation/reserved-channels.d.ts +1 -1
- package/dist/validation/reserved-channels.js +5 -5
- package/dist/validation/sanitize-error.js +1 -1
- package/dist/validation/schema-compat-invariants.d.ts +2 -2
- package/dist/validation/schema-compat-invariants.js +2 -2
- package/dist/validation/schema-meta-validation.d.ts +1 -1
- package/dist/validation/schema-meta-validation.js +2 -2
- package/dist/validation/schema-subset.d.ts +1 -1
- package/dist/version.d.ts +253 -46
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +253 -46
- package/package.json +3 -2
- package/dist/navigation/index.d.ts +0 -3
- package/dist/navigation/index.d.ts.map +0 -1
- package/dist/navigation/index.js +0 -1
- package/dist/navigation/stack-navigation.d.ts +0 -55
- package/dist/navigation/stack-navigation.d.ts.map +0 -1
- package/dist/navigation/stack-navigation.js +0 -80
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-apps.d.ts","sourceRoot":"","sources":["../../src/integrations/mcp-apps.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mcp-apps.d.ts","sourceRoot":"","sources":["../../src/integrations/mcp-apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACV,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAG,4BAAqC,CAAC;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAG,kBAA2B,CAAC;AAEpE;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAG,2BAAoC,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;IAC9B,kFAAkF;;IAElF,kEAAkE;;CAE1D,CAAC;AAEX;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpD;;;;;;;;;GASG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,0BAA0B;IACzC,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD;;;OAGG;IACH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AkB;IACjC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;QAC9B,QAAQ,CAAC,IAAI,EAAE;YAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;KAC9C,CAAC;CACH"}
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
* ```ts
|
|
10
10
|
* import {
|
|
11
11
|
* MCP_APPS_UI_CAPABILITY,
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* GGUI_RENDER_RESOURCE_URI,
|
|
13
|
+
* parseMcpAppAiGguiRenderMeta,
|
|
14
|
+
* type McpAppAiGguiRenderMeta,
|
|
14
15
|
* } from '@ggui-ai/protocol/integrations/mcp-apps';
|
|
15
16
|
* ```
|
|
16
17
|
*
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
* drift is bounded to callers that explicitly import from here.
|
|
21
22
|
*
|
|
22
23
|
* Core still carries two fields that make the bootstrap flow work —
|
|
23
|
-
* `SubscribePayload.bootstrap?: string` and `AckPayload.
|
|
24
|
+
* `SubscribePayload.bootstrap?: string` and `AckPayload.renderToken?:
|
|
24
25
|
* string`. Those are deliberately framed as **general transport bootstrap
|
|
25
26
|
* credentials** (opaque strings), not MCP-Apps-specific. Any future
|
|
26
27
|
* bootstrap mechanism (short-code auto-login, signed-URL bootstrap, etc.)
|
|
@@ -34,26 +35,26 @@
|
|
|
34
35
|
export const MCP_APPS_UI_CAPABILITY = 'io.modelcontextprotocol/ui';
|
|
35
36
|
/**
|
|
36
37
|
* The single MCP Apps resource URI ggui exposes for outbound delivery.
|
|
37
|
-
* `
|
|
38
|
+
* `ggui_render` is the sole tool declaration that carries this in its
|
|
38
39
|
* `_meta.ui.resourceUri`. No other ggui tool gets a resource URI —
|
|
39
|
-
* `
|
|
40
|
+
* `ggui_render` is the single outbound entry point.
|
|
40
41
|
*/
|
|
41
|
-
export const
|
|
42
|
+
export const GGUI_RENDER_RESOURCE_URI = 'ui://ggui/render';
|
|
42
43
|
/**
|
|
43
|
-
* MIME type for the `ui://ggui/
|
|
44
|
+
* MIME type for the `ui://ggui/render` resource. Per MCP Apps spec, UI
|
|
44
45
|
* resources carry the `text/html` base type with a `profile=mcp-app`
|
|
45
46
|
* parameter so hosts that don't support MCP Apps don't accidentally
|
|
46
47
|
* render them as plain HTML.
|
|
47
48
|
*/
|
|
48
|
-
export const
|
|
49
|
+
export const GGUI_RENDER_RESOURCE_MIME = 'text/html;profile=mcp-app';
|
|
49
50
|
/**
|
|
50
51
|
* The single `_meta.ui.resourceUri` value ggui uses across every MCP Apps
|
|
51
52
|
* host surface. Exposed as a named constant so tool-declaration code,
|
|
52
53
|
* resource-serving code, and tests all agree on one spelling.
|
|
53
54
|
*/
|
|
54
|
-
export const
|
|
55
|
-
/** Resource URI hosts fetch via `resources/read` on a `
|
|
56
|
-
resourceUri:
|
|
55
|
+
export const GGUI_RENDER_UI_META = {
|
|
56
|
+
/** Resource URI hosts fetch via `resources/read` on a `ggui_render` tool call. */
|
|
57
|
+
resourceUri: GGUI_RENDER_RESOURCE_URI,
|
|
57
58
|
/** Only `"model"` — outer agent can call, iframe views cannot. */
|
|
58
59
|
visibility: ['model'],
|
|
59
60
|
};
|
|
@@ -75,23 +76,268 @@ export function deriveContextName(slotKey) {
|
|
|
75
76
|
return 'Context';
|
|
76
77
|
return slotKey.charAt(0).toUpperCase() + slotKey.slice(1) + 'Context';
|
|
77
78
|
}
|
|
79
|
+
// =============================================================================
|
|
80
|
+
// Single `_meta` key carrying everything a render needs — identity, boot
|
|
81
|
+
// wiring, live-channel auth, capability advertisements, render state,
|
|
82
|
+
// contract pointer, and component-mode discriminator.
|
|
83
|
+
//
|
|
84
|
+
// Phase B replaced the pair (`ai.ggui/session` + `ai.ggui/stack-item`)
|
|
85
|
+
// with this single key. The pair existed because pre-Phase-A multiple
|
|
86
|
+
// stack items could share session-scoped state; post-Phase-A every
|
|
87
|
+
// render is its own thing, so the two slices were always emitted
|
|
88
|
+
// together.
|
|
89
|
+
//
|
|
90
|
+
// Wire shape:
|
|
91
|
+
//
|
|
92
|
+
// ```jsonc
|
|
93
|
+
// "_meta": {
|
|
94
|
+
// "ai.ggui/render": {
|
|
95
|
+
// renderId, appId, runtimeUrl,
|
|
96
|
+
// wsUrl?, wsToken?, expiresAt?,
|
|
97
|
+
// pollingUrl?,
|
|
98
|
+
// themeId?, themeMode?,
|
|
99
|
+
// gadgets?, publicEnv?, streamWebSocketLocalTools?,
|
|
100
|
+
// appCallableTools?, permissionsPolicy?,
|
|
101
|
+
// lastSequence?,
|
|
102
|
+
// propsJson?, actionNextSteps?, contextSlots?,
|
|
103
|
+
// contractHash?, validatorsUrl?,
|
|
104
|
+
// codeUrl?, codeHash?, kind?
|
|
105
|
+
// }
|
|
106
|
+
// }
|
|
107
|
+
// ```
|
|
108
|
+
//
|
|
109
|
+
// Hosts that don't recognize the key MUST treat it as opaque and forward
|
|
110
|
+
// verbatim — same posture as the spec-defined `_meta` extension surface.
|
|
111
|
+
//
|
|
112
|
+
// Consumers:
|
|
113
|
+
// - {@link parseMcpAppAiGguiRenderMeta}(_meta) → {ok, meta?: <slice>}
|
|
114
|
+
// structural validation only. Missing key returns {ok:true, meta: undefined}.
|
|
115
|
+
// - {@link toMcpAppEnvelope}(slice) → `_meta` envelope. Emitter helper
|
|
116
|
+
// that builds the wire shape from a server-built slice.
|
|
117
|
+
// =============================================================================
|
|
78
118
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
119
|
+
* `_meta` key carrying the full render slice. Single source of truth
|
|
120
|
+
* post-Phase-B: identity, boot wiring, live-channel auth, capability
|
|
121
|
+
* advertisements, current render state, contract pointer, and component-
|
|
122
|
+
* mode discriminator.
|
|
123
|
+
*
|
|
124
|
+
* @public
|
|
125
|
+
*/
|
|
126
|
+
export const MCP_APP_AI_GGUI_RENDER_META_KEY = 'ai.ggui/render';
|
|
127
|
+
/**
|
|
128
|
+
* Read the `ai.ggui/render` slice off a parsed JSON-RPC `_meta` object.
|
|
129
|
+
*
|
|
130
|
+
* Structural validation only. Missing key returns `{ok: true, meta: undefined}`
|
|
131
|
+
* — not a failure. Required-fields gate (renderId / appId / runtimeUrl)
|
|
132
|
+
* fires only when the key is present. Field-level optional-field
|
|
133
|
+
* defensive parsing (e.g. context-slot schema narrowing, expiresAt date
|
|
134
|
+
* parse) lives downstream in the iframe-runtime's `validateMeta`.
|
|
135
|
+
*
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
export function parseMcpAppAiGguiRenderMeta(meta) {
|
|
139
|
+
if (meta === null || typeof meta !== 'object') {
|
|
140
|
+
return { ok: true };
|
|
141
|
+
}
|
|
142
|
+
const m = meta;
|
|
143
|
+
const raw = m[MCP_APP_AI_GGUI_RENDER_META_KEY];
|
|
144
|
+
if (raw === undefined) {
|
|
145
|
+
return { ok: true };
|
|
146
|
+
}
|
|
147
|
+
if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
148
|
+
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
149
|
+
}
|
|
150
|
+
const s = raw;
|
|
151
|
+
// Identity — required when slice is present.
|
|
152
|
+
if (typeof s.renderId !== 'string' ||
|
|
153
|
+
s.renderId.length === 0 ||
|
|
154
|
+
typeof s.appId !== 'string' ||
|
|
155
|
+
s.appId.length === 0 ||
|
|
156
|
+
typeof s.runtimeUrl !== 'string' ||
|
|
157
|
+
s.runtimeUrl.length === 0) {
|
|
158
|
+
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
159
|
+
}
|
|
160
|
+
// Auth pairing — both wsUrl + wsToken present or both absent.
|
|
161
|
+
const aw = s.wsUrl;
|
|
162
|
+
const at = s.wsToken;
|
|
163
|
+
const ae = s.expiresAt;
|
|
164
|
+
const hasW = typeof aw === 'string' && aw.length > 0;
|
|
165
|
+
const hasT = typeof at === 'string' && at.length > 0;
|
|
166
|
+
if (hasW !== hasT)
|
|
167
|
+
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
168
|
+
if (ae !== undefined && typeof ae !== 'string') {
|
|
169
|
+
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
170
|
+
}
|
|
171
|
+
// `lastSequence` MUST be a non-negative finite integer when present
|
|
172
|
+
// — it's a monotonic ledger cursor. NaN / negative / float / string
|
|
173
|
+
// are protocol violations.
|
|
174
|
+
const ls = s.lastSequence;
|
|
175
|
+
if (ls !== undefined &&
|
|
176
|
+
(typeof ls !== 'number' || !Number.isInteger(ls) || ls < 0)) {
|
|
177
|
+
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
178
|
+
}
|
|
179
|
+
// Component-mode discriminator: codeUrl + kind mutually exclusive.
|
|
180
|
+
const cu = s.codeUrl;
|
|
181
|
+
const ck = s.kind;
|
|
182
|
+
const ch = s.codeHash;
|
|
183
|
+
if (cu !== undefined && (typeof cu !== 'string' || cu.length === 0)) {
|
|
184
|
+
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
185
|
+
}
|
|
186
|
+
if (ck !== undefined && (typeof ck !== 'string' || ck.length === 0)) {
|
|
187
|
+
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
188
|
+
}
|
|
189
|
+
if (ch !== undefined && (typeof ch !== 'string' || ch.length === 0)) {
|
|
190
|
+
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
191
|
+
}
|
|
192
|
+
if (typeof cu === 'string' && cu.length > 0 && typeof ck === 'string' && ck.length > 0) {
|
|
193
|
+
return { ok: false, reason: 'MALFORMED_RENDER' };
|
|
194
|
+
}
|
|
195
|
+
// Contract pair — both present or both absent (or both effectively
|
|
196
|
+
// absent via empty/wrong type → drop both, degrade to no validators).
|
|
197
|
+
const cHash = s.contractHash;
|
|
198
|
+
const vUrl = s.validatorsUrl;
|
|
199
|
+
const validContractPair = typeof cHash === 'string' &&
|
|
200
|
+
cHash.length > 0 &&
|
|
201
|
+
typeof vUrl === 'string' &&
|
|
202
|
+
vUrl.length > 0;
|
|
203
|
+
const slice = {
|
|
204
|
+
renderId: s.renderId,
|
|
205
|
+
appId: s.appId,
|
|
206
|
+
runtimeUrl: s.runtimeUrl,
|
|
207
|
+
...(hasW && hasT ? { wsUrl: aw, wsToken: at } : {}),
|
|
208
|
+
...(ae !== undefined ? { expiresAt: ae } : {}),
|
|
209
|
+
...(s.pollingUrl !== undefined ? { pollingUrl: s.pollingUrl } : {}),
|
|
210
|
+
...(s.themeId !== undefined ? { themeId: s.themeId } : {}),
|
|
211
|
+
...(s.themeMode !== undefined
|
|
212
|
+
? { themeMode: s.themeMode }
|
|
213
|
+
: {}),
|
|
214
|
+
...(s.gadgets !== undefined
|
|
215
|
+
? { gadgets: s.gadgets }
|
|
216
|
+
: {}),
|
|
217
|
+
...(s.publicEnv !== undefined
|
|
218
|
+
? { publicEnv: s.publicEnv }
|
|
219
|
+
: {}),
|
|
220
|
+
...(s.streamWebSocketLocalTools !== undefined
|
|
221
|
+
? {
|
|
222
|
+
streamWebSocketLocalTools: s.streamWebSocketLocalTools,
|
|
223
|
+
}
|
|
224
|
+
: {}),
|
|
225
|
+
...(s.appCallableTools !== undefined
|
|
226
|
+
? { appCallableTools: s.appCallableTools }
|
|
227
|
+
: {}),
|
|
228
|
+
...(s.permissionsPolicy !== undefined
|
|
229
|
+
? { permissionsPolicy: s.permissionsPolicy }
|
|
230
|
+
: {}),
|
|
231
|
+
...(ls !== undefined ? { lastSequence: ls } : {}),
|
|
232
|
+
...(s.propsJson !== undefined ? { propsJson: s.propsJson } : {}),
|
|
233
|
+
...(s.actionNextSteps !== undefined
|
|
234
|
+
? {
|
|
235
|
+
actionNextSteps: s.actionNextSteps,
|
|
236
|
+
}
|
|
237
|
+
: {}),
|
|
238
|
+
...(s.contextSlots !== undefined
|
|
239
|
+
? {
|
|
240
|
+
contextSlots: s.contextSlots,
|
|
241
|
+
}
|
|
242
|
+
: {}),
|
|
243
|
+
...(validContractPair
|
|
244
|
+
? {
|
|
245
|
+
contractHash: cHash,
|
|
246
|
+
validatorsUrl: vUrl,
|
|
247
|
+
}
|
|
248
|
+
: {}),
|
|
249
|
+
...(typeof cu === 'string' && cu.length > 0 ? { codeUrl: cu } : {}),
|
|
250
|
+
...(typeof ch === 'string' && ch.length > 0 ? { codeHash: ch } : {}),
|
|
251
|
+
...(typeof ck === 'string' && ck.length > 0 ? { kind: ck } : {}),
|
|
252
|
+
};
|
|
253
|
+
return { ok: true, meta: slice };
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Emitter convenience — wrap a server-built {@link McpAppAiGguiRenderMeta}
|
|
257
|
+
* slice as the wire `_meta` envelope under the canonical key constant.
|
|
258
|
+
*
|
|
259
|
+
* @public
|
|
260
|
+
*/
|
|
261
|
+
export function toMcpAppEnvelope(render) {
|
|
262
|
+
return {
|
|
263
|
+
[MCP_APP_AI_GGUI_RENDER_META_KEY]: render,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
// =============================================================================
|
|
267
|
+
// Request-side `_meta` — host-supplied metadata on inbound `tools/call`.
|
|
268
|
+
//
|
|
269
|
+
// Set BY the MCP host (claude.ai, ChatGPT, sample-agent), READ BY the ggui
|
|
270
|
+
// server when the agent inside the host invokes a `ggui_*` tool. Distinct
|
|
271
|
+
// from the outbound render slice above (server → host on tool results) —
|
|
272
|
+
// different direction, different parser, different lifecycle.
|
|
273
|
+
// =============================================================================
|
|
274
|
+
/**
|
|
275
|
+
* `_meta` key carrying host-supplied conversation-grouping metadata on
|
|
276
|
+
* every inbound `tools/call` request. Captured ONCE on the first call
|
|
277
|
+
* that materializes a ggui render row and persisted as opt-in identity
|
|
278
|
+
* for later rehydration.
|
|
279
|
+
*
|
|
280
|
+
* Hosts that don't set this key produce one-shot renders — they work
|
|
281
|
+
* fine for a single chat turn but cannot be re-listed or restored after
|
|
282
|
+
* the host closes the conversation surface. Opt-in is the whole design:
|
|
283
|
+
* hosts that want resume thread their conversation id here; hosts that
|
|
284
|
+
* don't get the simple write-only path.
|
|
285
|
+
*
|
|
286
|
+
* @public
|
|
287
|
+
*/
|
|
288
|
+
export const MCP_APP_AI_GGUI_HOST_SESSION_META_KEY = 'ai.ggui/host-session';
|
|
289
|
+
/**
|
|
290
|
+
* Read the `ai.ggui/host-session` slice off a parsed inbound `_meta`
|
|
291
|
+
* object. Structural validation only — `hostName` + `hostSessionId`
|
|
292
|
+
* both required and non-empty. Both missing entirely returns
|
|
293
|
+
* `{ok: true, hostSession: undefined}` (the documented opt-out path).
|
|
294
|
+
*
|
|
295
|
+
* @public
|
|
296
|
+
*/
|
|
297
|
+
export function parseMcpAppAiGguiHostSessionMeta(meta) {
|
|
298
|
+
if (meta === null || typeof meta !== 'object') {
|
|
299
|
+
return { ok: true };
|
|
300
|
+
}
|
|
301
|
+
const m = meta;
|
|
302
|
+
const raw = m[MCP_APP_AI_GGUI_HOST_SESSION_META_KEY];
|
|
303
|
+
if (raw === undefined) {
|
|
304
|
+
return { ok: true };
|
|
305
|
+
}
|
|
306
|
+
if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
307
|
+
return { ok: false, reason: 'MALFORMED_HOST_SESSION' };
|
|
308
|
+
}
|
|
309
|
+
const r = raw;
|
|
310
|
+
if (typeof r.hostName !== 'string' ||
|
|
311
|
+
r.hostName.length === 0 ||
|
|
312
|
+
typeof r.hostSessionId !== 'string' ||
|
|
313
|
+
r.hostSessionId.length === 0) {
|
|
314
|
+
return { ok: false, reason: 'MALFORMED_HOST_SESSION' };
|
|
315
|
+
}
|
|
316
|
+
return {
|
|
317
|
+
ok: true,
|
|
318
|
+
hostSession: {
|
|
319
|
+
hostName: r.hostName,
|
|
320
|
+
hostSessionId: r.hostSessionId,
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Type guard: narrows a `Render` (or unknown) to {@link McpAppsRender}.
|
|
326
|
+
* Uses the discriminator.
|
|
81
327
|
*/
|
|
82
|
-
export function
|
|
328
|
+
export function isMcpAppsRender(entry) {
|
|
83
329
|
return (entry !== null &&
|
|
84
330
|
typeof entry === 'object' &&
|
|
85
331
|
entry.type === 'mcpApps');
|
|
86
332
|
}
|
|
87
333
|
/**
|
|
88
|
-
* Structural validator for an `
|
|
334
|
+
* Structural validator for an `McpAppsRender` — not a Zod schema
|
|
89
335
|
* so we don't force a Zod dependency here. Returns null on failure
|
|
90
336
|
* (caller maps to an appropriate error code). Required when accepting
|
|
91
337
|
* one over the wire from an agent: the discriminator alone isn't
|
|
92
338
|
* enough.
|
|
93
339
|
*/
|
|
94
|
-
export function
|
|
340
|
+
export function validateMcpAppsRender(input) {
|
|
95
341
|
if (input === null || typeof input !== 'object')
|
|
96
342
|
return null;
|
|
97
343
|
const item = input;
|
|
@@ -134,7 +380,7 @@ export const MCP_APP_LIFECYCLE_STATES = [
|
|
|
134
380
|
* - Outer envelope is an object with `type === 'ggui:lifecycle'`.
|
|
135
381
|
* - `event` is an object with `state` matching {@link
|
|
136
382
|
* MCP_APP_LIFECYCLE_STATES}.
|
|
137
|
-
* - If `
|
|
383
|
+
* - If `renderId` is present, it is a non-empty string.
|
|
138
384
|
* - If `error` is present, it is an object with string `code` +
|
|
139
385
|
* `message`.
|
|
140
386
|
*
|
|
@@ -154,8 +400,8 @@ export function isMcpAppLifecycleMessage(message) {
|
|
|
154
400
|
if (!MCP_APP_LIFECYCLE_STATES.includes(e.state)) {
|
|
155
401
|
return false;
|
|
156
402
|
}
|
|
157
|
-
if (e.
|
|
158
|
-
if (typeof e.
|
|
403
|
+
if (e.renderId !== undefined) {
|
|
404
|
+
if (typeof e.renderId !== 'string' || e.renderId.length === 0) {
|
|
159
405
|
return false;
|
|
160
406
|
}
|
|
161
407
|
}
|
|
@@ -169,128 +415,6 @@ export function isMcpAppLifecycleMessage(message) {
|
|
|
169
415
|
}
|
|
170
416
|
return true;
|
|
171
417
|
}
|
|
172
|
-
/**
|
|
173
|
-
* Type guard for recognizing a `ggui_push` result `_meta` that carries a
|
|
174
|
-
* bootstrap block. Handy for views / tests that receive the raw result.
|
|
175
|
-
*
|
|
176
|
-
* Validates the three-mode discriminator: a well-formed bootstrap MUST
|
|
177
|
-
* carry `runtimeUrl` + `sessionId` + `appId` AND at least one of
|
|
178
|
-
* `{wsUrl, codeUrl, kind}` as a non-empty string. Live mode
|
|
179
|
-
* additionally requires `token` to pair with `wsUrl` — half-live
|
|
180
|
-
* (one without the other) is rejected as MALFORMED.
|
|
181
|
-
*/
|
|
182
|
-
export function hasPushBootstrapMeta(meta) {
|
|
183
|
-
if (meta === null || typeof meta !== 'object')
|
|
184
|
-
return false;
|
|
185
|
-
const ggui = meta.ggui;
|
|
186
|
-
if (ggui === null || typeof ggui !== 'object')
|
|
187
|
-
return false;
|
|
188
|
-
const bootstrap = ggui.bootstrap;
|
|
189
|
-
if (bootstrap === null || typeof bootstrap !== 'object')
|
|
190
|
-
return false;
|
|
191
|
-
const b = bootstrap;
|
|
192
|
-
// Required-everywhere fields.
|
|
193
|
-
if (!(typeof b.sessionId === 'string' &&
|
|
194
|
-
b.sessionId.length > 0 &&
|
|
195
|
-
typeof b.appId === 'string' &&
|
|
196
|
-
b.appId.length > 0 &&
|
|
197
|
-
typeof b.runtimeUrl === 'string' &&
|
|
198
|
-
b.runtimeUrl.length > 0)) {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
// Mode discriminator — at least one of {wsUrl, codeUrl, kind} MUST
|
|
202
|
-
// be a non-empty string. Live mode requires `token` paired with
|
|
203
|
-
// `wsUrl`; half-live is MALFORMED. `codeUrl` is the static-component
|
|
204
|
-
// delivery channel (content-addressable URL the runtime fetches the
|
|
205
|
-
// compiled ES module from). System-card mode (`kind`) is mutually
|
|
206
|
-
// exclusive with `codeUrl`.
|
|
207
|
-
const hasWsUrl = typeof b.wsUrl === 'string' && b.wsUrl.length > 0;
|
|
208
|
-
const hasToken = typeof b.token === 'string' && b.token.length > 0;
|
|
209
|
-
const hasCodeUrl = typeof b.codeUrl === 'string' && b.codeUrl.length > 0;
|
|
210
|
-
const hasKind = typeof b.kind === 'string' && b.kind.length > 0;
|
|
211
|
-
if (hasWsUrl !== hasToken)
|
|
212
|
-
return false;
|
|
213
|
-
if (!hasWsUrl && !hasCodeUrl && !hasKind)
|
|
214
|
-
return false;
|
|
215
|
-
if (hasKind && hasCodeUrl)
|
|
216
|
-
return false;
|
|
217
|
-
// expiresAt is now optional (live-mode-only). When present, must be
|
|
218
|
-
// a string; type-only check, semantic validation lives in the
|
|
219
|
-
// iframe-runtime parser which has clock access.
|
|
220
|
-
if (b.expiresAt !== undefined && typeof b.expiresAt !== 'string') {
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
// themeMode (when present) must be one of the closed set.
|
|
224
|
-
if (b.themeMode !== undefined &&
|
|
225
|
-
b.themeMode !== 'light' &&
|
|
226
|
-
b.themeMode !== 'dark') {
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
// themeId / propsJson (when present) must be strings.
|
|
230
|
-
if (b.themeId !== undefined && typeof b.themeId !== 'string')
|
|
231
|
-
return false;
|
|
232
|
-
if (b.propsJson !== undefined && typeof b.propsJson !== 'string')
|
|
233
|
-
return false;
|
|
234
|
-
if (b.appCallableTools !== undefined) {
|
|
235
|
-
if (!Array.isArray(b.appCallableTools))
|
|
236
|
-
return false;
|
|
237
|
-
if (!b.appCallableTools.every((s) => typeof s === 'string'))
|
|
238
|
-
return false;
|
|
239
|
-
}
|
|
240
|
-
if (b.actionNextSteps !== undefined) {
|
|
241
|
-
if (b.actionNextSteps === null ||
|
|
242
|
-
typeof b.actionNextSteps !== 'object' ||
|
|
243
|
-
Array.isArray(b.actionNextSteps)) {
|
|
244
|
-
return false;
|
|
245
|
-
}
|
|
246
|
-
for (const value of Object.values(b.actionNextSteps)) {
|
|
247
|
-
if (typeof value !== 'string')
|
|
248
|
-
return false;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
// `contextSlots` is OPTIONAL on the wire. Each entry MUST carry
|
|
252
|
-
// non-empty `name`, non-empty `contextName`, a `schema` object, AND
|
|
253
|
-
// a `default` value (JsonValue, can be null — the runtime owns
|
|
254
|
-
// useState per slot and the Provider seed is load-bearing).
|
|
255
|
-
// Optional `debounceMs` MUST be a number when present.
|
|
256
|
-
if (b.contextSlots !== undefined) {
|
|
257
|
-
if (!Array.isArray(b.contextSlots))
|
|
258
|
-
return false;
|
|
259
|
-
for (const entry of b.contextSlots) {
|
|
260
|
-
if (entry === null || typeof entry !== 'object')
|
|
261
|
-
return false;
|
|
262
|
-
const e = entry;
|
|
263
|
-
if (typeof e.name !== 'string' || e.name.length === 0)
|
|
264
|
-
return false;
|
|
265
|
-
if (typeof e.contextName !== 'string' || e.contextName.length === 0) {
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
268
|
-
if (e.schema === null || typeof e.schema !== 'object' || Array.isArray(e.schema)) {
|
|
269
|
-
return false;
|
|
270
|
-
}
|
|
271
|
-
// `default` MUST be present (key exists). The value MAY be null
|
|
272
|
-
// — that's a legitimate JsonValue. Discriminate via `in` so a
|
|
273
|
-
// literal `null` passes while truly-missing fails.
|
|
274
|
-
if (!('default' in e))
|
|
275
|
-
return false;
|
|
276
|
-
if (e.debounceMs !== undefined && typeof e.debounceMs !== 'number') {
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
// `permissionsPolicy` is OPTIONAL on the wire. When present, MUST be
|
|
282
|
-
// an array of non-empty strings (the browser Permissions API names
|
|
283
|
-
// declared on `DataContract.clientCapabilities.gadgets[*].permission`).
|
|
284
|
-
if (b.permissionsPolicy !== undefined) {
|
|
285
|
-
if (!Array.isArray(b.permissionsPolicy))
|
|
286
|
-
return false;
|
|
287
|
-
for (const value of b.permissionsPolicy) {
|
|
288
|
-
if (typeof value !== 'string' || value.length === 0)
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
return true;
|
|
293
|
-
}
|
|
294
418
|
/**
|
|
295
419
|
* The three canonical gesture kinds — useful for exhaustiveness checks
|
|
296
420
|
* in `switch (kind) { ... }` blocks. Frozen so consumers can safely use
|
|
@@ -319,7 +443,7 @@ export function isGguiSubmitActionInput(value) {
|
|
|
319
443
|
const v = value;
|
|
320
444
|
if (typeof v.kind !== 'string' || v.kind.length === 0)
|
|
321
445
|
return false;
|
|
322
|
-
if (typeof v.
|
|
446
|
+
if (typeof v.renderId !== 'string' || v.renderId.length === 0)
|
|
323
447
|
return false;
|
|
324
448
|
if (typeof v.appId !== 'string' || v.appId.length === 0)
|
|
325
449
|
return false;
|
|
@@ -327,10 +451,6 @@ export function isGguiSubmitActionInput(value) {
|
|
|
327
451
|
return false;
|
|
328
452
|
if (typeof v.firedAt !== 'string' || v.firedAt.length === 0)
|
|
329
453
|
return false;
|
|
330
|
-
if (v.stackItemId !== undefined &&
|
|
331
|
-
(typeof v.stackItemId !== 'string' || v.stackItemId.length === 0)) {
|
|
332
|
-
return false;
|
|
333
|
-
}
|
|
334
454
|
if (v.payload === null || typeof v.payload !== 'object')
|
|
335
455
|
return false;
|
|
336
456
|
// Per-kind payload narrowing for the closed primary set. Unknown
|
|
@@ -363,65 +483,3 @@ export function isGguiSubmitActionInput(value) {
|
|
|
363
483
|
return true;
|
|
364
484
|
}
|
|
365
485
|
}
|
|
366
|
-
/**
|
|
367
|
-
* Type guard for {@link GguiUserActionMeta}. Validates the
|
|
368
|
-
* discriminated shape on a `ui/message` envelope's
|
|
369
|
-
* `params._meta.ggui.userAction` field.
|
|
370
|
-
*
|
|
371
|
-
* Designed for `_meta.ggui.userAction`-aware consumers (sample agent
|
|
372
|
-
* dispatcher, e2e assertions, future SDKs) to route deterministically
|
|
373
|
-
* without speculative shape coercion.
|
|
374
|
-
*
|
|
375
|
-
* @public
|
|
376
|
-
*/
|
|
377
|
-
export function isGguiUserActionMeta(meta) {
|
|
378
|
-
if (meta === null || typeof meta !== 'object')
|
|
379
|
-
return false;
|
|
380
|
-
const m = meta;
|
|
381
|
-
if (typeof m.description !== 'string' || m.description.length === 0) {
|
|
382
|
-
return false;
|
|
383
|
-
}
|
|
384
|
-
if (typeof m.stackItemId !== 'string' || m.stackItemId.length === 0) {
|
|
385
|
-
return false;
|
|
386
|
-
}
|
|
387
|
-
if (typeof m.actionId !== 'string' || m.actionId.length === 0) {
|
|
388
|
-
return false;
|
|
389
|
-
}
|
|
390
|
-
if (typeof m.submittedAt !== 'string' || m.submittedAt.length === 0) {
|
|
391
|
-
return false;
|
|
392
|
-
}
|
|
393
|
-
if (typeof m.intent !== 'string' || m.intent.length === 0)
|
|
394
|
-
return false;
|
|
395
|
-
if (m.kind === 'queued') {
|
|
396
|
-
if (m.nextStep === null || typeof m.nextStep !== 'object')
|
|
397
|
-
return false;
|
|
398
|
-
const ns = m.nextStep;
|
|
399
|
-
if (ns.tool !== 'ggui_consume')
|
|
400
|
-
return false;
|
|
401
|
-
if (ns.args === null || typeof ns.args !== 'object')
|
|
402
|
-
return false;
|
|
403
|
-
const args = ns.args;
|
|
404
|
-
if (typeof args.stackItemId !== 'string' ||
|
|
405
|
-
args.stackItemId.length === 0) {
|
|
406
|
-
return false;
|
|
407
|
-
}
|
|
408
|
-
return true;
|
|
409
|
-
}
|
|
410
|
-
if (m.kind === 'inline') {
|
|
411
|
-
if (m.payload === null || typeof m.payload !== 'object')
|
|
412
|
-
return false;
|
|
413
|
-
const p = m.payload;
|
|
414
|
-
if (p.actionData === undefined)
|
|
415
|
-
return false; // explicit null OK
|
|
416
|
-
if (p.uiContext === null || typeof p.uiContext !== 'object')
|
|
417
|
-
return false;
|
|
418
|
-
if (Array.isArray(p.uiContext))
|
|
419
|
-
return false;
|
|
420
|
-
if (m.nextStep !== undefined &&
|
|
421
|
-
(typeof m.nextStep !== 'string' || m.nextStep.length === 0)) {
|
|
422
|
-
return false;
|
|
423
|
-
}
|
|
424
|
-
return true;
|
|
425
|
-
}
|
|
426
|
-
return false;
|
|
427
|
-
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - The server's `InitializeResult.instructions` field (set via
|
|
8
8
|
* `@ggui-ai/mcp-server`'s `MCP_INSTRUCTIONS_PRESETS`).
|
|
9
9
|
*
|
|
10
|
-
* Those two carry the wire flow (
|
|
10
|
+
* Those two carry the wire flow (handshake → render →
|
|
11
11
|
* consume → react), the contract-authoring rules, recovery shapes,
|
|
12
12
|
* and the mutation rule. **Agent builders should NOT replicate any
|
|
13
13
|
* of that in their system prompt.** The protocol is designed to be
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - The server's `InitializeResult.instructions` field (set via
|
|
8
8
|
* `@ggui-ai/mcp-server`'s `MCP_INSTRUCTIONS_PRESETS`).
|
|
9
9
|
*
|
|
10
|
-
* Those two carry the wire flow (
|
|
10
|
+
* Those two carry the wire flow (handshake → render →
|
|
11
11
|
* consume → react), the contract-authoring rules, recovery shapes,
|
|
12
12
|
* and the mutation rule. **Agent builders should NOT replicate any
|
|
13
13
|
* of that in their system prompt.** The protocol is designed to be
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* ## Why this file exists
|
|
6
6
|
*
|
|
7
7
|
* Output-side seams that type-narrow contract on the wire —
|
|
8
|
-
* `
|
|
8
|
+
* `renderOutputSchema.contract` and the various `decision` echoes — use
|
|
9
9
|
* `z.custom<DataContract>()` because they trust the shape (it
|
|
10
10
|
* originates from internal pod state).
|
|
11
11
|
*
|
|
@@ -714,7 +714,8 @@ export declare const clientCapabilitiesSpecSchema: z.ZodObject<{
|
|
|
714
714
|
* Consumed by:
|
|
715
715
|
* - OSS `ggui.json#app.publicEnv` boot-time parse.
|
|
716
716
|
* - Cloud AppRecord persistence layer.
|
|
717
|
-
* - Defensive re-validation in
|
|
717
|
+
* - Defensive re-validation in the iframe-runtime slice-meta
|
|
718
|
+
* extractors (`parseMetaFromGlobal`, `parseMetaFromToolResult`).
|
|
718
719
|
*/
|
|
719
720
|
export declare const appPublicEnvSchema: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
720
721
|
/**
|
|
@@ -743,7 +744,7 @@ export declare const appPublicEnvSchema: z.ZodReadonly<z.ZodRecord<z.ZodString,
|
|
|
743
744
|
* `passthrough()` lets unknown fields ride through without rejection
|
|
744
745
|
* — forward-compatible with future protocol additions, and matches
|
|
745
746
|
* the protocol's general "input-shape lax / validator-shape strict"
|
|
746
|
-
* posture (`handshakeInputSchema`, `
|
|
747
|
+
* posture (`handshakeInputSchema`, `renderInputSchema`, etc. all
|
|
747
748
|
* `passthrough` for the same reason).
|
|
748
749
|
*/
|
|
749
750
|
export declare const dataContractSchema: z.ZodType<DataContract>;
|