Class: Pikuri::Command::Extension
- Inherits:
-
Object
- Object
- Pikuri::Command::Extension
- Includes:
- Agent::Extension
- Defined in:
- lib/pikuri/command/extension.rb
Overview
Declares the command surface to Trifecta, and does nothing else — it registers no tool, renders no prompt snippet and binds no handle.
Pikuri::Agent.new(transport: ..., system_prompt: ...) do |c|
c.add_extension Pikuri::Command::Extension.new(registry: registry)
end
A host wires it purely so the boot banner tells the truth. Expansion
needs none of this: Registry and Renderer are pure functions over
disk, and a host dispatches a typed /name itself.
Why an extension for one declaration
The detector builds its tree from an agent's tools plus what its extensions contribute. A command is neither — so a wired command surface would land in that tree nowhere, and an agent that genuinely holds all three legs would report two. Skills don't have this problem only because their bytes ride Skill::SkillTool's declaration; commands have no tool to ride.
An object rather than a kwarg on the host side because the mistake should be unrepresentable, not something each host remembers.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(registry:) ⇒ Extension
constructor
A new instance of Extension.
-
#trifecta_contribution(tools) ⇒ Pikuri::Trifecta::Contribution?
The
untrustedleg, graded over the commands the registry stored::hardunless every one of them came from a base the host vouched for.
Constructor Details
#initialize(registry:) ⇒ Extension
Returns a new instance of Extension.
32 33 34 |
# File 'lib/pikuri/command/extension.rb', line 32 def initialize(registry:) @registry = registry end |
Instance Attribute Details
#registry ⇒ Pikuri::Command::Registry (readonly)
37 38 39 |
# File 'lib/pikuri/command/extension.rb', line 37 def registry @registry end |
Instance Method Details
#trifecta_contribution(tools) ⇒ Pikuri::Trifecta::Contribution?
The untrusted leg, graded over the commands the registry stored:
:hard unless every one of them came from a base the host vouched
for. No private leg (a command reads nothing) and no egress leg (it
sends nothing) — a command body is prose that lands in a user turn.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/pikuri/command/extension.rb', line 47 def trifecta_contribution(tools) level = @registry.untrusted_level return nil if level == :none Pikuri::Trifecta::Contribution.new( label: '(commands)', legs: Pikuri::Tool::TrifectaLegs.new( private: false, untrusted: level, egress_payload_review: :no_egress ) ) end |