@townco/ui 0.1.17 → 0.1.19

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 (214) hide show
  1. package/dist/core/hooks/use-chat-input.d.ts +17 -17
  2. package/dist/core/hooks/use-chat-input.js +55 -64
  3. package/dist/core/hooks/use-chat-messages.js +114 -121
  4. package/dist/core/hooks/use-chat-session.d.ts +1 -1
  5. package/dist/core/hooks/use-chat-session.js +80 -78
  6. package/dist/gui/components/Button.d.ts +7 -23
  7. package/dist/gui/components/Button.js +27 -40
  8. package/dist/gui/components/Card.d.ts +7 -26
  9. package/dist/gui/components/Card.js +8 -54
  10. package/dist/gui/components/ChatEmptyState.d.ts +18 -0
  11. package/dist/gui/components/ChatEmptyState.js +22 -0
  12. package/dist/gui/components/ChatInput.js +29 -1
  13. package/dist/gui/components/ChatLayout.js +2 -2
  14. package/dist/gui/components/ChatSecondaryPanel.d.ts +25 -14
  15. package/dist/gui/components/ChatSecondaryPanel.js +60 -115
  16. package/dist/gui/components/ChatStatus.d.ts +2 -4
  17. package/dist/gui/components/ChatStatus.js +34 -45
  18. package/dist/gui/components/Conversation.d.ts +14 -17
  19. package/dist/gui/components/Conversation.js +83 -143
  20. package/dist/gui/components/Dialog.d.ts +11 -57
  21. package/dist/gui/components/HeightTransition.d.ts +7 -12
  22. package/dist/gui/components/HeightTransition.js +77 -88
  23. package/dist/gui/components/Input.d.ts +6 -13
  24. package/dist/gui/components/Input.js +16 -27
  25. package/dist/gui/components/Label.d.ts +1 -7
  26. package/dist/gui/components/MarkdownRenderer.d.ts +4 -6
  27. package/dist/gui/components/MarkdownRenderer.js +81 -178
  28. package/dist/gui/components/Message.d.ts +1 -1
  29. package/dist/gui/components/MessageContent.d.ts +22 -29
  30. package/dist/gui/components/PanelTabsHeader.d.ts +17 -0
  31. package/dist/gui/components/PanelTabsHeader.js +31 -0
  32. package/dist/gui/components/Reasoning.d.ts +24 -30
  33. package/dist/gui/components/Reasoning.js +60 -187
  34. package/dist/gui/components/Response.d.ts +9 -11
  35. package/dist/gui/components/Response.js +90 -229
  36. package/dist/gui/components/Select.d.ts +10 -69
  37. package/dist/gui/components/Tabs.d.ts +4 -24
  38. package/dist/gui/components/Task.d.ts +24 -28
  39. package/dist/gui/components/Task.js +31 -164
  40. package/dist/gui/components/Textarea.d.ts +7 -15
  41. package/dist/gui/components/Textarea.js +46 -63
  42. package/dist/gui/components/ThinkingBlock.d.ts +10 -20
  43. package/dist/gui/components/ThinkingBlock.js +35 -134
  44. package/dist/gui/components/TodoList.d.ts +10 -12
  45. package/dist/gui/components/TodoList.js +7 -22
  46. package/dist/gui/components/TodoListItem.d.ts +6 -9
  47. package/dist/gui/components/TodoListItem.js +4 -18
  48. package/dist/gui/components/index.d.ts +2 -0
  49. package/dist/gui/components/index.js +2 -0
  50. package/dist/gui/lib/utils.js +1 -1
  51. package/dist/index.test.js +1 -0
  52. package/dist/sdk/client/acp-client.d.ts +76 -88
  53. package/dist/sdk/client/acp-client.js +217 -215
  54. package/dist/sdk/schemas/agent.d.ts +64 -111
  55. package/dist/sdk/schemas/agent.js +24 -24
  56. package/dist/sdk/schemas/message.d.ts +147 -245
  57. package/dist/sdk/schemas/message.js +40 -40
  58. package/dist/sdk/schemas/session.d.ts +6 -6
  59. package/dist/sdk/transports/http.d.ts +55 -55
  60. package/dist/sdk/transports/http.js +3 -3
  61. package/dist/sdk/transports/stdio.d.ts +20 -20
  62. package/dist/sdk/transports/types.d.ts +42 -42
  63. package/dist/sdk/transports/websocket.d.ts +12 -12
  64. package/dist/sdk/transports/websocket.js +46 -52
  65. package/dist/tui/components/ChatView.d.ts +2 -4
  66. package/dist/tui/components/GameOfLife.js +35 -64
  67. package/dist/tui/components/InputBox.d.ts +11 -18
  68. package/dist/tui/components/InputBox.js +10 -70
  69. package/dist/tui/components/ReadlineInput.d.ts +6 -12
  70. package/dist/tui/components/ReadlineInput.js +237 -252
  71. package/dist/tui/components/SingleSelect.d.ts +9 -15
  72. package/dist/tui/components/SingleSelect.js +43 -84
  73. package/dist/tui/components/StatusBar.d.ts +6 -11
  74. package/dist/tui/components/StatusBar.js +67 -102
  75. package/package.json +2 -2
  76. package/src/styles/global.css +64 -0
  77. package/dist/core/hooks/index.d.ts.map +0 -1
  78. package/dist/core/hooks/index.js.map +0 -1
  79. package/dist/core/hooks/use-chat-input.d.ts.map +0 -1
  80. package/dist/core/hooks/use-chat-input.js.map +0 -1
  81. package/dist/core/hooks/use-chat-messages.d.ts.map +0 -1
  82. package/dist/core/hooks/use-chat-messages.js.map +0 -1
  83. package/dist/core/hooks/use-chat-session.d.ts.map +0 -1
  84. package/dist/core/hooks/use-chat-session.js.map +0 -1
  85. package/dist/core/index.d.ts.map +0 -1
  86. package/dist/core/index.js.map +0 -1
  87. package/dist/core/schemas/chat.d.ts.map +0 -1
  88. package/dist/core/schemas/chat.js.map +0 -1
  89. package/dist/core/schemas/index.d.ts.map +0 -1
  90. package/dist/core/schemas/index.js.map +0 -1
  91. package/dist/core/store/chat-store.d.ts.map +0 -1
  92. package/dist/core/store/chat-store.js.map +0 -1
  93. package/dist/gui/components/Button.d.ts.map +0 -1
  94. package/dist/gui/components/Button.js.map +0 -1
  95. package/dist/gui/components/Card.d.ts.map +0 -1
  96. package/dist/gui/components/Card.js.map +0 -1
  97. package/dist/gui/components/ChatInput.d.ts.map +0 -1
  98. package/dist/gui/components/ChatInput.js.map +0 -1
  99. package/dist/gui/components/ChatInterface.d.ts +0 -12
  100. package/dist/gui/components/ChatInterface.d.ts.map +0 -1
  101. package/dist/gui/components/ChatInterface.js +0 -204
  102. package/dist/gui/components/ChatInterface.js.map +0 -1
  103. package/dist/gui/components/ChatPreview.d.ts +0 -12
  104. package/dist/gui/components/ChatPreview.d.ts.map +0 -1
  105. package/dist/gui/components/ChatPreview.js +0 -214
  106. package/dist/gui/components/ChatPreview.js.map +0 -1
  107. package/dist/gui/components/ChatSecondaryPanel.d.ts.map +0 -1
  108. package/dist/gui/components/ChatSecondaryPanel.js.map +0 -1
  109. package/dist/gui/components/ChatStatus.d.ts.map +0 -1
  110. package/dist/gui/components/ChatStatus.js.map +0 -1
  111. package/dist/gui/components/ChatView.d.ts +0 -8
  112. package/dist/gui/components/ChatView.d.ts.map +0 -1
  113. package/dist/gui/components/ChatView.js +0 -42
  114. package/dist/gui/components/ChatView.js.map +0 -1
  115. package/dist/gui/components/ConfigPanel.d.ts +0 -20
  116. package/dist/gui/components/ConfigPanel.d.ts.map +0 -1
  117. package/dist/gui/components/ConfigPanel.js +0 -225
  118. package/dist/gui/components/ConfigPanel.js.map +0 -1
  119. package/dist/gui/components/Conversation.d.ts.map +0 -1
  120. package/dist/gui/components/Conversation.js.map +0 -1
  121. package/dist/gui/components/Dialog.d.ts.map +0 -1
  122. package/dist/gui/components/Dialog.js.map +0 -1
  123. package/dist/gui/components/HeightTransition.d.ts.map +0 -1
  124. package/dist/gui/components/HeightTransition.js.map +0 -1
  125. package/dist/gui/components/Input.d.ts.map +0 -1
  126. package/dist/gui/components/Input.js.map +0 -1
  127. package/dist/gui/components/InputBox.d.ts +0 -21
  128. package/dist/gui/components/InputBox.d.ts.map +0 -1
  129. package/dist/gui/components/InputBox.js +0 -90
  130. package/dist/gui/components/InputBox.js.map +0 -1
  131. package/dist/gui/components/Label.d.ts.map +0 -1
  132. package/dist/gui/components/Label.js.map +0 -1
  133. package/dist/gui/components/MarkdownRenderer.d.ts.map +0 -1
  134. package/dist/gui/components/MarkdownRenderer.js.map +0 -1
  135. package/dist/gui/components/Message.d.ts.map +0 -1
  136. package/dist/gui/components/Message.js.map +0 -1
  137. package/dist/gui/components/MessageContent.d.ts.map +0 -1
  138. package/dist/gui/components/MessageContent.js.map +0 -1
  139. package/dist/gui/components/MessageList.d.ts.map +0 -1
  140. package/dist/gui/components/MessageList.js.map +0 -1
  141. package/dist/gui/components/PlaygroundLayout.d.ts +0 -14
  142. package/dist/gui/components/PlaygroundLayout.d.ts.map +0 -1
  143. package/dist/gui/components/PlaygroundLayout.js +0 -49
  144. package/dist/gui/components/PlaygroundLayout.js.map +0 -1
  145. package/dist/gui/components/Reasoning.d.ts.map +0 -1
  146. package/dist/gui/components/Reasoning.js.map +0 -1
  147. package/dist/gui/components/Response.d.ts.map +0 -1
  148. package/dist/gui/components/Response.js.map +0 -1
  149. package/dist/gui/components/Select.d.ts.map +0 -1
  150. package/dist/gui/components/Select.js.map +0 -1
  151. package/dist/gui/components/StatusBar.d.ts +0 -12
  152. package/dist/gui/components/StatusBar.d.ts.map +0 -1
  153. package/dist/gui/components/StatusBar.js +0 -58
  154. package/dist/gui/components/StatusBar.js.map +0 -1
  155. package/dist/gui/components/Tabs.d.ts.map +0 -1
  156. package/dist/gui/components/Tabs.js.map +0 -1
  157. package/dist/gui/components/Task.d.ts.map +0 -1
  158. package/dist/gui/components/Task.js.map +0 -1
  159. package/dist/gui/components/Textarea.d.ts.map +0 -1
  160. package/dist/gui/components/Textarea.js.map +0 -1
  161. package/dist/gui/components/ThinkingBlock.d.ts.map +0 -1
  162. package/dist/gui/components/ThinkingBlock.js.map +0 -1
  163. package/dist/gui/components/TodoList.d.ts.map +0 -1
  164. package/dist/gui/components/TodoList.js.map +0 -1
  165. package/dist/gui/components/TodoListItem.d.ts.map +0 -1
  166. package/dist/gui/components/TodoListItem.js.map +0 -1
  167. package/dist/gui/components/index.d.ts.map +0 -1
  168. package/dist/gui/components/index.js.map +0 -1
  169. package/dist/gui/index.d.ts.map +0 -1
  170. package/dist/gui/index.js.map +0 -1
  171. package/dist/gui/lib/utils.d.ts.map +0 -1
  172. package/dist/gui/lib/utils.js.map +0 -1
  173. package/dist/index.d.ts.map +0 -1
  174. package/dist/index.js.map +0 -1
  175. package/dist/sdk/client/acp-client.d.ts.map +0 -1
  176. package/dist/sdk/client/acp-client.js.map +0 -1
  177. package/dist/sdk/client/index.d.ts.map +0 -1
  178. package/dist/sdk/client/index.js.map +0 -1
  179. package/dist/sdk/index.d.ts.map +0 -1
  180. package/dist/sdk/index.js.map +0 -1
  181. package/dist/sdk/schemas/agent.d.ts.map +0 -1
  182. package/dist/sdk/schemas/agent.js.map +0 -1
  183. package/dist/sdk/schemas/index.d.ts.map +0 -1
  184. package/dist/sdk/schemas/index.js.map +0 -1
  185. package/dist/sdk/schemas/message.d.ts.map +0 -1
  186. package/dist/sdk/schemas/message.js.map +0 -1
  187. package/dist/sdk/schemas/session.d.ts.map +0 -1
  188. package/dist/sdk/schemas/session.js.map +0 -1
  189. package/dist/sdk/transports/http.d.ts.map +0 -1
  190. package/dist/sdk/transports/http.js.map +0 -1
  191. package/dist/sdk/transports/index.d.ts.map +0 -1
  192. package/dist/sdk/transports/index.js.map +0 -1
  193. package/dist/sdk/transports/stdio.d.ts.map +0 -1
  194. package/dist/sdk/transports/stdio.js.map +0 -1
  195. package/dist/sdk/transports/types.d.ts.map +0 -1
  196. package/dist/sdk/transports/types.js.map +0 -1
  197. package/dist/sdk/transports/websocket.d.ts.map +0 -1
  198. package/dist/sdk/transports/websocket.js.map +0 -1
  199. package/dist/tui/components/ChatView.d.ts.map +0 -1
  200. package/dist/tui/components/ChatView.js.map +0 -1
  201. package/dist/tui/components/GameOfLife.d.ts.map +0 -1
  202. package/dist/tui/components/GameOfLife.js.map +0 -1
  203. package/dist/tui/components/InputBox.d.ts.map +0 -1
  204. package/dist/tui/components/InputBox.js.map +0 -1
  205. package/dist/tui/components/MessageList.d.ts.map +0 -1
  206. package/dist/tui/components/MessageList.js.map +0 -1
  207. package/dist/tui/components/ReadlineInput.d.ts.map +0 -1
  208. package/dist/tui/components/ReadlineInput.js.map +0 -1
  209. package/dist/tui/components/StatusBar.d.ts.map +0 -1
  210. package/dist/tui/components/StatusBar.js.map +0 -1
  211. package/dist/tui/components/index.d.ts.map +0 -1
  212. package/dist/tui/components/index.js.map +0 -1
  213. package/dist/tui/index.d.ts.map +0 -1
  214. package/dist/tui/index.js.map +0 -1
@@ -3,12 +3,12 @@ import { z } from "zod";
3
3
  * Session status
4
4
  */
5
5
  export declare const SessionStatus: z.ZodEnum<{
6
+ error: "error";
6
7
  idle: "idle";
7
8
  connecting: "connecting";
8
9
  connected: "connected";
9
10
  active: "active";
10
11
  streaming: "streaming";
11
- error: "error";
12
12
  disconnected: "disconnected";
13
13
  }>;
14
14
  export type SessionStatus = z.infer<typeof SessionStatus>;
@@ -40,12 +40,12 @@ export type SessionMetadata = z.infer<typeof SessionMetadata>;
40
40
  export declare const Session: z.ZodObject<{
41
41
  id: z.ZodString;
42
42
  status: z.ZodEnum<{
43
+ error: "error";
43
44
  idle: "idle";
44
45
  connecting: "connecting";
45
46
  connected: "connected";
46
47
  active: "active";
47
48
  streaming: "streaming";
48
- error: "error";
49
49
  disconnected: "disconnected";
50
50
  }>;
51
51
  config: z.ZodObject<{
@@ -108,12 +108,12 @@ export type Session = z.infer<typeof Session>;
108
108
  export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
109
109
  sessionId: z.ZodString;
110
110
  status: z.ZodOptional<z.ZodEnum<{
111
+ error: "error";
111
112
  idle: "idle";
112
113
  connecting: "connecting";
113
114
  connected: "connected";
114
115
  active: "active";
115
116
  streaming: "streaming";
116
- error: "error";
117
117
  disconnected: "disconnected";
118
118
  }>>;
119
119
  message: z.ZodOptional<z.ZodObject<{
@@ -214,12 +214,12 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
214
214
  }, z.core.$strip>, z.ZodObject<{
215
215
  sessionId: z.ZodString;
216
216
  status: z.ZodOptional<z.ZodEnum<{
217
+ error: "error";
217
218
  idle: "idle";
218
219
  connecting: "connecting";
219
220
  connected: "connected";
220
221
  active: "active";
221
222
  streaming: "streaming";
222
- error: "error";
223
223
  disconnected: "disconnected";
224
224
  }>>;
225
225
  message: z.ZodOptional<z.ZodObject<{
@@ -305,12 +305,12 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
305
305
  }, z.core.$strip>, z.ZodObject<{
306
306
  sessionId: z.ZodString;
307
307
  status: z.ZodOptional<z.ZodEnum<{
308
+ error: "error";
308
309
  idle: "idle";
309
310
  connecting: "connecting";
310
311
  connected: "connected";
311
312
  active: "active";
312
313
  streaming: "streaming";
313
- error: "error";
314
314
  disconnected: "disconnected";
315
315
  }>>;
316
316
  message: z.ZodOptional<z.ZodObject<{
@@ -361,12 +361,12 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
361
361
  }, z.core.$strip>, z.ZodObject<{
362
362
  sessionId: z.ZodString;
363
363
  status: z.ZodOptional<z.ZodEnum<{
364
+ error: "error";
364
365
  idle: "idle";
365
366
  connecting: "connecting";
366
367
  connected: "connected";
367
368
  active: "active";
368
369
  streaming: "streaming";
369
- error: "error";
370
370
  disconnected: "disconnected";
371
371
  }>>;
372
372
  message: z.ZodOptional<z.ZodObject<{
@@ -5,59 +5,59 @@ import type { HttpTransportOptions, Transport } from "./types.js";
5
5
  * Uses POST /rpc for client->agent messages and GET /events (SSE) for agent->client
6
6
  */
7
7
  export declare class HttpTransport implements Transport {
8
- private connected;
9
- private sessionUpdateCallbacks;
10
- private errorCallbacks;
11
- private messageQueue;
12
- private currentSessionId;
13
- private chunkResolvers;
14
- private streamComplete;
15
- private sseAbortController;
16
- private reconnectAttempts;
17
- private maxReconnectAttempts;
18
- private reconnectDelay;
19
- private reconnecting;
20
- private abortController;
21
- private options;
22
- constructor(options: HttpTransportOptions);
23
- connect(): Promise<void>;
24
- disconnect(): Promise<void>;
25
- send(message: Message): Promise<void>;
26
- receive(): AsyncIterableIterator<MessageChunk>;
27
- isConnected(): boolean;
28
- onSessionUpdate(callback: (update: SessionUpdate) => void): () => void;
29
- onError(callback: (error: Error) => void): () => void;
30
- /**
31
- * Send an ACP RPC request to the server
32
- */
33
- private sendRpcRequest;
34
- /**
35
- * Connect to the SSE event stream
36
- * Uses fetch-based SSE to support custom headers (X-Session-ID)
37
- */
38
- private connectSSE;
39
- /**
40
- * Handle SSE disconnection with automatic reconnection
41
- */
42
- private handleSSEDisconnect;
43
- /**
44
- * Handle an incoming SSE message
45
- */
46
- private handleSSEMessage;
47
- /**
48
- * Handle a session notification from the agent
49
- */
50
- private handleSessionNotification;
51
- /**
52
- * Generate a unique request ID
53
- */
54
- private generateRequestId;
55
- /**
56
- * Notify all session update callbacks
57
- */
58
- private notifySessionUpdate;
59
- /**
60
- * Notify all error callbacks
61
- */
62
- private notifyError;
8
+ private connected;
9
+ private sessionUpdateCallbacks;
10
+ private errorCallbacks;
11
+ private messageQueue;
12
+ private currentSessionId;
13
+ private chunkResolvers;
14
+ private streamComplete;
15
+ private sseAbortController;
16
+ private reconnectAttempts;
17
+ private maxReconnectAttempts;
18
+ private reconnectDelay;
19
+ private reconnecting;
20
+ private abortController;
21
+ private options;
22
+ constructor(options: HttpTransportOptions);
23
+ connect(): Promise<void>;
24
+ disconnect(): Promise<void>;
25
+ send(message: Message): Promise<void>;
26
+ receive(): AsyncIterableIterator<MessageChunk>;
27
+ isConnected(): boolean;
28
+ onSessionUpdate(callback: (update: SessionUpdate) => void): () => void;
29
+ onError(callback: (error: Error) => void): () => void;
30
+ /**
31
+ * Send an ACP RPC request to the server
32
+ */
33
+ private sendRpcRequest;
34
+ /**
35
+ * Connect to the SSE event stream
36
+ * Uses fetch-based SSE to support custom headers (X-Session-ID)
37
+ */
38
+ private connectSSE;
39
+ /**
40
+ * Handle SSE disconnection with automatic reconnection
41
+ */
42
+ private handleSSEDisconnect;
43
+ /**
44
+ * Handle an incoming SSE message
45
+ */
46
+ private handleSSEMessage;
47
+ /**
48
+ * Handle a session notification from the agent
49
+ */
50
+ private handleSessionNotification;
51
+ /**
52
+ * Generate a unique request ID
53
+ */
54
+ private generateRequestId;
55
+ /**
56
+ * Notify all session update callbacks
57
+ */
58
+ private notifySessionUpdate;
59
+ /**
60
+ * Notify all error callbacks
61
+ */
62
+ private notifyError;
63
63
  }
@@ -217,9 +217,9 @@ export class HttpTransport {
217
217
  "Content-Type": "application/json",
218
218
  ...this.options.headers,
219
219
  };
220
- const timeout = this.options.timeout || 30000;
220
+ const timeoutMs = this.options.timeout ?? 10 * 60 * 1000;
221
221
  const controller = new AbortController();
222
- const timeoutId = setTimeout(() => controller.abort(), timeout);
222
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
223
223
  try {
224
224
  const response = await fetch(`${this.options.baseUrl}/rpc`, {
225
225
  method: "POST",
@@ -242,7 +242,7 @@ export class HttpTransport {
242
242
  catch (error) {
243
243
  clearTimeout(timeoutId);
244
244
  if (error instanceof Error && error.name === "AbortError") {
245
- throw new Error(`Request timeout after ${timeout}ms`);
245
+ throw new Error(`Request timeout after ${timeoutMs}ms`);
246
246
  }
247
247
  throw error;
248
248
  }
@@ -5,24 +5,24 @@ import type { StdioTransportOptions, Transport } from "./types.js";
5
5
  * Uses JSON-RPC 2.0 over stdio to communicate with agents
6
6
  */
7
7
  export declare class StdioTransport implements Transport {
8
- private options;
9
- private agentProcess;
10
- private connection;
11
- private connected;
12
- private sessionUpdateCallbacks;
13
- private errorCallbacks;
14
- private messageQueue;
15
- private currentSessionId;
16
- private chunkResolvers;
17
- private streamComplete;
18
- constructor(options: StdioTransportOptions);
19
- connect(): Promise<void>;
20
- disconnect(): Promise<void>;
21
- send(message: Message): Promise<void>;
22
- receive(): AsyncIterableIterator<MessageChunk>;
23
- isConnected(): boolean;
24
- onSessionUpdate(callback: (update: SessionUpdate) => void): () => void;
25
- onError(callback: (error: Error) => void): () => void;
26
- private notifySessionUpdate;
27
- private notifyError;
8
+ private options;
9
+ private agentProcess;
10
+ private connection;
11
+ private connected;
12
+ private sessionUpdateCallbacks;
13
+ private errorCallbacks;
14
+ private messageQueue;
15
+ private currentSessionId;
16
+ private chunkResolvers;
17
+ private streamComplete;
18
+ constructor(options: StdioTransportOptions);
19
+ connect(): Promise<void>;
20
+ disconnect(): Promise<void>;
21
+ send(message: Message): Promise<void>;
22
+ receive(): AsyncIterableIterator<MessageChunk>;
23
+ isConnected(): boolean;
24
+ onSessionUpdate(callback: (update: SessionUpdate) => void): () => void;
25
+ onError(callback: (error: Error) => void): () => void;
26
+ private notifySessionUpdate;
27
+ private notifyError;
28
28
  }
@@ -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,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;