mirror of
https://github.com/msitarzewski/agency-agents.git
synced 2026-10-13 01:30:05 +00:00
Snapshot evidence payloads before hashing and appending
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
This commit is contained in:
@@ -165,6 +165,11 @@ class DelegationVerifier:
|
||||
### Evidence Record Structure
|
||||
|
||||
```python
|
||||
from copy import deepcopy
|
||||
from datetime import datetime
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
class EvidenceRecord:
|
||||
"""
|
||||
Append-only, tamper-evident record of an agent action.
|
||||
@@ -185,9 +190,9 @@ class EvidenceRecord:
|
||||
record = {
|
||||
"agent_id": agent_id,
|
||||
"action_type": action_type,
|
||||
"intent": intent,
|
||||
"intent": deepcopy(intent),
|
||||
"decision": decision,
|
||||
"outcome": outcome,
|
||||
"outcome": deepcopy(outcome),
|
||||
"timestamp_utc": datetime.utcnow().isoformat(),
|
||||
"prev_record_hash": prev_hash,
|
||||
}
|
||||
@@ -199,7 +204,9 @@ class EvidenceRecord:
|
||||
# Sign with agent's key
|
||||
record["signature"] = self.sign(canonical.encode())
|
||||
|
||||
self.append(record)
|
||||
# Keep caller-owned inputs and the returned record independent of the
|
||||
# stored snapshot; later mutations must not invalidate its signed hash.
|
||||
self.append(deepcopy(record))
|
||||
return record
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user