Skip to content

feat: add DynamicToolRegistry for hot-loadable tool extensions#1

Closed
AP3X-Dev wants to merge 1 commit into
mainfrom
feat/dynamic-tool-registry
Closed

feat: add DynamicToolRegistry for hot-loadable tool extensions#1
AP3X-Dev wants to merge 1 commit into
mainfrom
feat/dynamic-tool-registry

Conversation

@AP3X-Dev
Copy link
Copy Markdown
Owner

@AP3X-Dev AP3X-Dev commented Apr 11, 2026

Summary

  • Adds DynamicToolRegistry — a mutable handler map behind a single compiled StateGraph node, allowing tool extensions to be registered/unregistered at runtime without recompiling the graph
  • Exports ToolHandler and ToolResult types, asNode() for graph integration, and asSchema() for OpenAI-format tool definitions
  • New subpath export at @oni.bot/core/registry (opt-in, not added to root barrel)

Test plan

  • register-and-execute.test.ts — register a tool, execute via node, verify result in messages (4 tests)
  • unknown-tool.test.ts — call unregistered tool, verify structured error returned not thrown (3 tests)
  • register-unregister.test.ts — lifecycle: register, unregister, hot-swap, list/has reflection (6 tests)
  • schema-output.test.ts — 3 tools with different arg shapes, validate JSON schema output (4 tests)
  • Full suite: 291 test files, 1612 tests passing, no regressions
  • Clean typecheck (tsc --noEmit)

Summary by CodeRabbit

  • New Features

    • Added Dynamic Tool Registry enabling runtime tool registration, unregistration, and execution with hot-swap capability
    • Tools integrate with state graphs and support schema generation for language models
    • Built-in error handling for unregistered tools without blocking execution
  • Documentation

    • Added registry feature documentation with usage examples

Introduces a mutable handler map that sits behind a single compiled
StateGraph node. Extensions register/unregister at runtime without
recompiling the graph — the topology never changes.

- DynamicToolRegistry class with register, unregister, list, has,
  asNode (StateGraph-compatible node fn), asSchema (OpenAI format)
- ToolHandler / ToolResult types
- Subpath export at @oni.bot/core/registry
- 18 tests across 4 files covering execution, unknown-tool error
  handling, lifecycle, and schema output
@AP3X-Dev AP3X-Dev closed this Apr 11, 2026
@AP3X-Dev AP3X-Dev deleted the feat/dynamic-tool-registry branch April 11, 2026 21:44
Repository owner deleted a comment from coderabbitai Bot Apr 11, 2026
Repository owner deleted a comment from coderabbitai Bot Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant