@ggui-ai/protocol 0.1.0-rc.1

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 (222) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +46 -0
  3. package/dist/bridge/invoke-agent.d.ts +65 -0
  4. package/dist/bridge/invoke-agent.d.ts.map +1 -0
  5. package/dist/bridge/invoke-agent.js +113 -0
  6. package/dist/envelope-adapters.d.ts +24 -0
  7. package/dist/envelope-adapters.d.ts.map +1 -0
  8. package/dist/envelope-adapters.js +14 -0
  9. package/dist/envelopes/builders.d.ts +145 -0
  10. package/dist/envelopes/builders.d.ts.map +1 -0
  11. package/dist/envelopes/builders.js +113 -0
  12. package/dist/errors/unknown-permission-name.d.ts +12 -0
  13. package/dist/errors/unknown-permission-name.d.ts.map +1 -0
  14. package/dist/errors/unknown-permission-name.js +29 -0
  15. package/dist/errors/version-mismatch.d.ts +55 -0
  16. package/dist/errors/version-mismatch.d.ts.map +1 -0
  17. package/dist/errors/version-mismatch.js +52 -0
  18. package/dist/gadgets/resolve-contract-gadgets.d.ts +93 -0
  19. package/dist/gadgets/resolve-contract-gadgets.d.ts.map +1 -0
  20. package/dist/gadgets/resolve-contract-gadgets.js +119 -0
  21. package/dist/gadgets/stdlib-gadgets.d.ts +43 -0
  22. package/dist/gadgets/stdlib-gadgets.d.ts.map +1 -0
  23. package/dist/gadgets/stdlib-gadgets.js +161 -0
  24. package/dist/iframe-bridge.d.ts +63 -0
  25. package/dist/iframe-bridge.d.ts.map +1 -0
  26. package/dist/iframe-bridge.js +166 -0
  27. package/dist/index.d.ts +62 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +79 -0
  30. package/dist/integrations/mcp-apps.d.ts +1218 -0
  31. package/dist/integrations/mcp-apps.d.ts.map +1 -0
  32. package/dist/integrations/mcp-apps.js +427 -0
  33. package/dist/navigation/index.d.ts +3 -0
  34. package/dist/navigation/index.d.ts.map +1 -0
  35. package/dist/navigation/index.js +1 -0
  36. package/dist/navigation/stack-navigation.d.ts +55 -0
  37. package/dist/navigation/stack-navigation.d.ts.map +1 -0
  38. package/dist/navigation/stack-navigation.js +80 -0
  39. package/dist/recommended-prompts.d.ts +56 -0
  40. package/dist/recommended-prompts.d.ts.map +1 -0
  41. package/dist/recommended-prompts.js +55 -0
  42. package/dist/registry/blueprint-key.d.ts +9 -0
  43. package/dist/registry/blueprint-key.d.ts.map +1 -0
  44. package/dist/registry/blueprint-key.js +28 -0
  45. package/dist/registry/canonicalize-contract.d.ts +35 -0
  46. package/dist/registry/canonicalize-contract.d.ts.map +1 -0
  47. package/dist/registry/canonicalize-contract.js +166 -0
  48. package/dist/registry/summarize-contract.d.ts +46 -0
  49. package/dist/registry/summarize-contract.d.ts.map +1 -0
  50. package/dist/registry/summarize-contract.js +63 -0
  51. package/dist/schema-learning/derive-contract.d.ts +67 -0
  52. package/dist/schema-learning/derive-contract.d.ts.map +1 -0
  53. package/dist/schema-learning/derive-contract.js +117 -0
  54. package/dist/schema-learning/merge.d.ts +32 -0
  55. package/dist/schema-learning/merge.d.ts.map +1 -0
  56. package/dist/schema-learning/merge.js +146 -0
  57. package/dist/schemas/blueprint.d.ts +32 -0
  58. package/dist/schemas/blueprint.d.ts.map +1 -0
  59. package/dist/schemas/blueprint.js +92 -0
  60. package/dist/schemas/data-contract.d.ts +750 -0
  61. package/dist/schemas/data-contract.d.ts.map +1 -0
  62. package/dist/schemas/data-contract.js +663 -0
  63. package/dist/schemas/gadget-name-grammar.d.ts +29 -0
  64. package/dist/schemas/gadget-name-grammar.d.ts.map +1 -0
  65. package/dist/schemas/gadget-name-grammar.js +28 -0
  66. package/dist/schemas/handshake-suggestion.d.ts +46 -0
  67. package/dist/schemas/handshake-suggestion.d.ts.map +1 -0
  68. package/dist/schemas/handshake-suggestion.js +107 -0
  69. package/dist/schemas/invoke.d.ts +337 -0
  70. package/dist/schemas/invoke.d.ts.map +1 -0
  71. package/dist/schemas/invoke.js +169 -0
  72. package/dist/schemas/mcp.d.ts +301 -0
  73. package/dist/schemas/mcp.d.ts.map +1 -0
  74. package/dist/schemas/mcp.js +373 -0
  75. package/dist/schemas/ops-blueprint.d.ts +176 -0
  76. package/dist/schemas/ops-blueprint.d.ts.map +1 -0
  77. package/dist/schemas/ops-blueprint.js +259 -0
  78. package/dist/schemas/sync-check.d.ts +11 -0
  79. package/dist/schemas/sync-check.d.ts.map +1 -0
  80. package/dist/schemas/sync-check.js +60 -0
  81. package/dist/screen-blueprints/define.d.ts +22 -0
  82. package/dist/screen-blueprints/define.d.ts.map +1 -0
  83. package/dist/screen-blueprints/define.js +3 -0
  84. package/dist/screen-blueprints/index.d.ts +4 -0
  85. package/dist/screen-blueprints/index.d.ts.map +1 -0
  86. package/dist/screen-blueprints/index.js +3 -0
  87. package/dist/screen-blueprints/match.d.ts +35 -0
  88. package/dist/screen-blueprints/match.d.ts.map +1 -0
  89. package/dist/screen-blueprints/match.js +51 -0
  90. package/dist/screen-blueprints/types.d.ts +164 -0
  91. package/dist/screen-blueprints/types.d.ts.map +1 -0
  92. package/dist/screen-blueprints/types.js +1 -0
  93. package/dist/stream/stream-parser.d.ts +62 -0
  94. package/dist/stream/stream-parser.d.ts.map +1 -0
  95. package/dist/stream/stream-parser.js +199 -0
  96. package/dist/transport/websocket.d.ts +178 -0
  97. package/dist/transport/websocket.d.ts.map +1 -0
  98. package/dist/transport/websocket.js +1 -0
  99. package/dist/types/app-config.d.ts +61 -0
  100. package/dist/types/app-config.d.ts.map +1 -0
  101. package/dist/types/app-config.js +1 -0
  102. package/dist/types/auth.d.ts +61 -0
  103. package/dist/types/auth.d.ts.map +1 -0
  104. package/dist/types/auth.js +1 -0
  105. package/dist/types/blueprint.d.ts +206 -0
  106. package/dist/types/blueprint.d.ts.map +1 -0
  107. package/dist/types/blueprint.js +1 -0
  108. package/dist/types/canvas-lifecycle.d.ts +105 -0
  109. package/dist/types/canvas-lifecycle.d.ts.map +1 -0
  110. package/dist/types/canvas-lifecycle.js +38 -0
  111. package/dist/types/capabilities.d.ts +40 -0
  112. package/dist/types/capabilities.d.ts.map +1 -0
  113. package/dist/types/capabilities.js +19 -0
  114. package/dist/types/contract-inference.d.ts +401 -0
  115. package/dist/types/contract-inference.d.ts.map +1 -0
  116. package/dist/types/contract-inference.js +44 -0
  117. package/dist/types/credential.d.ts +41 -0
  118. package/dist/types/credential.d.ts.map +1 -0
  119. package/dist/types/credential.js +32 -0
  120. package/dist/types/data-bindings.d.ts +322 -0
  121. package/dist/types/data-bindings.d.ts.map +1 -0
  122. package/dist/types/data-bindings.js +29 -0
  123. package/dist/types/data-contract.d.ts +1296 -0
  124. package/dist/types/data-contract.d.ts.map +1 -0
  125. package/dist/types/data-contract.js +111 -0
  126. package/dist/types/events.d.ts +182 -0
  127. package/dist/types/events.d.ts.map +1 -0
  128. package/dist/types/events.js +8 -0
  129. package/dist/types/feedback.d.ts +24 -0
  130. package/dist/types/feedback.d.ts.map +1 -0
  131. package/dist/types/feedback.js +7 -0
  132. package/dist/types/gadget.d.ts +121 -0
  133. package/dist/types/gadget.d.ts.map +1 -0
  134. package/dist/types/gadget.js +24 -0
  135. package/dist/types/handshake-suggestion.d.ts +264 -0
  136. package/dist/types/handshake-suggestion.d.ts.map +1 -0
  137. package/dist/types/handshake-suggestion.js +70 -0
  138. package/dist/types/host-context.d.ts +163 -0
  139. package/dist/types/host-context.d.ts.map +1 -0
  140. package/dist/types/host-context.js +142 -0
  141. package/dist/types/interface-context.d.ts +105 -0
  142. package/dist/types/interface-context.d.ts.map +1 -0
  143. package/dist/types/interface-context.js +115 -0
  144. package/dist/types/invoke.d.ts +28 -0
  145. package/dist/types/invoke.d.ts.map +1 -0
  146. package/dist/types/invoke.js +7 -0
  147. package/dist/types/live-channel.d.ts +613 -0
  148. package/dist/types/live-channel.d.ts.map +1 -0
  149. package/dist/types/live-channel.js +1 -0
  150. package/dist/types/llm.d.ts +61 -0
  151. package/dist/types/llm.d.ts.map +1 -0
  152. package/dist/types/llm.js +186 -0
  153. package/dist/types/mcp-proxy.d.ts +67 -0
  154. package/dist/types/mcp-proxy.d.ts.map +1 -0
  155. package/dist/types/mcp-proxy.js +46 -0
  156. package/dist/types/mcp.d.ts +637 -0
  157. package/dist/types/mcp.d.ts.map +1 -0
  158. package/dist/types/mcp.js +30 -0
  159. package/dist/types/openrouter-models.d.ts +22 -0
  160. package/dist/types/openrouter-models.d.ts.map +1 -0
  161. package/dist/types/openrouter-models.js +4843 -0
  162. package/dist/types/region.d.ts +26 -0
  163. package/dist/types/region.d.ts.map +1 -0
  164. package/dist/types/region.js +36 -0
  165. package/dist/types/session.d.ts +419 -0
  166. package/dist/types/session.d.ts.map +1 -0
  167. package/dist/types/session.js +1 -0
  168. package/dist/types/thread.d.ts +207 -0
  169. package/dist/types/thread.d.ts.map +1 -0
  170. package/dist/types/thread.js +57 -0
  171. package/dist/types/ui-generator.d.ts +100 -0
  172. package/dist/types/ui-generator.d.ts.map +1 -0
  173. package/dist/types/ui-generator.js +53 -0
  174. package/dist/validation/ajv-runtime.d.ts +140 -0
  175. package/dist/validation/ajv-runtime.d.ts.map +1 -0
  176. package/dist/validation/ajv-runtime.js +452 -0
  177. package/dist/validation/content-hash.d.ts +3 -0
  178. package/dist/validation/content-hash.d.ts.map +1 -0
  179. package/dist/validation/content-hash.js +21 -0
  180. package/dist/validation/contract-validator.d.ts +244 -0
  181. package/dist/validation/contract-validator.d.ts.map +1 -0
  182. package/dist/validation/contract-validator.js +711 -0
  183. package/dist/validation/cross-references.d.ts +105 -0
  184. package/dist/validation/cross-references.d.ts.map +1 -0
  185. package/dist/validation/cross-references.js +164 -0
  186. package/dist/validation/hygiene-rules.d.ts +250 -0
  187. package/dist/validation/hygiene-rules.d.ts.map +1 -0
  188. package/dist/validation/hygiene-rules.js +564 -0
  189. package/dist/validation/lint-contract.d.ts +130 -0
  190. package/dist/validation/lint-contract.d.ts.map +1 -0
  191. package/dist/validation/lint-contract.js +225 -0
  192. package/dist/validation/name-invariants.d.ts +117 -0
  193. package/dist/validation/name-invariants.d.ts.map +1 -0
  194. package/dist/validation/name-invariants.js +172 -0
  195. package/dist/validation/reserved-channels.d.ts +156 -0
  196. package/dist/validation/reserved-channels.d.ts.map +1 -0
  197. package/dist/validation/reserved-channels.js +356 -0
  198. package/dist/validation/resolve-stream-channel.d.ts +78 -0
  199. package/dist/validation/resolve-stream-channel.d.ts.map +1 -0
  200. package/dist/validation/resolve-stream-channel.js +64 -0
  201. package/dist/validation/sanitize-error.d.ts +46 -0
  202. package/dist/validation/sanitize-error.d.ts.map +1 -0
  203. package/dist/validation/sanitize-error.js +88 -0
  204. package/dist/validation/schema-compat-invariants.d.ts +140 -0
  205. package/dist/validation/schema-compat-invariants.d.ts.map +1 -0
  206. package/dist/validation/schema-compat-invariants.js +220 -0
  207. package/dist/validation/schema-meta-validation.d.ts +60 -0
  208. package/dist/validation/schema-meta-validation.d.ts.map +1 -0
  209. package/dist/validation/schema-meta-validation.js +131 -0
  210. package/dist/validation/schema-subset.d.ts +165 -0
  211. package/dist/validation/schema-subset.d.ts.map +1 -0
  212. package/dist/validation/schema-subset.js +295 -0
  213. package/dist/validation/ui-security.d.ts +54 -0
  214. package/dist/validation/ui-security.d.ts.map +1 -0
  215. package/dist/validation/ui-security.js +138 -0
  216. package/dist/validation/zod-to-json-schema.d.ts +63 -0
  217. package/dist/validation/zod-to-json-schema.d.ts.map +1 -0
  218. package/dist/validation/zod-to-json-schema.js +126 -0
  219. package/dist/version.d.ts +1458 -0
  220. package/dist/version.d.ts.map +1 -0
  221. package/dist/version.js +1459 -0
  222. package/package.json +113 -0
@@ -0,0 +1,161 @@
1
+ // packages/protocol/src/gadgets/stdlib-gadgets.ts
2
+ //
3
+ // `STDLIB_GADGETS` — the canonical list of browser-capability
4
+ // gadget hooks shipped by the first-party `@ggui-ai/gadgets`
5
+ // package. Each entry is a `GadgetDescriptor` declaration that an app
6
+ // MAY use as-is (default `App.gadgets`) or filter / extend via
7
+ // the per-app gadget list.
8
+ //
9
+ // **Why protocol owns this list:**
10
+ //
11
+ // - The protocol layer is the source of truth for the four-spec
12
+ // surface (`DataContract.clientCapabilities.gadgets`). The list
13
+ // of available stdlib hooks is part of the contract surface
14
+ // agents reason about — so it belongs alongside the type
15
+ // definitions, not in the runtime package.
16
+ // - Descriptors are strings + JSON only — no runtime deps. The
17
+ // protocol package stays free of `@ggui-ai/gadgets` as
18
+ // a workspace dependency (which would create a cycle: protocol →
19
+ // gadgets → protocol).
20
+ //
21
+ // **Parity guarantee:** `@ggui-ai/gadgets` ships a cross-
22
+ // package contract test (`stdlib-parity.test.ts`) that imports both
23
+ // this list and the actual hook exports, then asserts the hook names
24
+ // match exactly. Drift fails the test on CI; the protocol package
25
+ // cannot ship a stale descriptor list without the runtime side
26
+ // catching it.
27
+ /**
28
+ * The first-party `@ggui-ai/gadgets` package name. Used as
29
+ * the default `package` for every entry in {@link STDLIB_GADGETS}
30
+ * and as the `DEFAULT_GADGET_PACKAGE` literal in the hygiene linter.
31
+ */
32
+ export const STDLIB_GADGETS_PACKAGE = '@ggui-ai/gadgets';
33
+ /**
34
+ * Pinned semver of the stdlib gadgets every descriptor declares on
35
+ * its `version` field. Mirrors
36
+ * `packages/gadgets/package.json#version`; a cross-package parity test
37
+ * in `@ggui-ai/gadgets` asserts the two stay in sync, so a release-time
38
+ * bump to the runtime package without updating this constant fails CI.
39
+ */
40
+ export const STDLIB_GADGETS_VERSION = '0.1.0-rc.1';
41
+ /**
42
+ * v1 catalog of stdlib gadget descriptors. Every entry's
43
+ * `package` defaults to {@link STDLIB_GADGETS_PACKAGE}; the
44
+ * `permission` field, where present, mirrors the Web Permissions API
45
+ * name and lines up with the hygiene linter's
46
+ * `KNOWN_PERMISSION_HOOKS` table.
47
+ *
48
+ * **Ordering:** alphabetical by hook name. Stable so consumers can
49
+ * diff the list across protocol minor bumps without false positives
50
+ * from re-ordering.
51
+ *
52
+ * **Shape note:** entries are typed `Readonly<GadgetDescriptor>` so
53
+ * downstream consumers (App.gadgets default-on-read, the LLM
54
+ * generator's catalog, the `ggui_list_gadgets` handler)
55
+ * can structurally clone without mutating the source. Callers that
56
+ * need a mutable copy should `structuredClone` explicitly.
57
+ */
58
+ export const STDLIB_GADGETS = [
59
+ {
60
+ package: STDLIB_GADGETS_PACKAGE,
61
+ version: STDLIB_GADGETS_VERSION,
62
+ exports: [
63
+ {
64
+ hook: 'useCamera',
65
+ permission: 'camera',
66
+ description: 'Capture stills or live video from the device camera.',
67
+ usage: 'Mount when the intent names photo capture, QR / barcode scanning, video recording, or anything that requires a camera feed. The hook returns a stream once `start()` resolves; thread the resulting blob or stream URL into a contextSpec slot or an actionSpec payload to surface it to the agent.',
68
+ example: {
69
+ call: 'const cam = useCamera();',
70
+ returns: {
71
+ status: 'ready',
72
+ value: { stream: '<MediaStream>', kind: 'video' },
73
+ },
74
+ },
75
+ },
76
+ {
77
+ hook: 'useClipboardPaste',
78
+ permission: 'clipboard-read',
79
+ description: 'Read the system clipboard contents on user gesture.',
80
+ usage: 'Mount when the intent involves importing copied content (paste-into-form, paste-image-to-upload, paste-link). The Permissions API requires a user gesture; gate `start()` behind a button click. Returned value lands in a contextSpec slot or an actionSpec payload.',
81
+ example: {
82
+ call: 'const paste = useClipboardPaste();',
83
+ returns: { status: 'ready', value: 'pasted clipboard text' },
84
+ },
85
+ },
86
+ {
87
+ hook: 'useClipboardWrite',
88
+ permission: 'clipboard-write',
89
+ description: 'Write to the system clipboard on user gesture.',
90
+ usage: 'Mount when the intent includes copying generated text, share links, codes, or transcripts to the system clipboard. Fire an actionSpec event so the agent observes the act (it does not see the written value — that stays component-local).',
91
+ example: {
92
+ call: "const write = useClipboardWrite(); write.write('hello');",
93
+ returns: { status: 'ready' },
94
+ },
95
+ },
96
+ {
97
+ hook: 'useFilePicker',
98
+ description: 'Open the native file picker and read selected files.',
99
+ usage: 'Mount when the intent names file upload, attachment selection, or document import. No permission required. The hook returns the picked files plus metadata; thread file refs / data URLs into a contextSpec slot or actionSpec payload.',
100
+ example: {
101
+ call: 'const picker = useFilePicker({ accept: "image/*" });',
102
+ returns: {
103
+ status: 'ready',
104
+ value: [{ name: 'photo.png', type: 'image/png', size: 12345 }],
105
+ },
106
+ },
107
+ },
108
+ {
109
+ hook: 'useGeolocation',
110
+ permission: 'geolocation',
111
+ description: "Resolve the device's current geolocation.",
112
+ usage: 'Mount when the intent names "current location", maps, nearby search, location-aware UI. Browser prompts the user on `start()`; the hook returns coordinates once granted. Thread the resolved coords into a contextSpec slot so the agent observes the latest fix.',
113
+ example: {
114
+ call: 'const geo = useGeolocation();',
115
+ returns: {
116
+ status: 'ready',
117
+ value: { latitude: 37.7749, longitude: -122.4194, accuracy: 20 },
118
+ },
119
+ },
120
+ },
121
+ {
122
+ hook: 'useMicrophone',
123
+ permission: 'microphone',
124
+ description: 'Capture audio from the device microphone.',
125
+ usage: 'Mount when the intent names voice memos, audio messages, dictation, voice-driven UI. Returns an audio stream / blob; thread it into an actionSpec payload at recording-stop, or into a contextSpec slot for live transcription pipelines.',
126
+ example: {
127
+ call: 'const mic = useMicrophone();',
128
+ returns: {
129
+ status: 'ready',
130
+ value: { stream: '<MediaStream>', kind: 'audio' },
131
+ },
132
+ },
133
+ },
134
+ {
135
+ hook: 'useNotifications',
136
+ permission: 'notifications',
137
+ description: 'Show system / browser notifications to the user.',
138
+ usage: 'Mount when the intent involves alerting the user about something (reminders, completion of long tasks, incoming messages) and the UI may be in the background. Permission is prompted on first `start()`; the agent does NOT see notification dismissal directly — surface it via an actionSpec if needed.',
139
+ example: {
140
+ call: "const notify = useNotifications(); notify.show({ title: 'Done' });",
141
+ returns: { status: 'ready', value: { granted: true } },
142
+ },
143
+ },
144
+ ],
145
+ },
146
+ ];
147
+ /**
148
+ * Hook-name index over {@link STDLIB_GADGETS}. Lazily
149
+ * constructed for callers that need O(1) "is hook X part of the
150
+ * stdlib?" checks (the hygiene linter, the per-app gadget validator,
151
+ * the `ggui_list_gadgets` handler).
152
+ *
153
+ * Frozen so accidental mutation is loud, not silent.
154
+ */
155
+ export const STDLIB_GADGET_HOOKS = Object.freeze(new Set(STDLIB_GADGETS.flatMap((pkg) => pkg.exports)
156
+ // `GadgetExport` is a type-exclusive union (`hook?: never` on the
157
+ // component member), so `hook` is an optional key of both members
158
+ // and `'hook' in exp` no longer narrows. Discriminate by VALUE
159
+ // presence and collect only defined hook names.
160
+ .map((exp) => exp.hook)
161
+ .filter((hook) => hook !== undefined)));
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Event names used across the iframe bridge -- symmetric naming convention.
3
+ *
4
+ * Events prefixed with `ggui-` are `postMessage` types (cross-origin iframe boundary).
5
+ * Events prefixed with `ggui:` are `CustomEvent` names (same-origin, dispatched on `window`).
6
+ *
7
+ * The bridge has three directions:
8
+ * 1. **Agent to Component** (inbound): data, streams, progress
9
+ * 2. **Component to Agent** (outbound): user interactions (form submits, clicks)
10
+ * 3. **Component to Host** (outbound): rendering lifecycle (resize, success, error)
11
+ */
12
+ export declare const BRIDGE_EVENTS: {
13
+ /** `postMessage` type for parent-to-iframe data delivery. The parent window posts this type; the iframe bridge script converts it to an `AGENT_DATA` CustomEvent. */
14
+ readonly AGENT_DATA_POST: "ggui-agent-data";
15
+ /** `CustomEvent` name dispatched on `window` when agent data arrives. Components listen for this to receive real-time data from the agent (chat messages, typing indicators, etc.). */
16
+ readonly AGENT_DATA: "ggui:agent-data";
17
+ /** `CustomEvent` name for streaming text chunks from the agent. Fired incrementally as the agent generates a response. */
18
+ readonly AGENT_STREAM: "ggui:agent-stream";
19
+ /** `CustomEvent` name for agent messages. Payload includes `type: 'thinking' | 'chat'`. Thinking messages show what the agent is doing; chat messages are final responses. */
20
+ readonly AGENT_MSG: "ggui:agent-msg";
21
+ /** `CustomEvent` name for UI generation log updates. Debug/devtools only — not displayed to end users. */
22
+ readonly AGENT_LOGS: "ggui:logs";
23
+ /** `postMessage` type for iframe-to-parent user interaction data. Carries form submissions and click events from generated components back to the host. */
24
+ readonly USER_DATA_POST: "ggui-user-data";
25
+ /** `CustomEvent` name dispatched on the parent window when user data arrives from the iframe. The host shell listens for this to forward events to the agent. */
26
+ readonly USER_DATA: "ggui:user-data";
27
+ /** `postMessage` type sent when a component's content size changes. Used by the host to auto-resize the iframe to fit content. */
28
+ readonly RESIZE: "ggui-resize";
29
+ /** `postMessage` type sent when a component renders successfully. The host uses this to hide loading indicators and show the component. */
30
+ readonly RENDER_SUCCESS: "ggui-render-success";
31
+ /** `postMessage` type sent when a component fails to render. The host uses this to show an error state instead of a blank iframe. */
32
+ readonly RENDER_ERROR: "ggui-render-error";
33
+ };
34
+ /**
35
+ * Srcdoc JS snippet: bridge agent data postMessages into CustomEvents inside iframe.
36
+ * Inject this into any srcdoc <script> so that components receive ggui:agent-data
37
+ * events when the parent forwards data via postMessage.
38
+ */
39
+ export declare const SRCDOC_AGENT_DATA_BRIDGE = "\n window.addEventListener(\"message\", function(event) {\n if (event.data && event.data.type === \"ggui-agent-data\") {\n window.dispatchEvent(new CustomEvent(\"ggui:agent-data\", { detail: event.data.payload }));\n }\n });";
40
+ /**
41
+ * Srcdoc JS snippet: auto-report content height changes to parent.
42
+ *
43
+ * Uses a ResizeObserver on <html> to detect layout changes and posts
44
+ * a `ggui-resize` message with the current scrollHeight. Also fires
45
+ * an initial measurement on the next animation frame after injection.
46
+ *
47
+ * Inject this into any srcdoc or rendered page <script> so the parent
48
+ * can auto-size the iframe to fit content without scrollbars.
49
+ */
50
+ export declare const SRCDOC_RESIZE_BRIDGE: string;
51
+ /**
52
+ * Srcdoc JS snippet: universal interaction bridge inside iframe.
53
+ *
54
+ * Three layers of automatic event capture (no props.onSubmit needed):
55
+ * 1. Form submit intercept — captures <form> submissions with all field data
56
+ * 2. Interactive element clicks — buttons, [role="button"], links, [data-action]
57
+ * 3. Cursor-pointer fallback (approach C) — any styled-clickable div/span/card
58
+ *
59
+ * All layers skip if props.onSubmit already handled the event (__ggui_submitHandled).
60
+ * Click handler uses bubble phase so component handlers run first.
61
+ */
62
+ export declare const SRCDOC_USER_DATA_BRIDGE = "\n // Dedup: props.onSubmit sets __ggui_submitHandled = true synchronously.\n // Both layers check this. We use a microtask to reset it so it stays\n // true for ALL handlers in the same event cycle (click + submit).\n function __ggui_wasHandled() {\n if (!window.__ggui_submitHandled) return false;\n // Reset via microtask \u2014 stays true for all sync handlers in this tick\n Promise.resolve().then(function() { window.__ggui_submitHandled = false; });\n return true;\n }\n\n // Layer 1: Form submit intercept (bubble phase \u2014 lets component onSubmit run first)\n // Handles: <form> submit via enter key or submit-button click.\n // Uses bubble phase so component's onSubmit (which may call props.onSubmit) fires first.\n document.addEventListener(\"submit\", function(e) {\n e.preventDefault();\n if (__ggui_wasHandled()) return;\n var form = e.target;\n var data = {};\n try { data = Object.fromEntries(new FormData(form)); } catch(_) {}\n parent.postMessage({ type: \"ggui-user-data\", data: data }, \"*\");\n });\n\n // Layers 2+3: Universal click handler (bubble phase \u2014 runs after component handlers)\n // Handles: buttons, [role=\"button\"], links, [data-action], cursor:pointer elements.\n // Does NOT handle submit-type elements inside forms (Layer 1 handles those).\n document.addEventListener(\"click\", function(e) {\n if (__ggui_wasHandled()) return;\n if (!e.target || !e.target.closest) return;\n\n // Layer 2: Find the closest standard interactive element\n var el = e.target.closest(\"button\")\n || e.target.closest(\"[role='button']\")\n || e.target.closest(\"a[href], a[data-action]\")\n || e.target.closest(\"[data-action]\")\n || e.target.closest(\"[data-ggui-action]\");\n\n // Layer 3 (approach C): Fallback \u2014 walk up DOM looking for cursor:pointer\n if (!el) {\n var target = e.target;\n var depth = 0;\n while (target && target !== document.documentElement && depth < 6) {\n if (target.nodeType === 1) {\n try {\n if (window.getComputedStyle(target).cursor === \"pointer\") {\n el = target;\n break;\n }\n } catch(_) {}\n }\n target = target.parentElement;\n depth++;\n }\n }\n if (!el) return;\n\n // Skip submit-type elements inside forms \u2014 Layer 1 handles those.\n // (click fires before submit, so we must yield to avoid double-fire)\n // <button> defaults to type=\"submit\", so el.type === \"submit\" catches both\n // <button> and <button type=\"submit\">. Only <button type=\"button\"> is excluded.\n if (el.closest(\"form\") && el.type === \"submit\") return;\n\n // Skip form control elements \u2014 these are data entry, not actions.\n // Checkboxes, radios, inputs, selects get captured via form submit (Layer 1).\n var tag = el.tagName;\n if (tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\" || tag === \"LABEL\") return;\n\n // For standalone interactive elements, post click event with label + data attributes\n var data = { action: \"click\" };\n var label = el.getAttribute(\"aria-label\")\n || el.getAttribute(\"data-label\")\n || el.innerText\n || el.textContent;\n if (label) data.label = label.trim().substring(0, 200);\n\n // Spread data-* attributes into payload (data-action, data-value, etc.)\n if (el.dataset) {\n for (var key in el.dataset) {\n if (el.dataset.hasOwnProperty(key)) data[key] = el.dataset[key];\n }\n }\n\n parent.postMessage({ type: \"ggui-user-data\", data: data }, \"*\");\n });";
63
+ //# sourceMappingURL=iframe-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iframe-bridge.d.ts","sourceRoot":"","sources":["../src/iframe-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa;IAExB,qKAAqK;;IAErK,uLAAuL;;IAIvL,0HAA0H;;IAI1H,8KAA8K;;IAI9K,0GAA0G;;IAI1G,2JAA2J;;IAE3J,iKAAiK;;IAIjK,kIAAkI;;IAElI,2IAA2I;;IAE3I,qIAAqI;;CAE7H,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,kPAK/B,CAAC;AAEP;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,QAUzB,CAAC;AAET;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,8lHAmF9B,CAAC"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Event names used across the iframe bridge -- symmetric naming convention.
3
+ *
4
+ * Events prefixed with `ggui-` are `postMessage` types (cross-origin iframe boundary).
5
+ * Events prefixed with `ggui:` are `CustomEvent` names (same-origin, dispatched on `window`).
6
+ *
7
+ * The bridge has three directions:
8
+ * 1. **Agent to Component** (inbound): data, streams, progress
9
+ * 2. **Component to Agent** (outbound): user interactions (form submits, clicks)
10
+ * 3. **Component to Host** (outbound): rendering lifecycle (resize, success, error)
11
+ */
12
+ export const BRIDGE_EVENTS = {
13
+ // === Agent → Component (inbound via ggui_emit) ===
14
+ /** `postMessage` type for parent-to-iframe data delivery. The parent window posts this type; the iframe bridge script converts it to an `AGENT_DATA` CustomEvent. */
15
+ AGENT_DATA_POST: 'ggui-agent-data',
16
+ /** `CustomEvent` name dispatched on `window` when agent data arrives. Components listen for this to receive real-time data from the agent (chat messages, typing indicators, etc.). */
17
+ AGENT_DATA: 'ggui:agent-data',
18
+ // === Agent → Component (inbound via streaming) ===
19
+ /** `CustomEvent` name for streaming text chunks from the agent. Fired incrementally as the agent generates a response. */
20
+ AGENT_STREAM: 'ggui:agent-stream',
21
+ // === Agent → Shell (inbound agent messages) ===
22
+ /** `CustomEvent` name for agent messages. Payload includes `type: 'thinking' | 'chat'`. Thinking messages show what the agent is doing; chat messages are final responses. */
23
+ AGENT_MSG: 'ggui:agent-msg',
24
+ // === Platform → Shell (inbound via generation logs) ===
25
+ /** `CustomEvent` name for UI generation log updates. Debug/devtools only — not displayed to end users. */
26
+ AGENT_LOGS: 'ggui:logs',
27
+ // === Component → Agent (outbound via user interaction) ===
28
+ /** `postMessage` type for iframe-to-parent user interaction data. Carries form submissions and click events from generated components back to the host. */
29
+ USER_DATA_POST: 'ggui-user-data',
30
+ /** `CustomEvent` name dispatched on the parent window when user data arrives from the iframe. The host shell listens for this to forward events to the agent. */
31
+ USER_DATA: 'ggui:user-data',
32
+ // === Component → Host (outbound via rendering lifecycle) ===
33
+ /** `postMessage` type sent when a component's content size changes. Used by the host to auto-resize the iframe to fit content. */
34
+ RESIZE: 'ggui-resize',
35
+ /** `postMessage` type sent when a component renders successfully. The host uses this to hide loading indicators and show the component. */
36
+ RENDER_SUCCESS: 'ggui-render-success',
37
+ /** `postMessage` type sent when a component fails to render. The host uses this to show an error state instead of a blank iframe. */
38
+ RENDER_ERROR: 'ggui-render-error',
39
+ };
40
+ /**
41
+ * Srcdoc JS snippet: bridge agent data postMessages into CustomEvents inside iframe.
42
+ * Inject this into any srcdoc <script> so that components receive ggui:agent-data
43
+ * events when the parent forwards data via postMessage.
44
+ */
45
+ export const SRCDOC_AGENT_DATA_BRIDGE = `
46
+ window.addEventListener("message", function(event) {
47
+ if (event.data && event.data.type === "ggui-agent-data") {
48
+ window.dispatchEvent(new CustomEvent("ggui:agent-data", { detail: event.data.payload }));
49
+ }
50
+ });`;
51
+ /**
52
+ * Srcdoc JS snippet: auto-report content height changes to parent.
53
+ *
54
+ * Uses a ResizeObserver on <html> to detect layout changes and posts
55
+ * a `ggui-resize` message with the current scrollHeight. Also fires
56
+ * an initial measurement on the next animation frame after injection.
57
+ *
58
+ * Inject this into any srcdoc or rendered page <script> so the parent
59
+ * can auto-size the iframe to fit content without scrollbars.
60
+ */
61
+ export const SRCDOC_RESIZE_BRIDGE = `
62
+ (function() {
63
+ var resizeObserver = new ResizeObserver(function() {
64
+ parent.postMessage({ type: "${BRIDGE_EVENTS.RESIZE}", height: document.documentElement.scrollHeight }, "*");
65
+ });
66
+ resizeObserver.observe(document.documentElement);
67
+ // Initial measurement after first paint
68
+ requestAnimationFrame(function() {
69
+ parent.postMessage({ type: "${BRIDGE_EVENTS.RESIZE}", height: document.documentElement.scrollHeight }, "*");
70
+ });
71
+ })();`;
72
+ /**
73
+ * Srcdoc JS snippet: universal interaction bridge inside iframe.
74
+ *
75
+ * Three layers of automatic event capture (no props.onSubmit needed):
76
+ * 1. Form submit intercept — captures <form> submissions with all field data
77
+ * 2. Interactive element clicks — buttons, [role="button"], links, [data-action]
78
+ * 3. Cursor-pointer fallback (approach C) — any styled-clickable div/span/card
79
+ *
80
+ * All layers skip if props.onSubmit already handled the event (__ggui_submitHandled).
81
+ * Click handler uses bubble phase so component handlers run first.
82
+ */
83
+ export const SRCDOC_USER_DATA_BRIDGE = `
84
+ // Dedup: props.onSubmit sets __ggui_submitHandled = true synchronously.
85
+ // Both layers check this. We use a microtask to reset it so it stays
86
+ // true for ALL handlers in the same event cycle (click + submit).
87
+ function __ggui_wasHandled() {
88
+ if (!window.__ggui_submitHandled) return false;
89
+ // Reset via microtask — stays true for all sync handlers in this tick
90
+ Promise.resolve().then(function() { window.__ggui_submitHandled = false; });
91
+ return true;
92
+ }
93
+
94
+ // Layer 1: Form submit intercept (bubble phase — lets component onSubmit run first)
95
+ // Handles: <form> submit via enter key or submit-button click.
96
+ // Uses bubble phase so component's onSubmit (which may call props.onSubmit) fires first.
97
+ document.addEventListener("submit", function(e) {
98
+ e.preventDefault();
99
+ if (__ggui_wasHandled()) return;
100
+ var form = e.target;
101
+ var data = {};
102
+ try { data = Object.fromEntries(new FormData(form)); } catch(_) {}
103
+ parent.postMessage({ type: "ggui-user-data", data: data }, "*");
104
+ });
105
+
106
+ // Layers 2+3: Universal click handler (bubble phase — runs after component handlers)
107
+ // Handles: buttons, [role="button"], links, [data-action], cursor:pointer elements.
108
+ // Does NOT handle submit-type elements inside forms (Layer 1 handles those).
109
+ document.addEventListener("click", function(e) {
110
+ if (__ggui_wasHandled()) return;
111
+ if (!e.target || !e.target.closest) return;
112
+
113
+ // Layer 2: Find the closest standard interactive element
114
+ var el = e.target.closest("button")
115
+ || e.target.closest("[role='button']")
116
+ || e.target.closest("a[href], a[data-action]")
117
+ || e.target.closest("[data-action]")
118
+ || e.target.closest("[data-ggui-action]");
119
+
120
+ // Layer 3 (approach C): Fallback — walk up DOM looking for cursor:pointer
121
+ if (!el) {
122
+ var target = e.target;
123
+ var depth = 0;
124
+ while (target && target !== document.documentElement && depth < 6) {
125
+ if (target.nodeType === 1) {
126
+ try {
127
+ if (window.getComputedStyle(target).cursor === "pointer") {
128
+ el = target;
129
+ break;
130
+ }
131
+ } catch(_) {}
132
+ }
133
+ target = target.parentElement;
134
+ depth++;
135
+ }
136
+ }
137
+ if (!el) return;
138
+
139
+ // Skip submit-type elements inside forms — Layer 1 handles those.
140
+ // (click fires before submit, so we must yield to avoid double-fire)
141
+ // <button> defaults to type="submit", so el.type === "submit" catches both
142
+ // <button> and <button type="submit">. Only <button type="button"> is excluded.
143
+ if (el.closest("form") && el.type === "submit") return;
144
+
145
+ // Skip form control elements — these are data entry, not actions.
146
+ // Checkboxes, radios, inputs, selects get captured via form submit (Layer 1).
147
+ var tag = el.tagName;
148
+ if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || tag === "LABEL") return;
149
+
150
+ // For standalone interactive elements, post click event with label + data attributes
151
+ var data = { action: "click" };
152
+ var label = el.getAttribute("aria-label")
153
+ || el.getAttribute("data-label")
154
+ || el.innerText
155
+ || el.textContent;
156
+ if (label) data.label = label.trim().substring(0, 200);
157
+
158
+ // Spread data-* attributes into payload (data-action, data-value, etc.)
159
+ if (el.dataset) {
160
+ for (var key in el.dataset) {
161
+ if (el.dataset.hasOwnProperty(key)) data[key] = el.dataset[key];
162
+ }
163
+ }
164
+
165
+ parent.postMessage({ type: "ggui-user-data", data: data }, "*");
166
+ });`;
@@ -0,0 +1,62 @@
1
+ export * from './version';
2
+ export * from './types/auth';
3
+ export * from './types/capabilities';
4
+ export * from './types/events';
5
+ export * from './types/region';
6
+ export * from './types/session';
7
+ export * from './types/thread';
8
+ export * from './types/live-channel';
9
+ export * from './types/ui-generator';
10
+ export * from './types/mcp';
11
+ export * from './schemas/mcp';
12
+ export * from './schemas/invoke';
13
+ export * from './schemas/data-contract';
14
+ export { canonicalizeContracts, canonicalizeValue, } from './registry/canonicalize-contract';
15
+ export { summarizeContract } from './registry/summarize-contract';
16
+ export type { TextBlock, ToolUseBlock, ToolResultBlock, ContentBlock, TextDelta, InputJsonDelta, ContentBlockDeltaPayload, MessageStartEvent, ContentBlockStartEvent, ContentBlockDeltaEvent, ContentBlockStopEvent, MessageDeltaEvent, MessageStopEvent, PingEvent, ErrorEvent, InvokeEvent, InvokeErrorCode, InvokeTurn, InvokeRequest, } from './types/invoke';
17
+ export * from './types/llm';
18
+ export * from './types/openrouter-models';
19
+ export * from './types/interface-context';
20
+ export * from './types/host-context';
21
+ export * from './types/canvas-lifecycle';
22
+ export * from './types/data-bindings';
23
+ export * from './types/feedback';
24
+ export * from './types/data-contract';
25
+ export * from './types/blueprint';
26
+ export * from './schemas/blueprint';
27
+ export * from './types/handshake-suggestion';
28
+ export * from './schemas/handshake-suggestion';
29
+ export * from './schemas/ops-blueprint';
30
+ export * from './types/contract-inference';
31
+ export * from './types/gadget';
32
+ export * from './types/app-config';
33
+ export * from './navigation/index';
34
+ export * from './iframe-bridge';
35
+ export * from './envelope-adapters';
36
+ export * from './envelopes/builders';
37
+ export * from './errors/version-mismatch';
38
+ export * from './errors/unknown-permission-name';
39
+ export * from './validation/contract-validator';
40
+ export * from './validation/cross-references';
41
+ export * from './validation/hygiene-rules';
42
+ export * from './validation/lint-contract';
43
+ export * from './validation/name-invariants';
44
+ export * from './validation/schema-compat-invariants';
45
+ export * from './validation/schema-meta-validation';
46
+ export * from './validation/resolve-stream-channel';
47
+ export * from './validation/reserved-channels';
48
+ export * from './validation/sanitize-error';
49
+ export * from './validation/schema-subset';
50
+ export * from './validation/zod-to-json-schema';
51
+ export * from './validation/ui-security';
52
+ export * from './stream/stream-parser';
53
+ export * from './bridge/invoke-agent';
54
+ export * from './schema-learning/merge';
55
+ export * from './schema-learning/derive-contract';
56
+ export * from './screen-blueprints/index';
57
+ export * from './types/credential';
58
+ export { GGUI_AGENT_SYSTEM_PROMPT } from './recommended-prompts';
59
+ export * from './types/mcp-proxy';
60
+ export { STDLIB_GADGETS, STDLIB_GADGETS_PACKAGE, STDLIB_GADGETS_VERSION, STDLIB_GADGET_HOOKS, } from './gadgets/stdlib-gadgets';
61
+ export { filterDescriptorsToContract, gadgetIdentityKey, gadgetExportName, listContractGadgets, } from './gadgets/resolve-contract-gadgets';
62
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAI/B,cAAc,sBAAsB,CAAC;AAOrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AAIxC,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,kCAAkC,CAAC;AAK1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAMlE,YAAY,EAEV,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EAEZ,SAAS,EACT,cAAc,EACd,wBAAwB,EAExB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,WAAW,EACX,eAAe,EAEf,UAAU,EACV,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAI/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,cAAc,mBAAmB,CAAC;AAClC,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oCAAoC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,79 @@
1
+ export * from './version.js';
2
+ export * from './types/auth.js';
3
+ export * from './types/capabilities.js';
4
+ export * from './types/events.js';
5
+ export * from './types/region.js';
6
+ export * from './types/session.js';
7
+ export * from './types/thread.js';
8
+ // Live-channel contract payload types — SubscribePayload / AckPayload /
9
+ // StreamEnvelope / GeneratePayload / etc. The WHAT each live-channel
10
+ // message carries, independent of how the wire frames it.
11
+ export * from './types/live-channel.js';
12
+ // WebSocket transport envelope (WebSocketMessage / WebSocketMessageType
13
+ // / ConnectionStatus) is NOT re-exported at root. Transport implementors
14
+ // import it from the dedicated subpath: `@ggui-ai/protocol/transport/
15
+ // websocket`. That keeps `@ggui-ai/protocol`'s root surface free of
16
+ // wire-framing baggage — consumers that only need contract shapes don't
17
+ // pay the transport types' weight.
18
+ export * from './types/ui-generator.js';
19
+ export * from './types/mcp.js';
20
+ export * from './schemas/mcp.js';
21
+ export * from './schemas/invoke.js';
22
+ export * from './schemas/data-contract.js';
23
+ // Registry-side helpers — pure utilities for computing the canonical
24
+ // identity hash of a DataContract shape. Consumed by the Tier 1
25
+ // exact-match path of the blueprint registry.
26
+ export { canonicalizeContracts, canonicalizeValue, } from './registry/canonicalize-contract.js';
27
+ // `blueprintKey` lives at `@ggui-ai/protocol/blueprint-key` (server-only).
28
+ // It pulls in `node:crypto`, which browsers can't bundle. Same convention
29
+ // as `./content-hash`. Server consumers import from the subpath:
30
+ // import { blueprintKey } from '@ggui-ai/protocol/blueprint-key';
31
+ export { summarizeContract } from './registry/summarize-contract.js';
32
+ export * from './types/llm.js';
33
+ export * from './types/openrouter-models.js';
34
+ export * from './types/interface-context.js';
35
+ export * from './types/host-context.js';
36
+ export * from './types/canvas-lifecycle.js';
37
+ export * from './types/data-bindings.js';
38
+ export * from './types/feedback.js';
39
+ export * from './types/data-contract.js';
40
+ export * from './types/blueprint.js';
41
+ export * from './schemas/blueprint.js';
42
+ export * from './types/handshake-suggestion.js';
43
+ export * from './schemas/handshake-suggestion.js';
44
+ // Operator-class blueprint tool schemas. Lives alongside the blueprint
45
+ // type schemas so handlers + cloud pod + console + fixtures all import
46
+ // the wire shape from one place.
47
+ export * from './schemas/ops-blueprint.js';
48
+ export * from './types/contract-inference.js';
49
+ export * from './types/gadget.js';
50
+ export * from './types/app-config.js';
51
+ export * from './navigation/index.js';
52
+ export * from './iframe-bridge.js';
53
+ export * from './envelope-adapters.js';
54
+ export * from './envelopes/builders.js';
55
+ export * from './errors/version-mismatch.js';
56
+ export * from './errors/unknown-permission-name.js';
57
+ export * from './validation/contract-validator.js';
58
+ export * from './validation/cross-references.js';
59
+ export * from './validation/hygiene-rules.js';
60
+ export * from './validation/lint-contract.js';
61
+ export * from './validation/name-invariants.js';
62
+ export * from './validation/schema-compat-invariants.js';
63
+ export * from './validation/schema-meta-validation.js';
64
+ export * from './validation/resolve-stream-channel.js';
65
+ export * from './validation/reserved-channels.js';
66
+ export * from './validation/sanitize-error.js';
67
+ export * from './validation/schema-subset.js';
68
+ export * from './validation/zod-to-json-schema.js';
69
+ export * from './validation/ui-security.js';
70
+ export * from './stream/stream-parser.js';
71
+ export * from './bridge/invoke-agent.js';
72
+ export * from './schema-learning/merge.js';
73
+ export * from './schema-learning/derive-contract.js';
74
+ export * from './screen-blueprints/index.js';
75
+ export * from './types/credential.js';
76
+ export { GGUI_AGENT_SYSTEM_PROMPT } from './recommended-prompts.js';
77
+ export * from './types/mcp-proxy.js';
78
+ export { STDLIB_GADGETS, STDLIB_GADGETS_PACKAGE, STDLIB_GADGETS_VERSION, STDLIB_GADGET_HOOKS, } from './gadgets/stdlib-gadgets.js';
79
+ export { filterDescriptorsToContract, gadgetIdentityKey, gadgetExportName, listContractGadgets, } from './gadgets/resolve-contract-gadgets.js';