tokensafe 3.1.1 → 3.1.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tokensafe",
3
3
  "mcpName": "dev.tokensafe/tokensafe",
4
- "version": "3.1.1",
4
+ "version": "3.1.2",
5
5
  "description": "Reduce your AI bills by up to 99% locally. Your agents read only needed code, keep prompt caches intact across turns, and keep secrets out of git.",
6
6
  "main": "bin/tokensafe.js",
7
7
  "bin": {
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tokensafe",
3
3
  "displayName": "TokenSafe",
4
- "version": "3.1.1",
4
+ "version": "3.1.2",
5
5
  "description": "Reduce your AI bills by up to 99% locally. Your agents read only needed code, keep prompt caches intact across turns, and keep secrets out of git.",
6
6
  "logo": "assets/logo.svg",
7
7
  "author": {
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "dev.tokensafe/tokensafe",
4
4
  "title": "TokenSafe",
5
5
  "description": "Reduce your AI bills by up to 99% locally: focused code, warm prompt caches & zero secret leaks.",
6
- "version": "3.1.1",
6
+ "version": "3.1.2",
7
7
  "websiteUrl": "https://tokensafe.dev",
8
8
  "repository": {
9
9
  "url": "https://github.com/tokensafe-dev/tokensafe",
@@ -30,7 +30,7 @@
30
30
  "registryType": "npm",
31
31
  "registryBaseUrl": "https://registry.npmjs.org",
32
32
  "identifier": "tokensafe",
33
- "version": "3.1.1",
33
+ "version": "3.1.2",
34
34
  "runtimeHint": "npx",
35
35
  "transport": {
36
36
  "type": "stdio"
@@ -46,7 +46,7 @@
46
46
  "registryType": "pypi",
47
47
  "registryBaseUrl": "https://pypi.org",
48
48
  "identifier": "tokensafe",
49
- "version": "3.1.1",
49
+ "version": "3.1.2",
50
50
  "runtimeHint": "uvx",
51
51
  "transport": {
52
52
  "type": "stdio"
@@ -134,10 +134,13 @@ class RealRepoBenchmark:
134
134
  def __init__(self, registry: Optional[Dict[str, Any]] = None):
135
135
  self.reg = registry or load_registry()
136
136
  self.pricing = self.reg.get("pricing", PUBLISHED_PIN)
137
+ # Clone destination; the QA sweep (bench_sweep.py) redirects this to its
138
+ # own cache dir without touching the published benchmark's cache.
139
+ self.repos_dir = REPOS_DIR
137
140
 
138
141
  # -- repo cache ------------------------------------------------------
139
142
  def ensure_repo(self, repo: Dict[str, Any]) -> str:
140
- dest = os.path.join(REPOS_DIR, repo["key"])
143
+ dest = os.path.join(self.repos_dir, repo["key"])
141
144
  depth = str(repo.get("clone_depth", 1))
142
145
  if os.path.isdir(os.path.join(dest, ".git")):
143
146
  subprocess.run(["git", "fetch", "--depth", depth, "origin"], cwd=dest,
@@ -145,7 +148,7 @@ class RealRepoBenchmark:
145
148
  subprocess.run(["git", "reset", "--hard", "-q", "origin/HEAD"], cwd=dest,
146
149
  capture_output=True, timeout=60)
147
150
  else:
148
- os.makedirs(REPOS_DIR, exist_ok=True)
151
+ os.makedirs(self.repos_dir, exist_ok=True)
149
152
  subprocess.run(["git", "clone", "--depth", depth, "-q", repo["url"], dest],
150
153
  capture_output=True, timeout=600, check=True)
151
154
  return dest
@@ -297,14 +300,33 @@ class RealRepoBenchmark:
297
300
  if importlib.util.find_spec("pytest") is None:
298
301
  return {"status": "skipped", "reason": "pytest not installed"}
299
302
  py = sys.executable
303
+ # Local mode runs the suite AS-IS (no injected regression, no deps venv).
304
+ targets = ["tests/"]
300
305
  py_args = [py, "-m", "pytest"]
301
- if any(d.startswith("pytest-asyncio") for d in pytest_cfg.get("deps", [])):
302
- # pytest-asyncio >=0.24 emits a deprecation warning that repos running
303
- # with filterwarnings=error (fastapi) escalate into INTERNALERROR.
304
- py_args += ["-o", "asyncio_default_fixture_loop_scope=function"]
306
+ # pytest-asyncio >=0.24 emits a deprecation warning that repos running
307
+ # with filterwarnings=error (fastapi) escalate into INTERNALERROR. The
308
+ # published path knows the deps from the registry; local mode infers
309
+ # asyncio usage from the repo's own pytest config and only applies the
310
+ # override when pytest-asyncio is importable in the chosen interpreter.
311
+ asyncio_hint = False
312
+ for cfg_name in ("pytest.ini", "pyproject.toml", "setup.cfg", "tox.ini"):
313
+ cfg_path = os.path.join(root, cfg_name)
314
+ if os.path.isfile(cfg_path):
315
+ try:
316
+ with open(cfg_path, "r", encoding="utf-8", errors="replace") as f:
317
+ if "asyncio" in f.read():
318
+ asyncio_hint = True
319
+ break
320
+ except Exception:
321
+ pass
322
+ if asyncio_hint:
323
+ probe = subprocess.run([py, "-c", "import pytest_asyncio"],
324
+ capture_output=True, timeout=30)
325
+ if probe.returncode == 0:
326
+ py_args += ["-o", "asyncio_default_fixture_loop_scope=function"]
305
327
  py_args += [*targets, "-q", "--tb=long", "--no-header", "-p", "no:cacheprovider"]
306
328
  try:
307
- proc = subprocess.run(py_args, cwd=repo_root, capture_output=True, text=True, timeout=300)
329
+ proc = subprocess.run(py_args, cwd=root, capture_output=True, text=True, timeout=300)
308
330
  except subprocess.TimeoutExpired:
309
331
  return {"status": "skipped", "reason": "pytest timeout 300s"}
310
332
  raw = (proc.stdout or "") + (proc.stderr or "")
package/src/mcp_server.py CHANGED
@@ -42,7 +42,7 @@ from src.paths import get_active_workspace, is_plugin_or_system_dir
42
42
 
43
43
  SERVER_INFO = {
44
44
  "name": "tokensafe-mcp",
45
- "version": "3.1.1"
45
+ "version": "3.1.2"
46
46
  }
47
47
 
48
48
  # MCP client attribution: the initialize handshake carries clientInfo, which
@@ -228,7 +228,7 @@ class TelemetrySync:
228
228
  current_last_id = last_id
229
229
  headers = {
230
230
  "Content-Type": "application/json",
231
- "User-Agent": "TokenSafe-Sync/3.1.1"
231
+ "User-Agent": "TokenSafe-Sync/3.1.2"
232
232
  }
233
233
  if active_key:
234
234
  headers["Authorization"] = f"Bearer {active_key}"
@@ -17,7 +17,7 @@ import urllib.request
17
17
  import urllib.error
18
18
  from typing import Dict, Any, Optional, Tuple
19
19
 
20
- CURRENT_VERSION = "3.1.1"
20
+ CURRENT_VERSION = "3.1.2"
21
21
  CACHE_TTL = 86400 # 24 hours
22
22
  # When the cloud is unreachable we must NOT cache the synthesized "up to date"
23
23
  # answer for a full day — otherwise an update released right after an outage