@dastageer_44/eco-code 1.1.0
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/LICENSE +21 -0
- package/README.md +105 -0
- package/dist/config.d.ts +44 -0
- package/dist/config.js +111 -0
- package/dist/config.js.map +1 -0
- package/dist/harness/agent.d.ts +51 -0
- package/dist/harness/agent.js +168 -0
- package/dist/harness/agent.js.map +1 -0
- package/dist/harness/context.d.ts +17 -0
- package/dist/harness/context.js +77 -0
- package/dist/harness/context.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +414 -0
- package/dist/index.js.map +1 -0
- package/dist/services/openrouter.d.ts +21 -0
- package/dist/services/openrouter.js +106 -0
- package/dist/services/openrouter.js.map +1 -0
- package/dist/services/updater.d.ts +6 -0
- package/dist/services/updater.js +61 -0
- package/dist/services/updater.js.map +1 -0
- package/dist/taste/engine.d.ts +10 -0
- package/dist/taste/engine.js +80 -0
- package/dist/taste/engine.js.map +1 -0
- package/dist/tools/file-ops.d.ts +18 -0
- package/dist/tools/file-ops.js +89 -0
- package/dist/tools/file-ops.js.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.js +235 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/search-ops.d.ts +5 -0
- package/dist/tools/search-ops.js +55 -0
- package/dist/tools/search-ops.js.map +1 -0
- package/dist/tools/shell-ops.d.ts +18 -0
- package/dist/tools/shell-ops.js +140 -0
- package/dist/tools/shell-ops.js.map +1 -0
- package/dist/tools/types.d.ts +11 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/ui/banner.d.ts +2 -0
- package/dist/ui/banner.js +31 -0
- package/dist/ui/banner.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { exec } from 'child_process';
|
|
2
|
+
import crypto from 'crypto';
|
|
3
|
+
const activeTasks = new Map();
|
|
4
|
+
export async function runCommand(args, cwd = process.cwd()) {
|
|
5
|
+
const timeout = args.timeout_ms || 45000;
|
|
6
|
+
const isBackground = args.run_in_background === true;
|
|
7
|
+
if (isBackground) {
|
|
8
|
+
const taskId = 'task_' + crypto.randomBytes(4).toString('hex');
|
|
9
|
+
const child = exec(args.command, { cwd, maxBuffer: 1024 * 1024 * 5 }); // 5MB buffer
|
|
10
|
+
const task = {
|
|
11
|
+
id: taskId,
|
|
12
|
+
command: args.command,
|
|
13
|
+
process: child,
|
|
14
|
+
status: 'running',
|
|
15
|
+
exitCode: null,
|
|
16
|
+
outputBuffer: '',
|
|
17
|
+
};
|
|
18
|
+
activeTasks.set(taskId, task);
|
|
19
|
+
child.stdout?.on('data', (data) => {
|
|
20
|
+
task.outputBuffer += data.toString();
|
|
21
|
+
});
|
|
22
|
+
child.stderr?.on('data', (data) => {
|
|
23
|
+
task.outputBuffer += data.toString();
|
|
24
|
+
});
|
|
25
|
+
child.on('close', (code) => {
|
|
26
|
+
task.status = code === 0 ? 'completed' : 'failed';
|
|
27
|
+
task.exitCode = code;
|
|
28
|
+
});
|
|
29
|
+
child.on('error', (err) => {
|
|
30
|
+
task.status = 'failed';
|
|
31
|
+
task.errorMsg = err.message;
|
|
32
|
+
});
|
|
33
|
+
return `Background task started with ID: ${taskId}. Use shell_output to read logs or monitor_command to wait for it.`;
|
|
34
|
+
}
|
|
35
|
+
// Synchronous execution
|
|
36
|
+
return new Promise((resolve) => {
|
|
37
|
+
exec(args.command, { cwd, timeout, maxBuffer: 1024 * 1024 * 5 }, (error, stdout, stderr) => {
|
|
38
|
+
let output = '';
|
|
39
|
+
if (stdout && stdout.trim()) {
|
|
40
|
+
output += stdout.trim();
|
|
41
|
+
}
|
|
42
|
+
if (stderr && stderr.trim()) {
|
|
43
|
+
output += (output ? '\n' : '') + `[STDERR]\n${stderr.trim()}`;
|
|
44
|
+
}
|
|
45
|
+
if (error) {
|
|
46
|
+
if (error.killed) {
|
|
47
|
+
output += (output ? '\n' : '') + `[ERROR] Command timed out after ${timeout}ms.`;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// Treat grep exit code 1 as no matches instead of error
|
|
51
|
+
if (args.command.trim().startsWith('grep') && error.code === 1) {
|
|
52
|
+
output += (output ? '\n' : '') + `(No matches found - exit code 1)`;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
output += (output ? '\n' : '') + `[EXIT CODE ${error.code}]: ${error.message}`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
let finalOutput = output || '(command completed with no output)';
|
|
60
|
+
// Fence output to protect context
|
|
61
|
+
resolve(`<<<UNTRUSTED_TASK_OUTPUT>>>\n${finalOutput}\n<<<EOF>>>`);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export async function getShellOutput(args, cwd) {
|
|
66
|
+
const task = activeTasks.get(args.task_id);
|
|
67
|
+
if (!task)
|
|
68
|
+
return `Error: No task found with ID ${args.task_id}`;
|
|
69
|
+
const offset = args.from_offset || 0;
|
|
70
|
+
const newOutput = task.outputBuffer.slice(offset);
|
|
71
|
+
const nextOffset = task.outputBuffer.length;
|
|
72
|
+
let header = `Status: ${task.status}`;
|
|
73
|
+
if (task.exitCode !== null)
|
|
74
|
+
header += ` (Exit Code: ${task.exitCode})`;
|
|
75
|
+
let result = `Task ${task.id} [${header}]\n`;
|
|
76
|
+
if (newOutput.length > 0) {
|
|
77
|
+
result += `<<<UNTRUSTED_TASK_OUTPUT>>>\n${newOutput}\n<<<EOF>>>\n`;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
result += `(No new output since offset ${offset})\n`;
|
|
81
|
+
}
|
|
82
|
+
result += `\nNext offset: ${nextOffset}`;
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
export async function sleepTool(args, cwd) {
|
|
86
|
+
return new Promise(resolve => {
|
|
87
|
+
setTimeout(() => {
|
|
88
|
+
resolve(`Slept for ${args.ms} milliseconds.`);
|
|
89
|
+
}, args.ms);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export async function monitorCommand(args, cwd) {
|
|
93
|
+
const task = activeTasks.get(args.task_id);
|
|
94
|
+
if (!task)
|
|
95
|
+
return `Error: No task found with ID ${args.task_id}`;
|
|
96
|
+
const timeout = args.timeout_ms || 30000;
|
|
97
|
+
const startTime = Date.now();
|
|
98
|
+
let regex = null;
|
|
99
|
+
if (args.pattern) {
|
|
100
|
+
try {
|
|
101
|
+
regex = new RegExp(args.pattern, 'm');
|
|
102
|
+
}
|
|
103
|
+
catch (e) {
|
|
104
|
+
return `Error compiling pattern regex: ${e}`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return new Promise((resolve) => {
|
|
108
|
+
const checkInterval = setInterval(() => {
|
|
109
|
+
const elapsed = Date.now() - startTime;
|
|
110
|
+
// Check for exit
|
|
111
|
+
if (task.status === 'completed' || task.status === 'failed' || task.status === 'killed') {
|
|
112
|
+
clearInterval(checkInterval);
|
|
113
|
+
resolve(`Task finished with status: ${task.status}. Exit code: ${task.exitCode}`);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
// Check for regex match
|
|
117
|
+
if (regex && regex.test(task.outputBuffer)) {
|
|
118
|
+
clearInterval(checkInterval);
|
|
119
|
+
resolve(`Pattern /${args.pattern}/ found in output.`);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
// Check for timeout
|
|
123
|
+
if (elapsed > timeout) {
|
|
124
|
+
clearInterval(checkInterval);
|
|
125
|
+
resolve(`Monitor timed out after ${timeout}ms. Task status is still: ${task.status}`);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
}, 500); // Poll every 500ms internally
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
export async function listShellTasks(args, cwd) {
|
|
132
|
+
if (activeTasks.size === 0)
|
|
133
|
+
return 'No background tasks running.';
|
|
134
|
+
let res = 'Background Tasks:\n';
|
|
135
|
+
for (const [id, task] of activeTasks.entries()) {
|
|
136
|
+
res += `- [${id}] Status: ${task.status} | Cmd: ${task.command.slice(0, 50)}\n`;
|
|
137
|
+
}
|
|
138
|
+
return res;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=shell-ops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-ops.js","sourceRoot":"","sources":["../../src/tools/shell-ops.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AACnD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAY5B,MAAM,WAAW,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,IAA2E,EAC3E,MAAc,OAAO,CAAC,GAAG,EAAE;IAE3B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC;IACzC,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,KAAK,IAAI,CAAC;IAErD,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa;QAEpF,MAAM,IAAI,GAAmB;YAC3B,EAAE,EAAE,MAAM;YACV,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,SAAS;YACjB,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,EAAE;SACjB,CAAC;QAEF,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAE9B,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAA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,CAAC,CAAC,CAAC,8BAA8B;IACzC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAS,EAAE,GAAW;IACzD,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,8BAA8B,CAAC;IAClE,IAAI,GAAG,GAAG,qBAAqB,CAAC;IAChC,KAAK,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;QAC/C,GAAG,IAAI,MAAM,EAAE,aAAa,IAAI,CAAC,MAAM,WAAW,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC;IAClF,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import OpenAI from 'openai';
|
|
2
|
+
export interface ToolDefinition {
|
|
3
|
+
schema: OpenAI.Chat.Completions.ChatCompletionTool;
|
|
4
|
+
execute: (args: any, cwd?: string) => Promise<string>;
|
|
5
|
+
}
|
|
6
|
+
export interface ToolExecutionResult {
|
|
7
|
+
toolName: string;
|
|
8
|
+
args: any;
|
|
9
|
+
result: string;
|
|
10
|
+
isError: boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
export function printBanner(version = '1.0.0') {
|
|
3
|
+
const banner = `
|
|
4
|
+
${chalk.green.bold(' ███████╗ ██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ███████╗')}
|
|
5
|
+
${chalk.green.bold(' ██╔════╝██╔════╝██╔═══██╗ ██╔════╝██╔═══██╗██╔══██╗██╔════╝')}
|
|
6
|
+
${chalk.green.bold(' █████╗ ██║ ██║ ██║█████╗██║ ██║ ██║██║ ██║█████╗ ')}
|
|
7
|
+
${chalk.green.bold(' ██╔══╝ ██║ ██║ ██║╚════╝██║ ██║ ██║██║ ██║██╔══╝ ')}
|
|
8
|
+
${chalk.green.bold(' ███████╗╚██████╗╚██████╔╝ ╚██████╗╚██████╔╝██████╔╝███████╗')}
|
|
9
|
+
${chalk.green.bold(' ╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝')}
|
|
10
|
+
${chalk.dim('Free OpenRouter CLI Coding Agent with Taste-Adaptation')} ${chalk.yellow(`v${version}`)}
|
|
11
|
+
`;
|
|
12
|
+
console.log(banner);
|
|
13
|
+
}
|
|
14
|
+
export function printHelp() {
|
|
15
|
+
console.log(`
|
|
16
|
+
${chalk.bold('Interactive Slash Commands:')}
|
|
17
|
+
${chalk.cyan('/models')} (or ${chalk.cyan('/model')}) - Browse & switch between active OpenRouter free models
|
|
18
|
+
${chalk.cyan('/refresh')} - Force fetch the latest free models from OpenRouter
|
|
19
|
+
${chalk.cyan('/compact')} - Compact conversation history to save tokens
|
|
20
|
+
${chalk.cyan('/resume')} - Resume previous session history
|
|
21
|
+
${chalk.cyan('/taste')} - View or add project coding style rules
|
|
22
|
+
${chalk.cyan('/key')} - Update your OpenRouter API Key
|
|
23
|
+
${chalk.cyan('/clear')} - Clear current conversation & reset context
|
|
24
|
+
${chalk.cyan('/help')} - Show this help menu
|
|
25
|
+
${chalk.cyan('/exit')} - Exit the agent
|
|
26
|
+
|
|
27
|
+
${chalk.bold('Shortcuts & Direct Execution:')}
|
|
28
|
+
${chalk.cyan('!<cmd>')} - Run terminal command directly (e.g. ${chalk.dim('!npm test')}, ${chalk.dim('!git status')})
|
|
29
|
+
`);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.js","sourceRoot":"","sources":["../../src/ui/banner.ts"],"names":[],"mappings":"AAAA,OAAO,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,GAAG,CAAC,WAAW,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC;CACjI,CAAC,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dastageer_44/eco-code",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Free, open-source CLI coding agent powered by OpenRouter free tier models with taste-adaptation harness.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"eco-code": "./dist/index.js",
|
|
8
|
+
"ecocode": "./dist/index.js",
|
|
9
|
+
"eco": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"watch": "tsc -w",
|
|
20
|
+
"start": "tsx src/index.ts",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"ai",
|
|
25
|
+
"coding-agent",
|
|
26
|
+
"cli",
|
|
27
|
+
"openrouter",
|
|
28
|
+
"developer-tools",
|
|
29
|
+
"free-models",
|
|
30
|
+
"agentic",
|
|
31
|
+
"taste-learning"
|
|
32
|
+
],
|
|
33
|
+
"author": "",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@clack/prompts": "^0.8.2",
|
|
37
|
+
"axios": "^1.7.9",
|
|
38
|
+
"chalk": "^5.4.1",
|
|
39
|
+
"commander": "^13.1.0",
|
|
40
|
+
"openai": "^4.85.4",
|
|
41
|
+
"ora": "^8.2.0",
|
|
42
|
+
"update-notifier": "^7.3.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^22.13.4",
|
|
46
|
+
"@types/update-notifier": "^6.0.3",
|
|
47
|
+
"tsx": "^4.19.3",
|
|
48
|
+
"typescript": "^5.7.3"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=18.0.0"
|
|
52
|
+
}
|
|
53
|
+
}
|