@townco/ui 0.1.6 → 0.1.8
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/README.md +11 -11
- package/dist/core/hooks/index.d.ts +1 -0
- package/dist/core/hooks/index.js +1 -0
- 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.d.ts +11 -11
- package/dist/core/hooks/use-chat-messages.js +114 -121
- package/dist/core/hooks/use-chat-session.d.ts +5 -5
- package/dist/core/hooks/use-chat-session.js +80 -78
- package/dist/core/hooks/use-media-query.d.ts +5 -5
- package/dist/core/hooks/use-media-query.js +42 -38
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/schemas/chat.d.ts +56 -83
- package/dist/core/schemas/chat.js +25 -27
- package/dist/core/store/chat-store.d.ts +22 -28
- package/dist/core/store/chat-store.js +50 -59
- 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/ChatHeader.d.ts +31 -58
- package/dist/gui/components/ChatHeader.js +68 -171
- package/dist/gui/components/ChatInput.d.ts +54 -58
- package/dist/gui/components/ChatInput.js +207 -194
- package/dist/gui/components/ChatInputCommandMenu.d.ts +20 -0
- package/dist/gui/components/ChatInputCommandMenu.js +62 -0
- package/dist/gui/components/ChatLayout.d.ts +41 -71
- package/dist/gui/components/ChatLayout.js +87 -214
- package/dist/gui/components/ChatPanelTabContent.d.ts +9 -18
- package/dist/gui/components/ChatPanelTabContent.js +10 -88
- package/dist/gui/components/ChatSecondaryPanel.d.ts +11 -14
- package/dist/gui/components/ChatSecondaryPanel.js +38 -115
- package/dist/gui/components/ChatSidebar.d.ts +13 -26
- package/dist/gui/components/ChatSidebar.js +14 -48
- 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/Dialog.js +8 -84
- package/dist/gui/components/DropdownMenu.d.ts +20 -101
- package/dist/gui/components/DropdownMenu.js +14 -161
- 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/Label.js +2 -12
- package/dist/gui/components/MarkdownRenderer.d.ts +4 -6
- package/dist/gui/components/MarkdownRenderer.js +81 -178
- package/dist/gui/components/Message.d.ts +22 -25
- package/dist/gui/components/Message.js +97 -44
- package/dist/gui/components/MessageContent.d.ts +22 -29
- package/dist/gui/components/MessageContent.js +85 -157
- 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/Select.js +12 -118
- package/dist/gui/components/Sonner.d.ts +1 -3
- package/dist/gui/components/Sonner.js +18 -29
- package/dist/gui/components/Tabs.d.ts +4 -24
- package/dist/gui/components/Tabs.js +4 -32
- 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 +16 -59
- package/dist/gui/components/index.js +18 -42
- package/dist/gui/lib/utils.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.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/index.d.ts +1 -1
- package/dist/sdk/index.js +1 -1
- 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 +135 -219
- package/dist/sdk/schemas/session.js +27 -27
- package/dist/sdk/transports/http.d.ts +55 -55
- package/dist/sdk/transports/http.js +469 -472
- package/dist/sdk/transports/stdio.d.ts +20 -20
- package/dist/sdk/transports/stdio.js +286 -289
- 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/ChatView.js +18 -51
- 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/MessageList.d.ts +2 -4
- package/dist/tui/components/MessageList.js +10 -37
- package/dist/tui/components/MultiSelect.d.ts +10 -15
- package/dist/tui/components/MultiSelect.js +73 -116
- 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/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/package.json +6 -4
- package/src/styles/global.css +2 -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,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,57 +1,24 @@
|
|
|
1
|
-
import { Box } from "ink";
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
description?: string;
|
|
5
5
|
}
|
|
6
6
|
export interface MultiSelectProps {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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;
|