open-agents-ai 0.139.4 → 0.139.6
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 +70 -13
- 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`, {
|
|
@@ -45941,10 +45974,18 @@ var init_toolPatternStore = __esm({
|
|
|
45941
45974
|
}
|
|
45942
45975
|
});
|
|
45943
45976
|
|
|
45977
|
+
// packages/memory/dist/embeddings.js
|
|
45978
|
+
var init_embeddings = __esm({
|
|
45979
|
+
"packages/memory/dist/embeddings.js"() {
|
|
45980
|
+
"use strict";
|
|
45981
|
+
}
|
|
45982
|
+
});
|
|
45983
|
+
|
|
45944
45984
|
// packages/memory/dist/proceduralMemoryStore.js
|
|
45945
45985
|
var init_proceduralMemoryStore = __esm({
|
|
45946
45986
|
"packages/memory/dist/proceduralMemoryStore.js"() {
|
|
45947
45987
|
"use strict";
|
|
45988
|
+
init_embeddings();
|
|
45948
45989
|
}
|
|
45949
45990
|
});
|
|
45950
45991
|
|
|
@@ -45960,6 +46001,7 @@ var init_dist7 = __esm({
|
|
|
45960
46001
|
init_failureStore();
|
|
45961
46002
|
init_validationStore();
|
|
45962
46003
|
init_toolPatternStore();
|
|
46004
|
+
init_embeddings();
|
|
45963
46005
|
init_proceduralMemoryStore();
|
|
45964
46006
|
}
|
|
45965
46007
|
});
|
|
@@ -59330,6 +59372,26 @@ Rules:
|
|
|
59330
59372
|
const steps = stepsMatch?.[1]?.trim().slice(0, 300) || "";
|
|
59331
59373
|
if (lesson && lesson.length > 5) {
|
|
59332
59374
|
const content = `[${category}] TRIGGER: ${trigger} | LESSON: ${lesson}` + (steps ? ` | STEPS: ${steps}` : "");
|
|
59375
|
+
try {
|
|
59376
|
+
const { initDb: initDb2 } = __require("@open-agents/memory");
|
|
59377
|
+
const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
|
|
59378
|
+
const dbDir = join59(repoRoot, ".oa", "memory");
|
|
59379
|
+
mkdirSync19(dbDir, { recursive: true });
|
|
59380
|
+
const db = initDb2(join59(dbDir, "structured.db"));
|
|
59381
|
+
const memStore = new ProceduralMemoryStore2(db);
|
|
59382
|
+
memStore.createWithEmbedding({
|
|
59383
|
+
content: content.slice(0, 600),
|
|
59384
|
+
category,
|
|
59385
|
+
triggerPattern: trigger,
|
|
59386
|
+
steps,
|
|
59387
|
+
sourceTrace: "llm-trajectory-extraction",
|
|
59388
|
+
utility: category === "recovery" ? 0.85 : 0.7,
|
|
59389
|
+
confidence: 0.8
|
|
59390
|
+
}, { baseUrl: config.backendUrl?.replace(/\/v1.*$/, "") || "http://localhost:11434" }).catch(() => {
|
|
59391
|
+
});
|
|
59392
|
+
db.close();
|
|
59393
|
+
} catch {
|
|
59394
|
+
}
|
|
59333
59395
|
const metaDir = join59(repoRoot, ".oa", "memory", "metabolism");
|
|
59334
59396
|
const storeFile = join59(metaDir, "store.json");
|
|
59335
59397
|
let store = [];
|
|
@@ -59343,12 +59405,7 @@ Rules:
|
|
|
59343
59405
|
type: "procedural",
|
|
59344
59406
|
content: content.slice(0, 600),
|
|
59345
59407
|
sourceTrace: "llm-trajectory-extraction",
|
|
59346
|
-
scores: {
|
|
59347
|
-
novelty: 0.7,
|
|
59348
|
-
utility: category === "recovery" ? 0.85 : 0.7,
|
|
59349
|
-
confidence: 0.8,
|
|
59350
|
-
identityRelevance: 0.3
|
|
59351
|
-
},
|
|
59408
|
+
scores: { novelty: 0.7, utility: category === "recovery" ? 0.85 : 0.7, confidence: 0.8, identityRelevance: 0.3 },
|
|
59352
59409
|
decision: { action: "admit", reason: `LLM-extracted ${category} from task (${ts.toolCallCount} tool calls)` },
|
|
59353
59410
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
59354
59411
|
lastAccessedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -59683,7 +59740,7 @@ var init_fileSummarizer = __esm({
|
|
|
59683
59740
|
});
|
|
59684
59741
|
|
|
59685
59742
|
// packages/indexer/dist/embeddings.js
|
|
59686
|
-
var
|
|
59743
|
+
var init_embeddings2 = __esm({
|
|
59687
59744
|
"packages/indexer/dist/embeddings.js"() {
|
|
59688
59745
|
"use strict";
|
|
59689
59746
|
}
|
|
@@ -59705,7 +59762,7 @@ var init_dist8 = __esm({
|
|
|
59705
59762
|
init_symbolExtractor();
|
|
59706
59763
|
init_graphBuilder();
|
|
59707
59764
|
init_fileSummarizer();
|
|
59708
|
-
|
|
59765
|
+
init_embeddings2();
|
|
59709
59766
|
init_ollamaEmbeddings();
|
|
59710
59767
|
}
|
|
59711
59768
|
});
|
package/package.json
CHANGED