Skip to content

feat(tools): add @agentskit/tools + README for all npm packages#26

Merged
EmersonBraun merged 5 commits into
mainfrom
feat/tools-and-readmes
Apr 6, 2026
Merged

feat(tools): add @agentskit/tools + README for all npm packages#26
EmersonBraun merged 5 commits into
mainfrom
feat/tools-and-readmes

Conversation

@EmersonBraun

Copy link
Copy Markdown
Collaborator

Summary

Implements #7 and adds READMEs to all packages.

New package: @agentskit/tools

web_search — DuckDuckGo default, configurable (Serper, custom function)

webSearch()                                    // zero config
webSearch({ provider: 'serper', apiKey: '...' }) // Serper
webSearch({ search: myCustomSearch })            // BYOS

filesystem — read_file, write_file, list_directory with mandatory basePath and path traversal protection

filesystem({ basePath: './workspace' }) // returns ToolDefinition[]

shell — streaming output via AsyncIterable (spawn), mandatory timeout, optional allow list

shell({ timeout: 10_000, allowed: ['ls', 'cat', 'grep'] })

listTools() — static discovery of all built-in tools with metadata

READMEs for npm

Individual README.md for: core, react, ink, adapters, cli, runtime, tools. Each has install, quick example, and docs link.

30 new tests

  • web_search: contract, custom search, formatting, error cases (6)
  • filesystem: read/write/list, path traversal protection, nested files (12)
  • shell: streaming, stderr, allow list, timeout, dispose, exit code (9)
  • discovery: metadata completeness, tool count, copy safety (3)

Test plan

  • 30 tools tests pass
  • All 11 test suites across monorepo pass (27 test files)
  • All 10 packages build
  • All 14 lint tasks pass

…h streaming

New package with reusable executable tools:

- web_search: DuckDuckGo default, configurable (Serper, custom function)
- filesystem: read_file, write_file, list_directory with mandatory basePath
  and path traversal protection
- shell: streaming output via AsyncIterable (spawn), mandatory timeout,
  optional allow list, dispose kills running processes
- listTools(): static discovery function returning tool metadata
- 30 tests covering all tools, contract compliance, and security
Each package now has a focused README with install, quick example,
and link to full docs. Shows on npmjs.com package pages.
…-then-yield

Shell tool was hanging on CI (Linux) because SIGTERM didn't reliably
terminate sleep commands. Changed to SIGKILL for timeouts/dispose,
and simplified to collect-then-yield pattern instead of streaming
promises that could hang if process close event raced.
1. Extract safeParseArgs to core/primitives — removes duplication from
   controller.ts and runner.ts

2. Extract createToolLifecycle() to core/primitives — shared lazy init
   and dispose-all logic for both ChatController and AgentRunner

3. Add tool lifecycle to ChatController — init() before first tool use,
   disposeAll() on clear() and updateConfig(). Fixes process leak when
   shell tool is used via useChat.

4. Runner now passes onPartialResult to executeToolCall — streaming
   tools (like shell) update toolCall.result incrementally instead of
   silently consuming the AsyncIterable.

5. discovery.ts now derives metadata from actual tool instances instead
   of a static registry. Metadata can never diverge from implementations.

6. Fix safePath dead branch in filesystem — the operator precedence bug
   made the second clause always false. Simplified to a single startsWith
   check against normalized base path.

7. Add retriever support to RuntimeConfig — runner now supports RAG
   context injection, matching ChatController's capability.
Replace spawn+SIGKILL with execSync which handles timeout natively
and exits cleanly on all platforms. Simplifies the tool from
AsyncIterable to a sync execute — the timeout and allow list
guarantees remain identical.
@EmersonBraun EmersonBraun merged commit bceb2a1 into main Apr 6, 2026
1 check passed
@EmersonBraun EmersonBraun deleted the feat/tools-and-readmes branch April 6, 2026 00:39
@EmersonBraun EmersonBraun mentioned this pull request Apr 6, 2026
11 tasks
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