@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,750 @@
1
+ /**
2
+ * Zod schema for {@link DataContract} — the canonical wire shape for
3
+ * agent-authored contract declarations.
4
+ *
5
+ * ## Why this file exists
6
+ *
7
+ * Output-side seams that type-narrow contract on the wire —
8
+ * `pushOutputSchema.contract` and the various `decision` echoes — use
9
+ * `z.custom<DataContract>()` because they trust the shape (it
10
+ * originates from internal pod state).
11
+ *
12
+ * The input seam is different: agents author contract on
13
+ * `story.contract` and the handler MUST plumb them to the generator.
14
+ * `z.custom<DataContract>()` does NOT work on input schemas — the
15
+ * MCP SDK serializes input schemas as JSON Schema for `tools/list`,
16
+ * and `z.custom<T>()` has no JSON-Schema representation (it's a
17
+ * TypeScript-only escape hatch). The narrow alternative
18
+ * (`z.record(z.string(), z.unknown())`) erases the type and forces
19
+ * `as DataContract` casts downstream, which violates the project's
20
+ * Zero Workarounds Policy + Strict Typing First principle.
21
+ *
22
+ * The fundamental fix is this file: a real zod schema mirroring the
23
+ * `DataContract` interface field-for-field. Both the protocol's
24
+ * `handshakeInputSchema` and the OSS handler's `inputSchema` build
25
+ * their `contract?` field from `dataContractSchema`, the type derives
26
+ * via `z.infer`, and JSON-Schema serialization for MCP `tools/list`
27
+ * advertises the contract surface to agents.
28
+ *
29
+ * ## Shape source of truth
30
+ *
31
+ * The TS interface in `../types/data-contract.ts` remains the
32
+ * declared source of truth (consumers import the type). This file's
33
+ * schemas are a structural mirror — `dataContractSchema` is typed
34
+ * `z.ZodType<DataContract>` so any drift between schema and
35
+ * interface fails compile. A future cleanup can flip the relationship
36
+ * (TS via `z.infer`), but that's a broader refactor.
37
+ *
38
+ * ## JsonSchema posture
39
+ *
40
+ * Every nested `schema: JsonSchema` field on contract entries
41
+ * (PropEntry, ActionEntry, StreamChannelEntry, ContextEntry, ...)
42
+ * accepts `jsonSchemaSchema` — a permissive `z.object` over the
43
+ * known JSON Schema draft-07 subset {@link JsonSchema} declares,
44
+ * with `passthrough()` for fields the shape doesn't enumerate. We
45
+ * deliberately do NOT enforce JSON Schema's full grammar at this
46
+ * layer — that work belongs in
47
+ * `@ggui-ai/protocol/validation/schema-subset` and runs at
48
+ * push-time + blueprint-registration-time as the F4 schema
49
+ * compatibility checker. Agents authoring malformed schemas surface
50
+ * at that pass with a named violation reason; this layer's job is
51
+ * just to accept the contract and pass it to the generator.
52
+ */
53
+ import { z } from 'zod';
54
+ import type { DataContract, JsonValue, JsonSchema } from '../types/data-contract';
55
+ /**
56
+ * Recursive {@link JsonValue} — string | number | boolean | null |
57
+ * array | object. All fields on contract entries that carry default
58
+ * values, examples, or arbitrary JSON payloads use this.
59
+ */
60
+ export declare const jsonValueSchema: z.ZodType<JsonValue>;
61
+ /**
62
+ * {@link JsonSchema} — JSON Schema draft-07 subset. Mirrors the
63
+ * fields the TS interface enumerates. `additionalProperties` and
64
+ * `items` are recursive — kept loose (`z.unknown()`) to avoid
65
+ * deep `z.lazy` chains; the F4 schema-subset checker validates
66
+ * full structural correctness at push time.
67
+ */
68
+ export declare const jsonSchemaSchema: z.ZodType<JsonSchema>;
69
+ /**
70
+ * {@link PropEntry} — per-prop metadata in a {@link PropsSpec}.
71
+ *
72
+ * Shape: `{schema: {type:'string', ...}, required?, default?, ...}`.
73
+ * The JSON Schema NEVER sits flat at the entry level — every entry's
74
+ * schema lives in `.schema`. Authors writing `{type:'string'}` instead
75
+ * of `{schema: {type:'string'}}` will hit a shape error at push time.
76
+ */
77
+ export declare const propEntrySchema: z.ZodObject<{
78
+ description: z.ZodOptional<z.ZodString>;
79
+ schema: z.ZodType<JsonSchema, unknown, z.core.$ZodTypeInternals<JsonSchema, unknown>>;
80
+ required: z.ZodOptional<z.ZodBoolean>;
81
+ default: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
82
+ example: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
83
+ sourceTool: z.ZodOptional<z.ZodString>;
84
+ }, z.core.$strict>;
85
+ /** {@link PropsSpec} — wrapper `{description?, properties}` over the per-prop map. */
86
+ export declare const propsSpecSchema: z.ZodObject<{
87
+ description: z.ZodOptional<z.ZodString>;
88
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
89
+ description: z.ZodOptional<z.ZodString>;
90
+ schema: z.ZodType<JsonSchema, unknown, z.core.$ZodTypeInternals<JsonSchema, unknown>>;
91
+ required: z.ZodOptional<z.ZodBoolean>;
92
+ default: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
93
+ example: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
94
+ sourceTool: z.ZodOptional<z.ZodString>;
95
+ }, z.core.$strict>>;
96
+ }, z.core.$strict>;
97
+ /**
98
+ * {@link ActionEntry} — per-action metadata in an {@link ActionSpec}.
99
+ *
100
+ * Actions are agent-routed gestures; no dispatch discriminator. Optional
101
+ * `nextStep` hints at the agent's intended next tool call (must resolve
102
+ * to an `agentCapabilities.tools[*]` key on the same contract —
103
+ * cross-ref enforced by the `CTR_REF_NEXT_STEP` linter).
104
+ *
105
+ * Anti-pattern: do NOT write `dispatch: {kind: 'tool', tool: '...'}` —
106
+ * that vocabulary is retired. Use a flat optional `nextStep: '<toolName>'`.
107
+ */
108
+ export declare const actionEntrySchema: z.ZodObject<{
109
+ description: z.ZodOptional<z.ZodString>;
110
+ label: z.ZodString;
111
+ schema: z.ZodOptional<z.ZodType<JsonSchema, unknown, z.core.$ZodTypeInternals<JsonSchema, unknown>>>;
112
+ example: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
113
+ icon: z.ZodOptional<z.ZodString>;
114
+ confirm: z.ZodOptional<z.ZodBoolean>;
115
+ nextStep: z.ZodOptional<z.ZodString>;
116
+ }, z.core.$strict>;
117
+ /** {@link ActionSpec} — flat `Record<name, ActionEntry>`. */
118
+ export declare const actionSpecSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
119
+ description: z.ZodOptional<z.ZodString>;
120
+ label: z.ZodString;
121
+ schema: z.ZodOptional<z.ZodType<JsonSchema, unknown, z.core.$ZodTypeInternals<JsonSchema, unknown>>>;
122
+ example: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
123
+ icon: z.ZodOptional<z.ZodString>;
124
+ confirm: z.ZodOptional<z.ZodBoolean>;
125
+ nextStep: z.ZodOptional<z.ZodString>;
126
+ }, z.core.$strict>>;
127
+ /** {@link StreamChannelEntry} — per-channel metadata in a {@link StreamSpec}. */
128
+ export declare const streamChannelEntrySchema: z.ZodObject<{
129
+ description: z.ZodOptional<z.ZodString>;
130
+ schema: z.ZodType<JsonSchema, unknown, z.core.$ZodTypeInternals<JsonSchema, unknown>>;
131
+ example: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
132
+ mode: z.ZodOptional<z.ZodEnum<{
133
+ append: "append";
134
+ replace: "replace";
135
+ }>>;
136
+ replay: z.ZodOptional<z.ZodEnum<{
137
+ latest: "latest";
138
+ all: "all";
139
+ none: "none";
140
+ }>>;
141
+ complete: z.ZodOptional<z.ZodBoolean>;
142
+ tool: z.ZodOptional<z.ZodString>;
143
+ source: z.ZodOptional<z.ZodObject<{
144
+ tool: z.ZodString;
145
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
146
+ }, z.core.$strict>>;
147
+ }, z.core.$strict>;
148
+ /** {@link StreamSpec} — flat `Record<channel, StreamChannelEntry>`. */
149
+ export declare const streamSpecSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
150
+ description: z.ZodOptional<z.ZodString>;
151
+ schema: z.ZodType<JsonSchema, unknown, z.core.$ZodTypeInternals<JsonSchema, unknown>>;
152
+ example: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
153
+ mode: z.ZodOptional<z.ZodEnum<{
154
+ append: "append";
155
+ replace: "replace";
156
+ }>>;
157
+ replay: z.ZodOptional<z.ZodEnum<{
158
+ latest: "latest";
159
+ all: "all";
160
+ none: "none";
161
+ }>>;
162
+ complete: z.ZodOptional<z.ZodBoolean>;
163
+ tool: z.ZodOptional<z.ZodString>;
164
+ source: z.ZodOptional<z.ZodObject<{
165
+ tool: z.ZodString;
166
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
167
+ }, z.core.$strict>>;
168
+ }, z.core.$strict>>;
169
+ /** {@link ContextEntry} — per-slot metadata in a {@link ContextSpec}. */
170
+ export declare const contextEntrySchema: z.ZodObject<{
171
+ description: z.ZodOptional<z.ZodString>;
172
+ schema: z.ZodType<JsonSchema, unknown, z.core.$ZodTypeInternals<JsonSchema, unknown>>;
173
+ default: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
174
+ debounceMs: z.ZodOptional<z.ZodNumber>;
175
+ example: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
176
+ }, z.core.$strict>;
177
+ /** {@link ContextSpec} — flat `Record<slot, ContextEntry>`. */
178
+ export declare const contextSpecSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
179
+ description: z.ZodOptional<z.ZodString>;
180
+ schema: z.ZodType<JsonSchema, unknown, z.core.$ZodTypeInternals<JsonSchema, unknown>>;
181
+ default: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
182
+ debounceMs: z.ZodOptional<z.ZodNumber>;
183
+ example: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
184
+ }, z.core.$strict>>;
185
+ /** {@link AgentToolEntry} — per-tool metadata in an {@link AgentCapabilitiesSpec}. */
186
+ export declare const agentToolEntrySchema: z.ZodObject<{
187
+ description: z.ZodOptional<z.ZodString>;
188
+ usage: z.ZodOptional<z.ZodString>;
189
+ inputSchema: z.ZodOptional<z.ZodType<JsonSchema, unknown, z.core.$ZodTypeInternals<JsonSchema, unknown>>>;
190
+ outputSchema: z.ZodOptional<z.ZodType<JsonSchema, unknown, z.core.$ZodTypeInternals<JsonSchema, unknown>>>;
191
+ required: z.ZodOptional<z.ZodBoolean>;
192
+ example: z.ZodOptional<z.ZodObject<{
193
+ input: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
194
+ output: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
195
+ }, z.core.$strict>>;
196
+ }, z.core.$strict>;
197
+ /** {@link AgentCapabilitiesSpec} — wrapper over the per-tool map. */
198
+ export declare const agentCapabilitiesSpecSchema: z.ZodObject<{
199
+ tools: z.ZodRecord<z.ZodString, z.ZodObject<{
200
+ description: z.ZodOptional<z.ZodString>;
201
+ usage: z.ZodOptional<z.ZodString>;
202
+ inputSchema: z.ZodOptional<z.ZodType<JsonSchema, unknown, z.core.$ZodTypeInternals<JsonSchema, unknown>>>;
203
+ outputSchema: z.ZodOptional<z.ZodType<JsonSchema, unknown, z.core.$ZodTypeInternals<JsonSchema, unknown>>>;
204
+ required: z.ZodOptional<z.ZodBoolean>;
205
+ example: z.ZodOptional<z.ZodObject<{
206
+ input: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
207
+ output: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
208
+ }, z.core.$strict>>;
209
+ }, z.core.$strict>>;
210
+ }, z.core.$loose>;
211
+ /**
212
+ * `App.publicEnv` key regex.
213
+ *
214
+ * Each key in `App.publicEnv` MUST match this pattern. The prefix is
215
+ * the **security boundary** — operators can't accidentally stash
216
+ * sensitive credentials under arbitrary names, and downstream consumers
217
+ * (push gate, bootstrap projection, iframe shim) can rely on the
218
+ * naming convention to mean "public-by-design".
219
+ *
220
+ * Rule: `GGUI_PUBLIC_APP_` prefix, then uppercase letters / digits /
221
+ * underscores, at least one char after the prefix.
222
+ *
223
+ * `GGUI_PUBLIC_USER_*` keys are RESERVED for a future per-user
224
+ * channel. The current regex rejects them so App-side config can't
225
+ * pre-emptively use the namespace.
226
+ *
227
+ * Hoisted above `gadgetDescriptorSchema` so the wrapper's `requires`
228
+ * array can reference it at schema-construction time (TDZ-safe).
229
+ */
230
+ export declare const PUBLIC_ENV_APP_KEY_RE: RegExp;
231
+ /**
232
+ * Single source of truth for the `requires[]` field shape on gadget
233
+ * descriptors. The wire-permissive `gadgetDescriptorSchema`, the
234
+ * strict `strictGadgetDescriptorSchema`, AND the author-facing
235
+ * `@ggui-ai/artifact-manifest#gadgetManifestSchema` all need an
236
+ * identical `z.array(z.string().regex(PUBLIC_ENV_APP_KEY_RE))`.
237
+ * Exported here so any future tightening (e.g., cap count, dedupe
238
+ * refinement) lives in one place.
239
+ *
240
+ * Entries are App.publicEnv key names — `GGUI_PUBLIC_APP_*`. Wrappers
241
+ * that declare a `requires` key must have a corresponding App-side
242
+ * publicEnv value at push time (gate: `assertPublicEnvSatisfied`).
243
+ */
244
+ export declare const gadgetRequiresSchema: z.ZodReadonly<z.ZodArray<z.ZodString>>;
245
+ /**
246
+ * SRI hash format for gadget bundles. Registry install writes
247
+ * `bundleSri` in this shape; iframe-runtime emits it verbatim into
248
+ * the `<script integrity>` attribute. Only `sha384` is accepted on
249
+ * purpose:
250
+ *
251
+ * - SHA-384 is the strongest hash routinely allowed by browsers
252
+ * for SRI without compatibility caveats (SHA-512 is allowed but
253
+ * adds no real security over -384 here).
254
+ * - Pinning a single algorithm makes the publish Lambda's hash
255
+ * computation and the iframe's verification trivially aligned —
256
+ * no algorithm negotiation, no ambiguity at audit time.
257
+ *
258
+ * Base64 body is the standard SRI body (RFC 3548 `+/=`, NOT
259
+ * url-safe). The regex permits zero or two `=` pad chars (SHA-384
260
+ * digest is 48 bytes = base64 length 64 with no padding).
261
+ */
262
+ export declare const BUNDLE_SRI_RE: RegExp;
263
+ /**
264
+ * Bare npm package name. Either an unscoped name (`leaflet`) or a
265
+ * scoped name (`@my-org/leaflet`). Mirrors the
266
+ * `validate-npm-package-name` subset that nearly every modern
267
+ * registry accepts:
268
+ *
269
+ * - Lowercase alphanumerics + `.` + `_` + `-`.
270
+ * - First char of name (and scope, if present) MUST be alphanumeric
271
+ * — leading `.`/`_`/`-` rejected to match historical npm bans.
272
+ * - At most one optional `@scope/` prefix.
273
+ *
274
+ * Examples that pass:
275
+ * - `leaflet`, `react-router`, `@ggui-ai/gadgets`, `@my-org/foo.bar`
276
+ *
277
+ * Examples that fail:
278
+ * - `@scope/@other/name` (multi-scope)
279
+ * - `https://registry.ggui.ai/foo` (URL — registry choice lives on
280
+ * `bundleUrl` / `typesUrl`, not `package`)
281
+ * - `Leaflet` (uppercase)
282
+ * - `.foo` / `_foo` / `-foo` (leading non-alphanumeric)
283
+ */
284
+ export declare const NPM_PACKAGE_NAME_RE: RegExp;
285
+ /**
286
+ * Exact semver pin (e.g., `0.0.1`, `1.2.3-beta.1`, `2.0.0+build.7`).
287
+ * No ranges (`^`, `~`, `>=`), no leading `v`, no wildcards.
288
+ *
289
+ * Why pin-only: the cache key for a generated UI is
290
+ * `hashContract(wire, intent)` — making the wire carry an exact
291
+ * version means cache invalidation is a pure function of the wire
292
+ * bytes (no canonicalize step). Version bumps produce new wire →
293
+ * fresh generation; forensics are observable from storage alone.
294
+ *
295
+ * Grammar mirrors semver 2.0 spec:
296
+ * `MAJOR.MINOR.PATCH(-PRERELEASE)?(+BUILD)?`
297
+ * Pre-release + build identifiers match `[\w.]+` (semver's
298
+ * dot-separated alphanumeric identifiers).
299
+ */
300
+ export declare const SEMVER_PIN_RE: RegExp;
301
+ /**
302
+ * Hostname-only regex for `bundleHost` — the registry hostname (no
303
+ * scheme, no path) that the server prepends `https://` to and
304
+ * appends the canonical `/bundles/<scope>/<name>/<version>/{bundle.js,style.css}`
305
+ * suffix to when resolving a gadget's URLs at push time.
306
+ *
307
+ * Examples that pass:
308
+ * - `registry.ggui.ai` (spec default)
309
+ * - `dev.registry.sandbox.ggui.ai`
310
+ * - `sandbox-ggui-main.registry.sandbox.ggui.ai`
311
+ * - `localhost:8787` (port permitted for local registries)
312
+ *
313
+ * Examples that fail (caught at register-time):
314
+ * - `https://registry.ggui.ai` (scheme not allowed; use `bundleUrl`
315
+ * full-URL escape hatch if you need non-HTTPS or a non-standard path)
316
+ * - `/leaflet@0.0.1/bundle.js` (path not allowed)
317
+ * - `Registry.Ggui.Ai` (must be lowercase; DNS names are
318
+ * case-insensitive but we pin lower for canonicalization)
319
+ */
320
+ export declare const BUNDLE_HOST_RE: RegExp;
321
+ /**
322
+ * Spec-default registry hostname applied when neither operator
323
+ * (`app.gadgets[*].bundleHost`) nor gadget manifest
324
+ * (`ggui.gadget.json#bundleHost`) declares one. The server's URL
325
+ * resolver falls through here last, so first-party + hosted-registry
326
+ * publishes "just work" without explicit operator config.
327
+ */
328
+ export declare const DEFAULT_BUNDLE_HOST = "registry.ggui.ai";
329
+ /**
330
+ * Loopback `bundleHost` predicate — anchored regex matching the three
331
+ * IP/hostname pairs that resolve to localhost: `localhost`, `127.0.0.1`,
332
+ * `0.0.0.0` (each optionally suffixed with a port). Anchoring at both
333
+ * ends prevents `localhost-evil.com` from being treated as loopback.
334
+ *
335
+ * Used symmetrically by:
336
+ * - `buildInstallCommand` (publish CLI) to emit `http://localhost:PORT`
337
+ * in the printed `ggui gadget install ...` line.
338
+ * - `resolveGadgetUrls` (push-time bootstrap derivation) to compute
339
+ * `http://localhost:PORT/bundles/...` so iframe fetches a reachable
340
+ * URL during local-dev / sandbox-registry workflows.
341
+ *
342
+ * If install + render disagreed on scheme, an operator running a local
343
+ * registry would publish via `http://` then have render emit `https://`
344
+ * and silently fail in the iframe (mixed-content block in the host's
345
+ * sandboxed context).
346
+ */
347
+ export declare const LOOPBACK_HOST_RE: RegExp;
348
+ /**
349
+ * Compute the scheme (`http` / `https`) for a given `bundleHost`.
350
+ * Loopback hosts get `http://`; everything else gets `https://`.
351
+ *
352
+ * Centralized so any future scheme-policy change (e.g., allowing
353
+ * `https://` on a self-signed local cert) updates one site.
354
+ */
355
+ export declare function bundleHostScheme(host: string): 'http' | 'https';
356
+ /**
357
+ * `HOOK_NAME_RE` + `COMPONENT_NAME_RE` are defined in the
358
+ * dependency-free leaf {@link module:schemas/gadget-name-grammar} and
359
+ * re-exported here so the package barrel surface is unchanged. The
360
+ * leaf placement breaks the import cycle that would otherwise form
361
+ * between this module and `validation/hygiene-rules.ts` (which also
362
+ * needs the grammars and which this module imports
363
+ * `KNOWN_PERMISSION_NAMES` from).
364
+ */
365
+ export { HOOK_NAME_RE, COMPONENT_NAME_RE } from './gadget-name-grammar';
366
+ /**
367
+ * Wire-permissive {@link GadgetExport} schema — a union of a
368
+ * hook-export shape (carries `hook`) and a component-export shape
369
+ * (carries `component`); the identifier field present is the natural
370
+ * discriminator. Each member is `.strict()`, so an entry carrying
371
+ * BOTH `hook` and `component` is rejected. Teaching text is optional
372
+ * so contract authoring stays cheap; the registry-side
373
+ * {@link strictGadgetExportSchema} requires it.
374
+ */
375
+ export declare const gadgetExportSchema: z.ZodUnion<readonly [z.ZodObject<{
376
+ description: z.ZodOptional<z.ZodString>;
377
+ usage: z.ZodOptional<z.ZodString>;
378
+ example: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
379
+ permission: z.ZodOptional<z.ZodString>;
380
+ gotchas: z.ZodOptional<z.ZodString>;
381
+ required: z.ZodOptional<z.ZodBoolean>;
382
+ hook: z.ZodString;
383
+ }, z.core.$strict>, z.ZodObject<{
384
+ description: z.ZodOptional<z.ZodString>;
385
+ usage: z.ZodOptional<z.ZodString>;
386
+ example: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
387
+ permission: z.ZodOptional<z.ZodString>;
388
+ gotchas: z.ZodOptional<z.ZodString>;
389
+ required: z.ZodOptional<z.ZodBoolean>;
390
+ component: z.ZodString;
391
+ }, z.core.$strict>]>;
392
+ /**
393
+ * Registry-strict {@link GadgetExport} schema — teaching text
394
+ * REQUIRED, `permission` enum-tight. Used as the `exports` element
395
+ * schema inside {@link strictGadgetDescriptorSchema}.
396
+ */
397
+ export declare const strictGadgetExportSchema: z.ZodUnion<readonly [z.ZodObject<{
398
+ description: z.ZodString;
399
+ usage: z.ZodString;
400
+ example: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
401
+ permission: z.ZodOptional<z.ZodEnum<{
402
+ camera: "camera";
403
+ "clipboard-read": "clipboard-read";
404
+ "clipboard-write": "clipboard-write";
405
+ geolocation: "geolocation";
406
+ microphone: "microphone";
407
+ notifications: "notifications";
408
+ "persistent-storage": "persistent-storage";
409
+ midi: "midi";
410
+ "speaker-selection": "speaker-selection";
411
+ "storage-access": "storage-access";
412
+ "background-sync": "background-sync";
413
+ accelerometer: "accelerometer";
414
+ gyroscope: "gyroscope";
415
+ magnetometer: "magnetometer";
416
+ "ambient-light-sensor": "ambient-light-sensor";
417
+ "screen-wake-lock": "screen-wake-lock";
418
+ }>>;
419
+ gotchas: z.ZodOptional<z.ZodString>;
420
+ required: z.ZodOptional<z.ZodBoolean>;
421
+ hook: z.ZodString;
422
+ }, z.core.$strict>, z.ZodObject<{
423
+ description: z.ZodString;
424
+ usage: z.ZodString;
425
+ example: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
426
+ permission: z.ZodOptional<z.ZodEnum<{
427
+ camera: "camera";
428
+ "clipboard-read": "clipboard-read";
429
+ "clipboard-write": "clipboard-write";
430
+ geolocation: "geolocation";
431
+ microphone: "microphone";
432
+ notifications: "notifications";
433
+ "persistent-storage": "persistent-storage";
434
+ midi: "midi";
435
+ "speaker-selection": "speaker-selection";
436
+ "storage-access": "storage-access";
437
+ "background-sync": "background-sync";
438
+ accelerometer: "accelerometer";
439
+ gyroscope: "gyroscope";
440
+ magnetometer: "magnetometer";
441
+ "ambient-light-sensor": "ambient-light-sensor";
442
+ "screen-wake-lock": "screen-wake-lock";
443
+ }>>;
444
+ gotchas: z.ZodOptional<z.ZodString>;
445
+ required: z.ZodOptional<z.ZodBoolean>;
446
+ component: z.ZodString;
447
+ }, z.core.$strict>]>;
448
+ /**
449
+ * {@link GadgetDescriptor} — a gadget PACKAGE: identity + transport
450
+ * metadata + an `exports` array (≥1). Permissive shape: per-export
451
+ * teaching text is optional so contract authoring stays cheap.
452
+ * Registry-side registration uses the stricter
453
+ * {@link strictGadgetDescriptorSchema}.
454
+ */
455
+ export declare const gadgetDescriptorSchema: z.ZodObject<{
456
+ exports: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
457
+ description: z.ZodOptional<z.ZodString>;
458
+ usage: z.ZodOptional<z.ZodString>;
459
+ example: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
460
+ permission: z.ZodOptional<z.ZodString>;
461
+ gotchas: z.ZodOptional<z.ZodString>;
462
+ required: z.ZodOptional<z.ZodBoolean>;
463
+ hook: z.ZodString;
464
+ }, z.core.$strict>, z.ZodObject<{
465
+ description: z.ZodOptional<z.ZodString>;
466
+ usage: z.ZodOptional<z.ZodString>;
467
+ example: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
468
+ permission: z.ZodOptional<z.ZodString>;
469
+ gotchas: z.ZodOptional<z.ZodString>;
470
+ required: z.ZodOptional<z.ZodBoolean>;
471
+ component: z.ZodString;
472
+ }, z.core.$strict>]>>;
473
+ version: z.ZodString;
474
+ package: z.ZodString;
475
+ bundleUrl: z.ZodOptional<z.ZodURL>;
476
+ bundleHost: z.ZodOptional<z.ZodString>;
477
+ bundleSri: z.ZodOptional<z.ZodString>;
478
+ styleUrl: z.ZodOptional<z.ZodURL>;
479
+ connect: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodURL>>>;
480
+ requires: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
481
+ typesUrl: z.ZodOptional<z.ZodURL>;
482
+ typesSri: z.ZodOptional<z.ZodString>;
483
+ }, z.core.$strict>;
484
+ /**
485
+ * Registry-side {@link GadgetDescriptor} validator. Stricter than the
486
+ * wire schema: every export's `description` / `usage` / `example` is
487
+ * REQUIRED and `permission` is enum-tight — via
488
+ * {@link strictGadgetExportSchema} as the `exports` element schema.
489
+ *
490
+ * Used by:
491
+ * - `createGguiGadget` SDK factory (validates wrapper specs).
492
+ * - `App.gadgets` registration handlers (ggui.json seed,
493
+ * ops_register_gadget, etc.).
494
+ *
495
+ * Same TS interface as the wire schema — the strictness lives in zod
496
+ * refinements, not the type system.
497
+ */
498
+ export declare const strictGadgetDescriptorSchema: z.ZodObject<{
499
+ exports: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
500
+ description: z.ZodString;
501
+ usage: z.ZodString;
502
+ example: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
503
+ permission: z.ZodOptional<z.ZodEnum<{
504
+ camera: "camera";
505
+ "clipboard-read": "clipboard-read";
506
+ "clipboard-write": "clipboard-write";
507
+ geolocation: "geolocation";
508
+ microphone: "microphone";
509
+ notifications: "notifications";
510
+ "persistent-storage": "persistent-storage";
511
+ midi: "midi";
512
+ "speaker-selection": "speaker-selection";
513
+ "storage-access": "storage-access";
514
+ "background-sync": "background-sync";
515
+ accelerometer: "accelerometer";
516
+ gyroscope: "gyroscope";
517
+ magnetometer: "magnetometer";
518
+ "ambient-light-sensor": "ambient-light-sensor";
519
+ "screen-wake-lock": "screen-wake-lock";
520
+ }>>;
521
+ gotchas: z.ZodOptional<z.ZodString>;
522
+ required: z.ZodOptional<z.ZodBoolean>;
523
+ hook: z.ZodString;
524
+ }, z.core.$strict>, z.ZodObject<{
525
+ description: z.ZodString;
526
+ usage: z.ZodString;
527
+ example: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
528
+ permission: z.ZodOptional<z.ZodEnum<{
529
+ camera: "camera";
530
+ "clipboard-read": "clipboard-read";
531
+ "clipboard-write": "clipboard-write";
532
+ geolocation: "geolocation";
533
+ microphone: "microphone";
534
+ notifications: "notifications";
535
+ "persistent-storage": "persistent-storage";
536
+ midi: "midi";
537
+ "speaker-selection": "speaker-selection";
538
+ "storage-access": "storage-access";
539
+ "background-sync": "background-sync";
540
+ accelerometer: "accelerometer";
541
+ gyroscope: "gyroscope";
542
+ magnetometer: "magnetometer";
543
+ "ambient-light-sensor": "ambient-light-sensor";
544
+ "screen-wake-lock": "screen-wake-lock";
545
+ }>>;
546
+ gotchas: z.ZodOptional<z.ZodString>;
547
+ required: z.ZodOptional<z.ZodBoolean>;
548
+ component: z.ZodString;
549
+ }, z.core.$strict>]>>;
550
+ version: z.ZodString;
551
+ package: z.ZodString;
552
+ bundleUrl: z.ZodOptional<z.ZodURL>;
553
+ bundleHost: z.ZodOptional<z.ZodString>;
554
+ bundleSri: z.ZodOptional<z.ZodString>;
555
+ styleUrl: z.ZodOptional<z.ZodURL>;
556
+ connect: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodURL>>>;
557
+ requires: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
558
+ typesUrl: z.ZodOptional<z.ZodURL>;
559
+ typesSri: z.ZodOptional<z.ZodString>;
560
+ }, z.core.$strict>;
561
+ /**
562
+ * Registration-ready descriptor validator.
563
+ * {@link strictGadgetDescriptorSchema} plus the refinement that
564
+ * every non-stdlib package MUST carry a `typesUrl`.
565
+ *
566
+ * Two boundaries, two schemas:
567
+ *
568
+ * - `strictGadgetDescriptorSchema` — **author time**. The
569
+ * `createGguiGadget` SDK factory validates a wrapper spec at
570
+ * module load, BEFORE the build emits a `.d.ts` — `typesUrl`
571
+ * doesn't exist yet, so it can't be required here.
572
+ * - `registeredGadgetDescriptorSchema` — **registration time**.
573
+ * The build helper (`writeDescriptorJson`) and the `App.gadgets`
574
+ * registration handlers validate here, AFTER the build has
575
+ * emitted the `.d.ts`, computed its SRI, and stamped
576
+ * `typesUrl` + `typesSri` on the descriptor.
577
+ *
578
+ * The code-gen sandbox loads the `.d.ts` the URL points at to
579
+ * typecheck generated component code against the package's real
580
+ * export signatures. Stdlib (`@ggui-ai/gadgets`) is exempt — the
581
+ * sandbox loads its types directly. No permissive fallback:
582
+ * pre-launch posture forces strict typing across the board.
583
+ */
584
+ export declare const registeredGadgetDescriptorSchema: z.ZodObject<{
585
+ exports: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
586
+ description: z.ZodString;
587
+ usage: z.ZodString;
588
+ example: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
589
+ permission: z.ZodOptional<z.ZodEnum<{
590
+ camera: "camera";
591
+ "clipboard-read": "clipboard-read";
592
+ "clipboard-write": "clipboard-write";
593
+ geolocation: "geolocation";
594
+ microphone: "microphone";
595
+ notifications: "notifications";
596
+ "persistent-storage": "persistent-storage";
597
+ midi: "midi";
598
+ "speaker-selection": "speaker-selection";
599
+ "storage-access": "storage-access";
600
+ "background-sync": "background-sync";
601
+ accelerometer: "accelerometer";
602
+ gyroscope: "gyroscope";
603
+ magnetometer: "magnetometer";
604
+ "ambient-light-sensor": "ambient-light-sensor";
605
+ "screen-wake-lock": "screen-wake-lock";
606
+ }>>;
607
+ gotchas: z.ZodOptional<z.ZodString>;
608
+ required: z.ZodOptional<z.ZodBoolean>;
609
+ hook: z.ZodString;
610
+ }, z.core.$strict>, z.ZodObject<{
611
+ description: z.ZodString;
612
+ usage: z.ZodString;
613
+ example: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
614
+ permission: z.ZodOptional<z.ZodEnum<{
615
+ camera: "camera";
616
+ "clipboard-read": "clipboard-read";
617
+ "clipboard-write": "clipboard-write";
618
+ geolocation: "geolocation";
619
+ microphone: "microphone";
620
+ notifications: "notifications";
621
+ "persistent-storage": "persistent-storage";
622
+ midi: "midi";
623
+ "speaker-selection": "speaker-selection";
624
+ "storage-access": "storage-access";
625
+ "background-sync": "background-sync";
626
+ accelerometer: "accelerometer";
627
+ gyroscope: "gyroscope";
628
+ magnetometer: "magnetometer";
629
+ "ambient-light-sensor": "ambient-light-sensor";
630
+ "screen-wake-lock": "screen-wake-lock";
631
+ }>>;
632
+ gotchas: z.ZodOptional<z.ZodString>;
633
+ required: z.ZodOptional<z.ZodBoolean>;
634
+ component: z.ZodString;
635
+ }, z.core.$strict>]>>;
636
+ version: z.ZodString;
637
+ package: z.ZodString;
638
+ bundleUrl: z.ZodOptional<z.ZodURL>;
639
+ bundleHost: z.ZodOptional<z.ZodString>;
640
+ bundleSri: z.ZodOptional<z.ZodString>;
641
+ styleUrl: z.ZodOptional<z.ZodURL>;
642
+ connect: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodURL>>>;
643
+ requires: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
644
+ typesUrl: z.ZodOptional<z.ZodURL>;
645
+ typesSri: z.ZodOptional<z.ZodString>;
646
+ }, z.core.$strict>;
647
+ /**
648
+ * Wire-side per-export USE entry on `clientCapabilities.gadgets`.
649
+ *
650
+ * The export NAME is the map key (see {@link gadgetPackageUseSchema});
651
+ * its grammar discriminates kind — a `use`-prefixed key is a hook, a
652
+ * PascalCase key is a component. Kind is therefore never a field.
653
+ *
654
+ * The only wire-authored payload is optional intent-specific prose:
655
+ *
656
+ * - `description?` / `usage?` — when present the agent's prose wins
657
+ * over the registered export's text; when omitted, push-time
658
+ * resolution inherits the registered text verbatim.
659
+ *
660
+ * Everything else — `version`, transport metadata, `permission`,
661
+ * `example`, `gotchas` — is registry-side and resolves from the
662
+ * `App.gadgets` catalog. `.strict()` so a hallucinated registry field
663
+ * fails loudly instead of being silently dropped.
664
+ */
665
+ export declare const gadgetExportUseSchema: z.ZodObject<{
666
+ description: z.ZodOptional<z.ZodString>;
667
+ usage: z.ZodOptional<z.ZodString>;
668
+ }, z.core.$strict>;
669
+ /**
670
+ * Wire-side per-PACKAGE gadget use — the value type of
671
+ * `clientCapabilities.gadgets` (which is keyed by npm package name).
672
+ *
673
+ * A map of export name → {@link gadgetExportUseSchema}; at least one
674
+ * entry. The export name key is a `use`-prefixed hook
675
+ * ({@link HOOK_NAME_RE}) or a PascalCase component
676
+ * ({@link COMPONENT_NAME_RE}). The wire carries identity only —
677
+ * `(package, export name)` — never `version` or transport metadata;
678
+ * there is no package-level wire field, so the package entry IS its
679
+ * export map (no `exports` wrapper).
680
+ */
681
+ export declare const gadgetPackageUseSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
682
+ description: z.ZodOptional<z.ZodString>;
683
+ usage: z.ZodOptional<z.ZodString>;
684
+ }, z.core.$strict>>;
685
+ /**
686
+ * {@link ClientCapabilitiesSpec} — wrapper over the package-keyed
687
+ * gadget map.
688
+ *
689
+ * `gadgets` is keyed by npm PACKAGE name; each value is a
690
+ * {@link gadgetPackageUseSchema} listing the exports of that package
691
+ * the UI uses. The wire carries identity only — `(package, export
692
+ * name)` — never `version` or transport metadata: the ggui server
693
+ * resolves the full {@link GadgetDescriptor} from the `App.gadgets`
694
+ * catalog at push time onto the `SessionStackEntry.gadgetDescriptors`
695
+ * sidecar.
696
+ *
697
+ * `.strict()` (not `.passthrough()`): the retired `libraries` field
698
+ * (renamed to `gadgets`) and any other stale sibling field MUST fail
699
+ * loudly at parse time.
700
+ */
701
+ export declare const clientCapabilitiesSpecSchema: z.ZodObject<{
702
+ gadgets: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
703
+ description: z.ZodOptional<z.ZodString>;
704
+ usage: z.ZodOptional<z.ZodString>;
705
+ }, z.core.$strict>>>;
706
+ }, z.core.$strict>;
707
+ /**
708
+ * Zod schema for `App.publicEnv`.
709
+ *
710
+ * Flat `Record<string, string>` with key-regex enforcement
711
+ * ({@link PUBLIC_ENV_APP_KEY_RE}). Empty-string values are allowed
712
+ * (operator may want "intentionally absent" without dropping the key).
713
+ *
714
+ * Consumed by:
715
+ * - OSS `ggui.json#app.publicEnv` boot-time parse.
716
+ * - Cloud AppRecord persistence layer.
717
+ * - Defensive re-validation in `parseBootstrap` (iframe-runtime).
718
+ */
719
+ export declare const appPublicEnvSchema: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
720
+ /**
721
+ * {@link DataContract} — the unified four-spec contract surface
722
+ * agents author on `story.contract` and that the generator
723
+ * constrains the LLM to honor.
724
+ *
725
+ * Fields per the TS interface: `propsSpec` / `actionSpec` / `streamSpec` /
726
+ * `contextSpec` (the four typed surfaces), `agentCapabilities` (MCP
727
+ * tool catalog) + `clientCapabilities` (browser-capability hook
728
+ * catalog). All fields are optional — agents declare only what their UI
729
+ * uses. `intent` is NOT a contract field; internal consumers (prompt
730
+ * rendering, contract hash, cache scope) receive intent from the outer
731
+ * pipeline (the flat `intent` field on `ggui_handshake`, the operator
732
+ * prompt for harness benchmarks).
733
+ *
734
+ * No `interaction` mode field — the four specs describe the wire
735
+ * surface exhaustively, so a categorical mode label would be
736
+ * redundant. `passthrough()` below tolerates legacy payloads that
737
+ * still carry it — the field is silently dropped on round-trip.
738
+ *
739
+ * No `broadcast` field — channel data sources are declared per-channel
740
+ * via `streamSpec[ch].source` (flat `{tool, args?}` shape; transport
741
+ * auto-negotiated at runtime by `@ggui-ai/wire`).
742
+ *
743
+ * `passthrough()` lets unknown fields ride through without rejection
744
+ * — forward-compatible with future protocol additions, and matches
745
+ * the protocol's general "input-shape lax / validator-shape strict"
746
+ * posture (`handshakeInputSchema`, `pushInputSchema`, etc. all
747
+ * `passthrough` for the same reason).
748
+ */
749
+ export declare const dataContractSchema: z.ZodType<DataContract>;
750
+ //# sourceMappingURL=data-contract.d.ts.map