@townco/ui 0.1.0 → 0.1.3
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 +64 -55
- package/dist/core/hooks/use-chat-messages.d.ts +11 -11
- package/dist/core/hooks/use-chat-messages.js +121 -114
- package/dist/core/hooks/use-chat-session.d.ts +5 -5
- package/dist/core/hooks/use-chat-session.js +78 -80
- package/dist/core/hooks/use-media-query.d.ts +5 -5
- package/dist/core/hooks/use-media-query.js +38 -38
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/schemas/chat.d.ts +83 -56
- package/dist/core/schemas/chat.js +27 -25
- package/dist/core/store/chat-store.d.ts +28 -22
- package/dist/core/store/chat-store.js +59 -50
- package/dist/gui/components/Button.d.ts +23 -7
- package/dist/gui/components/Button.js +40 -27
- package/dist/gui/components/Card.d.ts +26 -7
- package/dist/gui/components/Card.js +54 -8
- package/dist/gui/components/ChatHeader.d.ts +58 -31
- package/dist/gui/components/ChatHeader.js +171 -66
- package/dist/gui/components/ChatInput.d.ts +58 -36
- package/dist/gui/components/ChatInput.js +191 -121
- package/dist/gui/components/ChatInterface.d.ts +9 -6
- package/dist/gui/components/ChatInterface.js +162 -90
- package/dist/gui/components/ChatLayout.d.ts +71 -41
- package/dist/gui/components/ChatLayout.js +214 -87
- package/dist/gui/components/ChatPanelTabContent.d.ts +18 -9
- package/dist/gui/components/ChatPanelTabContent.js +88 -10
- package/dist/gui/components/ChatPreview.d.ts +9 -6
- package/dist/gui/components/ChatPreview.js +212 -162
- package/dist/gui/components/ChatSecondaryPanel.d.ts +14 -11
- package/dist/gui/components/ChatSecondaryPanel.js +115 -38
- package/dist/gui/components/ChatSidebar.d.ts +26 -13
- package/dist/gui/components/ChatSidebar.js +48 -14
- package/dist/gui/components/ChatStatus.d.ts +4 -2
- package/dist/gui/components/ChatStatus.js +45 -34
- package/dist/gui/components/ChatView.d.ts +5 -3
- package/dist/gui/components/ChatView.js +38 -9
- package/dist/gui/components/ConfigPanel.d.ts +16 -12
- package/dist/gui/components/ConfigPanel.js +218 -41
- package/dist/gui/components/Conversation.d.ts +17 -14
- package/dist/gui/components/Conversation.js +143 -83
- package/dist/gui/components/Dialog.d.ts +57 -11
- package/dist/gui/components/Dialog.js +84 -8
- package/dist/gui/components/DropdownMenu.d.ts +101 -20
- package/dist/gui/components/DropdownMenu.js +161 -14
- package/dist/gui/components/HeightTransition.d.ts +12 -7
- package/dist/gui/components/HeightTransition.js +88 -77
- package/dist/gui/components/Input.d.ts +13 -6
- package/dist/gui/components/Input.js +27 -16
- package/dist/gui/components/InputBox.d.ts +19 -12
- package/dist/gui/components/InputBox.js +86 -14
- package/dist/gui/components/Label.d.ts +7 -1
- package/dist/gui/components/Label.js +12 -2
- package/dist/gui/components/MarkdownRenderer.d.ts +6 -4
- package/dist/gui/components/MarkdownRenderer.js +178 -81
- package/dist/gui/components/Message.d.ts +25 -18
- package/dist/gui/components/Message.js +44 -23
- package/dist/gui/components/MessageContent.d.ts +29 -22
- package/dist/gui/components/MessageContent.js +157 -85
- package/dist/gui/components/PlaygroundLayout.d.ts +9 -5
- package/dist/gui/components/PlaygroundLayout.js +43 -12
- package/dist/gui/components/Reasoning.d.ts +30 -24
- package/dist/gui/components/Reasoning.js +187 -60
- package/dist/gui/components/Response.d.ts +11 -9
- package/dist/gui/components/Response.js +229 -90
- package/dist/gui/components/Select.d.ts +69 -10
- package/dist/gui/components/Select.js +118 -12
- package/dist/gui/components/Sonner.d.ts +3 -1
- package/dist/gui/components/Sonner.js +29 -18
- package/dist/gui/components/StatusBar.d.ts +9 -5
- package/dist/gui/components/StatusBar.js +56 -9
- package/dist/gui/components/Tabs.d.ts +24 -4
- package/dist/gui/components/Tabs.js +32 -4
- package/dist/gui/components/Task.d.ts +28 -24
- package/dist/gui/components/Task.js +164 -31
- package/dist/gui/components/Textarea.d.ts +15 -7
- package/dist/gui/components/Textarea.js +63 -46
- package/dist/gui/components/ThinkingBlock.d.ts +20 -10
- package/dist/gui/components/ThinkingBlock.js +134 -35
- package/dist/gui/components/TodoList.d.ts +12 -10
- package/dist/gui/components/TodoList.js +22 -7
- package/dist/gui/components/TodoListItem.d.ts +9 -6
- package/dist/gui/components/TodoListItem.js +18 -4
- package/dist/gui/components/index.d.ts +59 -8
- package/dist/gui/components/index.js +42 -8
- 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 +0 -1
- package/dist/sdk/client/acp-client.d.ts +88 -76
- package/dist/sdk/client/acp-client.js +215 -217
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/schemas/agent.d.ts +111 -64
- package/dist/sdk/schemas/agent.js +24 -24
- package/dist/sdk/schemas/message.d.ts +245 -147
- package/dist/sdk/schemas/message.js +40 -40
- package/dist/sdk/schemas/session.d.ts +219 -135
- package/dist/sdk/schemas/session.js +27 -27
- package/dist/sdk/transports/http.d.ts +55 -55
- package/dist/sdk/transports/http.js +472 -469
- package/dist/sdk/transports/stdio.d.ts +20 -20
- package/dist/sdk/transports/stdio.js +289 -286
- package/dist/sdk/transports/types.d.ts +42 -42
- package/dist/sdk/transports/websocket.d.ts +12 -12
- package/dist/sdk/transports/websocket.js +52 -46
- package/dist/tui/components/ChatView.d.ts +4 -2
- package/dist/tui/components/ChatView.js +51 -18
- package/dist/tui/components/GameOfLife.js +64 -35
- package/dist/tui/components/InputBox.d.ts +18 -11
- package/dist/tui/components/InputBox.js +70 -10
- package/dist/tui/components/MessageList.d.ts +4 -2
- package/dist/tui/components/MessageList.js +37 -10
- package/dist/tui/components/MultiSelect.d.ts +15 -9
- package/dist/tui/components/MultiSelect.js +116 -69
- package/dist/tui/components/ReadlineInput.d.ts +12 -6
- package/dist/tui/components/ReadlineInput.js +252 -237
- package/dist/tui/components/SingleSelect.d.ts +15 -9
- package/dist/tui/components/SingleSelect.js +84 -43
- package/dist/tui/components/StatusBar.d.ts +11 -6
- package/dist/tui/components/StatusBar.js +102 -67
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/package.json +2 -3
|
@@ -1,72 +1,119 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { Box, Text, useInput } from "ink";
|
|
3
2
|
import { useState } from "react";
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
export function MultiSelect({
|
|
5
|
+
options,
|
|
6
|
+
selected,
|
|
7
|
+
onChange,
|
|
8
|
+
onSubmit,
|
|
9
|
+
onCancel,
|
|
10
|
+
}) {
|
|
11
|
+
const [focusedIndex, setFocusedIndex] = useState(0);
|
|
12
|
+
const totalItems = options.length + 1; // +1 for Continue button
|
|
13
|
+
useInput((input, key) => {
|
|
14
|
+
// Handle Escape: Cancel
|
|
15
|
+
if (key.escape) {
|
|
16
|
+
onCancel?.();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// Handle Enter: Toggle selection or submit
|
|
20
|
+
if (key.return) {
|
|
21
|
+
if (focusedIndex === options.length) {
|
|
22
|
+
// On Continue button - submit
|
|
23
|
+
onSubmit();
|
|
24
|
+
} else {
|
|
25
|
+
// On an option - toggle selection
|
|
26
|
+
const currentOption = options[focusedIndex];
|
|
27
|
+
if (currentOption) {
|
|
28
|
+
const currentValue = currentOption.value;
|
|
29
|
+
const newSelected = selected.includes(currentValue)
|
|
30
|
+
? selected.filter((v) => v !== currentValue)
|
|
31
|
+
: [...selected, currentValue];
|
|
32
|
+
onChange(newSelected);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// Handle Arrow Up: Move focus up
|
|
38
|
+
if (key.upArrow) {
|
|
39
|
+
setFocusedIndex((prev) => (prev > 0 ? prev - 1 : totalItems - 1));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Handle Arrow Down: Move focus down
|
|
43
|
+
if (key.downArrow) {
|
|
44
|
+
setFocusedIndex((prev) => (prev < totalItems - 1 ? prev + 1 : 0));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// Handle Spacebar: Toggle selection (only for options, not Continue button)
|
|
48
|
+
if (input === " ") {
|
|
49
|
+
if (focusedIndex >= options.length) return; // Don't toggle Continue button
|
|
50
|
+
const currentOption = options[focusedIndex];
|
|
51
|
+
if (!currentOption) return;
|
|
52
|
+
const currentValue = currentOption.value;
|
|
53
|
+
const newSelected = selected.includes(currentValue)
|
|
54
|
+
? selected.filter((v) => v !== currentValue)
|
|
55
|
+
: [...selected, currentValue];
|
|
56
|
+
onChange(newSelected);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// Handle Ctrl+A: Select all
|
|
60
|
+
if (key.ctrl && input === "a") {
|
|
61
|
+
onChange(options.map((opt) => opt.value));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
// Handle Ctrl+N: Clear all
|
|
65
|
+
if (key.ctrl && input === "n") {
|
|
66
|
+
onChange([]);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return _jsxs(Box, {
|
|
71
|
+
flexDirection: "column",
|
|
72
|
+
children: [
|
|
73
|
+
options.map((option, index) => {
|
|
74
|
+
const isSelected = selected.includes(option.value);
|
|
75
|
+
const isFocused = index === focusedIndex;
|
|
76
|
+
return _jsxs(
|
|
77
|
+
Box,
|
|
78
|
+
{
|
|
79
|
+
flexDirection: "column",
|
|
80
|
+
children: [
|
|
81
|
+
_jsx(Box, {
|
|
82
|
+
children: _jsxs(Text, {
|
|
83
|
+
inverse: isFocused,
|
|
84
|
+
children: [isSelected ? "[x]" : "[ ]", " ", option.label],
|
|
85
|
+
}),
|
|
86
|
+
}),
|
|
87
|
+
option.description &&
|
|
88
|
+
_jsx(Box, {
|
|
89
|
+
paddingLeft: 4,
|
|
90
|
+
children: _jsx(Text, {
|
|
91
|
+
dimColor: true,
|
|
92
|
+
children: option.description,
|
|
93
|
+
}),
|
|
94
|
+
}),
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
option.value,
|
|
98
|
+
);
|
|
99
|
+
}),
|
|
100
|
+
_jsx(Box, {
|
|
101
|
+
marginTop: 1,
|
|
102
|
+
children: _jsx(Text, {
|
|
103
|
+
inverse: focusedIndex === options.length,
|
|
104
|
+
color: "green",
|
|
105
|
+
bold: true,
|
|
106
|
+
children: "\u2192 Continue",
|
|
107
|
+
}),
|
|
108
|
+
}),
|
|
109
|
+
_jsx(Box, {
|
|
110
|
+
marginTop: 1,
|
|
111
|
+
children: _jsx(Text, {
|
|
112
|
+
dimColor: true,
|
|
113
|
+
children:
|
|
114
|
+
"\u2191/\u2193: Navigate \u2022 Space/Enter: Toggle \u2022 Enter on Continue: Proceed",
|
|
115
|
+
}),
|
|
116
|
+
}),
|
|
117
|
+
],
|
|
118
|
+
});
|
|
72
119
|
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
export interface ReadlineInputProps {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
value: string;
|
|
3
|
+
onChange: (value: string) => void;
|
|
4
|
+
onSubmit: () => void;
|
|
5
|
+
onEscape?: () => void;
|
|
6
|
+
placeholder?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function ReadlineInput({
|
|
8
|
+
export declare function ReadlineInput({
|
|
9
|
+
value,
|
|
10
|
+
onChange,
|
|
11
|
+
onSubmit,
|
|
12
|
+
onEscape,
|
|
13
|
+
placeholder,
|
|
14
|
+
}: ReadlineInputProps): import("react/jsx-runtime").JSX.Element;
|