harness-evolver 3.0.4 → 3.0.5

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/bin/install.js CHANGED
@@ -190,28 +190,58 @@ function installTools() {
190
190
  }
191
191
 
192
192
  function installPythonDeps() {
193
- console.log(`\n ${YELLOW}Installing Python dependencies...${RESET}`);
194
-
195
- // Try multiple pip variants
196
- const commands = [
197
- "pip install langsmith openevals",
198
- "uv pip install langsmith openevals",
199
- "pip3 install langsmith openevals",
200
- "python3 -m pip install langsmith openevals",
193
+ const venvDir = path.join(HOME, ".evolver", "venv");
194
+ const venvPython = path.join(venvDir, "bin", "python");
195
+ const venvPip = path.join(venvDir, "bin", "pip");
196
+
197
+ console.log(`\n ${YELLOW}Setting up Python environment...${RESET}`);
198
+
199
+ // Create venv if it doesn't exist
200
+ if (!fs.existsSync(venvPython)) {
201
+ console.log(` Creating isolated venv at ~/.evolver/venv/`);
202
+ const venvCommands = [
203
+ `uv venv "${venvDir}"`,
204
+ `python3 -m venv "${venvDir}"`,
205
+ ];
206
+ let created = false;
207
+ for (const cmd of venvCommands) {
208
+ try {
209
+ execSync(cmd, { stdio: "pipe", timeout: 30000 });
210
+ created = true;
211
+ break;
212
+ } catch {
213
+ continue;
214
+ }
215
+ }
216
+ if (!created) {
217
+ console.log(` ${RED}Failed to create venv.${RESET}`);
218
+ console.log(` Run manually: ${BOLD}python3 -m venv ~/.evolver/venv${RESET}`);
219
+ return false;
220
+ }
221
+ console.log(` ${GREEN}✓${RESET} venv created`);
222
+ } else {
223
+ console.log(` ${GREEN}✓${RESET} venv exists at ~/.evolver/venv/`);
224
+ }
225
+
226
+ // Install/upgrade deps in the venv
227
+ const installCommands = [
228
+ `uv pip install --python "${venvPython}" langsmith openevals`,
229
+ `"${venvPip}" install --upgrade langsmith openevals`,
230
+ `"${venvPython}" -m pip install --upgrade langsmith openevals`,
201
231
  ];
202
232
 
203
- for (const cmd of commands) {
233
+ for (const cmd of installCommands) {
204
234
  try {
205
235
  execSync(cmd, { stdio: "pipe", timeout: 120000 });
206
- console.log(` ${GREEN}✓${RESET} langsmith + openevals installed`);
236
+ console.log(` ${GREEN}✓${RESET} langsmith + openevals installed in venv`);
207
237
  return true;
208
238
  } catch {
209
239
  continue;
210
240
  }
211
241
  }
212
242
 
213
- console.log(` ${YELLOW}!${RESET} Could not auto-install Python packages.`);
214
- console.log(` Run manually: ${BOLD}pip install langsmith openevals${RESET}`);
243
+ console.log(` ${YELLOW}!${RESET} Could not install packages in venv.`);
244
+ console.log(` Run manually: ${BOLD}~/.evolver/venv/bin/pip install langsmith openevals${RESET}`);
215
245
  return false;
216
246
  }
217
247
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harness-evolver",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "LangSmith-native autonomous agent optimization for Claude Code",
5
5
  "author": "Raphael Valdetaro",
6
6
  "license": "MIT",
@@ -13,12 +13,15 @@ Run the autonomous propose-evaluate-iterate loop using LangSmith as the evaluati
13
13
 
14
14
  `.evolver.json` must exist. If not, tell user to run `evolver:setup`.
15
15
 
16
- ## Resolve Tool Path
16
+ ## Resolve Tool Path and Python
17
17
 
18
18
  ```bash
19
19
  TOOLS=$([ -d ".evolver/tools" ] && echo ".evolver/tools" || echo "$HOME/.evolver/tools")
20
+ EVOLVER_PY=$([ -f "$HOME/.evolver/venv/bin/python" ] && echo "$HOME/.evolver/venv/bin/python" || echo "python3")
20
21
  ```
21
22
 
23
+ Use `$EVOLVER_PY` instead of `python3` for ALL tool invocations.
24
+
22
25
  ## Parse Arguments
23
26
 
24
27
  - `--iterations N` (default: from interactive question or 5)
@@ -76,7 +79,7 @@ Run trace insights from the best experiment:
76
79
 
77
80
  ```bash
78
81
  BEST=$(python3 -c "import json; print(json.load(open('.evolver.json'))['best_experiment'])")
79
- python3 $TOOLS/trace_insights.py \
82
+ $EVOLVER_PY $TOOLS/trace_insights.py \
80
83
  --from-experiment "$BEST" \
81
84
  --output trace_insights.json 2>/dev/null
82
85
  ```
@@ -86,7 +89,7 @@ If a production project is configured, also gather production insights:
86
89
  ```bash
87
90
  PROD=$(python3 -c "import json; c=json.load(open('.evolver.json')); print(c.get('production_project',''))")
88
91
  if [ -n "$PROD" ] && [ ! -f "production_seed.json" ]; then
89
- python3 $TOOLS/seed_from_traces.py \
92
+ $EVOLVER_PY $TOOLS/seed_from_traces.py \
90
93
  --project "$PROD" --use-sdk \
91
94
  --output-md production_seed.md \
92
95
  --output-json production_seed.json \
@@ -99,7 +102,7 @@ fi
99
102
  Read the best experiment results and cluster failures:
100
103
 
101
104
  ```bash
102
- python3 $TOOLS/read_results.py \
105
+ $EVOLVER_PY $TOOLS/read_results.py \
103
106
  --experiment "$BEST" \
104
107
  --config .evolver.json \
105
108
  --output best_results.json 2>/dev/null
@@ -174,7 +177,7 @@ Wait for all 5 to complete.
174
177
  For each worktree that has changes (proposer committed something):
175
178
 
176
179
  ```bash
177
- python3 $TOOLS/run_eval.py \
180
+ $EVOLVER_PY $TOOLS/run_eval.py \
178
181
  --config .evolver.json \
179
182
  --worktree-path {worktree_path} \
180
183
  --experiment-prefix v{NNN}{suffix} \
@@ -186,7 +189,7 @@ Each candidate becomes a separate LangSmith experiment.
186
189
  ### 4. Compare All Candidates
187
190
 
188
191
  ```bash
189
- python3 $TOOLS/read_results.py \
192
+ $EVOLVER_PY $TOOLS/read_results.py \
190
193
  --experiments "v{NNN}a,v{NNN}b,v{NNN}c,v{NNN}d,v{NNN}e" \
191
194
  --config .evolver.json \
192
195
  --output comparison.json
@@ -35,23 +35,20 @@ If `MISSING`: "Set your LangSmith API key: `export LANGSMITH_API_KEY=lsv2_pt_...
35
35
 
36
36
  The tools auto-load the key from the credentials file, but the env var takes precedence.
37
37
 
38
- Python 3.10+ with `langsmith` and `openevals` packages must be installed:
39
-
40
- ```bash
41
- pip install langsmith openevals 2>/dev/null || uv pip install langsmith openevals
42
- ```
43
-
44
- ## Resolve Tool Path
38
+ ## Resolve Tool Path and Python
45
39
 
46
40
  ```bash
47
41
  TOOLS=$([ -d ".evolver/tools" ] && echo ".evolver/tools" || echo "$HOME/.evolver/tools")
42
+ EVOLVER_PY=$([ -f "$HOME/.evolver/venv/bin/python" ] && echo "$HOME/.evolver/venv/bin/python" || echo "python3")
48
43
  ```
49
44
 
45
+ Use `$EVOLVER_PY` instead of `python3` for ALL tool invocations. This ensures the venv with langsmith+openevals is used.
46
+
50
47
  ## Phase 1: Explore Project (automatic)
51
48
 
52
49
  ```bash
53
50
  find . -maxdepth 3 -type f -name "*.py" | head -30
54
- python3 $TOOLS/detect_stack.py .
51
+ $EVOLVER_PY $TOOLS/detect_stack.py .
55
52
  ```
56
53
 
57
54
  Look for:
@@ -145,7 +142,7 @@ If "I have test data": ask for file path.
145
142
  Build the setup.py command based on all gathered information:
146
143
 
147
144
  ```bash
148
- python3 $TOOLS/setup.py \
145
+ $EVOLVER_PY $TOOLS/setup.py \
149
146
  --project-name "{project_name}" \
150
147
  --entry-point "{run_command}" \
151
148
  --framework "{framework}" \