@lasso-ai/cli 1.3.8 → 1.3.9

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.
Files changed (2) hide show
  1. package/dist/cli/bridge.js +8 -41
  2. package/package.json +1 -1
@@ -1183,47 +1183,14 @@ async function startBridge(cwd = process.cwd(), collabConfig = null, bridgePort
1183
1183
  }
1184
1184
  else if (msg.type === "apply") {
1185
1185
  try {
1186
- socket.send(JSON.stringify({
1187
- type: "agent_status",
1188
- taskId: msg.taskId,
1189
- status: "working",
1190
- message: "Re-generating changes with current file state..."
1191
- }));
1192
- // Re-run the edit request to get fresh changes based on current file state
1193
- const editRequest = editRequests.get(msg.taskId);
1194
- const editConfig = editConfigs.get(msg.taskId);
1195
- if (!editRequest || !editConfig) {
1196
- socket.send(JSON.stringify({
1197
- type: "agent_status",
1198
- taskId: msg.taskId,
1199
- status: "error",
1200
- message: "Could not re-generate changes: original request not found."
1201
- }));
1202
- return;
1203
- }
1204
- const controller = new AbortController();
1205
- taskControllers.set(msg.taskId, controller);
1206
- const freshProposal = await (0, agent_1.proposeChanges)(cwd, editRequest, editConfig, controller.signal, (message, detail, level) => {
1207
- if (!controller.signal.aborted && socket.readyState === socket.OPEN) {
1208
- socket.send(JSON.stringify({ type: "agent_status", taskId: msg.taskId, status: level === "error" ? "error" : "working", message, detail }));
1209
- }
1210
- }, (prompt) => {
1211
- if (!controller.signal.aborted && socket.readyState === socket.OPEN) {
1212
- socket.send(JSON.stringify({ type: "agent_prompt", taskId: msg.taskId, prompt }));
1213
- }
1214
- });
1215
- if (controller.signal.aborted) {
1216
- socket.send(JSON.stringify({ type: "agent_status", taskId: msg.taskId, status: "stopped", message: "Agent stopped." }));
1217
- return;
1218
- }
1219
- // Apply the fresh changes
1220
- const filePaths = [...new Set(freshProposal.changes.map(c => c.filePath))];
1186
+ // Create snapshot before applying changes
1187
+ const filePaths = [...new Set(msg.changes.map(c => c.filePath))];
1221
1188
  const parentSnapshot = (0, snapshot_1.getSnapshotByTaskId)(cwd, msg.taskId);
1222
1189
  // Create pre-apply snapshot
1223
- const preSnapshot = (0, snapshot_1.createSnapshot)(cwd, msg.taskId, `Pre-apply: ${freshProposal.changes.length} file${freshProposal.changes.length === 1 ? "" : "s"}`, filePaths, parentSnapshot?.id);
1190
+ const preSnapshot = (0, snapshot_1.createSnapshot)(cwd, msg.taskId, `Pre-apply: ${msg.changes.length} file${msg.changes.length === 1 ? "" : "s"}`, filePaths, parentSnapshot?.id);
1224
1191
  const snapshots = [];
1225
1192
  const planned = new Map();
1226
- for (const change of freshProposal.changes) {
1193
+ for (const change of msg.changes) {
1227
1194
  const isNew = !change.oldString;
1228
1195
  const filePath = resolveProposedFile(cwd, change.filePath, true);
1229
1196
  const exists = node_fs_1.default.existsSync(filePath);
@@ -1253,7 +1220,7 @@ async function startBridge(cwd = process.cwd(), collabConfig = null, bridgePort
1253
1220
  node_fs_1.default.writeFileSync(filePath, nextContent);
1254
1221
  }
1255
1222
  // Create post-apply snapshot
1256
- (0, snapshot_1.createSnapshot)(cwd, msg.taskId, `Applied: ${freshProposal.changes.length} file${freshProposal.changes.length === 1 ? "" : "s"}`, filePaths, preSnapshot.id);
1223
+ (0, snapshot_1.createSnapshot)(cwd, msg.taskId, `Applied: ${msg.changes.length} file${msg.changes.length === 1 ? "" : "s"}`, filePaths, preSnapshot.id);
1257
1224
  // Run build validation after applying changes
1258
1225
  const validation = await validateBuild(cwd);
1259
1226
  if (!validation.passed) {
@@ -1270,17 +1237,17 @@ async function startBridge(cwd = process.cwd(), collabConfig = null, bridgePort
1270
1237
  buildErrorContext.set(msg.taskId, {
1271
1238
  errors: validation.errors,
1272
1239
  command: validation.command,
1273
- originalChanges: freshProposal.changes,
1240
+ originalChanges: msg.changes,
1274
1241
  retryCount: 0
1275
1242
  });
1276
1243
  // Trigger automatic build fix
1277
- await triggerBuildFix(cwd, msg.taskId, validation.errors, validation.command, freshProposal.changes, resolvedLassoKey, agentConfig, collabConfig, socket, taskControllers, taskSnapshots, buildErrorContext);
1244
+ await triggerBuildFix(cwd, msg.taskId, validation.errors, validation.command, msg.changes, resolvedLassoKey, agentConfig, collabConfig, socket, taskControllers, taskSnapshots, buildErrorContext);
1278
1245
  return;
1279
1246
  }
1280
1247
  socket.send(JSON.stringify({
1281
1248
  type: "applied",
1282
1249
  taskId: msg.taskId,
1283
- message: `${freshProposal.changes.length} file${freshProposal.changes.length === 1 ? "" : "s"} updated. Your dev server will reload.`,
1250
+ message: `${msg.changes.length} file${msg.changes.length === 1 ? "" : "s"} updated. Your dev server will reload.`,
1284
1251
  validation
1285
1252
  }));
1286
1253
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lasso-ai/cli",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "Select any part of your running app, describe a change, and let AI edit the real source code.",
5
5
  "type": "commonjs",
6
6
  "main": "dist/cli/index.js",