transcript-viewer 0.8.0__tar.gz → 0.8.1__tar.gz

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.
Files changed (33) hide show
  1. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/PKG-INFO +1 -1
  2. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/pyproject.toml +1 -1
  3. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/src/transcript_viewer/cli.py +6 -1
  4. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/src/transcript_viewer/corpus.py +30 -0
  5. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/src/transcript_viewer/viewer.py +13 -2
  6. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_cli.py +5 -1
  7. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_corpus.py +33 -0
  8. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/uv.lock +1 -1
  9. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/.coverage +0 -0
  10. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/.github/workflows/publish.yml +0 -0
  11. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/.github/workflows/test.yml +0 -0
  12. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/.gitignore +0 -0
  13. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/README.md +0 -0
  14. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/src/transcript_viewer/__init__.py +0 -0
  15. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/src/transcript_viewer/ai.py +0 -0
  16. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/src/transcript_viewer/config.py +0 -0
  17. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/src/transcript_viewer/fetch.py +0 -0
  18. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/src/transcript_viewer/library.py +0 -0
  19. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/src/transcript_viewer/page.html +0 -0
  20. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/src/transcript_viewer/store.py +0 -0
  21. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/fixtures/big-command.json +0 -0
  22. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/page.test.js +0 -0
  23. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_ai.py +0 -0
  24. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_config.py +0 -0
  25. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_fetch.py +0 -0
  26. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_library.py +0 -0
  27. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_page.py +0 -0
  28. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_readme.py +0 -0
  29. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_store.py +0 -0
  30. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_stream.py +0 -0
  31. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_style.py +0 -0
  32. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_tidiness.py +0 -0
  33. {transcript_viewer-0.8.0 → transcript_viewer-0.8.1}/tests/test_viewer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: transcript-viewer
3
- Version: 0.8.0
3
+ Version: 0.8.1
4
4
  Summary: Browse agent transcripts in a local, dependency-free web viewer.
5
5
  License: MIT
6
6
  Requires-Python: >=3.12
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "transcript-viewer"
3
- version = "0.8.0"
3
+ version = "0.8.1"
4
4
  description = "Browse agent transcripts in a local, dependency-free web viewer."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -49,7 +49,12 @@ def cmd_view(args: argparse.Namespace) -> int:
49
49
  # An explicit path that holds nothing is a mistake worth reporting; an
50
50
  # empty library is not, so this only guards the argument.
51
51
  if not entries:
52
- print(f"transcript-viewer: nothing convertible in {path}", file=sys.stderr)
52
+ print(
53
+ f"transcript-viewer: no transcript in {path}. "
54
+ f"{corpus.describe_contents(path)}, and none of it is a log "
55
+ f"this can read.",
56
+ file=sys.stderr,
57
+ )
53
58
  return 1
54
59
  else:
55
60
  # Only what has been added deliberately. Scanning a machine because the
@@ -9,6 +9,7 @@ something actually asks for that trajectory.
9
9
  from __future__ import annotations
10
10
 
11
11
  import hashlib
12
+ from collections import Counter
12
13
  import re
13
14
  import json
14
15
  from dataclasses import asdict, dataclass
@@ -367,3 +368,32 @@ def load(path: Path | None = None) -> list[Entry]:
367
368
  except TypeError:
368
369
  continue
369
370
  return entries
371
+
372
+
373
+ def describe_contents(root: Path, limit: int = 4000) -> str:
374
+ """What is inside a path, said in a sentence.
375
+
376
+ Reached only when nothing in it converted. "Nothing convertible" on its own
377
+ invites the reader to doubt the tool rather than the file — one real archive
378
+ held 1,952 files and an audit that referenced a transcript which had not
379
+ been shipped with it, and the answer gave no way to tell that from a bug.
380
+ """
381
+ if root.is_file():
382
+ return f"{root.name} ({root.stat().st_size:,} bytes)"
383
+
384
+ kinds: Counter[str] = Counter()
385
+ total = 0
386
+ for item in root.rglob("*"):
387
+ if not item.is_file():
388
+ continue
389
+ total += 1
390
+ if total > limit:
391
+ break
392
+ kinds[item.suffix.lower() or "no extension"] += 1
393
+
394
+ if not total:
395
+ return "it is empty"
396
+
397
+ common = ", ".join(f"{n:,} {ext}" for ext, n in kinds.most_common(4))
398
+ more = "+" if total > limit else ""
399
+ return f"{total:,}{more} files inside — {common}"
@@ -27,6 +27,7 @@ from urllib.parse import parse_qs, unquote, urlparse
27
27
  from atif_make.atif import ContentPart, Trajectory
28
28
  from . import corpus
29
29
  from atif_make.container import is_container, open_container
30
+ from atif_make.detect import FORMATS
30
31
  from atif_make.convert import convert
31
32
  from transcript_viewer.corpus import Entry, scan
32
33
 
@@ -615,9 +616,19 @@ class _Handler(BaseHTTPRequestHandler):
615
616
  self._json({"error": str(exc)}, 400)
616
617
  return
617
618
  if not found:
618
- # Nothing usable in it — do not keep the copy around.
619
+ # Nothing usable in it — do not keep the copy around. Say what was
620
+ # in it on the way out: an answer of "nothing convertible" with
621
+ # nothing behind it reads as the tool failing rather than the file
622
+ # not holding what was hoped.
623
+ inside = corpus.describe_contents(target)
619
624
  shutil.rmtree(home, ignore_errors=True)
620
- self._json({"error": f"nothing convertible in {name}"}, 415)
625
+ self._json(
626
+ {
627
+ "error": f"No transcript in {name}. {inside}, and none of it "
628
+ f"is a log this can read ({', '.join(FORMATS)})."
629
+ },
630
+ 415,
631
+ )
621
632
  return
622
633
 
623
634
  with self.lock:
@@ -65,7 +65,11 @@ def test_a_path_with_nothing_convertible_reports_rather_than_serving(
65
65
  ):
66
66
  (tmp_path / "notes.txt").write_text("nothing here")
67
67
  assert cli.main([str(tmp_path)]) == 1
68
- assert "nothing convertible" in capsys.readouterr().err
68
+ said = capsys.readouterr().err
69
+ assert "no transcript" in said
70
+ # It must also say what it looked at: a bare refusal reads as the tool
71
+ # failing rather than the path not holding what was hoped for.
72
+ assert "1 file" in said and ".txt" in said
69
73
  assert not served
70
74
 
71
75
 
@@ -496,3 +496,36 @@ def test_pieces_unpacked_beside_a_download_are_used_as_they_are(tmp_path):
496
496
  entries = corpus.scan([tmp_path])
497
497
  assert len(entries) == 3
498
498
  assert all(str(beside) in e.path for e in entries)
499
+
500
+
501
+ def test_a_path_that_converts_to_nothing_still_says_what_was_in_it(tmp_path):
502
+ """"Nothing convertible" alone reads as the tool failing, not the file."""
503
+ (tmp_path / "a").mkdir()
504
+ (tmp_path / "a" / "notes.md").write_text("# hello")
505
+ (tmp_path / "a" / "data.json").write_text('{"not": "a transcript"}')
506
+ (tmp_path / "a" / "run.py").write_text("print(1)")
507
+
508
+ said = corpus.describe_contents(tmp_path)
509
+
510
+ assert "3 files" in said
511
+ for ext in (".md", ".json", ".py"):
512
+ assert ext in said, f"{ext} should be named"
513
+
514
+
515
+ def test_describing_a_single_file_names_it(tmp_path):
516
+ path = tmp_path / "one.jsonl"
517
+ path.write_text("{}\n")
518
+ said = corpus.describe_contents(path)
519
+ assert "one.jsonl" in said and "bytes" in said
520
+
521
+
522
+ def test_describing_an_empty_directory_says_so(tmp_path):
523
+ assert corpus.describe_contents(tmp_path) == "it is empty"
524
+
525
+
526
+ def test_describing_a_huge_tree_does_not_read_all_of_it(tmp_path):
527
+ """A 600 MB archive should not be walked twice to explain itself."""
528
+ for i in range(60):
529
+ (tmp_path / f"f{i}.bin").write_text("x")
530
+ said = corpus.describe_contents(tmp_path, limit=10)
531
+ assert "+" in said, "it should say the count is a floor, not a total"
@@ -388,7 +388,7 @@ wheels = [
388
388
 
389
389
  [[package]]
390
390
  name = "transcript-viewer"
391
- version = "0.8.0"
391
+ version = "0.8.1"
392
392
  source = { editable = "." }
393
393
  dependencies = [
394
394
  { name = "atif-make" },