token-tracker 0.4.3__tar.gz → 0.4.4__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 (48) hide show
  1. {token_tracker-0.4.3/src/token_tracker.egg-info → token_tracker-0.4.4}/PKG-INFO +1 -1
  2. {token_tracker-0.4.3 → token_tracker-0.4.4}/pyproject.toml +1 -1
  3. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/hooks.py +5 -2
  4. {token_tracker-0.4.3 → token_tracker-0.4.4/src/token_tracker.egg-info}/PKG-INFO +1 -1
  5. {token_tracker-0.4.3 → token_tracker-0.4.4}/tests/test_hooks.py +13 -0
  6. {token_tracker-0.4.3 → token_tracker-0.4.4}/LICENSE +0 -0
  7. {token_tracker-0.4.3 → token_tracker-0.4.4}/README.md +0 -0
  8. {token_tracker-0.4.3 → token_tracker-0.4.4}/setup.cfg +0 -0
  9. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/__init__.py +0 -0
  10. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/adapters/__init__.py +0 -0
  11. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/adapters/claude.py +0 -0
  12. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/adapters/codex.py +0 -0
  13. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/adapters/rate_limits.py +0 -0
  14. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/adapters/registry.py +0 -0
  15. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/adapters/types.py +0 -0
  16. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/adapters/util.py +0 -0
  17. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/analyzer/__init__.py +0 -0
  18. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/analyzer/aggregator.py +0 -0
  19. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/analyzer/blocks.py +0 -0
  20. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/analyzer/cost.py +0 -0
  21. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/cli.py +0 -0
  22. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/config.py +0 -0
  23. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/i18n.py +0 -0
  24. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/ui/__init__.py +0 -0
  25. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/ui/console.py +0 -0
  26. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/ui/format.py +0 -0
  27. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/ui/heatmap.py +0 -0
  28. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/ui/panels.py +0 -0
  29. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/ui/status.py +0 -0
  30. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/ui/tables.py +0 -0
  31. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/ui/theme.py +0 -0
  32. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/ui/themes.py +0 -0
  33. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker/wizard.py +0 -0
  34. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker.egg-info/SOURCES.txt +0 -0
  35. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker.egg-info/dependency_links.txt +0 -0
  36. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker.egg-info/entry_points.txt +0 -0
  37. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker.egg-info/requires.txt +0 -0
  38. {token_tracker-0.4.3 → token_tracker-0.4.4}/src/token_tracker.egg-info/top_level.txt +0 -0
  39. {token_tracker-0.4.3 → token_tracker-0.4.4}/tests/test_aggregator.py +0 -0
  40. {token_tracker-0.4.3 → token_tracker-0.4.4}/tests/test_blocks.py +0 -0
  41. {token_tracker-0.4.3 → token_tracker-0.4.4}/tests/test_cli.py +0 -0
  42. {token_tracker-0.4.3 → token_tracker-0.4.4}/tests/test_codex.py +0 -0
  43. {token_tracker-0.4.3 → token_tracker-0.4.4}/tests/test_cost.py +0 -0
  44. {token_tracker-0.4.3 → token_tracker-0.4.4}/tests/test_heatmap.py +0 -0
  45. {token_tracker-0.4.3 → token_tracker-0.4.4}/tests/test_status.py +0 -0
  46. {token_tracker-0.4.3 → token_tracker-0.4.4}/tests/test_tables.py +0 -0
  47. {token_tracker-0.4.3 → token_tracker-0.4.4}/tests/test_theme.py +0 -0
  48. {token_tracker-0.4.3 → token_tracker-0.4.4}/tests/test_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: token-tracker
3
- Version: 0.4.3
3
+ Version: 0.4.4
4
4
  Summary: Track token usage across local AI agents (Claude Code, Codex)
5
5
  Author-email: stormzhang <stormzhang.dev@gmail.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "token-tracker"
7
- version = "0.4.3"
7
+ version = "0.4.4"
8
8
  description = "Track token usage across local AI agents (Claude Code, Codex)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -690,7 +690,8 @@ _CODEX_STATUSLINE_REGEX = re.compile(
690
690
  r'\n*\[\[hooks\.Stop\]\]\s*'
691
691
  r'\[\[hooks\.Stop\.hooks\]\]\s*'
692
692
  r'type = "command"\s*'
693
- r'command = "[^"]*(?:codex-statusline|tt-statusline)[^"]*"\s*'
693
+ # command 兼容双引号 basic string(老用户已装)和单引号 literal string(修了 Windows 路径转义后的新装)
694
+ r'command = ["\'][^"\']*(?:codex-statusline|tt-statusline)[^"\']*["\']\s*'
694
695
  r'timeout = \d+\s*'
695
696
  )
696
697
 
@@ -712,7 +713,9 @@ def _install_codex_statusline(content: str, python: str) -> str:
712
713
  "\n\n[[hooks.Stop]]\n\n"
713
714
  "[[hooks.Stop.hooks]]\n"
714
715
  'type = "command"\n'
715
- f'command = "{cmd}"\n'
716
+ # 用 TOML literal string(单引号)包裹 command,避免 Windows 反斜杠路径被当转义符
717
+ # 解析失败(如 `C:\Users\...` 里的 `\U` 被识别为 unicode 转义起始)
718
+ f"command = '{cmd}'\n"
716
719
  "timeout = 10\n"
717
720
  )
718
721
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: token-tracker
3
- Version: 0.4.3
3
+ Version: 0.4.4
4
4
  Summary: Track token usage across local AI agents (Claude Code, Codex)
5
5
  Author-email: stormzhang <stormzhang.dev@gmail.com>
6
6
  License: MIT License
@@ -80,6 +80,19 @@ def test_codex_statusline_install_uninstall_roundtrip(tmp_path, monkeypatch):
80
80
  assert "tt-statusline" not in removed and 'command = "mine"' in removed
81
81
 
82
82
 
83
+ def test_codex_statusline_windows_path_toml_parses(tmp_path, monkeypatch):
84
+ # 回归:Windows 路径含 \U \A \P 等被 TOML basic string 当 unicode 转义起始符(issue 用户反馈)
85
+ # —— 写入的 command 必须用 literal string(单引号)包裹,写出来后能被 tomllib 原样解析回来。
86
+ import tomllib
87
+ monkeypatch.setattr(hooks, "CODEX_STATUSLINE_HOOK_PATH",
88
+ r"C:\Users\test\.config\token-tracker\codex-statusline.py")
89
+ py = r"C:\Users\test\AppData\Local\Programs\Python\Python313\python.exe"
90
+ content = hooks._install_codex_statusline("", py)
91
+ parsed = tomllib.loads(content) # 旧 bug:basic string 下 \U 等触发 TOML 解析错误
92
+ assert parsed["hooks"]["Stop"][0]["hooks"][0]["command"] == \
93
+ rf"{py} C:\Users\test\.config\token-tracker\codex-statusline.py"
94
+
95
+
83
96
  def test_codex_statusline_version_roundtrip(tmp_path, monkeypatch):
84
97
  # _installed_codex_statusline_version 读回的版本应与写入的 STATUSLINE_HOOK_VERSION 一致,
85
98
  # 保证 needs_update 不会因解析偏差而误判。
File without changes
File without changes
File without changes