@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.
- package/dist/core/hooks/use-chat-input.d.ts +17 -17
- package/dist/core/hooks/use-chat-input.js +55 -64
- package/dist/core/hooks/use-chat-messages.js +114 -121
- package/dist/core/hooks/use-chat-session.d.ts +1 -1
- package/dist/core/hooks/use-chat-session.js +80 -78
- package/dist/gui/components/Button.d.ts +7 -23
- package/dist/gui/components/Button.js +27 -40
- package/dist/gui/components/Card.d.ts +7 -26
- package/dist/gui/components/Card.js +8 -54
- package/dist/gui/components/ChatEmptyState.d.ts +18 -0
- package/dist/gui/components/ChatEmptyState.js +22 -0
- package/dist/gui/components/ChatInput.js +29 -1
- package/dist/gui/components/ChatLayout.js +2 -2
- package/dist/gui/components/ChatSecondaryPanel.d.ts +25 -14
- package/dist/gui/components/ChatSecondaryPanel.js +60 -115
- package/dist/gui/components/ChatStatus.d.ts +2 -4
- package/dist/gui/components/ChatStatus.js +34 -45
- package/dist/gui/components/Conversation.d.ts +14 -17
- package/dist/gui/components/Conversation.js +83 -143
- package/dist/gui/components/Dialog.d.ts +11 -57
- package/dist/gui/components/HeightTransition.d.ts +7 -12
- package/dist/gui/components/HeightTransition.js +77 -88
- package/dist/gui/components/Input.d.ts +6 -13
- package/dist/gui/components/Input.js +16 -27
- package/dist/gui/components/Label.d.ts +1 -7
- package/dist/gui/components/MarkdownRenderer.d.ts +4 -6
- package/dist/gui/components/MarkdownRenderer.js +81 -178
- package/dist/gui/components/Message.d.ts +1 -1
- package/dist/gui/components/MessageContent.d.ts +22 -29
- package/dist/gui/components/PanelTabsHeader.d.ts +17 -0
- package/dist/gui/components/PanelTabsHeader.js +31 -0
- package/dist/gui/components/Reasoning.d.ts +24 -30
- package/dist/gui/components/Reasoning.js +60 -187
- package/dist/gui/components/Response.d.ts +9 -11
- package/dist/gui/components/Response.js +90 -229
- package/dist/gui/components/Select.d.ts +10 -69
- package/dist/gui/components/Tabs.d.ts +4 -24
- package/dist/gui/components/Task.d.ts +24 -28
- package/dist/gui/components/Task.js +31 -164
- package/dist/gui/components/Textarea.d.ts +7 -15
- package/dist/gui/components/Textarea.js +46 -63
- package/dist/gui/components/ThinkingBlock.d.ts +10 -20
- package/dist/gui/components/ThinkingBlock.js +35 -134
- package/dist/gui/components/TodoList.d.ts +10 -12
- package/dist/gui/components/TodoList.js +7 -22
- package/dist/gui/components/TodoListItem.d.ts +6 -9
- package/dist/gui/components/TodoListItem.js +4 -18
- package/dist/gui/components/index.d.ts +2 -0
- package/dist/gui/components/index.js +2 -0
- package/dist/gui/lib/utils.js +1 -1
- package/dist/index.test.js +1 -0
- package/dist/sdk/client/acp-client.d.ts +76 -88
- package/dist/sdk/client/acp-client.js +217 -215
- package/dist/sdk/schemas/agent.d.ts +64 -111
- package/dist/sdk/schemas/agent.js +24 -24
- package/dist/sdk/schemas/message.d.ts +147 -245
- package/dist/sdk/schemas/message.js +40 -40
- package/dist/sdk/schemas/session.d.ts +6 -6
- package/dist/sdk/transports/http.d.ts +55 -55
- package/dist/sdk/transports/http.js +3 -3
- package/dist/sdk/transports/stdio.d.ts +20 -20
- package/dist/sdk/transports/types.d.ts +42 -42
- package/dist/sdk/transports/websocket.d.ts +12 -12
- package/dist/sdk/transports/websocket.js +46 -52
- package/dist/tui/components/ChatView.d.ts +2 -4
- package/dist/tui/components/GameOfLife.js +35 -64
- package/dist/tui/components/InputBox.d.ts +11 -18
- package/dist/tui/components/InputBox.js +10 -70
- package/dist/tui/components/ReadlineInput.d.ts +6 -12
- package/dist/tui/components/ReadlineInput.js +237 -252
- package/dist/tui/components/SingleSelect.d.ts +9 -15
- package/dist/tui/components/SingleSelect.js +43 -84
- package/dist/tui/components/StatusBar.d.ts +6 -11
- package/dist/tui/components/StatusBar.js +67 -102
- package/package.json +2 -2
- package/src/styles/global.css +64 -0
- package/dist/core/hooks/index.d.ts.map +0 -1
- package/dist/core/hooks/index.js.map +0 -1
- package/dist/core/hooks/use-chat-input.d.ts.map +0 -1
- package/dist/core/hooks/use-chat-input.js.map +0 -1
- package/dist/core/hooks/use-chat-messages.d.ts.map +0 -1
- package/dist/core/hooks/use-chat-messages.js.map +0 -1
- package/dist/core/hooks/use-chat-session.d.ts.map +0 -1
- package/dist/core/hooks/use-chat-session.js.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/schemas/chat.d.ts.map +0 -1
- package/dist/core/schemas/chat.js.map +0 -1
- package/dist/core/schemas/index.d.ts.map +0 -1
- package/dist/core/schemas/index.js.map +0 -1
- package/dist/core/store/chat-store.d.ts.map +0 -1
- package/dist/core/store/chat-store.js.map +0 -1
- package/dist/gui/components/Button.d.ts.map +0 -1
- package/dist/gui/components/Button.js.map +0 -1
- package/dist/gui/components/Card.d.ts.map +0 -1
- package/dist/gui/components/Card.js.map +0 -1
- package/dist/gui/components/ChatInput.d.ts.map +0 -1
- package/dist/gui/components/ChatInput.js.map +0 -1
- package/dist/gui/components/ChatInterface.d.ts +0 -12
- package/dist/gui/components/ChatInterface.d.ts.map +0 -1
- package/dist/gui/components/ChatInterface.js +0 -204
- package/dist/gui/components/ChatInterface.js.map +0 -1
- package/dist/gui/components/ChatPreview.d.ts +0 -12
- package/dist/gui/components/ChatPreview.d.ts.map +0 -1
- package/dist/gui/components/ChatPreview.js +0 -214
- package/dist/gui/components/ChatPreview.js.map +0 -1
- package/dist/gui/components/ChatSecondaryPanel.d.ts.map +0 -1
- package/dist/gui/components/ChatSecondaryPanel.js.map +0 -1
- package/dist/gui/components/ChatStatus.d.ts.map +0 -1
- package/dist/gui/components/ChatStatus.js.map +0 -1
- package/dist/gui/components/ChatView.d.ts +0 -8
- package/dist/gui/components/ChatView.d.ts.map +0 -1
- package/dist/gui/components/ChatView.js +0 -42
- package/dist/gui/components/ChatView.js.map +0 -1
- package/dist/gui/components/ConfigPanel.d.ts +0 -20
- package/dist/gui/components/ConfigPanel.d.ts.map +0 -1
- package/dist/gui/components/ConfigPanel.js +0 -225
- package/dist/gui/components/ConfigPanel.js.map +0 -1
- package/dist/gui/components/Conversation.d.ts.map +0 -1
- package/dist/gui/components/Conversation.js.map +0 -1
- package/dist/gui/components/Dialog.d.ts.map +0 -1
- package/dist/gui/components/Dialog.js.map +0 -1
- package/dist/gui/components/HeightTransition.d.ts.map +0 -1
- package/dist/gui/components/HeightTransition.js.map +0 -1
- package/dist/gui/components/Input.d.ts.map +0 -1
- package/dist/gui/components/Input.js.map +0 -1
- package/dist/gui/components/InputBox.d.ts +0 -21
- package/dist/gui/components/InputBox.d.ts.map +0 -1
- package/dist/gui/components/InputBox.js +0 -90
- package/dist/gui/components/InputBox.js.map +0 -1
- package/dist/gui/components/Label.d.ts.map +0 -1
- package/dist/gui/components/Label.js.map +0 -1
- package/dist/gui/components/MarkdownRenderer.d.ts.map +0 -1
- package/dist/gui/components/MarkdownRenderer.js.map +0 -1
- package/dist/gui/components/Message.d.ts.map +0 -1
- package/dist/gui/components/Message.js.map +0 -1
- package/dist/gui/components/MessageContent.d.ts.map +0 -1
- package/dist/gui/components/MessageContent.js.map +0 -1
- package/dist/gui/components/MessageList.d.ts.map +0 -1
- package/dist/gui/components/MessageList.js.map +0 -1
- package/dist/gui/components/PlaygroundLayout.d.ts +0 -14
- package/dist/gui/components/PlaygroundLayout.d.ts.map +0 -1
- package/dist/gui/components/PlaygroundLayout.js +0 -49
- package/dist/gui/components/PlaygroundLayout.js.map +0 -1
- package/dist/gui/components/Reasoning.d.ts.map +0 -1
- package/dist/gui/components/Reasoning.js.map +0 -1
- package/dist/gui/components/Response.d.ts.map +0 -1
- package/dist/gui/components/Response.js.map +0 -1
- package/dist/gui/components/Select.d.ts.map +0 -1
- package/dist/gui/components/Select.js.map +0 -1
- package/dist/gui/components/StatusBar.d.ts +0 -12
- package/dist/gui/components/StatusBar.d.ts.map +0 -1
- package/dist/gui/components/StatusBar.js +0 -58
- package/dist/gui/components/StatusBar.js.map +0 -1
- package/dist/gui/components/Tabs.d.ts.map +0 -1
- package/dist/gui/components/Tabs.js.map +0 -1
- package/dist/gui/components/Task.d.ts.map +0 -1
- package/dist/gui/components/Task.js.map +0 -1
- package/dist/gui/components/Textarea.d.ts.map +0 -1
- package/dist/gui/components/Textarea.js.map +0 -1
- package/dist/gui/components/ThinkingBlock.d.ts.map +0 -1
- package/dist/gui/components/ThinkingBlock.js.map +0 -1
- package/dist/gui/components/TodoList.d.ts.map +0 -1
- package/dist/gui/components/TodoList.js.map +0 -1
- package/dist/gui/components/TodoListItem.d.ts.map +0 -1
- package/dist/gui/components/TodoListItem.js.map +0 -1
- package/dist/gui/components/index.d.ts.map +0 -1
- package/dist/gui/components/index.js.map +0 -1
- package/dist/gui/index.d.ts.map +0 -1
- package/dist/gui/index.js.map +0 -1
- package/dist/gui/lib/utils.d.ts.map +0 -1
- package/dist/gui/lib/utils.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/sdk/client/acp-client.d.ts.map +0 -1
- package/dist/sdk/client/acp-client.js.map +0 -1
- package/dist/sdk/client/index.d.ts.map +0 -1
- package/dist/sdk/client/index.js.map +0 -1
- package/dist/sdk/index.d.ts.map +0 -1
- package/dist/sdk/index.js.map +0 -1
- package/dist/sdk/schemas/agent.d.ts.map +0 -1
- package/dist/sdk/schemas/agent.js.map +0 -1
- package/dist/sdk/schemas/index.d.ts.map +0 -1
- package/dist/sdk/schemas/index.js.map +0 -1
- package/dist/sdk/schemas/message.d.ts.map +0 -1
- package/dist/sdk/schemas/message.js.map +0 -1
- package/dist/sdk/schemas/session.d.ts.map +0 -1
- package/dist/sdk/schemas/session.js.map +0 -1
- package/dist/sdk/transports/http.d.ts.map +0 -1
- package/dist/sdk/transports/http.js.map +0 -1
- package/dist/sdk/transports/index.d.ts.map +0 -1
- package/dist/sdk/transports/index.js.map +0 -1
- package/dist/sdk/transports/stdio.d.ts.map +0 -1
- package/dist/sdk/transports/stdio.js.map +0 -1
- package/dist/sdk/transports/types.d.ts.map +0 -1
- package/dist/sdk/transports/types.js.map +0 -1
- package/dist/sdk/transports/websocket.d.ts.map +0 -1
- package/dist/sdk/transports/websocket.js.map +0 -1
- package/dist/tui/components/ChatView.d.ts.map +0 -1
- package/dist/tui/components/ChatView.js.map +0 -1
- package/dist/tui/components/GameOfLife.d.ts.map +0 -1
- package/dist/tui/components/GameOfLife.js.map +0 -1
- package/dist/tui/components/InputBox.d.ts.map +0 -1
- package/dist/tui/components/InputBox.js.map +0 -1
- package/dist/tui/components/MessageList.d.ts.map +0 -1
- package/dist/tui/components/MessageList.js.map +0 -1
- package/dist/tui/components/ReadlineInput.d.ts.map +0 -1
- package/dist/tui/components/ReadlineInput.js.map +0 -1
- package/dist/tui/components/StatusBar.d.ts.map +0 -1
- package/dist/tui/components/StatusBar.js.map +0 -1
- package/dist/tui/components/index.d.ts.map +0 -1
- package/dist/tui/components/index.js.map +0 -1
- package/dist/tui/index.d.ts.map +0 -1
- 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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
220
|
+
const timeoutMs = this.options.timeout ?? 10 * 60 * 1000;
|
|
221
221
|
const controller = new AbortController();
|
|
222
|
-
const timeoutId = setTimeout(() => controller.abort(),
|
|
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 ${
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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;
|