@ggui-ai/protocol 0.9.0 → 0.10.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.
Files changed (59) hide show
  1. package/dist/gadgets/stdlib-gadgets.d.ts +1 -1
  2. package/dist/gadgets/stdlib-gadgets.d.ts.map +1 -1
  3. package/dist/gadgets/stdlib-gadgets.js +1 -1
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +7 -0
  7. package/dist/integrations/mcp-apps.d.ts +50 -1
  8. package/dist/integrations/mcp-apps.d.ts.map +1 -1
  9. package/dist/integrations/mcp-apps.js +67 -1
  10. package/dist/registry/props-schema-hash.d.ts +3 -0
  11. package/dist/registry/props-schema-hash.d.ts.map +1 -0
  12. package/dist/registry/props-schema-hash.js +23 -0
  13. package/dist/schemas/blueprint.d.ts +2 -0
  14. package/dist/schemas/blueprint.d.ts.map +1 -1
  15. package/dist/schemas/blueprint.js +9 -0
  16. package/dist/schemas/data-contract.d.ts +61 -7
  17. package/dist/schemas/data-contract.d.ts.map +1 -1
  18. package/dist/schemas/data-contract.js +73 -14
  19. package/dist/schemas/handshake-suggestion.d.ts +3 -6
  20. package/dist/schemas/handshake-suggestion.d.ts.map +1 -1
  21. package/dist/schemas/handshake-suggestion.js +11 -9
  22. package/dist/schemas/mcp.d.ts +20 -0
  23. package/dist/schemas/mcp.d.ts.map +1 -1
  24. package/dist/schemas/mcp.js +15 -1
  25. package/dist/schemas/ops-blueprint.d.ts +19 -10
  26. package/dist/schemas/ops-blueprint.d.ts.map +1 -1
  27. package/dist/schemas/ops-blueprint.js +39 -10
  28. package/dist/types/blueprint.d.ts +12 -0
  29. package/dist/types/blueprint.d.ts.map +1 -1
  30. package/dist/types/contract-inference.d.ts +5 -1
  31. package/dist/types/contract-inference.d.ts.map +1 -1
  32. package/dist/types/data-contract.d.ts +12 -2
  33. package/dist/types/data-contract.d.ts.map +1 -1
  34. package/dist/types/llm-route.d.ts +1 -1
  35. package/dist/types/llm-route.d.ts.map +1 -1
  36. package/dist/types/llm-route.js +1 -0
  37. package/dist/types/llm.d.ts +1 -1
  38. package/dist/types/llm.d.ts.map +1 -1
  39. package/dist/types/llm.js +22 -5
  40. package/dist/types/mcp.d.ts +26 -3
  41. package/dist/types/mcp.d.ts.map +1 -1
  42. package/dist/types/render.d.ts +33 -0
  43. package/dist/types/render.d.ts.map +1 -1
  44. package/dist/types/render.js +26 -1
  45. package/dist/validation/ajv-runtime.d.ts +26 -6
  46. package/dist/validation/ajv-runtime.d.ts.map +1 -1
  47. package/dist/validation/ajv-runtime.js +87 -9
  48. package/dist/validation/contract-validator.d.ts +104 -33
  49. package/dist/validation/contract-validator.d.ts.map +1 -1
  50. package/dist/validation/contract-validator.js +152 -42
  51. package/dist/validation/enforced-props-schema.d.ts +56 -0
  52. package/dist/validation/enforced-props-schema.d.ts.map +1 -0
  53. package/dist/validation/enforced-props-schema.js +232 -0
  54. package/dist/validation/schema-subset.d.ts.map +1 -1
  55. package/dist/validation/schema-subset.js +27 -10
  56. package/dist/version.d.ts +169 -2
  57. package/dist/version.d.ts.map +1 -1
  58. package/dist/version.js +168 -1
  59. package/package.json +7 -1
@@ -3,6 +3,7 @@ import type { PropsSpec, StreamSpec, ActionSpec, ContextSpec, ClientCapabilities
3
3
  import type { EndUserIdentity } from './auth';
4
4
  import type { HostContextProjection } from './host-context';
5
5
  import type { AppTheme } from '../schemas/app-theme';
6
+ import type { RenderErrorCode } from '../schemas/mcp';
6
7
  import type { McpAppsGguiSession } from '../integrations/mcp-apps';
7
8
  /**
8
9
  * Recognised system-card kinds the runtime renders via built-in
@@ -167,6 +168,22 @@ export interface GguiSessionBase {
167
168
  * ```
168
169
  */
169
170
  export type GguiSession<TProps = JsonObject> = ComponentGguiSession<TProps> | SystemGguiSession | McpAppsGguiSession;
171
+ /**
172
+ * Outcome-facet predicate (#495): true iff a generation failure was
173
+ * recorded on this render. The failure writer commits component
174
+ * renders only, so non-component variants are never errored. Rows
175
+ * written before {@link ComponentGguiSession.errorCode} existed carry
176
+ * {@link ComponentGguiSession.error} alone — either field's presence
177
+ * means errored. This is the single definition of "errored": store
178
+ * filters (`GguiSessionFilter.erroredOnly`) MUST match it.
179
+ */
180
+ export declare function isErroredGguiSession(render: GguiSession): boolean;
181
+ /**
182
+ * Companion accessor to {@link isErroredGguiSession}: the recorded
183
+ * failure classification, or `undefined` when the render is not
184
+ * errored or predates the `errorCode` field (message-only rows).
185
+ */
186
+ export declare function erroredGguiSessionCode(render: GguiSession): RenderErrorCode | undefined;
170
187
  /**
171
188
  * GguiSession variant: LLM-generated / native React component.
172
189
  *
@@ -195,6 +212,22 @@ export interface ComponentGguiSession<TProps = JsonObject> extends GguiSessionBa
195
212
  readonly schema?: JsonSchema;
196
213
  /** Generation error message (populated on failure). */
197
214
  readonly error?: string;
215
+ /**
216
+ * Canonical failure classification for the recorded failure —
217
+ * `renderErrorCodeSchema`'s closed enum, the same code the failed
218
+ * `ggui_render` result carried on the wire (#495).
219
+ *
220
+ * **Outcome facet, orthogonal to lifecycle.** {@link status} stays
221
+ * `'active' | 'expired'` — an errored row still TTL-expires like any
222
+ * other; "errored" means a generation failure was recorded here, not
223
+ * a third lifecycle state. Written by exactly one site (the error
224
+ * commit in `@ggui-ai/mcp-server-handlers`' render handler) in the
225
+ * same commit as {@link error}; invariant: `errorCode` present ⇒
226
+ * `error` present. Rows written before this field exists carry
227
+ * `error` alone — readers filtering "errored" MUST treat either
228
+ * field's presence as errored.
229
+ */
230
+ readonly errorCode?: RenderErrorCode;
198
231
  /** Stream contract — describes what data the component accepts in
199
232
  * real-time via `ggui_emit`. */
200
233
  readonly streamSpec?: StreamSpec;
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/types/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EACV,SAAS,EACT,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B,EAAE,CAAC;IACzD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;IAC1B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,UAAU,CAAC;CACvC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB,CAAC,MAAM,SAAS,UAAU,GAAG,UAAU,CACvE,SAAQ,eAAe;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,gDAAgD;IAChD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAMD;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB,CAAC,SAAS,GAAG,UAAU;IACtD,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -1 +1,26 @@
1
- export {};
1
+ /**
2
+ * Outcome-facet predicate (#495): true iff a generation failure was
3
+ * recorded on this render. The failure writer commits component
4
+ * renders only, so non-component variants are never errored. Rows
5
+ * written before {@link ComponentGguiSession.errorCode} existed carry
6
+ * {@link ComponentGguiSession.error} alone — either field's presence
7
+ * means errored. This is the single definition of "errored": store
8
+ * filters (`GguiSessionFilter.erroredOnly`) MUST match it.
9
+ */
10
+ export function isErroredGguiSession(render) {
11
+ // `type` absent ⇒ component (back-compat default, see the variant's
12
+ // discriminator docstring below).
13
+ if (render.type !== undefined && render.type !== 'component')
14
+ return false;
15
+ return render.errorCode !== undefined || render.error !== undefined;
16
+ }
17
+ /**
18
+ * Companion accessor to {@link isErroredGguiSession}: the recorded
19
+ * failure classification, or `undefined` when the render is not
20
+ * errored or predates the `errorCode` field (message-only rows).
21
+ */
22
+ export function erroredGguiSessionCode(render) {
23
+ if (render.type !== undefined && render.type !== 'component')
24
+ return undefined;
25
+ return render.errorCode;
26
+ }
@@ -29,12 +29,18 @@
29
29
  *
30
30
  * Tolerated metadata keywords:
31
31
  * - `example` (singular, OpenAPI-ish; JSON Schema standard is
32
- * `examples` array). Treated as informational.
33
- * - `nullable` (OpenAPI 3.0 shorthand). Tolerated; the canonical
34
- * way to express nullability is `type: [<original>, 'null']`.
35
- *
36
- * Both are registered as no-op keywords so Ajv strict mode doesn't
37
- * reject schemas that carry them.
32
+ * `examples` array). Registered by us as a genuine no-op keyword
33
+ * (informational only) so strict mode doesn't reject it.
34
+ * - `nullable` (OpenAPI 3.0 shorthand). NOT a no-op: Ajv 8
35
+ * pre-registers `nullable` itself with WIDENING semantics —
36
+ * `{type:'string', nullable:true}` accepts `null` (empirically
37
+ * verified 2026-08-19; the `getKeyword` guard below never fires
38
+ * for it). Behaviorally equivalent to the canonical
39
+ * `type: [<original>, 'null']` union, which is what the enforced
40
+ * props schema emission (`buildEnforcedPropsSchema`) rewrites it
41
+ * to — the wire artifact carries the widening explicitly so a
42
+ * strict reader of the emitted schema sees the same acceptance
43
+ * the validator enforces.
38
44
  */
39
45
  import type { ErrorObject, ValidateFunction } from 'ajv';
40
46
  /**
@@ -102,6 +108,20 @@ export declare function compileForValidation(schema: JsonSchema): ValidateFuncti
102
108
  * layer-B meta-validation side effect as {@link compileForValidation}.
103
109
  */
104
110
  export declare function compileValidatorModule(schema: JsonSchema): string;
111
+ /**
112
+ * Compile a JSON Schema into a standalone validator as a JS
113
+ * **EXPRESSION** — an IIFE over the CJS standalone emission, runtime
114
+ * helpers inlined, evaluating to the validate function.
115
+ *
116
+ * The expression form is what makes the eval-free EXECUTABLE contract
117
+ * bundle possible (ggui#522 slice 2): N validators concatenate into
118
+ * ONE plain ES module (`v.actions["submit"] = <expr>;`) that a
119
+ * strict-CSP iframe imports directly — no per-validator `blob:`
120
+ * import, no `new Function`, the browser just parses code. Closed
121
+ * shape + strict-mode meta-validation semantics are identical to
122
+ * {@link compileValidatorModule} (same options, same injection).
123
+ */
124
+ export declare function compileValidatorFunctionExpr(schema: JsonSchema): string;
105
125
  /**
106
126
  * Convert Ajv error objects into our {@link ContractViolation} shape.
107
127
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ajv-runtime.d.ts","sourceRoot":"","sources":["../../src/validation/ajv-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAGzD;;;;;GAKG;AACH,YAAY,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAI5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAoF9D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAqChE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,gBAAgB,CAGzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAIjE;AA4DD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,GAAG,SAAS,EACxC,IAAI,EAAE,OAAO,GACZ,iBAAiB,EAAE,CAGrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,iBAAiB,EAAE,EAC/B,MAAM,EAAE,MAAM,GACb,iBAAiB,EAAE,CAMrB"}
1
+ {"version":3,"file":"ajv-runtime.d.ts","sourceRoot":"","sources":["../../src/validation/ajv-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAGzD;;;;;GAKG;AACH,YAAY,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAI5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAyG9D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CA4ChE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,gBAAgB,CAGzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAIjE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAWvE;AAqFD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,GAAG,SAAS,EACxC,IAAI,EAAE,OAAO,GACZ,iBAAiB,EAAE,CAUrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,iBAAiB,EAAE,EAC/B,MAAM,EAAE,MAAM,GACb,iBAAiB,EAAE,CAMrB"}
@@ -29,12 +29,18 @@
29
29
  *
30
30
  * Tolerated metadata keywords:
31
31
  * - `example` (singular, OpenAPI-ish; JSON Schema standard is
32
- * `examples` array). Treated as informational.
33
- * - `nullable` (OpenAPI 3.0 shorthand). Tolerated; the canonical
34
- * way to express nullability is `type: [<original>, 'null']`.
35
- *
36
- * Both are registered as no-op keywords so Ajv strict mode doesn't
37
- * reject schemas that carry them.
32
+ * `examples` array). Registered by us as a genuine no-op keyword
33
+ * (informational only) so strict mode doesn't reject it.
34
+ * - `nullable` (OpenAPI 3.0 shorthand). NOT a no-op: Ajv 8
35
+ * pre-registers `nullable` itself with WIDENING semantics —
36
+ * `{type:'string', nullable:true}` accepts `null` (empirically
37
+ * verified 2026-08-19; the `getKeyword` guard below never fires
38
+ * for it). Behaviorally equivalent to the canonical
39
+ * `type: [<original>, 'null']` union, which is what the enforced
40
+ * props schema emission (`buildEnforcedPropsSchema`) rewrites it
41
+ * to — the wire artifact carries the widening explicitly so a
42
+ * strict reader of the emitted schema sees the same acceptance
43
+ * the validator enforces.
38
44
  */
39
45
  import Ajv from 'ajv';
40
46
  import addFormats from 'ajv-formats';
@@ -118,6 +124,25 @@ if (!standaloneAjv.getKeyword('example')) {
118
124
  if (!standaloneAjv.getKeyword('nullable')) {
119
125
  standaloneAjv.addKeyword({ keyword: 'nullable' });
120
126
  }
127
+ /**
128
+ * A third instance for {@link compileValidatorFunctionExpr} — CJS
129
+ * standalone emission (`code.esm` off). CJS sources can be wrapped in
130
+ * a function scope and CONCATENATED into one executable bundle module
131
+ * (ggui#522 slice 2); ESM sources cannot — `export` is illegal inside
132
+ * a function body, which is why the v1 bundle carried them as strings
133
+ * the iframe had to `blob:`-import one by one.
134
+ */
135
+ const standaloneCjsAjv = new Ajv({
136
+ ...AJV_OPTIONS,
137
+ code: { source: true },
138
+ });
139
+ addFormats(standaloneCjsAjv);
140
+ if (!standaloneCjsAjv.getKeyword('example')) {
141
+ standaloneCjsAjv.addKeyword({ keyword: 'example' });
142
+ }
143
+ if (!standaloneCjsAjv.getKeyword('nullable')) {
144
+ standaloneCjsAjv.addKeyword({ keyword: 'nullable' });
145
+ }
121
146
  /**
122
147
  * Recursively walk a JSON Schema and inject
123
148
  * `additionalProperties: false` at every object node. Authors who
@@ -133,7 +158,12 @@ if (!standaloneAjv.getKeyword('nullable')) {
133
158
  * Returns a new schema tree; never mutates the input.
134
159
  */
135
160
  export function injectClosedShape(schema) {
136
- const isObjectNode = schema.type === 'object' || schema.properties !== undefined;
161
+ // `type` may be a draft-07 type ARRAY (`['object','null']` — the
162
+ // canonical nullable form since draft-2026-08-19); read it as a SET
163
+ // so nullable object/array nodes get the same closed-shape treatment
164
+ // as their single-type forms.
165
+ const typeSet = new Set(Array.isArray(schema.type) ? schema.type : schema.type ? [schema.type] : []);
166
+ const isObjectNode = typeSet.has('object') || schema.properties !== undefined;
137
167
  if (isObjectNode) {
138
168
  const out = { ...schema };
139
169
  if (out.properties) {
@@ -155,7 +185,7 @@ export function injectClosedShape(schema) {
155
185
  out.anyOf = out.anyOf.map(injectClosedShape);
156
186
  return out;
157
187
  }
158
- if (schema.type === 'array' && schema.items) {
188
+ if (typeSet.has('array') && schema.items) {
159
189
  return { ...schema, items: injectClosedShape(schema.items) };
160
190
  }
161
191
  if (schema.oneOf || schema.anyOf) {
@@ -216,6 +246,27 @@ export function compileValidatorModule(schema) {
216
246
  const validate = standaloneAjv.compile(injected);
217
247
  return inlineRuntimeHelpers(standaloneCode(standaloneAjv, validate));
218
248
  }
249
+ /**
250
+ * Compile a JSON Schema into a standalone validator as a JS
251
+ * **EXPRESSION** — an IIFE over the CJS standalone emission, runtime
252
+ * helpers inlined, evaluating to the validate function.
253
+ *
254
+ * The expression form is what makes the eval-free EXECUTABLE contract
255
+ * bundle possible (ggui#522 slice 2): N validators concatenate into
256
+ * ONE plain ES module (`v.actions["submit"] = <expr>;`) that a
257
+ * strict-CSP iframe imports directly — no per-validator `blob:`
258
+ * import, no `new Function`, the browser just parses code. Closed
259
+ * shape + strict-mode meta-validation semantics are identical to
260
+ * {@link compileValidatorModule} (same options, same injection).
261
+ */
262
+ export function compileValidatorFunctionExpr(schema) {
263
+ const injected = injectClosedShape(schema);
264
+ const validate = standaloneCjsAjv.compile(injected);
265
+ const source = inlineRuntimeHelpersCjs(standaloneCode(standaloneCjsAjv, validate));
266
+ return (`(function(){var module={exports:{}};var exports=module.exports;\n` +
267
+ `${source}\n` +
268
+ `return module.exports.default||module.exports;})()`);
269
+ }
219
270
  /**
220
271
  * Inlinable Ajv runtime helpers, keyed by bare specifier. Ajv standalone
221
272
  * references these by `import`; the CSP-sandboxed iframe has no bundler
@@ -258,6 +309,26 @@ function inlineRuntimeHelpers(source) {
258
309
  }
259
310
  return out;
260
311
  }
312
+ /**
313
+ * CJS twin of {@link inlineRuntimeHelpers} for
314
+ * {@link compileValidatorFunctionExpr}: inline each supported runtime
315
+ * helper's source in place of its `require(...)`, keeping the emission
316
+ * CJS throughout (no `import` may appear — the result is embedded
317
+ * inside a function body). Same survivor check, on the `require` form.
318
+ */
319
+ function inlineRuntimeHelpersCjs(source) {
320
+ const out = source.replace(/const (\w+) = require\("([^"]+)"\)(\.default)?;/g, (match, binding, specifier) => {
321
+ const helperSource = RUNTIME_HELPER_SOURCES[specifier];
322
+ if (helperSource === undefined)
323
+ return match;
324
+ return `const ${binding} = ${helperSource};`;
325
+ });
326
+ const leftover = /require\("(ajv\/dist\/runtime\/[^"]+)"\)/.exec(out);
327
+ if (leftover) {
328
+ throw new Error(`compileValidatorFunctionExpr: emitted validator has an un-inlined require of "${leftover[1]}". Add it to RUNTIME_HELPER_SOURCES.`);
329
+ }
330
+ return out;
331
+ }
261
332
  /**
262
333
  * Convert Ajv error objects into our {@link ContractViolation} shape.
263
334
  *
@@ -282,7 +353,14 @@ function inlineRuntimeHelpers(source) {
282
353
  export function mapAjvErrorsToViolations(errors, data) {
283
354
  if (!errors)
284
355
  return [];
285
- return errors.map(err => mapOne(err, data));
356
+ // `keyword` is stamped uniformly at this single assembly seam (not
357
+ // per-case inside `mapOne`) so every mapped violation — including
358
+ // the default-case fallthrough — retains the producing JSON Schema
359
+ // keyword for downstream failure-class segmentation.
360
+ return errors.map(err => ({
361
+ ...mapOne(err, data),
362
+ ...(err.keyword ? { keyword: err.keyword } : {}),
363
+ }));
286
364
  }
287
365
  /**
288
366
  * Re-anchor a list of Ajv-mapped violations under a stable field
@@ -9,6 +9,16 @@ export interface ContractViolation extends JsonObject {
9
9
  message: string;
10
10
  expected?: string;
11
11
  received?: string;
12
+ /**
13
+ * The JSON Schema keyword whose assertion failed (`'enum'`,
14
+ * `'required'`, `'type'`, `'additionalProperties'`, …) — retained
15
+ * verbatim from the underlying validator error. Absent on synthetic
16
+ * violations that no schema keyword produced (e.g. the
17
+ * props-without-propsSpec rejection). Consumers segment failure
18
+ * classes on it (telemetry `violationKeywords`); it is additive
19
+ * metadata, never part of the violation's identity.
20
+ */
21
+ keyword?: string;
12
22
  }
13
23
  export interface ValidationResult {
14
24
  valid: boolean;
@@ -29,6 +39,19 @@ export interface ValidationResult {
29
39
  * semantics to the runtime validator — one synthesis, no drift.
30
40
  */
31
41
  export declare function buildPropsWrapperSchema(spec: PropsSpec): JsonSchema;
42
+ /**
43
+ * Validate runtime props against an EXPLICIT enforced schema — the
44
+ * persisted-schema render path of the schema-precise render contract
45
+ * (docs/plans/2026-08-19-schema-precise-render.md P1). The paired
46
+ * `ggui_handshake` persists the exact `buildEnforcedPropsSchema`
47
+ * artifact it returned on the wire; `ggui_render` validates against
48
+ * that PERSISTED schema rather than recomputing from the propsSpec,
49
+ * so the returned and enforced schemas cannot diverge under
50
+ * rolling-deploy version skew (the AUTHORITY obligation is structural,
51
+ * not best-effort). Closed-shape injection at compile is idempotent —
52
+ * a pre-injected enforced schema round-trips unchanged.
53
+ */
54
+ export declare function validatePropsDataWithSchema(props: Record<string, unknown>, schema: JsonSchema): ValidationResult;
32
55
  /**
33
56
  * Validate runtime props data against a PropsSpec contract.
34
57
  *
@@ -199,45 +222,78 @@ export declare function compileContractValidators(specs: {
199
222
  readonly contextSpec?: ContextSpec;
200
223
  }): CompiledContractValidators | undefined;
201
224
  /**
202
- * Wrap a {@link CompiledContractValidators} object as the source text of
203
- * an ES module whose `default` export is the same object. This is the
204
- * wire format served from the content-addressable contract route
205
- * (`GET /contract/<hash>.js`) in #109's decomposition slice — one URL,
206
- * one fetch, one dynamic-import per unique contract.
225
+ * A contract's runtime-validator compilation in **expression form** —
226
+ * same grouping as {@link CompiledContractValidators}, but each string
227
+ * is a JS EXPRESSION evaluating to the validate function (see
228
+ * `compileValidatorFunctionExpr`), not an ESM module source. The
229
+ * expression form exists so the executable bundle below can be one
230
+ * plain module; the ESM-module form remains the inline
231
+ * `_meta.compiledValidators` channel's shape.
232
+ *
233
+ * @public
234
+ */
235
+ export interface ContractValidatorExprs {
236
+ readonly props?: string;
237
+ readonly actions?: Readonly<Record<string, string>>;
238
+ readonly streams?: Readonly<Record<string, string>>;
239
+ readonly context?: Readonly<Record<string, string>>;
240
+ }
241
+ /**
242
+ * Compile a contract's runtime-validated sub-schemas into
243
+ * expression-form validators ({@link ContractValidatorExprs}) — the
244
+ * same four surfaces, guards, and closed-shape semantics as
245
+ * {@link compileContractValidators}, differing only in emission form.
246
+ * Returns `undefined` when the contract declares no runtime-validated
247
+ * schema at all.
248
+ */
249
+ export declare function compileContractValidatorExprs(specs: {
250
+ readonly propsSpec?: PropsSpec;
251
+ readonly actionSpec?: ActionSpec;
252
+ readonly streamSpec?: StreamSpec;
253
+ readonly contextSpec?: ContextSpec;
254
+ }): ContractValidatorExprs | undefined;
255
+ /**
256
+ * Wrap {@link ContractValidatorExprs} as the source text of ONE plain
257
+ * ES module whose `default` export carries the validate FUNCTIONS
258
+ * themselves — the v2 wire format of the content-addressable contract
259
+ * route (`GET /contract/<hash>.js`), ggui#522 slice 2.
207
260
  *
208
- * Why a wrapping module rather than emitting the validator-modules
209
- * raw: each inner validator-module is independently `export default ...`,
210
- * so they can't share a single file without name collisions. The
211
- * iframe-runtime's existing `loadCompiledValidators` already knows how
212
- * to take a `CompiledContractValidators` and load each inner module via
213
- * `blob:` import; this wrapper just hands it the same shape it expects,
214
- * sourced from one HTTP round-trip instead of inline.
261
+ * The v1 format exported the validator-module SOURCES as strings, so
262
+ * the iframe still needed one `blob:` dynamic import per validator —
263
+ * exactly the scheme-source grant a strict host CSP refuses, which
264
+ * made client-side validation silently fail open on such hosts. Here
265
+ * the expressions concatenate at BUILD time into ordinary code: the
266
+ * frame does one `import(validatorsUrl)` (a plain https module load,
267
+ * governed by `script-src` origins alone) and receives functions. No
268
+ * `blob:`, no `data:`, no eval anywhere.
215
269
  *
216
- * `JSON.stringify` is deterministic on objects with string keys in V8
217
- * + Node — the producer's iteration order is preserved, so a given
218
- * contract always serializes to identical bytes. {@link computeContractBundle}
219
- * leans on that determinism so the resulting hash is stable across
220
- * renders of the same contract.
270
+ * Key emission order follows the producer's iteration order, which is
271
+ * deterministic in V8/Node for string keys — {@link computeContractBundle}
272
+ * hashes the INPUT specs anyway, so byte-level determinism of this
273
+ * source is a courtesy, not a correctness requirement.
221
274
  *
222
275
  * @public
223
276
  */
224
- export declare function bundleCompiledValidatorsAsModule(compiled: CompiledContractValidators): string;
277
+ export declare function bundleValidatorExprsAsExecutableModule(exprs: ContractValidatorExprs): string;
225
278
  /**
226
- * Convenience over {@link compileContractValidators} +
227
- * {@link bundleCompiledValidatorsAsModule} + sha256 — produces the
228
- * `{contractHash, bundleSource, validators}` triple the emitter (render.ts
229
- * / update.ts in #109 C4) writes to the content-addressable store and
230
- * emits as `_meta["ai.ggui/contract"] = {contractHash, validatorsUrl}`.
279
+ * Convenience over {@link compileContractValidatorExprs} +
280
+ * {@link bundleValidatorExprsAsExecutableModule} + sha256 — produces
281
+ * the `{contractHash, bundleSource, validators}` triple the emitter
282
+ * (render.ts / the resource read / the /state route) writes to the
283
+ * content-addressable store and emits as
284
+ * `{contractHash, validatorsUrl}` on the render slice.
231
285
  *
232
- * `contractHash` is `sha256(canonicalJsonStringify(specs))` (hex). Hashing
233
- * the INPUT specs — not the compiled output — guarantees a stable hash
234
- * across server processes and Ajv version bumps: the same contract
235
- * definition always lands at the same URL. Compiled output bytes may
236
- * differ across calls (Ajv's standalone emitter uses incrementing
237
- * counter names like `validate10`/`validate11`), but the CodeStore is
238
- * idempotent (first write wins) and the URL response carries
239
- * `Cache-Control: immutable`, so browsers + CDNs lock in the
240
- * first-served bytes and never observe a counter-name reshuffle.
286
+ * `contractHash` is `sha256(salt + canonicalJsonStringify(specs))`
287
+ * (hex). Hashing the INPUT specs — not the compiled output —
288
+ * guarantees a stable hash across server processes and Ajv version
289
+ * bumps: the same contract definition always lands at the same URL.
290
+ * Compiled output bytes may differ across calls (Ajv's standalone
291
+ * emitter uses incrementing counter names like `validate10`/
292
+ * `validate11`), but the CodeStore is idempotent (first write wins)
293
+ * and the URL response carries `Cache-Control: immutable`, so browsers
294
+ * + CDNs lock in the first-served bytes and never observe a
295
+ * counter-name reshuffle. The salt exists precisely because of that
296
+ * immutability — see {@link CONTRACT_BUNDLE_HASH_SALT}.
241
297
  *
242
298
  * Returns `undefined` when the contract declares no runtime-validated
243
299
  * schema at all (matches {@link compileContractValidators}'s posture).
@@ -252,7 +308,7 @@ export declare function computeContractBundle(specs: {
252
308
  }): Promise<{
253
309
  readonly contractHash: string;
254
310
  readonly bundleSource: string;
255
- readonly validators: CompiledContractValidators;
311
+ readonly validators: ContractValidatorExprs;
256
312
  } | undefined>;
257
313
  /**
258
314
  * Format violations into a human-readable error message for the target agent.
@@ -285,10 +341,24 @@ export declare class ContractViolationError extends Error {
285
341
  readonly violations: ContractViolation[];
286
342
  readonly tool: 'ggui_render' | 'ggui_update' | 'ggui_amend' | 'ggui_emit' | 'ggui_event';
287
343
  readonly hint: string;
344
+ /**
345
+ * sha256 (lowercase hex) of the RFC 8785 canonical bytes of the
346
+ * ENFORCED props schema this violation was validated against —
347
+ * present when the enforcing site holds one (the handshake-persisted
348
+ * schema on the render path). The breach classifier of the
349
+ * schema-precise render contract: a caller holding the handshake's
350
+ * `propsSchemaHash` compares it to this value — mismatch means the
351
+ * server enforced a different schema than it returned (server
352
+ * breach); match means the props themselves were at fault. Absent on
353
+ * violations produced without an enforced-schema identity (synthetic
354
+ * violations, stream/context/action validation).
355
+ */
356
+ readonly propsSchemaHash?: string;
288
357
  constructor(opts: {
289
358
  tool: 'ggui_render' | 'ggui_update' | 'ggui_amend' | 'ggui_emit' | 'ggui_event';
290
359
  violations: ContractViolation[];
291
360
  hint?: string;
361
+ propsSchemaHash?: string;
292
362
  });
293
363
  /** Structured payload for MCP error response `data` field. */
294
364
  toErrorData(): {
@@ -296,6 +366,7 @@ export declare class ContractViolationError extends Error {
296
366
  tool: string;
297
367
  violations: ContractViolation[];
298
368
  hint: string;
369
+ propsSchemaHash?: string;
299
370
  };
300
371
  }
301
372
  //# sourceMappingURL=contract-validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-validator.d.ts","sourceRoot":"","sources":["../../src/validation/contract-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEnI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAO3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAItD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAKtD,OAAO,EAKL,KAAK,wBAAwB,EAC9B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED;;;;;;;;;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