@townco/ui 0.1.47 → 0.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/dist/core/hooks/index.d.ts +1 -0
  2. package/dist/core/hooks/index.js +1 -0
  3. package/dist/core/hooks/use-chat-input.d.ts +2 -0
  4. package/dist/core/hooks/use-chat-input.js +11 -1
  5. package/dist/core/hooks/use-chat-messages.d.ts +22 -1
  6. package/dist/core/hooks/use-chat-messages.js +19 -4
  7. package/dist/core/hooks/use-chat-session.js +22 -0
  8. package/dist/core/hooks/use-message-history.d.ts +12 -0
  9. package/dist/core/hooks/use-message-history.js +113 -0
  10. package/dist/core/hooks/use-tool-calls.d.ts +11 -0
  11. package/dist/core/schemas/chat.d.ts +40 -0
  12. package/dist/core/schemas/chat.js +9 -0
  13. package/dist/core/schemas/tool-call.d.ts +34 -0
  14. package/dist/core/schemas/tool-call.js +27 -0
  15. package/dist/core/store/chat-store.d.ts +7 -0
  16. package/dist/core/store/chat-store.js +46 -0
  17. package/dist/gui/components/ChatEmptyState.d.ts +4 -0
  18. package/dist/gui/components/ChatEmptyState.js +2 -2
  19. package/dist/gui/components/ChatInput.d.ts +21 -1
  20. package/dist/gui/components/ChatInput.js +184 -7
  21. package/dist/gui/components/ChatLayout.d.ts +3 -2
  22. package/dist/gui/components/ChatLayout.js +7 -7
  23. package/dist/gui/components/ChatPanelTabContent.d.ts +17 -0
  24. package/dist/gui/components/ChatPanelTabContent.js +6 -5
  25. package/dist/gui/components/ChatView.d.ts +3 -1
  26. package/dist/gui/components/ChatView.js +81 -49
  27. package/dist/gui/components/ContextUsageButton.d.ts +2 -0
  28. package/dist/gui/components/ContextUsageButton.js +3 -1
  29. package/dist/gui/components/InvokingGroup.d.ts +9 -0
  30. package/dist/gui/components/InvokingGroup.js +16 -0
  31. package/dist/gui/components/MessageContent.js +122 -6
  32. package/dist/gui/components/PanelTabsHeader.d.ts +1 -1
  33. package/dist/gui/components/PanelTabsHeader.js +6 -1
  34. package/dist/gui/components/Response.js +2 -0
  35. package/dist/gui/components/Task.js +3 -3
  36. package/dist/gui/components/TodoListItem.js +1 -1
  37. package/dist/gui/components/ToolCall.js +57 -5
  38. package/dist/gui/components/ToolCallGroup.d.ts +8 -0
  39. package/dist/gui/components/ToolCallGroup.js +29 -0
  40. package/dist/gui/components/index.d.ts +1 -2
  41. package/dist/gui/components/index.js +1 -2
  42. package/dist/sdk/client/acp-client.d.ts +24 -1
  43. package/dist/sdk/client/acp-client.js +28 -7
  44. package/dist/sdk/schemas/message.d.ts +41 -9
  45. package/dist/sdk/schemas/message.js +15 -3
  46. package/dist/sdk/schemas/session.d.ts +75 -10
  47. package/dist/sdk/transports/http.d.ts +14 -0
  48. package/dist/sdk/transports/http.js +130 -36
  49. package/dist/sdk/transports/stdio.d.ts +14 -0
  50. package/dist/sdk/transports/stdio.js +27 -10
  51. package/dist/sdk/transports/types.d.ts +29 -0
  52. package/package.json +3 -3
  53. package/dist/core/hooks/index.d.ts.map +0 -1
  54. package/dist/core/hooks/index.js.map +0 -1
  55. package/dist/core/hooks/use-chat-input.d.ts.map +0 -1
  56. package/dist/core/hooks/use-chat-input.js.map +0 -1
  57. package/dist/core/hooks/use-chat-messages.d.ts.map +0 -1
  58. package/dist/core/hooks/use-chat-messages.js.map +0 -1
  59. package/dist/core/hooks/use-chat-session.d.ts.map +0 -1
  60. package/dist/core/hooks/use-chat-session.js.map +0 -1
  61. package/dist/core/index.d.ts.map +0 -1
  62. package/dist/core/index.js.map +0 -1
  63. package/dist/core/lib/logger.d.ts +0 -24
  64. package/dist/core/lib/logger.js +0 -108
  65. package/dist/core/schemas/chat.d.ts.map +0 -1
  66. package/dist/core/schemas/chat.js.map +0 -1
  67. package/dist/core/schemas/index.d.ts.map +0 -1
  68. package/dist/core/schemas/index.js.map +0 -1
  69. package/dist/core/store/chat-store.d.ts.map +0 -1
  70. package/dist/core/store/chat-store.js.map +0 -1
  71. package/dist/gui/components/Button.d.ts.map +0 -1
  72. package/dist/gui/components/Button.js.map +0 -1
  73. package/dist/gui/components/Card.d.ts.map +0 -1
  74. package/dist/gui/components/Card.js.map +0 -1
  75. package/dist/gui/components/ChatInput.d.ts.map +0 -1
  76. package/dist/gui/components/ChatInput.js.map +0 -1
  77. package/dist/gui/components/ChatSecondaryPanel.d.ts.map +0 -1
  78. package/dist/gui/components/ChatSecondaryPanel.js.map +0 -1
  79. package/dist/gui/components/ChatStatus.d.ts.map +0 -1
  80. package/dist/gui/components/ChatStatus.js.map +0 -1
  81. package/dist/gui/components/Conversation.d.ts.map +0 -1
  82. package/dist/gui/components/Conversation.js.map +0 -1
  83. package/dist/gui/components/Dialog.d.ts.map +0 -1
  84. package/dist/gui/components/Dialog.js.map +0 -1
  85. package/dist/gui/components/HeightTransition.d.ts.map +0 -1
  86. package/dist/gui/components/HeightTransition.js.map +0 -1
  87. package/dist/gui/components/Input.d.ts.map +0 -1
  88. package/dist/gui/components/Input.js.map +0 -1
  89. package/dist/gui/components/Label.d.ts.map +0 -1
  90. package/dist/gui/components/Label.js.map +0 -1
  91. package/dist/gui/components/MarkdownRenderer.d.ts.map +0 -1
  92. package/dist/gui/components/MarkdownRenderer.js.map +0 -1
  93. package/dist/gui/components/Message.d.ts.map +0 -1
  94. package/dist/gui/components/Message.js.map +0 -1
  95. package/dist/gui/components/MessageContent.d.ts.map +0 -1
  96. package/dist/gui/components/MessageContent.js.map +0 -1
  97. package/dist/gui/components/MessageList.d.ts.map +0 -1
  98. package/dist/gui/components/MessageList.js.map +0 -1
  99. package/dist/gui/components/Reasoning.d.ts.map +0 -1
  100. package/dist/gui/components/Reasoning.js.map +0 -1
  101. package/dist/gui/components/Response.d.ts.map +0 -1
  102. package/dist/gui/components/Response.js.map +0 -1
  103. package/dist/gui/components/Select.d.ts.map +0 -1
  104. package/dist/gui/components/Select.js.map +0 -1
  105. package/dist/gui/components/Tabs.d.ts.map +0 -1
  106. package/dist/gui/components/Tabs.js.map +0 -1
  107. package/dist/gui/components/Task.d.ts.map +0 -1
  108. package/dist/gui/components/Task.js.map +0 -1
  109. package/dist/gui/components/Textarea.d.ts.map +0 -1
  110. package/dist/gui/components/Textarea.js.map +0 -1
  111. package/dist/gui/components/ThinkingBlock.d.ts.map +0 -1
  112. package/dist/gui/components/ThinkingBlock.js.map +0 -1
  113. package/dist/gui/components/TodoList.d.ts.map +0 -1
  114. package/dist/gui/components/TodoList.js.map +0 -1
  115. package/dist/gui/components/TodoListItem.d.ts.map +0 -1
  116. package/dist/gui/components/TodoListItem.js.map +0 -1
  117. package/dist/gui/components/index.d.ts.map +0 -1
  118. package/dist/gui/components/index.js.map +0 -1
  119. package/dist/gui/index.d.ts.map +0 -1
  120. package/dist/gui/index.js.map +0 -1
  121. package/dist/gui/lib/utils.d.ts.map +0 -1
  122. package/dist/gui/lib/utils.js.map +0 -1
  123. package/dist/index.d.ts.map +0 -1
  124. package/dist/index.js.map +0 -1
  125. package/dist/sdk/client/acp-client.d.ts.map +0 -1
  126. package/dist/sdk/client/acp-client.js.map +0 -1
  127. package/dist/sdk/client/index.d.ts.map +0 -1
  128. package/dist/sdk/client/index.js.map +0 -1
  129. package/dist/sdk/index.d.ts.map +0 -1
  130. package/dist/sdk/index.js.map +0 -1
  131. package/dist/sdk/schemas/agent.d.ts.map +0 -1
  132. package/dist/sdk/schemas/agent.js.map +0 -1
  133. package/dist/sdk/schemas/index.d.ts.map +0 -1
  134. package/dist/sdk/schemas/index.js.map +0 -1
  135. package/dist/sdk/schemas/message.d.ts.map +0 -1
  136. package/dist/sdk/schemas/message.js.map +0 -1
  137. package/dist/sdk/schemas/session.d.ts.map +0 -1
  138. package/dist/sdk/schemas/session.js.map +0 -1
  139. package/dist/sdk/transports/http.d.ts.map +0 -1
  140. package/dist/sdk/transports/http.js.map +0 -1
  141. package/dist/sdk/transports/index.d.ts.map +0 -1
  142. package/dist/sdk/transports/index.js.map +0 -1
  143. package/dist/sdk/transports/stdio.d.ts.map +0 -1
  144. package/dist/sdk/transports/stdio.js.map +0 -1
  145. package/dist/sdk/transports/types.d.ts.map +0 -1
  146. package/dist/sdk/transports/types.js.map +0 -1
  147. package/dist/sdk/transports/websocket.d.ts.map +0 -1
  148. package/dist/sdk/transports/websocket.js.map +0 -1
  149. package/dist/test-http-client.d.ts +0 -11
  150. package/dist/test-http-client.d.ts.map +0 -1
  151. package/dist/test-http-client.js +0 -147
  152. package/dist/test-http-client.js.map +0 -1
  153. package/dist/test-http-transport.d.ts +0 -11
  154. package/dist/test-http-transport.d.ts.map +0 -1
  155. package/dist/test-http-transport.js +0 -127
  156. package/dist/test-http-transport.js.map +0 -1
  157. package/dist/tui/components/ChatView.d.ts.map +0 -1
  158. package/dist/tui/components/ChatView.js.map +0 -1
  159. package/dist/tui/components/GameOfLife.d.ts.map +0 -1
  160. package/dist/tui/components/GameOfLife.js.map +0 -1
  161. package/dist/tui/components/InputBox.d.ts.map +0 -1
  162. package/dist/tui/components/InputBox.js.map +0 -1
  163. package/dist/tui/components/MessageList.d.ts.map +0 -1
  164. package/dist/tui/components/MessageList.js.map +0 -1
  165. package/dist/tui/components/ReadlineInput.d.ts.map +0 -1
  166. package/dist/tui/components/ReadlineInput.js.map +0 -1
  167. package/dist/tui/components/StatusBar.d.ts.map +0 -1
  168. package/dist/tui/components/StatusBar.js.map +0 -1
  169. package/dist/tui/components/index.d.ts.map +0 -1
  170. package/dist/tui/components/index.js.map +0 -1
  171. package/dist/tui/index.d.ts.map +0 -1
  172. package/dist/tui/index.js.map +0 -1
@@ -1,13 +1,15 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import JsonView from "@uiw/react-json-view";
3
- import { CheckSquare, ChevronDown, Cloud, Edit, FileText, Globe, Link, Search, Wrench, } from "lucide-react";
4
- import { useState } from "react";
3
+ import { AlertCircle, BrainCircuit, CheckSquare, ChevronDown, ChevronRight, Cloud, Edit, FileText, Globe, Image, Link, Search, Wrench, } from "lucide-react";
4
+ import React, { useState } from "react";
5
+ import { ChatLayout } from "./index.js";
5
6
  import { useTheme } from "./ThemeProvider.js";
6
7
  /**
7
8
  * Map of icon names to Lucide components
8
9
  */
9
10
  const ICON_MAP = {
10
11
  Globe: Globe,
12
+ Image: Image,
11
13
  Link: Link,
12
14
  Cloud: Cloud,
13
15
  CheckSquare: CheckSquare,
@@ -15,6 +17,7 @@ const ICON_MAP = {
15
17
  FileText: FileText,
16
18
  Edit: Edit,
17
19
  Wrench: Wrench,
20
+ BrainCircuit: BrainCircuit,
18
21
  };
19
22
  /**
20
23
  * Tool call kind icons (using emoji for simplicity)
@@ -37,12 +40,39 @@ const _kindIcons = {
37
40
  export function ToolCall({ toolCall }) {
38
41
  const [isExpanded, setIsExpanded] = useState(false);
39
42
  const { resolvedTheme } = useTheme();
43
+ // Detect TodoWrite tool
44
+ const isTodoWrite = toolCall.title === "todo_write";
45
+ // Safely access ChatLayout context - will be undefined if not within ChatLayout
46
+ const layoutContext = React.useContext(ChatLayout.Context);
47
+ // Click handler: toggle sidepanel for TodoWrite, expand for others
48
+ const handleHeaderClick = React.useCallback(() => {
49
+ if (isTodoWrite && layoutContext) {
50
+ // Toggle sidepanel - close if already open on todo tab, otherwise open
51
+ if (layoutContext.panelSize !== "hidden" &&
52
+ layoutContext.activeTab === "todo") {
53
+ layoutContext.setPanelSize("hidden");
54
+ }
55
+ else {
56
+ layoutContext.setPanelSize("small");
57
+ layoutContext.setActiveTab("todo");
58
+ }
59
+ }
60
+ else {
61
+ // Normal expand/collapse
62
+ setIsExpanded(!isExpanded);
63
+ }
64
+ }, [isTodoWrite, layoutContext, isExpanded]);
40
65
  // Determine which icon to show
41
66
  const IconComponent = toolCall.icon && ICON_MAP[toolCall.icon]
42
67
  ? ICON_MAP[toolCall.icon]
43
- : Wrench;
68
+ : BrainCircuit;
44
69
  // Determine display name
45
70
  const displayName = toolCall.prettyName || toolCall.title;
71
+ // Check if there's an error
72
+ const hasError = toolCall.status === "failed" || !!toolCall.error;
73
+ // Check if this is a preliminary (pending) tool call without full details yet
74
+ const isPreliminary = toolCall.status === "pending" &&
75
+ (!toolCall.rawInput || Object.keys(toolCall.rawInput).length === 0);
46
76
  // JSON View style based on theme
47
77
  const jsonStyle = {
48
78
  fontSize: "11px",
@@ -74,7 +104,11 @@ export function ToolCall({ toolCall }) {
74
104
  "--w-rjv-type-nan-color": resolvedTheme === "dark" ? "#ef4444" : "#dc2626",
75
105
  "--w-rjv-type-undefined-color": resolvedTheme === "dark" ? "#ef4444" : "#dc2626",
76
106
  };
77
- return (_jsxs("div", { className: "flex flex-col my-4", children: [_jsx("button", { type: "button", className: "flex items-center gap-2 cursor-pointer bg-transparent border-none p-0 text-left group w-fit", onClick: () => setIsExpanded(!isExpanded), "aria-expanded": isExpanded, children: _jsxs("div", { className: "flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground", children: [_jsx("div", { className: "text-muted-foreground", children: _jsx(IconComponent, { className: "h-3 w-3" }) }), _jsx("span", { className: "text-paragraph-sm text-muted-foreground", children: displayName }), _jsx(ChevronDown, { className: `h-3 w-3 text-muted-foreground/70 transition-transform duration-200 ${isExpanded ? "rotate-180" : ""}` })] }) }), isExpanded && (_jsxs("div", { className: "mt-2 text-sm border border-border rounded-lg bg-card overflow-hidden w-full", children: [toolCall.locations && toolCall.locations.length > 0 && (_jsxs("div", { className: "p-3 border-b border-border", children: [_jsx("div", { className: "text-[10px] font-bold text-muted-foreground uppercase tracking-wider mb-1.5 font-sans", children: "Files" }), _jsx("ul", { className: "space-y-1", children: toolCall.locations.map((loc) => (_jsxs("li", { className: "font-mono text-[11px] text-foreground bg-muted px-1.5 py-0.5 rounded w-fit", children: [loc.path, loc.line !== null &&
107
+ // Preliminary tool calls show as simple light gray text without expansion
108
+ if (isPreliminary) {
109
+ return (_jsx("div", { className: "flex flex-col my-4", children: _jsxs("span", { className: "text-paragraph-sm text-muted-foreground/50", children: ["Invoking ", displayName] }) }));
110
+ }
111
+ return (_jsxs("div", { className: "flex flex-col my-4", children: [_jsxs("button", { type: "button", className: "flex flex-col items-start gap-0.5 cursor-pointer bg-transparent border-none p-0 text-left group w-fit", onClick: handleHeaderClick, "aria-expanded": isTodoWrite ? undefined : isExpanded, children: [_jsxs("div", { className: "flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground", children: [_jsx("div", { className: "text-muted-foreground", children: _jsx(IconComponent, { className: "h-3 w-3" }) }), _jsx("span", { className: "text-paragraph-sm text-muted-foreground", children: displayName }), hasError && _jsx(AlertCircle, { className: "h-3 w-3 text-destructive" }), isTodoWrite ? (_jsx(ChevronRight, { className: "h-3 w-3 text-muted-foreground/70" })) : (_jsx(ChevronDown, { className: `h-3 w-3 text-muted-foreground/70 transition-transform duration-200 ${isExpanded ? "rotate-180" : ""}` }))] }), toolCall.subline && (_jsx("span", { className: "text-paragraph-sm text-muted-foreground/70 pl-4.5", children: toolCall.subline }))] }), !isTodoWrite && isExpanded && (_jsxs("div", { className: "mt-2 text-sm border border-border rounded-lg bg-card overflow-hidden w-full", children: [toolCall.locations && toolCall.locations.length > 0 && (_jsxs("div", { className: "p-3 border-b border-border", children: [_jsx("div", { className: "text-[10px] font-bold text-muted-foreground uppercase tracking-wider mb-1.5 font-sans", children: "Files" }), _jsx("ul", { className: "space-y-1", children: toolCall.locations.map((loc) => (_jsxs("li", { className: "font-mono text-[11px] text-foreground bg-muted px-1.5 py-0.5 rounded w-fit", children: [loc.path, loc.line !== null &&
78
112
  loc.line !== undefined &&
79
113
  `:${loc.line}`] }, `${loc.path}:${loc.line ?? ""}`))) })] })), toolCall.rawInput && Object.keys(toolCall.rawInput).length > 0 && (_jsxs("div", { className: "p-3 border-b border-border", children: [_jsx("div", { className: "text-[10px] font-bold text-muted-foreground uppercase tracking-wider mb-1.5 font-sans", children: "Input" }), _jsx("div", { className: "text-[11px] font-mono text-foreground", children: _jsx(JsonView, { value: toolCall.rawInput, collapsed: false, displayDataTypes: false, displayObjectSize: false, enableClipboard: true, style: jsonStyle }) })] })), (toolCall.content && toolCall.content.length > 0) ||
80
114
  toolCall.error ? (_jsxs("div", { className: "p-3 border-b border-border last:border-0", children: [_jsx("div", { className: "text-[10px] font-bold text-muted-foreground uppercase tracking-wider mb-1.5 font-sans", children: "Output" }), _jsxs("div", { className: "space-y-2 text-[11px] text-foreground", children: [toolCall.content?.map((block, idx) => {
@@ -122,6 +156,24 @@ export function ToolCall({ toolCall }) {
122
156
  if (block.type === "text" && "text" in block) {
123
157
  return renderTextContent(block.text, getBlockKey());
124
158
  }
159
+ // Handle image blocks
160
+ if (block.type === "image") {
161
+ const alt = block.alt || "Generated image";
162
+ let imageSrc;
163
+ if ("data" in block) {
164
+ // Base64 encoded image
165
+ const mimeType = block.mimeType || "image/png";
166
+ imageSrc = `data:${mimeType};base64,${block.data}`;
167
+ }
168
+ else if ("url" in block) {
169
+ // URL or file path
170
+ imageSrc = block.url;
171
+ }
172
+ else {
173
+ return null;
174
+ }
175
+ return (_jsx("div", { className: "my-2", children: _jsx("img", { src: imageSrc, alt: alt, className: "max-w-full h-auto rounded-md border border-border" }) }, getBlockKey()));
176
+ }
125
177
  // Handle diff blocks
126
178
  if (block.type === "diff" &&
127
179
  "path" in block &&
@@ -0,0 +1,8 @@
1
+ import type { ToolCall as ToolCallType } from "../../core/schemas/tool-call.js";
2
+ export interface ToolCallGroupProps {
3
+ toolCalls: ToolCallType[];
4
+ }
5
+ /**
6
+ * ToolCallGroup component - displays a group of parallel tool calls with collapsible details
7
+ */
8
+ export declare function ToolCallGroup({ toolCalls }: ToolCallGroupProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronDown, ListVideo } from "lucide-react";
3
+ import React, { useState } from "react";
4
+ import { ToolCall } from "./ToolCall.js";
5
+ /**
6
+ * ToolCallGroup component - displays a group of parallel tool calls with collapsible details
7
+ */
8
+ export function ToolCallGroup({ toolCalls }) {
9
+ const [isExpanded, setIsExpanded] = useState(false);
10
+ // Calculate group status based on individual tool call statuses
11
+ const getGroupStatus = () => {
12
+ const statuses = toolCalls.map((tc) => tc.status);
13
+ if (statuses.some((s) => s === "failed"))
14
+ return "failed";
15
+ if (statuses.some((s) => s === "in_progress"))
16
+ return "in_progress";
17
+ if (statuses.every((s) => s === "completed"))
18
+ return "completed";
19
+ return "pending";
20
+ };
21
+ const groupStatus = getGroupStatus();
22
+ // Generate summary of tool names
23
+ const toolNames = toolCalls.map((tc) => tc.prettyName || tc.title);
24
+ const uniqueNames = [...new Set(toolNames)];
25
+ const summary = uniqueNames.length <= 2
26
+ ? uniqueNames.join(", ")
27
+ : `${uniqueNames.slice(0, 2).join(", ")} +${uniqueNames.length - 2} more`;
28
+ return (_jsxs("div", { className: "flex flex-col my-4", children: [_jsxs("button", { type: "button", className: "flex flex-col items-start gap-0.5 cursor-pointer bg-transparent border-none p-0 text-left group w-fit", onClick: () => setIsExpanded(!isExpanded), "aria-expanded": isExpanded, children: [_jsxs("div", { className: "flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground", children: [_jsx("div", { className: "text-muted-foreground", children: _jsx(ListVideo, { className: "h-3 w-3" }) }), _jsx("span", { className: "text-paragraph-sm text-muted-foreground", children: "Parallel operation" }), _jsx("span", { className: "text-[10px] bg-muted px-1.5 py-0.5 rounded text-muted-foreground/70", children: toolCalls.length }), _jsx(ChevronDown, { className: `h-3 w-3 text-muted-foreground/70 transition-transform duration-200 ${isExpanded ? "rotate-180" : ""}` })] }), !isExpanded && (_jsx("span", { className: "text-paragraph-sm text-muted-foreground/70 pl-4.5", children: summary }))] }), isExpanded && (_jsx("div", { className: "mt-1", children: toolCalls.map((toolCall) => (_jsxs("div", { className: "flex items-start", children: [_jsx("div", { className: "w-2.5 h-4 border-l-2 border-b-2 border-border rounded-bl-[6px] mt-1 mr-0.5 shrink-0" }), _jsx("div", { className: "flex-1 -mt-2", children: _jsx(ToolCall, { toolCall: toolCall }) })] }, toolCall.id))) }))] }));
29
+ }
@@ -1,7 +1,6 @@
1
1
  export { toast } from "sonner";
2
2
  export { MockFileSystemProvider, mockFileSystemData, } from "../data/mockFileSystemData.js";
3
3
  export { mockSourceData } from "../data/mockSourceData.js";
4
- export { mockTodoData } from "../data/mockTodoData.js";
5
4
  export type { FileSystemData, FileSystemItem as FileSystemItemData, FileSystemItemType, FileSystemProvider, } from "../types/filesystem.js";
6
5
  export { Button, type ButtonProps, buttonVariants } from "./Button.js";
7
6
  export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "./Card.js";
@@ -10,7 +9,7 @@ export type { ConnectionStatus } from "./ChatHeader.js";
10
9
  export * as ChatHeader from "./ChatHeader.js";
11
10
  export { Actions as ChatInputActions, Attachment as ChatInputAttachment, type ChatInputActionsProps, type ChatInputAttachmentProps, type ChatInputCommandMenuProps, type ChatInputFieldProps, type ChatInputRootProps, type ChatInputSubmitProps, type ChatInputToolbarProps, type ChatInputVoiceInputProps, CommandMenu as ChatInputCommandMenu, type CommandMenuItem, Field as ChatInputField, Root as ChatInputRoot, Submit as ChatInputSubmit, Toolbar as ChatInputToolbar, VoiceInput as ChatInputVoiceInput, } from "./ChatInput.js";
12
11
  export * as ChatLayout from "./ChatLayout.js";
13
- export { DatabaseTabContent, type DatabaseTabContentProps, FilesTabContent, type FilesTabContentProps, SourcesTabContent, type SourcesTabContentProps, TodoTabContent, type TodoTabContentProps, } from "./ChatPanelTabContent.js";
12
+ export { DatabaseTabContent, type DatabaseTabContentProps, FilesTabContent, type FilesTabContentProps, SettingsTabContent, type SettingsTabContentProps, SourcesTabContent, type SourcesTabContentProps, TodoTabContent, type TodoTabContentProps, } from "./ChatPanelTabContent.js";
14
13
  export { ChatSecondaryPanel, type ChatSecondaryPanelProps, } from "./ChatSecondaryPanel.js";
15
14
  export * as ChatSidebar from "./ChatSidebar.js";
16
15
  export { ChatStatus, type ChatStatusProps } from "./ChatStatus.js";
@@ -2,7 +2,6 @@
2
2
  export { toast } from "sonner";
3
3
  export { MockFileSystemProvider, mockFileSystemData, } from "../data/mockFileSystemData.js";
4
4
  export { mockSourceData } from "../data/mockSourceData.js";
5
- export { mockTodoData } from "../data/mockTodoData.js";
6
5
  export { Button, buttonVariants } from "./Button.js";
7
6
  export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "./Card.js";
8
7
  export { ChatEmptyState } from "./ChatEmptyState.js";
@@ -11,7 +10,7 @@ export * as ChatHeader from "./ChatHeader.js";
11
10
  export { Actions as ChatInputActions, Attachment as ChatInputAttachment, CommandMenu as ChatInputCommandMenu, Field as ChatInputField, Root as ChatInputRoot, Submit as ChatInputSubmit, Toolbar as ChatInputToolbar, VoiceInput as ChatInputVoiceInput, } from "./ChatInput.js";
12
11
  // Chat layout components
13
12
  export * as ChatLayout from "./ChatLayout.js";
14
- export { DatabaseTabContent, FilesTabContent, SourcesTabContent, TodoTabContent, } from "./ChatPanelTabContent.js";
13
+ export { DatabaseTabContent, FilesTabContent, SettingsTabContent, SourcesTabContent, TodoTabContent, } from "./ChatPanelTabContent.js";
15
14
  export { ChatSecondaryPanel, } from "./ChatSecondaryPanel.js";
16
15
  export * as ChatSidebar from "./ChatSidebar.js";
17
16
  export { ChatStatus } from "./ChatStatus.js";
@@ -51,7 +51,13 @@ export declare class AcpClient {
51
51
  /**
52
52
  * Send a message in the current session
53
53
  */
54
- sendMessage(content: string, sessionId?: string): Promise<void>;
54
+ sendMessage(content: string, sessionId?: string, attachments?: Array<{
55
+ name: string;
56
+ path: string;
57
+ size: number;
58
+ mimeType: string;
59
+ data: string;
60
+ }>): Promise<void>;
55
61
  /**
56
62
  * Receive messages from the agent (streaming)
57
63
  */
@@ -80,6 +86,9 @@ export declare class AcpClient {
80
86
  * Get agent information
81
87
  * - displayName: Human-readable name for UI (preferred)
82
88
  * - name: Programmatic name (fallback if displayName not set)
89
+ * - tools: List of tools available to the agent
90
+ * - mcps: List of MCP servers connected to the agent
91
+ * - subagents: List of subagents available via Task tool
83
92
  */
84
93
  getAgentInfo(): {
85
94
  name?: string;
@@ -87,6 +96,20 @@ export declare class AcpClient {
87
96
  version?: string;
88
97
  description?: string;
89
98
  suggestedPrompts?: string[];
99
+ tools?: Array<{
100
+ name: string;
101
+ description?: string;
102
+ prettyName?: string;
103
+ icon?: string;
104
+ }>;
105
+ mcps?: Array<{
106
+ name: string;
107
+ transport: string;
108
+ }>;
109
+ subagents?: Array<{
110
+ name: string;
111
+ description: string;
112
+ }>;
90
113
  };
91
114
  /**
92
115
  * Create transport based on explicit configuration
@@ -134,7 +134,7 @@ export class AcpClient {
134
134
  /**
135
135
  * Send a message in the current session
136
136
  */
137
- async sendMessage(content, sessionId) {
137
+ async sendMessage(content, sessionId, attachments) {
138
138
  const targetSessionId = sessionId || this.currentSessionId;
139
139
  if (!targetSessionId) {
140
140
  throw new Error("No active session. Start a session first.");
@@ -146,16 +146,34 @@ export class AcpClient {
146
146
  if (!session) {
147
147
  throw new Error(`Session ${targetSessionId} not found`);
148
148
  }
149
+ // Create content blocks (images first, then text)
150
+ const contentBlocks = [];
151
+ // Add image attachments
152
+ if (attachments && attachments.length > 0) {
153
+ for (const attachment of attachments) {
154
+ // Only process image attachments
155
+ if (attachment.mimeType.startsWith("image/")) {
156
+ contentBlocks.push({
157
+ type: "image",
158
+ source: {
159
+ type: "base64",
160
+ media_type: attachment.mimeType,
161
+ data: attachment.data,
162
+ },
163
+ });
164
+ }
165
+ }
166
+ }
167
+ // Add text content
168
+ contentBlocks.push({
169
+ type: "text",
170
+ text: content,
171
+ });
149
172
  // Create message
150
173
  const message = {
151
174
  id: this.generateMessageId(),
152
175
  role: "user",
153
- content: [
154
- {
155
- type: "text",
156
- text: content,
157
- },
158
- ],
176
+ content: contentBlocks,
159
177
  timestamp: new Date().toISOString(),
160
178
  };
161
179
  // Add to session
@@ -215,6 +233,9 @@ export class AcpClient {
215
233
  * Get agent information
216
234
  * - displayName: Human-readable name for UI (preferred)
217
235
  * - name: Programmatic name (fallback if displayName not set)
236
+ * - tools: List of tools available to the agent
237
+ * - mcps: List of MCP servers connected to the agent
238
+ * - subagents: List of subagents available via Task tool
218
239
  */
219
240
  getAgentInfo() {
220
241
  return this.transport.getAgentInfo?.() || {};
@@ -41,13 +41,21 @@ export declare const TextContent: z.ZodObject<{
41
41
  }, z.core.$strip>;
42
42
  export type TextContent = z.infer<typeof TextContent>;
43
43
  /**
44
- * Image content
44
+ * Image content (supports both URLs and base64 data, matching Claude's API format)
45
45
  */
46
46
  export declare const ImageContent: z.ZodObject<{
47
47
  type: z.ZodLiteral<"image">;
48
48
  url: z.ZodOptional<z.ZodString>;
49
- data: z.ZodOptional<z.ZodString>;
50
- mimeType: z.ZodOptional<z.ZodString>;
49
+ source: z.ZodOptional<z.ZodObject<{
50
+ type: z.ZodLiteral<"base64">;
51
+ media_type: z.ZodEnum<{
52
+ "image/jpeg": "image/jpeg";
53
+ "image/png": "image/png";
54
+ "image/gif": "image/gif";
55
+ "image/webp": "image/webp";
56
+ }>;
57
+ data: z.ZodString;
58
+ }, z.core.$strip>>;
51
59
  }, z.core.$strip>;
52
60
  export type ImageContent = z.infer<typeof ImageContent>;
53
61
  /**
@@ -91,8 +99,16 @@ export declare const Content: z.ZodDiscriminatedUnion<[z.ZodObject<{
91
99
  }, z.core.$strip>, z.ZodObject<{
92
100
  type: z.ZodLiteral<"image">;
93
101
  url: z.ZodOptional<z.ZodString>;
94
- data: z.ZodOptional<z.ZodString>;
95
- mimeType: z.ZodOptional<z.ZodString>;
102
+ source: z.ZodOptional<z.ZodObject<{
103
+ type: z.ZodLiteral<"base64">;
104
+ media_type: z.ZodEnum<{
105
+ "image/jpeg": "image/jpeg";
106
+ "image/png": "image/png";
107
+ "image/gif": "image/gif";
108
+ "image/webp": "image/webp";
109
+ }>;
110
+ data: z.ZodString;
111
+ }, z.core.$strip>>;
96
112
  }, z.core.$strip>, z.ZodObject<{
97
113
  type: z.ZodLiteral<"file">;
98
114
  name: z.ZodString;
@@ -129,8 +145,16 @@ export declare const Message: z.ZodObject<{
129
145
  }, z.core.$strip>, z.ZodObject<{
130
146
  type: z.ZodLiteral<"image">;
131
147
  url: z.ZodOptional<z.ZodString>;
132
- data: z.ZodOptional<z.ZodString>;
133
- mimeType: z.ZodOptional<z.ZodString>;
148
+ source: z.ZodOptional<z.ZodObject<{
149
+ type: z.ZodLiteral<"base64">;
150
+ media_type: z.ZodEnum<{
151
+ "image/jpeg": "image/jpeg";
152
+ "image/png": "image/png";
153
+ "image/gif": "image/gif";
154
+ "image/webp": "image/webp";
155
+ }>;
156
+ data: z.ZodString;
157
+ }, z.core.$strip>>;
134
158
  }, z.core.$strip>, z.ZodObject<{
135
159
  type: z.ZodLiteral<"file">;
136
160
  name: z.ZodString;
@@ -170,8 +194,16 @@ export declare const MessageChunk: z.ZodObject<{
170
194
  }, z.core.$strip>, z.ZodObject<{
171
195
  type: z.ZodLiteral<"image">;
172
196
  url: z.ZodOptional<z.ZodString>;
173
- data: z.ZodOptional<z.ZodString>;
174
- mimeType: z.ZodOptional<z.ZodString>;
197
+ source: z.ZodOptional<z.ZodObject<{
198
+ type: z.ZodLiteral<"base64">;
199
+ media_type: z.ZodEnum<{
200
+ "image/jpeg": "image/jpeg";
201
+ "image/png": "image/png";
202
+ "image/gif": "image/gif";
203
+ "image/webp": "image/webp";
204
+ }>;
205
+ data: z.ZodString;
206
+ }, z.core.$strip>>;
175
207
  }, z.core.$strip>, z.ZodObject<{
176
208
  type: z.ZodLiteral<"file">;
177
209
  name: z.ZodString;
@@ -27,13 +27,25 @@ export const TextContent = BaseContent.extend({
27
27
  text: z.string(),
28
28
  });
29
29
  /**
30
- * Image content
30
+ * Image content (supports both URLs and base64 data, matching Claude's API format)
31
31
  */
32
32
  export const ImageContent = BaseContent.extend({
33
33
  type: z.literal("image"),
34
+ // URL format
34
35
  url: z.string().url().optional(),
35
- data: z.string().optional(), // Base64 encoded
36
- mimeType: z.string().optional(),
36
+ // Base64 format (Claude API format)
37
+ source: z
38
+ .object({
39
+ type: z.literal("base64"),
40
+ media_type: z.enum([
41
+ "image/jpeg",
42
+ "image/png",
43
+ "image/gif",
44
+ "image/webp",
45
+ ]),
46
+ data: z.string(),
47
+ })
48
+ .optional(),
37
49
  });
38
50
  /**
39
51
  * File attachment content
@@ -76,8 +76,16 @@ export declare const Session: z.ZodObject<{
76
76
  }, z.core.$strip>, z.ZodObject<{
77
77
  type: z.ZodLiteral<"image">;
78
78
  url: z.ZodOptional<z.ZodString>;
79
- data: z.ZodOptional<z.ZodString>;
80
- mimeType: z.ZodOptional<z.ZodString>;
79
+ source: z.ZodOptional<z.ZodObject<{
80
+ type: z.ZodLiteral<"base64">;
81
+ media_type: z.ZodEnum<{
82
+ "image/jpeg": "image/jpeg";
83
+ "image/png": "image/png";
84
+ "image/gif": "image/gif";
85
+ "image/webp": "image/webp";
86
+ }>;
87
+ data: z.ZodString;
88
+ }, z.core.$strip>>;
81
89
  }, z.core.$strip>, z.ZodObject<{
82
90
  type: z.ZodLiteral<"file">;
83
91
  name: z.ZodString;
@@ -130,8 +138,16 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
130
138
  }, z.core.$strip>, z.ZodObject<{
131
139
  type: z.ZodLiteral<"image">;
132
140
  url: z.ZodOptional<z.ZodString>;
133
- data: z.ZodOptional<z.ZodString>;
134
- mimeType: z.ZodOptional<z.ZodString>;
141
+ source: z.ZodOptional<z.ZodObject<{
142
+ type: z.ZodLiteral<"base64">;
143
+ media_type: z.ZodEnum<{
144
+ "image/jpeg": "image/jpeg";
145
+ "image/png": "image/png";
146
+ "image/gif": "image/gif";
147
+ "image/webp": "image/webp";
148
+ }>;
149
+ data: z.ZodString;
150
+ }, z.core.$strip>>;
135
151
  }, z.core.$strip>, z.ZodObject<{
136
152
  type: z.ZodLiteral<"file">;
137
153
  name: z.ZodString;
@@ -158,9 +174,11 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
158
174
  type: z.ZodLiteral<"tool_call">;
159
175
  toolCall: z.ZodObject<{
160
176
  id: z.ZodString;
177
+ batchId: z.ZodOptional<z.ZodString>;
161
178
  title: z.ZodString;
162
179
  prettyName: z.ZodOptional<z.ZodString>;
163
180
  icon: z.ZodOptional<z.ZodString>;
181
+ subline: z.ZodOptional<z.ZodString>;
164
182
  kind: z.ZodEnum<{
165
183
  read: "read";
166
184
  edit: "edit";
@@ -195,6 +213,15 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
195
213
  }, z.core.$strip>, z.ZodObject<{
196
214
  type: z.ZodLiteral<"text">;
197
215
  text: z.ZodString;
216
+ }, z.core.$strip>, z.ZodObject<{
217
+ type: z.ZodLiteral<"image">;
218
+ data: z.ZodString;
219
+ mimeType: z.ZodOptional<z.ZodString>;
220
+ alt: z.ZodOptional<z.ZodString>;
221
+ }, z.core.$strip>, z.ZodObject<{
222
+ type: z.ZodLiteral<"image">;
223
+ url: z.ZodString;
224
+ alt: z.ZodOptional<z.ZodString>;
198
225
  }, z.core.$strip>, z.ZodObject<{
199
226
  type: z.ZodLiteral<"diff">;
200
227
  path: z.ZodString;
@@ -249,8 +276,16 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
249
276
  }, z.core.$strip>, z.ZodObject<{
250
277
  type: z.ZodLiteral<"image">;
251
278
  url: z.ZodOptional<z.ZodString>;
252
- data: z.ZodOptional<z.ZodString>;
253
- mimeType: z.ZodOptional<z.ZodString>;
279
+ source: z.ZodOptional<z.ZodObject<{
280
+ type: z.ZodLiteral<"base64">;
281
+ media_type: z.ZodEnum<{
282
+ "image/jpeg": "image/jpeg";
283
+ "image/png": "image/png";
284
+ "image/gif": "image/gif";
285
+ "image/webp": "image/webp";
286
+ }>;
287
+ data: z.ZodString;
288
+ }, z.core.$strip>>;
254
289
  }, z.core.$strip>, z.ZodObject<{
255
290
  type: z.ZodLiteral<"file">;
256
291
  name: z.ZodString;
@@ -283,6 +318,11 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
283
318
  completed: "completed";
284
319
  failed: "failed";
285
320
  }>>;
321
+ title: z.ZodOptional<z.ZodString>;
322
+ prettyName: z.ZodOptional<z.ZodString>;
323
+ icon: z.ZodOptional<z.ZodString>;
324
+ batchId: z.ZodOptional<z.ZodString>;
325
+ rawInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
286
326
  locations: z.ZodOptional<z.ZodArray<z.ZodObject<{
287
327
  path: z.ZodString;
288
328
  line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -297,6 +337,15 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
297
337
  }, z.core.$strip>, z.ZodObject<{
298
338
  type: z.ZodLiteral<"text">;
299
339
  text: z.ZodString;
340
+ }, z.core.$strip>, z.ZodObject<{
341
+ type: z.ZodLiteral<"image">;
342
+ data: z.ZodString;
343
+ mimeType: z.ZodOptional<z.ZodString>;
344
+ alt: z.ZodOptional<z.ZodString>;
345
+ }, z.core.$strip>, z.ZodObject<{
346
+ type: z.ZodLiteral<"image">;
347
+ url: z.ZodString;
348
+ alt: z.ZodOptional<z.ZodString>;
300
349
  }, z.core.$strip>, z.ZodObject<{
301
350
  type: z.ZodLiteral<"diff">;
302
351
  path: z.ZodString;
@@ -341,8 +390,16 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
341
390
  }, z.core.$strip>, z.ZodObject<{
342
391
  type: z.ZodLiteral<"image">;
343
392
  url: z.ZodOptional<z.ZodString>;
344
- data: z.ZodOptional<z.ZodString>;
345
- mimeType: z.ZodOptional<z.ZodString>;
393
+ source: z.ZodOptional<z.ZodObject<{
394
+ type: z.ZodLiteral<"base64">;
395
+ media_type: z.ZodEnum<{
396
+ "image/jpeg": "image/jpeg";
397
+ "image/png": "image/png";
398
+ "image/gif": "image/gif";
399
+ "image/webp": "image/webp";
400
+ }>;
401
+ data: z.ZodString;
402
+ }, z.core.$strip>>;
346
403
  }, z.core.$strip>, z.ZodObject<{
347
404
  type: z.ZodLiteral<"file">;
348
405
  name: z.ZodString;
@@ -398,8 +455,16 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
398
455
  }, z.core.$strip>, z.ZodObject<{
399
456
  type: z.ZodLiteral<"image">;
400
457
  url: z.ZodOptional<z.ZodString>;
401
- data: z.ZodOptional<z.ZodString>;
402
- mimeType: z.ZodOptional<z.ZodString>;
458
+ source: z.ZodOptional<z.ZodObject<{
459
+ type: z.ZodLiteral<"base64">;
460
+ media_type: z.ZodEnum<{
461
+ "image/jpeg": "image/jpeg";
462
+ "image/png": "image/png";
463
+ "image/gif": "image/gif";
464
+ "image/webp": "image/webp";
465
+ }>;
466
+ data: z.ZodString;
467
+ }, z.core.$strip>>;
403
468
  }, z.core.$strip>, z.ZodObject<{
404
469
  type: z.ZodLiteral<"file">;
405
470
  name: z.ZodString;
@@ -41,6 +41,20 @@ export declare class HttpTransport implements Transport {
41
41
  version?: string;
42
42
  description?: string;
43
43
  suggestedPrompts?: string[];
44
+ tools?: Array<{
45
+ name: string;
46
+ description?: string;
47
+ prettyName?: string;
48
+ icon?: string;
49
+ }>;
50
+ mcps?: Array<{
51
+ name: string;
52
+ transport: string;
53
+ }>;
54
+ subagents?: Array<{
55
+ name: string;
56
+ description: string;
57
+ }>;
44
58
  };
45
59
  /**
46
60
  * Send an ACP RPC request to the server