Class: Kward::EditorPromptSession
- Inherits:
-
Object
- Object
- Kward::EditorPromptSession
- Defined in:
- lib/kward/cli/editor_prompt_session.rb
Overview
Transactional draft used while an agent works on an active editor buffer.
The live terminal editor remains owned by PromptInterface. Agent tool calls update this draft and the caller commits it only after a successful turn.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
- #changed? ⇒ Boolean
- #initial_content ⇒ Object
-
#initialize(context) ⇒ EditorPromptSession
constructor
A new instance of EditorPromptSession.
- #replace(content) ⇒ Object
Constructor Details
#initialize(context) ⇒ EditorPromptSession
Returns a new instance of EditorPromptSession.
10 11 12 13 14 |
# File 'lib/kward/cli/editor_prompt_session.rb', line 10 def initialize(context) @context = context.dup @initial_content = @context.fetch(:content).to_s.dup @content = @initial_content.dup end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
8 9 10 |
# File 'lib/kward/cli/editor_prompt_session.rb', line 8 def content @content end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
8 9 10 |
# File 'lib/kward/cli/editor_prompt_session.rb', line 8 def context @context end |
Instance Method Details
#changed? ⇒ Boolean
20 21 22 |
# File 'lib/kward/cli/editor_prompt_session.rb', line 20 def changed? @content != @initial_content end |
#initial_content ⇒ Object
24 25 26 |
# File 'lib/kward/cli/editor_prompt_session.rb', line 24 def initial_content @initial_content.dup end |
#replace(content) ⇒ Object
16 17 18 |
# File 'lib/kward/cli/editor_prompt_session.rb', line 16 def replace(content) @content = content.to_s end |