@miphamai/cli 0.32.0 → 0.32.1

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/ui/chat.tsx +39 -33
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miphamai/cli",
3
- "version": "0.32.0",
3
+ "version": "0.32.1",
4
4
  "description": "Mipham Code — Multi-model open-core intelligent coding terminal by MiphamAI",
5
5
  "keywords": [
6
6
  "ai",
package/src/ui/chat.tsx CHANGED
@@ -157,52 +157,58 @@ export function ChatPanel({ messages, focusMode }: ChatPanelProps) {
157
157
  }
158
158
 
159
159
  /**
160
- * Group consecutive tool calls into compact one-liners for the normal view.
161
- * Single tools show normally; 2+ consecutive tools get folded:
162
- * ⏺ Read · Glob · Bash (3 tools)
160
+ * Pair each tool_use message with its following tool_result message(s),
161
+ * showing every tool individually with its name, detail, and output.
162
+ *
163
+ * Claude Code parity: each tool renders as:
164
+ * ⏺ ToolName (detail) ← colored per tool type
165
+ * ⎿ output summary ← dimmed below
166
+ *
167
+ * Only true duplicates (same tool name + same detail) are collapsed
168
+ * into a single entry with a count.
163
169
  */
164
170
  function compactToolGroups(messages: ChatMessage[]): ChatMessage[] {
165
171
  const result: ChatMessage[] = []
166
- let toolGroup: ChatMessage[] = []
172
+ let current: ChatMessage | null = null
167
173
 
168
- const flush = () => {
169
- if (toolGroup.length === 0) return
170
- if (toolGroup.length === 1) {
171
- result.push(toolGroup[0]!)
172
- } else {
173
- const names = toolGroup
174
- .filter((t) => t.toolMeta?.name && !t.toolMeta.name.startsWith('tools ('))
175
- .map((t) => t.toolMeta!.name)
176
- const uniqueNames = [...new Set(names)]
177
- result.push({
178
- role: 'system',
179
- content: `⏺ ${uniqueNames.join(' · ')} (${names.length} tools)`,
180
- toolMeta: {
181
- name: `tools (${names.length})`,
182
- input: uniqueNames.join(', '),
183
- collapsed: true,
184
- },
185
- })
174
+ for (const msg of messages) {
175
+ // Tool call with a name → flush previous, start a new one
176
+ if (msg.toolMeta?.name && !msg.toolMeta.name.startsWith('tools (')) {
177
+ if (current) result.push(current)
178
+ current = { ...msg }
179
+ continue
186
180
  }
187
- toolGroup = []
188
- }
189
181
 
190
- for (const msg of messages) {
191
- // Tool results (no name, has output) get folded into the preceding tool group
182
+ // Tool result (no name, has output) → merge output into current tool
192
183
  if (msg.toolMeta && !msg.toolMeta.name && msg.toolMeta.output) {
193
- toolGroup.push(msg)
184
+ if (current) {
185
+ current = {
186
+ ...current,
187
+ content: msg.content,
188
+ toolMeta: {
189
+ ...current.toolMeta!,
190
+ output: msg.toolMeta.output,
191
+ },
192
+ }
193
+ }
194
+ // Orphan tool result (no preceding tool_use) → skip
194
195
  continue
195
196
  }
196
- // Tool calls with a name
197
- if (msg.toolMeta?.name && !msg.toolMeta.name.startsWith('tools (')) {
198
- toolGroup.push(msg)
197
+
198
+ // Already-grouped message (from a previous compact cycle) or non-tool
199
+ if (current) {
200
+ result.push(current)
201
+ current = null
202
+ }
203
+ // Skip orphan tool-result messages without a preceding tool_use
204
+ if (msg.toolMeta && !msg.toolMeta.name && msg.toolMeta.output) {
199
205
  continue
200
206
  }
201
- // Already-grouped or non-tool message
202
- flush()
203
207
  result.push(msg)
204
208
  }
205
- flush()
209
+
210
+ // Flush any remaining tool
211
+ if (current) result.push(current)
206
212
  return result
207
213
  }
208
214