open-agents-ai 0.187.587 → 0.187.588
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 +133 -11
- package/npm-shrinkwrap.json +9 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -514656,7 +514656,8 @@ function evaluate(inputs) {
|
|
|
514656
514656
|
return {
|
|
514657
514657
|
decision: "observer_block",
|
|
514658
514658
|
reason: "Littleman observer flagged this fingerprint as redundant",
|
|
514659
|
-
cachedResult: cached ?
|
|
514659
|
+
cachedResult: cached ? `[CACHED RESULT — you already have this information from a prior call. Do NOT call this tool again with the same arguments.]
|
|
514660
|
+
${cached.result}` : null
|
|
514660
514661
|
};
|
|
514661
514662
|
}
|
|
514662
514663
|
if (isReadLike) {
|
|
@@ -514672,10 +514673,12 @@ function evaluate(inputs) {
|
|
|
514672
514673
|
blockMessage: buildForceProgressBlockMessage(proposedCall, hits)
|
|
514673
514674
|
};
|
|
514674
514675
|
}
|
|
514676
|
+
const cachedEnvelope = `[CACHED RESULT — you already have this information from a prior call. Do NOT call this tool again with the same arguments.]
|
|
514677
|
+
${cached.result}`;
|
|
514675
514678
|
return {
|
|
514676
514679
|
decision: "serve_cached",
|
|
514677
514680
|
reason: cached.compacted ? "post-compaction cache re-serve" : `duplicate call #${hits} (still under ${threshold}-hit gate)`,
|
|
514678
|
-
cachedResult:
|
|
514681
|
+
cachedResult: cachedEnvelope,
|
|
514679
514682
|
compacted: cached.compacted,
|
|
514680
514683
|
hitNumber: hits
|
|
514681
514684
|
};
|
|
@@ -529241,14 +529244,15 @@ ${body}`;
|
|
|
529241
529244
|
proactivePrune(messages2, currentTurn) {
|
|
529242
529245
|
if (process.env["OA_DISABLE_PROACTIVE_PRUNE"] === "1")
|
|
529243
529246
|
return;
|
|
529244
|
-
const AGED_FILE_READ_TURNS =
|
|
529245
|
-
const AGED_SHELL_TURNS =
|
|
529247
|
+
const AGED_FILE_READ_TURNS = 20;
|
|
529248
|
+
const AGED_SHELL_TURNS = 12;
|
|
529246
529249
|
const ERROR_MARKERS = /(?:error|fail|exception|traceback|enoent|enotfound|exit code [^0]|status[: ]+1\d?\d?)/i;
|
|
529247
529250
|
const PRUNE_PREFIX = "[Tool result cleared";
|
|
529248
529251
|
const DEDUPE_PREFIX = "[deduped — same call as turn";
|
|
529249
529252
|
const FILE_AGED_PREFIX = "[file_read aged out, summary:";
|
|
529250
529253
|
const SHELL_AGED_PREFIX = "[shell succeeded, output pruned —";
|
|
529251
529254
|
const seen = /* @__PURE__ */ new Map();
|
|
529255
|
+
const seenResource = /* @__PURE__ */ new Map();
|
|
529252
529256
|
const pending = [];
|
|
529253
529257
|
let scanTurn = 0;
|
|
529254
529258
|
for (let i2 = 0; i2 < messages2.length; i2++) {
|
|
@@ -529293,7 +529297,26 @@ ${body}`;
|
|
|
529293
529297
|
}
|
|
529294
529298
|
seen.set(fp, { turn: scanTurn, idx: resultIdx });
|
|
529295
529299
|
const ageTurns = currentTurn - scanTurn;
|
|
529296
|
-
|
|
529300
|
+
const wasRecentlyWritten = (() => {
|
|
529301
|
+
try {
|
|
529302
|
+
const o2 = JSON.parse(tc.function.arguments || "{}");
|
|
529303
|
+
const p2 = String(o2.path ?? o2.file ?? "");
|
|
529304
|
+
for (let k = Math.max(0, i2 - 20); k < i2; k++) {
|
|
529305
|
+
const m2 = messages2[k];
|
|
529306
|
+
if (m2.role === "assistant" && m2.tool_calls) {
|
|
529307
|
+
for (const tc2 of m2.tool_calls) {
|
|
529308
|
+
if ((tc2.function.name === "file_edit" || tc2.function.name === "file_write" || tc2.function.name === "file_patch") && tc2.function.arguments?.includes(p2)) {
|
|
529309
|
+
return true;
|
|
529310
|
+
}
|
|
529311
|
+
}
|
|
529312
|
+
}
|
|
529313
|
+
}
|
|
529314
|
+
return false;
|
|
529315
|
+
} catch {
|
|
529316
|
+
return false;
|
|
529317
|
+
}
|
|
529318
|
+
})();
|
|
529319
|
+
if (name10 === "file_read" && ageTurns > AGED_FILE_READ_TURNS && content.length > 200 && !wasRecentlyWritten) {
|
|
529297
529320
|
const pathArg = (() => {
|
|
529298
529321
|
try {
|
|
529299
529322
|
const o2 = JSON.parse(tc.function.arguments || "{}");
|
|
@@ -529302,11 +529325,15 @@ ${body}`;
|
|
|
529302
529325
|
return "?";
|
|
529303
529326
|
}
|
|
529304
529327
|
})();
|
|
529305
|
-
const
|
|
529328
|
+
const lines = content.split("\n");
|
|
529329
|
+
const lineCount = lines.length;
|
|
529330
|
+
const contentPreview = content.slice(0, 500);
|
|
529306
529331
|
pending.push({
|
|
529307
529332
|
idx: resultIdx,
|
|
529308
529333
|
reason: "aged_file",
|
|
529309
|
-
replacement: `${FILE_AGED_PREFIX} path=${pathArg},
|
|
529334
|
+
replacement: `${FILE_AGED_PREFIX} path=${pathArg}, ${lineCount} lines, ${content.length} chars]
|
|
529335
|
+
${contentPreview}
|
|
529336
|
+
[End of aged file_read preview — do NOT re-read this file, use the content above]`
|
|
529310
529337
|
});
|
|
529311
529338
|
continue;
|
|
529312
529339
|
}
|
|
@@ -530113,6 +530140,61 @@ ${latest.output || ""}`.trim();
|
|
|
530113
530140
|
sections.push(`(turn ${turn} — this block is regenerated every turn from your tool history)`);
|
|
530114
530141
|
return sections.join("\n");
|
|
530115
530142
|
}
|
|
530143
|
+
/**
|
|
530144
|
+
* REG-62: Pre-call knowledge injection. Builds a concise system message
|
|
530145
|
+
* summarizing what the model has already read/searched/listed so it
|
|
530146
|
+
* doesn't re-call those tools. This is the PRIMARY fix for duplicate
|
|
530147
|
+
* tool calls — the model re-reads because it can't find prior results
|
|
530148
|
+
* in the long transcript. By injecting a summary right before the LLM
|
|
530149
|
+
* call, the model knows what it already has.
|
|
530150
|
+
*/
|
|
530151
|
+
_renderKnowledgeBlock(recentToolResults) {
|
|
530152
|
+
if (recentToolResults.size === 0)
|
|
530153
|
+
return null;
|
|
530154
|
+
const filesRead = [];
|
|
530155
|
+
const dirsListed = [];
|
|
530156
|
+
const searches = [];
|
|
530157
|
+
const shells = [];
|
|
530158
|
+
for (const [fingerprint, entry] of recentToolResults) {
|
|
530159
|
+
if (entry.compacted)
|
|
530160
|
+
continue;
|
|
530161
|
+
const colonIdx = fingerprint.indexOf(":");
|
|
530162
|
+
const toolName = colonIdx > 0 ? fingerprint.slice(0, colonIdx) : fingerprint;
|
|
530163
|
+
if (toolName === "file_read") {
|
|
530164
|
+
const pathMatch = fingerprint.match(/path=([^,\s]+)/);
|
|
530165
|
+
if (pathMatch?.[1])
|
|
530166
|
+
filesRead.push(pathMatch[1]);
|
|
530167
|
+
} else if (toolName === "list_directory") {
|
|
530168
|
+
const pathMatch = fingerprint.match(/path=([^,\s]+)/);
|
|
530169
|
+
if (pathMatch?.[1])
|
|
530170
|
+
dirsListed.push(pathMatch[1]);
|
|
530171
|
+
} else if (toolName === "grep_search" || toolName === "find_files") {
|
|
530172
|
+
searches.push(toolName);
|
|
530173
|
+
} else if (toolName === "shell" || toolName === "shell_async") {
|
|
530174
|
+
const cmdMatch = fingerprint.match(/cmd=([^,\s]+)/);
|
|
530175
|
+
shells.push(cmdMatch?.[1] ?? toolName);
|
|
530176
|
+
}
|
|
530177
|
+
}
|
|
530178
|
+
const sections = ["[KNOWLEDGE — you already have these results in context above. Do NOT re-call these tools for the same targets:]"];
|
|
530179
|
+
if (filesRead.length > 0) {
|
|
530180
|
+
const unique = [...new Set(filesRead)].slice(0, 30);
|
|
530181
|
+
sections.push(`Files already read (${unique.length}): ${unique.join(", ")}`);
|
|
530182
|
+
}
|
|
530183
|
+
if (dirsListed.length > 0) {
|
|
530184
|
+
const unique = [...new Set(dirsListed)].slice(0, 15);
|
|
530185
|
+
sections.push(`Directories already listed (${unique.length}): ${unique.join(", ")}`);
|
|
530186
|
+
}
|
|
530187
|
+
if (searches.length > 0) {
|
|
530188
|
+
sections.push(`Searches already run: ${searches.length}`);
|
|
530189
|
+
}
|
|
530190
|
+
if (shells.length > 0) {
|
|
530191
|
+
const unique = [...new Set(shells)].slice(0, 15);
|
|
530192
|
+
sections.push(`Shell commands already executed (${unique.length}): ${unique.join(", ")}`);
|
|
530193
|
+
}
|
|
530194
|
+
if (sections.length <= 1)
|
|
530195
|
+
return null;
|
|
530196
|
+
return sections.join("\n");
|
|
530197
|
+
}
|
|
530116
530198
|
makePhaseSummarizer() {
|
|
530117
530199
|
if (process.env["OA_DISABLE_PHASE_SUMMARIZER"] === "1")
|
|
530118
530200
|
return null;
|
|
@@ -530341,6 +530423,46 @@ ${blob}
|
|
|
530341
530423
|
_buildToolFingerprint(name10, args) {
|
|
530342
530424
|
return `${name10}:${this._buildExactArgsKey(args)}`;
|
|
530343
530425
|
}
|
|
530426
|
+
/**
|
|
530427
|
+
* REG-62: Build a resource-level key for semantic dedup.
|
|
530428
|
+
*
|
|
530429
|
+
* Unlike _buildToolFingerprint (exact args match), this normalizes
|
|
530430
|
+
* different calls that target the SAME resource:
|
|
530431
|
+
* file_read("foo.ts") == file_read("foo.ts", offset=10)
|
|
530432
|
+
* file_read("foo.ts") == shell("cat foo.ts")
|
|
530433
|
+
* grep_search("x", path="src") == grep_search("x", path="src", include="*.ts")
|
|
530434
|
+
*
|
|
530435
|
+
* Returns empty string if no resource key can be extracted (non-dedupable).
|
|
530436
|
+
*/
|
|
530437
|
+
_buildResourceKey(name10, args) {
|
|
530438
|
+
const a2 = args ?? {};
|
|
530439
|
+
if (name10 === "file_read") {
|
|
530440
|
+
const p2 = String(a2.path ?? a2.file ?? "");
|
|
530441
|
+
return p2 ? `resource:file:${p2}` : "";
|
|
530442
|
+
}
|
|
530443
|
+
if (name10 === "shell" || name10 === "shell_async") {
|
|
530444
|
+
const cmd = String(a2.command ?? a2.cmd ?? "");
|
|
530445
|
+
const catMatch = cmd.match(/(?:cat|head|tail|type|less|more)\s+["']?([^\s"';&|>]+)/);
|
|
530446
|
+
if (catMatch?.[1])
|
|
530447
|
+
return `resource:file:${catMatch[1]}`;
|
|
530448
|
+
return "";
|
|
530449
|
+
}
|
|
530450
|
+
if (name10 === "grep_search") {
|
|
530451
|
+
const p2 = String(a2.path ?? ".");
|
|
530452
|
+
const pat = String(a2.pattern ?? "");
|
|
530453
|
+
return `resource:grep:${p2}:${pat}`;
|
|
530454
|
+
}
|
|
530455
|
+
if (name10 === "find_files") {
|
|
530456
|
+
const p2 = String(a2.path ?? ".");
|
|
530457
|
+
const pat = String(a2.pattern ?? "");
|
|
530458
|
+
return `resource:find:${p2}:${pat}`;
|
|
530459
|
+
}
|
|
530460
|
+
if (name10 === "list_directory") {
|
|
530461
|
+
const p2 = String(a2.path ?? ".");
|
|
530462
|
+
return `resource:ls:${p2}`;
|
|
530463
|
+
}
|
|
530464
|
+
return "";
|
|
530465
|
+
}
|
|
530344
530466
|
_formatExactArgValue(value2) {
|
|
530345
530467
|
const canonical = this._canonicalArgValue(value2);
|
|
530346
530468
|
const oneLine = canonical.replace(/\r/g, "\\r").replace(/\n/g, "\\n");
|
|
@@ -532566,6 +532688,9 @@ ${memoryLines.join("\n")}`
|
|
|
532566
532688
|
const progressBlock = this._renderProgressNudgeBlock(turn);
|
|
532567
532689
|
if (progressBlock)
|
|
532568
532690
|
_injections.push(progressBlock);
|
|
532691
|
+
const knowledgeBlock = this._renderKnowledgeBlock(recentToolResults);
|
|
532692
|
+
if (knowledgeBlock)
|
|
532693
|
+
_injections.push(knowledgeBlock);
|
|
532569
532694
|
if (_injections.length > 0) {
|
|
532570
532695
|
const reqMsgs = chatRequest.messages;
|
|
532571
532696
|
if (Array.isArray(reqMsgs)) {
|
|
@@ -579023,12 +579148,9 @@ sleep 1
|
|
|
579023
579148
|
if (ctx3.isBlessed?.()) {
|
|
579024
579149
|
ctx3.blessStop?.();
|
|
579025
579150
|
}
|
|
579026
|
-
if (ctx3.isTelegramActive?.()) {
|
|
579027
|
-
ctx3.telegramStop?.();
|
|
579028
|
-
}
|
|
579029
579151
|
const clearedQueue = ctx3.clearQueuedPrompts?.() ?? 0;
|
|
579030
579152
|
if (!ctx3.hasActiveTask?.()) {
|
|
579031
|
-
if (!ctx3.isBlessed?.()
|
|
579153
|
+
if (!ctx3.isBlessed?.()) {
|
|
579032
579154
|
renderWarning(clearedQueue > 0 ? `No active task to stop. Cleared ${clearedQueue} queued prompt(s).` : "No active task to stop.");
|
|
579033
579155
|
}
|
|
579034
579156
|
return "handled";
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-agents-ai",
|
|
3
|
-
"version": "0.187.
|
|
3
|
+
"version": "0.187.588",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "open-agents-ai",
|
|
9
|
-
"version": "0.187.
|
|
9
|
+
"version": "0.187.588",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "CC-BY-NC-4.0",
|
|
12
12
|
"dependencies": {
|
|
@@ -1914,12 +1914,12 @@
|
|
|
1914
1914
|
}
|
|
1915
1915
|
},
|
|
1916
1916
|
"node_modules/@types/node": {
|
|
1917
|
-
"version": "25.
|
|
1918
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.
|
|
1919
|
-
"integrity": "sha512-
|
|
1917
|
+
"version": "25.8.0",
|
|
1918
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.8.0.tgz",
|
|
1919
|
+
"integrity": "sha512-TCFSk8IZh+iLX1xtksoBVtdmgL+1IX0fC9BeU4QqFSuNdN/K+HUlhqOzEmSYYpZUVsLYcPqc9KX+60iDuninSQ==",
|
|
1920
1920
|
"license": "MIT",
|
|
1921
1921
|
"dependencies": {
|
|
1922
|
-
"undici-types": "
|
|
1922
|
+
"undici-types": ">=7.24.0 <7.24.7"
|
|
1923
1923
|
}
|
|
1924
1924
|
},
|
|
1925
1925
|
"node_modules/@types/sinon": {
|
|
@@ -6994,9 +6994,9 @@
|
|
|
6994
6994
|
}
|
|
6995
6995
|
},
|
|
6996
6996
|
"node_modules/undici-types": {
|
|
6997
|
-
"version": "7.
|
|
6998
|
-
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.
|
|
6999
|
-
"integrity": "sha512-
|
|
6997
|
+
"version": "7.24.6",
|
|
6998
|
+
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
|
|
6999
|
+
"integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
|
|
7000
7000
|
"license": "MIT"
|
|
7001
7001
|
},
|
|
7002
7002
|
"node_modules/unlimited-timeout": {
|
package/package.json
CHANGED