Skip to content

Secure, Fast, and Extensible Sandbox runtime for AI agents.

fix(kotlin): keep JVM constructors when adding exitCode

BootstrapperSBL5ac3311ae72a
diff --git a/sdks/sandbox/kotlin/sandbox-api/src/main/kotlin/com/alibaba/opensandbox/sandbox/api/models/execd/ExecutionModels.kt b/sdks/sandbox/kotlin/sandbox-api/src/main/kotlin/com/alibaba/opensandbox/sandbox/api/models/execd/ExecutionModels.kt
index d60881589..c95c0eced 100644
--- a/sdks/sandbox/kotlin/sandbox-api/src/main/kotlin/com/alibaba/opensandbox/sandbox/api/models/execd/ExecutionModels.kt
+++ b/sdks/sandbox/kotlin/sandbox-api/src/main/kotlin/com/alibaba/opensandbox/sandbox/api/models/execd/ExecutionModels.kt
@@ -23,7 +23,7 @@ import kotlinx.serialization.json.contentOrNull
import kotlinx.serialization.json.jsonPrimitive
@Serializable
-data class EventNode(
+data class EventNode @JvmOverloads constructor(
val type: String,
val timestamp: Long,
val text: String? = null,
@@ -51,7 +51,7 @@ value class ResultData(val raw: JsonObject) {
}
@Serializable
-data class ErrorData(
+data class ErrorData @JvmOverloads constructor(
@SerialName("ename")
val name: String? = null,
@SerialName("evalue")
diff --git a/sdks/sandbox/kotlin/sandbox/src/main/kotlin/com/alibaba/opensandbox/sandbox/domain/models/execd/executions/ExecutionModels.kt b/sdks/sandbox/kotlin/sandbox/src/main/kotlin/com/alibaba/opensandbox/sandbox/domain/models/execd/executions/ExecutionModels.kt
index fd1a0cb10..056c24dfd 100644
--- a/sdks/sandbox/kotlin/sandbox/src/main/kotlin/com/alibaba/opensandbox/sandbox/domain/models/execd/executions/ExecutionModels.kt
+++ b/sdks/sandbox/kotlin/sandbox/src/main/kotlin/com/alibaba/opensandbox/sandbox/domain/models/execd/executions/ExecutionModels.kt
@@ -143,19 +143,21 @@ class ExecutionResult(
* @property timestamp Unix timestamp in milliseconds when the error occurred
* @property traceback List of traceback lines showing the complete error stack trace
*/
-class ExecutionError(
- val name: String,
- val value: String,
- val timestamp: Long,
- val traceback: List<String> = emptyList(),
- /**
- * Exit status reported by execd for a CommandExecError when the command ran
- * and finished with a non-zero status (-1 when terminated by a signal).
- * Null when the process failed to start, for non-command errors, and on
- * servers that predate error.exit_code.
- */
- val exitCode: Int? = null,
-)
+class ExecutionError
+ @JvmOverloads
+ constructor(
+ val name: String,
+ val value: String,
+ val timestamp: Long,
+ val traceback: List<String> = emptyList(),
+ /**
+ * Exit status reported by execd for a CommandExecError when the command ran
+ * and finished with a non-zero status (-1 when terminated by a signal).
+ * Null when the process failed to start, for non-command errors, and on
+ * servers that predate error.exit_code.
+ */
+ val exitCode: Int? = null,
+ )
/**
* Execution complete event.
@@ -163,23 +165,25 @@ class ExecutionError(
* Represents the completion of a code execution,
* including timing information about when the execution finished.
*/
-class ExecutionComplete(
- /**
- * Timestamp when the execution completed.
- * Unix timestamp in milliseconds indicating when the execution finished.
- */
- val timestamp: Long,
- /**
- * Execution time in mills
- */
- val executionTimeInMillis: Long,
- /**
- * Successful foreground POST /command exit status (0), when present on the
- * wire execution_complete event. Null for background startup, code
- * execution, and servers that omit execution_complete.exit_code.
- */
- val exitCode: Int? = null,
-)
+class ExecutionComplete
+ @JvmOverloads
+ constructor(
+ /**
+ * Timestamp when the execution completed.
+ * Unix timestamp in milliseconds indicating when the execution finished.
+ */
+ val timestamp: Long,
+ /**
+ * Execution time in mills
+ */
+ val executionTimeInMillis: Long,
+ /**
+ * Successful foreground POST /command exit status (0), when present on the
+ * wire execution_complete event. Null for background startup, code
+ * execution, and servers that omit execution_complete.exit_code.
+ */
+ val exitCode: Int? = null,
+ )
/**
* Execution init event.