Move API code from user/ to agent/
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
021eafe6da
commit
9bebbcb635
22 changed files with 259 additions and 251 deletions
|
|
@ -34,7 +34,9 @@ use poc_memory::dbglog;
|
|||
|
||||
use poc_memory::user::*;
|
||||
use poc_memory::agent::{Agent, TurnResult};
|
||||
use poc_memory::user::api::ApiClient;
|
||||
use poc_memory::agent::api::ApiClient;
|
||||
use poc_memory::agent::api::types as api_types;
|
||||
use poc_memory::agent::context as ctx;
|
||||
use poc_memory::user::tui::HotkeyAction;
|
||||
use poc_memory::config::{self, AppConfig, SessionConfig};
|
||||
use poc_memory::user::ui_channel::{ContextInfo, StatusInfo, StreamTarget, UiMessage};
|
||||
|
|
@ -518,7 +520,7 @@ impl Session {
|
|||
let entries = agent_guard.entries_mut();
|
||||
let mut last_user_text = None;
|
||||
while let Some(entry) = entries.last() {
|
||||
if entry.message().role == poc_memory::user::types::Role::User {
|
||||
if entry.message().role == api_types::Role::User {
|
||||
last_user_text =
|
||||
Some(entries.pop().unwrap().message().content_text().to_string());
|
||||
break;
|
||||
|
|
@ -1091,7 +1093,7 @@ fn drain_ui_messages(rx: &mut ui_channel::UiReceiver, app: &mut tui::App) -> boo
|
|||
/// conversation history immediately on restart. Shows user input,
|
||||
/// assistant responses, and brief tool call summaries. Skips the system
|
||||
/// prompt, context message, DMN plumbing, and image injection messages.
|
||||
fn replay_session_to_ui(entries: &[types::ConversationEntry], ui_tx: &ui_channel::UiSender) {
|
||||
fn replay_session_to_ui(entries: &[ctx::ConversationEntry], ui_tx: &ui_channel::UiSender) {
|
||||
use poc_memory::user::ui_channel::StreamTarget;
|
||||
|
||||
dbglog!("[replay] replaying {} entries to UI", entries.len());
|
||||
|
|
@ -1111,8 +1113,8 @@ fn replay_session_to_ui(entries: &[types::ConversationEntry], ui_tx: &ui_channel
|
|||
if entry.is_memory() { continue; }
|
||||
let msg = entry.message();
|
||||
match msg.role {
|
||||
types::Role::System => {}
|
||||
types::Role::User => {
|
||||
api_types::Role::System => {}
|
||||
api_types::Role::User => {
|
||||
// Skip context message (always the first user message)
|
||||
if !seen_first_user {
|
||||
seen_first_user = true;
|
||||
|
|
@ -1140,7 +1142,7 @@ fn replay_session_to_ui(entries: &[types::ConversationEntry], ui_tx: &ui_channel
|
|||
let _ = ui_tx.send(UiMessage::UserInput(text.to_string()));
|
||||
}
|
||||
}
|
||||
types::Role::Assistant => {
|
||||
api_types::Role::Assistant => {
|
||||
if let Some(ref calls) = msg.tool_calls {
|
||||
for call in calls {
|
||||
let _ = ui_tx.send(UiMessage::ToolCall {
|
||||
|
|
@ -1156,7 +1158,7 @@ fn replay_session_to_ui(entries: &[types::ConversationEntry], ui_tx: &ui_channel
|
|||
.send(UiMessage::TextDelta(format!("{}\n", text), target));
|
||||
}
|
||||
}
|
||||
types::Role::Tool => {
|
||||
api_types::Role::Tool => {
|
||||
let text = msg.content_text();
|
||||
let preview: String =
|
||||
text.lines().take(3).collect::<Vec<_>>().join("\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue