open-agents-ai 0.184.74 → 0.184.76

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 +68 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -15944,10 +15944,10 @@ Coordinates are normalized (0-1). Multiply by image width/height for pixel value
15944
15944
  ollamaPrompt = prompt;
15945
15945
  break;
15946
15946
  case "detect":
15947
- ollamaPrompt = `Detect all instances of "${prompt}" in this image. For each, describe its location.`;
15947
+ ollamaPrompt = `Locate all instances of "${prompt}" in this image. For each, give bounding box coordinates as [x1, y1, x2, y2].`;
15948
15948
  break;
15949
15949
  case "point":
15950
- ollamaPrompt = `Point to ${prompt}`;
15950
+ ollamaPrompt = `Locate the "${prompt}" in this image and give its x,y position as normalized coordinates.`;
15951
15951
  break;
15952
15952
  default:
15953
15953
  return null;
@@ -15982,19 +15982,48 @@ Coordinates are normalized (0-1). Multiply by image width/height for pixel value
15982
15982
  if (!response)
15983
15983
  return null;
15984
15984
  if (action === "point") {
15985
- const matches = [...response.matchAll(/<point\s+x="([\d.]+)"\s+y="([\d.]+)"\s*\/?>/g)];
15986
- if (matches.length > 0) {
15987
- const formatted = matches.map((m, i) => ` ${i + 1}. (${parseFloat(m[1]).toFixed(4)}, ${parseFloat(m[2]).toFixed(4)}) \u2014 normalized 0-1`).join("\n");
15985
+ const xmlMatches = [...response.matchAll(/<point\s+x="([\d.]+)"\s+y="([\d.]+)"\s*\/?>/g)];
15986
+ if (xmlMatches.length > 0) {
15987
+ const formatted = xmlMatches.map((m, i) => ` ${i + 1}. (${parseFloat(m[1]).toFixed(4)}, ${parseFloat(m[2]).toFixed(4)}) \u2014 normalized 0-1`).join("\n");
15988
15988
  return {
15989
15989
  success: true,
15990
- output: `Found ${matches.length} "${prompt}" location(s) in ${filename} (via Ollama):
15990
+ output: `Found ${xmlMatches.length} "${prompt}" location(s) in ${filename} (via Ollama):
15991
15991
  ${formatted}
15992
15992
 
15993
15993
  Coordinates are normalized (0-1). Multiply by image width/height for pixel values.`,
15994
15994
  durationMs: performance.now() - start
15995
15995
  };
15996
15996
  }
15997
- return { success: true, output: `Could not extract coordinates for "${prompt}" from ${filename}. Model response: ${response}`, durationMs: performance.now() - start };
15997
+ const arrayMatch = response.match(/\[\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+)\s*,\s*([\d.]+))?\s*\]/);
15998
+ if (arrayMatch) {
15999
+ const x1 = parseFloat(arrayMatch[1]);
16000
+ const y1 = parseFloat(arrayMatch[2]);
16001
+ if (arrayMatch[3] && arrayMatch[4]) {
16002
+ const x2 = parseFloat(arrayMatch[3]);
16003
+ const y2 = parseFloat(arrayMatch[4]);
16004
+ const cx = ((x1 + x2) / 2).toFixed(4);
16005
+ const cy = ((y1 + y2) / 2).toFixed(4);
16006
+ return {
16007
+ success: true,
16008
+ output: `Found "${prompt}" in ${filename} (via Ollama):
16009
+ Center: (${cx}, ${cy}) \u2014 normalized 0-1
16010
+ Bounding box: [${x1}, ${y1}, ${x2}, ${y2}]
16011
+
16012
+ Coordinates are normalized (0-1). Multiply by image width/height for pixel values.`,
16013
+ durationMs: performance.now() - start
16014
+ };
16015
+ }
16016
+ return {
16017
+ success: true,
16018
+ output: `Found "${prompt}" in ${filename} (via Ollama):
16019
+ Position: (${x1.toFixed(4)}, ${y1.toFixed(4)}) \u2014 normalized 0-1
16020
+
16021
+ Coordinates are normalized (0-1). Multiply by image width/height for pixel values.`,
16022
+ durationMs: performance.now() - start
16023
+ };
16024
+ }
16025
+ return { success: true, output: `Location of "${prompt}" in ${filename} (via Ollama):
16026
+ ${response}`, durationMs: performance.now() - start };
15998
16027
  }
15999
16028
  if (action === "caption") {
16000
16029
  return { success: true, output: `Caption (${length}) for ${filename} (via Ollama):
@@ -51415,13 +51444,18 @@ async function handleUpdate(subcommand, ctx) {
51415
51444
  const { execPath, argv } = process;
51416
51445
  try {
51417
51446
  const { execFileSync } = await import("node:child_process");
51447
+ if (process.stdout.isTTY) {
51448
+ process.stdout.write("\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?25h\x1B[?1049l\x1B[0m");
51449
+ }
51418
51450
  process.env.__OA_RESUMED = resumeFlag;
51419
51451
  execFileSync(execPath, argv.slice(1), {
51420
51452
  stdio: "inherit",
51421
51453
  env: { ...process.env, __OA_RESUMED: resumeFlag }
51422
51454
  });
51455
+ process.exit(0);
51423
51456
  } catch {
51424
- renderWarning("Restart oa manually to use the new version.");
51457
+ process.stderr.write("\x1B[0m\nRestart oa manually to use the new version.\n");
51458
+ process.exit(1);
51425
51459
  }
51426
51460
  }
51427
51461
  async function switchModel(query, ctx, local = false) {
@@ -64391,6 +64425,32 @@ ${lines.join("\n")}
64391
64425
  if (flowEnabled) {
64392
64426
  dynamicContext += "\n\n" + FLOWSTATE_PROMPT;
64393
64427
  }
64428
+ if (modelCaps?.vision) {
64429
+ dynamicContext += `
64430
+
64431
+ <vision-capabilities>
64432
+ You have vision capabilities available. You can analyze images using these tools:
64433
+
64434
+ 1. **image_read** \u2014 Read/view an image file directly. Use this for screenshots, photos,
64435
+ diagrams, or any image the user provides. Pass the file path.
64436
+ Example: image_read(image="/path/to/image.png")
64437
+
64438
+ 2. **vision** \u2014 Analyze images with Moondream vision model. Supports:
64439
+ - caption: Describe what's in an image
64440
+ - query: Ask a question about an image (visual QA)
64441
+ - detect: Find all instances of an object (bounding boxes)
64442
+ - point: Find the center location of an object (for click targeting)
64443
+ Example: vision(image="/tmp/screenshot.png", action="caption")
64444
+ Example: vision(image="photo.jpg", action="query", prompt="What color is the car?")
64445
+
64446
+ 3. **screenshot** \u2014 Capture the current screen (desktop automation).
64447
+ Returns a screenshot path you can then analyze with vision or image_read.
64448
+
64449
+ When the user asks you to look at, describe, or analyze an image or camera feed,
64450
+ use these tools proactively. Do not say you cannot see images \u2014 you can.
64451
+ For video streams or camera feeds, capture frames and analyze them sequentially.
64452
+ </vision-capabilities>`;
64453
+ }
64394
64454
  let localFirstOverride = false;
64395
64455
  if (config.backendType === "nexus") {
64396
64456
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.184.74",
3
+ "version": "0.184.76",
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",