Class: Kward::SessionTabDriver
- Inherits:
-
Object
- Object
- Kward::SessionTabDriver
- Defined in:
- lib/kward/tab_driver.rb
Overview
Adapts a session-backed agent to the tab runtime interface. Plugin tab drivers implement the same small surface without becoming Kward sessions.
Instance Attribute Summary collapse
-
#agent ⇒ Object
readonly
Returns the value of attribute agent.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#worktree ⇒ Object
readonly
Returns the value of attribute worktree.
Instance Method Summary collapse
- #assistant_label ⇒ Object
- #conversation ⇒ Object
- #descriptor ⇒ Object
-
#initialize(session:, agent:, worktree: nil) ⇒ SessionTabDriver
constructor
A new instance of SessionTabDriver.
- #messages ⇒ Object
- #session? ⇒ Boolean
- #submit(input, display_input:, cancellation:, steering: nil, &block) ⇒ Object
- #supports_steering? ⇒ Boolean
Constructor Details
#initialize(session:, agent:, worktree: nil) ⇒ SessionTabDriver
Returns a new instance of SessionTabDriver.
8 9 10 11 12 |
# File 'lib/kward/tab_driver.rb', line 8 def initialize(session:, agent:, worktree: nil) @session = session @agent = agent @worktree = worktree end |
Instance Attribute Details
#agent ⇒ Object (readonly)
Returns the value of attribute agent.
6 7 8 |
# File 'lib/kward/tab_driver.rb', line 6 def agent @agent end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
6 7 8 |
# File 'lib/kward/tab_driver.rb', line 6 def session @session end |
#worktree ⇒ Object (readonly)
Returns the value of attribute worktree.
6 7 8 |
# File 'lib/kward/tab_driver.rb', line 6 def worktree @worktree end |
Instance Method Details
#assistant_label ⇒ Object
43 44 45 |
# File 'lib/kward/tab_driver.rb', line 43 def assistant_label nil end |
#conversation ⇒ Object
18 19 20 |
# File 'lib/kward/tab_driver.rb', line 18 def conversation agent.conversation end |
#descriptor ⇒ Object
29 30 31 32 33 |
# File 'lib/kward/tab_driver.rb', line 29 def descriptor descriptor = { "kind" => "session", "session_path" => session.path } descriptor["worktree"] = worktree.descriptor if worktree descriptor end |
#messages ⇒ Object
14 15 16 |
# File 'lib/kward/tab_driver.rb', line 14 def agent.conversation. end |
#session? ⇒ Boolean
35 36 37 |
# File 'lib/kward/tab_driver.rb', line 35 def session? true end |
#submit(input, display_input:, cancellation:, steering: nil, &block) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/kward/tab_driver.rb', line 22 def submit(input, display_input:, cancellation:, steering: nil, &block) = { cancellation: cancellation } [:display_input] = display_input unless display_input.nil? [:steering] = steering if steering agent.ask(input, **, &block) end |
#supports_steering? ⇒ Boolean
39 40 41 |
# File 'lib/kward/tab_driver.rb', line 39 def supports_steering? true end |