tokensafe 4.10.0 → 4.11.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 +32 -30
- package/kimi.plugin.json +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/server.json +3 -3
- package/src/auto_inject.py +16 -6
- 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/mcp_server.py +1 -1
- package/src/retrofit.py +41 -1
- package/src/session_brief.py +3 -1
- package/src/telemetry_sync.py +1 -1
- package/src/version_checker.py +1 -1
package/README.md
CHANGED
|
@@ -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
|
package/kimi.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokensafe",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.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.11.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.11.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/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.11.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.11.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.11.0",
|
|
43
43
|
"runtimeHint": "uvx",
|
|
44
44
|
"transport": {
|
|
45
45
|
"type": "stdio"
|
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
|
|
|
@@ -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/mcp_server.py
CHANGED
package/src/retrofit.py
CHANGED
|
@@ -682,7 +682,7 @@ def get_adapters_catalog() -> List[Dict[str, Any]]:
|
|
|
682
682
|
"repo": "tokensafe-backend/python",
|
|
683
683
|
"mode": "hybrid",
|
|
684
684
|
"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
|
|
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 50/50 over HTTP, 51/51 over WS and 54/54 over SSE on fixtures v19; the read-only profile certifies 29/29.",
|
|
686
686
|
"technology": {
|
|
687
687
|
"language": "python",
|
|
688
688
|
"framework": "starlette",
|
|
@@ -695,6 +695,46 @@ def get_adapters_catalog() -> List[Dict[str, Any]]:
|
|
|
695
695
|
{"name": "verify.runtime_behavior", "constraints": {"readOnly": True, "developmentOnly": False}},
|
|
696
696
|
],
|
|
697
697
|
},
|
|
698
|
+
{
|
|
699
|
+
"id": "backend/flask",
|
|
700
|
+
"name": "Python Flask Adapter (WSGI)",
|
|
701
|
+
"profile": "backend",
|
|
702
|
+
"profiles": ["backend"],
|
|
703
|
+
"repo": "tokensafe-backend/python",
|
|
704
|
+
"mode": "hybrid",
|
|
705
|
+
"status": "ready",
|
|
706
|
+
"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.",
|
|
707
|
+
"technology": {
|
|
708
|
+
"language": "python",
|
|
709
|
+
"framework": "flask",
|
|
710
|
+
"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"'},
|
|
711
|
+
},
|
|
712
|
+
"capabilities": [
|
|
713
|
+
{"name": "observe.resources", "constraints": {"readOnly": True, "developmentOnly": False}},
|
|
714
|
+
{"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": False, "requiresPermission": "permissions.mutate != false"}},
|
|
715
|
+
{"name": "verify.runtime_behavior", "constraints": {"readOnly": True, "developmentOnly": False}},
|
|
716
|
+
],
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"id": "backend/django",
|
|
720
|
+
"name": "Python Django Adapter (WSGI)",
|
|
721
|
+
"profile": "backend",
|
|
722
|
+
"profiles": ["backend"],
|
|
723
|
+
"repo": "tokensafe-backend/python",
|
|
724
|
+
"mode": "hybrid",
|
|
725
|
+
"status": "ready",
|
|
726
|
+
"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.",
|
|
727
|
+
"technology": {
|
|
728
|
+
"language": "python",
|
|
729
|
+
"framework": "django",
|
|
730
|
+
"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"'},
|
|
731
|
+
},
|
|
732
|
+
"capabilities": [
|
|
733
|
+
{"name": "observe.resources", "constraints": {"readOnly": True, "developmentOnly": False}},
|
|
734
|
+
{"name": "mutate.source", "constraints": {"readOnly": False, "developmentOnly": False, "requiresPermission": "permissions.mutate != false"}},
|
|
735
|
+
{"name": "verify.runtime_behavior", "constraints": {"readOnly": True, "developmentOnly": False}},
|
|
736
|
+
],
|
|
737
|
+
},
|
|
698
738
|
{
|
|
699
739
|
"id": "backend/node",
|
|
700
740
|
"name": "Node.js Backend Adapter (Express, Fastify)",
|
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 = {
|
|
@@ -216,7 +218,7 @@ def _activation(workspace: str, stack: Dict[str, Any]) -> List[str]:
|
|
|
216
218
|
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
219
|
elif item.get("provider") == "go":
|
|
218
220
|
hints.append(
|
|
219
|
-
"activate backend: `go get github.com/tokensafe-dev/tokensafe-backend/go@
|
|
221
|
+
f"activate backend: `go get github.com/tokensafe-dev/tokensafe-backend/go@{BACKEND_RELEASE_TAG}` "
|
|
220
222
|
"then `tokensafe inject` (one line, reversible)"
|
|
221
223
|
)
|
|
222
224
|
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.11.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.11.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
|