@blockrun/franklin 3.15.38 → 3.15.39
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/tools/bash.js +14 -1
- package/package.json +1 -1
package/dist/tools/bash.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Bash capability — execute shell commands with timeout and output capture.
|
|
3
3
|
*/
|
|
4
4
|
import { spawn } from 'node:child_process';
|
|
5
|
+
import fs from 'node:fs';
|
|
5
6
|
// ─── Smart Output Compression ─────────────────────────────────────────────
|
|
6
7
|
// Learned from RTK (Rust Token Killer): strip noise before sending to LLM.
|
|
7
8
|
// Applied after capture, before the 32KB cap — reduces tokens on verbose commands.
|
|
@@ -273,7 +274,19 @@ async function execute(input, ctx) {
|
|
|
273
274
|
}
|
|
274
275
|
function executeCommand(command, timeoutMs, ctx) {
|
|
275
276
|
return new Promise((resolve) => {
|
|
276
|
-
|
|
277
|
+
// Force /bin/bash (not $SHELL) so the tool's behavior matches its name
|
|
278
|
+
// and its tool description. Pre-3.15.39 used `process.env.SHELL ||
|
|
279
|
+
// '/bin/bash'`, which on macOS defaults to zsh — and zsh has
|
|
280
|
+
// semantically different rules (NOMATCH on unmatched globs is fatal,
|
|
281
|
+
// unlike bash's literal-passthrough). Verified 2026-05-04 from a real
|
|
282
|
+
// session: agent ran `rm -f data/etl_out/shard-*.ndjson` expecting
|
|
283
|
+
// bash's "if no match, -f ignores it"; zsh fatal-erred with `no
|
|
284
|
+
// matches found`. Other zsh-vs-bash divergences (process substitution
|
|
285
|
+
// syntax, `[[` bashisms in scripts, parameter expansion edge cases)
|
|
286
|
+
// would silently bite agents that learned bash. /bin/bash exists on
|
|
287
|
+
// every Linux + macOS install we ship to. Fall back to $SHELL only if
|
|
288
|
+
// /bin/bash is somehow missing (NixOS-style stores, exotic Docker).
|
|
289
|
+
const shell = fs.existsSync('/bin/bash') ? '/bin/bash' : (process.env.SHELL || '/bin/sh');
|
|
277
290
|
let child;
|
|
278
291
|
try {
|
|
279
292
|
child = spawn(shell, ['-c', command], {
|
package/package.json
CHANGED