poe-code 3.0.120 → 3.0.121

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 CHANGED
@@ -9081,10 +9081,48 @@ async function runExperimentLoop(options) {
9081
9081
  });
9082
9082
  continue;
9083
9083
  }
9084
- const commitHash = await git.commitAll(
9085
- `experiment-loop: ${path18.basename(absoluteDocPath, path18.extname(absoluteDocPath))} #${experimentIndex}`,
9086
- options.cwd
9087
- );
9084
+ const commitMessage = `experiment-loop: ${path18.basename(absoluteDocPath, path18.extname(absoluteDocPath))} #${experimentIndex}`;
9085
+ let commitHash;
9086
+ try {
9087
+ commitHash = await git.commitAll(commitMessage, options.cwd);
9088
+ } catch (commitError) {
9089
+ const errorMessage = commitError instanceof Error ? commitError.message : String(commitError);
9090
+ options.onRecoveryAttempt?.(errorMessage);
9091
+ const recoveryResult = await runAgent({
9092
+ agent: currentSpecifier.agent,
9093
+ prompt: `A git command failed. Fix the issue so the commit can succeed.
9094
+
9095
+ Error:
9096
+ ${errorMessage}`,
9097
+ cwd: options.cwd,
9098
+ ...model ? { model } : {},
9099
+ ...options.signal ? { signal: options.signal } : {}
9100
+ });
9101
+ if (recoveryResult.exitCode !== 0) {
9102
+ const entry2 = createEntry({
9103
+ commit: preExperimentHash,
9104
+ status: "crash",
9105
+ score: null,
9106
+ output: errorMessage,
9107
+ durationMs: Date.now() - experimentStart
9108
+ });
9109
+ experimentsCompleted += 1;
9110
+ lastCrashOutput = entry2.output;
9111
+ await journal.log(entry2);
9112
+ await git.reset(preExperimentHash, options.cwd);
9113
+ options.onReset?.(preExperimentHash);
9114
+ options.onExperimentComplete?.(experimentIndex, entry2);
9115
+ await persistDoc({
9116
+ fs: fs3,
9117
+ docPath: absoluteDocPath,
9118
+ baseline: frontmatter.baseline,
9119
+ experimentsCompleted,
9120
+ experimentsKept
9121
+ });
9122
+ continue;
9123
+ }
9124
+ commitHash = await git.commitAll(commitMessage, options.cwd);
9125
+ }
9088
9126
  options.onCommit?.(commitHash);
9089
9127
  const evaluationResults = await evaluateChain(metrics, options.cwd, exec3, options.onMetricResult, metricTimeoutMs);
9090
9128
  const keep = allMetricsPassed(metrics, evaluationResults) && allScoresImproved(metrics, evaluationResults, frontmatter.baseline);
@@ -21878,7 +21916,7 @@ var init_package = __esm({
21878
21916
  "package.json"() {
21879
21917
  package_default = {
21880
21918
  name: "poe-code",
21881
- version: "3.0.120",
21919
+ version: "3.0.121",
21882
21920
  description: "CLI tool to configure Poe API for developer workflows.",
21883
21921
  type: "module",
21884
21922
  main: "./dist/index.js",