Connector calls, semantic rules, and DuckDB memory keep long runs stable, and stream retry stops chats from stalling. Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
452 B
Python
21 lines
452 B
Python
"""Deal status comes only from the Status field."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Optional
|
|
|
|
_CANONICAL = {
|
|
"Pending": "pending",
|
|
"Won": "won",
|
|
"Lost": "lost",
|
|
}
|
|
|
|
|
|
def canonical_status(record: Any) -> Optional[str]:
|
|
if not isinstance(record, dict):
|
|
return None
|
|
value = record.get("Status")
|
|
if isinstance(value, str) and value in _CANONICAL:
|
|
return _CANONICAL[value]
|
|
return None
|