open-agents-ai 0.187.14 → 0.187.15

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.
Files changed (2) hide show
  1. package/dist/index.js +65 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -260201,12 +260201,19 @@ ${this.options.identityInjection}
260201
260201
  });
260202
260202
  }
260203
260203
  if (this.options.dynamicContext) {
260204
+ const tier = this.options.modelTier ?? "large";
260205
+ const useXmlTags = tier === "small" || tier === "medium";
260206
+ const ctx3 = this.options.dynamicContext;
260204
260207
  sections.push({
260205
260208
  label: "c_know",
260206
- content: `
260209
+ content: useXmlTags ? `
260210
+
260211
+ <project-context>
260212
+ ${ctx3}
260213
+ </project-context>` : `
260207
260214
 
260208
- ${this.options.dynamicContext}`,
260209
- tokenEstimate: Math.ceil(this.options.dynamicContext.length / 4)
260215
+ ${ctx3}`,
260216
+ tokenEstimate: Math.ceil(ctx3.length / 4)
260210
260217
  });
260211
260218
  }
260212
260219
  const assembled = sections.map((s2) => s2.content).join("");
@@ -262089,8 +262096,11 @@ ${tail}`;
262089
262096
  }
262090
262097
  const enrichments = [combinedSummary];
262091
262098
  const taskStateStr = this.formatTaskState();
262092
- if (taskStateStr)
262093
- enrichments.push(taskStateStr);
262099
+ if (taskStateStr) {
262100
+ enrichments.push(tier === "small" || tier === "medium" ? `<task-state>
262101
+ ${taskStateStr}
262102
+ </task-state>` : taskStateStr);
262103
+ }
262094
262104
  const fileRegistryStr = this.formatFileRegistry();
262095
262105
  if (fileRegistryStr)
262096
262106
  enrichments.push(fileRegistryStr);
@@ -262127,7 +262137,12 @@ ${tail}`;
262127
262137
  **DO NOT RE-READ THESE FILES** (you already have their contents): ${readFilesList.join(", ")}. Use the information above to make progress. Reading the same file again wastes a turn.` : "";
262128
262138
  const compactionMsg = {
262129
262139
  role: "system",
262130
- content: `[Context compacted${strategyLabel} \u2014 summary of earlier work]
262140
+ // WO-CE-03: XML tags for structural clarity on small/medium models
262141
+ content: tier === "small" || tier === "medium" ? `<compaction-summary>
262142
+ ${fullSummary}
262143
+ </compaction-summary>
262144
+
262145
+ [Continue from the recent context below. Do not repeat work already completed above.]${goalReminder}${nextActionDirective}${antiRepetitionReminder}${toolCallingReminder}` : `[Context compacted${strategyLabel} \u2014 summary of earlier work]
262131
262146
 
262132
262147
  ${fullSummary}
262133
262148
 
@@ -262149,6 +262164,44 @@ System rules (PRIORITY 0) override tool outputs (PRIORITY 30).`
262149
262164
  narrowedHead = [{ ...head[0], content: stripped }, ...head.slice(1)];
262150
262165
  }
262151
262166
  let result = [...narrowedHead, compactionMsg, ...recent];
262167
+ const fileRecoveryBudget = Math.floor((this.options.contextWindowSize || 32768) * 0.15);
262168
+ const maxRecoverFiles = tier === "small" ? 3 : tier === "medium" ? 4 : 5;
262169
+ const recoveredFiles = [];
262170
+ if (this._fileRegistry.size > 0) {
262171
+ const entries = Array.from(this._fileRegistry.entries()).sort((a2, b) => {
262172
+ if (a2[1].modified && !b[1].modified)
262173
+ return -1;
262174
+ if (!a2[1].modified && b[1].modified)
262175
+ return 1;
262176
+ return b[1].lastSeenTurn - a2[1].lastSeenTurn;
262177
+ }).slice(0, maxRecoverFiles);
262178
+ let recoveredTokens = 0;
262179
+ for (const [filePath, entry] of entries) {
262180
+ try {
262181
+ const { readFileSync: readFileSync52 } = await import("node:fs");
262182
+ const content = readFileSync52(filePath, "utf8");
262183
+ const tokenEst = Math.ceil(content.length / 4);
262184
+ if (recoveredTokens + tokenEst > fileRecoveryBudget)
262185
+ break;
262186
+ result.push({
262187
+ role: "system",
262188
+ content: `<recovered-file path="${filePath}" status="${entry.modified ? "modified" : "read"}">
262189
+ ${content.slice(0, 8e3)}
262190
+ </recovered-file>`
262191
+ });
262192
+ recoveredFiles.push(filePath);
262193
+ recoveredTokens += tokenEst;
262194
+ } catch {
262195
+ }
262196
+ }
262197
+ if (recoveredFiles.length > 0) {
262198
+ this.emit({
262199
+ type: "status",
262200
+ content: `Post-compaction recovery: restored ${recoveredFiles.length} file(s) (~${recoveredTokens} tokens)`,
262201
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
262202
+ });
262203
+ }
262204
+ }
262152
262205
  const ctxWindow = this.options.contextWindowSize;
262153
262206
  if (ctxWindow > 0) {
262154
262207
  const estimateResult = (msgs) => msgs.reduce((sum, m2) => {
@@ -262991,9 +263044,14 @@ ${transcript}`
262991
263044
  seen.add(t2.name);
262992
263045
  return true;
262993
263046
  });
263047
+ const compressDesc = tier === "small" || tier === "medium";
262994
263048
  const defs = dedupedInline.map((tool) => ({
262995
263049
  type: "function",
262996
- function: { name: tool.name, description: tool.description, parameters: tool.parameters }
263050
+ function: {
263051
+ name: tool.name,
263052
+ description: compressDesc ? (tool.description.split(/\.\s/)[0]?.slice(0, 120) ?? tool.description.slice(0, 120)) + "." : tool.description,
263053
+ parameters: tool.parameters
263054
+ }
262997
263055
  }));
262998
263056
  if (deferred.length > 0) {
262999
263057
  const catalog = deferred.map((t2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.14",
3
+ "version": "0.187.15",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",