kairn-cli 2.2.9 → 2.2.10

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.js CHANGED
@@ -5218,19 +5218,41 @@ async function evolve(workspacePath, tasks, kairnConfig, evolveConfig, onProgres
5218
5218
  };
5219
5219
  await writeIterationLog(workspacePath, rollbackLog);
5220
5220
  history.push(rollbackLog);
5221
+ const bestHarnessPath = path21.join(
5222
+ workspacePath,
5223
+ "iterations",
5224
+ bestIteration.toString(),
5225
+ "harness"
5226
+ );
5221
5227
  if (iter + 1 < evolveConfig.maxIterations) {
5222
- const nextIterDir2 = path21.join(
5223
- workspacePath,
5224
- "iterations",
5225
- (iter + 1).toString()
5226
- );
5227
- const bestHarnessPath = path21.join(
5228
- workspacePath,
5229
- "iterations",
5230
- bestIteration.toString(),
5231
- "harness"
5232
- );
5233
- await copyDir(bestHarnessPath, path21.join(nextIterDir2, "harness"));
5228
+ onProgress?.({ type: "proposing", iteration: iter, message: "Proposing new mutations after rollback" });
5229
+ try {
5230
+ let rollbackProposal = await propose(
5231
+ iter,
5232
+ workspacePath,
5233
+ bestHarnessPath,
5234
+ history,
5235
+ tasks,
5236
+ kairnConfig,
5237
+ evolveConfig.proposerModel
5238
+ );
5239
+ if (rollbackProposal.mutations.length > evolveConfig.maxMutationsPerIteration) {
5240
+ rollbackProposal = {
5241
+ ...rollbackProposal,
5242
+ mutations: rollbackProposal.mutations.slice(0, evolveConfig.maxMutationsPerIteration)
5243
+ };
5244
+ }
5245
+ const nextIterDir2 = path21.join(workspacePath, "iterations", (iter + 1).toString());
5246
+ await applyMutations(bestHarnessPath, nextIterDir2, rollbackProposal.mutations);
5247
+ onProgress?.({
5248
+ type: "mutations-applied",
5249
+ iteration: iter,
5250
+ mutationCount: rollbackProposal.mutations.length
5251
+ });
5252
+ } catch {
5253
+ const nextIterDir2 = path21.join(workspacePath, "iterations", (iter + 1).toString());
5254
+ await copyDir(bestHarnessPath, path21.join(nextIterDir2, "harness"));
5255
+ }
5234
5256
  }
5235
5257
  continue;
5236
5258
  }