@ggui-ai/mcp-server-handlers 0.7.0 → 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/blueprints/index.d.ts +2 -2
- package/dist/blueprints/index.d.ts.map +1 -1
- package/dist/blueprints/index.js +1 -1
- package/dist/blueprints/search-blueprints.d.ts +64 -12
- package/dist/blueprints/search-blueprints.d.ts.map +1 -1
- package/dist/blueprints/search-blueprints.js +166 -16
- package/dist/renders/code-delivery-events.d.ts +45 -29
- package/dist/renders/code-delivery-events.d.ts.map +1 -1
- package/dist/renders/code-delivery-events.js +42 -25
- package/dist/renders/index.d.ts +1 -1
- package/dist/renders/index.d.ts.map +1 -1
- package/dist/renders/index.js +1 -1
- package/dist/renders/render.d.ts.map +1 -1
- package/dist/renders/render.js +27 -3
- package/dist/renders/slice-meta-derivation.d.ts +89 -6
- package/dist/renders/slice-meta-derivation.d.ts.map +1 -1
- package/dist/renders/slice-meta-derivation.js +118 -7
- package/dist/renders/update.d.ts.map +1 -1
- package/dist/renders/update.js +8 -4
- package/package.json +7 -7
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
* on top when wrapping these into its tool-handler shape (a wider
|
|
24
24
|
* `SharedHandler<ToolContext>` re-export).
|
|
25
25
|
*/
|
|
26
|
-
export { createSearchBlueprintsHandler, MIN_SIMILARITY_SCORE, MANIFEST_EXACT_NAME_SCORE, MANIFEST_SUBSTRING_SCORE, } from './search-blueprints.js';
|
|
27
|
-
export type { SearchBlueprintsDeps } from './search-blueprints.js';
|
|
26
|
+
export { createSearchBlueprintsHandler, DEFAULT_REGISTRY_SEARCH_TIMEOUT_MS, MIN_SIMILARITY_SCORE, MANIFEST_EXACT_NAME_SCORE, MANIFEST_SUBSTRING_SCORE, } from './search-blueprints.js';
|
|
27
|
+
export type { SearchBlueprintsDeps, SearchBlueprintsRegistrySource, } from './search-blueprints.js';
|
|
28
28
|
export { createListFeaturedBlueprintsHandler } from './list-featured-blueprints.js';
|
|
29
29
|
export type { ListFeaturedBlueprintsDeps, ListFeaturedBlueprintsOutput, } from './list-featured-blueprints.js';
|
|
30
30
|
export { createRenderBlueprintHandler } from './render-blueprint.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blueprints/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blueprints/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,EAClC,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,oBAAoB,EACpB,8BAA8B,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mCAAmC,EAAE,MAAM,+BAA+B,CAAC;AACpF,YAAY,EACV,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,oCAAoC,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,oCAAoC,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,oCAAoC,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,uCAAuC,EAAE,MAAM,oCAAoC,CAAC;AAC7F,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/blueprints/index.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* on top when wrapping these into its tool-handler shape (a wider
|
|
24
24
|
* `SharedHandler<ToolContext>` re-export).
|
|
25
25
|
*/
|
|
26
|
-
export { createSearchBlueprintsHandler, MIN_SIMILARITY_SCORE, MANIFEST_EXACT_NAME_SCORE, MANIFEST_SUBSTRING_SCORE, } from './search-blueprints.js';
|
|
26
|
+
export { createSearchBlueprintsHandler, DEFAULT_REGISTRY_SEARCH_TIMEOUT_MS, MIN_SIMILARITY_SCORE, MANIFEST_EXACT_NAME_SCORE, MANIFEST_SUBSTRING_SCORE, } from './search-blueprints.js';
|
|
27
27
|
export { createListFeaturedBlueprintsHandler } from './list-featured-blueprints.js';
|
|
28
28
|
export { createRenderBlueprintHandler } from './render-blueprint.js';
|
|
29
29
|
export { createValidateBlueprintHandler } from './validate-blueprint.js';
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* ggui_search_blueprints — search across every discoverable blueprint
|
|
3
3
|
* on this server.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* by id:
|
|
5
|
+
* Up to three sources are consulted in parallel, then merged +
|
|
6
|
+
* de-duplicated by id:
|
|
7
7
|
*
|
|
8
8
|
* 1. **Manifest source** (optional `BlueprintProvider`) — authored
|
|
9
9
|
* UIs declared in `ggui.json#blueprints.include`. Matched by
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
* producer that has written into the scope. Continues to honor
|
|
20
20
|
* `MIN_SIMILARITY_SCORE`.
|
|
21
21
|
*
|
|
22
|
+
* 3. **Registry source** (optional, opt-in via deps.registry) —
|
|
23
|
+
* bounded public /search call for published blueprint
|
|
24
|
+
* candidates; appended after local hits, degrades typed on
|
|
25
|
+
* failure.
|
|
26
|
+
*
|
|
22
27
|
* When both sources return the same id (a manifest blueprint that
|
|
23
28
|
* also has a cached generation), the manifest entry wins — its
|
|
24
29
|
* metadata is the source of truth and its name/description don't
|
|
@@ -26,8 +31,12 @@
|
|
|
26
31
|
* max of the two so a lexical OR semantic hit keeps the entry in
|
|
27
32
|
* the top band.
|
|
28
33
|
*
|
|
29
|
-
* The merge
|
|
30
|
-
* after sort
|
|
34
|
+
* The local merge (manifest + semantic) is trimmed to the top-N
|
|
35
|
+
* after sort, so it stays within `limit`. Registry candidates are
|
|
36
|
+
* bounded by the same `limit` on their own request and append AFTER
|
|
37
|
+
* that trim rather than sharing its budget, so the final `results`
|
|
38
|
+
* count can reach up to 2×`limit`. `total` reflects the pre-trim
|
|
39
|
+
* local match count plus the appended registry count.
|
|
31
40
|
*
|
|
32
41
|
* ## Why merge vs. a dedicated tool
|
|
33
42
|
*
|
|
@@ -38,8 +47,8 @@
|
|
|
38
47
|
* the split the server already knows how to make.
|
|
39
48
|
*
|
|
40
49
|
* Pure over `@ggui-ai/mcp-server-core`'s seams. No AWS imports. No
|
|
41
|
-
* config loading.
|
|
42
|
-
* when
|
|
50
|
+
* config loading. A composing host may wrap this with its own
|
|
51
|
+
* logging when assembling the server.
|
|
43
52
|
*/
|
|
44
53
|
import { z } from 'zod';
|
|
45
54
|
import type { BlueprintProvider, EmbeddingProvider, VectorStore } from '@ggui-ai/mcp-server-core';
|
|
@@ -65,6 +74,30 @@ export declare const MANIFEST_EXACT_NAME_SCORE = 1;
|
|
|
65
74
|
* stronger signal.
|
|
66
75
|
*/
|
|
67
76
|
export declare const MANIFEST_SUBSTRING_SCORE = 0.7;
|
|
77
|
+
/**
|
|
78
|
+
* Default budget for the registry `/search` round-trip. The registry
|
|
79
|
+
* source is advisory — a slow registry must never stall the local
|
|
80
|
+
* sources past this bound. Operator-overridable per-deps.
|
|
81
|
+
*/
|
|
82
|
+
export declare const DEFAULT_REGISTRY_SEARCH_TIMEOUT_MS = 3000;
|
|
83
|
+
/**
|
|
84
|
+
* Registry-backed discovery source configuration. Presence of this
|
|
85
|
+
* object on `SearchBlueprintsDeps` ACTIVATES the source (opt-in —
|
|
86
|
+
* a zero-config server never makes an outbound registry request).
|
|
87
|
+
*/
|
|
88
|
+
export interface SearchBlueprintsRegistrySource {
|
|
89
|
+
/**
|
|
90
|
+
* Registry host (`host[:port]`). Absent = `DEFAULT_BUNDLE_HOST`.
|
|
91
|
+
* Scheme derives via `bundleHostScheme` — http for loopback,
|
|
92
|
+
* https otherwise (the same resolution the gadget bundleHost
|
|
93
|
+
* uses).
|
|
94
|
+
*/
|
|
95
|
+
readonly host?: string;
|
|
96
|
+
/** Fetch budget in ms. Default `DEFAULT_REGISTRY_SEARCH_TIMEOUT_MS`. */
|
|
97
|
+
readonly timeoutMs?: number;
|
|
98
|
+
/** Injectable fetch for tests. Defaults to the global fetch. */
|
|
99
|
+
readonly fetch?: typeof fetch;
|
|
100
|
+
}
|
|
68
101
|
export interface SearchBlueprintsDeps {
|
|
69
102
|
readonly embedding: EmbeddingProvider;
|
|
70
103
|
readonly vectors: VectorStore;
|
|
@@ -74,29 +107,48 @@ export interface SearchBlueprintsDeps {
|
|
|
74
107
|
* included in the search results alongside the semantic
|
|
75
108
|
* `VectorStore` matches.
|
|
76
109
|
*
|
|
77
|
-
* Omitted = semantic-only behavior (the pre-merge default)
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* `ManifestBlueprintProvider` at boot and threads it through
|
|
110
|
+
* Omitted = semantic-only behavior (the pre-merge default) — a
|
|
111
|
+
* composing host can run without a manifest provider bound to this
|
|
112
|
+
* handler. This package's own `createGguiServer` constructs a
|
|
113
|
+
* `ManifestBlueprintProvider` at boot and threads it through by
|
|
114
|
+
* default.
|
|
81
115
|
*/
|
|
82
116
|
readonly blueprints?: BlueprintProvider;
|
|
117
|
+
/**
|
|
118
|
+
* Optional registry discovery source. When bound, the handler
|
|
119
|
+
* queries the registry's public `/search` for published blueprint
|
|
120
|
+
* candidates and appends them after the local sources. Omitted =
|
|
121
|
+
* no outbound registry traffic (the zero-config default).
|
|
122
|
+
*/
|
|
123
|
+
readonly registry?: SearchBlueprintsRegistrySource;
|
|
83
124
|
}
|
|
84
125
|
declare const inputSchema: {
|
|
85
126
|
readonly query: z.ZodString;
|
|
86
127
|
readonly limit: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
readonly tool: z.ZodOptional<z.ZodString>;
|
|
129
|
+
readonly server: z.ZodOptional<z.ZodString>;
|
|
87
130
|
};
|
|
88
131
|
declare const outputSchema: {
|
|
89
132
|
results: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
90
133
|
total: z.ZodNumber;
|
|
91
134
|
query: z.ZodString;
|
|
135
|
+
degradedSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
136
|
+
source: z.ZodLiteral<"registry">;
|
|
137
|
+
reason: z.ZodEnum<{
|
|
138
|
+
unreachable: "unreachable";
|
|
139
|
+
timeout: "timeout";
|
|
140
|
+
invalid_response: "invalid_response";
|
|
141
|
+
}>;
|
|
142
|
+
}, z.core.$strip>>>;
|
|
92
143
|
};
|
|
93
144
|
/**
|
|
94
145
|
* Build a search-blueprints handler bound to concrete `embedding` +
|
|
95
146
|
* `vectors` implementations (required) + an optional manifest
|
|
96
147
|
* `BlueprintProvider`. Tests inject in-memory fakes from
|
|
97
148
|
* `@ggui-ai/mcp-server-core/in-memory`; production hosts bind to
|
|
98
|
-
*
|
|
99
|
-
* `ManifestBlueprintProvider` for the
|
|
149
|
+
* their own operator-configured embedding + vector-store providers
|
|
150
|
+
* for the semantic source and a `ManifestBlueprintProvider` for the
|
|
151
|
+
* manifest source.
|
|
100
152
|
*/
|
|
101
153
|
export declare function createSearchBlueprintsHandler(deps: SearchBlueprintsDeps): SharedHandler<typeof inputSchema, typeof outputSchema, GguiSearchBlueprintsOutput>;
|
|
102
154
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-blueprints.d.ts","sourceRoot":"","sources":["../../src/blueprints/search-blueprints.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"search-blueprints.d.ts","sourceRoot":"","sources":["../../src/blueprints/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AE,oBAAoB,GACzB,aAAa,CAAC,OAAO,WAAW,EAAE,OAAO,YAAY,EAAE,0BAA0B,CAAC,CAyDpF"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* ggui_search_blueprints — search across every discoverable blueprint
|
|
3
3
|
* on this server.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* by id:
|
|
5
|
+
* Up to three sources are consulted in parallel, then merged +
|
|
6
|
+
* de-duplicated by id:
|
|
7
7
|
*
|
|
8
8
|
* 1. **Manifest source** (optional `BlueprintProvider`) — authored
|
|
9
9
|
* UIs declared in `ggui.json#blueprints.include`. Matched by
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
* producer that has written into the scope. Continues to honor
|
|
20
20
|
* `MIN_SIMILARITY_SCORE`.
|
|
21
21
|
*
|
|
22
|
+
* 3. **Registry source** (optional, opt-in via deps.registry) —
|
|
23
|
+
* bounded public /search call for published blueprint
|
|
24
|
+
* candidates; appended after local hits, degrades typed on
|
|
25
|
+
* failure.
|
|
26
|
+
*
|
|
22
27
|
* When both sources return the same id (a manifest blueprint that
|
|
23
28
|
* also has a cached generation), the manifest entry wins — its
|
|
24
29
|
* metadata is the source of truth and its name/description don't
|
|
@@ -26,8 +31,12 @@
|
|
|
26
31
|
* max of the two so a lexical OR semantic hit keeps the entry in
|
|
27
32
|
* the top band.
|
|
28
33
|
*
|
|
29
|
-
* The merge
|
|
30
|
-
* after sort
|
|
34
|
+
* The local merge (manifest + semantic) is trimmed to the top-N
|
|
35
|
+
* after sort, so it stays within `limit`. Registry candidates are
|
|
36
|
+
* bounded by the same `limit` on their own request and append AFTER
|
|
37
|
+
* that trim rather than sharing its budget, so the final `results`
|
|
38
|
+
* count can reach up to 2×`limit`. `total` reflects the pre-trim
|
|
39
|
+
* local match count plus the appended registry count.
|
|
31
40
|
*
|
|
32
41
|
* ## Why merge vs. a dedicated tool
|
|
33
42
|
*
|
|
@@ -38,11 +47,11 @@
|
|
|
38
47
|
* the split the server already knows how to make.
|
|
39
48
|
*
|
|
40
49
|
* Pure over `@ggui-ai/mcp-server-core`'s seams. No AWS imports. No
|
|
41
|
-
* config loading.
|
|
42
|
-
* when
|
|
50
|
+
* config loading. A composing host may wrap this with its own
|
|
51
|
+
* logging when assembling the server.
|
|
43
52
|
*/
|
|
44
53
|
import { z } from 'zod';
|
|
45
|
-
import { flatToBlueprintSource, searchBlueprintsInputShape, } from '@ggui-ai/protocol';
|
|
54
|
+
import { bundleHostScheme, DEFAULT_BUNDLE_HOST, flatToBlueprintSource, searchBlueprintsInputShape, } from '@ggui-ai/protocol';
|
|
46
55
|
/**
|
|
47
56
|
* Matches the hosted `MIN_SIMILARITY_SCORE`. Below this is noise —
|
|
48
57
|
* callers that want stricter matching post-filter by `score`.
|
|
@@ -63,6 +72,12 @@ export const MANIFEST_EXACT_NAME_SCORE = 1.0;
|
|
|
63
72
|
* stronger signal.
|
|
64
73
|
*/
|
|
65
74
|
export const MANIFEST_SUBSTRING_SCORE = 0.7;
|
|
75
|
+
/**
|
|
76
|
+
* Default budget for the registry `/search` round-trip. The registry
|
|
77
|
+
* source is advisory — a slow registry must never stall the local
|
|
78
|
+
* sources past this bound. Operator-overridable per-deps.
|
|
79
|
+
*/
|
|
80
|
+
export const DEFAULT_REGISTRY_SEARCH_TIMEOUT_MS = 3000;
|
|
66
81
|
// Canonical SSoT shape — authored once in `@ggui-ai/protocol`
|
|
67
82
|
// (`schemas/mcp.ts`).
|
|
68
83
|
const inputSchema = searchBlueprintsInputShape;
|
|
@@ -76,32 +91,42 @@ const outputSchema = {
|
|
|
76
91
|
results: z.array(z.record(z.string(), z.unknown())),
|
|
77
92
|
total: z.number().int().nonnegative(),
|
|
78
93
|
query: z.string(),
|
|
94
|
+
degradedSources: z
|
|
95
|
+
.array(z.object({
|
|
96
|
+
source: z.literal('registry'),
|
|
97
|
+
reason: z.enum(['unreachable', 'timeout', 'invalid_response']),
|
|
98
|
+
}))
|
|
99
|
+
.optional(),
|
|
79
100
|
};
|
|
80
101
|
/**
|
|
81
102
|
* Build a search-blueprints handler bound to concrete `embedding` +
|
|
82
103
|
* `vectors` implementations (required) + an optional manifest
|
|
83
104
|
* `BlueprintProvider`. Tests inject in-memory fakes from
|
|
84
105
|
* `@ggui-ai/mcp-server-core/in-memory`; production hosts bind to
|
|
85
|
-
*
|
|
86
|
-
* `ManifestBlueprintProvider` for the
|
|
106
|
+
* their own operator-configured embedding + vector-store providers
|
|
107
|
+
* for the semantic source and a `ManifestBlueprintProvider` for the
|
|
108
|
+
* manifest source.
|
|
87
109
|
*/
|
|
88
110
|
export function createSearchBlueprintsHandler(deps) {
|
|
89
111
|
return {
|
|
90
112
|
name: 'ggui_search_blueprints',
|
|
91
113
|
title: 'Search blueprints',
|
|
92
114
|
audience: ['agent'],
|
|
93
|
-
description: "Search this app's blueprints —
|
|
115
|
+
description: "Search this app's blueprints — manifest-declared UIs (ggui.json#blueprints.include), previously cached generations, and, when a registry is configured, published blueprint candidates from the artifact registry. Local sources match by name/description and cosine similarity; registry candidates are advisory matches appended after local results, labeled origin 'registry'. Optional tool/server filters narrow registry candidates to artifacts declaring those MCP tool bindings. The agent can decide to reuse a match or generate from scratch; installing a registry candidate remains a human/operator act.",
|
|
94
116
|
inputSchema,
|
|
95
117
|
outputSchema,
|
|
96
118
|
async handler(rawInput, ctx) {
|
|
97
|
-
const { query, limit = 10 } = z
|
|
98
|
-
|
|
119
|
+
const { query, limit = 10, tool, server } = z
|
|
120
|
+
.object(inputSchema)
|
|
121
|
+
.parse(rawInput);
|
|
122
|
+
// Fan out all sources in parallel. The manifest source is a
|
|
99
123
|
// pure metadata read (cheap); the semantic source is one
|
|
100
|
-
// `embed` + one `query` round-trip
|
|
101
|
-
//
|
|
102
|
-
const [semantic, manifest] = await Promise.all([
|
|
124
|
+
// `embed` + one `query` round-trip; the registry source is a
|
|
125
|
+
// bounded HTTP call that degrades typed instead of throwing.
|
|
126
|
+
const [semantic, manifest, registry] = await Promise.all([
|
|
103
127
|
searchSemantic(deps, ctx.appId, query, limit),
|
|
104
128
|
searchManifest(deps.blueprints, query, limit),
|
|
129
|
+
searchRegistry(deps.registry, { query, tool, server, limit }, ctx.signal),
|
|
105
130
|
]);
|
|
106
131
|
// Merge + dedupe by id. Manifest entries win on collision —
|
|
107
132
|
// their metadata is author-curated and cannot drift against a
|
|
@@ -117,7 +142,15 @@ export function createSearchBlueprintsHandler(deps) {
|
|
|
117
142
|
}
|
|
118
143
|
const merged = Array.from(byId.values()).sort((a, b) => b.score - a.score);
|
|
119
144
|
const trimmed = merged.slice(0, limit);
|
|
120
|
-
|
|
145
|
+
// Registry candidates append AFTER the local sources (advisory
|
|
146
|
+
// per the discovery design §3) and never displace a local id.
|
|
147
|
+
const registryHits = registry.hits.filter((hit) => !byId.has(hit.id));
|
|
148
|
+
return {
|
|
149
|
+
results: [...trimmed, ...registryHits],
|
|
150
|
+
total: merged.length + registryHits.length,
|
|
151
|
+
query,
|
|
152
|
+
...(registry.degraded ? { degradedSources: [registry.degraded] } : {}),
|
|
153
|
+
};
|
|
121
154
|
},
|
|
122
155
|
};
|
|
123
156
|
}
|
|
@@ -222,3 +255,120 @@ function toManifestHit(entry, queryLower) {
|
|
|
222
255
|
function asString(value) {
|
|
223
256
|
return typeof value === 'string' ? value : '';
|
|
224
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Wire subset of the registry `GET /search` response this handler
|
|
260
|
+
* consumes. Local on purpose: this package does not depend on the
|
|
261
|
+
* registry server implementation, and zod's default strip semantics
|
|
262
|
+
* keep the guard forward-compatible with response additions.
|
|
263
|
+
*/
|
|
264
|
+
const registrySearchEntrySchema = z.object({
|
|
265
|
+
artifactId: z.string().min(1),
|
|
266
|
+
latestVersion: z.string().min(1),
|
|
267
|
+
kind: z.string(),
|
|
268
|
+
description: z.string().optional(),
|
|
269
|
+
mcpTools: z.array(z.object({ server: z.string().optional(), tool: z.string() })).optional(),
|
|
270
|
+
scopeVerification: z.enum(['verified', 'unverified']).optional(),
|
|
271
|
+
});
|
|
272
|
+
const registrySearchResponseSchema = z.object({
|
|
273
|
+
results: z.array(registrySearchEntrySchema),
|
|
274
|
+
});
|
|
275
|
+
/**
|
|
276
|
+
* Registry-source branch: bounded public `/search` call. Inactive
|
|
277
|
+
* (empty hits, no degradation) when no registry source is
|
|
278
|
+
* configured. Never throws — every failure mode maps onto the typed
|
|
279
|
+
* `degraded` indication so the merged tool result always succeeds.
|
|
280
|
+
*/
|
|
281
|
+
async function searchRegistry(registry, filters, signal) {
|
|
282
|
+
if (!registry)
|
|
283
|
+
return { hits: [] };
|
|
284
|
+
// Operator-override-then-default host resolution — the same
|
|
285
|
+
// precedence + scheme rule as gadget bundleHost (`DEFAULT_BUNDLE_HOST`
|
|
286
|
+
// + `bundleHostScheme` from `@ggui-ai/protocol`).
|
|
287
|
+
const host = typeof registry.host === 'string' && registry.host.length > 0
|
|
288
|
+
? registry.host
|
|
289
|
+
: DEFAULT_BUNDLE_HOST;
|
|
290
|
+
const params = new URLSearchParams();
|
|
291
|
+
params.set('q', filters.query);
|
|
292
|
+
// This tool's kind scope is blueprints; gadget discovery is served
|
|
293
|
+
// by the registry HTTP surface directly.
|
|
294
|
+
params.set('kind', 'blueprint');
|
|
295
|
+
if (filters.tool !== undefined)
|
|
296
|
+
params.set('tool', filters.tool);
|
|
297
|
+
if (filters.server !== undefined)
|
|
298
|
+
params.set('server', filters.server);
|
|
299
|
+
params.set('limit', String(filters.limit));
|
|
300
|
+
const url = `${bundleHostScheme(host)}://${host}/search?${params.toString()}`;
|
|
301
|
+
const timeoutMs = registry.timeoutMs ?? DEFAULT_REGISTRY_SEARCH_TIMEOUT_MS;
|
|
302
|
+
const signals = [AbortSignal.timeout(timeoutMs)];
|
|
303
|
+
if (signal)
|
|
304
|
+
signals.push(signal);
|
|
305
|
+
const fetchImpl = registry.fetch ?? fetch;
|
|
306
|
+
let res;
|
|
307
|
+
try {
|
|
308
|
+
res = await fetchImpl(url, {
|
|
309
|
+
method: 'GET',
|
|
310
|
+
headers: { accept: 'application/json' },
|
|
311
|
+
signal: AbortSignal.any(signals),
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
catch (err) {
|
|
315
|
+
const reason = err instanceof Error && err.name === 'TimeoutError' ? 'timeout' : 'unreachable';
|
|
316
|
+
return { hits: [], degraded: { source: 'registry', reason } };
|
|
317
|
+
}
|
|
318
|
+
if (!res.ok) {
|
|
319
|
+
// Undici doesn't return the socket to the pool until the body is
|
|
320
|
+
// consumed or canceled. We never read this body (non-2xx), so
|
|
321
|
+
// cancel it explicitly — a rejecting cancel() must still surface
|
|
322
|
+
// the already-typed degradation, not throw past this branch.
|
|
323
|
+
try {
|
|
324
|
+
await res.body?.cancel();
|
|
325
|
+
}
|
|
326
|
+
catch {
|
|
327
|
+
// Deliberately swallowed — see comment above.
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
hits: [],
|
|
331
|
+
degraded: { source: 'registry', reason: 'invalid_response' },
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
let body;
|
|
335
|
+
try {
|
|
336
|
+
body = await res.json();
|
|
337
|
+
}
|
|
338
|
+
catch {
|
|
339
|
+
return {
|
|
340
|
+
hits: [],
|
|
341
|
+
degraded: { source: 'registry', reason: 'invalid_response' },
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
const parsed = registrySearchResponseSchema.safeParse(body);
|
|
345
|
+
if (!parsed.success) {
|
|
346
|
+
return {
|
|
347
|
+
hits: [],
|
|
348
|
+
degraded: { source: 'registry', reason: 'invalid_response' },
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
return { hits: parsed.data.results.map(toRegistryHit) };
|
|
352
|
+
}
|
|
353
|
+
function toRegistryHit(entry) {
|
|
354
|
+
return {
|
|
355
|
+
id: `${entry.artifactId}@${entry.latestVersion}`,
|
|
356
|
+
name: entry.artifactId,
|
|
357
|
+
description: entry.description ?? '',
|
|
358
|
+
category: entry.kind,
|
|
359
|
+
// Registry search rows carry no contract details — honest empties.
|
|
360
|
+
props: [],
|
|
361
|
+
callbacks: [],
|
|
362
|
+
featured: false,
|
|
363
|
+
relevance: 'match',
|
|
364
|
+
// The registry source computes no similarity. Entries always
|
|
365
|
+
// append AFTER the score-sorted local sources, so this value
|
|
366
|
+
// carries no ranking weight; 0 is the honest "not measured".
|
|
367
|
+
score: 0,
|
|
368
|
+
origin: 'registry',
|
|
369
|
+
artifactId: entry.artifactId,
|
|
370
|
+
version: entry.latestVersion,
|
|
371
|
+
...(entry.mcpTools ? { mcpTools: entry.mcpTools } : {}),
|
|
372
|
+
...(entry.scopeVerification ? { scopeVerification: entry.scopeVerification } : {}),
|
|
373
|
+
};
|
|
374
|
+
}
|
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Named events for the content-addressable code-delivery channel.
|
|
3
3
|
*
|
|
4
|
-
* `codeUrl` is the
|
|
5
|
-
* envelope
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `codeUrl` mint is not absorbed by a second static channel; what
|
|
11
|
-
* happens next is deployment-shaped:
|
|
4
|
+
* `codeUrl` is the CACHE-ADDRESSABLE static delivery surface of a
|
|
5
|
+
* COMPILED-COMPONENT envelope — since #471 it is no longer the only
|
|
6
|
+
* static one: `deriveRenderMeta` also stamps the size-capped inline
|
|
7
|
+
* `codeB64` twin, independent of this channel's store. A failed
|
|
8
|
+
* `codeUrl` mint therefore usually IS absorbed by the inline channel;
|
|
9
|
+
* what it still costs is deployment-shaped:
|
|
12
10
|
*
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* -
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* - A deployment with neither loses the mount for that one
|
|
22
|
-
* envelope.
|
|
11
|
+
* - Every under-cap compiled render keeps mounting via `codeB64`
|
|
12
|
+
* (and, when minted, the live trio). The loss is the browser-
|
|
13
|
+
* cacheable content-addressable URL — repeat renders of the same
|
|
14
|
+
* bytes re-ship them inline instead of hitting HTTP cache.
|
|
15
|
+
* - An OVER-CAP render (no `codeB64`) falls back to exactly the
|
|
16
|
+
* pre-#471 posture: live trio mounts it; a host that resolves
|
|
17
|
+
* `resourceUri` re-mints `codeUrl` at READ time; a deployment
|
|
18
|
+
* with neither loses the mount for that one envelope.
|
|
23
19
|
*
|
|
24
|
-
* None of
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
20
|
+
* None of this is distinguishable from the wire — the render reports
|
|
21
|
+
* success either way — which is why the failure is emitted under a
|
|
22
|
+
* name instead of swallowed. The event carries whether a live channel
|
|
23
|
+
* is wired; combined with the render's size class it separates
|
|
24
|
+
* "slower / uncacheable delivery" from "this envelope cannot mount".
|
|
29
25
|
*/
|
|
30
26
|
/**
|
|
31
27
|
* Every event this module can emit. Closed union — a new emitter picks
|
|
@@ -33,7 +29,7 @@
|
|
|
33
29
|
* compile error rather than an alert filter that quietly stops
|
|
34
30
|
* matching.
|
|
35
31
|
*/
|
|
36
|
-
export type CodeDeliveryEvent = 'render_code_write_failed';
|
|
32
|
+
export type CodeDeliveryEvent = 'render_code_write_failed' | 'render_code_b64_over_cap';
|
|
37
33
|
/**
|
|
38
34
|
* The event names as values, so every emitter — in this package or a
|
|
39
35
|
* storage backend elsewhere — spells them from one place.
|
|
@@ -41,10 +37,17 @@ export type CodeDeliveryEvent = 'render_code_write_failed';
|
|
|
41
37
|
export declare const CODE_DELIVERY_EVENTS: {
|
|
42
38
|
/**
|
|
43
39
|
* The `codeUrl` mint failed for a render envelope. That envelope
|
|
44
|
-
*
|
|
45
|
-
* what survives.
|
|
40
|
+
* loses the cache-addressable static channel; see the module
|
|
41
|
+
* docstring for what survives.
|
|
46
42
|
*/
|
|
47
43
|
readonly renderCodeWriteFailed: "render_code_write_failed";
|
|
44
|
+
/**
|
|
45
|
+
* A compiled render's source exceeded the inline `codeB64` cap, so
|
|
46
|
+
* the slice was emitted WITHOUT the fetch-free channel. On hosts
|
|
47
|
+
* whose iframe CSP blocks fetches AND WebSockets, that render
|
|
48
|
+
* cannot paint — the omission must be visible, not silent.
|
|
49
|
+
*/
|
|
50
|
+
readonly renderCodeB64OverCap: "render_code_b64_over_cap";
|
|
48
51
|
};
|
|
49
52
|
/**
|
|
50
53
|
* What an emitter knows at the point the mint failed.
|
|
@@ -58,9 +61,11 @@ export interface RenderCodeWriteFailure {
|
|
|
58
61
|
* Whether this deployment mints live-channel credentials.
|
|
59
62
|
*
|
|
60
63
|
* `true` ⇒ the render still mounts over the WS subscribe; the loss
|
|
61
|
-
* is the instant first paint. `false` ⇒
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
+
* is the instant first paint. `false` ⇒ the envelope mounts only
|
|
65
|
+
* through the inline `codeB64` channel (present for every under-cap
|
|
66
|
+
* compiled render, independent of this store); an OVER-CAP render
|
|
67
|
+
* with `false` here truly has no mount mode, and only a host that
|
|
68
|
+
* resolves `resourceUri` will still produce a card.
|
|
64
69
|
*/
|
|
65
70
|
readonly liveChannelWired: boolean;
|
|
66
71
|
/** Whatever the store threw. Unshaped by construction. */
|
|
@@ -73,4 +78,15 @@ export interface RenderCodeWriteFailure {
|
|
|
73
78
|
* committed must not fail because its delivery-channel telemetry did.
|
|
74
79
|
*/
|
|
75
80
|
export declare function reportRenderCodeWriteFailed(failure: RenderCodeWriteFailure): void;
|
|
81
|
+
/**
|
|
82
|
+
* Emit {@link CODE_DELIVERY_EVENTS.renderCodeB64OverCap}.
|
|
83
|
+
*
|
|
84
|
+
* Never throws — same posture as the write-failure emitter above.
|
|
85
|
+
*/
|
|
86
|
+
export declare function reportRenderCodeB64OverCap(over: {
|
|
87
|
+
readonly sessionId: string;
|
|
88
|
+
readonly appId: string;
|
|
89
|
+
/** UTF-8 byte length of the compiled source that exceeded the cap. */
|
|
90
|
+
readonly sourceBytes: number;
|
|
91
|
+
}): void;
|
|
76
92
|
//# sourceMappingURL=code-delivery-events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-delivery-events.d.ts","sourceRoot":"","sources":["../../src/renders/code-delivery-events.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"code-delivery-events.d.ts","sourceRoot":"","sources":["../../src/renders/code-delivery-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GACzB,0BAA0B,GAC1B,0BAA0B,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;OAIG;;IAEH;;;;;OAKG;;CAEiD,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,qDAAqD;IACrD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;;;;;;OASG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CAgBN;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,GAAG,IAAI,CAUP"}
|
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Named events for the content-addressable code-delivery channel.
|
|
3
3
|
*
|
|
4
|
-
* `codeUrl` is the
|
|
5
|
-
* envelope
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `codeUrl` mint is not absorbed by a second static channel; what
|
|
11
|
-
* happens next is deployment-shaped:
|
|
4
|
+
* `codeUrl` is the CACHE-ADDRESSABLE static delivery surface of a
|
|
5
|
+
* COMPILED-COMPONENT envelope — since #471 it is no longer the only
|
|
6
|
+
* static one: `deriveRenderMeta` also stamps the size-capped inline
|
|
7
|
+
* `codeB64` twin, independent of this channel's store. A failed
|
|
8
|
+
* `codeUrl` mint therefore usually IS absorbed by the inline channel;
|
|
9
|
+
* what it still costs is deployment-shaped:
|
|
12
10
|
*
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* -
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* - A deployment with neither loses the mount for that one
|
|
22
|
-
* envelope.
|
|
11
|
+
* - Every under-cap compiled render keeps mounting via `codeB64`
|
|
12
|
+
* (and, when minted, the live trio). The loss is the browser-
|
|
13
|
+
* cacheable content-addressable URL — repeat renders of the same
|
|
14
|
+
* bytes re-ship them inline instead of hitting HTTP cache.
|
|
15
|
+
* - An OVER-CAP render (no `codeB64`) falls back to exactly the
|
|
16
|
+
* pre-#471 posture: live trio mounts it; a host that resolves
|
|
17
|
+
* `resourceUri` re-mints `codeUrl` at READ time; a deployment
|
|
18
|
+
* with neither loses the mount for that one envelope.
|
|
23
19
|
*
|
|
24
|
-
* None of
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
20
|
+
* None of this is distinguishable from the wire — the render reports
|
|
21
|
+
* success either way — which is why the failure is emitted under a
|
|
22
|
+
* name instead of swallowed. The event carries whether a live channel
|
|
23
|
+
* is wired; combined with the render's size class it separates
|
|
24
|
+
* "slower / uncacheable delivery" from "this envelope cannot mount".
|
|
29
25
|
*/
|
|
30
26
|
/**
|
|
31
27
|
* The event names as values, so every emitter — in this package or a
|
|
@@ -34,10 +30,17 @@
|
|
|
34
30
|
export const CODE_DELIVERY_EVENTS = {
|
|
35
31
|
/**
|
|
36
32
|
* The `codeUrl` mint failed for a render envelope. That envelope
|
|
37
|
-
*
|
|
38
|
-
* what survives.
|
|
33
|
+
* loses the cache-addressable static channel; see the module
|
|
34
|
+
* docstring for what survives.
|
|
39
35
|
*/
|
|
40
36
|
renderCodeWriteFailed: 'render_code_write_failed',
|
|
37
|
+
/**
|
|
38
|
+
* A compiled render's source exceeded the inline `codeB64` cap, so
|
|
39
|
+
* the slice was emitted WITHOUT the fetch-free channel. On hosts
|
|
40
|
+
* whose iframe CSP blocks fetches AND WebSockets, that render
|
|
41
|
+
* cannot paint — the omission must be visible, not silent.
|
|
42
|
+
*/
|
|
43
|
+
renderCodeB64OverCap: 'render_code_b64_over_cap',
|
|
41
44
|
};
|
|
42
45
|
/**
|
|
43
46
|
* Emit {@link CODE_DELIVERY_EVENTS.renderCodeWriteFailed}.
|
|
@@ -58,3 +61,17 @@ export function reportRenderCodeWriteFailed(failure) {
|
|
|
58
61
|
errorName: failure.cause instanceof Error ? failure.cause.name : undefined,
|
|
59
62
|
}));
|
|
60
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Emit {@link CODE_DELIVERY_EVENTS.renderCodeB64OverCap}.
|
|
66
|
+
*
|
|
67
|
+
* Never throws — same posture as the write-failure emitter above.
|
|
68
|
+
*/
|
|
69
|
+
export function reportRenderCodeB64OverCap(over) {
|
|
70
|
+
// eslint-disable-next-line no-console -- structured single-line event for log-pipeline pickup
|
|
71
|
+
console.warn(JSON.stringify({
|
|
72
|
+
msg: CODE_DELIVERY_EVENTS.renderCodeB64OverCap,
|
|
73
|
+
sessionId: over.sessionId,
|
|
74
|
+
appId: over.appId,
|
|
75
|
+
sourceBytes: over.sourceBytes,
|
|
76
|
+
}));
|
|
77
|
+
}
|
package/dist/renders/index.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export { buildCacheReuseResult, buildCreateFallback, decideHandshake, type Bluep
|
|
|
68
68
|
export { installToCache, type InstallToCacheInput } from "./install-to-cache.js";
|
|
69
69
|
export { createInstalledBlueprintsProvider, type CreateInstalledBlueprintsProviderOptions, type InstalledBlueprintCacheIssue, type CompileResult as InstalledBlueprintCompileResult, type InstalledBlueprintEntry, type InstalledBlueprintsProvider, } from "./installed-blueprints-provider.js";
|
|
70
70
|
export { createInMemoryProvisionalPreviewRegistry, evaluateProvisionalPreviewGate, finalizeProvisionalPreview, kickoffProvisionalPreview, PreviewAbortError, PROVISIONAL_PREVIEW_CHANNEL, runProvisionalPreview, type ProvisionalPreviewConfig, type ProvisionalPreviewContext, type ProvisionalPreviewDeps, type ProvisionalPreviewEmit, type ProvisionalPreviewEmitter, type ProvisionalPreviewGate, type ProvisionalPreviewGateInput, type ProvisionalPreviewHandle, type ProvisionalPreviewOutcome, type ProvisionalPreviewRegistry, type ProvisionalPreviewRunContext, type ProvisionalPreviewSkipReason, } from "./provisional-preview.js";
|
|
71
|
-
export { assembleRenderSliceBase, deriveBundleOrigins, deriveContextSlots, deriveContractBundle, derivePropsJson, derivePublicEnvProjection, deriveRenderMeta, resolveGadgetUrls, type RenderMetaView, type RenderSliceBase, type RenderSliceMetaDeps, } from "./slice-meta-derivation.js";
|
|
71
|
+
export { assembleRenderSliceBase, deriveBundleOrigins, deriveContextSlots, deriveContractBundle, derivePropsJson, derivePublicEnvProjection, deriveRenderMeta, rewritePrivateBundleUrls, PRIVATE_BUNDLE_PREFIX, resolveGadgetUrls, type RenderMetaView, type RenderSliceBase, type RenderSliceMetaDeps, } from "./slice-meta-derivation.js";
|
|
72
72
|
export type { SeedPoolSource } from "./seed-pool-source.js";
|
|
73
73
|
export { buildSeedPool, type BuildSeedPoolOptions } from "./build-seed-pool.js";
|
|
74
74
|
export { listRegistryBlueprintsForExport, type ExportableBlueprint } from './export-registry.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/renders/index.ts"],"names":[],"mappings":"AAAA;;;;;;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sBAAsB,CAAC"}
|
package/dist/renders/index.js
CHANGED
|
@@ -83,7 +83,7 @@ export { createInMemoryProvisionalPreviewRegistry, evaluateProvisionalPreviewGat
|
|
|
83
83
|
// Exported so any server can run the same projections off the
|
|
84
84
|
// resolved render without duplicating the actionSpec / contextSpec
|
|
85
85
|
// walks.
|
|
86
|
-
export { assembleRenderSliceBase, deriveBundleOrigins, deriveContextSlots, deriveContractBundle, derivePropsJson, derivePublicEnvProjection, deriveRenderMeta, resolveGadgetUrls, } from "./slice-meta-derivation.js";
|
|
86
|
+
export { assembleRenderSliceBase, deriveBundleOrigins, deriveContextSlots, deriveContractBundle, derivePropsJson, derivePublicEnvProjection, deriveRenderMeta, rewritePrivateBundleUrls, PRIVATE_BUNDLE_PREFIX, resolveGadgetUrls, } from "./slice-meta-derivation.js";
|
|
87
87
|
export { buildSeedPool } from "./build-seed-pool.js";
|
|
88
88
|
export { listRegistryBlueprintsForExport } from './export-registry.js';
|
|
89
89
|
// The render-identity event registry. Exported because storage backends
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/renders/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,KAAK,iBAAiB,EAEtB,KAAK,YAAY,EAGjB,KAAK,WAAW,EAGjB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EAGd,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAOrB,OAAO,EA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d,OAAO,WAAW,EAClB,OAAO,YAAY,EACnB,YAAY,GAAG,cAAc,CAAC,mBAAmB,CAAC,CACnD,CAo9CA"}
|
package/dist/renders/render.js
CHANGED
|
@@ -53,7 +53,7 @@ import { handlerFailure, isHandlerFailure, } from '../types.js';
|
|
|
53
53
|
import { consumeHandshakeRecord, peekHandshakeRecord, HandshakeNotFoundError, } from './handshake.js';
|
|
54
54
|
import { evaluateProvisionalPreviewGate, finalizeProvisionalPreview, kickoffProvisionalPreview, } from './provisional-preview.js';
|
|
55
55
|
import { assertNoDuplicateGadgetHooks } from './assert-no-duplicate-gadget-hooks.js';
|
|
56
|
-
import { reportRenderCodeWriteFailed } from './code-delivery-events.js';
|
|
56
|
+
import { reportRenderCodeB64OverCap, reportRenderCodeWriteFailed, } from './code-delivery-events.js';
|
|
57
57
|
import { writeRenderIdentity } from './render-identity.js';
|
|
58
58
|
import { findBlueprintExact, readBlueprintById, registerBlueprint, } from './blueprint-registry.js';
|
|
59
59
|
import { assertGadgetsRegistered, filterDescriptorsToContract, } from './assert-gadgets.js';
|
|
@@ -64,7 +64,7 @@ import { validatePropsData, ContractViolationError, validateContract, renderInpu
|
|
|
64
64
|
import { emitCacheTraceEvent, newCacheTraceId, truncateCacheTraceIntent, } from './cache-trace-sink.js';
|
|
65
65
|
import { emitPayloadTraceEvent } from './payload-trace-sink.js';
|
|
66
66
|
import { isVisibleToCaller } from './tenancy.js';
|
|
67
|
-
import { assembleRenderSliceBase, deriveRenderMeta, derivePublicEnvProjection, deriveContractBundle, } from './slice-meta-derivation.js';
|
|
67
|
+
import { assembleRenderSliceBase, deriveRenderMeta, derivePublicEnvProjection, deriveContractBundle, rewritePrivateBundleUrls, } from './slice-meta-derivation.js';
|
|
68
68
|
/**
|
|
69
69
|
* Input raw-shape.
|
|
70
70
|
*
|
|
@@ -1340,7 +1340,25 @@ export function createGguiRenderHandler(deps) {
|
|
|
1340
1340
|
lastSequence = stored.eventSequence;
|
|
1341
1341
|
}
|
|
1342
1342
|
if (top) {
|
|
1343
|
-
|
|
1343
|
+
// H1 ruling 1b — presign-rewrite PRIVATE bundle URLs before
|
|
1344
|
+
// projection so CSP origins + iframe registrations both see
|
|
1345
|
+
// the fetchable (presigned) URL. Passthrough when the
|
|
1346
|
+
// deployment wires no presigner (OSS same-origin story).
|
|
1347
|
+
view = deriveRenderMeta(await rewritePrivateBundleUrls(top, deps.presignPrivateBundleUrl));
|
|
1348
|
+
// Over-cap inline-channel omission is a named event, not a
|
|
1349
|
+
// silent degrade: on a host whose iframe CSP blocks fetches
|
|
1350
|
+
// AND WebSockets, a slice without `codeB64` cannot paint.
|
|
1351
|
+
if (top.type !== 'mcpApps' &&
|
|
1352
|
+
top.type !== 'system' &&
|
|
1353
|
+
typeof top.componentCode === 'string' &&
|
|
1354
|
+
top.componentCode.length > 0 &&
|
|
1355
|
+
view.codeB64 === undefined) {
|
|
1356
|
+
reportRenderCodeB64OverCap({
|
|
1357
|
+
sessionId: output.sessionId,
|
|
1358
|
+
appId: ctx.appId,
|
|
1359
|
+
sourceBytes: Buffer.byteLength(top.componentCode, 'utf8'),
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1344
1362
|
// Project the App's publicEnv down to the union of declared
|
|
1345
1363
|
// wrappers' `requires`.
|
|
1346
1364
|
if (deps.appMetadataStore) {
|
|
@@ -1468,6 +1486,12 @@ export function createGguiRenderHandler(deps) {
|
|
|
1468
1486
|
...(outputWithCode.codeHash
|
|
1469
1487
|
? { codeHash: outputWithCode.codeHash }
|
|
1470
1488
|
: {}),
|
|
1489
|
+
// Inline compiled source (size-capped, projected by
|
|
1490
|
+
// `deriveRenderMeta`). Coexists with codeUrl: fetch-capable
|
|
1491
|
+
// hosts keep the cache-addressable URL, fetch-blocked hosts
|
|
1492
|
+
// (iframe CSP without connect-src/script-src to this server)
|
|
1493
|
+
// decode the inline bytes. Never emitted alongside `kind`.
|
|
1494
|
+
...(view.codeB64 !== undefined ? { codeB64: view.codeB64 } : {}),
|
|
1471
1495
|
};
|
|
1472
1496
|
const uiMeta = {
|
|
1473
1497
|
resourceUri: perCallResourceUri,
|
|
@@ -48,9 +48,13 @@ import { type CompiledContractValidators, type McpAppAiGguiRenderMeta } from '@g
|
|
|
48
48
|
* ships via a non-registry CDN (esm.sh, jsdelivr, …).
|
|
49
49
|
* 2. `entry.bundleHost` + `entry.package` + `entry.version` —
|
|
50
50
|
* hostname resolution: server assembles
|
|
51
|
-
* `https://<bundleHost>/bundles/<scope>/<name>/<version>/bundle.js`
|
|
52
|
-
*
|
|
53
|
-
*
|
|
51
|
+
* `https://<bundleHost>/bundles/public/<scope>/<name>/<version>/bundle.js`
|
|
52
|
+
* — the PUBLIC prefix of `@ggui-ai/registry-core`'s
|
|
53
|
+
* visibility-split `BundleStorage` layout (H1). Host composition
|
|
54
|
+
* serves the anonymous render-time fetch, which only the public
|
|
55
|
+
* prefix answers; private artifacts always arrive as explicit
|
|
56
|
+
* `bundleUrl` values and are presign-rewritten at render-meta
|
|
57
|
+
* time ({@link rewritePrivateBundleUrls}).
|
|
54
58
|
* 3. Spec default `registry.ggui.ai` — applied when `entry.bundleHost`
|
|
55
59
|
* is absent but `package` + `version` are present (first-party
|
|
56
60
|
* hosted-registry default).
|
|
@@ -90,6 +94,48 @@ export declare function resolveGadgetUrls(entry: Partial<Pick<GadgetDescriptor,
|
|
|
90
94
|
readonly bundleUrl?: string;
|
|
91
95
|
readonly styleUrl?: string;
|
|
92
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* URL-path marker of the registry's PRIVATE bundle prefix (H1
|
|
99
|
+
* visibility split) — the substring {@link rewritePrivateBundleUrls}
|
|
100
|
+
* dispatches on.
|
|
101
|
+
*/
|
|
102
|
+
export declare const PRIVATE_BUNDLE_PREFIX = "/bundles/private/";
|
|
103
|
+
/**
|
|
104
|
+
* H1 ruling 1b — rewrite a render item's PRIVATE gadget bundle URLs
|
|
105
|
+
* into fetchable equivalents at render-meta time.
|
|
106
|
+
*
|
|
107
|
+
* A private artifact's explicit `bundleUrl` / `styleUrl` / `typesUrl`
|
|
108
|
+
* point at the registry's `bundles/private/` prefix, which serves no
|
|
109
|
+
* anonymous request — the sandboxed iframe (which sends no
|
|
110
|
+
* credentials) could never load it. When a `presign` function is
|
|
111
|
+
* supplied, every descriptor URL containing
|
|
112
|
+
* {@link PRIVATE_BUNDLE_PREFIX} is replaced by `await presign(url)` —
|
|
113
|
+
* the hosted deployment presigns a short-lived object-storage URL via
|
|
114
|
+
* its pod task role. Everything else is untouched: public explicit
|
|
115
|
+
* URLs, bundleHost-composed URLs (which are public-prefix by
|
|
116
|
+
* construction, see {@link resolveGadgetUrls}), and descriptors with
|
|
117
|
+
* no URLs at all.
|
|
118
|
+
*
|
|
119
|
+
* **OSS default: passthrough.** Without `presign` the item is returned
|
|
120
|
+
* unchanged — the self-hosted story is same-origin: a self-hoster's
|
|
121
|
+
* iframe and registry share an origin, so its `/bundles/private/…`
|
|
122
|
+
* route can authenticate the fetch itself (cookie/session) or the
|
|
123
|
+
* operator simply publishes render-consumed gadgets public. No
|
|
124
|
+
* presigning infrastructure is required to run the OSS stack.
|
|
125
|
+
*
|
|
126
|
+
* MUST run BEFORE {@link deriveRenderMeta}: both the CSP origin
|
|
127
|
+
* allowlist (`deriveBundleOrigins`) and the iframe registrations
|
|
128
|
+
* (`deriveGadgetRegistrations`) read the descriptor URLs, so the
|
|
129
|
+
* rewritten (presigned) origin lands in `script-src`/`style-src`
|
|
130
|
+
* automatically and the iframe fetches exactly what the CSP allows.
|
|
131
|
+
* Zero iframe changes — the client sees an ordinary absolute URL.
|
|
132
|
+
*
|
|
133
|
+
* Purity note: `deriveRenderMeta` stays pure; this pre-pass is the
|
|
134
|
+
* ONLY projection stage that may perform I/O, and it returns a new
|
|
135
|
+
* item (never mutates) so the WeakMap-memoized URL resolution keys
|
|
136
|
+
* stay correct.
|
|
137
|
+
*/
|
|
138
|
+
export declare function rewritePrivateBundleUrls(item: GguiSession, presign?: (url: string) => Promise<string>): Promise<GguiSession>;
|
|
93
139
|
/**
|
|
94
140
|
* Per-slot contextSpec data for an active render, derived to a
|
|
95
141
|
* wire-friendly array. Returns `undefined` when no slots are declared.
|
|
@@ -277,6 +323,19 @@ export declare function derivePropsJson(item: GguiSession): string | undefined;
|
|
|
277
323
|
export interface RenderMetaView {
|
|
278
324
|
readonly kind?: string;
|
|
279
325
|
readonly propsJson?: string;
|
|
326
|
+
/**
|
|
327
|
+
* Base64-encoded compiled component source — the fetch-free static
|
|
328
|
+
* delivery channel for hosts whose iframe CSP forbids cross-origin
|
|
329
|
+
* fetches (no `connect-src`/`script-src` to this server). Distinct
|
|
330
|
+
* from the 2026-05-13-retired raw-ESM `componentCode` field: this is
|
|
331
|
+
* base64 (inline-embedding-safe), consumed by the iframe-runtime's
|
|
332
|
+
* seed builder which PREFERS it over `codeUrl` and never fetches.
|
|
333
|
+
* Omitted when the source exceeds {@link CODE_B64_MAX_CHARS}
|
|
334
|
+
* (over-cap renders keep the codeUrl / live channels) and for
|
|
335
|
+
* system-card renders. Each transport spreads it explicitly, like
|
|
336
|
+
* every other view field.
|
|
337
|
+
*/
|
|
338
|
+
readonly codeB64?: string;
|
|
280
339
|
readonly contextSlots?: ReadonlyArray<{
|
|
281
340
|
name: string;
|
|
282
341
|
contextName: string;
|
|
@@ -432,14 +491,23 @@ export declare function deriveContractBundle(item: GguiSession): Promise<{
|
|
|
432
491
|
readonly bundleSource: string;
|
|
433
492
|
readonly validators: CompiledContractValidators;
|
|
434
493
|
} | undefined>;
|
|
494
|
+
/**
|
|
495
|
+
* Ceiling on the base64 length {@link deriveRenderMeta} will inline as
|
|
496
|
+
* `codeB64` (256 KiB of base64 ≈ 192 KiB of source). Generated
|
|
497
|
+
* components run 5–50 KB; the cap exists so a pathological render
|
|
498
|
+
* cannot balloon every tool result and resource read it rides on.
|
|
499
|
+
* Over-cap renders keep their `codeUrl` / live-channel delivery.
|
|
500
|
+
*/
|
|
501
|
+
export declare const CODE_B64_MAX_CHARS = 262144;
|
|
435
502
|
/**
|
|
436
503
|
* Build the {@link RenderMetaView} for a render — the
|
|
437
504
|
* single-entry-point projection function every bootstrap transport
|
|
438
505
|
* SHOULD call. Composing transports take the view, spread it into
|
|
439
506
|
* their own envelope alongside render/auth/runtime concerns. The
|
|
440
|
-
* static-component code body
|
|
441
|
-
*
|
|
442
|
-
*
|
|
507
|
+
* static-component code body is delivered via the render handler's
|
|
508
|
+
* `codeUrl` channel (composed from `codeStore` + `codeBaseUrl`) AND —
|
|
509
|
+
* for fetch-blocked hosts — inline via the size-capped `codeB64`
|
|
510
|
+
* field this projection carries.
|
|
443
511
|
*
|
|
444
512
|
* Pure. Same input → identical output, byte-for-byte.
|
|
445
513
|
*/
|
|
@@ -520,6 +588,21 @@ export interface RenderSliceMetaDeps {
|
|
|
520
588
|
readonly id?: string;
|
|
521
589
|
readonly mode?: 'light' | 'dark';
|
|
522
590
|
} | undefined;
|
|
591
|
+
/**
|
|
592
|
+
* H1 ruling 1b — presigner for PRIVATE gadget bundle URLs, applied
|
|
593
|
+
* via {@link rewritePrivateBundleUrls} before the render projection
|
|
594
|
+
* so a private artifact's `bundles/private/…` URLs become
|
|
595
|
+
* short-lived fetchable equivalents (and their origin lands in the
|
|
596
|
+
* CSP allowlist). Injected at the deployment boundary: the hosted
|
|
597
|
+
* pod supplies an object-storage presigner running on its task
|
|
598
|
+
* role; leaving it unset (the OSS default) passes URLs through
|
|
599
|
+
* unchanged — the self-hosted same-origin story needs no presigning.
|
|
600
|
+
*
|
|
601
|
+
* Consumed by the full-envelope projection (`ggui_render`); the
|
|
602
|
+
* `ggui_update` slice subset carries no gadget URLs or CSP, so it
|
|
603
|
+
* never presigns.
|
|
604
|
+
*/
|
|
605
|
+
readonly presignPrivateBundleUrl?: (url: string) => Promise<string>;
|
|
523
606
|
}
|
|
524
607
|
/**
|
|
525
608
|
* Envelope-base fields assembled from {@link RenderSliceMetaDeps} —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice-meta-derivation.d.ts","sourceRoot":"","sources":["../../src/renders/slice-meta-derivation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAKL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC5B,MAAM,yCAAyC,CAAC;AAEjD
|
|
1
|
+
{"version":3,"file":"slice-meta-derivation.d.ts","sourceRoot":"","sources":["../../src/renders/slice-meta-derivation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAKL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC5B,MAAM,yCAAyC,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,CACZ,IAAI,CACF,gBAAgB,EAChB,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAChE,CACF,GACA;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAY7D;AA6ED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE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AG,MAAM,CAAC;KAClC,GACD,SAAS,CAAC;IACd;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACrE;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAC1B,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC,CAChE,CAAC;IACF,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,mBAAmB,EACzB,IAAI,EAAE;IACJ,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7C,GACA,eAAe,CA8BjB"}
|
|
@@ -48,9 +48,13 @@ import { deriveContextName, } from '@ggui-ai/protocol/integrations/mcp-apps';
|
|
|
48
48
|
* ships via a non-registry CDN (esm.sh, jsdelivr, …).
|
|
49
49
|
* 2. `entry.bundleHost` + `entry.package` + `entry.version` —
|
|
50
50
|
* hostname resolution: server assembles
|
|
51
|
-
* `https://<bundleHost>/bundles/<scope>/<name>/<version>/bundle.js`
|
|
52
|
-
*
|
|
53
|
-
*
|
|
51
|
+
* `https://<bundleHost>/bundles/public/<scope>/<name>/<version>/bundle.js`
|
|
52
|
+
* — the PUBLIC prefix of `@ggui-ai/registry-core`'s
|
|
53
|
+
* visibility-split `BundleStorage` layout (H1). Host composition
|
|
54
|
+
* serves the anonymous render-time fetch, which only the public
|
|
55
|
+
* prefix answers; private artifacts always arrive as explicit
|
|
56
|
+
* `bundleUrl` values and are presign-rewritten at render-meta
|
|
57
|
+
* time ({@link rewritePrivateBundleUrls}).
|
|
54
58
|
* 3. Spec default `registry.ggui.ai` — applied when `entry.bundleHost`
|
|
55
59
|
* is absent but `package` + `version` are present (first-party
|
|
56
60
|
* hosted-registry default).
|
|
@@ -130,7 +134,15 @@ function resolveGadgetUrlsImpl(entry) {
|
|
|
130
134
|
const host = typeof bundleHost === 'string' && bundleHost.length > 0
|
|
131
135
|
? bundleHost
|
|
132
136
|
: DEFAULT_BUNDLE_HOST;
|
|
133
|
-
|
|
137
|
+
// H1 visibility split: bundleHost-tier composition serves the
|
|
138
|
+
// anonymous render-time fetch, which only the registry's PUBLIC
|
|
139
|
+
// prefix answers — the composed path carries the `public` segment
|
|
140
|
+
// (matches the visibility-split `BundleStorage` layout; pinned by
|
|
141
|
+
// the resolution-conformance catalog). Private artifacts reach
|
|
142
|
+
// the iframe via an explicit `bundleUrl` (presign-rewritten at
|
|
143
|
+
// render-meta time, see `rewritePrivateBundleUrls`), never via
|
|
144
|
+
// host composition.
|
|
145
|
+
return `${bundleHostScheme(host)}://${host}/bundles/public/${pkg}/${version}/${file}`;
|
|
134
146
|
};
|
|
135
147
|
const resolvedBundle = hasExplicitBundleUrl ? bundleUrl : computeFromHost('bundle.js');
|
|
136
148
|
// When the operator explicitly sets `bundleUrl` (the escape-hatch
|
|
@@ -149,6 +161,78 @@ function resolveGadgetUrlsImpl(entry) {
|
|
|
149
161
|
...(resolvedStyle !== undefined ? { styleUrl: resolvedStyle } : {}),
|
|
150
162
|
};
|
|
151
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* URL-path marker of the registry's PRIVATE bundle prefix (H1
|
|
166
|
+
* visibility split) — the substring {@link rewritePrivateBundleUrls}
|
|
167
|
+
* dispatches on.
|
|
168
|
+
*/
|
|
169
|
+
export const PRIVATE_BUNDLE_PREFIX = '/bundles/private/';
|
|
170
|
+
/**
|
|
171
|
+
* H1 ruling 1b — rewrite a render item's PRIVATE gadget bundle URLs
|
|
172
|
+
* into fetchable equivalents at render-meta time.
|
|
173
|
+
*
|
|
174
|
+
* A private artifact's explicit `bundleUrl` / `styleUrl` / `typesUrl`
|
|
175
|
+
* point at the registry's `bundles/private/` prefix, which serves no
|
|
176
|
+
* anonymous request — the sandboxed iframe (which sends no
|
|
177
|
+
* credentials) could never load it. When a `presign` function is
|
|
178
|
+
* supplied, every descriptor URL containing
|
|
179
|
+
* {@link PRIVATE_BUNDLE_PREFIX} is replaced by `await presign(url)` —
|
|
180
|
+
* the hosted deployment presigns a short-lived object-storage URL via
|
|
181
|
+
* its pod task role. Everything else is untouched: public explicit
|
|
182
|
+
* URLs, bundleHost-composed URLs (which are public-prefix by
|
|
183
|
+
* construction, see {@link resolveGadgetUrls}), and descriptors with
|
|
184
|
+
* no URLs at all.
|
|
185
|
+
*
|
|
186
|
+
* **OSS default: passthrough.** Without `presign` the item is returned
|
|
187
|
+
* unchanged — the self-hosted story is same-origin: a self-hoster's
|
|
188
|
+
* iframe and registry share an origin, so its `/bundles/private/…`
|
|
189
|
+
* route can authenticate the fetch itself (cookie/session) or the
|
|
190
|
+
* operator simply publishes render-consumed gadgets public. No
|
|
191
|
+
* presigning infrastructure is required to run the OSS stack.
|
|
192
|
+
*
|
|
193
|
+
* MUST run BEFORE {@link deriveRenderMeta}: both the CSP origin
|
|
194
|
+
* allowlist (`deriveBundleOrigins`) and the iframe registrations
|
|
195
|
+
* (`deriveGadgetRegistrations`) read the descriptor URLs, so the
|
|
196
|
+
* rewritten (presigned) origin lands in `script-src`/`style-src`
|
|
197
|
+
* automatically and the iframe fetches exactly what the CSP allows.
|
|
198
|
+
* Zero iframe changes — the client sees an ordinary absolute URL.
|
|
199
|
+
*
|
|
200
|
+
* Purity note: `deriveRenderMeta` stays pure; this pre-pass is the
|
|
201
|
+
* ONLY projection stage that may perform I/O, and it returns a new
|
|
202
|
+
* item (never mutates) so the WeakMap-memoized URL resolution keys
|
|
203
|
+
* stay correct.
|
|
204
|
+
*/
|
|
205
|
+
export async function rewritePrivateBundleUrls(item, presign) {
|
|
206
|
+
if (presign === undefined)
|
|
207
|
+
return item;
|
|
208
|
+
if (item.type === 'mcpApps' || item.type === 'system')
|
|
209
|
+
return item;
|
|
210
|
+
const descriptors = item.gadgetDescriptors;
|
|
211
|
+
if (descriptors === undefined || descriptors.length === 0)
|
|
212
|
+
return item;
|
|
213
|
+
const maybePresign = async (url) => typeof url === 'string' && url.includes(PRIVATE_BUNDLE_PREFIX)
|
|
214
|
+
? await presign(url)
|
|
215
|
+
: url;
|
|
216
|
+
let changed = false;
|
|
217
|
+
const rewritten = await Promise.all(descriptors.map(async (descriptor) => {
|
|
218
|
+
const bundleUrl = await maybePresign(descriptor.bundleUrl);
|
|
219
|
+
const styleUrl = await maybePresign(descriptor.styleUrl);
|
|
220
|
+
const typesUrl = await maybePresign(descriptor.typesUrl);
|
|
221
|
+
if (bundleUrl === descriptor.bundleUrl &&
|
|
222
|
+
styleUrl === descriptor.styleUrl &&
|
|
223
|
+
typesUrl === descriptor.typesUrl) {
|
|
224
|
+
return descriptor;
|
|
225
|
+
}
|
|
226
|
+
changed = true;
|
|
227
|
+
return {
|
|
228
|
+
...descriptor,
|
|
229
|
+
...(bundleUrl !== undefined ? { bundleUrl } : {}),
|
|
230
|
+
...(styleUrl !== undefined ? { styleUrl } : {}),
|
|
231
|
+
...(typesUrl !== undefined ? { typesUrl } : {}),
|
|
232
|
+
};
|
|
233
|
+
}));
|
|
234
|
+
return changed ? { ...item, gadgetDescriptors: rewritten } : item;
|
|
235
|
+
}
|
|
152
236
|
/**
|
|
153
237
|
* Per-slot contextSpec data for an active render, derived to a
|
|
154
238
|
* wire-friendly array. Returns `undefined` when no slots are declared.
|
|
@@ -601,14 +685,39 @@ export async function deriveContractBundle(item) {
|
|
|
601
685
|
contextSpec: item.contextSpec,
|
|
602
686
|
});
|
|
603
687
|
}
|
|
688
|
+
/**
|
|
689
|
+
* Ceiling on the base64 length {@link deriveRenderMeta} will inline as
|
|
690
|
+
* `codeB64` (256 KiB of base64 ≈ 192 KiB of source). Generated
|
|
691
|
+
* components run 5–50 KB; the cap exists so a pathological render
|
|
692
|
+
* cannot balloon every tool result and resource read it rides on.
|
|
693
|
+
* Over-cap renders keep their `codeUrl` / live-channel delivery.
|
|
694
|
+
*/
|
|
695
|
+
export const CODE_B64_MAX_CHARS = 262_144;
|
|
696
|
+
/**
|
|
697
|
+
* Base64-encode a component render's compiled source for the inline
|
|
698
|
+
* `codeB64` channel. `undefined` for non-component variants, empty
|
|
699
|
+
* source, or over-cap source (see {@link CODE_B64_MAX_CHARS}).
|
|
700
|
+
*/
|
|
701
|
+
function deriveCodeB64(item) {
|
|
702
|
+
if (item.type === 'mcpApps' || item.type === 'system')
|
|
703
|
+
return undefined;
|
|
704
|
+
const code = item.componentCode;
|
|
705
|
+
if (typeof code !== 'string' || code.length === 0)
|
|
706
|
+
return undefined;
|
|
707
|
+
const encoded = Buffer.from(code, 'utf8').toString('base64');
|
|
708
|
+
if (encoded.length > CODE_B64_MAX_CHARS)
|
|
709
|
+
return undefined;
|
|
710
|
+
return encoded;
|
|
711
|
+
}
|
|
604
712
|
/**
|
|
605
713
|
* Build the {@link RenderMetaView} for a render — the
|
|
606
714
|
* single-entry-point projection function every bootstrap transport
|
|
607
715
|
* SHOULD call. Composing transports take the view, spread it into
|
|
608
716
|
* their own envelope alongside render/auth/runtime concerns. The
|
|
609
|
-
* static-component code body
|
|
610
|
-
*
|
|
611
|
-
*
|
|
717
|
+
* static-component code body is delivered via the render handler's
|
|
718
|
+
* `codeUrl` channel (composed from `codeStore` + `codeBaseUrl`) AND —
|
|
719
|
+
* for fetch-blocked hosts — inline via the size-capped `codeB64`
|
|
720
|
+
* field this projection carries.
|
|
612
721
|
*
|
|
613
722
|
* Pure. Same input → identical output, byte-for-byte.
|
|
614
723
|
*/
|
|
@@ -644,8 +753,10 @@ export function deriveRenderMeta(item) {
|
|
|
644
753
|
// system cards theme via the SystemCardHost→ThemeProvider path, not
|
|
645
754
|
// this slice, so `SystemGguiSession` never carries a `theme` sidecar.
|
|
646
755
|
const theme = deriveTheme(item);
|
|
756
|
+
const codeB64 = deriveCodeB64(item);
|
|
647
757
|
return {
|
|
648
758
|
...(propsJson !== undefined ? { propsJson } : {}),
|
|
759
|
+
...(codeB64 !== undefined ? { codeB64 } : {}),
|
|
649
760
|
...(slots !== undefined ? { contextSlots: [...slots] } : {}),
|
|
650
761
|
...(permissionsPolicy !== undefined
|
|
651
762
|
? { permissionsPolicy: [...permissionsPolicy] }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/renders/update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,sBAAsB,EAEtB,KAAK,UAAU,EAEhB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjE,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAGvD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,mBAAmB;IAClC,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtE;AAED;;;wDAGwD;AACxD,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,CAAC;AAE5D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W,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAO/B;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,WAAW;IACf;;;;;OAKG;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;IAEH;;;;;OAKG;;CAEK,CAAC;AAEX,QAAA,MAAM,YAAY;;;IAGhB;;;;;;;;;OASG;;CAEK,CAAC;AAEX,UAAU,YAAY;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,qBAAqB,GAC1B,aAAa,CAAC,OAAO,WAAW,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,CA0RtE"}
|
package/dist/renders/update.js
CHANGED
|
@@ -322,12 +322,15 @@ export function createGguiUpdateHandler(deps) {
|
|
|
322
322
|
* `_meta` (the structuredContent reply is the source of truth).
|
|
323
323
|
*/
|
|
324
324
|
resultMeta: async (output, _input, ctx) => {
|
|
325
|
-
// Load the just-patched render
|
|
326
|
-
//
|
|
327
|
-
// contextSlots / permissionsPolicy / compiledValidators) are
|
|
325
|
+
// Load the just-patched render to derive the projected propsJson
|
|
326
|
+
// AND the inline `codeB64`. The remaining view fields
|
|
327
|
+
// (contextSlots / permissionsPolicy / compiledValidators) are
|
|
328
328
|
// mount-time invariants — the initial render already shipped
|
|
329
329
|
// them, and `ggui_update` patches `props` only, never the
|
|
330
|
-
// contract specs.
|
|
330
|
+
// contract specs. `codeB64` rides updates deliberately: on a
|
|
331
|
+
// fetch-blocked host the iframe repaints by re-seeding from the
|
|
332
|
+
// tool-result meta, and a seed needs a static-content channel —
|
|
333
|
+
// propsJson alone projects to nothing mountable.
|
|
331
334
|
let view = {};
|
|
332
335
|
let renderThemeId;
|
|
333
336
|
// `lastSequence` — monotonic event-ledger cursor stamped on every
|
|
@@ -376,6 +379,7 @@ export function createGguiUpdateHandler(deps) {
|
|
|
376
379
|
: {}),
|
|
377
380
|
...(lastSequence !== undefined ? { lastSequence } : {}),
|
|
378
381
|
...(view.propsJson !== undefined ? { propsJson: view.propsJson } : {}),
|
|
382
|
+
...(view.codeB64 !== undefined ? { codeB64: view.codeB64 } : {}),
|
|
379
383
|
};
|
|
380
384
|
return toMcpAppEnvelope(render);
|
|
381
385
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ggui-ai/mcp-server-handlers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "MCP tool handler logic for the ggui protocol. Pure over @ggui-ai/mcp-server-core seams and consumed by @ggui-ai/mcp-server. Never imports AWS, HTTP transports, or CLI concerns.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ggui",
|
|
@@ -69,17 +69,17 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"zod": "^4.3.6",
|
|
72
|
-
"@ggui-ai/
|
|
73
|
-
"@ggui-ai/negotiator": "0.
|
|
74
|
-
"@ggui-ai/
|
|
75
|
-
"@ggui-ai/ui-gen": "0.
|
|
76
|
-
"@ggui-ai/ui-registry": "0.
|
|
72
|
+
"@ggui-ai/protocol": "0.8.0",
|
|
73
|
+
"@ggui-ai/negotiator": "0.8.0",
|
|
74
|
+
"@ggui-ai/mcp-server-core": "0.8.0",
|
|
75
|
+
"@ggui-ai/ui-gen": "0.8.0",
|
|
76
|
+
"@ggui-ai/ui-registry": "0.8.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@types/node": "^22.0.0",
|
|
80
80
|
"typescript": "^5.0.0",
|
|
81
81
|
"vitest": "^3.2.6",
|
|
82
|
-
"@ggui-ai/protocol-conformance": "0.
|
|
82
|
+
"@ggui-ai/protocol-conformance": "0.8.0"
|
|
83
83
|
},
|
|
84
84
|
"repository": {
|
|
85
85
|
"type": "git",
|