@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,207 @@
1
+ /**
2
+ * Persistent-chat wire types for OSS `@ggui-ai/mcp-server` and its
3
+ * adapters.
4
+ *
5
+ * Paired with the Portal-side `FullChatStorageAdapter` contract in
6
+ * `packages/chat-managed-amplify/src/createAdapter.ts` — this file's
7
+ * vocabulary (action names, author roles, message kinds, idempotency
8
+ * semantics) matches that adapter verbatim so both cloud and self-
9
+ * hosted implementations speak the same shape.
10
+ *
11
+ * These types are protocol-level because they cross the wire between
12
+ * self-hosted clients (Portal) and self-hosted servers (`ggui serve`)
13
+ * + between SDK adapter packages and server handler implementations.
14
+ * Internal server state (e.g., per-thread sequencer counters) stays
15
+ * in `@ggui-ai/mcp-server-core` and is NOT exposed here.
16
+ *
17
+ * Out of scope for v1:
18
+ * - cross-origin thread federation
19
+ * - multi-user / shared threads
20
+ * - server-driven push-notification delivery (channel is here, pipe
21
+ * isn't)
22
+ * - search within threads
23
+ *
24
+ * Rule of thumb: these shapes are the public wire contract.
25
+ * **Additions are additive forever** (consumer adapters dedupe on
26
+ * fields they know). Breaking changes require a protocol version bump.
27
+ */
28
+ /**
29
+ * Opaque identity owning a thread.
30
+ *
31
+ * - Hosted-cloud origins → Cognito sub (`cognito_<sub>`) or guest
32
+ * install id (`guest_<uuidv4>`). Wire shape identical; ownership is
33
+ * derived per-auth-mode on the server.
34
+ * - Self-hosted origins → the subject the `AuthAdapter` resolves a
35
+ * pairing bearer token to (implementation-defined, typically
36
+ * `paired_<pairingId>`).
37
+ *
38
+ * The server never needs to parse this; it's an opaque string that
39
+ * partitions thread rows. The SDK adapter likewise treats it as
40
+ * opaque.
41
+ */
42
+ export type ThreadOwnerId = string;
43
+ /** Message author roles. Matches the cloud adapter verbatim. */
44
+ export type ThreadMessageAuthor = 'user' | 'agent' | 'system';
45
+ /** Message content kinds. Matches the cloud adapter verbatim. */
46
+ export type ThreadMessageKind = 'text' | 'card' | 'event';
47
+ /** Thread lifecycle states. */
48
+ export type ThreadStatus = 'active' | 'archived' | 'pending_delete';
49
+ /**
50
+ * The 9-action state machine that mutates per-thread UI state. Identical
51
+ * vocabulary to `packages/chat-managed-amplify/src/createAdapter.ts#
52
+ * ThreadStateAction` so both cloud and self-hosted adapters dispatch
53
+ * through the same call. Every action is idempotent with respect to
54
+ * its target state — `pin` twice leaves the thread pinned; `unpin` on
55
+ * an unpinned thread is a no-op; `restore` requires
56
+ * `status === 'pending_delete'` or is rejected.
57
+ */
58
+ export declare const THREAD_STATE_ACTIONS: readonly ["pin", "unpin", "mute", "unmute", "archive", "unarchive", "mark_read", "request_delete", "restore"];
59
+ export type ThreadStateAction = (typeof THREAD_STATE_ACTIONS)[number];
60
+ export declare function isThreadStateAction(value: unknown): value is ThreadStateAction;
61
+ /**
62
+ * A persistent conversation.
63
+ *
64
+ * Pinned to its origin at creation; origin-awareness lives on the
65
+ * client. A thread exists on exactly one origin for its entire
66
+ * lifetime — there is no migration path.
67
+ */
68
+ export interface Thread {
69
+ id: string;
70
+ /** App this thread belongs to. */
71
+ appId: string;
72
+ /** Opaque owner identity — see {@link ThreadOwnerId}. */
73
+ ownerId: ThreadOwnerId;
74
+ /** Optional human-readable title. Initially derived from the
75
+ * `firstMessageHint` supplied at creation, or the app name if
76
+ * absent. Editable later (not part of v1 transport, but the field
77
+ * is here so the shape is forward-compatible). */
78
+ title?: string;
79
+ /** Monotonic sequence of the latest message. Starts at 0 on create;
80
+ * bumps on every `appendMessage`. */
81
+ lastSeq: number;
82
+ /** ISO timestamp of the last message append. Absent until the
83
+ * first message exists. */
84
+ lastMessageAt?: string;
85
+ /** Unread count from the owner's perspective. Incremented by
86
+ * `appendMessage`, zeroed by `mark_read`. */
87
+ unreadCount: number;
88
+ pinned: boolean;
89
+ muted: boolean;
90
+ status: ThreadStatus;
91
+ createdAt: string;
92
+ updatedAt: string;
93
+ /** Opaque per-thread metadata — integrators may attach
94
+ * servingRegion, shellType hints, etc. Not interpreted by the
95
+ * server; forwarded verbatim on reads. */
96
+ metadata?: Record<string, unknown>;
97
+ }
98
+ /**
99
+ * One message within a thread. Append-only — messages are never
100
+ * edited or deleted in place; thread state mutations use
101
+ * {@link ThreadStateAction} instead.
102
+ *
103
+ * `seq` is server-assigned and monotonic per thread, starting at 1.
104
+ * `key` is the caller-supplied idempotency key — a duplicate `key`
105
+ * on append returns the existing row (the appended row's `seq` and
106
+ * `at` stay stable across retries).
107
+ */
108
+ export interface ThreadMessage {
109
+ threadId: string;
110
+ /** Idempotency key. Unique per `(threadId, key)`. */
111
+ key: string;
112
+ /** Monotonic within a thread; starts at 1. */
113
+ seq: number;
114
+ /** ISO timestamp of server receipt. */
115
+ at: string;
116
+ authorRole: ThreadMessageAuthor;
117
+ kind: ThreadMessageKind;
118
+ /** Content blocks. The OSS protocol does not constrain block shape
119
+ * beyond JSON-serializability; integrators typically put the same
120
+ * ContentBlock vocabulary `@ggui-ai/protocol/types/invoke.ts` uses
121
+ * (text + tool_use + tool_result + thinking). Kept `unknown[]` here
122
+ * so the wire stays forward-compatible when the block vocabulary
123
+ * widens. */
124
+ blocks: unknown[];
125
+ /** Card snapshot — populated when `kind === 'card'`. Opaque. */
126
+ cardSnapshot?: unknown;
127
+ /** Short text preview used in transcript lists + search indexing. */
128
+ textPreview: string;
129
+ /** Opaque integrator context (appId, model, shellType, etc.). */
130
+ aiContext?: unknown;
131
+ }
132
+ /**
133
+ * Input to `createThread` / `POST /threads`.
134
+ */
135
+ export interface CreateThreadInput {
136
+ appId: string;
137
+ /** A hint the server may use to seed the thread title or be echoed
138
+ * to the agent as the conversation opener. Not stored as a message
139
+ * by default — a subsequent `appendMessage` with the user's real
140
+ * first message is the load-bearing write. */
141
+ firstMessageHint?: string;
142
+ metadata?: Record<string, unknown>;
143
+ }
144
+ /**
145
+ * Input to `appendMessage` / `POST /threads/{id}/messages`.
146
+ */
147
+ export interface AppendThreadMessageInput {
148
+ threadId: string;
149
+ key: string;
150
+ authorRole: ThreadMessageAuthor;
151
+ kind: ThreadMessageKind;
152
+ blocks: unknown[];
153
+ cardSnapshot?: unknown;
154
+ /** Required — keeps compact transcript views honest. Callers that
155
+ * have nothing visual to show should still pass an empty string
156
+ * explicitly to make that choice auditable. */
157
+ textPreview: string;
158
+ aiContext?: unknown;
159
+ }
160
+ /**
161
+ * Input to `listMessages` / `GET /threads/{id}/messages`.
162
+ */
163
+ export interface ListMessagesOptions {
164
+ /** First `seq` to include. Default: 1. */
165
+ fromSeq?: number;
166
+ /** Max messages to return. Default: 100. Hard ceiling enforced
167
+ * server-side — implementations MAY cap below this. */
168
+ limit?: number;
169
+ /** Opaque cursor for pagination. Format is implementation-local;
170
+ * clients pass the previous response's cursor verbatim. */
171
+ cursor?: string;
172
+ }
173
+ export interface ListMessagesResult {
174
+ messages: ThreadMessage[];
175
+ /** Cursor for the next page. Absent when no more pages. */
176
+ nextCursor?: string;
177
+ }
178
+ /**
179
+ * Filter shape for `listThreads` / `GET /threads`.
180
+ */
181
+ export interface ListThreadsFilter {
182
+ /** Restrict by status. Omit for all statuses. */
183
+ status?: ThreadStatus;
184
+ /** Restrict by app. Omit for all apps. */
185
+ appId?: string;
186
+ /** Max threads to return. Default: 50. */
187
+ limit?: number;
188
+ cursor?: string;
189
+ }
190
+ export interface ListThreadsResult {
191
+ threads: Thread[];
192
+ nextCursor?: string;
193
+ }
194
+ /**
195
+ * SSE stream event emitted by `GET /threads/{id}/stream`.
196
+ *
197
+ * Every event carries the message's `seq` so reconnecting clients can
198
+ * resume with `?fromSeq=<last-seen-seq + 1>`. Delivery is
199
+ * at-least-once; consumers dedupe by `(threadId, seq)`.
200
+ */
201
+ export interface ThreadStreamEvent {
202
+ /** Discriminator — makes future event kinds additive-forward. */
203
+ type: 'thread-message';
204
+ message: ThreadMessage;
205
+ }
206
+ export declare function isThreadStreamEvent(value: unknown): value is ThreadStreamEvent;
207
+ //# sourceMappingURL=thread.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../../src/types/thread.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Persistent-chat wire types for OSS `@ggui-ai/mcp-server` and its
3
+ * adapters.
4
+ *
5
+ * Paired with the Portal-side `FullChatStorageAdapter` contract in
6
+ * `packages/chat-managed-amplify/src/createAdapter.ts` — this file's
7
+ * vocabulary (action names, author roles, message kinds, idempotency
8
+ * semantics) matches that adapter verbatim so both cloud and self-
9
+ * hosted implementations speak the same shape.
10
+ *
11
+ * These types are protocol-level because they cross the wire between
12
+ * self-hosted clients (Portal) and self-hosted servers (`ggui serve`)
13
+ * + between SDK adapter packages and server handler implementations.
14
+ * Internal server state (e.g., per-thread sequencer counters) stays
15
+ * in `@ggui-ai/mcp-server-core` and is NOT exposed here.
16
+ *
17
+ * Out of scope for v1:
18
+ * - cross-origin thread federation
19
+ * - multi-user / shared threads
20
+ * - server-driven push-notification delivery (channel is here, pipe
21
+ * isn't)
22
+ * - search within threads
23
+ *
24
+ * Rule of thumb: these shapes are the public wire contract.
25
+ * **Additions are additive forever** (consumer adapters dedupe on
26
+ * fields they know). Breaking changes require a protocol version bump.
27
+ */
28
+ /**
29
+ * The 9-action state machine that mutates per-thread UI state. Identical
30
+ * vocabulary to `packages/chat-managed-amplify/src/createAdapter.ts#
31
+ * ThreadStateAction` so both cloud and self-hosted adapters dispatch
32
+ * through the same call. Every action is idempotent with respect to
33
+ * its target state — `pin` twice leaves the thread pinned; `unpin` on
34
+ * an unpinned thread is a no-op; `restore` requires
35
+ * `status === 'pending_delete'` or is rejected.
36
+ */
37
+ export const THREAD_STATE_ACTIONS = [
38
+ 'pin',
39
+ 'unpin',
40
+ 'mute',
41
+ 'unmute',
42
+ 'archive',
43
+ 'unarchive',
44
+ 'mark_read',
45
+ 'request_delete',
46
+ 'restore',
47
+ ];
48
+ export function isThreadStateAction(value) {
49
+ return (typeof value === 'string' &&
50
+ THREAD_STATE_ACTIONS.includes(value));
51
+ }
52
+ export function isThreadStreamEvent(value) {
53
+ if (typeof value !== 'object' || value === null)
54
+ return false;
55
+ const v = value;
56
+ return v['type'] === 'thread-message' && typeof v['message'] === 'object';
57
+ }
@@ -0,0 +1,100 @@
1
+ import type { EventSubscription } from './events';
2
+ import type { DataContract, JsonObject, JsonSchema, JsonValue } from './data-contract';
3
+ /**
4
+ * Design system version — used as part of the cache fingerprint.
5
+ * When tokens or primitives change, bump this to invalidate cached blueprints.
6
+ *
7
+ * Keep in sync with the `@ggui-ai/design` package.json version.
8
+ */
9
+ export declare const DESIGN_SYSTEM_VERSION = "0.1.0";
10
+ /**
11
+ * Inputs for computing a style fingerprint.
12
+ * The fingerprint determines cache validity for generated blueprints.
13
+ *
14
+ * NOTE: themeId is NOT included — theme colors are injected at render time
15
+ * via cssOverrides, not baked into generated code.
16
+ */
17
+ export interface StyleFingerprintInput {
18
+ /** App's styling/generation prompt (affects component structure/layout) */
19
+ stylingPrompt?: string;
20
+ /** Design system preset (affects available components/tokens) */
21
+ designSystemPreset?: string;
22
+ /** Design system version (covers tokens, primitives, motion, everything compiled) */
23
+ designSystemVersion: string;
24
+ }
25
+ /**
26
+ * Compute a style fingerprint for cache invalidation.
27
+ *
28
+ * Blueprints generated under the same fingerprint are interchangeable.
29
+ * A fingerprint change means cached blueprints may use outdated primitives,
30
+ * tokens, or structural patterns and should be regenerated.
31
+ *
32
+ * What invalidates the cache:
33
+ * - stylingPrompt changed ("make it playful" → different layout)
34
+ * - designSystemPreset changed (different component set available)
35
+ * - designSystemVersion bumped (new tokens, primitives, motion, etc.)
36
+ *
37
+ * What does NOT invalidate:
38
+ * - themeId changed (colors are applied at render time via cssOverrides)
39
+ *
40
+ * Uses FNV-1a (non-cryptographic) — this is for cache keys, not security.
41
+ * Works in all JS runtimes (browser, Node.js, React Native).
42
+ */
43
+ export declare function computeStyleFingerprint(input: StyleFingerprintInput): string;
44
+ /**
45
+ * Request to generate a UI component.
46
+ * Generic `TContext` defaults to {@link JsonObject} for generator context hints.
47
+ */
48
+ export interface UIGenerationRequest<TContext = JsonObject> {
49
+ sessionId: string;
50
+ prompt: string;
51
+ context?: TContext;
52
+ schema?: JsonSchema;
53
+ subscription?: EventSubscription;
54
+ }
55
+ /**
56
+ * Internal response from UI generation. This is the GENERATOR-OUTPUT
57
+ * shape — `componentCode` is the freshly produced ESM string. Before
58
+ * the stack item commits to the wire, the bootstrap-meta derivation
59
+ * uploads the code body and projects `codeUrl` (a fetchable URL) onto
60
+ * `_meta.ggui.bootstrap` instead of inlining the source. Iframe
61
+ * runtimes fetch the code from `codeUrl`; they never see this field.
62
+ */
63
+ export interface UIGenerationResponse {
64
+ stackItemId: string;
65
+ componentCode: string;
66
+ sourceCode?: string;
67
+ warnings?: string[];
68
+ /**
69
+ * Data contract the generated component conforms to.
70
+ *
71
+ * Populated by the generator when the component calls wire hooks
72
+ * (`useAction('name')`, `useStream('channel')`) — the generator
73
+ * extracts the call sites and emits a matching authoring-side
74
+ * envelope so downstream consumers (`ggui_push` → StackItem, console
75
+ * inspectors, session-channel router) have the contract available.
76
+ *
77
+ * - When the caller supplied `UiGenerateInput.contract` that
78
+ * envelope is passed through as-is (already authoritative).
79
+ * - When the caller didn't supply a contract but the generated code
80
+ * uses wire hooks, the generator synthesizes a MINIMAL envelope:
81
+ * `actionSpec[name] = {label: name}` and
82
+ * `streamSpec[channel] = {schema: {type: 'object'}}`. Enough for
83
+ * the receiver to know the surface exists; callers who need
84
+ * richer metadata (labels, schemas, refresh tools) should
85
+ * author the contract themselves and pass it on input.
86
+ * - When no wire hooks are used, this field stays absent.
87
+ */
88
+ contract?: DataContract;
89
+ }
90
+ /**
91
+ * Error during UI generation.
92
+ * The `details` field is {@link JsonValue} to carry any JSON-safe diagnostic data.
93
+ */
94
+ export interface GenerationError {
95
+ code: 'PRODUCTION_FAILED' | 'COMPILATION_ERROR' | 'VALIDATION_ERROR';
96
+ message: string;
97
+ /** Additional diagnostic information. Typed as {@link JsonValue} (any JSON-safe value). */
98
+ details?: JsonValue;
99
+ }
100
+ //# sourceMappingURL=ui-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-generator.d.ts","sourceRoot":"","sources":["../../src/types/ui-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,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,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB,2FAA2F;IAC3F,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB"}
@@ -0,0 +1,53 @@
1
+ /**
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
+ }
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Ajv-backed JSON Schema validation runtime for ggui contracts.
3
+ *
4
+ * Owns layers B (inner JSON Schema meta-validation) and C (runtime
5
+ * data validation across propsSpec / actionSpec / streamSpec /
6
+ * contextSpec) of the six-layer model. The outer A-layers — protocol
7
+ * wrappers (DataContract envelope, PropsSpec, PropEntry, ActionEntry,
8
+ * etc.) — stay on zod where TS inference + structural strict-mode
9
+ * already do their job.
10
+ *
11
+ * Why Ajv:
12
+ * - Canonical JSON Schema validator (303M weekly downloads).
13
+ * - Single source of truth: same compiled validator powers all four
14
+ * runtime spec surfaces, so closed-shape semantics never diverge
15
+ * between props vs action vs stream vs context.
16
+ * - Compile-time meta-validation: `strict: true` rejects malformed
17
+ * JSON Schemas at `compile()` — agents discover bugs at
18
+ * handshake/push, not at first data flow.
19
+ *
20
+ * Closed-shape (load-bearing):
21
+ * JSON Schema's default is `additionalProperties: true` (extras
22
+ * allowed). Our "propsSpec IS the contract" promise needs
23
+ * closed-shape at EVERY depth. Rather than tax agents with
24
+ * `additionalProperties: false` at every object node, we inject it
25
+ * recursively via {@link injectClosedShape} before Ajv compiles.
26
+ * An author who explicitly sets `additionalProperties` (boolean or
27
+ * schema) keeps that intent — escape hatch for the rare case where
28
+ * open extension is intentional.
29
+ *
30
+ * Tolerated metadata keywords:
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.
38
+ */
39
+ import type { ErrorObject, ValidateFunction } from 'ajv';
40
+ /**
41
+ * Re-export of Ajv's compiled-validator function type. Consumers
42
+ * (e.g. the renderer iframe loading precompiled validator modules)
43
+ * import it from `@ggui-ai/protocol` so they need no direct `ajv`
44
+ * dependency — TS resolves the type transitively through this package.
45
+ */
46
+ export type { ValidateFunction } from 'ajv';
47
+ import type { JsonSchema } from '../types/data-contract';
48
+ import type { ContractViolation } from './contract-validator';
49
+ /**
50
+ * Recursively walk a JSON Schema and inject
51
+ * `additionalProperties: false` at every object node. Authors who
52
+ * explicitly set `additionalProperties` keep that intent (boolean
53
+ * preserved; schema recursed into).
54
+ *
55
+ * Walks:
56
+ * - `properties` (each entry)
57
+ * - `items` (array element schema)
58
+ * - `additionalProperties` (when it's a schema)
59
+ * - `oneOf` / `anyOf` (each branch)
60
+ *
61
+ * Returns a new schema tree; never mutates the input.
62
+ */
63
+ export declare function injectClosedShape(schema: JsonSchema): JsonSchema;
64
+ /**
65
+ * Compile a JSON Schema into an Ajv {@link ValidateFunction}, with
66
+ * closed-shape injected at every object node. Throws if the schema
67
+ * is malformed under Ajv strict mode — this is layer B meta-
68
+ * validation as a free side effect. Dedicated meta-validation call
69
+ * sites (handshake / push) wrap this in a structured error.
70
+ *
71
+ * Not cached. Compilation is fast and contracts are small; caching
72
+ * adds a memory cost without a measured win. Revisit if profiling
73
+ * shows compile dominating.
74
+ */
75
+ export declare function compileForValidation(schema: JsonSchema): ValidateFunction;
76
+ /**
77
+ * Compile a JSON Schema into a standalone, **fully self-contained ESM
78
+ * validator module** — source text, never a live function. Closed-shape
79
+ * is injected first, exactly as {@link compileForValidation} does, so
80
+ * the emitted validator enforces the same semantics.
81
+ *
82
+ * Why this exists: the renderer iframe runs under a strict CSP with no
83
+ * `'unsafe-eval'`, so `ajv.compile()` (which builds the validator via
84
+ * `new Function`) throws `EvalError` there. Codegen has to happen
85
+ * where `eval` is legal — the server, at push time, where the contract
86
+ * schema is already fixed. The iframe then loads this module source
87
+ * via a `blob:` dynamic import (governed by `script-src`, not
88
+ * `unsafe-eval`) and only ever *runs* the validator.
89
+ *
90
+ * The returned module `export default`s the validator function (and
91
+ * also names it `validate`). Ajv standalone references its runtime
92
+ * helpers by bare specifier (`ajv/dist/runtime/*`) — the
93
+ * CSP-sandboxed iframe has no bundler to resolve those, so this
94
+ * function **inlines** every helper a closed-contract validator can
95
+ * reach (in practice only `equal` / fast-deep-equal, for `uniqueItems`
96
+ * and object-valued `enum`/`const`). The result has zero imports. A
97
+ * survivor check throws if any un-inlined bare import remains, so a new
98
+ * Ajv helper surfaces as a loud server-side failure, never as silent
99
+ * iframe breakage.
100
+ *
101
+ * Throws if the schema is malformed under Ajv strict mode — same
102
+ * layer-B meta-validation side effect as {@link compileForValidation}.
103
+ */
104
+ export declare function compileValidatorModule(schema: JsonSchema): string;
105
+ /**
106
+ * Convert Ajv error objects into our {@link ContractViolation} shape.
107
+ *
108
+ * Path translation: Ajv `instancePath: '/todos/0/done'` →
109
+ * `field: 'todos[0].done'`. Numeric segments become bracket indices,
110
+ * named segments become dot-separated. Empty instancePath collapses
111
+ * to `''` (root-level error).
112
+ *
113
+ * Per-keyword mapping (see {@link mapOne}):
114
+ * - `additionalProperties` — extra-key violation; `field` includes
115
+ * the offending key, `expected: '<declared key>'`.
116
+ * - `required` — missing-key violation; `field` includes the
117
+ * missing key, `expected: 'present'`, `received: 'undefined'`.
118
+ * - `type` — type mismatch; `expected` is the JSON Schema type,
119
+ * `received` reads from the violating value.
120
+ * - `enum` / `const` — `expected` is the allowed value(s);
121
+ * `received` is the offending value.
122
+ * - `pattern` — `expected` is the regex; `received` is the
123
+ * offending string.
124
+ * - other keywords — fall through to Ajv's message verbatim.
125
+ */
126
+ export declare function mapAjvErrorsToViolations(errors: ErrorObject[] | null | undefined, data: unknown): ContractViolation[];
127
+ /**
128
+ * Re-anchor a list of Ajv-mapped violations under a stable field
129
+ * prefix. Used by the four spec validators to lift Ajv's root-
130
+ * relative paths into the caller's namespace:
131
+ * - propsSpec: no prefix (paths already prop-relative).
132
+ * - actionSpec: `<actionName>.data`.
133
+ * - streamSpec: `<channelName>.payload`.
134
+ * - contextSpec: `<slotName>.value`.
135
+ *
136
+ * Empty `field` (root-level violation) collapses to the prefix
137
+ * itself; sub-fields dot-join.
138
+ */
139
+ export declare function prefixViolations(violations: ContractViolation[], prefix: string): ContractViolation[];
140
+ //# sourceMappingURL=ajv-runtime.d.ts.map
@@ -0,0 +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;AAmF9D;;;;;;;;;;;;;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"}