tokensafe 4.7.20 → 4.7.22
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/.codex-plugin/plugin.json +1 -1
- package/kimi.plugin.json +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/server.json +3 -3
- package/src/auto_inject.py +47 -3
- package/src/mcp_server.py +1 -1
- package/src/telemetry_sync.py +1 -1
- package/src/version_checker.py +1 -1
package/kimi.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokensafe",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.22",
|
|
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.
|
|
4
|
+
"version": "4.7.22",
|
|
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.
|
|
4
|
+
"version": "4.7.22",
|
|
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.
|
|
6
|
+
"version": "4.7.22",
|
|
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.
|
|
26
|
+
"version": "4.7.22",
|
|
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.
|
|
42
|
+
"version": "4.7.22",
|
|
43
43
|
"runtimeHint": "uvx",
|
|
44
44
|
"transport": {
|
|
45
45
|
"type": "stdio"
|
package/src/auto_inject.py
CHANGED
|
@@ -885,6 +885,33 @@ def _next_instrumentation_path(workspace: str) -> str:
|
|
|
885
885
|
return os.path.join(workspace, source_root, _NEXT_INSTRUMENTATION) if source_root else os.path.join(workspace, _NEXT_INSTRUMENTATION)
|
|
886
886
|
|
|
887
887
|
|
|
888
|
+
def _next_instrumentation_candidates(workspace: str) -> List[str]:
|
|
889
|
+
"""Every extension Next would load, so we never shadow a user's own loader."""
|
|
890
|
+
base = os.path.splitext(_next_instrumentation_path(workspace))[0]
|
|
891
|
+
return [base + ext for ext in (".ts", ".js", ".tsx", ".jsx", ".mjs")]
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
def _next_existing_instrumentation(workspace: str) -> Optional[str]:
|
|
895
|
+
for path in _next_instrumentation_candidates(workspace):
|
|
896
|
+
if os.path.isfile(path):
|
|
897
|
+
return path
|
|
898
|
+
return None
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
def _file_mentions(path: Optional[str], needle: str) -> bool:
|
|
902
|
+
if not path or not os.path.isfile(path):
|
|
903
|
+
return False
|
|
904
|
+
try:
|
|
905
|
+
with open(path, "r", encoding="utf-8") as handle:
|
|
906
|
+
return needle in handle.read()
|
|
907
|
+
except Exception:
|
|
908
|
+
return False
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
def _next_instrumentation_installed(workspace: str) -> bool:
|
|
912
|
+
return _file_mentions(_next_existing_instrumentation(workspace), "installNextBridge")
|
|
913
|
+
|
|
914
|
+
|
|
888
915
|
def _next_files(workspace: str) -> List[Tuple[str, str]]:
|
|
889
916
|
app_dir, _ = _next_app_dir(workspace)
|
|
890
917
|
files: List[Tuple[str, str]] = [
|
|
@@ -895,7 +922,11 @@ def _next_files(workspace: str) -> List[Tuple[str, str]]:
|
|
|
895
922
|
# that pretends to work. Those apps get the two route files plus the manual
|
|
896
923
|
# snippet; the bridge itself is unchanged once the loader exists.
|
|
897
924
|
if next_bridge_mode(workspace) == "instrumentation":
|
|
898
|
-
|
|
925
|
+
existing = _next_existing_instrumentation(workspace)
|
|
926
|
+
if existing is None:
|
|
927
|
+
files.append((_next_instrumentation_path(workspace), _NEXT_INSTRUMENTATION_SOURCE))
|
|
928
|
+
# An existing loader is the user's file: never create a second one next to
|
|
929
|
+
# it. apply() reports whether it already calls installNextBridge().
|
|
899
930
|
return files
|
|
900
931
|
|
|
901
932
|
|
|
@@ -927,12 +958,17 @@ def next_bridge_mode(workspace: str) -> str:
|
|
|
927
958
|
def next_patch_state(workspace: str) -> Dict[str, Any]:
|
|
928
959
|
files = _next_files(workspace)
|
|
929
960
|
existing = [path for path, _ in files if os.path.isfile(path)]
|
|
961
|
+
loader = _next_existing_instrumentation(workspace)
|
|
962
|
+
installed = _next_instrumentation_installed(workspace)
|
|
963
|
+
mode = next_bridge_mode(workspace)
|
|
930
964
|
return {
|
|
931
965
|
"entrypoint": existing[0] if existing else None,
|
|
932
|
-
"patched": len(existing) == len(files),
|
|
966
|
+
"patched": len(existing) == len(files) and (mode != "instrumentation" or installed),
|
|
933
967
|
"files": [os.path.relpath(path, workspace) for path, _ in files],
|
|
934
968
|
"missing": [os.path.relpath(path, workspace) for path, _ in files if not os.path.isfile(path)],
|
|
935
|
-
"bridge":
|
|
969
|
+
"bridge": mode,
|
|
970
|
+
"instrumentation": os.path.relpath(loader, workspace) if loader else None,
|
|
971
|
+
"instrumentation_installed": installed,
|
|
936
972
|
}
|
|
937
973
|
|
|
938
974
|
|
|
@@ -1015,6 +1051,14 @@ def apply_next_patch(workspace: str, dry_run: bool = False) -> Dict[str, Any]:
|
|
|
1015
1051
|
"reason": "instrumentation-client requires Next >= 15.3; load the bridge by hand in this app",
|
|
1016
1052
|
"snippet": "import { installNextBridge } from 'tokensafe-backend-node/next-bridge';\ninstallNextBridge();",
|
|
1017
1053
|
}
|
|
1054
|
+
else:
|
|
1055
|
+
loader = _next_existing_instrumentation(workspace)
|
|
1056
|
+
own_paths = {path for path, _ in files}
|
|
1057
|
+
if loader and loader not in own_paths and not _next_instrumentation_installed(workspace):
|
|
1058
|
+
result["bridge_manual"] = {
|
|
1059
|
+
"reason": f"{os.path.relpath(loader, workspace)} already exists — add the installer call to it instead of letting the engine shadow it",
|
|
1060
|
+
"snippet": "import { installNextBridge } from 'tokensafe-backend-node/next-bridge';\ninstallNextBridge();",
|
|
1061
|
+
}
|
|
1018
1062
|
return result
|
|
1019
1063
|
|
|
1020
1064
|
|
package/src/mcp_server.py
CHANGED
package/src/telemetry_sync.py
CHANGED
|
@@ -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.
|
|
314
|
+
"User-Agent": "TokenSafe-Sync/4.7.22"
|
|
315
315
|
}
|
|
316
316
|
if active_key:
|
|
317
317
|
headers["Authorization"] = f"Bearer {active_key}"
|
package/src/version_checker.py
CHANGED
|
@@ -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.
|
|
20
|
+
CURRENT_VERSION = "4.7.22"
|
|
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
|