Class: Pikuri::Skill::Activation::Sealed
- Inherits:
-
Object
- Object
- Pikuri::Skill::Activation::Sealed
- Defined in:
- lib/pikuri/skill/activation/sealed.rb
Overview
An Pikuri::Skill::Activation with the door welded shut: gated skills stay withheld for the whole run, and promoting one raises.
sealed = Activation::Sealed.new(catalog: catalog)
sealed.get('data-viz') # => #<Skill …> — ungated skills load normally
sealed.get('writing-rdoc') # => nil — gated, and nothing can change that
sealed.activate([rdoc]) # => raises
What a spawned sub-agent's skill tool resolves against. A sub-agent
inherits no extension, so no listener ever fires for it, and its prompt
carries no catalog at all — a gated skill is a name it was never told,
and reaching one through the parent's promotions would make the child's
surface depend on which files the parent happened to read.
The raise is an assertion, not a policy: nothing can legitimately promote here, so a caller that turns up is a wiring bug worth seeing.
Thread-safe.
Instance Attribute Summary collapse
-
#catalog ⇒ Pikuri::Skill::Catalog
readonly
The unfiltered catalog behind this view.
Instance Method Summary collapse
-
#activate(skills) ⇒ void
Never returns.
-
#get(name) ⇒ Pikuri::Skill::Catalog::Skill?
nilfor a gated skill, the same answer a name that exists nowhere gets. -
#in_play?(name) ⇒ Boolean
True only for a skill that declared no gate.
-
#initialize(catalog:) ⇒ Sealed
constructor
A new instance of Sealed.
-
#names ⇒ Array<String>
Sorted names of the ungated skills.
-
#reset ⇒ void
No-op: there is never anything to clear.
Constructor Details
#initialize(catalog:) ⇒ Sealed
Returns a new instance of Sealed.
26 27 28 |
# File 'lib/pikuri/skill/activation/sealed.rb', line 26 def initialize(catalog:) @catalog = catalog end |
Instance Attribute Details
#catalog ⇒ Pikuri::Skill::Catalog (readonly)
Returns the unfiltered catalog behind this view.
31 32 33 |
# File 'lib/pikuri/skill/activation/sealed.rb', line 31 def catalog @catalog end |
Instance Method Details
#activate(skills) ⇒ void
This method returns an undefined value.
Returns never returns.
55 56 57 58 |
# File 'lib/pikuri/skill/activation/sealed.rb', line 55 def activate(skills) raise "a sealed Activation cannot promote #{skills.map(&:name).join(', ')} — " \ 'nothing should path-activate a skill inside a sub-agent' end |
#get(name) ⇒ Pikuri::Skill::Catalog::Skill?
Returns nil for a gated skill,
the same answer a name that exists nowhere gets.
43 44 45 |
# File 'lib/pikuri/skill/activation/sealed.rb', line 43 def get(name) in_play?(name) ? @catalog.get(name) : nil end |
#in_play?(name) ⇒ Boolean
Returns true only for a skill that declared no gate.
35 36 37 38 |
# File 'lib/pikuri/skill/activation/sealed.rb', line 35 def in_play?(name) skill = @catalog.get(name) !skill.nil? && !skill.gated? end |
#names ⇒ Array<String>
Returns sorted names of the ungated skills.
48 49 50 |
# File 'lib/pikuri/skill/activation/sealed.rb', line 48 def names @catalog.list.reject(&:gated?).map(&:name).sort end |
#reset ⇒ void
This method returns an undefined value.
Returns no-op: there is never anything to clear.
61 |
# File 'lib/pikuri/skill/activation/sealed.rb', line 61 def reset = nil |