Initial import of NousResearch/hermes-agent
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
Docker / shell lint / Lint Dockerfile (hadolint) (push) Has been cancelled
Docker / shell lint / Lint docker/ shell scripts (shellcheck) (push) Has been cancelled
Docker Build and Publish / build-amd64 (push) Has been cancelled
Docker Build and Publish / build-arm64 (push) Has been cancelled
Lint (ruff + ty) / ruff + ty diff (push) Has been cancelled
Lint (ruff + ty) / ruff enforcement (blocking) (push) Has been cancelled
Lint (ruff + ty) / Windows footguns (blocking) (push) Has been cancelled
Nix Lockfile Fix / auto-fix-main (push) Has been cancelled
Nix Lockfile Fix / fix (push) Has been cancelled
Nix / nix (macos-latest) (push) Has been cancelled
Nix / nix (ubuntu-latest) (push) Has been cancelled
OSV-Scanner / Scan lockfiles (push) Has been cancelled
Build Skills Index / build-index (push) Has been cancelled
Tests / test (1) (push) Has been cancelled
Tests / test (2) (push) Has been cancelled
Tests / test (3) (push) Has been cancelled
Tests / test (4) (push) Has been cancelled
Tests / test (5) (push) Has been cancelled
Tests / test (6) (push) Has been cancelled
Tests / e2e (push) Has been cancelled
uv.lock check / uv lock --check (push) Has been cancelled
Docker Build and Publish / merge (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
Tests / save-durations (push) Has been cancelled

This commit is contained in:
红尘
2026-05-31 09:36:58 +08:00
commit d73ff9b0fb
4188 changed files with 1614916 additions and 0 deletions
@@ -0,0 +1,49 @@
"""Tests for defensive bracketed-paste wrapper stripping in the CLI."""
from cli import _strip_leaked_bracketed_paste_wrappers
class TestStripLeakedBracketedPasteWrappers:
def test_plain_text_unchanged(self):
text = "hello world"
assert _strip_leaked_bracketed_paste_wrappers(text) == text
def test_strips_canonical_escape_wrappers(self):
text = "\x1b[200~hello\x1b[201~"
assert _strip_leaked_bracketed_paste_wrappers(text) == "hello"
def test_strips_visible_caret_escape_wrappers(self):
text = "^[[200~hello^[[201~"
assert _strip_leaked_bracketed_paste_wrappers(text) == "hello"
def test_strips_degraded_bracket_only_wrappers(self):
text = "[200~hello[201~"
assert _strip_leaked_bracketed_paste_wrappers(text) == "hello"
def test_strips_degraded_bracket_only_wrappers_after_whitespace(self):
text = "prefix [200~hello[201~ suffix"
assert _strip_leaked_bracketed_paste_wrappers(text) == "prefix hello suffix"
def test_strips_wrapper_fragments_at_boundaries(self):
text = "00~hello world01~"
assert _strip_leaked_bracketed_paste_wrappers(text) == "hello world"
def test_strips_wrapper_fragments_after_whitespace(self):
text = "prefix 00~hello world01~ suffix"
assert _strip_leaked_bracketed_paste_wrappers(text) == "prefix hello world suffix"
def test_does_not_strip_non_wrapper_00_tilde_in_normal_text(self):
text = "build00~tag should stay"
assert _strip_leaked_bracketed_paste_wrappers(text) == text
def test_does_not_strip_non_wrapper_bracket_forms_in_normal_text(self):
text = "literal[200~tag and literal[201~tag should stay"
assert _strip_leaked_bracketed_paste_wrappers(text) == text
def test_preserves_multiline_content_while_stripping_wrappers(self):
text = "^[[200~line 1\nline 2\nline 3^[[201~"
assert _strip_leaked_bracketed_paste_wrappers(text) == "line 1\nline 2\nline 3"
def test_preserves_multiline_content_while_stripping_degraded_bracket_only_wrappers(self):
text = "[200~line 1\nline 2\nline 3[201~"
assert _strip_leaked_bracketed_paste_wrappers(text) == "line 1\nline 2\nline 3"