Class: AgentsControl::Agents::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/agents_control/agents/base.rb

Overview

The agent adapter contract.

Deliberately tiny. The core is written for a weak agent — one with nothing but a process in a terminal. An agent with full hooks (Claude Code, Codex) just enriches the same events, without changing their shape.

If adding a new agent requires changes outside its adapter, the registry, and the hook installer, the seam was drawn wrong.

Direct Known Subclasses

ClaudeCode

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.binariesObject

Executable names, matched by process basename.



20
# File 'lib/agents_control/agents/base.rb', line 20

def binaries = []

.handles?(_payload) ⇒ Boolean

Whether this adapter can parse a hook payload of this shape.

Returns:

  • (Boolean)


23
# File 'lib/agents_control/agents/base.rb', line 23

def handles?(_payload) = false

.keyObject

Name in the registry and in Session#agent.

Raises:

  • (NotImplementedError)


17
# File 'lib/agents_control/agents/base.rb', line 17

def key = raise(NotImplementedError)

Instance Method Details

#capabilitiesObject

What the adapter can do. The core checks this list, not the agent's name.

:push               — pushes events itself, no polling needed
:blocking_reply     — can wait for an answer and feed it back to the session
:structured_options — brings a ready-made list of answer choices


34
# File 'lib/agents_control/agents/base.rb', line 34

def capabilities = []

#install!(_url, secret: nil) ⇒ Object

Register itself in the agent's config so events start arriving.

Raises:

  • (NotImplementedError)


45
# File 'lib/agents_control/agents/base.rb', line 45

def install!(_url, secret: nil) = raise(NotImplementedError)

#installed?Boolean

Returns:

  • (Boolean)


49
# File 'lib/agents_control/agents/base.rb', line 49

def installed? = false

#keyObject



26
# File 'lib/agents_control/agents/base.rb', line 26

def key = self.class.key

#supports?(capability) ⇒ Boolean

Returns:

  • (Boolean)


36
# File 'lib/agents_control/agents/base.rb', line 36

def supports?(capability) = capabilities.include?(capability)

#to_event(_payload) ⇒ Object

hook payload → Event, or nil if the event isn't interesting.

Raises:

  • (NotImplementedError)


39
# File 'lib/agents_control/agents/base.rb', line 39

def to_event(_payload) = raise(NotImplementedError)

#to_response(_event, _reply) ⇒ Object

Reply → the hook response body.

Raises:

  • (NotImplementedError)


42
# File 'lib/agents_control/agents/base.rb', line 42

def to_response(_event, _reply) = raise(NotImplementedError)

#uninstall!Object

Raises:

  • (NotImplementedError)


47
# File 'lib/agents_control/agents/base.rb', line 47

def uninstall! = raise(NotImplementedError)