add unreachable_pub lint, fix all 17 violations
pub → pub(crate) for SseReader methods (used across child modules). pub → pub(super) for openai::stream_events, tool definitions, store helpers. pub → private for normalize_link and differentiate_hub_with_graph (only used within their own files). Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
af3929cc65
commit
b0e852a05f
7 changed files with 15 additions and 15 deletions
|
|
@ -309,7 +309,7 @@ pub(crate) struct SseReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SseReader {
|
impl SseReader {
|
||||||
pub fn new(ui_tx: &UiSender) -> Self {
|
pub(crate) fn new(ui_tx: &UiSender) -> Self {
|
||||||
Self {
|
Self {
|
||||||
line_buf: String::new(),
|
line_buf: String::new(),
|
||||||
chunk_timeout: Duration::from_secs(120),
|
chunk_timeout: Duration::from_secs(120),
|
||||||
|
|
@ -343,7 +343,7 @@ impl SseReader {
|
||||||
/// Read the next SSE event from the response stream.
|
/// Read the next SSE event from the response stream.
|
||||||
/// Returns Ok(Some(value)) for each parsed data line,
|
/// Returns Ok(Some(value)) for each parsed data line,
|
||||||
/// Ok(None) when the stream ends or [DONE] is received.
|
/// Ok(None) when the stream ends or [DONE] is received.
|
||||||
pub async fn next_event(
|
pub(crate) async fn next_event(
|
||||||
&mut self,
|
&mut self,
|
||||||
response: &mut reqwest::Response,
|
response: &mut reqwest::Response,
|
||||||
) -> Result<Option<serde_json::Value>> {
|
) -> Result<Option<serde_json::Value>> {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use super::StreamEvent;
|
||||||
/// Stream SSE events from an OpenAI-compatible endpoint, sending
|
/// Stream SSE events from an OpenAI-compatible endpoint, sending
|
||||||
/// parsed StreamEvents through the channel. The caller (runner)
|
/// parsed StreamEvents through the channel. The caller (runner)
|
||||||
/// handles routing to the UI.
|
/// handles routing to the UI.
|
||||||
pub async fn stream_events(
|
pub(super) async fn stream_events(
|
||||||
client: &Client,
|
client: &Client,
|
||||||
base_url: &str,
|
base_url: &str,
|
||||||
api_key: &str,
|
api_key: &str,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use anyhow::{Context, Result};
|
||||||
use super::ToolOutput;
|
use super::ToolOutput;
|
||||||
use crate::agent::types::ToolDef;
|
use crate::agent::types::ToolDef;
|
||||||
|
|
||||||
pub fn pause(_args: &serde_json::Value) -> Result<ToolOutput> {
|
pub(super) fn pause(_args: &serde_json::Value) -> Result<ToolOutput> {
|
||||||
Ok(ToolOutput {
|
Ok(ToolOutput {
|
||||||
text: "Pausing autonomous behavior. Only user input will wake you.".to_string(),
|
text: "Pausing autonomous behavior. Only user input will wake you.".to_string(),
|
||||||
is_yield: true,
|
is_yield: true,
|
||||||
|
|
@ -19,7 +19,7 @@ pub fn pause(_args: &serde_json::Value) -> Result<ToolOutput> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn switch_model(args: &serde_json::Value) -> Result<ToolOutput> {
|
pub(super) fn switch_model(args: &serde_json::Value) -> Result<ToolOutput> {
|
||||||
let model = args
|
let model = args
|
||||||
.get("model")
|
.get("model")
|
||||||
.and_then(|v| v.as_str())
|
.and_then(|v| v.as_str())
|
||||||
|
|
@ -36,7 +36,7 @@ pub fn switch_model(args: &serde_json::Value) -> Result<ToolOutput> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn yield_to_user(args: &serde_json::Value) -> Result<ToolOutput> {
|
pub(super) fn yield_to_user(args: &serde_json::Value) -> Result<ToolOutput> {
|
||||||
let msg = args
|
let msg = args
|
||||||
.get("message")
|
.get("message")
|
||||||
.and_then(|v| v.as_str())
|
.and_then(|v| v.as_str())
|
||||||
|
|
@ -50,7 +50,7 @@ pub fn yield_to_user(args: &serde_json::Value) -> Result<ToolOutput> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn definitions() -> Vec<ToolDef> {
|
pub(super) fn definitions() -> Vec<ToolDef> {
|
||||||
vec![
|
vec![
|
||||||
ToolDef::new(
|
ToolDef::new(
|
||||||
"switch_model",
|
"switch_model",
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ struct Args {
|
||||||
|
|
||||||
fn default_lines() -> usize { 50 }
|
fn default_lines() -> usize { 50 }
|
||||||
|
|
||||||
pub fn definition() -> ToolDef {
|
pub(super) fn definition() -> ToolDef {
|
||||||
ToolDef::new(
|
ToolDef::new(
|
||||||
"view_image",
|
"view_image",
|
||||||
"View an image file or capture a tmux pane screenshot. \
|
"View an image file or capture a tmux pane screenshot. \
|
||||||
|
|
@ -49,7 +49,7 @@ pub fn definition() -> ToolDef {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// View an image file or capture a tmux pane.
|
/// View an image file or capture a tmux pane.
|
||||||
pub fn view_image(args: &serde_json::Value) -> Result<ToolOutput> {
|
pub(super) fn view_image(args: &serde_json::Value) -> Result<ToolOutput> {
|
||||||
let a: Args = serde_json::from_value(args.clone())
|
let a: Args = serde_json::from_value(args.clone())
|
||||||
.context("invalid view_image arguments")?;
|
.context("invalid view_image arguments")?;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ pub fn differentiate_hub(store: &Store, hub_key: &str) -> Option<Vec<LinkMove>>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Like differentiate_hub but uses a pre-built graph.
|
/// Like differentiate_hub but uses a pre-built graph.
|
||||||
pub fn differentiate_hub_with_graph(store: &Store, hub_key: &str, graph: &Graph) -> Option<Vec<LinkMove>> {
|
fn differentiate_hub_with_graph(store: &Store, hub_key: &str, graph: &Graph) -> Option<Vec<LinkMove>> {
|
||||||
let degree = graph.degree(hub_key);
|
let degree = graph.degree(hub_key);
|
||||||
|
|
||||||
// Only differentiate actual hubs
|
// Only differentiate actual hubs
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ pub struct MemoryUnit {
|
||||||
pub source_ref: Option<String>,
|
pub source_ref: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn classify_filename(filename: &str) -> NodeType {
|
pub(super) fn classify_filename(filename: &str) -> NodeType {
|
||||||
let bare = filename.strip_suffix(".md").unwrap_or(filename);
|
let bare = filename.strip_suffix(".md").unwrap_or(filename);
|
||||||
if bare.starts_with("daily-") { NodeType::EpisodicDaily }
|
if bare.starts_with("daily-") { NodeType::EpisodicDaily }
|
||||||
else if bare.starts_with("weekly-") { NodeType::EpisodicWeekly }
|
else if bare.starts_with("weekly-") { NodeType::EpisodicWeekly }
|
||||||
|
|
@ -147,7 +147,7 @@ fn extract_md_links(content: &str, re: &Regex, source_file: &str) -> Vec<String>
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn normalize_link(target: &str, source_file: &str) -> String {
|
fn normalize_link(target: &str, source_file: &str) -> String {
|
||||||
let source_bare = source_file.strip_suffix(".md").unwrap_or(source_file);
|
let source_bare = source_file.strip_suffix(".md").unwrap_or(source_file);
|
||||||
|
|
||||||
if target.starts_with('#') {
|
if target.starts_with('#') {
|
||||||
|
|
|
||||||
|
|
@ -434,7 +434,7 @@ pub struct GapRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Per-node agent visit index: node_key → (agent_type → last_visit_timestamp)
|
/// Per-node agent visit index: node_key → (agent_type → last_visit_timestamp)
|
||||||
pub type VisitIndex = HashMap<String, HashMap<String, i64>>;
|
pub(super) type VisitIndex = HashMap<String, HashMap<String, i64>>;
|
||||||
|
|
||||||
// The full in-memory store
|
// The full in-memory store
|
||||||
#[derive(Default, Serialize, Deserialize)]
|
#[derive(Default, Serialize, Deserialize)]
|
||||||
|
|
@ -557,7 +557,7 @@ capnp_message!(AgentVisit,
|
||||||
skip: [],
|
skip: [],
|
||||||
);
|
);
|
||||||
|
|
||||||
pub fn new_visit(node_uuid: [u8; 16], node_key: &str, agent: &str, outcome: &str) -> AgentVisit {
|
pub(super) fn new_visit(node_uuid: [u8; 16], node_key: &str, agent: &str, outcome: &str) -> AgentVisit {
|
||||||
AgentVisit {
|
AgentVisit {
|
||||||
node_uuid,
|
node_uuid,
|
||||||
node_key: node_key.to_string(),
|
node_key: node_key.to_string(),
|
||||||
|
|
@ -588,7 +588,7 @@ capnp_message!(TranscriptSegment,
|
||||||
skip: [],
|
skip: [],
|
||||||
);
|
);
|
||||||
|
|
||||||
pub fn new_transcript_segment(transcript_id: &str, segment_index: u32, agent: &str) -> TranscriptSegment {
|
pub(super) fn new_transcript_segment(transcript_id: &str, segment_index: u32, agent: &str) -> TranscriptSegment {
|
||||||
TranscriptSegment {
|
TranscriptSegment {
|
||||||
transcript_id: transcript_id.to_string(),
|
transcript_id: transcript_id.to_string(),
|
||||||
segment_index,
|
segment_index,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue