@townco/ui 0.1.0 → 0.1.6

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 (125) hide show
  1. package/dist/core/hooks/use-chat-input.d.ts +17 -17
  2. package/dist/core/hooks/use-chat-input.js +64 -55
  3. package/dist/core/hooks/use-chat-messages.d.ts +11 -11
  4. package/dist/core/hooks/use-chat-messages.js +121 -114
  5. package/dist/core/hooks/use-chat-session.d.ts +5 -5
  6. package/dist/core/hooks/use-chat-session.js +78 -80
  7. package/dist/core/hooks/use-media-query.d.ts +5 -5
  8. package/dist/core/hooks/use-media-query.js +38 -38
  9. package/dist/core/index.d.ts +1 -1
  10. package/dist/core/index.js +1 -1
  11. package/dist/core/schemas/chat.d.ts +83 -56
  12. package/dist/core/schemas/chat.js +27 -25
  13. package/dist/core/store/chat-store.d.ts +28 -22
  14. package/dist/core/store/chat-store.js +59 -50
  15. package/dist/gui/components/Button.d.ts +23 -7
  16. package/dist/gui/components/Button.js +40 -27
  17. package/dist/gui/components/Card.d.ts +26 -7
  18. package/dist/gui/components/Card.js +54 -8
  19. package/dist/gui/components/ChatHeader.d.ts +58 -31
  20. package/dist/gui/components/ChatHeader.js +171 -66
  21. package/dist/gui/components/ChatInput.d.ts +58 -36
  22. package/dist/gui/components/ChatInput.js +191 -121
  23. package/dist/gui/components/ChatInterface.d.ts +9 -6
  24. package/dist/gui/components/ChatInterface.js +162 -90
  25. package/dist/gui/components/ChatLayout.d.ts +71 -41
  26. package/dist/gui/components/ChatLayout.js +214 -87
  27. package/dist/gui/components/ChatPanelTabContent.d.ts +18 -9
  28. package/dist/gui/components/ChatPanelTabContent.js +88 -10
  29. package/dist/gui/components/ChatPreview.d.ts +9 -6
  30. package/dist/gui/components/ChatPreview.js +212 -162
  31. package/dist/gui/components/ChatSecondaryPanel.d.ts +14 -11
  32. package/dist/gui/components/ChatSecondaryPanel.js +115 -38
  33. package/dist/gui/components/ChatSidebar.d.ts +26 -13
  34. package/dist/gui/components/ChatSidebar.js +48 -14
  35. package/dist/gui/components/ChatStatus.d.ts +4 -2
  36. package/dist/gui/components/ChatStatus.js +45 -34
  37. package/dist/gui/components/ChatView.d.ts +5 -3
  38. package/dist/gui/components/ChatView.js +38 -9
  39. package/dist/gui/components/ConfigPanel.d.ts +16 -12
  40. package/dist/gui/components/ConfigPanel.js +218 -41
  41. package/dist/gui/components/Conversation.d.ts +17 -14
  42. package/dist/gui/components/Conversation.js +143 -83
  43. package/dist/gui/components/Dialog.d.ts +57 -11
  44. package/dist/gui/components/Dialog.js +84 -8
  45. package/dist/gui/components/DropdownMenu.d.ts +101 -20
  46. package/dist/gui/components/DropdownMenu.js +161 -14
  47. package/dist/gui/components/HeightTransition.d.ts +12 -7
  48. package/dist/gui/components/HeightTransition.js +88 -77
  49. package/dist/gui/components/Input.d.ts +13 -6
  50. package/dist/gui/components/Input.js +27 -16
  51. package/dist/gui/components/InputBox.d.ts +19 -12
  52. package/dist/gui/components/InputBox.js +86 -14
  53. package/dist/gui/components/Label.d.ts +7 -1
  54. package/dist/gui/components/Label.js +12 -2
  55. package/dist/gui/components/MarkdownRenderer.d.ts +6 -4
  56. package/dist/gui/components/MarkdownRenderer.js +178 -81
  57. package/dist/gui/components/Message.d.ts +25 -18
  58. package/dist/gui/components/Message.js +44 -23
  59. package/dist/gui/components/MessageContent.d.ts +29 -22
  60. package/dist/gui/components/MessageContent.js +157 -85
  61. package/dist/gui/components/PlaygroundLayout.d.ts +9 -5
  62. package/dist/gui/components/PlaygroundLayout.js +43 -12
  63. package/dist/gui/components/Reasoning.d.ts +30 -24
  64. package/dist/gui/components/Reasoning.js +187 -60
  65. package/dist/gui/components/Response.d.ts +11 -9
  66. package/dist/gui/components/Response.js +229 -90
  67. package/dist/gui/components/Select.d.ts +69 -10
  68. package/dist/gui/components/Select.js +118 -12
  69. package/dist/gui/components/Sonner.d.ts +3 -1
  70. package/dist/gui/components/Sonner.js +29 -18
  71. package/dist/gui/components/StatusBar.d.ts +9 -5
  72. package/dist/gui/components/StatusBar.js +56 -9
  73. package/dist/gui/components/Tabs.d.ts +24 -4
  74. package/dist/gui/components/Tabs.js +32 -4
  75. package/dist/gui/components/Task.d.ts +28 -24
  76. package/dist/gui/components/Task.js +164 -31
  77. package/dist/gui/components/Textarea.d.ts +15 -7
  78. package/dist/gui/components/Textarea.js +63 -46
  79. package/dist/gui/components/ThinkingBlock.d.ts +20 -10
  80. package/dist/gui/components/ThinkingBlock.js +134 -35
  81. package/dist/gui/components/TodoList.d.ts +12 -10
  82. package/dist/gui/components/TodoList.js +22 -7
  83. package/dist/gui/components/TodoListItem.d.ts +9 -6
  84. package/dist/gui/components/TodoListItem.js +18 -4
  85. package/dist/gui/components/index.d.ts +59 -8
  86. package/dist/gui/components/index.js +42 -8
  87. package/dist/gui/lib/utils.js +1 -1
  88. package/dist/index.d.ts +1 -1
  89. package/dist/index.js +1 -1
  90. package/dist/index.test.js +0 -1
  91. package/dist/sdk/client/acp-client.d.ts +88 -76
  92. package/dist/sdk/client/acp-client.js +215 -217
  93. package/dist/sdk/index.d.ts +1 -1
  94. package/dist/sdk/index.js +1 -1
  95. package/dist/sdk/schemas/agent.d.ts +111 -64
  96. package/dist/sdk/schemas/agent.js +24 -24
  97. package/dist/sdk/schemas/message.d.ts +245 -147
  98. package/dist/sdk/schemas/message.js +40 -40
  99. package/dist/sdk/schemas/session.d.ts +219 -135
  100. package/dist/sdk/schemas/session.js +27 -27
  101. package/dist/sdk/transports/http.d.ts +55 -55
  102. package/dist/sdk/transports/http.js +472 -469
  103. package/dist/sdk/transports/stdio.d.ts +20 -20
  104. package/dist/sdk/transports/stdio.js +289 -286
  105. package/dist/sdk/transports/types.d.ts +42 -42
  106. package/dist/sdk/transports/websocket.d.ts +12 -12
  107. package/dist/sdk/transports/websocket.js +52 -46
  108. package/dist/tui/components/ChatView.d.ts +4 -2
  109. package/dist/tui/components/ChatView.js +51 -18
  110. package/dist/tui/components/GameOfLife.js +64 -35
  111. package/dist/tui/components/InputBox.d.ts +18 -11
  112. package/dist/tui/components/InputBox.js +70 -10
  113. package/dist/tui/components/MessageList.d.ts +4 -2
  114. package/dist/tui/components/MessageList.js +37 -10
  115. package/dist/tui/components/MultiSelect.d.ts +15 -9
  116. package/dist/tui/components/MultiSelect.js +116 -69
  117. package/dist/tui/components/ReadlineInput.d.ts +12 -6
  118. package/dist/tui/components/ReadlineInput.js +252 -237
  119. package/dist/tui/components/SingleSelect.d.ts +15 -9
  120. package/dist/tui/components/SingleSelect.js +84 -43
  121. package/dist/tui/components/StatusBar.d.ts +11 -6
  122. package/dist/tui/components/StatusBar.js +102 -67
  123. package/dist/tui/index.d.ts +1 -1
  124. package/dist/tui/index.js +1 -1
  125. package/package.json +2 -3
@@ -3,48 +3,48 @@ import { z } from "zod";
3
3
  * Agent capability schema
4
4
  */
5
5
  export const AgentCapability = z.object({
6
- name: z.string(),
7
- description: z.string().optional(),
8
- parameters: z.record(z.string(), z.unknown()).optional(),
6
+ name: z.string(),
7
+ description: z.string().optional(),
8
+ parameters: z.record(z.string(), z.unknown()).optional(),
9
9
  });
10
10
  /**
11
11
  * Agent tool schema
12
12
  */
13
13
  export const AgentTool = z.object({
14
- name: z.string(),
15
- description: z.string(),
16
- parameters: z.record(z.string(), z.unknown()),
17
- required: z.array(z.string()).optional(),
14
+ name: z.string(),
15
+ description: z.string(),
16
+ parameters: z.record(z.string(), z.unknown()),
17
+ required: z.array(z.string()).optional(),
18
18
  });
19
19
  /**
20
20
  * Agent information schema
21
21
  */
22
22
  export const AgentInfo = z.object({
23
- name: z.string(),
24
- version: z.string().optional(),
25
- description: z.string().optional(),
26
- author: z.string().optional(),
27
- capabilities: z.array(AgentCapability).optional(),
28
- tools: z.array(AgentTool).optional(),
29
- supportedFormats: z.array(z.string()).optional(),
23
+ name: z.string(),
24
+ version: z.string().optional(),
25
+ description: z.string().optional(),
26
+ author: z.string().optional(),
27
+ capabilities: z.array(AgentCapability).optional(),
28
+ tools: z.array(AgentTool).optional(),
29
+ supportedFormats: z.array(z.string()).optional(),
30
30
  });
31
31
  /**
32
32
  * Agent status schema
33
33
  */
34
34
  export const AgentStatus = z.enum([
35
- "initializing",
36
- "ready",
37
- "busy",
38
- "error",
39
- "terminated",
35
+ "initializing",
36
+ "ready",
37
+ "busy",
38
+ "error",
39
+ "terminated",
40
40
  ]);
41
41
  /**
42
42
  * Agent state schema
43
43
  */
44
44
  export const AgentState = z.object({
45
- status: AgentStatus,
46
- info: AgentInfo.optional(),
47
- pid: z.number().optional(),
48
- error: z.string().optional(),
49
- uptime: z.number().optional(),
45
+ status: AgentStatus,
46
+ info: AgentInfo.optional(),
47
+ pid: z.number().optional(),
48
+ error: z.string().optional(),
49
+ uptime: z.number().optional(),
50
50
  });
@@ -3,193 +3,291 @@ import { z } from "zod";
3
3
  * Message role types
4
4
  */
5
5
  export declare const MessageRole: z.ZodEnum<{
6
- user: "user";
7
- assistant: "assistant";
8
- system: "system";
9
- tool: "tool";
6
+ user: "user";
7
+ assistant: "assistant";
8
+ system: "system";
9
+ tool: "tool";
10
10
  }>;
11
11
  export type MessageRole = z.infer<typeof MessageRole>;
12
12
  /**
13
13
  * Content type for messages
14
14
  */
15
15
  export declare const ContentType: z.ZodEnum<{
16
- text: "text";
17
- image: "image";
18
- file: "file";
19
- tool_call: "tool_call";
20
- tool_result: "tool_result";
16
+ text: "text";
17
+ image: "image";
18
+ file: "file";
19
+ tool_call: "tool_call";
20
+ tool_result: "tool_result";
21
21
  }>;
22
22
  export type ContentType = z.infer<typeof ContentType>;
23
23
  /**
24
24
  * Base content schema
25
25
  */
26
- export declare const BaseContent: z.ZodObject<{
27
- type: z.ZodEnum<{
28
- text: "text";
29
- image: "image";
30
- file: "file";
31
- tool_call: "tool_call";
32
- tool_result: "tool_result";
33
- }>;
34
- }, z.core.$strip>;
26
+ export declare const BaseContent: z.ZodObject<
27
+ {
28
+ type: z.ZodEnum<{
29
+ text: "text";
30
+ image: "image";
31
+ file: "file";
32
+ tool_call: "tool_call";
33
+ tool_result: "tool_result";
34
+ }>;
35
+ },
36
+ z.core.$strip
37
+ >;
35
38
  /**
36
39
  * Text content
37
40
  */
38
- export declare const TextContent: z.ZodObject<{
39
- type: z.ZodLiteral<"text">;
40
- text: z.ZodString;
41
- }, z.core.$strip>;
41
+ export declare const TextContent: z.ZodObject<
42
+ {
43
+ type: z.ZodLiteral<"text">;
44
+ text: z.ZodString;
45
+ },
46
+ z.core.$strip
47
+ >;
42
48
  export type TextContent = z.infer<typeof TextContent>;
43
49
  /**
44
50
  * Image content
45
51
  */
46
- export declare const ImageContent: z.ZodObject<{
47
- type: z.ZodLiteral<"image">;
48
- url: z.ZodOptional<z.ZodString>;
49
- data: z.ZodOptional<z.ZodString>;
50
- mimeType: z.ZodOptional<z.ZodString>;
51
- }, z.core.$strip>;
52
+ export declare const ImageContent: z.ZodObject<
53
+ {
54
+ type: z.ZodLiteral<"image">;
55
+ url: z.ZodOptional<z.ZodString>;
56
+ data: z.ZodOptional<z.ZodString>;
57
+ mimeType: z.ZodOptional<z.ZodString>;
58
+ },
59
+ z.core.$strip
60
+ >;
52
61
  export type ImageContent = z.infer<typeof ImageContent>;
53
62
  /**
54
63
  * File attachment content
55
64
  */
56
- export declare const FileContent: z.ZodObject<{
57
- type: z.ZodLiteral<"file">;
58
- name: z.ZodString;
59
- path: z.ZodOptional<z.ZodString>;
60
- url: z.ZodOptional<z.ZodString>;
61
- mimeType: z.ZodString;
62
- size: z.ZodOptional<z.ZodNumber>;
63
- }, z.core.$strip>;
65
+ export declare const FileContent: z.ZodObject<
66
+ {
67
+ type: z.ZodLiteral<"file">;
68
+ name: z.ZodString;
69
+ path: z.ZodOptional<z.ZodString>;
70
+ url: z.ZodOptional<z.ZodString>;
71
+ mimeType: z.ZodString;
72
+ size: z.ZodOptional<z.ZodNumber>;
73
+ },
74
+ z.core.$strip
75
+ >;
64
76
  export type FileContent = z.infer<typeof FileContent>;
65
77
  /**
66
78
  * Tool call content
67
79
  */
68
- export declare const ToolCallContent: z.ZodObject<{
69
- type: z.ZodLiteral<"tool_call">;
70
- id: z.ZodString;
71
- name: z.ZodString;
72
- arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
73
- }, z.core.$strip>;
80
+ export declare const ToolCallContent: z.ZodObject<
81
+ {
82
+ type: z.ZodLiteral<"tool_call">;
83
+ id: z.ZodString;
84
+ name: z.ZodString;
85
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
86
+ },
87
+ z.core.$strip
88
+ >;
74
89
  export type ToolCallContent = z.infer<typeof ToolCallContent>;
75
90
  /**
76
91
  * Tool result content
77
92
  */
78
- export declare const ToolResultContent: z.ZodObject<{
79
- type: z.ZodLiteral<"tool_result">;
80
- callId: z.ZodString;
81
- result: z.ZodUnknown;
82
- error: z.ZodOptional<z.ZodString>;
83
- }, z.core.$strip>;
93
+ export declare const ToolResultContent: z.ZodObject<
94
+ {
95
+ type: z.ZodLiteral<"tool_result">;
96
+ callId: z.ZodString;
97
+ result: z.ZodUnknown;
98
+ error: z.ZodOptional<z.ZodString>;
99
+ },
100
+ z.core.$strip
101
+ >;
84
102
  export type ToolResultContent = z.infer<typeof ToolResultContent>;
85
103
  /**
86
104
  * Union of all content types
87
105
  */
88
- export declare const Content: z.ZodDiscriminatedUnion<[z.ZodObject<{
89
- type: z.ZodLiteral<"text">;
90
- text: z.ZodString;
91
- }, z.core.$strip>, z.ZodObject<{
92
- type: z.ZodLiteral<"image">;
93
- url: z.ZodOptional<z.ZodString>;
94
- data: z.ZodOptional<z.ZodString>;
95
- mimeType: z.ZodOptional<z.ZodString>;
96
- }, z.core.$strip>, z.ZodObject<{
97
- type: z.ZodLiteral<"file">;
98
- name: z.ZodString;
99
- path: z.ZodOptional<z.ZodString>;
100
- url: z.ZodOptional<z.ZodString>;
101
- mimeType: z.ZodString;
102
- size: z.ZodOptional<z.ZodNumber>;
103
- }, z.core.$strip>, z.ZodObject<{
104
- type: z.ZodLiteral<"tool_call">;
105
- id: z.ZodString;
106
- name: z.ZodString;
107
- arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
108
- }, z.core.$strip>, z.ZodObject<{
109
- type: z.ZodLiteral<"tool_result">;
110
- callId: z.ZodString;
111
- result: z.ZodUnknown;
112
- error: z.ZodOptional<z.ZodString>;
113
- }, z.core.$strip>], "type">;
106
+ export declare const Content: z.ZodDiscriminatedUnion<
107
+ [
108
+ z.ZodObject<
109
+ {
110
+ type: z.ZodLiteral<"text">;
111
+ text: z.ZodString;
112
+ },
113
+ z.core.$strip
114
+ >,
115
+ z.ZodObject<
116
+ {
117
+ type: z.ZodLiteral<"image">;
118
+ url: z.ZodOptional<z.ZodString>;
119
+ data: z.ZodOptional<z.ZodString>;
120
+ mimeType: z.ZodOptional<z.ZodString>;
121
+ },
122
+ z.core.$strip
123
+ >,
124
+ z.ZodObject<
125
+ {
126
+ type: z.ZodLiteral<"file">;
127
+ name: z.ZodString;
128
+ path: z.ZodOptional<z.ZodString>;
129
+ url: z.ZodOptional<z.ZodString>;
130
+ mimeType: z.ZodString;
131
+ size: z.ZodOptional<z.ZodNumber>;
132
+ },
133
+ z.core.$strip
134
+ >,
135
+ z.ZodObject<
136
+ {
137
+ type: z.ZodLiteral<"tool_call">;
138
+ id: z.ZodString;
139
+ name: z.ZodString;
140
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
141
+ },
142
+ z.core.$strip
143
+ >,
144
+ z.ZodObject<
145
+ {
146
+ type: z.ZodLiteral<"tool_result">;
147
+ callId: z.ZodString;
148
+ result: z.ZodUnknown;
149
+ error: z.ZodOptional<z.ZodString>;
150
+ },
151
+ z.core.$strip
152
+ >,
153
+ ],
154
+ "type"
155
+ >;
114
156
  export type Content = z.infer<typeof Content>;
115
157
  /**
116
158
  * Message schema
117
159
  */
118
- export declare const Message: z.ZodObject<{
119
- id: z.ZodString;
120
- role: z.ZodEnum<{
121
- user: "user";
122
- assistant: "assistant";
123
- system: "system";
124
- tool: "tool";
125
- }>;
126
- content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
127
- type: z.ZodLiteral<"text">;
128
- text: z.ZodString;
129
- }, z.core.$strip>, z.ZodObject<{
130
- type: z.ZodLiteral<"image">;
131
- url: z.ZodOptional<z.ZodString>;
132
- data: z.ZodOptional<z.ZodString>;
133
- mimeType: z.ZodOptional<z.ZodString>;
134
- }, z.core.$strip>, z.ZodObject<{
135
- type: z.ZodLiteral<"file">;
136
- name: z.ZodString;
137
- path: z.ZodOptional<z.ZodString>;
138
- url: z.ZodOptional<z.ZodString>;
139
- mimeType: z.ZodString;
140
- size: z.ZodOptional<z.ZodNumber>;
141
- }, z.core.$strip>, z.ZodObject<{
142
- type: z.ZodLiteral<"tool_call">;
143
- id: z.ZodString;
144
- name: z.ZodString;
145
- arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
146
- }, z.core.$strip>, z.ZodObject<{
147
- type: z.ZodLiteral<"tool_result">;
148
- callId: z.ZodString;
149
- result: z.ZodUnknown;
150
- error: z.ZodOptional<z.ZodString>;
151
- }, z.core.$strip>], "type">>;
152
- timestamp: z.ZodISODateTime;
153
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
154
- }, z.core.$strip>;
160
+ export declare const Message: z.ZodObject<
161
+ {
162
+ id: z.ZodString;
163
+ role: z.ZodEnum<{
164
+ user: "user";
165
+ assistant: "assistant";
166
+ system: "system";
167
+ tool: "tool";
168
+ }>;
169
+ content: z.ZodArray<
170
+ z.ZodDiscriminatedUnion<
171
+ [
172
+ z.ZodObject<
173
+ {
174
+ type: z.ZodLiteral<"text">;
175
+ text: z.ZodString;
176
+ },
177
+ z.core.$strip
178
+ >,
179
+ z.ZodObject<
180
+ {
181
+ type: z.ZodLiteral<"image">;
182
+ url: z.ZodOptional<z.ZodString>;
183
+ data: z.ZodOptional<z.ZodString>;
184
+ mimeType: z.ZodOptional<z.ZodString>;
185
+ },
186
+ z.core.$strip
187
+ >,
188
+ z.ZodObject<
189
+ {
190
+ type: z.ZodLiteral<"file">;
191
+ name: z.ZodString;
192
+ path: z.ZodOptional<z.ZodString>;
193
+ url: z.ZodOptional<z.ZodString>;
194
+ mimeType: z.ZodString;
195
+ size: z.ZodOptional<z.ZodNumber>;
196
+ },
197
+ z.core.$strip
198
+ >,
199
+ z.ZodObject<
200
+ {
201
+ type: z.ZodLiteral<"tool_call">;
202
+ id: z.ZodString;
203
+ name: z.ZodString;
204
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
205
+ },
206
+ z.core.$strip
207
+ >,
208
+ z.ZodObject<
209
+ {
210
+ type: z.ZodLiteral<"tool_result">;
211
+ callId: z.ZodString;
212
+ result: z.ZodUnknown;
213
+ error: z.ZodOptional<z.ZodString>;
214
+ },
215
+ z.core.$strip
216
+ >,
217
+ ],
218
+ "type"
219
+ >
220
+ >;
221
+ timestamp: z.ZodISODateTime;
222
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
223
+ },
224
+ z.core.$strip
225
+ >;
155
226
  export type Message = z.infer<typeof Message>;
156
227
  /**
157
228
  * Streaming message chunk
158
229
  */
159
- export declare const MessageChunk: z.ZodObject<{
160
- id: z.ZodString;
161
- role: z.ZodEnum<{
162
- user: "user";
163
- assistant: "assistant";
164
- system: "system";
165
- tool: "tool";
166
- }>;
167
- contentDelta: z.ZodDiscriminatedUnion<[z.ZodObject<{
168
- type: z.ZodLiteral<"text">;
169
- text: z.ZodString;
170
- }, z.core.$strip>, z.ZodObject<{
171
- type: z.ZodLiteral<"image">;
172
- url: z.ZodOptional<z.ZodString>;
173
- data: z.ZodOptional<z.ZodString>;
174
- mimeType: z.ZodOptional<z.ZodString>;
175
- }, z.core.$strip>, z.ZodObject<{
176
- type: z.ZodLiteral<"file">;
177
- name: z.ZodString;
178
- path: z.ZodOptional<z.ZodString>;
179
- url: z.ZodOptional<z.ZodString>;
180
- mimeType: z.ZodString;
181
- size: z.ZodOptional<z.ZodNumber>;
182
- }, z.core.$strip>, z.ZodObject<{
183
- type: z.ZodLiteral<"tool_call">;
184
- id: z.ZodString;
185
- name: z.ZodString;
186
- arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
187
- }, z.core.$strip>, z.ZodObject<{
188
- type: z.ZodLiteral<"tool_result">;
189
- callId: z.ZodString;
190
- result: z.ZodUnknown;
191
- error: z.ZodOptional<z.ZodString>;
192
- }, z.core.$strip>], "type">;
193
- isComplete: z.ZodBoolean;
194
- }, z.core.$strip>;
230
+ export declare const MessageChunk: z.ZodObject<
231
+ {
232
+ id: z.ZodString;
233
+ role: z.ZodEnum<{
234
+ user: "user";
235
+ assistant: "assistant";
236
+ system: "system";
237
+ tool: "tool";
238
+ }>;
239
+ contentDelta: z.ZodDiscriminatedUnion<
240
+ [
241
+ z.ZodObject<
242
+ {
243
+ type: z.ZodLiteral<"text">;
244
+ text: z.ZodString;
245
+ },
246
+ z.core.$strip
247
+ >,
248
+ z.ZodObject<
249
+ {
250
+ type: z.ZodLiteral<"image">;
251
+ url: z.ZodOptional<z.ZodString>;
252
+ data: z.ZodOptional<z.ZodString>;
253
+ mimeType: z.ZodOptional<z.ZodString>;
254
+ },
255
+ z.core.$strip
256
+ >,
257
+ z.ZodObject<
258
+ {
259
+ type: z.ZodLiteral<"file">;
260
+ name: z.ZodString;
261
+ path: z.ZodOptional<z.ZodString>;
262
+ url: z.ZodOptional<z.ZodString>;
263
+ mimeType: z.ZodString;
264
+ size: z.ZodOptional<z.ZodNumber>;
265
+ },
266
+ z.core.$strip
267
+ >,
268
+ z.ZodObject<
269
+ {
270
+ type: z.ZodLiteral<"tool_call">;
271
+ id: z.ZodString;
272
+ name: z.ZodString;
273
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
274
+ },
275
+ z.core.$strip
276
+ >,
277
+ z.ZodObject<
278
+ {
279
+ type: z.ZodLiteral<"tool_result">;
280
+ callId: z.ZodString;
281
+ result: z.ZodUnknown;
282
+ error: z.ZodOptional<z.ZodString>;
283
+ },
284
+ z.core.$strip
285
+ >,
286
+ ],
287
+ "type"
288
+ >;
289
+ isComplete: z.ZodBoolean;
290
+ },
291
+ z.core.$strip
292
+ >;
195
293
  export type MessageChunk = z.infer<typeof MessageChunk>;
@@ -7,89 +7,89 @@ export const MessageRole = z.enum(["user", "assistant", "system", "tool"]);
7
7
  * Content type for messages
8
8
  */
9
9
  export const ContentType = z.enum([
10
- "text",
11
- "image",
12
- "file",
13
- "tool_call",
14
- "tool_result",
10
+ "text",
11
+ "image",
12
+ "file",
13
+ "tool_call",
14
+ "tool_result",
15
15
  ]);
16
16
  /**
17
17
  * Base content schema
18
18
  */
19
19
  export const BaseContent = z.object({
20
- type: ContentType,
20
+ type: ContentType,
21
21
  });
22
22
  /**
23
23
  * Text content
24
24
  */
25
25
  export const TextContent = BaseContent.extend({
26
- type: z.literal("text"),
27
- text: z.string(),
26
+ type: z.literal("text"),
27
+ text: z.string(),
28
28
  });
29
29
  /**
30
30
  * Image content
31
31
  */
32
32
  export const ImageContent = BaseContent.extend({
33
- type: z.literal("image"),
34
- url: z.string().url().optional(),
35
- data: z.string().optional(), // Base64 encoded
36
- mimeType: z.string().optional(),
33
+ type: z.literal("image"),
34
+ url: z.string().url().optional(),
35
+ data: z.string().optional(), // Base64 encoded
36
+ mimeType: z.string().optional(),
37
37
  });
38
38
  /**
39
39
  * File attachment content
40
40
  */
41
41
  export const FileContent = BaseContent.extend({
42
- type: z.literal("file"),
43
- name: z.string(),
44
- path: z.string().optional(),
45
- url: z.string().url().optional(),
46
- mimeType: z.string(),
47
- size: z.number().optional(),
42
+ type: z.literal("file"),
43
+ name: z.string(),
44
+ path: z.string().optional(),
45
+ url: z.string().url().optional(),
46
+ mimeType: z.string(),
47
+ size: z.number().optional(),
48
48
  });
49
49
  /**
50
50
  * Tool call content
51
51
  */
52
52
  export const ToolCallContent = BaseContent.extend({
53
- type: z.literal("tool_call"),
54
- id: z.string(),
55
- name: z.string(),
56
- arguments: z.record(z.string(), z.unknown()),
53
+ type: z.literal("tool_call"),
54
+ id: z.string(),
55
+ name: z.string(),
56
+ arguments: z.record(z.string(), z.unknown()),
57
57
  });
58
58
  /**
59
59
  * Tool result content
60
60
  */
61
61
  export const ToolResultContent = BaseContent.extend({
62
- type: z.literal("tool_result"),
63
- callId: z.string(),
64
- result: z.unknown(),
65
- error: z.string().optional(),
62
+ type: z.literal("tool_result"),
63
+ callId: z.string(),
64
+ result: z.unknown(),
65
+ error: z.string().optional(),
66
66
  });
67
67
  /**
68
68
  * Union of all content types
69
69
  */
70
70
  export const Content = z.discriminatedUnion("type", [
71
- TextContent,
72
- ImageContent,
73
- FileContent,
74
- ToolCallContent,
75
- ToolResultContent,
71
+ TextContent,
72
+ ImageContent,
73
+ FileContent,
74
+ ToolCallContent,
75
+ ToolResultContent,
76
76
  ]);
77
77
  /**
78
78
  * Message schema
79
79
  */
80
80
  export const Message = z.object({
81
- id: z.string(),
82
- role: MessageRole,
83
- content: z.array(Content),
84
- timestamp: z.iso.datetime(),
85
- metadata: z.record(z.string(), z.unknown()).optional(),
81
+ id: z.string(),
82
+ role: MessageRole,
83
+ content: z.array(Content),
84
+ timestamp: z.iso.datetime(),
85
+ metadata: z.record(z.string(), z.unknown()).optional(),
86
86
  });
87
87
  /**
88
88
  * Streaming message chunk
89
89
  */
90
90
  export const MessageChunk = z.object({
91
- id: z.string(),
92
- role: MessageRole,
93
- contentDelta: Content,
94
- isComplete: z.boolean(),
91
+ id: z.string(),
92
+ role: MessageRole,
93
+ contentDelta: Content,
94
+ isComplete: z.boolean(),
95
95
  });