@opencode-cloud/core
Advanced tools
+1
-1
| [package] | ||
| name = "opencode-cloud-core" | ||
| version = "6.2.0" | ||
| version = "6.3.0" | ||
| edition = "2024" | ||
@@ -5,0 +5,0 @@ rust-version = "1.88" |
+1
-1
| { | ||
| "name": "@opencode-cloud/core", | ||
| "version": "6.2.0", | ||
| "version": "6.3.0", | ||
| "description": "Core NAPI bindings for opencode-cloud (internal package)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -519,3 +519,3 @@ # ============================================================================= | ||
| # Build opencode from source (BuildKit cache mounts disabled for now) | ||
| RUN OPENCODE_COMMIT="ed7d5c6d7fcaf0a4ab94894f8825a08a55eebb67" \ | ||
| RUN OPENCODE_COMMIT="ecaebed0934eeda267a66226eb8c2106beaf68c8" \ | ||
| && rm -rf /tmp/opencode-repo \ | ||
@@ -522,0 +522,0 @@ && git clone --depth 1 https://github.com/pRizz/opencode.git /tmp/opencode-repo \ |
+70
-0
@@ -85,2 +85,72 @@ //! Container exec wrapper for running commands in containers | ||
| /// Execute a command and capture output plus exit code | ||
| /// | ||
| /// Returns a tuple of (output, exit_code). Exit code is -1 if not available. | ||
| pub async fn exec_command_with_status( | ||
| client: &DockerClient, | ||
| container: &str, | ||
| cmd: Vec<&str>, | ||
| ) -> Result<(String, i64), DockerError> { | ||
| let exec_config = CreateExecOptions { | ||
| attach_stdout: Some(true), | ||
| attach_stderr: Some(true), | ||
| cmd: Some(cmd.iter().map(|s| s.to_string()).collect()), | ||
| user: Some("root".to_string()), | ||
| ..Default::default() | ||
| }; | ||
| let exec = client | ||
| .inner() | ||
| .create_exec(container, exec_config) | ||
| .await | ||
| .map_err(|e| DockerError::Container(format!("Failed to create exec: {e}")))?; | ||
| let exec_id = exec.id.clone(); | ||
| let start_config = StartExecOptions { | ||
| detach: false, | ||
| ..Default::default() | ||
| }; | ||
| let mut output = String::new(); | ||
| match client | ||
| .inner() | ||
| .start_exec(&exec.id, Some(start_config)) | ||
| .await | ||
| .map_err(|e| DockerError::Container(format!("Failed to start exec: {e}")))? | ||
| { | ||
| StartExecResults::Attached { | ||
| output: mut stream, .. | ||
| } => { | ||
| while let Some(result) = stream.next().await { | ||
| match result { | ||
| Ok(log_output) => { | ||
| output.push_str(&log_output.to_string()); | ||
| } | ||
| Err(e) => { | ||
| return Err(DockerError::Container(format!( | ||
| "Error reading exec output: {e}" | ||
| ))); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| StartExecResults::Detached => { | ||
| return Err(DockerError::Container( | ||
| "Exec unexpectedly detached".to_string(), | ||
| )); | ||
| } | ||
| } | ||
| let inspect = client | ||
| .inner() | ||
| .inspect_exec(&exec_id) | ||
| .await | ||
| .map_err(|e| DockerError::Container(format!("Failed to inspect exec: {e}")))?; | ||
| let exit_code = inspect.exit_code.unwrap_or(-1); | ||
| Ok((output, exit_code)) | ||
| } | ||
| /// Execute a command with stdin input and capture output | ||
@@ -87,0 +157,0 @@ /// |
@@ -53,3 +53,5 @@ //! Docker operations module | ||
| // Container exec operations | ||
| pub use exec::{exec_command, exec_command_exit_code, exec_command_with_stdin}; | ||
| pub use exec::{ | ||
| exec_command, exec_command_exit_code, exec_command_with_status, exec_command_with_stdin, | ||
| }; | ||
@@ -56,0 +58,0 @@ // User management operations |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
325172
0.66%