tokensafe 4.9.1 → 4.9.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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.9.1",
2
+ "version": "4.9.2",
3
3
  "name": "tokensafe",
4
4
  "description": "Your AI agent is smart enough to code all day. Now it actually can. Local runtime firewall & zero-loss context optimizer for AI coding agents.",
5
5
  "author": {
package/kimi.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokensafe",
3
- "version": "4.9.1",
3
+ "version": "4.9.2",
4
4
  "description": "Your AI agent is smart enough to code all day. Now it actually can. Local runtime firewall & zero-loss context optimizer for AI coding agents.",
5
5
  "homepage": "https://tokensafe.dev",
6
6
  "license": "Apache-2.0",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tokensafe",
3
3
  "mcpName": "dev.tokensafe/tokensafe",
4
- "version": "4.9.1",
4
+ "version": "4.9.2",
5
5
  "description": "Your AI agent is smart enough to code all day. Now it actually can. Local runtime firewall & zero-loss context optimizer for AI coding agents.",
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": "4.9.1",
4
+ "version": "4.9.2",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Your AI agent is smart enough to code all day. Now it actually can. Local runtime firewall & zero-loss context optimizer for AI coding agents.",
7
7
  "logo": "assets/logo.png",
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "dev.tokensafe/tokensafe",
4
4
  "title": "TokenSafe",
5
5
  "description": "Your AI agent is smart enough to code all day. Local firewall & zero-loss runtime.",
6
- "version": "4.9.1",
6
+ "version": "4.9.2",
7
7
  "websiteUrl": "https://tokensafe.dev",
8
8
  "repository": {
9
9
  "url": "https://github.com/tokensafe-dev/tokensafe",
@@ -23,7 +23,7 @@
23
23
  "registryType": "npm",
24
24
  "registryBaseUrl": "https://registry.npmjs.org",
25
25
  "identifier": "tokensafe",
26
- "version": "4.9.1",
26
+ "version": "4.9.2",
27
27
  "runtimeHint": "npx",
28
28
  "transport": {
29
29
  "type": "stdio"
@@ -39,7 +39,7 @@
39
39
  "registryType": "pypi",
40
40
  "registryBaseUrl": "https://pypi.org",
41
41
  "identifier": "tokensafe",
42
- "version": "4.9.1",
42
+ "version": "4.9.2",
43
43
  "runtimeHint": "uvx",
44
44
  "transport": {
45
45
  "type": "stdio"
@@ -1538,6 +1538,7 @@ def plan(workspace: str) -> Dict[str, Any]:
1538
1538
  provider = backend.get("provider")
1539
1539
  entry_id = {
1540
1540
  "fastapi": "backend/fastapi",
1541
+ "python": "backend/starlette",
1541
1542
  "go": "backend/go",
1542
1543
  "node": "backend/node",
1543
1544
  "elysia": "backend/elysia",
@@ -1547,13 +1548,16 @@ def plan(workspace: str) -> Dict[str, Any]:
1547
1548
  }.get(provider, "backend/go")
1548
1549
  entry = catalog.get(entry_id, {})
1549
1550
  install = entry.get("technology", {}).get("package", {}).get("install")
1550
- if provider == "fastapi":
1551
+ if provider == "fastapi" or (provider == "python" and backend.get("framework") in ("fastapi", "starlette")):
1551
1552
  actions.append({
1552
1553
  "kind": "python_autoload",
1553
1554
  "profile": "backend",
1554
- "framework": "fastapi",
1555
+ "framework": backend.get("framework", "fastapi"),
1555
1556
  "writes_repo": False,
1556
- "description": "sitecustomize patches uvicorn; mount_tokensafe(app) runs on import",
1557
+ "description": (
1558
+ "sitecustomize patches uvicorn; mount_tokensafe(app) runs on import and detects "
1559
+ "the ASGI host (FastAPI or plain Starlette)"
1560
+ ),
1557
1561
  "install": install or 'pip install "tokensafe-backend-python @ git+https://github.com/tokensafe-dev/tokensafe-backend.git#subdirectory=python"',
1558
1562
  "run": python_run_hint(workspace),
1559
1563
  })
@@ -1667,7 +1671,9 @@ def apply(workspace: str, dry_run: bool = False, include_go: bool = True) -> Dic
1667
1671
  results["actions"].append({"kind": "next_route_handler", **apply_next_patch(workspace, dry_run=dry_run)})
1668
1672
 
1669
1673
  backend = stack.get("backend") or {}
1670
- if backend.get("provider") == "fastapi":
1674
+ if backend.get("provider") == "fastapi" or (
1675
+ backend.get("provider") == "python" and backend.get("framework") in ("fastapi", "starlette")
1676
+ ):
1671
1677
  if dry_run:
1672
1678
  results["actions"].append({"kind": "python_autoload", "status": "would-write", "path": os.path.join(pyhooks_dir(), "sitecustomize.py")})
1673
1679
  else:
package/src/mcp_server.py CHANGED
@@ -45,7 +45,7 @@ from src.session_context import current_root, current_session_id
45
45
 
46
46
  SERVER_INFO = {
47
47
  "name": "tokensafe-mcp",
48
- "version": "4.9.1"
48
+ "version": "4.9.2"
49
49
  }
50
50
 
51
51
  # MCP client attribution: the initialize handshake carries clientInfo, which
@@ -311,7 +311,7 @@ class TelemetrySync:
311
311
  current_last_id = last_id
312
312
  headers = {
313
313
  "Content-Type": "application/json",
314
- "User-Agent": "TokenSafe-Sync/4.9.1"
314
+ "User-Agent": "TokenSafe-Sync/4.9.2"
315
315
  }
316
316
  if active_key:
317
317
  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 = "4.9.1"
20
+ CURRENT_VERSION = "4.9.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