@ggui-ai/protocol 0.14.0 → 0.16.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/envelopes/render-refusal.d.ts +49 -0
- package/dist/envelopes/render-refusal.d.ts.map +1 -0
- package/dist/envelopes/render-refusal.js +12 -0
- package/dist/errors/domain-error.d.ts +70 -0
- package/dist/errors/domain-error.d.ts.map +1 -0
- package/dist/errors/domain-error.js +118 -0
- package/dist/gadgets/resolve-app-gadgets.d.ts +1 -1
- package/dist/gadgets/stdlib-gadgets.d.ts +2 -2
- package/dist/gadgets/stdlib-gadgets.js +1 -1
- package/dist/index.d.ts +69 -63
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/integrations/mcp-apps.d.ts +35 -9
- package/dist/integrations/mcp-apps.d.ts.map +1 -1
- package/dist/integrations/mcp-apps.js +13 -13
- package/dist/integrations/overlay-hash.d.ts +19 -0
- package/dist/integrations/overlay-hash.d.ts.map +1 -0
- package/dist/integrations/overlay-hash.js +29 -0
- package/dist/integrations/theme-binding.d.ts +14 -12
- package/dist/integrations/theme-binding.d.ts.map +1 -1
- package/dist/integrations/theme-binding.js +10 -6
- package/dist/registry/blueprint-key.d.ts.map +1 -1
- package/dist/registry/blueprint-key.js +4 -3
- package/dist/schemas/app-theme.d.ts +46 -10
- package/dist/schemas/app-theme.d.ts.map +1 -1
- package/dist/schemas/app-theme.js +108 -40
- package/dist/schemas/blueprint.d.ts +4 -3
- package/dist/schemas/blueprint.d.ts.map +1 -1
- package/dist/schemas/blueprint.js +15 -3
- package/dist/schemas/data-contract.d.ts +11 -31
- package/dist/schemas/data-contract.d.ts.map +1 -1
- package/dist/schemas/data-contract.js +5 -28
- package/dist/schemas/handshake-suggestion.d.ts.map +1 -1
- package/dist/schemas/handshake-suggestion.js +8 -1
- package/dist/schemas/interface-context.d.ts +44 -0
- package/dist/schemas/interface-context.d.ts.map +1 -0
- package/dist/schemas/interface-context.js +22 -0
- package/dist/schemas/invoke.d.ts +3 -3
- package/dist/schemas/invoke.js +1 -1
- package/dist/schemas/mcp.d.ts +246 -111
- package/dist/schemas/mcp.d.ts.map +1 -1
- package/dist/schemas/mcp.js +149 -42
- package/dist/schemas/ops-blueprint.d.ts +4 -4
- package/dist/schemas/ops-blueprint.d.ts.map +1 -1
- package/dist/schemas/ops-blueprint.js +13 -8
- package/dist/schemas/public-env-key.d.ts +26 -0
- package/dist/schemas/public-env-key.d.ts.map +1 -0
- package/dist/schemas/public-env-key.js +25 -0
- package/dist/schemas/render-input-envelope.d.ts +2 -2
- package/dist/schemas/render-input-envelope.js +1 -1
- package/dist/schemas/runtime-telemetry-limits.d.ts +11 -0
- package/dist/schemas/runtime-telemetry-limits.d.ts.map +1 -0
- package/dist/schemas/runtime-telemetry-limits.js +10 -0
- package/dist/transport/websocket.d.ts +5 -5
- package/dist/types/auth.d.ts +1 -1
- package/dist/types/blueprint-source.d.ts +27 -7
- package/dist/types/blueprint-source.d.ts.map +1 -1
- package/dist/types/blueprint-source.js +19 -3
- package/dist/types/blueprint.d.ts +2 -2
- package/dist/types/blueprint.d.ts.map +1 -1
- package/dist/types/contract-inference.d.ts +1 -1
- package/dist/types/data-contract.d.ts +3 -3
- package/dist/types/domain-error-codes.d.ts +167 -0
- package/dist/types/domain-error-codes.d.ts.map +1 -0
- package/dist/types/domain-error-codes.js +170 -0
- package/dist/types/events.d.ts +1 -1
- package/dist/types/ggui-session-event.d.ts +2 -2
- package/dist/types/handshake-suggestion.d.ts +2 -2
- package/dist/types/host-context.d.ts +3 -3
- package/dist/types/interface-context.d.ts +1 -1
- package/dist/types/invoke.d.ts +1 -1
- package/dist/types/lifecycle.d.ts +1 -1
- package/dist/types/live-channel.d.ts +3 -3
- package/dist/types/llm-route.d.ts +59 -2
- package/dist/types/llm-route.d.ts.map +1 -1
- package/dist/types/llm-route.js +62 -16
- package/dist/types/llm.d.ts +22 -2
- package/dist/types/llm.d.ts.map +1 -1
- package/dist/types/llm.js +29 -2
- package/dist/types/mcp.d.ts +49 -100
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/mcp.js +28 -9
- package/dist/types/refusal-codes.d.ts +54 -95
- package/dist/types/refusal-codes.d.ts.map +1 -1
- package/dist/types/refusal-codes.js +67 -105
- package/dist/types/render.d.ts +12 -11
- package/dist/types/render.d.ts.map +1 -1
- package/dist/types/ui-generator.d.ts +1 -1
- package/dist/validation/ajv-runtime.d.ts +2 -2
- package/dist/validation/contract-validator.d.ts +14 -8
- package/dist/validation/contract-validator.d.ts.map +1 -1
- package/dist/validation/contract-validator.js +12 -4
- package/dist/validation/cross-references.d.ts +2 -2
- package/dist/validation/hygiene-rules.d.ts +1 -1
- package/dist/validation/lint-contract.d.ts +2 -2
- package/dist/validation/lint-contract.d.ts.map +1 -1
- package/dist/validation/lint-contract.js +6 -4
- package/dist/validation/name-invariants.d.ts +2 -2
- package/dist/validation/reserved-channels.d.ts +1 -1
- package/dist/validation/schema-compat-invariants.d.ts +2 -2
- package/dist/validation/schema-meta-validation.d.ts +1 -1
- package/dist/validation/schema-subset.d.ts +3 -3
- package/dist/version.d.ts +485 -12
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +484 -11
- package/dist/wire.d.ts +45 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +44 -0
- package/package.json +7 -1
- package/dist/envelope-adapters.d.ts +0 -25
- package/dist/envelope-adapters.d.ts.map +0 -1
- package/dist/envelope-adapters.js +0 -14
package/dist/schemas/mcp.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Two consumption patterns, both anchored here:
|
|
8
8
|
*
|
|
9
9
|
* - **Wired raw shapes** (`*InputShape`): handlers in
|
|
10
|
-
* `@ggui-ai/mcp-server-handlers` (and
|
|
10
|
+
* `@ggui-ai/mcp-server-handlers` (and a hosted deployment's discover
|
|
11
11
|
* tool) import the SHAPE directly as their `inputSchema` and
|
|
12
12
|
* validate with `z.object(shape)` — unknown keys are STRIPPED.
|
|
13
13
|
* The shape is the one authored copy of the validation rules AND
|
|
@@ -25,25 +25,10 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import { z } from 'zod';
|
|
27
27
|
import { blueprintDraftSchema, handshakeSuggestionSchema, } from './handshake-suggestion.js';
|
|
28
|
-
import { dataContractSchema, jsonObjectSchema } from './data-contract.js';
|
|
28
|
+
import { dataContractSchema, jsonObjectSchema, jsonValueSchema } from './data-contract.js';
|
|
29
29
|
import { blueprintVarianceSchema, blueprintSourceSchema } from './blueprint.js';
|
|
30
|
-
import { REFUSAL_RETRIES, RENDER_GATE_REFUSAL_CODES, } from '../types/refusal-codes.js';
|
|
31
|
-
|
|
32
|
-
export const viewportSchema = z.object({
|
|
33
|
-
width: z.number(),
|
|
34
|
-
height: z.number(),
|
|
35
|
-
});
|
|
36
|
-
export const interfaceContextSchema = z.object({
|
|
37
|
-
viewport: viewportSchema,
|
|
38
|
-
platform: z.enum(['web', 'mobile', 'desktop']),
|
|
39
|
-
deviceType: z.enum(['phone', 'tablet', 'desktop']),
|
|
40
|
-
orientation: z.enum(['portrait', 'landscape']),
|
|
41
|
-
devicePixelRatio: z.number().optional(),
|
|
42
|
-
touchPrimary: z.boolean().optional(),
|
|
43
|
-
shellType: z.enum(['chat', 'fullscreen', 'spatial']).optional(),
|
|
44
|
-
colorScheme: z.enum(['light', 'dark']).optional(),
|
|
45
|
-
reducedMotion: z.boolean().optional(),
|
|
46
|
-
}).passthrough();
|
|
30
|
+
import { MCP_ENDPOINT_REFUSAL_CODES, REFUSAL_RETRIES, RENDER_GATE_REFUSAL_CODES, } from '../types/refusal-codes.js';
|
|
31
|
+
import { RUNTIME_TELEMETRY_MAX_EVENTS } from './runtime-telemetry-limits.js';
|
|
47
32
|
// ── Wired Tool Input Shapes ──
|
|
48
33
|
//
|
|
49
34
|
// Raw zod shapes for the non-lifecycle tools. The SHAPE is the canonical
|
|
@@ -63,14 +48,14 @@ export const consumeInputShape = {
|
|
|
63
48
|
sessionId: z
|
|
64
49
|
.string()
|
|
65
50
|
.min(1)
|
|
66
|
-
.describe('Globally-unique sessionId to consume events from. Cross-
|
|
51
|
+
.describe('Globally-unique sessionId to consume events from. Cross-app access surfaces uniformly as session_not_found.'),
|
|
67
52
|
timeout: z
|
|
68
53
|
.number()
|
|
69
54
|
.int()
|
|
70
55
|
.min(0)
|
|
71
56
|
.max(25)
|
|
72
57
|
.optional()
|
|
73
|
-
.describe('Inline long-poll seconds, integer in [0, 25]. 0 = immediate. Values outside the bound reject INVALID_PARAMS. Returns on first event OR timeout; re-call
|
|
58
|
+
.describe('Inline long-poll seconds, integer in [0, 25]. 0 = immediate. Values outside the bound reject INVALID_PARAMS. Returns on first event OR timeout; on empty you may re-call once, then end your turn — a later gesture arrives as a new user message carrying its own consume directive.'),
|
|
74
59
|
};
|
|
75
60
|
export const consumeInputSchema = z.object(consumeInputShape);
|
|
76
61
|
/**
|
|
@@ -235,7 +220,7 @@ export const handshakeInputSchema = z.object({
|
|
|
235
220
|
* `'declined'` cover every legal outcome.
|
|
236
221
|
*/
|
|
237
222
|
export const handshakeOutputSchema = z.object({
|
|
238
|
-
handshakeId: z.string().describe('Stable id — pass to ggui_render
|
|
223
|
+
handshakeId: z.string().describe('Stable id — pass to ggui_render'),
|
|
239
224
|
action: z.enum(['create', 'reuse', 'update', 'replace', 'declined']),
|
|
240
225
|
/**
|
|
241
226
|
* The handshake suggestion — see `handshakeSuggestionSchema`. The
|
|
@@ -345,7 +330,7 @@ export const renderInputShape = {
|
|
|
345
330
|
.string()
|
|
346
331
|
.min(1)
|
|
347
332
|
.optional()
|
|
348
|
-
.describe('Model route in either wire form — canonical `anthropic:claude-haiku-4-5-20251001` or LiteLLM `anthropic/claude-haiku-4-5` (aliases resolve in both); generator-specific prefixes (e.g. `bedrock/...`) route to that transport. A value that parses in neither form fails the handler input parse at `infra.model`, before any pre-generation gate; `
|
|
333
|
+
.describe('Model route in either wire form — canonical `anthropic:claude-haiku-4-5-20251001` or LiteLLM `anthropic/claude-haiku-4-5` (aliases resolve in both); generator-specific prefixes (e.g. `bedrock/...`) route to that transport. A value that parses in neither form fails the handler input parse at `infra.model`, before any pre-generation gate; `model_not_allowed` is only ever a well-formed route with no rate row on the effective tier.'),
|
|
349
334
|
})
|
|
350
335
|
.strict()
|
|
351
336
|
.optional(),
|
|
@@ -489,10 +474,16 @@ export const renderOutcomeSchema = z.enum(['rendered', 'failed', 'refused']);
|
|
|
489
474
|
* row names a `fixBy` other than `caller`: the fix belongs to the app's
|
|
490
475
|
* owner, the tenant, or the operator, and retrying does not perform it.
|
|
491
476
|
*/
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
477
|
+
/**
|
|
478
|
+
* The refusal projection every surface shares — what a client acts on:
|
|
479
|
+
* the diagnostic, the one recovery step, and how the call becomes
|
|
480
|
+
* possible again. Defined ONCE and spread into each surface's envelope
|
|
481
|
+
* (the render gate's {@link renderRefusalSchema}, the per-app endpoint's
|
|
482
|
+
* {@link transportRefusalSchema}); the `code` enum is per surface,
|
|
483
|
+
* derived from the registry. `fixBy` never travels — it is a registry
|
|
484
|
+
* attribute a client reads by `code`.
|
|
485
|
+
*/
|
|
486
|
+
const refusalProjectionFields = {
|
|
496
487
|
message: z
|
|
497
488
|
.string()
|
|
498
489
|
.describe('Precise diagnostic — what was checked, and against what. Surface it to the operator; do not parse it.'),
|
|
@@ -502,6 +493,12 @@ export const renderRefusalSchema = z.object({
|
|
|
502
493
|
retry: z
|
|
503
494
|
.enum(REFUSAL_RETRIES)
|
|
504
495
|
.describe("How the call becomes possible again. 'after-fix': a named party acts and the same call then succeeds. 'next-period': time restores it at the next period boundary. 'later': transient — retry after a short delay. 'never': no caller action restores it under this identity."),
|
|
496
|
+
};
|
|
497
|
+
export const renderRefusalSchema = z.object({
|
|
498
|
+
code: z
|
|
499
|
+
.enum(RENDER_GATE_REFUSAL_CODES)
|
|
500
|
+
.describe("Registered refusal state. Look the code up in the protocol's refusal registry for its retry class and which party can act; the accompanying `fix` names the one recovery step."),
|
|
501
|
+
...refusalProjectionFields,
|
|
505
502
|
handshake: z
|
|
506
503
|
.literal('intact')
|
|
507
504
|
.describe('The handshake was NOT consumed — nothing was read. The same handshakeId is valid on a retry.'),
|
|
@@ -511,6 +508,51 @@ export const renderRefusalSchema = z.object({
|
|
|
511
508
|
.optional()
|
|
512
509
|
.describe('Present only when the refusing check read a balance: its value at the moment of the check.'),
|
|
513
510
|
});
|
|
511
|
+
/**
|
|
512
|
+
* A refusal typed on the per-app MCP endpoint's authorization
|
|
513
|
+
* (ggui#825) — the registry projection WITHOUT the render-only fields:
|
|
514
|
+
* no `handshake` (nothing was handed), no `balanceCentsAtCheck`. Strict:
|
|
515
|
+
* a render-only field here is a bug, never a wire state. `code` draws
|
|
516
|
+
* from {@link MCP_ENDPOINT_REFUSAL_CODES} — today exactly
|
|
517
|
+
* `app_deprovisioned`, the one refusal with a tenant-side fix and
|
|
518
|
+
* therefore the one that MUST be legible where a deleted app and a bad
|
|
519
|
+
* credential would otherwise look alike. `appId` (ggui#870) is the app
|
|
520
|
+
* the refused endpoint serves, as DATA — equal to the path's `{appId}`
|
|
521
|
+
* — so a tenant's repair loop keys on it and never parses prose; it is
|
|
522
|
+
* the ggui id the bound caller already holds, never the tenant's own
|
|
523
|
+
* `ownerRef`. The typed refusal answers a correctly bound federated
|
|
524
|
+
* identity only (identity first): an anonymous request is refused by the
|
|
525
|
+
* auth adapter before this arm, and learns nothing about the app.
|
|
526
|
+
*/
|
|
527
|
+
export const transportRefusalSchema = z.strictObject({
|
|
528
|
+
code: z
|
|
529
|
+
.enum(MCP_ENDPOINT_REFUSAL_CODES)
|
|
530
|
+
.describe("Registered refusal state on the per-app endpoint. Look the code up in the protocol's refusal registry for its retry class and which party can act."),
|
|
531
|
+
...refusalProjectionFields,
|
|
532
|
+
appId: z
|
|
533
|
+
.string()
|
|
534
|
+
.min(1)
|
|
535
|
+
.describe('The app id the refused endpoint serves — equals the {appId} of the endpoint path. Structured here so a repair loop keys on it instead of parsing the message.'),
|
|
536
|
+
});
|
|
537
|
+
/**
|
|
538
|
+
* The JSON-RPC error object a per-app MCP endpoint answers with when it
|
|
539
|
+
* refuses a request for a typed reason (ggui#825, codes ruled in
|
|
540
|
+
* ggui#836): HTTP 403, `code` `-32003` (`APP_NOT_FOUND` — the endpoint
|
|
541
|
+
* no longer serves this app, the same reading ggui's embed host gives a
|
|
542
|
+
* proxy 403) and `message` `App not found`, plus `data.refusal`, which
|
|
543
|
+
* makes it legible. `data` is strict: it carries the refusal and nothing
|
|
544
|
+
* else. An authorization failure that is not a registry state answers
|
|
545
|
+
* HTTP 403 with `-32007` (`UNAUTHORIZED`) and NO `data` — the three
|
|
546
|
+
* untyped arms stay indistinguishable among themselves by contract:
|
|
547
|
+
* naming any of them would say which is true. A first-party server
|
|
548
|
+
* never chooses `-32000`: it is the SDK client's `ConnectionClosed`, so
|
|
549
|
+
* a bare 403 and a dropped socket would share a number.
|
|
550
|
+
*/
|
|
551
|
+
export const transportRefusalErrorSchema = z.strictObject({
|
|
552
|
+
code: z.literal(-32003),
|
|
553
|
+
message: z.literal('App not found'),
|
|
554
|
+
data: z.strictObject({ refusal: transportRefusalSchema }),
|
|
555
|
+
});
|
|
514
556
|
/**
|
|
515
557
|
* The COMPLETE structuredContent of a refused tool result — the whole
|
|
516
558
|
* payload, not a slice of it. Strict on purpose: a refusal commits
|
|
@@ -819,7 +861,7 @@ export const renderOutputSchema = z.object({
|
|
|
819
861
|
* wise). Use when most props stay the same and the agent only
|
|
820
862
|
* needs to send a small delta — common after a single domain-tool
|
|
821
863
|
* mutation. RFC 7396 chosen because it has a published spec and
|
|
822
|
-
* wide library support (GitHub API,
|
|
864
|
+
* wide library support (GitHub API's merge semantics, strategic-merge-patch).
|
|
823
865
|
*
|
|
824
866
|
* Anti-patterns (the discriminated union rejects these structurally,
|
|
825
867
|
* but they're a common author mistake when copy-pasting):
|
|
@@ -832,7 +874,7 @@ export const renderOutputSchema = z.object({
|
|
|
832
874
|
* partial patches that would break required fields, type-mismatch
|
|
833
875
|
* values, etc. all reject pre-persist.
|
|
834
876
|
*
|
|
835
|
-
* `sessionId` is globally unique; the server
|
|
877
|
+
* `sessionId` is globally unique; the server checks the app scope via
|
|
836
878
|
* `ctx.appId`.
|
|
837
879
|
*/
|
|
838
880
|
export const updateInputSchema = z.discriminatedUnion('kind', [
|
|
@@ -1106,15 +1148,15 @@ export const gguiSessionEventSchema = z.object({
|
|
|
1106
1148
|
* OPTIONAL here (the bridge rung owns its cursor and seeds from 0; the
|
|
1107
1149
|
* route requires it because a bare browser GET has no cursor owner),
|
|
1108
1150
|
* and `limit` is clamped to {@link RUNTIME_PULL_MAX_LIMIT} instead of
|
|
1109
|
-
* rejecting above it.
|
|
1151
|
+
* rejecting above it. Cross-app access and unknown sessionIds
|
|
1110
1152
|
* surface uniformly as the `session_not_found` error — existence of
|
|
1111
|
-
* other
|
|
1153
|
+
* other apps' renders is never leaked.
|
|
1112
1154
|
*/
|
|
1113
1155
|
export const runtimePullInputShape = {
|
|
1114
1156
|
sessionId: z
|
|
1115
1157
|
.string()
|
|
1116
1158
|
.min(1)
|
|
1117
|
-
.describe('Active render id — sourced from `_meta["ai.ggui/render"].sessionId` on the iframe boot envelope. Unknown and cross-
|
|
1159
|
+
.describe('Active render id — sourced from `_meta["ai.ggui/render"].sessionId` on the iframe boot envelope. Unknown and cross-app ids surface uniformly as session_not_found.'),
|
|
1118
1160
|
sinceSequence: z
|
|
1119
1161
|
.number()
|
|
1120
1162
|
.int()
|
|
@@ -1174,11 +1216,6 @@ export const runtimePullOutputSchema = z.union([
|
|
|
1174
1216
|
runtimePullEventsPageSchema,
|
|
1175
1217
|
runtimePullHorizonSchema,
|
|
1176
1218
|
]);
|
|
1177
|
-
/**
|
|
1178
|
-
* Per-batch event cap on `ggui_runtime_telemetry` — a bounded
|
|
1179
|
-
* fire-and-forget diagnostic channel, never a data plane.
|
|
1180
|
-
*/
|
|
1181
|
-
export const RUNTIME_TELEMETRY_MAX_EVENTS = 40;
|
|
1182
1219
|
/**
|
|
1183
1220
|
* `ggui_runtime_telemetry` input — the iframe runtime's transport
|
|
1184
1221
|
* self-report (`_meta.ui.visibility: ['app']`, view-callable only).
|
|
@@ -1255,10 +1292,6 @@ export function isRefusedRenderOutput(output) {
|
|
|
1255
1292
|
// mutable JSON; readonly is applied at the seam (`DeepReadonly` on the
|
|
1256
1293
|
// derived types). Every shape is closed: the transport strip-parses against
|
|
1257
1294
|
// `.shape`, so the shape IS the wire.
|
|
1258
|
-
// Honest exception, pre-existing: three `.readonly()` calls in
|
|
1259
|
-
// `schemas/data-contract.ts` (gadget requires/connect, app public env) reach
|
|
1260
|
-
// the registered render + handshake inputs through `dataContractSchema` and
|
|
1261
|
-
// advertise `readOnly` on tools/list today — ggui#824 removes them.
|
|
1262
1295
|
// ============================================================================
|
|
1263
1296
|
/** Display modes an MCP Apps host can render a view in (ext-apps vocabulary). */
|
|
1264
1297
|
export const mcpUiDisplayModeSchema = z.enum(['inline', 'fullscreen', 'pip']);
|
|
@@ -1300,6 +1333,77 @@ export const gguiSessionSummaryWireSchema = z.object({
|
|
|
1300
1333
|
wsToken: z.string().optional(),
|
|
1301
1334
|
wsTokenExpiresAt: z.string().optional(),
|
|
1302
1335
|
});
|
|
1336
|
+
/**
|
|
1337
|
+
* The two states a GguiSession is in on the wire — the pair the consume
|
|
1338
|
+
* loop exits on (`expired`). Owned here (ggui#817 part C2); the type is
|
|
1339
|
+
* derived, never a second list.
|
|
1340
|
+
*/
|
|
1341
|
+
export const gguiSessionStatusSchema = z.enum(['active', 'expired']);
|
|
1342
|
+
/**
|
|
1343
|
+
* One drained row of `ggui_consume` — a user action that reached the
|
|
1344
|
+
* pipe (ggui#817 part C2). Closed on the wire: an unknown key is
|
|
1345
|
+
* stripped at the transport, a missing key refuses the row at the store
|
|
1346
|
+
* boundary (`pendingEventSchema`, ggui#839), so a malformed pipe entry
|
|
1347
|
+
* never ships to an agent typed as a good one.
|
|
1348
|
+
*/
|
|
1349
|
+
export const consumeEventEntrySchema = z.object({
|
|
1350
|
+
type: z.literal('action'),
|
|
1351
|
+
sessionId: z.string().min(1),
|
|
1352
|
+
intent: z.string(),
|
|
1353
|
+
actionData: jsonValueSchema.nullable(),
|
|
1354
|
+
uiContext: jsonObjectSchema,
|
|
1355
|
+
actionId: z.string(),
|
|
1356
|
+
firedAt: z.string(),
|
|
1357
|
+
});
|
|
1358
|
+
/**
|
|
1359
|
+
* One stored row of the consume pipe — what a producer appends and
|
|
1360
|
+
* `consumeAndClear` drains, the same shape on every store (ggui#839; a
|
|
1361
|
+
* store-boundary contract, never wire — `ggui_consume` returns the
|
|
1362
|
+
* entries, never the wrapper). `id` is the drain_ack key and the
|
|
1363
|
+
* idempotency key per `(sessionId, id)`; `envelope` is the
|
|
1364
|
+
* {@link consumeEventEntrySchema} entry, always the object (every writer
|
|
1365
|
+
* passes one; a store that serializes the row serializes the whole row);
|
|
1366
|
+
* `createdAt` is when the row was appended — a string, never `.datetime()`:
|
|
1367
|
+
* the relay copies the client's `firedAt`, which the ingress accepts as a
|
|
1368
|
+
* diagnostic. `PendingEventConsumer` adapters validate every row through
|
|
1369
|
+
* this schema on append and, when rows come back from a serialization, on
|
|
1370
|
+
* drain — a malformed row never reaches an agent typed as a good entry.
|
|
1371
|
+
*/
|
|
1372
|
+
export const pendingEventSchema = z.object({
|
|
1373
|
+
id: z.string().min(1),
|
|
1374
|
+
envelope: consumeEventEntrySchema,
|
|
1375
|
+
createdAt: z.string(),
|
|
1376
|
+
});
|
|
1377
|
+
/**
|
|
1378
|
+
* `ggui_consume`'s output — the drained rows, the session's state, and the
|
|
1379
|
+
* client's observations when the host sent any (ggui#817 part C2). The
|
|
1380
|
+
* handler registers `.shape`; `tools/list` therefore advertises the entry
|
|
1381
|
+
* vocabulary and the status enum instead of a free-form record and a free
|
|
1382
|
+
* string.
|
|
1383
|
+
*/
|
|
1384
|
+
export const gguiConsumeOutputSchema = z.object({
|
|
1385
|
+
events: z.array(consumeEventEntrySchema),
|
|
1386
|
+
status: gguiSessionStatusSchema,
|
|
1387
|
+
client: clientObservationsSchema.optional(),
|
|
1388
|
+
});
|
|
1389
|
+
/** `ggui_list_sessions`' output — the closed summary rows (ggui#817 part C2). */
|
|
1390
|
+
export const gguiListSessionsOutputSchema = z.object({
|
|
1391
|
+
sessions: z.array(gguiSessionSummaryWireSchema),
|
|
1392
|
+
});
|
|
1393
|
+
/**
|
|
1394
|
+
* `ggui_emit`'s output (ggui#817 part C2): `accepted` at the boundary, and
|
|
1395
|
+
* `seq` when the server keeps a stream buffer — seq-aware implementations
|
|
1396
|
+
* stamp and return it so replay cursors can be built from the ack.
|
|
1397
|
+
*/
|
|
1398
|
+
export const gguiEmitOutputSchema = z.object({
|
|
1399
|
+
accepted: z.boolean(),
|
|
1400
|
+
seq: z
|
|
1401
|
+
.number()
|
|
1402
|
+
.int()
|
|
1403
|
+
.nonnegative()
|
|
1404
|
+
.optional()
|
|
1405
|
+
.describe('Session-scoped monotonic outbound sequence assigned to this delivery. Present when the server keeps a stream buffer.'),
|
|
1406
|
+
});
|
|
1303
1407
|
/**
|
|
1304
1408
|
* `ggui_get_session`'s wire: the store row's six base fields plus the mount
|
|
1305
1409
|
* variant — for EVERY session. An MCP-Apps mount is locator-only on the
|
|
@@ -1307,6 +1411,8 @@ export const gguiSessionSummaryWireSchema = z.object({
|
|
|
1307
1411
|
* projection reads them from the row and the wire never fails on that
|
|
1308
1412
|
* variant. The locator itself is not on this wire (MCP-Apps resources have
|
|
1309
1413
|
* their own paths).
|
|
1414
|
+
* `contextSnapshot` rides when a component (`render`) mount's row has one —
|
|
1415
|
+
* never on an mcpApps mount.
|
|
1310
1416
|
*/
|
|
1311
1417
|
export const gguiGetSessionOutputSchema = z.object({
|
|
1312
1418
|
variant: z.enum(['render', 'mcpApps']),
|
|
@@ -1320,7 +1426,8 @@ export const gguiGetSessionOutputSchema = z.object({
|
|
|
1320
1426
|
* The last-known value of every declared contextSpec slot, as
|
|
1321
1427
|
* `ggui_runtime_sync_context` wrote it onto the row — the read path a
|
|
1322
1428
|
* raw MCP client (no widget-context mirror) has for contextSpec values.
|
|
1323
|
-
* Present iff the row carries one
|
|
1429
|
+
* Present iff the row carries one — component (`render`) mounts only; an
|
|
1430
|
+
* mcpApps mount never carries one; never an empty placeholder.
|
|
1324
1431
|
*/
|
|
1325
1432
|
contextSnapshot: jsonObjectSchema.optional(),
|
|
1326
1433
|
});
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* persisting the result. Optionally pins as the operator default
|
|
8
8
|
* for its `(appId, contractHash)` group.
|
|
9
9
|
* - `ggui_ops_list_blueprints` — enumerate blueprint metadata
|
|
10
|
-
* (no code body) under
|
|
10
|
+
* (no code body) under the caller's app scope + optional filters. Sorted by
|
|
11
11
|
* `createdAt desc`.
|
|
12
12
|
* - `ggui_ops_update_blueprint` — toggle the operator-default flag
|
|
13
13
|
* and/or patch variance tags. Immutable fields (contractHash,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* The schemas live in `@ggui-ai/protocol` (not the handler package)
|
|
20
20
|
* for the same reason all wire-shape schemas do: the protocol package
|
|
21
21
|
* is the source of truth for every MCP wire surface, and consumers
|
|
22
|
-
* (
|
|
22
|
+
* (a hosted deployment's handlers, console UI, fixture authors) can import from
|
|
23
23
|
* one place. Handler package wraps these into `SharedHandler`
|
|
24
24
|
* factories.
|
|
25
25
|
*/
|
|
@@ -69,11 +69,11 @@ export declare const opsGenerateBlueprintOutputSchema: z.ZodObject<{
|
|
|
69
69
|
* - Seeding pre-vetted blueprints at deploy time (fixture corpus,
|
|
70
70
|
* migration imports).
|
|
71
71
|
* - Round-tripping export+reimport — operator exports a blueprint
|
|
72
|
-
* from one
|
|
72
|
+
* from one app (or one deployment) and re-registers it in another.
|
|
73
73
|
* - Reapplying a fixed version of a blueprint after live edits
|
|
74
74
|
* (manual recovery from a bad generate run).
|
|
75
75
|
*
|
|
76
|
-
* Same
|
|
76
|
+
* Same app-scoping + variance + default-pin semantics as
|
|
77
77
|
* `*_generate_*`; the only difference is the LLM/generator dispatch
|
|
78
78
|
* is replaced with a verbatim accept of the operator's
|
|
79
79
|
* `componentCode` string.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops-blueprint.d.ts","sourceRoot":"","sources":["../../src/schemas/ops-blueprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"ops-blueprint.d.ts","sourceRoot":"","sources":["../../src/schemas/ops-blueprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;kBAkDjC,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,gCAAgC;;;;;kBAqBlC,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;kBA+CjC,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,gCAAgC;;;;kBAalC,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,4BAA4B;;;;;;kBAsC9B,CAAC;AAEZ,eAAO,MAAM,6BAA6B;;kBAI/B,CAAC;AAEZ;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B;;;;;kBAsB/B,CAAC;AAEZ,eAAO,MAAM,8BAA8B;;;kBAKhC,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,6BAA6B;;;kBAW/B,CAAC;AAEZ,eAAO,MAAM,8BAA8B;;kBAIhC,CAAC;AAEZ;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,gCAAgC,CACxC,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,gCAAgC,CACxC,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* persisting the result. Optionally pins as the operator default
|
|
8
8
|
* for its `(appId, contractHash)` group.
|
|
9
9
|
* - `ggui_ops_list_blueprints` — enumerate blueprint metadata
|
|
10
|
-
* (no code body) under
|
|
10
|
+
* (no code body) under the caller's app scope + optional filters. Sorted by
|
|
11
11
|
* `createdAt desc`.
|
|
12
12
|
* - `ggui_ops_update_blueprint` — toggle the operator-default flag
|
|
13
13
|
* and/or patch variance tags. Immutable fields (contractHash,
|
|
@@ -19,11 +19,12 @@
|
|
|
19
19
|
* The schemas live in `@ggui-ai/protocol` (not the handler package)
|
|
20
20
|
* for the same reason all wire-shape schemas do: the protocol package
|
|
21
21
|
* is the source of truth for every MCP wire surface, and consumers
|
|
22
|
-
* (
|
|
22
|
+
* (a hosted deployment's handlers, console UI, fixture authors) can import from
|
|
23
23
|
* one place. Handler package wraps these into `SharedHandler`
|
|
24
24
|
* factories.
|
|
25
25
|
*/
|
|
26
26
|
import { z } from 'zod';
|
|
27
|
+
import { GENERATOR_ID_PATTERN } from '../types/blueprint-source.js';
|
|
27
28
|
import { dataContractSchema, jsonValueSchema, } from './data-contract.js';
|
|
28
29
|
import { blueprintSchema, blueprintVarianceSchema, llmBlueprintSourceSchema, userBlueprintSourceSchema, } from './blueprint.js';
|
|
29
30
|
/**
|
|
@@ -51,9 +52,11 @@ export const opsGenerateBlueprintInputSchema = z
|
|
|
51
52
|
contract: dataContractSchema,
|
|
52
53
|
generator: z
|
|
53
54
|
.string()
|
|
54
|
-
.
|
|
55
|
+
.regex(GENERATOR_ID_PATTERN, {
|
|
56
|
+
error: 'generator is an identity `ui-gen-<tier>` — one tier token, no model segment (ggui#924)',
|
|
57
|
+
})
|
|
55
58
|
.optional()
|
|
56
|
-
.describe('Generator
|
|
59
|
+
.describe('Generator identity (e.g. `ui-gen-default`; the model is chosen by the deployment and reported on `source.model`). When omitted, dispatches through `GeneratorRegistry.defaultGenerator()`.'),
|
|
57
60
|
persona: z
|
|
58
61
|
.string()
|
|
59
62
|
.optional()
|
|
@@ -106,11 +109,11 @@ export const opsGenerateBlueprintOutputSchema = z
|
|
|
106
109
|
* - Seeding pre-vetted blueprints at deploy time (fixture corpus,
|
|
107
110
|
* migration imports).
|
|
108
111
|
* - Round-tripping export+reimport — operator exports a blueprint
|
|
109
|
-
* from one
|
|
112
|
+
* from one app (or one deployment) and re-registers it in another.
|
|
110
113
|
* - Reapplying a fixed version of a blueprint after live edits
|
|
111
114
|
* (manual recovery from a bad generate run).
|
|
112
115
|
*
|
|
113
|
-
* Same
|
|
116
|
+
* Same app-scoping + variance + default-pin semantics as
|
|
114
117
|
* `*_generate_*`; the only difference is the LLM/generator dispatch
|
|
115
118
|
* is replaced with a verbatim accept of the operator's
|
|
116
119
|
* `componentCode` string.
|
|
@@ -206,9 +209,11 @@ export const opsListBlueprintsInputSchema = z
|
|
|
206
209
|
.describe('Filter to a single `(appId, contractHash)` group. Combine with `generator` / `persona` to narrow within the group.'),
|
|
207
210
|
generator: z
|
|
208
211
|
.string()
|
|
209
|
-
.
|
|
212
|
+
.regex(GENERATOR_ID_PATTERN, {
|
|
213
|
+
error: 'generator is an identity `ui-gen-<tier>` — one tier token, no model segment (ggui#924)',
|
|
214
|
+
})
|
|
210
215
|
.optional()
|
|
211
|
-
.describe('Filter to engine-generated blueprints (`source.kind === "llm"`) whose `source.generator` equals this
|
|
216
|
+
.describe('Filter to engine-generated blueprints (`source.kind === "llm"`) whose `source.generator` equals this identity (`ui-gen-<tier>`, e.g. `ui-gen-advanced`). `user`-sourced rows never match (they carry no engine provenance).'),
|
|
212
217
|
persona: z
|
|
213
218
|
.string()
|
|
214
219
|
.optional()
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `GGUI_PUBLIC_APP_*` key grammar — its own module (ggui#819) so the
|
|
3
|
+
* browser entry can carry the regex without the contract schema that
|
|
4
|
+
* embeds it.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* `App.publicEnv` key regex.
|
|
8
|
+
*
|
|
9
|
+
* Each key in `App.publicEnv` MUST match this pattern. The prefix is
|
|
10
|
+
* the **security boundary** — operators can't accidentally stash
|
|
11
|
+
* sensitive credentials under arbitrary names, and downstream consumers
|
|
12
|
+
* (render gate, bootstrap projection, iframe shim) can rely on the
|
|
13
|
+
* naming convention to mean "public-by-design".
|
|
14
|
+
*
|
|
15
|
+
* Rule: `GGUI_PUBLIC_APP_` prefix, then uppercase letters / digits /
|
|
16
|
+
* underscores, at least one char after the prefix.
|
|
17
|
+
*
|
|
18
|
+
* `GGUI_PUBLIC_USER_*` keys are RESERVED for a future per-user
|
|
19
|
+
* channel. The current regex rejects them so App-side config can't
|
|
20
|
+
* pre-emptively use the namespace.
|
|
21
|
+
*
|
|
22
|
+
* Hoisted above `gadgetDescriptorSchema` so the wrapper's `requires`
|
|
23
|
+
* array can reference it at schema-construction time (TDZ-safe).
|
|
24
|
+
*/
|
|
25
|
+
export declare const PUBLIC_ENV_APP_KEY_RE: RegExp;
|
|
26
|
+
//# sourceMappingURL=public-env-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-env-key.d.ts","sourceRoot":"","sources":["../../src/schemas/public-env-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB,QAAiC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `GGUI_PUBLIC_APP_*` key grammar — its own module (ggui#819) so the
|
|
3
|
+
* browser entry can carry the regex without the contract schema that
|
|
4
|
+
* embeds it.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* `App.publicEnv` key regex.
|
|
8
|
+
*
|
|
9
|
+
* Each key in `App.publicEnv` MUST match this pattern. The prefix is
|
|
10
|
+
* the **security boundary** — operators can't accidentally stash
|
|
11
|
+
* sensitive credentials under arbitrary names, and downstream consumers
|
|
12
|
+
* (render gate, bootstrap projection, iframe shim) can rely on the
|
|
13
|
+
* naming convention to mean "public-by-design".
|
|
14
|
+
*
|
|
15
|
+
* Rule: `GGUI_PUBLIC_APP_` prefix, then uppercase letters / digits /
|
|
16
|
+
* underscores, at least one char after the prefix.
|
|
17
|
+
*
|
|
18
|
+
* `GGUI_PUBLIC_USER_*` keys are RESERVED for a future per-user
|
|
19
|
+
* channel. The current regex rejects them so App-side config can't
|
|
20
|
+
* pre-emptively use the namespace.
|
|
21
|
+
*
|
|
22
|
+
* Hoisted above `gadgetDescriptorSchema` so the wrapper's `requires`
|
|
23
|
+
* array can reference it at schema-construction time (TDZ-safe).
|
|
24
|
+
*/
|
|
25
|
+
export const PUBLIC_ENV_APP_KEY_RE = /^GGUI_PUBLIC_APP_[A-Z0-9_]+$/;
|
|
@@ -7,8 +7,8 @@ export declare const renderInputEnvelopeSchema: z.ZodObject<{
|
|
|
7
7
|
model: z.ZodOptional<z.ZodString>;
|
|
8
8
|
}, z.core.$strict>>;
|
|
9
9
|
override: z.ZodOptional<z.ZodObject<{
|
|
10
|
-
contract: z.ZodOptional<z.ZodType<import("
|
|
11
|
-
variance: z.ZodOptional<z.ZodType<import("
|
|
10
|
+
contract: z.ZodOptional<z.ZodType<import("../index.js").DataContract, unknown, z.core.$ZodTypeInternals<import("../index.js").DataContract, unknown>>>;
|
|
11
|
+
variance: z.ZodOptional<z.ZodType<import("../index.js").BlueprintVariance, unknown, z.core.$ZodTypeInternals<import("../index.js").BlueprintVariance, unknown>>>;
|
|
12
12
|
}, z.core.$strict>>;
|
|
13
13
|
}, z.core.$strip>;
|
|
14
14
|
export declare const renderInputRouteGuardSchema: z.ZodObject<{
|
|
@@ -7,7 +7,7 @@ import { renderInputShape } from './mcp.js';
|
|
|
7
7
|
* either wire form (canonical `provider:model` or LiteLLM `provider/model`;
|
|
8
8
|
* aliases resolve in both). The render handler parses this BEFORE its
|
|
9
9
|
* pre-generation gate, so a malformed route is a contract error at zod path
|
|
10
|
-
* `infra.model` — never a policy refusal (`
|
|
10
|
+
* `infra.model` — never a policy refusal (`model_not_allowed` is reserved
|
|
11
11
|
* for a well-formed route with no rate row on the effective tier).
|
|
12
12
|
*
|
|
13
13
|
* Kept OUT of the registered shape on purpose: `@ggui-ai/iframe-runtime`
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounds the browser runtime shares with the server — its own module
|
|
3
|
+
* (ggui#819) so `@ggui-ai/protocol/wire` carries the number, not the tool
|
|
4
|
+
* schemas that enforce it.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Per-batch event cap on `ggui_runtime_telemetry` — a bounded
|
|
8
|
+
* fire-and-forget diagnostic channel, never a data plane.
|
|
9
|
+
*/
|
|
10
|
+
export declare const RUNTIME_TELEMETRY_MAX_EVENTS = 40;
|
|
11
|
+
//# sourceMappingURL=runtime-telemetry-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-telemetry-limits.d.ts","sourceRoot":"","sources":["../../src/schemas/runtime-telemetry-limits.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;GAGG;AACH,eAAO,MAAM,4BAA4B,KAAK,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounds the browser runtime shares with the server — its own module
|
|
3
|
+
* (ggui#819) so `@ggui-ai/protocol/wire` carries the number, not the tool
|
|
4
|
+
* schemas that enforce it.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Per-batch event cap on `ggui_runtime_telemetry` — a bounded
|
|
8
|
+
* fire-and-forget diagnostic channel, never a data plane.
|
|
9
|
+
*/
|
|
10
|
+
export const RUNTIME_TELEMETRY_MAX_EVENTS = 40;
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
* pay its type/build cost. Consumers that only need contract payloads
|
|
21
21
|
* stay on the root import.
|
|
22
22
|
*/
|
|
23
|
-
import type { ActionEnvelope } from '../types/events';
|
|
24
|
-
import type { JsonObject } from '../types/data-contract';
|
|
25
|
-
import type { SubscribePayload, AckPayload, ErrorPayload, RenderPayload, StreamEnvelope, PropsUpdatePayload, ChannelSubscribePayload, ChannelUnsubscribePayload, ChannelPayloadFrame, ChannelErrorPayload, DrainAckPayload } from '../types/live-channel';
|
|
26
|
-
import type { HostContextObservedPayload } from '../types/host-context';
|
|
27
|
-
import type { GguiSessionEvent } from '../types/ggui-session-event';
|
|
23
|
+
import type { ActionEnvelope } from '../types/events.js';
|
|
24
|
+
import type { JsonObject } from '../types/data-contract.js';
|
|
25
|
+
import type { SubscribePayload, AckPayload, ErrorPayload, RenderPayload, StreamEnvelope, PropsUpdatePayload, ChannelSubscribePayload, ChannelUnsubscribePayload, ChannelPayloadFrame, ChannelErrorPayload, DrainAckPayload } from '../types/live-channel.js';
|
|
26
|
+
import type { HostContextObservedPayload } from '../types/host-context.js';
|
|
27
|
+
import type { GguiSessionEvent } from '../types/ggui-session-event.js';
|
|
28
28
|
/**
|
|
29
29
|
* WebSocket message types for client-server communication.
|
|
30
30
|
* Each type maps to a specific payload shape in the {@link WebSocketMessage} discriminated union.
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* - `llm` — engine-generated. `generator` is the slug of the
|
|
13
13
|
* {@link UiGenerator} that produced the component code; `model` is
|
|
14
|
-
* the
|
|
14
|
+
* the route the engine called, as a `ModelRef`. Both REQUIRED: every
|
|
15
15
|
* generation mint site has them in scope, and an engine-generated
|
|
16
16
|
* artifact without them is not a real state.
|
|
17
17
|
* - `user` — developer-registered / hand-authored. Covers
|
|
@@ -30,21 +30,41 @@
|
|
|
30
30
|
* cache (invalidation = regeneration, never data loss), so unlabeled
|
|
31
31
|
* rows are dropped at the trust boundary, never coerced.
|
|
32
32
|
*/
|
|
33
|
+
import { type ModelRef } from "./llm-route.js";
|
|
33
34
|
/** Closed list of `BlueprintSource` discriminants. */
|
|
34
35
|
export declare const BLUEPRINT_SOURCE_KINDS: readonly ["llm", "user", "curated"];
|
|
35
36
|
/** Discriminant of {@link BlueprintSource}. */
|
|
36
37
|
export type BlueprintSourceKind = (typeof BLUEPRINT_SOURCE_KINDS)[number];
|
|
38
|
+
/**
|
|
39
|
+
* The de-modeled generator identity (ggui#924): `ui-gen-` + ONE tier token
|
|
40
|
+
* — `ui-gen-default`, `ui-gen-advanced`, or an operator-defined tier. No
|
|
41
|
+
* model segment: the model is its own field, so a model retirement never
|
|
42
|
+
* renames an identity or re-keys a stored record. The template admits any
|
|
43
|
+
* `ui-gen-*` at the type level; {@link isGeneratorId} is the grammar.
|
|
44
|
+
*/
|
|
45
|
+
export declare const GENERATOR_ID_PATTERN: RegExp;
|
|
46
|
+
/** A generator identity — see {@link GENERATOR_ID_PATTERN}. */
|
|
47
|
+
export type GeneratorId = `ui-gen-${string}`;
|
|
48
|
+
/** Whether `value` is a generator identity: one tier token, no model segment. */
|
|
49
|
+
export declare function isGeneratorId(value: string): value is GeneratorId;
|
|
37
50
|
/** Engine-generated — full engine provenance is mandatory. */
|
|
38
51
|
export interface LlmBlueprintSource {
|
|
39
52
|
readonly kind: "llm";
|
|
40
53
|
/**
|
|
41
|
-
*
|
|
42
|
-
* `'ui-gen-default
|
|
43
|
-
* the authority for which
|
|
54
|
+
* The generator identity that produced the component code (e.g.
|
|
55
|
+
* `'ui-gen-default'`), de-modeled — see {@link GENERATOR_ID_PATTERN}.
|
|
56
|
+
* The server's `GeneratorRegistry` is the authority for which
|
|
57
|
+
* identities exist on a given deployment.
|
|
58
|
+
*/
|
|
59
|
+
readonly generator: GeneratorId;
|
|
60
|
+
/**
|
|
61
|
+
* The route the generator's LLM call used, rendered in the registry's
|
|
62
|
+
* spelling (`<prefix>/<model>`; {@link ModelRef}, composed only by
|
|
63
|
+
* `modelRefOfRoute`). Registry ids (`'anthropic/claude-haiku-4-5'`) are
|
|
64
|
+
* the subset the registry lists; a self-hoster's bedrock or OpenRouter
|
|
65
|
+
* route is a ref too. One spelling per route: a dated wire id is refused.
|
|
44
66
|
*/
|
|
45
|
-
readonly
|
|
46
|
-
/** Model id of the LLM call the generator made. */
|
|
47
|
-
readonly model: string;
|
|
67
|
+
readonly model: ModelRef;
|
|
48
68
|
}
|
|
49
69
|
/** Developer-registered / hand-authored — no engine provenance exists. */
|
|
50
70
|
export interface UserBlueprintSource {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blueprint-source.d.ts","sourceRoot":"","sources":["../../src/types/blueprint-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;
|
|
1
|
+
{"version":3,"file":"blueprint-source.d.ts","sourceRoot":"","sources":["../../src/types/blueprint-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAExD,sDAAsD;AACtD,eAAO,MAAM,sBAAsB,qCAAsC,CAAC;AAE1E,+CAA+C;AAC/C,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,QAAuB,CAAC;AAEzD,+DAA+D;AAC/D,MAAM,MAAM,WAAW,GAAG,UAAU,MAAM,EAAE,CAAC;AAE7C,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,WAAW,CAEjE;AAED,8DAA8D;AAC9D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC1B;AAED,0EAA0E;AAC1E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,0EAA0E;AAC1E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CAC1B;AAED,MAAM,MAAM,eAAe,GACvB,kBAAkB,GAClB,mBAAmB,GACnB,sBAAsB,CAAC;AAE3B;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAuB3E;AAED,uDAAuD;AACvD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAE1E;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,0BAA0B;;;;CAI7B,CAAC;AAEX;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC;IACzC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,qEAAqE;AACrE,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,eAAe,GACtB,mBAAmB,CAQrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE;IACzC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC,GAAG,eAAe,GAAG,IAAI,CAMzB"}
|