Skip to content

refactor(core): normalize ToolCall names at provider layer#1061

Merged
christso merged 1 commit intomainfrom
refactor/1059-normalize-toolcall
Apr 12, 2026
Merged

refactor(core): normalize ToolCall names at provider layer#1061
christso merged 1 commit intomainfrom
refactor/1059-normalize-toolcall

Conversation

@christso
Copy link
Copy Markdown
Collaborator

Summary

Closes #1059

Normalizes provider-specific tool names to canonical names (Skill, Read, Write, Edit, Bash) at the provider layer, eliminating ~120 lines of per-provider matching logic from evaluators.

Changes

Phase 1: normalizeToolCall() function

  • New normalize-tool-call.ts with static mapping tables (data-driven, not if/else)
  • Wired into all 9 providers + 2 import parsers
  • Input normalization: pathfile_path for Read tools
  • 83 unit tests

Phase 2: stream_log config + auto-transcript

  • New stream_log field on TargetDefinition and all resolved configs
  • resolveStreamLog() helper with log_formatstream_log fallback + deprecation warning
  • Auto-writes transcript.jsonl on every eval run

Phase 3: Simplified skill-trigger evaluator

  • Removed ToolMatcher interface, all provider matchers, PROVIDER_TOOL_SEMANTICS map
  • Evaluator now checks only canonical names: Skill (input.skill) + Read (input.file_path)
  • Fully provider-agnostic — no ProviderKind import

Testing

  • 2045 tests pass (1607 core + 438 CLI), 0 failures
  • Lint clean (biome)
  • Build succeeds
  • E2E: CLI dry-run verified transcript.jsonl output
  • Updated 5 existing test files to expect canonical names

Files changed

  • 21 files (19 modified + 2 new), net -499/+849 lines

Phase 1: Add normalizeToolCall() pure function with static mapping tables
- Canonical names: Skill, Read, Write, Edit, Bash (Claude naming)
- Wired into all 9 providers and 2 import parsers
- Input normalization: path → file_path for Read tools
- 83 unit tests for normalizeToolCall

Phase 2: Add stream_log config + auto-write transcript JSONL
- New stream_log field on TargetDefinition and all resolved configs
- resolveStreamLog() helper with log_format → stream_log fallback
- Deprecation warning when log_format used
- Auto-writes transcript.jsonl on every eval run

Phase 3: Simplify skill-trigger evaluator
- Removed ~120 lines of provider-specific code (ToolMatcher, matchers,
  PROVIDER_TOOL_SEMANTICS, resolveMatcher, readPathFromInput)
- Evaluator now only checks canonical names: Skill + Read
- Fully provider-agnostic (no ProviderKind import)

All 2045 tests pass. Lint clean.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying agentv with  Cloudflare Pages  Cloudflare Pages

Latest commit: 00ba70b
Status: ✅  Deploy successful!
Preview URL: https://d944fe09.agentv.pages.dev
Branch Preview URL: https://refactor-1059-normalize-tool.agentv.pages.dev

View logs

@christso christso marked this pull request as ready for review April 12, 2026 22:18
@christso christso merged commit 56cac3b into main Apr 12, 2026
4 checks passed
@christso christso deleted the refactor/1059-normalize-toolcall branch April 12, 2026 22:18
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.

refactor: normalize ToolCall names at provider layer, auto-write transcript, deprecate log_format

1 participant