Class: Pikuri::Trifecta::Contribution

Inherits:
Object
  • Object
show all
Defined in:
lib/pikuri/trifecta/contribution.rb

Overview

What an extension adds to the tree, returned from Agent::Extension#trifecta_contribution. Two independent things, either of which may be empty:

# a sub-agent extension: one child per persona, nothing of its own
Contribution.new(legs: Pikuri::Tool::TrifectaLegs::NONE, children: nodes)

# an MCP extension: legs no tool can declare, no children
Contribution.new(label: '(mcp)', legs: assumed_with_private, children: [])

Needed because two things in the tree are invisible to per-tool tagging: a sub-agent is a whole node the tools cannot describe, and a foreign tool surface (MCP) arrives as raw RubyLLM::Tool subclasses with no leg surface at all.

Immutable.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label: '(extension)', legs: Pikuri::Tool::TrifectaLegs::NONE, children: []) ⇒ Contribution

Returns a new instance of Contribution.

Parameters:

  • label (String) (defaults to: '(extension)')

    row name for legs; ignored when they are NONE

  • legs (Pikuri::Tool::TrifectaLegs) (defaults to: Pikuri::Tool::TrifectaLegs::NONE)
  • children (Array<Node>) (defaults to: [])


38
39
40
# File 'lib/pikuri/trifecta/contribution.rb', line 38

def initialize(label: '(extension)', legs: Pikuri::Tool::TrifectaLegs::NONE, children: [])
  super
end

Instance Attribute Details

#childrenArray<Node> (readonly)

Returns child nodes this extension introduces.

Returns:

  • (Array<Node>)

    child nodes this extension introduces



34
35
36
37
38
39
40
41
# File 'lib/pikuri/trifecta/contribution.rb', line 34

class Contribution < Data.define(:label, :legs, :children)
  # @param label [String] row name for +legs+; ignored when they are +NONE+
  # @param legs [Pikuri::Tool::TrifectaLegs]
  # @param children [Array<Node>]
  def initialize(label: '(extension)', legs: Pikuri::Tool::TrifectaLegs::NONE, children: [])
    super
  end
end

#labelString (readonly)

Returns name of the row these legs appear under in the report, parenthesized to mark it as not-a-tool. It is what Report#attribution points the reader at, so it has to name the surface they can actually go and change — two extensions declaring under one label would blame each other's wiring.

Returns:

  • (String)

    name of the row these legs appear under in the report, parenthesized to mark it as not-a-tool. It is what Report#attribution points the reader at, so it has to name the surface they can actually go and change — two extensions declaring under one label would blame each other's wiring.



34
35
36
37
38
39
40
41
# File 'lib/pikuri/trifecta/contribution.rb', line 34

class Contribution < Data.define(:label, :legs, :children)
  # @param label [String] row name for +legs+; ignored when they are +NONE+
  # @param legs [Pikuri::Tool::TrifectaLegs]
  # @param children [Array<Node>]
  def initialize(label: '(extension)', legs: Pikuri::Tool::TrifectaLegs::NONE, children: [])
    super
  end
end

#legsPikuri::Tool::TrifectaLegs (readonly)

Returns legs this extension adds to the node it is wired into, over and above that node's own tools.

Returns:



34
35
36
37
38
39
40
41
# File 'lib/pikuri/trifecta/contribution.rb', line 34

class Contribution < Data.define(:label, :legs, :children)
  # @param label [String] row name for +legs+; ignored when they are +NONE+
  # @param legs [Pikuri::Tool::TrifectaLegs]
  # @param children [Array<Node>]
  def initialize(label: '(extension)', legs: Pikuri::Tool::TrifectaLegs::NONE, children: [])
    super
  end
end