tokensafe 4.4.2 → 4.4.3

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.4.2",
2
+ "version": "4.4.3",
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.4.2",
3
+ "version": "4.4.3",
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": "MIT",
package/mcp_config.json CHANGED
@@ -6,6 +6,13 @@
6
6
  "-c",
7
7
  "exec \"${TOKENSAFE_PYTHON:-python3}\" \"$PLUGIN_ROOT/src/mcp_server.py\""
8
8
  ]
9
+ },
10
+ "tokensafe-mcp": {
11
+ "command": "npx",
12
+ "args": [
13
+ "-y",
14
+ "tokensafe-mcp"
15
+ ]
9
16
  }
10
17
  }
11
18
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tokensafe",
3
3
  "mcpName": "dev.tokensafe/tokensafe",
4
- "version": "4.4.2",
4
+ "version": "4.4.3",
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.4.2",
4
+ "version": "4.4.3",
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
  "logo": "assets/logo.png",
7
7
  "developerName": "TokenSafe",
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.4.2",
6
+ "version": "4.4.3",
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.4.2",
26
+ "version": "4.4.3",
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.4.2",
42
+ "version": "4.4.3",
43
43
  "runtimeHint": "uvx",
44
44
  "transport": {
45
45
  "type": "stdio"
package/src/installer.py CHANGED
@@ -1241,6 +1241,10 @@ WantedBy=default.target
1241
1241
  "command": PYTHON_BIN,
1242
1242
  "args": [MCP_SERVER_PATH]
1243
1243
  }
1244
+ data["mcpServers"]["tokensafe-mcp"] = {
1245
+ "command": "npx",
1246
+ "args": ["-y", "tokensafe-mcp"]
1247
+ }
1244
1248
 
1245
1249
  cls._atomic_write_json(config_file, data)
1246
1250
 
@@ -1282,6 +1286,10 @@ WantedBy=default.target
1282
1286
  "command": PYTHON_BIN,
1283
1287
  "args": [MCP_SERVER_PATH]
1284
1288
  }
1289
+ data["mcpServers"]["tokensafe-mcp"] = {
1290
+ "command": "npx",
1291
+ "args": ["-y", "tokensafe-mcp"]
1292
+ }
1285
1293
 
1286
1294
  cls._atomic_write_json(config_file, data)
1287
1295
 
@@ -1350,6 +1358,10 @@ WantedBy=default.target
1350
1358
  "command": PYTHON_BIN,
1351
1359
  "args": [MCP_SERVER_PATH]
1352
1360
  }
1361
+ data["mcpServers"]["tokensafe-mcp"] = {
1362
+ "command": "npx",
1363
+ "args": ["-y", "tokensafe-mcp"]
1364
+ }
1353
1365
  cls._atomic_write_json(config_file, data)
1354
1366
 
1355
1367
  if "agents_md_path" in info:
@@ -1374,6 +1386,12 @@ WantedBy=default.target
1374
1386
  "args": [MCP_SERVER_PATH],
1375
1387
  "tools": ["*"]
1376
1388
  }
1389
+ data["mcpServers"]["tokensafe-mcp"] = {
1390
+ "type": "stdio",
1391
+ "command": "npx",
1392
+ "args": ["-y", "tokensafe-mcp"],
1393
+ "tools": ["*"]
1394
+ }
1377
1395
  cls._atomic_write_json(config_file, data)
1378
1396
  return True, f"Configured MCP for GitHub Copilot in {config_file}"
1379
1397
 
@@ -1394,6 +1412,10 @@ WantedBy=default.target
1394
1412
  "command": PYTHON_BIN,
1395
1413
  "args": [MCP_SERVER_PATH]
1396
1414
  }
1415
+ data["mcp"]["servers"]["tokensafe-mcp"] = {
1416
+ "command": "npx",
1417
+ "args": ["-y", "tokensafe-mcp"]
1418
+ }
1397
1419
 
1398
1420
  cls._atomic_write_json(config_file, data)
1399
1421
 
@@ -1421,6 +1443,10 @@ WantedBy=default.target
1421
1443
  "command": PYTHON_BIN,
1422
1444
  "args": [MCP_SERVER_PATH]
1423
1445
  }
1446
+ data["mcpServers"]["tokensafe-mcp"] = {
1447
+ "command": "npx",
1448
+ "args": ["-y", "tokensafe-mcp"]
1449
+ }
1424
1450
  cls._atomic_write_json(mcp_file, data)
1425
1451
 
1426
1452
  managed_plugin_path = info.get("managed_plugin_path")
@@ -1518,8 +1544,14 @@ WantedBy=default.target
1518
1544
  if os.path.exists(config_file):
1519
1545
  data, err = cls._load_json_with_backup(config_file)
1520
1546
  if not err and data and isinstance(data.get("mcpServers"), dict):
1547
+ mutated = False
1521
1548
  if "tokensafe" in data["mcpServers"]:
1522
1549
  data["mcpServers"].pop("tokensafe")
1550
+ mutated = True
1551
+ if "tokensafe-mcp" in data["mcpServers"]:
1552
+ data["mcpServers"].pop("tokensafe-mcp")
1553
+ mutated = True
1554
+ if mutated:
1523
1555
  cls._atomic_write_json(config_file, data)
1524
1556
 
1525
1557
  cls._remove_path_safely(info.get("skills_path"))
@@ -1533,8 +1565,14 @@ WantedBy=default.target
1533
1565
  if os.path.exists(config_file):
1534
1566
  data, err = cls._load_json_with_backup(config_file)
1535
1567
  if not err and data and isinstance(data.get("mcpServers"), dict):
1568
+ mutated = False
1536
1569
  if "tokensafe" in data["mcpServers"]:
1537
1570
  data["mcpServers"].pop("tokensafe")
1571
+ mutated = True
1572
+ if "tokensafe-mcp" in data["mcpServers"]:
1573
+ data["mcpServers"].pop("tokensafe-mcp")
1574
+ mutated = True
1575
+ if mutated:
1538
1576
  cls._atomic_write_json(config_file, data)
1539
1577
 
1540
1578
  if "skills_path" in info:
@@ -1579,8 +1617,14 @@ WantedBy=default.target
1579
1617
  config_file = info["config_path"]
1580
1618
  data, err = cls._load_json_with_backup(config_file)
1581
1619
  if not err and data and isinstance(data.get("mcpServers"), dict):
1620
+ mutated = False
1582
1621
  if "tokensafe" in data["mcpServers"]:
1583
1622
  data["mcpServers"].pop("tokensafe")
1623
+ mutated = True
1624
+ if "tokensafe-mcp" in data["mcpServers"]:
1625
+ data["mcpServers"].pop("tokensafe-mcp")
1626
+ mutated = True
1627
+ if mutated:
1584
1628
  cls._atomic_write_json(config_file, data)
1585
1629
 
1586
1630
  if "agents_md_path" in info:
@@ -1596,8 +1640,14 @@ WantedBy=default.target
1596
1640
  if os.path.exists(config_file):
1597
1641
  data, err = cls._load_json_with_backup(config_file)
1598
1642
  if not err and data and isinstance(data.get("mcpServers"), dict):
1643
+ mutated = False
1599
1644
  if "tokensafe" in data["mcpServers"]:
1600
1645
  data["mcpServers"].pop("tokensafe")
1646
+ mutated = True
1647
+ if "tokensafe-mcp" in data["mcpServers"]:
1648
+ data["mcpServers"].pop("tokensafe-mcp")
1649
+ mutated = True
1650
+ if mutated:
1601
1651
  cls._atomic_write_json(config_file, data)
1602
1652
  return True, f"Removed MCP for GitHub Copilot in {config_file}"
1603
1653
 
@@ -1608,8 +1658,14 @@ WantedBy=default.target
1608
1658
  if not err and data:
1609
1659
  mcp = data.get("mcp")
1610
1660
  if isinstance(mcp, dict) and isinstance(mcp.get("servers"), dict):
1661
+ mutated = False
1611
1662
  if "tokensafe" in mcp["servers"]:
1612
1663
  mcp["servers"].pop("tokensafe")
1664
+ mutated = True
1665
+ if "tokensafe-mcp" in mcp["servers"]:
1666
+ mcp["servers"].pop("tokensafe-mcp")
1667
+ mutated = True
1668
+ if mutated:
1613
1669
  cls._atomic_write_json(config_file, data)
1614
1670
 
1615
1671
  if "skills_path" in info:
@@ -1628,8 +1684,14 @@ WantedBy=default.target
1628
1684
  if mcp_file and os.path.exists(mcp_file):
1629
1685
  data, err = cls._load_json_with_backup(mcp_file)
1630
1686
  if not err and data and isinstance(data.get("mcpServers"), dict):
1687
+ mutated = False
1631
1688
  if "tokensafe" in data["mcpServers"]:
1632
1689
  data["mcpServers"].pop("tokensafe")
1690
+ mutated = True
1691
+ if "tokensafe-mcp" in data["mcpServers"]:
1692
+ data["mcpServers"].pop("tokensafe-mcp")
1693
+ mutated = True
1694
+ if mutated:
1633
1695
  cls._atomic_write_json(mcp_file, data)
1634
1696
 
1635
1697
  managed_plugin_path = info.get("managed_plugin_path")
@@ -1878,6 +1940,10 @@ WantedBy=default.target
1878
1940
  "command": PYTHON_BIN,
1879
1941
  "args": [MCP_SERVER_PATH]
1880
1942
  }
1943
+ data["mcpServers"]["tokensafe-mcp"] = {
1944
+ "command": "npx",
1945
+ "args": ["-y", "tokensafe-mcp"]
1946
+ }
1881
1947
  cls._atomic_write_json(cursor_mcp, data)
1882
1948
  created.append(".cursor/mcp.json")
1883
1949
  except Exception:
@@ -2032,8 +2098,14 @@ WantedBy=default.target
2032
2098
  try:
2033
2099
  data, err = cls._load_json_with_backup(cursor_mcp)
2034
2100
  if not err and data and isinstance(data.get("mcpServers"), dict):
2101
+ mutated = False
2035
2102
  if "tokensafe" in data["mcpServers"]:
2036
2103
  data["mcpServers"].pop("tokensafe")
2104
+ mutated = True
2105
+ if "tokensafe-mcp" in data["mcpServers"]:
2106
+ data["mcpServers"].pop("tokensafe-mcp")
2107
+ mutated = True
2108
+ if mutated:
2037
2109
  if not data["mcpServers"] and list(data.keys()) == ["mcpServers"]:
2038
2110
  os.remove(cursor_mcp)
2039
2111
  else:
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": "4.4.2"
45
+ "version": "4.4.3"
46
46
  }
47
47
 
48
48
  # MCP client attribution: the initialize handshake carries clientInfo, which
@@ -241,7 +241,7 @@ class TelemetrySync:
241
241
  current_last_id = last_id
242
242
  headers = {
243
243
  "Content-Type": "application/json",
244
- "User-Agent": "TokenSafe-Sync/4.4.2"
244
+ "User-Agent": "TokenSafe-Sync/4.4.3"
245
245
  }
246
246
  if active_key:
247
247
  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.4.2"
20
+ CURRENT_VERSION = "4.4.3"
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