Class: AgentHarness::Extensions::Adapters::PiExtension

Inherits:
Base
  • Object
show all
Includes:
DeepDupable
Defined in:
lib/agent_harness/extensions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#on_message_after, #on_message_before, #on_tools_available

Constructor Details

#initialize(name:, source_path:, entry_paths:, description: nil, version: nil, tools: [], system_prompt_additions: [], mcp_servers: [], required_provider_capabilities: [], unsupported_features: []) ⇒ PiExtension

Returns a new instance of PiExtension.



317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/agent_harness/extensions.rb', line 317

def initialize(name:, source_path:, entry_paths:, description: nil, version: nil, tools: [],
  system_prompt_additions: [], mcp_servers: [], required_provider_capabilities: [],
  unsupported_features: [])
  @name = name.to_s.strip.gsub(/[^a-zA-Z0-9]+/, "_").gsub(/\A_+|_+\z/, "").downcase.to_sym
  @description = description
  @version = version
  @tools = tools.freeze
  @system_prompt_additions = system_prompt_additions.freeze
  @mcp_servers = mcp_servers.freeze
  @required_provider_capabilities = required_provider_capabilities.freeze
  @unsupported_features = unsupported_features.freeze
  @source_path = source_path
  @entry_paths = entry_paths.freeze
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



315
316
317
# File 'lib/agent_harness/extensions.rb', line 315

def description
  @description
end

#entry_pathsObject (readonly)

Returns the value of attribute entry_paths.



315
316
317
# File 'lib/agent_harness/extensions.rb', line 315

def entry_paths
  @entry_paths
end

#nameObject (readonly)

Returns the value of attribute name.



315
316
317
# File 'lib/agent_harness/extensions.rb', line 315

def name
  @name
end

#source_pathObject (readonly)

Returns the value of attribute source_path.



315
316
317
# File 'lib/agent_harness/extensions.rb', line 315

def source_path
  @source_path
end

#versionObject (readonly)

Returns the value of attribute version.



315
316
317
# File 'lib/agent_harness/extensions.rb', line 315

def version
  @version
end

Instance Method Details

#mcp_serversObject



336
337
338
# File 'lib/agent_harness/extensions.rb', line 336

def mcp_servers
  @mcp_servers.map { |server| deep_dup(server) }
end

#required_provider_capabilitiesObject



344
345
346
347
348
349
# File 'lib/agent_harness/extensions.rb', line 344

def required_provider_capabilities
  inferred = []
  inferred << :tool_use if @tools.any?
  inferred << :mcp if @mcp_servers.any?
  (@required_provider_capabilities + inferred).uniq
end

#system_prompt_additionsObject



340
341
342
# File 'lib/agent_harness/extensions.rb', line 340

def system_prompt_additions
  @system_prompt_additions.dup
end

#toolsObject



332
333
334
# File 'lib/agent_harness/extensions.rb', line 332

def tools
  @tools.map(&:dup)
end

#unsupported_featuresObject



351
352
353
# File 'lib/agent_harness/extensions.rb', line 351

def unsupported_features
  @unsupported_features.dup
end