Class: Pikuri::Trifecta::Node

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

Overview

One agent in the tree the detector walks: the main agent at the root, a persona per sub-agent below it. Assembled from a wired Agent (its tools plus every extension's Agent::Extension#trifecta_contribution), and hand-built in specs — which is the point of carrying plain data rather than live objects:

Node.new(label: 'demo',
       tool_legs: { 'read' => read_legs },
       children: [Node.new(label: 'RESEARCHER',
                           tool_legs: { 'fetch' => fetch_legs },
                           channel_egress: :human_reviewed)])

Immutable.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, tool_legs: {}, children: [], channel_egress: nil) ⇒ Node

Returns a new instance of Node.

Parameters:

  • (defaults to: {})
  • (defaults to: [])
  • (defaults to: nil)


42
43
44
# File 'lib/pikuri/trifecta/node.rb', line 42

def initialize(label:, tool_legs: {}, children: [], channel_egress: nil)
  super
end

Instance Attribute Details

#channel_egressSymbol? (readonly)

Returns how much egress the delegation channel from the parent permits, on the Pikuri::Tool::TrifectaLegs review axis — :human_reviewed when a human gates the hand-off, :unreviewed otherwise. A property of the edge, stored on the child because every child has exactly one parent edge; nil at the root, which has none.

Returns:

  • how much egress the delegation channel from the parent permits, on the Pikuri::Tool::TrifectaLegs review axis — :human_reviewed when a human gates the hand-off, :unreviewed otherwise. A property of the edge, stored on the child because every child has exactly one parent edge; nil at the root, which has none.



37
38
39
40
41
42
43
44
45
# File 'lib/pikuri/trifecta/node.rb', line 37

class Node < Data.define(:label, :tool_legs, :children, :channel_egress)
  # @param label [String]
  # @param tool_legs [Hash{String=>Pikuri::Tool::TrifectaLegs}]
  # @param children [Array<Node>]
  # @param channel_egress [Symbol, nil]
  def initialize(label:, tool_legs: {}, children: [], channel_egress: nil)
    super
  end
end

#childrenArray<Node> (readonly)

Returns sub-agents this agent can dispatch to.

Returns:

  • sub-agents this agent can dispatch to



37
38
39
40
41
42
43
44
45
# File 'lib/pikuri/trifecta/node.rb', line 37

class Node < Data.define(:label, :tool_legs, :children, :channel_egress)
  # @param label [String]
  # @param tool_legs [Hash{String=>Pikuri::Tool::TrifectaLegs}]
  # @param children [Array<Node>]
  # @param channel_egress [Symbol, nil]
  def initialize(label:, tool_legs: {}, children: [], channel_egress: nil)
    super
  end
end

#labelString (readonly)

Returns name shown in the report — the binary/agent name at the root, the persona name for a sub-agent.

Returns:

  • name shown in the report — the binary/agent name at the root, the persona name for a sub-agent



37
38
39
40
41
42
43
44
45
# File 'lib/pikuri/trifecta/node.rb', line 37

class Node < Data.define(:label, :tool_legs, :children, :channel_egress)
  # @param label [String]
  # @param tool_legs [Hash{String=>Pikuri::Tool::TrifectaLegs}]
  # @param children [Array<Node>]
  # @param channel_egress [Symbol, nil]
  def initialize(label:, tool_legs: {}, children: [], channel_egress: nil)
    super
  end
end

#tool_legsHash{String=>Pikuri::Tool::TrifectaLegs} (readonly)

Returns this agent's own tools, in wiring order. The per-tool breakdown is kept rather than pre-unioned so the rendered tree can show which tool contributes a leg instead of a bare total.

Returns:

  • this agent's own tools, in wiring order. The per-tool breakdown is kept rather than pre-unioned so the rendered tree can show which tool contributes a leg instead of a bare total.



37
38
39
40
41
42
43
44
45
# File 'lib/pikuri/trifecta/node.rb', line 37

class Node < Data.define(:label, :tool_legs, :children, :channel_egress)
  # @param label [String]
  # @param tool_legs [Hash{String=>Pikuri::Tool::TrifectaLegs}]
  # @param children [Array<Node>]
  # @param channel_egress [Symbol, nil]
  def initialize(label:, tool_legs: {}, children: [], channel_egress: nil)
    super
  end
end