mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
feat(tui): allow silent hidden-preface submissions
This commit is contained in:
+10
-2
@@ -2548,9 +2548,17 @@ impl App<'_> {
|
||||
widget.submit_text_message_with_preface(visible, preface);
|
||||
}
|
||||
}
|
||||
AppEvent::SubmitHiddenTextWithPreface { agent_text, preface } => {
|
||||
AppEvent::SubmitHiddenTextWithPreface {
|
||||
agent_text,
|
||||
preface,
|
||||
surface_notice,
|
||||
} => {
|
||||
if let AppState::Chat { widget } = &mut self.app_state {
|
||||
widget.submit_hidden_text_message_with_preface(agent_text, preface);
|
||||
widget.submit_hidden_text_message_with_preface_and_notice(
|
||||
agent_text,
|
||||
preface,
|
||||
surface_notice,
|
||||
);
|
||||
}
|
||||
}
|
||||
AppEvent::RunReviewCommand(args) => {
|
||||
|
||||
@@ -331,8 +331,14 @@ pub(crate) enum AppEvent {
|
||||
/// Submit a message with hidden preface instructions
|
||||
SubmitTextWithPreface { visible: String, preface: String },
|
||||
|
||||
/// Submit a hidden message that is not rendered in history but still sent to the LLM
|
||||
SubmitHiddenTextWithPreface { agent_text: String, preface: String },
|
||||
/// Submit a hidden message that is not rendered in history but still sent to the LLM.
|
||||
/// When `surface_notice` is true, the TUI shows a developer-style notice with the
|
||||
/// injected text; when false, the injection is silent.
|
||||
SubmitHiddenTextWithPreface {
|
||||
agent_text: String,
|
||||
preface: String,
|
||||
surface_notice: bool,
|
||||
},
|
||||
|
||||
/// Run a review with an explicit prompt/hint pair (used by TUI selections)
|
||||
RunReviewWithScope {
|
||||
|
||||
@@ -26793,6 +26793,18 @@ Have we met every part of this goal and is there no further work to do?"#
|
||||
&mut self,
|
||||
agent_text: String,
|
||||
preface: String,
|
||||
) {
|
||||
self.submit_hidden_text_message_with_preface_and_notice(agent_text, preface, true);
|
||||
}
|
||||
|
||||
/// Submit a hidden message with optional notice surfacing.
|
||||
/// When `surface_notice` is true, the injected text is also shown in history
|
||||
/// as a developer-style notice; when false, the injection is silent.
|
||||
pub(crate) fn submit_hidden_text_message_with_preface_and_notice(
|
||||
&mut self,
|
||||
agent_text: String,
|
||||
preface: String,
|
||||
surface_notice: bool,
|
||||
) {
|
||||
if agent_text.trim().is_empty() && preface.trim().is_empty() {
|
||||
return;
|
||||
@@ -26814,16 +26826,18 @@ Have we met every part of this goal and is there no further work to do?"#
|
||||
return;
|
||||
}
|
||||
|
||||
// Surface immediately in the TUI as a notice (developer-style message).
|
||||
let mut notice_lines = Vec::new();
|
||||
if !preface_cache.trim().is_empty() {
|
||||
notice_lines.push(preface_cache.trim().to_string());
|
||||
}
|
||||
if !agent_cache.trim().is_empty() {
|
||||
notice_lines.push(agent_cache.trim().to_string());
|
||||
}
|
||||
if !notice_lines.is_empty() {
|
||||
self.history_push_plain_paragraphs(PlainMessageKind::Notice, notice_lines);
|
||||
if surface_notice {
|
||||
// Surface immediately in the TUI as a notice (developer-style message).
|
||||
let mut notice_lines = Vec::new();
|
||||
if !preface_cache.trim().is_empty() {
|
||||
notice_lines.push(preface_cache.trim().to_string());
|
||||
}
|
||||
if !agent_cache.trim().is_empty() {
|
||||
notice_lines.push(agent_cache.trim().to_string());
|
||||
}
|
||||
if !notice_lines.is_empty() {
|
||||
self.history_push_plain_paragraphs(PlainMessageKind::Notice, notice_lines);
|
||||
}
|
||||
}
|
||||
|
||||
let msg = UserMessage {
|
||||
@@ -34016,6 +34030,7 @@ impl ChatWidget<'_> {
|
||||
tx.send(AppEvent::SubmitHiddenTextWithPreface {
|
||||
agent_text: message,
|
||||
preface: String::new(),
|
||||
surface_notice: false,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user