@ggui-ai/mcp-server 0.25.0 → 0.26.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/README.md +2 -2
- package/dist/api-renders-routes.d.ts +46 -5
- package/dist/api-renders-routes.d.ts.map +1 -1
- package/dist/api-renders-routes.js +98 -39
- package/dist/api-renders-stream-route.d.ts +2 -1
- package/dist/api-renders-stream-route.d.ts.map +1 -1
- package/dist/api-renders-stream-route.js +14 -2
- package/dist/build-mcp.d.ts +16 -0
- package/dist/build-mcp.d.ts.map +1 -1
- package/dist/build-mcp.js +48 -20
- package/dist/console-auth.d.ts +10 -10
- package/dist/console-auth.d.ts.map +1 -1
- package/dist/first-seen.d.ts +14 -0
- package/dist/first-seen.d.ts.map +1 -0
- package/dist/first-seen.js +19 -0
- package/dist/ggui-session-channel/action-ingress.d.ts.map +1 -1
- package/dist/ggui-session-channel/action-ingress.js +96 -8
- package/dist/ggui-session-channel/channel-subscriptions.d.ts +0 -1
- package/dist/ggui-session-channel/channel-subscriptions.d.ts.map +1 -1
- package/dist/ggui-session-channel/channel-subscriptions.js +4 -1
- package/dist/ggui-session-channel/internal-types.d.ts +20 -12
- package/dist/ggui-session-channel/internal-types.d.ts.map +1 -1
- package/dist/ggui-session-channel/outbound.d.ts.map +1 -1
- package/dist/ggui-session-channel/outbound.js +18 -6
- package/dist/ggui-session-channel/stream-epoch.d.ts +61 -0
- package/dist/ggui-session-channel/stream-epoch.d.ts.map +1 -0
- package/dist/ggui-session-channel/stream-epoch.js +47 -0
- package/dist/ggui-session-channel/subscribe.d.ts +29 -17
- package/dist/ggui-session-channel/subscribe.d.ts.map +1 -1
- package/dist/ggui-session-channel/subscribe.js +247 -124
- package/dist/ggui-session-channel/subscriber-lifecycle.d.ts.map +1 -1
- package/dist/ggui-session-channel/subscriber-lifecycle.js +17 -7
- package/dist/ggui-session-channel.d.ts +13 -5
- package/dist/ggui-session-channel.d.ts.map +1 -1
- package/dist/ggui-session-channel.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/instructions-presets.d.ts +22 -21
- package/dist/instructions-presets.d.ts.map +1 -1
- package/dist/instructions-presets.js +38 -38
- package/dist/llm-backed-negotiator.d.ts +1 -36
- package/dist/llm-backed-negotiator.d.ts.map +1 -1
- package/dist/llm-backed-negotiator.js +0 -196
- package/dist/mcp-apps-outbound.d.ts +39 -90
- package/dist/mcp-apps-outbound.d.ts.map +1 -1
- package/dist/mcp-apps-outbound.js +45 -3
- package/dist/mcp-endpoint-routes.d.ts.map +1 -1
- package/dist/mcp-endpoint-routes.js +4 -1
- package/dist/server.d.ts +108 -33
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +181 -48
- package/dist/storage.d.ts +9 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +4 -3
- package/dist/view-proof-gate.d.ts +96 -0
- package/dist/view-proof-gate.d.ts.map +1 -0
- package/dist/view-proof-gate.js +167 -0
- package/package.json +14 -15
|
@@ -25,11 +25,6 @@
|
|
|
25
25
|
* `ensureConformingContract`. Operational errors fail open; programmer
|
|
26
26
|
* errors re-throw. See `decide-handshake.ts` for the full contract.
|
|
27
27
|
*
|
|
28
|
-
* ## selectVariant
|
|
29
|
-
*
|
|
30
|
-
* The optional LLM-driven variant-selection seam is OSS-specific and
|
|
31
|
-
* stays on this binding (it is not part of the shared decide spine).
|
|
32
|
-
*
|
|
33
28
|
* ## Default binding
|
|
34
29
|
*
|
|
35
30
|
* Bound by default in `createGguiServer` when handshake is enabled AND a
|
|
@@ -237,7 +232,6 @@ export function assembleHandshakePools(deps) {
|
|
|
237
232
|
* decision spine (find-similar → coverage guard → judge → atomic
|
|
238
233
|
* reuse, else synth-repair create) is shared verbatim across every
|
|
239
234
|
* negotiator binding; only the injected adapter differs.
|
|
240
|
-
* `selectVariant` is specific to this binding.
|
|
241
235
|
*
|
|
242
236
|
* @public
|
|
243
237
|
*/
|
|
@@ -273,195 +267,5 @@ export function createLlmBackedHandshakeNegotiator(deps) {
|
|
|
273
267
|
};
|
|
274
268
|
return {
|
|
275
269
|
decide: (input) => decideHandshake(adapter, input),
|
|
276
|
-
// LLM-driven variant selection. Reads each candidate's
|
|
277
|
-
// `variance` + `validatorScore` + `isOperatorDefault` + the
|
|
278
|
-
// provenance (`source`), asks the LLM to pick the best fit for
|
|
279
|
-
// the current request's `intent` + `variance`, and returns a
|
|
280
|
-
// calibrated decision. The caller (`selectVariantWithLlm`)
|
|
281
|
-
// thresholds on `confidence`.
|
|
282
|
-
//
|
|
283
|
-
// Errors throw — the caller catches and falls through to the
|
|
284
|
-
// deterministic ladder. The decide() seam uses a more permissive
|
|
285
|
-
// fail-open pattern because there's no fallback higher up; the
|
|
286
|
-
// variant-selector caller owns the fallback path itself.
|
|
287
|
-
async selectVariant({ candidates, context, ctx }) {
|
|
288
|
-
if (candidates.length === 0) {
|
|
289
|
-
throw new Error("selectVariant: empty candidates list — orchestration should short-circuit before calling");
|
|
290
|
-
}
|
|
291
|
-
const creds = await deps.resolveLlm(ctx);
|
|
292
|
-
if (!creds) {
|
|
293
|
-
throw new Error("selectVariant: no BYOK credentials resolved; orchestration falls through to deterministic ladder");
|
|
294
|
-
}
|
|
295
|
-
const llm = buildLlmCaller(creds.selection, creds.providerKey);
|
|
296
|
-
return runVariantSelectionLlm(llm, candidates, context);
|
|
297
|
-
},
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* The system prompt for the variant-selection LLM call. Calibration
|
|
302
|
-
* is load-bearing — the model is explicitly told to surface low
|
|
303
|
-
* confidence when signals are weak so the deterministic-ladder
|
|
304
|
-
* fallback takes over. The prompt is intentionally short: high
|
|
305
|
-
* token budget on the user message (candidate JSON) is more useful
|
|
306
|
-
* than verbose system framing.
|
|
307
|
-
*/
|
|
308
|
-
export const VARIANT_SELECTION_SYSTEM_PROMPT = `You are the variant selector for the ggui UI matcher. You receive a shortlist of pre-built UI blueprint variants and a request context. Pick the variant that best fits the request.
|
|
309
|
-
|
|
310
|
-
Each variant carries:
|
|
311
|
-
- blueprintId: stable identity (you MUST echo back exactly one of these).
|
|
312
|
-
- source: provenance. {kind:"llm", generator, model} = engine-generated (advanced generators win on visual polish; default generators win on simplicity). {kind:"user"} = operator-registered hand-authored code. {kind:"curated"} = catalog-shipped system blueprint.
|
|
313
|
-
- validatorScore: optional 0-1 self-assessed quality from the advanced generator's validators. Higher is better, undefined ⇒ unknown.
|
|
314
|
-
- isOperatorDefault: true ⇒ the human operator pinned this as the default. Strong signal.
|
|
315
|
-
- variance.persona: free-form tag ("minimalist", "data-dense", "mobile-first"…).
|
|
316
|
-
- variance.aesthetic: optional free-form tag ("glassy", "flat", "editorial"…).
|
|
317
|
-
- variance.context: small structured signal (theme, accent, …).
|
|
318
|
-
- variance.seedPrompt: the operator's original prose that produced this variant.
|
|
319
|
-
|
|
320
|
-
The request context carries the same fields. Match on:
|
|
321
|
-
1. variance.persona equality / closeness (strongest non-pin signal).
|
|
322
|
-
2. variance.aesthetic equality / closeness.
|
|
323
|
-
3. variance.context overlap (shared keys + values).
|
|
324
|
-
4. seedPrompt semantic similarity to context.intent.
|
|
325
|
-
|
|
326
|
-
Honor operator pins (isOperatorDefault: true) unless variance.persona / variance.aesthetic on the request clearly contradicts the pinned variant — that's the only case where you should override the pin.
|
|
327
|
-
|
|
328
|
-
Calibrate confidence honestly. Return high (≥ 0.7) only when a clear best match exists. Return low (< 0.6) when signals are weak — the orchestration falls back to a deterministic ladder in that case. The fallback is safe; over-confident picks are NOT.`;
|
|
329
|
-
const VARIANT_SELECTION_TOOL_NAME = "select_variant";
|
|
330
|
-
const VARIANT_SELECTION_TOOL_DESCRIPTION = "Pick the variant that best fits the request context. Return the chosen blueprintId, a calibrated 0-1 confidence, and a one-sentence reason citing the matching axes (persona / aesthetic / context / seedPrompt / pin / validator).";
|
|
331
|
-
/**
|
|
332
|
-
* JSON Schema for the structured-output tool call. Forces the model
|
|
333
|
-
* to emit `{blueprintId, confidence, reason}` — no free-text prose.
|
|
334
|
-
* Used on Anthropic via `LLMCaller.callStructured`; the text-fallback
|
|
335
|
-
* path parses the same shape from regex-extracted JSON.
|
|
336
|
-
*/
|
|
337
|
-
const VARIANT_SELECTION_TOOL_SCHEMA = {
|
|
338
|
-
type: "object",
|
|
339
|
-
properties: {
|
|
340
|
-
blueprintId: {
|
|
341
|
-
type: "string",
|
|
342
|
-
description: "One of the candidate blueprintIds shown in the request. Echo exactly — must match a candidate.",
|
|
343
|
-
},
|
|
344
|
-
confidence: {
|
|
345
|
-
type: "number",
|
|
346
|
-
minimum: 0,
|
|
347
|
-
maximum: 1,
|
|
348
|
-
description: "Calibrated confidence in this pick on [0, 1]. Use < 0.6 when signals are weak; the orchestration falls back to a deterministic ladder.",
|
|
349
|
-
},
|
|
350
|
-
reason: {
|
|
351
|
-
type: "string",
|
|
352
|
-
description: "One-sentence rationale citing the matching axes (persona, aesthetic, context, seedPrompt, validator, pin).",
|
|
353
|
-
},
|
|
354
|
-
},
|
|
355
|
-
required: ["blueprintId", "confidence", "reason"],
|
|
356
|
-
};
|
|
357
|
-
/**
|
|
358
|
-
* Build the user-message payload for the variant-selection prompt.
|
|
359
|
-
* The candidate list is projected to a compact JSON shape that
|
|
360
|
-
* surfaces the decision-relevant fields only — full contract
|
|
361
|
-
* embedding is too much surface area for a sub-second pick.
|
|
362
|
-
*
|
|
363
|
-
* Exposed for testing — the prompt structure is load-bearing, so
|
|
364
|
-
* snapshot tests against this output anchor regressions.
|
|
365
|
-
*/
|
|
366
|
-
export function buildVariantSelectionUserMessage(candidates, context) {
|
|
367
|
-
const projectedCandidates = candidates.map((c) => ({
|
|
368
|
-
blueprintId: c.blueprintId,
|
|
369
|
-
source: c.source,
|
|
370
|
-
...(c.validatorScore !== undefined ? { validatorScore: c.validatorScore } : {}),
|
|
371
|
-
...(c.isOperatorDefault === true ? { isOperatorDefault: true } : {}),
|
|
372
|
-
variance: {
|
|
373
|
-
...(c.variance.persona !== undefined ? { persona: c.variance.persona } : {}),
|
|
374
|
-
...(c.variance.context !== undefined ? { context: c.variance.context } : {}),
|
|
375
|
-
...(c.variance.seedPrompt !== undefined ? { seedPrompt: c.variance.seedPrompt } : {}),
|
|
376
|
-
},
|
|
377
|
-
}));
|
|
378
|
-
const requestProjection = {
|
|
379
|
-
contractHash: context.contractHash,
|
|
380
|
-
...(context.intent !== undefined ? { intent: context.intent } : {}),
|
|
381
|
-
...(context.variance !== undefined
|
|
382
|
-
? {
|
|
383
|
-
variance: {
|
|
384
|
-
...(context.variance.persona !== undefined
|
|
385
|
-
? { persona: context.variance.persona }
|
|
386
|
-
: {}),
|
|
387
|
-
...(context.variance.aesthetic !== undefined
|
|
388
|
-
? { aesthetic: context.variance.aesthetic }
|
|
389
|
-
: {}),
|
|
390
|
-
...(context.variance.context !== undefined
|
|
391
|
-
? { context: context.variance.context }
|
|
392
|
-
: {}),
|
|
393
|
-
...(context.variance.seedPrompt !== undefined
|
|
394
|
-
? { seedPrompt: context.variance.seedPrompt }
|
|
395
|
-
: {}),
|
|
396
|
-
},
|
|
397
|
-
}
|
|
398
|
-
: {}),
|
|
399
270
|
};
|
|
400
|
-
return [
|
|
401
|
-
"CANDIDATES:",
|
|
402
|
-
JSON.stringify(projectedCandidates, null, 2),
|
|
403
|
-
"",
|
|
404
|
-
"REQUEST:",
|
|
405
|
-
JSON.stringify(requestProjection, null, 2),
|
|
406
|
-
"",
|
|
407
|
-
"Pick the variant that best fits the REQUEST. Echo the blueprintId exactly, surface calibrated confidence, give a one-sentence rationale.",
|
|
408
|
-
].join("\n");
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Run the LLM call + decode. Anthropic path uses `callStructured`
|
|
412
|
-
* (forced tool use ⇒ guaranteed JSON); other providers fall back to
|
|
413
|
-
* text + regex-extracted JSON. The caller (`selectVariantWithLlm`)
|
|
414
|
-
* catches any throw from this function and routes through the
|
|
415
|
-
* deterministic ladder; this function surfaces detail in the thrown
|
|
416
|
-
* error so telemetry can attribute the fallback cause.
|
|
417
|
-
*/
|
|
418
|
-
async function runVariantSelectionLlm(llm, candidates, context) {
|
|
419
|
-
const userMessage = buildVariantSelectionUserMessage(candidates, context);
|
|
420
|
-
if (llm.callStructured) {
|
|
421
|
-
const decoded = await llm.callStructured(VARIANT_SELECTION_SYSTEM_PROMPT, userMessage, {
|
|
422
|
-
name: VARIANT_SELECTION_TOOL_NAME,
|
|
423
|
-
description: VARIANT_SELECTION_TOOL_DESCRIPTION,
|
|
424
|
-
input_schema: VARIANT_SELECTION_TOOL_SCHEMA,
|
|
425
|
-
}, 512);
|
|
426
|
-
return parseVariantSelectionResponse(decoded);
|
|
427
|
-
}
|
|
428
|
-
// Text-fallback — parse JSON via regex. Lower reliability;
|
|
429
|
-
// operators on non-Anthropic providers get this path until
|
|
430
|
-
// `callStructured` extends to their adapter.
|
|
431
|
-
const text = await llm.call(VARIANT_SELECTION_SYSTEM_PROMPT, `${userMessage}\n\nRespond as ONE LINE of JSON: {"blueprintId":"…","confidence":0.0-1.0,"reason":"…"}`, 512);
|
|
432
|
-
const match = text.match(/\{[\s\S]*?"blueprintId"[\s\S]*?\}/);
|
|
433
|
-
if (!match) {
|
|
434
|
-
throw new Error(`variant-selection: no JSON object found in text response (length ${text.length})`);
|
|
435
|
-
}
|
|
436
|
-
return parseVariantSelectionResponse(JSON.parse(match[0]));
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Parse + validate the LLM-tool-use response shape. Exposed for
|
|
440
|
-
* testing; in production it is only called via `runVariantSelectionLlm`.
|
|
441
|
-
*
|
|
442
|
-
* @throws Error on any shape violation. The caller catches and falls
|
|
443
|
-
* through to the deterministic ladder; the message is surfaced in
|
|
444
|
-
* `VariantSelectionResult.reason` for telemetry.
|
|
445
|
-
*/
|
|
446
|
-
export function parseVariantSelectionResponse(raw) {
|
|
447
|
-
if (!isRecord(raw)) {
|
|
448
|
-
throw new Error("variant-selection: response is not an object");
|
|
449
|
-
}
|
|
450
|
-
const obj = raw;
|
|
451
|
-
const blueprintId = obj["blueprintId"];
|
|
452
|
-
const confidence = obj["confidence"];
|
|
453
|
-
const reason = obj["reason"];
|
|
454
|
-
if (typeof blueprintId !== "string" || blueprintId.length === 0) {
|
|
455
|
-
throw new Error("variant-selection: blueprintId missing or non-string");
|
|
456
|
-
}
|
|
457
|
-
if (typeof confidence !== "number" ||
|
|
458
|
-
!Number.isFinite(confidence) ||
|
|
459
|
-
confidence < 0 ||
|
|
460
|
-
confidence > 1) {
|
|
461
|
-
throw new Error(`variant-selection: confidence missing or out of range: ${JSON.stringify(confidence)}`);
|
|
462
|
-
}
|
|
463
|
-
if (typeof reason !== "string") {
|
|
464
|
-
throw new Error("variant-selection: reason missing or non-string");
|
|
465
|
-
}
|
|
466
|
-
return { blueprintId, confidence, reason };
|
|
467
271
|
}
|
|
@@ -364,6 +364,12 @@ export interface SelfContainedShellInputs {
|
|
|
364
364
|
* route uses, so both transports share replay-cache state.
|
|
365
365
|
*/
|
|
366
366
|
readonly token?: string;
|
|
367
|
+
/**
|
|
368
|
+
* The view key rooted in {@link token} (ggui#1415), inlined as the
|
|
369
|
+
* slice's `viewKey` beside `wsToken`. Only a key-issuing mount sets it;
|
|
370
|
+
* it is dropped without a token.
|
|
371
|
+
*/
|
|
372
|
+
readonly viewKey?: string;
|
|
367
373
|
/**
|
|
368
374
|
* ISO-8601 expiry of {@link token}. Past-due envelopes degrade to
|
|
369
375
|
* static-only mode at parse time; the static UI still mounts, but
|
|
@@ -666,6 +672,39 @@ export interface GguiRenderResourceTemplateOptions {
|
|
|
666
672
|
readonly token: string;
|
|
667
673
|
readonly expiresAt: string;
|
|
668
674
|
};
|
|
675
|
+
/**
|
|
676
|
+
* The key-issuing minter (ggui#1415): the same live credential as
|
|
677
|
+
* {@link mintWsToken}, minted as a view root, with the view key rooted in
|
|
678
|
+
* it (`undefined` when the root is too long to key). The read door mints
|
|
679
|
+
* through it only when it issues the key (see {@link issueViewKeys});
|
|
680
|
+
* every other read mints through {@link mintWsToken}, so a token that
|
|
681
|
+
* carries `kid` and `src` always had a key issued with it. Ignored
|
|
682
|
+
* without {@link mintWsToken}.
|
|
683
|
+
*/
|
|
684
|
+
readonly mintViewRoot?: (sessionId: string, appId: string) => {
|
|
685
|
+
readonly wsUrl: string;
|
|
686
|
+
readonly token: string;
|
|
687
|
+
readonly expiresAt: string;
|
|
688
|
+
readonly viewKey: string | undefined;
|
|
689
|
+
};
|
|
690
|
+
/**
|
|
691
|
+
* Whether this mount's read door may issue a view key (ggui#1415). Only
|
|
692
|
+
* the data plane, which delivers a view to an app-credentialed caller,
|
|
693
|
+
* sets it; `/control` and the isolated services never do. Even there no
|
|
694
|
+
* key is issued when the caller's `authSource` is `anonymous` or absent:
|
|
695
|
+
* such a caller resolves to the builder app and would pass the read gate
|
|
696
|
+
* on every builder-app row. A read that issues no key mints the live
|
|
697
|
+
* credential alone and says why (`view_key_not_issued`).
|
|
698
|
+
*
|
|
699
|
+
* An auth adapter that admits every caller as one identity (the
|
|
700
|
+
* development `InMemoryAuthAdapter({ devAllowAll: true })`, source `dev`)
|
|
701
|
+
* is not an anonymous mount: its callers are keyed, so the view runs its
|
|
702
|
+
* proof end to end in development. There every caller holds the same
|
|
703
|
+
* identity, so a `valid` verdict says the plumbing works and nothing
|
|
704
|
+
* about who signed; the gate's line carries `authSource`, which keeps
|
|
705
|
+
* those verdicts apart from a credentialed deployment's.
|
|
706
|
+
*/
|
|
707
|
+
readonly issueViewKeys?: boolean;
|
|
669
708
|
/**
|
|
670
709
|
* Per-request handler-context accessor — the SAME AsyncLocalStorage
|
|
671
710
|
* read the tool path uses. The per-session resource handler gates
|
|
@@ -682,96 +721,6 @@ export interface GguiRenderResourceTemplateOptions {
|
|
|
682
721
|
*/
|
|
683
722
|
readonly logger?: Logger;
|
|
684
723
|
}
|
|
685
|
-
/**
|
|
686
|
-
* Register a `ui://ggui/render/{sessionId}` resource template. Each
|
|
687
|
-
* `resources/read` request is resolved by looking up the render in the
|
|
688
|
-
* store and returning the self-contained shell with that
|
|
689
|
-
* componentCode inlined.
|
|
690
|
-
*
|
|
691
|
-
* Per-call `_meta.ui.resourceUri` (stamped by `ggui_render.resultMeta`)
|
|
692
|
-
* pins the URI to a specific sessionId; hosts fetch THAT URI rather
|
|
693
|
-
* than the static `ui://ggui/render` one. Both registrations co-exist:
|
|
694
|
-
* legacy postMessage shell at the static URI, self-contained shell at
|
|
695
|
-
* the templated URI.
|
|
696
|
-
*
|
|
697
|
-
* # The obligation
|
|
698
|
-
*
|
|
699
|
-
* A read returns EITHER a shell carrying mount material — a static
|
|
700
|
-
* component URL, a live channel, or a system card — OR exactly one
|
|
701
|
-
* typed JSON-RPC error. There is no third outcome, and in particular no
|
|
702
|
-
* successful result wrapping a shell that can never paint anything. A
|
|
703
|
-
* host can check this without trusting the server: if it got
|
|
704
|
-
* `contents`, it got something mountable.
|
|
705
|
-
*
|
|
706
|
-
* The obligation covers outcomes this server can DECIDE. A malfunction
|
|
707
|
-
* still reaches the caller as an internal error (`-32603`) carrying
|
|
708
|
-
* none of the four codes: a template wired with an empty `runtimeUrl`,
|
|
709
|
-
* or a delivery channel that faults **and leaves the read with no other
|
|
710
|
-
* channel to mount through**. A fault the read survives — the usual
|
|
711
|
-
* case on a deployment wiring both channels — is not an outcome at all;
|
|
712
|
-
* the render mounts through whatever is left. That split is deliberate:
|
|
713
|
-
* `-32603` says "something is broken here", which the four codes must
|
|
714
|
-
* never be diluted into claiming, and equally must not be raised over a
|
|
715
|
-
* blip the server routed around.
|
|
716
|
-
*
|
|
717
|
-
* Three resolutions are tried, in this order, and any of them can
|
|
718
|
-
* produce the mount:
|
|
719
|
-
*
|
|
720
|
-
* 1. The render row itself.
|
|
721
|
-
* 2. A re-mint from the durable identity record, when the row is gone
|
|
722
|
-
* and this server keeps one ({@link GguiRenderResourceTemplateOptions.renderIdentityStore}
|
|
723
|
-
* + {@link GguiRenderResourceTemplateOptions.durableBlueprints}).
|
|
724
|
-
* 3. The blueprint registry, keyed by the locator's own `blueprintKey`
|
|
725
|
-
* — the original component with its authoring-time defaults rather
|
|
726
|
-
* than the state the render last held.
|
|
727
|
-
*
|
|
728
|
-
* # Failure modes
|
|
729
|
-
*
|
|
730
|
-
* Which code a given read produces is fully predictable from two facts:
|
|
731
|
-
* whether this server binds a durable substrate (both
|
|
732
|
-
* {@link GguiRenderResourceTemplateOptions.renderIdentityStore} and
|
|
733
|
-
* {@link GguiRenderResourceTemplateOptions.durableBlueprints} — either
|
|
734
|
-
* one alone is as good as neither), and how far the read got.
|
|
735
|
-
*
|
|
736
|
-
* - `NOT_FOUND` (`-32002`) — nothing resolved the locator, **and** the
|
|
737
|
-
* response for a caller who may not read a locator that DOES
|
|
738
|
-
* resolve. Those two are byte-identical by construction: both route
|
|
739
|
-
* through the protocol's projection, which substitutes a constant
|
|
740
|
-
* message and drops `detail`. A distinguishable refusal would turn
|
|
741
|
-
* this read into an oracle for the existence of other callers'
|
|
742
|
-
* renders, so the equality is a security property, not a courtesy.
|
|
743
|
-
* - `NOT_SUPPORTED` (`-32006`) — the same two cases, on a server with
|
|
744
|
-
* no durable substrate: an evicted locator can never be restored
|
|
745
|
-
* here, so saying "not found" would understate it. It takes
|
|
746
|
-
* `NOT_FOUND`'s place WHOLESALE on such a server rather than
|
|
747
|
-
* answering for some locators and not others — a server that said
|
|
748
|
-
* `NOT_FOUND` for a row it refused and `NOT_SUPPORTED` for one that
|
|
749
|
-
* never existed would have rebuilt the same oracle out of the two
|
|
750
|
-
* codes. Correspondingly, a server that DOES bind the substrate
|
|
751
|
-
* never emits it.
|
|
752
|
-
* - `BLUEPRINT_UNRESOLVABLE` (`-32006`) — a record named the render
|
|
753
|
-
* but its component is gone; `detail` names which link broke.
|
|
754
|
-
* Reachable only after the access check.
|
|
755
|
-
* - `NOT_MOUNTABLE` (`-32006`) — something resolved, but nothing
|
|
756
|
-
* mountable can be produced from it: no delivery channel is wired
|
|
757
|
-
* (neither {@link GguiRenderResourceTemplateOptions.codeStore} nor
|
|
758
|
-
* {@link GguiRenderResourceTemplateOptions.mintWsToken}), the row's
|
|
759
|
-
* generation has not committed a component yet, or a registry
|
|
760
|
-
* blueprint matched but cannot be delivered. Unlike the pair above,
|
|
761
|
-
* this one does NOT vary with the substrate: it is what the
|
|
762
|
-
* caller's OWN row gets on every server, because "this server
|
|
763
|
-
* cannot rehydrate" is not the useful truth for a row that is
|
|
764
|
-
* sitting right there. Reachable only after the access check, or —
|
|
765
|
-
* for the registry case — off the caller's own supplied key, so it
|
|
766
|
-
* discloses nothing either way.
|
|
767
|
-
*
|
|
768
|
-
* A URI matching neither template never reaches any of this: the
|
|
769
|
-
* transport rejects it as invalid params, outside these four codes.
|
|
770
|
-
*
|
|
771
|
-
* Returns nothing; mutates the server in place.
|
|
772
|
-
*
|
|
773
|
-
* @public
|
|
774
|
-
*/
|
|
775
724
|
export declare function registerGguiRenderResourceTemplate(server: McpServer, opts: GguiRenderResourceTemplateOptions): void;
|
|
776
725
|
/**
|
|
777
726
|
* Apply the full MCP Apps outbound wiring to a fresh `McpServer` - both
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-apps-outbound.d.ts","sourceRoot":"","sources":["../src/mcp-apps-outbound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAEhB,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAWL,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAmBjF,OAAO,EAgBL,KAAK,sBAAsB,EAE5B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAG3F,OAAO,KAAK,EAAE,cAAc,EAAE,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|
|
@@ -38,7 +38,7 @@ import { GGUI_RENDER_RESOURCE_MIME, GGUI_RENDER_RESOURCE_URI, GGUI_RENDER_SHELL_
|
|
|
38
38
|
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
39
39
|
import { registerAppResource } from "@modelcontextprotocol/ext-apps/server";
|
|
40
40
|
import { createHash } from "node:crypto";
|
|
41
|
-
import {
|
|
41
|
+
import { RENDER_READ_APP_TRUST_OVER_SUBJECT, renderReadVerdict } from "@ggui-ai/mcp-server-handlers/renders";
|
|
42
42
|
import { DEFAULT_BUILDER_APP_ID } from "./auth.js";
|
|
43
43
|
import { RUNTIME_BUNDLE_PLAIN_NAME } from "./runtime-bundle-hash.js";
|
|
44
44
|
/**
|
|
@@ -987,6 +987,7 @@ export function buildSelfContainedShell(opts) {
|
|
|
987
987
|
// input is renamed to `wsToken` on the slice for wire-field parity.
|
|
988
988
|
...(opts.wsUrl !== undefined ? { wsUrl: opts.wsUrl } : {}),
|
|
989
989
|
...(opts.token !== undefined ? { wsToken: opts.token } : {}),
|
|
990
|
+
...(opts.token !== undefined && opts.viewKey !== undefined ? { viewKey: opts.viewKey } : {}),
|
|
990
991
|
...(opts.expiresAt !== undefined ? { expiresAt: opts.expiresAt } : {}),
|
|
991
992
|
// Polling fallback URL — lights up `@ggui-ai/live-channel`'s
|
|
992
993
|
// events-polling transport when WS is unavailable. Absent ⇒
|
|
@@ -1278,6 +1279,19 @@ function pickComponentFromGguiSession(render) {
|
|
|
1278
1279
|
*
|
|
1279
1280
|
* @public
|
|
1280
1281
|
*/
|
|
1282
|
+
/**
|
|
1283
|
+
* Why the read door issues no view key on this read (ggui#1415), or
|
|
1284
|
+
* `undefined` when it issues one: the mount does not opt in, or the caller
|
|
1285
|
+
* is anonymous (or carries no auth source).
|
|
1286
|
+
*/
|
|
1287
|
+
function viewKeyWithheldAtReadDoor(opts) {
|
|
1288
|
+
if (opts.issueViewKeys !== true)
|
|
1289
|
+
return "not_a_view_mount";
|
|
1290
|
+
const authSource = opts.getContext?.()?.authSource;
|
|
1291
|
+
if (authSource === undefined || authSource === "anonymous")
|
|
1292
|
+
return "anonymous_mount";
|
|
1293
|
+
return undefined;
|
|
1294
|
+
}
|
|
1281
1295
|
export function registerGguiRenderResourceTemplate(server, opts) {
|
|
1282
1296
|
// TWO templates registered against the same handler core:
|
|
1283
1297
|
//
|
|
@@ -1516,8 +1530,19 @@ export function registerGguiRenderResourceTemplate(server, opts) {
|
|
|
1516
1530
|
requestId: "resource-read",
|
|
1517
1531
|
}
|
|
1518
1532
|
: callerCtx;
|
|
1519
|
-
|
|
1533
|
+
const verdict = renderReadVerdict(candidate, fallbackCtx);
|
|
1534
|
+
if (verdict.allowed) {
|
|
1535
|
+
// ggui#1553: rung 4 admitted an app credential to a subject-bound
|
|
1536
|
+
// session. Door, app, source; never the session or the subject.
|
|
1537
|
+
if (verdict.appTrustOverSubject) {
|
|
1538
|
+
opts.logger?.info(RENDER_READ_APP_TRUST_OVER_SUBJECT, {
|
|
1539
|
+
door: "resources_read",
|
|
1540
|
+
appId: candidate.appId,
|
|
1541
|
+
source: fallbackCtx?.authSource ?? null,
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1520
1544
|
return true;
|
|
1545
|
+
}
|
|
1521
1546
|
opts.logger?.warn("render_resource_read_denied", {
|
|
1522
1547
|
sessionId,
|
|
1523
1548
|
rowAppId: candidate.appId,
|
|
@@ -1854,9 +1879,25 @@ export function registerGguiRenderResourceTemplate(server, opts) {
|
|
|
1854
1879
|
let wsUrl;
|
|
1855
1880
|
let wsToken;
|
|
1856
1881
|
let wsExpiresAt;
|
|
1882
|
+
let wsViewKey;
|
|
1857
1883
|
if (opts.mintWsToken) {
|
|
1858
1884
|
try {
|
|
1859
|
-
|
|
1885
|
+
// ggui#1415: a view root, and its key, only on a key-issuing mount
|
|
1886
|
+
// and for a caller that is not anonymous; any other read mints the
|
|
1887
|
+
// live credential alone.
|
|
1888
|
+
const withheld = viewKeyWithheldAtReadDoor(opts);
|
|
1889
|
+
let minted;
|
|
1890
|
+
if (opts.mintViewRoot !== undefined && withheld === undefined) {
|
|
1891
|
+
const root = opts.mintViewRoot(sessionId, accessibleStored.appId);
|
|
1892
|
+
wsViewKey = root.viewKey;
|
|
1893
|
+
minted = root;
|
|
1894
|
+
}
|
|
1895
|
+
else {
|
|
1896
|
+
minted = opts.mintWsToken(sessionId, accessibleStored.appId);
|
|
1897
|
+
if (opts.mintViewRoot !== undefined && withheld !== undefined) {
|
|
1898
|
+
opts.logger?.info("view_key_not_issued", { sessionId, src: "read", reason: withheld });
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1860
1901
|
wsUrl = minted.wsUrl;
|
|
1861
1902
|
wsToken = minted.token;
|
|
1862
1903
|
// Forward the token TTL so the iframe-runtime can degrade to
|
|
@@ -1936,6 +1977,7 @@ export function registerGguiRenderResourceTemplate(server, opts) {
|
|
|
1936
1977
|
wsUrl,
|
|
1937
1978
|
token: wsToken,
|
|
1938
1979
|
...(wsExpiresAt !== undefined ? { expiresAt: wsExpiresAt } : {}),
|
|
1980
|
+
...(wsViewKey !== undefined ? { viewKey: wsViewKey } : {}),
|
|
1939
1981
|
}
|
|
1940
1982
|
: {}),
|
|
1941
1983
|
// Layered theme — the SAME resolver the tool-result slice uses
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-endpoint-routes.d.ts","sourceRoot":"","sources":["../src/mcp-endpoint-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElF,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,SAAS,CAAC;AAC1D,OAAO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SAAS,CAAC;IACvE;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,EAAE,qBAAqB,CAAC;CACjD;AAyBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CA4f1D"}
|
|
@@ -370,6 +370,7 @@ export function mountMcpEndpoints(opts) {
|
|
|
370
370
|
reqLogger.debug?.("mcp_request", { appId: ctx.appId });
|
|
371
371
|
const mcp = buildMcpServer(info, routeHandlers, () => als.getStore() ?? ctx, reqLogger, {
|
|
372
372
|
...buildMcpOptions,
|
|
373
|
+
...(handlerOpts?.issueViewKeys === true ? { issueViewKeys: true } : {}),
|
|
373
374
|
});
|
|
374
375
|
const transport = new StreamableHTTPServerTransport({
|
|
375
376
|
sessionIdGenerator: undefined,
|
|
@@ -433,7 +434,9 @@ export function mountMcpEndpoints(opts) {
|
|
|
433
434
|
// intersects ['agent','runtime']. Handlers without an explicit tag
|
|
434
435
|
// default to ['agent'], so every untagged handler is agent-callable.
|
|
435
436
|
const agentRouteHandlers = filterHandlersByAudience(handlers, DATA_PLANE_AUDIENCES);
|
|
436
|
-
|
|
437
|
+
// The data plane delivers views to app-credentialed callers, so its read
|
|
438
|
+
// door is the one that issues view keys (ggui#1415).
|
|
439
|
+
const agentMcpHandler = makeMcpHandler(agentRouteHandlers, { issueViewKeys: true });
|
|
437
440
|
// Control plane — anonymous-capable (design-time tools answer
|
|
438
441
|
// bearer-less) with each ops tool re-imposing auth for itself.
|
|
439
442
|
const controlMcpHandler = makeMcpHandler(controlHandlers, {
|