open-agents-ai 0.184.75 → 0.184.77
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.
- package/dist/index.js +43 -9
- 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 = `
|
|
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 = `
|
|
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
|
|
15986
|
-
if (
|
|
15987
|
-
const formatted =
|
|
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 ${
|
|
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
|
-
|
|
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
|
-
|
|
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) {
|
|
@@ -62105,7 +62139,7 @@ ${CONTENT_BG_SEQ}`);
|
|
|
62105
62139
|
onCtrlO();
|
|
62106
62140
|
return;
|
|
62107
62141
|
}
|
|
62108
|
-
if (key?.ctrl && key?.name === "
|
|
62142
|
+
if (s === "" || key?.ctrl && key?.name === "\\" || s === "\x1B[9;5u") {
|
|
62109
62143
|
self.cycleFocus();
|
|
62110
62144
|
return;
|
|
62111
62145
|
}
|
package/package.json
CHANGED