Clean up warnings: StreamToken pub, dead oneshot code, SkipIndex

Made StreamToken pub (was pub(crate), needed by context.rs).
Removed dead API_CLIENT, get_client, sampling/priority fields
from oneshot. Suppressed pre-existing SkipIndex warning in learn.rs.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-08 16:35:57 -04:00
parent 2c401e24d6
commit 14fd8c9b90
4 changed files with 5 additions and 29 deletions

View file

@ -44,7 +44,7 @@ pub(crate) struct SamplingParams {
// ─────────────────────────────────────────────────────────────
/// One token from the streaming completions API.
pub(crate) enum StreamToken {
pub enum StreamToken {
Token { text: String, id: u32 },
Done { usage: Option<Usage> },
Error(String),

View file

@ -318,7 +318,7 @@ impl Agent {
loop {
let _thinking = start_activity(&agent, "thinking...").await;
let (mut rx, _stream_guard) = {
let (rx, _stream_guard) = {
let prompt_tokens = agent.assemble_prompt_tokens().await;
let st = agent.state.lock().await;
agent.client.stream_completion(

View file

@ -12,29 +12,11 @@ use crate::subconscious::{defs, prompts};
use std::fs;
use std::path::PathBuf;
use std::sync::OnceLock;
use super::api::ApiClient;
use super::context::AstNode;
use super::tools::{self as agent_tools};
use super::Agent;
// ---------------------------------------------------------------------------
// API client — shared across oneshot agent runs
// ---------------------------------------------------------------------------
static API_CLIENT: OnceLock<ApiClient> = OnceLock::new();
fn get_client() -> Result<&'static ApiClient, String> {
Ok(API_CLIENT.get_or_init(|| {
let config = crate::config::get();
let base_url = config.api_base_url.as_deref().unwrap_or("");
let api_key = config.api_key.as_deref().unwrap_or("");
let model = config.api_model.as_deref().unwrap_or("qwen-2.5-27b");
ApiClient::new(base_url, api_key, model)
}))
}
// ---------------------------------------------------------------------------
// AutoAgent — multi-step autonomous agent
// ---------------------------------------------------------------------------
@ -52,9 +34,6 @@ pub struct AutoAgent {
pub name: String,
pub tools: Vec<agent_tools::Tool>,
pub steps: Vec<AutoStep>,
sampling: super::api::SamplingParams,
priority: i32,
/// Named outputs from the agent's output() tool calls.
/// Collected per-run, read by Mind after completion.
pub outputs: std::collections::BTreeMap<String, String>,
// Observable status
@ -122,15 +101,11 @@ impl AutoAgent {
name: String,
tools: Vec<agent_tools::Tool>,
steps: Vec<AutoStep>,
temperature: f32,
priority: i32,
_temperature: f32,
_priority: i32,
) -> Self {
Self {
name, tools, steps,
sampling: super::api::SamplingParams {
temperature, top_p: 0.95, top_k: 20,
},
priority,
outputs: std::collections::BTreeMap::new(),
current_phase: String::new(),
turn: 0,