Module: Clacky::UIInterface
Overview
UIInterface defines the standard interface between Agent/CLI and UI implementations. All UI controllers (UIController, JsonUIController) must implement these methods.
Defined Under Namespace
Classes: LegacyProgressHandleAdapter
Instance Method Summary
collapse
-
#append_output(content) ⇒ Object
-
#clear_input ⇒ Object
-
#log(message, level: :info) ⇒ Object
-
#request_confirmation(message, default: true) ⇒ Object
Blocking interaction ===.
-
#set_idle_status ⇒ Object
-
#set_input_tips(message, type: :info) ⇒ Object
-
#set_working_status ⇒ Object
-
#show_assistant_message(content, files:) ⇒ Object
Output display ===.
-
#show_complete(iterations:, cost:, duration: nil, cache_stats: nil, awaiting_user_feedback: false) ⇒ Object
-
#show_diff(old_content, new_content, max_lines: 50) ⇒ Object
-
#show_error(message) ⇒ Object
-
#show_file_edit_preview(path) ⇒ Object
-
#show_file_error(error_message) ⇒ Object
-
#show_file_write_preview(path, is_new_file:) ⇒ Object
-
#show_info(message, prefix_newline: true) ⇒ Object
Status messages ===.
-
#show_progress(message = nil, prefix_newline: true, progress_type: "thinking", phase: "active", metadata: {}) ⇒ Object
Progress === Unified progress indicator with type-based display customization.
-
#show_shell_preview(command) ⇒ Object
-
#show_success(message) ⇒ Object
-
#show_token_usage(token_data) ⇒ Object
-
#show_tool_args(formatted_args) ⇒ Object
-
#show_tool_call(name, args) ⇒ Object
-
#show_tool_error(error) ⇒ Object
-
#show_tool_result(result) ⇒ Object
-
#show_tool_stdout(lines) ⇒ Object
-
#show_warning(message) ⇒ Object
-
#start_progress(message: nil, style: :primary, quiet_on_fast_finish: false) ⇒ #update, ...
Progress (v2: owned handles) ===.
-
#stop ⇒ Object
Path redaction (for encrypted brand skill tmpdirs) === === Lifecycle ===.
-
#update_sessionbar(tasks: nil, cost: nil, cost_source: nil, status: nil) ⇒ Object
State updates ===.
-
#update_todos(todos) ⇒ Object
-
#with_progress(message: nil, style: :primary, quiet_on_fast_finish: false) {|handle| ... } ⇒ Object
Run the given block with a progress indicator active.
Instance Method Details
#append_output(content) ⇒ Object
23
|
# File 'lib/clacky/ui_interface.rb', line 23
def append_output(content); end
|
118
|
# File 'lib/clacky/ui_interface.rb', line 118
def clear_input; end
|
#log(message, level: :info) ⇒ Object
30
|
# File 'lib/clacky/ui_interface.rb', line 30
def log(message, level: :info); end
|
#request_confirmation(message, default: true) ⇒ Object
115
|
# File 'lib/clacky/ui_interface.rb', line 115
def request_confirmation(message, default: true); end
|
#set_idle_status ⇒ Object
112
|
# File 'lib/clacky/ui_interface.rb', line 112
def set_idle_status; end
|
119
|
# File 'lib/clacky/ui_interface.rb', line 119
def set_input_tips(message, type: :info); end
|
#set_working_status ⇒ Object
111
|
# File 'lib/clacky/ui_interface.rb', line 111
def set_working_status; end
|
#show_assistant_message(content, files:) ⇒ Object
10
|
# File 'lib/clacky/ui_interface.rb', line 10
def show_assistant_message(content, files:); end
|
#show_complete(iterations:, cost:, duration: nil, cache_stats: nil, awaiting_user_feedback: false) ⇒ Object
22
|
# File 'lib/clacky/ui_interface.rb', line 22
def show_complete(iterations:, cost:, duration: nil, cache_stats: nil, awaiting_user_feedback: false); end
|
#show_diff(old_content, new_content, max_lines: 50) ⇒ Object
20
|
# File 'lib/clacky/ui_interface.rb', line 20
def show_diff(old_content, new_content, max_lines: 50); end
|
#show_error(message) ⇒ Object
28
|
# File 'lib/clacky/ui_interface.rb', line 28
def show_error(message); end
|
#show_file_edit_preview(path) ⇒ Object
17
|
# File 'lib/clacky/ui_interface.rb', line 17
def show_file_edit_preview(path); end
|
#show_file_error(error_message) ⇒ Object
18
|
# File 'lib/clacky/ui_interface.rb', line 18
def show_file_error(error_message); end
|
#show_file_write_preview(path, is_new_file:) ⇒ Object
16
|
# File 'lib/clacky/ui_interface.rb', line 16
def show_file_write_preview(path, is_new_file:); end
|
#show_info(message, prefix_newline: true) ⇒ Object
26
|
# File 'lib/clacky/ui_interface.rb', line 26
def show_info(message, prefix_newline: true); end
|
#show_progress(message = nil, prefix_newline: true, progress_type: "thinking", phase: "active", metadata: {}) ⇒ Object
Progress ===
Unified progress indicator with type-based display customization. progress_type: “thinking” | “retrying” | “idle_compress” | custom phase: “active” | “done” metadata: extensible hash (e.g., 3, total: 10 for retries)
37
|
# File 'lib/clacky/ui_interface.rb', line 37
def show_progress(message = nil, prefix_newline: true, progress_type: "thinking", phase: "active", metadata: {}); end
|
#show_shell_preview(command) ⇒ Object
19
|
# File 'lib/clacky/ui_interface.rb', line 19
def show_shell_preview(command); end
|
#show_success(message) ⇒ Object
29
|
# File 'lib/clacky/ui_interface.rb', line 29
def show_success(message); end
|
#show_token_usage(token_data) ⇒ Object
21
|
# File 'lib/clacky/ui_interface.rb', line 21
def show_token_usage(token_data); end
|
15
|
# File 'lib/clacky/ui_interface.rb', line 15
def show_tool_args(formatted_args); end
|
11
|
# File 'lib/clacky/ui_interface.rb', line 11
def show_tool_call(name, args); end
|
14
|
# File 'lib/clacky/ui_interface.rb', line 14
def show_tool_error(error); end
|
12
|
# File 'lib/clacky/ui_interface.rb', line 12
def show_tool_result(result); end
|
13
|
# File 'lib/clacky/ui_interface.rb', line 13
def show_tool_stdout(lines); end
|
#show_warning(message) ⇒ Object
27
|
# File 'lib/clacky/ui_interface.rb', line 27
def show_warning(message); end
|
#start_progress(message: nil, style: :primary, quiet_on_fast_finish: false) ⇒ #update, ...
Progress (v2: owned handles) ===
Start a new progress indicator and return an owned handle. The caller is responsible for finishing it — use with_progress (below) whenever possible to get ensure-based auto-close.
Default implementation degrades gracefully to the old show_progress API so UI implementations that haven’t migrated still behave correctly.
58
59
60
61
62
63
|
# File 'lib/clacky/ui_interface.rb', line 58
def start_progress(message: nil, style: :primary, quiet_on_fast_finish: false)
_ = quiet_on_fast_finish progress_type = style == :primary ? "thinking" : "idle_compress"
show_progress(message, progress_type: progress_type, phase: "active")
LegacyProgressHandleAdapter.new(self, progress_type: progress_type)
end
|
#stop ⇒ Object
Path redaction (for encrypted brand skill tmpdirs) ===
Lifecycle ===
123
|
# File 'lib/clacky/ui_interface.rb', line 123
def stop; end
|
#update_sessionbar(tasks: nil, cost: nil, cost_source: nil, status: nil) ⇒ Object
109
|
# File 'lib/clacky/ui_interface.rb', line 109
def update_sessionbar(tasks: nil, cost: nil, cost_source: nil, status: nil); end
|
#update_todos(todos) ⇒ Object
110
|
# File 'lib/clacky/ui_interface.rb', line 110
def update_todos(todos); end
|
#with_progress(message: nil, style: :primary, quiet_on_fast_finish: false) {|handle| ... } ⇒ Object
Run the given block with a progress indicator active. The handle is always finished in an ensure block — exceptions (including AgentInterrupted) cannot leave the ticker or entry orphaned.
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/clacky/ui_interface.rb', line 70
def with_progress(message: nil, style: :primary, quiet_on_fast_finish: false)
handle = start_progress(
message: message,
style: style,
quiet_on_fast_finish: quiet_on_fast_finish
)
begin
yield handle
ensure
handle.finish
end
end
|