open-agents-ai 0.187.180 → 0.187.182

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 +117 -27
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -265356,6 +265356,45 @@ var init_ralphLoop = __esm({
265356
265356
  }
265357
265357
  });
265358
265358
 
265359
+ // packages/orchestrator/dist/textSanitize.js
265360
+ function cleanScaffolding(text) {
265361
+ if (text == null)
265362
+ return "";
265363
+ let out = String(text);
265364
+ out = out.replace(SIGNPOST_RE, "");
265365
+ out = out.replace(RESTORED_BLOCK_RE, "");
265366
+ out = out.replace(NEW_TASK_RE, "");
265367
+ out = out.replace(SYSTEM_BLOCK_RE, "");
265368
+ return out.trim();
265369
+ }
265370
+ function stripThinkTags(text) {
265371
+ if (text == null)
265372
+ return "";
265373
+ return String(text).replace(THINK_BLOCK_RE, "").trim();
265374
+ }
265375
+ function cleanForStorage(text) {
265376
+ if (text == null)
265377
+ return "";
265378
+ let out = String(text);
265379
+ out = cleanScaffolding(out);
265380
+ out = stripThinkTags(out);
265381
+ out = out.replace(ANSI_ESCAPE_RE, "");
265382
+ out = out.replace(/\s+/g, " ").trim();
265383
+ return out;
265384
+ }
265385
+ var SIGNPOST_RE, NEW_TASK_RE, RESTORED_BLOCK_RE, SYSTEM_BLOCK_RE, THINK_BLOCK_RE, ANSI_ESCAPE_RE;
265386
+ var init_textSanitize = __esm({
265387
+ "packages/orchestrator/dist/textSanitize.js"() {
265388
+ "use strict";
265389
+ SIGNPOST_RE = /^\[Previous sessions exist[^\]]*\]\s*\n*/m;
265390
+ NEW_TASK_RE = /^NEW TASK:\s*/m;
265391
+ RESTORED_BLOCK_RE = /^[\s\S]*?\n---\s*\n\s*NEW TASK:\s*/m;
265392
+ SYSTEM_BLOCK_RE = /^<system>[\s\S]*?<\/system>\s*\n*/m;
265393
+ THINK_BLOCK_RE = /<think>[\s\S]*?<\/think>/g;
265394
+ ANSI_ESCAPE_RE = /\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07/g;
265395
+ }
265396
+ });
265397
+
265359
265398
  // packages/orchestrator/dist/personality.js
265360
265399
  function compilePersonalityPrompt(profile, presetName) {
265361
265400
  if (presetName === "stark") {
@@ -267638,6 +267677,7 @@ var SYSTEM_PROMPT, SYSTEM_PROMPT_MEDIUM, SYSTEM_PROMPT_SMALL, AgenticRunner, Oll
267638
267677
  var init_agenticRunner = __esm({
267639
267678
  "packages/orchestrator/dist/agenticRunner.js"() {
267640
267679
  "use strict";
267680
+ init_textSanitize();
267641
267681
  init_dist();
267642
267682
  init_personality();
267643
267683
  init_promptLoader();
@@ -268279,6 +268319,7 @@ Respond with your assessment, then take action.`;
268279
268319
  if (typeof this.backend.setAbortSignal === "function") {
268280
268320
  this.backend.setAbortSignal(this._abortController.signal);
268281
268321
  }
268322
+ const cleanedTask = cleanForStorage(task) || task.slice(0, 500);
268282
268323
  const start2 = Date.now();
268283
268324
  const taskTimeoutMs = this.options.taskTimeoutMs;
268284
268325
  const selfEvalInterval = taskTimeoutMs;
@@ -268328,7 +268369,7 @@ Respond with your assessment, then take action.`;
268328
268369
  this._pauseResolve = null;
268329
268370
  this.pendingUserMessages.length = 0;
268330
268371
  this._taskState = {
268331
- goal: task.slice(0, 500),
268372
+ goal: cleanedTask.slice(0, 500),
268332
268373
  completedSteps: [],
268333
268374
  pendingSteps: [],
268334
268375
  currentStep: "",
@@ -268652,7 +268693,7 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
268652
268693
  }
268653
268694
  if (turn > 0 && turn % 3 === 0 && this._temporalGraph && this._episodeStore) {
268654
268695
  try {
268655
- const taskGoal = this._taskState.goal || task.slice(0, 200);
268696
+ const taskGoal = this._taskState.goal || cleanedTask.slice(0, 200);
268656
268697
  const pprResult = retrieveByPPR(taskGoal, this._temporalGraph, this._episodeStore, { topK: 3 });
268657
268698
  if (pprResult.episodes.length > 0) {
268658
268699
  const memoryLines = pprResult.episodes.map(({ episode, pprScore, matchedNodes }) => `- [${episode.toolName ?? episode.modality}] ${episode.content.slice(0, 120)} (via: ${matchedNodes.slice(0, 2).join(", ")})`);
@@ -269907,7 +269948,7 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
269907
269948
  };
269908
269949
  const consolidation = {
269909
269950
  sessionId: this._sessionId,
269910
- task: task.slice(0, 500),
269951
+ task: cleanedTask.slice(0, 500),
269911
269952
  outcome: completed ? "success" : this.aborted ? "aborted" : "timeout",
269912
269953
  turns: messages2.filter((m2) => m2.role === "assistant").length,
269913
269954
  toolsUsed: [...new Set(toolCallLog.map((tc) => tc.name))],
@@ -269926,7 +269967,7 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
269926
269967
  fs4.mkdirSync(provenanceDir, { recursive: true });
269927
269968
  const provenanceGraph = {
269928
269969
  sessionId: this._sessionId,
269929
- task: task.slice(0, 500),
269970
+ task: cleanedTask.slice(0, 500),
269930
269971
  outcome: consolidation.outcome,
269931
269972
  timestamp: consolidation.timestamp,
269932
269973
  // Full action trace — every tool call with sequence ordering
@@ -269970,7 +270011,7 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
269970
270011
  fs4.writeFileSync(path5.join(provenanceDir, `${this._sessionId}.json`), JSON.stringify(provenanceGraph, null, 2));
269971
270012
  if (completed && this.tools.has("memory_write")) {
269972
270013
  const memTool = this.tools.get("memory_write");
269973
- const lessonContent = `Task "${task.slice(0, 100)}" completed successfully. Tools: ${consolidation.toolsUsed.join(", ")}. Files: ${consolidation.filesModified.slice(0, 3).join(", ")}. Duration: ${Math.round(durationMs / 1e3)}s, ${consolidation.turns} turns.`;
270014
+ const lessonContent = `Task "${cleanedTask.slice(0, 100)}" completed successfully. Tools: ${consolidation.toolsUsed.join(", ")}. Files: ${consolidation.filesModified.slice(0, 3).join(", ")}. Duration: ${Math.round(durationMs / 1e3)}s, ${consolidation.turns} turns.`;
269974
270015
  try {
269975
270016
  await memTool.execute({
269976
270017
  topic: "task_lessons",
@@ -269993,7 +270034,7 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
269993
270034
  sessionId: this._sessionId,
269994
270035
  modality: "gist",
269995
270036
  toolName: "task_complete",
269996
- content: `Task "${task.slice(0, 200)}" ${completed ? "completed" : "ended"}: ${summary.slice(0, 300)}`,
270037
+ content: `Task "${cleanedTask.slice(0, 200)}" ${completed ? "completed" : "ended"}: ${cleanForStorage(summary).slice(0, 300)}`,
269997
270038
  importance: 9,
269998
270039
  decayClass: "procedural"
269999
270040
  });
@@ -270040,7 +270081,10 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
270040
270081
  fs4.mkdirSync(trajDir, { recursive: true });
270041
270082
  const trajectory = {
270042
270083
  id: this._sessionId,
270043
- task: task.slice(0, 1e3),
270084
+ // CLEAN task — this file is the prerequisite for ALL future RL/RFT
270085
+ // training. Storing the scaffolded version would teach future models
270086
+ // to reproduce signpost text as part of their task understanding.
270087
+ task: cleanedTask.slice(0, 1e3),
270044
270088
  outcome: completed ? "pass" : this.aborted ? "aborted" : "timeout",
270045
270089
  model: this.backend.model ?? "unknown",
270046
270090
  modelTier: this.options.modelTier ?? "large",
@@ -273597,6 +273641,7 @@ var init_sessionMetrics = __esm({
273597
273641
  var init_taskLearning = __esm({
273598
273642
  "packages/orchestrator/dist/taskLearning.js"() {
273599
273643
  "use strict";
273644
+ init_textSanitize();
273600
273645
  }
273601
273646
  });
273602
273647
 
@@ -274200,6 +274245,7 @@ var init_dist8 = __esm({
274200
274245
  init_skill_fork();
274201
274246
  init_streaming_executor();
274202
274247
  init_app_state();
274248
+ init_textSanitize();
274203
274249
  }
274204
274250
  });
274205
274251
 
@@ -284371,6 +284417,7 @@ var oa_directory_exports = {};
284371
284417
  __export(oa_directory_exports, {
284372
284418
  OA_DIR: () => OA_DIR,
284373
284419
  buildContextRestorePrompt: () => buildContextRestorePrompt,
284420
+ cleanPromptForDiary: () => cleanPromptForDiary,
284374
284421
  deleteSession: () => deleteSession,
284375
284422
  deleteUsageRecord: () => deleteUsageRecord,
284376
284423
  discoverContextFiles: () => discoverContextFiles,
@@ -284389,6 +284436,7 @@ __export(oa_directory_exports, {
284389
284436
  readIndexData: () => readIndexData,
284390
284437
  readIndexMeta: () => readIndexMeta,
284391
284438
  recordUsage: () => recordUsage,
284439
+ renderSessionDiary: () => renderSessionDiary,
284392
284440
  resolveSettings: () => resolveSettings,
284393
284441
  saveGlobalSettings: () => saveGlobalSettings,
284394
284442
  savePendingTask: () => savePendingTask,
@@ -284671,22 +284719,59 @@ function saveSessionContext(repoRoot, entry) {
284671
284719
  ctx3.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
284672
284720
  writeFileSync26(filePath, JSON.stringify(ctx3, null, 2) + "\n", "utf-8");
284673
284721
  try {
284674
- const diaryLines = ["# Session Diary", ""];
284675
- for (const e2 of ctx3.entries.slice(-10)) {
284676
- const date = e2.savedAt ? new Date(e2.savedAt).toISOString().slice(0, 16).replace("T", " ") : "unknown";
284677
- const status = e2.completed ? "\u2713" : "\u25CB";
284678
- const task = (e2.task || "untitled").slice(0, 120);
284679
- diaryLines.push(`## ${date} \u2014 ${task} ${status}`);
284680
- if (e2.filesModified?.length) {
284681
- diaryLines.push(`Files: ${e2.filesModified.slice(0, 5).join(", ")}${e2.filesModified.length > 5 ? ` (+${e2.filesModified.length - 5} more)` : ""}`);
284682
- }
284683
- if (e2.summary) diaryLines.push(`Summary: ${e2.summary.slice(0, 200)}`);
284684
- diaryLines.push("");
284685
- }
284686
- writeFileSync26(join71(contextDir, "session-diary.md"), diaryLines.join("\n"), "utf-8");
284722
+ writeFileSync26(
284723
+ join71(contextDir, "session-diary.md"),
284724
+ renderSessionDiary(ctx3.entries.slice(-10)),
284725
+ "utf-8"
284726
+ );
284687
284727
  } catch {
284688
284728
  }
284689
284729
  }
284730
+ function cleanPromptForDiary(raw) {
284731
+ if (!raw) return "";
284732
+ let text = String(raw);
284733
+ text = text.replace(/^\[Previous sessions exist[^\]]*\]\s*\n*/m, "");
284734
+ text = text.replace(/^[\s\S]*?\n---\s*\n\s*NEW TASK:\s*/m, "");
284735
+ text = text.replace(/^NEW TASK:\s*/m, "");
284736
+ text = text.replace(/^<system>[\s\S]*?<\/system>\s*\n*/m, "");
284737
+ text = text.replace(/\s+/g, " ").trim();
284738
+ return text || "(empty prompt)";
284739
+ }
284740
+ function renderSessionDiary(entries) {
284741
+ const lines = ["# Session Diary", ""];
284742
+ if (entries.length === 0) {
284743
+ lines.push("_(no sessions recorded yet)_", "");
284744
+ return lines.join("\n");
284745
+ }
284746
+ for (const e2 of entries) {
284747
+ const date = e2.savedAt ? new Date(e2.savedAt).toISOString().slice(0, 16).replace("T", " ") : "unknown time";
284748
+ const status = e2.completed ? "\u2713" : "\u25CB";
284749
+ const cleanPrompt = cleanPromptForDiary(e2.task);
284750
+ const slug = cleanPrompt.length > 80 ? cleanPrompt.slice(0, 77) + "..." : cleanPrompt;
284751
+ lines.push(`## ${date} ${status} ${slug || "untitled"}`);
284752
+ lines.push("");
284753
+ lines.push(`- **Prompt:** ${cleanPrompt || "(empty prompt)"}`);
284754
+ if (e2.model) {
284755
+ lines.push(`- **Model:** ${e2.model}`);
284756
+ }
284757
+ if (e2.filesModified && e2.filesModified.length > 0) {
284758
+ const shown = e2.filesModified.slice(0, 5).join(", ");
284759
+ const more = e2.filesModified.length > 5 ? ` (+${e2.filesModified.length - 5} more)` : "";
284760
+ lines.push(`- **Files:** ${shown}${more}`);
284761
+ }
284762
+ if (typeof e2.toolCalls === "number" && e2.toolCalls > 0) {
284763
+ lines.push(`- **Tools:** ${e2.toolCalls} call${e2.toolCalls === 1 ? "" : "s"}`);
284764
+ }
284765
+ if (e2.summary) {
284766
+ const summary = e2.summary.replace(/\s+/g, " ").trim().slice(0, 280);
284767
+ lines.push(`- **Summary:** ${summary}`);
284768
+ }
284769
+ lines.push("");
284770
+ }
284771
+ while (lines.length > 1 && lines[lines.length - 1] === "") lines.pop();
284772
+ lines.push("");
284773
+ return lines.join("\n");
284774
+ }
284690
284775
  function loadSessionContext(repoRoot) {
284691
284776
  const filePath = join71(repoRoot, OA_DIR, "context", CONTEXT_SAVE_FILE);
284692
284777
  try {
@@ -303901,9 +303986,11 @@ function loadSessionHistory2(repoRoot) {
303901
303986
  if (!s2.startedAt || !s2.task) continue;
303902
303987
  const status = s2.completed ? "completed" : "incomplete";
303903
303988
  const date = s2.startedAt.split("T")[0];
303904
- lines.push(`- [${date}] ${s2.task.slice(0, 80)} (${status}, ${s2.turns ?? 0} turns)`);
303989
+ const cleanTask = cleanForStorage(s2.task) || s2.task;
303990
+ lines.push(`- [${date}] ${cleanTask.slice(0, 80)} (${status}, ${s2.turns ?? 0} turns)`);
303905
303991
  if (s2.summary) {
303906
- lines.push(` Summary: ${s2.summary.slice(0, 120)}`);
303992
+ const cleanSummary = cleanForStorage(s2.summary) || s2.summary;
303993
+ lines.push(` Summary: ${cleanSummary.slice(0, 120)}`);
303907
303994
  }
303908
303995
  }
303909
303996
  return lines.join("\n");
@@ -304072,6 +304159,7 @@ These patterns have been repeated 3+ times. Consider using create_tool to automa
304072
304159
  var init_project_context = __esm({
304073
304160
  "packages/cli/src/tui/project-context.ts"() {
304074
304161
  "use strict";
304162
+ init_dist8();
304075
304163
  init_oa_directory();
304076
304164
  init_dist4();
304077
304165
  }
@@ -316579,7 +316667,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
316579
316667
  ikState.stats.tool_use_count = (ikState.stats.tool_use_count || 0) + result.toolCalls;
316580
316668
  }
316581
316669
  ikState.version = (ikState.version || 1) + 1;
316582
- ikState.version_history.push({ version: ikState.version, change: "query_served: " + result.summary.slice(0, 60), timestamp: (/* @__PURE__ */ new Date()).toISOString() });
316670
+ ikState.version_history.push({ version: ikState.version, change: "query_served: " + cleanForStorage(result.summary).slice(0, 60), timestamp: (/* @__PURE__ */ new Date()).toISOString() });
316583
316671
  if (ikState.version_history.length > 200) ikState.version_history = ikState.version_history.slice(-200);
316584
316672
  if (ikState.version % 10 === 0) {
316585
316673
  const specList = (ikState.specializations || []).join(", ") || "general-purpose";
@@ -316635,18 +316723,18 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
316635
316723
  id: sessionId,
316636
316724
  startedAt: new Date(Date.now() - result.durationMs).toISOString(),
316637
316725
  completedAt: (/* @__PURE__ */ new Date()).toISOString(),
316638
- task,
316726
+ task: cleanForStorage(task) || task.slice(0, 500),
316639
316727
  turns: result.turns,
316640
316728
  toolCalls: result.toolCalls,
316641
316729
  completed: result.completed,
316642
- summary: result.summary.slice(0, 500)
316730
+ summary: cleanForStorage(result.summary).slice(0, 500)
316643
316731
  });
316644
316732
  } catch {
316645
316733
  }
316646
316734
  try {
316647
316735
  saveSessionContext(repoRoot, {
316648
316736
  savedAt: (/* @__PURE__ */ new Date()).toISOString(),
316649
- task: task.slice(0, 500),
316737
+ task: cleanPromptForDiary(task).slice(0, 500),
316650
316738
  summary: result.summary.slice(0, 500),
316651
316739
  filesModified: Array.from(filesTouched).slice(0, 30),
316652
316740
  toolCalls: result.toolCalls,
@@ -319363,9 +319451,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
319363
319451
  },
319364
319452
  contextSave() {
319365
319453
  try {
319454
+ const cleaned = (lastSubmittedPrompt || "(manual save)").replace(/^\[Previous sessions exist[^\]]*\]\s*/m, "").replace(/^NEW TASK:\s*/m, "").trim() || "(manual save)";
319366
319455
  const entry = {
319367
319456
  savedAt: (/* @__PURE__ */ new Date()).toISOString(),
319368
- task: lastSubmittedPrompt || "(manual save)",
319457
+ task: cleaned,
319369
319458
  summary: `Manual context save. ${sessionToolCallCount} tool calls, ${sessionFilesTouched.length} files modified.`,
319370
319459
  filesModified: [...sessionFilesTouched],
319371
319460
  toolCalls: sessionToolCallCount,
@@ -320632,6 +320721,7 @@ var init_interactive = __esm({
320632
320721
  init_dist8();
320633
320722
  init_dist8();
320634
320723
  init_dist8();
320724
+ init_dist8();
320635
320725
  init_dist4();
320636
320726
  init_dist();
320637
320727
  init_listen();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.180",
3
+ "version": "0.187.182",
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",