@ggui-ai/mcp-server 0.2.0-alpha.4 → 0.4.0-rc.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/admin-blueprints-transport.d.ts.map +1 -1
- package/dist/admin-blueprints-transport.js +2 -1
- package/dist/admin-oauth-providers-transport.d.ts.map +1 -1
- package/dist/admin-oauth-providers-transport.js +7 -5
- package/dist/api-renders-routes.d.ts +85 -0
- package/dist/api-renders-routes.d.ts.map +1 -0
- package/dist/api-renders-routes.js +372 -0
- package/dist/build-mcp.d.ts +2 -2
- package/dist/build-mcp.d.ts.map +1 -1
- package/dist/build-mcp.js +64 -5
- package/dist/code-routes.d.ts +47 -0
- package/dist/code-routes.d.ts.map +1 -0
- package/dist/code-routes.js +81 -0
- package/dist/code-store-fs.js +2 -2
- package/dist/console-auth.d.ts +10 -10
- package/dist/console-auth.d.ts.map +1 -1
- package/dist/console-auth.js +5 -5
- package/dist/console-blueprint-routes.d.ts +71 -0
- package/dist/console-blueprint-routes.d.ts.map +1 -0
- package/dist/console-blueprint-routes.js +348 -0
- package/dist/console-chat-routes.d.ts +80 -0
- package/dist/console-chat-routes.d.ts.map +1 -0
- package/dist/console-chat-routes.js +204 -0
- package/dist/console-config-routes.d.ts +37 -0
- package/dist/console-config-routes.d.ts.map +1 -0
- package/dist/console-config-routes.js +91 -0
- package/dist/console-headers.d.ts +1 -1
- package/dist/console-info-routes.d.ts +84 -0
- package/dist/console-info-routes.d.ts.map +1 -0
- package/dist/console-info-routes.js +135 -0
- package/dist/console-keys-routes.d.ts +50 -0
- package/dist/console-keys-routes.d.ts.map +1 -0
- package/dist/console-keys-routes.js +222 -0
- package/dist/console-llm-keys-routes.d.ts +47 -0
- package/dist/console-llm-keys-routes.d.ts.map +1 -0
- package/dist/console-llm-keys-routes.js +443 -0
- package/dist/console-mcp-tools-routes.d.ts +41 -0
- package/dist/console-mcp-tools-routes.d.ts.map +1 -0
- package/dist/console-mcp-tools-routes.js +60 -0
- package/dist/console-registry-routes.d.ts +66 -0
- package/dist/console-registry-routes.d.ts.map +1 -0
- package/dist/console-registry-routes.js +276 -0
- package/dist/console-session-routes.d.ts +89 -0
- package/dist/console-session-routes.d.ts.map +1 -0
- package/dist/console-session-routes.js +385 -0
- package/dist/console-sessions-routes.d.ts +52 -0
- package/dist/console-sessions-routes.d.ts.map +1 -0
- package/dist/console-sessions-routes.js +106 -0
- package/dist/console-static-routes.d.ts +54 -0
- package/dist/console-static-routes.d.ts.map +1 -0
- package/dist/console-static-routes.js +190 -0
- package/dist/console-theme-routes.d.ts +3 -3
- package/dist/console-theme-routes.js +1 -1
- package/dist/console-timeline.d.ts +5 -5
- package/dist/console-timeline.d.ts.map +1 -1
- package/dist/console-timeline.js +27 -26
- package/dist/console-welcome.js +2 -2
- package/dist/email-login.d.ts.map +1 -1
- package/dist/email-login.js +2 -3
- package/dist/ggui-session-channel/action-ingress.d.ts +54 -0
- package/dist/ggui-session-channel/action-ingress.d.ts.map +1 -0
- package/dist/ggui-session-channel/action-ingress.js +228 -0
- package/dist/ggui-session-channel/channel-subscriptions.d.ts +97 -0
- package/dist/ggui-session-channel/channel-subscriptions.d.ts.map +1 -0
- package/dist/ggui-session-channel/channel-subscriptions.js +224 -0
- package/dist/ggui-session-channel/internal-types.d.ts +102 -0
- package/dist/ggui-session-channel/internal-types.d.ts.map +1 -0
- package/dist/ggui-session-channel/internal-types.js +6 -0
- package/dist/ggui-session-channel/outbound.d.ts +81 -0
- package/dist/ggui-session-channel/outbound.d.ts.map +1 -0
- package/dist/ggui-session-channel/outbound.js +174 -0
- package/dist/ggui-session-channel/socket-router.d.ts +38 -0
- package/dist/ggui-session-channel/socket-router.d.ts.map +1 -0
- package/dist/ggui-session-channel/socket-router.js +213 -0
- package/dist/ggui-session-channel/subscribe.d.ts +165 -0
- package/dist/ggui-session-channel/subscribe.d.ts.map +1 -0
- package/dist/ggui-session-channel/subscribe.js +370 -0
- package/dist/ggui-session-channel/subscriber-lifecycle.d.ts +40 -0
- package/dist/ggui-session-channel/subscriber-lifecycle.d.ts.map +1 -0
- package/dist/ggui-session-channel/subscriber-lifecycle.js +123 -0
- package/dist/ggui-session-channel.d.ts +425 -0
- package/dist/ggui-session-channel.d.ts.map +1 -0
- package/dist/ggui-session-channel.js +262 -0
- package/dist/health-routes.d.ts +76 -0
- package/dist/health-routes.d.ts.map +1 -0
- package/dist/health-routes.js +145 -0
- package/dist/index.d.ts +10 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -9
- package/dist/instructions-presets.d.ts +3 -3
- package/dist/instructions-presets.js +24 -24
- package/dist/llm-backed-negotiator.d.ts +68 -67
- package/dist/llm-backed-negotiator.d.ts.map +1 -1
- package/dist/llm-backed-negotiator.js +82 -221
- package/dist/mcp-apps-outbound.d.ts +47 -48
- package/dist/mcp-apps-outbound.d.ts.map +1 -1
- package/dist/mcp-apps-outbound.js +154 -177
- package/dist/mcp-endpoint-routes.d.ts +88 -0
- package/dist/mcp-endpoint-routes.d.ts.map +1 -0
- package/dist/mcp-endpoint-routes.js +359 -0
- package/dist/mcp-mounts.d.ts +2 -76
- package/dist/mcp-mounts.d.ts.map +1 -1
- package/dist/mcp-mounts.js +0 -76
- package/dist/oauth-as-routes.d.ts +60 -0
- package/dist/oauth-as-routes.d.ts.map +1 -0
- package/dist/oauth-as-routes.js +82 -0
- package/dist/oauth-clients-routes.d.ts +39 -0
- package/dist/oauth-clients-routes.d.ts.map +1 -0
- package/dist/oauth-clients-routes.js +87 -0
- package/dist/oauth-login-types.d.ts +1 -20
- package/dist/oauth-login-types.d.ts.map +1 -1
- package/dist/oauth-login-types.js +30 -7
- package/dist/oauth-login.d.ts.map +1 -1
- package/dist/oauth-login.js +3 -2
- package/dist/oauth-providers-store.d.ts.map +1 -1
- package/dist/oauth-providers-store.js +5 -5
- package/dist/oauth.d.ts +9 -8
- package/dist/oauth.d.ts.map +1 -1
- package/dist/oauth.js +41 -19
- package/dist/pairing-transport.d.ts.map +1 -1
- package/dist/pairing-transport.js +2 -1
- package/dist/request-context.d.ts +2 -2
- package/dist/request-context.js +2 -2
- package/dist/reserved-validators.d.ts.map +1 -1
- package/dist/reserved-validators.js +9 -1
- package/dist/route-param.d.ts +9 -0
- package/dist/route-param.d.ts.map +1 -0
- package/dist/route-param.js +10 -0
- package/dist/runtime-bundle-route.d.ts +43 -0
- package/dist/runtime-bundle-route.d.ts.map +1 -0
- package/dist/runtime-bundle-route.js +80 -0
- package/dist/schema-compat.d.ts +64 -62
- package/dist/schema-compat.d.ts.map +1 -1
- package/dist/schema-compat.js +23 -51
- package/dist/server.d.ts +179 -193
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +644 -3759
- package/dist/storage.d.ts +5 -5
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +5 -5
- package/dist/thread-transport.d.ts.map +1 -1
- package/dist/thread-transport.js +4 -3
- package/dist/user-session-auth.d.ts +7 -21
- package/dist/user-session-auth.d.ts.map +1 -1
- package/dist/user-session-auth.js +7 -28
- package/package.json +16 -15
- package/dist/mcp-apps-inbound.d.ts +0 -86
- package/dist/mcp-apps-inbound.d.ts.map +0 -1
- package/dist/mcp-apps-inbound.js +0 -283
- package/dist/render-channel.d.ts +0 -694
- package/dist/render-channel.d.ts.map +0 -1
- package/dist/render-channel.js +0 -1775
package/dist/server.d.ts
CHANGED
|
@@ -37,35 +37,46 @@
|
|
|
37
37
|
* handlers wired up. The `Logger.warn('dev_mode_auth_enabled')` fires
|
|
38
38
|
* once at boot so operators see the shape they're running.
|
|
39
39
|
*/
|
|
40
|
-
import type { AppMetadataStore, AuditSink, AuthAdapter, AuthResult, BlueprintProvider, BlueprintSearch, BlueprintSelector, BlueprintStore, CodeStore,
|
|
40
|
+
import type { AppMetadataStore, AuditSink, AuthAdapter, AuthResult, BlueprintIndex, BlueprintProvider, BlueprintSearch, BlueprintSelector, BlueprintStore, CodeStore, EmbeddingProvider, GeneratorRegistry, KeyValueStore, PairingService, PendingEventConsumer, ProviderKeyStore, RateLimiter, GguiSessionStore, GguiSessionStreamBuffer, ShortCodeIndex, TelemetrySink, ThreadStore, VectorStore } from "@ggui-ai/mcp-server-core";
|
|
41
41
|
import type { SharedHandler } from "@ggui-ai/mcp-server-handlers";
|
|
42
42
|
import { type ThemeCatalogEntry } from "@ggui-ai/mcp-server-handlers/app-discovery";
|
|
43
|
-
import type { OperatorConfig } from "@ggui-ai/project-config";
|
|
43
|
+
import type { OperatorConfig, ThemeConfig } from "@ggui-ai/project-config";
|
|
44
44
|
import type { DiscoveredPrimitiveCatalog, LoadedTheme } from "@ggui-ai/project-config/node";
|
|
45
45
|
import type { Blueprint } from "@ggui-ai/protocol";
|
|
46
46
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
47
47
|
import { type Express, type Request } from "express";
|
|
48
48
|
import { Server as NodeHttpServer } from "node:http";
|
|
49
|
-
import {
|
|
49
|
+
import type { ZodRawShape } from "zod";
|
|
50
50
|
import { type ThemeFileUploader, type ThemeWriter } from "./console-theme-routes.js";
|
|
51
51
|
import { type AppsSource, type UserDefaultAppSource } from "@ggui-ai/mcp-server-handlers/ops-apps";
|
|
52
52
|
import { type ConnectorKeysSource } from "@ggui-ai/mcp-server-handlers/ops-connector-keys";
|
|
53
53
|
import { type CouponRedeemSource } from "@ggui-ai/mcp-server-handlers/ops-coupon";
|
|
54
54
|
import { type OrgInvitesSource, type OrgsSource } from "@ggui-ai/mcp-server-handlers/ops-orgs";
|
|
55
|
-
import { type ChannelNotifier, type GenerationCredentials, type GenerationDeps, type HandshakeNegotiator, type PropsUpdateNotifier, type ProvisionalPreviewConfig, type ProvisionalPreviewDeps, type ProvisionalPreviewEmitter, type ProvisionalPreviewOutcome } from "@ggui-ai/mcp-server-handlers/renders";
|
|
55
|
+
import { type ChannelNotifier, type GenerationCredentials, type GenerationDeps, type BlueprintPool, type HandshakeNegotiator, type PropsUpdateNotifier, type ProvisionalPreviewConfig, type ProvisionalPreviewDeps, type ProvisionalPreviewEmitter, type ProvisionalPreviewOutcome, type ToolIdentityCatalogStore } from "@ggui-ai/mcp-server-handlers/renders";
|
|
56
56
|
import type { UiRegistry } from "@ggui-ai/ui-registry";
|
|
57
|
-
import {
|
|
57
|
+
import type { ServerInfo } from "./build-mcp.js";
|
|
58
58
|
import { type EmailSender, type MagicLinkStore } from "./email-login.js";
|
|
59
59
|
import { type McpInstructionsValue } from "./instructions-presets.js";
|
|
60
60
|
import { type Logger } from "./logger.js";
|
|
61
61
|
import { type McpServerMount, type McpService } from "./mcp-mounts.js";
|
|
62
62
|
import { type OAuthConfig } from "./oauth.js";
|
|
63
|
-
import { type
|
|
63
|
+
import { type GguiSessionChannelServer } from "./ggui-session-channel.js";
|
|
64
64
|
import { type SchemaCompatMode } from "./schema-compat.js";
|
|
65
65
|
import { type ThreadOwnerResolver } from "./thread-transport.js";
|
|
66
66
|
export declare function defaultHandlers(deps: {
|
|
67
67
|
readonly embedding: EmbeddingProvider;
|
|
68
68
|
readonly vectors: VectorStore;
|
|
69
|
+
/**
|
|
70
|
+
* Per-app tool-identity catalog store (write side). When bound,
|
|
71
|
+
* registers `ggui_runtime_declare_tool_catalog` — the host runtime's
|
|
72
|
+
* `{ bareToolName -> canonical serverInfo }` declaration is persisted
|
|
73
|
+
* here under `ctx.appId`. The SAME instance the handshake negotiator's
|
|
74
|
+
* `toolIdentityCatalog` resolver reads, so a reused blueprint's tool
|
|
75
|
+
* `serverInfo` is canonicalized before keying. Absent ⇒ the declaration
|
|
76
|
+
* tool is NOT registered (zero-config OSS without the round-trip wired
|
|
77
|
+
* stays clean).
|
|
78
|
+
*/
|
|
79
|
+
readonly toolIdentityCatalogStore?: ToolIdentityCatalogStore;
|
|
69
80
|
/**
|
|
70
81
|
* Optional blueprint catalog source. When bound,
|
|
71
82
|
* `ggui_list_featured_blueprints` enumerates the provider's
|
|
@@ -105,12 +116,12 @@ export declare function defaultHandlers(deps: {
|
|
|
105
116
|
/**
|
|
106
117
|
* Optional render store. When bound, `ggui_handshake` validates
|
|
107
118
|
* the wire render id against this store (existence + tenant
|
|
108
|
-
* ownership) before negotiating.
|
|
109
|
-
* the render-commit handler uses so the handshake catches
|
|
110
|
-
* / cross-tenant ids at the earliest boundary;
|
|
111
|
-
* validate at render-commit time
|
|
119
|
+
* ownership) before negotiating. This server sets it to the same
|
|
120
|
+
* store the render-commit handler uses so the handshake catches
|
|
121
|
+
* unknown / cross-tenant ids at the earliest boundary; deployments
|
|
122
|
+
* that omit it validate at render-commit time instead.
|
|
112
123
|
*/
|
|
113
|
-
readonly renderStore?:
|
|
124
|
+
readonly renderStore?: GguiSessionStore;
|
|
114
125
|
/**
|
|
115
126
|
* Optional negotiator binding. Absent = `ggui_handshake` stamps
|
|
116
127
|
* `action: 'create'` + honest no-negotiator reason on the record
|
|
@@ -135,16 +146,16 @@ export declare function defaultHandlers(deps: {
|
|
|
135
146
|
*/
|
|
136
147
|
readonly serverCapabilities?: () => import("@ggui-ai/protocol").ServerCapabilities | undefined;
|
|
137
148
|
};
|
|
138
|
-
readonly
|
|
139
|
-
readonly renderStore:
|
|
149
|
+
readonly render?: {
|
|
150
|
+
readonly renderStore: GguiSessionStore;
|
|
140
151
|
/**
|
|
141
152
|
* Optional bootstrap-credential minter. When present, `ggui_render`
|
|
142
153
|
* (the renamed render-commit tool) results carry the
|
|
143
154
|
* `ai.ggui/render` slice meta. When absent, they don't —
|
|
144
|
-
* non-MCP-Apps hosts read `{
|
|
155
|
+
* non-MCP-Apps hosts read `{sessionId}` off structuredContent and
|
|
145
156
|
* resolve the render-resource themselves.
|
|
146
157
|
*/
|
|
147
|
-
readonly mintBootstrap?: (
|
|
158
|
+
readonly mintBootstrap?: (sessionId: string, appId: string) => {
|
|
148
159
|
wsUrl: string;
|
|
149
160
|
token: string;
|
|
150
161
|
expiresAt: string;
|
|
@@ -175,24 +186,18 @@ export declare function defaultHandlers(deps: {
|
|
|
175
186
|
/** Theme color mode resolved from `ggui.json#theme.mode`. */
|
|
176
187
|
readonly themeMode?: "light" | "dark";
|
|
177
188
|
/**
|
|
178
|
-
* Live theme getter — resolved per-
|
|
179
|
-
* the static `themeId` / `themeMode` for every
|
|
189
|
+
* Live theme getter — resolved per-render. When set, supersedes
|
|
190
|
+
* the static `themeId` / `themeMode` for every render's bootstrap.
|
|
180
191
|
* Pair with the same getter passed into `createGguiServer({
|
|
181
192
|
* themeProvider })` and a closure that reads from the shared
|
|
182
193
|
* mutable cell `mountDevtoolThemeRoutes`'s POST handler updates.
|
|
183
|
-
* Forwarded onto `deps.
|
|
194
|
+
* Forwarded onto `deps.render.themeProvider` so the handler reads
|
|
184
195
|
* the live theme each call.
|
|
185
196
|
*/
|
|
186
197
|
readonly themeProvider?: () => {
|
|
187
198
|
readonly id?: string;
|
|
188
199
|
readonly mode?: "light" | "dark";
|
|
189
200
|
} | undefined;
|
|
190
|
-
/**
|
|
191
|
-
* Optional connector registry — required for accepting
|
|
192
|
-
* `shortcuts.mcpApps` push payloads (inbound MCP Apps hosting).
|
|
193
|
-
* Omitted = inbound path is rejected with a clear error.
|
|
194
|
-
*/
|
|
195
|
-
readonly connectors?: ConnectorRegistry;
|
|
196
201
|
/**
|
|
197
202
|
* Optional admission-control limiter. When present, `ggui_render`
|
|
198
203
|
* gates every call through `rateLimiter.check({key:
|
|
@@ -202,23 +207,22 @@ export declare function defaultHandlers(deps: {
|
|
|
202
207
|
*/
|
|
203
208
|
readonly rateLimiter?: RateLimiter;
|
|
204
209
|
/**
|
|
205
|
-
* Optional shortCode →
|
|
210
|
+
* Optional shortCode → render binding index. When present,
|
|
206
211
|
* `ggui_render` records every minted `shortCode` so console's
|
|
207
|
-
* `/s/<shortCode>` viewer (via the
|
|
208
|
-
* resolve it back to the right
|
|
212
|
+
* `/s/<shortCode>` viewer (via the render-cookie endpoint) can
|
|
213
|
+
* resolve it back to the right render. Absent = hosted cloud
|
|
209
214
|
* flow (DynamoDB side-table owns lookups), or console not
|
|
210
215
|
* enabled.
|
|
211
216
|
*/
|
|
212
217
|
readonly shortCodeIndex?: ShortCodeIndex;
|
|
213
218
|
/**
|
|
214
219
|
* Optional provisional-preview wiring. When present, `ggui_render`
|
|
215
|
-
* kicks off the configured emitter on every qualifying
|
|
216
|
-
* `evaluateProvisionalPreviewGate` predicate filters
|
|
217
|
-
*
|
|
218
|
-
* channel traffic.
|
|
220
|
+
* kicks off the configured emitter on every qualifying render (the
|
|
221
|
+
* `evaluateProvisionalPreviewGate` predicate filters storyless
|
|
222
|
+
* calls automatically). Absent = no preview channel traffic.
|
|
219
223
|
*
|
|
220
224
|
* Constructed by `createGguiServer` from `opts.provisionalPreview`
|
|
221
|
-
* plus the late-bound `
|
|
225
|
+
* plus the late-bound `GguiSessionChannelServer.sendToGguiSession`
|
|
222
226
|
* closure; callers threading their own handler set can build
|
|
223
227
|
* `ProvisionalPreviewDeps` directly.
|
|
224
228
|
*/
|
|
@@ -226,8 +230,8 @@ export declare function defaultHandlers(deps: {
|
|
|
226
230
|
/**
|
|
227
231
|
* Optional generation wiring. When present, `ggui_render` invokes
|
|
228
232
|
* the supplied {@link UiGenerator} on every story-path call and
|
|
229
|
-
* commits the generated `
|
|
230
|
-
* true`. Absent =
|
|
233
|
+
* commits the generated `GguiSession` before returning `codeReady:
|
|
234
|
+
* true`. Absent = render stays in placeholder mode (render +
|
|
231
235
|
* shortCode + preview still work, but no componentCode is
|
|
232
236
|
* produced).
|
|
233
237
|
*
|
|
@@ -252,7 +256,7 @@ export declare function defaultHandlers(deps: {
|
|
|
252
256
|
/**
|
|
253
257
|
* Optional F4 schema compat check hook. When present,
|
|
254
258
|
* `ggui_render` invokes it immediately
|
|
255
|
-
* before every `renderStore.commit` — if the pending
|
|
259
|
+
* before every `renderStore.commit` — if the pending GguiSession's
|
|
256
260
|
* `actionSpec` / `streamSpec` references a tool whose schemas
|
|
257
261
|
* disagree, the hook throws `SchemaCompatError` and the handler
|
|
258
262
|
* converts the rejection into an error render + `codeReady:
|
|
@@ -260,7 +264,7 @@ export declare function defaultHandlers(deps: {
|
|
|
260
264
|
*
|
|
261
265
|
* `createGguiServer` binds this closure against the composed
|
|
262
266
|
* `handlers` list + `opts.schemaCompatCheck` (default `'reject'`)
|
|
263
|
-
* automatically; callers composing their own
|
|
267
|
+
* automatically; callers composing their own render handler via
|
|
264
268
|
* `defaultHandlers` wire the hook themselves.
|
|
265
269
|
*/
|
|
266
270
|
readonly checkRenderContracts?: (shape: {
|
|
@@ -275,7 +279,7 @@ export declare function defaultHandlers(deps: {
|
|
|
275
279
|
* post-T3-1 (2026-05-13).
|
|
276
280
|
*
|
|
277
281
|
* Absent: `ggui_render.resultMeta` omits `codeUrl`. The iframe boots
|
|
278
|
-
* via live-mode (wsUrl+token) and receives the
|
|
282
|
+
* via live-mode (wsUrl+token) and receives the render via the
|
|
279
283
|
* live-channel WS subscribe. `/r/<shortCode>` (HTML default; JSON branch on `Accept: application/json`)
|
|
280
284
|
* routes ALSO mint `codeUrl` when `codeStore` is set — they derive
|
|
281
285
|
* the base URL from `req.protocol + req.host` when `codeBaseUrl`
|
|
@@ -307,11 +311,11 @@ export declare function defaultHandlers(deps: {
|
|
|
307
311
|
readonly streamWebSocketLocalTools?: () => readonly string[] | undefined;
|
|
308
312
|
/**
|
|
309
313
|
* Optional bootstrap-refresh seam for the
|
|
310
|
-
* `
|
|
314
|
+
* `ggui_runtime_refresh_ws_token` tool (G14, 2026-05-23). When
|
|
311
315
|
* supplied, the tool registers and validates each refresh request
|
|
312
316
|
* via this seam's HMAC check + refresh-window arithmetic. Typically
|
|
313
317
|
* wired against the SAME `channelBootstrap.refresh` the
|
|
314
|
-
*
|
|
318
|
+
* render-channel server uses for WS upgrade validation, so both
|
|
315
319
|
* paths share one HMAC secret and one refresh-window policy.
|
|
316
320
|
*
|
|
317
321
|
* Absent: the tool is NOT registered on this deployment. iframes
|
|
@@ -320,15 +324,16 @@ export declare function defaultHandlers(deps: {
|
|
|
320
324
|
* a stateless refresh.
|
|
321
325
|
*
|
|
322
326
|
* `createGguiServer` wires this from the `mcpAppsEnabled` branch's
|
|
323
|
-
* `channelBootstrap.refresh` so the
|
|
324
|
-
*
|
|
327
|
+
* `channelBootstrap.refresh` so the factory's behavior matches the
|
|
328
|
+
* tool-side composition every deployment of this server family
|
|
329
|
+
* uses.
|
|
325
330
|
*/
|
|
326
331
|
readonly bootstrapRefresh?: import("@ggui-ai/mcp-server-handlers/renders").WsTokenRefreshSeam;
|
|
327
332
|
};
|
|
328
333
|
/**
|
|
329
334
|
* `ggui_update` wiring. When present, register the OSS update
|
|
330
|
-
* handler against the supplied
|
|
331
|
-
* props_update notifier. The handler reads `
|
|
335
|
+
* handler against the supplied GguiSessionStore + optional live-channel
|
|
336
|
+
* props_update notifier. The handler reads `sessionId` from wire
|
|
332
337
|
* input today, but a future in-process dispatcher can populate it
|
|
333
338
|
* on the canonical context.
|
|
334
339
|
*
|
|
@@ -337,10 +342,10 @@ export declare function defaultHandlers(deps: {
|
|
|
337
342
|
* static-blueprint demos, MCP-Apps-only deployments).
|
|
338
343
|
*/
|
|
339
344
|
readonly update?: {
|
|
340
|
-
readonly renderStore:
|
|
345
|
+
readonly renderStore: GguiSessionStore;
|
|
341
346
|
/**
|
|
342
347
|
* Optional live-subscriber `props_update` notifier — typically a
|
|
343
|
-
* thin closure over `
|
|
348
|
+
* thin closure over `GguiSessionChannelServer.sendPropsUpdate`.
|
|
344
349
|
* Forwarded as-is to `createGguiUpdateHandler`. Hosts without a
|
|
345
350
|
* render channel leave this absent; the handler still persists
|
|
346
351
|
* via `renderStore.commit` on every successful patch.
|
|
@@ -355,14 +360,14 @@ export declare function defaultHandlers(deps: {
|
|
|
355
360
|
* the same field on `render` deps; composing hosts wire both from
|
|
356
361
|
* the same minter.
|
|
357
362
|
*/
|
|
358
|
-
readonly mintBootstrap?: (
|
|
363
|
+
readonly mintBootstrap?: (sessionId: string, appId: string) => {
|
|
359
364
|
wsUrl: string;
|
|
360
365
|
token: string;
|
|
361
366
|
expiresAt: string;
|
|
362
367
|
};
|
|
363
368
|
/** Iframe-runtime bundle URL forwarded onto the
|
|
364
369
|
* `ai.ggui/render.runtimeUrl` slice field.
|
|
365
|
-
* Function form mirrors
|
|
370
|
+
* Function form mirrors the `render` deps' `runtimeUrl`. */
|
|
366
371
|
readonly runtimeUrl?: string | (() => string | undefined);
|
|
367
372
|
/** Theme preset id forwarded onto the `ai.ggui/render.themeId` slice field. */
|
|
368
373
|
readonly themeId?: string;
|
|
@@ -373,13 +378,9 @@ export declare function defaultHandlers(deps: {
|
|
|
373
378
|
readonly id?: string;
|
|
374
379
|
readonly mode?: "light" | "dark";
|
|
375
380
|
} | undefined;
|
|
376
|
-
/** Returns names of app-visible tools for bootstrap.appCallableTools. */
|
|
377
|
-
readonly appCallableTools?: () => readonly string[];
|
|
378
|
-
/** Resolver for bootstrap.streamWebSocketLocalTools. */
|
|
379
|
-
readonly streamWebSocketLocalTools?: () => readonly string[] | undefined;
|
|
380
381
|
};
|
|
381
382
|
/**
|
|
382
|
-
* Pending-events consumer wiring for `ggui_consume`. When `
|
|
383
|
+
* Pending-events consumer wiring for `ggui_consume`. When `render`
|
|
383
384
|
* is bound, the handler registers automatically with an in-memory
|
|
384
385
|
* default; pass `consume.pendingEventConsumer` to override (e.g.,
|
|
385
386
|
* SQLite-backed for persistent dev or a Dynamo adapter on cloud).
|
|
@@ -393,10 +394,10 @@ export declare function defaultHandlers(deps: {
|
|
|
393
394
|
readonly defaultRenderTtlSeconds?: number;
|
|
394
395
|
};
|
|
395
396
|
/**
|
|
396
|
-
* Stream channel wiring for `ggui_emit`. When `
|
|
397
|
+
* Stream channel wiring for `ggui_emit`. When `render` is bound, the
|
|
397
398
|
* handler registers automatically; its `sendEnvelope` closes over
|
|
398
399
|
* `stream.channelProvider`, a lazy getter that resolves the
|
|
399
|
-
* `
|
|
400
|
+
* `GguiSessionChannelServer` at emit time (the channel is constructed
|
|
400
401
|
* AFTER `defaultHandlers` runs, so a static reference would always
|
|
401
402
|
* be null on the OSS in-process boot).
|
|
402
403
|
*
|
|
@@ -405,10 +406,10 @@ export declare function defaultHandlers(deps: {
|
|
|
405
406
|
* cloud's `ggui_emit_accepted_no_receiver` posture.
|
|
406
407
|
*
|
|
407
408
|
* The getter pattern lets the OSS server bind once at boot, then
|
|
408
|
-
* mutate the cell after `
|
|
409
|
+
* mutate the cell after `createGguiSessionChannelServer` runs.
|
|
409
410
|
*/
|
|
410
411
|
readonly stream?: {
|
|
411
|
-
readonly channelProvider?: () =>
|
|
412
|
+
readonly channelProvider?: () => GguiSessionChannelServer | null;
|
|
412
413
|
};
|
|
413
414
|
/**
|
|
414
415
|
* Structured-event logger threaded into handlers that emit
|
|
@@ -462,7 +463,7 @@ export declare function defaultHandlers(deps: {
|
|
|
462
463
|
* blueprint tools on `/ops`:
|
|
463
464
|
*
|
|
464
465
|
* - `ggui_ops_generate_blueprint` (requires `resolveLlm` +
|
|
465
|
-
* `blueprints` too — same deps the
|
|
466
|
+
* `blueprints` too — same deps the render generation path
|
|
466
467
|
* reads).
|
|
467
468
|
* - `ggui_ops_list_blueprints`
|
|
468
469
|
* - `ggui_ops_update_blueprint`
|
|
@@ -495,7 +496,7 @@ export declare function defaultHandlers(deps: {
|
|
|
495
496
|
readonly listAllForApp?: (appId: string) => Promise<readonly Blueprint[]>;
|
|
496
497
|
/**
|
|
497
498
|
* Resolver for LLM credentials on the generate path. Same shape
|
|
498
|
-
* as `
|
|
499
|
+
* as `render.generation.resolveLlm` — typically wired to the same
|
|
499
500
|
* closure. When absent, the generate handler is NOT registered
|
|
500
501
|
* (list/update/delete still register).
|
|
501
502
|
*/
|
|
@@ -511,12 +512,13 @@ export declare function defaultHandlers(deps: {
|
|
|
511
512
|
* Cache-registry mirror for `ggui_ops_generate_blueprint`. When
|
|
512
513
|
* bound, operator-authored blueprints are dual-written to the
|
|
513
514
|
* cache vectorStore via `registerBlueprint` so the agent-facing
|
|
514
|
-
* matchBlueprint exact-key probe (handshake +
|
|
515
|
-
* Same bundle the
|
|
515
|
+
* matchBlueprint exact-key probe (handshake + render) finds them.
|
|
516
|
+
* Same bundle the render handler reads/writes.
|
|
516
517
|
*/
|
|
517
518
|
readonly cacheRegistry?: {
|
|
518
519
|
readonly embedding: EmbeddingProvider;
|
|
519
520
|
readonly vectorStore: VectorStore;
|
|
521
|
+
readonly index: BlueprintIndex;
|
|
520
522
|
};
|
|
521
523
|
};
|
|
522
524
|
/**
|
|
@@ -584,7 +586,7 @@ export interface CreateGguiServerOptions {
|
|
|
584
586
|
* `['user']`-only handlers without affecting the existing toolset
|
|
585
587
|
* (which is all `['app', 'builder']`).
|
|
586
588
|
* - end-user / Connector posture sets `['user']` — skips all
|
|
587
|
-
* agent-builder writes (
|
|
589
|
+
* agent-builder writes (render / handshake / update) while keeping
|
|
588
590
|
* the read-only blueprint surface visible.
|
|
589
591
|
* - OSS local omits this option — every handler registers; OSS
|
|
590
592
|
* callers resolve to `kind: 'builder'` and the filter never fires.
|
|
@@ -604,6 +606,16 @@ export interface CreateGguiServerOptions {
|
|
|
604
606
|
* Vector store for blueprint search. Defaults to `InMemoryVectorStore`.
|
|
605
607
|
*/
|
|
606
608
|
readonly vectors?: VectorStore;
|
|
609
|
+
/**
|
|
610
|
+
* Blueprint identity index — resolves `(scope, exactKey) → blueprintId`
|
|
611
|
+
* without a scope scan. Defaults to `InMemoryBlueprintIndex`. Operators
|
|
612
|
+
* who wire a persistent `vectors` store SHOULD pass a matching
|
|
613
|
+
* persistent index (e.g. `SqliteBlueprintIndex`) so the binding survives
|
|
614
|
+
* a restart. Threaded into the generation cache + every
|
|
615
|
+
* `BlueprintRegistryDeps` the server builds so the matcher + registry
|
|
616
|
+
* share one instance.
|
|
617
|
+
*/
|
|
618
|
+
readonly index?: BlueprintIndex;
|
|
607
619
|
/**
|
|
608
620
|
* Embedding provider for blueprint search. Defaults to `MockEmbeddingProvider`
|
|
609
621
|
* — produces deterministic but NOT semantically meaningful vectors.
|
|
@@ -626,6 +638,24 @@ export interface CreateGguiServerOptions {
|
|
|
626
638
|
* cross-handler sharing) and `ggui_list_themes` is NOT registered.
|
|
627
639
|
*/
|
|
628
640
|
readonly appMetadataStore?: AppMetadataStore;
|
|
641
|
+
/**
|
|
642
|
+
* Per-app tool-identity catalog store — the shared persistence seam
|
|
643
|
+
* for cross-runtime tool-identity canonicalization. The SAME instance
|
|
644
|
+
* is wired into BOTH sides of the round-trip:
|
|
645
|
+
* - WRITE: the `ggui_runtime_declare_tool_catalog` handler (the host
|
|
646
|
+
* runtime declares `{ bareToolName -> canonical serverInfo }` on
|
|
647
|
+
* connect).
|
|
648
|
+
* - READ: the handshake decision adapter's `toolIdentityCatalog`
|
|
649
|
+
* resolver, so a reused blueprint's tool `serverInfo` is rewritten
|
|
650
|
+
* to the canonical identity before keying (framework-invariant
|
|
651
|
+
* reuse).
|
|
652
|
+
*
|
|
653
|
+
* Absent ⇒ `createGguiServer` constructs a single shared
|
|
654
|
+
* `InMemoryToolIdentityCatalogStore` and threads it into both sides
|
|
655
|
+
* (mirrors the `appMetadataStore` default). Hosted deployments bind a
|
|
656
|
+
* multi-tenant adapter.
|
|
657
|
+
*/
|
|
658
|
+
readonly toolIdentityCatalogStore?: ToolIdentityCatalogStore;
|
|
629
659
|
/**
|
|
630
660
|
* Global theme-catalog resolver. When bound alongside
|
|
631
661
|
* `appMetadataStore`, registers `ggui_list_themes` and projects the
|
|
@@ -768,7 +798,7 @@ export interface CreateGguiServerOptions {
|
|
|
768
798
|
* `mode` into the `ai.ggui/render` slice meta. Pair with
|
|
769
799
|
* {@link onThemeConfigChange} so a console save updates the
|
|
770
800
|
* shared state cell the closure reads from. The cell pattern
|
|
771
|
-
* closes the parallel-state-stores bug where the
|
|
801
|
+
* closes the parallel-state-stores bug where the render handler
|
|
772
802
|
* captured `themeId` at boot from the static `theme` opt and
|
|
773
803
|
* silently ignored every subsequent ggui.json edit until restart.
|
|
774
804
|
*
|
|
@@ -786,22 +816,15 @@ export interface CreateGguiServerOptions {
|
|
|
786
816
|
* `/upload` variant). Forwarded onto
|
|
787
817
|
* `mountDevtoolThemeRoutes({onConfigChange})`. Pair with a
|
|
788
818
|
* `themeProvider` closure that reads from the same shared cell
|
|
789
|
-
* the callback writes to so a console save reaches the next
|
|
819
|
+
* the callback writes to so a console save reaches the next render
|
|
790
820
|
* without restarting the server.
|
|
791
821
|
*
|
|
792
|
-
* `next`
|
|
822
|
+
* `next` is `ThemeConfig` from `@ggui-ai/project-config` —
|
|
793
823
|
* one of: a string shorthand (`'indigo'`), a preset object
|
|
794
824
|
* (`{ preset, mode?, overrides? }`), a file object
|
|
795
825
|
* (`{ file, mode? }`), or `null` (cleared).
|
|
796
826
|
*/
|
|
797
|
-
readonly onThemeConfigChange?: (next:
|
|
798
|
-
preset: string;
|
|
799
|
-
mode?: "light" | "dark";
|
|
800
|
-
overrides?: Record<string, string>;
|
|
801
|
-
} | {
|
|
802
|
-
file: string;
|
|
803
|
-
mode?: "light" | "dark";
|
|
804
|
-
} | null) => void;
|
|
827
|
+
readonly onThemeConfigChange?: (next: ThemeConfig | null) => void;
|
|
805
828
|
/**
|
|
806
829
|
* Map a resolved identity to the `appId` used by handlers for tenant
|
|
807
830
|
* scoping. Defaults to `defaultAppIdFromIdentity` — single-user
|
|
@@ -811,9 +834,9 @@ export interface CreateGguiServerOptions {
|
|
|
811
834
|
readonly appIdFromIdentity?: (result: AuthResult) => string;
|
|
812
835
|
/**
|
|
813
836
|
* Path the universal MCP endpoint mounts at. Defaults to `/mcp` per
|
|
814
|
-
* Streamable HTTP convention.
|
|
815
|
-
* (bare root) so URLs
|
|
816
|
-
* no need to repeat it in the path.
|
|
837
|
+
* Streamable HTTP convention. A deployment on a dedicated MCP
|
|
838
|
+
* domain may override to `/` (bare root) so URLs stay short — the
|
|
839
|
+
* domain already says "mcp", no need to repeat it in the path.
|
|
817
840
|
*
|
|
818
841
|
* Threaded into the well-known protected-resource metadata so OAuth
|
|
819
842
|
* clients discover the right resource URL, and into the route table
|
|
@@ -822,37 +845,39 @@ export interface CreateGguiServerOptions {
|
|
|
822
845
|
readonly universalMcpPath?: string;
|
|
823
846
|
/**
|
|
824
847
|
* Per-tenant URL routing. When set, the factory
|
|
825
|
-
* additionally mounts `${pathPrefix}/:${paramName}
|
|
848
|
+
* additionally mounts `${pathPrefix}/:${paramName}`
|
|
826
849
|
* alongside the universal path. The shared handler reads
|
|
827
850
|
* `req.params[paramName]` and uses it as `ctx.appId`, overriding
|
|
828
851
|
* `appIdFromIdentity` for that request.
|
|
829
852
|
*
|
|
830
|
-
*
|
|
853
|
+
* A multi-tenant deployment passes e.g. `{paramName: 'appId',
|
|
831
854
|
* paramPattern: '[A-Za-z0-9]{8}', pathPrefix: '/apps'}` so URLs
|
|
832
|
-
* like `
|
|
833
|
-
* that specific
|
|
855
|
+
* like `example.com/apps/aB3kP9xY` route to a session scoped to
|
|
856
|
+
* that specific app. The `/apps/` prefix segments the
|
|
834
857
|
* namespace cleanly — no risk of an 8-char appId colliding with a
|
|
835
858
|
* bare-root system route like `/health` or `/settings`.
|
|
836
859
|
*
|
|
837
860
|
* Without `pathPrefix`, the route mounts at the bare
|
|
838
|
-
* `/:${paramName}
|
|
839
|
-
*
|
|
840
|
-
*
|
|
861
|
+
* `/:${paramName}` — useful only when the deployment owns the
|
|
862
|
+
* entire URL space and the pattern guarantees no collision
|
|
863
|
+
* (e.g. UUIDs).
|
|
841
864
|
*
|
|
842
|
-
* Pattern is
|
|
843
|
-
*
|
|
844
|
-
*
|
|
865
|
+
* Pattern is a JS regex source (no slashes, no flags). `path-to-
|
|
866
|
+
* regexp` v8 (express@5) dropped inline `:param(pattern)` route
|
|
867
|
+
* syntax, so the factory enforces `paramPattern` with an `app.param`
|
|
868
|
+
* validator (anchored full-match) rather than baking it into the
|
|
869
|
+
* route string; a malformed appId 404s before reaching the handler.
|
|
845
870
|
*
|
|
846
871
|
* `authorize` is the deployment-specific access check. After auth
|
|
847
872
|
* resolves but before session work begins, the handler invokes it
|
|
848
873
|
* with the URL-supplied appId + identity. Throw to deny — the
|
|
849
874
|
* handler converts to a 403 response and skips MCP processing.
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
*
|
|
854
|
-
* authorize callback are TRUSTED — every authenticated
|
|
855
|
-
* scope to any URL appId.
|
|
875
|
+
* Multi-tenant deployments use this to verify the resolved identity
|
|
876
|
+
* owns the URL-addressed app — this is the boundary that prevents
|
|
877
|
+
* cross-user blueprint reads when downstream stores don't enforce
|
|
878
|
+
* ownership themselves. Deployments that opt in to per-app routing
|
|
879
|
+
* without an authorize callback are TRUSTED — every authenticated
|
|
880
|
+
* caller can scope to any URL appId.
|
|
856
881
|
*/
|
|
857
882
|
readonly perAppRouting?: {
|
|
858
883
|
readonly paramName: string;
|
|
@@ -879,7 +904,7 @@ export interface CreateGguiServerOptions {
|
|
|
879
904
|
* preserves the default.
|
|
880
905
|
*
|
|
881
906
|
* Use case: hosted closed-runtime deployments throw domain errors from
|
|
882
|
-
* tool handlers (e.g. `
|
|
907
|
+
* tool handlers (e.g. `GguiSessionAccessError` "this render doesn't belong
|
|
883
908
|
* to you") that should map to HTTP 404 so callers can distinguish
|
|
884
909
|
* tenancy violations from real server bugs. OSS deployments don't
|
|
885
910
|
* need this seam — every domain error is a 500 unless they say
|
|
@@ -962,30 +987,30 @@ export interface CreateGguiServerOptions {
|
|
|
962
987
|
/** Express body size limit. Defaults to `'4mb'`. */
|
|
963
988
|
readonly bodyLimit?: string;
|
|
964
989
|
/**
|
|
965
|
-
*
|
|
990
|
+
* GguiSession store — backing plane for the live-channel render endpoint
|
|
966
991
|
* (and OSS render-reading MCP tools). Defaults to
|
|
967
|
-
* `
|
|
992
|
+
* `InMemoryGguiSessionStore`, which is fine for OSS zero-config / dev.
|
|
968
993
|
* SQLite / Postgres / Redis adapters bind via the same interface
|
|
969
994
|
* when they land.
|
|
970
995
|
*/
|
|
971
|
-
readonly renderStore?:
|
|
996
|
+
readonly renderStore?: GguiSessionStore;
|
|
972
997
|
/**
|
|
973
998
|
* Outbound stream replay buffer for the live-channel endpoint. Defaults
|
|
974
|
-
* to a fresh `
|
|
999
|
+
* to a fresh `InMemoryGguiSessionStreamBuffer` — fine for OSS zero-config
|
|
975
1000
|
* / dev. Operators who need durability layer a different
|
|
976
|
-
* `
|
|
1001
|
+
* `GguiSessionStreamBuffer` implementation behind this seam.
|
|
977
1002
|
*
|
|
978
|
-
* Only used when `
|
|
1003
|
+
* Only used when `renderChannel` is enabled. Ignored otherwise.
|
|
979
1004
|
*/
|
|
980
|
-
readonly streamBuffer?:
|
|
1005
|
+
readonly streamBuffer?: GguiSessionStreamBuffer;
|
|
981
1006
|
/**
|
|
982
|
-
* Enable the OSS live-channel
|
|
1007
|
+
* Enable the OSS live-channel render endpoint at `/ws` (configurable).
|
|
983
1008
|
*
|
|
984
|
-
* - `false` (default): no
|
|
1009
|
+
* - `false` (default): no render channel. `/mcp` is the only
|
|
985
1010
|
* HTTP surface. Callers who only need the tool plane get the
|
|
986
1011
|
* smallest shape.
|
|
987
1012
|
* - `true`: mount the channel at the default path (`/ws`) with
|
|
988
|
-
* the default
|
|
1013
|
+
* the default render store.
|
|
989
1014
|
* - `{ path?: string }`: override the mount path.
|
|
990
1015
|
*
|
|
991
1016
|
* The live channel is where the live-contract enforcement point
|
|
@@ -993,41 +1018,13 @@ export interface CreateGguiServerOptions {
|
|
|
993
1018
|
* of the shared `@ggui-ai/mcp-server-handlers/renders`
|
|
994
1019
|
* helpers.
|
|
995
1020
|
*/
|
|
996
|
-
readonly
|
|
1021
|
+
readonly renderChannel?: boolean | {
|
|
997
1022
|
readonly path?: string;
|
|
998
1023
|
};
|
|
999
|
-
/**
|
|
1000
|
-
* Opt-in WS-direct action dispatcher for agent-less deployments.
|
|
1001
|
-
* When present AND `sessionChannel: true`, the channel server
|
|
1002
|
-
* fires the tool named by an incoming action's `payload.tool` hint
|
|
1003
|
-
* (falling back to `actionSpec[name].nextStep` when the client
|
|
1004
|
-
* omitted the hint) in-process after inbound validation, and emits
|
|
1005
|
-
* every declared `streamSpec[name].source.tool` refresh on the
|
|
1006
|
-
* session. See {@link WiredActionRouter} + `session-channel.ts` for
|
|
1007
|
-
* the full router contract.
|
|
1008
|
-
*
|
|
1009
|
-
* Absent = agent-mediated behavior (canonical for MCP Apps hosts and
|
|
1010
|
-
* Claude Agent SDK consumers). Inbound actions land on the
|
|
1011
|
-
* renderId-keyed pending-events pipe via `ggui_runtime_submit_action`
|
|
1012
|
-
* and the agent's `ggui_consume` long-poll drains them. CLI
|
|
1013
|
-
* composition in `ggui serve` wires a router by default over the
|
|
1014
|
-
* same handler bundle `/mcp` uses, since that command runs WITHOUT
|
|
1015
|
-
* an agent (raw WS clients hitting the OSS server directly). Library
|
|
1016
|
-
* consumers MAY pass their own router; library consumers running
|
|
1017
|
-
* behind an agent typically pass `undefined` so actions flow through
|
|
1018
|
-
* the agent's reasoning loop.
|
|
1019
|
-
*/
|
|
1020
|
-
readonly wiredActionRouter?: WiredActionRouter;
|
|
1021
|
-
/**
|
|
1022
|
-
* Per-call timeout for wired-tool invocations, in ms. Defaults to
|
|
1023
|
-
* `DEFAULT_WIRED_TOOL_TIMEOUT_MS` (30 s) when omitted. Forwarded
|
|
1024
|
-
* verbatim to `createRenderChannelServer`.
|
|
1025
|
-
*/
|
|
1026
|
-
readonly wiredActionTimeoutMs?: number;
|
|
1027
1024
|
/**
|
|
1028
1025
|
* Opt-in plumbing for `channel_subscribe` polling — the WS fan-out
|
|
1029
1026
|
* path for `streamSpec[*].source.tool`. When present, the
|
|
1030
|
-
*
|
|
1027
|
+
* render channel accepts `channel_subscribe` frames whose
|
|
1031
1028
|
* `source.tool` is in `allowlist` and begins polling. When absent
|
|
1032
1029
|
* (the OSS first-run zero-config posture), every `channel_subscribe`
|
|
1033
1030
|
* rejects with `CHANNEL_NOT_LOCAL` so the iframe falls back to
|
|
@@ -1038,49 +1035,39 @@ export interface CreateGguiServerOptions {
|
|
|
1038
1035
|
* `serverCapabilities.streamWebSocketLocalTools` so `@ggui-ai/wire`
|
|
1039
1036
|
* agrees with the server on which channels use WS fan-out.
|
|
1040
1037
|
*
|
|
1041
|
-
* Only consulted when `
|
|
1042
|
-
* verbatim to `
|
|
1043
|
-
* `
|
|
1038
|
+
* Only consulted when `renderChannel` is enabled. Forwarded
|
|
1039
|
+
* verbatim to `createGguiSessionChannelServer` (see
|
|
1040
|
+
* `GguiSessionChannelOptions.streamWebSocketLocalTools`).
|
|
1044
1041
|
*/
|
|
1045
|
-
readonly streamWebSocketLocalTools?: import("./
|
|
1042
|
+
readonly streamWebSocketLocalTools?: import("./ggui-session-channel.js").GguiSessionChannelLocalToolsOptions;
|
|
1046
1043
|
/**
|
|
1047
1044
|
* Hook fired when the local subscriber count for `sessionId`
|
|
1048
1045
|
* transitions 0 → 1 on the live channel. Forwarded verbatim to
|
|
1049
|
-
* `
|
|
1046
|
+
* `createGguiSessionChannelServer`. Used by cloud adapters for per-render
|
|
1050
1047
|
* cross-pod pubsub channel scoping; OSS callers leave this undefined.
|
|
1051
1048
|
*
|
|
1052
|
-
* Only consulted when `
|
|
1053
|
-
* `
|
|
1049
|
+
* Only consulted when `renderChannel` is enabled. See
|
|
1050
|
+
* `GguiSessionChannelOptions.onFirstSubscriber` for the full contract.
|
|
1054
1051
|
*/
|
|
1055
1052
|
readonly onFirstSubscriber?: (sessionId: string) => void;
|
|
1056
1053
|
/**
|
|
1057
1054
|
* Hook fired when the local subscriber count for `sessionId`
|
|
1058
1055
|
* transitions 1 → 0 on the live channel. Forwarded verbatim to
|
|
1059
|
-
* `
|
|
1056
|
+
* `createGguiSessionChannelServer`.
|
|
1060
1057
|
*
|
|
1061
|
-
* Only consulted when `
|
|
1062
|
-
* `
|
|
1058
|
+
* Only consulted when `renderChannel` is enabled. See
|
|
1059
|
+
* `GguiSessionChannelOptions.onLastSubscriberGone` for the full contract.
|
|
1063
1060
|
*/
|
|
1064
1061
|
readonly onLastSubscriberGone?: (sessionId: string) => void;
|
|
1065
|
-
/**
|
|
1066
|
-
* Override the sanitizer applied to the stringified original error
|
|
1067
|
-
* written into `ContractErrorPayload.error.causedBy`. Defaults to
|
|
1068
|
-
* `@ggui-ai/protocol::sanitizeCausedBy` when omitted — redacts
|
|
1069
|
-
* Bearer tokens, query-param secrets, common env-var dumps, and
|
|
1070
|
-
* truncates at 2 KB. Forwarded verbatim to
|
|
1071
|
-
* `createRenderChannelServer`. See `RenderChannelOptions
|
|
1072
|
-
* .sanitizeCausedBy` for the contract.
|
|
1073
|
-
*/
|
|
1074
|
-
readonly sanitizeCausedBy?: import("@ggui-ai/protocol").SanitizeCausedBy;
|
|
1075
1062
|
/**
|
|
1076
1063
|
* Extra reserved-channel payload validators merged with the
|
|
1077
1064
|
* server's default A2UI preview validator before being passed to
|
|
1078
|
-
* the
|
|
1065
|
+
* the render channel (Item 4 injection pattern). Caller-provided
|
|
1079
1066
|
* entries WIN on key conflict — the pattern is "server supplies
|
|
1080
1067
|
* defaults, operator may replace by key".
|
|
1081
1068
|
*
|
|
1082
1069
|
* Absent = the server binds only the A2UI validator for
|
|
1083
|
-
* `_ggui:preview` by default. `_ggui:
|
|
1070
|
+
* `_ggui:preview` by default. `_ggui:lifecycle` is validated
|
|
1084
1071
|
* via the protocol-shipped builtin regardless of this option.
|
|
1085
1072
|
*
|
|
1086
1073
|
* Pass `new Map()` (explicitly empty) to DISABLE the A2UI default —
|
|
@@ -1090,15 +1077,15 @@ export interface CreateGguiServerOptions {
|
|
|
1090
1077
|
*/
|
|
1091
1078
|
readonly extraReservedValidators?: ReadonlyMap<string, import("@ggui-ai/protocol").ReservedChannelValidator>;
|
|
1092
1079
|
/**
|
|
1093
|
-
* Protocol-version handshake policy for the
|
|
1094
|
-
* verbatim to `
|
|
1095
|
-
* `
|
|
1080
|
+
* Protocol-version handshake policy for the render channel. Forwarded
|
|
1081
|
+
* verbatim to `createGguiSessionChannelServer` (see
|
|
1082
|
+
* `GguiSessionChannelOptions.versionPolicy`). Defaults to `'reject'` —
|
|
1096
1083
|
* mismatched `SubscribePayload.supportedVersions` emits
|
|
1097
1084
|
* UPGRADE_REQUIRED and closes the connection. Legacy opt-out
|
|
1098
1085
|
* `'advisory'` keeps the connection open after the error frame for
|
|
1099
1086
|
* controlled migration windows.
|
|
1100
1087
|
*
|
|
1101
|
-
* Only consulted when `
|
|
1088
|
+
* Only consulted when `renderChannel` is enabled.
|
|
1102
1089
|
*/
|
|
1103
1090
|
readonly versionPolicy?: "advisory" | "reject";
|
|
1104
1091
|
/**
|
|
@@ -1109,8 +1096,8 @@ export interface CreateGguiServerOptions {
|
|
|
1109
1096
|
* `streamSpec[channel].tool` ref points at a tool whose return
|
|
1110
1097
|
* schema fits inside the channel's declared `schema`.
|
|
1111
1098
|
*
|
|
1112
|
-
* - `'reject'` (default) — violations throw before the
|
|
1113
|
-
*
|
|
1099
|
+
* - `'reject'` (default) — violations throw before the render
|
|
1100
|
+
* commits (or before blueprint registration completes).
|
|
1114
1101
|
* Canonical enforcement posture for launch.
|
|
1115
1102
|
* - `'warn'` — violations log through the server's structured
|
|
1116
1103
|
* logger (`schema_compat_warn` event with the full report
|
|
@@ -1178,7 +1165,7 @@ export interface CreateGguiServerOptions {
|
|
|
1178
1165
|
* is NOT advertised. Server looks identical to the pre-MCP-Apps
|
|
1179
1166
|
* surface.
|
|
1180
1167
|
* - `true`: enable with sensible defaults. Requires
|
|
1181
|
-
* `
|
|
1168
|
+
* `renderChannel: true` so the iframe has a WebSocket to open;
|
|
1182
1169
|
* throws at construction otherwise.
|
|
1183
1170
|
* - `{ shellHtml?, wsUrl? }`: explicit config.
|
|
1184
1171
|
*
|
|
@@ -1191,9 +1178,9 @@ export interface CreateGguiServerOptions {
|
|
|
1191
1178
|
* 3. `io.modelcontextprotocol/ui` is advertised in the server's
|
|
1192
1179
|
* `initialize` capabilities (under `experimental`).
|
|
1193
1180
|
* 4. Each `ggui_render` result carries the `ai.ggui/render` slice
|
|
1194
|
-
* with wsUrl + short-TTL token + expiresAt. The
|
|
1181
|
+
* with wsUrl + short-TTL token + expiresAt. The render-channel
|
|
1195
1182
|
* server accepts that token on `subscribe` and issues a
|
|
1196
|
-
* longer-TTL `
|
|
1183
|
+
* longer-TTL `sessionToken` in the ack for iframe reconnects.
|
|
1197
1184
|
*/
|
|
1198
1185
|
readonly mcpApps?: boolean | {
|
|
1199
1186
|
readonly shellHtml?: string;
|
|
@@ -1237,13 +1224,6 @@ export interface CreateGguiServerOptions {
|
|
|
1237
1224
|
readonly distDir?: string;
|
|
1238
1225
|
readonly url?: string;
|
|
1239
1226
|
};
|
|
1240
|
-
/**
|
|
1241
|
-
* Connector registry for external MCP servers. Required to accept
|
|
1242
|
-
* inbound MCP Apps push payloads (`shortcuts.mcpApps`) and for the
|
|
1243
|
-
* `/mcp-apps/resource` proxy route to resolve source-server
|
|
1244
|
-
* endpoints. Absent = inbound MCP Apps hosting disabled.
|
|
1245
|
-
*/
|
|
1246
|
-
readonly connectors?: ConnectorRegistry;
|
|
1247
1227
|
/**
|
|
1248
1228
|
* HMAC secret used to sign bootstrap + session tokens. When the MCP
|
|
1249
1229
|
* Apps outbound path is enabled and no secret is passed, the server
|
|
@@ -1522,7 +1502,7 @@ export interface CreateGguiServerOptions {
|
|
|
1522
1502
|
*
|
|
1523
1503
|
* - Same-origin ONLY — not a Portal replacement, not an MCP Apps
|
|
1524
1504
|
* iframe shell.
|
|
1525
|
-
* - No same-origin cookie, no
|
|
1505
|
+
* - No same-origin cookie, no render viewer, no WebSocket
|
|
1526
1506
|
* wiring yet.
|
|
1527
1507
|
*
|
|
1528
1508
|
* Options:
|
|
@@ -1552,13 +1532,13 @@ export interface CreateGguiServerOptions {
|
|
|
1552
1532
|
readonly distDir?: string;
|
|
1553
1533
|
/**
|
|
1554
1534
|
* Enable the Slice-2 same-origin session-cookie flow
|
|
1555
|
-
* (`POST /ggui/console/
|
|
1535
|
+
* (`POST /ggui/console/session-cookie` + render-channel
|
|
1556
1536
|
* cookie-auth wiring). Defaults to OFF — the landing-page
|
|
1557
1537
|
* static surface is useful on its own (pair-code display,
|
|
1558
1538
|
* server identity); turning on the cookie flow is an
|
|
1559
1539
|
* explicit step that pulls in additional deps.
|
|
1560
1540
|
*
|
|
1561
|
-
* Enabling REQUIRES `
|
|
1541
|
+
* Enabling REQUIRES `renderChannel: true` — the cookie only
|
|
1562
1542
|
* authenticates the live-channel WebSocket upgrade, so a cookie
|
|
1563
1543
|
* flow without a channel to use it on would be pointless +
|
|
1564
1544
|
* confusing. Throws at construction if that invariant fails.
|
|
@@ -1568,7 +1548,7 @@ export interface CreateGguiServerOptions {
|
|
|
1568
1548
|
* it. Throws at construction if the index is absent.
|
|
1569
1549
|
*
|
|
1570
1550
|
* The cookie signing secret is the same {@link wsTokenSecret}
|
|
1571
|
-
* used by the MCP Apps bootstrap/
|
|
1551
|
+
* used by the MCP Apps bootstrap/render tokens — different
|
|
1572
1552
|
* token `kind` claims make cross-kind confusion impossible
|
|
1573
1553
|
* (see `console-auth.ts` isolation comment).
|
|
1574
1554
|
*/
|
|
@@ -1596,7 +1576,7 @@ export interface CreateGguiServerOptions {
|
|
|
1596
1576
|
*
|
|
1597
1577
|
* The gate accepts either an `Authorization: Bearer <token>`
|
|
1598
1578
|
* header OR the `ggui_console_admin` cookie set by the
|
|
1599
|
-
* admin-login route. Other console routes (registry,
|
|
1579
|
+
* admin-login route. Other console routes (registry, renders,
|
|
1600
1580
|
* cached blueprints, …) are NOT gated by this token — that's
|
|
1601
1581
|
* a separate audit slice. The keys plane is the immediate
|
|
1602
1582
|
* threat: plaintext bearer rendering + mint + revoke must not
|
|
@@ -1655,9 +1635,9 @@ export interface CreateGguiServerOptions {
|
|
|
1655
1635
|
/**
|
|
1656
1636
|
* Index for resolving `shortCode → { sessionId, appId }`. Required
|
|
1657
1637
|
* when `console.sessionCookie` is enabled (the cookie endpoint
|
|
1658
|
-
* looks up the posted shortCode to find the
|
|
1638
|
+
* looks up the posted shortCode to find the render to bind).
|
|
1659
1639
|
*
|
|
1660
|
-
* Pair this with a `
|
|
1640
|
+
* Pair this with a `render` handler so the agent's `ggui_render` writes
|
|
1661
1641
|
* the shortCode into the same index that console later reads.
|
|
1662
1642
|
* See `defaultHandlers` for the wiring seam.
|
|
1663
1643
|
*/
|
|
@@ -1665,11 +1645,11 @@ export interface CreateGguiServerOptions {
|
|
|
1665
1645
|
/**
|
|
1666
1646
|
* Content-addressable code blob storage. When wired, this server
|
|
1667
1647
|
* mounts `GET /code/<hash>.js` for the iframe runtime to fetch
|
|
1668
|
-
* compiled componentCode by content hash. The
|
|
1648
|
+
* compiled componentCode by content hash. The render handler writes
|
|
1669
1649
|
* to the store before emitting `codeUrl` on the `ai.ggui/render`
|
|
1670
1650
|
* slice.
|
|
1671
1651
|
*
|
|
1672
|
-
* Defaults: when omitted the route is NOT mounted; the
|
|
1652
|
+
* Defaults: when omitted the route is NOT mounted; the render
|
|
1673
1653
|
* handler falls back to inline base64 `componentCode` on the
|
|
1674
1654
|
* `ai.ggui/render` slice (legacy delivery channel).
|
|
1675
1655
|
*
|
|
@@ -1683,15 +1663,15 @@ export interface CreateGguiServerOptions {
|
|
|
1683
1663
|
readonly codeStore?: CodeStore;
|
|
1684
1664
|
/**
|
|
1685
1665
|
* Provisional A2UI preview wiring for `ggui_render`. When the config
|
|
1686
|
-
* flag is on, every qualifying component
|
|
1666
|
+
* flag is on, every qualifying component render kicks off the
|
|
1687
1667
|
* supplied emitter; frames land on the reserved `_ggui:preview`
|
|
1688
|
-
* channel of the
|
|
1668
|
+
* channel of the render.
|
|
1689
1669
|
*
|
|
1690
1670
|
* The server owns the `sendEnvelope` + registry plumbing — only
|
|
1691
1671
|
* the emitter + flag + optional observers are caller-facing.
|
|
1692
1672
|
*
|
|
1693
|
-
* Requires `
|
|
1694
|
-
* needs a channel to emit on AND a
|
|
1673
|
+
* Requires `renderChannel: true` + `mcpApps` enabled (preview
|
|
1674
|
+
* needs a channel to emit on AND a render handler to attach to).
|
|
1695
1675
|
* When the flag is on without those, `createGguiServer` throws —
|
|
1696
1676
|
* silent drop would make "I enabled preview and nothing fires"
|
|
1697
1677
|
* look like a generation bug instead of a wiring bug.
|
|
@@ -1709,7 +1689,7 @@ export interface CreateGguiServerOptions {
|
|
|
1709
1689
|
* explicit about the producer).
|
|
1710
1690
|
*/
|
|
1711
1691
|
readonly emitter: ProvisionalPreviewEmitter;
|
|
1712
|
-
/** Per-
|
|
1692
|
+
/** Per-render predicate. See {@link ProvisionalPreviewConfig}. */
|
|
1713
1693
|
readonly isEnabledFor?: ProvisionalPreviewConfig["isEnabledFor"];
|
|
1714
1694
|
/** Lifecycle observer. Fires sync — must not throw. */
|
|
1715
1695
|
readonly onOutcome?: (outcome: ProvisionalPreviewOutcome) => void;
|
|
@@ -1730,7 +1710,7 @@ export interface CreateGguiServerOptions {
|
|
|
1730
1710
|
* shape.
|
|
1731
1711
|
* - `{kvStore, negotiator}` — wire a real negotiator (e.g. RAG
|
|
1732
1712
|
* in a hosted closed runtime) so handshake records carry a
|
|
1733
|
-
* decision the paired
|
|
1713
|
+
* decision the paired render echoes as `structuredContent.decision`.
|
|
1734
1714
|
* - `false` — explicitly disable: `ggui_handshake` is NOT
|
|
1735
1715
|
* registered and `ggui_render({handshakeId})` falls back to
|
|
1736
1716
|
* the rejection shape.
|
|
@@ -1759,8 +1739,8 @@ export interface CreateGguiServerOptions {
|
|
|
1759
1739
|
};
|
|
1760
1740
|
/**
|
|
1761
1741
|
* Generation wiring for the `ggui_render` story path. When present,
|
|
1762
|
-
* every component
|
|
1763
|
-
* the result as a real `
|
|
1742
|
+
* every component render invokes the bound `UiGenerator` and commits
|
|
1743
|
+
* the result as a real `GguiSession`. Absent = placeholder mode:
|
|
1764
1744
|
* `ggui_render` on the story path returns `codeReady: false`
|
|
1765
1745
|
* without writing componentCode.
|
|
1766
1746
|
*
|
|
@@ -1774,9 +1754,15 @@ export interface CreateGguiServerOptions {
|
|
|
1774
1754
|
* runtime supplies its own generator binding through the same seam.
|
|
1775
1755
|
* BYOK resolution (env → credentials file) is the CLI layer's
|
|
1776
1756
|
* concern — at this boundary the caller hands in a closure that
|
|
1777
|
-
* returns resolved credentials per
|
|
1757
|
+
* returns resolved credentials per render.
|
|
1778
1758
|
*/
|
|
1779
1759
|
readonly generation?: GenerationDeps;
|
|
1760
|
+
/**
|
|
1761
|
+
* Read-only shared/seed blueprint pools for cross-deployment reuse.
|
|
1762
|
+
* Threaded into the handshake negotiator's `seedPools`. Built by the
|
|
1763
|
+
* CLI from `--seed-pool` artifacts; absent ⇒ no shared pool.
|
|
1764
|
+
*/
|
|
1765
|
+
readonly seedPools?: readonly BlueprintPool[];
|
|
1780
1766
|
/**
|
|
1781
1767
|
* Optional multi-generator registry. When present, exposes named
|
|
1782
1768
|
* generators (e.g. `ui-gen-default-haiku-4-5`,
|
|
@@ -1795,7 +1781,7 @@ export interface CreateGguiServerOptions {
|
|
|
1795
1781
|
/**
|
|
1796
1782
|
* Optional multi-variant blueprint store. When present, `Blueprint`
|
|
1797
1783
|
* rows persist via this seam so `ggui_ops_generate_blueprint` and
|
|
1798
|
-
*
|
|
1784
|
+
* render-on-cache-miss can read + write through it. When omitted,
|
|
1799
1785
|
* `createGguiServer` auto-seeds an {@link InMemoryBlueprintStore}.
|
|
1800
1786
|
*/
|
|
1801
1787
|
readonly blueprintStore?: BlueprintStore;
|
|
@@ -1964,13 +1950,13 @@ export interface GguiServer {
|
|
|
1964
1950
|
*/
|
|
1965
1951
|
readonly toolCount: number;
|
|
1966
1952
|
/**
|
|
1967
|
-
* The OSS live-channel
|
|
1953
|
+
* The OSS live-channel render endpoint, when `renderChannel` was
|
|
1968
1954
|
* enabled. `null` when disabled. Hosts can use this for
|
|
1969
|
-
* introspection (`.
|
|
1955
|
+
* introspection (`.renderCount`, `.subscriberCount`) or for
|
|
1970
1956
|
* composition with future mutation handlers that want to fan out
|
|
1971
|
-
* via `
|
|
1957
|
+
* via `renderChannel.sendToGguiSession(sessionId, data)`.
|
|
1972
1958
|
*/
|
|
1973
|
-
readonly
|
|
1959
|
+
readonly renderChannel: GguiSessionChannelServer | null;
|
|
1974
1960
|
/**
|
|
1975
1961
|
* The pairing service bound to this server, when the `pairing` option
|
|
1976
1962
|
* was enabled. `null` when pairing is disabled. In-process hosts
|