Class: Insika::Evals::Simulator::Safety
- Inherits:
-
Struct
- Object
- Struct
- Insika::Evals::Simulator::Safety
- Defined in:
- lib/insika/evals/simulator.rb
Overview
The target-safety gate. A run is allowed when:
· `staging` — the operator declares the target is a staging
deployment (real tools, staging data), or
· the derived `side_effect_tools` is EMPTY — the agent has nothing
that can write, or
· `eval_profile` AND `swapped_tools` covers EVERY derived
side-effect tool — the eval profile swaps them all for dry-runs.
Anything else is refused with the offending tool names. Refusals are loud:
UnsafeTarget is raised BEFORE a single model call.
side_effect_tools is the DERIVED list (see EvalProfile) — never a
hand-typed claim; swapped_tools is what the run's eval profile declares
it swaps. A bare eval_profile: true with a known side-effect list is
REFUSED: an eval profile that leaves a write-capable tool unswapped is a
trust-me flag wearing a safety's clothes.
Instance Attribute Summary collapse
-
#eval_profile ⇒ Object
Returns the value of attribute eval_profile.
-
#side_effect_tools ⇒ Object
Returns the value of attribute side_effect_tools.
-
#staging ⇒ Object
Returns the value of attribute staging.
-
#swapped_tools ⇒ Object
Returns the value of attribute swapped_tools.
Class Method Summary collapse
Instance Method Summary collapse
-
#refusal ⇒ Object
-> reason to refuse, or nil.
Instance Attribute Details
#eval_profile ⇒ Object
Returns the value of attribute eval_profile
59 60 61 |
# File 'lib/insika/evals/simulator.rb', line 59 def eval_profile @eval_profile end |
#side_effect_tools ⇒ Object
Returns the value of attribute side_effect_tools
59 60 61 |
# File 'lib/insika/evals/simulator.rb', line 59 def side_effect_tools @side_effect_tools end |
#staging ⇒ Object
Returns the value of attribute staging
59 60 61 |
# File 'lib/insika/evals/simulator.rb', line 59 def staging @staging end |
#swapped_tools ⇒ Object
Returns the value of attribute swapped_tools
59 60 61 |
# File 'lib/insika/evals/simulator.rb', line 59 def swapped_tools @swapped_tools end |
Class Method Details
.staging ⇒ Object
60 |
# File 'lib/insika/evals/simulator.rb', line 60 def self.staging = new(staging: true) |
Instance Method Details
#refusal ⇒ Object
-> reason to refuse, or nil. side_effect_tools is the DERIVED list (the
target's reachable tools the registry marks side_effect).
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/insika/evals/simulator.rb', line 64 def refusal return nil if staging tools = Array(side_effect_tools).map(&:to_s).reject(&:empty?) return nil if tools.empty? if eval_profile swapped = Array(swapped_tools).map(&:to_s) uncovered = tools - swapped return nil if uncovered.empty? return "eval profile declares swapped tool(s) (#{swapped.join(', ')}) but the target " \ "also exposes side-effect tool(s) (#{uncovered.join(', ')}) — an eval profile " \ "must swap EVERY side-effect tool" end "the target agent exposes side-effect tool(s) (#{tools.join(', ')}) — a simulated " \ "conversation could write for real. Run against staging (--staging) or against an " \ "eval profile where these tools are swapped for fakes (--eval-profile --eval-tools ...)." end |