Skip to content

Commit 26e51f7

Browse files
author
SentienceDEV
committed
restored _best_effort_post_snapshot_digest
1 parent 0ee4ab2 commit 26e51f7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

sentience/agent.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,25 @@ def _compute_hash(self, text: str) -> str:
188188
"""Compute SHA256 hash of text."""
189189
return hashlib.sha256(text.encode("utf-8")).hexdigest()
190190

191+
async def _best_effort_post_snapshot_digest(self, goal: str) -> str | None:
192+
"""
193+
Best-effort post-action snapshot digest for tracing (async).
194+
"""
195+
try:
196+
snap_opts = SnapshotOptions(
197+
limit=min(10, self.default_snapshot_limit),
198+
goal=f"{goal} (post)",
199+
)
200+
snap_opts.screenshot = False
201+
snap_opts.show_overlay = self.config.show_overlay if self.config else None
202+
post_snap = await snapshot_async(self.browser, snap_opts)
203+
if post_snap.status != "success":
204+
return None
205+
digest_input = f"{post_snap.url}{post_snap.timestamp}"
206+
return f"sha256:{self._compute_hash(digest_input)}"
207+
except Exception:
208+
return None
209+
191210
def _best_effort_post_snapshot_digest(self, goal: str) -> str | None:
192211
"""
193212
Best-effort post-action snapshot digest for tracing.

0 commit comments

Comments
 (0)