@exreve/exk 1.0.49 → 1.0.50

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.
@@ -99,6 +99,12 @@ function extractToolName(toolResult) {
99
99
  return 'Edit';
100
100
  return (toolResult.content !== undefined || toolResult.type === 'create') ? 'Write' : 'Read';
101
101
  }
102
+ // Grep: {mode, numFiles, filenames, content, numLines}
103
+ if (toolResult.numFiles !== undefined && toolResult.filenames !== undefined && toolResult.mode !== undefined)
104
+ return 'Grep';
105
+ // Glob: {type, pattern, files}
106
+ if (toolResult.files !== undefined && toolResult.pattern !== undefined && !toolResult.stdout)
107
+ return 'Glob';
102
108
  if (toolResult.stdout !== undefined || toolResult.stderr !== undefined)
103
109
  return 'Bash';
104
110
  // send_file tool: content is JSON with _type marker — detect before Bash fallback
@@ -122,7 +128,12 @@ function lookupToolNameFromHistory(messages, toolUseId) {
122
128
  const msg = messages[i];
123
129
  if (msg.role !== 'assistant')
124
130
  continue;
125
- const content = typeof msg.content === 'string' ? null : msg.content;
131
+ // msg.content is the SDK message object: {role: 'assistant', content: [{type: 'text',...}, {type: 'tool_use',...}]}
132
+ let content = typeof msg.content === 'string' ? null : msg.content;
133
+ // Unwrap nested content: {content: [...]} → [...]
134
+ if (content && !Array.isArray(content) && Array.isArray(content.content)) {
135
+ content = content.content;
136
+ }
126
137
  if (!Array.isArray(content))
127
138
  continue;
128
139
  const toolUse = content.find((c) => c.type === 'tool_use' && c.id === toolUseId);
@@ -1042,10 +1053,11 @@ export class AgentSessionManager {
1042
1053
  }
1043
1054
  }
1044
1055
  if (toolResult) {
1056
+ // History lookup is authoritative: the assistant's tool_use block names the tool.
1057
+ // Heuristic detection can't distinguish Bash/Grep/Glob/etc (all have {stdout,stderr}).
1058
+ const historyName = lookupToolNameFromHistory(session.messages, toolUseId);
1045
1059
  const detectedName = extractToolName(toolResult);
1046
- const resolvedName = detectedName !== 'unknown'
1047
- ? detectedName
1048
- : (lookupToolNameFromHistory(session.messages, toolUseId) || detectedName);
1060
+ const resolvedName = historyName || detectedName;
1049
1061
  onOutput({
1050
1062
  type: 'tool_result',
1051
1063
  data: toolResult,
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exreve/exk",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "exk - Control Claude CLI with voice and programmable interfaces",
5
5
  "type": "module",
6
6
  "bin": {
@@ -61,4 +61,4 @@
61
61
  "engines": {
62
62
  "node": ">=20.0.0"
63
63
  }
64
- }
64
+ }