@sparkleideas/agent-booster 0.2.5 → 0.2.32
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/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +259 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +222 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +266 -0
- package/dist/server.js.map +1 -0
- package/package.json +5 -1
- package/wasm/README.md +299 -0
- package/wasm/agent_booster_wasm.d.ts +149 -0
- package/wasm/agent_booster_wasm.js +849 -0
- package/wasm/agent_booster_wasm_bg.wasm +0 -0
- package/wasm/agent_booster_wasm_bg.wasm.d.ts +47 -0
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Agent Booster CLI
|
|
5
|
+
*
|
|
6
|
+
* npx agent-booster apply <file> <edit>
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
const index_1 = require("./index");
|
|
43
|
+
const fs = __importStar(require("fs"));
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
const USAGE = `
|
|
46
|
+
Agent Booster - Ultra-fast code editing (52x faster than Morph LLM)
|
|
47
|
+
|
|
48
|
+
USAGE:
|
|
49
|
+
npx agent-booster apply <file> <edit> [options]
|
|
50
|
+
npx agent-booster benchmark [options]
|
|
51
|
+
|
|
52
|
+
COMMANDS:
|
|
53
|
+
apply <file> <edit> Apply an edit to a file
|
|
54
|
+
benchmark Run performance benchmarks
|
|
55
|
+
|
|
56
|
+
OPTIONS:
|
|
57
|
+
--language <lang> Programming language (default: auto-detect)
|
|
58
|
+
--confidence <num> Minimum confidence threshold (default: 0.5)
|
|
59
|
+
--output <file> Output file (default: overwrite input)
|
|
60
|
+
--dry-run Show changes without writing
|
|
61
|
+
|
|
62
|
+
EXAMPLES:
|
|
63
|
+
# Add type annotations to a function
|
|
64
|
+
npx agent-booster apply src/utils.js "add TypeScript types"
|
|
65
|
+
|
|
66
|
+
# Convert var to const/let
|
|
67
|
+
npx agent-booster apply src/old.js "convert var to const/let"
|
|
68
|
+
|
|
69
|
+
# Run benchmarks
|
|
70
|
+
npx agent-booster benchmark
|
|
71
|
+
|
|
72
|
+
PERFORMANCE:
|
|
73
|
+
Average latency: 7ms (vs Morph LLM: 352ms)
|
|
74
|
+
Cost: $0.00 (vs Morph LLM: $0.01/edit)
|
|
75
|
+
Speedup: 52x faster
|
|
76
|
+
`;
|
|
77
|
+
function parseArgs(args) {
|
|
78
|
+
const parsed = {
|
|
79
|
+
command: args[0] || 'help',
|
|
80
|
+
};
|
|
81
|
+
for (let i = 1; i < args.length; i++) {
|
|
82
|
+
const arg = args[i];
|
|
83
|
+
if (arg === '--language' && args[i + 1]) {
|
|
84
|
+
parsed.language = args[++i];
|
|
85
|
+
}
|
|
86
|
+
else if (arg === '--confidence' && args[i + 1]) {
|
|
87
|
+
parsed.confidence = parseFloat(args[++i]);
|
|
88
|
+
}
|
|
89
|
+
else if (arg === '--output' && args[i + 1]) {
|
|
90
|
+
parsed.output = args[++i];
|
|
91
|
+
}
|
|
92
|
+
else if (arg === '--dry-run') {
|
|
93
|
+
parsed.dryRun = true;
|
|
94
|
+
}
|
|
95
|
+
else if (!parsed.file) {
|
|
96
|
+
parsed.file = arg;
|
|
97
|
+
}
|
|
98
|
+
else if (!parsed.edit) {
|
|
99
|
+
parsed.edit = arg;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return parsed;
|
|
103
|
+
}
|
|
104
|
+
function detectLanguage(filePath) {
|
|
105
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
106
|
+
const langMap = {
|
|
107
|
+
'.js': 'javascript',
|
|
108
|
+
'.jsx': 'javascript',
|
|
109
|
+
'.ts': 'typescript',
|
|
110
|
+
'.tsx': 'typescript',
|
|
111
|
+
'.py': 'python',
|
|
112
|
+
'.go': 'go',
|
|
113
|
+
'.rs': 'rust',
|
|
114
|
+
'.java': 'java',
|
|
115
|
+
'.c': 'c',
|
|
116
|
+
'.cpp': 'cpp',
|
|
117
|
+
'.h': 'c',
|
|
118
|
+
'.hpp': 'cpp',
|
|
119
|
+
};
|
|
120
|
+
return langMap[ext] || 'javascript';
|
|
121
|
+
}
|
|
122
|
+
async function applyCommand(args) {
|
|
123
|
+
// Check for help flags FIRST (before stdin mode)
|
|
124
|
+
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
125
|
+
console.log(USAGE);
|
|
126
|
+
process.exit(0);
|
|
127
|
+
}
|
|
128
|
+
// Check if stdin has data (JSON mode for MCP)
|
|
129
|
+
// Only use stdin mode if no file argument is provided
|
|
130
|
+
if (!process.stdin.isTTY && !args.file) {
|
|
131
|
+
return applyJsonStdin(args);
|
|
132
|
+
}
|
|
133
|
+
if (!args.file) {
|
|
134
|
+
console.error('Error: File path required');
|
|
135
|
+
console.log(USAGE);
|
|
136
|
+
process.exit(1);
|
|
137
|
+
}
|
|
138
|
+
if (!args.edit) {
|
|
139
|
+
console.error('Error: Edit instruction required');
|
|
140
|
+
console.log(USAGE);
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
// Read file
|
|
144
|
+
const filePath = path.resolve(args.file);
|
|
145
|
+
if (!fs.existsSync(filePath)) {
|
|
146
|
+
console.error(`Error: File not found: ${filePath}`);
|
|
147
|
+
process.exit(1);
|
|
148
|
+
}
|
|
149
|
+
const code = fs.readFileSync(filePath, 'utf-8');
|
|
150
|
+
const language = args.language || detectLanguage(filePath);
|
|
151
|
+
console.log(`\n📝 File: ${filePath}`);
|
|
152
|
+
console.log(`🔤 Language: ${language}`);
|
|
153
|
+
console.log(`✏️ Edit: ${args.edit}\n`);
|
|
154
|
+
// Apply edit
|
|
155
|
+
const booster = new index_1.AgentBooster({
|
|
156
|
+
confidenceThreshold: args.confidence || 0.5,
|
|
157
|
+
});
|
|
158
|
+
const startTime = Date.now();
|
|
159
|
+
const result = await booster.apply({
|
|
160
|
+
code: code,
|
|
161
|
+
edit: args.edit,
|
|
162
|
+
language: language,
|
|
163
|
+
});
|
|
164
|
+
const elapsed = Date.now() - startTime;
|
|
165
|
+
// Show results
|
|
166
|
+
console.log(`✅ Success! (${elapsed}ms)`);
|
|
167
|
+
console.log(`📊 Confidence: ${(result.confidence * 100).toFixed(1)}%`);
|
|
168
|
+
console.log(`🔧 Strategy: ${result.strategy}`);
|
|
169
|
+
if (args.dryRun) {
|
|
170
|
+
console.log(`\n📄 Modified code:\n`);
|
|
171
|
+
console.log(result.output);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
const outputPath = args.output || filePath;
|
|
175
|
+
fs.writeFileSync(outputPath, result.output, 'utf-8');
|
|
176
|
+
console.log(`\n💾 Saved to: ${outputPath}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
async function applyJsonStdin(args) {
|
|
180
|
+
return new Promise((resolve, reject) => {
|
|
181
|
+
let input = '';
|
|
182
|
+
process.stdin.on('data', (chunk) => {
|
|
183
|
+
input += chunk;
|
|
184
|
+
});
|
|
185
|
+
process.stdin.on('end', async () => {
|
|
186
|
+
try {
|
|
187
|
+
const { code, edit } = JSON.parse(input);
|
|
188
|
+
if (!code || !edit) {
|
|
189
|
+
console.log(JSON.stringify({
|
|
190
|
+
success: false,
|
|
191
|
+
error: 'Missing required fields: code and edit'
|
|
192
|
+
}));
|
|
193
|
+
process.exit(1);
|
|
194
|
+
}
|
|
195
|
+
const booster = new index_1.AgentBooster({
|
|
196
|
+
confidenceThreshold: args.confidence || 0.5,
|
|
197
|
+
});
|
|
198
|
+
const result = await booster.apply({
|
|
199
|
+
code,
|
|
200
|
+
edit,
|
|
201
|
+
language: args.language || 'javascript'
|
|
202
|
+
});
|
|
203
|
+
// Output JSON result
|
|
204
|
+
console.log(JSON.stringify(result));
|
|
205
|
+
process.exit(result.success ? 0 : 1);
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
console.log(JSON.stringify({
|
|
209
|
+
success: false,
|
|
210
|
+
error: error.message
|
|
211
|
+
}));
|
|
212
|
+
process.exit(1);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
async function benchmarkCommand() {
|
|
218
|
+
console.log('\n🚀 Running Agent Booster benchmarks...\n');
|
|
219
|
+
const benchmarkScript = path.join(__dirname, '../benchmarks/run-real-benchmark.js');
|
|
220
|
+
if (!fs.existsSync(benchmarkScript)) {
|
|
221
|
+
console.error('Error: Benchmark script not found');
|
|
222
|
+
console.log('Run: npm test');
|
|
223
|
+
process.exit(1);
|
|
224
|
+
}
|
|
225
|
+
// Run benchmark script
|
|
226
|
+
const { execSync } = require('child_process');
|
|
227
|
+
execSync(`node ${benchmarkScript}`, { stdio: 'inherit' });
|
|
228
|
+
}
|
|
229
|
+
async function main() {
|
|
230
|
+
const args = parseArgs(process.argv.slice(2));
|
|
231
|
+
try {
|
|
232
|
+
switch (args.command) {
|
|
233
|
+
case 'apply':
|
|
234
|
+
await applyCommand(args);
|
|
235
|
+
break;
|
|
236
|
+
case 'benchmark':
|
|
237
|
+
await benchmarkCommand();
|
|
238
|
+
break;
|
|
239
|
+
case 'help':
|
|
240
|
+
case '--help':
|
|
241
|
+
case '-h':
|
|
242
|
+
console.log(USAGE);
|
|
243
|
+
break;
|
|
244
|
+
default:
|
|
245
|
+
console.error(`Unknown command: ${args.command}`);
|
|
246
|
+
console.log(USAGE);
|
|
247
|
+
process.exit(1);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
console.error(`\n❌ Error: ${error.message}`);
|
|
252
|
+
process.exit(1);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// Run CLI
|
|
256
|
+
if (require.main ===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;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,UAAU;AACV,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,CAAC;AACT,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Agent Booster - Morph LLM Compatible API
|
|
4
|
+
*
|
|
5
|
+
* Drop-in replacement for Morph LLM with 52x better performance
|
|
6
|
+
*/
|
|
7
|
+
export interface MorphApplyRequest {
|
|
8
|
+
/** Original code to modify */
|
|
9
|
+
code: string;
|
|
10
|
+
/** Edit instruction or snippet to apply */
|
|
11
|
+
edit: string;
|
|
12
|
+
/** Programming language (e.g., 'javascript', 'typescript', 'python') */
|
|
13
|
+
language?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface MorphApplyResponse {
|
|
16
|
+
/** Modified code after applying the edit (Morph-compatible) */
|
|
17
|
+
output: string;
|
|
18
|
+
/** Whether the edit was successful (Morph-compatible) */
|
|
19
|
+
success: boolean;
|
|
20
|
+
/** Latency in milliseconds (Morph-compatible) */
|
|
21
|
+
latency: number;
|
|
22
|
+
/** Token usage (Morph-compatible) */
|
|
23
|
+
tokens: {
|
|
24
|
+
input: number;
|
|
25
|
+
output: number;
|
|
26
|
+
};
|
|
27
|
+
/** Confidence score (0-1) - Agent Booster extension */
|
|
28
|
+
confidence: number;
|
|
29
|
+
/** Strategy used for merging - Agent Booster extension */
|
|
30
|
+
strategy: string;
|
|
31
|
+
}
|
|
32
|
+
export interface AgentBoosterConfig {
|
|
33
|
+
/** Minimum confidence threshold (0-1). Default: 0.5 */
|
|
34
|
+
confidenceThreshold?: number;
|
|
35
|
+
/** Maximum chunks to analyze. Default: 100 */
|
|
36
|
+
maxChunks?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Agent Booster - Morph-compatible code editor
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const booster = new AgentBooster();
|
|
44
|
+
* const result = await booster.apply({
|
|
45
|
+
* code: 'function add(a, b) { return a + b; }',
|
|
46
|
+
* edit: 'function add(a: number, b: number): number { return a + b; }',
|
|
47
|
+
* language: 'typescript'
|
|
48
|
+
* });
|
|
49
|
+
* console.log(result.code); // Modified code
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare class AgentBooster {
|
|
53
|
+
private config;
|
|
54
|
+
private wasmInstance;
|
|
55
|
+
constructor(config?: AgentBoosterConfig);
|
|
56
|
+
/**
|
|
57
|
+
* Apply a code edit (100% Morph-compatible API)
|
|
58
|
+
*
|
|
59
|
+
* @param request - Apply request
|
|
60
|
+
* @returns Modified code in Morph-compatible format
|
|
61
|
+
*/
|
|
62
|
+
apply(request: MorphApplyRequest): Promise<MorphApplyResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* Batch apply multiple edits
|
|
65
|
+
*
|
|
66
|
+
* @param requests - Array of apply requests
|
|
67
|
+
* @returns Array of results
|
|
68
|
+
*/
|
|
69
|
+
batchApply(requests: MorphApplyRequest[]): Promise<MorphApplyResponse[]>;
|
|
70
|
+
private getConfidence;
|
|
71
|
+
private getStrategy;
|
|
72
|
+
private getMergedCode;
|
|
73
|
+
private strategyToString;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Convenience function for single apply operation
|
|
77
|
+
*
|
|
78
|
+
* @param request - Apply request
|
|
79
|
+
* @returns Modified code with metadata
|
|
80
|
+
*/
|
|
81
|
+
export declare function apply(request: MorphApplyRequest): Promise<MorphApplyResponse>;
|
|
82
|
+
export default AgentBooster;
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAeH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
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Agent Booster - Morph LLM Compatible API
|
|
5
|
+
*
|
|
6
|
+
* Drop-in replacement for Morph LLM with 52x better performance
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.AgentBooster = void 0;
|
|
43
|
+
exports.apply = apply;
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
// Load WASM module
|
|
46
|
+
const wasmPath = path.join(__dirname, '../wasm/agent_booster_wasm.js');
|
|
47
|
+
let AgentBoosterWasm;
|
|
48
|
+
try {
|
|
49
|
+
AgentBoosterWasm = require(wasmPath);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
throw new Error(`Failed to load WASM module from ${wasmPath}: ${e}`);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Agent Booster - Morph-compatible code editor
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const booster = new AgentBooster();
|
|
60
|
+
* const result = await booster.apply({
|
|
61
|
+
* code: 'function add(a, b) { return a + b; }',
|
|
62
|
+
* edit: 'function add(a: number, b: number): number { return a + b; }',
|
|
63
|
+
* language: 'typescript'
|
|
64
|
+
* });
|
|
65
|
+
* console.log(result.code); // Modified code
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
class AgentBooster {
|
|
69
|
+
constructor(config = {}) {
|
|
70
|
+
this.config = {
|
|
71
|
+
confidenceThreshold: config.confidenceThreshold || 0.5,
|
|
72
|
+
maxChunks: config.maxChunks || 100,
|
|
73
|
+
};
|
|
74
|
+
// Initialize WASM instance
|
|
75
|
+
this.wasmInstance = new AgentBoosterWasm.AgentBoosterWasm();
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Apply a code edit (100% Morph-compatible API)
|
|
79
|
+
*
|
|
80
|
+
* @param request - Apply request
|
|
81
|
+
* @returns Modified code in Morph-compatible format
|
|
82
|
+
*/
|
|
83
|
+
async apply(request) {
|
|
84
|
+
const startTime = Date.now();
|
|
85
|
+
try {
|
|
86
|
+
// Validate input - detect vague instructions
|
|
87
|
+
if (!request.edit || request.edit.trim().length === 0) {
|
|
88
|
+
throw new Error('Edit instruction cannot be empty. Provide specific code snippet or transformation.');
|
|
89
|
+
}
|
|
90
|
+
// Detect vague/non-code instructions
|
|
91
|
+
const vaguePhrases = [
|
|
92
|
+
'make it better', 'improve', 'optimize', 'fix', 'refactor',
|
|
93
|
+
'add feature', 'implement', 'create', 'design', 'build',
|
|
94
|
+
'handle', 'manage', 'process', 'support'
|
|
95
|
+
];
|
|
96
|
+
const isVague = vaguePhrases.some(phrase => request.edit.toLowerCase().includes(phrase) &&
|
|
97
|
+
!request.edit.includes('{') && // No code blocks
|
|
98
|
+
!request.edit.includes('function') && // No function def
|
|
99
|
+
!request.edit.includes('const') && // No variable def
|
|
100
|
+
!request.edit.includes('class') // No class def
|
|
101
|
+
);
|
|
102
|
+
if (isVague) {
|
|
103
|
+
throw new Error(`Vague instruction detected: "${request.edit}". Agent Booster requires specific code snippets, not high-level instructions. Use an LLM for vague tasks.`);
|
|
104
|
+
}
|
|
105
|
+
// Call WASM module with confidence threshold
|
|
106
|
+
const result = this.wasmInstance.apply_edit(request.code, request.edit, request.language || 'javascript', this.config.confidenceThreshold);
|
|
107
|
+
const latency = Date.now() - startTime;
|
|
108
|
+
// Debug: Log WASM result structure
|
|
109
|
+
if (process.env.DEBUG_AGENT_BOOSTER) {
|
|
110
|
+
console.log('WASM result:', {
|
|
111
|
+
type: typeof result,
|
|
112
|
+
confidence: result.confidence,
|
|
113
|
+
strategy: result.strategy,
|
|
114
|
+
merged_code_length: result.merged_code?.length,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// Convert WASM result to Morph-compatible format
|
|
118
|
+
const confidence = this.getConfidence(result);
|
|
119
|
+
const strategy = this.getStrategy(result);
|
|
120
|
+
const mergedCode = this.getMergedCode(result);
|
|
121
|
+
// Calculate token estimates (WASM doesn't track tokens, so we estimate)
|
|
122
|
+
const inputTokens = Math.ceil(request.code.length / 4);
|
|
123
|
+
const outputTokens = Math.ceil(mergedCode.length / 4);
|
|
124
|
+
return {
|
|
125
|
+
// Morph-compatible fields
|
|
126
|
+
output: mergedCode,
|
|
127
|
+
success: confidence > this.config.confidenceThreshold,
|
|
128
|
+
latency: latency,
|
|
129
|
+
tokens: {
|
|
130
|
+
input: inputTokens,
|
|
131
|
+
output: outputTokens,
|
|
132
|
+
},
|
|
133
|
+
// Agent Booster extensions (don't break Morph compatibility)
|
|
134
|
+
confidence: confidence,
|
|
135
|
+
strategy: this.strategyToString(strategy),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
// Return failure in Morph-compatible format
|
|
140
|
+
const latency = Date.now() - startTime;
|
|
141
|
+
// Debug: Log error
|
|
142
|
+
if (process.env.DEBUG_AGENT_BOOSTER) {
|
|
143
|
+
console.error('Error in apply():', error.message || error);
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
output: request.code,
|
|
147
|
+
success: false,
|
|
148
|
+
latency: latency,
|
|
149
|
+
tokens: { input: 0, output: 0 },
|
|
150
|
+
confidence: 0,
|
|
151
|
+
strategy: 'failed',
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Batch apply multiple edits
|
|
157
|
+
*
|
|
158
|
+
* @param requests - Array of apply requests
|
|
159
|
+
* @returns Array of results
|
|
160
|
+
*/
|
|
161
|
+
async batchApply(requests) {
|
|
162
|
+
return Promise.all(requests.map(req => this.apply(req)));
|
|
163
|
+
}
|
|
164
|
+
// Helper methods to extract data from WASM result
|
|
165
|
+
getConfidence(result) {
|
|
166
|
+
if (typeof result === 'object' && result !== null) {
|
|
167
|
+
if (typeof result.confidence === 'number')
|
|
168
|
+
return result.confidence;
|
|
169
|
+
if (typeof result.get_confidence === 'function')
|
|
170
|
+
return result.get_confidence();
|
|
171
|
+
}
|
|
172
|
+
return 0.5;
|
|
173
|
+
}
|
|
174
|
+
getStrategy(result) {
|
|
175
|
+
if (typeof result === 'object' && result !== null) {
|
|
176
|
+
if (typeof result.strategy === 'number')
|
|
177
|
+
return result.strategy;
|
|
178
|
+
if (typeof result.strategy === 'string')
|
|
179
|
+
return result.strategy;
|
|
180
|
+
if (typeof result.get_strategy === 'function')
|
|
181
|
+
return result.get_strategy();
|
|
182
|
+
}
|
|
183
|
+
return 2; // Default to InsertAfter
|
|
184
|
+
}
|
|
185
|
+
getMergedCode(result) {
|
|
186
|
+
if (typeof result === 'object' && result !== null) {
|
|
187
|
+
if (typeof result.merged_code === 'string')
|
|
188
|
+
return result.merged_code;
|
|
189
|
+
if (typeof result.get_merged_code === 'function')
|
|
190
|
+
return result.get_merged_code();
|
|
191
|
+
if (typeof result.code === 'string')
|
|
192
|
+
return result.code;
|
|
193
|
+
}
|
|
194
|
+
return '';
|
|
195
|
+
}
|
|
196
|
+
strategyToString(strategy) {
|
|
197
|
+
if (typeof strategy === 'string')
|
|
198
|
+
return strategy;
|
|
199
|
+
const strategies = {
|
|
200
|
+
0: 'exact_replace',
|
|
201
|
+
1: 'fuzzy_replace',
|
|
202
|
+
2: 'insert_after',
|
|
203
|
+
3: 'insert_before',
|
|
204
|
+
4: 'append',
|
|
205
|
+
};
|
|
206
|
+
return strategies[strategy] || 'unknown';
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
exports.AgentBooster = AgentBooster;
|
|
210
|
+
/**
|
|
211
|
+
* Convenience function for single apply operation
|
|
212
|
+
*
|
|
213
|
+
* @param request - Apply request
|
|
214
|
+
* @returns Modified code with metadata
|
|
215
|
+
*/
|
|
216
|
+
async function apply(request) {
|
|
217
|
+
const booster = new AgentBooster();
|
|
218
|
+
return booster.apply(request);
|
|
219
|
+
}
|
|
220
|
+
// Default export
|
|
221
|
+
exports.default = AgentBooster;
|
|
222
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;A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,eAAe,KAAK,UAAU;gBAAE,OAAO,MAAM,CAAC,eAAe,EAAE,CAAC;YAClF,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO,MAAM,CAAC,IAAI,CAAC;QAC1D,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAEO,gBAAgB,CAAC,QAAyB;QAChD,IAAI,OAAO,QAAQ,KAAK,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAElD,MAAM,UAAU,GAA8B;YAC5C,CAAC,EAAE,eAAe;YAClB,CAAC,EAAE,eAAe;YAClB,CAAC,EAAE,cAAc;YACjB,CAAC,EAAE,eAAe;YAClB,CAAC,EAAE,QAAQ;SACZ,CAAC;QAEF,OAAO,UAAU,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC;IAC3C,CAAC;CACF;AAhKD,oCAgKC;AAED;;;;;GAKG;AACI,KAAK,UAAU,KAAK,CAAC,OAA0B;IACpD,MAAM,OAAO,GAAG,IAAI,YAAY,EAAE,CAAC;IACnC,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED,iBAAiB;AACjB,kBAAe,YAAY,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Agent Booster API Server - Morph LLM Compatible
|
|
4
|
+
*
|
|
5
|
+
* Drop-in replacement for Morph LLM API with 352x faster performance
|
|
6
|
+
*
|
|
7
|
+
* Compatible endpoints:
|
|
8
|
+
* - POST /v1/chat/completions (Morph LLM format)
|
|
9
|
+
* - POST /v1/apply (Morph LLM format)
|
|
10
|
+
*/
|
|
11
|
+
declare const app: any;
|
|
12
|
+
export default app;
|
|
13
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAKH,QAAA,MAAM,GAAG,KAAY,CAAC;AA8QtB,eAAe,GAAG,CAAC"}
|