tokensafe 4.10.0 → 4.12.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.
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +35 -33
- package/kimi.plugin.json +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/rules/AGENTS.md +1 -1
- package/server.json +3 -3
- package/skills/token-optimizer/SKILL.md +1 -1
- package/src/adapter_core.py +2 -2
- package/src/auto_inject.py +25 -9
- package/src/backend_release.py +17 -0
- package/src/bench/go_target.py +18 -52
- package/src/bench/react_target.py +46 -11
- package/src/installer.py +2 -2
- package/src/mcp_server.py +1 -1
- package/src/oumv_gateway.py +1 -1
- package/src/retrofit.py +87 -5
- package/src/session_brief.py +9 -1
- package/src/telemetry_sync.py +1 -1
- package/src/version_checker.py +1 -1
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, Node/Express|Fastify, Next.js, Elysia on Bun, ASP.NET Core, or nothing supported).
|
|
218
|
+
1. **Detect** the stack (React/Vue/Solid/Angular + Vite, FastAPI, Flask, Django, Go/Gin|Chi, Node/Express|Fastify, Next.js, Elysia on Bun, ASP.NET Core, Spring, Laravel/Symfony, 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**;
|
|
@@ -249,42 +249,44 @@ Full matrix and details: [docs/OUMV.md](docs/OUMV.md).
|
|
|
249
249
|
|
|
250
250
|
## Benchmarks
|
|
251
251
|
|
|
252
|
-
### Measured agent matrix
|
|
252
|
+
### Measured agent matrix v7 (Go + React, DeepSeek — 3 tasks × 5 runs × 3 arms)
|
|
253
253
|
|
|
254
254
|
Real 12-assertion oracle re-run after every step; tokens and cost from the provider's `usage`
|
|
255
255
|
payload. `baseline` = file/search/command tools, `tokensafe` = this product's MCP server
|
|
256
256
|
(`smart_read_file(endpoint="POST /api/…")` in one call → `apply_edits` with the hunk and inline
|
|
257
|
-
`verify="auto"`), `oumv` = the OUMV
|
|
258
|
-
`applyEdit mode=patch`
|
|
259
|
-
|
|
257
|
+
`verify="auto"`), `oumv` = the OUMV runtime on wire 1.7.0 (`observe L3` returns the handler, its
|
|
258
|
+
version and the same-package callees; `applyEdit mode=patch` carries an inline `verify` probe and
|
|
259
|
+
an actionable `-32009`). The Go sandbox is the benchmark module plus **200 generated service
|
|
260
|
+
files**; the React sandbox is a TaskManager store + component whose declared `npm test` is the
|
|
261
|
+
oracle.
|
|
260
262
|
|
|
261
263
|
| Arm | Solved | Mean steps | Mean input | Mean output | Cost/run |
|
|
262
264
|
| :--- | ---: | ---: | ---: | ---: | ---: |
|
|
263
|
-
| `baseline` | 15/15 | 5.
|
|
264
|
-
| `tokensafe` | 15/15 |
|
|
265
|
-
| `oumv` | 15/15 |
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
`
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
265
|
+
| `baseline` — Go | 15/15 | 5.9 | 32,231 | 1,712 | $0.0051 |
|
|
266
|
+
| `tokensafe` — Go | 15/15 | 3.1 | 8,240 | 401 | $0.0012 |
|
|
267
|
+
| `oumv` — Go | 15/15 | **2.7** | **6,712** | 433 | **$0.0011** |
|
|
268
|
+
| `baseline` — React | 15/15 | 4.9 | 18,396 | 1,591 | $0.0033 |
|
|
269
|
+
| `tokensafe` — React | 15/15 | 4.3 | 11,971 | 507 | $0.0017 |
|
|
270
|
+
| `oumv` — React | 15/15 | **4.2** | **9,814** | 642 | $0.0016 |
|
|
271
|
+
|
|
272
|
+
**vs baseline — Go: `oumv` -79.2% input, -77.8% cost,
|
|
273
|
+
-55.1% steps; `tokensafe` -74.4%,
|
|
274
|
+
-76.4%, -48.3%.** **React: `oumv`
|
|
275
|
+
-46.7% input, -52.7% cost, -14.9%
|
|
276
|
+
steps; `tokensafe` -34.9%, -50.4%,
|
|
277
|
+
-12.2%.** Every session in both matrices solved — the v6 max-steps
|
|
278
|
+
flounder on `product-validation` is gone. On Go the protocol arm creates the fix in 2.0 calls
|
|
279
|
+
against the product arm's 3.2 and ties it on the other two tasks; on React a component has no
|
|
280
|
+
endpoint for a route slice, so the protocol arm's `getSource → patch` path wins there as well.
|
|
281
|
+
|
|
282
|
+
Full method, per-task tables, both targets, the min–max spread and the limits (one model, alias
|
|
283
|
+
drift between dates, cache-hit share):
|
|
284
|
+
[`OUMV_AGENT_MATRIX_V7.md`](https://github.com/tokensafe-dev/tokensafe-backend/blob/main/go/benchmark/OUMV_AGENT_MATRIX_V7.md)
|
|
285
|
+
in the backend repo, generated from the run JSON by `go/benchmark/render_agent_matrix.py`. The
|
|
286
|
+
previous measured run is
|
|
287
|
+
[`OUMV_AGENT_MATRIX_V5.md`](https://github.com/tokensafe-dev/tokensafe-backend/blob/main/go/benchmark/OUMV_AGENT_MATRIX_V5.md).
|
|
288
|
+
|
|
289
|
+
--- | :--- | :--- | :---: | :---: | :---: | :---: |
|
|
288
290
|
| **Frontend (UI)** | `tokensafe-ui` | React 18/19 vs. TokenSafe UI | **21.0x** | **-95%** (1.5k vs 32.5k) | **1 vs 6 turns** | Zero reactive stale closures |
|
|
289
291
|
| **Backend (Python)** | `tokensafe-python` | Vanilla FastAPI vs. TokenSafe UARP | **23.5x** | **-96%** (1.4k vs 33.3k) | **1 vs 6 turns** | 0 DB pollution (automatic rollback) |
|
|
290
292
|
| **Backend (Go)** | `tokensafe-backend` | Vanilla Gin vs. TokenSafe Backend | **24.6x** | **-96%** (1.3k vs 33.9k) | **1 vs 6 turns** | 0 DB pollution + in-memory compiler guard |
|
|
@@ -372,7 +374,7 @@ No modeling: fifteen popular repositories across 10 languages (Python, TypeScrip
|
|
|
372
374
|
| flask (Py) | Full-suite pytest output | 6,402 | 6,191 | **-3.3%** | PASS |
|
|
373
375
|
| fastapi (Py) | Git diff churn -> slice | 416 | 393 | **-5.5%** | PASS |
|
|
374
376
|
|
|
375
|
-
Aggregate: **~25.7M measured tokens saved** per traced pass over all 15 repositories in 10 languages (
|
|
377
|
+
Aggregate: **~25.7M measured tokens saved** per traced pass over all 15 repositories in 10 languages (186 gated-OK rows; input at `$3/M`, output axis at `$15/M`, KV-cache hits billed at `$0.30/M`). Clean pytest suites honestly score ~0-3% — savings are never invented. **17 gate-FAILs and 21 skips are published with reasons** on the live page (e.g. fastapi's test-output: strict warning filters escalate a `pytest-asyncio` deprecation into a pytest `INTERNALERROR`; whole-repo API surfaces bigger than hub crawls for fastapi/httpie; httpie's `core.py` refuses skeletonization — one function is most of the file). Full table + raw JSON: [docs/BENCHMARK_REAL.md](docs/BENCHMARK_REAL.md) · live page: <https://tokensafe.dev/bench> · methodology post: <https://tokensafe.dev/blog/real-repo-benchmark-5-repos>. Reproduce:
|
|
376
378
|
|
|
377
379
|
```bash
|
|
378
380
|
tokensafe bench --real # all 15 pre-registered repos
|
|
@@ -616,8 +618,8 @@ TokenSafe integrates with the [OUMV Protocol](https://github.com/tokensafe-dev/o
|
|
|
616
618
|
- **Out-of-the-Box Stack Detection**: TokenSafe automatically detects your application stack (`package.json`, `go.mod`, `pyproject.toml`, Vite, Next.js, FastAPI, Gin) and configures agent tooling dynamically.
|
|
617
619
|
- **Level 1 Static AST Fallback**: When live dev-servers are offline, `oumv_observe` and `oumv_understand` gracefully fall back to zero-config static AST component trees and route maps with evidence tracking.
|
|
618
620
|
- **Consolidated Adapters**:
|
|
619
|
-
- **Frontend**: `tokensafe-ui/react`, `tokensafe-ui/vue`, and the zero-footprint Vite bridge (`tokensafe-ui/vite`) with a session token stored in the per-workspace descriptor (`~/.tokensafe/runtimes/<hash>.json`, mode 0600).
|
|
620
|
-
- **Backend**: Go (`gin`, `chi`, `stdhttp`)
|
|
621
|
+
- **Frontend**: `tokensafe-ui/react`, `tokensafe-ui/vue`, and the zero-footprint Vite bridge (`tokensafe-ui/vite`) that also serves Solid (`--framework solid`) and Angular (`--framework angular`, Vite/Analog dev server), with a session token stored in the per-workspace descriptor (`~/.tokensafe/runtimes/<hash>.json`, mode 0600).
|
|
622
|
+
- **Backend**: Go (`gin`, `chi`, `stdhttp`), Node (`express`, `fastify`, `next`, `elysia`), Python (`fastapi`, `starlette`, `flask`, `django`), ASP.NET Core and the JDK/PHP sidecars in [`tokensafe-backend`](https://github.com/tokensafe-dev/tokensafe-backend) — eighteen manifests in the [OUMV adapter matrix](https://github.com/tokensafe-dev/oumv/blob/main/docs/ADAPTERS.md), every claim backed by a committed certificate.
|
|
621
623
|
- **Guarded Mutations, Enabled by Default**: `oumv_mutate` works out of the box on Solo and above and guards every write — mandatory OCC `expectedVersion`, workspace path jail, syntax pre-flight, backup of previous bytes. Opt out with `permissions.mutate: false` in `.tokensafe/oumv.json`.
|
|
622
624
|
- **Automatic Wiring CLI**: `tokensafe inject` activates adapters with zero repository footprint (Vite wrapper, Python autoload, one marker-delimited Go line), `tokensafe inject --revert` restores it, and `tokensafe oumv doctor` reports readiness with blocking reasons.
|
|
623
625
|
- **Greenfield Recipes**: `tokensafe create <name> --template react-fastapi|react-go|vue-gin|fastapi|gin` generates a normal project in your stack with OUMV already wired.
|
package/kimi.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokensafe",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.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": "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.
|
|
4
|
+
"version": "4.12.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.
|
|
4
|
+
"version": "4.12.0",
|
|
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/rules/AGENTS.md
CHANGED
|
@@ -45,7 +45,7 @@ Execute the specified action directly based on these extracted parameters.
|
|
|
45
45
|
- `"diff"` (`diff`): slice unified git diffs
|
|
46
46
|
- `"image"` (`image_path`, `max_edge=1024`): downscale screenshots (-50-75% vision tokens)
|
|
47
47
|
- `"compress"` (`prompt`): TOCP S-expression compression
|
|
48
|
-
7. **Universal OUMV Protocol (`oumv` — Mandatory When Supported)**: When a project uses an OUMV-supported stack (`frontend/react` Vite, `frontend/vue`, `frontend/solid`, `backend/go`, `backend/fastapi`), ALWAYS prefer `tokensafe:oumv(action="status"|"observe"|"understand"|"verify"|"mutate"|"graph", ...)` BEFORE full file crawls, raw `curl`, or headless browsers — even for read/edit tasks (static AST OUMV works offline without running dev/build). For Vite
|
|
48
|
+
7. **Universal OUMV Protocol (`oumv` — Mandatory When Supported)**: When a project uses an OUMV-supported stack (`frontend/react` Vite, `frontend/vue`, `frontend/solid`, `frontend/angular`, `backend/go`, `backend/fastapi`), ALWAYS prefer `tokensafe:oumv(action="status"|"observe"|"understand"|"verify"|"mutate"|"graph", ...)` BEFORE full file crawls, raw `curl`, or headless browsers — even for read/edit tasks (static AST OUMV works offline without running dev/build). For Vite frontends, use `tokensafe dev` to start live OUMV with zero repository footprint. In mixed monorepos (e.g. React + Node.js), inspect `oumv(action="status")` / `[TokenSafe OUMV Workspace Matrix]`: use `oumv` on supported profiles and fall back to `repo_map` + `smart_read_file` + `scoped_search` for unsupported stacks (`backend/node`). **Multi-root sessions**: the routing brief is classified per workspace root — a verdict for one repo NEVER applies to another. Before editing a repo outside the roots listed in the brief, call `tokensafe:oumv(action="status", workspace_dir="<that repo>")`; never conclude "OUMV is unavailable" from a single-root brief.
|
|
49
49
|
8. **Bounded Reads & Styles**: Never call raw `read_file` without `StartLine`/`EndLine` on files > 100 lines. `smart_read_file` preserves CSS/SCSS/Tailwind design tokens (`:root`, `@theme`) in full.
|
|
50
50
|
|
|
51
51
|
### 4. Turn Token Savings Footer (Proof-of-Savings — always in English)
|
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.
|
|
6
|
+
"version": "4.12.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.
|
|
26
|
+
"version": "4.12.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.
|
|
42
|
+
"version": "4.12.0",
|
|
43
43
|
"runtimeHint": "uvx",
|
|
44
44
|
"transport": {
|
|
45
45
|
"type": "stdio"
|
|
@@ -113,7 +113,7 @@ 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`, `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.
|
|
116
|
+
- **Mandatory When Supported (Even Without Dev/Build Running)**: If the workspace contains a supported profile (`frontend/react`, `frontend/vue`, `frontend/solid`, `frontend/angular`, `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
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
|
|
package/src/adapter_core.py
CHANGED
|
@@ -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, 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
|
|
48
|
+
"• Universal OUMV Protocol (Mandatory When Supported): If the workspace reports an OUMV-supported stack (React+Vite, Vue, Solid, Angular, 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 RPC). 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
|
|
|
@@ -529,7 +529,7 @@ def get_oumv_read_edit_advisory(workspace_dir: str, file_path: str, session_id:
|
|
|
529
529
|
f"[TokenSafe OUMV]: Live {pkg.get('provider')}/{pkg.get('framework')} OUMV runtime is active (port {live_ports[0]}). "
|
|
530
530
|
f"Prefer tokensafe:oumv(action='observe'|'understand'|'verify') for live DOM/state/causality instead of manual file crawling."
|
|
531
531
|
)
|
|
532
|
-
vite_tip = "; run 'tokensafe dev' for zero-footprint live Vite
|
|
532
|
+
vite_tip = "; run 'tokensafe dev' for zero-footprint live Vite RPC" if pkg.get("vite") else ""
|
|
533
533
|
return (
|
|
534
534
|
f"[TokenSafe OUMV]: '{os.path.basename(file_path)}' belongs to an OUMV-supported {pkg.get('provider')}/{pkg.get('framework')} stack. "
|
|
535
535
|
f"Use tokensafe:oumv(action='observe', level='L1') or oumv(action='understand', query='impact') first (works statically offline{vite_tip})."
|
package/src/auto_inject.py
CHANGED
|
@@ -28,6 +28,7 @@ import subprocess
|
|
|
28
28
|
from typing import Any, Dict, List, Optional, Tuple
|
|
29
29
|
|
|
30
30
|
from src import oumv_policy
|
|
31
|
+
from src.backend_release import BACKEND_RELEASE_TAG
|
|
31
32
|
from src.retrofit import detect_project_stack, generate_config, get_adapters_catalog
|
|
32
33
|
|
|
33
34
|
_PYHOOKS_DIRNAME = "pyhooks"
|
|
@@ -293,7 +294,7 @@ def go_patch_state(workspace: str) -> Dict[str, Any]:
|
|
|
293
294
|
_GO_MODULE = "github.com/tokensafe-dev/tokensafe-backend/go"
|
|
294
295
|
# Keep in step with the backend release tag (go/vX.Y.Z): injection must never
|
|
295
296
|
# downgrade an adapter that is already newer than this pin.
|
|
296
|
-
_GO_MODULE_VERSION =
|
|
297
|
+
_GO_MODULE_VERSION = BACKEND_RELEASE_TAG
|
|
297
298
|
|
|
298
299
|
|
|
299
300
|
def _version_tuple(tag: str):
|
|
@@ -1376,17 +1377,17 @@ def revert_dotnet_patch(workspace: str) -> Dict[str, Any]:
|
|
|
1376
1377
|
# Pinned to the backend release: the sidecars are single files, so the cache is
|
|
1377
1378
|
# content-addressed by SHA-256 and a clean machine downloads the exact bytes the
|
|
1378
1379
|
# release was certified from. Bump both the tag and the hashes together.
|
|
1379
|
-
_SIDECAR_RELEASE_TAG =
|
|
1380
|
+
_SIDECAR_RELEASE_TAG = BACKEND_RELEASE_TAG
|
|
1380
1381
|
_SIDECARS = {
|
|
1381
1382
|
"spring": (
|
|
1382
1383
|
"java/src/dev/tokensafe/oumv/OumvSpring.java",
|
|
1383
1384
|
"OumvSpring.java",
|
|
1384
|
-
"
|
|
1385
|
+
"7d228f3eedd4d401cbbef9b0722a9d215083f926ed1ef8e083c58456205595c4",
|
|
1385
1386
|
),
|
|
1386
1387
|
"php": (
|
|
1387
1388
|
"php/bin/oumv-php",
|
|
1388
1389
|
"oumv-php",
|
|
1389
|
-
"
|
|
1390
|
+
"7f2939cf909d91dbbe6cf92295e5db0141f8b3533127a7bbc59bfad3d388b8b3",
|
|
1390
1391
|
),
|
|
1391
1392
|
}
|
|
1392
1393
|
|
|
@@ -1410,10 +1411,19 @@ def sidecar_run_command(kind: str, sidecar_path: str, workspace: str) -> Optiona
|
|
|
1410
1411
|
# dispatch and observe L4 into recorded traces (wire 1.6.0).
|
|
1411
1412
|
app_url = (os.environ.get("TOKENSAFE_OUMV_APP_URL") or "").strip().rstrip("/")
|
|
1412
1413
|
dispatch = f" --app-url {app_url}" if app_url else ""
|
|
1414
|
+
# §14.2: a DSN turns on the read-only query surface; without one the sidecar
|
|
1415
|
+
# answers -32006 and never advertises the capability.
|
|
1416
|
+
db_dsn = (os.environ.get("TOKENSAFE_OUMV_DB") or "").strip()
|
|
1417
|
+
query_flag = f" --db {db_dsn}" if db_dsn else ""
|
|
1418
|
+
if (os.environ.get("TOKENSAFE_OUMV_PERMISSIONS_QUERY") or "").strip().lower() in {"false", "0", "no", "off"}:
|
|
1419
|
+
query_flag += " --no-query"
|
|
1413
1420
|
if kind == "spring":
|
|
1414
|
-
return
|
|
1421
|
+
return (
|
|
1422
|
+
f"tokensafe run-backend java {sidecar_path} --root {workspace} --port 7331"
|
|
1423
|
+
f"{read_only}{dispatch}{query_flag}"
|
|
1424
|
+
)
|
|
1415
1425
|
if kind == "php":
|
|
1416
|
-
return f"tokensafe run-backend php -S 127.0.0.1:7332 {sidecar_path} --root {workspace}"
|
|
1426
|
+
return f"tokensafe run-backend php -S 127.0.0.1:7332 {sidecar_path} --root {workspace}{query_flag}"
|
|
1417
1427
|
return None
|
|
1418
1428
|
|
|
1419
1429
|
|
|
@@ -1498,14 +1508,20 @@ def plan(workspace: str) -> Dict[str, Any]:
|
|
|
1498
1508
|
frontend = stack.get("frontend")
|
|
1499
1509
|
is_next = bool(frontend and frontend.get("framework") == "nextjs")
|
|
1500
1510
|
if frontend and not is_next:
|
|
1511
|
+
provider = str(frontend.get("provider") or "")
|
|
1512
|
+
framework = str(frontend.get("framework") or provider)
|
|
1513
|
+
# The install hint belongs to the detected adapter, not to React: Vue,
|
|
1514
|
+
# Solid and Angular each have their own catalog entry.
|
|
1515
|
+
frontend_entry = catalog.get(f"frontend/{provider}") or {}
|
|
1516
|
+
run = "tokensafe dev" if framework == "react" else f"tokensafe dev --framework {framework}"
|
|
1501
1517
|
actions.append({
|
|
1502
1518
|
"kind": "frontend_zero_footprint",
|
|
1503
1519
|
"profile": "frontend",
|
|
1504
|
-
"framework": f"{
|
|
1520
|
+
"framework": f"{provider}/{framework}",
|
|
1505
1521
|
"writes_repo": False,
|
|
1506
1522
|
"description": "served by `tokensafe dev` (inline Vite config, descriptor in ~/.tokensafe/runtimes)",
|
|
1507
|
-
"run":
|
|
1508
|
-
"install":
|
|
1523
|
+
"run": run,
|
|
1524
|
+
"install": frontend_entry.get("technology", {}).get("package", {}).get("install"),
|
|
1509
1525
|
})
|
|
1510
1526
|
if is_next:
|
|
1511
1527
|
next_state = next_patch_state(workspace)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""The backend release the engine ships against.
|
|
2
|
+
|
|
3
|
+
Every place that names a backend artifact — the `go get` pin for the Go adapter,
|
|
4
|
+
the `~/.tokensafe/sidecars` content hashes, and the brief that tells an agent how
|
|
5
|
+
to activate a backend — reads this tag, so a release bumps one string instead of
|
|
6
|
+
chasing literals that silently point at an older certified build.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
# Backend tag (`vX.Y.Z`); the Go module resolves against the matching `go/vX.Y.Z`,
|
|
12
|
+
# which the backend release workflow creates alongside it.
|
|
13
|
+
BACKEND_RELEASE_TAG = "v0.20.0"
|
|
14
|
+
|
|
15
|
+
# Wire version that tag speaks. Printed in briefs so an agent never mixes a
|
|
16
|
+
# backend release with an older protocol line.
|
|
17
|
+
BACKEND_WIRE_VERSION = "1.8.0"
|
package/src/bench/go_target.py
CHANGED
|
@@ -773,36 +773,6 @@ OUMV_TOOLS: List[Dict[str, Any]] = BASE_TOOLS + [
|
|
|
773
773
|
},
|
|
774
774
|
},
|
|
775
775
|
},
|
|
776
|
-
{
|
|
777
|
-
"type": "function",
|
|
778
|
-
"function": {
|
|
779
|
-
"name": "oumv_verify",
|
|
780
|
-
"description": "OUMV verify: dispatch a request (optionally with a JSON body) in-process and see status/body without starting a server.",
|
|
781
|
-
"parameters": {
|
|
782
|
-
"type": "object",
|
|
783
|
-
"properties": {
|
|
784
|
-
"target": {"type": "string", "description": "e.g. 'GET /api/products' or 'POST /api/orders'"},
|
|
785
|
-
"payload": {"type": "object", "description": "JSON body for POST/PUT targets"},
|
|
786
|
-
},
|
|
787
|
-
"required": ["target"],
|
|
788
|
-
},
|
|
789
|
-
},
|
|
790
|
-
},
|
|
791
|
-
{
|
|
792
|
-
"type": "function",
|
|
793
|
-
"function": {
|
|
794
|
-
"name": "oumv_understand",
|
|
795
|
-
"description": "OUMV understand: impact analysis for an endpoint target.",
|
|
796
|
-
"parameters": {
|
|
797
|
-
"type": "object",
|
|
798
|
-
"properties": {
|
|
799
|
-
"query": {"type": "string", "enum": ["impact", "causality"]},
|
|
800
|
-
"target": {"type": "string"},
|
|
801
|
-
},
|
|
802
|
-
"required": ["query", "target"],
|
|
803
|
-
},
|
|
804
|
-
},
|
|
805
|
-
},
|
|
806
776
|
]
|
|
807
777
|
|
|
808
778
|
|
|
@@ -922,28 +892,24 @@ SYSTEM_TOKENSAFE = (
|
|
|
922
892
|
)
|
|
923
893
|
|
|
924
894
|
SYSTEM_OUMV = (
|
|
925
|
-
"You are a senior Go engineer
|
|
926
|
-
"The
|
|
927
|
-
"
|
|
928
|
-
"
|
|
929
|
-
"
|
|
930
|
-
"
|
|
931
|
-
"
|
|
932
|
-
"
|
|
933
|
-
"
|
|
934
|
-
"
|
|
935
|
-
"
|
|
936
|
-
"
|
|
937
|
-
"
|
|
938
|
-
"
|
|
939
|
-
"
|
|
940
|
-
"
|
|
941
|
-
"
|
|
942
|
-
"
|
|
943
|
-
"idempotency key), use run_command with the oracle command and oumv_verify only for a single stateless "
|
|
944
|
-
"request. (5) If the verification fails, read the reported line and repeat (2)-(4). Do not fetch whole files "
|
|
945
|
-
"with getSource and do not use write_file: the patch IS the edit. Do not call list_files/read_file unless "
|
|
946
|
-
"an OUMV tool returns an error. Tests are read-only."
|
|
895
|
+
"You are a senior Go engineer in a small Go module that exposes the OUMV runtime. "
|
|
896
|
+
"The repro names the endpoint; go straight to its handler and stop when the oracle passes. "
|
|
897
|
+
"(1) oumv_observe L3 with the endpoint (\"POST /api/products\"), one call, never L2: the payload has the "
|
|
898
|
+
"handler source, its path, startLine/endLine, the OCC version, and `calls`: [{name, file, line}] for "
|
|
899
|
+
"same-package declarations it calls. "
|
|
900
|
+
"(2) If the fix is in a callee, read it once: oumv_getSource(path=<file from calls>, symbol=<name>). Use "
|
|
901
|
+
"paths exactly as the payload prints them; never strip a directory. Do not search for a name the payload "
|
|
902
|
+
"already located, and do not read the oracle or the tests. "
|
|
903
|
+
"(3) oumv_applyEdit with that path, expectedVersion, mode=\"patch\" and hunks=[{target: THE EXACT TEXT AS IT "
|
|
904
|
+
"APPEARS IN THE SLICE, the current, broken code copied verbatim with its whitespace, never the fixed code; "
|
|
905
|
+
"replacement; startLine and endLine from the slice}]. Every hunk MUST carry startLine and endLine. "
|
|
906
|
+
"(4) On -32009 the target is absent: rebuild it from error.data.nearest, error.data.occurrences or "
|
|
907
|
+
"error.data.suggestedWindow (or mode=\"symbol\" + symbol) and retry once. "
|
|
908
|
+
"(5) Verify in the same call ONLY for a stateless task: oumv_applyEdit(verify={target: <endpoint>, action: "
|
|
909
|
+
"\"probe\", payload: <from the repro>}). A task whose repro needs a second request in the same process (a "
|
|
910
|
+
"duplicate key, a retry after the first call) is stateful: inline verify probes one request and would "
|
|
911
|
+
"report a false failure there, so run the oracle with run_command instead. "
|
|
912
|
+
"Do not fetch whole files, do not use write_file, and avoid list_files/read_file. Tests are read-only."
|
|
947
913
|
)
|
|
948
914
|
|
|
949
915
|
|
|
@@ -373,8 +373,15 @@ def registry(ws: ReactWorkspace, arm: str = "baseline") -> Dict[str, Any]:
|
|
|
373
373
|
tools.update({
|
|
374
374
|
"oumv_observe": lambda level, target="": ws.oumv("oumv/observe", {"level": level, "target": target}),
|
|
375
375
|
"oumv_getSource": lambda path, symbol="": ws.oumv("oumv/getSource", {"path": path, "symbol": symbol}),
|
|
376
|
-
"oumv_applyEdit": lambda path, replacement,
|
|
377
|
-
"oumv/applyEdit",
|
|
376
|
+
"oumv_applyEdit": lambda path, expectedVersion, mode="", replacement="", hunks=None: ws.oumv(
|
|
377
|
+
"oumv/applyEdit",
|
|
378
|
+
{
|
|
379
|
+
"path": path,
|
|
380
|
+
"expectedVersion": expectedVersion,
|
|
381
|
+
**({"mode": mode} if mode else {}),
|
|
382
|
+
**({"replacement": replacement} if replacement else {}),
|
|
383
|
+
**({"hunks": hunks} if hunks else {}),
|
|
384
|
+
},
|
|
378
385
|
),
|
|
379
386
|
"oumv_understand": lambda query, target: ws.oumv("oumv/understand", {"query": query, "target": target}),
|
|
380
387
|
})
|
|
@@ -502,15 +509,40 @@ OUMV_TOOLS: List[Dict[str, Any]] = TOOLS + [
|
|
|
502
509
|
"type": "function",
|
|
503
510
|
"function": {
|
|
504
511
|
"name": "oumv_applyEdit",
|
|
505
|
-
"description":
|
|
512
|
+
"description": (
|
|
513
|
+
"OUMV guarded edit: applies only if `expectedVersion` from getSource matches the file on disk. "
|
|
514
|
+
"mode='patch' splices hunks (cheapest; the whole file is never re-sent); mode='symbol' replaces "
|
|
515
|
+
"one declaration; mode='replace' rewrites the whole file."
|
|
516
|
+
),
|
|
506
517
|
"parameters": {
|
|
507
518
|
"type": "object",
|
|
508
519
|
"properties": {
|
|
509
520
|
"path": {"type": "string"},
|
|
510
|
-
"replacement": {"type": "string"},
|
|
511
521
|
"expectedVersion": {"type": "string", "description": "sha256 version from getSource"},
|
|
522
|
+
"mode": {"type": "string", "enum": ["patch", "symbol", "replace"]},
|
|
523
|
+
"hunks": {
|
|
524
|
+
"type": "array",
|
|
525
|
+
"description": (
|
|
526
|
+
"mode='patch': exact snippets from the getSource output, applied in order. Copy "
|
|
527
|
+
"startLine/endLine from that output; without them a repeated target is -32011 and "
|
|
528
|
+
"the error carries the occurrence lines."
|
|
529
|
+
),
|
|
530
|
+
"items": {
|
|
531
|
+
"type": "object",
|
|
532
|
+
"properties": {
|
|
533
|
+
"target": {"type": "string", "description": "Exact snippet from the source on disk"},
|
|
534
|
+
"replacement": {"type": "string"},
|
|
535
|
+
"startLine": {"type": "integer", "description": "1-based first line to search, from getSource"},
|
|
536
|
+
"endLine": {"type": "integer", "description": "1-based last line to search"},
|
|
537
|
+
"replaceAll": {"type": "boolean"},
|
|
538
|
+
},
|
|
539
|
+
"required": ["target", "replacement"],
|
|
540
|
+
},
|
|
541
|
+
},
|
|
542
|
+
"replacement": {"type": "string", "description": "New content, or the declaration body for mode='symbol'"},
|
|
543
|
+
"symbol": {"type": "string", "description": "Declaration to replace when mode='symbol'"},
|
|
512
544
|
},
|
|
513
|
-
"required": ["path", "
|
|
545
|
+
"required": ["path", "expectedVersion"],
|
|
514
546
|
},
|
|
515
547
|
},
|
|
516
548
|
},
|
|
@@ -561,12 +593,15 @@ SYSTEM_TOKENSAFE = (
|
|
|
561
593
|
SYSTEM_OUMV = (
|
|
562
594
|
"You are a senior React engineer working in a small sandbox that exposes the OUMV runtime. "
|
|
563
595
|
"Use this loop and stop as soon as the oracle reports 12: (1) search_files ONCE for the behaviour named in "
|
|
564
|
-
"the repro
|
|
565
|
-
"
|
|
566
|
-
"
|
|
567
|
-
"
|
|
568
|
-
"
|
|
569
|
-
"
|
|
596
|
+
"the repro (skip it when the repro names the store or component). (2) oumv_getSource ONCE with `symbol` for "
|
|
597
|
+
"the function or method you change: it returns that body, its startLine/endLine and the sha256 OCC version. "
|
|
598
|
+
"(3) oumv_applyEdit with that path, the version and mode=\"patch\": hunks=[{target: the exact text as it "
|
|
599
|
+
"appears in that output (the current, broken code copied verbatim, never the fixed code), replacement: the "
|
|
600
|
+
"fix, startLine/endLine: the lines the target occupies in that output}]. Every hunk carries the window. "
|
|
601
|
+
"(4) On -32009 the target is absent: rebuild it from error.data.nearest, error.data.occurrences or "
|
|
602
|
+
"error.data.suggestedWindow and retry once. (5) run_command to run the oracle. Do not re-read a file you "
|
|
603
|
+
"already have in context, do not send the whole file, and do not use write_file unless an OUMV tool returns "
|
|
604
|
+
"an error. Tests and adapter.ts are read-only."
|
|
570
605
|
)
|
|
571
606
|
|
|
572
607
|
|
package/src/installer.py
CHANGED
|
@@ -60,9 +60,9 @@ 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, Express/Fastify, Next.js, Elysia on Bun, ASP.NET Core), "
|
|
63
|
+
"12. **Universal OUMV Protocol (`oumv`)**: When a workspace profile is OUMV-supported (React+Vite, Vue, Solid, Angular, 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
|
-
"static OUMV works offline on read/edit tasks too, and `tokensafe dev` starts zero-footprint live Vite
|
|
65
|
+
"static OUMV works offline on read/edit tasks too, and `tokensafe dev` starts zero-footprint live Vite 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"
|
|
67
67
|
)
|
|
68
68
|
|
package/src/mcp_server.py
CHANGED
package/src/oumv_gateway.py
CHANGED
|
@@ -535,7 +535,7 @@ class OUMVGateway:
|
|
|
535
535
|
"frontend": fe or {
|
|
536
536
|
"status": "DISCONNECTED",
|
|
537
537
|
"framework": (stack_info.get("frontend") or {}).get("framework", "None"),
|
|
538
|
-
"tip": "Static AST analysis active. Run 'tokensafe dev' (zero repo footprint) for live Vite
|
|
538
|
+
"tip": "Static AST analysis active. Run 'tokensafe dev' (zero repo footprint) for live Vite OUMV.",
|
|
539
539
|
},
|
|
540
540
|
"backend": be or ({
|
|
541
541
|
"status": "UNSUPPORTED",
|
package/src/retrofit.py
CHANGED
|
@@ -83,6 +83,21 @@ def _detect_package_json_entry(pkg_json_path: str, rel_dir: str = ".") -> Tuple[
|
|
|
83
83
|
})
|
|
84
84
|
elif "svelte" in deps:
|
|
85
85
|
fe_info.update({"framework": "svelte", "provider": "svelte", "adapter": "tokensafe-ui/core", "version": deps.get("svelte"), "oumv_supported": False, "status": "planned"})
|
|
86
|
+
elif "@angular/core" in deps:
|
|
87
|
+
# Angular has no JSX and no __file marker: components are decorated
|
|
88
|
+
# classes, discovery reads the dev build's window.ng, and the app must
|
|
89
|
+
# be served by a Vite dev server that also runs the Angular compiler.
|
|
90
|
+
# The Angular CLI dev server exposes no third-party Vite plugin hook.
|
|
91
|
+
has_analog = "@analogjs/vite-plugin-angular" in deps
|
|
92
|
+
fe_info.update({
|
|
93
|
+
"framework": "angular",
|
|
94
|
+
"provider": "angular",
|
|
95
|
+
"adapter": "tokensafe-ui/vite",
|
|
96
|
+
"version": deps.get("@angular/core"),
|
|
97
|
+
"oumv_supported": has_vite and has_analog,
|
|
98
|
+
"status": "ready" if has_vite and has_analog else "needs-vite",
|
|
99
|
+
"note": "requires the Vite dev server with @analogjs/vite-plugin-angular 3.x (Angular 20+); discovery reads the Angular dev build's window.ng, and the Angular CLI dev server (ng serve / @angular/build) is out of scope",
|
|
100
|
+
})
|
|
86
101
|
|
|
87
102
|
if "framework" in fe_info:
|
|
88
103
|
fe_out = fe_info
|
|
@@ -592,7 +607,7 @@ def get_adapters_catalog() -> List[Dict[str, Any]]:
|
|
|
592
607
|
"repo": "tokensafe-ui",
|
|
593
608
|
"mode": "hybrid",
|
|
594
609
|
"status": "ready",
|
|
595
|
-
"description": "Solid has no DOM-attached component registry, so the bridge reads the dev build's owner tree (DEV.hooks.afterCreateOwner) and strips vite-plugin-solid's [solid-refresh] prefix; the in-page bridge is generated by the shared bridge-core module
|
|
610
|
+
"description": "Solid has no DOM-attached component registry, so the bridge reads the dev build's owner tree (DEV.hooks.afterCreateOwner) and strips vite-plugin-solid's [solid-refresh] prefix; the in-page bridge is generated by the shared bridge-core module. Browser-certified 50/50 Level 3 on fixtures v19, including the three browserCases (agent-dom/certification/solid-vite-browser.json).",
|
|
596
611
|
"technology": {
|
|
597
612
|
"language": "typescript",
|
|
598
613
|
"framework": "solidjs",
|
|
@@ -607,6 +622,29 @@ def get_adapters_catalog() -> List[Dict[str, Any]]:
|
|
|
607
622
|
{"name": "verify.runtime_behavior", "constraints": {"readOnly": True, "developmentOnly": True}},
|
|
608
623
|
],
|
|
609
624
|
},
|
|
625
|
+
{
|
|
626
|
+
"id": "frontend/angular",
|
|
627
|
+
"name": "Angular + Vite Adapter (window.ng discovery, @Component scanner)",
|
|
628
|
+
"profile": "frontend",
|
|
629
|
+
"profiles": ["frontend"],
|
|
630
|
+
"repo": "tokensafe-ui",
|
|
631
|
+
"mode": "hybrid",
|
|
632
|
+
"status": "ready",
|
|
633
|
+
"description": "Angular components are decorated classes: the bridge walks the DOM and asks the dev build's window.ng for the owning component (getComponent/getOwningComponent, inputs from getDirectiveMetadata), and a static @Component scanner supplies file and class ranges. Served by the Vite dev server with @analogjs/vite-plugin-angular 3.x; the Angular CLI dev server is out of scope. Browser-certified 50/50 Level 3 on fixtures v19, read-only 27/27 (agent-dom/certification/angular-vite-browser.json).",
|
|
634
|
+
"technology": {
|
|
635
|
+
"language": "typescript",
|
|
636
|
+
"framework": "angular",
|
|
637
|
+
"package": {"manager": "npm", "name": "tokensafe-ui", "install": "npm install -D tokensafe-ui"},
|
|
638
|
+
},
|
|
639
|
+
"capabilities": [
|
|
640
|
+
{"name": "observe.resources", "constraints": {"readOnly": True, "developmentOnly": True}},
|
|
641
|
+
{"name": "understand.causality", "constraints": {"readOnly": True, "developmentOnly": True}},
|
|
642
|
+
{"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": True, "requiresPermission": "permissions.mutate != false"}},
|
|
643
|
+
{"name": "mutate.multiFile", "constraints": {"readOnly": False, "developmentOnly": True, "requiresPermission": "permissions.mutate != false"}},
|
|
644
|
+
{"name": "mutate.preview", "constraints": {"readOnly": False, "developmentOnly": True, "requiresPermission": "permissions.mutate != false"}},
|
|
645
|
+
{"name": "verify.runtime_behavior", "constraints": {"readOnly": True, "developmentOnly": True}},
|
|
646
|
+
],
|
|
647
|
+
},
|
|
610
648
|
{
|
|
611
649
|
"id": "frontend/vue",
|
|
612
650
|
"name": "Vue 3 Adapter (Composition API, Pinia)",
|
|
@@ -682,7 +720,7 @@ def get_adapters_catalog() -> List[Dict[str, Any]]:
|
|
|
682
720
|
"repo": "tokensafe-backend/python",
|
|
683
721
|
"mode": "hybrid",
|
|
684
722
|
"status": "ready",
|
|
685
|
-
"description": "Duck-typed Starlette binding: introspects Route/WebSocketRoute, serves HTTP/SSE/WebSocket from the same runtime as the FastAPI adapter, discovers a DB engine from app.state. Certified Level 3
|
|
723
|
+
"description": "Duck-typed Starlette binding: introspects Route/WebSocketRoute, serves HTTP/SSE/WebSocket from the same runtime as the FastAPI adapter, discovers a DB engine from app.state. Certified Level 3 50/50 over HTTP, 51/51 over WS and 54/54 over SSE on fixtures v19; the read-only profile certifies 29/29.",
|
|
686
724
|
"technology": {
|
|
687
725
|
"language": "python",
|
|
688
726
|
"framework": "starlette",
|
|
@@ -695,6 +733,46 @@ def get_adapters_catalog() -> List[Dict[str, Any]]:
|
|
|
695
733
|
{"name": "verify.runtime_behavior", "constraints": {"readOnly": True, "developmentOnly": False}},
|
|
696
734
|
],
|
|
697
735
|
},
|
|
736
|
+
{
|
|
737
|
+
"id": "backend/flask",
|
|
738
|
+
"name": "Python Flask Adapter (WSGI)",
|
|
739
|
+
"profile": "backend",
|
|
740
|
+
"profiles": ["backend"],
|
|
741
|
+
"repo": "tokensafe-backend/python",
|
|
742
|
+
"mode": "hybrid",
|
|
743
|
+
"status": "ready",
|
|
744
|
+
"description": "WSGI binding: wraps app.wsgi_app with POST /__oumv/rpc, discovers app.url_map routes, dispatches verify through the Flask test client and adopts a Flask-SQLAlchemy engine. HTTP only (no server-push channel). Certified Level 3 50/50 on fixtures v19; the read-only profile certifies 29/29 and the query policy 50/50.",
|
|
745
|
+
"technology": {
|
|
746
|
+
"language": "python",
|
|
747
|
+
"framework": "flask",
|
|
748
|
+
"package": {"manager": "pip", "name": "tokensafe-backend-python", "install": 'pip install "tokensafe-backend-python[flask] @ git+https://github.com/tokensafe-dev/tokensafe-backend.git#subdirectory=python"'},
|
|
749
|
+
},
|
|
750
|
+
"capabilities": [
|
|
751
|
+
{"name": "observe.resources", "constraints": {"readOnly": True, "developmentOnly": False}},
|
|
752
|
+
{"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": False, "requiresPermission": "permissions.mutate != false"}},
|
|
753
|
+
{"name": "verify.runtime_behavior", "constraints": {"readOnly": True, "developmentOnly": False}},
|
|
754
|
+
],
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"id": "backend/django",
|
|
758
|
+
"name": "Python Django Adapter (WSGI)",
|
|
759
|
+
"profile": "backend",
|
|
760
|
+
"profiles": ["backend"],
|
|
761
|
+
"repo": "tokensafe-backend/python",
|
|
762
|
+
"mode": "hybrid",
|
|
763
|
+
"status": "ready",
|
|
764
|
+
"description": "WSGI binding: wraps the Django WSGI application, walks get_resolver() for routes (GET/POST unless the view restricts them), dispatches verify through django.test.Client, and takes an explicitly passed SQLAlchemy engine. HTTP only (no server-push channel). Certified Level 3 50/50 on fixtures v19; the read-only profile certifies 29/29 and the query policy 50/50.",
|
|
765
|
+
"technology": {
|
|
766
|
+
"language": "python",
|
|
767
|
+
"framework": "django",
|
|
768
|
+
"package": {"manager": "pip", "name": "tokensafe-backend-python", "install": 'pip install "tokensafe-backend-python[django] @ git+https://github.com/tokensafe-dev/tokensafe-backend.git#subdirectory=python"'},
|
|
769
|
+
},
|
|
770
|
+
"capabilities": [
|
|
771
|
+
{"name": "observe.resources", "constraints": {"readOnly": True, "developmentOnly": False}},
|
|
772
|
+
{"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": False, "requiresPermission": "permissions.mutate != false"}},
|
|
773
|
+
{"name": "verify.runtime_behavior", "constraints": {"readOnly": True, "developmentOnly": False}},
|
|
774
|
+
],
|
|
775
|
+
},
|
|
698
776
|
{
|
|
699
777
|
"id": "backend/node",
|
|
700
778
|
"name": "Node.js Backend Adapter (Express, Fastify)",
|
|
@@ -1142,12 +1220,12 @@ def resolve_zero_footprint_vite_command(
|
|
|
1142
1220
|
cli_flags.append(f"--host={host}")
|
|
1143
1221
|
if open_browser:
|
|
1144
1222
|
cli_flags.append("--open")
|
|
1145
|
-
# `dev` defaults to React;
|
|
1146
|
-
# React controller and bridge.
|
|
1223
|
+
# `dev` defaults to React; any other framework must say so explicitly or it
|
|
1224
|
+
# gets the React controller and bridge.
|
|
1147
1225
|
stack = detect_project_stack(ws)
|
|
1148
1226
|
frontend = stack.get("frontend") or {}
|
|
1149
1227
|
framework = frontend.get("framework") if isinstance(frontend, dict) else None
|
|
1150
|
-
if framework in ("react", "vue"):
|
|
1228
|
+
if framework in ("react", "vue", "solid", "angular"):
|
|
1151
1229
|
cli_flags.append(f"--framework={framework}")
|
|
1152
1230
|
|
|
1153
1231
|
resolved = resolve_tokensafe_ui_cli(ws)
|
|
@@ -1265,6 +1343,10 @@ def is_path_in_supported_oumv_scope(workspace_dir: str, file_path: str, use_cach
|
|
|
1265
1343
|
if role == "frontend":
|
|
1266
1344
|
if ext in (".tsx", ".jsx", ".vue"):
|
|
1267
1345
|
return pkg
|
|
1346
|
+
# Angular components are .ts and their templates are .html; both
|
|
1347
|
+
# belong to the frontend that owns them.
|
|
1348
|
+
if ext == ".html" and pkg.get("provider") == "angular":
|
|
1349
|
+
return pkg
|
|
1268
1350
|
if ext in (".ts", ".js"):
|
|
1269
1351
|
# A repository-root frontend also owns scripts/, configs and
|
|
1270
1352
|
# tooling in .ts/.js; only nudge files under source-like dirs.
|
package/src/session_brief.py
CHANGED
|
@@ -16,6 +16,8 @@ import json
|
|
|
16
16
|
import os
|
|
17
17
|
from typing import Any, Dict, List, Optional
|
|
18
18
|
|
|
19
|
+
from src.backend_release import BACKEND_RELEASE_TAG
|
|
20
|
+
|
|
19
21
|
MAX_BRIEF_CHARS = 1200
|
|
20
22
|
|
|
21
23
|
_FRONTEND_LINES = {
|
|
@@ -29,6 +31,12 @@ _FRONTEND_LINES = {
|
|
|
29
31
|
"(zero repo footprint, L0-L4, OCC edits; certified L3 in a browser). Call "
|
|
30
32
|
"tokensafe:oumv(action='observe', level='L1') before reading files."
|
|
31
33
|
),
|
|
34
|
+
"angular": (
|
|
35
|
+
"frontend angular/{framework}: OUMV live via `tokensafe dev --framework angular` "
|
|
36
|
+
"on the Vite/Analog dev server (window.ng discovery, L0-L4, OCC edits; certified "
|
|
37
|
+
"L3 in a browser). Call tokensafe:oumv(action='observe', level='L1') before "
|
|
38
|
+
"reading files; `ng serve` is out of scope."
|
|
39
|
+
),
|
|
32
40
|
"vue": (
|
|
33
41
|
"frontend {provider}/{framework}: OUMV live via `tokensafe dev --framework vue` "
|
|
34
42
|
"(zero repo footprint, L0-L4, OCC edits; certified L3 in a browser). Call "
|
|
@@ -216,7 +224,7 @@ def _activation(workspace: str, stack: Dict[str, Any]) -> List[str]:
|
|
|
216
224
|
hints.append('activate backend: `pip install "tokensafe-backend-python @ git+https://github.com/tokensafe-dev/tokensafe-backend.git#subdirectory=python"` then run the server via `tokensafe run-backend ...`')
|
|
217
225
|
elif item.get("provider") == "go":
|
|
218
226
|
hints.append(
|
|
219
|
-
"activate backend: `go get github.com/tokensafe-dev/tokensafe-backend/go@
|
|
227
|
+
f"activate backend: `go get github.com/tokensafe-dev/tokensafe-backend/go@{BACKEND_RELEASE_TAG}` "
|
|
220
228
|
"then `tokensafe inject` (one line, reversible)"
|
|
221
229
|
)
|
|
222
230
|
if not hints and not readiness:
|
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.
|
|
314
|
+
"User-Agent": "TokenSafe-Sync/4.12.0"
|
|
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.
|
|
20
|
+
CURRENT_VERSION = "4.12.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
|