paperclip/packages/adapters
neerajdad123-byte 70c86d2c73
fix(hermes): strip ANSI escape codes from terminal output in UI parsers (#8731)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Hermes adapter produces terminal output with ANSI color codes on
stdout
> - These escape sequences flow through the UI parsers untouched and
render as raw garbage text
> - This PR adds ANSI stripping at the entry point of all four Hermes
parse-stdout entry points
   > - The same regex is already proven in claude-local adapter
   > - The benefit is clean, readable terminal output for Hermes agents

   ## Linked Issues or Issue Description

   No existing issue. This is a bug report:

   **What happened**

Hermes terminal output displayed ANSI color codes as raw text in the
Paperclip UI, making agent output unreadable.

   **Expected behavior**

Terminal output in run transcripts should be clean text without
invisible control characters.

   **Steps to reproduce**

   1. Connect a Hermes agent to Paperclip
   2. Create and assign a task to the agent
   3. View the run transcript — ANSI escape codes appear as raw garbage

   **Paperclip version or commit**

   e6407b322 (upstream master)

   **Deployment mode**

   local_trusted

   ## What Changed

- Added `stripAnsi()` function using the same regex pattern from
claude-local adapter (quota.ts) — strips CSI and
 OSC sequences
- Applied at entry point of `parseHermesStdoutLine` in hermes_local (TS
+ CJS)
- Applied at entry point of `parseHermesGatewayStdoutLine` in
hermes_gateway (TS + CJS)
- CJS files keep the function inline since the dynamic parser sandbox
has no module loader
   - 5 files changed, +123/-8 lines

   ## Verification

- Smoke tested with real ANSI patterns from Hermes output — all samples
pass
- `pnpm --filter @paperclipai/hermes-paperclip-adapter exec vitest run
src/ui/parse-stdout.test.ts` — 9 passed
- TypeScript compiles clean for both hermes and hermes-gateway packages
- Adapter tests pass (5/6, 1 pre-existing Windows CI failure unrelated)
- Live tested on running Paperclip instance — ANSI codes no longer
appear in transcripts

   ## Risks

Low risk. Only affects Hermes parser output. Regex already proven in
claude-local adapter. No logic changes to parse
 behavior — only strips invisible control characters before parsing.

   ## Model Used

   DeepSeek V4 Pro — reasoning mode, tool use

   ## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue
 in-PR following the relevant issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` /
 `github.com/paperclipai/paperclip` URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id
 or instance-derived details
   - [x] I have run tests locally and they pass
   - [x] I have added or updated tests where applicable
   - [ ] I have updated relevant documentation to reflect my changes
   - [x] I have considered and documented any risks above
   - [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
2026-07-06 12:07:55 -07:00
..
acpx-local Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
claude-local Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
codex-local feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
cursor-cloud build(deps): bump @cursor/sdk from 1.0.18 to 1.0.19 (#8462) 2026-06-23 10:14:12 -07:00
cursor-local Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
gemini-local Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
grok-local Normalize adapter display labels (#8913) 2026-07-02 21:32:50 -07:00
hermes fix(hermes): strip ANSI escape codes from terminal output in UI parsers (#8731) 2026-07-06 12:07:55 -07:00
hermes-gateway [codex] Add built-in Hermes adapters (#8543) 2026-06-26 16:04:58 -05:00
openclaw-gateway fix(openclaw-gateway): drop root paperclip params (#4416) 2026-06-23 16:32:15 -07:00
opencode-local Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
pi-local Improve live agent feedback during sandboxed runs (#8915) 2026-07-02 22:21:56 -07:00
AUTHORING.md PAPA-430: workspace finalize gates + no-remote-git enforcement (#6969) 2026-05-29 08:25:29 -07:00