open-agents-ai 0.139.5 → 0.139.7
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 +51 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13903,24 +13903,41 @@ var init_image_generate = __esm({
|
|
|
13903
13903
|
cachedImageModel = null;
|
|
13904
13904
|
constructor(cwd4, ollamaUrl = "http://localhost:11434") {
|
|
13905
13905
|
this.cwd = cwd4;
|
|
13906
|
-
this.ollamaUrl = ollamaUrl;
|
|
13906
|
+
this.ollamaUrl = ollamaUrl.replace(/\/v1\/?$/, "").replace(/\/$/, "");
|
|
13907
13907
|
}
|
|
13908
13908
|
async execute(args) {
|
|
13909
13909
|
const prompt = String(args.prompt ?? "");
|
|
13910
13910
|
const width = Number(args.width ?? 1024);
|
|
13911
13911
|
const height = Number(args.height ?? 1024);
|
|
13912
13912
|
const steps = args.steps ? Number(args.steps) : void 0;
|
|
13913
|
-
const
|
|
13913
|
+
const rawModel = args.model ? String(args.model) : void 0;
|
|
13914
|
+
const requestedModel = rawModel === "auto" ? void 0 : rawModel;
|
|
13914
13915
|
const start = performance.now();
|
|
13915
13916
|
if (!prompt.trim()) {
|
|
13916
13917
|
return { success: false, output: "No prompt provided", error: "Empty prompt", durationMs: 0 };
|
|
13917
13918
|
}
|
|
13918
13919
|
try {
|
|
13919
|
-
|
|
13920
|
+
let model = requestedModel ?? await this.findImageGenModel();
|
|
13921
|
+
if (!model) {
|
|
13922
|
+
try {
|
|
13923
|
+
const pullResp = await fetch(`${this.ollamaUrl}/api/pull`, {
|
|
13924
|
+
method: "POST",
|
|
13925
|
+
headers: { "Content-Type": "application/json" },
|
|
13926
|
+
body: JSON.stringify({ name: "x/z-image-turbo", stream: false }),
|
|
13927
|
+
signal: AbortSignal.timeout(6e5)
|
|
13928
|
+
// 10 min for model download
|
|
13929
|
+
});
|
|
13930
|
+
if (pullResp.ok) {
|
|
13931
|
+
model = "x/z-image-turbo";
|
|
13932
|
+
this.cachedImageModel = model;
|
|
13933
|
+
}
|
|
13934
|
+
} catch {
|
|
13935
|
+
}
|
|
13936
|
+
}
|
|
13920
13937
|
if (!model) {
|
|
13921
13938
|
return {
|
|
13922
13939
|
success: false,
|
|
13923
|
-
output: "No image generation model available.\nPull
|
|
13940
|
+
output: "No image generation model available and auto-pull failed.\nPull manually: ollama pull x/z-image-turbo\nOr: ollama pull x/flux2-klein\nNote: Image generation is currently macOS-only in Ollama. Linux/Windows support is coming soon.",
|
|
13924
13941
|
error: "No image gen model",
|
|
13925
13942
|
durationMs: performance.now() - start
|
|
13926
13943
|
};
|
|
@@ -13981,10 +13998,19 @@ ${errText.slice(0, 200)}`,
|
|
|
13981
13998
|
};
|
|
13982
13999
|
}
|
|
13983
14000
|
}
|
|
13984
|
-
/** Find the best available image gen model on Ollama
|
|
14001
|
+
/** Find the best available image gen model on Ollama.
|
|
14002
|
+
* Priority: 1) known image models by name, 2) capabilities="image" check */
|
|
13985
14003
|
async findImageGenModel() {
|
|
13986
14004
|
if (this.cachedImageModel)
|
|
13987
14005
|
return this.cachedImageModel;
|
|
14006
|
+
const KNOWN_IMAGE_MODELS = [
|
|
14007
|
+
"x/z-image-turbo",
|
|
14008
|
+
// 6B, Apache 2.0, photorealistic + bilingual text
|
|
14009
|
+
"x/flux2-klein",
|
|
14010
|
+
// 4B, Apache 2.0, good text rendering
|
|
14011
|
+
"x/flux2-klein:9b"
|
|
14012
|
+
// 9B, non-commercial, higher quality
|
|
14013
|
+
];
|
|
13988
14014
|
try {
|
|
13989
14015
|
const resp = await fetch(`${this.ollamaUrl}/api/tags`, {
|
|
13990
14016
|
signal: AbortSignal.timeout(5e3)
|
|
@@ -13993,6 +14019,13 @@ ${errText.slice(0, 200)}`,
|
|
|
13993
14019
|
return null;
|
|
13994
14020
|
const data = await resp.json();
|
|
13995
14021
|
const models = data.models ?? [];
|
|
14022
|
+
const modelNames = new Set(models.map((m) => m.name));
|
|
14023
|
+
for (const known of KNOWN_IMAGE_MODELS) {
|
|
14024
|
+
if (modelNames.has(known) || modelNames.has(known + ":latest")) {
|
|
14025
|
+
this.cachedImageModel = known;
|
|
14026
|
+
return known;
|
|
14027
|
+
}
|
|
14028
|
+
}
|
|
13996
14029
|
for (const m of models) {
|
|
13997
14030
|
try {
|
|
13998
14031
|
const showResp = await fetch(`${this.ollamaUrl}/api/show`, {
|
|
@@ -52953,6 +52986,13 @@ var init_text_selection = __esm({
|
|
|
52953
52986
|
|
|
52954
52987
|
// packages/cli/dist/tui/status-bar.js
|
|
52955
52988
|
import { readFileSync as readFileSync31 } from "node:fs";
|
|
52989
|
+
function setTerminalTitle(task, version) {
|
|
52990
|
+
if (!process.stdout.isTTY)
|
|
52991
|
+
return;
|
|
52992
|
+
const ver = version ? `OA v${version}` : "OA";
|
|
52993
|
+
const title = task ? `${task.slice(0, 60)} \xB7 ${ver}` : ver;
|
|
52994
|
+
process.stdout.write(`\x1B]2;${title}\x07`);
|
|
52995
|
+
}
|
|
52956
52996
|
var EXPERT_TOOL_BASELINES, CONTEXT_SWITCH_OVERHEAD, TURN_PLANNING_OVERHEAD, DEFAULT_TOOL_BASELINE, CODE_READ_CHARS_PER_SEC, PROSE_READ_CHARS_PER_SEC, MIN_CONTENT_FOR_READING, CODE_CONTENT_TOOLS, PROSE_CONTENT_TOOLS, HumanSpeedTracker, PANEL_BG, CONTENT_BG, TEXT_PRIMARY, PANEL_BG_SEQ, CONTENT_BG_SEQ, RESET, StatusBar;
|
|
52957
52997
|
var init_status_bar = __esm({
|
|
52958
52998
|
"packages/cli/dist/tui/status-bar.js"() {
|
|
@@ -56452,6 +56492,7 @@ async function startInteractive(config, repoPath) {
|
|
|
56452
56492
|
if (process.stdout.isTTY) {
|
|
56453
56493
|
const scrollTop = carouselLines > 0 ? carouselLines : 1;
|
|
56454
56494
|
statusBar.activate(scrollTop);
|
|
56495
|
+
setTerminalTitle(void 0, version);
|
|
56455
56496
|
banner.onAfterRender = () => statusBar.renderHeaderButtons();
|
|
56456
56497
|
statusBar.setBannerRefresh(() => {
|
|
56457
56498
|
banner.renderCurrentFrame();
|
|
@@ -58693,6 +58734,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
58693
58734
|
lastTaskMeta = meta ?? null;
|
|
58694
58735
|
}, currentTaskType, resolvedContextWindowSize, resolvedCaps, currentStyle, deepContextEnabled, compactionSNRCallback(), emotionEngine, flowEnabled, buildSlashCommandHandler(), thinkingEnabled, handleAskUser);
|
|
58695
58736
|
activeTask = task;
|
|
58737
|
+
setTerminalTitle(input.slice(0, 60), version);
|
|
58696
58738
|
showPrompt();
|
|
58697
58739
|
if (isNeovimActive() && !isNeovimFocused()) {
|
|
58698
58740
|
refocusNeovim();
|
|
@@ -58704,6 +58746,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
58704
58746
|
}
|
|
58705
58747
|
statusBar.setProcessing(false);
|
|
58706
58748
|
activeTask = null;
|
|
58749
|
+
setTerminalTitle(void 0, version);
|
|
58707
58750
|
showPrompt();
|
|
58708
58751
|
return;
|
|
58709
58752
|
}
|
|
@@ -58944,6 +58987,7 @@ NEW TASK: ${fullInput}`;
|
|
|
58944
58987
|
lastTaskMeta = meta ?? null;
|
|
58945
58988
|
}, currentTaskType, resolvedContextWindowSize, resolvedCaps, currentStyle, deepContextEnabled, compactionSNRCallback(), emotionEngine, flowEnabled, buildSlashCommandHandler(), thinkingEnabled, handleAskUser);
|
|
58946
58989
|
activeTask = task;
|
|
58990
|
+
setTerminalTitle(input.slice(0, 60), version);
|
|
58947
58991
|
showPrompt();
|
|
58948
58992
|
if (isNeovimActive() && !isNeovimFocused()) {
|
|
58949
58993
|
refocusNeovim();
|
|
@@ -58990,6 +59034,7 @@ NEW TASK: ${fullInput}`;
|
|
|
58990
59034
|
sessionToolCallCount = activeTask.toolCallCount;
|
|
58991
59035
|
}
|
|
58992
59036
|
activeTask = null;
|
|
59037
|
+
setTerminalTitle(void 0, version);
|
|
58993
59038
|
}
|
|
58994
59039
|
const updateMode = savedSettings.updateMode ?? "auto";
|
|
58995
59040
|
if (updateMode !== "manual") {
|
|
@@ -59209,6 +59254,7 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
59209
59254
|
}
|
|
59210
59255
|
renderCompactHeader(config.model);
|
|
59211
59256
|
renderUserMessage(task);
|
|
59257
|
+
setTerminalTitle(task.slice(0, 60), getVersion3());
|
|
59212
59258
|
try {
|
|
59213
59259
|
const handle = startTask(task, config, repoRoot);
|
|
59214
59260
|
await handle.promise;
|
package/package.json
CHANGED