open-agents-ai 0.186.47 → 0.186.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +108 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -299203,6 +299203,110 @@ function isDockerAvailable() {
299203
299203
  return false;
299204
299204
  }
299205
299205
  }
299206
+ function isDockerInstalled() {
299207
+ try {
299208
+ execSync35("docker --version", { stdio: "pipe", timeout: 5e3 });
299209
+ return true;
299210
+ } catch {
299211
+ return false;
299212
+ }
299213
+ }
299214
+ async function ensureDocker() {
299215
+ if (isDockerAvailable()) {
299216
+ return { ok: true, message: "Docker is available" };
299217
+ }
299218
+ if (isDockerInstalled()) {
299219
+ return {
299220
+ ok: false,
299221
+ message: "Docker CLI is installed but the daemon is not running. Start it with: sudo systemctl start docker"
299222
+ };
299223
+ }
299224
+ const platform6 = process.platform;
299225
+ if (platform6 !== "linux") {
299226
+ return {
299227
+ ok: false,
299228
+ message: `Docker not found. Install manually: https://docs.docker.com/get-docker/ (${platform6})`
299229
+ };
299230
+ }
299231
+ try {
299232
+ console.log("[oa-docker] Docker not found. Installing via get.docker.com...");
299233
+ execSync35("curl -fsSL https://get.docker.com | sh", {
299234
+ stdio: "inherit",
299235
+ timeout: 3e5
299236
+ });
299237
+ const user = process.env["USER"] || process.env["LOGNAME"];
299238
+ if (user) {
299239
+ try {
299240
+ execSync35(`sudo usermod -aG docker ${user}`, { stdio: "pipe" });
299241
+ } catch {
299242
+ }
299243
+ }
299244
+ try {
299245
+ execSync35("sudo systemctl start docker", { stdio: "pipe", timeout: 15e3 });
299246
+ } catch {
299247
+ }
299248
+ try {
299249
+ execSync35("nvidia-smi", { stdio: "pipe", timeout: 5e3 });
299250
+ const runtimes = execSync35("docker info --format '{{json .Runtimes}}'", {
299251
+ stdio: "pipe",
299252
+ timeout: 5e3
299253
+ }).toString();
299254
+ if (!runtimes.includes("nvidia")) {
299255
+ console.log("[oa-docker] NVIDIA GPU detected. Installing nvidia-container-toolkit...");
299256
+ try {
299257
+ execSync35(`
299258
+ curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 2>/dev/null
299259
+ curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list > /dev/null 2>&1
299260
+ sudo apt-get update -qq 2>/dev/null && sudo apt-get install -y -qq nvidia-container-toolkit 2>/dev/null || ( sudo dnf install -y nvidia-container-toolkit 2>/dev/null || sudo yum install -y nvidia-container-toolkit 2>/dev/null || true )
299261
+ sudo nvidia-ctk runtime configure --runtime=docker 2>/dev/null
299262
+ sudo systemctl restart docker 2>/dev/null
299263
+ `, { stdio: "pipe", timeout: 12e4 });
299264
+ console.log("[oa-docker] nvidia-container-toolkit installed. GPU passthrough enabled.");
299265
+ } catch {
299266
+ console.log("[oa-docker] nvidia-container-toolkit install failed \u2014 GPU passthrough unavailable. Install manually: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html");
299267
+ }
299268
+ }
299269
+ } catch {
299270
+ }
299271
+ if (isDockerAvailable()) {
299272
+ return { ok: true, message: "Docker installed and running" };
299273
+ }
299274
+ return {
299275
+ ok: false,
299276
+ message: "Docker installed but daemon not reachable. You may need to log out and back in, or run: sudo systemctl start docker"
299277
+ };
299278
+ } catch (err) {
299279
+ return {
299280
+ ok: false,
299281
+ message: `Docker auto-install failed: ${err instanceof Error ? err.message : String(err)}. Install manually: https://docs.docker.com/get-docker/`
299282
+ };
299283
+ }
299284
+ }
299285
+ async function ensureNvidiaToolkit() {
299286
+ try {
299287
+ execSync35("nvidia-smi --query-gpu=name --format=csv,noheader", { stdio: "pipe", timeout: 5e3 });
299288
+ } catch {
299289
+ return { ok: false, message: "No NVIDIA GPU detected (nvidia-smi not found)" };
299290
+ }
299291
+ if (hasNvidiaGpu()) {
299292
+ return { ok: true, message: "nvidia-container-toolkit already configured" };
299293
+ }
299294
+ if (process.platform !== "linux") {
299295
+ return { ok: false, message: "Auto-install only supported on Linux. Install manually: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html" };
299296
+ }
299297
+ try {
299298
+ execSync35(`
299299
+ curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 2>/dev/null
299300
+ curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list > /dev/null 2>&1
299301
+ sudo apt-get update -qq 2>/dev/null && sudo apt-get install -y -qq nvidia-container-toolkit 2>/dev/null || ( sudo dnf install -y nvidia-container-toolkit 2>/dev/null || sudo yum install -y nvidia-container-toolkit 2>/dev/null || true )
299302
+ sudo nvidia-ctk runtime configure --runtime=docker 2>/dev/null
299303
+ sudo systemctl restart docker 2>/dev/null
299304
+ `, { stdio: "pipe", timeout: 12e4 });
299305
+ return { ok: true, message: "nvidia-container-toolkit installed and configured" };
299306
+ } catch (err) {
299307
+ return { ok: false, message: `nvidia-container-toolkit install failed: ${err instanceof Error ? err.message : String(err)}` };
299308
+ }
299309
+ }
299206
299310
  function isOaImageBuilt() {
299207
299311
  try {
299208
299312
  const out = execSync35(`docker images -q ${OA_IMAGE}:${OA_IMAGE_TAG}`, {
@@ -300160,7 +300264,10 @@ async function handleV1Run(req2, res) {
300160
300264
  const sandbox = requestBody["sandbox"] || activeProfile?.sandbox || process.env["OA_DEFAULT_SANDBOX"] || "none";
300161
300265
  if (sandbox === "container") {
300162
300266
  if (!isDockerAvailable()) {
300163
- jsonResponse(res, 400, { error: "Container sandbox unavailable", message: "Docker not found or daemon not running. Install Docker or use sandbox:'none'." });
300267
+ ensureDocker().then(() => ensureNvidiaToolkit().catch(() => {
300268
+ })).catch(() => {
300269
+ });
300270
+ jsonResponse(res, 503, { error: "Container sandbox unavailable", message: "Docker not found. Auto-installing in background \u2014 retry in ~3 minutes. Or install manually: https://docs.docker.com/get-docker/" });
300164
300271
  return;
300165
300272
  }
300166
300273
  if (!isOaImageBuilt()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.186.47",
3
+ "version": "0.186.48",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",