@ggui-ai/protocol 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.
Files changed (200) hide show
  1. package/README.md +16 -16
  2. package/dist/envelope-adapters.d.ts +6 -5
  3. package/dist/envelope-adapters.d.ts.map +1 -1
  4. package/dist/envelope-adapters.js +3 -3
  5. package/dist/envelopes/builders.d.ts +6 -32
  6. package/dist/envelopes/builders.d.ts.map +1 -1
  7. package/dist/envelopes/builders.js +3 -25
  8. package/dist/errors/version-mismatch.d.ts +1 -1
  9. package/dist/errors/version-mismatch.js +1 -1
  10. package/dist/gadgets/resolve-app-gadgets.d.ts +10 -0
  11. package/dist/gadgets/resolve-app-gadgets.d.ts.map +1 -0
  12. package/dist/gadgets/resolve-app-gadgets.js +19 -0
  13. package/dist/gadgets/resolve-contract-gadgets.d.ts +6 -6
  14. package/dist/gadgets/resolve-contract-gadgets.js +5 -5
  15. package/dist/gadgets/stdlib-gadgets.d.ts +1 -1
  16. package/dist/gadgets/stdlib-gadgets.d.ts.map +1 -1
  17. package/dist/gadgets/stdlib-gadgets.js +43 -22
  18. package/dist/iframe-bridge.d.ts +4 -43
  19. package/dist/iframe-bridge.d.ts.map +1 -1
  20. package/dist/iframe-bridge.js +4 -141
  21. package/dist/index.d.ts +60 -62
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +66 -61
  24. package/dist/integrations/mcp-apps.d.ts +83 -38
  25. package/dist/integrations/mcp-apps.d.ts.map +1 -1
  26. package/dist/integrations/mcp-apps.js +98 -52
  27. package/dist/recommended-prompts.d.ts +1 -1
  28. package/dist/recommended-prompts.js +1 -1
  29. package/dist/registry/blueprint-key.d.ts +3 -0
  30. package/dist/registry/blueprint-key.d.ts.map +1 -1
  31. package/dist/registry/blueprint-key.js +9 -0
  32. package/dist/registry/blueprint-stamp.d.ts +12 -0
  33. package/dist/registry/blueprint-stamp.d.ts.map +1 -0
  34. package/dist/registry/blueprint-stamp.js +12 -0
  35. package/dist/registry/canonicalize-contract.d.ts +31 -2
  36. package/dist/registry/canonicalize-contract.d.ts.map +1 -1
  37. package/dist/registry/canonicalize-contract.js +125 -13
  38. package/dist/registry/portable-blueprint.d.ts +71 -0
  39. package/dist/registry/portable-blueprint.d.ts.map +1 -0
  40. package/dist/registry/portable-blueprint.js +111 -0
  41. package/dist/registry/summarize-contract.d.ts +7 -2
  42. package/dist/registry/summarize-contract.d.ts.map +1 -1
  43. package/dist/registry/summarize-contract.js +12 -3
  44. package/dist/registry/variant-key.d.ts +17 -0
  45. package/dist/registry/variant-key.d.ts.map +1 -0
  46. package/dist/registry/variant-key.js +22 -0
  47. package/dist/schema-learning/derive-contract.d.ts +2 -2
  48. package/dist/schema-learning/derive-contract.js +2 -2
  49. package/dist/schema-learning/merge.d.ts.map +1 -1
  50. package/dist/schema-learning/merge.js +3 -2
  51. package/dist/schemas/app-theme.d.ts +38 -0
  52. package/dist/schemas/app-theme.d.ts.map +1 -0
  53. package/dist/schemas/app-theme.js +43 -0
  54. package/dist/schemas/blueprint.d.ts +30 -11
  55. package/dist/schemas/blueprint.d.ts.map +1 -1
  56. package/dist/schemas/blueprint.js +62 -26
  57. package/dist/schemas/data-contract.d.ts +28 -30
  58. package/dist/schemas/data-contract.d.ts.map +1 -1
  59. package/dist/schemas/data-contract.js +26 -26
  60. package/dist/schemas/handshake-suggestion.d.ts +2 -4
  61. package/dist/schemas/handshake-suggestion.d.ts.map +1 -1
  62. package/dist/schemas/handshake-suggestion.js +5 -14
  63. package/dist/schemas/mcp.d.ts +294 -59
  64. package/dist/schemas/mcp.d.ts.map +1 -1
  65. package/dist/schemas/mcp.js +350 -94
  66. package/dist/schemas/ops-blueprint.d.ts +12 -12
  67. package/dist/schemas/ops-blueprint.d.ts.map +1 -1
  68. package/dist/schemas/ops-blueprint.js +14 -24
  69. package/dist/screen-blueprints/define.d.ts +2 -2
  70. package/dist/screen-blueprints/match.d.ts +12 -7
  71. package/dist/screen-blueprints/match.d.ts.map +1 -1
  72. package/dist/screen-blueprints/match.js +7 -5
  73. package/dist/screen-blueprints/types.d.ts +14 -18
  74. package/dist/screen-blueprints/types.d.ts.map +1 -1
  75. package/dist/transport/websocket.d.ts +5 -26
  76. package/dist/transport/websocket.d.ts.map +1 -1
  77. package/dist/types/app-config.d.ts +0 -1
  78. package/dist/types/app-config.d.ts.map +1 -1
  79. package/dist/types/auth.d.ts +1 -46
  80. package/dist/types/auth.d.ts.map +1 -1
  81. package/dist/types/blueprint-source.d.ts +123 -0
  82. package/dist/types/blueprint-source.d.ts.map +1 -0
  83. package/dist/types/blueprint-source.js +126 -0
  84. package/dist/types/blueprint.d.ts +25 -18
  85. package/dist/types/blueprint.d.ts.map +1 -1
  86. package/dist/types/contract-inference.d.ts +2 -43
  87. package/dist/types/contract-inference.d.ts.map +1 -1
  88. package/dist/types/data-contract.d.ts +59 -344
  89. package/dist/types/data-contract.d.ts.map +1 -1
  90. package/dist/types/data-contract.js +5 -12
  91. package/dist/types/events.d.ts +31 -69
  92. package/dist/types/events.d.ts.map +1 -1
  93. package/dist/types/{render-event.d.ts → ggui-session-event.d.ts} +15 -15
  94. package/dist/types/ggui-session-event.d.ts.map +1 -0
  95. package/dist/types/{render-event.js → ggui-session-event.js} +5 -5
  96. package/dist/types/handshake-suggestion.d.ts +49 -35
  97. package/dist/types/handshake-suggestion.d.ts.map +1 -1
  98. package/dist/types/host-context.d.ts +8 -8
  99. package/dist/types/host-context.d.ts.map +1 -1
  100. package/dist/types/host-context.js +5 -5
  101. package/dist/types/invoke.d.ts +1 -13
  102. package/dist/types/invoke.d.ts.map +1 -1
  103. package/dist/types/{canvas-lifecycle.d.ts → lifecycle.d.ts} +35 -37
  104. package/dist/types/lifecycle.d.ts.map +1 -0
  105. package/dist/types/{canvas-lifecycle.js → lifecycle.js} +12 -14
  106. package/dist/types/live-channel.d.ts +48 -104
  107. package/dist/types/live-channel.d.ts.map +1 -1
  108. package/dist/types/llm-route.d.ts +4 -4
  109. package/dist/types/llm-route.d.ts.map +1 -1
  110. package/dist/types/llm-route.js +24 -2
  111. package/dist/types/llm.d.ts +13 -24
  112. package/dist/types/llm.d.ts.map +1 -1
  113. package/dist/types/llm.js +23 -53
  114. package/dist/types/mcp.d.ts +74 -177
  115. package/dist/types/mcp.d.ts.map +1 -1
  116. package/dist/types/mcp.js +11 -4
  117. package/dist/types/oauth-user-id.d.ts +12 -0
  118. package/dist/types/oauth-user-id.d.ts.map +1 -0
  119. package/dist/types/oauth-user-id.js +10 -0
  120. package/dist/types/portable-blueprint.d.ts +61 -0
  121. package/dist/types/portable-blueprint.d.ts.map +1 -0
  122. package/dist/types/portable-blueprint.js +8 -0
  123. package/dist/types/{session.d.ts → render.d.ts} +51 -53
  124. package/dist/types/render.d.ts.map +1 -0
  125. package/dist/types/thread.d.ts.map +1 -1
  126. package/dist/types/thread.js +3 -3
  127. package/dist/types/ui-generator.d.ts +24 -47
  128. package/dist/types/ui-generator.d.ts.map +1 -1
  129. package/dist/types/ui-generator.js +1 -53
  130. package/dist/validation/ajv-runtime.d.ts +3 -3
  131. package/dist/validation/ajv-runtime.d.ts.map +1 -1
  132. package/dist/validation/ajv-runtime.js +6 -5
  133. package/dist/validation/contract-validator.d.ts +23 -22
  134. package/dist/validation/contract-validator.d.ts.map +1 -1
  135. package/dist/validation/contract-validator.js +28 -26
  136. package/dist/validation/cross-references.d.ts +3 -3
  137. package/dist/validation/cross-references.js +3 -3
  138. package/dist/validation/hygiene-rules.d.ts +9 -9
  139. package/dist/validation/hygiene-rules.js +13 -13
  140. package/dist/validation/is-record.d.ts +17 -0
  141. package/dist/validation/is-record.d.ts.map +1 -0
  142. package/dist/validation/is-record.js +18 -0
  143. package/dist/validation/lint-contract.d.ts +1 -1
  144. package/dist/validation/lint-contract.js +3 -3
  145. package/dist/validation/name-invariants.d.ts +4 -4
  146. package/dist/validation/name-invariants.js +4 -4
  147. package/dist/validation/reserved-channels.d.ts +43 -46
  148. package/dist/validation/reserved-channels.d.ts.map +1 -1
  149. package/dist/validation/reserved-channels.js +14 -177
  150. package/dist/validation/resolve-stream-channel.d.ts +3 -9
  151. package/dist/validation/resolve-stream-channel.d.ts.map +1 -1
  152. package/dist/validation/resolve-stream-channel.js +3 -4
  153. package/dist/validation/sanitize-error.d.ts +10 -9
  154. package/dist/validation/sanitize-error.d.ts.map +1 -1
  155. package/dist/validation/sanitize-error.js +19 -18
  156. package/dist/validation/schema-compat-invariants.d.ts +1 -1
  157. package/dist/validation/schema-compat-invariants.js +3 -3
  158. package/dist/validation/schema-meta-validation.d.ts +4 -4
  159. package/dist/validation/schema-meta-validation.d.ts.map +1 -1
  160. package/dist/validation/schema-meta-validation.js +7 -9
  161. package/dist/validation/schema-subset.d.ts +9 -8
  162. package/dist/validation/schema-subset.d.ts.map +1 -1
  163. package/dist/validation/ui-security.d.ts +0 -17
  164. package/dist/validation/ui-security.d.ts.map +1 -1
  165. package/dist/validation/ui-security.js +17 -22
  166. package/dist/validation/zod-to-json-schema.d.ts +1 -1
  167. package/dist/validation/zod-to-json-schema.d.ts.map +1 -1
  168. package/dist/validation/zod-to-json-schema.js +4 -3
  169. package/dist/version.d.ts +818 -9
  170. package/dist/version.d.ts.map +1 -1
  171. package/dist/version.js +817 -8
  172. package/package.json +3 -3
  173. package/dist/bridge/invoke-agent.d.ts +0 -65
  174. package/dist/bridge/invoke-agent.d.ts.map +0 -1
  175. package/dist/bridge/invoke-agent.js +0 -113
  176. package/dist/stream/stream-parser.d.ts +0 -62
  177. package/dist/stream/stream-parser.d.ts.map +0 -1
  178. package/dist/stream/stream-parser.js +0 -199
  179. package/dist/types/canvas-lifecycle.d.ts.map +0 -1
  180. package/dist/types/credential.d.ts +0 -41
  181. package/dist/types/credential.d.ts.map +0 -1
  182. package/dist/types/credential.js +0 -32
  183. package/dist/types/data-bindings.d.ts +0 -322
  184. package/dist/types/data-bindings.d.ts.map +0 -1
  185. package/dist/types/data-bindings.js +0 -29
  186. package/dist/types/feedback.d.ts +0 -22
  187. package/dist/types/feedback.d.ts.map +0 -1
  188. package/dist/types/feedback.js +0 -7
  189. package/dist/types/mcp-proxy.d.ts +0 -67
  190. package/dist/types/mcp-proxy.d.ts.map +0 -1
  191. package/dist/types/mcp-proxy.js +0 -46
  192. package/dist/types/openrouter-models.d.ts +0 -23
  193. package/dist/types/openrouter-models.d.ts.map +0 -1
  194. package/dist/types/openrouter-models.js +0 -4843
  195. package/dist/types/region.d.ts +0 -26
  196. package/dist/types/region.d.ts.map +0 -1
  197. package/dist/types/region.js +0 -36
  198. package/dist/types/render-event.d.ts.map +0 -1
  199. package/dist/types/session.d.ts.map +0 -1
  200. /package/dist/types/{session.js → render.js} +0 -0
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Canonical user-id namespace for an externally-issued identity:
3
+ * `'<providerId>:<providerSubject>'`. One definition shared by the
4
+ * OAuth-login routes and the OIDC verify adapter so every consumer
5
+ * computes the same id. Collision-safe vs raw provider subjects that
6
+ * carry no `:` prefix.
7
+ */
8
+ export function composeOAuthUserId(input) {
9
+ return `${input.providerId}:${input.providerSubject}`;
10
+ }
@@ -0,0 +1,61 @@
1
+ import type { DataContract } from "./data-contract.js";
2
+ import type { BlueprintVariance } from "./blueprint.js";
3
+ import type { BlueprintSource } from "./blueprint-source.js";
4
+ /**
5
+ * Current `PortableBlueprint` record schema version. v2 (2026-06) made
6
+ * provenance non-negotiable: `source` + `generatorProtocolVersion` are
7
+ * required. v1 records are REJECTED by importers — a rejected seed
8
+ * entry is just a cold-gen, so the fix is to re-export the pool, never
9
+ * to coerce.
10
+ */
11
+ export declare const PORTABLE_BLUEPRINT_SCHEMA_VERSION = 2;
12
+ /**
13
+ * One self-contained, JSON-serializable blueprint record in a
14
+ * distributable shared-pool artifact. A blueprint is a COMPLETED
15
+ * TEMPLATE (a whole generated UI keyed by a contract) — not a
16
+ * component — so there is no `kind`/atomic-taxonomy field; that
17
+ * taxonomy belongs to the separate component library. Carries the
18
+ * component code inline (the stored Blueprint references code by hash;
19
+ * the artifact must travel with the bytes). `contractHash` /
20
+ * `variantKey` are shipped for diagnostics + integrity and are
21
+ * recomputed on load.
22
+ */
23
+ export interface PortableBlueprint {
24
+ readonly schemaVersion: typeof PORTABLE_BLUEPRINT_SCHEMA_VERSION;
25
+ readonly contract: DataContract;
26
+ readonly componentCode: string;
27
+ readonly variance: BlueprintVariance;
28
+ readonly contractHash: string;
29
+ readonly variantKey: string;
30
+ /**
31
+ * Provenance of the component code. Required — an artifact that
32
+ * cannot say where its code came from is rejected at import, not
33
+ * tolerated as "unlabeled".
34
+ */
35
+ readonly source: BlueprintSource;
36
+ /**
37
+ * Generator era at export time (`PROTOCOL_VERSION`). Required —
38
+ * importers reject blueprints whose generator era is incompatible
39
+ * with theirs rather than serve code generated against a different
40
+ * protocol shape.
41
+ */
42
+ readonly generatorProtocolVersion: string;
43
+ /**
44
+ * Intent prose the blueprint was registered under — the semantic
45
+ * (Tier-2) matching input at the import side. Optional: artifacts
46
+ * exported before this field existed still import, with the
47
+ * importer deriving intent from its own fallbacks. When present it
48
+ * MUST be non-empty.
49
+ */
50
+ readonly intent?: string;
51
+ /**
52
+ * SHA256(16) of the tool-identity catalog used to canonicalize
53
+ * `contract` at export. Importers re-canonicalize against their own
54
+ * catalog and recompute the key; a divergence means the same intent
55
+ * would mis-key and silently cold-gen — so it is rejected. Optional
56
+ * because the catalog is a runtime artifact built from live MCP
57
+ * handshakes — an offline pool export has no catalog to hash.
58
+ */
59
+ readonly toolIdentityCatalogHash?: string;
60
+ }
61
+ //# sourceMappingURL=portable-blueprint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portable-blueprint.d.ts","sourceRoot":"","sources":["../../src/types/portable-blueprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,IAAI,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,aAAa,EAAE,OAAO,iCAAiC,CAAC;IACjE,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC;IAC1C;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;OAOG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAC3C"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Current `PortableBlueprint` record schema version. v2 (2026-06) made
3
+ * provenance non-negotiable: `source` + `generatorProtocolVersion` are
4
+ * required. v1 records are REJECTED by importers — a rejected seed
5
+ * entry is just a cold-gen, so the fix is to re-export the pool, never
6
+ * to coerce.
7
+ */
8
+ export const PORTABLE_BLUEPRINT_SCHEMA_VERSION = 2;
@@ -3,14 +3,15 @@ import type { KNOWN_PERMISSION_NAMES } from '../validation/hygiene-rules';
3
3
  import type { PropsSpec, StreamSpec, ActionSpec, ContextSpec, ClientCapabilitiesSpec, GadgetDescriptor, JsonSchema, JsonObject } from './data-contract';
4
4
  import type { EndUserIdentity } from './auth';
5
5
  import type { HostContextProjection } from './host-context';
6
- import type { McpAppsRender } from '../integrations/mcp-apps';
6
+ import type { AppTheme } from '../schemas/app-theme';
7
+ import type { McpAppsGguiSession } from '../integrations/mcp-apps';
7
8
  /**
8
9
  * Recognised system-card kinds the runtime renders via built-in
9
10
  * components. The wire is open-ended (string), but new kinds without a
10
11
  * matching renderer fall through to a generic "system message" card so
11
12
  * an old runtime + new server still produce something visible.
12
13
  */
13
- export type SystemRenderKind = 'no-credentials' | 'mcp-apps-probe' | (string & {});
14
+ export type SystemGguiSessionKind = 'no-credentials' | 'mcp-apps-probe' | (string & {});
14
15
  /**
15
16
  * Adapter permission status
16
17
  */
@@ -27,7 +28,7 @@ export type AdapterPermissions = {
27
28
  readonly [K in (typeof KNOWN_PERMISSION_NAMES)[number]]?: PermissionStatus;
28
29
  };
29
30
  /**
30
- * Lifecycle status of a {@link Render}. RenderStore implementations MAY
31
+ * Lifecycle status of a {@link GguiSession}. GguiSessionStore implementations MAY
31
32
  * populate this on `get`; absent ⇒ caller treats as `'active'`.
32
33
  *
33
34
  * Two states only:
@@ -35,29 +36,29 @@ export type AdapterPermissions = {
35
36
  * - `'expired'` — TTL elapsed; no further writes accepted, reads return
36
37
  * a historical snapshot.
37
38
  *
38
- * There is no explicit terminal state. Renders decay implicitly via TTL.
39
+ * There is no explicit terminal state. GguiSessions decay implicitly via TTL.
39
40
  * The dropped `'completed'` state was a vestige of the deleted Session
40
41
  * vessel — kept symmetrical with `ggui_new_session`, which was deleted
41
42
  * in the earlier handshake collapse. The companion `ggui_close` tool
42
43
  * that wrote it was removed in the same slice.
43
44
  */
44
- export type RenderStatus = 'active' | 'expired';
45
+ export type GguiSessionStatus = 'active' | 'expired';
45
46
  /**
46
- * Common base for every {@link Render} variant. Carries identity,
47
+ * Common base for every {@link GguiSession} variant. Carries identity,
47
48
  * tenancy, lifecycle, and conversation-scoped context that every
48
49
  * rendered thing has regardless of how its visible bits are
49
50
  * produced (LLM-generated component, server-emitted system card,
50
51
  * embedded MCP-App iframe).
51
52
  *
52
53
  * **Conversation-scoped context note** — fields that convey "this
53
- * render belongs to a logical group of renders within a host
54
- * conversation" (hostContext continuity, sibling render discovery)
55
- * are NOT duplicated onto each Render. They look up via the optional
56
- * {@link RenderBase.hostSession} pair instead. See
54
+ * GguiSession belongs to a logical group of GguiSessions within a host
55
+ * conversation" (hostContext continuity, sibling-GguiSession discovery)
56
+ * are NOT duplicated onto each GguiSession. They look up via the optional
57
+ * {@link GguiSessionBase.hostSession} pair instead. See
57
58
  * [[session-concept-deletion-2026-05-27]] for the framing.
58
59
  */
59
- export interface RenderBase {
60
- /** Render identity. The value an iframe's bootstrap meta and every
60
+ export interface GguiSessionBase {
61
+ /** GguiSession identity. The value an iframe's bootstrap meta and every
61
62
  * wire reference (props_update, consume, update) keys by. */
62
63
  readonly id: string;
63
64
  /** App identity (tenancy boundary, always per-render). */
@@ -74,13 +75,13 @@ export interface RenderBase {
74
75
  * host's opaque grouping key for "this conversation" — typically
75
76
  * the host's thread/chat id.
76
77
  *
77
- * Multiple renders inside one host conversation share the same
78
- * `hostSessionId`. The `ggui_list_renders(hostName, hostSessionId)`
79
- * tool enumerates renders belonging to a host conversation; absent
80
- * `hostSession` ⇒ the render is one-shot (functional but
78
+ * Multiple GguiSessions inside one host conversation share the same
79
+ * `hostSessionId`. The `ggui_list_sessions(hostName, hostSessionId)`
80
+ * tool enumerates GguiSessions belonging to a host conversation; absent
81
+ * `hostSession` ⇒ the GguiSession is one-shot (functional but
81
82
  * non-rehydratable).
82
83
  *
83
- * Once captured, immutable for the render's lifetime.
84
+ * Once captured, immutable for the GguiSession's lifetime.
84
85
  */
85
86
  readonly hostSession?: {
86
87
  readonly hostName: string;
@@ -88,7 +89,7 @@ export interface RenderBase {
88
89
  };
89
90
  /**
90
91
  * Theme preset id for this render. Resolution chain:
91
- * 1. `Render.themeId` — agent-explicit per-render override
92
+ * 1. `GguiSession.themeId` — agent-explicit per-render override
92
93
  * 2. `App.defaultThemeId` — server-side per-app default
93
94
  * 3. server fallback (process default)
94
95
  * First non-undefined wins at bootstrap-meta projection.
@@ -111,13 +112,13 @@ export interface RenderBase {
111
112
  /**
112
113
  * Per-render Web Permissions API status map. Populated as the user
113
114
  * grants / denies adapter requests (geolocation, camera, etc.) over
114
- * the render's lifetime.
115
+ * the GguiSession's lifetime.
115
116
  */
116
117
  readonly adapterPermissions?: AdapterPermissions;
117
118
  /** Resolved lifecycle status. Absent ⇒ caller treats as `'active'`. */
118
- readonly status?: RenderStatus;
119
- /** Monotonic event ledger sequence (per-render — each Render has its
120
- * own RenderEvent ledger). */
119
+ readonly status?: GguiSessionStatus;
120
+ /** Monotonic event ledger sequence (per-render — each GguiSession has its
121
+ * own GguiSessionEvent ledger). */
121
122
  readonly eventSequence: number;
122
123
  /** Creation timestamp (epoch ms). */
123
124
  readonly createdAt: number;
@@ -127,18 +128,18 @@ export interface RenderBase {
127
128
  readonly expiresAt: number;
128
129
  }
129
130
  /**
130
- * `Render` — the canonical protocol shape for a single rendered UI.
131
+ * `GguiSession` — the canonical protocol shape for a single rendered UI.
131
132
  *
132
- * Three variants share {@link RenderBase} (identity, tenancy,
133
+ * Three variants share {@link GguiSessionBase} (identity, tenancy,
133
134
  * lifecycle); each variant adds its own visible-bits surface:
134
135
  *
135
- * - {@link ComponentRender} — LLM-generated / native React component.
136
+ * - {@link ComponentGguiSession} — LLM-generated / native React component.
136
137
  * Carries `componentCode`, `propsSpec`, `actionSpec`, `streamSpec`,
137
138
  * `contextSpec`, `gadgetDescriptors`, etc.
138
- * - {@link SystemRender} — server-emitted system card. Carries an
139
+ * - {@link SystemGguiSession} — server-emitted system card. Carries an
139
140
  * opaque `kind` + structured `props`; the runtime maps the kind to
140
141
  * a built-in `.tsx` renderer.
141
- * - {@link McpAppsRender} — embedded third-party MCP-App iframe.
142
+ * - {@link McpAppsGguiSession} — embedded third-party MCP-App iframe.
142
143
  * Carries `resourceUri` + MCP server config. (Lives in
143
144
  * `@ggui-ai/protocol/integrations/mcp-apps` to keep core typing
144
145
  * MCP-Apps-opt-in.)
@@ -146,22 +147,22 @@ export interface RenderBase {
146
147
  * Narrowing pattern:
147
148
  * ```ts
148
149
  * if (render.type === 'mcpApps') {
149
- * // McpAppsRender — render via host-role adapter
150
+ * // McpAppsGguiSession — render via host-role adapter
150
151
  * } else if (render.type === 'system') {
151
- * // SystemRender — render via built-in card registry
152
+ * // SystemGguiSession — render via built-in card registry
152
153
  * } else {
153
- * // ComponentRender — render via DynamicComponent
154
+ * // ComponentGguiSession — render via DynamicComponent
154
155
  * }
155
156
  * ```
156
157
  */
157
- export type Render<TProps = JsonObject> = ComponentRender<TProps> | SystemRender | McpAppsRender;
158
+ export type GguiSession<TProps = JsonObject> = ComponentGguiSession<TProps> | SystemGguiSession | McpAppsGguiSession;
158
159
  /**
159
- * Render variant: LLM-generated / native React component.
160
+ * GguiSession variant: LLM-generated / native React component.
160
161
  *
161
162
  * Discriminator: `type === 'component'` OR `type` absent (back-compat
162
163
  * default — every producer that omits `type` is producing this variant).
163
164
  */
164
- export interface ComponentRender<TProps = JsonObject> extends RenderBase {
165
+ export interface ComponentGguiSession<TProps = JsonObject> extends GguiSessionBase {
165
166
  /** Variant discriminator. Optional; absent ⇒ `'component'`. */
166
167
  readonly type?: 'component';
167
168
  /** Blueprint component code (pure UI). */
@@ -208,7 +209,7 @@ export interface ComponentRender<TProps = JsonObject> extends RenderBase {
208
209
  * preserved verbatim from the agent's render payload — no enrichment
209
210
  * overlay, no `version` (resolves from `App.gadgets`). Resolution
210
211
  * metadata lives on the parallel
211
- * {@link ComponentRender.gadgetDescriptors} sidecar.
212
+ * {@link ComponentGguiSession.gadgetDescriptors} sidecar.
212
213
  */
213
214
  readonly clientCapabilities?: ClientCapabilitiesSpec;
214
215
  /**
@@ -218,6 +219,18 @@ export interface ComponentRender<TProps = JsonObject> extends RenderBase {
218
219
  * + CSP + bundle-loader derivation read from this array.
219
220
  */
220
221
  readonly gadgetDescriptors?: readonly GadgetDescriptor[];
222
+ /**
223
+ * Theme sidecar — the resolved per-app theme overlay (mode +
224
+ * `--ggui-*` CSS-variable map) snapshotted from `App.theme` at
225
+ * render-commit time. Sibling to {@link ComponentGguiSession.gadgetDescriptors}:
226
+ * a render-time snapshot the slice-meta derivation reads without
227
+ * re-resolving against the App record. The bootstrap projection
228
+ * (`deriveRenderMeta`) surfaces it on the
229
+ * `_meta["ai.ggui/render"].theme` slice so the iframe applies the
230
+ * operator-curated overlay at boot. Absent ⇒ the renderer's default
231
+ * theme.
232
+ */
233
+ readonly theme?: AppTheme;
221
234
  /**
222
235
  * Last-known snapshot of the contextSpec slot values, mirrored from
223
236
  * the runtime's `ui/update-model-context` posts via
@@ -235,7 +248,7 @@ export interface ComponentRender<TProps = JsonObject> extends RenderBase {
235
248
  readonly contextSnapshot?: JsonObject;
236
249
  }
237
250
  /**
238
- * Render variant: server-emitted system card.
251
+ * GguiSession variant: server-emitted system card.
239
252
  *
240
253
  * Used when the SERVER (not an LLM, not an MCP host) needs to render
241
254
  * a UI card the operator can act on: "set up your LLM key", "rate
@@ -244,7 +257,7 @@ export interface ComponentRender<TProps = JsonObject> extends RenderBase {
244
257
  * Wire shape is intentionally tiny — server emits identifier + data,
245
258
  * not code. The runtime maps `kind` to a built-in `.tsx` component.
246
259
  */
247
- export interface SystemRender<TProps extends JsonObject = JsonObject> extends RenderBase {
260
+ export interface SystemGguiSession<TProps extends JsonObject = JsonObject> extends GguiSessionBase {
248
261
  readonly type: 'system';
249
262
  /**
250
263
  * Identifier the runtime maps to a built-in renderer. Stable strings
@@ -252,7 +265,7 @@ export interface SystemRender<TProps extends JsonObject = JsonObject> extends Re
252
265
  * never breaks an older runtime; it just falls through to a generic
253
266
  * card carrying the props as raw JSON.
254
267
  */
255
- readonly kind: SystemRenderKind;
268
+ readonly kind: SystemGguiSessionKind;
256
269
  /** Props forwarded to the built-in renderer. */
257
270
  readonly props?: TProps;
258
271
  /** Optional descriptive text the server can attach (telemetry, logs). */
@@ -275,19 +288,4 @@ export interface ConversationTurn<TToolArgs = JsonObject> {
275
288
  }[];
276
289
  timestamp: string;
277
290
  }
278
- /**
279
- * Progress update emitted by a producer during component production.
280
- * Delivered via the `ggui:logs` bridge event.
281
- *
282
- * Post-Phase-B: collapsed from `{ sessionId, stackItemId }` to a single
283
- * `renderId` (the two identifiers were the same value once each render
284
- * was its own thing).
285
- */
286
- export interface ProgressUpdate {
287
- renderId: string;
288
- step: 'queued' | 'negotiating' | 'matching' | 'generating' | 'compiling' | 'evaluating' | 'complete' | 'error';
289
- label: string;
290
- percent: number;
291
- message?: string;
292
- }
293
- //# sourceMappingURL=session.d.ts.map
291
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/types/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACX,sBAAsB,EACtB,gBAAgB,EAChB,UAAU,EACV,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAKrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AA6BnE;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAC7B,gBAAgB,GAChB,gBAAgB,GAEhB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE/D;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EA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AM,WAAW,mBAAmB;IAClC,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;4DACwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;gEAC4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAG9E"}
@@ -25,6 +25,7 @@
25
25
  * **Additions are additive forever** (consumer adapters dedupe on
26
26
  * fields they know). Breaking changes require a protocol version bump.
27
27
  */
28
+ import { isRecord } from '../validation/is-record.js';
28
29
  /**
29
30
  * The 9-action state machine that mutates per-thread UI state. Identical
30
31
  * vocabulary to `packages/chat-managed-amplify/src/createAdapter.ts#
@@ -50,8 +51,7 @@ export function isThreadStateAction(value) {
50
51
  THREAD_STATE_ACTIONS.includes(value));
51
52
  }
52
53
  export function isThreadStreamEvent(value) {
53
- if (typeof value !== 'object' || value === null)
54
+ if (!isRecord(value))
54
55
  return false;
55
- const v = value;
56
- return v['type'] === 'thread-message' && typeof v['message'] === 'object';
56
+ return value['type'] === 'thread-message' && typeof value['message'] === 'object';
57
57
  }
@@ -1,51 +1,10 @@
1
1
  import type { DataContract, JsonObject, JsonSchema, JsonValue } from './data-contract';
2
- /**
3
- * Design system version — used as part of the cache fingerprint.
4
- * When tokens or primitives change, bump this to invalidate cached blueprints.
5
- *
6
- * Keep in sync with the `@ggui-ai/design` package.json version.
7
- */
8
- export declare const DESIGN_SYSTEM_VERSION = "0.1.0";
9
- /**
10
- * Inputs for computing a style fingerprint.
11
- * The fingerprint determines cache validity for generated blueprints.
12
- *
13
- * NOTE: themeId is NOT included — theme colors are injected at render time
14
- * via cssOverrides, not baked into generated code.
15
- */
16
- export interface StyleFingerprintInput {
17
- /** App's styling/generation prompt (affects component structure/layout) */
18
- stylingPrompt?: string;
19
- /** Design system preset (affects available components/tokens) */
20
- designSystemPreset?: string;
21
- /** Design system version (covers tokens, primitives, motion, everything compiled) */
22
- designSystemVersion: string;
23
- }
24
- /**
25
- * Compute a style fingerprint for cache invalidation.
26
- *
27
- * Blueprints generated under the same fingerprint are interchangeable.
28
- * A fingerprint change means cached blueprints may use outdated primitives,
29
- * tokens, or structural patterns and should be regenerated.
30
- *
31
- * What invalidates the cache:
32
- * - stylingPrompt changed ("make it playful" → different layout)
33
- * - designSystemPreset changed (different component set available)
34
- * - designSystemVersion bumped (new tokens, primitives, motion, etc.)
35
- *
36
- * What does NOT invalidate:
37
- * - themeId changed (colors are applied at render time via cssOverrides)
38
- *
39
- * Uses FNV-1a (non-cryptographic) — this is for cache keys, not security.
40
- * Works in all JS runtimes (browser, Node.js, React Native).
41
- */
42
- export declare function computeStyleFingerprint(input: StyleFingerprintInput): string;
43
2
  /**
44
3
  * Request to generate a UI component.
45
4
  * Generic `TContext` defaults to {@link JsonObject} for generator context hints.
46
5
  */
47
6
  export interface UIGenerationRequest<TContext = JsonObject> {
48
- renderId: string;
7
+ sessionId: string;
49
8
  prompt: string;
50
9
  context?: TContext;
51
10
  schema?: JsonSchema;
@@ -60,7 +19,7 @@ export interface UIGenerationRequest<TContext = JsonObject> {
60
19
  * field.
61
20
  */
62
21
  export interface UIGenerationResponse {
63
- renderId: string;
22
+ sessionId: string;
64
23
  componentCode: string;
65
24
  sourceCode?: string;
66
25
  warnings?: string[];
@@ -70,8 +29,8 @@ export interface UIGenerationResponse {
70
29
  * Populated by the generator when the component calls wire hooks
71
30
  * (`useAction('name')`, `useStream('channel')`) — the generator
72
31
  * extracts the call sites and emits a matching authoring-side
73
- * envelope so downstream consumers (`ggui_render` → Render, console
74
- * inspectors, render-channel router) have the contract available.
32
+ * envelope so downstream consumers (`ggui_render` → GguiSession,
33
+ * console inspectors) have the contract available.
75
34
  *
76
35
  * - When the caller supplied `UiGenerateInput.contract` that
77
36
  * envelope is passed through as-is (already authoritative).
@@ -80,7 +39,7 @@ export interface UIGenerationResponse {
80
39
  * `actionSpec[name] = {label: name}` and
81
40
  * `streamSpec[channel] = {schema: {type: 'object'}}`. Enough for
82
41
  * the receiver to know the surface exists; callers who need
83
- * richer metadata (labels, schemas, refresh tools) should
42
+ * richer metadata (labels, schemas, nextStep hints) should
84
43
  * author the contract themselves and pass it on input.
85
44
  * - When no wire hooks are used, this field stays absent.
86
45
  */
@@ -89,9 +48,27 @@ export interface UIGenerationResponse {
89
48
  /**
90
49
  * Error during UI generation.
91
50
  * The `details` field is {@link JsonValue} to carry any JSON-safe diagnostic data.
51
+ *
52
+ * `code` vocabulary:
53
+ *
54
+ * - `PRODUCTION_FAILED` — the generation pipeline ran but did not
55
+ * produce a component.
56
+ * - `COMPILATION_ERROR` — produced code failed to compile. Maps to
57
+ * the canonical `PRODUCTION_FAILED` on the render failure envelope
58
+ * (it is a finer-grained production failure, not a distinct wire
59
+ * class).
60
+ * - `VALIDATION_ERROR` — an input/config precondition rejected the
61
+ * generation before the LLM was called.
62
+ * - `NO_PLATFORM_KEY` — the server's managed provider-key
63
+ * configuration has no key for the resolved route.
64
+ * - `NO_CREDENTIALS` — no generation credentials are configured on
65
+ * the server.
66
+ *
67
+ * The last four map 1:1 onto the render failure envelope's canonical
68
+ * codes (`renderErrorCodeSchema` in `schemas/mcp.ts`).
92
69
  */
93
70
  export interface GenerationError {
94
- code: 'PRODUCTION_FAILED' | 'COMPILATION_ERROR' | 'VALIDATION_ERROR';
71
+ code: 'PRODUCTION_FAILED' | 'COMPILATION_ERROR' | 'VALIDATION_ERROR' | 'NO_PLATFORM_KEY' | 'NO_CREDENTIALS';
95
72
  message: string;
96
73
  /** Additional diagnostic information. Typed as {@link JsonValue} (any JSON-safe value). */
97
74
  details?: JsonValue;
@@ -1 +1 @@
1
- {"version":3,"file":"ui-generator.d.ts","sourceRoot":"","sources":["../../src/types/ui-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,UAAU,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qFAAqF;IACrF,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAuBD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAO5E;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,QAAQ,GAAG,UAAU;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACt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- /**
2
- * Design system version — used as part of the cache fingerprint.
3
- * When tokens or primitives change, bump this to invalidate cached blueprints.
4
- *
5
- * Keep in sync with the `@ggui-ai/design` package.json version.
6
- */
7
- export const DESIGN_SYSTEM_VERSION = '0.1.0';
8
- /**
9
- * FNV-1a hash — a fast, non-cryptographic hash with good distribution.
10
- * Used for cache key fingerprinting only, not for security purposes.
11
- * Works in all JS runtimes (browser, Node.js, React Native).
12
- */
13
- function fnv1aHash(str) {
14
- let hash = 0x811c9dc5; // FNV offset basis (32-bit)
15
- for (let i = 0; i < str.length; i++) {
16
- hash ^= str.charCodeAt(i);
17
- hash = Math.imul(hash, 0x01000193); // FNV prime (32-bit)
18
- }
19
- // Convert to unsigned 32-bit, then to base-36 for compact representation.
20
- // Produce two 32-bit hashes (second seeded differently) for a longer fingerprint.
21
- let hash2 = 0x1a2b3c4d;
22
- for (let i = 0; i < str.length; i++) {
23
- hash2 ^= str.charCodeAt(i);
24
- hash2 = Math.imul(hash2, 0x01000193);
25
- }
26
- return (hash >>> 0).toString(36) + (hash2 >>> 0).toString(36);
27
- }
28
- /**
29
- * Compute a style fingerprint for cache invalidation.
30
- *
31
- * Blueprints generated under the same fingerprint are interchangeable.
32
- * A fingerprint change means cached blueprints may use outdated primitives,
33
- * tokens, or structural patterns and should be regenerated.
34
- *
35
- * What invalidates the cache:
36
- * - stylingPrompt changed ("make it playful" → different layout)
37
- * - designSystemPreset changed (different component set available)
38
- * - designSystemVersion bumped (new tokens, primitives, motion, etc.)
39
- *
40
- * What does NOT invalidate:
41
- * - themeId changed (colors are applied at render time via cssOverrides)
42
- *
43
- * Uses FNV-1a (non-cryptographic) — this is for cache keys, not security.
44
- * Works in all JS runtimes (browser, Node.js, React Native).
45
- */
46
- export function computeStyleFingerprint(input) {
47
- const raw = [
48
- input.stylingPrompt || '',
49
- input.designSystemPreset || 'default',
50
- input.designSystemVersion,
51
- ].join('|');
52
- return fnv1aHash(raw);
53
- }
1
+ export {};
@@ -15,7 +15,7 @@
15
15
  * between props vs action vs stream vs context.
16
16
  * - Compile-time meta-validation: `strict: true` rejects malformed
17
17
  * JSON Schemas at `compile()` — agents discover bugs at
18
- * handshake/push, not at first data flow.
18
+ * handshake/render, not at first data flow.
19
19
  *
20
20
  * Closed-shape (load-bearing):
21
21
  * JSON Schema's default is `additionalProperties: true` (extras
@@ -66,7 +66,7 @@ export declare function injectClosedShape(schema: JsonSchema): JsonSchema;
66
66
  * closed-shape injected at every object node. Throws if the schema
67
67
  * is malformed under Ajv strict mode — this is layer B meta-
68
68
  * validation as a free side effect. Dedicated meta-validation call
69
- * sites (handshake / push) wrap this in a structured error.
69
+ * sites (handshake / render) wrap this in a structured error.
70
70
  *
71
71
  * Not cached. Compilation is fast and contracts are small; caching
72
72
  * adds a memory cost without a measured win. Revisit if profiling
@@ -82,7 +82,7 @@ export declare function compileForValidation(schema: JsonSchema): ValidateFuncti
82
82
  * Why this exists: the renderer iframe runs under a strict CSP with no
83
83
  * `'unsafe-eval'`, so `ajv.compile()` (which builds the validator via
84
84
  * `new Function`) throws `EvalError` there. Codegen has to happen
85
- * where `eval` is legal — the server, at push time, where the contract
85
+ * where `eval` is legal — the server, at render time, where the contract
86
86
  * schema is already fixed. The iframe then loads this module source
87
87
  * via a `blob:` dynamic import (governed by `script-src`, not
88
88
  * `unsafe-eval`) and only ever *runs* the validator.
@@ -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,sBAAs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AAsB,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"}
@@ -15,7 +15,7 @@
15
15
  * between props vs action vs stream vs context.
16
16
  * - Compile-time meta-validation: `strict: true` rejects malformed
17
17
  * JSON Schemas at `compile()` — agents discover bugs at
18
- * handshake/push, not at first data flow.
18
+ * handshake/render, not at first data flow.
19
19
  *
20
20
  * Closed-shape (load-bearing):
21
21
  * JSON Schema's default is `additionalProperties: true` (extras
@@ -41,6 +41,7 @@ import addFormats from 'ajv-formats';
41
41
  import standaloneCode from 'ajv/dist/standalone/index.js';
42
42
  import equalImport from 'ajv/dist/runtime/equal.js';
43
43
  import ucs2lengthImport from 'ajv/dist/runtime/ucs2length.js';
44
+ import { isRecord } from './is-record.js';
44
45
  /**
45
46
  * Resolve a runtime-helper module's exported function across the
46
47
  * CJS↔ESM interop gap: a plain `module.exports = fn` CJS module
@@ -172,7 +173,7 @@ export function injectClosedShape(schema) {
172
173
  * closed-shape injected at every object node. Throws if the schema
173
174
  * is malformed under Ajv strict mode — this is layer B meta-
174
175
  * validation as a free side effect. Dedicated meta-validation call
175
- * sites (handshake / push) wrap this in a structured error.
176
+ * sites (handshake / render) wrap this in a structured error.
176
177
  *
177
178
  * Not cached. Compilation is fast and contracts are small; caching
178
179
  * adds a memory cost without a measured win. Revisit if profiling
@@ -191,7 +192,7 @@ export function compileForValidation(schema) {
191
192
  * Why this exists: the renderer iframe runs under a strict CSP with no
192
193
  * `'unsafe-eval'`, so `ajv.compile()` (which builds the validator via
193
194
  * `new Function`) throws `EvalError` there. Codegen has to happen
194
- * where `eval` is legal — the server, at push time, where the contract
195
+ * where `eval` is legal — the server, at render time, where the contract
195
196
  * schema is already fixed. The iframe then loads this module source
196
197
  * via a `blob:` dynamic import (governed by `script-src`, not
197
198
  * `unsafe-eval`) and only ever *runs* the validator.
@@ -247,7 +248,7 @@ function inlineRuntimeHelpers(source) {
247
248
  }
248
249
  // Survivor check: a remaining `ajv/dist/runtime/*` import means Ajv
249
250
  // emitted a helper we don't inline. Fail loud here (server-side,
250
- // caught by tests / push) rather than shipping a module the iframe
251
+ // caught by tests / render) rather than shipping a module the iframe
251
252
  // cannot load. Scoped to the `ajv/dist/runtime/` prefix — the only
252
253
  // specifiers Ajv standalone emits — so an embedded contract-schema
253
254
  // string can't false-trip it.
@@ -434,7 +435,7 @@ function resolveAtPath(root, instancePath) {
434
435
  return undefined;
435
436
  cur = cur[idx];
436
437
  }
437
- else if (typeof cur === 'object') {
438
+ else if (isRecord(cur)) {
438
439
  cur = cur[part];
439
440
  }
440
441
  else {