Commit graph

5 commits

Author SHA1 Message Date
Resham Joshi
c6f2073766
fix(bash): attribute wrapped commands to the real tool, not the wrapper (#658)
Some checks failed
CI / semgrep (push) Has been cancelled
extractBashCommands recorded the wrapper (sudo, npx, rtk, and friends)
instead of the command it delegates to, so any agent that prefixes its
shell calls collapsed its whole bash breakdown into one meaningless
bucket and the optimize detectors lost the actual tool.

Skip a known set of command wrappers when a real command follows, and
interleave that skip with the existing VAR=value env-assignment skip so
forms like 'sudo NODE_ENV=prod node x' resolve to the real tool. A
wrapper followed by a flag or a quoted token is kept as-is so we never
emit a garbage key.

Closes #657
2026-07-10 06:36:07 -07:00
AgentSeal
97c0869763 chore: hoist Pi model sort + cover bash-utils edge cases
- Move modelDisplayEntries sort to module scope so it runs once
  instead of on every modelDisplayName call.
- Add bash-utils tests for the env var prefix and true/false
  skip behaviors that came in with the Pi commit.

Verified Pi token semantics against real session data:
input + cacheRead + cacheWrite + output equals totalTokens
exactly, confirming Anthropic-style accounting (cached tokens
disjoint from input). No double-counting.
2026-04-16 02:02:32 -07:00
Rafael Calleja
a5696362f2 refactor: share BASH_TOOLS from classifier, remove comments
- Export BASH_TOOLS from classifier.ts instead of duplicating in bash-utils.ts
- Remove isBashTool helper (use BASH_TOOLS.has() directly)
- Strip unnecessary comments per codebase conventions
2026-04-14 10:24:38 +02:00
Rafael Calleja
45ce697eea fix: correct quote-handling alignment in extractBashCommands
Replace quoted strings with same-length spaces in stripQuotedStrings so
separator indices in the stripped string map correctly to the original.
Add test coverage for quoted separators and isBashTool.
2026-04-14 10:24:24 +02:00
Rafael Calleja
b75c2663b4 feat: add extractBashCommands with TDD tests
Implements bash command parsing utility that splits on &&, ;, and |
separators while respecting quoted strings. Includes isBashTool helper.
All 12 vitest tests pass.
2026-04-14 10:24:24 +02:00