diff --git a/.github/workflows/branch-docs.yml b/.github/workflows/branch-docs.yml index e6200e708d..48ac80d004 100644 --- a/.github/workflows/branch-docs.yml +++ b/.github/workflows/branch-docs.yml @@ -34,7 +34,7 @@ jobs: fi - name: Setup Node.js - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: "24" diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 4c92bc3857..0ed09d9d4b 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -96,7 +96,7 @@ jobs: cli) binary_component=cli binary_name=openshell - features="bundled-z3" + features="" has_image=false ;; *) diff --git a/.github/workflows/publish-docs-website.yml b/.github/workflows/publish-docs-website.yml index 44df413fd9..16363f6e34 100644 --- a/.github/workflows/publish-docs-website.yml +++ b/.github/workflows/publish-docs-website.yml @@ -41,7 +41,7 @@ jobs: ref: docs-website - name: Setup Node.js - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: "24" diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 222ba7a8f0..82b5b2a116 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -292,7 +292,7 @@ jobs: sed -i -E '/^\[workspace\.package\]/,/^\[/{s/^version[[:space:]]*=[[:space:]]*".*"/version = "'"${{ needs.compute-versions.outputs.cargo_version }}"'"/}' Cargo.toml - name: Build ${{ matrix.target }} - run: mise x -- cargo build --release --target ${{ matrix.target }} -p openshell-cli --features bundled-z3 + run: mise x -- cargo build --release --target ${{ matrix.target }} -p openshell-cli - name: sccache stats if: always() @@ -980,7 +980,7 @@ jobs: git push --force origin dev - name: Create / update GitHub Release - uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1 + uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2 with: name: OpenShell Development Build prerelease: true diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index ec95ab5ea1..ca63a69923 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -324,7 +324,7 @@ jobs: sed -i -E '/^\[workspace\.package\]/,/^\[/{s/^version[[:space:]]*=[[:space:]]*".*"/version = "'"${{ needs.compute-versions.outputs.cargo_version }}"'"/}' Cargo.toml - name: Build ${{ matrix.target }} - run: mise x -- cargo build --release --target ${{ matrix.target }} -p openshell-cli --features bundled-z3 + run: mise x -- cargo build --release --target ${{ matrix.target }} -p openshell-cli - name: sccache stats if: always() @@ -1005,7 +1005,7 @@ jobs: } - name: Create GitHub Release - uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1 + uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2 with: name: OpenShell ${{ env.RELEASE_TAG }} prerelease: false @@ -1052,7 +1052,7 @@ jobs: ref: ${{ inputs.tag || github.ref }} - name: Setup Node.js - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: "24" diff --git a/.github/workflows/release-vm-kernel.yml b/.github/workflows/release-vm-kernel.yml index fc8d7b1a0e..cf86d0b46f 100644 --- a/.github/workflows/release-vm-kernel.yml +++ b/.github/workflows/release-vm-kernel.yml @@ -224,7 +224,7 @@ jobs: } - name: Create / update vm-runtime GitHub Release - uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1 + uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2 with: name: OpenShell VM Runtime prerelease: true diff --git a/.github/workflows/sync-docs.yml b/.github/workflows/sync-docs.yml index f84f4cdfef..481fd85cf5 100644 --- a/.github/workflows/sync-docs.yml +++ b/.github/workflows/sync-docs.yml @@ -117,7 +117,7 @@ jobs: --display-name "$DISPLAY_NAME" - name: Setup Node.js - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: "24" diff --git a/Cargo.lock b/Cargo.lock index d061c74496..1de52d8841 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3597,7 +3597,6 @@ dependencies = [ "openshell-bootstrap", "openshell-core", "openshell-policy", - "openshell-prover", "openshell-providers", "openshell-tui", "owo-colors", diff --git a/crates/openshell-cli/Cargo.toml b/crates/openshell-cli/Cargo.toml index 8e4cb3fb25..1cbfd7d474 100644 --- a/crates/openshell-cli/Cargo.toml +++ b/crates/openshell-cli/Cargo.toml @@ -19,7 +19,6 @@ openshell-bootstrap = { path = "../openshell-bootstrap" } openshell-core = { path = "../openshell-core", default-features = false } openshell-policy = { path = "../openshell-policy" } openshell-providers = { path = "../openshell-providers" } -openshell-prover = { path = "../openshell-prover" } openshell-tui = { path = "../openshell-tui" } serde = { workspace = true } serde_json = { workspace = true } @@ -84,9 +83,6 @@ tracing-subscriber = { workspace = true } [lints] workspace = true -[features] -bundled-z3 = ["openshell-prover/bundled-z3"] - [dev-dependencies] futures = { workspace = true } rcgen = { version = "0.13", features = ["crypto", "pem"] } diff --git a/crates/openshell-cli/src/main.rs b/crates/openshell-cli/src/main.rs index b32e7fe9f9..07b302a027 100644 --- a/crates/openshell-cli/src/main.rs +++ b/crates/openshell-cli/src/main.rs @@ -1743,30 +1743,6 @@ enum PolicyCommands { #[arg(long)] yes: bool, }, - - /// Prove properties of a sandbox policy — or find counterexamples. - #[command(help_template = LEAF_HELP_TEMPLATE, next_help_heading = "FLAGS")] - Prove { - /// Path to `OpenShell` sandbox policy YAML. - #[arg(long, value_hint = ValueHint::FilePath)] - policy: String, - - /// Path to credential descriptor YAML. - #[arg(long, value_hint = ValueHint::FilePath)] - credentials: String, - - /// Path to capability registry directory (default: bundled). - #[arg(long, value_hint = ValueHint::DirPath)] - registry: Option, - - /// Path to accepted risks YAML. - #[arg(long, value_hint = ValueHint::FilePath)] - accepted_risks: Option, - - /// One-line-per-finding output (for demos and CI). - #[arg(long)] - compact: bool, - }, } #[derive(Subcommand, Debug)] @@ -2297,28 +2273,6 @@ async fn main() -> Result<()> { // ----------------------------------------------------------- // Top-level policy (was `sandbox policy`) // ----------------------------------------------------------- - Some(Commands::Policy { - command: - Some(PolicyCommands::Prove { - policy, - credentials, - registry, - accepted_risks, - compact, - }), - }) => { - // Prove runs locally — no gateway needed. - let exit_code = openshell_prover::prove( - &policy, - &credentials, - registry.as_deref(), - accepted_risks.as_deref(), - compact, - )?; - if exit_code != 0 { - std::process::exit(exit_code); - } - } Some(Commands::Policy { command: Some(policy_cmd), }) => { @@ -2438,7 +2392,6 @@ async fn main() -> Result<()> { } run::gateway_setting_delete(&ctx.endpoint, "policy", yes, &tls).await?; } - PolicyCommands::Prove { .. } => unreachable!(), } } diff --git a/crates/openshell-core/src/config.rs b/crates/openshell-core/src/config.rs index 36a2a4ec64..c9f8a86b21 100644 --- a/crates/openshell-core/src/config.rs +++ b/crates/openshell-core/src/config.rs @@ -12,7 +12,6 @@ use std::net::SocketAddr; #[cfg(unix)] use std::os::unix::fs::FileTypeExt; use std::path::{Path, PathBuf}; -use std::process::Command; use std::str::FromStr; use std::time::Duration; @@ -163,7 +162,7 @@ pub fn detect_driver() -> Option { return Some(ComputeDriverKind::Podman); } - // Docker: check if the CLI is available or a local Docker socket exists. + // Docker: check for a reachable local API socket. if is_docker_available() { return Some(ComputeDriverKind::Docker); } @@ -171,14 +170,6 @@ pub fn detect_driver() -> Option { None } -/// Check if a binary is available on the system PATH. -fn is_binary_available(name: &str) -> bool { - Command::new(name) - .arg("--version") - .output() - .is_ok_and(|output| output.status.success()) -} - fn is_podman_available() -> bool { podman_socket_candidates() .iter() @@ -228,13 +219,18 @@ fn podman_socket_candidates_from_env( } fn is_docker_available() -> bool { - is_binary_available("docker") || docker_socket_available() + detect_docker_socket().is_some() } -fn docker_socket_available() -> bool { - docker_socket_candidates() +pub fn detect_docker_socket() -> Option { + detect_docker_socket_from_candidates(&docker_socket_candidates()) +} + +fn detect_docker_socket_from_candidates(candidates: &[PathBuf]) -> Option { + candidates .iter() - .any(|path| is_unix_socket(path)) + .find(|path| docker_socket_responds(path)) + .cloned() } fn docker_socket_candidates() -> Vec { @@ -277,6 +273,15 @@ fn podman_socket_responds(path: &Path) -> bool { }) } +#[cfg(unix)] +fn docker_socket_responds(path: &Path) -> bool { + unix_socket_http_ping(path, |response| { + http_response_is_success(response) + && contains_ascii(response, b"Api-Version:") + && !contains_ascii(response, b"Libpod-Api-Version:") + }) +} + #[cfg(unix)] fn unix_socket_http_ping(path: &Path, accepts_response: impl FnOnce(&[u8]) -> bool) -> bool { const PROBE_TIMEOUT: Duration = Duration::from_secs(1); @@ -350,6 +355,12 @@ fn podman_socket_responds(path: &Path) -> bool { false } +#[cfg(not(unix))] +fn docker_socket_responds(path: &Path) -> bool { + let _ = path; + false +} + /// Server configuration. /// /// Built programmatically in [`crate::Config::new`] and the gateway CLI from @@ -960,9 +971,9 @@ mod tests { use super::{ ComputeDriverKind, Config, DEFAULT_SERVICE_ROUTING_DOMAIN, GatewayInterceptorBindingPolicy, GatewayInterceptorConfig, GatewayInterceptorFailurePolicy, GatewayJwtConfig, - GatewayProviderProfileSourceConfig, detect_driver, docker_host_unix_socket_path, - is_unix_socket, normalize_compute_driver_name, podman_socket_candidates_from_env, - podman_socket_responds, + GatewayProviderProfileSourceConfig, detect_docker_socket_from_candidates, detect_driver, + docker_host_unix_socket_path, docker_socket_responds, is_unix_socket, + normalize_compute_driver_name, podman_socket_candidates_from_env, podman_socket_responds, }; #[cfg(unix)] use std::io::{Read as _, Write as _}; @@ -1239,6 +1250,90 @@ mod tests { handle.join().expect("probe server exits"); } + #[cfg(unix)] + #[test] + fn docker_socket_probe_accepts_successful_ping_response() { + let temp_dir = tempfile::tempdir().expect("create temp dir"); + let socket_path = temp_dir.path().join("docker.sock"); + let listener = UnixListener::bind(&socket_path).expect("bind docker socket"); + + let handle = std::thread::spawn(move || { + let (mut stream, _) = listener.accept().expect("accept docker probe"); + let mut request = [0_u8; 128]; + let n = stream.read(&mut request).expect("read docker probe"); + assert!(request[..n].starts_with(b"GET /_ping HTTP/1.1\r\n")); + stream + .write_all( + b"HTTP/1.1 200 OK\r\nApi-Version: 1.51\r\nDocker-Experimental: false\r\nContent-Length: 2\r\n\r\nOK", + ) + .expect("write docker ping response"); + }); + + assert!(docker_socket_responds(&socket_path)); + handle.join().expect("probe server exits"); + } + + #[cfg(unix)] + #[test] + fn docker_socket_probe_rejects_podman_ping_response() { + let temp_dir = tempfile::tempdir().expect("create temp dir"); + let socket_path = temp_dir.path().join("podman.sock"); + let listener = UnixListener::bind(&socket_path).expect("bind podman socket"); + + let handle = std::thread::spawn(move || { + let (mut stream, _) = listener.accept().expect("accept docker probe"); + let mut request = [0_u8; 128]; + let n = stream.read(&mut request).expect("read docker probe"); + assert!(request[..n].starts_with(b"GET /_ping HTTP/1.1\r\n")); + stream + .write_all( + b"HTTP/1.1 200 OK\r\nLibpod-Api-Version: 5.8.2\r\nContent-Length: 2\r\n\r\nOK", + ) + .expect("write podman ping response"); + }); + + assert!(!docker_socket_responds(&socket_path)); + handle.join().expect("probe server exits"); + } + + #[cfg(unix)] + #[test] + fn docker_socket_probe_rejects_inactive_socket() { + let temp_dir = tempfile::tempdir().expect("create temp dir"); + let socket_path = temp_dir.path().join("docker.sock"); + let listener = UnixListener::bind(&socket_path).expect("bind docker socket"); + drop(listener); + + assert!(is_unix_socket(&socket_path)); + assert!(!docker_socket_responds(&socket_path)); + } + + #[cfg(unix)] + #[test] + fn docker_socket_detection_returns_the_responsive_candidate() { + let temp_dir = tempfile::tempdir().expect("create temp dir"); + let inactive_path = temp_dir.path().join("inactive.sock"); + let inactive_listener = UnixListener::bind(&inactive_path).expect("bind inactive socket"); + drop(inactive_listener); + + let responsive_path = temp_dir.path().join("responsive.sock"); + let listener = UnixListener::bind(&responsive_path).expect("bind responsive socket"); + let handle = std::thread::spawn(move || { + let (mut stream, _) = listener.accept().expect("accept docker probe"); + let mut request = [0_u8; 128]; + let _ = stream.read(&mut request).expect("read docker probe"); + stream + .write_all(b"HTTP/1.1 200 OK\r\nApi-Version: 1.51\r\nContent-Length: 2\r\n\r\nOK") + .expect("write docker ping response"); + }); + + assert_eq!( + detect_docker_socket_from_candidates(&[inactive_path, responsive_path.clone(),]), + Some(responsive_path) + ); + handle.join().expect("probe server exits"); + } + #[test] fn podman_socket_candidates_include_env_runtime_and_home_paths() { let candidates = podman_socket_candidates_from_env( diff --git a/crates/openshell-driver-docker/README.md b/crates/openshell-driver-docker/README.md index 82e5eea4b7..e17791e747 100644 --- a/crates/openshell-driver-docker/README.md +++ b/crates/openshell-driver-docker/README.md @@ -6,6 +6,12 @@ The driver manages sandbox containers through the local Docker daemon with the `bollard` client. It is intended for developer environments where Docker is already available and running Kubernetes would be unnecessary. +The driver connects to `[openshell.drivers.docker].socket_path` when configured. +Otherwise, it uses the first standard local Docker socket that responds to an +API ping, which is the same selection mechanism used by gateway auto-detection. +An explicitly selected Docker driver falls back to `/var/run/docker.sock` when +no candidate responds. + ## Runtime Model The gateway runs as a host process. The Docker driver creates one container per diff --git a/crates/openshell-driver-docker/src/lib.rs b/crates/openshell-driver-docker/src/lib.rs index 06d575a1e1..97a0f60839 100644 --- a/crates/openshell-driver-docker/src/lib.rs +++ b/crates/openshell-driver-docker/src/lib.rs @@ -93,6 +93,11 @@ pub trait SupervisorReadiness: Send + Sync + 'static { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[serde(default, deny_unknown_fields)] pub struct DockerComputeConfig { + /// Docker API Unix socket. When unset, use the socket selected by gateway + /// auto-detection, falling back to `/var/run/docker.sock` for an explicitly + /// configured Docker driver. + pub socket_path: Option, + /// Default OCI image for sandboxes. pub default_image: String, @@ -145,6 +150,7 @@ pub struct DockerComputeConfig { impl Default for DockerComputeConfig { fn default() -> Self { Self { + socket_path: None, default_image: openshell_core::image::default_sandbox_image(), image_pull_policy: String::new(), sandbox_namespace: "default".to_string(), @@ -307,8 +313,22 @@ impl DockerComputeDriver { docker_config: &DockerComputeConfig, supervisor_readiness: Arc, ) -> CoreResult { - let docker = Docker::connect_with_local_defaults() - .map_err(|err| Error::execution(format!("failed to create Docker client: {err}")))?; + let socket_path = docker_config + .socket_path + .clone() + .or_else(openshell_core::config::detect_docker_socket) + .unwrap_or_else(|| PathBuf::from("/var/run/docker.sock")); + let socket_path_str = socket_path.to_str().ok_or_else(|| { + Error::config(format!( + "Docker socket path is not valid UTF-8: {}", + socket_path.display() + )) + })?; + let docker = + Docker::connect_with_socket(socket_path_str, 120, bollard::API_DEFAULT_VERSION) + .map_err(|err| { + Error::execution(format!("failed to create Docker client: {err}")) + })?; let version = docker.version().await.map_err(|err| { Error::execution(format!("failed to query Docker daemon version: {err}")) })?; diff --git a/crates/openshell-server/src/cli.rs b/crates/openshell-server/src/cli.rs index 7260fc1fdf..269b9f40e9 100644 --- a/crates/openshell-server/src/cli.rs +++ b/crates/openshell-server/src/cli.rs @@ -100,7 +100,7 @@ struct RunArgs { /// `kubernetes,podman`. The configuration format is future-proofed for /// multiple drivers, but the gateway currently requires exactly one. /// When unset, the gateway auto-detects the driver based on the runtime - /// environment (Kubernetes → Podman → Docker CLI or socket). VM is never + /// environment (Kubernetes → Podman → Docker). VM is never /// auto-detected and requires explicit configuration. #[arg( long, diff --git a/crates/openshell-server/src/compute/driver_config.rs b/crates/openshell-server/src/compute/driver_config.rs index 294cec0ce7..fa44cd3a38 100644 --- a/crates/openshell-server/src/compute/driver_config.rs +++ b/crates/openshell-server/src/compute/driver_config.rs @@ -321,6 +321,21 @@ enable_bind_mounts = true assert!(cfg.enable_bind_mounts); } + #[test] + fn docker_config_reads_socket_path_from_driver_table() { + let file: config_file::ConfigFile = toml::from_str( + r#" +[openshell.drivers.docker] +socket_path = "/tmp/docker.sock" +"#, + ) + .expect("valid config"); + + let cfg = docker_config_from_context(test_context(Some(&file))).expect("docker config"); + + assert_eq!(cfg.socket_path, Some(PathBuf::from("/tmp/docker.sock"))); + } + #[test] fn remote_driver_config_reads_socket_path_from_named_table() { let file: config_file::ConfigFile = toml::from_str( diff --git a/crates/openshell-server/src/compute/mod.rs b/crates/openshell-server/src/compute/mod.rs index a0dd3e37fe..239feb74d5 100644 --- a/crates/openshell-server/src/compute/mod.rs +++ b/crates/openshell-server/src/compute/mod.rs @@ -509,6 +509,14 @@ impl ComputeRuntime { // Create with MustCreate condition to prevent duplicate creation race self.sandbox_index.update_from_sandbox(&sandbox); let mut sandbox = sandbox; + let labels_json = sandbox + .metadata + .as_ref() + .map(|metadata| &metadata.labels) + .filter(|labels| !labels.is_empty()) + .map(serde_json::to_string) + .transpose() + .map_err(|e| Status::internal(format!("failed to serialize labels: {e}")))?; let result = self .store .put_if( @@ -516,7 +524,7 @@ impl ComputeRuntime { &sandbox_id, sandbox.object_name(), &sandbox.encode_to_vec(), - None, + labels_json.as_deref(), WriteCondition::MustCreate, ) .await @@ -3603,6 +3611,29 @@ mod tests { ); } + #[tokio::test] + async fn created_sandbox_is_immediately_visible_to_label_selectors() { + let runtime = test_runtime(Arc::new(TestDriver::default())).await; + let mut sandbox = + sandbox_record("sb-labeled", "labeled-sandbox", SandboxPhase::Provisioning); + sandbox + .metadata + .as_mut() + .unwrap() + .labels + .insert("env".to_string(), "prod".to_string()); + + runtime.create_sandbox(sandbox, None).await.unwrap(); + + let matching = runtime + .store + .list_messages_with_selector::("env=prod", 10, 0) + .await + .unwrap(); + assert_eq!(matching.len(), 1); + assert_eq!(matching[0].object_id(), "sb-labeled"); + } + #[tokio::test] async fn concurrent_create_sandbox_rejects_duplicate() { let runtime = Arc::new(test_runtime(Arc::new(TestDriver::default())).await); diff --git a/crates/openshell-tui/src/app.rs b/crates/openshell-tui/src/app.rs index 0d59c58589..f8ebe49895 100644 --- a/crates/openshell-tui/src/app.rs +++ b/crates/openshell-tui/src/app.rs @@ -1140,6 +1140,70 @@ impl App { } } + const DASHBOARD_PANELS: [Focus; 3] = [Focus::Gateways, Focus::Providers, Focus::Sandboxes]; + + fn panel_item_count(&self, focus: Focus) -> usize { + match focus { + Focus::Gateways => self.gateways.len(), + Focus::Providers => { + if self.middle_pane_tab == MiddlePaneTab::GlobalSettings { + self.global_settings.len() + } else { + self.provider_count + } + } + Focus::Sandboxes => self.sandbox_count, + _ => 0, + } + } + + fn set_panel_cursor(&mut self, focus: Focus, index: usize) { + match focus { + Focus::Gateways => self.gateway_selected = index, + Focus::Providers => { + if self.middle_pane_tab == MiddlePaneTab::GlobalSettings { + self.global_settings_selected = index; + } else { + self.provider_selected = index; + } + } + Focus::Sandboxes => self.sandbox_selected = index, + _ => {} + } + } + + fn overflow_focus_down(&mut self) { + let cur_idx = Self::DASHBOARD_PANELS + .iter() + .position(|&f| f == self.focus) + .unwrap_or(0); + for offset in 1..=Self::DASHBOARD_PANELS.len() { + let next = Self::DASHBOARD_PANELS[(cur_idx + offset) % Self::DASHBOARD_PANELS.len()]; + if self.panel_item_count(next) > 0 { + self.focus = next; + self.set_panel_cursor(next, 0); + return; + } + } + } + + fn overflow_focus_up(&mut self) { + let cur_idx = Self::DASHBOARD_PANELS + .iter() + .position(|&f| f == self.focus) + .unwrap_or(0); + for offset in 1..=Self::DASHBOARD_PANELS.len() { + let prev = Self::DASHBOARD_PANELS + [(cur_idx + Self::DASHBOARD_PANELS.len() - offset) % Self::DASHBOARD_PANELS.len()]; + let count = self.panel_item_count(prev); + if count > 0 { + self.focus = prev; + self.set_panel_cursor(prev, count - 1); + return; + } + } + } + fn handle_gateways_key(&mut self, key: KeyEvent) { match key.code { KeyCode::Char('q') => self.running = false, @@ -1149,11 +1213,19 @@ impl App { self.input_mode = InputMode::Command; self.command_input.clear(); } - KeyCode::Char('j') | KeyCode::Down if !self.gateways.is_empty() => { - self.gateway_selected = (self.gateway_selected + 1).min(self.gateways.len() - 1); + KeyCode::Char('j') | KeyCode::Down => { + if !self.gateways.is_empty() && self.gateway_selected < self.gateways.len() - 1 { + self.gateway_selected += 1; + } else { + self.overflow_focus_down(); + } } KeyCode::Char('k') | KeyCode::Up => { - self.gateway_selected = self.gateway_selected.saturating_sub(1); + if !self.gateways.is_empty() && self.gateway_selected > 0 { + self.gateway_selected -= 1; + } else { + self.overflow_focus_up(); + } } KeyCode::Enter => { if let Some(entry) = self.gateways.get(self.gateway_selected) { @@ -1190,11 +1262,19 @@ impl App { self.input_mode = InputMode::Command; self.command_input.clear(); } - KeyCode::Char('j') | KeyCode::Down if self.provider_count > 0 => { - self.provider_selected = (self.provider_selected + 1).min(self.provider_count - 1); + KeyCode::Char('j') | KeyCode::Down => { + if self.provider_count > 0 && self.provider_selected < self.provider_count - 1 { + self.provider_selected += 1; + } else { + self.overflow_focus_down(); + } } KeyCode::Char('k') | KeyCode::Up => { - self.provider_selected = self.provider_selected.saturating_sub(1); + if self.provider_count > 0 && self.provider_selected > 0 { + self.provider_selected -= 1; + } else { + self.overflow_focus_up(); + } } KeyCode::Char('c') if !self.providers_v2_enabled => { self.open_create_provider_form(); @@ -1226,12 +1306,21 @@ impl App { self.input_mode = InputMode::Command; self.command_input.clear(); } - KeyCode::Char('j') | KeyCode::Down if !self.global_settings.is_empty() => { - self.global_settings_selected = - (self.global_settings_selected + 1).min(self.global_settings.len() - 1); + KeyCode::Char('j') | KeyCode::Down => { + if !self.global_settings.is_empty() + && self.global_settings_selected < self.global_settings.len() - 1 + { + self.global_settings_selected += 1; + } else { + self.overflow_focus_down(); + } } KeyCode::Char('k') | KeyCode::Up => { - self.global_settings_selected = self.global_settings_selected.saturating_sub(1); + if !self.global_settings.is_empty() && self.global_settings_selected > 0 { + self.global_settings_selected -= 1; + } else { + self.overflow_focus_up(); + } } KeyCode::Char('h' | 'l') | KeyCode::Left | KeyCode::Right => { self.middle_pane_tab = self.middle_pane_tab.next(); @@ -1367,11 +1456,19 @@ impl App { self.input_mode = InputMode::Command; self.command_input.clear(); } - KeyCode::Char('j') | KeyCode::Down if self.sandbox_count > 0 => { - self.sandbox_selected = (self.sandbox_selected + 1).min(self.sandbox_count - 1); + KeyCode::Char('j') | KeyCode::Down => { + if self.sandbox_count > 0 && self.sandbox_selected < self.sandbox_count - 1 { + self.sandbox_selected += 1; + } else { + self.overflow_focus_down(); + } } KeyCode::Char('k') | KeyCode::Up => { - self.sandbox_selected = self.sandbox_selected.saturating_sub(1); + if self.sandbox_count > 0 && self.sandbox_selected > 0 { + self.sandbox_selected -= 1; + } else { + self.overflow_focus_up(); + } } KeyCode::Char('c') => { self.open_create_form(); diff --git a/deploy/docker/Dockerfile.cli-macos b/deploy/docker/Dockerfile.cli-macos index 7dce3a63db..af509ee976 100644 --- a/deploy/docker/Dockerfile.cli-macos +++ b/deploy/docker/Dockerfile.cli-macos @@ -97,7 +97,7 @@ RUN mkdir -p crates/openshell-cli/src \ RUN --mount=type=cache,id=cargo-registry-cli-macos,sharing=locked,target=/root/.cargo/registry \ --mount=type=cache,id=cargo-git-cli-macos,sharing=locked,target=/root/.cargo/git \ --mount=type=cache,id=cargo-target-cli-macos-${CARGO_TARGET_CACHE_SCOPE},sharing=locked,target=/build/target \ - cargo build --release --target aarch64-apple-darwin -p openshell-cli --features bundled-z3 2>/dev/null || true + cargo build --release --target aarch64-apple-darwin -p openshell-cli 2>/dev/null || true # --------------------------------------------------------------------------- # Stage 2: real build @@ -126,7 +126,7 @@ RUN --mount=type=cache,id=cargo-registry-cli-macos,sharing=locked,target=/root/. if [ -n "${OPENSHELL_CARGO_VERSION:-}" ]; then \ sed -i -E '/^\[workspace\.package\]/,/^\[/{s/^version[[:space:]]*=[[:space:]]*".*"/version = "'"${OPENSHELL_CARGO_VERSION}"'"/}' Cargo.toml; \ fi && \ - cargo build --release --target aarch64-apple-darwin -p openshell-cli --features bundled-z3 && \ + cargo build --release --target aarch64-apple-darwin -p openshell-cli && \ cp target/aarch64-apple-darwin/release/openshell /openshell FROM scratch AS binary diff --git a/deploy/docker/Dockerfile.python-wheels b/deploy/docker/Dockerfile.python-wheels index e93bf8f22e..fe58e3fcc7 100644 --- a/deploy/docker/Dockerfile.python-wheels +++ b/deploy/docker/Dockerfile.python-wheels @@ -75,7 +75,7 @@ RUN --mount=type=cache,id=cargo-registry-python-wheels-${TARGETARCH},sharing=loc --mount=type=cache,id=cargo-git-python-wheels-${TARGETARCH},sharing=locked,target=/root/.cargo/git \ --mount=type=cache,id=cargo-target-python-wheels-${TARGETARCH}-${CARGO_TARGET_CACHE_SCOPE},sharing=locked,target=/build/target \ --mount=type=cache,id=sccache-python-wheels-${TARGETARCH},sharing=locked,target=/tmp/sccache \ - . cross-build.sh && cargo_cross_build --release -p openshell-cli --features bundled-z3 2>/dev/null || true + . cross-build.sh && cargo_cross_build --release -p openshell-cli 2>/dev/null || true # Copy actual source code and Python packaging files. COPY crates/ crates/ @@ -109,7 +109,7 @@ RUN --mount=type=cache,id=cargo-registry-python-wheels-${TARGETARCH},sharing=loc if [ -n "${OPENSHELL_CARGO_VERSION:-}" ]; then \ sed -i -E '/^\[workspace\.package\]/,/^\[/{s/^version[[:space:]]*=[[:space:]]*".*"/version = "'"${OPENSHELL_CARGO_VERSION}"'"/}' Cargo.toml; \ fi && \ - maturin build --release --target "${CARGO_BUILD_TARGET}" --features bundled-z3 --out /wheels + maturin build --release --target "${CARGO_BUILD_TARGET}" --out /wheels FROM scratch AS wheels COPY --from=builder /wheels/*.whl / diff --git a/deploy/docker/Dockerfile.python-wheels-macos b/deploy/docker/Dockerfile.python-wheels-macos index 45194b0690..1825dd6276 100644 --- a/deploy/docker/Dockerfile.python-wheels-macos +++ b/deploy/docker/Dockerfile.python-wheels-macos @@ -88,7 +88,7 @@ RUN mkdir -p crates/openshell-cli/src crates/openshell-core/src crates/openshell RUN --mount=type=cache,id=cargo-registry-python-wheels-macos-${TARGETARCH},sharing=locked,target=/root/.cargo/registry \ --mount=type=cache,id=cargo-git-python-wheels-macos-${TARGETARCH},sharing=locked,target=/root/.cargo/git \ --mount=type=cache,id=cargo-target-python-wheels-macos-${TARGETARCH}-${CARGO_TARGET_CACHE_SCOPE},sharing=locked,target=/build/target \ - cargo build --release --target aarch64-apple-darwin -p openshell-cli --features bundled-z3 2>/dev/null || true + cargo build --release --target aarch64-apple-darwin -p openshell-cli 2>/dev/null || true # Copy actual source code and Python packaging files. COPY crates/ crates/ @@ -120,7 +120,7 @@ RUN --mount=type=cache,id=cargo-registry-python-wheels-macos-${TARGETARCH},shari if [ -n "${OPENSHELL_CARGO_VERSION:-}" ]; then \ sed -i -E '/^\[workspace\.package\]/,/^\[/{s/^version[[:space:]]*=[[:space:]]*".*"/version = "'"${OPENSHELL_CARGO_VERSION}"'"/}' Cargo.toml; \ fi && \ - maturin build --release --target aarch64-apple-darwin --features bundled-z3 --out /wheels + maturin build --release --target aarch64-apple-darwin --out /wheels FROM scratch AS wheels COPY --from=builder /wheels/*.whl / diff --git a/docs/reference/gateway-config.mdx b/docs/reference/gateway-config.mdx index 6ed2bae858..b0efa87e40 100644 --- a/docs/reference/gateway-config.mdx +++ b/docs/reference/gateway-config.mdx @@ -287,6 +287,7 @@ log_level = "info" compute_drivers = ["docker"] [openshell.drivers.docker] +socket_path = "/var/run/docker.sock" default_image = "ghcr.io/nvidia/openshell/sandbox:latest" # Docker vocabulary: Always | IfNotPresent | Never. Empty behaves like IfNotPresent. image_pull_policy = "IfNotPresent" diff --git a/docs/reference/sandbox-compute-drivers.mdx b/docs/reference/sandbox-compute-drivers.mdx index 03a9b564f0..a0167ae72a 100644 --- a/docs/reference/sandbox-compute-drivers.mdx +++ b/docs/reference/sandbox-compute-drivers.mdx @@ -25,7 +25,7 @@ Reserved built-in values are `docker`, `podman`, `kubernetes`, and `vm`. Non-reserved names select an extension driver and require a `socket_path` in `[openshell.drivers.]`. -When `compute_drivers` is unset, the gateway auto-detects Kubernetes, then Podman, then Docker by CLI availability or a local Unix socket. The VM driver is never auto-detected; configure it explicitly with `compute_drivers = ["vm"]` or set `OPENSHELL_DRIVERS=vm` in the launch environment. +When `compute_drivers` is unset, the gateway auto-detects Kubernetes, then Podman, then Docker. Local container runtimes must respond to an API probe before the gateway selects them. The VM driver is never auto-detected; configure it explicitly with `compute_drivers = ["vm"]` or set `OPENSHELL_DRIVERS=vm` in the launch environment. Common gateway options: @@ -115,7 +115,7 @@ The gateway talks to the Docker daemon to create sandbox containers. Docker is a For maintainer-level implementation details, refer to the [Docker driver README](https://github.com/NVIDIA/OpenShell/blob/main/crates/openshell-driver-docker/README.md). -Select Docker with `compute_drivers = ["docker"]` in `[openshell.gateway]`. Configure Docker driver values such as `grpc_endpoint`, `network_name`, `supervisor_bin`, `supervisor_image`, `image_pull_policy`, `ssh_socket_path`, `sandbox_pids_limit`, and `guest_tls_*` in `[openshell.drivers.docker]`. +Select Docker with `compute_drivers = ["docker"]` in `[openshell.gateway]`. Configure Docker driver values such as `socket_path`, `grpc_endpoint`, `network_name`, `supervisor_bin`, `supervisor_image`, `image_pull_policy`, `ssh_socket_path`, `sandbox_pids_limit`, and `guest_tls_*` in `[openshell.drivers.docker]`. When `socket_path` is unset, the driver uses the same responsive local socket selected by auto-detection. An explicitly selected Docker driver falls back to `/var/run/docker.sock` when no candidate responds. For GPU-backed Docker sandboxes, configure Docker CDI before starting the gateway so OpenShell can detect the daemon capability. diff --git a/docs/sandboxes/manage-sandboxes.mdx b/docs/sandboxes/manage-sandboxes.mdx index 8d47754c5d..86d4053978 100644 --- a/docs/sandboxes/manage-sandboxes.mdx +++ b/docs/sandboxes/manage-sandboxes.mdx @@ -336,6 +336,8 @@ openshell term Use the terminal to spot blocked connections marked `action=deny` and inference-related proxy activity. If a connection is blocked unexpectedly, add the host to your network policy. Refer to [Policies](/sandboxes/policies) for the workflow. +The dashboard has three panels stacked vertically: Gateways, Providers (or Global Settings), and Sandboxes. Navigate within a panel with `Up`/`Down` or `j`/`k`. At a list boundary the cursor overflows into the adjacent panel, skipping empty panels. Use `Tab`/`Shift+Tab` to cycle panels directly. Press `h`/`l` or `Left`/`Right` in the middle panel to switch between the Providers and Global Settings tabs. + ## Port Forwarding Forward a local port to a running sandbox to access services inside it, such as a web server or database: diff --git a/scripts/bin/openshell b/scripts/bin/openshell index 23000bc313..263f5613aa 100755 --- a/scripts/bin/openshell +++ b/scripts/bin/openshell @@ -109,11 +109,6 @@ if [[ "$needs_build" == "1" ]]; then break fi done - - if [[ -z "${Z3_SYS_Z3_HEADER:-}" ]]; then - echo "Falling back to bundled Z3 for local CLI build." >&2 - build_args+=(--features bundled-z3) - fi fi cargo build "${build_args[@]}" # Persist state after successful build diff --git a/tasks/ci.toml b/tasks/ci.toml index 9696517af2..6b3b8b2153 100644 --- a/tasks/ci.toml +++ b/tasks/ci.toml @@ -30,7 +30,7 @@ hide = true ["build:rust:snap"] description = "Build release Rust binaries consumed by the hand-staged snap" run = [ - "cargo build --release -p openshell-cli --features bundled-z3", + "cargo build --release -p openshell-cli", "cargo build --release -p openshell-server --features bundled-z3", "cargo build --release -p openshell-sandbox", ] diff --git a/tasks/python.toml b/tasks/python.toml index 62b8b4f787..3aa9727ebf 100644 --- a/tasks/python.toml +++ b/tasks/python.toml @@ -76,7 +76,7 @@ fi rm -rf "$WHEEL_OUTPUT_DIR" mkdir -p "$WHEEL_OUTPUT_DIR" -uv run maturin build --release --features bundled-z3 --out "$WHEEL_OUTPUT_DIR" +uv run maturin build --release --out "$WHEEL_OUTPUT_DIR" ls -la "$WHEEL_OUTPUT_DIR"/*.whl '''