@townco/ui 0.1.7 → 0.1.9
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/index.d.ts +1 -0
- package/dist/core/hooks/index.d.ts.map +1 -0
- package/dist/core/hooks/index.js +1 -0
- package/dist/core/hooks/index.js.map +1 -0
- package/dist/core/hooks/use-chat-input.d.ts +17 -17
- package/dist/core/hooks/use-chat-input.d.ts.map +1 -0
- package/dist/core/hooks/use-chat-input.js +64 -55
- package/dist/core/hooks/use-chat-input.js.map +1 -0
- package/dist/core/hooks/use-chat-messages.d.ts +11 -11
- package/dist/core/hooks/use-chat-messages.d.ts.map +1 -0
- package/dist/core/hooks/use-chat-messages.js +121 -114
- package/dist/core/hooks/use-chat-messages.js.map +1 -0
- package/dist/core/hooks/use-chat-session.d.ts +5 -5
- package/dist/core/hooks/use-chat-session.d.ts.map +1 -0
- package/dist/core/hooks/use-chat-session.js +78 -80
- package/dist/core/hooks/use-chat-session.js.map +1 -0
- package/dist/core/hooks/use-media-query.d.ts +39 -0
- package/dist/core/hooks/use-media-query.js +84 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/schemas/chat.d.ts +83 -56
- package/dist/core/schemas/chat.d.ts.map +1 -0
- package/dist/core/schemas/chat.js +27 -25
- package/dist/core/schemas/chat.js.map +1 -0
- package/dist/core/schemas/index.d.ts.map +1 -0
- package/dist/core/schemas/index.js.map +1 -0
- package/dist/core/store/chat-store.d.ts +28 -22
- package/dist/core/store/chat-store.d.ts.map +1 -0
- package/dist/core/store/chat-store.js +59 -50
- package/dist/core/store/chat-store.js.map +1 -0
- package/dist/gui/components/Button.d.ts +23 -7
- package/dist/gui/components/Button.d.ts.map +1 -0
- package/dist/gui/components/Button.js +40 -27
- package/dist/gui/components/Button.js.map +1 -0
- package/dist/gui/components/Card.d.ts +26 -7
- package/dist/gui/components/Card.d.ts.map +1 -0
- package/dist/gui/components/Card.js +54 -8
- package/dist/gui/components/Card.js.map +1 -0
- package/dist/gui/components/ChatHeader.d.ts +38 -0
- package/dist/gui/components/ChatHeader.js +86 -0
- package/dist/gui/components/ChatInput.d.ts +19 -1
- package/dist/gui/components/ChatInput.d.ts.map +1 -0
- package/dist/gui/components/ChatInput.js +94 -11
- package/dist/gui/components/ChatInput.js.map +1 -0
- package/dist/gui/components/ChatInputCommandMenu.d.ts +20 -0
- package/dist/gui/components/ChatInputCommandMenu.js +62 -0
- package/dist/gui/components/ChatInterface.d.ts +12 -0
- package/dist/gui/components/ChatInterface.d.ts.map +1 -0
- package/dist/gui/components/ChatInterface.js +204 -0
- package/dist/gui/components/ChatInterface.js.map +1 -0
- package/dist/gui/components/ChatLayout.d.ts +52 -0
- package/dist/gui/components/ChatLayout.js +105 -0
- package/dist/gui/components/ChatPanelTabContent.d.ts +18 -0
- package/dist/gui/components/ChatPanelTabContent.js +15 -0
- package/dist/gui/components/ChatPreview.d.ts +12 -0
- package/dist/gui/components/ChatPreview.d.ts.map +1 -0
- package/dist/gui/components/ChatPreview.js +214 -0
- package/dist/gui/components/ChatPreview.js.map +1 -0
- package/dist/gui/components/ChatSecondaryPanel.d.ts +14 -11
- package/dist/gui/components/ChatSecondaryPanel.d.ts.map +1 -0
- package/dist/gui/components/ChatSecondaryPanel.js +115 -38
- package/dist/gui/components/ChatSecondaryPanel.js.map +1 -0
- package/dist/gui/components/ChatSidebar.d.ts +14 -0
- package/dist/gui/components/ChatSidebar.js +23 -0
- package/dist/gui/components/ChatStatus.d.ts +4 -2
- package/dist/gui/components/ChatStatus.d.ts.map +1 -0
- package/dist/gui/components/ChatStatus.js +45 -34
- package/dist/gui/components/ChatStatus.js.map +1 -0
- package/dist/gui/components/ChatView.d.ts +8 -0
- package/dist/gui/components/ChatView.d.ts.map +1 -0
- package/dist/gui/components/ChatView.js +42 -0
- package/dist/gui/components/ChatView.js.map +1 -0
- package/dist/gui/components/ConfigPanel.d.ts +20 -0
- package/dist/gui/components/ConfigPanel.d.ts.map +1 -0
- package/dist/gui/components/ConfigPanel.js +225 -0
- package/dist/gui/components/ConfigPanel.js.map +1 -0
- package/dist/gui/components/Conversation.d.ts +17 -14
- package/dist/gui/components/Conversation.d.ts.map +1 -0
- package/dist/gui/components/Conversation.js +143 -83
- package/dist/gui/components/Conversation.js.map +1 -0
- package/dist/gui/components/Dialog.d.ts +57 -11
- package/dist/gui/components/Dialog.d.ts.map +1 -0
- package/dist/gui/components/Dialog.js +84 -8
- package/dist/gui/components/Dialog.js.map +1 -0
- package/dist/gui/components/DropdownMenu.d.ts +27 -0
- package/dist/gui/components/DropdownMenu.js +68 -0
- package/dist/gui/components/HeightTransition.d.ts +12 -7
- package/dist/gui/components/HeightTransition.d.ts.map +1 -0
- package/dist/gui/components/HeightTransition.js +88 -77
- package/dist/gui/components/HeightTransition.js.map +1 -0
- package/dist/gui/components/Input.d.ts +13 -6
- package/dist/gui/components/Input.d.ts.map +1 -0
- package/dist/gui/components/Input.js +27 -16
- package/dist/gui/components/Input.js.map +1 -0
- package/dist/gui/components/InputBox.d.ts +21 -0
- package/dist/gui/components/InputBox.d.ts.map +1 -0
- package/dist/gui/components/InputBox.js +90 -0
- package/dist/gui/components/InputBox.js.map +1 -0
- package/dist/gui/components/Label.d.ts +7 -1
- package/dist/gui/components/Label.d.ts.map +1 -0
- package/dist/gui/components/Label.js +12 -2
- package/dist/gui/components/Label.js.map +1 -0
- package/dist/gui/components/MarkdownRenderer.d.ts +6 -4
- package/dist/gui/components/MarkdownRenderer.d.ts.map +1 -0
- package/dist/gui/components/MarkdownRenderer.js +178 -81
- package/dist/gui/components/MarkdownRenderer.js.map +1 -0
- package/dist/gui/components/Message.d.ts +4 -0
- package/dist/gui/components/Message.d.ts.map +1 -0
- package/dist/gui/components/Message.js +77 -3
- package/dist/gui/components/Message.js.map +1 -0
- package/dist/gui/components/MessageContent.d.ts +29 -22
- package/dist/gui/components/MessageContent.d.ts.map +1 -0
- package/dist/gui/components/MessageContent.js +1 -1
- package/dist/gui/components/MessageContent.js.map +1 -0
- package/dist/gui/components/MessageList.d.ts.map +1 -0
- package/dist/gui/components/MessageList.js.map +1 -0
- package/dist/gui/components/PlaygroundLayout.d.ts +14 -0
- package/dist/gui/components/PlaygroundLayout.d.ts.map +1 -0
- package/dist/gui/components/PlaygroundLayout.js +49 -0
- package/dist/gui/components/PlaygroundLayout.js.map +1 -0
- package/dist/gui/components/Reasoning.d.ts +30 -24
- package/dist/gui/components/Reasoning.d.ts.map +1 -0
- package/dist/gui/components/Reasoning.js +187 -60
- package/dist/gui/components/Reasoning.js.map +1 -0
- package/dist/gui/components/Response.d.ts +11 -9
- package/dist/gui/components/Response.d.ts.map +1 -0
- package/dist/gui/components/Response.js +229 -90
- package/dist/gui/components/Response.js.map +1 -0
- package/dist/gui/components/Select.d.ts +69 -10
- package/dist/gui/components/Select.d.ts.map +1 -0
- package/dist/gui/components/Select.js +118 -12
- package/dist/gui/components/Select.js.map +1 -0
- package/dist/gui/components/Sonner.d.ts +5 -0
- package/dist/gui/components/Sonner.js +23 -0
- package/dist/gui/components/StatusBar.d.ts +12 -0
- package/dist/gui/components/StatusBar.d.ts.map +1 -0
- package/dist/gui/components/StatusBar.js +58 -0
- package/dist/gui/components/StatusBar.js.map +1 -0
- package/dist/gui/components/Tabs.d.ts +24 -4
- package/dist/gui/components/Tabs.d.ts.map +1 -0
- package/dist/gui/components/Tabs.js +32 -4
- package/dist/gui/components/Tabs.js.map +1 -0
- package/dist/gui/components/Task.d.ts +28 -24
- package/dist/gui/components/Task.d.ts.map +1 -0
- package/dist/gui/components/Task.js +164 -31
- package/dist/gui/components/Task.js.map +1 -0
- package/dist/gui/components/Textarea.d.ts +15 -7
- package/dist/gui/components/Textarea.d.ts.map +1 -0
- package/dist/gui/components/Textarea.js +63 -46
- package/dist/gui/components/Textarea.js.map +1 -0
- package/dist/gui/components/ThinkingBlock.d.ts +20 -10
- package/dist/gui/components/ThinkingBlock.d.ts.map +1 -0
- package/dist/gui/components/ThinkingBlock.js +134 -35
- package/dist/gui/components/ThinkingBlock.js.map +1 -0
- package/dist/gui/components/TodoList.d.ts +12 -10
- package/dist/gui/components/TodoList.d.ts.map +1 -0
- package/dist/gui/components/TodoList.js +22 -7
- package/dist/gui/components/TodoList.js.map +1 -0
- package/dist/gui/components/TodoListItem.d.ts +9 -6
- package/dist/gui/components/TodoListItem.d.ts.map +1 -0
- package/dist/gui/components/TodoListItem.js +18 -4
- package/dist/gui/components/TodoListItem.js.map +1 -0
- package/dist/gui/components/index.d.ts +9 -1
- package/dist/gui/components/index.d.ts.map +1 -0
- package/dist/gui/components/index.js +11 -1
- package/dist/gui/components/index.js.map +1 -0
- package/dist/gui/index.d.ts.map +1 -0
- package/dist/gui/index.js.map +1 -0
- package/dist/gui/lib/utils.d.ts.map +1 -0
- package/dist/gui/lib/utils.js +1 -1
- package/dist/gui/lib/utils.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.js +0 -1
- package/dist/sdk/client/acp-client.d.ts +88 -76
- package/dist/sdk/client/acp-client.d.ts.map +1 -0
- package/dist/sdk/client/acp-client.js +215 -217
- package/dist/sdk/client/acp-client.js.map +1 -0
- package/dist/sdk/client/index.d.ts.map +1 -0
- package/dist/sdk/client/index.js.map +1 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/schemas/agent.d.ts +111 -64
- package/dist/sdk/schemas/agent.d.ts.map +1 -0
- package/dist/sdk/schemas/agent.js +24 -24
- package/dist/sdk/schemas/agent.js.map +1 -0
- package/dist/sdk/schemas/index.d.ts.map +1 -0
- package/dist/sdk/schemas/index.js.map +1 -0
- package/dist/sdk/schemas/message.d.ts +245 -147
- package/dist/sdk/schemas/message.d.ts.map +1 -0
- package/dist/sdk/schemas/message.js +40 -40
- package/dist/sdk/schemas/message.js.map +1 -0
- package/dist/sdk/schemas/session.d.ts +219 -135
- package/dist/sdk/schemas/session.d.ts.map +1 -0
- package/dist/sdk/schemas/session.js +27 -27
- package/dist/sdk/schemas/session.js.map +1 -0
- package/dist/sdk/transports/http.d.ts +55 -55
- package/dist/sdk/transports/http.d.ts.map +1 -0
- package/dist/sdk/transports/http.js +472 -469
- package/dist/sdk/transports/http.js.map +1 -0
- package/dist/sdk/transports/index.d.ts.map +1 -0
- package/dist/sdk/transports/index.js.map +1 -0
- package/dist/sdk/transports/stdio.d.ts +20 -20
- package/dist/sdk/transports/stdio.d.ts.map +1 -0
- package/dist/sdk/transports/stdio.js.map +1 -0
- package/dist/sdk/transports/types.d.ts +42 -42
- package/dist/sdk/transports/types.d.ts.map +1 -0
- package/dist/sdk/transports/types.js.map +1 -0
- package/dist/sdk/transports/websocket.d.ts +12 -12
- package/dist/sdk/transports/websocket.d.ts.map +1 -0
- package/dist/sdk/transports/websocket.js +52 -46
- package/dist/sdk/transports/websocket.js.map +1 -0
- package/dist/tui/components/ChatView.d.ts +4 -2
- package/dist/tui/components/ChatView.d.ts.map +1 -0
- package/dist/tui/components/ChatView.js +51 -18
- package/dist/tui/components/ChatView.js.map +1 -0
- package/dist/tui/components/GameOfLife.d.ts.map +1 -0
- package/dist/tui/components/GameOfLife.js +64 -35
- package/dist/tui/components/GameOfLife.js.map +1 -0
- package/dist/tui/components/InputBox.d.ts +18 -11
- package/dist/tui/components/InputBox.d.ts.map +1 -0
- package/dist/tui/components/InputBox.js +70 -10
- package/dist/tui/components/InputBox.js.map +1 -0
- package/dist/tui/components/MessageList.d.ts +4 -2
- package/dist/tui/components/MessageList.d.ts.map +1 -0
- package/dist/tui/components/MessageList.js +37 -10
- package/dist/tui/components/MessageList.js.map +1 -0
- package/dist/tui/components/ReadlineInput.d.ts +12 -6
- package/dist/tui/components/ReadlineInput.d.ts.map +1 -0
- package/dist/tui/components/ReadlineInput.js +252 -237
- package/dist/tui/components/ReadlineInput.js.map +1 -0
- 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.d.ts.map +1 -0
- package/dist/tui/components/StatusBar.js +102 -67
- package/dist/tui/components/StatusBar.js.map +1 -0
- package/dist/tui/components/index.d.ts.map +1 -0
- package/dist/tui/components/index.js.map +1 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js.map +1 -0
- package/package.json +6 -4
- package/src/styles/global.css +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/gui/components/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEvF;;;GAGG;AAEH,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageList.js","sourceRoot":"","sources":["../../../src/gui/components/MessageList.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ThemeConfig } from "./ConfigPanel.js";
|
|
2
|
+
declare const DEFAULT_CONFIG: ThemeConfig;
|
|
3
|
+
interface PlaygroundLayoutProps {
|
|
4
|
+
initialConfig?: ThemeConfig;
|
|
5
|
+
initialStatus?: string;
|
|
6
|
+
iframeSrc?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function PlaygroundLayout({
|
|
9
|
+
initialConfig,
|
|
10
|
+
initialStatus,
|
|
11
|
+
iframeSrc,
|
|
12
|
+
}: PlaygroundLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export { DEFAULT_CONFIG };
|
|
14
|
+
//# sourceMappingURL=PlaygroundLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlaygroundLayout.d.ts","sourceRoot":"","sources":["../../../src/gui/components/PlaygroundLayout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGjE,QAAA,MAAM,cAAc,EAAE,WAMrB,CAAC;AAEF,UAAU,qBAAqB;IAC7B,aAAa,CAAC,EAAE,WAAW,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,aAA8B,EAC9B,aAAwB,EACxB,SAAS,GACV,EAAE,qBAAqB,2CAwBvB;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChatPreview } from "./ChatPreview.js";
|
|
4
|
+
import { ConfigPanel } from "./ConfigPanel.js";
|
|
5
|
+
|
|
6
|
+
const DEFAULT_CONFIG = {
|
|
7
|
+
colorScheme: "light",
|
|
8
|
+
accentColor: "#646cff",
|
|
9
|
+
typography: "Inter",
|
|
10
|
+
fontSize: 16,
|
|
11
|
+
thinkingDisplayStyle: "collapsible",
|
|
12
|
+
};
|
|
13
|
+
export function PlaygroundLayout({
|
|
14
|
+
initialConfig = DEFAULT_CONFIG,
|
|
15
|
+
initialStatus = "v0.1.0",
|
|
16
|
+
iframeSrc,
|
|
17
|
+
}) {
|
|
18
|
+
const [config, setConfig] = useState(initialConfig);
|
|
19
|
+
const [status, setStatus] = useState(initialStatus);
|
|
20
|
+
return _jsx("div", {
|
|
21
|
+
className: "w-full h-screen overflow-hidden",
|
|
22
|
+
"data-theme": config.colorScheme,
|
|
23
|
+
children: _jsxs("div", {
|
|
24
|
+
className: "flex h-full w-full",
|
|
25
|
+
children: [
|
|
26
|
+
_jsx("div", {
|
|
27
|
+
className: "w-[400px] flex-shrink-0 h-full overflow-hidden",
|
|
28
|
+
children: _jsx(ConfigPanel, {
|
|
29
|
+
config: config,
|
|
30
|
+
status: status,
|
|
31
|
+
onConfigChange: setConfig,
|
|
32
|
+
onStatusChange: setStatus,
|
|
33
|
+
}),
|
|
34
|
+
}),
|
|
35
|
+
_jsx("div", {
|
|
36
|
+
className:
|
|
37
|
+
"flex-1 h-full overflow-hidden [background-image:radial-gradient(var(--color-border)_1px,var(--color-bg)_1px)] [background-size:20px_20px] flex items-center justify-center p-5",
|
|
38
|
+
children: _jsx(ChatPreview, {
|
|
39
|
+
config: config,
|
|
40
|
+
status: status,
|
|
41
|
+
iframeSrc: iframeSrc,
|
|
42
|
+
}),
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export { DEFAULT_CONFIG };
|
|
49
|
+
//# sourceMappingURL=PlaygroundLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlaygroundLayout.js","sourceRoot":"","sources":["../../../src/gui/components/PlaygroundLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,WAAW,EAAoB,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,cAAc,GAAgB;IAClC,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,SAAS;IACtB,UAAU,EAAE,OAAO;IACnB,QAAQ,EAAE,EAAE;IACZ,oBAAoB,EAAE,aAAa;CACpC,CAAC;AAQF,MAAM,UAAU,gBAAgB,CAAC,EAC/B,aAAa,GAAG,cAAc,EAC9B,aAAa,GAAG,QAAQ,EACxB,SAAS,GACa;IACtB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAc,aAAa,CAAC,CAAC;IACjE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IAEpD,OAAO,CACL,cACE,SAAS,EAAC,iCAAiC,gBAC/B,MAAM,CAAC,WAAW,YAE9B,eAAK,SAAS,EAAC,oBAAoB,aACjC,cAAK,SAAS,EAAC,gDAAgD,YAC7D,KAAC,WAAW,IACV,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,SAAS,EACzB,cAAc,EAAE,SAAS,GACzB,GACE,EACN,cAAK,SAAS,EAAC,gLAAgL,YAC7L,KAAC,WAAW,IAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAI,GACjE,IACF,GACF,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -4,28 +4,34 @@ import * as React from "react";
|
|
|
4
4
|
* Reasoning component inspired by shadcn.io/ai
|
|
5
5
|
* Displays AI thinking/reasoning process with auto-collapse support
|
|
6
6
|
*/
|
|
7
|
-
declare const reasoningContainerVariants: (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
7
|
+
declare const reasoningContainerVariants: (
|
|
8
|
+
props?:
|
|
9
|
+
| ({
|
|
10
|
+
variant?: "default" | "subtle" | "prominent" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp)
|
|
12
|
+
| undefined,
|
|
13
|
+
) => string;
|
|
14
|
+
export interface ReasoningProps
|
|
15
|
+
extends VariantProps<typeof reasoningContainerVariants> {
|
|
16
|
+
/** The reasoning/thinking content */
|
|
17
|
+
content?: string;
|
|
18
|
+
/** Whether the content is currently streaming */
|
|
19
|
+
isStreaming?: boolean;
|
|
20
|
+
/** Display mode - collapsible or always visible */
|
|
21
|
+
mode?: "collapsible" | "inline";
|
|
22
|
+
/** Default expanded state (default: false - collapsed by default) */
|
|
23
|
+
defaultExpanded?: boolean;
|
|
24
|
+
/** Auto-expand when streaming starts (default: false) */
|
|
25
|
+
autoExpand?: boolean;
|
|
26
|
+
/** Auto-collapse after streaming completes */
|
|
27
|
+
autoCollapse?: boolean;
|
|
28
|
+
/** Delay before auto-collapsing (ms) */
|
|
29
|
+
autoCollapseDelay?: number;
|
|
30
|
+
/** Custom label */
|
|
31
|
+
label?: string;
|
|
32
|
+
/** Additional CSS class */
|
|
33
|
+
className?: string;
|
|
29
34
|
}
|
|
30
|
-
export declare const Reasoning: React.ForwardRefExoticComponent<
|
|
31
|
-
|
|
35
|
+
export declare const Reasoning: React.ForwardRefExoticComponent<
|
|
36
|
+
ReasoningProps & React.RefAttributes<HTMLDivElement>
|
|
37
|
+
>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Reasoning.d.ts","sourceRoot":"","sources":["../../../src/gui/components/Reasoning.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE;;;GAGG;AAEH,QAAA,MAAM,0BAA0B;;8EAc/B,CAAC;AAiBF,MAAM,WAAW,cACf,SAAQ,YAAY,CAAC,OAAO,0BAA0B,CAAC;IACvD,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mDAAmD;IACnD,IAAI,CAAC,EAAE,aAAa,GAAG,QAAQ,CAAC;IAChC,qEAAqE;IACrE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yDAAyD;IACzD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,wCAAwC;IACxC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,uFA+HrB,CAAC"}
|
|
@@ -1,70 +1,197 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { cva } from "class-variance-authority";
|
|
3
2
|
import { ChevronDown } from "lucide-react";
|
|
4
3
|
import * as React from "react";
|
|
5
4
|
import { useEffect, useState } from "react";
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { cn } from "../lib/utils.js";
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* Reasoning component inspired by shadcn.io/ai
|
|
9
10
|
* Displays AI thinking/reasoning process with auto-collapse support
|
|
10
11
|
*/
|
|
11
|
-
const reasoningContainerVariants = cva(
|
|
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
|
-
|
|
12
|
+
const reasoningContainerVariants = cva(
|
|
13
|
+
"mb-3 rounded-lg bg-card border border-border transition-all",
|
|
14
|
+
{
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
default: "opacity-70",
|
|
18
|
+
subtle: "opacity-50",
|
|
19
|
+
prominent: "opacity-90 shadow-sm",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: "default",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
const reasoningIconVariants = cva(
|
|
28
|
+
"w-4 h-4 text-foreground opacity-60 transition-transform duration-200",
|
|
29
|
+
{
|
|
30
|
+
variants: {
|
|
31
|
+
expanded: {
|
|
32
|
+
true: "rotate-180",
|
|
33
|
+
false: "",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
expanded: false,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
export const Reasoning = React.forwardRef(
|
|
42
|
+
(
|
|
43
|
+
{
|
|
44
|
+
content,
|
|
45
|
+
isStreaming = false,
|
|
46
|
+
mode = "collapsible",
|
|
47
|
+
defaultExpanded = false,
|
|
48
|
+
autoExpand = false,
|
|
49
|
+
autoCollapse = true,
|
|
50
|
+
autoCollapseDelay = 2000,
|
|
51
|
+
label = "Thinking",
|
|
52
|
+
variant,
|
|
53
|
+
className,
|
|
54
|
+
},
|
|
55
|
+
ref,
|
|
56
|
+
) => {
|
|
57
|
+
const [isExpanded, setIsExpanded] = useState(
|
|
58
|
+
mode === "inline" ? true : defaultExpanded,
|
|
59
|
+
);
|
|
60
|
+
const [shouldAutoCollapse, setShouldAutoCollapse] = useState(false);
|
|
61
|
+
// Handle auto-collapse after streaming completes
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (autoCollapse && !isStreaming && content && mode === "collapsible") {
|
|
64
|
+
const timer = setTimeout(() => {
|
|
65
|
+
setShouldAutoCollapse(true);
|
|
66
|
+
setIsExpanded(false);
|
|
67
|
+
}, autoCollapseDelay);
|
|
68
|
+
return () => clearTimeout(timer);
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}, [isStreaming, content, autoCollapse, autoCollapseDelay, mode]);
|
|
72
|
+
// Auto-expand when streaming starts (only if autoExpand is enabled)
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (
|
|
75
|
+
autoExpand &&
|
|
76
|
+
isStreaming &&
|
|
77
|
+
mode === "collapsible" &&
|
|
78
|
+
!shouldAutoCollapse
|
|
79
|
+
) {
|
|
80
|
+
setIsExpanded(true);
|
|
81
|
+
}
|
|
82
|
+
}, [autoExpand, isStreaming, mode, shouldAutoCollapse]);
|
|
83
|
+
if (!content && !isStreaming) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
// Inline mode - always visible
|
|
87
|
+
if (mode === "inline") {
|
|
88
|
+
return _jsxs("div", {
|
|
89
|
+
ref: ref,
|
|
90
|
+
className: cn(
|
|
91
|
+
reasoningContainerVariants({ variant }),
|
|
92
|
+
"p-3",
|
|
93
|
+
className,
|
|
94
|
+
),
|
|
95
|
+
children: [
|
|
96
|
+
_jsxs("div", {
|
|
97
|
+
className: "flex items-start gap-2 mb-2",
|
|
98
|
+
children: [
|
|
99
|
+
_jsx("span", {
|
|
100
|
+
className:
|
|
101
|
+
"text-xs font-medium text-foreground opacity-60 uppercase tracking-wide",
|
|
102
|
+
children: label,
|
|
103
|
+
}),
|
|
104
|
+
isStreaming &&
|
|
105
|
+
_jsx("span", {
|
|
106
|
+
className:
|
|
107
|
+
"inline-block w-2 h-2 bg-primary rounded-full animate-pulse",
|
|
108
|
+
}),
|
|
109
|
+
],
|
|
110
|
+
}),
|
|
111
|
+
_jsxs("div", {
|
|
112
|
+
className:
|
|
113
|
+
"text-sm italic text-foreground opacity-80 leading-relaxed whitespace-pre-wrap",
|
|
114
|
+
children: [
|
|
115
|
+
content,
|
|
116
|
+
isStreaming &&
|
|
117
|
+
content &&
|
|
118
|
+
_jsx("span", {
|
|
119
|
+
className: "inline-block animate-typing text-primary",
|
|
120
|
+
children: "...",
|
|
121
|
+
}),
|
|
122
|
+
],
|
|
123
|
+
}),
|
|
124
|
+
],
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
// Collapsible mode
|
|
128
|
+
return _jsxs("div", {
|
|
129
|
+
ref: ref,
|
|
130
|
+
className: cn("mb-3", className),
|
|
131
|
+
children: [
|
|
132
|
+
_jsxs("button", {
|
|
133
|
+
type: "button",
|
|
134
|
+
onClick: () => {
|
|
135
|
+
setIsExpanded(!isExpanded);
|
|
136
|
+
setShouldAutoCollapse(false); // Disable auto-collapse on manual interaction
|
|
137
|
+
},
|
|
138
|
+
className:
|
|
139
|
+
"w-full flex items-center justify-between p-2.5 rounded-lg bg-card border border-border hover:bg-card/80 hover:shadow-sm transition-all text-left",
|
|
140
|
+
"aria-expanded": isExpanded,
|
|
141
|
+
"aria-label": `${isExpanded ? "Collapse" : "Expand"} reasoning`,
|
|
142
|
+
children: [
|
|
143
|
+
_jsxs("div", {
|
|
144
|
+
className: "flex items-center gap-2 flex-1 min-w-0",
|
|
145
|
+
children: [
|
|
146
|
+
_jsx("span", {
|
|
147
|
+
className:
|
|
148
|
+
"text-xs font-medium text-foreground opacity-60 uppercase tracking-wide shrink-0",
|
|
149
|
+
children: label,
|
|
150
|
+
}),
|
|
151
|
+
isStreaming &&
|
|
152
|
+
_jsx("span", {
|
|
153
|
+
className:
|
|
154
|
+
"inline-block w-2 h-2 bg-primary rounded-full animate-pulse shrink-0",
|
|
155
|
+
}),
|
|
156
|
+
!isExpanded &&
|
|
157
|
+
content &&
|
|
158
|
+
_jsxs("span", {
|
|
159
|
+
className: "text-xs text-foreground opacity-50 truncate",
|
|
160
|
+
children: [
|
|
161
|
+
content.substring(0, 60),
|
|
162
|
+
content.length > 60 && "...",
|
|
163
|
+
],
|
|
164
|
+
}),
|
|
165
|
+
],
|
|
166
|
+
}),
|
|
167
|
+
_jsx(ChevronDown, {
|
|
168
|
+
className: reasoningIconVariants({ expanded: isExpanded }),
|
|
169
|
+
"aria-hidden": "true",
|
|
170
|
+
}),
|
|
171
|
+
],
|
|
172
|
+
}),
|
|
173
|
+
isExpanded &&
|
|
174
|
+
_jsx("div", {
|
|
175
|
+
className: cn(
|
|
176
|
+
reasoningContainerVariants({ variant }),
|
|
177
|
+
"mt-2 p-3 animate-fadeIn",
|
|
178
|
+
),
|
|
179
|
+
children: _jsxs("div", {
|
|
180
|
+
className:
|
|
181
|
+
"text-sm italic text-foreground opacity-80 leading-relaxed whitespace-pre-wrap",
|
|
182
|
+
children: [
|
|
183
|
+
content,
|
|
184
|
+
isStreaming &&
|
|
185
|
+
content &&
|
|
186
|
+
_jsx("span", {
|
|
187
|
+
className: "inline-block animate-typing text-primary",
|
|
188
|
+
children: "...",
|
|
189
|
+
}),
|
|
190
|
+
],
|
|
191
|
+
}),
|
|
192
|
+
}),
|
|
193
|
+
],
|
|
194
|
+
});
|
|
195
|
+
},
|
|
196
|
+
);
|
|
70
197
|
Reasoning.displayName = "Reasoning";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Reasoning.js","sourceRoot":"","sources":["../../../src/gui/components/Reasoning.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC;;;GAGG;AAEH,MAAM,0BAA0B,GAAG,GAAG,CACpC,8FAA8F,EAC9F;IACE,QAAQ,EAAE;QACR,OAA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,EAAC,qMAAqM,mBAChM,UAAU,gBACb,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,YAAY,aAE7D,eAAK,SAAS,EAAC,wCAAwC,aACrD,eAAM,SAAS,EAAC,0FAA0F,YACvG,KAAK,GACD,EACN,WAAW,IAAI,CACd,eAAM,SAAS,EAAC,mFAAmF,GAAG,CACvG,EACA,CAAC,UAAU,IAAI,OAAO,IAAI,CACzB,gBAAM,SAAS,EAAC,sDAAsD,aACnE,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EACxB,OAAO,CAAC,MAAM,GAAG,EAAE,IAAI,KAAK,IACxB,CACR,IACG,EACN,KAAC,WAAW,IACV,SAAS,EAAE,qBAAqB,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,iBAC9C,MAAM,GAClB,IACK,EACR,UAAU,IAAI,CACb,cACE,SAAS,EAAE,EAAE,CACX,0BAA0B,CAAC,EAAE,OAAO,EAAE,CAAC,EACvC,yBAAyB,CAC1B,YAED,eAAK,SAAS,EAAC,wFAAwF,aACpG,OAAO,EACP,WAAW,IAAI,OAAO,IAAI,CACzB,eAAM,SAAS,EAAC,wDAAwD,oBAEjE,CACR,IACG,GACF,CACP,IACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
|
@@ -4,13 +4,15 @@ import * as React from "react";
|
|
|
4
4
|
* Streaming-optimized markdown renderer for AI-generated content
|
|
5
5
|
*/
|
|
6
6
|
export interface ResponseProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
/** The markdown content to render */
|
|
8
|
+
content: string;
|
|
9
|
+
/** Whether the content is currently streaming */
|
|
10
|
+
isStreaming?: boolean;
|
|
11
|
+
/** Show empty state when no content */
|
|
12
|
+
showEmpty?: boolean;
|
|
13
|
+
/** Custom empty state message */
|
|
14
|
+
emptyMessage?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare const Response: React.ForwardRefExoticComponent<
|
|
16
|
+
export declare const Response: React.ForwardRefExoticComponent<
|
|
17
|
+
ResponseProps & React.RefAttributes<HTMLDivElement>
|
|
18
|
+
>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Response.d.ts","sourceRoot":"","sources":["../../../src/gui/components/Response.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;;GAGG;AAEH,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACzE,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,QAAQ,sFA8NpB,CAAC"}
|