Skip to content

refactor(tools): TypedTool trait + input/schema normalization#158

Merged
yishuiliunian merged 1 commit into
mainfrom
fix/bash-empty-process-id
May 15, 2026
Merged

refactor(tools): TypedTool trait + input/schema normalization#158
yishuiliunian merged 1 commit into
mainfrom
fix/bash-empty-process-id

Conversation

@yishuiliunian
Copy link
Copy Markdown
Contributor

Summary

  • Introduce TypedTool<P> trait + TypedBridge adapter for compile-time schema-parameter safety — eliminates hand-written JSON schemas and manual Value parsing across all 23 builtin tools
  • Split Bash tool into Bash (command execution) + BashProcess (process management) to eliminate flag argument anti-pattern
  • Add input normalization (empty string → None for optional fields) and schema normalization ($ref inlining, $schema/title removal) in TypedBridge

Changes

  • crates/loopal-tool-api/src/ — new: typed_tool.rs, typed_bridge.rs, input_normalize.rs, schema_normalize.rs
  • crates/tools/process/bash-process/ — new crate for BashProcessTool
  • crates/tools/process/background/src/ops.rs — migrated from bash/bg_ops.rs
  • All 23 tool crates migrated from impl Tool to impl TypedTool<XxxParams>
  • All tool BUILD.bazel files updated with schemars dep
  • Registry builtin/mod.rs updated to use TypedBridge registration

Test plan

  • 74/74 bazel tests pass
  • clippy clean (zero warnings)
  • rustfmt clean
  • Integration tests verify empty string → None E2E through TypedBridge
  • Integration tests verify schema output has no $schema/$ref/title

…rameter safety

Eliminates systemic schema-parameter mismatch by replacing hand-written
JSON schemas and manual Value parsing with typed parameter structs
(derive Deserialize + JsonSchema). TypedBridge adapter bridges typed
tools to dyn Tool registry. Also splits Bash tool into Bash + BashProcess
to eliminate flag argument anti-pattern, and adds input/schema
normalization (empty string → None, $ref inlining, title/schema removal).
@yishuiliunian yishuiliunian force-pushed the fix/bash-empty-process-id branch from 5cce5bd to 455f801 Compare May 15, 2026 07:33
@yishuiliunian yishuiliunian merged commit 53b19fe into main May 15, 2026
4 checks passed
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