Fix collect_results: read outputs from self.state, not auto.outputs
The output tool closure writes directly to Subconscious.state, so auto.outputs is always empty. collect_results now reads surface, reflection, and thalamus keys from self.state. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
dd85a56902
commit
e106b90a71
1 changed files with 7 additions and 12 deletions
|
|
@ -476,18 +476,13 @@ impl Subconscious {
|
||||||
match result {
|
match result {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
let name = self.agents[idx].name.clone();
|
let name = self.agents[idx].name.clone();
|
||||||
let outputs = std::mem::take(&mut self.agents[idx].auto.outputs);
|
|
||||||
// Merge into shared persistent state
|
|
||||||
for (k, v) in &outputs {
|
|
||||||
self.state.insert(k.clone(), v.clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inject all outputs into the conscious agent under one lock
|
// Check state for outputs (written by the output tool closure)
|
||||||
let has_outputs = outputs.contains_key("surface")
|
let has_outputs = self.state.contains_key("surface")
|
||||||
|| outputs.contains_key("reflection")
|
|| self.state.contains_key("reflection")
|
||||||
|| outputs.contains_key("thalamus");
|
|| self.state.contains_key("thalamus");
|
||||||
if has_outputs {
|
if has_outputs {
|
||||||
if let Some(surface_str) = outputs.get("surface") {
|
if let Some(surface_str) = self.state.get("surface").cloned() {
|
||||||
let store = crate::store::Store::cached().await.ok();
|
let store = crate::store::Store::cached().await.ok();
|
||||||
let store_guard = match &store {
|
let store_guard = match &store {
|
||||||
Some(s) => Some(s.lock().await),
|
Some(s) => Some(s.lock().await),
|
||||||
|
|
@ -505,7 +500,7 @@ impl Subconscious {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(reflection) = outputs.get("reflection") {
|
if let Some(reflection) = self.state.get("reflection").cloned() {
|
||||||
if !reflection.trim().is_empty() {
|
if !reflection.trim().is_empty() {
|
||||||
agent.push_node(AstNode::dmn(format!(
|
agent.push_node(AstNode::dmn(format!(
|
||||||
"--- subconscious reflection ---\n{}",
|
"--- subconscious reflection ---\n{}",
|
||||||
|
|
@ -514,7 +509,7 @@ impl Subconscious {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(nudge) = outputs.get("thalamus") {
|
if let Some(nudge) = self.state.get("thalamus").cloned() {
|
||||||
let nudge = nudge.trim();
|
let nudge = nudge.trim();
|
||||||
if !nudge.is_empty() && nudge != "ok" {
|
if !nudge.is_empty() && nudge != "ok" {
|
||||||
agent.push_node(AstNode::dmn(format!(
|
agent.push_node(AstNode::dmn(format!(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue