open-agents-ai 0.184.73 → 0.184.75
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 +68 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15839,10 +15839,34 @@ var init_vision = __esm({
|
|
|
15839
15839
|
const ollamaResult = await this.tryOllamaVision(buffer, filename, action, prompt, length, start);
|
|
15840
15840
|
if (ollamaResult)
|
|
15841
15841
|
return ollamaResult;
|
|
15842
|
+
try {
|
|
15843
|
+
const { execSync: execSync34 } = await import("node:child_process");
|
|
15844
|
+
try {
|
|
15845
|
+
execSync34("pip3 install --user moondream 2>/dev/null || pip install --user moondream 2>/dev/null", {
|
|
15846
|
+
timeout: 12e4,
|
|
15847
|
+
stdio: "pipe"
|
|
15848
|
+
});
|
|
15849
|
+
moondreamError = null;
|
|
15850
|
+
moondreamClient = null;
|
|
15851
|
+
const retryClient = await getMoondreamClient().catch(() => null);
|
|
15852
|
+
if (retryClient) {
|
|
15853
|
+
return await this.runMoondream(retryClient, buffer, filename, action, prompt, length, start);
|
|
15854
|
+
}
|
|
15855
|
+
} catch {
|
|
15856
|
+
}
|
|
15857
|
+
try {
|
|
15858
|
+
execSync34("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
|
|
15859
|
+
const retryOllama = await this.tryOllamaVision(buffer, filename, action, prompt, length, start);
|
|
15860
|
+
if (retryOllama)
|
|
15861
|
+
return retryOllama;
|
|
15862
|
+
} catch {
|
|
15863
|
+
}
|
|
15864
|
+
} catch {
|
|
15865
|
+
}
|
|
15842
15866
|
return {
|
|
15843
15867
|
success: false,
|
|
15844
15868
|
output: "",
|
|
15845
|
-
error: "No vision backend available
|
|
15869
|
+
error: "No vision backend available (auto-install attempted but failed).\nManual options:\n 1. ollama pull moondream \u2014 uses Ollama (easiest)\n 2. pip install moondream-station \u2014 dedicated server\n 3. Set MOONDREAM_API_KEY for cloud inference",
|
|
15846
15870
|
durationMs: performance.now() - start
|
|
15847
15871
|
};
|
|
15848
15872
|
} catch (error) {
|
|
@@ -15929,12 +15953,28 @@ Coordinates are normalized (0-1). Multiply by image width/height for pixel value
|
|
|
15929
15953
|
return null;
|
|
15930
15954
|
}
|
|
15931
15955
|
try {
|
|
15932
|
-
|
|
15956
|
+
let res = await fetch(`${ollamaHost}/api/generate`, {
|
|
15933
15957
|
method: "POST",
|
|
15934
15958
|
headers: { "Content-Type": "application/json" },
|
|
15935
15959
|
body: JSON.stringify({ model, prompt: ollamaPrompt, images: [imageBase64], stream: false }),
|
|
15936
15960
|
signal: AbortSignal.timeout(6e4)
|
|
15937
15961
|
});
|
|
15962
|
+
if (!res.ok && model === "moondream") {
|
|
15963
|
+
const errText = await res.text().catch(() => "");
|
|
15964
|
+
if (res.status === 404 || /not found|does not exist/i.test(errText)) {
|
|
15965
|
+
try {
|
|
15966
|
+
const { execSync: execSync34 } = await import("node:child_process");
|
|
15967
|
+
execSync34("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
|
|
15968
|
+
res = await fetch(`${ollamaHost}/api/generate`, {
|
|
15969
|
+
method: "POST",
|
|
15970
|
+
headers: { "Content-Type": "application/json" },
|
|
15971
|
+
body: JSON.stringify({ model, prompt: ollamaPrompt, images: [imageBase64], stream: false }),
|
|
15972
|
+
signal: AbortSignal.timeout(6e4)
|
|
15973
|
+
});
|
|
15974
|
+
} catch {
|
|
15975
|
+
}
|
|
15976
|
+
}
|
|
15977
|
+
}
|
|
15938
15978
|
if (!res.ok)
|
|
15939
15979
|
return null;
|
|
15940
15980
|
const data = await res.json();
|
|
@@ -64351,6 +64391,32 @@ ${lines.join("\n")}
|
|
|
64351
64391
|
if (flowEnabled) {
|
|
64352
64392
|
dynamicContext += "\n\n" + FLOWSTATE_PROMPT;
|
|
64353
64393
|
}
|
|
64394
|
+
if (modelCaps?.vision) {
|
|
64395
|
+
dynamicContext += `
|
|
64396
|
+
|
|
64397
|
+
<vision-capabilities>
|
|
64398
|
+
You have vision capabilities available. You can analyze images using these tools:
|
|
64399
|
+
|
|
64400
|
+
1. **image_read** \u2014 Read/view an image file directly. Use this for screenshots, photos,
|
|
64401
|
+
diagrams, or any image the user provides. Pass the file path.
|
|
64402
|
+
Example: image_read(image="/path/to/image.png")
|
|
64403
|
+
|
|
64404
|
+
2. **vision** \u2014 Analyze images with Moondream vision model. Supports:
|
|
64405
|
+
- caption: Describe what's in an image
|
|
64406
|
+
- query: Ask a question about an image (visual QA)
|
|
64407
|
+
- detect: Find all instances of an object (bounding boxes)
|
|
64408
|
+
- point: Find the center location of an object (for click targeting)
|
|
64409
|
+
Example: vision(image="/tmp/screenshot.png", action="caption")
|
|
64410
|
+
Example: vision(image="photo.jpg", action="query", prompt="What color is the car?")
|
|
64411
|
+
|
|
64412
|
+
3. **screenshot** \u2014 Capture the current screen (desktop automation).
|
|
64413
|
+
Returns a screenshot path you can then analyze with vision or image_read.
|
|
64414
|
+
|
|
64415
|
+
When the user asks you to look at, describe, or analyze an image or camera feed,
|
|
64416
|
+
use these tools proactively. Do not say you cannot see images \u2014 you can.
|
|
64417
|
+
For video streams or camera feeds, capture frames and analyze them sequentially.
|
|
64418
|
+
</vision-capabilities>`;
|
|
64419
|
+
}
|
|
64354
64420
|
let localFirstOverride = false;
|
|
64355
64421
|
if (config.backendType === "nexus") {
|
|
64356
64422
|
try {
|
package/package.json
CHANGED