@tarcisiopgs/lisa 1.22.1 → 1.22.3
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/index.js +19 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -546,12 +546,13 @@ import { spawn } from "child_process";
|
|
|
546
546
|
import { platform } from "os";
|
|
547
547
|
var ANSI_REGEX = /\x1b(?:\[[0-9;?]*[a-zA-Z]|\][^\x07]*\x07|\([A-Z0-9]|[A-Z])/g;
|
|
548
548
|
var CTRL_D_REGEX = /\x04/g;
|
|
549
|
+
var CARET_D_BACKSPACE_REGEX = /\^D\x08\x08/g;
|
|
549
550
|
function stripAnsi(text2) {
|
|
550
|
-
return text2.replace(ANSI_REGEX, "").replace(CTRL_D_REGEX, "").replace(/\r\n/g, "\n").replace(/\r/g, "");
|
|
551
|
+
return text2.replace(ANSI_REGEX, "").replace(CTRL_D_REGEX, "").replace(CARET_D_BACKSPACE_REGEX, "").replace(/\r\n/g, "\n").replace(/\r/g, "");
|
|
551
552
|
}
|
|
552
553
|
function buildPtyArgs(command, os) {
|
|
553
554
|
const currentOs = os ?? platform();
|
|
554
|
-
const wrappedCommand =
|
|
555
|
+
const wrappedCommand = `stty eof undef 2>/dev/null; ${command} < /dev/null`;
|
|
555
556
|
if (currentOs === "darwin") {
|
|
556
557
|
return { file: "script", args: ["-qF", "/dev/null", "sh", "-c", wrappedCommand] };
|
|
557
558
|
}
|
|
@@ -1546,7 +1547,7 @@ async function runWithFallback(models, prompt, opts) {
|
|
|
1546
1547
|
const guardrailsSection = opts.guardrailsDir ? buildGuardrailsSection(opts.guardrailsDir) : "";
|
|
1547
1548
|
const fullPrompt = guardrailsSection ? `${prompt}${guardrailsSection}` : prompt;
|
|
1548
1549
|
const result = await provider.run(fullPrompt, { ...opts, model: spec.model });
|
|
1549
|
-
if (result.success) {
|
|
1550
|
+
if (result.success || opts.earlySuccess?.()) {
|
|
1550
1551
|
attempts.push({
|
|
1551
1552
|
provider: spec.provider,
|
|
1552
1553
|
model: spec.model,
|
|
@@ -5764,7 +5765,11 @@ async function runWorktreeMultiRepoSession(config2, issue2, logFile, session, mo
|
|
|
5764
5765
|
onProcess: (pid) => {
|
|
5765
5766
|
activeProviderPids.set(issue2.id, pid);
|
|
5766
5767
|
},
|
|
5767
|
-
shouldAbort: () => userKilledSet.has(issue2.id) || userSkippedSet.has(issue2.id)
|
|
5768
|
+
shouldAbort: () => userKilledSet.has(issue2.id) || userSkippedSet.has(issue2.id),
|
|
5769
|
+
earlySuccess: () => {
|
|
5770
|
+
const p = readPlanFile(planPath);
|
|
5771
|
+
return !!(p?.steps && p.steps.length > 0);
|
|
5772
|
+
}
|
|
5768
5773
|
});
|
|
5769
5774
|
stopSpinner();
|
|
5770
5775
|
planProviderUsed = planResult.providerUsed;
|
|
@@ -5780,20 +5785,13 @@ ${planResult.output}
|
|
|
5780
5785
|
);
|
|
5781
5786
|
} catch {
|
|
5782
5787
|
}
|
|
5783
|
-
if (!planResult.success) {
|
|
5784
|
-
error(`Planning phase failed for ${issue2.id}. Check ${logFile}`);
|
|
5785
|
-
cleanupPlanFile(planPath);
|
|
5786
|
-
activeProviderPids.delete(issue2.id);
|
|
5787
|
-
return {
|
|
5788
|
-
success: false,
|
|
5789
|
-
providerUsed: planResult.providerUsed,
|
|
5790
|
-
prUrls: [],
|
|
5791
|
-
fallback: planResult
|
|
5792
|
-
};
|
|
5793
|
-
}
|
|
5794
5788
|
const plan = readPlanFile(planPath);
|
|
5795
5789
|
if (!plan?.steps || plan.steps.length === 0) {
|
|
5796
|
-
|
|
5790
|
+
if (!planResult.success) {
|
|
5791
|
+
error(`Planning phase failed for ${issue2.id}. Check ${logFile}`);
|
|
5792
|
+
} else {
|
|
5793
|
+
error(`Agent did not produce a valid execution plan for ${issue2.id}. Aborting.`);
|
|
5794
|
+
}
|
|
5797
5795
|
cleanupPlanFile(planPath);
|
|
5798
5796
|
activeProviderPids.delete(issue2.id);
|
|
5799
5797
|
return {
|
|
@@ -5803,6 +5801,11 @@ ${planResult.output}
|
|
|
5803
5801
|
fallback: planResult
|
|
5804
5802
|
};
|
|
5805
5803
|
}
|
|
5804
|
+
if (!planResult.success) {
|
|
5805
|
+
warn(
|
|
5806
|
+
`Planning provider exited with error but plan file was written for ${issue2.id}. Proceeding.`
|
|
5807
|
+
);
|
|
5808
|
+
}
|
|
5806
5809
|
sortedSteps = [...plan.steps].sort((a, b) => a.order - b.order);
|
|
5807
5810
|
ok(
|
|
5808
5811
|
`Plan produced ${sortedSteps.length} step(s): ${sortedSteps.map((s) => s.repoPath).join(" \u2192 ")}`
|