Class: Insika::Policy::Decision

Inherits:
Data
  • Object
show all
Defined in:
lib/insika/policy/policy.rb

Overview

Output of ONE policy. allow_* == nil => "no restriction from this policy" (does not enter the intersection); [] => empty set; deny_* is always a list (union). verdict :deny denies the WHOLE TURN. All immutable Data — the policy's purity is structural. requires_approval: names of tools that require human approval — does NOT deny or allow; the real gate is in the ToolEnvelope (stage 6). Default [].

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#allow_skillsObject (readonly)

Returns the value of attribute allow_skills

Returns:

  • (Object)

    the current value of allow_skills



18
19
20
# File 'lib/insika/policy/policy.rb', line 18

def allow_skills
  @allow_skills
end

#allow_toolsObject (readonly)

Returns the value of attribute allow_tools

Returns:

  • (Object)

    the current value of allow_tools



18
19
20
# File 'lib/insika/policy/policy.rb', line 18

def allow_tools
  @allow_tools
end

#deny_skillsObject (readonly)

Returns the value of attribute deny_skills

Returns:

  • (Object)

    the current value of deny_skills



18
19
20
# File 'lib/insika/policy/policy.rb', line 18

def deny_skills
  @deny_skills
end

#deny_toolsObject (readonly)

Returns the value of attribute deny_tools

Returns:

  • (Object)

    the current value of deny_tools



18
19
20
# File 'lib/insika/policy/policy.rb', line 18

def deny_tools
  @deny_tools
end

#reasonObject (readonly)

Returns the value of attribute reason

Returns:

  • (Object)

    the current value of reason



18
19
20
# File 'lib/insika/policy/policy.rb', line 18

def reason
  @reason
end

#requires_approvalObject (readonly)

Returns the value of attribute requires_approval

Returns:

  • (Object)

    the current value of requires_approval



18
19
20
# File 'lib/insika/policy/policy.rb', line 18

def requires_approval
  @requires_approval
end

#verdictObject (readonly)

Returns the value of attribute verdict

Returns:

  • (Object)

    the current value of verdict



18
19
20
# File 'lib/insika/policy/policy.rb', line 18

def verdict
  @verdict
end

Class Method Details

.allow(allow_tools: nil, deny_tools: [], allow_skills: nil, deny_skills: [], requires_approval: []) ⇒ Object



20
21
22
23
24
25
# File 'lib/insika/policy/policy.rb', line 20

def self.allow(allow_tools: nil, deny_tools: [], allow_skills: nil, deny_skills: [],
               requires_approval: [])
  new(allow_tools: allow_tools, deny_tools: deny_tools, allow_skills: allow_skills,
      deny_skills: deny_skills, requires_approval: requires_approval,
      verdict: :allow, reason: nil)
end

.deny(reason:, allow_tools: nil, deny_tools: [], allow_skills: nil, deny_skills: [], requires_approval: []) ⇒ Object



27
28
29
30
31
32
# File 'lib/insika/policy/policy.rb', line 27

def self.deny(reason:, allow_tools: nil, deny_tools: [], allow_skills: nil, deny_skills: [],
              requires_approval: [])
  new(allow_tools: allow_tools, deny_tools: deny_tools, allow_skills: allow_skills,
      deny_skills: deny_skills, requires_approval: requires_approval,
      verdict: :deny, reason: reason)
end