@townco/ui 0.1.3 → 0.1.7

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 (250) hide show
  1. package/README.md +11 -11
  2. package/dist/core/hooks/use-chat-input.d.ts +17 -17
  3. package/dist/core/hooks/use-chat-input.js +55 -64
  4. package/dist/core/hooks/use-chat-messages.d.ts +11 -11
  5. package/dist/core/hooks/use-chat-messages.js +114 -121
  6. package/dist/core/hooks/use-chat-session.d.ts +5 -5
  7. package/dist/core/hooks/use-chat-session.js +80 -78
  8. package/dist/core/index.d.ts +1 -1
  9. package/dist/core/index.js +1 -1
  10. package/dist/core/schemas/chat.d.ts +56 -83
  11. package/dist/core/schemas/chat.js +25 -27
  12. package/dist/core/store/chat-store.d.ts +22 -28
  13. package/dist/core/store/chat-store.js +50 -59
  14. package/dist/gui/components/Button.d.ts +7 -23
  15. package/dist/gui/components/Button.js +27 -40
  16. package/dist/gui/components/Card.d.ts +7 -26
  17. package/dist/gui/components/Card.js +8 -54
  18. package/dist/gui/components/ChatInput.d.ts +36 -58
  19. package/dist/gui/components/ChatInput.js +121 -191
  20. package/dist/gui/components/ChatSecondaryPanel.d.ts +11 -14
  21. package/dist/gui/components/ChatSecondaryPanel.js +38 -115
  22. package/dist/gui/components/ChatStatus.d.ts +2 -4
  23. package/dist/gui/components/ChatStatus.js +34 -45
  24. package/dist/gui/components/Conversation.d.ts +14 -17
  25. package/dist/gui/components/Conversation.js +83 -143
  26. package/dist/gui/components/Dialog.d.ts +11 -57
  27. package/dist/gui/components/Dialog.js +8 -84
  28. package/dist/gui/components/HeightTransition.d.ts +7 -12
  29. package/dist/gui/components/HeightTransition.js +77 -88
  30. package/dist/gui/components/Input.d.ts +6 -13
  31. package/dist/gui/components/Input.js +16 -27
  32. package/dist/gui/components/Label.d.ts +1 -7
  33. package/dist/gui/components/Label.js +2 -12
  34. package/dist/gui/components/MarkdownRenderer.d.ts +4 -6
  35. package/dist/gui/components/MarkdownRenderer.js +81 -178
  36. package/dist/gui/components/Message.d.ts +18 -25
  37. package/dist/gui/components/Message.js +23 -44
  38. package/dist/gui/components/MessageContent.d.ts +22 -29
  39. package/dist/gui/components/MessageContent.js +85 -157
  40. package/dist/gui/components/Reasoning.d.ts +24 -30
  41. package/dist/gui/components/Reasoning.js +60 -187
  42. package/dist/gui/components/Response.d.ts +9 -11
  43. package/dist/gui/components/Response.js +90 -229
  44. package/dist/gui/components/Select.d.ts +10 -69
  45. package/dist/gui/components/Select.js +12 -118
  46. package/dist/gui/components/Tabs.d.ts +4 -24
  47. package/dist/gui/components/Tabs.js +4 -32
  48. package/dist/gui/components/Task.d.ts +24 -28
  49. package/dist/gui/components/Task.js +31 -164
  50. package/dist/gui/components/Textarea.d.ts +7 -15
  51. package/dist/gui/components/Textarea.js +46 -63
  52. package/dist/gui/components/ThinkingBlock.d.ts +10 -20
  53. package/dist/gui/components/ThinkingBlock.js +35 -134
  54. package/dist/gui/components/TodoList.d.ts +10 -12
  55. package/dist/gui/components/TodoList.js +7 -22
  56. package/dist/gui/components/TodoListItem.d.ts +6 -9
  57. package/dist/gui/components/TodoListItem.js +4 -18
  58. package/dist/gui/components/index.d.ts +8 -59
  59. package/dist/gui/components/index.js +8 -42
  60. package/dist/gui/lib/utils.js +1 -1
  61. package/dist/index.d.ts +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/index.test.js +1 -0
  64. package/dist/sdk/client/acp-client.d.ts +76 -88
  65. package/dist/sdk/client/acp-client.js +217 -215
  66. package/dist/sdk/index.d.ts +1 -1
  67. package/dist/sdk/index.js +1 -1
  68. package/dist/sdk/schemas/agent.d.ts +64 -111
  69. package/dist/sdk/schemas/agent.js +24 -24
  70. package/dist/sdk/schemas/message.d.ts +147 -245
  71. package/dist/sdk/schemas/message.js +40 -40
  72. package/dist/sdk/schemas/session.d.ts +135 -219
  73. package/dist/sdk/schemas/session.js +27 -27
  74. package/dist/sdk/transports/http.d.ts +55 -55
  75. package/dist/sdk/transports/http.js +469 -472
  76. package/dist/sdk/transports/stdio.d.ts +20 -20
  77. package/dist/sdk/transports/stdio.js +286 -289
  78. package/dist/sdk/transports/types.d.ts +42 -42
  79. package/dist/sdk/transports/websocket.d.ts +12 -12
  80. package/dist/sdk/transports/websocket.js +46 -52
  81. package/dist/tui/components/ChatView.d.ts +2 -4
  82. package/dist/tui/components/ChatView.js +18 -51
  83. package/dist/tui/components/GameOfLife.js +35 -64
  84. package/dist/tui/components/InputBox.d.ts +11 -18
  85. package/dist/tui/components/InputBox.js +10 -70
  86. package/dist/tui/components/MessageList.d.ts +2 -4
  87. package/dist/tui/components/MessageList.js +10 -37
  88. package/dist/tui/components/MultiSelect.d.ts +10 -15
  89. package/dist/tui/components/MultiSelect.js +73 -116
  90. package/dist/tui/components/ReadlineInput.d.ts +6 -12
  91. package/dist/tui/components/ReadlineInput.js +237 -252
  92. package/dist/tui/components/SingleSelect.d.ts +9 -15
  93. package/dist/tui/components/SingleSelect.js +43 -84
  94. package/dist/tui/components/StatusBar.d.ts +6 -11
  95. package/dist/tui/components/StatusBar.js +67 -102
  96. package/dist/tui/index.d.ts +1 -1
  97. package/dist/tui/index.js +1 -1
  98. package/package.json +2 -2
  99. package/dist/core/hooks/index.d.ts.map +0 -1
  100. package/dist/core/hooks/index.js.map +0 -1
  101. package/dist/core/hooks/use-chat-input.d.ts.map +0 -1
  102. package/dist/core/hooks/use-chat-input.js.map +0 -1
  103. package/dist/core/hooks/use-chat-messages.d.ts.map +0 -1
  104. package/dist/core/hooks/use-chat-messages.js.map +0 -1
  105. package/dist/core/hooks/use-chat-session.d.ts.map +0 -1
  106. package/dist/core/hooks/use-chat-session.js.map +0 -1
  107. package/dist/core/hooks/use-media-query.d.ts +0 -39
  108. package/dist/core/hooks/use-media-query.js +0 -80
  109. package/dist/core/index.d.ts.map +0 -1
  110. package/dist/core/index.js.map +0 -1
  111. package/dist/core/schemas/chat.d.ts.map +0 -1
  112. package/dist/core/schemas/chat.js.map +0 -1
  113. package/dist/core/schemas/index.d.ts.map +0 -1
  114. package/dist/core/schemas/index.js.map +0 -1
  115. package/dist/core/store/chat-store.d.ts.map +0 -1
  116. package/dist/core/store/chat-store.js.map +0 -1
  117. package/dist/gui/components/Button.d.ts.map +0 -1
  118. package/dist/gui/components/Button.js.map +0 -1
  119. package/dist/gui/components/Card.d.ts.map +0 -1
  120. package/dist/gui/components/Card.js.map +0 -1
  121. package/dist/gui/components/ChatHeader.d.ts +0 -65
  122. package/dist/gui/components/ChatHeader.js +0 -189
  123. package/dist/gui/components/ChatInput.d.ts.map +0 -1
  124. package/dist/gui/components/ChatInput.js.map +0 -1
  125. package/dist/gui/components/ChatInterface.d.ts +0 -12
  126. package/dist/gui/components/ChatInterface.d.ts.map +0 -1
  127. package/dist/gui/components/ChatInterface.js +0 -204
  128. package/dist/gui/components/ChatInterface.js.map +0 -1
  129. package/dist/gui/components/ChatLayout.d.ts +0 -82
  130. package/dist/gui/components/ChatLayout.js +0 -232
  131. package/dist/gui/components/ChatPanelTabContent.d.ts +0 -27
  132. package/dist/gui/components/ChatPanelTabContent.js +0 -93
  133. package/dist/gui/components/ChatPreview.d.ts +0 -12
  134. package/dist/gui/components/ChatPreview.d.ts.map +0 -1
  135. package/dist/gui/components/ChatPreview.js +0 -214
  136. package/dist/gui/components/ChatPreview.js.map +0 -1
  137. package/dist/gui/components/ChatSecondaryPanel.d.ts.map +0 -1
  138. package/dist/gui/components/ChatSecondaryPanel.js.map +0 -1
  139. package/dist/gui/components/ChatSidebar.d.ts +0 -27
  140. package/dist/gui/components/ChatSidebar.js +0 -57
  141. package/dist/gui/components/ChatStatus.d.ts.map +0 -1
  142. package/dist/gui/components/ChatStatus.js.map +0 -1
  143. package/dist/gui/components/ChatView.d.ts +0 -8
  144. package/dist/gui/components/ChatView.d.ts.map +0 -1
  145. package/dist/gui/components/ChatView.js +0 -42
  146. package/dist/gui/components/ChatView.js.map +0 -1
  147. package/dist/gui/components/ConfigPanel.d.ts +0 -20
  148. package/dist/gui/components/ConfigPanel.d.ts.map +0 -1
  149. package/dist/gui/components/ConfigPanel.js +0 -225
  150. package/dist/gui/components/ConfigPanel.js.map +0 -1
  151. package/dist/gui/components/Conversation.d.ts.map +0 -1
  152. package/dist/gui/components/Conversation.js.map +0 -1
  153. package/dist/gui/components/Dialog.d.ts.map +0 -1
  154. package/dist/gui/components/Dialog.js.map +0 -1
  155. package/dist/gui/components/DropdownMenu.d.ts +0 -108
  156. package/dist/gui/components/DropdownMenu.js +0 -215
  157. package/dist/gui/components/HeightTransition.d.ts.map +0 -1
  158. package/dist/gui/components/HeightTransition.js.map +0 -1
  159. package/dist/gui/components/Input.d.ts.map +0 -1
  160. package/dist/gui/components/Input.js.map +0 -1
  161. package/dist/gui/components/InputBox.d.ts +0 -21
  162. package/dist/gui/components/InputBox.d.ts.map +0 -1
  163. package/dist/gui/components/InputBox.js +0 -90
  164. package/dist/gui/components/InputBox.js.map +0 -1
  165. package/dist/gui/components/Label.d.ts.map +0 -1
  166. package/dist/gui/components/Label.js.map +0 -1
  167. package/dist/gui/components/MarkdownRenderer.d.ts.map +0 -1
  168. package/dist/gui/components/MarkdownRenderer.js.map +0 -1
  169. package/dist/gui/components/Message.d.ts.map +0 -1
  170. package/dist/gui/components/Message.js.map +0 -1
  171. package/dist/gui/components/MessageContent.d.ts.map +0 -1
  172. package/dist/gui/components/MessageContent.js.map +0 -1
  173. package/dist/gui/components/MessageList.d.ts.map +0 -1
  174. package/dist/gui/components/MessageList.js.map +0 -1
  175. package/dist/gui/components/PlaygroundLayout.d.ts +0 -14
  176. package/dist/gui/components/PlaygroundLayout.d.ts.map +0 -1
  177. package/dist/gui/components/PlaygroundLayout.js +0 -49
  178. package/dist/gui/components/PlaygroundLayout.js.map +0 -1
  179. package/dist/gui/components/Reasoning.d.ts.map +0 -1
  180. package/dist/gui/components/Reasoning.js.map +0 -1
  181. package/dist/gui/components/Response.d.ts.map +0 -1
  182. package/dist/gui/components/Response.js.map +0 -1
  183. package/dist/gui/components/Select.d.ts.map +0 -1
  184. package/dist/gui/components/Select.js.map +0 -1
  185. package/dist/gui/components/Sonner.d.ts +0 -7
  186. package/dist/gui/components/Sonner.js +0 -34
  187. package/dist/gui/components/StatusBar.d.ts +0 -12
  188. package/dist/gui/components/StatusBar.d.ts.map +0 -1
  189. package/dist/gui/components/StatusBar.js +0 -58
  190. package/dist/gui/components/StatusBar.js.map +0 -1
  191. package/dist/gui/components/Tabs.d.ts.map +0 -1
  192. package/dist/gui/components/Tabs.js.map +0 -1
  193. package/dist/gui/components/Task.d.ts.map +0 -1
  194. package/dist/gui/components/Task.js.map +0 -1
  195. package/dist/gui/components/Textarea.d.ts.map +0 -1
  196. package/dist/gui/components/Textarea.js.map +0 -1
  197. package/dist/gui/components/ThinkingBlock.d.ts.map +0 -1
  198. package/dist/gui/components/ThinkingBlock.js.map +0 -1
  199. package/dist/gui/components/TodoList.d.ts.map +0 -1
  200. package/dist/gui/components/TodoList.js.map +0 -1
  201. package/dist/gui/components/TodoListItem.d.ts.map +0 -1
  202. package/dist/gui/components/TodoListItem.js.map +0 -1
  203. package/dist/gui/components/index.d.ts.map +0 -1
  204. package/dist/gui/components/index.js.map +0 -1
  205. package/dist/gui/index.d.ts.map +0 -1
  206. package/dist/gui/index.js.map +0 -1
  207. package/dist/gui/lib/utils.d.ts.map +0 -1
  208. package/dist/gui/lib/utils.js.map +0 -1
  209. package/dist/index.d.ts.map +0 -1
  210. package/dist/index.js.map +0 -1
  211. package/dist/sdk/client/acp-client.d.ts.map +0 -1
  212. package/dist/sdk/client/acp-client.js.map +0 -1
  213. package/dist/sdk/client/index.d.ts.map +0 -1
  214. package/dist/sdk/client/index.js.map +0 -1
  215. package/dist/sdk/index.d.ts.map +0 -1
  216. package/dist/sdk/index.js.map +0 -1
  217. package/dist/sdk/schemas/agent.d.ts.map +0 -1
  218. package/dist/sdk/schemas/agent.js.map +0 -1
  219. package/dist/sdk/schemas/index.d.ts.map +0 -1
  220. package/dist/sdk/schemas/index.js.map +0 -1
  221. package/dist/sdk/schemas/message.d.ts.map +0 -1
  222. package/dist/sdk/schemas/message.js.map +0 -1
  223. package/dist/sdk/schemas/session.d.ts.map +0 -1
  224. package/dist/sdk/schemas/session.js.map +0 -1
  225. package/dist/sdk/transports/http.d.ts.map +0 -1
  226. package/dist/sdk/transports/http.js.map +0 -1
  227. package/dist/sdk/transports/index.d.ts.map +0 -1
  228. package/dist/sdk/transports/index.js.map +0 -1
  229. package/dist/sdk/transports/stdio.d.ts.map +0 -1
  230. package/dist/sdk/transports/stdio.js.map +0 -1
  231. package/dist/sdk/transports/types.d.ts.map +0 -1
  232. package/dist/sdk/transports/types.js.map +0 -1
  233. package/dist/sdk/transports/websocket.d.ts.map +0 -1
  234. package/dist/sdk/transports/websocket.js.map +0 -1
  235. package/dist/tui/components/ChatView.d.ts.map +0 -1
  236. package/dist/tui/components/ChatView.js.map +0 -1
  237. package/dist/tui/components/GameOfLife.d.ts.map +0 -1
  238. package/dist/tui/components/GameOfLife.js.map +0 -1
  239. package/dist/tui/components/InputBox.d.ts.map +0 -1
  240. package/dist/tui/components/InputBox.js.map +0 -1
  241. package/dist/tui/components/MessageList.d.ts.map +0 -1
  242. package/dist/tui/components/MessageList.js.map +0 -1
  243. package/dist/tui/components/ReadlineInput.d.ts.map +0 -1
  244. package/dist/tui/components/ReadlineInput.js.map +0 -1
  245. package/dist/tui/components/StatusBar.d.ts.map +0 -1
  246. package/dist/tui/components/StatusBar.js.map +0 -1
  247. package/dist/tui/components/index.d.ts.map +0 -1
  248. package/dist/tui/components/index.js.map +0 -1
  249. package/dist/tui/index.d.ts.map +0 -1
  250. package/dist/tui/index.js.map +0 -1
@@ -3,61 +3,61 @@ import type { Message, MessageChunk, SessionUpdate } from "../schemas/index.js";
3
3
  * Transport interface for different communication methods
4
4
  */
5
5
  export interface Transport {
6
- /**
7
- * Initialize the transport connection
8
- */
9
- connect(): Promise<void>;
10
- /**
11
- * Close the transport connection
12
- */
13
- disconnect(): Promise<void>;
14
- /**
15
- * Send a message through the transport
16
- */
17
- send(message: Message): Promise<void>;
18
- /**
19
- * Receive messages from the transport
20
- * Returns an async iterator for streaming support
21
- */
22
- receive(): AsyncIterableIterator<MessageChunk>;
23
- /**
24
- * Get current connection status
25
- */
26
- isConnected(): boolean;
27
- /**
28
- * Subscribe to session updates
29
- */
30
- onSessionUpdate(callback: (update: SessionUpdate) => void): () => void;
31
- /**
32
- * Subscribe to errors
33
- */
34
- onError(callback: (error: Error) => void): () => void;
6
+ /**
7
+ * Initialize the transport connection
8
+ */
9
+ connect(): Promise<void>;
10
+ /**
11
+ * Close the transport connection
12
+ */
13
+ disconnect(): Promise<void>;
14
+ /**
15
+ * Send a message through the transport
16
+ */
17
+ send(message: Message): Promise<void>;
18
+ /**
19
+ * Receive messages from the transport
20
+ * Returns an async iterator for streaming support
21
+ */
22
+ receive(): AsyncIterableIterator<MessageChunk>;
23
+ /**
24
+ * Get current connection status
25
+ */
26
+ isConnected(): boolean;
27
+ /**
28
+ * Subscribe to session updates
29
+ */
30
+ onSessionUpdate(callback: (update: SessionUpdate) => void): () => void;
31
+ /**
32
+ * Subscribe to errors
33
+ */
34
+ onError(callback: (error: Error) => void): () => void;
35
35
  }
36
36
  /**
37
37
  * Stdio transport options
38
38
  */
39
39
  export interface StdioTransportOptions {
40
- agentPath: string;
41
- agentArgs?: string[];
42
- environment?: Record<string, string>;
43
- workingDirectory?: string;
44
- timeout?: number;
40
+ agentPath: string;
41
+ agentArgs?: string[];
42
+ environment?: Record<string, string>;
43
+ workingDirectory?: string;
44
+ timeout?: number;
45
45
  }
46
46
  /**
47
47
  * HTTP transport options
48
48
  */
49
49
  export interface HttpTransportOptions {
50
- baseUrl: string;
51
- apiKey?: string;
52
- timeout?: number;
53
- headers?: Record<string, string>;
50
+ baseUrl: string;
51
+ apiKey?: string;
52
+ timeout?: number;
53
+ headers?: Record<string, string>;
54
54
  }
55
55
  /**
56
56
  * WebSocket transport options
57
57
  */
58
58
  export interface WebSocketTransportOptions {
59
- url: string;
60
- protocols?: string[];
61
- reconnect?: boolean;
62
- reconnectDelay?: number;
59
+ url: string;
60
+ protocols?: string[];
61
+ reconnect?: boolean;
62
+ reconnectDelay?: number;
63
63
  }
@@ -5,16 +5,16 @@ import type { Transport, WebSocketTransportOptions } from "./types.js";
5
5
  * Will be implemented when HTTP ACP server with WebSocket support is ready
6
6
  */
7
7
  export declare class WebSocketTransport implements Transport {
8
- private ws;
9
- private connected;
10
- private sessionUpdateCallbacks;
11
- private errorCallbacks;
12
- constructor(_options: WebSocketTransportOptions);
13
- connect(): Promise<void>;
14
- disconnect(): Promise<void>;
15
- send(_message: Message): Promise<void>;
16
- receive(): AsyncIterableIterator<MessageChunk>;
17
- isConnected(): boolean;
18
- onSessionUpdate(callback: (update: SessionUpdate) => void): () => void;
19
- onError(callback: (error: Error) => void): () => void;
8
+ private ws;
9
+ private connected;
10
+ private sessionUpdateCallbacks;
11
+ private errorCallbacks;
12
+ constructor(_options: WebSocketTransportOptions);
13
+ connect(): Promise<void>;
14
+ disconnect(): Promise<void>;
15
+ send(_message: Message): Promise<void>;
16
+ receive(): AsyncIterableIterator<MessageChunk>;
17
+ isConnected(): boolean;
18
+ onSessionUpdate(callback: (update: SessionUpdate) => void): () => void;
19
+ onError(callback: (error: Error) => void): () => void;
20
20
  }
@@ -3,56 +3,50 @@
3
3
  * Will be implemented when HTTP ACP server with WebSocket support is ready
4
4
  */
5
5
  export class WebSocketTransport {
6
- ws = null;
7
- connected = false;
8
- sessionUpdateCallbacks = new Set();
9
- errorCallbacks = new Set();
10
- // biome-ignore lint/complexity/noUselessConstructor: Constructor needed for type compatibility with other transports
11
- constructor(_options) {
12
- // Options will be used when WebSocket transport is implemented
13
- }
14
- async connect() {
15
- // TODO: Implement WebSocket connection
16
- throw new Error(
17
- "WebSocketTransport not yet implemented. Waiting for HTTP ACP server.",
18
- );
19
- }
20
- async disconnect() {
21
- if (this.ws) {
22
- this.ws.close();
23
- this.ws = null;
24
- }
25
- this.connected = false;
26
- }
27
- async send(_message) {
28
- if (!this.connected || !this.ws) {
29
- throw new Error("Transport not connected");
30
- }
31
- // TODO: Implement WebSocket message sending
32
- throw new Error(
33
- "WebSocketTransport not yet implemented. Waiting for HTTP ACP server.",
34
- );
35
- }
36
- // biome-ignore lint/correctness/useYield: .
37
- async *receive() {
38
- // TODO: Implement WebSocket message receiving
39
- throw new Error(
40
- "WebSocketTransport not yet implemented. Waiting for HTTP ACP server.",
41
- );
42
- }
43
- isConnected() {
44
- return this.connected;
45
- }
46
- onSessionUpdate(callback) {
47
- this.sessionUpdateCallbacks.add(callback);
48
- return () => {
49
- this.sessionUpdateCallbacks.delete(callback);
50
- };
51
- }
52
- onError(callback) {
53
- this.errorCallbacks.add(callback);
54
- return () => {
55
- this.errorCallbacks.delete(callback);
56
- };
57
- }
6
+ ws = null;
7
+ connected = false;
8
+ sessionUpdateCallbacks = new Set();
9
+ errorCallbacks = new Set();
10
+ // biome-ignore lint/complexity/noUselessConstructor: Constructor needed for type compatibility with other transports
11
+ constructor(_options) {
12
+ // Options will be used when WebSocket transport is implemented
13
+ }
14
+ async connect() {
15
+ // TODO: Implement WebSocket connection
16
+ throw new Error("WebSocketTransport not yet implemented. Waiting for HTTP ACP server.");
17
+ }
18
+ async disconnect() {
19
+ if (this.ws) {
20
+ this.ws.close();
21
+ this.ws = null;
22
+ }
23
+ this.connected = false;
24
+ }
25
+ async send(_message) {
26
+ if (!this.connected || !this.ws) {
27
+ throw new Error("Transport not connected");
28
+ }
29
+ // TODO: Implement WebSocket message sending
30
+ throw new Error("WebSocketTransport not yet implemented. Waiting for HTTP ACP server.");
31
+ }
32
+ // biome-ignore lint/correctness/useYield: .
33
+ async *receive() {
34
+ // TODO: Implement WebSocket message receiving
35
+ throw new Error("WebSocketTransport not yet implemented. Waiting for HTTP ACP server.");
36
+ }
37
+ isConnected() {
38
+ return this.connected;
39
+ }
40
+ onSessionUpdate(callback) {
41
+ this.sessionUpdateCallbacks.add(callback);
42
+ return () => {
43
+ this.sessionUpdateCallbacks.delete(callback);
44
+ };
45
+ }
46
+ onError(callback) {
47
+ this.errorCallbacks.add(callback);
48
+ return () => {
49
+ this.errorCallbacks.delete(callback);
50
+ };
51
+ }
58
52
  }
@@ -1,7 +1,5 @@
1
1
  import type { AcpClient } from "../../sdk/client/index.js";
2
2
  export interface ChatViewProps {
3
- client: AcpClient | null;
3
+ client: AcpClient | null;
4
4
  }
5
- export declare function ChatView({
6
- client,
7
- }: ChatViewProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function ChatView({ client }: ChatViewProps): import("react/jsx-runtime").JSX.Element;
@@ -1,57 +1,24 @@
1
- import { Box } from "ink";
2
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import {
4
- useChatInput,
5
- useChatMessages,
6
- useChatSession,
7
- useChatStore,
8
- } from "../../core/index.js";
2
+ import { Box } from "ink";
3
+ import { useChatInput, useChatMessages, useChatSession, useChatStore, } from "../../core/index.js";
9
4
  import { InputBox } from "./InputBox.js";
10
5
  import { MessageList } from "./MessageList.js";
11
6
  import { StatusBar } from "./StatusBar.js";
12
7
  export function ChatView({ client }) {
13
- const setIsStreaming = useChatStore((state) => state.setIsStreaming);
14
- const streamingStartTime = useChatStore((state) => state.streamingStartTime);
15
- // Use headless hooks for business logic
16
- const { connectionStatus, sessionId } = useChatSession(client);
17
- const { messages, isStreaming } = useChatMessages(client);
18
- const { value, isSubmitting, attachedFiles, onChange, onSubmit } =
19
- useChatInput(client);
20
- // Check if we're actively receiving content (hide waiting indicator)
21
- const hasStreamingContent = messages.some(
22
- (msg) => msg.isStreaming && msg.content.length > 0,
23
- );
24
- // Callbacks for keyboard shortcuts
25
- const handleEscape = () => {
26
- if (isStreaming) {
27
- // TODO: Implement proper cancellation when SDK supports it
28
- setIsStreaming(false);
29
- }
30
- };
31
- return _jsxs(Box, {
32
- flexDirection: "column",
33
- height: "100%",
34
- children: [
35
- _jsx(Box, {
36
- flexGrow: 1,
37
- flexDirection: "column",
38
- children: _jsx(MessageList, { messages: messages }),
39
- }),
40
- _jsx(InputBox, {
41
- value: value,
42
- isSubmitting: isSubmitting,
43
- attachedFiles: attachedFiles,
44
- onChange: onChange,
45
- onSubmit: onSubmit,
46
- onEscape: handleEscape,
47
- }),
48
- _jsx(StatusBar, {
49
- connectionStatus: connectionStatus,
50
- sessionId: sessionId,
51
- isStreaming: isStreaming,
52
- streamingStartTime: streamingStartTime,
53
- hasStreamingContent: hasStreamingContent,
54
- }),
55
- ],
56
- });
8
+ const setIsStreaming = useChatStore((state) => state.setIsStreaming);
9
+ const streamingStartTime = useChatStore((state) => state.streamingStartTime);
10
+ // Use headless hooks for business logic
11
+ const { connectionStatus, sessionId } = useChatSession(client);
12
+ const { messages, isStreaming } = useChatMessages(client);
13
+ const { value, isSubmitting, attachedFiles, onChange, onSubmit } = useChatInput(client);
14
+ // Check if we're actively receiving content (hide waiting indicator)
15
+ const hasStreamingContent = messages.some((msg) => msg.isStreaming && msg.content.length > 0);
16
+ // Callbacks for keyboard shortcuts
17
+ const handleEscape = () => {
18
+ if (isStreaming) {
19
+ // TODO: Implement proper cancellation when SDK supports it
20
+ setIsStreaming(false);
21
+ }
22
+ };
23
+ return (_jsxs(Box, { flexDirection: "column", height: "100%", children: [_jsx(Box, { flexGrow: 1, flexDirection: "column", children: _jsx(MessageList, { messages: messages }) }), _jsx(InputBox, { value: value, isSubmitting: isSubmitting, attachedFiles: attachedFiles, onChange: onChange, onSubmit: onSubmit, onEscape: handleEscape }), _jsx(StatusBar, { connectionStatus: connectionStatus, sessionId: sessionId, isStreaming: isStreaming, streamingStartTime: streamingStartTime, hasStreamingContent: hasStreamingContent })] }));
57
24
  }
@@ -1,79 +1,50 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
1
2
  import { Box, Text } from "ink";
2
3
  import { useEffect, useState } from "react";
3
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
-
5
4
  const ROWS = 12;
6
5
  const COLS = 60;
7
6
  // Initialize with a random pattern
8
7
  function createRandomGrid() {
9
- return Array.from({ length: ROWS }, () =>
10
- Array.from({ length: COLS }, () => Math.random() < 0.3),
11
- );
8
+ return Array.from({ length: ROWS }, () => Array.from({ length: COLS }, () => Math.random() < 0.3));
12
9
  }
13
10
  // Count living neighbors
14
11
  function countNeighbors(grid, row, col) {
15
- let count = 0;
16
- for (let i = -1; i <= 1; i++) {
17
- for (let j = -1; j <= 1; j++) {
18
- if (i === 0 && j === 0) continue;
19
- const newRow = (row + i + ROWS) % ROWS;
20
- const newCol = (col + j + COLS) % COLS;
21
- if (grid[newRow]?.[newCol]) count++;
22
- }
23
- }
24
- return count;
12
+ let count = 0;
13
+ for (let i = -1; i <= 1; i++) {
14
+ for (let j = -1; j <= 1; j++) {
15
+ if (i === 0 && j === 0)
16
+ continue;
17
+ const newRow = (row + i + ROWS) % ROWS;
18
+ const newCol = (col + j + COLS) % COLS;
19
+ if (grid[newRow]?.[newCol])
20
+ count++;
21
+ }
22
+ }
23
+ return count;
25
24
  }
26
25
  // Compute next generation
27
26
  function nextGeneration(grid) {
28
- return grid.map((row, i) =>
29
- row.map((cell, j) => {
30
- const neighbors = countNeighbors(grid, i, j);
31
- if (cell) {
32
- return neighbors === 2 || neighbors === 3;
33
- } else {
34
- return neighbors === 3;
35
- }
36
- }),
37
- );
27
+ return grid.map((row, i) => row.map((cell, j) => {
28
+ const neighbors = countNeighbors(grid, i, j);
29
+ if (cell) {
30
+ return neighbors === 2 || neighbors === 3;
31
+ }
32
+ else {
33
+ return neighbors === 3;
34
+ }
35
+ }));
38
36
  }
39
37
  export function GameOfLife() {
40
- const [grid, setGrid] = useState(createRandomGrid);
41
- const [generation, setGeneration] = useState(0);
42
- // Generate stable row IDs on mount
43
- const rowIds = useState(() =>
44
- Array.from({ length: ROWS }, (_, i) => `row-${i}`),
45
- )[0];
46
- useEffect(() => {
47
- const interval = setInterval(() => {
48
- setGrid((prevGrid) => nextGeneration(prevGrid));
49
- setGeneration((prev) => prev + 1);
50
- }, 150);
51
- return () => clearInterval(interval);
52
- }, []);
53
- return _jsxs(Box, {
54
- flexDirection: "column",
55
- paddingX: 1,
56
- children: [
57
- _jsxs(Text, {
58
- color: "gray",
59
- italic: true,
60
- children: ["Conway's Game of Life (generation ", generation, ")"],
61
- }),
62
- grid.map((row, i) =>
63
- _jsx(
64
- Text,
65
- {
66
- color: "green",
67
- children: row.map((cell) => (cell ? "█" : " ")).join(""),
68
- },
69
- rowIds[i],
70
- ),
71
- ),
72
- _jsx(Text, {
73
- color: "gray",
74
- italic: true,
75
- children: "Start typing to begin...",
76
- }),
77
- ],
78
- });
38
+ const [grid, setGrid] = useState(createRandomGrid);
39
+ const [generation, setGeneration] = useState(0);
40
+ // Generate stable row IDs on mount
41
+ const rowIds = useState(() => Array.from({ length: ROWS }, (_, i) => `row-${i}`))[0];
42
+ useEffect(() => {
43
+ const interval = setInterval(() => {
44
+ setGrid((prevGrid) => nextGeneration(prevGrid));
45
+ setGeneration((prev) => prev + 1);
46
+ }, 150);
47
+ return () => clearInterval(interval);
48
+ }, []);
49
+ return (_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsxs(Text, { color: "gray", italic: true, children: ["Conway's Game of Life (generation ", generation, ")"] }), grid.map((row, i) => (_jsx(Text, { color: "green", children: row.map((cell) => (cell ? "█" : " ")).join("") }, rowIds[i]))), _jsx(Text, { color: "gray", italic: true, children: "Start typing to begin..." })] }));
79
50
  }
@@ -1,20 +1,13 @@
1
1
  export interface InputBoxProps {
2
- value: string;
3
- isSubmitting: boolean;
4
- attachedFiles: Array<{
5
- name: string;
6
- path: string;
7
- size: number;
8
- }>;
9
- onChange: (value: string) => void;
10
- onSubmit: () => void;
11
- onEscape?: () => void;
2
+ value: string;
3
+ isSubmitting: boolean;
4
+ attachedFiles: Array<{
5
+ name: string;
6
+ path: string;
7
+ size: number;
8
+ }>;
9
+ onChange: (value: string) => void;
10
+ onSubmit: () => void;
11
+ onEscape?: () => void;
12
12
  }
13
- export declare function InputBox({
14
- value,
15
- isSubmitting,
16
- attachedFiles,
17
- onChange,
18
- onSubmit,
19
- onEscape,
20
- }: InputBoxProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function InputBox({ value, isSubmitting, attachedFiles, onChange, onSubmit, onEscape, }: InputBoxProps): import("react/jsx-runtime").JSX.Element;
@@ -1,75 +1,15 @@
1
- import { Box, Text, useStdout } from "ink";
2
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text, useStdout } from "ink";
3
3
  import { ReadlineInput } from "./ReadlineInput.js";
4
- export function InputBox({
5
- value,
6
- isSubmitting,
7
- attachedFiles,
8
- onChange,
9
- onSubmit,
10
- onEscape,
11
- }) {
12
- const { stdout } = useStdout();
13
- const terminalWidth = stdout?.columns || 80;
14
- return _jsxs(Box, {
15
- flexDirection: "column",
16
- children: [
17
- _jsx(Text, { color: "blue", children: "─".repeat(terminalWidth) }),
18
- attachedFiles.length > 0 &&
19
- _jsxs(Box, {
20
- flexDirection: "column",
21
- paddingTop: 1,
22
- children: [
23
- _jsx(Text, { dimColor: true, children: "Attached files:" }),
24
- attachedFiles.map((file) =>
25
- _jsxs(
26
- Box,
27
- {
28
- children: [
29
- _jsxs(Text, { color: "cyan", children: [" ", file.name] }),
30
- _jsxs(Text, {
31
- dimColor: true,
32
- children: [" (", formatFileSize(file.size), ")"],
33
- }),
34
- ],
35
- },
36
- file.path,
37
- ),
38
- ),
39
- ],
40
- }),
41
- _jsxs(Box, {
42
- paddingY: 1,
43
- children: [
44
- _jsx(Text, { bold: true, color: "blue", children: "> " }),
45
- isSubmitting
46
- ? _jsx(Text, {
47
- color: "gray",
48
- italic: true,
49
- children: "Sending...",
50
- })
51
- : onEscape
52
- ? _jsx(ReadlineInput, {
53
- value: value,
54
- onChange: onChange,
55
- onSubmit: onSubmit,
56
- onEscape: onEscape,
57
- placeholder: "Type your message...",
58
- })
59
- : _jsx(ReadlineInput, {
60
- value: value,
61
- onChange: onChange,
62
- onSubmit: onSubmit,
63
- placeholder: "Type your message...",
64
- }),
65
- ],
66
- }),
67
- _jsx(Text, { color: "blue", children: "─".repeat(terminalWidth) }),
68
- ],
69
- });
4
+ export function InputBox({ value, isSubmitting, attachedFiles, onChange, onSubmit, onEscape, }) {
5
+ const { stdout } = useStdout();
6
+ const terminalWidth = stdout?.columns || 80;
7
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "blue", children: "─".repeat(terminalWidth) }), attachedFiles.length > 0 && (_jsxs(Box, { flexDirection: "column", paddingTop: 1, children: [_jsx(Text, { dimColor: true, children: "Attached files:" }), attachedFiles.map((file) => (_jsxs(Box, { children: [_jsxs(Text, { color: "cyan", children: [" ", file.name] }), _jsxs(Text, { dimColor: true, children: [" (", formatFileSize(file.size), ")"] })] }, file.path)))] })), _jsxs(Box, { paddingY: 1, children: [_jsx(Text, { bold: true, color: "blue", children: "> " }), isSubmitting ? (_jsx(Text, { color: "gray", italic: true, children: "Sending..." })) : onEscape ? (_jsx(ReadlineInput, { value: value, onChange: onChange, onSubmit: onSubmit, onEscape: onEscape, placeholder: "Type your message..." })) : (_jsx(ReadlineInput, { value: value, onChange: onChange, onSubmit: onSubmit, placeholder: "Type your message..." }))] }), _jsx(Text, { color: "blue", children: "─".repeat(terminalWidth) })] }));
70
8
  }
71
9
  function formatFileSize(bytes) {
72
- if (bytes < 1024) return `${bytes} B`;
73
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
74
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
10
+ if (bytes < 1024)
11
+ return `${bytes} B`;
12
+ if (bytes < 1024 * 1024)
13
+ return `${(bytes / 1024).toFixed(1)} KB`;
14
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
75
15
  }
@@ -1,7 +1,5 @@
1
1
  import type { DisplayMessage } from "../../core/index.js";
2
2
  export interface MessageListProps {
3
- messages: DisplayMessage[];
3
+ messages: DisplayMessage[];
4
4
  }
5
- export declare function MessageList({
6
- messages,
7
- }: MessageListProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function MessageList({ messages }: MessageListProps): import("react/jsx-runtime").JSX.Element;
@@ -1,43 +1,16 @@
1
- import { Box, Text } from "ink";
2
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from "ink";
3
3
  import { GameOfLife } from "./GameOfLife.js";
4
4
  export function MessageList({ messages }) {
5
- return _jsx(Box, {
6
- flexDirection: "column",
7
- paddingX: 1,
8
- paddingY: 1,
9
- children:
10
- messages.length === 0
11
- ? _jsx(GameOfLife, {})
12
- : messages.map((message) =>
13
- _jsx(Message, { message: message }, message.id),
14
- ),
15
- });
5
+ return (_jsx(Box, { flexDirection: "column", paddingX: 1, paddingY: 1, children: messages.length === 0 ? (_jsx(GameOfLife, {})) : (messages.map((message) => (_jsx(Message, { message: message }, message.id)))) }));
16
6
  }
17
7
  function Message({ message }) {
18
- const roleColor =
19
- message.role === "user"
20
- ? "blue"
21
- : message.role === "assistant"
22
- ? "green"
23
- : "gray";
24
- const roleSymbol =
25
- message.role === "user" ? ">" : message.role === "assistant" ? "" : "•";
26
- const trimmedContent = message.content?.trim() || "";
27
- return _jsx(Box, {
28
- flexDirection: "column",
29
- marginY: 1,
30
- children: _jsxs(Box, {
31
- children: [
32
- _jsxs(Text, {
33
- bold: true,
34
- color: roleColor,
35
- children: [roleSymbol, " "],
36
- }),
37
- message.role === "user"
38
- ? _jsx(Text, { backgroundColor: "gray", children: trimmedContent })
39
- : _jsx(Text, { children: trimmedContent }),
40
- ],
41
- }),
42
- });
8
+ const roleColor = message.role === "user"
9
+ ? "blue"
10
+ : message.role === "assistant"
11
+ ? "green"
12
+ : "gray";
13
+ const roleSymbol = message.role === "user" ? ">" : message.role === "assistant" ? "⏺" : "•";
14
+ const trimmedContent = message.content?.trim() || "";
15
+ return (_jsx(Box, { flexDirection: "column", marginY: 1, children: _jsxs(Box, { children: [_jsxs(Text, { bold: true, color: roleColor, children: [roleSymbol, " "] }), message.role === "user" ? (_jsx(Text, { backgroundColor: "gray", children: trimmedContent })) : (_jsx(Text, { children: trimmedContent }))] }) }));
43
16
  }
@@ -1,19 +1,14 @@
1
1
  export interface MultiSelectOption {
2
- label: string;
3
- value: string;
4
- description?: string;
2
+ label: string;
3
+ value: string;
4
+ description?: string;
5
5
  }
6
6
  export interface MultiSelectProps {
7
- options: MultiSelectOption[];
8
- selected: string[];
9
- onChange: (selected: string[]) => void;
10
- onSubmit: () => void;
11
- onCancel?: () => void;
7
+ options: MultiSelectOption[];
8
+ selected: string[];
9
+ onChange: (selected: string[]) => void;
10
+ onSubmit: () => void;
11
+ onCancel?: () => void;
12
+ autoAdvanceOnSelect?: boolean;
12
13
  }
13
- export declare function MultiSelect({
14
- options,
15
- selected,
16
- onChange,
17
- onSubmit,
18
- onCancel,
19
- }: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function MultiSelect({ options, selected, onChange, onSubmit, onCancel, autoAdvanceOnSelect, }: MultiSelectProps): import("react/jsx-runtime").JSX.Element;