tokensafe 4.7.1 → 4.7.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.7.1",
2
+ "version": "4.7.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.7.1",
3
+ "version": "4.7.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.7.1",
4
+ "version": "4.7.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.7.1",
4
+ "version": "4.7.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.7.1",
6
+ "version": "4.7.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.7.1",
26
+ "version": "4.7.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.7.1",
42
+ "version": "4.7.2",
43
43
  "runtimeHint": "uvx",
44
44
  "transport": {
45
45
  "type": "stdio"
package/src/mcp_server.py CHANGED
@@ -43,7 +43,7 @@ from src.session_context import current_root, current_session_id
43
43
 
44
44
  SERVER_INFO = {
45
45
  "name": "tokensafe-mcp",
46
- "version": "4.7.1"
46
+ "version": "4.7.2"
47
47
  }
48
48
 
49
49
  # MCP client attribution: the initialize handshake carries clientInfo, which
@@ -2485,22 +2485,39 @@ def _dispatch_tool_call(name: str, args: dict) -> dict:
2485
2485
  return {"content": [{"type": "text", "text": surface_md}]}
2486
2486
 
2487
2487
  elif name == "list_dir":
2488
- path = args.get("path") or args.get("project_path") or args.get("directory") or args.get("root_dir") or ""
2489
- if not path:
2488
+ path = args.get("path") or args.get("directory") or ""
2489
+ explicit_root = args.get("project_path") or args.get("root_dir")
2490
+ if not path and not explicit_root:
2490
2491
  return _fallback_error("list_dir", "missing required 'path' argument")
2491
2492
 
2492
- # Resolve path relative to active workspace, cwd, or absolute
2493
+ # An explicit project_path is the base for a relative path. Before this,
2494
+ # `path` shadowed it and joined to the session workspace, so repo_map
2495
+ # view='tree' on a second repo reported "directory not found".
2493
2496
  active_ws = _workspace_root()
2494
- if not os.path.isabs(path):
2495
- if active_ws and os.path.isdir(os.path.join(active_ws, path)):
2496
- abs_path = os.path.abspath(os.path.join(active_ws, path))
2497
- else:
2498
- abs_path = os.path.abspath(path)
2499
- else:
2497
+
2498
+ def _abs_candidate(value: str) -> str:
2499
+ if os.path.isabs(value):
2500
+ return os.path.abspath(value)
2501
+ if active_ws and os.path.isdir(os.path.join(active_ws, value)):
2502
+ return os.path.abspath(os.path.join(active_ws, value))
2503
+ return os.path.abspath(value)
2504
+
2505
+ base_dir = _abs_candidate(str(explicit_root)) if explicit_root else None
2506
+ if base_dir and not os.path.isdir(base_dir):
2507
+ return _fallback_error("list_dir", f"project_path not found or not a directory: '{explicit_root}'")
2508
+
2509
+ if not path:
2510
+ abs_path = base_dir
2511
+ elif os.path.isabs(path):
2500
2512
  abs_path = os.path.abspath(path)
2513
+ elif base_dir:
2514
+ abs_path = os.path.abspath(os.path.join(base_dir, path))
2515
+ else:
2516
+ abs_path = _abs_candidate(path)
2501
2517
 
2502
2518
  if not os.path.isdir(abs_path):
2503
- return _fallback_error("list_dir", f"directory not found: {abs_path}")
2519
+ where = f" (resolved from '{path}' under '{base_dir}')" if base_dir and not os.path.isabs(path) else ""
2520
+ return _fallback_error("list_dir", f"directory not found: {abs_path}{where}")
2504
2521
  if is_plugin_or_system_dir(abs_path):
2505
2522
  return _fallback_error("list_dir", f"refusing to inspect system root or plugin dir '{path}'")
2506
2523
  system_roots = {"/", "/Users", "/home", "/root", os.path.expanduser("~")}
@@ -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.7.1"
314
+ "User-Agent": "TokenSafe-Sync/4.7.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.7.1"
20
+ CURRENT_VERSION = "4.7.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