Skip to content

Commit 357461b

Browse files
fix(orchestrator): add switch_project/clear_history/recent_history delegators (restore bin build) (#42)
## Summary \`src/main.rs\` calls three Orchestrator methods (\`switch_project\`, \`clear_history\`, \`recent_history\`) that don't exist on the type, so \`cargo check --bin mobile-ai\` fails with 4 E0599 errors. All three methods already exist on the inner \`ContextManager\`, so the fix is three pure-delegation forwarders. ## Changes (16 lines) - \`src/orchestrator.rs\`: - Import \`ConversationTurn\` from \`crate::types\` (already declared there) for \`recent_history\`'s return type - Add \`Orchestrator::switch_project(&mut self, impl Into<String>)\` → delegates to \`self.context.switch_project\` - Add \`Orchestrator::clear_history(&mut self)\` → delegates to \`self.context.clear_history\` - Add \`Orchestrator::recent_history(&self, usize) -> Vec<ConversationTurn>\` → delegates to \`self.context.recent_history\` ## Verification - \`cargo check --workspace\` — green - \`cargo test --lib\` — 39/41 pass; the 2 failing tests (\`snn::tests::test_lif_neuron_reset\` and \`snn::tests::test_spiking_network_reset\`) fail on main HEAD and are unrelated to this fix (SNN spike-reset behaviour, out of scope here). ## Context Surfaced 2026-05-27 by PR #41 (Cargo CVE phantom-strip pilot). #41's body noted the four pre-existing E0599 errors as out-of-scope for the CVE work and worth fixing separately. This is that follow-up. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8f2d1f2 commit 357461b

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/orchestrator.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::{
1818
context::ContextManager,
1919
expert::ExpertSystem,
2020
router::{Router, RouterConfig},
21-
types::{Query, Response, ResponseMetadata, RoutingDecision},
21+
types::{ConversationTurn, Query, Response, ResponseMetadata, RoutingDecision},
2222
};
2323

2424
/// Orchestrator: Coordinates the full AI pipeline.
@@ -82,6 +82,21 @@ impl Orchestrator {
8282

8383
Ok(response)
8484
}
85+
86+
/// Set the active project on the underlying ContextManager.
87+
pub fn switch_project(&mut self, project: impl Into<String>) {
88+
self.context.switch_project(project);
89+
}
90+
91+
/// Drop the active project's conversation history.
92+
pub fn clear_history(&mut self) {
93+
self.context.clear_history();
94+
}
95+
96+
/// Borrow the N most recent turns from the active project's history.
97+
pub fn recent_history(&self, n: usize) -> Vec<ConversationTurn> {
98+
self.context.recent_history(n)
99+
}
85100
}
86101

87102
impl Default for Orchestrator {

0 commit comments

Comments
 (0)