codeep 1.2.53 → 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.
@@ -204,6 +204,7 @@ export function startAcpServer() {
204
204
  abortController: null,
205
205
  currentModeId: 'auto',
206
206
  titleSent: false,
207
+ hadHistory: history.length > 0,
207
208
  });
208
209
  const result = {
209
210
  sessionId: acpSessionId,
@@ -255,6 +256,7 @@ export function startAcpServer() {
255
256
  addedFiles: new Map(),
256
257
  abortController: null,
257
258
  titleSent: false,
259
+ hadHistory: history.length > 0,
258
260
  currentModeId: 'auto',
259
261
  });
260
262
  const result = {
@@ -406,18 +408,10 @@ export function startAcpServer() {
406
408
  },
407
409
  });
408
410
  }
409
- // Send title on first interaction (commands count too)
410
- if (!session.titleSent) {
411
+ // Update title with first real prompt if session had no history
412
+ if (!session.titleSent && !session.hadHistory) {
411
413
  session.titleSent = true;
412
- const title = prompt.slice(0, 60).replace(/\n/g, ' ').trim();
413
- transport.notify('session/update', {
414
- sessionId: params.sessionId,
415
- update: {
416
- sessionUpdate: 'session_info_update',
417
- title,
418
- updatedAt: new Date().toISOString(),
419
- },
420
- });
414
+ sendSessionTitle(params.sessionId, [{ role: 'user', content: prompt }]);
421
415
  }
422
416
  transport.respond(msg.id, { stopReason: 'end_turn' });
423
417
  return;
@@ -446,7 +440,7 @@ export function startAcpServer() {
446
440
  },
447
441
  });
448
442
  },
449
- onToolCall: (toolCallId, toolName, kind, title, status, locations) => {
443
+ onToolCall: (toolCallId, toolName, kind, title, status, locations, rawOutput) => {
450
444
  if (status === 'running') {
451
445
  // Initial tool_call notification: spec ToolCall shape
452
446
  transport.notify('session/update', {
@@ -464,13 +458,14 @@ export function startAcpServer() {
464
458
  });
465
459
  }
466
460
  else {
467
- // tool_call_update: update status to completed/failed
461
+ // tool_call_update: update status to completed/failed, with optional content
468
462
  transport.notify('session/update', {
469
463
  sessionId: params.sessionId,
470
464
  update: {
471
465
  sessionUpdate: 'tool_call_update',
472
466
  toolCallId,
473
467
  status: status === 'finished' ? 'completed' : 'failed',
468
+ ...(rawOutput !== undefined ? { rawOutput } : {}),
474
469
  },
475
470
  });
476
471
  }
@@ -482,18 +477,10 @@ export function startAcpServer() {
482
477
  session.history.push({ role: 'assistant', content: agentResponse });
483
478
  }
484
479
  autoSaveSession(session.history, session.workspaceRoot);
485
- // Send session title on first completed prompt (so Zed shows something useful)
486
- if (!session.titleSent) {
480
+ // Update title with first real prompt if session had no history
481
+ if (!session.titleSent && !session.hadHistory) {
487
482
  session.titleSent = true;
488
- const title = prompt.slice(0, 60).replace(/\n/g, ' ').trim();
489
- transport.notify('session/update', {
490
- sessionId: params.sessionId,
491
- update: {
492
- sessionUpdate: 'session_info_update',
493
- title,
494
- updatedAt: new Date().toISOString(),
495
- },
496
- });
483
+ sendSessionTitle(params.sessionId, [{ role: 'user', content: prompt }]);
497
484
  }
498
485
  transport.respond(msg.id, { stopReason: 'end_turn' });
499
486
  }).catch((err) => {
@@ -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.
@@ -24,22 +24,55 @@ export function buildProjectContext(workspaceRoot) {
24
24
  };
25
25
  }
26
26
  // Maps internal tool names to ACP tool_call kind values and human titles.
27
- function toolCallMeta(toolName, params) {
27
+ function toolCallMeta(toolName, params, workspaceRoot) {
28
28
  const file = params.path ?? params.file ?? '';
29
- const label = file ? ` ${file.split('/').pop()}` : '';
29
+ // Use full path for edit tools (Zed renders it as a clickable file link)
30
+ const absFile = file
31
+ ? (isAbsolute(file) ? file : join(workspaceRoot, file))
32
+ : '';
33
+ const basename = absFile ? absFile.split('/').pop() ?? '' : '';
30
34
  switch (toolName) {
31
- case 'read_file': return { kind: 'read', title: `Reading${label}` };
32
- case 'write_file': return { kind: 'edit', title: `Writing${label}` };
33
- case 'edit_file': return { kind: 'edit', title: `Editing${label}` };
34
- case 'delete_file': return { kind: 'delete', title: `Deleting${label}` };
35
- case 'move_file': return { kind: 'move', title: `Moving${label}` };
36
- case 'list_files': return { kind: 'read', title: `Listing files${label}` };
37
- case 'search_files': return { kind: 'search', title: `Searching${label || ' files'}` };
38
- case 'run_command': return { kind: 'execute', title: `Running: ${params.command ?? ''}` };
35
+ case 'read_file': return { kind: 'read', title: `Reading ${basename}` };
36
+ case 'write_file': return { kind: 'edit', title: absFile ? `Edit ${absFile}` : 'Writing file' };
37
+ case 'edit_file': return { kind: 'edit', title: absFile ? `Edit ${absFile}` : 'Editing file' };
38
+ case 'delete_file': return { kind: 'delete', title: `Deleting ${basename}` };
39
+ case 'move_file': return { kind: 'move', title: `Moving ${basename}` };
40
+ case 'list_files': return { kind: 'read', title: `Listing files ${basename}` };
41
+ case 'search_files': return { kind: 'search', title: `Searching ${basename || 'files'}` };
42
+ case 'run_command': return { kind: 'execute', title: params.command ?? 'Running command' };
39
43
  case 'web_fetch': return { kind: 'fetch', title: `Fetching ${params.url ?? ''}` };
40
44
  default: return { kind: 'other', title: toolName };
41
45
  }
42
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
+ }
43
76
  export async function runAgentSession(opts) {
44
77
  const projectContext = buildProjectContext(opts.workspaceRoot);
45
78
  let toolCallCounter = 0;
@@ -60,7 +93,7 @@ export async function runAgentSession(opts) {
60
93
  onToolCall: (toolCall) => {
61
94
  const name = toolCall.tool;
62
95
  const params = (toolCall.parameters ?? {});
63
- const { kind, title } = toolCallMeta(name, params);
96
+ const { kind, title } = toolCallMeta(name, params, opts.workspaceRoot);
64
97
  const toolCallId = `tc_${++toolCallCounter}`;
65
98
  // Resolve file locations for edit/read/delete/move tools
66
99
  // ToolCallLocation.path expects a filesystem path, not a file:// URI
@@ -97,7 +130,8 @@ export async function runAgentSession(opts) {
97
130
  const tracked = toolCallIdMap.get(mapKey);
98
131
  if (tracked && opts.onToolCall) {
99
132
  const status = toolResult.success ? 'finished' : 'error';
100
- 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);
101
135
  }
102
136
  toolCallIdMap.delete(mapKey);
103
137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.2.53",
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",