open-agents-ai 0.187.28 → 0.187.30

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 +147 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -82929,8 +82929,8 @@ var require_follow_redirects = __commonJS({
82929
82929
  }
82930
82930
  return parsed;
82931
82931
  }
82932
- function resolveUrl(relative5, base3) {
82933
- return useNativeURL ? new URL3(relative5, base3) : parseUrl(url.resolve(base3, relative5));
82932
+ function resolveUrl(relative6, base3) {
82933
+ return useNativeURL ? new URL3(relative6, base3) : parseUrl(url.resolve(base3, relative6));
82934
82934
  }
82935
82935
  function validateUrl(input) {
82936
82936
  if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
@@ -241704,15 +241704,15 @@ var require_pattern = __commonJS({
241704
241704
  exports.removeDuplicateSlashes = removeDuplicateSlashes;
241705
241705
  function partitionAbsoluteAndRelative(patterns) {
241706
241706
  const absolute = [];
241707
- const relative5 = [];
241707
+ const relative6 = [];
241708
241708
  for (const pattern of patterns) {
241709
241709
  if (isAbsolute(pattern)) {
241710
241710
  absolute.push(pattern);
241711
241711
  } else {
241712
- relative5.push(pattern);
241712
+ relative6.push(pattern);
241713
241713
  }
241714
241714
  }
241715
- return [absolute, relative5];
241715
+ return [absolute, relative6];
241716
241716
  }
241717
241717
  exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
241718
241718
  function isAbsolute(pattern) {
@@ -253099,6 +253099,131 @@ var init_repo_map = __esm({
253099
253099
  }
253100
253100
  });
253101
253101
 
253102
+ // packages/execution/dist/tools/import-graph.js
253103
+ import { relative as relative3 } from "node:path";
253104
+ function clearImportGraphCache() {
253105
+ _cachedGraph = null;
253106
+ _cachedRoot = null;
253107
+ }
253108
+ var _cachedGraph, _cachedRoot, ImportGraphTool;
253109
+ var init_import_graph = __esm({
253110
+ "packages/execution/dist/tools/import-graph.js"() {
253111
+ "use strict";
253112
+ init_repo_map();
253113
+ _cachedGraph = null;
253114
+ _cachedRoot = null;
253115
+ ImportGraphTool = class {
253116
+ name = "import_graph";
253117
+ description = "Show the import graph for a specific file: what it imports (dependencies), what imports it (dependents), and 1-hop transitive connections. Use before editing a file to understand what other files might be affected. Output is compact (~200-500 tokens).";
253118
+ parameters = {
253119
+ type: "object",
253120
+ properties: {
253121
+ path: {
253122
+ type: "string",
253123
+ description: "File path to analyze (relative to project root)"
253124
+ }
253125
+ },
253126
+ required: ["path"]
253127
+ };
253128
+ workingDir;
253129
+ constructor(workingDir) {
253130
+ this.workingDir = workingDir;
253131
+ }
253132
+ async execute(args) {
253133
+ const start2 = performance.now();
253134
+ const rawPath = String(args["path"] ?? "");
253135
+ if (!rawPath) {
253136
+ return { success: false, output: "", error: "path is required", durationMs: 0 };
253137
+ }
253138
+ const filePath = rawPath.startsWith("/") ? relative3(this.workingDir, rawPath).replace(/\\/g, "/") : rawPath.replace(/\\/g, "/");
253139
+ try {
253140
+ if (!_cachedGraph || _cachedRoot !== this.workingDir) {
253141
+ _cachedGraph = buildGraph(this.workingDir);
253142
+ _cachedRoot = this.workingDir;
253143
+ }
253144
+ const graph = _cachedGraph;
253145
+ const node = graph.files.get(filePath);
253146
+ if (!node) {
253147
+ const variants = [filePath, filePath + ".ts", filePath + ".js", filePath + ".tsx"];
253148
+ const found = variants.find((v) => graph.files.has(v));
253149
+ if (!found) {
253150
+ return {
253151
+ success: false,
253152
+ output: "",
253153
+ error: `File "${filePath}" not found in import graph. Use find_files or list_directory to locate it.`,
253154
+ durationMs: performance.now() - start2
253155
+ };
253156
+ }
253157
+ return this.buildOutput(found, graph, performance.now() - start2);
253158
+ }
253159
+ return this.buildOutput(filePath, graph, performance.now() - start2);
253160
+ } catch (error) {
253161
+ return {
253162
+ success: false,
253163
+ output: "",
253164
+ error: `import_graph error: ${error instanceof Error ? error.message : String(error)}`,
253165
+ durationMs: performance.now() - start2
253166
+ };
253167
+ }
253168
+ }
253169
+ buildOutput(filePath, graph, elapsed) {
253170
+ const node = graph.files.get(filePath);
253171
+ const lines = [];
253172
+ lines.push(`# Import graph for ${filePath}`);
253173
+ lines.push("");
253174
+ if (node.imports.length > 0) {
253175
+ lines.push(`## Dependencies (${node.imports.length} files this imports):`);
253176
+ for (const imp of node.imports) {
253177
+ const impNode = graph.files.get(imp);
253178
+ const symbols = impNode?.symbols.filter((s2) => s2.exported).map((s2) => s2.name).slice(0, 5).join(", ") ?? "";
253179
+ lines.push(`- ${imp}${symbols ? ` (${symbols})` : ""}`);
253180
+ }
253181
+ } else {
253182
+ lines.push("## Dependencies: none (leaf module)");
253183
+ }
253184
+ lines.push("");
253185
+ if (node.importedBy.length > 0) {
253186
+ lines.push(`## Dependents (${node.importedBy.length} files import this \u2014 changes here may break them):`);
253187
+ for (const dep of node.importedBy.slice(0, 15)) {
253188
+ lines.push(`- ${dep}`);
253189
+ }
253190
+ if (node.importedBy.length > 15) {
253191
+ lines.push(` +${node.importedBy.length - 15} more`);
253192
+ }
253193
+ } else {
253194
+ lines.push("## Dependents: none (no other file imports this)");
253195
+ }
253196
+ lines.push("");
253197
+ const transitiveSet = /* @__PURE__ */ new Set();
253198
+ for (const dep of node.importedBy.slice(0, 10)) {
253199
+ const depNode = graph.files.get(dep);
253200
+ if (depNode) {
253201
+ for (const transImp of depNode.imports) {
253202
+ if (transImp !== filePath && !node.imports.includes(transImp)) {
253203
+ transitiveSet.add(`${dep} \u2192 ${transImp}`);
253204
+ }
253205
+ }
253206
+ }
253207
+ }
253208
+ if (transitiveSet.size > 0) {
253209
+ lines.push(`## 1-hop transitive (other deps of dependents):`);
253210
+ for (const entry of [...transitiveSet].slice(0, 10)) {
253211
+ lines.push(`- ${entry}`);
253212
+ }
253213
+ if (transitiveSet.size > 10) {
253214
+ lines.push(` +${transitiveSet.size - 10} more`);
253215
+ }
253216
+ }
253217
+ return {
253218
+ success: true,
253219
+ output: lines.join("\n"),
253220
+ durationMs: elapsed
253221
+ };
253222
+ }
253223
+ };
253224
+ }
253225
+ });
253226
+
253102
253227
  // packages/execution/dist/tools/process-health.js
253103
253228
  import { execSync as execSync23 } from "node:child_process";
253104
253229
  function getSystemStatus() {
@@ -256446,6 +256571,7 @@ __export(dist_exports, {
256446
256571
  IdentityKernelTool: () => IdentityKernelTool,
256447
256572
  ImageGenerateTool: () => ImageGenerateTool,
256448
256573
  ImageReadTool: () => ImageReadTool,
256574
+ ImportGraphTool: () => ImportGraphTool,
256449
256575
  ListDirectoryTool: () => ListDirectoryTool,
256450
256576
  ManageToolsTool: () => ManageToolsTool,
256451
256577
  McpClient: () => McpClient,
@@ -256503,6 +256629,7 @@ __export(dist_exports, {
256503
256629
  checkConstraints: () => checkConstraints,
256504
256630
  checkDesktopDeps: () => checkDesktopDeps,
256505
256631
  clearExploreNotes: () => clearExploreNotes,
256632
+ clearImportGraphCache: () => clearImportGraphCache,
256506
256633
  clearWorkingNotes: () => clearWorkingNotes,
256507
256634
  collectSnapshot: () => collectSnapshot,
256508
256635
  createAgentWorktree: () => createWorktree,
@@ -256641,6 +256768,7 @@ var init_dist4 = __esm({
256641
256768
  init_semantic_map();
256642
256769
  init_change_log();
256643
256770
  init_repo_map();
256771
+ init_import_graph();
256644
256772
  init_process_health();
256645
256773
  init_full_sub_agent();
256646
256774
  init_agent_tool();
@@ -261375,6 +261503,15 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
261375
261503
  }
261376
261504
  if (!result.success && tc.name !== "task_complete") {
261377
261505
  const failDesc = `${tc.name}(${filePath || "..."}): ${(result.error || "").slice(0, 100)}`;
261506
+ const consecutiveSameTool = this._taskState.failedApproaches.slice(-2).filter((f2) => f2.startsWith(`${tc.name}(`)).length;
261507
+ if (consecutiveSameTool >= 2 && (this.options.modelTier === "small" || this.options.modelTier === "medium")) {
261508
+ this.pendingUserMessages.push(`[PIVOT REQUIRED] You have failed ${consecutiveSameTool + 1} times in a row with ${tc.name}. Your current approach is not working. You MUST try something fundamentally different:
261509
+ - If file_edit keeps failing: re-read the file first, then use the EXACT text from the file
261510
+ - If shell keeps failing: try a different command or check prerequisites
261511
+ - If grep_search finds nothing: try broader patterns or list_directory
261512
+ - Consider using a completely different tool or strategy
261513
+ Do NOT retry ${tc.name} with similar arguments.`);
261514
+ }
261378
261515
  if (!this._taskState.failedApproaches.includes(failDesc)) {
261379
261516
  this._taskState.failedApproaches.push(failDesc);
261380
261517
  if (this._taskState.failedApproaches.length > 10) {
@@ -275939,7 +276076,7 @@ __export(oa_directory_exports, {
275939
276076
  writeIndexMeta: () => writeIndexMeta
275940
276077
  });
275941
276078
  import { existsSync as existsSync41, mkdirSync as mkdirSync16, readFileSync as readFileSync31, writeFileSync as writeFileSync17, readdirSync as readdirSync11, statSync as statSync12, unlinkSync as unlinkSync7 } from "node:fs";
275942
- import { join as join58, relative as relative3, basename as basename12, extname as extname9 } from "node:path";
276079
+ import { join as join58, relative as relative4, basename as basename12, extname as extname9 } from "node:path";
275943
276080
  import { homedir as homedir15 } from "node:os";
275944
276081
  function initOaDirectory(repoRoot) {
275945
276082
  const oaPath = join58(repoRoot, OA_DIR);
@@ -276020,7 +276157,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
276020
276157
  }
276021
276158
  const type = normalizedName.includes("agents") ? "agents" : normalizedName === "oa.md" || normalizedName === ".open-agents.md" ? "oa" : normalizedName.includes("claude") ? "claude" : normalizedName.includes("readme") ? "readme" : normalizedName.includes("architect") ? "architecture" : normalizedName.includes("contribut") ? "contributing" : "other";
276022
276159
  found.push({
276023
- path: relative3(repoRoot, filePath) || name10,
276160
+ path: relative4(repoRoot, filePath) || name10,
276024
276161
  content,
276025
276162
  type
276026
276163
  });
@@ -276037,7 +276174,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
276037
276174
  content = content.slice(0, maxContentLen) + "\n\n...(truncated)";
276038
276175
  }
276039
276176
  found.push({
276040
- path: relative3(repoRoot, projectMap),
276177
+ path: relative4(repoRoot, projectMap),
276041
276178
  content,
276042
276179
  type: "oa"
276043
276180
  });
@@ -306404,6 +306541,7 @@ function buildTools(repoRoot, config, contextWindowSize, modelTier) {
306404
306541
  new WorkingNotesTool(),
306405
306542
  new SemanticMapTool(repoRoot),
306406
306543
  new RepoMapTool(repoRoot),
306544
+ new ImportGraphTool(repoRoot),
306407
306545
  new ProcessHealthTool(),
306408
306546
  new VideoUnderstandTool(repoRoot),
306409
306547
  // Full OA sub-process — callbacks wired after runner + statusBar created
@@ -311997,7 +312135,7 @@ import { glob as glob2 } from "glob";
311997
312135
  import ignore from "ignore";
311998
312136
  import { readFile as readFile23, stat as stat5 } from "node:fs/promises";
311999
312137
  import { createHash as createHash6 } from "node:crypto";
312000
- import { join as join83, relative as relative4, extname as extname12, basename as basename18 } from "node:path";
312138
+ import { join as join83, relative as relative5, extname as extname12, basename as basename18 } from "node:path";
312001
312139
  var DEFAULT_EXCLUDE, LANGUAGE_MAP, CodebaseIndexer;
312002
312140
  var init_codebase_indexer = __esm({
312003
312141
  "packages/indexer/dist/codebase-indexer.js"() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.28",
3
+ "version": "0.187.30",
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",