MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / normalize_response

Function normalize_response

codeclash/arenas/scml/runtime/run_scml.py:170–184  ·  view source on GitHub ↗
(response)

Source from the content-addressed store, hash-verified

168
169
170def normalize_response(response) -> tuple[ResponseType | None, str | None]:
171 if response is None:
172 return None, None
173 if isinstance(response, ResponseType):
174 return response, None
175 if not isinstance(response, str):
176 return None, "response must be one of: accept, reject, end"
177 normalized = response.strip().lower().replace("_", " ")
178 if normalized in {"accept", "accept offer", "accept_offer"}:
179 return ResponseType.ACCEPT_OFFER, None
180 if normalized in {"reject", "reject offer", "reject_offer"}:
181 return ResponseType.REJECT_OFFER, None
182 if normalized in {"end", "end negotiation", "end_negotiation"}:
183 return ResponseType.END_NEGOTIATION, None
184 return None, f"unknown response: {response}"
185
186
187def policy_worker(

Callers 2

respondMethod · 0.85
counter_allMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected