closed-loop-cli 1.0.0 → 1.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.
Potentially problematic release.
This version of closed-loop-cli might be problematic. Click here for more details.
- package/dist/index.js +31 -13
- package/package.json +1 -1
- package/src/index.ts +34 -13
package/dist/index.js
CHANGED
|
@@ -42,26 +42,38 @@ const autogenesis_1 = require("./orchestrator/autogenesis");
|
|
|
42
42
|
const server_1 = require("./dashboard/server");
|
|
43
43
|
const telegram_bot_1 = require("./orchestrator/telegram-bot");
|
|
44
44
|
const task_agent_1 = require("./orchestrator/task-agent");
|
|
45
|
+
const tui_tools_1 = require("./tools/tui-tools");
|
|
45
46
|
// Phase 3 is initialized
|
|
46
47
|
// Load environment variables
|
|
47
48
|
dotenv.config();
|
|
48
49
|
function printHeader() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
const endpoint = process.env.ANTHROPIC_BASE_URL || 'default';
|
|
51
|
+
const model = process.env.ANTHROPIC_MODEL || 'mimo-v2.5-pro[1m]';
|
|
52
|
+
const subagent = process.env.CLAUDE_CODE_SUBAGENT_MODEL || 'mimo-v2.5-pro';
|
|
53
|
+
const padRaw = (label, value) => {
|
|
54
|
+
let valStr = value;
|
|
55
|
+
if (valStr.length > 48) {
|
|
56
|
+
valStr = valStr.substring(0, 45) + '...';
|
|
57
|
+
}
|
|
58
|
+
const visibleText = ` ${label} ❯ ${valStr}`;
|
|
59
|
+
const padding = ' '.repeat(Math.max(0, 65 - visibleText.length));
|
|
60
|
+
return ` \x1b[38;5;86m${label}\x1b[0m \x1b[90m❯\x1b[0m \x1b[38;5;153m${valStr}\x1b[0m${padding}`;
|
|
61
|
+
};
|
|
62
|
+
console.log('\x1b[38;5;99m╭──────────────────────────────────────────────────────────────────╮\x1b[0m');
|
|
63
|
+
console.log('\x1b[38;5;99m│\x1b[0m \x1b[1;38;5;159m🤖 Closed-Loop Conversational Agent CLI\x1b[0m \x1b[38;5;99m│\x1b[0m');
|
|
64
|
+
console.log('\x1b[38;5;99m├──────────────────────────────────────────────────────────────────┤\x1b[0m');
|
|
65
|
+
console.log('\x1b[38;5;99m│\x1b[0m' + padRaw('Endpoint', endpoint) + '\x1b[38;5;99m│\x1b[0m');
|
|
66
|
+
console.log('\x1b[38;5;99m│\x1b[0m' + padRaw('Model ', model) + '\x1b[38;5;99m│\x1b[0m');
|
|
67
|
+
console.log('\x1b[38;5;99m│\x1b[0m' + padRaw('Subagent', subagent) + '\x1b[38;5;99m│\x1b[0m');
|
|
68
|
+
console.log('\x1b[38;5;99m╰──────────────────────────────────────────────────────────────────╯\x1b[0m\n');
|
|
69
|
+
console.log('\x1b[90m💡 Type your task to begin, or type "exit" to quit.\x1b[0m\n');
|
|
56
70
|
}
|
|
57
71
|
async function startInteractiveCLI(effort = 'standard', codeactMode = false) {
|
|
58
72
|
printHeader();
|
|
59
|
-
console.log('\x1b[33m%s\x1b[0m', '--- CLAUDE CODE INTERACTIVE MODE (Conversational CLI) ---');
|
|
60
|
-
console.log('Conversation history is maintained. Type "exit" or "quit" to leave.\n');
|
|
61
73
|
const rl = readline.createInterface({
|
|
62
74
|
input: process.stdin,
|
|
63
75
|
output: process.stdout,
|
|
64
|
-
prompt: '\x1b[
|
|
76
|
+
prompt: '\x1b[38;5;99mclosed-loop\x1b[0m \x1b[38;5;86m❯\x1b[0m '
|
|
65
77
|
});
|
|
66
78
|
const history = [];
|
|
67
79
|
rl.prompt();
|
|
@@ -72,28 +84,34 @@ async function startInteractiveCLI(effort = 'standard', codeactMode = false) {
|
|
|
72
84
|
return;
|
|
73
85
|
}
|
|
74
86
|
if (input.toLowerCase() === 'exit' || input.toLowerCase() === 'quit') {
|
|
75
|
-
console.log('
|
|
87
|
+
console.log('\x1b[90mGoodbye!\x1b[0m');
|
|
76
88
|
process.exit(0);
|
|
77
89
|
}
|
|
78
90
|
rl.pause(); // Pause standard input while agent runs
|
|
91
|
+
const spinner = new tui_tools_1.Spinner('Thinking...');
|
|
92
|
+
spinner.start();
|
|
79
93
|
try {
|
|
80
94
|
const response = await (0, task_agent_1.runTaskAgent)(input, {
|
|
81
95
|
role: 'coder_codeact', // Coder with command execution tools
|
|
82
96
|
effort,
|
|
83
97
|
history: history
|
|
84
98
|
});
|
|
99
|
+
spinner.stop(true, 'Done!');
|
|
85
100
|
// Update history
|
|
86
101
|
history.push({ role: 'user', content: input });
|
|
87
102
|
history.push({ role: 'assistant', content: response.result });
|
|
88
|
-
console.log(`\n\x1b[
|
|
103
|
+
console.log(`\n\x1b[38;5;86m╭── Agent Response ─────────────────────────────────────────────────────────────╮\x1b[0m`);
|
|
104
|
+
console.log(response.result);
|
|
105
|
+
console.log(`\x1b[38;5;86m╰───────────────────────────────────────────────────────────────────────────────╯\x1b[0m\n`);
|
|
89
106
|
}
|
|
90
107
|
catch (err) {
|
|
108
|
+
spinner.stop(false, 'Failed');
|
|
91
109
|
console.error('\n\x1b[31m[Agent Error]:\x1b[0m', err.message);
|
|
92
110
|
}
|
|
93
111
|
rl.resume();
|
|
94
112
|
rl.prompt();
|
|
95
113
|
}).on('close', () => {
|
|
96
|
-
console.log('\
|
|
114
|
+
console.log('\n\x1b[90mGoodbye!\x1b[0m');
|
|
97
115
|
process.exit(0);
|
|
98
116
|
});
|
|
99
117
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { AutogenesisEngine } from './orchestrator/autogenesis';
|
|
|
7
7
|
import { startDashboardServer } from './dashboard/server';
|
|
8
8
|
import { startTelegramBot } from './orchestrator/telegram-bot';
|
|
9
9
|
import { runTaskAgent } from './orchestrator/task-agent';
|
|
10
|
+
import { Spinner } from './tools/tui-tools';
|
|
10
11
|
|
|
11
12
|
// Phase 3 is initialized
|
|
12
13
|
|
|
@@ -14,24 +15,37 @@ import { runTaskAgent } from './orchestrator/task-agent';
|
|
|
14
15
|
dotenv.config();
|
|
15
16
|
|
|
16
17
|
function printHeader() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const endpoint = process.env.ANTHROPIC_BASE_URL || 'default';
|
|
19
|
+
const model = process.env.ANTHROPIC_MODEL || 'mimo-v2.5-pro[1m]';
|
|
20
|
+
const subagent = process.env.CLAUDE_CODE_SUBAGENT_MODEL || 'mimo-v2.5-pro';
|
|
21
|
+
|
|
22
|
+
const padRaw = (label: string, value: string) => {
|
|
23
|
+
let valStr = value;
|
|
24
|
+
if (valStr.length > 48) {
|
|
25
|
+
valStr = valStr.substring(0, 45) + '...';
|
|
26
|
+
}
|
|
27
|
+
const visibleText = ` ${label} ❯ ${valStr}`;
|
|
28
|
+
const padding = ' '.repeat(Math.max(0, 65 - visibleText.length));
|
|
29
|
+
return ` \x1b[38;5;86m${label}\x1b[0m \x1b[90m❯\x1b[0m \x1b[38;5;153m${valStr}\x1b[0m${padding}`;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
console.log('\x1b[38;5;99m╭──────────────────────────────────────────────────────────────────╮\x1b[0m');
|
|
33
|
+
console.log('\x1b[38;5;99m│\x1b[0m \x1b[1;38;5;159m🤖 Closed-Loop Conversational Agent CLI\x1b[0m \x1b[38;5;99m│\x1b[0m');
|
|
34
|
+
console.log('\x1b[38;5;99m├──────────────────────────────────────────────────────────────────┤\x1b[0m');
|
|
35
|
+
console.log('\x1b[38;5;99m│\x1b[0m' + padRaw('Endpoint', endpoint) + '\x1b[38;5;99m│\x1b[0m');
|
|
36
|
+
console.log('\x1b[38;5;99m│\x1b[0m' + padRaw('Model ', model) + '\x1b[38;5;99m│\x1b[0m');
|
|
37
|
+
console.log('\x1b[38;5;99m│\x1b[0m' + padRaw('Subagent', subagent) + '\x1b[38;5;99m│\x1b[0m');
|
|
38
|
+
console.log('\x1b[38;5;99m╰──────────────────────────────────────────────────────────────────╯\x1b[0m\n');
|
|
39
|
+
console.log('\x1b[90m💡 Type your task to begin, or type "exit" to quit.\x1b[0m\n');
|
|
24
40
|
}
|
|
25
41
|
|
|
26
42
|
async function startInteractiveCLI(effort: 'standard' | 'ultracode' = 'standard', codeactMode = false) {
|
|
27
43
|
printHeader();
|
|
28
|
-
console.log('\x1b[33m%s\x1b[0m', '--- CLAUDE CODE INTERACTIVE MODE (Conversational CLI) ---');
|
|
29
|
-
console.log('Conversation history is maintained. Type "exit" or "quit" to leave.\n');
|
|
30
44
|
|
|
31
45
|
const rl = readline.createInterface({
|
|
32
46
|
input: process.stdin,
|
|
33
47
|
output: process.stdout,
|
|
34
|
-
prompt: '\x1b[
|
|
48
|
+
prompt: '\x1b[38;5;99mclosed-loop\x1b[0m \x1b[38;5;86m❯\x1b[0m '
|
|
35
49
|
});
|
|
36
50
|
|
|
37
51
|
const history: any[] = [];
|
|
@@ -45,11 +59,13 @@ async function startInteractiveCLI(effort: 'standard' | 'ultracode' = 'standard'
|
|
|
45
59
|
}
|
|
46
60
|
|
|
47
61
|
if (input.toLowerCase() === 'exit' || input.toLowerCase() === 'quit') {
|
|
48
|
-
console.log('
|
|
62
|
+
console.log('\x1b[90mGoodbye!\x1b[0m');
|
|
49
63
|
process.exit(0);
|
|
50
64
|
}
|
|
51
65
|
|
|
52
66
|
rl.pause(); // Pause standard input while agent runs
|
|
67
|
+
const spinner = new Spinner('Thinking...');
|
|
68
|
+
spinner.start();
|
|
53
69
|
try {
|
|
54
70
|
const response = await runTaskAgent(input, {
|
|
55
71
|
role: 'coder_codeact' as any, // Coder with command execution tools
|
|
@@ -57,18 +73,23 @@ async function startInteractiveCLI(effort: 'standard' | 'ultracode' = 'standard'
|
|
|
57
73
|
history: history
|
|
58
74
|
});
|
|
59
75
|
|
|
76
|
+
spinner.stop(true, 'Done!');
|
|
77
|
+
|
|
60
78
|
// Update history
|
|
61
79
|
history.push({ role: 'user', content: input });
|
|
62
80
|
history.push({ role: 'assistant', content: response.result });
|
|
63
81
|
|
|
64
|
-
console.log(`\n\x1b[
|
|
82
|
+
console.log(`\n\x1b[38;5;86m╭── Agent Response ─────────────────────────────────────────────────────────────╮\x1b[0m`);
|
|
83
|
+
console.log(response.result);
|
|
84
|
+
console.log(`\x1b[38;5;86m╰───────────────────────────────────────────────────────────────────────────────╯\x1b[0m\n`);
|
|
65
85
|
} catch (err: any) {
|
|
86
|
+
spinner.stop(false, 'Failed');
|
|
66
87
|
console.error('\n\x1b[31m[Agent Error]:\x1b[0m', err.message);
|
|
67
88
|
}
|
|
68
89
|
rl.resume();
|
|
69
90
|
rl.prompt();
|
|
70
91
|
}).on('close', () => {
|
|
71
|
-
console.log('\
|
|
92
|
+
console.log('\n\x1b[90mGoodbye!\x1b[0m');
|
|
72
93
|
process.exit(0);
|
|
73
94
|
});
|
|
74
95
|
}
|