@revealui/contracts 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +160 -0
  3. package/dist/a2a/index.d.ts +383 -0
  4. package/dist/a2a/index.d.ts.map +1 -0
  5. package/dist/a2a/index.js +276 -0
  6. package/dist/a2a/index.js.map +1 -0
  7. package/dist/actions/action-validator.d.ts +48 -0
  8. package/dist/actions/action-validator.d.ts.map +1 -0
  9. package/dist/actions/action-validator.js +288 -0
  10. package/dist/actions/action-validator.js.map +1 -0
  11. package/dist/actions/index.d.ts +7 -0
  12. package/dist/actions/index.d.ts.map +1 -0
  13. package/dist/actions/index.js +7 -0
  14. package/dist/actions/index.js.map +1 -0
  15. package/dist/agents/index.d.ts +628 -0
  16. package/dist/agents/index.d.ts.map +1 -0
  17. package/dist/agents/index.js +511 -0
  18. package/dist/agents/index.js.map +1 -0
  19. package/dist/agents/types.d.ts +22 -0
  20. package/dist/agents/types.d.ts.map +1 -0
  21. package/dist/agents/types.js +2 -0
  22. package/dist/agents/types.js.map +1 -0
  23. package/dist/api/auth.d.ts +60 -0
  24. package/dist/api/auth.d.ts.map +1 -0
  25. package/dist/api/auth.js +84 -0
  26. package/dist/api/auth.js.map +1 -0
  27. package/dist/api/chat.d.ts +45 -0
  28. package/dist/api/chat.d.ts.map +1 -0
  29. package/dist/api/chat.js +55 -0
  30. package/dist/api/chat.js.map +1 -0
  31. package/dist/api/gdpr.d.ts +39 -0
  32. package/dist/api/gdpr.d.ts.map +1 -0
  33. package/dist/api/gdpr.js +53 -0
  34. package/dist/api/gdpr.js.map +1 -0
  35. package/dist/cms/collection.d.ts +108 -0
  36. package/dist/cms/collection.d.ts.map +1 -0
  37. package/dist/cms/collection.js +144 -0
  38. package/dist/cms/collection.js.map +1 -0
  39. package/dist/cms/compat.d.ts +128 -0
  40. package/dist/cms/compat.d.ts.map +1 -0
  41. package/dist/cms/compat.js +141 -0
  42. package/dist/cms/compat.js.map +1 -0
  43. package/dist/cms/config-contract.d.ts +278 -0
  44. package/dist/cms/config-contract.d.ts.map +1 -0
  45. package/dist/cms/config-contract.js +220 -0
  46. package/dist/cms/config-contract.js.map +1 -0
  47. package/dist/cms/config.d.ts +351 -0
  48. package/dist/cms/config.d.ts.map +1 -0
  49. package/dist/cms/config.js +50 -0
  50. package/dist/cms/config.js.map +1 -0
  51. package/dist/cms/errors.d.ts +122 -0
  52. package/dist/cms/errors.d.ts.map +1 -0
  53. package/dist/cms/errors.js +163 -0
  54. package/dist/cms/errors.js.map +1 -0
  55. package/dist/cms/extensibility.d.ts +211 -0
  56. package/dist/cms/extensibility.d.ts.map +1 -0
  57. package/dist/cms/extensibility.js +313 -0
  58. package/dist/cms/extensibility.js.map +1 -0
  59. package/dist/cms/field.d.ts +69 -0
  60. package/dist/cms/field.d.ts.map +1 -0
  61. package/dist/cms/field.js +94 -0
  62. package/dist/cms/field.js.map +1 -0
  63. package/dist/cms/functions.d.ts +466 -0
  64. package/dist/cms/functions.d.ts.map +1 -0
  65. package/dist/cms/functions.js +19 -0
  66. package/dist/cms/functions.js.map +1 -0
  67. package/dist/cms/global.d.ts +45 -0
  68. package/dist/cms/global.d.ts.map +1 -0
  69. package/dist/cms/global.js +62 -0
  70. package/dist/cms/global.js.map +1 -0
  71. package/dist/cms/index.d.ts +23 -0
  72. package/dist/cms/index.d.ts.map +1 -0
  73. package/dist/cms/index.js +42 -0
  74. package/dist/cms/index.js.map +1 -0
  75. package/dist/cms/structure.d.ts +1601 -0
  76. package/dist/cms/structure.d.ts.map +1 -0
  77. package/dist/cms/structure.js +757 -0
  78. package/dist/cms/structure.js.map +1 -0
  79. package/dist/content/index.d.ts +1542 -0
  80. package/dist/content/index.d.ts.map +1 -0
  81. package/dist/content/index.js +522 -0
  82. package/dist/content/index.js.map +1 -0
  83. package/dist/database/bridge.d.ts +177 -0
  84. package/dist/database/bridge.d.ts.map +1 -0
  85. package/dist/database/bridge.js +139 -0
  86. package/dist/database/bridge.js.map +1 -0
  87. package/dist/database/index.d.ts +8 -0
  88. package/dist/database/index.d.ts.map +1 -0
  89. package/dist/database/index.js +9 -0
  90. package/dist/database/index.js.map +1 -0
  91. package/dist/database/type-bridge.d.ts +178 -0
  92. package/dist/database/type-bridge.d.ts.map +1 -0
  93. package/dist/database/type-bridge.js +154 -0
  94. package/dist/database/type-bridge.js.map +1 -0
  95. package/dist/entities/agent-context.d.ts +280 -0
  96. package/dist/entities/agent-context.d.ts.map +1 -0
  97. package/dist/entities/agent-context.js +390 -0
  98. package/dist/entities/agent-context.js.map +1 -0
  99. package/dist/entities/agent-memory.d.ts +661 -0
  100. package/dist/entities/agent-memory.d.ts.map +1 -0
  101. package/dist/entities/agent-memory.js +544 -0
  102. package/dist/entities/agent-memory.js.map +1 -0
  103. package/dist/entities/board.d.ts +95 -0
  104. package/dist/entities/board.d.ts.map +1 -0
  105. package/dist/entities/board.js +99 -0
  106. package/dist/entities/board.js.map +1 -0
  107. package/dist/entities/code-provenance.d.ts +270 -0
  108. package/dist/entities/code-provenance.d.ts.map +1 -0
  109. package/dist/entities/code-provenance.js +339 -0
  110. package/dist/entities/code-provenance.js.map +1 -0
  111. package/dist/entities/index.d.ts +22 -0
  112. package/dist/entities/index.d.ts.map +1 -0
  113. package/dist/entities/index.js +22 -0
  114. package/dist/entities/index.js.map +1 -0
  115. package/dist/entities/media.d.ts +485 -0
  116. package/dist/entities/media.d.ts.map +1 -0
  117. package/dist/entities/media.js +606 -0
  118. package/dist/entities/media.js.map +1 -0
  119. package/dist/entities/page-revision.d.ts +390 -0
  120. package/dist/entities/page-revision.d.ts.map +1 -0
  121. package/dist/entities/page-revision.js +406 -0
  122. package/dist/entities/page-revision.js.map +1 -0
  123. package/dist/entities/page.d.ts +2349 -0
  124. package/dist/entities/page.d.ts.map +1 -0
  125. package/dist/entities/page.js +377 -0
  126. package/dist/entities/page.js.map +1 -0
  127. package/dist/entities/post.d.ts +619 -0
  128. package/dist/entities/post.d.ts.map +1 -0
  129. package/dist/entities/post.js +555 -0
  130. package/dist/entities/post.js.map +1 -0
  131. package/dist/entities/price.d.ts +772 -0
  132. package/dist/entities/price.d.ts.map +1 -0
  133. package/dist/entities/price.js +308 -0
  134. package/dist/entities/price.js.map +1 -0
  135. package/dist/entities/product.d.ts +753 -0
  136. package/dist/entities/product.d.ts.map +1 -0
  137. package/dist/entities/product.js +307 -0
  138. package/dist/entities/product.js.map +1 -0
  139. package/dist/entities/session.d.ts +222 -0
  140. package/dist/entities/session.d.ts.map +1 -0
  141. package/dist/entities/session.js +253 -0
  142. package/dist/entities/session.js.map +1 -0
  143. package/dist/entities/site.d.ts +387 -0
  144. package/dist/entities/site.d.ts.map +1 -0
  145. package/dist/entities/site.js +348 -0
  146. package/dist/entities/site.js.map +1 -0
  147. package/dist/entities/ticket-comment.d.ts +49 -0
  148. package/dist/entities/ticket-comment.d.ts.map +1 -0
  149. package/dist/entities/ticket-comment.js +58 -0
  150. package/dist/entities/ticket-comment.js.map +1 -0
  151. package/dist/entities/ticket-label.d.ts +64 -0
  152. package/dist/entities/ticket-label.d.ts.map +1 -0
  153. package/dist/entities/ticket-label.js +77 -0
  154. package/dist/entities/ticket-label.js.map +1 -0
  155. package/dist/entities/ticket.d.ts +204 -0
  156. package/dist/entities/ticket.d.ts.map +1 -0
  157. package/dist/entities/ticket.js +205 -0
  158. package/dist/entities/ticket.js.map +1 -0
  159. package/dist/entities/user.d.ts +336 -0
  160. package/dist/entities/user.d.ts.map +1 -0
  161. package/dist/entities/user.js +255 -0
  162. package/dist/entities/user.js.map +1 -0
  163. package/dist/foundation/contract.d.ts +221 -0
  164. package/dist/foundation/contract.d.ts.map +1 -0
  165. package/dist/foundation/contract.js +133 -0
  166. package/dist/foundation/contract.js.map +1 -0
  167. package/dist/foundation/index.d.ts +7 -0
  168. package/dist/foundation/index.d.ts.map +1 -0
  169. package/dist/foundation/index.js +7 -0
  170. package/dist/foundation/index.js.map +1 -0
  171. package/dist/generated/contracts.d.ts +1514 -0
  172. package/dist/generated/contracts.d.ts.map +1 -0
  173. package/dist/generated/contracts.js +959 -0
  174. package/dist/generated/contracts.js.map +1 -0
  175. package/dist/generated/database.d.ts +48 -0
  176. package/dist/generated/database.d.ts.map +1 -0
  177. package/dist/generated/database.js +17 -0
  178. package/dist/generated/database.js.map +1 -0
  179. package/dist/generated/zod-schemas.d.ts +14793 -0
  180. package/dist/generated/zod-schemas.d.ts.map +1 -0
  181. package/dist/generated/zod-schemas.js +547 -0
  182. package/dist/generated/zod-schemas.js.map +1 -0
  183. package/dist/index.d.ts +50 -0
  184. package/dist/index.d.ts.map +1 -0
  185. package/dist/index.js +81 -0
  186. package/dist/index.js.map +1 -0
  187. package/dist/representation/index.d.ts +304 -0
  188. package/dist/representation/index.d.ts.map +1 -0
  189. package/dist/representation/index.js +280 -0
  190. package/dist/representation/index.js.map +1 -0
  191. package/package.json +117 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 RevealUI Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,160 @@
1
+ # @revealui/contracts
2
+
3
+ Unified contracts package for RevealUI - schemas, validation, and type safety across the stack.
4
+
5
+ ## Overview
6
+
7
+ This package provides a unified contract system that combines:
8
+ - **Runtime validation** using Zod schemas
9
+ - **TypeScript types** derived from schemas
10
+ - **Dual representation** (human/agent) for entities
11
+ - **Database contract bridges** for type-safe DB operations
12
+ - **Action validation** against entity constraints
13
+
14
+ ## Package Exports
15
+
16
+ ```typescript
17
+ // Everything
18
+ import { ... } from '@revealui/contracts'
19
+
20
+ // Foundation (Contract<T> system)
21
+ import { Contract, createContract } from '@revealui/contracts/foundation'
22
+
23
+ // Representation (dual entity system)
24
+ import { DualEntitySchema, createEmbedding } from '@revealui/contracts/representation'
25
+
26
+ // Entities (User, Site, Page)
27
+ import { UserContract, PageContract, SiteContract } from '@revealui/contracts/entities'
28
+
29
+ // Content (blocks)
30
+ import { BlockSchema, createTextBlock } from '@revealui/contracts/content'
31
+
32
+ // CMS (configuration contracts)
33
+ import { ConfigContract, CollectionContract } from '@revealui/contracts/cms'
34
+
35
+ // Agents (memory, context, conversations)
36
+ import { AgentMemorySchema, AgentContextSchema } from '@revealui/contracts/agents'
37
+
38
+ // Database (DB ↔ Contract bridges)
39
+ import { dbRowToContract, contractToDbInsert } from '@revealui/contracts/database'
40
+
41
+ // Actions (action validation)
42
+ import { validateAction, checkConstraints } from '@revealui/contracts/actions'
43
+ ```
44
+
45
+ ## Quick Start
46
+
47
+ ### Validation
48
+
49
+ ```typescript
50
+ import { PageSchema } from '@revealui/contracts'
51
+
52
+ // Validate incoming data
53
+ const page = PageSchema.parse(rawData) // Throws on error
54
+
55
+ // Or use safe parse
56
+ const result = PageSchema.safeParse(rawData)
57
+ if (result.success) {
58
+ // result.data is typed as Page
59
+ }
60
+ ```
61
+
62
+ ### Creating Entities
63
+
64
+ ```typescript
65
+ import { createPage, createTextBlock } from '@revealui/contracts'
66
+
67
+ const page = createPage('page-123', {
68
+ siteId: 'site-456',
69
+ title: 'Hello World',
70
+ slug: 'hello-world'
71
+ })
72
+
73
+ const block = createTextBlock('block-1', '# Hello\n\nWelcome!')
74
+ ```
75
+
76
+ ### Database Integration
77
+
78
+ ```typescript
79
+ import { UserSchema } from '@revealui/contracts/entities'
80
+ import { dbRowToContract } from '@revealui/contracts/database'
81
+
82
+ // Load from DB with validation
83
+ const dbRow = await db.query.users.findFirst()
84
+ const validatedUser = dbRowToContract(UserSchema, dbRow)
85
+ ```
86
+
87
+ ### Action Validation
88
+
89
+ ```typescript
90
+ import { validateAction } from '@revealui/contracts/actions'
91
+
92
+ const result = validateAction({
93
+ entity: page,
94
+ action: 'update',
95
+ agent: agentDefinition,
96
+ changes: { title: 'New Title' },
97
+ permissions: userPermissions
98
+ })
99
+
100
+ if (!result.success) {
101
+ throw new Error(result.errors.map(e => e.message).join(', '))
102
+ }
103
+ ```
104
+
105
+ ### CMS Configuration
106
+
107
+ ```typescript
108
+ import { ConfigContract, validateConfigStructure } from '@revealui/contracts/cms'
109
+
110
+ const result = validateConfigStructure(userConfig)
111
+ if (result.success) {
112
+ // result.data is fully typed and validated
113
+ }
114
+ ```
115
+
116
+ ## Architecture
117
+
118
+ This package follows a unified contract system:
119
+
120
+ 1. **Foundation** - Core `Contract<T>` interface
121
+ 2. **Representation** - Dual representation (human/agent)
122
+ 3. **Entities** - Domain entities (User, Site, Page)
123
+ 4. **Content** - Content blocks
124
+ 5. **CMS** - CMS configuration contracts
125
+ 6. **Agents** - Agent memory/context contracts
126
+ 7. **Database** - DB ↔ Contract bridges
127
+ 8. **Actions** - Action validation layer
128
+
129
+ ## Migration from @revealui/schema (Complete ✅)
130
+
131
+ The migration from `@revealui/schema` to `@revealui/contracts` is **complete**. All internal packages now use `@revealui/contracts`.
132
+
133
+ If you're updating external code that still uses `@revealui/schema`, update imports:
134
+
135
+ ```typescript
136
+ // Before (schema package - DELETED)
137
+ import { PageSchema } from '@revealui/schema'
138
+ import { ConfigContract } from '@revealui/schema/core/contracts'
139
+
140
+ // After (contracts package)
141
+ import { PageSchema } from '@revealui/contracts'
142
+ import { ConfigContract } from '@revealui/contracts/cms'
143
+ ```
144
+
145
+ ## Development
146
+
147
+ ```bash
148
+ # Type check
149
+ pnpm typecheck
150
+
151
+ # Run tests
152
+ pnpm test
153
+
154
+ # Build
155
+ pnpm build
156
+ ```
157
+
158
+ ## License
159
+
160
+ MIT
@@ -0,0 +1,383 @@
1
+ /**
2
+ * A2A (Agent-to-Agent) Protocol Contracts
3
+ *
4
+ * Implements the Google A2A specification as Zod schemas, bound to RevealUI's
5
+ * existing AgentDefinition and ToolDefinition contracts. This enables RevealUI
6
+ * agents to interoperate with any A2A-compatible orchestrator (LangGraph,
7
+ * Google ADK, Vertex AI, etc.).
8
+ *
9
+ * Spec: https://google.github.io/A2A
10
+ *
11
+ * Binding:
12
+ * AgentDefinition → A2AAgentCard
13
+ * ToolDefinition → A2ASkill
14
+ */
15
+ import { z } from 'zod/v4';
16
+ import type { AgentDefinition, ToolDefinition } from '../agents/index.js';
17
+ /**
18
+ * A skill exposed by an A2A agent (maps from ToolDefinition)
19
+ */
20
+ export declare const A2ASkillSchema: z.ZodObject<{
21
+ id: z.ZodString;
22
+ name: z.ZodString;
23
+ description: z.ZodString;
24
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
+ examples: z.ZodOptional<z.ZodArray<z.ZodString>>;
26
+ inputModes: z.ZodDefault<z.ZodArray<z.ZodString>>;
27
+ outputModes: z.ZodDefault<z.ZodArray<z.ZodString>>;
28
+ }, z.core.$strip>;
29
+ export type A2ASkill = z.infer<typeof A2ASkillSchema>;
30
+ /**
31
+ * Agent capabilities flags
32
+ */
33
+ export declare const A2ACapabilitiesSchema: z.ZodObject<{
34
+ streaming: z.ZodDefault<z.ZodBoolean>;
35
+ pushNotifications: z.ZodDefault<z.ZodBoolean>;
36
+ stateTransitionHistory: z.ZodDefault<z.ZodBoolean>;
37
+ }, z.core.$strip>;
38
+ export type A2ACapabilities = z.infer<typeof A2ACapabilitiesSchema>;
39
+ /**
40
+ * Provider information
41
+ */
42
+ export declare const A2AProviderSchema: z.ZodObject<{
43
+ organization: z.ZodString;
44
+ url: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$strip>;
46
+ export type A2AProvider = z.infer<typeof A2AProviderSchema>;
47
+ /**
48
+ * Authentication configuration
49
+ */
50
+ export declare const A2AAuthSchema: z.ZodObject<{
51
+ schemes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
52
+ Bearer: "Bearer";
53
+ ApiKey: "ApiKey";
54
+ OAuth2: "OAuth2";
55
+ None: "None";
56
+ }>>>;
57
+ credentials: z.ZodDefault<z.ZodNullable<z.ZodString>>;
58
+ }, z.core.$strip>;
59
+ export type A2AAuth = z.infer<typeof A2AAuthSchema>;
60
+ /**
61
+ * A2A Agent Card — the full discovery document.
62
+ * Served at /.well-known/agent.json (platform) or
63
+ * /.well-known/agents/:id/agent.json (per-agent).
64
+ */
65
+ export declare const A2AAgentCardSchema: z.ZodObject<{
66
+ name: z.ZodString;
67
+ description: z.ZodString;
68
+ url: z.ZodString;
69
+ documentationUrl: z.ZodOptional<z.ZodString>;
70
+ provider: z.ZodOptional<z.ZodObject<{
71
+ organization: z.ZodString;
72
+ url: z.ZodOptional<z.ZodString>;
73
+ }, z.core.$strip>>;
74
+ version: z.ZodDefault<z.ZodString>;
75
+ capabilities: z.ZodObject<{
76
+ streaming: z.ZodDefault<z.ZodBoolean>;
77
+ pushNotifications: z.ZodDefault<z.ZodBoolean>;
78
+ stateTransitionHistory: z.ZodDefault<z.ZodBoolean>;
79
+ }, z.core.$strip>;
80
+ authentication: z.ZodObject<{
81
+ schemes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
82
+ Bearer: "Bearer";
83
+ ApiKey: "ApiKey";
84
+ OAuth2: "OAuth2";
85
+ None: "None";
86
+ }>>>;
87
+ credentials: z.ZodDefault<z.ZodNullable<z.ZodString>>;
88
+ }, z.core.$strip>;
89
+ defaultInputModes: z.ZodDefault<z.ZodArray<z.ZodString>>;
90
+ defaultOutputModes: z.ZodDefault<z.ZodArray<z.ZodString>>;
91
+ skills: z.ZodArray<z.ZodObject<{
92
+ id: z.ZodString;
93
+ name: z.ZodString;
94
+ description: z.ZodString;
95
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
96
+ examples: z.ZodOptional<z.ZodArray<z.ZodString>>;
97
+ inputModes: z.ZodDefault<z.ZodArray<z.ZodString>>;
98
+ outputModes: z.ZodDefault<z.ZodArray<z.ZodString>>;
99
+ }, z.core.$strip>>;
100
+ }, z.core.$strip>;
101
+ export type A2AAgentCard = z.infer<typeof A2AAgentCardSchema>;
102
+ /**
103
+ * Text part of a message
104
+ */
105
+ export declare const A2ATextPartSchema: z.ZodObject<{
106
+ type: z.ZodLiteral<"text">;
107
+ text: z.ZodString;
108
+ }, z.core.$strip>;
109
+ /**
110
+ * Structured data part of a message
111
+ */
112
+ export declare const A2ADataPartSchema: z.ZodObject<{
113
+ type: z.ZodLiteral<"data">;
114
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
115
+ mimeType: z.ZodOptional<z.ZodString>;
116
+ }, z.core.$strip>;
117
+ /**
118
+ * File/binary part of a message
119
+ */
120
+ export declare const A2AFilePartSchema: z.ZodObject<{
121
+ type: z.ZodLiteral<"file">;
122
+ mimeType: z.ZodString;
123
+ data: z.ZodString;
124
+ name: z.ZodOptional<z.ZodString>;
125
+ }, z.core.$strip>;
126
+ /** Discriminated union of all part types */
127
+ export declare const A2APartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
128
+ type: z.ZodLiteral<"text">;
129
+ text: z.ZodString;
130
+ }, z.core.$strip>, z.ZodObject<{
131
+ type: z.ZodLiteral<"data">;
132
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
133
+ mimeType: z.ZodOptional<z.ZodString>;
134
+ }, z.core.$strip>, z.ZodObject<{
135
+ type: z.ZodLiteral<"file">;
136
+ mimeType: z.ZodString;
137
+ data: z.ZodString;
138
+ name: z.ZodOptional<z.ZodString>;
139
+ }, z.core.$strip>], "type">;
140
+ export type A2APart = z.infer<typeof A2APartSchema>;
141
+ /**
142
+ * A single message in a task conversation
143
+ */
144
+ export declare const A2AMessageSchema: z.ZodObject<{
145
+ role: z.ZodEnum<{
146
+ agent: "agent";
147
+ user: "user";
148
+ }>;
149
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
150
+ type: z.ZodLiteral<"text">;
151
+ text: z.ZodString;
152
+ }, z.core.$strip>, z.ZodObject<{
153
+ type: z.ZodLiteral<"data">;
154
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
155
+ mimeType: z.ZodOptional<z.ZodString>;
156
+ }, z.core.$strip>, z.ZodObject<{
157
+ type: z.ZodLiteral<"file">;
158
+ mimeType: z.ZodString;
159
+ data: z.ZodString;
160
+ name: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strip>], "type">>;
162
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
163
+ }, z.core.$strip>;
164
+ export type A2AMessage = z.infer<typeof A2AMessageSchema>;
165
+ /**
166
+ * Task lifecycle states
167
+ */
168
+ export declare const A2ATaskStateSchema: z.ZodEnum<{
169
+ unknown: "unknown";
170
+ completed: "completed";
171
+ failed: "failed";
172
+ submitted: "submitted";
173
+ working: "working";
174
+ "input-required": "input-required";
175
+ canceled: "canceled";
176
+ }>;
177
+ export type A2ATaskState = z.infer<typeof A2ATaskStateSchema>;
178
+ /**
179
+ * Task status snapshot
180
+ */
181
+ export declare const A2ATaskStatusSchema: z.ZodObject<{
182
+ state: z.ZodEnum<{
183
+ unknown: "unknown";
184
+ completed: "completed";
185
+ failed: "failed";
186
+ submitted: "submitted";
187
+ working: "working";
188
+ "input-required": "input-required";
189
+ canceled: "canceled";
190
+ }>;
191
+ message: z.ZodOptional<z.ZodObject<{
192
+ role: z.ZodEnum<{
193
+ agent: "agent";
194
+ user: "user";
195
+ }>;
196
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
197
+ type: z.ZodLiteral<"text">;
198
+ text: z.ZodString;
199
+ }, z.core.$strip>, z.ZodObject<{
200
+ type: z.ZodLiteral<"data">;
201
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
202
+ mimeType: z.ZodOptional<z.ZodString>;
203
+ }, z.core.$strip>, z.ZodObject<{
204
+ type: z.ZodLiteral<"file">;
205
+ mimeType: z.ZodString;
206
+ data: z.ZodString;
207
+ name: z.ZodOptional<z.ZodString>;
208
+ }, z.core.$strip>], "type">>;
209
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
210
+ }, z.core.$strip>>;
211
+ timestamp: z.ZodString;
212
+ }, z.core.$strip>;
213
+ export type A2ATaskStatus = z.infer<typeof A2ATaskStatusSchema>;
214
+ /**
215
+ * An artifact produced by a task
216
+ */
217
+ export declare const A2AArtifactSchema: z.ZodObject<{
218
+ name: z.ZodOptional<z.ZodString>;
219
+ description: z.ZodOptional<z.ZodString>;
220
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
221
+ type: z.ZodLiteral<"text">;
222
+ text: z.ZodString;
223
+ }, z.core.$strip>, z.ZodObject<{
224
+ type: z.ZodLiteral<"data">;
225
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
226
+ mimeType: z.ZodOptional<z.ZodString>;
227
+ }, z.core.$strip>, z.ZodObject<{
228
+ type: z.ZodLiteral<"file">;
229
+ mimeType: z.ZodString;
230
+ data: z.ZodString;
231
+ name: z.ZodOptional<z.ZodString>;
232
+ }, z.core.$strip>], "type">>;
233
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
234
+ index: z.ZodDefault<z.ZodNumber>;
235
+ append: z.ZodOptional<z.ZodBoolean>;
236
+ lastChunk: z.ZodOptional<z.ZodBoolean>;
237
+ }, z.core.$strip>;
238
+ export type A2AArtifact = z.infer<typeof A2AArtifactSchema>;
239
+ /**
240
+ * A complete A2A Task entity
241
+ */
242
+ export declare const A2ATaskSchema: z.ZodObject<{
243
+ id: z.ZodString;
244
+ sessionId: z.ZodOptional<z.ZodString>;
245
+ status: z.ZodObject<{
246
+ state: z.ZodEnum<{
247
+ unknown: "unknown";
248
+ completed: "completed";
249
+ failed: "failed";
250
+ submitted: "submitted";
251
+ working: "working";
252
+ "input-required": "input-required";
253
+ canceled: "canceled";
254
+ }>;
255
+ message: z.ZodOptional<z.ZodObject<{
256
+ role: z.ZodEnum<{
257
+ agent: "agent";
258
+ user: "user";
259
+ }>;
260
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
261
+ type: z.ZodLiteral<"text">;
262
+ text: z.ZodString;
263
+ }, z.core.$strip>, z.ZodObject<{
264
+ type: z.ZodLiteral<"data">;
265
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
266
+ mimeType: z.ZodOptional<z.ZodString>;
267
+ }, z.core.$strip>, z.ZodObject<{
268
+ type: z.ZodLiteral<"file">;
269
+ mimeType: z.ZodString;
270
+ data: z.ZodString;
271
+ name: z.ZodOptional<z.ZodString>;
272
+ }, z.core.$strip>], "type">>;
273
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
274
+ }, z.core.$strip>>;
275
+ timestamp: z.ZodString;
276
+ }, z.core.$strip>;
277
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
278
+ name: z.ZodOptional<z.ZodString>;
279
+ description: z.ZodOptional<z.ZodString>;
280
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
281
+ type: z.ZodLiteral<"text">;
282
+ text: z.ZodString;
283
+ }, z.core.$strip>, z.ZodObject<{
284
+ type: z.ZodLiteral<"data">;
285
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
286
+ mimeType: z.ZodOptional<z.ZodString>;
287
+ }, z.core.$strip>, z.ZodObject<{
288
+ type: z.ZodLiteral<"file">;
289
+ mimeType: z.ZodString;
290
+ data: z.ZodString;
291
+ name: z.ZodOptional<z.ZodString>;
292
+ }, z.core.$strip>], "type">>;
293
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
294
+ index: z.ZodDefault<z.ZodNumber>;
295
+ append: z.ZodOptional<z.ZodBoolean>;
296
+ lastChunk: z.ZodOptional<z.ZodBoolean>;
297
+ }, z.core.$strip>>>;
298
+ history: z.ZodOptional<z.ZodArray<z.ZodObject<{
299
+ role: z.ZodEnum<{
300
+ agent: "agent";
301
+ user: "user";
302
+ }>;
303
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
304
+ type: z.ZodLiteral<"text">;
305
+ text: z.ZodString;
306
+ }, z.core.$strip>, z.ZodObject<{
307
+ type: z.ZodLiteral<"data">;
308
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
309
+ mimeType: z.ZodOptional<z.ZodString>;
310
+ }, z.core.$strip>, z.ZodObject<{
311
+ type: z.ZodLiteral<"file">;
312
+ mimeType: z.ZodString;
313
+ data: z.ZodString;
314
+ name: z.ZodOptional<z.ZodString>;
315
+ }, z.core.$strip>], "type">>;
316
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
317
+ }, z.core.$strip>>>;
318
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
319
+ }, z.core.$strip>;
320
+ export type A2ATask = z.infer<typeof A2ATaskSchema>;
321
+ export declare const A2AJsonRpcRequestSchema: z.ZodObject<{
322
+ jsonrpc: z.ZodLiteral<"2.0">;
323
+ id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
324
+ method: z.ZodString;
325
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
326
+ }, z.core.$strip>;
327
+ export type A2AJsonRpcRequest = z.infer<typeof A2AJsonRpcRequestSchema>;
328
+ export declare const A2AJsonRpcErrorSchema: z.ZodObject<{
329
+ code: z.ZodNumber;
330
+ message: z.ZodString;
331
+ data: z.ZodOptional<z.ZodUnknown>;
332
+ }, z.core.$strip>;
333
+ export declare const A2AJsonRpcResponseSchema: z.ZodObject<{
334
+ jsonrpc: z.ZodLiteral<"2.0">;
335
+ id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
336
+ result: z.ZodOptional<z.ZodUnknown>;
337
+ error: z.ZodOptional<z.ZodObject<{
338
+ code: z.ZodNumber;
339
+ message: z.ZodString;
340
+ data: z.ZodOptional<z.ZodUnknown>;
341
+ }, z.core.$strip>>;
342
+ }, z.core.$strip>;
343
+ export type A2AJsonRpcResponse = z.infer<typeof A2AJsonRpcResponseSchema>;
344
+ export declare const A2ASendTaskParamsSchema: z.ZodObject<{
345
+ id: z.ZodOptional<z.ZodString>;
346
+ sessionId: z.ZodOptional<z.ZodString>;
347
+ message: z.ZodObject<{
348
+ role: z.ZodEnum<{
349
+ agent: "agent";
350
+ user: "user";
351
+ }>;
352
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
353
+ type: z.ZodLiteral<"text">;
354
+ text: z.ZodString;
355
+ }, z.core.$strip>, z.ZodObject<{
356
+ type: z.ZodLiteral<"data">;
357
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
358
+ mimeType: z.ZodOptional<z.ZodString>;
359
+ }, z.core.$strip>, z.ZodObject<{
360
+ type: z.ZodLiteral<"file">;
361
+ mimeType: z.ZodString;
362
+ data: z.ZodString;
363
+ name: z.ZodOptional<z.ZodString>;
364
+ }, z.core.$strip>], "type">>;
365
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
366
+ }, z.core.$strip>;
367
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
368
+ }, z.core.$strip>;
369
+ export type A2ASendTaskParams = z.infer<typeof A2ASendTaskParamsSchema>;
370
+ /**
371
+ * Convert a RevealUI ToolDefinition to an A2A Skill.
372
+ * ToolDefinition.name → Skill.id
373
+ * ToolDefinition.examples[].description → Skill.examples
374
+ */
375
+ export declare function toolDefinitionToSkill(tool: ToolDefinition): A2ASkill;
376
+ /**
377
+ * Convert a RevealUI AgentDefinition to an A2A Agent Card.
378
+ *
379
+ * @param def - The AgentDefinition from @revealui/contracts
380
+ * @param baseUrl - The public base URL of the A2A endpoint (e.g. https://api.revealui.com)
381
+ */
382
+ export declare function agentDefinitionToCard(def: AgentDefinition, baseUrl: string): A2AAgentCard;
383
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/a2a/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAMzE;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;iBAqBzB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAErD;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;iBAShC,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;iBAMxB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAEnD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiC7B,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAM7D;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;iBAI5B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;iBAO5B,CAAA;AAEF,4CAA4C;AAC5C,eAAO,MAAM,aAAa;;;;;;;;;;;;2BAIxB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAEnD;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;iBAO3B,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;EAQ7B,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAE7D;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAI9B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;iBAQ5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkBxB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAMnD,eAAO,MAAM,uBAAuB;;;;;iBAKlC,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAEvE,eAAO,MAAM,qBAAqB;;;;iBAIhC,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;iBAKnC,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAMzE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;iBAYlC,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAMvE;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,cAAc,GAAG,QAAQ,CAapE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,CAyBzF"}