@ruvnet/open-claude-code 2.0.0 → 2.0.1

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/src/ui/repl.mjs CHANGED
@@ -1,20 +1,21 @@
1
1
  /**
2
2
  * REPL — interactive read-eval-print loop for open-claude-code.
3
3
  *
4
- * Supports all 39 slash commands, skill invocation, enhanced UI,
5
- * and streaming output with spinner and token display.
4
+ * Supports all 39+ slash commands, skill invocation, enhanced UI,
5
+ * streaming output with spinner, token/cost display, and permission prompts.
6
6
  */
7
7
 
8
8
  import readline from 'readline';
9
9
  import { executeCommand, getCompletions, COMMANDS } from './commands.mjs';
10
- import { Spinner, highlightCode, renderStatusBar, renderToolProgress } from './ink-app.mjs';
10
+ import { Spinner, highlightCode, renderStatusBar, renderToolProgress, renderCostInline, renderMarkdown } from './ink-app.mjs';
11
11
 
12
12
  /**
13
13
  * Start the interactive REPL.
14
14
  * @param {object} loop - agent loop instance (from createAgentLoop)
15
15
  * @param {object} settings - loaded settings
16
+ * @param {object} [permissions] - permission checker to wire readline into
16
17
  */
17
- export async function startRepl(loop, settings) {
18
+ export async function startRepl(loop, settings, permissions) {
18
19
  const rl = readline.createInterface({
19
20
  input: process.stdin,
20
21
  output: process.stdout,
@@ -28,6 +29,11 @@ export async function startRepl(loop, settings) {
28
29
  },
29
30
  });
30
31
 
32
+ // Wire readline into permission checker for interactive prompts
33
+ if (permissions && typeof permissions === 'object') {
34
+ permissions.rl = rl;
35
+ }
36
+
31
37
  console.log('\x1b[1mopen-claude-code v2\x1b[0m — type your prompt or /help');
32
38
  console.log('\x1b[2mModel: %s | Tools: %d\x1b[0m', loop.state.model || 'default', loop.state.tools?.list?.()?.length || 0);
33
39
  console.log('');
@@ -58,9 +64,9 @@ export async function startRepl(loop, settings) {
58
64
  }
59
65
  }
60
66
 
61
- const { response, exit } = executeCommand(trimmed, loop.state);
62
- if (exit) { rl.close(); return; }
63
- console.log(response);
67
+ const result = executeCommand(trimmed, loop.state);
68
+ if (result.exit) { rl.close(); return; }
69
+ console.log(result.response);
64
70
  askPrompt();
65
71
  return;
66
72
  }
@@ -80,7 +86,7 @@ export async function startRepl(loop, settings) {
80
86
  }
81
87
  console.log('');
82
88
 
83
- // Show status bar if enabled
89
+ // Show cost display after each turn
84
90
  if (settings.showTokenUsage !== false) {
85
91
  process.stderr.write(renderStatusBar(loop.state) + '\n');
86
92
  }
@@ -110,7 +116,12 @@ function renderEvent(event) {
110
116
  break;
111
117
  case 'thinking':
112
118
  if (process.env.SHOW_THINKING) {
113
- process.stdout.write(`\x1b[2m${event.text}\x1b[0m`);
119
+ process.stdout.write(`\x1b[90m${event.text}\x1b[0m`);
120
+ }
121
+ break;
122
+ case 'thinking_complete':
123
+ if (process.env.SHOW_THINKING) {
124
+ process.stderr.write(`\x1b[90m[thinking complete]\x1b[0m\n`);
114
125
  }
115
126
  break;
116
127
  case 'tool_progress':
@@ -124,7 +135,11 @@ function renderEvent(event) {
124
135
  break;
125
136
  case 'assistant':
126
137
  if (event.content) {
127
- process.stdout.write(highlightCode(event.content));
138
+ // Apply markdown rendering and code highlighting
139
+ let text = event.content;
140
+ text = highlightCode(text);
141
+ text = renderMarkdown(text);
142
+ process.stdout.write(text);
128
143
  }
129
144
  break;
130
145
  case 'compaction':