tokensafe 4.5.4 → 4.6.0

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.5.4",
2
+ "version": "4.6.0",
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.5.4",
3
+ "version": "4.6.0",
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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tokensafe",
3
3
  "mcpName": "dev.tokensafe/tokensafe",
4
- "version": "4.5.4",
4
+ "version": "4.6.0",
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.5.4",
4
+ "version": "4.6.0",
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.5.4",
6
+ "version": "4.6.0",
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.5.4",
26
+ "version": "4.6.0",
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.5.4",
42
+ "version": "4.6.0",
43
43
  "runtimeHint": "uvx",
44
44
  "transport": {
45
45
  "type": "stdio"
@@ -133,7 +133,9 @@ def _run_rg_query(
133
133
  if not rg_bin:
134
134
  return None
135
135
 
136
- cmd = [rg_bin, "--no-heading", "--line-number", "--color=never", "--max-count", str(max_results)]
136
+ # --with-filename is mandatory: for a single-file target ripgrep omits the
137
+ # path prefix, so every output line would be unparseable below (silent 0 hits).
138
+ cmd = [rg_bin, "--no-heading", "--with-filename", "--line-number", "--color=never", "--max-count", str(max_results)]
137
139
  if not is_regex:
138
140
  cmd.append("--fixed-strings")
139
141
  if not case_sensitive:
@@ -184,6 +186,18 @@ def _run_rg_query(
184
186
  return None
185
187
 
186
188
 
189
+ def _iter_search_files(search_root: str, cwd: str):
190
+ """Yields (full_path, rel_path) for an explicit file target or a directory tree."""
191
+ if os.path.isfile(search_root):
192
+ yield search_root, os.path.relpath(search_root, cwd)
193
+ return
194
+ for root, dirs, files in os.walk(search_root):
195
+ dirs[:] = [d for d in dirs if d not in IGNORED_DIRS and not d.startswith(".")]
196
+ for f in files:
197
+ full_path = os.path.join(root, f)
198
+ yield full_path, os.path.relpath(full_path, cwd)
199
+
200
+
187
201
  def _run_python_text_search(
188
202
  pattern: str,
189
203
  cwd: str,
@@ -209,41 +223,41 @@ def _run_python_text_search(
209
223
 
210
224
  matches = []
211
225
  target_lower = pattern if case_sensitive else pattern.lower()
226
+ explicit_file = os.path.isfile(search_root)
212
227
 
213
- for root, dirs, files in os.walk(search_root):
214
- dirs[:] = [d for d in dirs if d not in IGNORED_DIRS and not d.startswith(".")]
215
- for f in files:
216
- ext = os.path.splitext(f)[1].lower()
228
+ for full_path, rel_p in _iter_search_files(search_root, cwd):
229
+ # An explicitly named file is searched as-is: extension, scope, and glob
230
+ # filters only make sense when walking a directory tree.
231
+ if not explicit_file:
232
+ ext = os.path.splitext(full_path)[1].lower()
217
233
  if ext in IGNORED_EXTENSIONS:
218
234
  continue
219
235
  if scope == "code" and ext not in CODE_EXTENSIONS:
220
236
  continue
221
- full_path = os.path.join(root, f)
222
- rel_p = os.path.relpath(full_path, cwd)
223
- if glob_filter and not (fnmatch.fnmatch(f, glob_filter) or fnmatch.fnmatch(rel_p, glob_filter)):
237
+ if glob_filter and not (fnmatch.fnmatch(os.path.basename(full_path), glob_filter) or fnmatch.fnmatch(rel_p, glob_filter)):
224
238
  continue
225
239
 
226
- try:
227
- with open(full_path, "r", encoding="utf-8", errors="replace") as fp:
228
- for line_idx, line in enumerate(fp):
229
- hit = False
230
- if regex:
231
- hit = bool(regex.search(line))
232
- elif case_sensitive:
233
- hit = pattern in line
234
- else:
235
- hit = target_lower in line.lower()
236
-
237
- if hit:
238
- matches.append({
239
- "file": rel_p,
240
- "line": line_idx + 1,
241
- "content": line.strip()[:180]
242
- })
243
- if len(matches) >= max_results:
244
- return matches
245
- except Exception:
246
- continue
240
+ try:
241
+ with open(full_path, "r", encoding="utf-8", errors="replace") as fp:
242
+ for line_idx, line in enumerate(fp):
243
+ hit = False
244
+ if regex:
245
+ hit = bool(regex.search(line))
246
+ elif case_sensitive:
247
+ hit = pattern in line
248
+ else:
249
+ hit = target_lower in line.lower()
250
+
251
+ if hit:
252
+ matches.append({
253
+ "file": rel_p,
254
+ "line": line_idx + 1,
255
+ "content": line.strip()[:180]
256
+ })
257
+ if len(matches) >= max_results:
258
+ return matches
259
+ except Exception:
260
+ continue
247
261
 
248
262
  return matches
249
263
 
@@ -254,15 +268,18 @@ def _run_glob_search(pattern: str, cwd: str, path_filter: Optional[str] = None,
254
268
  if not os.path.exists(search_root):
255
269
  return []
256
270
 
271
+ if os.path.isfile(search_root):
272
+ rel_p = os.path.relpath(search_root, cwd)
273
+ if fnmatch.fnmatch(rel_p, pattern) or fnmatch.fnmatch(os.path.basename(search_root), pattern):
274
+ return [rel_p]
275
+ return []
276
+
257
277
  results = []
258
- for root, dirs, files in os.walk(search_root):
259
- dirs[:] = [d for d in dirs if d not in IGNORED_DIRS and not d.startswith(".")]
260
- for f in files:
261
- rel_p = os.path.relpath(os.path.join(root, f), cwd)
262
- if fnmatch.fnmatch(rel_p, pattern) or fnmatch.fnmatch(f, pattern):
263
- results.append(rel_p)
264
- if len(results) >= max_results:
265
- return results
278
+ for full_path, rel_p in _iter_search_files(search_root, cwd):
279
+ if fnmatch.fnmatch(rel_p, pattern) or fnmatch.fnmatch(os.path.basename(full_path), pattern):
280
+ results.append(rel_p)
281
+ if len(results) >= max_results:
282
+ return results
266
283
  return results
267
284
 
268
285
 
@@ -274,17 +291,14 @@ def _run_fuzzy_search(pattern: str, cwd: str, path_filter: Optional[str] = None,
274
291
 
275
292
  pat_lower = pattern.lower().replace(" ", "")
276
293
  results = []
277
- for root, dirs, files in os.walk(search_root):
278
- dirs[:] = [d for d in dirs if d not in IGNORED_DIRS and not d.startswith(".")]
279
- for f in files:
280
- rel_p = os.path.relpath(os.path.join(root, f), cwd)
281
- name_lower = rel_p.lower()
282
- # Subsequence match
283
- it = iter(name_lower)
284
- if all(ch in it for ch in pat_lower):
285
- results.append(rel_p)
286
- if len(results) >= max_results:
287
- return results
294
+ for _, rel_p in _iter_search_files(search_root, cwd):
295
+ name_lower = rel_p.lower()
296
+ # Subsequence match
297
+ it = iter(name_lower)
298
+ if all(ch in it for ch in pat_lower):
299
+ results.append(rel_p)
300
+ if len(results) >= max_results:
301
+ return results
288
302
  return results
289
303
 
290
304
 
package/src/cli.py CHANGED
@@ -116,7 +116,8 @@ def _print_help():
116
116
  print(" expand-ref <hash> Restore folded tool/command/file result by its 8-char hash")
117
117
  print(" wrap <command> Run command with compact output folding (e.g. tests/logs)")
118
118
  print(" web <url> Fetch web page/docs and print clean compact Markdown")
119
- print(" doctor [--cleanup] Audit MCP tool overhead and detect competitor conflicts")
119
+ print(" doctor [--fix | --cleanup] Audit MCP/skill overhead, repair configs & consolidate ghost rules")
120
+ print(" skills [list|disable|enable] Inspect and toggle active skills to cut turn context tax")
120
121
  print(" tests [pytest] [--traceback] Run the unit test suite (compact failure report)")
121
122
  print(" prune [--days N | --max N] Compact metrics database (roll old events)")
122
123
  print(" vacuum Reclaim SQLite disk space")
@@ -960,6 +961,34 @@ def main(argv: Optional[List[str]] = None):
960
961
  res = CompetitorAuditor.cleanup(c["id"])
961
962
  print(f" \033[32m✔ Cleaned {c['name']}: {', '.join(res.get('removed', []))}\033[0m")
962
963
 
964
+ elif command in ("skills", "skill"):
965
+ from src.environment_auditor import EnvironmentAuditor
966
+ sub = args[1] if len(args) > 1 else "list"
967
+ if sub in ("disable", "off", "rm"):
968
+ if len(args) < 3:
969
+ print("Usage: tokensafe skills disable <skill_name>")
970
+ sys.exit(1)
971
+ target = args[2].strip()
972
+ res = EnvironmentAuditor.disable_skill(target)
973
+ if res.get("success"):
974
+ print(f"\n\033[32m✔ Skill '{res['skill']}' disabled ({res['path']}).\033[0m\n")
975
+ else:
976
+ print(f"\n\033[31m✖ {res.get('error', 'Failed to disable skill')}\033[0m\n")
977
+ sys.exit(1)
978
+ elif sub in ("enable", "on", "add"):
979
+ if len(args) < 3:
980
+ print("Usage: tokensafe skills enable <skill_name>")
981
+ sys.exit(1)
982
+ target = args[2].strip()
983
+ res = EnvironmentAuditor.enable_skill(target)
984
+ if res.get("success"):
985
+ print(f"\n\033[32m✔ Skill '{res['skill']}' re-enabled ({res['path']}).\033[0m\n")
986
+ else:
987
+ print(f"\n\033[31m✖ {res.get('error', 'Failed to enable skill')}\033[0m\n")
988
+ sys.exit(1)
989
+ else:
990
+ print(EnvironmentAuditor.format_skills_report())
991
+
963
992
  elif command in ("web", "fetch", "url"):
964
993
  if len(args) < 2:
965
994
  print("Usage: tokensafe web <url>")
@@ -1659,7 +1688,7 @@ def main(argv: Optional[List[str]] = None):
1659
1688
 
1660
1689
  else:
1661
1690
  print(f"Unknown command: {command}")
1662
- print("Available commands: init, login, logout, stats, status, sync, html, test, tests, expand-ref, wrap, web, doctor, providers, mcp, benchmark, proxy, graph, map, skeleton, guard, mistakes, vacuum, prune, digest, activate, license, markdown, install, uninstall, setup, update, check-update, reset. Run 'tokensafe help' for details.")
1691
+ print("Available commands: init, login, logout, stats, status, sync, html, test, tests, expand-ref, wrap, web, doctor, skills, providers, mcp, benchmark, proxy, graph, map, skeleton, guard, mistakes, vacuum, prune, digest, activate, license, markdown, install, uninstall, setup, update, check-update, reset. Run 'tokensafe help' for details.")
1663
1692
  sys.exit(1)
1664
1693
 
1665
1694
  if __name__ == "__main__":
@@ -0,0 +1,212 @@
1
+ """
2
+ Unified Cross-Stack Intelligence Graph (OUMV spec §11).
3
+
4
+ Merges three independent evidence sources into one resource graph:
5
+ 1. Static analysis (frontend API call sites -> backend endpoints, from the AST graph engine).
6
+ 2. Live frontend runtime surface (mounted components / actions, provenance "runtime").
7
+ 3. Live backend runtime surface (endpoints actually served, provenance "runtime").
8
+
9
+ Every node and edge carries EvidenceMetadata (spec §6.2). Missing runtime evidence
10
+ is reported explicitly instead of being inferred.
11
+ """
12
+
13
+ import time
14
+ from typing import Any, Callable, Dict, List, Optional
15
+
16
+
17
+ def _static_evidence() -> Dict[str, str]:
18
+ return {"provenance": "static", "sourceAdapter": "tokensafe-graph-engine", "confidence": "probable"}
19
+
20
+
21
+ def _runtime_evidence(source: str) -> Dict[str, str]:
22
+ return {"provenance": "runtime", "sourceAdapter": source, "confidence": "confirmed"}
23
+
24
+
25
+ def build_unified_graph(
26
+ workspace_dir: Optional[str] = None,
27
+ fe: Optional[Dict[str, Any]] = None,
28
+ be: Optional[Dict[str, Any]] = None,
29
+ rpc_call: Optional[Callable[..., Any]] = None,
30
+ ) -> Dict[str, Any]:
31
+ """Builds the unified cross-stack graph for a workspace.
32
+
33
+ Args:
34
+ workspace_dir: workspace root (defaults to the active workspace).
35
+ fe / be: live runtime descriptors from OUMVGateway.get_endpoints().
36
+ rpc_call: callable(url, method, params) used to observe live surfaces.
37
+ """
38
+ from src.graph_engine import GraphEngine
39
+ from src.paths import get_active_workspace
40
+
41
+ ws = workspace_dir or get_active_workspace()
42
+ static = GraphEngine.get_instance(ws)
43
+
44
+ nodes: Dict[str, Dict[str, Any]] = {}
45
+ edges: List[Dict[str, Any]] = []
46
+
47
+ def _endpoint_node_id(method: Optional[str], route: str) -> str:
48
+ return f"backend.endpoint:{method or 'ANY'}:{route}"
49
+
50
+ # 1. Static backend endpoints
51
+ for rel_path, eps in getattr(static, "file_endpoints", {}).items():
52
+ for route, sym, method in eps:
53
+ node_id = _endpoint_node_id(method, route)
54
+ nodes.setdefault(node_id, {
55
+ "id": node_id,
56
+ "type": "backend.endpoint",
57
+ "route": route,
58
+ "method": method,
59
+ "file": rel_path,
60
+ "symbol": sym,
61
+ "evidence": _static_evidence(),
62
+ })
63
+
64
+ # 2. Static frontend action (API call) sites
65
+ for rel_path, calls in getattr(static, "file_api_calls", {}).items():
66
+ for route, sym, method in calls:
67
+ node_id = f"frontend.action:{method or 'ANY'}:{route}:{rel_path}:{sym or ''}"
68
+ nodes.setdefault(node_id, {
69
+ "id": node_id,
70
+ "type": "frontend.action",
71
+ "route": route,
72
+ "method": method,
73
+ "file": rel_path,
74
+ "symbol": sym,
75
+ "evidence": _static_evidence(),
76
+ })
77
+
78
+ # 3. Static cross-stack edges (frontend call -> backend endpoint)
79
+ for link in getattr(static, "api_links", []):
80
+ source = link["source"]
81
+ target = link["target"]
82
+ src_id = f"frontend.action:{source.get('method') or 'ANY'}:{source.get('route')}:{source.get('file')}:{source.get('symbol') or ''}"
83
+ dst_id = _endpoint_node_id(target.get("method"), target.get("route") or "")
84
+ edges.append({
85
+ "source": src_id,
86
+ "target": dst_id,
87
+ "relation": "calls",
88
+ "evidence": _static_evidence(),
89
+ })
90
+
91
+ runtime_fe_ok = False
92
+ runtime_be_ok = False
93
+
94
+ # 4. Live backend surface: confirms endpoints actually served
95
+ if be and rpc_call:
96
+ try:
97
+ surface = rpc_call(be["url"], "oumv/observe", {"level": "L1"})
98
+ if isinstance(surface, dict):
99
+ runtime_be_ok = True
100
+ for ep in surface.get("endpoints", []) or []:
101
+ node_id = _endpoint_node_id(ep.get("method"), ep.get("path") or ep.get("route") or "")
102
+ if not node_id.endswith(":"):
103
+ if node_id in nodes:
104
+ nodes[node_id]["runtimeConfirmed"] = True
105
+ else:
106
+ nodes[node_id] = {
107
+ "id": node_id,
108
+ "type": "backend.endpoint",
109
+ "route": ep.get("path") or ep.get("route"),
110
+ "method": ep.get("method"),
111
+ "evidence": _runtime_evidence("live-backend-runtime"),
112
+ }
113
+ except Exception:
114
+ pass
115
+
116
+ # 5. Live frontend surface: mounted components / actions
117
+ if fe and rpc_call:
118
+ try:
119
+ surface = rpc_call(fe["url"], "oumv/observe", {"level": "L1"})
120
+ if isinstance(surface, dict):
121
+ runtime_fe_ok = True
122
+ for comp in surface.get("components", []) or surface.get("elements", []) or []:
123
+ comp_id = comp.get("id") or comp.get("agentId") or comp.get("componentId")
124
+ if not comp_id:
125
+ continue
126
+ node_id = f"frontend.component:{comp_id}"
127
+ nodes.setdefault(node_id, {
128
+ "id": node_id,
129
+ "type": "frontend.component",
130
+ "evidence": _runtime_evidence("live-frontend-runtime"),
131
+ })
132
+ except Exception:
133
+ pass
134
+
135
+ provenance_summary = {
136
+ "staticNodes": sum(1 for n in nodes.values() if n["evidence"]["provenance"] == "static"),
137
+ "runtimeNodes": sum(1 for n in nodes.values() if n["evidence"]["provenance"] == "runtime"),
138
+ "runtimeConfirmedEndpoints": sum(1 for n in nodes.values() if n.get("runtimeConfirmed")),
139
+ "edges": len(edges),
140
+ }
141
+
142
+ return {
143
+ "mode": "UNIFIED_CROSS_STACK_GRAPH",
144
+ "workspace": ws,
145
+ "timestamp": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
146
+ "nodes": list(nodes.values()),
147
+ "edges": edges,
148
+ "provenanceSummary": provenance_summary,
149
+ "missingEvidence": [
150
+ "Frontend call origins are statically inferred; runtime fetch tracing is not yet recorded by the frontend bridge.",
151
+ ],
152
+ "runtimes": {
153
+ "frontend": "live" if runtime_fe_ok else ("unreachable" if fe else "offline"),
154
+ "backend": "live" if runtime_be_ok else ("unreachable" if be else "offline"),
155
+ },
156
+ }
157
+
158
+
159
+ def who_depends_on(target: str, graph: Dict[str, Any]) -> Dict[str, Any]:
160
+ """Answers §11.4: which frontend resources call a given backend endpoint."""
161
+ t = (target or "").strip()
162
+ result: Dict[str, Any] = {
163
+ "query": "who_depends_on",
164
+ "target": t,
165
+ "frontendCallers": [],
166
+ "runtimeConfirmed": False,
167
+ "evidence": _static_evidence(),
168
+ }
169
+ if not t:
170
+ result["error"] = "target is required (e.g. '/api/orders' or 'POST /api/orders')"
171
+ return result
172
+
173
+ t_lower = t.lower()
174
+ for edge in graph.get("edges", []):
175
+ target_route = (edge.get("target") or "").lower()
176
+ if t_lower in target_route:
177
+ result["frontendCallers"].append({
178
+ "source": edge["source"],
179
+ "relation": "calls",
180
+ "evidence": edge.get("evidence"),
181
+ })
182
+
183
+ nodes = {n["id"]: n for n in graph.get("nodes", [])}
184
+ for node_id, node in nodes.items():
185
+ if node.get("type") == "backend.endpoint" and t_lower in f"{node.get('method') or ''} {node.get('route') or ''}".lower():
186
+ if node.get("runtimeConfirmed"):
187
+ result["runtimeConfirmed"] = True
188
+
189
+ result["frontendCallers"] = result["frontendCallers"][:30]
190
+ return result
191
+
192
+
193
+ def impact_from_graph(target: str, graph: Dict[str, Any]) -> Dict[str, Any]:
194
+ """Graph-based impact view: affected cross-stack callers with suggested verification."""
195
+ callers = who_depends_on(target, graph)
196
+ verification_steps = [
197
+ f"oumv_verify(target='POST {target}') — in-memory endpoint check",
198
+ ]
199
+ for caller in callers.get("frontendCallers", [])[:3]:
200
+ parts = caller["source"].split(":")
201
+ route_hint = parts[2] if len(parts) > 2 else caller["source"]
202
+ verification_steps.append(
203
+ f"oumv_understand(query='causality', target='{route_hint}') — confirm the calling code still matches"
204
+ )
205
+ return {
206
+ "query": "impact",
207
+ "target": target,
208
+ "frontendCallers": callers.get("frontendCallers", []),
209
+ "runtimeConfirmed": callers.get("runtimeConfirmed", False),
210
+ "suggestedVerification": verification_steps,
211
+ "missingEvidence": graph.get("missingEvidence", []),
212
+ }
@@ -656,8 +656,11 @@ class EnvironmentAuditor:
656
656
  shutil.copy2(p, f"{p}.backup")
657
657
  cleaned = AgentInstaller._clean_codex_orphans(orig_text)
658
658
  try:
659
- import tomllib
660
- tomllib.loads(cleaned)
659
+ try:
660
+ import tomllib
661
+ tomllib.loads(cleaned)
662
+ except ImportError:
663
+ pass
661
664
  with open(p, "w", encoding="utf-8") as f:
662
665
  f.write(cleaned)
663
666
  fixed.append(f"Repaired TOML syntax/orphans in {p} (backup: {p}.backup)")
@@ -743,20 +746,155 @@ class EnvironmentAuditor:
743
746
  "backup_dir": backup_dir if fixed else None,
744
747
  }
745
748
 
749
+ @classmethod
750
+ def list_skills(cls, workspace_root: Optional[str] = None) -> List[Dict[str, Any]]:
751
+ """Lists active and disabled skills across all skill roots with source & token estimate."""
752
+ skills: List[Dict[str, Any]] = []
753
+ disabled_plugins = cls._get_disabled_plugin_names()
754
+ plugins_dir = os.path.abspath(cls.get_plugins_dir())
755
+ seen_real = set()
756
+
757
+ for sdir in cls.get_skills_dirs(workspace_root):
758
+ is_plugins_root = os.path.abspath(sdir) == plugins_dir
759
+ for root, dirs, files in os.walk(sdir, followlinks=True):
760
+ real_root = os.path.realpath(root)
761
+ if real_root in seen_real:
762
+ dirs[:] = []
763
+ continue
764
+ seen_real.add(real_root)
765
+ if is_plugins_root and os.path.abspath(root) == plugins_dir:
766
+ dirs[:] = [d for d in dirs if d not in disabled_plugins and not d.endswith(".disabled")]
767
+ else:
768
+ dirs[:] = [d for d in dirs if d not in ("node_modules", ".git", "__pycache__", ".venv", "venv")]
769
+
770
+ if "SKILL.md" in files:
771
+ folder_name = os.path.basename(root)
772
+ is_disabled = folder_name.endswith(".disabled") or ".disabled" + os.sep in root
773
+ clean_name = folder_name[:-9] if folder_name.endswith(".disabled") else folder_name
774
+ desc = ""
775
+ try:
776
+ with open(os.path.join(root, "SKILL.md"), "r", encoding="utf-8", errors="replace") as f:
777
+ head = f.read(1200)
778
+ m_name = re.search(r"(?m)^name:\s*(.+)$", head)
779
+ if m_name and m_name.group(1).strip():
780
+ clean_name = m_name.group(1).strip().strip("'\"")
781
+ m_desc = re.search(r"(?m)^description:\s*(.+)$", head)
782
+ if m_desc:
783
+ raw_desc = m_desc.group(1).strip().strip("'\"")
784
+ if raw_desc in (">", ">-", "|", "|-"):
785
+ after = head[m_desc.end():]
786
+ for next_l in after.splitlines():
787
+ stripped = next_l.strip()
788
+ if stripped and not re.match(r"^[A-Za-z0-9_-]+:\s*", stripped):
789
+ desc = stripped[:90]
790
+ break
791
+ else:
792
+ desc = raw_desc[:90]
793
+ except Exception:
794
+ pass
795
+ skills.append({
796
+ "name": clean_name,
797
+ "dir_name": folder_name[:-9] if folder_name.endswith(".disabled") else folder_name,
798
+ "path": root,
799
+ "root": sdir,
800
+ "disabled": is_disabled,
801
+ "est_tokens": EST_TOKENS_PER_SKILL,
802
+ "description": desc,
803
+ "builtin": "builtin" in root.split(os.sep),
804
+ })
805
+ dirs[:] = []
806
+ return sorted(skills, key=lambda x: (x["disabled"], x["name"].lower()))
807
+
808
+ @classmethod
809
+ def disable_skill(cls, skill_name: str, workspace_root: Optional[str] = None) -> Dict[str, Any]:
810
+ """Disables a user/workspace skill by renaming its directory to `<name>.disabled`."""
811
+ target = skill_name.strip().lower()
812
+ for sk in cls.list_skills(workspace_root):
813
+ if sk["disabled"]:
814
+ continue
815
+ if sk["name"].lower() == target or sk["dir_name"].lower() == target:
816
+ if sk["builtin"]:
817
+ return {"success": False, "error": f"Skill '{sk['name']}' is a builtin Antigravity skill and cannot be renamed safely."}
818
+ src_path = sk["path"]
819
+ dst_path = f"{src_path}.disabled"
820
+ if os.path.exists(dst_path):
821
+ return {"success": False, "error": f"Target '{dst_path}' already exists."}
822
+ try:
823
+ os.rename(src_path, dst_path)
824
+ return {"success": True, "skill": sk["name"], "path": dst_path}
825
+ except Exception as exc:
826
+ return {"success": False, "error": str(exc)}
827
+ return {"success": False, "error": f"Active skill '{skill_name}' not found."}
828
+
829
+ @classmethod
830
+ def enable_skill(cls, skill_name: str, workspace_root: Optional[str] = None) -> Dict[str, Any]:
831
+ """Re-enables a previously `.disabled` skill directory."""
832
+ target = skill_name.strip().lower()
833
+ for sk in cls.list_skills(workspace_root):
834
+ if not sk["disabled"]:
835
+ continue
836
+ if sk["name"].lower() == target or sk["dir_name"].lower() == target:
837
+ src_path = sk["path"]
838
+ if not src_path.endswith(".disabled"):
839
+ continue
840
+ dst_path = src_path[:-9]
841
+ if os.path.exists(dst_path):
842
+ return {"success": False, "error": f"Target '{dst_path}' already exists."}
843
+ try:
844
+ os.rename(src_path, dst_path)
845
+ return {"success": True, "skill": sk["name"], "path": dst_path}
846
+ except Exception as exc:
847
+ return {"success": False, "error": str(exc)}
848
+ return {"success": False, "error": f"Disabled skill '{skill_name}' not found."}
849
+
850
+ @classmethod
851
+ def format_skills_report(cls, workspace_root: Optional[str] = None) -> str:
852
+ """Formats a clean CLI list of active & disabled skills grouped by token overhead."""
853
+ skills = cls.list_skills(workspace_root)
854
+ active = [s for s in skills if not s["disabled"]]
855
+ disabled = [s for s in skills if s["disabled"]]
856
+ lines = [
857
+ f"\n\033[1m\033[36m⚡ TOKENSAFE SKILLS INVENTORY ({len(active)} active, {len(disabled)} disabled) ⚡\033[0m\n",
858
+ f" \033[1mActive Context Overhead:\033[0m ~{len(active) * EST_TOKENS_PER_SKILL:,} tokens/turn (~{EST_TOKENS_PER_SKILL} tok/skill)\n",
859
+ ]
860
+ for s in active:
861
+ tag = "\033[2m[builtin]\033[0m" if s["builtin"] else f"\033[2m[{os.path.basename(s['root'])}]\033[0m"
862
+ desc = f" — {s['description']}" if s["description"] else ""
863
+ lines.append(f" \033[32m✔\033[0m \033[1m{s['name']:<28}\033[0m {tag}{desc}")
864
+ if disabled:
865
+ lines.append("\n \033[2mDisabled Skills:\033[0m")
866
+ for s in disabled:
867
+ lines.append(f" \033[2m○ {s['name']:<28} [{os.path.basename(s['root'])}]\033[0m")
868
+ lines.append("\n 💡 Tip: Run \033[36mtokensafe skills disable <name>\033[0m (or \033[36mtokensafe skills enable <name>\033[0m) to manage overhead.\n")
869
+ return "\n".join(lines)
870
+
746
871
  @classmethod
747
872
  def format_cli_report(cls, workspace_root: Optional[str] = None) -> str:
748
- """Formats visual CLI report for tokensafe doctor."""
873
+ """Formats visual CLI report for tokensafe doctor (pure static environment score)."""
749
874
  report = cls.audit(workspace_root)
750
875
  q_score: Dict[str, Any] = {}
751
876
  score_line = ""
752
877
  try:
753
878
  from src.quality_score import ContextQualityScore
754
879
  from src.governor import ContextBudget
755
- from src.metrics import MetricsTracker
756
- budget = ContextBudget.estimate(MetricsTracker(), session_id="mcp_session")
757
- q_score = ContextQualityScore.calculate(budget=budget, audit=report)
880
+ window = ContextBudget.resolve_window()
881
+ static_overhead = (
882
+ int(report.get("total_static_tokens_per_turn", 0) or 0)
883
+ + int((report.get("ghost_tokens") or {}).get("ghost_tokens_per_turn", 0) or 0)
884
+ + int((report.get("rules") or {}).get("total_tokens", 0) or 0)
885
+ )
886
+ used_pct = round(min(100.0, (static_overhead / window) * 100.0), 1) if window > 0 else 0.0
887
+ static_budget = {
888
+ "used_estimated": static_overhead,
889
+ "window_tokens": window,
890
+ "used_pct": used_pct,
891
+ }
892
+ q_score = ContextQualityScore.calculate(budget=static_budget, audit=report)
758
893
  color = "\033[32m" if q_score["grade"] in ("S", "A") else ("\033[33m" if q_score["grade"] == "B" else "\033[31m")
759
- score_line = f" \033[1mContext Quality Score:\033[0m {color}\033[1mGrade {q_score['grade']} ({q_score['label']})\033[0m — {q_score['headroom_pct']:.0f}% headroom, {q_score['score']}/100 pts\n"
894
+ score_line = (
895
+ f" \033[1mEnvironment Quality Score:\033[0m {color}\033[1mGrade {q_score['grade']} ({q_score['label']})\033[0m "
896
+ f"— {q_score['headroom_pct']:.1f}% fresh-turn headroom, {q_score['score']}/100 pts\n"
897
+ )
760
898
  except Exception:
761
899
  score_line = ""
762
900
 
@@ -784,6 +922,8 @@ class EnvironmentAuditor:
784
922
  if report["total_skills"] >= 15 and report.get("skills_breakdown"):
785
923
  for sdir, cnt in sorted(report["skills_breakdown"].items(), key=lambda kv: -kv[1])[:4]:
786
924
  lines.append(f" \033[2m• {sdir}: {cnt} skill(s)\033[0m")
925
+ if report["skills_tokens_per_turn"] >= 4000:
926
+ lines.append(" \033[36m💡 Tip: Run 'tokensafe skills list' and 'tokensafe skills disable <name>' to trim unused skills\033[0m")
787
927
 
788
928
  rules = report.get("rules") or {}
789
929
  if rules.get("files"):
@@ -824,9 +964,9 @@ class EnvironmentAuditor:
824
964
  if has_auto_fixable:
825
965
  lines.append(" ➜ Run: \033[36mtokensafe doctor --fix\033[0m to repair configs & consolidate ghost rule duplicates (with backups)")
826
966
  if report["skills_tokens_per_turn"] >= 4000:
827
- lines.append(f" ➜ Disable unused skills/plugins (currently {report['total_skills']} skills ≈ ~{report['skills_tokens_per_turn']:,} tok/turn)")
967
+ lines.append(f" ➜ Run: \033[36mtokensafe skills list\033[0m (currently {report['total_skills']} skills ≈ ~{report['skills_tokens_per_turn']:,} tok/turn; disable unused via \033[36mtokensafe skills disable <name>\033[0m)")
828
968
  if q_score.get("headroom_pct", 100.0) < 35.0:
829
- lines.append(" ➜ Run: \033[36mtokensafe compact\033[0m or start a fresh session to restore context headroom")
969
+ lines.append(" ➜ Run: \033[36mtokensafe budget\033[0m to inspect live session context usage")
830
970
  else:
831
971
  lines.append("\n \033[32m✔ Environment healthy: No critical context bloat detected.\033[0m")
832
972
 
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.5.4"
45
+ "version": "4.6.0"
46
46
  }
47
47
 
48
48
  # MCP client attribution: the initialize handshake carries clientInfo, which
@@ -2685,6 +2685,7 @@ def _dispatch_tool_call(name: str, args: dict) -> dict:
2685
2685
  details={"cmd": str(verify or "")[:100], "reason": str(res.get("error") or "")}
2686
2686
  )
2687
2687
  return _fallback_error("apply_edits", str(res.get("error") or "verify command blocked"))
2688
+ applied_files = res.get("applied_files") or []
2688
2689
  lines = []
2689
2690
  if res.get("success"):
2690
2691
  action_desc = "Validated" if dry_run else "Applied"
@@ -2713,6 +2714,31 @@ def _dispatch_tool_call(name: str, args: dict) -> dict:
2713
2714
  lines.append(f"Error: {v['error']}")
2714
2715
 
2715
2716
  out_msg = {"content": [{"type": "text", "text": "\n".join(lines)}]}
2717
+ if applied_files:
2718
+ # Dashboards must see batch edits: without this the batch editor is
2719
+ # invisible in metrics while every single-file edit is counted.
2720
+ payload_text = "".join(
2721
+ str(h.get("target") or "") + str(h.get("replacement") or "")
2722
+ for e in (edits or []) if isinstance(e, dict)
2723
+ for h in (e.get("hunks") or []) if isinstance(h, dict)
2724
+ ) + "".join(
2725
+ str(e.get("create") or "") for e in (edits or []) if isinstance(e, dict)
2726
+ )
2727
+ edit_tokens = count_tokens(payload_text)
2728
+ # Same convention as SCOPED_SEARCH: serial per-file round-trips cost
2729
+ # roughly an order of magnitude more than the consolidated payload.
2730
+ tracker.record_event(
2731
+ session_id=_mcp_session_id(),
2732
+ event_type="BATCH_EDIT",
2733
+ original_tokens=max(1500, edit_tokens * 8),
2734
+ optimized_tokens=edit_tokens,
2735
+ details={
2736
+ "files": len(applied_files),
2737
+ "hunks": sum(int(f.get("hunks") or 0) for f in applied_files),
2738
+ "dry_run": dry_run,
2739
+ "verify": bool(verify),
2740
+ },
2741
+ )
2716
2742
  if not res.get("success"):
2717
2743
  out_msg["isError"] = True
2718
2744
  return out_msg
@@ -238,11 +238,61 @@ class OUMVGateway:
238
238
  "framework": stack_info.get("backend", {}).get("framework", "None") if stack_info.get("backend") else "None",
239
239
  "tip": "Static AST analysis active. When backend DevServer starts (port 8080/8000), live OUMV auto-connects."
240
240
  },
241
+ "adapters": cls._adapter_lifecycle(stack_info, fe, be),
241
242
  "staticIntelligence": "ACTIVE (L0/L1/L2 AST observation & cross-stack linking ready)",
242
243
  "detectedStack": stack_info,
243
244
  "workspace": ws,
244
245
  }
245
246
 
247
+ @staticmethod
248
+ def _adapter_lifecycle(stack_info: Dict[str, Any], fe: Optional[Dict[str, Any]], be: Optional[Dict[str, Any]]) -> List[Dict[str, Any]]:
249
+ """Per-adapter lifecycle + health per the OUMV Adapter Contract (schemas/adapter.json)."""
250
+ adapters: List[Dict[str, Any]] = []
251
+ fe_detected = bool(stack_info.get("frontend"))
252
+ be_detected = bool(stack_info.get("backend"))
253
+ if not fe_detected and not be_detected:
254
+ return adapters
255
+
256
+ try:
257
+ from src.retrofit import get_adapters_catalog
258
+ catalog = get_adapters_catalog()
259
+ except Exception:
260
+ catalog = []
261
+
262
+ def _find_adapter(profile: str, provider: Optional[str]) -> Dict[str, Any]:
263
+ if provider:
264
+ for a in catalog:
265
+ if a.get("id") == f"{profile}/{provider}" and a.get("status") == "ready":
266
+ return a
267
+ for a in catalog:
268
+ if a.get("profile") == profile and a.get("status") == "ready":
269
+ return a
270
+ return {}
271
+
272
+ def _entry(profile: str, connected: Optional[Dict[str, Any]], detected: bool, provider: Optional[str] = None) -> Dict[str, Any]:
273
+ adapter = _find_adapter(profile, provider)
274
+ if connected:
275
+ state, health, detail = "ACTIVE", "healthy", f"Live runtime: {connected.get('name', 'unknown')}"
276
+ elif detected:
277
+ state, health, detail = "HANDSHAKE", "degraded", "Detected statically; runtime offline — hybrid static fallback active"
278
+ else:
279
+ state, health, detail = "DISCOVER", "unavailable", "Not detected in this workspace"
280
+ return {
281
+ "profile": profile,
282
+ "adapter": adapter.get("id", f"{profile}/unknown"),
283
+ "technology": adapter.get("technology"),
284
+ "capabilities": adapter.get("capabilities"),
285
+ "lifecycle": {"state": state, "health": {"status": health, "detail": detail}},
286
+ "security": {
287
+ "productionFailClosed": True,
288
+ "workspaceBoundary": True,
289
+ },
290
+ }
291
+
292
+ adapters.append(_entry("frontend", fe, fe_detected, (stack_info.get("frontend") or {}).get("provider")))
293
+ adapters.append(_entry("backend", be, be_detected, (stack_info.get("backend") or {}).get("provider")))
294
+ return adapters
295
+
246
296
  # 2. Tool: oumv_observe
247
297
  @classmethod
248
298
  def observe(cls, level: str = "L0", target: Optional[str] = None, runtime: str = "auto") -> Any:
@@ -471,9 +521,47 @@ class OUMVGateway:
471
521
  @classmethod
472
522
  def verify(cls, target: str, action: str = "invoke", payload: Optional[dict] = None, runtime: str = "auto") -> Any:
473
523
  url = cls._resolve_client_url(runtime=runtime, target=target)
474
- return cls._rpc_call(url, "oumv/verify", {
524
+ res = cls._rpc_call(url, "oumv/verify", {
475
525
  "target": target,
476
526
  "componentId": target,
477
527
  "action": action,
478
528
  "payload": payload or {},
479
529
  })
530
+ # Honest verification scope (spec §13): state exactly what was verified.
531
+ if isinstance(res, dict):
532
+ scope = res.setdefault("scope", {})
533
+ checked = scope.setdefault("checked", [])
534
+ checked_entry = "in-memory dispatch against live runtime"
535
+ if checked_entry not in checked:
536
+ checked.append(checked_entry)
537
+ scope.setdefault("notExecuted", [
538
+ "end-to-end browser flow",
539
+ "production behavior",
540
+ "full test suite",
541
+ ])
542
+ return res
543
+
544
+ # 6. Tool: oumv_graph — unified cross-stack intelligence graph (spec §11)
545
+ @classmethod
546
+ def graph(cls, query: str = "overview", target: Optional[str] = None, workspace_dir: Optional[str] = None) -> Any:
547
+ """Unified graph over static + runtime evidence, with §11.4-style queries."""
548
+ fe, be = cls.get_endpoints()
549
+ from src.cross_stack import build_unified_graph, who_depends_on, impact_from_graph
550
+
551
+ ws = workspace_dir or get_active_workspace()
552
+
553
+ q = (query or "overview").strip()
554
+ if q == "who_depends_on":
555
+ full = build_unified_graph(workspace_dir=ws, fe=fe, be=be, rpc_call=cls._rpc_call)
556
+ return who_depends_on(target or "", full)
557
+ if q == "impact":
558
+ full = build_unified_graph(workspace_dir=ws, fe=fe, be=be, rpc_call=cls._rpc_call)
559
+ return impact_from_graph(target or "", full)
560
+
561
+ g = build_unified_graph(workspace_dir=ws, fe=fe, be=be, rpc_call=cls._rpc_call)
562
+ if target:
563
+ t = target.lower()
564
+ g["nodes"] = [n for n in g["nodes"] if t in str(n).lower()][:50]
565
+ g["edges"] = [e for e in g["edges"] if t in (e["source"] + e["target"]).lower()][:50]
566
+ g["filteredBy"] = target
567
+ return g
package/src/retrofit.py CHANGED
@@ -197,57 +197,130 @@ def generate_config(
197
197
 
198
198
 
199
199
  def get_adapters_catalog() -> List[Dict[str, Any]]:
200
- """Lists available OUMV adapters in the consolidated architecture."""
200
+ """Lists available OUMV adapters in the consolidated architecture.
201
+
202
+ Each entry follows the language-neutral OUMV Adapter Contract
203
+ (agent-oumv/schemas/adapter.json): identity, technology/package,
204
+ profiles, and baseline capabilities with constraints.
205
+ """
201
206
  return [
202
207
  {
203
208
  "id": "frontend/react",
204
209
  "name": "React Adapter (Zustand, Redux, Context, useReducer)",
205
210
  "profile": "frontend",
211
+ "profiles": ["frontend"],
206
212
  "repo": "tokensafe-ui",
207
213
  "mode": "hybrid",
208
214
  "status": "ready",
209
215
  "description": "Progressive AST component discovery + runtime action/state inspection",
216
+ "technology": {
217
+ "language": "typescript",
218
+ "framework": "react",
219
+ "package": {"manager": "npm", "name": "tokensafe-ui", "install": "npm install tokensafe-ui"},
220
+ },
221
+ "capabilities": [
222
+ {"name": "observe.resources", "constraints": {"readOnly": True, "developmentOnly": False}},
223
+ {"name": "observe.runtime_state", "constraints": {"readOnly": True, "developmentOnly": True}},
224
+ {"name": "understand.impact", "constraints": {"readOnly": True, "developmentOnly": False}},
225
+ {"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": False, "requiresPermission": "permissions.mutate != false"}},
226
+ {"name": "verify.runtime_behavior", "constraints": {"readOnly": True, "developmentOnly": True}},
227
+ ],
210
228
  },
211
229
  {
212
230
  "id": "frontend/solid",
213
231
  "name": "SolidJS / TokenSafe UI Native Adapter",
214
232
  "profile": "frontend",
233
+ "profiles": ["frontend"],
215
234
  "repo": "tokensafe-ui",
216
235
  "mode": "hybrid",
217
236
  "status": "ready",
218
237
  "description": "Fine-grained reactive signals causality + virtual DOM observer",
238
+ "technology": {
239
+ "language": "typescript",
240
+ "framework": "solidjs",
241
+ "package": {"manager": "npm", "name": "tokensafe-ui", "install": "npm install tokensafe-ui"},
242
+ },
243
+ "capabilities": [
244
+ {"name": "observe.resources", "constraints": {"readOnly": True, "developmentOnly": False}},
245
+ {"name": "observe.runtime_state", "constraints": {"readOnly": True, "developmentOnly": True}},
246
+ {"name": "understand.causality", "constraints": {"readOnly": True, "developmentOnly": True}},
247
+ {"name": "understand.impact", "constraints": {"readOnly": True, "developmentOnly": False}},
248
+ {"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": False, "requiresPermission": "permissions.mutate != false"}},
249
+ {"name": "verify.runtime_behavior", "constraints": {"readOnly": True, "developmentOnly": True}},
250
+ ],
219
251
  },
220
252
  {
221
253
  "id": "frontend/vue",
222
254
  "name": "Vue 3 Adapter (Composition API, Pinia)",
223
255
  "profile": "frontend",
256
+ "profiles": ["frontend"],
224
257
  "repo": "tokensafe-ui",
225
258
  "mode": "hybrid",
226
259
  "status": "ready",
227
260
  "description": "Vue component hierarchy and store snapshot observer",
261
+ "technology": {
262
+ "language": "typescript",
263
+ "framework": "vue",
264
+ "package": {"manager": "npm", "name": "tokensafe-ui", "install": "npm install tokensafe-ui"},
265
+ },
266
+ "capabilities": [
267
+ {"name": "observe.resources", "constraints": {"readOnly": True, "developmentOnly": False}},
268
+ {"name": "observe.runtime_state", "constraints": {"readOnly": True, "developmentOnly": True}},
269
+ {"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": False, "requiresPermission": "permissions.mutate != false"}},
270
+ ],
228
271
  },
229
272
  {
230
273
  "id": "backend/go",
231
274
  "name": "Go Backend Adapter (Gin, Chi, net/http)",
232
275
  "profile": "backend",
276
+ "profiles": ["backend"],
233
277
  "repo": "tokensafe-backend/go",
234
278
  "mode": "hybrid",
235
279
  "status": "ready",
236
280
  "description": "Go AST pre-flight compiler guard + transactional DB sandbox with rollback",
281
+ "technology": {
282
+ "language": "go",
283
+ "framework": "gin/chi/net-http",
284
+ "package": {
285
+ "manager": "go",
286
+ "name": "github.com/tokensafe-dev/tokensafe-backend/go",
287
+ "install": "go get github.com/tokensafe-dev/tokensafe-backend/go",
288
+ },
289
+ },
290
+ "capabilities": [
291
+ {"name": "observe.resources", "constraints": {"readOnly": True, "developmentOnly": False}},
292
+ {"name": "observe.runtime_state", "constraints": {"readOnly": True, "developmentOnly": False}},
293
+ {"name": "understand.causality", "constraints": {"readOnly": True, "developmentOnly": False, "limitations": ["requires observed request traces (TraceHandler or oumv/verify)"]}},
294
+ {"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": False, "requiresPermission": "permissions.mutate != false"}},
295
+ {"name": "verify.runtime_behavior", "constraints": {"readOnly": True, "developmentOnly": False}},
296
+ ],
237
297
  },
238
298
  {
239
299
  "id": "backend/fastapi",
240
300
  "name": "Python FastAPI Adapter (Starlette, Pydantic)",
241
301
  "profile": "backend",
302
+ "profiles": ["backend"],
242
303
  "repo": "tokensafe-backend/python",
243
304
  "mode": "hybrid",
244
305
  "status": "ready",
245
306
  "description": "FastAPI automatic route & schema introspection + SQLAlchemy dry-run sandbox",
307
+ "technology": {
308
+ "language": "python",
309
+ "framework": "fastapi",
310
+ "package": {"manager": "pip", "name": "tokensafe-python", "install": "pip install tokensafe-python"},
311
+ },
312
+ "capabilities": [
313
+ {"name": "observe.resources", "constraints": {"readOnly": True, "developmentOnly": False}},
314
+ {"name": "understand.causality", "constraints": {"readOnly": True, "developmentOnly": False}},
315
+ {"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": False, "requiresPermission": "permissions.mutate != false"}},
316
+ {"name": "verify.runtime_behavior", "constraints": {"readOnly": True, "developmentOnly": False}},
317
+ ],
246
318
  },
247
319
  {
248
320
  "id": "backend/node",
249
321
  "name": "Node.js Backend Adapter (Express, Fastify)",
250
322
  "profile": "backend",
323
+ "profiles": ["backend"],
251
324
  "repo": "tokensafe-backend/node",
252
325
  "mode": "hybrid",
253
326
  "status": "planned",
@@ -17,7 +17,7 @@ import subprocess
17
17
  import tempfile
18
18
  from typing import Dict
19
19
 
20
- _NODE_TIMEOUT_SEC = 3.0
20
+ _NODE_TIMEOUT_SEC = 10.0
21
21
 
22
22
  _EXT_STRATEGY = {
23
23
  ".py": "python-ast",
@@ -249,7 +249,7 @@ class TelemetrySync:
249
249
  current_last_id = last_id
250
250
  headers = {
251
251
  "Content-Type": "application/json",
252
- "User-Agent": "TokenSafe-Sync/4.5.4"
252
+ "User-Agent": "TokenSafe-Sync/4.6.0"
253
253
  }
254
254
  if active_key:
255
255
  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.5.4"
20
+ CURRENT_VERSION = "4.6.0"
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