Class: AgentsControl::Agents::Base
- Inherits:
-
Object
- Object
- AgentsControl::Agents::Base
- 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
Class Method Summary collapse
-
.binaries ⇒ Object
Executable names, matched by process basename.
-
.handles?(_payload) ⇒ Boolean
Whether this adapter can parse a hook payload of this shape.
-
.key ⇒ Object
Name in the registry and in Session#agent.
Instance Method Summary collapse
-
#capabilities ⇒ Object
What the adapter can do.
-
#install!(_url, secret: nil) ⇒ Object
Register itself in the agent's config so events start arriving.
- #installed? ⇒ Boolean
- #key ⇒ Object
- #supports?(capability) ⇒ Boolean
-
#to_event(_payload) ⇒ Object
hook payload → Event, or nil if the event isn't interesting.
-
#to_response(_event, _reply) ⇒ Object
Reply → the hook response body.
- #uninstall! ⇒ Object
Class Method Details
.binaries ⇒ Object
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.
23 |
# File 'lib/agents_control/agents/base.rb', line 23 def handles?(_payload) = false |
.key ⇒ Object
Name in the registry and in Session#agent.
17 |
# File 'lib/agents_control/agents/base.rb', line 17 def key = raise(NotImplementedError) |
Instance Method Details
#capabilities ⇒ Object
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.
45 |
# File 'lib/agents_control/agents/base.rb', line 45 def install!(_url, secret: nil) = raise(NotImplementedError) |
#installed? ⇒ Boolean
49 |
# File 'lib/agents_control/agents/base.rb', line 49 def installed? = false |
#key ⇒ Object
26 |
# File 'lib/agents_control/agents/base.rb', line 26 def key = self.class.key |
#supports?(capability) ⇒ 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.
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.
42 |
# File 'lib/agents_control/agents/base.rb', line 42 def to_response(_event, _reply) = raise(NotImplementedError) |
#uninstall! ⇒ Object
47 |
# File 'lib/agents_control/agents/base.rb', line 47 def uninstall! = raise(NotImplementedError) |