Class: AgentsControl::Terminals::Base
- Inherits:
-
Object
- Object
- AgentsControl::Terminals::Base
- Defined in:
- lib/agents_control/terminals/base.rb
Overview
The terminal backend contract.
There are three implementations right now (iTerm2, tmux, null), and they're chosen not globally but per session: the same machine can hold bare iTerm2 tabs, tmux panes, and VS Code sessions with no terminal at all, all at once.
Every method must be safe when the backend is unavailable: return an empty result or false, never raise out to the caller or hang it.
Instance Method Summary collapse
-
#available? ⇒ Boolean
Whether the backend can answer right now.
- #capture(_id, lines: 200) ⇒ Object
- #close(_id) ⇒ Object
- #create_tab(cwd: nil, command: nil) ⇒ Object
- #focus(_id) ⇒ Object
-
#initialize(executor: Executor.new, probe: nil) ⇒ Base
constructor
A new instance of Base.
-
#name ⇒ Object
The backend's symbolic name — ends up in Session#backend.
- #send_text(_id, _text, newline: true) ⇒ Object
-
#sessions ⇒ Object
[Session] — all of this backend's tabs/panes.
Constructor Details
Instance Method Details
#available? ⇒ Boolean
Whether the backend can answer right now. Must have no side effects: in particular, must not launch an app the user hasn't already opened.
30 |
# File 'lib/agents_control/terminals/base.rb', line 30 def available? = raise(NotImplementedError) |
#capture(_id, lines: 200) ⇒ Object
39 |
# File 'lib/agents_control/terminals/base.rb', line 39 def capture(_id, lines: 200) = raise(Unsupported, "#{name}: reading the screen is not supported") |
#close(_id) ⇒ Object
43 |
# File 'lib/agents_control/terminals/base.rb', line 43 def close(_id) = raise(Unsupported, "#{name}: closing is not supported") |
#create_tab(cwd: nil, command: nil) ⇒ Object
35 |
# File 'lib/agents_control/terminals/base.rb', line 35 def create_tab(cwd: nil, command: nil) = raise(Unsupported, "#{name}: creating a tab is not supported") |
#focus(_id) ⇒ Object
41 |
# File 'lib/agents_control/terminals/base.rb', line 41 def focus(_id) = raise(Unsupported, "#{name}: focusing is not supported") |
#name ⇒ Object
The backend's symbolic name — ends up in Session#backend.
25 |
# File 'lib/agents_control/terminals/base.rb', line 25 def name = raise(NotImplementedError) |
#send_text(_id, _text, newline: true) ⇒ Object
37 |
# File 'lib/agents_control/terminals/base.rb', line 37 def send_text(_id, _text, newline: true) = raise(Unsupported, "#{name}: sending input is not supported") |
#sessions ⇒ Object
[Session] — all of this backend's tabs/panes.
33 |
# File 'lib/agents_control/terminals/base.rb', line 33 def sessions = raise(NotImplementedError) |