codeep 1.2.54 → 1.2.55

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.
@@ -440,7 +440,7 @@ export function startAcpServer() {
440
440
  },
441
441
  });
442
442
  },
443
- onToolCall: (toolCallId, toolName, kind, title, status, locations) => {
443
+ onToolCall: (toolCallId, toolName, kind, title, status, locations, rawOutput) => {
444
444
  if (status === 'running') {
445
445
  // Initial tool_call notification: spec ToolCall shape
446
446
  transport.notify('session/update', {
@@ -458,13 +458,14 @@ export function startAcpServer() {
458
458
  });
459
459
  }
460
460
  else {
461
- // tool_call_update: update status to completed/failed
461
+ // tool_call_update: update status to completed/failed, with optional content
462
462
  transport.notify('session/update', {
463
463
  sessionId: params.sessionId,
464
464
  update: {
465
465
  sessionUpdate: 'tool_call_update',
466
466
  toolCallId,
467
467
  status: status === 'finished' ? 'completed' : 'failed',
468
+ ...(rawOutput !== undefined ? { rawOutput } : {}),
468
469
  },
469
470
  });
470
471
  }
@@ -6,7 +6,7 @@ export interface AgentSessionOptions {
6
6
  abortSignal: AbortSignal;
7
7
  onChunk: (text: string) => void;
8
8
  onThought?: (text: string) => void;
9
- onToolCall?: (toolCallId: string, toolName: string, kind: string, title: string, status: 'pending' | 'running' | 'finished' | 'error', locations?: string[]) => void;
9
+ onToolCall?: (toolCallId: string, toolName: string, kind: string, title: string, status: 'pending' | 'running' | 'finished' | 'error', locations?: string[], rawOutput?: string) => void;
10
10
  }
11
11
  /**
12
12
  * Build a ProjectContext from a workspace root directory.
@@ -44,6 +44,35 @@ function toolCallMeta(toolName, params, workspaceRoot) {
44
44
  default: return { kind: 'other', title: toolName };
45
45
  }
46
46
  }
47
+ // Builds rawOutput content to display inside tool call cards.
48
+ // For write/edit operations, returns the code content or diff.
49
+ // For command execution, returns the command output.
50
+ function buildRawOutput(toolName, params, toolResult) {
51
+ switch (toolName) {
52
+ case 'write_file': {
53
+ const content = params.content ?? '';
54
+ return content || undefined;
55
+ }
56
+ case 'edit_file': {
57
+ const oldText = params.old_text ?? '';
58
+ const newText = params.new_text ?? '';
59
+ if (!oldText && !newText)
60
+ return undefined;
61
+ // Format as a simple before/after diff block
62
+ const oldLines = oldText.split('\n').map(l => `- ${l}`).join('\n');
63
+ const newLines = newText.split('\n').map(l => `+ ${l}`).join('\n');
64
+ return `${oldLines}\n${newLines}`;
65
+ }
66
+ case 'run_command': {
67
+ return toolResult.output || toolResult.error || undefined;
68
+ }
69
+ case 'read_file': {
70
+ return toolResult.output || undefined;
71
+ }
72
+ default:
73
+ return undefined;
74
+ }
75
+ }
47
76
  export async function runAgentSession(opts) {
48
77
  const projectContext = buildProjectContext(opts.workspaceRoot);
49
78
  let toolCallCounter = 0;
@@ -101,7 +130,8 @@ export async function runAgentSession(opts) {
101
130
  const tracked = toolCallIdMap.get(mapKey);
102
131
  if (tracked && opts.onToolCall) {
103
132
  const status = toolResult.success ? 'finished' : 'error';
104
- opts.onToolCall(tracked.toolCallId, toolCall.tool, tracked.kind, '', status, tracked.locations);
133
+ const rawOutput = buildRawOutput(toolCall.tool, toolCall.parameters, toolResult);
134
+ opts.onToolCall(tracked.toolCallId, toolCall.tool, tracked.kind, '', status, tracked.locations, rawOutput);
105
135
  }
106
136
  toolCallIdMap.delete(mapKey);
107
137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.2.54",
3
+ "version": "1.2.55",
4
4
  "description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",