@blockrun/franklin 3.15.38 → 3.15.40

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.
@@ -21,7 +21,17 @@ export function setSessionPersistenceDisabled(disabled) {
21
21
  persistenceDisabled = disabled;
22
22
  }
23
23
  export function isSessionPersistenceDisabled() {
24
- return persistenceDisabled;
24
+ // Also honor FRANKLIN_NO_PERSIST — a separate env var, deliberately
25
+ // NOT piggybacking on FRANKLIN_NO_AUDIT. test/local.mjs sets
26
+ // FRANKLIN_NO_AUDIT=1 at file level expecting session writes to
27
+ // keep working so resume tests can verify state on disk; that
28
+ // contract has to stay intact. FRANKLIN_NO_PERSIST is used by
29
+ // test/e2e.mjs to block home-dir writes from spawned franklin
30
+ // children. Verified 2026-05-04: prior e2e runs left 3 ghost
31
+ // session metas in the user's ~/.blockrun/sessions/ because real
32
+ // model names (zai/glm-5.1, nvidia/qwen3-coder-480b) escaped
33
+ // isTestFixtureModel()'s name-prefix gate.
34
+ return persistenceDisabled || process.env.FRANKLIN_NO_PERSIST === '1';
25
35
  }
26
36
  function getSessionsDir() {
27
37
  if (resolvedSessionsDir)
@@ -83,7 +93,7 @@ export function createSessionId() {
83
93
  * Save a message to the session transcript (append-only JSONL).
84
94
  */
85
95
  export function appendToSession(sessionId, message) {
86
- if (persistenceDisabled)
96
+ if (isSessionPersistenceDisabled())
87
97
  return;
88
98
  const line = JSON.stringify(message) + '\n';
89
99
  withWritableSessionDir(() => {
@@ -94,7 +104,7 @@ export function appendToSession(sessionId, message) {
94
104
  * Update session metadata.
95
105
  */
96
106
  export function updateSessionMeta(sessionId, meta) {
97
- if (persistenceDisabled)
107
+ if (isSessionPersistenceDisabled())
98
108
  return;
99
109
  withWritableSessionDir(() => {
100
110
  const existing = loadSessionMeta(sessionId);
@@ -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
- const shell = process.env.SHELL || '/bin/bash';
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/franklin",
3
- "version": "3.15.38",
3
+ "version": "3.15.40",
4
4
  "description": "Franklin — The AI agent with a wallet. Spends USDC autonomously to get real work done. Pay per action, no subscriptions.",
5
5
  "type": "module",
6
6
  "exports": {