huskies: merge 855
This commit is contained in:
@@ -11,6 +11,7 @@ use std::sync::{Arc, Mutex};
|
||||
use tokio::sync::broadcast;
|
||||
|
||||
use crate::agent_log::AgentLogWriter;
|
||||
use crate::http::context::AppContext;
|
||||
|
||||
use super::{AgentEvent, TokenUsage};
|
||||
|
||||
@@ -23,9 +24,10 @@ pub struct RuntimeContext {
|
||||
pub prompt: String,
|
||||
pub cwd: String,
|
||||
pub inactivity_timeout_secs: u64,
|
||||
/// Port of the huskies MCP server, used by API-based runtimes (Gemini, OpenAI)
|
||||
/// to call back for tool execution.
|
||||
pub mcp_port: u16,
|
||||
/// Shared application context, used by API-based runtimes (Gemini, OpenAI)
|
||||
/// to invoke MCP tool dispatch directly without an HTTP round-trip.
|
||||
/// `None` in tests or when the pool is created before `AppContext` exists.
|
||||
pub app_ctx: Option<Arc<AppContext>>,
|
||||
/// When set, resume a previous Claude Code session instead of starting fresh.
|
||||
///
|
||||
/// The CLI is invoked as `claude --resume <session_id> [-p <prompt>]` rather
|
||||
@@ -95,6 +97,12 @@ pub trait AgentRuntime: Send + Sync {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::http::context::AppContext;
|
||||
|
||||
fn test_app_ctx() -> Arc<AppContext> {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
Arc::new(AppContext::new_test(tmp.path().to_path_buf()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_context_fields() {
|
||||
@@ -106,7 +114,7 @@ mod tests {
|
||||
prompt: "Do the thing".to_string(),
|
||||
cwd: "/tmp/wt".to_string(),
|
||||
inactivity_timeout_secs: 300,
|
||||
mcp_port: 3001,
|
||||
app_ctx: Some(test_app_ctx()),
|
||||
session_id_to_resume: None,
|
||||
fresh_prompt: None,
|
||||
};
|
||||
@@ -117,7 +125,6 @@ mod tests {
|
||||
assert_eq!(ctx.prompt, "Do the thing");
|
||||
assert_eq!(ctx.cwd, "/tmp/wt");
|
||||
assert_eq!(ctx.inactivity_timeout_secs, 300);
|
||||
assert_eq!(ctx.mcp_port, 3001);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user