MCPcopy Create free account
hub / github.com/openai/openai-agents-python / ApprovalTracker

Class ApprovalTracker

examples/tools/apply_patch.py:13–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12
13class ApprovalTracker:
14 def __init__(self) -> None:
15 self._approved: set[str] = set()
16
17 def fingerprint(self, operation: ApplyPatchOperation, relative_path: str) -> str:
18 hasher = hashlib.sha256()
19 hasher.update(operation.type.encode("utf-8"))
20 hasher.update(b"\0")
21 hasher.update(relative_path.encode("utf-8"))
22 hasher.update(b"\0")
23 hasher.update((operation.diff or "").encode("utf-8"))
24 return hasher.hexdigest()
25
26 def remember(self, fingerprint: str) -> None:
27 self._approved.add(fingerprint)
28
29 def is_approved(self, fingerprint: str) -> bool:
30 return fingerprint in self._approved
31
32
33class WorkspaceEditor:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected