open-agents-ai 0.187.283 → 0.187.284
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 +27 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -328330,6 +328330,7 @@ Rules:
|
|
|
328330
328330
|
toolRelay = null;
|
|
328331
328331
|
verbose = false;
|
|
328332
328332
|
debugSnr = false;
|
|
328333
|
+
heuristicsEnabled = true;
|
|
328333
328334
|
toolCatalogNote = null;
|
|
328334
328335
|
toolRelay = null;
|
|
328335
328336
|
// State machine
|
|
@@ -328370,6 +328371,7 @@ Rules:
|
|
|
328370
328371
|
this.toolRelay = opts.toolRelay ?? null;
|
|
328371
328372
|
this.verbose = Boolean(opts.verbose);
|
|
328372
328373
|
this.debugSnr = Boolean(opts.debugSnr);
|
|
328374
|
+
this.heuristicsEnabled = opts.heuristicsEnabled !== false;
|
|
328373
328375
|
this.toolRelay = opts.toolRelay ?? null;
|
|
328374
328376
|
this.onStatus = opts.onStatus ?? (() => {
|
|
328375
328377
|
});
|
|
@@ -328597,7 +328599,7 @@ ${snap.trim()}` });
|
|
|
328597
328599
|
}
|
|
328598
328600
|
const lastUser = [...this.context].reverse().find((m2) => m2.role === "user")?.content || "";
|
|
328599
328601
|
let preAnswered = false;
|
|
328600
|
-
if (this.toolRelay && lastUser) {
|
|
328602
|
+
if (this.heuristicsEnabled && this.toolRelay && lastUser) {
|
|
328601
328603
|
const lower = lastUser.toLowerCase();
|
|
328602
328604
|
const wantList = /(list|show|explore|browse|what's in|whats in|contents).*(dir|directory|folder|files)/.test(lower);
|
|
328603
328605
|
const wantEnv = /(what\s+dir|cwd|current\s+dir|working\s+directory|where\s+are\s+you)/.test(lower);
|
|
@@ -328649,7 +328651,7 @@ ${toolOutput}` });
|
|
|
328649
328651
|
response = await this.streamOllamaInference(this.abortController.signal);
|
|
328650
328652
|
}
|
|
328651
328653
|
if (!this.active) return;
|
|
328652
|
-
if (this.toolRelay && /\b(can't|cannot)\b/i.test(response) && this.toolCatalogNote) {
|
|
328654
|
+
if (this.heuristicsEnabled && this.toolRelay && /\b(can't|cannot)\b/i.test(response) && this.toolCatalogNote) {
|
|
328653
328655
|
this.context.push({ role: "system", content: `You have tools. Use them. ${this.toolCatalogNote}` });
|
|
328654
328656
|
response = await this.streamOllamaInference(this.abortController.signal);
|
|
328655
328657
|
}
|
|
@@ -333301,6 +333303,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
333301
333303
|
model: currentConfig2.model,
|
|
333302
333304
|
apiKey: currentConfig2.apiKey,
|
|
333303
333305
|
runner: summaryRunner,
|
|
333306
|
+
heuristicsEnabled: true,
|
|
333304
333307
|
toolRelay: {
|
|
333305
333308
|
async call(name11, args2) {
|
|
333306
333309
|
try {
|
|
@@ -333323,6 +333326,21 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
333323
333326
|
}
|
|
333324
333327
|
return "No active task; set args.start=true to begin one.";
|
|
333325
333328
|
}
|
|
333329
|
+
if (name11 === "voice_tool_catalog") {
|
|
333330
|
+
const cat2 = activeTask2?.runner.getToolCatalog() ?? [];
|
|
333331
|
+
const allow = /* @__PURE__ */ new Set(["list_directory", "file_read", "grep_search", "find_files", "memory_read", "memory_search", "todo_read"]);
|
|
333332
|
+
const filtered = cat2.filter((t2) => allow.has(t2.name));
|
|
333333
|
+
return JSON.stringify(filtered, null, 2);
|
|
333334
|
+
}
|
|
333335
|
+
if (name11 === "voice_tool_call") {
|
|
333336
|
+
const toolName = String(args2?.name || "").trim();
|
|
333337
|
+
const toolArgs = args2?.args || {};
|
|
333338
|
+
const allow = /* @__PURE__ */ new Set(["list_directory", "file_read", "grep_search", "find_files", "memory_read", "memory_search", "todo_read"]);
|
|
333339
|
+
if (!allow.has(toolName)) return `Tool not allowed: ${toolName}`;
|
|
333340
|
+
if (!activeTask2) return "No active task.";
|
|
333341
|
+
const result = await activeTask2.runner.runToolByName(toolName, toolArgs);
|
|
333342
|
+
return result.success ? result.output : `Error: ${result.error || "unknown"}`;
|
|
333343
|
+
}
|
|
333326
333344
|
if (name11 === "voice_env") {
|
|
333327
333345
|
const os8 = __require("node:os");
|
|
333328
333346
|
const p2 = __require("node:process");
|
|
@@ -333357,15 +333375,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
333357
333375
|
return JSON.stringify({ dir: base3, items }, null, 2);
|
|
333358
333376
|
}
|
|
333359
333377
|
if (name11 === "voice_read_file") {
|
|
333360
|
-
|
|
333361
|
-
|
|
333362
|
-
|
|
333363
|
-
|
|
333364
|
-
|
|
333365
|
-
|
|
333366
|
-
|
|
333367
|
-
return txt.length > max ? txt.slice(0, max) + `
|
|
333368
|
-
... [truncated ${txt.length - max} chars]` : txt;
|
|
333378
|
+
if (activeTask2) {
|
|
333379
|
+
const rel = String(args2?.path || "");
|
|
333380
|
+
const max = Math.max(0, Math.min(8192, Number(args2?.max) || 2048));
|
|
333381
|
+
const out = await activeTask2.runner.runToolByName("file_read", { path: rel, maxBytes: max });
|
|
333382
|
+
return out.success ? out.output : `Error: ${out.error || "unknown"}`;
|
|
333383
|
+
}
|
|
333384
|
+
return "No active task.";
|
|
333369
333385
|
}
|
|
333370
333386
|
return `Unknown tool: ${name11}`;
|
|
333371
333387
|
} catch (e2) {
|
package/package.json
CHANGED