@lasso-ai/cli 1.0.22 → 1.0.23
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/agent.js +26 -9
- package/package.json +1 -1
package/dist/cli/agent.js
CHANGED
|
@@ -28,22 +28,31 @@ async function detectLocalAgents() {
|
|
|
28
28
|
const ignored = new Set(["node_modules", ".git", ".next", "dist", "build", ".turbo"]);
|
|
29
29
|
const sourceExtensions = /\.(tsx?|jsx?|vue|svelte|css|scss|html)$/i;
|
|
30
30
|
const sourceFileCache = new Map();
|
|
31
|
-
async function sourceFiles(directory) {
|
|
31
|
+
async function sourceFiles(directory, budget = { remaining: 40 }) {
|
|
32
|
+
if (budget.remaining <= 0)
|
|
33
|
+
return [];
|
|
32
34
|
const cached = sourceFileCache.get(directory);
|
|
33
|
-
if (cached && cached.expiresAt > Date.now())
|
|
34
|
-
|
|
35
|
+
if (cached && cached.expiresAt > Date.now()) {
|
|
36
|
+
const files = cached.files.slice(0, budget.remaining);
|
|
37
|
+
budget.remaining -= files.length;
|
|
38
|
+
return files;
|
|
39
|
+
}
|
|
35
40
|
const entries = await promises_1.default.readdir(directory, { withFileTypes: true });
|
|
36
41
|
const files = [];
|
|
37
42
|
for (const entry of entries) {
|
|
38
43
|
if (ignored.has(entry.name) || entry.name.startsWith("."))
|
|
39
44
|
continue;
|
|
40
45
|
const fullPath = node_path_1.default.join(directory, entry.name);
|
|
41
|
-
if (
|
|
42
|
-
files.push(...(await sourceFiles(fullPath)));
|
|
43
|
-
else if (sourceExtensions.test(entry.name))
|
|
44
|
-
files.push(fullPath);
|
|
45
|
-
if (files.length >= 40)
|
|
46
|
+
if (budget.remaining <= 0)
|
|
46
47
|
break;
|
|
48
|
+
if (entry.isDirectory()) {
|
|
49
|
+
const nested = await sourceFiles(fullPath, budget);
|
|
50
|
+
files.push(...nested);
|
|
51
|
+
}
|
|
52
|
+
else if (sourceExtensions.test(entry.name)) {
|
|
53
|
+
files.push(fullPath);
|
|
54
|
+
budget.remaining -= 1;
|
|
55
|
+
}
|
|
47
56
|
}
|
|
48
57
|
sourceFileCache.set(directory, { expiresAt: Date.now() + 5000, files });
|
|
49
58
|
return files;
|
|
@@ -369,7 +378,13 @@ async function proposeWithLocalAgent(cwd, instruction, context, config, signal,
|
|
|
369
378
|
};
|
|
370
379
|
child.stdout.on("data", consume);
|
|
371
380
|
child.stderr.on("data", (chunk) => {
|
|
372
|
-
|
|
381
|
+
const text = String(chunk);
|
|
382
|
+
stderr += text;
|
|
383
|
+
for (const line of text.split(/\r?\n/)) {
|
|
384
|
+
const progress = progressFromLine(line, config.provider);
|
|
385
|
+
if (progress)
|
|
386
|
+
onProgress?.(progress.message, progress.detail);
|
|
387
|
+
}
|
|
373
388
|
});
|
|
374
389
|
if (signal) {
|
|
375
390
|
if (signal.aborted)
|
|
@@ -391,7 +406,9 @@ async function proposeWithLocalAgent(cwd, instruction, context, config, signal,
|
|
|
391
406
|
return extractLocalAgentProposal(stdout, config.provider);
|
|
392
407
|
}
|
|
393
408
|
async function proposeChanges(cwd, input, config, signal, onProgress) {
|
|
409
|
+
onProgress?.("Reading source context…");
|
|
394
410
|
const context = await contextFor(cwd, input.element);
|
|
411
|
+
onProgress?.("Starting the coding agent…");
|
|
395
412
|
const visualContext = input.context ? { ...input.context, screenshots: undefined } : undefined;
|
|
396
413
|
const history = input.messages?.map((message) => `${message.role}: ${message.content}`).join("\n") || input.instruction;
|
|
397
414
|
const priorChanges = input.changesHistory?.length ? JSON.stringify(input.changesHistory, null, 2) : "None";
|
package/package.json
CHANGED