@alexgreensh/token-optimizer 5.13.50 → 5.13.51
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 +16 -16
- package/hooks/module_runner.py +303 -4
- package/hooks/run.py +16 -4
- package/package.json +1 -1
- package/skills/fleet-auditor/SKILL.md +13 -14
- package/skills/fleet-auditor/scripts/fleet.py +22 -1
- package/skills/token-coach/SKILL.md +12 -0
- package/skills/token-dashboard/SKILL.md +27 -6
- package/skills/token-optimizer/scripts/antigravity_install.py +3 -0
- package/skills/token-optimizer/scripts/cloud_kit.py +26 -6
- package/skills/token-optimizer/scripts/copilot_install.py +11 -0
- package/skills/token-optimizer/scripts/cursor_install.py +3 -0
- package/skills/token-optimizer/scripts/grok_install.py +3 -0
- package/skills/token-optimizer/scripts/hook_runtime.py +4 -1
- package/skills/token-optimizer/scripts/measure.py +910 -118
- package/skills/token-optimizer/scripts/runtime_env.py +30 -0
|
@@ -1262,6 +1262,26 @@ def _antigravity_signal() -> bool:
|
|
|
1262
1262
|
return _ancestor_in_process_tree(_AGY_BASENAMES)
|
|
1263
1263
|
|
|
1264
1264
|
|
|
1265
|
+
def _codex_plugin_env_signal() -> bool:
|
|
1266
|
+
"""True when CLAUDE_PLUGIN_ROOT / CLAUDE_PLUGIN_DATA point inside Codex's
|
|
1267
|
+
plugins dir (``<codex home>/plugins/``): a hook Codex loaded from the
|
|
1268
|
+
plugin's hooks.json. Never raises."""
|
|
1269
|
+
try:
|
|
1270
|
+
base = (codex_home() / "plugins").resolve(strict=False)
|
|
1271
|
+
for var in _CLAUDE_PLUGIN_ENVS:
|
|
1272
|
+
raw = os.environ.get(var, "").strip()
|
|
1273
|
+
if not raw:
|
|
1274
|
+
continue
|
|
1275
|
+
try:
|
|
1276
|
+
Path(raw).expanduser().resolve(strict=False).relative_to(base)
|
|
1277
|
+
return True
|
|
1278
|
+
except (ValueError, OSError, RuntimeError):
|
|
1279
|
+
continue
|
|
1280
|
+
except Exception:
|
|
1281
|
+
return False
|
|
1282
|
+
return False
|
|
1283
|
+
|
|
1284
|
+
|
|
1265
1285
|
@functools.lru_cache(maxsize=None)
|
|
1266
1286
|
def detect_runtime() -> str:
|
|
1267
1287
|
"""Return the active runtime name.
|
|
@@ -1325,6 +1345,16 @@ def detect_runtime() -> str:
|
|
|
1325
1345
|
if _opencode_process_signal():
|
|
1326
1346
|
return _RUNTIME_OPENCODE
|
|
1327
1347
|
|
|
1348
|
+
# Codex loads the plugin's own hooks/hooks.json and hands each hook ONLY
|
|
1349
|
+
# CLAUDE_PLUGIN_ROOT / CLAUDE_PLUGIN_DATA (no CODEX_HOME, no override;
|
|
1350
|
+
# verified live, see tests/test_codex_sessionstart_json_contract.py). Both
|
|
1351
|
+
# point inside Codex's plugins dir, which no Claude Code plugin uses, so
|
|
1352
|
+
# they name Codex before the Claude plugin-env tier below claims them.
|
|
1353
|
+
# Without this, a Codex session wrote its state into ~/.claude and pointed
|
|
1354
|
+
# Claude Code's statusLine at the Codex plugin cache.
|
|
1355
|
+
if _codex_plugin_env_signal():
|
|
1356
|
+
return _RUNTIME_CODEX
|
|
1357
|
+
|
|
1328
1358
|
if any(os.environ.get(env_var) for env_var in _CLAUDE_PLUGIN_ENVS):
|
|
1329
1359
|
return _RUNTIME_CLAUDE
|
|
1330
1360
|
|