tokensafe 4.9.0 → 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.0",
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.0",
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.0",
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.0",
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.0",
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.0",
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.0",
42
+ "version": "4.9.2",
43
43
  "runtimeHint": "uvx",
44
44
  "transport": {
45
45
  "type": "stdio"
@@ -1376,17 +1376,17 @@ def revert_dotnet_patch(workspace: str) -> Dict[str, Any]:
1376
1376
  # Pinned to the backend release: the sidecars are single files, so the cache is
1377
1377
  # content-addressed by SHA-256 and a clean machine downloads the exact bytes the
1378
1378
  # release was certified from. Bump both the tag and the hashes together.
1379
- _SIDECAR_RELEASE_TAG = "v0.16.0"
1379
+ _SIDECAR_RELEASE_TAG = "v0.18.0"
1380
1380
  _SIDECARS = {
1381
1381
  "spring": (
1382
1382
  "java/src/dev/tokensafe/oumv/OumvSpring.java",
1383
1383
  "OumvSpring.java",
1384
- "28491844ab13199da0d3972420101b415a1ba5dd78067a4482fd6546932cf86c",
1384
+ "7e31b52d6646e960101f24b5f4e85c89706b37ffc4252945bb112ea657b6c662",
1385
1385
  ),
1386
1386
  "php": (
1387
1387
  "php/bin/oumv-php",
1388
1388
  "oumv-php",
1389
- "74301298cec2867f9e67eb35f09edc95137b15fd49b60105cc2db54bb7d07346",
1389
+ "1ca76f6b1ed3f1a72ef18d8dbc85a54197341d6b95d47d3a7c48bf265aca4c6d",
1390
1390
  ),
1391
1391
  }
1392
1392
 
@@ -1403,11 +1403,15 @@ def sidecar_run_command(kind: str, sidecar_path: str, workspace: str) -> Optiona
1403
1403
  """The exact command that starts the sidecar against `workspace`."""
1404
1404
  if not sidecar_path:
1405
1405
  return None
1406
- # Java only knows the CLI flag; the PHP sidecar also reads OUMV_READ_ONLY,
1407
- # which run-backend sets, so its command line stays unchanged.
1406
+ # Java only knows the CLI flag; the PHP sidecar also reads OUMV_READ_ONLY and
1407
+ # OUMV_APP_URL, which run-backend sets, so its command line stays unchanged.
1408
1408
  read_only = " --read-only" if oumv_policy.current()[0] == oumv_policy.PROFILE_READ_ONLY else ""
1409
+ # Pointing a sidecar at the running app is what turns verify into a real
1410
+ # dispatch and observe L4 into recorded traces (wire 1.6.0).
1411
+ app_url = (os.environ.get("TOKENSAFE_OUMV_APP_URL") or "").strip().rstrip("/")
1412
+ dispatch = f" --app-url {app_url}" if app_url else ""
1409
1413
  if kind == "spring":
1410
- return f"tokensafe run-backend java {sidecar_path} --root {workspace} --port 7331{read_only}"
1414
+ return f"tokensafe run-backend java {sidecar_path} --root {workspace} --port 7331{read_only}{dispatch}"
1411
1415
  if kind == "php":
1412
1416
  return f"tokensafe run-backend php -S 127.0.0.1:7332 {sidecar_path} --root {workspace}"
1413
1417
  return None
@@ -1534,6 +1538,7 @@ def plan(workspace: str) -> Dict[str, Any]:
1534
1538
  provider = backend.get("provider")
1535
1539
  entry_id = {
1536
1540
  "fastapi": "backend/fastapi",
1541
+ "python": "backend/starlette",
1537
1542
  "go": "backend/go",
1538
1543
  "node": "backend/node",
1539
1544
  "elysia": "backend/elysia",
@@ -1543,13 +1548,16 @@ def plan(workspace: str) -> Dict[str, Any]:
1543
1548
  }.get(provider, "backend/go")
1544
1549
  entry = catalog.get(entry_id, {})
1545
1550
  install = entry.get("technology", {}).get("package", {}).get("install")
1546
- if provider == "fastapi":
1551
+ if provider == "fastapi" or (provider == "python" and backend.get("framework") in ("fastapi", "starlette")):
1547
1552
  actions.append({
1548
1553
  "kind": "python_autoload",
1549
1554
  "profile": "backend",
1550
- "framework": "fastapi",
1555
+ "framework": backend.get("framework", "fastapi"),
1551
1556
  "writes_repo": False,
1552
- "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
+ ),
1553
1561
  "install": install or 'pip install "tokensafe-backend-python @ git+https://github.com/tokensafe-dev/tokensafe-backend.git#subdirectory=python"',
1554
1562
  "run": python_run_hint(workspace),
1555
1563
  })
@@ -1663,7 +1671,9 @@ def apply(workspace: str, dry_run: bool = False, include_go: bool = True) -> Dic
1663
1671
  results["actions"].append({"kind": "next_route_handler", **apply_next_patch(workspace, dry_run=dry_run)})
1664
1672
 
1665
1673
  backend = stack.get("backend") or {}
1666
- 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
+ ):
1667
1677
  if dry_run:
1668
1678
  results["actions"].append({"kind": "python_autoload", "status": "would-write", "path": os.path.join(pyhooks_dir(), "sitecustomize.py")})
1669
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.0"
48
+ "version": "4.9.2"
49
49
  }
50
50
 
51
51
  # MCP client attribution: the initialize handshake carries clientInfo, which
@@ -91,11 +91,18 @@ def spawn_env(env: Optional[Dict[str, str]] = None) -> Dict[str, str]:
91
91
  Node/Go/.NET and the generated Python sitecustomize read
92
92
  ``TOKENSAFE_OUMV_READ_ONLY``; the PHP sidecar reads ``OUMV_READ_ONLY``. Java
93
93
  takes the CLI flag instead (see ``sidecar_run_command``).
94
+
95
+ ``TOKENSAFE_OUMV_APP_URL`` is forwarded as ``OUMV_APP_URL`` so a sidecar (PHP
96
+ in built-in-server mode) dispatches verify to the running application and
97
+ records real L4 traces instead of running only the static check.
94
98
  """
95
99
  base = dict(os.environ if env is None else env)
96
100
  if current()[0] == PROFILE_READ_ONLY:
97
101
  base["TOKENSAFE_OUMV_READ_ONLY"] = "1"
98
102
  base["OUMV_READ_ONLY"] = "1"
103
+ app_url = str(base.get("TOKENSAFE_OUMV_APP_URL") or "").strip()
104
+ if app_url:
105
+ base["OUMV_APP_URL"] = app_url
99
106
  return base
100
107
 
101
108
 
package/src/retrofit.py CHANGED
@@ -816,7 +816,7 @@ def get_adapters_catalog() -> List[Dict[str, Any]]:
816
816
  "repo": "tokensafe-backend/java",
817
817
  "mode": "sidecar",
818
818
  "status": "ready",
819
- "description": "Single-file JDK sidecar: scans @RestController mappings statically, serves HTTP and stdio, applies OCC edits (single or 1..16-file atomic batch), previews without writing, searches symbols, runs a real build/verify command and negotiates session TTL/cancel/idempotency. Wire 1.6.0. Certified Level 2 44/45: the only failure is the L4 trace case, which it refuses instead of fabricating traces; the read-only profile certifies 26/26.",
819
+ "description": "Single-file JDK sidecar: scans @RestController mappings statically, serves HTTP and stdio, applies OCC edits (single or 1..16-file atomic batch), previews without writing, searches symbols, runs a real build/verify command and negotiates session TTL/cancel/idempotency. Wire 1.6.0. Certified Level 3 45/45 with --app-url: verify dispatches to the running Spring app and the real responses become L4 traces (without --app-url it answers L4 with -32006 and attains Level 2); the read-only profile certifies 26/26.",
820
820
  "technology": {
821
821
  "language": "java",
822
822
  "framework": "spring",
@@ -829,7 +829,9 @@ def get_adapters_catalog() -> List[Dict[str, Any]]:
829
829
  "capabilities": [
830
830
  {"name": "observe.resources", "constraints": {"readOnly": True, "developmentOnly": False}},
831
831
  {"name": "observe.runtime_state", "constraints": {"readOnly": True, "developmentOnly": False}},
832
+ {"name": "observe.traces", "constraints": {"readOnly": True, "developmentOnly": False, "requiresConfig": "TOKENSAFE_OUMV_APP_URL (verify dispatches to the running app; without it L4 is -32006)"}},
832
833
  {"name": "understand.impact", "constraints": {"readOnly": True, "developmentOnly": False}},
834
+ {"name": "understand.causality", "constraints": {"readOnly": True, "developmentOnly": False, "requiresConfig": "TOKENSAFE_OUMV_APP_URL"}},
833
835
  {"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": False, "requiresPermission": "permissions.mutate != false"}},
834
836
  {"name": "mutate.multiFile", "constraints": {"readOnly": False, "developmentOnly": True, "requiresPermission": "permissions.mutate != false"}},
835
837
  {"name": "mutate.preview", "constraints": {"readOnly": False, "developmentOnly": True, "requiresPermission": "permissions.mutate != false"}},
@@ -849,7 +851,7 @@ def get_adapters_catalog() -> List[Dict[str, Any]]:
849
851
  "repo": "tokensafe-backend/php",
850
852
  "mode": "sidecar",
851
853
  "status": "ready",
852
- "description": "Dependency-free PHP sidecar: Laravel Route:: and Symfony #[Route] discovery, token_get_all handler ranges, php -l pre-flight, OCC edits (single or 1..16-file atomic batch), preview, symbol index, build command and session TTL/cancel/idempotency. Wire 1.6.0. Certified Level 3 41/41; the read-only profile certifies 26/26.",
854
+ "description": "Dependency-free PHP sidecar: Laravel Route:: and Symfony #[Route] discovery, token_get_all handler ranges, php -l pre-flight, OCC edits (single or 1..16-file atomic batch), preview, symbol index, build command and session TTL/cancel/idempotency. Wire 1.6.0. Certified Level 3 45/45 with --app-url: verify dispatches to the running Laravel app and the real responses become L4 traces (without --app-url it answers L4 with -32006); the read-only profile certifies 26/26.",
853
855
  "technology": {
854
856
  "language": "php",
855
857
  "framework": "laravel | symfony",
@@ -862,6 +864,9 @@ def get_adapters_catalog() -> List[Dict[str, Any]]:
862
864
  "capabilities": [
863
865
  {"name": "observe.resources", "constraints": {"readOnly": True, "developmentOnly": False}},
864
866
  {"name": "observe.runtime_state", "constraints": {"readOnly": True, "developmentOnly": False}},
867
+ {"name": "observe.traces", "constraints": {"readOnly": True, "developmentOnly": False, "requiresConfig": "TOKENSAFE_OUMV_APP_URL (verify dispatches to the running app; without it L4 is -32006)"}},
868
+ {"name": "understand.impact", "constraints": {"readOnly": True, "developmentOnly": False}},
869
+ {"name": "understand.causality", "constraints": {"readOnly": True, "developmentOnly": False, "requiresConfig": "TOKENSAFE_OUMV_APP_URL"}},
865
870
  {"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": False, "requiresPermission": "permissions.mutate != false"}},
866
871
  {"name": "mutate.multiFile", "constraints": {"readOnly": False, "developmentOnly": True, "requiresPermission": "permissions.mutate != false"}},
867
872
  {"name": "mutate.preview", "constraints": {"readOnly": False, "developmentOnly": True, "requiresPermission": "permissions.mutate != false"}},
@@ -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.0"
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.0"
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