open-agents-ai 0.186.47 → 0.186.49

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 +120 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8267,7 +8267,10 @@ process.on('unhandledRejection', (reason) => {
8267
8267
  try {
8268
8268
  var _cProbe = await fetch(_cApiUrl + '/v1/config', { signal: AbortSignal.timeout(2000) });
8269
8269
  _cApiAvailable = _cProbe.ok;
8270
- } catch {}
8270
+ dlog('COHERE: API probe ' + _cApiUrl + '/v1/config \u2192 ' + (_cProbe.ok ? 'OK' : 'HTTP ' + _cProbe.status));
8271
+ } catch (_cProbeErr) {
8272
+ dlog('COHERE: API probe failed: ' + (_cProbeErr.message || _cProbeErr));
8273
+ }
8271
8274
 
8272
8275
  if (_cApiAvailable) {
8273
8276
  dlog('COHERE: routing through full AgenticRunner at ' + _cApiUrl + '/v1/run');
@@ -8280,7 +8283,7 @@ process.on('unhandledRejection', (reason) => {
8280
8283
  model: _cModel,
8281
8284
  max_turns: 8,
8282
8285
  timeout_s: 90,
8283
- sandbox: 'container',
8286
+ sandbox: 'none',
8284
8287
  profile: 'cohere-mesh',
8285
8288
  }),
8286
8289
  signal: AbortSignal.timeout(120000),
@@ -8327,24 +8330,16 @@ process.on('unhandledRejection', (reason) => {
8327
8330
  dlog('COHERE: AgenticRunner error: ' + (_cRunErr.message || _cRunErr) + ' \u2014 falling back');
8328
8331
  }
8329
8332
  } else {
8330
- dlog('COHERE: OA API not available at ' + _cApiUrl + ' \u2014 using raw Ollama');
8333
+ dlog('COHERE: OA API not available at ' + _cApiUrl + ' \u2014 CANNOT process query (no raw Ollama fallback)');
8334
+ _cContent = '[COHERE error] OA API server not running on this node. Start it with: oa serve';
8331
8335
  }
8332
8336
 
8333
- // Fallback: raw Ollama /api/chat if API not available or returned empty
8337
+ // NO raw Ollama fallback \u2014 all queries MUST go through AgenticRunner
8338
+ // If /v1/run failed or API unavailable, report the error instead of
8339
+ // sending garbage responses without tools/context/system prompt.
8334
8340
  if (!_cContent) {
8335
- var _cMessages = (_cData.messages && _cData.messages.length > 0)
8336
- ? _cData.messages
8337
- : [{ role: 'user', content: _cData.query }];
8338
- dlog('COHERE fallback: raw Ollama, ' + _cMessages.length + ' msg, model=' + _cModel);
8339
- var _cResp = await fetch(_cOllamaUrl + '/api/chat', {
8340
- method: 'POST',
8341
- headers: { 'Content-Type': 'application/json' },
8342
- body: JSON.stringify({ model: _cModel, messages: _cMessages, stream: false }),
8343
- signal: AbortSignal.timeout(120000),
8344
- });
8345
- var _cResult = await _cResp.json();
8346
- _cContent = _cResult.message ? _cResult.message.content : '';
8347
- _cUsage = _cResult.eval_count ? { inputTokens: _cResult.prompt_eval_count || 0, outputTokens: _cResult.eval_count || 0 } : undefined;
8341
+ _cContent = '[COHERE error] AgenticRunner returned empty response. Check OA API server logs.';
8342
+ dlog('COHERE: no content from AgenticRunner \u2014 reporting error (no raw Ollama fallback)');
8348
8343
  }
8349
8344
 
8350
8345
  const _cLatency = Date.now() - _cStart;
@@ -299203,6 +299198,110 @@ function isDockerAvailable() {
299203
299198
  return false;
299204
299199
  }
299205
299200
  }
299201
+ function isDockerInstalled() {
299202
+ try {
299203
+ execSync35("docker --version", { stdio: "pipe", timeout: 5e3 });
299204
+ return true;
299205
+ } catch {
299206
+ return false;
299207
+ }
299208
+ }
299209
+ async function ensureDocker() {
299210
+ if (isDockerAvailable()) {
299211
+ return { ok: true, message: "Docker is available" };
299212
+ }
299213
+ if (isDockerInstalled()) {
299214
+ return {
299215
+ ok: false,
299216
+ message: "Docker CLI is installed but the daemon is not running. Start it with: sudo systemctl start docker"
299217
+ };
299218
+ }
299219
+ const platform6 = process.platform;
299220
+ if (platform6 !== "linux") {
299221
+ return {
299222
+ ok: false,
299223
+ message: `Docker not found. Install manually: https://docs.docker.com/get-docker/ (${platform6})`
299224
+ };
299225
+ }
299226
+ try {
299227
+ console.log("[oa-docker] Docker not found. Installing via get.docker.com...");
299228
+ execSync35("curl -fsSL https://get.docker.com | sh", {
299229
+ stdio: "inherit",
299230
+ timeout: 3e5
299231
+ });
299232
+ const user = process.env["USER"] || process.env["LOGNAME"];
299233
+ if (user) {
299234
+ try {
299235
+ execSync35(`sudo usermod -aG docker ${user}`, { stdio: "pipe" });
299236
+ } catch {
299237
+ }
299238
+ }
299239
+ try {
299240
+ execSync35("sudo systemctl start docker", { stdio: "pipe", timeout: 15e3 });
299241
+ } catch {
299242
+ }
299243
+ try {
299244
+ execSync35("nvidia-smi", { stdio: "pipe", timeout: 5e3 });
299245
+ const runtimes = execSync35("docker info --format '{{json .Runtimes}}'", {
299246
+ stdio: "pipe",
299247
+ timeout: 5e3
299248
+ }).toString();
299249
+ if (!runtimes.includes("nvidia")) {
299250
+ console.log("[oa-docker] NVIDIA GPU detected. Installing nvidia-container-toolkit...");
299251
+ try {
299252
+ execSync35(`
299253
+ curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 2>/dev/null
299254
+ 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
299255
+ 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 )
299256
+ sudo nvidia-ctk runtime configure --runtime=docker 2>/dev/null
299257
+ sudo systemctl restart docker 2>/dev/null
299258
+ `, { stdio: "pipe", timeout: 12e4 });
299259
+ console.log("[oa-docker] nvidia-container-toolkit installed. GPU passthrough enabled.");
299260
+ } catch {
299261
+ 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");
299262
+ }
299263
+ }
299264
+ } catch {
299265
+ }
299266
+ if (isDockerAvailable()) {
299267
+ return { ok: true, message: "Docker installed and running" };
299268
+ }
299269
+ return {
299270
+ ok: false,
299271
+ message: "Docker installed but daemon not reachable. You may need to log out and back in, or run: sudo systemctl start docker"
299272
+ };
299273
+ } catch (err) {
299274
+ return {
299275
+ ok: false,
299276
+ message: `Docker auto-install failed: ${err instanceof Error ? err.message : String(err)}. Install manually: https://docs.docker.com/get-docker/`
299277
+ };
299278
+ }
299279
+ }
299280
+ async function ensureNvidiaToolkit() {
299281
+ try {
299282
+ execSync35("nvidia-smi --query-gpu=name --format=csv,noheader", { stdio: "pipe", timeout: 5e3 });
299283
+ } catch {
299284
+ return { ok: false, message: "No NVIDIA GPU detected (nvidia-smi not found)" };
299285
+ }
299286
+ if (hasNvidiaGpu()) {
299287
+ return { ok: true, message: "nvidia-container-toolkit already configured" };
299288
+ }
299289
+ if (process.platform !== "linux") {
299290
+ return { ok: false, message: "Auto-install only supported on Linux. Install manually: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html" };
299291
+ }
299292
+ try {
299293
+ execSync35(`
299294
+ curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 2>/dev/null
299295
+ 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
299296
+ 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 )
299297
+ sudo nvidia-ctk runtime configure --runtime=docker 2>/dev/null
299298
+ sudo systemctl restart docker 2>/dev/null
299299
+ `, { stdio: "pipe", timeout: 12e4 });
299300
+ return { ok: true, message: "nvidia-container-toolkit installed and configured" };
299301
+ } catch (err) {
299302
+ return { ok: false, message: `nvidia-container-toolkit install failed: ${err instanceof Error ? err.message : String(err)}` };
299303
+ }
299304
+ }
299206
299305
  function isOaImageBuilt() {
299207
299306
  try {
299208
299307
  const out = execSync35(`docker images -q ${OA_IMAGE}:${OA_IMAGE_TAG}`, {
@@ -300160,7 +300259,10 @@ async function handleV1Run(req2, res) {
300160
300259
  const sandbox = requestBody["sandbox"] || activeProfile?.sandbox || process.env["OA_DEFAULT_SANDBOX"] || "none";
300161
300260
  if (sandbox === "container") {
300162
300261
  if (!isDockerAvailable()) {
300163
- jsonResponse(res, 400, { error: "Container sandbox unavailable", message: "Docker not found or daemon not running. Install Docker or use sandbox:'none'." });
300262
+ ensureDocker().then(() => ensureNvidiaToolkit().catch(() => {
300263
+ })).catch(() => {
300264
+ });
300265
+ 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
300266
  return;
300165
300267
  }
300166
300268
  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.49",
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",