Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/maple-agent/app/assets/icons/file-text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion apps/maple-agent/app/locales/de/app.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,12 @@ chat-turn-worked = Gearbeitet
chat-turn-worked-seconds = { $seconds } s gearbeitet
# $minutes is a whole number of minutes; $seconds is the rest, under 60.
chat-turn-worked-minutes = { $minutes } min { $seconds } s gearbeitet
# $count is the number of tool and thinking steps in one activity chunk.
chat-activity-steps =
{ $count ->
[one] { $count } Schritt
*[other] { $count } Schritte
}
chat-settings = Einstellungen
chat-usage = Nutzung
chat-usage-unavailable = Nutzung nicht verfügbar
Expand Down Expand Up @@ -1721,7 +1727,6 @@ chat-thinking-save-failed = Denkstufe konnte nicht gespeichert werden: { $error
chat-composer-placeholder = Bitte Maple, in diesem Ordner zu arbeiten…
chat-side-thread-placeholder = Stelle eine Nebenfrage (Esc verlässt das Gespräch)…
chat-queue-edit-placeholder = Bearbeite die eingereihte Nachricht und sende sie, um ihren Platz zu behalten. Escape verwirft sie.
chat-status-completed = abgeschlossen
chat-status-failed = fehlgeschlagen
chat-status-stopped = gestoppt
chat-status-running = läuft
Expand Down
7 changes: 6 additions & 1 deletion apps/maple-agent/app/locales/en/app.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,12 @@ chat-turn-worked = Worked
chat-turn-worked-seconds = Worked for { $seconds }s
# $minutes is a whole number of minutes; $seconds is the rest, under 60.
chat-turn-worked-minutes = Worked for { $minutes }m { $seconds }s
# $count is the number of tool and thinking steps in one activity chunk.
chat-activity-steps =
{ $count ->
[one] { $count } step
*[other] { $count } steps
}
chat-settings = Settings
chat-usage = Usage
chat-usage-unavailable = Usage unavailable
Expand Down Expand Up @@ -1721,7 +1727,6 @@ chat-thinking-save-failed = Could not save the thinking level: { $error }
chat-composer-placeholder = Ask Maple to work in this folder…
chat-side-thread-placeholder = Ask a side question (Esc to leave the thread)…
chat-queue-edit-placeholder = Edit the queued message, then send to keep its place. Escape discards.
chat-status-completed = completed
chat-status-failed = failed
chat-status-stopped = stopped
chat-status-running = running
Expand Down
7 changes: 6 additions & 1 deletion apps/maple-agent/app/locales/es/app.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,12 @@ chat-turn-worked = Trabajó
chat-turn-worked-seconds = Trabajó { $seconds } s
# $minutes is a whole number of minutes; $seconds is the rest, under 60.
chat-turn-worked-minutes = Trabajó { $minutes } min { $seconds } s
# $count is the number of tool and thinking steps in one activity chunk.
chat-activity-steps =
{ $count ->
[one] { $count } paso
*[other] { $count } pasos
}
chat-settings = Configuración
chat-usage = Uso
chat-usage-unavailable = Uso no disponible
Expand Down Expand Up @@ -1598,7 +1604,6 @@ chat-thinking-save-failed = No se pudo guardar el nivel de razonamiento: { $erro
chat-composer-placeholder = Pídele a Maple que trabaje en esta carpeta…
chat-side-thread-placeholder = Haz una pregunta aparte (Esc para salir del hilo)…
chat-queue-edit-placeholder = Edita el mensaje en cola y envíalo para conservar su lugar. Esc descarta los cambios.
chat-status-completed = completado
chat-status-failed = falló
chat-status-stopped = detenido
chat-status-running = en ejecución
Expand Down
3 changes: 2 additions & 1 deletion apps/maple-agent/app/locales/ko/app.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,8 @@ chat-turn-worked = 작업 완료
chat-turn-worked-seconds = { $seconds }초 동안 작업했어요
# $minutes is a whole number of minutes; $seconds is the rest, under 60.
chat-turn-worked-minutes = { $minutes }분 { $seconds }초 동안 작업했어요
# $count is the number of tool and thinking steps in one activity chunk.
chat-activity-steps = 단계 { $count }개
chat-settings = 설정
chat-usage = 사용량
chat-usage-unavailable = 사용량을 확인할 수 없음
Expand Down Expand Up @@ -1667,7 +1669,6 @@ chat-thinking-save-failed = 사고 수준을 저장하지 못했어요: { $error
chat-composer-placeholder = 이 폴더에서 할 작업을 Maple에 요청하세요…
chat-side-thread-placeholder = 곁가지 질문을 입력하세요(Esc로 스레드 나가기)…
chat-queue-edit-placeholder = 대기 중인 메시지를 편집한 뒤 보내면 순서가 유지돼요. Escape를 누르면 취소돼요.
chat-status-completed = 완료됨
chat-status-failed = 실패
chat-status-stopped = 중지됨
chat-status-running = 실행 중
Expand Down
1 change: 1 addition & 0 deletions apps/maple-agent/app/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ assets!(
"icons/effort-burst.svg",
"icons/ellipsis.svg",
"icons/external-link.svg",
"icons/file-text.svg",
"icons/folder-open.svg",
"icons/folder-plus.svg",
"icons/folder.svg",
Expand Down
22 changes: 21 additions & 1 deletion apps/maple-agent/app/src/ui/chat/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use maple_agent::agent::{AgentTimelineItem, ExternalAgentActivity};

use super::ChatScreen;
use super::transcript::{
PlanEntry, diff_lines_for, external_agent_activity, plan_entries, tool_input_line,
PlanEntry, diff_counts, diff_lines_for, external_agent_activity, plan_entries, tool_input_line,
tool_output_markdown,
};
use crate::ui::markdown;
Expand Down Expand Up @@ -270,6 +270,11 @@ pub(super) struct ItemDerived {
pub(super) input_line: Option<SharedString>,
/// +/- lines of an edit or write tool, capped at `MAX_DIFF_LINES`.
pub(super) diff_lines: Arc<Vec<(char, SharedString)>>,
/// Lines that edit or write adds and removes, as "+12" and "−3".
pub(super) changed: Option<(SharedString, SharedString)>,
/// What a tool call acts on: the command, path or query the host put
/// in its label.
pub(super) acted_on: Option<SharedString>,
/// What an external agent (Codex) did, for the row of the tool call
/// that ran it.
pub(super) external_agent: Option<Arc<ExternalAgentActivity>>,
Expand All @@ -282,6 +287,8 @@ pub(super) const MAX_DIFF_LINES: usize = 200;
impl ItemDerived {
fn build(item: &AgentTimelineItem) -> Self {
let output_text = tool_output_markdown(item).map(SharedString::from);
// Counted from the whole input: the lines shown stop at a cap.
let (added, removed) = diff_counts(item);
Self {
text: SharedString::from(item.text.clone().unwrap_or_default()),
attachments: super::transcript::attachment_metadata(item)
Expand All @@ -295,6 +302,19 @@ impl ItemDerived {
.collect(),
output_text,
input_line: tool_input_line(item).map(SharedString::from),
changed: (added + removed > 0).then(|| {
(
format!("+{added}").into(),
format!("\u{2212}{removed}").into(),
)
}),
acted_on: item
.label
.as_ref()
// A skill's name is already its row's title.
.filter(|label| label.kind == "tool" && label.name.as_deref() != Some("load_skill"))
.and_then(|label| label.detail.clone())
.map(SharedString::from),
diff_lines: Arc::new(diff_lines_for(item)),
external_agent: external_agent_activity(item).map(Arc::new),
plan: plan_entries(item),
Expand Down
37 changes: 29 additions & 8 deletions apps/maple-agent/app/src/ui/chat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ mod sending;
mod sidebar;
mod speech;
mod staging;
mod step;
mod summaries;
#[cfg(test)]
mod tests;
Expand Down Expand Up @@ -227,6 +228,9 @@ struct TranscriptCtx<'a> {
/// How far the row's just-opened details are through fading in; 1 at
/// rest.
reveal: f32,
/// For a step: whether the thread's rail runs on to the steps drawn
/// right above and below it.
rail: step::Rail,
}

/// Text-to-speech progress for one message.
Expand Down Expand Up @@ -847,9 +851,8 @@ pub struct ChatScreen {
toggled_tools: HashSet<String>,
/// Each row's place in its turn, rebuilt or extended with `timeline`.
turns: turn::Turns,
/// Lead item ids of turns whose line was clicked; membership inverts
/// the `tool_details` default for whether that turn's steps show.
toggled_turns: HashSet<String>,
/// Chunk lead ids whose disclosure differs from `tool_details`.
toggled_chunks: HashSet<String>,
/// How long finished turns worked, by lead item id. Only turns this
/// window timed have one.
turn_worked: HashMap<String, std::time::Duration>,
Expand Down Expand Up @@ -1695,7 +1698,7 @@ impl ChatScreen {
loading_since: None,
toggled_tools: HashSet::new(),
turns: turn::Turns::default(),
toggled_turns: HashSet::new(),
toggled_chunks: HashSet::new(),
turn_worked: HashMap::new(),
run_clocks: HashMap::new(),
run_tick_pending: std::cell::Cell::new(false),
Expand Down Expand Up @@ -3777,7 +3780,7 @@ impl ChatScreen {
self.attachment_queue.clear();
self.attachment_viewport = 0..0;
self.toggled_tools.clear();
self.toggled_turns.clear();
self.toggled_chunks.clear();
self.turn_worked.clear();
if let Some(composer) = self.composer.clone() {
composer.update(cx, |input, cx| input.reset_vim_context(cx));
Expand Down Expand Up @@ -6355,6 +6358,7 @@ impl ChatScreen {
} = item;
let existing = &mut self.timeline[index];
let part = turn::part(existing);
let step_before = turn::step_info(existing);
existing.revision = incoming_revision;
if let Some(label) = incoming_label {
match &mut existing.label {
Expand Down Expand Up @@ -6390,11 +6394,17 @@ impl ChatScreen {
existing.output = incoming_output.or_else(|| existing.output.take());
existing.merge = incoming_merge;
}
// A row that became a step, or stopped being one, moves
// every row after it to another place in its turn.
if turn::part(&self.timeline[index]) != part {
self.turns.rebuild(&self.timeline);
self.list_state.remeasure_items(index..self.timeline.len());
// A changed boundary can merge or split an earlier
// header. Remeasure without moving the scroll anchor.
self.list_state.remeasure_items(0..self.timeline.len());
} else if let Some(lead) = self.turns.update_step(
index,
step_before,
turn::step_info(&self.timeline[index]),
) {
self.list_state.remeasure_items(lead..lead + 1);
}
index
}
Expand All @@ -6409,6 +6419,17 @@ impl ChatScreen {
self.turns.push(&item);
self.timeline.push(item);
self.list_state.splice(index..index, 1);
// The step before a new one loses the gap under it, so
// the rail joins them: its height changed too.
if index > 0
&& matches!(self.turns.row(index), turn::TurnRow::Step(_))
&& self.turns.row(index - 1) != turn::TurnRow::Plain
{
self.list_state.remeasure_items(index - 1..index);
}
if let turn::TurnRow::Step(lead) = self.turns.row(index) {
self.list_state.remeasure_items(lead..lead + 1);
}
self.time_arrival(session_id, index);
index
}
Expand Down
28 changes: 13 additions & 15 deletions apps/maple-agent/app/src/ui/chat/navigation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,9 @@ impl ChatScreen {
let Some(&(index, _)) = self.timeline_index.get(&item_id) else {
return;
};
// On a turn's first step the selection is the turn's line.
if self.turns.row(index) == TurnRow::Lead {
self.toggle_turn(&item_id, cx);
// A chunk's first row selects its disclosure header.
if matches!(self.turns.row(index), TurnRow::Lead | TurnRow::Chunk) {
self.toggle_chunk(&item_id, cx);
return;
}
let Some(item) = self.timeline.get(index) else {
Expand Down Expand Up @@ -710,13 +710,13 @@ impl ChatScreen {
return;
}
let current = self.tool_details != self.toggled_tools.contains(item_id);
// A turn's first step sits under the turn's line: the line opens
// before the step's details do, and folds after them.
if self.turns.row(index) == TurnRow::Lead
&& self.turn_open(index) != expanded
// Open the chunk before its first step's details, and fold it
// after those details have closed.
if matches!(self.turns.row(index), TurnRow::Lead | TurnRow::Chunk)
&& self.chunk_open(index) != expanded
&& (expanded || !current)
{
self.toggle_turn(item_id, cx);
self.toggle_chunk(item_id, cx);
return;
}
if current != expanded {
Expand Down Expand Up @@ -803,18 +803,16 @@ impl ChatScreen {
.collect()
}

/// Whether the selection can rest on the row at `index`. A step under
/// a folded line draws nothing, and a turn's first step always draws
/// the line.
/// A folded chunk keeps its header navigable and hides its later steps.
fn timeline_row_navigable(&self, index: usize, item: &AgentTimelineItem) -> bool {
match self.turns.row(index) {
TurnRow::Lead => true,
TurnRow::Step(lead) => self.turn_open(lead) && timeline_item_is_navigable(item),
TurnRow::Lead | TurnRow::Chunk => true,
TurnRow::Step(lead) => self.chunk_open(lead) && timeline_item_is_navigable(item),
TurnRow::Plain => timeline_item_is_navigable(item),
}
}

/// A turn folded: a selection on one of its steps moves to its line.
/// Folding a chunk moves a hidden selection to its header.
pub(super) fn keep_application_selection_shown(&mut self, lead: usize) {
if !self.application_vim_enabled {
return;
Expand Down Expand Up @@ -1228,7 +1226,7 @@ impl ChatScreen {
}
}

fn timeline_item_is_navigable(item: &AgentTimelineItem) -> bool {
pub(super) fn timeline_item_is_navigable(item: &AgentTimelineItem) -> bool {
if item.item_type == "internal" {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/maple-agent/app/src/ui/chat/paging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ impl ChatScreen {
.map(|(i, item)| (item.id.clone(), (i, 0)))
.collect();
self.turns.rebuild(&self.timeline);
self.toggled_turns
self.toggled_chunks
.retain(|id| self.timeline_index.contains_key(id));
self.turn_worked
.retain(|id, _| self.timeline_index.contains_key(id));
Expand Down
Loading
Loading