@lasso-ai/cli 2.1.13 → 2.1.14
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/runtime-client.js +10 -5
- package/package.json +1 -1
|
@@ -88,9 +88,13 @@ class RuntimeClient {
|
|
|
88
88
|
}
|
|
89
89
|
const executor = new index_js_1.ActionExecutor(projectPath, opts?.browserContextProvider);
|
|
90
90
|
const verifier = new index_js_1.VerificationEngine(projectPath);
|
|
91
|
+
// Idempotent: called on agent_completed AND on stream failure, so the
|
|
92
|
+
// diff is always cached before the safety-net restore wipes the edits.
|
|
93
|
+
let finalized = false;
|
|
91
94
|
const finalizeGuard = async () => {
|
|
92
|
-
if (!guard)
|
|
95
|
+
if (!guard || finalized)
|
|
93
96
|
return;
|
|
97
|
+
finalized = true;
|
|
94
98
|
try {
|
|
95
99
|
const changes = guard.diff();
|
|
96
100
|
const applyable = changes.filter((c) => !c.binary);
|
|
@@ -174,10 +178,11 @@ class RuntimeClient {
|
|
|
174
178
|
}
|
|
175
179
|
finally {
|
|
176
180
|
reader.releaseLock();
|
|
177
|
-
//
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
// Stream died before agent_completed (network cut, server crash, model
|
|
182
|
+
// error surfaced as an error event): cache the diff first so the user's
|
|
183
|
+
// changes are recoverable, then restore the workspace. On the normal
|
|
184
|
+
// path finalizeGuard already ran and this is a no-op.
|
|
185
|
+
await finalizeGuard();
|
|
181
186
|
}
|
|
182
187
|
}
|
|
183
188
|
/** Execute a tool_call request locally against the real project. */
|
package/package.json
CHANGED