Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# .gitkeep file auto-generated at 2026-07-27T03:36:32.513Z for PR creation at branch issue-281-8d4563b818c2 for issue https://github.com/link-assistant/agent/issues/281
5 changes: 5 additions & 0 deletions js/.changeset/fix-stream-json-tool-use.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@link-assistant/agent': patch
---

Report tool names and inputs correctly in `stream-json` tool-use events.
5 changes: 2 additions & 3 deletions js/src/json-standard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,12 @@ export function convertOpenCodeToClaude(
case 'tool_use':
if (event.part && event.part.state) {
const state = event.part.state as Record<string, unknown>;
const tool = state.tool as Record<string, unknown> | undefined;
return {
type: 'tool_use',
timestamp,
session_id,
name: (tool?.name as string) || 'unknown',
input: tool?.parameters || {},
name: (event.part.tool as string) || 'unknown',
input: state.input || {},
tool_use_id: event.part.id as string,
};
}
Expand Down
17 changes: 11 additions & 6 deletions js/tests/json-standard-unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,13 @@ describe('JSON Standard Module - Unit Tests', () => {
sessionID: 'ses_test123',
part: {
id: 'prt_tool123',
type: 'tool',
callID: 'call_tool123',
tool: 'write',
state: {
tool: {
name: 'bash',
parameters: { command: 'ls' },
},
status: 'pending',
input: { filePath: 'hi.txt', content: 'hi\n' },
raw: '',
},
},
};
Expand All @@ -134,8 +136,11 @@ describe('JSON Standard Module - Unit Tests', () => {

expect(claudeEvent).not.toBeNull();
expect(claudeEvent.type).toBe('tool_use');
expect(claudeEvent.name).toBe('bash');
expect(claudeEvent.input).toEqual({ command: 'ls' });
expect(claudeEvent.name).toBe('write');
expect(claudeEvent.input).toEqual({
filePath: 'hi.txt',
content: 'hi\n',
});
expect(claudeEvent.tool_use_id).toBe('prt_tool123');
});

Expand Down