@alexgreensh/token-optimizer 5.13.68 → 5.13.69
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/module_runner.py +1 -1
- package/package.json +1 -1
- package/skills/fleet-auditor/references/fleet-systems.md +38 -0
- package/skills/fleet-auditor/scripts/fleet.py +63 -92
- package/skills/fleet-auditor/scripts/fleet_base.py +106 -0
- package/skills/fleet-auditor/scripts/fleet_cursor_adapter.py +376 -0
- package/skills/token-coach/SKILL.md +21 -23
- package/skills/token-dashboard/SKILL.md +5 -4
- package/skills/token-optimizer/SKILL.md +1 -1
- package/skills/token-optimizer/assets/dashboard.html +101 -50
- package/skills/token-optimizer/references/cli-reference.md +1 -1
- package/skills/token-optimizer/references/cursor-workflow.md +1 -1
- package/skills/token-optimizer/references/phase0-setup.md +1 -1
- package/skills/token-optimizer/references/presentation-workflow.md +1 -1
- package/skills/token-optimizer/scripts/_measure/__init__.py +1 -1
- package/skills/token-optimizer/scripts/_measure/cli.py +86 -0
- package/skills/token-optimizer/scripts/_measure/daemon.py +13 -25
- package/skills/token-optimizer/scripts/_measure/dashboard.py +63 -37
- package/skills/token-optimizer/scripts/_measure/dashboard_history.py +79 -0
- package/skills/token-optimizer/scripts/_measure/lifecycle.py +6 -7
- package/skills/token-optimizer/scripts/_measure/savings.py +20 -70
- package/skills/token-optimizer/scripts/_measure/sessions.py +58 -20
- package/skills/token-optimizer/scripts/_measure/weekly_activity.py +69 -0
- package/skills/token-optimizer/scripts/antigravity_install.py +4 -0
- package/skills/token-optimizer/scripts/bash_compress.py +8 -40
- package/skills/token-optimizer/scripts/bash_compress_hook.py +6 -0
- package/skills/token-optimizer/scripts/bash_search_results.py +43 -0
- package/skills/token-optimizer/scripts/cloud_kit.py +1 -1
- package/skills/token-optimizer/scripts/codex_doctor.py +1 -1
- package/skills/token-optimizer/scripts/copilot_install.py +4 -0
- package/skills/token-optimizer/scripts/credential_patterns.py +4 -19
- package/skills/token-optimizer/scripts/credential_url_patterns.py +42 -0
- package/skills/token-optimizer/scripts/cursor_audit.py +723 -0
- package/skills/token-optimizer/scripts/cursor_bridge_checkpoint.py +213 -0
- package/skills/token-optimizer/scripts/cursor_bridge_payload.py +170 -0
- package/skills/token-optimizer/scripts/cursor_bridge_rewrite.py +106 -0
- package/skills/token-optimizer/scripts/cursor_bridge_rollup.py +115 -0
- package/skills/token-optimizer/scripts/cursor_coach.py +485 -0
- package/skills/token-optimizer/scripts/cursor_doctor.py +89 -9
- package/skills/token-optimizer/scripts/cursor_hook_bridge.py +393 -276
- package/skills/token-optimizer/scripts/cursor_install.py +106 -19
- package/skills/token-optimizer/scripts/cursor_quality.py +505 -0
- package/skills/token-optimizer/scripts/cursor_read_cache.py +597 -0
- package/skills/token-optimizer/scripts/cursor_session.py +26 -5
- package/skills/token-optimizer/scripts/cursor_state.py +8 -0
- package/skills/token-optimizer/scripts/cursor_statusline.py +372 -0
- package/skills/token-optimizer/scripts/cursor_thrash.py +78 -0
- package/skills/token-optimizer/scripts/cursor_transcript.py +223 -0
- package/skills/token-optimizer/scripts/devin_source.py +12 -2
- package/skills/token-optimizer/scripts/devin_verify.py +7 -6
- package/skills/token-optimizer/scripts/grok_install.py +4 -0
- package/skills/token-optimizer/scripts/hermes_doctor.py +4 -1
- package/skills/token-optimizer/scripts/hermes_install.py +4 -1
- package/skills/token-optimizer/scripts/measure.py +2 -2
- package/skills/token-optimizer/scripts/thrash_guard.py +10 -5
|
@@ -9,7 +9,8 @@ import stat
|
|
|
9
9
|
import sys
|
|
10
10
|
|
|
11
11
|
PAYLOAD = ('devin_compress.py', 'devin_state.py', 'devin_doctor.py', 'devin_verify.py', 'devin_source.py',
|
|
12
|
-
'bash_compress.py', 'bash_whitelist.py', 'credential_patterns.py',
|
|
12
|
+
'bash_compress.py', 'bash_search_results.py', 'bash_whitelist.py', 'credential_patterns.py',
|
|
13
|
+
'credential_url_patterns.py',
|
|
13
14
|
'token_estimate.py', 'command_filters.py', 'runtime_env.py', 'py_trust.py', 'plugin_env.py', 'refetch_fingerprint.py',
|
|
14
15
|
'_tomli.py', 'devin_hooks.py')
|
|
15
16
|
ALLOWED_MODULES = frozenset(Path(name).stem for name in PAYLOAD)
|
|
@@ -19,7 +20,7 @@ REPO_MODULES = frozenset((
|
|
|
19
20
|
'_measure', '_tomli',
|
|
20
21
|
'activity_tracker', 'adapter_hook_command', 'antigravity_doctor', 'antigravity_hook_bridge', 'antigravity_install',
|
|
21
22
|
'antigravity_proto', 'antigravity_session', 'antigravity_state', 'archive_result',
|
|
22
|
-
'bash_compress', 'bash_compress_hook', 'bash_hook', 'bash_whitelist', 'benchmark', 'cloud_kit',
|
|
23
|
+
'bash_compress', 'bash_search_results', 'bash_compress_hook', 'bash_hook', 'bash_whitelist', 'benchmark', 'cloud_kit',
|
|
23
24
|
'build_output_compress', 'codex_command_compress', 'codex_compact_prompt', 'codex_doctor',
|
|
24
25
|
'codex_hook_bridge', 'codex_hook_provenance', 'codex_install', 'codex_io', 'codex_log_index', 'codex_models',
|
|
25
26
|
'codex_session', 'codex_state', 'codex_statusline', 'command_filters',
|
|
@@ -37,6 +38,15 @@ REPO_MODULES = frozenset((
|
|
|
37
38
|
'read_cache', 'recovery_output', 'refetch_fingerprint', 'refetch_guard', 'routing_advisor',
|
|
38
39
|
'reset_epoch', 'runtime_env', 'session_activity', 'session_store', 'spawn_utils', 'structure_map', 'structure_map_ts',
|
|
39
40
|
'structure_replay', 'thrash_guard', 'token_estimate', 'tool_search_diagnostic', 'utf8_io', 'archive_window', 'checkpoint_state',
|
|
41
|
+
'cursor_audit',
|
|
42
|
+
'cursor_coach',
|
|
43
|
+
'cursor_bridge_checkpoint', 'cursor_bridge_payload', 'cursor_bridge_rewrite', 'cursor_bridge_rollup',
|
|
44
|
+
'credential_url_patterns',
|
|
45
|
+
'cursor_quality',
|
|
46
|
+
'cursor_read_cache',
|
|
47
|
+
'cursor_statusline',
|
|
48
|
+
'cursor_thrash',
|
|
49
|
+
'cursor_transcript',
|
|
40
50
|
))
|
|
41
51
|
|
|
42
52
|
class SourceOnly(importlib.abc.MetaPathFinder, importlib.abc.Loader):
|
|
@@ -71,13 +71,14 @@ def payload_key_shapes(plugin, names, skill_md):
|
|
|
71
71
|
"""Recorded-key sets for every payload shape an install record may carry.
|
|
72
72
|
|
|
73
73
|
Returns ``(expected, shapes)``: the current payload's path set plus the
|
|
74
|
-
sorted key lists
|
|
75
|
-
Earlier releases shipped fewer payload files: 5.13.43 had no hook module,
|
|
76
|
-
releases before it also lacked the two plugin-env modules, and every
|
|
77
|
-
existing record predates the _tomli.py payload module shipped now.
|
|
74
|
+
sorted key lists for both independent module additions and older releases.
|
|
78
75
|
"""
|
|
79
76
|
expected={str(plugin/name) for name in names}|{str(skill_md)}
|
|
80
77
|
tomli=str(plugin/'_tomli.py')
|
|
81
|
-
|
|
78
|
+
search=str(plugin/'bash_search_results.py')
|
|
79
|
+
urls=str(plugin/'credential_url_patterns.py')
|
|
80
|
+
variants=(expected,expected-{search},expected-{urls},expected-{search,urls})
|
|
81
|
+
before_both=expected-{search,urls}
|
|
82
|
+
previous=before_both-{str(plugin/'devin_hooks.py'),tomli}
|
|
82
83
|
legacy=previous-{str(plugin/name) for name in ('plugin_env.py','refetch_fingerprint.py')}
|
|
83
|
-
return expected,tuple(sorted(keys) for keys in (
|
|
84
|
+
return expected,tuple(sorted(keys) for keys in (*variants,before_both-{tomli},previous,legacy))
|
|
@@ -56,6 +56,7 @@ _PAYLOAD_MODULES = (
|
|
|
56
56
|
"grok_session.py",
|
|
57
57
|
"bash_hook.py",
|
|
58
58
|
"bash_compress.py",
|
|
59
|
+
"bash_search_results.py",
|
|
59
60
|
# Dependency-free whitelist gate shared by bash_hook + bash_compress.
|
|
60
61
|
# Without it, `import bash_hook` fails in the installed path, the bridge
|
|
61
62
|
# sets _bash_hook = None, and the entire PreToolUse bash compression
|
|
@@ -84,6 +85,9 @@ _PAYLOAD_MODULES = (
|
|
|
84
85
|
# credential_patterns: bash_compress's credential-preservation patterns
|
|
85
86
|
# (the inline fallback misses e.g. ghp_/github_pat_ tokens, #171).
|
|
86
87
|
"credential_patterns.py",
|
|
88
|
+
# credential_patterns imports this at module import time (URL family split
|
|
89
|
+
# under the 1,000-line ratchet); missing = import failure in the payload.
|
|
90
|
+
"credential_url_patterns.py",
|
|
87
91
|
)
|
|
88
92
|
|
|
89
93
|
# One-line locator written next to the bridge, naming the canonical measure.py
|
|
@@ -80,6 +80,9 @@ REQUIRED_ENGINE_SCRIPTS = (
|
|
|
80
80
|
"read_cache.py",
|
|
81
81
|
"refetch_guard.py",
|
|
82
82
|
"credential_patterns.py",
|
|
83
|
+
# credential_patterns imports this at module import time (URL family split
|
|
84
|
+
# under the 1,000-line ratchet); missing = import failure in the payload.
|
|
85
|
+
"credential_url_patterns.py",
|
|
83
86
|
)
|
|
84
87
|
|
|
85
88
|
# Copied into the plugin dir by hermes_install; a copy older than the checkout
|
|
@@ -351,7 +354,7 @@ _MEASURE_PACKAGE_FILES = (
|
|
|
351
354
|
"_measure/pricing.py", "_measure/audit.py", "_measure/dashboard.py",
|
|
352
355
|
"_measure/lifecycle.py", "_measure/sessions.py", "_measure/trends.py",
|
|
353
356
|
"_measure/cache_policy.py", "_measure/daemon.py", "_measure/quality_archive.py",
|
|
354
|
-
"_measure/continuity.py", "_measure/savings.py", "_measure/cli.py",
|
|
357
|
+
"_measure/continuity.py", "_measure/savings.py", "_measure/cli.py", "_measure/dashboard_history.py", "_measure/weekly_activity.py",
|
|
355
358
|
)
|
|
356
359
|
|
|
357
360
|
|
|
@@ -73,6 +73,9 @@ _ENGINE_SCRIPTS = (
|
|
|
73
73
|
"read_cache.py",
|
|
74
74
|
"refetch_guard.py",
|
|
75
75
|
"credential_patterns.py",
|
|
76
|
+
# credential_patterns imports this at module import time (URL family split
|
|
77
|
+
# under the 1,000-line ratchet); missing = import failure in the payload.
|
|
78
|
+
"credential_url_patterns.py",
|
|
76
79
|
)
|
|
77
80
|
|
|
78
81
|
# Plain-text locator file written into the plugin dir: one line, the absolute
|
|
@@ -96,7 +99,7 @@ _MEASURE_PACKAGE_FILES = (
|
|
|
96
99
|
"_measure/pricing.py", "_measure/audit.py", "_measure/dashboard.py",
|
|
97
100
|
"_measure/lifecycle.py", "_measure/sessions.py", "_measure/trends.py",
|
|
98
101
|
"_measure/cache_policy.py", "_measure/daemon.py", "_measure/quality_archive.py",
|
|
99
|
-
"_measure/continuity.py", "_measure/savings.py", "_measure/cli.py",
|
|
102
|
+
"_measure/continuity.py", "_measure/savings.py", "_measure/cli.py", "_measure/dashboard_history.py", "_measure/weekly_activity.py",
|
|
100
103
|
)
|
|
101
104
|
|
|
102
105
|
|
|
@@ -1603,7 +1603,7 @@ _manage_mcp = _measure_compat.bind(_measure_providers['dashboard']._manage_mcp,
|
|
|
1603
1603
|
_codex_memory_review_data = _measure_compat.bind(_measure_providers['dashboard']._codex_memory_review_data, __name__)
|
|
1604
1604
|
|
|
1605
1605
|
|
|
1606
|
-
generate_standalone_dashboard = _measure_compat.bind(_measure_providers['dashboard'].generate_standalone_dashboard, __name__, defaults=(
|
|
1606
|
+
generate_standalone_dashboard = _measure_compat.bind(_measure_providers['dashboard'].generate_standalone_dashboard, __name__, defaults=(None, False, False,))
|
|
1607
1607
|
|
|
1608
1608
|
|
|
1609
1609
|
_acquire_session_end_flush_lock = _measure_compat.bind(_measure_providers['lifecycle']._acquire_session_end_flush_lock, __name__, defaults=(120,))
|
|
@@ -1648,7 +1648,7 @@ _inline_flush_budget_seconds = _measure_compat.bind(_measure_providers['lifecycl
|
|
|
1648
1648
|
_dispatch_collect = _measure_compat.bind(_measure_providers['lifecycle']._dispatch_collect, __name__)
|
|
1649
1649
|
|
|
1650
1650
|
|
|
1651
|
-
_spawn_detached_dashboard_selfheal = _measure_compat.bind(_measure_providers['lifecycle']._spawn_detached_dashboard_selfheal, __name__, defaults=(
|
|
1651
|
+
_spawn_detached_dashboard_selfheal = _measure_compat.bind(_measure_providers['lifecycle']._spawn_detached_dashboard_selfheal, __name__, defaults=(None, False,), kwdefaults={'hook_timeout': True})
|
|
1652
1652
|
|
|
1653
1653
|
|
|
1654
1654
|
# Thundering-herd guard for the version-bump dashboard self-heal. The marker is
|
|
@@ -244,7 +244,7 @@ _NUMERIC_ERROR_LINE_RE = re.compile(
|
|
|
244
244
|
)
|
|
245
245
|
|
|
246
246
|
|
|
247
|
-
def _text_has_failure(text: str) -> bool:
|
|
247
|
+
def _text_has_failure(text: str, anchored: bool = False) -> bool:
|
|
248
248
|
"""True when any line of ``text`` matches a failure pattern.
|
|
249
249
|
|
|
250
250
|
Per line, so a pattern can match anywhere in the line (gcc/clang
|
|
@@ -255,6 +255,8 @@ def _text_has_failure(text: str) -> bool:
|
|
|
255
255
|
for line in text.splitlines():
|
|
256
256
|
if _NUMERIC_ERROR_LINE_RE.match(line):
|
|
257
257
|
continue
|
|
258
|
+
if anchored and not re.match(r"^\s*(?:(?:error|fatal|traceback|failed|panic|fehler|erreur|errore)\b|[^\n]+:\d+(?::\d+)?:\s*(?:fatal\s+)?error\b)", line, re.IGNORECASE):
|
|
259
|
+
continue
|
|
258
260
|
for pat in _ERROR_STDERR_PATTERNS:
|
|
259
261
|
if pat.search(line):
|
|
260
262
|
return True
|
|
@@ -329,6 +331,7 @@ def _looks_like_failure(
|
|
|
329
331
|
stderr: str,
|
|
330
332
|
exit_code: int | None = None,
|
|
331
333
|
redirected: bool = False,
|
|
334
|
+
combined_output: bool = False,
|
|
332
335
|
) -> bool:
|
|
333
336
|
"""Decide whether a Bash run failed.
|
|
334
337
|
|
|
@@ -340,8 +343,8 @@ def _looks_like_failure(
|
|
|
340
343
|
When no exit code is available, fall back to text: stderr is always
|
|
341
344
|
scanned; stdout is scanned only when the command redirected stderr into
|
|
342
345
|
stdout (``2>&1``), because otherwise an error-looking line on stdout is
|
|
343
|
-
just data. Redirected stdout is scanned line by line
|
|
344
|
-
|
|
346
|
+
just data. Redirected stdout is scanned line by line; combined Cursor
|
|
347
|
+
output uses anchored matching. Numeric error metrics are excluded.
|
|
345
348
|
"""
|
|
346
349
|
if exit_code is not None:
|
|
347
350
|
return exit_code != 0
|
|
@@ -367,7 +370,7 @@ def _looks_like_failure(
|
|
|
367
370
|
from bash_compress import _ERROR_STDERR_PATTERNS
|
|
368
371
|
if stderr and _text_has_failure(stderr):
|
|
369
372
|
return True
|
|
370
|
-
if stdout and redirected and _text_has_failure(stdout):
|
|
373
|
+
if stdout and redirected and _text_has_failure(stdout, anchored=combined_output):
|
|
371
374
|
return True
|
|
372
375
|
except Exception:
|
|
373
376
|
pass
|
|
@@ -381,6 +384,7 @@ def check(
|
|
|
381
384
|
stderr: str = "",
|
|
382
385
|
exit_code: int | None = None,
|
|
383
386
|
store_id: str | None = None,
|
|
387
|
+
combined_output: bool = False,
|
|
384
388
|
):
|
|
385
389
|
"""Record this Bash run and return a nudge line when the streak warrants it.
|
|
386
390
|
|
|
@@ -441,7 +445,8 @@ def check(
|
|
|
441
445
|
now = time.time() if now is None else now
|
|
442
446
|
is_fail = _looks_like_failure(
|
|
443
447
|
output, stderr, exit_code=exit_code,
|
|
444
|
-
redirected="2>&1" in command,
|
|
448
|
+
redirected=combined_output or "2>&1" in command,
|
|
449
|
+
combined_output=combined_output,
|
|
445
450
|
)
|
|
446
451
|
body = _heredoc_body(command)
|
|
447
452
|
has_inline_script = body is not None and len(body) >= INLINE_SCRIPT_MIN_CHARS
|