tokensafe 4.7.15 → 4.7.16

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.15",
2
+ "version": "4.7.16",
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/README.md CHANGED
@@ -215,7 +215,7 @@ Deeper mechanics (language matrix, AST syntax trees, cache tiers, governor) live
215
215
 
216
216
  You install TokenSafe, open a project in your agent, and the first turn does the wiring:
217
217
 
218
- 1. **Detect** the stack (React/Vue + Vite, FastAPI, Go/Gin|Chi, or nothing supported).
218
+ 1. **Detect** the stack (React/Vue + Vite, FastAPI, Go/Gin|Chi, Node/Express|Fastify, Next.js, Elysia on Bun, ASP.NET Core, or nothing supported).
219
219
  2. **Activate** the adapters:
220
220
  * frontend — `tokensafe dev` serves OUMV from an inline Vite config; **no file in the
221
221
  repository changes**;
@@ -226,7 +226,9 @@ You install TokenSafe, open a project in your agent, and the first turn does the
226
226
  * Node (Express/Fastify) — one `mountTokensafe(app)` / `registerTokensafe(app)` line, same
227
227
  markers and byte-exact revert; ASP.NET Core — one `AddTokensafe()`/`UseTokensafe()` pair;
228
228
  * Next.js (App Router) — one generated `app/api/tokensafe/route.ts` Route Handler
229
- (`createNextRouteHandlers`), server profile; `--revert` deletes the file.
229
+ (`createNextRouteHandlers`), server profile; `--revert` deletes the file;
230
+ * Elysia (Bun) — one `app.use(oumv())` line before `app.listen()`
231
+ (`tokensafe-backend-node/elysia`), same markers and byte-exact revert.
230
232
  3. **Brief the agent** — a short routing block (hook context and MCP `instructions`) says which
231
233
  stack is worked through OUMV and which through the TokenSafe tools. Nothing is written into
232
234
  the repository by the brief.
package/kimi.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokensafe",
3
- "version": "4.7.15",
3
+ "version": "4.7.16",
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.15",
4
+ "version": "4.7.16",
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.15",
4
+ "version": "4.7.16",
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.15",
6
+ "version": "4.7.16",
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.15",
26
+ "version": "4.7.16",
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.15",
42
+ "version": "4.7.16",
43
43
  "runtimeHint": "uvx",
44
44
  "transport": {
45
45
  "type": "stdio"
@@ -113,9 +113,9 @@ TokenSafe actively maximizes provider KV-cache hit rates alongside token compres
113
113
  TokenSafe integrates the **Universal Agent-Runtime Protocol (UARP / OUMV)** to inspect, reason about, edit, and verify Frontend (`tokensafe-ui`, React 18/19 + Vite, Vue 3) and Backend (`Go` Gin/Chi/net-http, `FastAPI`) services without heavy headless browsers or unconstrained shell curls.
114
114
 
115
115
  ### OUMV-First Policy, Zero-Footprint & Mixed Monorepos
116
- - **Mandatory When Supported (Even Without Dev/Build Running)**: If the workspace contains a supported profile (`frontend/react`, `frontend/vue`, `frontend/solid`, `backend/go`, `backend/fastapi`), prefer `tokensafe:oumv` (`status` -> `observe` L0/L1/L2 -> `understand` impact -> `mutate` -> `verify`) BEFORE brute-force reading components or running `curl`/browsers. Static OUMV works offline even when the agent only reads and edits files.
116
+ - **Mandatory When Supported (Even Without Dev/Build Running)**: If the workspace contains a supported profile (`frontend/react`, `frontend/vue`, `frontend/solid`, `backend/go`, `backend/fastapi`, `backend/node` (Express/Fastify/Next.js), `backend/elysia`, `backend/aspnetcore`), prefer `tokensafe:oumv` (`status` -> `observe` L0/L1/L2 -> `understand` impact -> `mutate` -> `verify`) BEFORE brute-force reading components or running `curl`/browsers. Static OUMV works offline even when the agent only reads and edits files.
117
117
  - **Zero-Footprint Vite+React (`tokensafe dev`)**: Running `tokensafe dev` (or `vite` / `npm run dev` rewritten automatically by `CommandSanitizer`) starts the project's Vite+React DevServer with `tokensafeReact()` injected in memory and runtime state stored under `~/.tokensafe/runtimes/<hash>.json` (sidecar L2 contracts in `~/.tokensafe/contracts/<hash>.json`) — leaving **0 modified/untracked files** in the repository.
118
- - **Monorepo Capability Boundaries**: In mixed monorepos (e.g., `apps/web` in React + `apps/api` in Node.js/Express), check `oumv(action="status")` or `[TokenSafe OUMV Workspace Matrix]`. Use `tokensafe:oumv(runtime="frontend")` for React, and use `repo_map` + `smart_read_file` + `scoped_search` + normal tests for unsupported backends like `backend/node` (`status: planned`).
118
+ - **Monorepo Capability Boundaries**: In mixed monorepos (e.g., `apps/web` in React + `apps/api` in Node.js/Express), check `oumv(action="status")` or `[TokenSafe OUMV Workspace Matrix]`. Use `tokensafe:oumv(runtime="frontend")` for React, and use `repo_map` + `smart_read_file` + `scoped_search` + normal tests for packages `oumv status` marks unsupported (Nest/Hono/Koa, a Bun worker with no HTTP server).
119
119
 
120
120
  1. **LIVE RUNTIME HEALTH (`oumv(action="status")`)**:
121
121
  - Call `tokensafe:oumv(action="status")` to inspect connection status and capabilities of running DevServers (Frontend ports 5173/3000, Backend ports 8080/8000).
@@ -45,7 +45,7 @@ TOKENSAFE_DIRECTIVES = (
45
45
  "• When context budget reports warning/critical or Grade C/F: call 'tokensafe:session_context(action=\"compact\", transcript_path=...)' to fold history before continuing.\n"
46
46
  "• Prohibited File Edits: NEVER use 'sed -i', 'perl -i', or stream editors to modify source files; ALWAYS use 'edit_file' with exact string targets. NEVER suppress errors with '2>/dev/null'.\n"
47
47
  "• Prefer 'edit_file' over 'write_file' for existing files.\n"
48
- "• Universal OUMV Protocol (Mandatory When Supported): If the workspace reports an OUMV-supported stack (React+Vite, Vue, Solid, Go, FastAPI), ALWAYS prefer the 'oumv' MCP tool (status/observe/understand/verify) before full file crawls, raw curl, or browser checks — even when only reading/editing files (static AST OUMV works offline; use 'tokensafe dev' for zero-footprint live Vite+React). Check capability boundaries in mixed monorepos (for unsupported stacks like backend/node Express/Fastify/Nest, use repo_map/smart_read_file/scoped_search).\n"
48
+ "• Universal OUMV Protocol (Mandatory When Supported): If the workspace reports an OUMV-supported stack (React+Vite, Vue, Solid, Go, FastAPI, Express/Fastify, Next.js, Elysia on Bun, ASP.NET Core), ALWAYS prefer the 'oumv' MCP tool (status/observe/understand/verify) before full file crawls, raw curl, or browser checks — even when only reading/editing files (static AST OUMV works offline; use 'tokensafe dev' for zero-footprint live Vite+React). Check capability boundaries in mixed monorepos (for unsupported stacks like backend/node Express/Fastify/Nest, use repo_map/smart_read_file/scoped_search).\n"
49
49
  "• Multi-Root Sessions: the OUMV routing brief is classified PER workspace root (hosts that report several folders get every root listed). A single-root verdict never describes another repo — before editing a repo outside the listed roots, call 'oumv' with workspace_dir='<that repo>'; never conclude 'OUMV is unavailable' from one root's line."
50
50
  )
51
51
 
@@ -489,7 +489,7 @@ def _gc_oumv_markers(data_dir: str) -> None:
489
489
 
490
490
  def get_oumv_read_edit_advisory(workspace_dir: str, file_path: str, session_id: str = "") -> Optional[str]:
491
491
  """One-shot per-session advisory when reading/editing files inside an OUMV-supported stack
492
- (React+Vite, Vue, Solid, Go, FastAPI) without having called `tokensafe:oumv` recently.
492
+ (React+Vite, Vue, Solid, Go, FastAPI, Express/Fastify, Next.js, Elysia on Bun, ASP.NET Core) without having called `tokensafe:oumv` recently.
493
493
 
494
494
  Returns None immediately for unsupported stacks in mixed monorepos (e.g. backend/node),
495
495
  when OUMV was already used in this workspace, or if already nudged in this session.
@@ -558,7 +558,7 @@ def revert_go_patch(workspace: str) -> Dict[str, Any]:
558
558
  # --------------------------------------------------------------------------- #
559
559
 
560
560
  def _find_node_entrypoint(workspace: str) -> Optional[str]:
561
- """Finds the Node entry file that creates the framework app."""
561
+ """Finds the Node/Bun entry file that creates the framework app."""
562
562
  candidates: List[str] = []
563
563
  pkg_path = os.path.join(workspace, "package.json")
564
564
  try:
@@ -569,7 +569,11 @@ def _find_node_entrypoint(workspace: str) -> Optional[str]:
569
569
  candidates.append(main)
570
570
  except Exception:
571
571
  pass
572
- candidates += ["src/index.js", "src/server.js", "src/app.js", "index.js", "server.js", "app.js"]
572
+ candidates += [
573
+ "src/index.js", "src/server.js", "src/app.js", "index.js", "server.js", "app.js",
574
+ # Bun/Elysia projects are TypeScript: `bun --watch src/index.ts` is the default script.
575
+ "src/index.ts", "src/server.ts", "src/app.ts", "index.ts", "server.ts", "app.ts",
576
+ ]
573
577
  for rel in candidates:
574
578
  path = os.path.join(workspace, rel)
575
579
  if os.path.isfile(path):
@@ -584,6 +588,9 @@ def _node_framework_of(workspace: str) -> Optional[str]:
584
588
  deps = {**(pkg.get("dependencies") or {}), **(pkg.get("devDependencies") or {})}
585
589
  except Exception:
586
590
  return None
591
+ # Elysia implies Bun; a project that has both should get the Bun mount.
592
+ if "elysia" in deps:
593
+ return "elysia"
587
594
  if "fastify" in deps:
588
595
  return "fastify"
589
596
  if "express" in deps:
@@ -681,6 +688,111 @@ def revert_node_patch(workspace: str) -> Dict[str, Any]:
681
688
  return {"status": "reverted", "entrypoint": os.path.relpath(entrypoint, workspace)}
682
689
 
683
690
 
691
+ def _elysia_app_reference(source: str) -> Optional[Tuple[str, str, int]]:
692
+ """(var, indent, insert_at) for the `.use(oumv())` line: before `listen` when present.
693
+
694
+ Elysia apps are usually a `.use(...)` chain ending in `app.listen(...)`. Injecting
695
+ before `listen` keeps the chain intact and runs after every route plugin, so the
696
+ route table `onStart` reads is complete. A file that exports the app without
697
+ listening falls back to the `new Elysia()` assignment.
698
+ """
699
+ listen = re.search(r"(?m)^(?P<indent>[ \t]*)(?P<var>[A-Za-z_$][\w$]*)\.listen\(", source)
700
+ if listen:
701
+ return listen.group("var"), listen.group("indent"), listen.start()
702
+ created = re.search(
703
+ r"(?m)^(?P<indent>[ \t]*)(?:export\s+)?(?:const|let|var)\s+(?P<var>[A-Za-z_$][\w$]*)"
704
+ r"\s*=\s*new\s+Elysia\([^)]*\)[ \t]*;?[ \t]*$",
705
+ source,
706
+ )
707
+ if not created:
708
+ return None
709
+ line_end = source.find("\n", created.end())
710
+ insert_at = len(source) if line_end < 0 else line_end + 1
711
+ return created.group("var"), created.group("indent"), insert_at
712
+
713
+
714
+ def elysia_patch_state(workspace: str) -> Dict[str, Any]:
715
+ path = _find_node_entrypoint(workspace)
716
+ if not path or _node_framework_of(workspace) != "elysia":
717
+ return {"entrypoint": None, "patched": False, "framework": _node_framework_of(workspace)}
718
+ try:
719
+ with open(path, "r", encoding="utf-8") as f:
720
+ source = f.read()
721
+ except OSError:
722
+ source = ""
723
+ return {
724
+ "entrypoint": os.path.relpath(path, workspace),
725
+ "patched": _MARK_BEGIN in source and _MARK_END in source,
726
+ "framework": "elysia",
727
+ }
728
+
729
+
730
+ def apply_elysia_patch(workspace: str, dry_run: bool = False) -> Dict[str, Any]:
731
+ """Adds `app.use(oumv())` to an Elysia app, with a byte-exact backup."""
732
+ if _node_framework_of(workspace) != "elysia":
733
+ return {"status": "skipped", "reason": "no Elysia dependency in package.json"}
734
+ path = _find_node_entrypoint(workspace)
735
+ if not path:
736
+ return {"status": "skipped", "reason": "no Bun entrypoint found"}
737
+
738
+ with open(path, "r", encoding="utf-8") as f:
739
+ source = f.read()
740
+ if _MARK_BEGIN in source:
741
+ return {"status": "already_patched", "entrypoint": os.path.relpath(path, workspace)}
742
+
743
+ ref = _elysia_app_reference(source)
744
+ if not ref:
745
+ return {
746
+ "status": "skipped",
747
+ "reason": f"could not find `new Elysia(...)` or `<app>.listen(...)` in {os.path.relpath(path, workspace)}",
748
+ }
749
+ var, indent, insert_at = ref
750
+ mount = (
751
+ f"{indent}{_MARK_BEGIN}\n"
752
+ f"{indent}const {{ oumv: _oumv }} = require('tokensafe-backend-node/elysia');\n"
753
+ f"{indent}{var}.use(_oumv());\n"
754
+ f"{indent}{_MARK_END}\n"
755
+ )
756
+ patched = source[:insert_at] + mount + source[insert_at:]
757
+
758
+ if dry_run:
759
+ return {
760
+ "status": "dry_run",
761
+ "entrypoint": os.path.relpath(path, workspace),
762
+ "framework": "elysia",
763
+ "preview": f"{var}.use(_oumv());",
764
+ }
765
+
766
+ backup_dir = _inject_dir(workspace)
767
+ os.makedirs(backup_dir, exist_ok=True)
768
+ backup_path = os.path.join(backup_dir, os.path.relpath(path, workspace).replace(os.sep, "__") + ".bak")
769
+ shutil.copy2(path, backup_path)
770
+ with open(path, "w", encoding="utf-8") as f:
771
+ f.write(patched)
772
+ _write_manifest(workspace, "elysia", {"entrypoint": path, "backup": backup_path, "framework": "elysia"})
773
+ return {
774
+ "status": "patched",
775
+ "entrypoint": os.path.relpath(path, workspace),
776
+ "framework": "elysia",
777
+ "mode": "elysia_plugin",
778
+ "backup": backup_path,
779
+ "line": f"{var}.use(_oumv());",
780
+ }
781
+
782
+
783
+ def revert_elysia_patch(workspace: str) -> Dict[str, Any]:
784
+ manifest = _read_manifest(workspace, "elysia", ("elysia_plugin",))
785
+ if manifest is None:
786
+ return {"status": "clean", "reason": "no Elysia patch manifest"}
787
+ entrypoint = manifest.get("entrypoint")
788
+ backup = manifest.get("backup")
789
+ if not (entrypoint and backup and os.path.isfile(backup)):
790
+ return {"status": "error", "reason": "backup missing; restore manually"}
791
+ shutil.copy2(backup, entrypoint)
792
+ _delete_manifest(manifest)
793
+ return {"status": "reverted", "entrypoint": os.path.relpath(entrypoint, workspace)}
794
+
795
+
684
796
 
685
797
  # Next.js App Router: the adapter is a Route Handler created by the npm package.
686
798
  # Nothing is patched inside app components — one generated file mounts the
@@ -1169,6 +1281,7 @@ def plan(workspace: str) -> Dict[str, Any]:
1169
1281
  "fastapi": "backend/fastapi",
1170
1282
  "go": "backend/go",
1171
1283
  "node": "backend/node",
1284
+ "elysia": "backend/elysia",
1172
1285
  "spring": "backend/spring",
1173
1286
  "php": "backend/php",
1174
1287
  "dotnet": "backend/aspnetcore",
@@ -1197,6 +1310,18 @@ def plan(workspace: str) -> Dict[str, Any]:
1197
1310
  "description": "one AutoMount() line between tokensafe markers; byte-exact backup + --revert",
1198
1311
  "install": install,
1199
1312
  })
1313
+ elif provider == "elysia":
1314
+ state = elysia_patch_state(workspace)
1315
+ actions.append({
1316
+ "kind": "elysia_plugin_patch",
1317
+ "profile": "backend",
1318
+ "framework": "elysia",
1319
+ "writes_repo": True,
1320
+ "already_patched": state["patched"],
1321
+ "entrypoint": state["entrypoint"],
1322
+ "description": "one app.use(oumv()) line before app.listen() between tokensafe markers; byte-exact backup + --revert",
1323
+ "install": install or "bun add tokensafe-backend-node",
1324
+ })
1200
1325
  elif provider == "node":
1201
1326
  state = node_patch_state(workspace)
1202
1327
  actions.append({
@@ -1292,6 +1417,8 @@ def apply(workspace: str, dry_run: bool = False, include_go: bool = True) -> Dic
1292
1417
 
1293
1418
  if backend.get("provider") == "go" and include_go:
1294
1419
  results["actions"].append({"kind": "go_one_line_patch", **apply_go_patch(workspace, dry_run=dry_run)})
1420
+ elif backend.get("provider") == "elysia":
1421
+ results["actions"].append({"kind": "elysia_plugin_patch", **apply_elysia_patch(workspace, dry_run=dry_run)})
1295
1422
  elif backend.get("provider") == "node":
1296
1423
  results["actions"].append({"kind": "node_one_line_patch", **apply_node_patch(workspace, dry_run=dry_run)})
1297
1424
  elif backend.get("provider") == "dotnet":
@@ -1314,6 +1441,7 @@ def revert(workspace: str) -> Dict[str, Any]:
1314
1441
  "workspace": workspace,
1315
1442
  "go": revert_go_patch(workspace),
1316
1443
  "node": revert_node_patch(workspace),
1444
+ "elysia": revert_elysia_patch(workspace),
1317
1445
  "dotnet": revert_dotnet_patch(workspace),
1318
1446
  "next": revert_next_patch(workspace),
1319
1447
  }
package/src/installer.py CHANGED
@@ -60,7 +60,7 @@ UNIFIED_TOKENSAFE_RULE = (
60
60
  "`🛡️ **TokenSafe Security Guard**: Prevented secret / private key leak into git (<target_file>: <details>)`\n"
61
61
  "11. **Proof-of-Savings Turn Footer (strictly English)**: Append on tool-using turns:\n"
62
62
  "`⚡ **TokenSafe Turn Savings**: +<tokens> tokens saved on this turn (<breakdown in English>) | Cumulative Total: <total> tokens (≈$<usd> approx)`\n"
63
- "12. **Universal OUMV Protocol (`oumv`)**: When a workspace profile is OUMV-supported (React+Vite, Vue, Solid, Go, FastAPI), "
63
+ "12. **Universal OUMV Protocol (`oumv`)**: When a workspace profile is OUMV-supported (React+Vite, Vue, Solid, Go, FastAPI, Express/Fastify, Next.js, Elysia on Bun, ASP.NET Core), "
64
64
  "ALWAYS prefer `tokensafe:oumv(action='status'|'observe'|'understand'|'verify'|'mutate'|'graph', ...)` BEFORE full file crawls, raw curls, or browser checks — "
65
65
  "static OUMV works offline on read/edit tasks too, and `tokensafe dev` starts zero-footprint live Vite+React RPC without touching repo files. "
66
66
  "In mixed monorepos (e.g. React + Node.js), use `oumv` on supported profiles and `repo_map`/`smart_read_file`/`scoped_search` on unsupported stacks (e.g. `backend/node`).\n"
package/src/mcp_server.py CHANGED
@@ -44,7 +44,7 @@ from src.session_context import current_root, current_session_id
44
44
 
45
45
  SERVER_INFO = {
46
46
  "name": "tokensafe-mcp",
47
- "version": "4.7.15"
47
+ "version": "4.7.16"
48
48
  }
49
49
 
50
50
  # MCP client attribution: the initialize handshake carries clientInfo, which
package/src/retrofit.py CHANGED
@@ -105,15 +105,17 @@ def _detect_package_json_entry(pkg_json_path: str, rel_dir: str = ".") -> Tuple[
105
105
  managers.append("bun")
106
106
 
107
107
  if node_fw:
108
- supported_fw = node_fw in ("express", "fastify")
108
+ is_elysia = node_fw == "elysia"
109
+ supported_fw = node_fw in ("express", "fastify", "elysia")
109
110
  be_out = {
110
111
  "framework": node_fw,
111
- "provider": "bun" if node_fw == "elysia" else "node",
112
- "adapter": None if node_fw == "elysia" else "tokensafe-backend/node",
113
- "language": "bun" if node_fw == "elysia" else "node",
112
+ "provider": "elysia" if is_elysia else "node",
113
+ "adapter": "tokensafe-backend/elysia" if is_elysia else "tokensafe-backend/node",
114
+ "language": "bun" if is_elysia else "node",
114
115
  "root": rel_dir,
115
- # Express/Fastify ship a certified adapter (npm tokensafe-backend-node);
116
- # Elysia/Nest/Hono/Koa do not yet.
116
+ # Express/Fastify ship the certified Node adapter; Elysia ships on the
117
+ # `tokensafe-backend-node/elysia` subpath and is certified L3 on Bun.
118
+ # Nest/Hono/Koa do not yet.
117
119
  "oumv_supported": supported_fw,
118
120
  "status": "ready" if supported_fw else "planned",
119
121
  }
@@ -679,6 +681,34 @@ def get_adapters_catalog() -> List[Dict[str, Any]]:
679
681
  {"name": "verify.behavior", "constraints": {"readOnly": True, "developmentOnly": True}},
680
682
  ],
681
683
  },
684
+ {
685
+ "id": "backend/elysia",
686
+ "name": "Elysia Adapter for Bun (HTTP + SSE + WebSocket)",
687
+ "profile": "backend",
688
+ "profiles": ["backend"],
689
+ "repo": "tokensafe-backend/node",
690
+ "mode": "hybrid",
691
+ "status": "ready",
692
+ "description": "Elysia plugin on Bun: the runtime mounts as a Web Request/Response binding, the route table is read from the composed app, verify dispatches through app.handle, and read-only mode registers no mutating method (certified Level 3: HTTP 51/51, SSE 52/52, WS 49/49)",
693
+ "technology": {
694
+ "language": "typescript",
695
+ "framework": "elysia (bun)",
696
+ "package": {"manager": "bun", "name": "tokensafe-backend-node", "install": "bun add tokensafe-backend-node"},
697
+ },
698
+ "capabilities": [
699
+ {"name": "observe.pulse", "constraints": {"readOnly": True, "developmentOnly": True}},
700
+ {"name": "observe.surface", "constraints": {"readOnly": True, "developmentOnly": True}},
701
+ {"name": "observe.contract", "constraints": {"readOnly": True, "developmentOnly": True}},
702
+ {"name": "observe.source", "constraints": {"readOnly": True, "developmentOnly": True}},
703
+ {"name": "observe.traces", "constraints": {"readOnly": True, "developmentOnly": True}},
704
+ {"name": "understand.impact", "constraints": {"readOnly": True, "developmentOnly": True}},
705
+ {"name": "understand.causality", "constraints": {"readOnly": True, "developmentOnly": True}},
706
+ {"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": True, "requiresPermission": "permissions.mutate != false"}},
707
+ {"name": "verify.behavior", "constraints": {"readOnly": True, "developmentOnly": True}},
708
+ {"name": "verify.sandboxRollback", "constraints": {"readOnly": True, "developmentOnly": True, "limitations": ["the adopter supplies sandbox.db.run (e.g. bun:sqlite)"]}},
709
+ {"name": "index.symbols", "constraints": {"readOnly": True, "developmentOnly": True}},
710
+ ],
711
+ },
682
712
  {
683
713
  "id": "backend/next",
684
714
  "name": "Next.js App Router Adapter (Route Handler, server profile)",
@@ -1184,8 +1214,8 @@ def is_path_in_supported_oumv_scope(workspace_dir: str, file_path: str, use_cach
1184
1214
  if role == "backend":
1185
1215
  if ext in (".go", ".py"):
1186
1216
  return pkg
1187
- # Express/Fastify adapters ship from npm; their sources are in scope.
1188
- if pkg.get("provider") == "node" and ext in (".js", ".ts", ".mjs", ".cjs", ".jsx", ".tsx"):
1217
+ # Express/Fastify/Elysia adapters ship from npm; their sources are in scope.
1218
+ if pkg.get("provider") in ("node", "elysia") and ext in (".js", ".ts", ".mjs", ".cjs", ".jsx", ".tsx"):
1189
1219
  return pkg
1190
1220
  return None
1191
1221
  return None
@@ -48,6 +48,11 @@ _BACKEND_LINES = {
48
48
  "(`mountTokensafe(app)` for Express, `registerTokensafe(app)` for Fastify); "
49
49
  "then use tokensafe:oumv for endpoints/impact and oumv_verify for live checks."
50
50
  ),
51
+ "elysia": (
52
+ "backend elysia/{framework} (Bun): install `tokensafe-backend-node` and add "
53
+ "`app.use(require('tokensafe-backend-node/elysia').oumv())` before `app.listen()`; "
54
+ "then use tokensafe:oumv for endpoints/impact and oumv_verify for live checks."
55
+ ),
51
56
  }
52
57
 
53
58
 
@@ -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.15"
314
+ "User-Agent": "TokenSafe-Sync/4.7.16"
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.15"
20
+ CURRENT_VERSION = "4.7.16"
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