Ë
    dÈjÑ	  ã                  ób   — d Z ddlmZ ddlmZmZmZ ddlmZ  G d„ de«      Z		 	 	 	 	 	 	 	 d
d„Z
y	)up  v3.6 Runtime Harness â€” guard engine (evaluate orchestrator).

chair_authorization_id=CHAIR-AUTH-TASK-2703-V36-HARNESS-MVP-260528

Public API:
    evaluate(tool_name, tool_input, context) -> Decision

Decision TypedDict:
    decision: "ALLOW" | "DENY" | "HOLD_FOR_CHAIR"
    matched_rule: str | None   (None for ALLOW)
    reason: str | None         (None for ALLOW)
é    )Úannotations)ÚAnyÚ	TypedDictÚOptionalé   )Ú	ALL_RULESc                  ó,   — e Zd ZU ded<   ded<   ded<   y)ÚDecisionÚstrÚdecisionzOptional[str]Úmatched_ruleÚreasonN)Ú__name__Ú
__module__Ú__qualname__Ú__annotations__© ó    ú0/home/jay/workspace/scripts/harness/v36/guard.pyr
   r
      s   … ØƒMØÓØÔr   r
   c                ój  — 	 t        | xs d«      }t        |t        «      rt        |«      ni }t        |t        «      rt        |«      ni }t        D ]%  }	  ||||«      }|€Œ|\  }}	}
t        ||	|
¬«      c S  t        ddd¬«      S # t        $ r d}Y Œ5w xY w# t        $ r t        ddd¬«      cY S w xY w)u½  Evaluate a tool call against all v36 harness rules.

    Args:
        tool_name: Name of the Claude Code tool (e.g. "Bash", "Write", "Edit").
        tool_input: The tool's input dict as received from the hook stdin.
        context: Additional context dict (task_id, session_id, new_code_files, etc.)

    Returns:
        Decision dict with decision, matched_rule, reason.

    Contract:
        - First matched rule wins (ordered by ALL_RULES list).
        - No match â†’ ALLOW with matched_rule=None, reason=None.
        - Any exception in a rule â†’ that rule returns None (rules are fail-safe).
        - The evaluate function itself is also fail-safe: any unhandled exception â†’ ALLOW.
    Ú N)r   r   r   ÚALLOW)r   Ú
isinstanceÚdictr   Ú	Exceptionr
   )Ú	tool_nameÚ
tool_inputÚcontextÚtool_name_strÚtool_input_dictÚcontext_dictÚrule_fnÚresultr   r   r   s              r   Úevaluater$      sÔ   € ð*JÜ˜IšO¨Ó,ˆÜ.8¸ÄTÔ.Jœ$˜zÔ*ÐPRˆÜ(2°7¼DÔ(A”t˜G”}Àrˆä ò 	ˆGðÙ  °ÀÓNð
 Ñ!Ø17Ñ.˜,¨ÜØ%Ø!-Ø!ôò ð	ô   °tÀDÔIÐIøô ò à’ðûô ò Jä °tÀDÔIÒIðJúsB   ‚AB Á
BÁB Á"B Á8B ÂBÂB ÂBÂB ÂB2Â1B2N)r   r   r   r   r   r   Úreturnr
   )Ú__doc__Ú
__future__r   Útypingr   r   r   Úrulesr   r
   r$   r   r   r   ú<module>r*      sR   ðñõ #ç +Ñ +å ôˆyô ð.JØð.Jàð.Jð ð.Jð ô	.Jr   