@sliday/tamp 0.8.3 → 0.8.4

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/compress.js CHANGED
@@ -37,8 +37,11 @@ function deduplicateTargets(targets) {
37
37
  const prev = seen.get(key)
38
38
  if (prev && prev.text === target.text) {
39
39
  const ref = `[see tool_result in message ${prev.path[1]}, block ${prev.index} — identical content]`
40
- target.compressed = ref
41
- target.dedup = true
40
+ // Never expand: a tiny duplicate can be shorter than the reference itself.
41
+ if (ref.length < target.text.length) {
42
+ target.compressed = ref
43
+ target.dedup = true
44
+ }
42
45
  } else {
43
46
  seen.set(key, target)
44
47
  }
package/lib/br-cache.js CHANGED
@@ -123,6 +123,10 @@ export function createBrCache({ cacheDir = defaultCacheDir(), maxBytes = DEFAULT
123
123
  }
124
124
 
125
125
  pruneInternal()
126
+ // If this entry alone exceeds maxBytes, pruneInternal() just evicted it.
127
+ // Don't claim persistence we can't honour — a phantom record would leave
128
+ // the caller with a brHash that get() can never resolve.
129
+ if (!existsSync(finalPath)) return null
126
130
  return { hash, storedBytes: byteLen, brotliBytes }
127
131
  }
128
132
 
@@ -144,9 +144,11 @@ export async function compressFile(filePath, options = {}) {
144
144
  }
145
145
  }
146
146
 
147
- // Create backup
147
+ // Create backup. Never clobber an existing backup — it holds the pristine
148
+ // original from a prior run, and overwriting it with already-compressed
149
+ // content would make the original unrecoverable.
148
150
  const backupPath = filePath + '.bak'
149
- if (!options.noBackup) {
151
+ if (!options.noBackup && !existsSync(backupPath)) {
150
152
  try {
151
153
  await copyFile(filePath, backupPath)
152
154
  } catch (error) {
@@ -34,7 +34,9 @@ export default {
34
34
  if (LEGACY_PROGRESS.test(line)) continue;
35
35
  // BuildKit "in-progress" duplicated step lines end with a fractional second
36
36
  // marker and are re-emitted as DONE later; strip the non-DONE variants.
37
- if (/^#\d+\s+\S.*\s\d+\.\d+s$/.test(line) && !/\sDONE\b/.test(line)) continue;
37
+ // Never strip a line carrying error/warning/failure context — a RUN step's
38
+ // stdout can legitimately end in a duration (e.g. "build failed in 2.3s").
39
+ if (/^#\d+\s+\S.*\s\d+\.\d+s$/.test(line) && !/\sDONE\b/.test(line) && !/\b(error|warning|fail)/i.test(line)) continue;
38
40
  out.push(line);
39
41
  }
40
42
 
@@ -6,7 +6,9 @@
6
6
  // the Tests/Suites/Time/Snapshots summary and any stack traces.
7
7
 
8
8
  const PASS_LINE = /^\s*PASS\s+\S+/;
9
- const FAIL_LINE = /^\s*FAIL\s+\S+/;
9
+ // `m` flag is required: the all-pass gate scans the whole multi-line output,
10
+ // and a FAIL line is rarely the first line (jest interleaves PASS suites).
11
+ const FAIL_LINE = /^\s*FAIL\s+\S+/m;
10
12
  const JEST_SIG = /(^|\n)(PASS\s+\S+|FAIL\s+\S+|Tests:\s+.*\d+\s+(passed|failed|total)|Test Suites:\s+\d)/;
11
13
 
12
14
  export default {
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "sidecar/server.py",
15
15
  "sidecar/requirements.txt"
16
16
  ],
17
- "version": "0.8.3",
17
+ "version": "0.8.4",
18
18
  "description": "Token compression proxy for coding agents. Works with Claude Code, Aider, Cursor, Cline, Windsurf. 60-70% combined input+output savings with Caveman-integrated presets and per-command rewriters.",
19
19
  "type": "module",
20
20
  "main": "index.js",