MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / execute

Method execute

crates/chat-cli/src/cli/chat/cli/compact.rs:58–79  ·  view source on GitHub ↗
(self, os: &mut Os, session: &mut ChatSession)

Source from the content-addressed store, hash-verified

56
57impl CompactArgs {
58 pub async fn execute(self, os: &mut Os, session: &mut ChatSession) -> Result<ChatState, ChatError> {
59 let default = CompactStrategy::default();
60 let prompt = if self.prompt.is_empty() {
61 None
62 } else {
63 Some(self.prompt.join(" "))
64 };
65
66 // Compact interrupts the current conversation so this will always result in a new user
67 // turn.
68 session.reset_user_turn();
69
70 session
71 .compact_history(os, prompt, self.show_summary, CompactStrategy {
72 messages_to_exclude: self.messages_to_exclude.unwrap_or(default.messages_to_exclude),
73 truncate_large_messages: self.truncate_large_messages.unwrap_or(default.truncate_large_messages),
74 max_message_length: self.max_message_length.map_or(default.max_message_length, |v| {
75 v.clamp(UserMessageContent::TRUNCATED_SUFFIX.len(), MAX_USER_MESSAGE_SIZE)
76 }),
77 })
78 .await
79 }
80}
81
82/// Parameters for performing the history compaction request.

Callers

nothing calls this directly

Calls 5

joinMethod · 0.80
reset_user_turnMethod · 0.80
compact_historyMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected