Skip to content

Commit 9ed7f57

Browse files
author
Symbiont OSS Sync
committed
Sync OSS release
1 parent 1f0a65a commit 9ed7f57

File tree

4 files changed

+68
-16
lines changed

4 files changed

+68
-16
lines changed

crates/runtime/src/api/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ impl HttpApiServer {
381381
use axum::http::{header, HeaderValue, Method};
382382

383383
let allowed_origins: Vec<HeaderValue> = std::env::var("SYMBIONT_CORS_ORIGINS")
384-
.unwrap_or_else(|_| "http://localhost:3000".to_string())
384+
.unwrap_or_else(|_| "http://localhost:3001,http://localhost:3000".to_string())
385385
.split(',')
386386
.filter_map(|origin| origin.trim().parse().ok())
387387
.collect();

src/commands/status.rs

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,26 @@ use sysinfo::System;
44
pub async fn run() {
55
println!("📊 Symbiont Runtime Status\n");
66

7-
// Check if runtime is running
8-
print!("Runtime: ");
9-
if is_runtime_running() {
10-
println!("✓ Running on :8080");
7+
let api_up = is_port_listening(8080);
8+
let http_up = is_port_listening(8081);
9+
10+
// Check if runtime is running (either port indicates a running instance)
11+
print!("Runtime API :8080 ");
12+
if api_up {
13+
println!("✓ Running");
14+
} else {
15+
println!("✗ Not listening");
16+
}
17+
18+
print!("HTTP Input :8081 ");
19+
if http_up {
20+
println!("✓ Running");
1121
} else {
12-
println!("✗ Not running (start with: symbi up)");
22+
println!("✗ Not listening");
23+
}
24+
25+
if !api_up && !http_up {
26+
println!("\n✗ Not running (start with: symbi up)");
1327
return;
1428
}
1529

@@ -27,10 +41,10 @@ pub async fn run() {
2741
// Routes
2842
println!("\n🔀 Routes:");
2943
println!(" • /webhook → webhook_handler (auto-configured)");
30-
31-
// I/O Handlers
32-
println!("\n🔌 I/O Handlers:");
33-
println!(" • HTTP Input :8081 (enabled)");
44+
if api_up {
45+
println!(" • /api/v1/* → management API");
46+
println!(" • /swagger-ui → API documentation");
47+
}
3448

3549
// Resource usage
3650
println!("\n💾 Resources:");
@@ -42,9 +56,8 @@ pub async fn run() {
4256
println!();
4357
}
4458

45-
fn is_runtime_running() -> bool {
46-
// Check if runtime is listening on port 8080
47-
std::net::TcpStream::connect("127.0.0.1:8080")
59+
fn is_port_listening(port: u16) -> bool {
60+
std::net::TcpStream::connect(format!("127.0.0.1:{}", port))
4861
.map(|_| true)
4962
.unwrap_or(false)
5063
}

src/commands/up.rs

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use symbi_channel_adapter::{
77
AgentInvoker, BasicInteractionLogger, ChannelAdapterManager, ChannelConfig, ChatPlatform,
88
MattermostConfig, PlatformSettings, SlackConfig, TeamsConfig,
99
};
10+
use symbi_runtime::api::server::{HttpApiConfig, HttpApiServer};
1011
use symbi_runtime::http_input::llm_client::LlmClient;
1112
use symbi_runtime::http_input::{start_http_input, HttpInputConfig};
1213
use symbi_runtime::types::AgentId;
@@ -29,6 +30,9 @@ pub async fn run(matches: &ArgMatches) {
2930
let http_port = matches
3031
.get_one::<String>("http-port")
3132
.expect("http-port argument is required");
33+
let http_bind = matches
34+
.get_one::<String>("http-bind")
35+
.expect("http-bind argument has default value");
3236
let http_token = matches.get_one::<String>("http-token");
3337
let cors_origins: Vec<String> = matches
3438
.get_one::<String>("http-cors-origins")
@@ -97,8 +101,8 @@ pub async fn run(matches: &ArgMatches) {
97101
// Scan agents directory
98102
let agents_found = scan_agents_directory();
99103

100-
println!("✓ Runtime started on :{}", port);
101-
println!("✓ HTTP Input enabled on :{}", http_port);
104+
println!("✓ Runtime API on {}:{}", http_bind, port);
105+
println!("✓ HTTP Input on {}:{}", http_bind, http_port);
102106
println!("✓ Authentication: ENABLED (Bearer token required)");
103107

104108
if let Some(agent) = agents_found.first() {
@@ -155,7 +159,7 @@ pub async fn run(matches: &ArgMatches) {
155159
};
156160

157161
let http_config = HttpInputConfig {
158-
bind_address: "127.0.0.1".to_string(),
162+
bind_address: http_bind.clone(),
159163
port: http_port_num,
160164
path: "/webhook".to_string(),
161165
agent: agent_id,
@@ -433,7 +437,35 @@ pub async fn run(matches: &ArgMatches) {
433437
channel_manager = Some(manager);
434438
}
435439

440+
// Parse the API port and configure the management API server
441+
let api_port_num = match port.parse::<u16>() {
442+
Ok(p) => p,
443+
Err(e) => {
444+
eprintln!("✗ Invalid API port number '{}': {}", port, e);
445+
return;
446+
}
447+
};
448+
449+
let api_config = HttpApiConfig {
450+
bind_address: http_bind.clone(),
451+
port: api_port_num,
452+
enable_cors: true,
453+
enable_tracing: true,
454+
enable_rate_limiting: true,
455+
api_keys_file: None,
456+
};
457+
458+
let mut api_server = HttpApiServer::new(api_config);
459+
if let Some(ref rt) = runtime {
460+
api_server = api_server.with_runtime_provider(rt.clone());
461+
}
462+
436463
tokio::select! {
464+
result = api_server.start() => {
465+
if let Err(e) = result {
466+
eprintln!("✗ API server error: {}", e);
467+
}
468+
},
437469
_ = start_http_input(http_config, runtime.clone(), secrets_config) => {},
438470
_ = tokio::signal::ctrl_c() => {}
439471
}

src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ async fn main() {
3030
.help("HTTP Input port")
3131
.default_value("8081"),
3232
)
33+
.arg(
34+
Arg::new("http-bind")
35+
.long("http-bind")
36+
.value_name("ADDRESS")
37+
.help("HTTP bind address (default: 127.0.0.1; use 0.0.0.0 for all interfaces)")
38+
.default_value("127.0.0.1"),
39+
)
3340
.arg(
3441
Arg::new("http-token")
3542
.long("http.token")

0 commit comments

Comments
 (0)