WIP: Rename context_new → context, delete old files, fix UI layer

Renamed context_new.rs to context.rs, deleted context_old.rs,
types.rs, openai.rs, parsing.rs. Updated all imports. Rewrote
user/context.rs and user/widgets.rs for new types. Stubbed
working_stack tool. Killed tokenize_conv_entry.

Remaining: mind/mod.rs, mind/dmn.rs, learn.rs, chat.rs,
subconscious.rs, oneshot.rs.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-08 15:20:26 -04:00
parent 22146156d4
commit bf3e2a9b73
9 changed files with 1063 additions and 1636 deletions

View file

@ -15,7 +15,6 @@
pub mod api;
pub mod context;
pub mod context_new;
pub mod oneshot;
pub mod tokenizer;
pub mod tools;
@ -24,7 +23,7 @@ use std::sync::Arc;
use anyhow::Result;
use api::ApiClient;
use context_new::{AstNode, NodeBody, ContextState, Section, Ast, PendingToolCall, ResponseParser, Role};
use context::{AstNode, NodeBody, ContextState, Section, Ast, PendingToolCall, ResponseParser, Role};
use tools::summarize_args;
use crate::mind::log::ConversationLog;
@ -418,13 +417,13 @@ impl Agent {
if let Some(e) = stream_error {
let err = anyhow::anyhow!("{}", e);
let mut me = agent.lock().await;
if context_new::is_context_overflow(&err) && overflow_retries < 2 {
if context::is_context_overflow(&err) && overflow_retries < 2 {
overflow_retries += 1;
me.notify(format!("context overflow — retrying ({}/2)", overflow_retries));
me.compact();
continue;
}
if context_new::is_stream_error(&err) && empty_retries < 2 {
if context::is_stream_error(&err) && empty_retries < 2 {
empty_retries += 1;
me.notify(format!("stream error — retrying ({}/2)", empty_retries));
drop(me);
@ -612,7 +611,7 @@ impl Agent {
journal_nodes.len()
};
let journal_budget = context_new::context_window() * 15 / 100;
let journal_budget = context::context_window() * 15 / 100;
let mut entries = Vec::new();
let mut total_tokens = 0;