mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-27 11:22:03 +00:00
feat(gateway): expose coding verification status
Add a read-only gateway RPC for querying the passive verification ledger without running checks from the UI surface.
This commit is contained in:
parent
f0beb6f617
commit
7ef0f360d0
2 changed files with 83 additions and 0 deletions
|
|
@ -6139,6 +6139,65 @@ def test_session_most_recent_handles_db_unavailable(monkeypatch):
|
|||
assert resp["result"]["session_id"] is None
|
||||
|
||||
|
||||
# ── verification.status ──────────────────────────────────────────────
|
||||
|
||||
|
||||
def test_verification_status_returns_recorded_evidence(tmp_path):
|
||||
home = tmp_path / ".hermes"
|
||||
home.mkdir()
|
||||
token = set_hermes_home_override(home)
|
||||
project = tmp_path / "project"
|
||||
project.mkdir()
|
||||
(project / "package.json").write_text(
|
||||
json.dumps({"scripts": {"test": "vitest"}}),
|
||||
encoding="utf-8",
|
||||
)
|
||||
(project / "pnpm-lock.yaml").write_text("", encoding="utf-8")
|
||||
try:
|
||||
from agent.verification_evidence import record_terminal_result
|
||||
|
||||
record_terminal_result(
|
||||
command="pnpm run test",
|
||||
cwd=project,
|
||||
session_id="sid",
|
||||
exit_code=0,
|
||||
output="green",
|
||||
)
|
||||
|
||||
resp = server.handle_request(
|
||||
{
|
||||
"id": "1",
|
||||
"method": "verification.status",
|
||||
"params": {"cwd": str(project), "session_id": "sid"},
|
||||
}
|
||||
)
|
||||
finally:
|
||||
reset_hermes_home_override(token)
|
||||
|
||||
verification = resp["result"]["verification"]
|
||||
assert verification["status"] == "passed"
|
||||
assert verification["evidence"]["canonical_command"] == "pnpm run test"
|
||||
assert verification["evidence"]["scope"] == "full"
|
||||
|
||||
|
||||
def test_verification_status_outside_workspace_is_not_applicable(tmp_path):
|
||||
home = tmp_path / ".hermes"
|
||||
home.mkdir()
|
||||
token = set_hermes_home_override(home)
|
||||
try:
|
||||
resp = server.handle_request(
|
||||
{
|
||||
"id": "1",
|
||||
"method": "verification.status",
|
||||
"params": {"cwd": str(tmp_path), "session_id": "sid"},
|
||||
}
|
||||
)
|
||||
finally:
|
||||
reset_hermes_home_override(token)
|
||||
|
||||
assert resp["result"]["verification"]["status"] == "not_applicable"
|
||||
|
||||
|
||||
# ── browser.manage ───────────────────────────────────────────────────
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4663,6 +4663,30 @@ def _(rid, params: dict) -> dict:
|
|||
return _ok(rid, {"facts": None})
|
||||
|
||||
|
||||
@method("verification.status")
|
||||
def _(rid, params: dict) -> dict:
|
||||
"""Best known coding verification evidence for a cwd/session.
|
||||
|
||||
Read-only consumer of the core ledger. It never runs checks and never
|
||||
upgrades targeted evidence into a repository-wide guarantee.
|
||||
"""
|
||||
try:
|
||||
from agent.verification_evidence import verification_status
|
||||
|
||||
return _ok(
|
||||
rid,
|
||||
{
|
||||
"verification": verification_status(
|
||||
session_id=params.get("session_id") or params.get("session_key"),
|
||||
cwd=params.get("cwd"),
|
||||
)
|
||||
},
|
||||
)
|
||||
except Exception:
|
||||
logger.exception("verification.status failed")
|
||||
return _ok(rid, {"verification": {"status": "unknown", "evidence": None}})
|
||||
|
||||
|
||||
@method("session.resume")
|
||||
def _(rid, params: dict) -> dict:
|
||||
target = params.get("session_id", "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue