codeep 1.0.48 → 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.
package/dist/app.js CHANGED
@@ -36,6 +36,7 @@ import { performCodeReview, formatReviewResult } from './utils/codeReview.js';
36
36
  import { learnFromProject, addCustomRule, getLearningStatus } from './utils/learning.js';
37
37
  import { getAllSkills, findSkill, formatSkillsList, formatSkillHelp, generateSkillPrompt, saveCustomSkill, deleteCustomSkill, parseSkillChain, parseSkillArgs, searchSkills, trackSkillUsage, getSkillStats } from './utils/skills.js';
38
38
  import { AgentProgress, AgentSummary } from './components/AgentProgress.js';
39
+ import { createActionLog } from './utils/tools.js';
39
40
  export const App = () => {
40
41
  const { exit } = useApp();
41
42
  const { stdout } = useStdout();
@@ -272,19 +273,23 @@ export const App = () => {
272
273
  setAgentIteration(iteration);
273
274
  },
274
275
  onToolCall: (tool) => {
275
- setAgentActions(prev => [...prev, {
276
- type: tool.tool,
277
- target: tool.parameters.path || tool.parameters.command || 'unknown',
278
- result: 'success', // Will be updated by onToolResult
279
- timestamp: Date.now(),
280
- }]);
276
+ // Create a placeholder action - will be updated by onToolResult
277
+ const placeholderResult = {
278
+ success: true,
279
+ output: '',
280
+ tool: tool.tool,
281
+ parameters: tool.parameters,
282
+ };
283
+ const actionLog = createActionLog(tool, placeholderResult);
284
+ setAgentActions(prev => [...prev, actionLog]);
281
285
  },
282
- onToolResult: (result) => {
286
+ onToolResult: (result, toolCall) => {
287
+ // Replace the last action with the complete one
288
+ const actionLog = createActionLog(toolCall, result);
283
289
  setAgentActions(prev => {
284
290
  const updated = [...prev];
285
291
  if (updated.length > 0) {
286
- updated[updated.length - 1].result = result.success ? 'success' : 'error';
287
- updated[updated.length - 1].details = result.success ? result.output.slice(0, 100) : result.error;
292
+ updated[updated.length - 1] = actionLog;
288
293
  }
289
294
  return updated;
290
295
  });
@@ -40,7 +40,7 @@ export const AgentProgress = ({ isRunning, iteration, maxIterations, actions, cu
40
40
  deleted: actions.filter(a => a.type === 'delete' && a.result === 'success').length,
41
41
  };
42
42
  const totalFileChanges = fileChanges.created + fileChanges.modified + fileChanges.deleted;
43
- return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: dryRun ? 'yellow' : '#f02a30', padding: 1, marginY: 1, children: [_jsx(Box, { children: isRunning ? (_jsxs(_Fragment, { children: [_jsxs(Text, { color: dryRun ? 'yellow' : '#f02a30', children: ["[", SPINNER_FRAMES[spinnerFrame], "]"] }), _jsxs(Text, { color: dryRun ? 'yellow' : '#f02a30', bold: true, children: [' ', dryRun ? 'DRY RUN' : 'AGENT', ' '] }), _jsx(Text, { color: "gray", children: "|" }), _jsxs(Text, { color: "cyan", children: [" step ", iteration] }), _jsx(Text, { color: "gray", children: " | " }), actionCounts.reads > 0 && _jsxs(Text, { color: "blue", children: [actionCounts.reads, "R "] }), actionCounts.writes > 0 && _jsxs(Text, { color: "green", children: [actionCounts.writes, "W "] }), actionCounts.edits > 0 && _jsxs(Text, { color: "yellow", children: [actionCounts.edits, "E "] }), actionCounts.commands > 0 && _jsxs(Text, { color: "magenta", children: [actionCounts.commands, "C "] }), actionCounts.searches > 0 && _jsxs(Text, { color: "cyan", children: [actionCounts.searches, "S "] }), actions.length === 0 && _jsx(Text, { color: "gray", children: "0 actions" })] })) : (_jsxs(_Fragment, { children: [_jsx(Text, { color: "green", bold: true, children: "[DONE] " }), _jsx(Text, { children: "Agent completed" }), _jsx(Text, { color: "gray", children: " | " }), _jsxs(Text, { color: "white", children: [actions.length, " actions"] })] })) }), isRunning && currentAction && (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: "white", bold: true, children: "Now: " }), _jsxs(Text, { color: getActionColor(currentAction.type), children: [getActionLabel(currentAction.type), " "] }), _jsx(Text, { color: "white", children: formatTarget(currentAction.target) })] })), _jsx(Text, { color: "gray", children: '─'.repeat(50) }), recentActions.length > 1 && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "gray", dimColor: true, children: "Recent:" }), recentActions.slice(0, -1).map((action, i) => (_jsx(ActionItem, { action: action }, i)))] })), isRunning && totalFileChanges > 0 && (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: "gray", children: "Changes: " }), fileChanges.created > 0 && _jsxs(Text, { color: "green", children: ["+", fileChanges.created, " "] }), fileChanges.modified > 0 && _jsxs(Text, { color: "yellow", children: ["~", fileChanges.modified, " "] }), fileChanges.deleted > 0 && _jsxs(Text, { color: "red", children: ["-", fileChanges.deleted] })] })), isRunning && currentThinking && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "gray", wrap: "truncate-end", children: ["> ", currentThinking.slice(0, 80), currentThinking.length > 80 ? '...' : ''] }) })), isRunning && (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: "gray", children: "Press " }), _jsx(Text, { color: "#f02a30", children: "Esc" }), _jsx(Text, { color: "gray", children: " to stop" })] })), !isRunning && totalFileChanges > 0 && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { bold: true, children: "File Changes:" }), fileChanges.created > 0 && (_jsxs(Text, { color: "green", children: [" + ", fileChanges.created, " file(s) created"] })), fileChanges.modified > 0 && (_jsxs(Text, { color: "yellow", children: [" ~ ", fileChanges.modified, " file(s) modified"] })), fileChanges.deleted > 0 && (_jsxs(Text, { color: "red", children: [" - ", fileChanges.deleted, " file(s) deleted"] }))] }))] }));
43
+ return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: dryRun ? 'yellow' : '#f02a30', padding: 1, marginY: 1, children: [_jsx(Box, { children: isRunning ? (_jsxs(_Fragment, { children: [_jsxs(Text, { color: dryRun ? 'yellow' : '#f02a30', children: ["[", SPINNER_FRAMES[spinnerFrame], "]"] }), _jsxs(Text, { color: dryRun ? 'yellow' : '#f02a30', bold: true, children: [' ', dryRun ? 'DRY RUN' : 'AGENT', ' '] }), _jsx(Text, { color: "gray", children: "|" }), _jsxs(Text, { color: "cyan", children: [" step ", iteration] }), _jsx(Text, { color: "gray", children: " | " }), actionCounts.reads > 0 && _jsxs(Text, { color: "blue", children: [actionCounts.reads, "R "] }), actionCounts.writes > 0 && _jsxs(Text, { color: "green", children: [actionCounts.writes, "W "] }), actionCounts.edits > 0 && _jsxs(Text, { color: "yellow", children: [actionCounts.edits, "E "] }), actionCounts.commands > 0 && _jsxs(Text, { color: "magenta", children: [actionCounts.commands, "C "] }), actionCounts.searches > 0 && _jsxs(Text, { color: "cyan", children: [actionCounts.searches, "S "] }), actions.length === 0 && _jsx(Text, { color: "gray", children: "0 actions" })] })) : (_jsxs(_Fragment, { children: [_jsx(Text, { color: "green", bold: true, children: "[DONE] " }), _jsx(Text, { children: "Agent completed" }), _jsx(Text, { color: "gray", children: " | " }), _jsxs(Text, { color: "white", children: [actions.length, " actions"] })] })) }), isRunning && currentAction && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: "white", bold: true, children: "Now: " }), _jsxs(Text, { color: getActionColor(currentAction.type), children: [getActionLabel(currentAction.type), " "] }), _jsx(Text, { color: "white", children: formatTarget(currentAction.target) })] }), (currentAction.type === 'write' || currentAction.type === 'edit') && currentAction.details && (_jsxs(Box, { flexDirection: "column", marginLeft: 2, marginTop: 0, children: [_jsx(Text, { color: "gray", dimColor: true, children: '┌' + '─'.repeat(40) }), currentAction.details.split('\n').slice(0, 5).map((line, i) => (_jsxs(Text, { color: "gray", dimColor: true, children: ['│ ', line.slice(0, 60), line.length > 60 ? '...' : ''] }, i))), _jsx(Text, { color: "gray", dimColor: true, children: '└' + '─'.repeat(40) })] }))] })), _jsx(Text, { color: "gray", children: '─'.repeat(50) }), recentActions.length > 1 && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "gray", dimColor: true, children: "Recent:" }), recentActions.slice(0, -1).map((action, i) => (_jsx(ActionItem, { action: action }, i)))] })), isRunning && totalFileChanges > 0 && (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: "gray", children: "Changes: " }), fileChanges.created > 0 && _jsxs(Text, { color: "green", children: ["+", fileChanges.created, " "] }), fileChanges.modified > 0 && _jsxs(Text, { color: "yellow", children: ["~", fileChanges.modified, " "] }), fileChanges.deleted > 0 && _jsxs(Text, { color: "red", children: ["-", fileChanges.deleted] })] })), isRunning && currentThinking && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "gray", wrap: "truncate-end", children: ["> ", currentThinking.slice(0, 80), currentThinking.length > 80 ? '...' : ''] }) })), isRunning && (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: "gray", children: "Press " }), _jsx(Text, { color: "#f02a30", children: "Esc" }), _jsx(Text, { color: "gray", children: " to stop" })] })), !isRunning && totalFileChanges > 0 && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { bold: true, children: "File Changes:" }), fileChanges.created > 0 && (_jsxs(Text, { color: "green", children: [" + ", fileChanges.created, " file(s) created"] })), fileChanges.modified > 0 && (_jsxs(Text, { color: "yellow", children: [" ~ ", fileChanges.modified, " file(s) modified"] })), fileChanges.deleted > 0 && (_jsxs(Text, { color: "red", children: [" - ", fileChanges.deleted, " file(s) deleted"] }))] }))] }));
44
44
  };
45
45
  // Helper functions for action display
46
46
  const getActionColor = (type) => {
@@ -10,7 +10,7 @@ export interface AgentOptions {
10
10
  maxIterations: number;
11
11
  maxDuration: number;
12
12
  onToolCall?: (tool: ToolCall) => void;
13
- onToolResult?: (result: ToolResult) => void;
13
+ onToolResult?: (result: ToolResult, toolCall: ToolCall) => void;
14
14
  onIteration?: (iteration: number, message: string) => void;
15
15
  onThinking?: (text: string) => void;
16
16
  onVerification?: (results: VerifyResult[]) => void;
@@ -680,7 +680,7 @@ export async function runAgent(prompt, projectContext, options = {}) {
680
680
  // Actually execute the tool
681
681
  toolResult = executeTool(toolCall, projectContext.root || process.cwd());
682
682
  }
683
- opts.onToolResult?.(toolResult);
683
+ opts.onToolResult?.(toolResult, toolCall);
684
684
  // Log action
685
685
  const actionLog = createActionLog(toolCall, toolResult);
686
686
  actions.push(actionLog);
@@ -770,7 +770,7 @@ export async function runAgent(prompt, projectContext, options = {}) {
770
770
  for (const toolCall of fixToolCalls) {
771
771
  opts.onToolCall?.(toolCall);
772
772
  const toolResult = executeTool(toolCall, projectContext.root || process.cwd());
773
- opts.onToolResult?.(toolResult);
773
+ opts.onToolResult?.(toolResult, toolCall);
774
774
  const actionLog = createActionLog(toolCall, toolResult);
775
775
  actions.push(actionLog);
776
776
  if (toolResult.success) {
@@ -893,11 +893,39 @@ export function createActionLog(toolCall, result) {
893
893
  toolCall.parameters.pattern ||
894
894
  toolCall.parameters.url ||
895
895
  'unknown';
896
+ // For write/edit actions, include content preview in details
897
+ let details;
898
+ if (result.success) {
899
+ if (normalizedTool === 'write_file' && toolCall.parameters.content) {
900
+ // Show first few lines of written content
901
+ const content = toolCall.parameters.content;
902
+ const lines = content.split('\n').slice(0, 5);
903
+ details = lines.join('\n');
904
+ if (content.split('\n').length > 5) {
905
+ details += '\n...';
906
+ }
907
+ }
908
+ else if (normalizedTool === 'edit_file' && toolCall.parameters.new_text) {
909
+ // Show the new text being inserted
910
+ const newText = toolCall.parameters.new_text;
911
+ const lines = newText.split('\n').slice(0, 5);
912
+ details = lines.join('\n');
913
+ if (newText.split('\n').length > 5) {
914
+ details += '\n...';
915
+ }
916
+ }
917
+ else {
918
+ details = result.output.slice(0, 200);
919
+ }
920
+ }
921
+ else {
922
+ details = result.error;
923
+ }
896
924
  return {
897
925
  type: typeMap[normalizedTool] || 'command',
898
926
  target,
899
927
  result: result.success ? 'success' : 'error',
900
- details: result.success ? result.output.slice(0, 200) : result.error,
928
+ details,
901
929
  timestamp: Date.now(),
902
930
  };
903
931
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
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",