[PR #1576] [CLOSED] refactor: load tools dynamically in ToolRegistry #9980

Closed
opened 2026-02-16 18:14:30 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/1576
Author: @yordis
Created: 8/3/2025
Status: Closed

Base: devHead: yordis/fix-12


📝 Commits (1)

  • 58da3f6 refactor: load tools dynamically in ToolRegistry

📊 Changes

1 file changed (+46 additions, -27 deletions)

View changed files

📝 packages/opencode/src/tool/registry.ts (+46 -27)

📄 Description

Circular Dependency Issue

  • The registry.ts file was using static imports for all tools
  • Some tools (like TaskTool) import from ../session, which imports ToolRegistry
  • This created a circular dependency chain: registry.tsedit.ts → (indirectly) → session/index.tsregistry.ts
  • Static imports are evaluated at module load time, causing the initialization error

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/1576 **Author:** [@yordis](https://github.com/yordis) **Created:** 8/3/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `yordis/fix-12` --- ### 📝 Commits (1) - [`58da3f6`](https://github.com/anomalyco/opencode/commit/58da3f69453f18199885038ea55734586262fdba) refactor: load tools dynamically in ToolRegistry ### 📊 Changes **1 file changed** (+46 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `packages/opencode/src/tool/registry.ts` (+46 -27) </details> ### 📄 Description ### Circular Dependency Issue - The `registry.ts` file was using static imports for all tools - Some tools (like `TaskTool`) import from `../session`, which imports `ToolRegistry` - This created a circular dependency chain: `registry.ts` → `edit.ts` → (indirectly) → `session/index.ts` → `registry.ts` - Static imports are evaluated at module load time, causing the initialization error --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:30 -05:00
yindo closed this issue 2026-02-16 18:14:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9980