@townco/ui 0.1.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 (271) hide show
  1. package/README.md +175 -0
  2. package/dist/core/hooks/index.d.ts +6 -0
  3. package/dist/core/hooks/index.d.ts.map +1 -0
  4. package/dist/core/hooks/index.js +6 -0
  5. package/dist/core/hooks/index.js.map +1 -0
  6. package/dist/core/hooks/use-chat-input.d.ts +23 -0
  7. package/dist/core/hooks/use-chat-input.d.ts.map +1 -0
  8. package/dist/core/hooks/use-chat-input.js +63 -0
  9. package/dist/core/hooks/use-chat-input.js.map +1 -0
  10. package/dist/core/hooks/use-chat-messages.d.ts +17 -0
  11. package/dist/core/hooks/use-chat-messages.d.ts.map +1 -0
  12. package/dist/core/hooks/use-chat-messages.js +121 -0
  13. package/dist/core/hooks/use-chat-messages.js.map +1 -0
  14. package/dist/core/hooks/use-chat-session.d.ts +11 -0
  15. package/dist/core/hooks/use-chat-session.d.ts.map +1 -0
  16. package/dist/core/hooks/use-chat-session.js +87 -0
  17. package/dist/core/hooks/use-chat-session.js.map +1 -0
  18. package/dist/core/hooks/use-media-query.d.ts +39 -0
  19. package/dist/core/hooks/use-media-query.js +80 -0
  20. package/dist/core/index.d.ts +9 -0
  21. package/dist/core/index.d.ts.map +1 -0
  22. package/dist/core/index.js +9 -0
  23. package/dist/core/index.js.map +1 -0
  24. package/dist/core/schemas/chat.d.ts +78 -0
  25. package/dist/core/schemas/chat.d.ts.map +1 -0
  26. package/dist/core/schemas/chat.js +49 -0
  27. package/dist/core/schemas/chat.js.map +1 -0
  28. package/dist/core/schemas/index.d.ts +4 -0
  29. package/dist/core/schemas/index.d.ts.map +1 -0
  30. package/dist/core/schemas/index.js +4 -0
  31. package/dist/core/schemas/index.js.map +1 -0
  32. package/dist/core/store/chat-store.d.ts +30 -0
  33. package/dist/core/store/chat-store.d.ts.map +1 -0
  34. package/dist/core/store/chat-store.js +56 -0
  35. package/dist/core/store/chat-store.js.map +1 -0
  36. package/dist/gui/components/Button.d.ts +11 -0
  37. package/dist/gui/components/Button.d.ts.map +1 -0
  38. package/dist/gui/components/Button.js +33 -0
  39. package/dist/gui/components/Button.js.map +1 -0
  40. package/dist/gui/components/Card.d.ts +8 -0
  41. package/dist/gui/components/Card.d.ts.map +1 -0
  42. package/dist/gui/components/Card.js +16 -0
  43. package/dist/gui/components/Card.js.map +1 -0
  44. package/dist/gui/components/ChatHeader.d.ts +38 -0
  45. package/dist/gui/components/ChatHeader.js +84 -0
  46. package/dist/gui/components/ChatInput.d.ts +42 -0
  47. package/dist/gui/components/ChatInput.d.ts.map +1 -0
  48. package/dist/gui/components/ChatInput.js +137 -0
  49. package/dist/gui/components/ChatInput.js.map +1 -0
  50. package/dist/gui/components/ChatInterface.d.ts +9 -0
  51. package/dist/gui/components/ChatInterface.d.ts.map +1 -0
  52. package/dist/gui/components/ChatInterface.js +132 -0
  53. package/dist/gui/components/ChatInterface.js.map +1 -0
  54. package/dist/gui/components/ChatLayout.d.ts +52 -0
  55. package/dist/gui/components/ChatLayout.js +105 -0
  56. package/dist/gui/components/ChatPanelTabContent.d.ts +18 -0
  57. package/dist/gui/components/ChatPanelTabContent.js +15 -0
  58. package/dist/gui/components/ChatPreview.d.ts +9 -0
  59. package/dist/gui/components/ChatPreview.d.ts.map +1 -0
  60. package/dist/gui/components/ChatPreview.js +164 -0
  61. package/dist/gui/components/ChatPreview.js.map +1 -0
  62. package/dist/gui/components/ChatSecondaryPanel.d.ts +20 -0
  63. package/dist/gui/components/ChatSecondaryPanel.d.ts.map +1 -0
  64. package/dist/gui/components/ChatSecondaryPanel.js +44 -0
  65. package/dist/gui/components/ChatSecondaryPanel.js.map +1 -0
  66. package/dist/gui/components/ChatSidebar.d.ts +14 -0
  67. package/dist/gui/components/ChatSidebar.js +23 -0
  68. package/dist/gui/components/ChatStatus.d.ts +6 -0
  69. package/dist/gui/components/ChatStatus.d.ts.map +1 -0
  70. package/dist/gui/components/ChatStatus.js +38 -0
  71. package/dist/gui/components/ChatStatus.js.map +1 -0
  72. package/dist/gui/components/ChatView.d.ts +6 -0
  73. package/dist/gui/components/ChatView.d.ts.map +1 -0
  74. package/dist/gui/components/ChatView.js +13 -0
  75. package/dist/gui/components/ChatView.js.map +1 -0
  76. package/dist/gui/components/ConfigPanel.d.ts +16 -0
  77. package/dist/gui/components/ConfigPanel.d.ts.map +1 -0
  78. package/dist/gui/components/ConfigPanel.js +48 -0
  79. package/dist/gui/components/ConfigPanel.js.map +1 -0
  80. package/dist/gui/components/Conversation.d.ts +20 -0
  81. package/dist/gui/components/Conversation.d.ts.map +1 -0
  82. package/dist/gui/components/Conversation.js +87 -0
  83. package/dist/gui/components/Conversation.js.map +1 -0
  84. package/dist/gui/components/Dialog.d.ts +19 -0
  85. package/dist/gui/components/Dialog.d.ts.map +1 -0
  86. package/dist/gui/components/Dialog.js +22 -0
  87. package/dist/gui/components/Dialog.js.map +1 -0
  88. package/dist/gui/components/DropdownMenu.d.ts +27 -0
  89. package/dist/gui/components/DropdownMenu.js +68 -0
  90. package/dist/gui/components/HeightTransition.d.ts +10 -0
  91. package/dist/gui/components/HeightTransition.d.ts.map +1 -0
  92. package/dist/gui/components/HeightTransition.js +80 -0
  93. package/dist/gui/components/HeightTransition.js.map +1 -0
  94. package/dist/gui/components/Input.d.ts +9 -0
  95. package/dist/gui/components/Input.d.ts.map +1 -0
  96. package/dist/gui/components/Input.js +21 -0
  97. package/dist/gui/components/Input.js.map +1 -0
  98. package/dist/gui/components/InputBox.d.ts +14 -0
  99. package/dist/gui/components/InputBox.d.ts.map +1 -0
  100. package/dist/gui/components/InputBox.js +18 -0
  101. package/dist/gui/components/InputBox.js.map +1 -0
  102. package/dist/gui/components/Label.d.ts +4 -0
  103. package/dist/gui/components/Label.d.ts.map +1 -0
  104. package/dist/gui/components/Label.js +7 -0
  105. package/dist/gui/components/Label.js.map +1 -0
  106. package/dist/gui/components/MarkdownRenderer.d.ts +6 -0
  107. package/dist/gui/components/MarkdownRenderer.d.ts.map +1 -0
  108. package/dist/gui/components/MarkdownRenderer.js +86 -0
  109. package/dist/gui/components/MarkdownRenderer.js.map +1 -0
  110. package/dist/gui/components/Message.d.ts +26 -0
  111. package/dist/gui/components/Message.d.ts.map +1 -0
  112. package/dist/gui/components/Message.js +33 -0
  113. package/dist/gui/components/Message.js.map +1 -0
  114. package/dist/gui/components/MessageContent.d.ts +26 -0
  115. package/dist/gui/components/MessageContent.d.ts.map +1 -0
  116. package/dist/gui/components/MessageContent.js +104 -0
  117. package/dist/gui/components/MessageContent.js.map +1 -0
  118. package/dist/gui/components/MessageList.d.ts +6 -0
  119. package/dist/gui/components/MessageList.d.ts.map +1 -0
  120. package/dist/gui/components/MessageList.js +1 -0
  121. package/dist/gui/components/MessageList.js.map +1 -0
  122. package/dist/gui/components/PlaygroundLayout.d.ts +10 -0
  123. package/dist/gui/components/PlaygroundLayout.d.ts.map +1 -0
  124. package/dist/gui/components/PlaygroundLayout.js +18 -0
  125. package/dist/gui/components/PlaygroundLayout.js.map +1 -0
  126. package/dist/gui/components/Reasoning.d.ts +31 -0
  127. package/dist/gui/components/Reasoning.d.ts.map +1 -0
  128. package/dist/gui/components/Reasoning.js +70 -0
  129. package/dist/gui/components/Reasoning.js.map +1 -0
  130. package/dist/gui/components/Response.d.ts +16 -0
  131. package/dist/gui/components/Response.d.ts.map +1 -0
  132. package/dist/gui/components/Response.js +95 -0
  133. package/dist/gui/components/Response.js.map +1 -0
  134. package/dist/gui/components/Select.d.ts +13 -0
  135. package/dist/gui/components/Select.d.ts.map +1 -0
  136. package/dist/gui/components/Select.js +26 -0
  137. package/dist/gui/components/Select.js.map +1 -0
  138. package/dist/gui/components/Sonner.d.ts +5 -0
  139. package/dist/gui/components/Sonner.js +23 -0
  140. package/dist/gui/components/StatusBar.d.ts +8 -0
  141. package/dist/gui/components/StatusBar.d.ts.map +1 -0
  142. package/dist/gui/components/StatusBar.js +11 -0
  143. package/dist/gui/components/StatusBar.js.map +1 -0
  144. package/dist/gui/components/Tabs.d.ts +7 -0
  145. package/dist/gui/components/Tabs.d.ts.map +1 -0
  146. package/dist/gui/components/Tabs.js +12 -0
  147. package/dist/gui/components/Tabs.js.map +1 -0
  148. package/dist/gui/components/Task.d.ts +35 -0
  149. package/dist/gui/components/Task.d.ts.map +1 -0
  150. package/dist/gui/components/Task.js +37 -0
  151. package/dist/gui/components/Task.js.map +1 -0
  152. package/dist/gui/components/Textarea.d.ts +11 -0
  153. package/dist/gui/components/Textarea.d.ts.map +1 -0
  154. package/dist/gui/components/Textarea.js +51 -0
  155. package/dist/gui/components/Textarea.js.map +1 -0
  156. package/dist/gui/components/ThinkingBlock.d.ts +12 -0
  157. package/dist/gui/components/ThinkingBlock.d.ts.map +1 -0
  158. package/dist/gui/components/ThinkingBlock.js +40 -0
  159. package/dist/gui/components/ThinkingBlock.js.map +1 -0
  160. package/dist/gui/components/TodoList.d.ts +20 -0
  161. package/dist/gui/components/TodoList.d.ts.map +1 -0
  162. package/dist/gui/components/TodoList.js +11 -0
  163. package/dist/gui/components/TodoList.js.map +1 -0
  164. package/dist/gui/components/TodoListItem.d.ts +10 -0
  165. package/dist/gui/components/TodoListItem.d.ts.map +1 -0
  166. package/dist/gui/components/TodoListItem.js +7 -0
  167. package/dist/gui/components/TodoListItem.js.map +1 -0
  168. package/dist/gui/components/index.d.ts +23 -0
  169. package/dist/gui/components/index.d.ts.map +1 -0
  170. package/dist/gui/components/index.js +28 -0
  171. package/dist/gui/components/index.js.map +1 -0
  172. package/dist/gui/index.d.ts +2 -0
  173. package/dist/gui/index.d.ts.map +1 -0
  174. package/dist/gui/index.js +4 -0
  175. package/dist/gui/index.js.map +1 -0
  176. package/dist/gui/lib/utils.d.ts +2 -0
  177. package/dist/gui/lib/utils.d.ts.map +1 -0
  178. package/dist/gui/lib/utils.js +5 -0
  179. package/dist/gui/lib/utils.js.map +1 -0
  180. package/dist/index.d.ts +11 -0
  181. package/dist/index.d.ts.map +1 -0
  182. package/dist/index.js +12 -0
  183. package/dist/index.js.map +1 -0
  184. package/dist/index.test.d.ts +0 -0
  185. package/dist/index.test.js +1 -0
  186. package/dist/sdk/client/acp-client.d.ts +84 -0
  187. package/dist/sdk/client/acp-client.d.ts.map +1 -0
  188. package/dist/sdk/client/acp-client.js +225 -0
  189. package/dist/sdk/client/acp-client.js.map +1 -0
  190. package/dist/sdk/client/index.d.ts +4 -0
  191. package/dist/sdk/client/index.d.ts.map +1 -0
  192. package/dist/sdk/client/index.js +4 -0
  193. package/dist/sdk/client/index.js.map +1 -0
  194. package/dist/sdk/index.d.ts +9 -0
  195. package/dist/sdk/index.d.ts.map +1 -0
  196. package/dist/sdk/index.js +9 -0
  197. package/dist/sdk/index.js.map +1 -0
  198. package/dist/sdk/schemas/agent.d.ts +87 -0
  199. package/dist/sdk/schemas/agent.d.ts.map +1 -0
  200. package/dist/sdk/schemas/agent.js +50 -0
  201. package/dist/sdk/schemas/agent.js.map +1 -0
  202. package/dist/sdk/schemas/index.d.ts +6 -0
  203. package/dist/sdk/schemas/index.d.ts.map +1 -0
  204. package/dist/sdk/schemas/index.js +6 -0
  205. package/dist/sdk/schemas/index.js.map +1 -0
  206. package/dist/sdk/schemas/message.d.ts +195 -0
  207. package/dist/sdk/schemas/message.d.ts.map +1 -0
  208. package/dist/sdk/schemas/message.js +95 -0
  209. package/dist/sdk/schemas/message.js.map +1 -0
  210. package/dist/sdk/schemas/session.d.ts +158 -0
  211. package/dist/sdk/schemas/session.d.ts.map +1 -0
  212. package/dist/sdk/schemas/session.js +54 -0
  213. package/dist/sdk/schemas/session.js.map +1 -0
  214. package/dist/sdk/transports/http.d.ts +63 -0
  215. package/dist/sdk/transports/http.d.ts.map +1 -0
  216. package/dist/sdk/transports/http.js +476 -0
  217. package/dist/sdk/transports/http.js.map +1 -0
  218. package/dist/sdk/transports/index.d.ts +7 -0
  219. package/dist/sdk/transports/index.d.ts.map +1 -0
  220. package/dist/sdk/transports/index.js +7 -0
  221. package/dist/sdk/transports/index.js.map +1 -0
  222. package/dist/sdk/transports/stdio.d.ts +28 -0
  223. package/dist/sdk/transports/stdio.d.ts.map +1 -0
  224. package/dist/sdk/transports/stdio.js +294 -0
  225. package/dist/sdk/transports/stdio.js.map +1 -0
  226. package/dist/sdk/transports/types.d.ts +63 -0
  227. package/dist/sdk/transports/types.d.ts.map +1 -0
  228. package/dist/sdk/transports/types.js +1 -0
  229. package/dist/sdk/transports/types.js.map +1 -0
  230. package/dist/sdk/transports/websocket.d.ts +20 -0
  231. package/dist/sdk/transports/websocket.d.ts.map +1 -0
  232. package/dist/sdk/transports/websocket.js +52 -0
  233. package/dist/sdk/transports/websocket.js.map +1 -0
  234. package/dist/tui/components/ChatView.d.ts +5 -0
  235. package/dist/tui/components/ChatView.d.ts.map +1 -0
  236. package/dist/tui/components/ChatView.js +24 -0
  237. package/dist/tui/components/ChatView.js.map +1 -0
  238. package/dist/tui/components/GameOfLife.d.ts +1 -0
  239. package/dist/tui/components/GameOfLife.d.ts.map +1 -0
  240. package/dist/tui/components/GameOfLife.js +50 -0
  241. package/dist/tui/components/GameOfLife.js.map +1 -0
  242. package/dist/tui/components/InputBox.d.ts +13 -0
  243. package/dist/tui/components/InputBox.d.ts.map +1 -0
  244. package/dist/tui/components/InputBox.js +15 -0
  245. package/dist/tui/components/InputBox.js.map +1 -0
  246. package/dist/tui/components/MessageList.d.ts +5 -0
  247. package/dist/tui/components/MessageList.d.ts.map +1 -0
  248. package/dist/tui/components/MessageList.js +16 -0
  249. package/dist/tui/components/MessageList.js.map +1 -0
  250. package/dist/tui/components/MultiSelect.d.ts +13 -0
  251. package/dist/tui/components/MultiSelect.js +72 -0
  252. package/dist/tui/components/ReadlineInput.d.ts +8 -0
  253. package/dist/tui/components/ReadlineInput.d.ts.map +1 -0
  254. package/dist/tui/components/ReadlineInput.js +240 -0
  255. package/dist/tui/components/ReadlineInput.js.map +1 -0
  256. package/dist/tui/components/SingleSelect.d.ts +13 -0
  257. package/dist/tui/components/SingleSelect.js +46 -0
  258. package/dist/tui/components/StatusBar.d.ts +9 -0
  259. package/dist/tui/components/StatusBar.d.ts.map +1 -0
  260. package/dist/tui/components/StatusBar.js +82 -0
  261. package/dist/tui/components/StatusBar.js.map +1 -0
  262. package/dist/tui/components/index.d.ts +11 -0
  263. package/dist/tui/components/index.d.ts.map +1 -0
  264. package/dist/tui/components/index.js +11 -0
  265. package/dist/tui/components/index.js.map +1 -0
  266. package/dist/tui/index.d.ts +7 -0
  267. package/dist/tui/index.d.ts.map +1 -0
  268. package/dist/tui/index.js +7 -0
  269. package/dist/tui/index.js.map +1 -0
  270. package/package.json +86 -0
  271. package/src/styles/global.css +152 -0
@@ -0,0 +1,225 @@
1
+ import { HttpTransport } from "../transports/http.js";
2
+ import { StdioTransport } from "../transports/stdio.js";
3
+ import { WebSocketTransport } from "../transports/websocket.js";
4
+ /**
5
+ * Simplified ACP client with explicit transport selection
6
+ */
7
+ export class AcpClient {
8
+ config;
9
+ transport;
10
+ sessions = new Map();
11
+ currentSessionId = null;
12
+ sessionUpdateHandlers = new Set();
13
+ errorHandlers = new Set();
14
+ constructor(config) {
15
+ this.config = config;
16
+ this.transport = this.createTransport();
17
+ this.setupTransportListeners();
18
+ if (config.autoConnect) {
19
+ this.connect().catch((error) => {
20
+ console.error("Failed to auto-connect:", error);
21
+ });
22
+ }
23
+ }
24
+ /**
25
+ * Connect to the agent
26
+ */
27
+ async connect() {
28
+ await this.transport.connect();
29
+ }
30
+ /**
31
+ * Disconnect from the agent
32
+ */
33
+ async disconnect() {
34
+ await this.transport.disconnect();
35
+ this.currentSessionId = null;
36
+ }
37
+ /**
38
+ * Check if connected
39
+ */
40
+ isConnected() {
41
+ return this.transport.isConnected();
42
+ }
43
+ /**
44
+ * Start a new chat session
45
+ */
46
+ async startSession(config) {
47
+ const sessionId = this.generateSessionId();
48
+ const now = new Date().toISOString();
49
+ const session = {
50
+ id: sessionId,
51
+ status: "connecting",
52
+ config: config
53
+ ? { ...config, agentPath: config.agentPath || "" }
54
+ : { agentPath: "" },
55
+ messages: [],
56
+ metadata: {
57
+ startedAt: now,
58
+ },
59
+ };
60
+ this.sessions.set(sessionId, session);
61
+ this.currentSessionId = sessionId;
62
+ // Update session status
63
+ this.updateSessionStatus(sessionId, "connected");
64
+ return sessionId;
65
+ }
66
+ /**
67
+ * Send a message in the current session
68
+ */
69
+ async sendMessage(content, sessionId) {
70
+ const targetSessionId = sessionId || this.currentSessionId;
71
+ if (!targetSessionId) {
72
+ throw new Error("No active session. Start a session first.");
73
+ }
74
+ if (!this.transport.isConnected()) {
75
+ throw new Error("Transport not connected");
76
+ }
77
+ const session = this.sessions.get(targetSessionId);
78
+ if (!session) {
79
+ throw new Error(`Session ${targetSessionId} not found`);
80
+ }
81
+ // Create message
82
+ const message = {
83
+ id: this.generateMessageId(),
84
+ role: "user",
85
+ content: [
86
+ {
87
+ type: "text",
88
+ text: content,
89
+ },
90
+ ],
91
+ timestamp: new Date().toISOString(),
92
+ };
93
+ // Add to session
94
+ session.messages.push(message);
95
+ this.updateSessionStatus(targetSessionId, "active");
96
+ // Send through transport
97
+ await this.transport.send(message);
98
+ }
99
+ /**
100
+ * Receive messages from the agent (streaming)
101
+ */
102
+ async *receiveMessages() {
103
+ if (!this.transport.isConnected()) {
104
+ throw new Error("Transport not connected");
105
+ }
106
+ yield* this.transport.receive();
107
+ }
108
+ /**
109
+ * Get a session by ID
110
+ */
111
+ getSession(sessionId) {
112
+ return this.sessions.get(sessionId);
113
+ }
114
+ /**
115
+ * Get current session
116
+ */
117
+ getCurrentSession() {
118
+ return this.currentSessionId
119
+ ? this.sessions.get(this.currentSessionId)
120
+ : undefined;
121
+ }
122
+ /**
123
+ * Get all sessions
124
+ */
125
+ getAllSessions() {
126
+ return Array.from(this.sessions.values());
127
+ }
128
+ /**
129
+ * Subscribe to session updates
130
+ */
131
+ onSessionUpdate(handler) {
132
+ this.sessionUpdateHandlers.add(handler);
133
+ return () => {
134
+ this.sessionUpdateHandlers.delete(handler);
135
+ };
136
+ }
137
+ /**
138
+ * Subscribe to errors
139
+ */
140
+ onError(handler) {
141
+ this.errorHandlers.add(handler);
142
+ return () => {
143
+ this.errorHandlers.delete(handler);
144
+ };
145
+ }
146
+ /**
147
+ * Create transport based on explicit configuration
148
+ */
149
+ createTransport() {
150
+ switch (this.config.type) {
151
+ case "stdio":
152
+ return new StdioTransport(this.config.options);
153
+ case "http":
154
+ return new HttpTransport(this.config.options);
155
+ case "websocket":
156
+ return new WebSocketTransport(this.config.options);
157
+ default:
158
+ // biome-ignore lint/suspicious/noExplicitAny: .
159
+ throw new Error(`Unknown transport type: ${this.config.type}`);
160
+ }
161
+ }
162
+ setupTransportListeners() {
163
+ // Listen to transport session updates
164
+ this.transport.onSessionUpdate((update) => {
165
+ this.handleSessionUpdate(update);
166
+ });
167
+ // Listen to transport errors
168
+ this.transport.onError((error) => {
169
+ this.handleError(error);
170
+ });
171
+ }
172
+ handleSessionUpdate(update) {
173
+ // Update local session state
174
+ if (update.sessionId) {
175
+ const session = this.sessions.get(update.sessionId);
176
+ if (session) {
177
+ if (update.status) {
178
+ session.status = update.status;
179
+ }
180
+ if (update.message) {
181
+ session.messages.push(update.message);
182
+ }
183
+ if (update.error) {
184
+ session.error = update.error;
185
+ }
186
+ }
187
+ }
188
+ // Notify handlers
189
+ for (const handler of this.sessionUpdateHandlers) {
190
+ try {
191
+ handler(update);
192
+ }
193
+ catch (error) {
194
+ console.error("Error in session update handler:", error);
195
+ }
196
+ }
197
+ }
198
+ handleError(error) {
199
+ // Notify error handlers
200
+ for (const handler of this.errorHandlers) {
201
+ try {
202
+ handler(error);
203
+ }
204
+ catch (err) {
205
+ console.error("Error in error handler:", err);
206
+ }
207
+ }
208
+ }
209
+ updateSessionStatus(sessionId, status) {
210
+ const session = this.sessions.get(sessionId);
211
+ if (session) {
212
+ session.status = status;
213
+ this.handleSessionUpdate({
214
+ sessionId,
215
+ status,
216
+ });
217
+ }
218
+ }
219
+ generateSessionId() {
220
+ return `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
221
+ }
222
+ generateMessageId() {
223
+ return `msg_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
224
+ }
225
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acp-client.js","sourceRoot":"","sources":["../../../src/sdk/client/acp-client.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAOtD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAchE;;GAEG;AACH,MAAM,OAAO,SAAS;IAQA;IAPZ,SAAS,CAAY;IACrB,QAAQ,GAAyB,IAAI,GAAG,EAAE,CAAC;IAC3C,gBAAgB,GAAkB,IAAI,CAAC;IACvC,qBAAqB,GAC3B,IAAI,GAAG,EAAE,CAAC;IACJ,aAAa,GAAgC,IAAI,GAAG,EAAE,CAAC;IAE/D,YAAoB,MAAuB;QAAvB,WAAM,GAAN,MAAM,CAAiB;QACzC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACxC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAE/B,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACvB,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC7B,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,W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ClE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;YACxB,IAAI,CAAC,mBAAmB,CAAC;gBACvB,SAAS;gBACT,MAAM;aACP,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAEO,iBAAiB;QACvB,OAAO,WAAW,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAC5E,CAAC;IAEO,iBAAiB;QACvB,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACxE,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Export client
3
+ */
4
+ export * from "./acp-client.js";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/client/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Export client
3
+ */
4
+ export * from "./acp-client.js";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sdk/client/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @townco/sdk
3
+ *
4
+ * Simplified SDK for Agent Client Protocol (ACP)
5
+ * Supports stdio, HTTP, and WebSocket transports
6
+ */
7
+ export * from "./client/index.js";
8
+ export * from "./schemas/index.js";
9
+ export * from "./transports/index.js";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @townco/sdk
3
+ *
4
+ * Simplified SDK for Agent Client Protocol (ACP)
5
+ * Supports stdio, HTTP, and WebSocket transports
6
+ */
7
+ export * from "./client/index.js";
8
+ export * from "./schemas/index.js";
9
+ export * from "./transports/index.js";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Agent capability schema
4
+ */
5
+ export declare const AgentCapability: z.ZodObject<{
6
+ name: z.ZodString;
7
+ description: z.ZodOptional<z.ZodString>;
8
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
9
+ }, z.core.$strip>;
10
+ export type AgentCapability = z.infer<typeof AgentCapability>;
11
+ /**
12
+ * Agent tool schema
13
+ */
14
+ export declare const AgentTool: z.ZodObject<{
15
+ name: z.ZodString;
16
+ description: z.ZodString;
17
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
18
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ }, z.core.$strip>;
20
+ export type AgentTool = z.infer<typeof AgentTool>;
21
+ /**
22
+ * Agent information schema
23
+ */
24
+ export declare const AgentInfo: z.ZodObject<{
25
+ name: z.ZodString;
26
+ version: z.ZodOptional<z.ZodString>;
27
+ description: z.ZodOptional<z.ZodString>;
28
+ author: z.ZodOptional<z.ZodString>;
29
+ capabilities: z.ZodOptional<z.ZodArray<z.ZodObject<{
30
+ name: z.ZodString;
31
+ description: z.ZodOptional<z.ZodString>;
32
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
33
+ }, z.core.$strip>>>;
34
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ name: z.ZodString;
36
+ description: z.ZodString;
37
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
38
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
39
+ }, z.core.$strip>>>;
40
+ supportedFormats: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
+ }, z.core.$strip>;
42
+ export type AgentInfo = z.infer<typeof AgentInfo>;
43
+ /**
44
+ * Agent status schema
45
+ */
46
+ export declare const AgentStatus: z.ZodEnum<{
47
+ error: "error";
48
+ initializing: "initializing";
49
+ ready: "ready";
50
+ busy: "busy";
51
+ terminated: "terminated";
52
+ }>;
53
+ export type AgentStatus = z.infer<typeof AgentStatus>;
54
+ /**
55
+ * Agent state schema
56
+ */
57
+ export declare const AgentState: z.ZodObject<{
58
+ status: z.ZodEnum<{
59
+ error: "error";
60
+ initializing: "initializing";
61
+ ready: "ready";
62
+ busy: "busy";
63
+ terminated: "terminated";
64
+ }>;
65
+ info: z.ZodOptional<z.ZodObject<{
66
+ name: z.ZodString;
67
+ version: z.ZodOptional<z.ZodString>;
68
+ description: z.ZodOptional<z.ZodString>;
69
+ author: z.ZodOptional<z.ZodString>;
70
+ capabilities: z.ZodOptional<z.ZodArray<z.ZodObject<{
71
+ name: z.ZodString;
72
+ description: z.ZodOptional<z.ZodString>;
73
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
74
+ }, z.core.$strip>>>;
75
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
76
+ name: z.ZodString;
77
+ description: z.ZodString;
78
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
79
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
80
+ }, z.core.$strip>>>;
81
+ supportedFormats: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
+ }, z.core.$strip>>;
83
+ pid: z.ZodOptional<z.ZodNumber>;
84
+ error: z.ZodOptional<z.ZodString>;
85
+ uptime: z.ZodOptional<z.ZodNumber>;
86
+ }, z.core.$strip>;
87
+ export type AgentState = z.infer<typeof AgentState>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/sdk/schemas/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;EAI1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;EAKpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,WAAW,qEAMtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Agent capability schema
4
+ */
5
+ export const AgentCapability = z.object({
6
+ name: z.string(),
7
+ description: z.string().optional(),
8
+ parameters: z.record(z.string(), z.unknown()).optional(),
9
+ });
10
+ /**
11
+ * Agent tool schema
12
+ */
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(),
18
+ });
19
+ /**
20
+ * Agent information schema
21
+ */
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(),
30
+ });
31
+ /**
32
+ * Agent status schema
33
+ */
34
+ export const AgentStatus = z.enum([
35
+ "initializing",
36
+ "ready",
37
+ "busy",
38
+ "error",
39
+ "terminated",
40
+ ]);
41
+ /**
42
+ * Agent state schema
43
+ */
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(),
50
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../src/sdk/schemas/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC;AAGH;;GAEG;AACH,M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,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Export all schemas
3
+ */
4
+ export * from "./agent.js";
5
+ export * from "./message.js";
6
+ export * from "./session.js";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/schemas/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Export all schemas
3
+ */
4
+ export * from "./agent.js";
5
+ export * from "./message.js";
6
+ export * from "./session.js";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sdk/schemas/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,195 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Message role types
4
+ */
5
+ export declare const MessageRole: z.ZodEnum<{
6
+ user: "user";
7
+ assistant: "assistant";
8
+ system: "system";
9
+ tool: "tool";
10
+ }>;
11
+ export type MessageRole = z.infer<typeof MessageRole>;
12
+ /**
13
+ * Content type for messages
14
+ */
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";
21
+ }>;
22
+ export type ContentType = z.infer<typeof ContentType>;
23
+ /**
24
+ * Base content schema
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>;
35
+ /**
36
+ * Text content
37
+ */
38
+ export declare const TextContent: z.ZodObject<{
39
+ type: z.ZodLiteral<"text">;
40
+ text: z.ZodString;
41
+ }, z.core.$strip>;
42
+ export type TextContent = z.infer<typeof TextContent>;
43
+ /**
44
+ * Image content
45
+ */
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 type ImageContent = z.infer<typeof ImageContent>;
53
+ /**
54
+ * File attachment content
55
+ */
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>;
64
+ export type FileContent = z.infer<typeof FileContent>;
65
+ /**
66
+ * Tool call content
67
+ */
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>;
74
+ export type ToolCallContent = z.infer<typeof ToolCallContent>;
75
+ /**
76
+ * Tool result content
77
+ */
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>;
84
+ export type ToolResultContent = z.infer<typeof ToolResultContent>;
85
+ /**
86
+ * Union of all content types
87
+ */
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">;
114
+ export type Content = z.infer<typeof Content>;
115
+ /**
116
+ * Message schema
117
+ */
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>;
155
+ export type Message = z.infer<typeof Message>;
156
+ /**
157
+ * Streaming message chunk
158
+ */
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>;
195
+ export type MessageChunk = z.infer<typeof MessageChunk>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/sdk/schemas/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,WAAW,oDAAkD,CAAC;AAC3E,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,WAAW,kEAMtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;EAEtB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;EAKvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;EAOtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;EAK1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAK5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,K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