@alexgreensh/token-optimizer 5.13.65 → 5.13.67
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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/hooks/hooks.json +0 -10
- package/hooks/module_runner.py +62 -13
- package/hooks/userpromptsubmit_runner.py +13 -1
- package/package.json +1 -1
- package/skills/token-optimizer/examples/hooks-starter.json +0 -10
- package/skills/token-optimizer/scripts/_measure/__init__.py +16 -0
- package/skills/token-optimizer/scripts/_measure/_compat.py +200 -0
- package/skills/token-optimizer/scripts/_measure/_vendor/README.md +9 -0
- package/skills/token-optimizer/scripts/_measure/_vendor/__init__.py +23 -0
- package/skills/token-optimizer/scripts/_measure/_vendor/tomli/LICENSE +21 -0
- package/skills/token-optimizer/scripts/_measure/_vendor/tomli/__init__.py +8 -0
- package/skills/token-optimizer/scripts/_measure/_vendor/tomli/_parser.py +770 -0
- package/skills/token-optimizer/scripts/_measure/_vendor/tomli/_re.py +112 -0
- package/skills/token-optimizer/scripts/_measure/_vendor/tomli/_types.py +10 -0
- package/skills/token-optimizer/scripts/_measure/_vendor/tomli/py.typed +1 -0
- package/skills/token-optimizer/scripts/_measure/audit.py +6949 -0
- package/skills/token-optimizer/scripts/_measure/cache_policy.py +7050 -0
- package/skills/token-optimizer/scripts/_measure/cli.py +2722 -0
- package/skills/token-optimizer/scripts/_measure/continuity.py +4630 -0
- package/skills/token-optimizer/scripts/_measure/daemon.py +6773 -0
- package/skills/token-optimizer/scripts/_measure/dashboard.py +4358 -0
- package/skills/token-optimizer/scripts/_measure/lifecycle.py +6145 -0
- package/skills/token-optimizer/scripts/_measure/pricing.py +2101 -0
- package/skills/token-optimizer/scripts/_measure/quality_archive.py +7138 -0
- package/skills/token-optimizer/scripts/_measure/runtime.py +1231 -0
- package/skills/token-optimizer/scripts/_measure/savings.py +7702 -0
- package/skills/token-optimizer/scripts/_measure/sessions.py +4784 -0
- package/skills/token-optimizer/scripts/_measure/trends.py +2432 -0
- package/skills/token-optimizer/scripts/antigravity_hook_bridge.py +11 -3
- package/skills/token-optimizer/scripts/bash_compress.py +3 -3
- package/skills/token-optimizer/scripts/bash_compress_hook.py +6 -7
- package/skills/token-optimizer/scripts/cloud_kit.py +7 -8
- package/skills/token-optimizer/scripts/codex_compact_prompt.py +2 -2
- package/skills/token-optimizer/scripts/codex_doctor.py +14 -0
- package/skills/token-optimizer/scripts/command_filters.py +630 -19
- package/skills/token-optimizer/scripts/devin_source.py +2 -1
- package/skills/token-optimizer/scripts/hermes_doctor.py +13 -0
- package/skills/token-optimizer/scripts/hermes_install.py +11 -0
- package/skills/token-optimizer/scripts/measure.py +2430 -60930
- package/skills/token-optimizer/scripts/read_cache.py +20 -21
- package/skills/token-optimizer/scripts/reset_epoch.py +177 -0
- package/skills/token-optimizer/scripts/session_store.py +11 -48
|
@@ -16,6 +16,7 @@ ALLOWED_MODULES = frozenset(Path(name).stem for name in PAYLOAD)
|
|
|
16
16
|
|
|
17
17
|
# Repo names outside the installed closure must never fall back to sys.path.
|
|
18
18
|
REPO_MODULES = frozenset((
|
|
19
|
+
'_measure',
|
|
19
20
|
'activity_tracker', 'adapter_hook_command', 'antigravity_doctor', 'antigravity_hook_bridge', 'antigravity_install',
|
|
20
21
|
'antigravity_proto', 'antigravity_session', 'antigravity_state', 'archive_result',
|
|
21
22
|
'bash_compress', 'bash_compress_hook', 'bash_hook', 'bash_whitelist', 'benchmark', 'cloud_kit',
|
|
@@ -33,7 +34,7 @@ REPO_MODULES = frozenset((
|
|
|
33
34
|
'hermes_state', 'hermes_tool_hooks', 'hook_io', 'hook_runtime', 'injection', 'install_reconcile', 'measure',
|
|
34
35
|
'outline', 'pipeline_analyzer', 'plugin_env', 'py_trust', 'quality_cache_gate',
|
|
35
36
|
'read_cache', 'recovery_output', 'refetch_fingerprint', 'refetch_guard', 'routing_advisor',
|
|
36
|
-
'runtime_env', 'session_activity', 'session_store', 'spawn_utils', 'structure_map', 'structure_map_ts',
|
|
37
|
+
'reset_epoch', 'runtime_env', 'session_activity', 'session_store', 'spawn_utils', 'structure_map', 'structure_map_ts',
|
|
37
38
|
'structure_replay', 'thrash_guard', 'token_estimate', 'tool_search_diagnostic', 'utf8_io', 'archive_window', 'checkpoint_state',
|
|
38
39
|
))
|
|
39
40
|
|
|
@@ -345,6 +345,16 @@ def _registration_checks() -> list[dict[str, str]]:
|
|
|
345
345
|
return checks
|
|
346
346
|
|
|
347
347
|
|
|
348
|
+
# Completeness is separate from the legacy healthy-output counts.
|
|
349
|
+
_MEASURE_PACKAGE_FILES = (
|
|
350
|
+
"_measure/__init__.py", "_measure/_compat.py", "_measure/runtime.py",
|
|
351
|
+
"_measure/pricing.py", "_measure/audit.py", "_measure/dashboard.py",
|
|
352
|
+
"_measure/lifecycle.py", "_measure/sessions.py", "_measure/trends.py",
|
|
353
|
+
"_measure/cache_policy.py", "_measure/daemon.py", "_measure/quality_archive.py",
|
|
354
|
+
"_measure/continuity.py", "_measure/savings.py", "_measure/cli.py",
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
|
|
348
358
|
def _engine_checks() -> list[dict[str, str]]:
|
|
349
359
|
"""The checkout the plugin points at must hold every engine script."""
|
|
350
360
|
plugin_dir = _plugin_install_dir(hermes_home())
|
|
@@ -355,6 +365,7 @@ def _engine_checks() -> list[dict[str, str]]:
|
|
|
355
365
|
return [_check("FAIL", "Engine scripts", f"cannot read {locator}; re-run: python3 hermes_install.py")]
|
|
356
366
|
sdir = measure_py.parent
|
|
357
367
|
missing = [name for name in REQUIRED_ENGINE_SCRIPTS if not (sdir / name).is_file()]
|
|
368
|
+
missing += [name for name in _MEASURE_PACKAGE_FILES if not (sdir / name).is_file()]
|
|
358
369
|
if missing:
|
|
359
370
|
return [_check("FAIL", "Engine scripts",
|
|
360
371
|
f"missing in {sdir}: {', '.join(missing)}; update the Token Optimizer checkout")]
|
|
@@ -645,6 +656,8 @@ def _dashboard_port_check() -> dict[str, str]:
|
|
|
645
656
|
def _skill_install_checks() -> list[dict[str, str]]:
|
|
646
657
|
root = _skill_root()
|
|
647
658
|
missing = [rel for rel in SKILL_INSTALL_FILES if not (root / rel).exists()]
|
|
659
|
+
missing += ['scripts/' + rel for rel in _MEASURE_PACKAGE_FILES
|
|
660
|
+
if not (root / 'scripts' / rel).is_file()]
|
|
648
661
|
if missing:
|
|
649
662
|
return [_check("FAIL", "Installed skill files", ", ".join(missing))]
|
|
650
663
|
return [
|
|
@@ -90,6 +90,16 @@ _CONFIG_FALLBACK = "config.yml"
|
|
|
90
90
|
_ENABLE_SNIPPET = "plugins:\n enabled:\n - token-optimizer\n"
|
|
91
91
|
|
|
92
92
|
|
|
93
|
+
# Completeness is separate from the legacy healthy-output counts.
|
|
94
|
+
_MEASURE_PACKAGE_FILES = (
|
|
95
|
+
"_measure/__init__.py", "_measure/_compat.py", "_measure/runtime.py",
|
|
96
|
+
"_measure/pricing.py", "_measure/audit.py", "_measure/dashboard.py",
|
|
97
|
+
"_measure/lifecycle.py", "_measure/sessions.py", "_measure/trends.py",
|
|
98
|
+
"_measure/cache_policy.py", "_measure/daemon.py", "_measure/quality_archive.py",
|
|
99
|
+
"_measure/continuity.py", "_measure/savings.py", "_measure/cli.py",
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
93
103
|
def _scripts_dir() -> Path:
|
|
94
104
|
"""Return the scripts/ dir that contains this installer and the runtime modules."""
|
|
95
105
|
return Path(__file__).resolve().parent
|
|
@@ -435,6 +445,7 @@ def install(
|
|
|
435
445
|
)
|
|
436
446
|
runtime_srcs.append(src)
|
|
437
447
|
missing_engines = [name for name in _ENGINE_SCRIPTS if not (scripts_dir / name).is_file()]
|
|
448
|
+
missing_engines += [name for name in _MEASURE_PACKAGE_FILES if not (scripts_dir / name).is_file()]
|
|
438
449
|
if missing_engines:
|
|
439
450
|
raise ValueError(
|
|
440
451
|
f"Token Optimizer engine scripts missing from {scripts_dir}: "
|