@alexgreensh/token-optimizer 5.13.66 → 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/package.json +1 -1
- package/skills/token-optimizer/examples/hooks-starter.json +0 -10
- package/skills/token-optimizer/scripts/_measure/_compat.py +2 -2
- 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/cache_policy.py +54 -1
- package/skills/token-optimizer/scripts/_measure/lifecycle.py +198 -5
- 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/codex_compact_prompt.py +2 -2
- package/skills/token-optimizer/scripts/command_filters.py +630 -19
- package/skills/token-optimizer/scripts/devin_source.py +1 -1
- package/skills/token-optimizer/scripts/measure.py +2 -2
- 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
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"name": "token-optimizer",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"description": "Audit, fix, and monitor Claude Code context window usage. Find the ghost tokens.",
|
|
16
|
-
"version": "5.13.
|
|
16
|
+
"version": "5.13.67",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "Alex Greenshpun",
|
|
19
19
|
"url": "https://linkedin.com/in/alexgreensh"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"name": "token-optimizer-cowork",
|
|
56
56
|
"source": "./cowork/token-optimizer",
|
|
57
57
|
"description": "Token Optimizer for Claude Cowork \u2014 full skills + Cowork-native hooks (beta). Install THIS in Cowork; the standard token-optimizer entry is for desktop Claude Code.",
|
|
58
|
-
"version": "5.13.
|
|
58
|
+
"version": "5.13.67",
|
|
59
59
|
"author": {
|
|
60
60
|
"name": "Alex Greenshpun",
|
|
61
61
|
"url": "https://linkedin.com/in/alexgreensh"
|
package/hooks/hooks.json
CHANGED
|
@@ -14,16 +14,6 @@
|
|
|
14
14
|
}
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
|
-
{
|
|
18
|
-
"matcher": "Bash",
|
|
19
|
-
"hooks": [
|
|
20
|
-
{
|
|
21
|
-
"type": "command",
|
|
22
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" skills/token-optimizer/scripts/bash_hook.py --quiet; done; exit 0",
|
|
23
|
-
"timeout": 10
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
17
|
{
|
|
28
18
|
"matcher": "Agent|Task",
|
|
29
19
|
"hooks": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexgreensh/token-optimizer",
|
|
3
|
-
"version": "5.13.
|
|
3
|
+
"version": "5.13.67",
|
|
4
4
|
"description": "Token Optimizer for Claude Code cloud sessions: the real plugin, installed by your cloud environment's setup script.",
|
|
5
5
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
6
|
"author": "Alex Greenshpun (https://linkedin.com/in/alexgreensh)",
|
|
@@ -11,16 +11,6 @@
|
|
|
11
11
|
}
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
|
-
{
|
|
15
|
-
"matcher": "Bash",
|
|
16
|
-
"hooks": [
|
|
17
|
-
{
|
|
18
|
-
"type": "command",
|
|
19
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; L=\"${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh\"; [ -r \"$L\" ] || exit 0; exec \"$b\" \"$L\" \"${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py\" skills/token-optimizer/scripts/bash_hook.py --quiet; done; exit 0",
|
|
20
|
-
"timeout": 10
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
14
|
{
|
|
25
15
|
"matcher": "Agent|Task",
|
|
26
16
|
"hooks": [
|
|
@@ -27,7 +27,7 @@ def read_global(module, name):
|
|
|
27
27
|
try:
|
|
28
28
|
return builtins[name]
|
|
29
29
|
except KeyError:
|
|
30
|
-
raise NameError(f"name '{name}' is not defined", name
|
|
30
|
+
raise NameError(f"name '{name}' is not defined", **({'name': name} if sys.version_info >= (3, 10) else {})) from None
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
def prepare(module):
|
|
@@ -147,7 +147,7 @@ def _lookups(namespace, providers):
|
|
|
147
147
|
providers.load(binding.domain)
|
|
148
148
|
if name in namespace:
|
|
149
149
|
return namespace[name]
|
|
150
|
-
|
|
150
|
+
error = AttributeError(f"module {namespace.get('__name__')!r} has no attribute {name!r}"); error.name = name; raise error # name= is 3.10+
|
|
151
151
|
|
|
152
152
|
def __dir__():
|
|
153
153
|
return sorted(set(namespace) | set(providers.pending))
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Vendored TOML reader
|
|
2
|
+
|
|
3
|
+
`tomli/` is the unmodified pure-Python source from Tomli 2.2.1, licensed under MIT (see `tomli/LICENSE`). It supplies TOML 1.0 parsing on Python 3.9 and 3.10 without a pip dependency. Python 3.11+ continues to use its standard-library `tomllib`.
|
|
4
|
+
|
|
5
|
+
Source: https://pypi.org/project/tomli/2.2.1/
|
|
6
|
+
Archive: https://files.pythonhosted.org/packages/18/87/302344fed471e44a87289cf4967697d07e532f2421fdaf868a303cbae4ff/tomli-2.2.1.tar.gz
|
|
7
|
+
Archive SHA256: `cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff`
|
|
8
|
+
|
|
9
|
+
The source files and `py.typed` are copied from `src/tomli/`; `LICENSE` is copied from the archive root. Keep these files unchanged when updating. The package stays below `_measure` so the existing installed-source refusal boundary covers it too. It is not an extraction provider or public API.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Private, license-preserving runtime dependencies; no runtime installation."""
|
|
2
|
+
import importlib.util as _util
|
|
3
|
+
import sys as _sys
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def _lazy(name):
|
|
7
|
+
"""Return module ``name`` with its code deferred to first attribute access."""
|
|
8
|
+
module = _sys.modules.get(name)
|
|
9
|
+
if module is not None:
|
|
10
|
+
return module
|
|
11
|
+
spec = _util.find_spec(name)
|
|
12
|
+
spec.loader = _util.LazyLoader(spec.loader)
|
|
13
|
+
module = _util.module_from_spec(spec)
|
|
14
|
+
_sys.modules[name] = module
|
|
15
|
+
spec.loader.exec_module(module)
|
|
16
|
+
return module
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# The Python 3.9/3.10 ``tomllib`` fallback. Importers bind it at module load
|
|
20
|
+
# (``from _measure._vendor import tomli as tomllib``), but Tomli itself, with
|
|
21
|
+
# its imports and regex compiles, runs only when a caller first parses TOML,
|
|
22
|
+
# so hooks that never read TOML pay nothing for it.
|
|
23
|
+
tomli = _lazy(__name__ + ".tomli")
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Taneli Hukkinen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
|
|
3
|
+
# Licensed to PSF under a Contributor Agreement.
|
|
4
|
+
|
|
5
|
+
__all__ = ("loads", "load", "TOMLDecodeError")
|
|
6
|
+
__version__ = "2.2.1" # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT
|
|
7
|
+
|
|
8
|
+
from ._parser import TOMLDecodeError, load, loads
|