@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,169 @@
1
+ /**
2
+ * Streamable Invoke Protocol v1 — Zod schemas.
3
+ *
4
+ * Single source of truth for the client→agent invoke turn. Mirrors Anthropic's
5
+ * Messages streaming format exactly (message_start / content_block_{start,delta,stop}
6
+ * / message_delta / message_stop / ping / error). UI rendering is expressed as
7
+ * plain `tool_use` blocks calling the `ggui_render` / `ggui_render_blueprint`
8
+ * client tools — no ggui-specific block type.
9
+ *
10
+ * TS types in types/invoke.ts are derived from these via z.infer. Consumers
11
+ * (@ggui-ai/server, @ggui-ai/react) import schemas for runtime validation
12
+ * and types for authoring.
13
+ */
14
+ import { z } from 'zod';
15
+ import { interfaceContextSchema } from './mcp.js';
16
+ // ── Content blocks ────────────────────────────────────────────────────
17
+ /** Plain text content — streamed via `text_delta` events. */
18
+ export const textBlockSchema = z.object({
19
+ type: z.literal('text'),
20
+ text: z.string(),
21
+ });
22
+ /** Tool call initiated by the agent. Input may arrive via `input_json_delta`. */
23
+ export const toolUseBlockSchema = z.object({
24
+ type: z.literal('tool_use'),
25
+ id: z.string(),
26
+ name: z.string(),
27
+ input: z.record(z.string(), z.unknown()),
28
+ });
29
+ /**
30
+ * Tool execution result (Protocol v1.1).
31
+ *
32
+ * Emitted inline on the assistant turn when the server executed a tool on
33
+ * the agent's behalf (e.g. `ggui_push`, `ggui_handshake`). Clients pair this
34
+ * with the matching `tool_use` by `tool_use_id` and render — no second
35
+ * round-trip through a `ggui_render` client tool is needed.
36
+ *
37
+ * This extends Anthropic's shape: Anthropic puts `tool_result` in the next
38
+ * user message, we also allow it on the assistant turn because the server
39
+ * already has the result. The `content` shape depends on the tool.
40
+ */
41
+ export const toolResultBlockSchema = z.object({
42
+ type: z.literal('tool_result'),
43
+ tool_use_id: z.string(),
44
+ content: z.unknown(),
45
+ is_error: z.boolean().optional(),
46
+ });
47
+ /** Discriminated union of every legal content block type. */
48
+ export const contentBlockSchema = z.discriminatedUnion('type', [
49
+ textBlockSchema,
50
+ toolUseBlockSchema,
51
+ toolResultBlockSchema,
52
+ ]);
53
+ // ── Deltas ────────────────────────────────────────────────────────────
54
+ export const textDeltaSchema = z.object({
55
+ type: z.literal('text_delta'),
56
+ text: z.string(),
57
+ });
58
+ export const inputJsonDeltaSchema = z.object({
59
+ type: z.literal('input_json_delta'),
60
+ partial_json: z.string(),
61
+ });
62
+ export const contentBlockDeltaPayloadSchema = z.discriminatedUnion('type', [
63
+ textDeltaSchema,
64
+ inputJsonDeltaSchema,
65
+ ]);
66
+ // ── Events ────────────────────────────────────────────────────────────
67
+ /** First event of a turn. */
68
+ export const messageStartEventSchema = z.object({
69
+ type: z.literal('message_start'),
70
+ message: z.object({
71
+ id: z.string(),
72
+ role: z.literal('assistant'),
73
+ model: z.string().optional(),
74
+ }),
75
+ });
76
+ /** A new content block begins. */
77
+ export const contentBlockStartEventSchema = z.object({
78
+ type: z.literal('content_block_start'),
79
+ index: z.number().int().nonnegative(),
80
+ content_block: contentBlockSchema,
81
+ });
82
+ /** Incremental update to the block at `index`. */
83
+ export const contentBlockDeltaEventSchema = z.object({
84
+ type: z.literal('content_block_delta'),
85
+ index: z.number().int().nonnegative(),
86
+ delta: contentBlockDeltaPayloadSchema,
87
+ });
88
+ /** The block at `index` is complete. */
89
+ export const contentBlockStopEventSchema = z.object({
90
+ type: z.literal('content_block_stop'),
91
+ index: z.number().int().nonnegative(),
92
+ });
93
+ /** Final metadata just before the turn ends. */
94
+ export const messageDeltaEventSchema = z.object({
95
+ type: z.literal('message_delta'),
96
+ delta: z.object({
97
+ stop_reason: z.enum(['end_turn', 'max_tokens', 'tool_use', 'error']),
98
+ stop_sequence: z.string().nullable().optional(),
99
+ }),
100
+ usage: z.object({
101
+ input_tokens: z.number().int().nonnegative(),
102
+ output_tokens: z.number().int().nonnegative(),
103
+ }),
104
+ });
105
+ /** Turn is done. No events may follow. */
106
+ export const messageStopEventSchema = z.object({
107
+ type: z.literal('message_stop'),
108
+ });
109
+ /** Keep-alive frame. */
110
+ export const pingEventSchema = z.object({
111
+ type: z.literal('ping'),
112
+ });
113
+ /** Terminal error. No `message_stop` follows. */
114
+ export const invokeErrorCodeSchema = z.enum([
115
+ 'invalid_request',
116
+ 'unauthorized',
117
+ 'rate_limited',
118
+ 'invoke_in_progress',
119
+ 'upstream_error',
120
+ 'tool_error',
121
+ 'internal',
122
+ ]);
123
+ export const errorEventSchema = z.object({
124
+ type: z.literal('error'),
125
+ error: z.object({
126
+ code: invokeErrorCodeSchema,
127
+ message: z.string(),
128
+ retryAfterMs: z.number().int().nonnegative().optional(),
129
+ }),
130
+ });
131
+ /**
132
+ * Discriminated union over every event the agent may emit.
133
+ *
134
+ * Parsing an incoming SSE frame:
135
+ * const event = invokeEventSchema.parse(JSON.parse(frame.data));
136
+ * switch (event.type) { ... }
137
+ */
138
+ export const invokeEventSchema = z.discriminatedUnion('type', [
139
+ messageStartEventSchema,
140
+ contentBlockStartEventSchema,
141
+ contentBlockDeltaEventSchema,
142
+ contentBlockStopEventSchema,
143
+ messageDeltaEventSchema,
144
+ messageStopEventSchema,
145
+ pingEventSchema,
146
+ errorEventSchema,
147
+ ]);
148
+ // ── Request ───────────────────────────────────────────────────────────
149
+ /**
150
+ * A prior conversation turn. Content is either a plain text shortcut or a
151
+ * structured content block sequence (mirrors Anthropic's `messages[].content`).
152
+ */
153
+ export const invokeTurnSchema = z.object({
154
+ role: z.enum(['user', 'assistant']),
155
+ content: z.union([z.string(), z.array(contentBlockSchema)]),
156
+ });
157
+ /**
158
+ * POST body shape for `{endpointUrl}/invoke`.
159
+ *
160
+ * Stateless by default — client holds history, sends full `history[]` every
161
+ * turn. Agents that need server-side memory layer their own keyed on
162
+ * `X-Ggui-Session-Id`.
163
+ */
164
+ export const invokeRequestSchema = z.object({
165
+ message: z.string(),
166
+ history: z.array(invokeTurnSchema).optional(),
167
+ interfaceContext: interfaceContextSchema.optional(),
168
+ requestId: z.string().optional(),
169
+ });
@@ -0,0 +1,301 @@
1
+ /**
2
+ * MCP Tool Zod Schemas — Single Source of Truth
3
+ *
4
+ * These schemas define the validation rules for MCP tool inputs.
5
+ * TypeScript types in types/mcp.ts are derived from these via z.infer.
6
+ * The server handler imports these for runtime validation.
7
+ */
8
+ import { z } from 'zod';
9
+ export declare const viewportSchema: z.ZodObject<{
10
+ width: z.ZodNumber;
11
+ height: z.ZodNumber;
12
+ }, z.core.$strip>;
13
+ export declare const interfaceContextSchema: z.ZodObject<{
14
+ viewport: z.ZodObject<{
15
+ width: z.ZodNumber;
16
+ height: z.ZodNumber;
17
+ }, z.core.$strip>;
18
+ platform: z.ZodEnum<{
19
+ web: "web";
20
+ desktop: "desktop";
21
+ mobile: "mobile";
22
+ }>;
23
+ deviceType: z.ZodEnum<{
24
+ desktop: "desktop";
25
+ phone: "phone";
26
+ tablet: "tablet";
27
+ }>;
28
+ orientation: z.ZodEnum<{
29
+ portrait: "portrait";
30
+ landscape: "landscape";
31
+ }>;
32
+ devicePixelRatio: z.ZodOptional<z.ZodNumber>;
33
+ touchPrimary: z.ZodOptional<z.ZodBoolean>;
34
+ shellType: z.ZodOptional<z.ZodEnum<{
35
+ fullscreen: "fullscreen";
36
+ chat: "chat";
37
+ spatial: "spatial";
38
+ }>>;
39
+ colorScheme: z.ZodOptional<z.ZodEnum<{
40
+ light: "light";
41
+ dark: "dark";
42
+ }>>;
43
+ reducedMotion: z.ZodOptional<z.ZodBoolean>;
44
+ }, z.core.$loose>;
45
+ export declare const popInputSchema: z.ZodObject<{
46
+ sessionId: z.ZodString;
47
+ }, z.core.$strict>;
48
+ export declare const consumeInputSchema: z.ZodObject<{
49
+ stackItemId: z.ZodString;
50
+ timeout: z.ZodOptional<z.ZodNumber>;
51
+ }, z.core.$strict>;
52
+ /**
53
+ * Input schema for `ggui_emit` — emit a stamped delivery on a declared
54
+ * `streamSpec[channel]`.
55
+ */
56
+ export declare const emitInputSchema: z.ZodObject<{
57
+ sessionId: z.ZodString;
58
+ channel: z.ZodString;
59
+ payload: z.ZodUnknown;
60
+ complete: z.ZodOptional<z.ZodBoolean>;
61
+ stackItemId: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strict>;
63
+ export declare const getSessionInputSchema: z.ZodObject<{
64
+ sessionId: z.ZodString;
65
+ }, z.core.$strict>;
66
+ export declare const getStackInputSchema: z.ZodObject<{
67
+ sessionId: z.ZodString;
68
+ }, z.core.$strict>;
69
+ export declare const closeInputSchema: z.ZodObject<{
70
+ sessionId: z.ZodString;
71
+ }, z.core.$strict>;
72
+ export declare const listFeaturedBlueprintsInputSchema: z.ZodObject<{
73
+ level: z.ZodOptional<z.ZodEnum<{
74
+ component: "component";
75
+ primitive: "primitive";
76
+ composite: "composite";
77
+ template: "template";
78
+ }>>;
79
+ category: z.ZodOptional<z.ZodString>;
80
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
+ limit: z.ZodOptional<z.ZodNumber>;
82
+ }, z.core.$strict>;
83
+ export declare const searchBlueprintsInputSchema: z.ZodObject<{
84
+ query: z.ZodString;
85
+ limit: z.ZodOptional<z.ZodNumber>;
86
+ }, z.core.$strict>;
87
+ export declare const renderBlueprintInputSchema: z.ZodObject<{
88
+ blueprintId: z.ZodString;
89
+ props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
90
+ }, z.core.$strict>;
91
+ export declare const discoverInputSchema: z.ZodObject<{}, z.core.$strict>;
92
+ export declare const requestCredentialInputSchema: z.ZodObject<{
93
+ serviceId: z.ZodString;
94
+ reason: z.ZodOptional<z.ZodString>;
95
+ sessionId: z.ZodOptional<z.ZodString>;
96
+ }, z.core.$strict>;
97
+ /**
98
+ * `ggui_new_session` — mint or resolve a chat-scoped session handle.
99
+ *
100
+ * Server-mints, agent-threads. SEP-2567 aligned ("Sessionless MCP",
101
+ * Final 2026-03-11): the MCP spec deliberately removes Mcp-Session-Id
102
+ * because hosts can't agree on what a session means; the recommended
103
+ * pattern is exactly this — server returns explicit handles, agent
104
+ * threads them through subsequent calls.
105
+ *
106
+ * No inputs — every call mints a fresh random sessionId. (A prior
107
+ * optional `seed` for deterministic derivation was retired because
108
+ * LLMs were passing the same seed across user turns and getting back
109
+ * the same sessionId, defeating the "new" in the tool name.)
110
+ */
111
+ export declare const newSessionInputSchema: z.ZodObject<{}, z.core.$strict>;
112
+ export declare const newSessionOutputSchema: z.ZodObject<{
113
+ sessionId: z.ZodString;
114
+ appId: z.ZodString;
115
+ createdAt: z.ZodString;
116
+ nextStep: z.ZodObject<{
117
+ tool: z.ZodLiteral<"ggui_handshake">;
118
+ description: z.ZodString;
119
+ example: z.ZodString;
120
+ }, z.core.$strip>;
121
+ }, z.core.$strip>;
122
+ /**
123
+ * `ggui_handshake` — three-step suggestion protocol.
124
+ *
125
+ * Step 1 (this input): the agent posts a draft — its idea: contract +
126
+ * optional variance + optional generator hint.
127
+ *
128
+ * Step 2 (server-side, see `handshakeOutputSchema`): the server runs
129
+ * `BlueprintSearch` and contract-validation in parallel and returns a
130
+ * `HandshakeSuggestion` routed by `origin: cache | agent | synth`.
131
+ *
132
+ * Step 3 (paired `ggui_push`): the agent accepts (reuses the
133
+ * provisional `blueprintId` minted in step-2) OR overrides (mints a
134
+ * fresh `blueprintId` against a NEW draft).
135
+ *
136
+ * Locked decisions:
137
+ *
138
+ * - `blueprintDraft` is the single-field input wrapping contract +
139
+ * variance + generator hint.
140
+ * - The agent is the contract authority; synth amends only when
141
+ * validation fails.
142
+ */
143
+ export declare const handshakeInputSchema: z.ZodObject<{
144
+ sessionId: z.ZodString;
145
+ intent: z.ZodString;
146
+ blueprintDraft: z.ZodType<import("..").BlueprintDraft, unknown, z.core.$ZodTypeInternals<import("..").BlueprintDraft, unknown>>;
147
+ forceCreate: z.ZodOptional<z.ZodBoolean>;
148
+ }, z.core.$strict>;
149
+ /**
150
+ * Three-step handshake output. Single `suggestion` carries
151
+ * `origin: cache | agent | synth`, `blueprintMeta` (always present),
152
+ * and optional `amendments` (synth-only) / `validationFindings`
153
+ * (soft on cache).
154
+ *
155
+ * The agent reads `suggestion.origin` to branch the paired push:
156
+ *
157
+ * - `cache` → push `{decision: {kind: 'accept'}}` for cache delivery.
158
+ * - `agent` → push `{decision: {kind: 'accept'}}` to gen against the draft.
159
+ * - `synth` → push `{decision: {kind: 'accept'}}` to gen against the amended contract.
160
+ *
161
+ * Any origin → push `{decision: {kind: 'override', blueprintDraft: {...}}}` to
162
+ * discard the suggestion and gen against a fresh draft (mints a new
163
+ * `blueprintId` server-side).
164
+ *
165
+ * Wire-output is intentionally lean. The handler carries `reason`,
166
+ * `target`, `alternatives`, `contractHash`, `serverCapabilities` on
167
+ * its internal `HandshakeOutput` TS shape for telemetry / post-classify
168
+ * tracing — zod strips them before structuredContent serialization.
169
+ *
170
+ * `serverCapabilities` reaches the iframe via `_meta.ggui.bootstrap`
171
+ * (see `bootstrap-meta-derivation.ts`), not via this response.
172
+ */
173
+ export declare const handshakeOutputSchema: z.ZodObject<{
174
+ handshakeId: z.ZodString;
175
+ action: z.ZodEnum<{
176
+ replace: "replace";
177
+ create: "create";
178
+ reuse: "reuse";
179
+ update: "update";
180
+ compose: "compose";
181
+ declined: "declined";
182
+ }>;
183
+ suggestion: z.ZodType<import("..").HandshakeSuggestion, unknown, z.core.$ZodTypeInternals<import("..").HandshakeSuggestion, unknown>>;
184
+ reason: z.ZodOptional<z.ZodString>;
185
+ nextStep: z.ZodOptional<z.ZodObject<{
186
+ tool: z.ZodLiteral<"ggui_push">;
187
+ description: z.ZodString;
188
+ example: z.ZodString;
189
+ }, z.core.$strip>>;
190
+ }, z.core.$strip>;
191
+ /**
192
+ * `ggui_push` — materialises a UI emission. Step 3 of the three-step
193
+ * handshake protocol.
194
+ *
195
+ * The agent commits its decision relative to the prior handshake's
196
+ * suggestion: ACCEPT (use the provisional `blueprintMeta` from
197
+ * step-2 verbatim) or OVERRIDE (mint a fresh blueprintId with a NEW
198
+ * `blueprintDraft`).
199
+ *
200
+ * Locked decisions:
201
+ *
202
+ * - `decision` discriminator: `{kind: 'accept'} |
203
+ * {kind: 'override', blueprintDraft: {...}}`.
204
+ * - `accept` reuses `handshake.suggestion.blueprintMeta.blueprintId`
205
+ * exactly; `override` discards the provisional id and mints fresh.
206
+ *
207
+ * There is no separate `ggui_commit` — push absorbs that responsibility.
208
+ */
209
+ export declare const pushInputSchema: z.ZodObject<{
210
+ handshakeId: z.ZodString;
211
+ props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
212
+ decision: z.ZodType<import("..").PushDecision, unknown, z.core.$ZodTypeInternals<import("..").PushDecision, unknown>>;
213
+ }, z.core.$strict>;
214
+ /**
215
+ * Wire-output shape — intentionally lean: `{stackItemId, nextStep?,
216
+ * url, action}`. The handler carries `sessionId`, `shortCode`,
217
+ * `codeReady`, `handshakeId`, `decision`, `contract`, `contractHash`,
218
+ * `cache`, `codeUrl`, `codeHash` on its internal `PushOutput` TS shape
219
+ * for telemetry / post-classify tracing — zod strips them before
220
+ * structuredContent serialization.
221
+ *
222
+ * The iframe receives bootstrap credentials (`wsUrl`, `token`,
223
+ * `expiresAt`) via `_meta.ggui.bootstrap`, not via this response.
224
+ */
225
+ export declare const pushOutputSchema: z.ZodObject<{
226
+ stackItemId: z.ZodString;
227
+ url: z.ZodString;
228
+ action: z.ZodEnum<{
229
+ replace: "replace";
230
+ create: "create";
231
+ reuse: "reuse";
232
+ update: "update";
233
+ compose: "compose";
234
+ declined: "declined";
235
+ }>;
236
+ nextStep: z.ZodOptional<z.ZodObject<{
237
+ tool: z.ZodLiteral<"ggui_consume">;
238
+ description: z.ZodString;
239
+ example: z.ZodString;
240
+ args: z.ZodObject<{
241
+ stackItemId: z.ZodString;
242
+ }, z.core.$strip>;
243
+ }, z.core.$strip>>;
244
+ }, z.core.$strip>;
245
+ /**
246
+ * `ggui_update` — refresh the rendered UI with new state.
247
+ *
248
+ * Discriminated on `kind`:
249
+ *
250
+ * - `kind: 'replace'` + `props` — full props replacement. The new
251
+ * map IS the new state. Use when most props change OR when you
252
+ * want deterministic state restoration (no merge ambiguity).
253
+ *
254
+ * - `kind: 'merge'` + `patch` — RFC 7396 JSON Merge Patch semantics.
255
+ * Top-level keys merge shallow; nested objects merge recursively;
256
+ * a `null` value DELETES the key; arrays fully replace (NOT element-
257
+ * wise). Use when most props stay the same and the agent only
258
+ * needs to send a small delta — common after a single domain-tool
259
+ * mutation. RFC 7396 chosen because it has a published spec and
260
+ * wide library support (GitHub API, Kubernetes strategic-merge).
261
+ *
262
+ * Anti-patterns (the discriminated union rejects these structurally,
263
+ * but they're a common author mistake when copy-pasting):
264
+ *
265
+ * - Do NOT send `props` on `kind: 'merge'` — use `patch`.
266
+ * - Do NOT send `patch` on `kind: 'replace'` — use `props`.
267
+ *
268
+ * Both modes validate the FINAL props state (post-merge for `merge`)
269
+ * against the stack item's `propsSpec` and reject on violation —
270
+ * partial patches that would break required fields, type-mismatch
271
+ * values, etc. all reject pre-persist.
272
+ *
273
+ * `stackItemId` is globally unique; the server resolves the owning
274
+ * session via its secondary index and tenancy-checks via `ctx.appId`.
275
+ * NO `sessionId` on the wire.
276
+ */
277
+ export declare const updateInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
278
+ stackItemId: z.ZodString;
279
+ kind: z.ZodLiteral<"replace">;
280
+ props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
281
+ }, z.core.$strict>, z.ZodObject<{
282
+ stackItemId: z.ZodString;
283
+ kind: z.ZodLiteral<"merge">;
284
+ patch: z.ZodRecord<z.ZodString, z.ZodUnknown>;
285
+ }, z.core.$strict>], "kind">;
286
+ /**
287
+ * Wire-output shape — minimal acknowledgement. The handler carries
288
+ * `sessionId`, `decision`, `contract`, `contractHash` on its internal
289
+ * `UpdateOutput` TS shape — zod strips them before structuredContent
290
+ * serialization.
291
+ *
292
+ * Post-update the iframe receives the new props via the live-channel
293
+ * `props_update` WS frame; the cross-host fallback path receives them
294
+ * via `_meta.ggui.bootstrap.propsJson` (see `update.resultMeta`). The
295
+ * wire response itself is just acknowledgement.
296
+ */
297
+ export declare const updateOutputSchema: z.ZodObject<{
298
+ stackItemId: z.ZodString;
299
+ updated: z.ZodBoolean;
300
+ }, z.core.$strip>;
301
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/schemas/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,cAAc;;;iBAGzB,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUnB,CAAC;AASjB,eAAO,MAAM,cAAc;;kBAEhB,CAAC;AAEZ,eAAO,MAAM,kBAAkB;;;kBAIpB,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;kBASjB,CAAC;AAEZ,eAAO,MAAM,qBAAqB;;kBAEvB,CAAC;AAEZ,eAAO,MAAM,mBAAmB;;kBAErB,CAAC;AAEZ,eAAO,MAAM,gBAAgB;;kBAElB,CAAC;AAEZ,eAAO,MAAM,iCAAiC;;;;;;;;;;kBAKnC,CAAC;AAEZ,eAAO,MAAM,2BAA2B;;;kBAG7B,CAAC;AAEZ,eAAO,MAAM,0BAA0B;;;kBAG5B,CAAC;AAEZ,eAAO,MAAM,mBAAmB,iCAAwB,CAAC;AAEzD,eAAO,MAAM,4BAA4B;;;;kBAI9B,CAAC;AAaZ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,iCAAwB,CAAC;AAE3D,eAAO,MAAM,sBAAsB;;;;;;;;;iBAWjC,CAAC;AAMH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,oBAAoB;;;;;kBAmCtB,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;iBAgChC,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,eAAe;;;;kBA4BjB,CAAC;AAEZ;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;iBA0B3B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;4BAa5B,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAC"}