@nbardy/oompa 0.4.3 → 0.4.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.
|
@@ -136,14 +136,19 @@
|
|
|
136
136
|
(declare cmd-swarm parse-model-string)
|
|
137
137
|
|
|
138
138
|
(defn- probe-model
|
|
139
|
-
"Send 'say ok' to a model via its harness CLI. Returns true if model responds.
|
|
139
|
+
"Send 'say ok' to a model via its harness CLI. Returns true if model responds.
|
|
140
|
+
Claude hangs without /dev/null stdin when spawned from bb."
|
|
140
141
|
[harness model]
|
|
141
142
|
(try
|
|
142
143
|
(let [cmd (case harness
|
|
143
|
-
:claude ["claude" "--model" model "-p" "say ok" "--max-turns" "1"]
|
|
144
|
-
:codex ["codex" "exec" "--dangerously-bypass-approvals-and-sandbox" "--skip-git-repo-check" "--model" model "--" "say ok"])
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
:claude ["claude" "--model" model "-p" "[oompa:probe] say ok" "--max-turns" "1"]
|
|
145
|
+
:codex ["codex" "exec" "--dangerously-bypass-approvals-and-sandbox" "--skip-git-repo-check" "--model" model "--" "[oompa:probe] say ok"])
|
|
146
|
+
null-in (io/input-stream (io/file "/dev/null"))
|
|
147
|
+
proc (process/process cmd {:out :string :err :string :in null-in})
|
|
148
|
+
result (deref proc 30000 :timeout)]
|
|
149
|
+
(if (= result :timeout)
|
|
150
|
+
(do (.destroyForcibly (:proc proc)) false)
|
|
151
|
+
(zero? (:exit result))))
|
|
147
152
|
(catch Exception _ false)))
|
|
148
153
|
|
|
149
154
|
(defn- validate-models!
|
|
@@ -97,6 +97,26 @@
|
|
|
97
97
|
"Root of the oompa package — set by bin/oompa.js, falls back to cwd."
|
|
98
98
|
(or (System/getenv "OOMPA_PACKAGE_ROOT") "."))
|
|
99
99
|
|
|
100
|
+
;; Resolve absolute paths for CLI binaries at first use.
|
|
101
|
+
;; ProcessBuilder with :dir set can fail to find bare command names on some
|
|
102
|
+
;; platforms (macOS + babashka), so we resolve once via `which` and cache.
|
|
103
|
+
(def ^:private binary-paths* (atom {}))
|
|
104
|
+
|
|
105
|
+
(defn- resolve-binary!
|
|
106
|
+
"Resolve the absolute path of a CLI binary. Caches result.
|
|
107
|
+
Throws if binary not found on PATH."
|
|
108
|
+
[name]
|
|
109
|
+
(or (get @binary-paths* name)
|
|
110
|
+
(let [result (try
|
|
111
|
+
(process/sh ["which" name] {:out :string :err :string})
|
|
112
|
+
(catch Exception _ {:exit -1 :out "" :err ""}))
|
|
113
|
+
path (when (zero? (:exit result))
|
|
114
|
+
(str/trim (:out result)))]
|
|
115
|
+
(if path
|
|
116
|
+
(do (swap! binary-paths* assoc name path)
|
|
117
|
+
path)
|
|
118
|
+
(throw (ex-info (str "Binary not found on PATH: " name) {:binary name}))))))
|
|
119
|
+
|
|
100
120
|
(defn- load-prompt
|
|
101
121
|
"Load a prompt file. Tries path as-is first, then from package root."
|
|
102
122
|
[path]
|
|
@@ -172,14 +192,14 @@
|
|
|
172
192
|
;; Build command — both harnesses run with cwd=worktree, no sandbox
|
|
173
193
|
;; so agents can `..` to reach project root for task management
|
|
174
194
|
cmd (case harness
|
|
175
|
-
:codex (cond-> ["codex" "exec"
|
|
195
|
+
:codex (cond-> [(resolve-binary! "codex") "exec"
|
|
176
196
|
"--dangerously-bypass-approvals-and-sandbox"
|
|
177
197
|
"--skip-git-repo-check"
|
|
178
198
|
"-C" abs-worktree]
|
|
179
199
|
model (into ["--model" model])
|
|
180
200
|
reasoning (into ["-c" (str "model_reasoning_effort=\"" reasoning "\"")])
|
|
181
201
|
true (conj "--" full-prompt))
|
|
182
|
-
:claude (cond-> ["claude" "-p" "--dangerously-skip-permissions"
|
|
202
|
+
:claude (cond-> [(resolve-binary! "claude") "-p" "--dangerously-skip-permissions"
|
|
183
203
|
"--session-id" session-id]
|
|
184
204
|
model (into ["--model" model])))
|
|
185
205
|
|
|
@@ -227,13 +247,13 @@
|
|
|
227
247
|
|
|
228
248
|
;; Build command — cwd=worktree, no sandbox
|
|
229
249
|
cmd (case review-harness
|
|
230
|
-
:codex (cond-> ["codex" "exec"
|
|
250
|
+
:codex (cond-> [(resolve-binary! "codex") "exec"
|
|
231
251
|
"--dangerously-bypass-approvals-and-sandbox"
|
|
232
252
|
"--skip-git-repo-check"
|
|
233
253
|
"-C" abs-wt]
|
|
234
254
|
review-model (into ["--model" review-model])
|
|
235
255
|
true (conj "--" review-prompt))
|
|
236
|
-
:claude (cond-> ["claude" "-p" "--dangerously-skip-permissions"]
|
|
256
|
+
:claude (cond-> [(resolve-binary! "claude") "-p" "--dangerously-skip-permissions"]
|
|
237
257
|
review-model (into ["--model" review-model])))
|
|
238
258
|
|
|
239
259
|
;; Run reviewer — cwd=worktree
|
|
@@ -265,13 +285,13 @@
|
|
|
265
285
|
abs-wt (.getAbsolutePath (io/file worktree-path))
|
|
266
286
|
|
|
267
287
|
cmd (case harness
|
|
268
|
-
:codex (cond-> ["codex" "exec"
|
|
288
|
+
:codex (cond-> [(resolve-binary! "codex") "exec"
|
|
269
289
|
"--dangerously-bypass-approvals-and-sandbox"
|
|
270
290
|
"--skip-git-repo-check"
|
|
271
291
|
"-C" abs-wt]
|
|
272
292
|
model (into ["--model" model])
|
|
273
293
|
true (conj "--" fix-prompt))
|
|
274
|
-
:claude (cond-> ["claude" "-p" "--dangerously-skip-permissions"]
|
|
294
|
+
:claude (cond-> [(resolve-binary! "claude") "-p" "--dangerously-skip-permissions"]
|
|
275
295
|
model (into ["--model" model])))
|
|
276
296
|
|
|
277
297
|
result (try
|
package/bin/test-models
CHANGED
|
@@ -37,9 +37,9 @@ if [ -z "$MODELS" ]; then
|
|
|
37
37
|
exit 1
|
|
38
38
|
fi
|
|
39
39
|
|
|
40
|
-
# Create results directory
|
|
40
|
+
# Create results directory in /tmp so it doesn't litter the project
|
|
41
41
|
RUN_ID=$(python3 -c "import uuid; print(str(uuid.uuid4())[:8])")
|
|
42
|
-
RESULTS_DIR="
|
|
42
|
+
RESULTS_DIR="/tmp/oompa_tst_${RUN_ID}"
|
|
43
43
|
mkdir -p "$RESULTS_DIR"
|
|
44
44
|
|
|
45
45
|
MODEL_COUNT=$(echo "$MODELS" | wc -l | tr -d ' ')
|