forked from kent/consciousness
Agent/AgentState split complete — separate context and state locks
Agent is now Arc<Agent> (immutable config). ContextState and AgentState have separate tokio::sync::Mutex locks. The parser locks only context, tool dispatch locks only state. No contention between the two. All callers migrated: mind/, user/, tools/, oneshot, dmn, learn. 28 tests pass, zero errors. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
1d61b091b0
commit
0b9813431a
8 changed files with 156 additions and 159 deletions
|
|
@ -20,22 +20,22 @@ impl ConsciousScreen {
|
|||
}
|
||||
|
||||
fn read_context_views(&self) -> Vec<SectionView> {
|
||||
let ag = match self.agent.try_lock() {
|
||||
Ok(ag) => ag,
|
||||
let ctx = match self.agent.context.try_lock() {
|
||||
Ok(ctx) => ctx,
|
||||
Err(_) => return Vec::new(),
|
||||
};
|
||||
|
||||
let mut views: Vec<SectionView> = Vec::new();
|
||||
|
||||
views.push(section_to_view("System", ag.context.system()));
|
||||
views.push(section_to_view("Identity", ag.context.identity()));
|
||||
views.push(section_to_view("Journal", ag.context.journal()));
|
||||
views.push(section_to_view("System", ctx.system()));
|
||||
views.push(section_to_view("Identity", ctx.identity()));
|
||||
views.push(section_to_view("Journal", ctx.journal()));
|
||||
|
||||
// Memory nodes extracted from conversation
|
||||
let mut mem_children: Vec<SectionView> = Vec::new();
|
||||
let mut scored = 0usize;
|
||||
let mut unscored = 0usize;
|
||||
for node in ag.context.conversation() {
|
||||
for node in ctx.conversation() {
|
||||
if let AstNode::Leaf(leaf) = node {
|
||||
if let NodeBody::Memory { key, score, text } = leaf.body() {
|
||||
let status = match score {
|
||||
|
|
@ -63,7 +63,7 @@ impl ConsciousScreen {
|
|||
});
|
||||
}
|
||||
|
||||
views.push(section_to_view("Conversation", ag.context.conversation()));
|
||||
views.push(section_to_view("Conversation", ctx.conversation()));
|
||||
views
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue