@vinkius-core/mcp-fusion 1.11.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md DELETED
@@ -1,616 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [1.11.0] - 2026-02-23
9
-
10
- ### 📄 Stateless Cursor Pagination for Prompts
11
-
12
- **MCP Fusion** now provides O(1) memory, cryptographic cursor-based pagination for `prompts/list`. Instead of loading thousands of prompts into memory or sending large payloads to MCP clients, the framework emits pages using an RFC-compliant cursor algorithm powered by the native Web Crypto API.
13
-
14
- ### Added
15
-
16
- - **`PromptRegistry.configurePagination({ pageSize })`:** Enables stateless pagination. By default, pagination is disabled (all prompts returned).
17
- - **`CursorCodec` module:** Implements a robust encoded cursor utilizing native `globalThis.crypto.subtle`. Zero external crypto dependencies.
18
- - **Server integration:** Automatically extracts the `cursor` param from the `prompts/list` MCP request, decodes it, applies filters, and generates the `nextCursor` transparently.
19
- - **Tamper resistance:** Adulterated cursors fallback gracefully to the first page without crashing the server.
20
- - **Progress Notifications Integration:** Full E2E testing of `ProgressSink` mapping to `notifications/progress`. Generator handlers firing `yield progress()` map seamlessly without overhead.
21
- - **Cooperative Cancellation Integration:** Full E2E testing of `AbortSignal` interception causing runaway generators and chains to abort instantly.
22
-
23
- ## [1.10.0] - 2026-02-23
24
-
25
- ### Hydration Timeout Sandbox — Graceful Degradation for Prompt Hydration
26
-
27
- **MCP Fusion** now protects prompt handlers from slow/failing external data sources via the **Hydration Timeout Sandbox**. When a handler fetches data from Jira, Stripe, databases, or any external source and the call hangs, the framework enforces a strict deadline, unblocks the UI immediately, and returns a structured SYSTEM ALERT.
28
-
29
- ### Added
30
-
31
- - **`HydrationSandbox` module** (`src/prompt/HydrationSandbox.ts`): Core timeout mechanism using `Promise.race`. Wraps handler execution with a strict deadline and catches both timeouts and handler errors, converting them to graceful `<hydration_alert>` XML-structured messages.
32
- - **`hydrationTimeout` config** on `definePrompt()`: Per-prompt deadline in milliseconds. Example: `definePrompt('briefing', { hydrationTimeout: 3000, handler: ... })`.
33
- - **`setDefaultHydrationTimeout(ms)`** on `PromptRegistry`: Global safety net for ALL prompts. Individual prompt timeouts override the registry default.
34
- - **Three-scenario coverage**: Handler completes → normal result. Handler exceeds deadline → TIMEOUT alert. Handler throws → ERROR alert. The UI ALWAYS unblocks.
35
- - **Timer cleanup**: `clearTimeout` via `finally` block — no resource leaks, no dangling timers keeping Node.js alive.
36
- - **Zero overhead**: When no timeout is configured, no timer is created, no `Promise.race` wrapping — the handler runs directly.
37
- - **Interceptor composition**: Prompt Interceptors still execute after a timeout, ensuring compliance headers and tenant context are always injected.
38
- - **`getHydrationTimeout()`** on `PromptBuilder` interface: Read the configured timeout for introspection and testing.
39
- - **17 new tests**: Unit tests covering timeout, early completion, error-as-degradation, timer cleanup, non-Error throws, plus integration tests for per-prompt config, registry defaults, override precedence, backward compatibility, and interceptor composition after timeout.
40
-
41
- ### Design Influences
42
-
43
- - Go's `context.WithDeadline` (structured cancellation)
44
- - gRPC deadline propagation (strict, per-RPC)
45
- - Resilience4j TimeLimiter (JVM circuit breaker pattern)
46
-
47
- ## [1.9.0] - 2026-02-23
48
-
49
- ### Intent Mutex (Anti-Race Condition)
50
-
51
- **MCP Fusion** now provides automatic transactional isolation for AI agents via the **Intent Mutex**. When an LLM hallucinates and fires identical destructive calls in the exact same millisecond (e.g., double-deleting a user), the framework serializes them to guarantee isolation.
52
-
53
- ### Added
54
-
55
- - **`MutationSerializer` class:** Implements an idiomatic JS async mutex using per-key promise-chaining. Strict FIFO queue order without external locks, Redis, or OS primitives.
56
- - **Zero-Configuration Setup:** Automatically enabled strictly for actions marked with `destructive: true`. Fast-path bypass for all other actions (zero overhead).
57
- - **Per-Action Serialization:** `billing.refund` and `billing.delete` run independently, but concurrent `billing.refund` requests are strictly serialized.
58
- - **Cooperative Cancellation:** Waiters queued in the mutex instantly abort if the request `AbortSignal` fires before they acquire the lock.
59
- - **Automatic Garbage Collection:** Completed promise chains are aggressively pruned to prevent memory leaks.
60
- - **Builder Integration:** Handled inside `_executePipeline` seamlessly; `GroupedToolBuilder` manages the mutex internally.
61
- - **14 New Tests:** Unit tests covering chain GC, error recovery, signal abortion, parallel execution, and builder integration with other guards.
62
-
63
- ## [1.8.0] - 2026-02-23
64
-
65
- ### Runtime Guards — Concurrency Bulkhead & Egress Limiter
66
-
67
- **MCP Fusion** now provides two built-in runtime guards that fulfill the MCP specification requirement: *"Servers MUST rate limit tool invocations."* Both guards have **zero overhead** when not configured — no objects created, no branches in the hot path.
68
-
69
- ### Added
70
-
71
- - **Concurrency Guard (Bulkhead):** Per-tool semaphore with configurable `maxActive` concurrent executions and `maxQueue` backpressure queue. Load shedding rejects excess calls with `toolError('SERVER_BUSY')` — a self-healing error that causes the LLM to reduce its cadence.
72
- - `ConcurrencyGuard` class in `src/core/execution/ConcurrencyGuard.ts`
73
- - `.concurrency({ maxActive, maxQueue })` fluent method on `GroupedToolBuilder`
74
- - `ConcurrencyConfig` type exported from root barrel
75
- - AbortSignal integration: queued waiters are cancelled cooperatively
76
- - Slot release guarantee via `try/finally` — no leaks on handler crash
77
- - **Egress Guard (Payload Limiter):** Per-tool maximum response size in bytes. Truncates oversized payloads at UTF-8 character boundaries and injects a system intervention message forcing the LLM to use pagination.
78
- - `applyEgressGuard()` function in `src/core/execution/EgressGuard.ts`
79
- - `.maxPayloadBytes(bytes)` fluent method on `GroupedToolBuilder`
80
- - `EgressConfig` type exported from root barrel
81
- - UTF-8 safe truncation via `TextEncoder`/`TextDecoder`
82
- - Minimum enforced at 1024 bytes to prevent unusable responses
83
- - **`_executeWithObservability()` internal method:** Extracted from `execute()` to keep the concurrency/egress guard integration clean. No behavioral change — same tracing/debug/fast paths.
84
-
85
- ### Documentation
86
-
87
- - **New "Runtime Guards" page (`docs/runtime-guards.md`):** Problem statement, architecture diagram, Quick Start for both guards, combined usage, testing patterns, MCP spec compliance section, configuration reference, and compatibility matrix.
88
- - **VitePress sidebar:** Added Runtime Guards under Production section.
89
- - **SEO:** 7 new FAQs for the Runtime Guards page with FAQPage + TechArticle JSON-LD structured data.
90
- - **llms.txt:** Updated with Runtime Guards section and public API entries.
91
-
92
- ### Test Suite
93
-
94
- - **24 new tests** in `RuntimeGuards.test.ts`:
95
- - ConcurrencyGuard: Semaphore Basics (3 tests)
96
- - ConcurrencyGuard: Backpressure Queue (3 tests)
97
- - ConcurrencyGuard: AbortSignal Integration (2 tests)
98
- - EgressGuard: Payload Truncation (5 tests)
99
- - Builder Integration: .concurrency() (5 tests)
100
- - Builder Integration: .maxPayloadBytes() (3 tests)
101
- - Runtime Guards: Combined (2 tests + abort scenario)
102
- - **Test count:** 1,525 tests across 70 files, all passing.
103
-
104
- ## [1.7.0] - 2026-02-23
105
-
106
- ### 🚫 Cancellation Propagation — Cooperative AbortSignal for MCP Tools
107
-
108
- **MCP Fusion** now intercepts the `AbortSignal` from the MCP SDK and propagates it through the **entire execution pipeline** — middleware, handlers, and generators. When a user clicks "Stop" or the transport drops, all in-flight operations terminate immediately. Zero zombie processes. Zero resource leaks.
109
-
110
- ### Added
111
-
112
- - **`extractSignal(extra)` in `ServerAttachment`:** Safely extracts `AbortSignal` from the MCP SDK's `RequestHandlerExtra` object. Returns `undefined` when not present (zero overhead).
113
- - **`McpRequestExtra.signal`:** Extended interface to include `signal?: AbortSignal` from the SDK protocol layer.
114
- - **`runChain()` cancellation gate:** Checks `signal.aborted` before invoking the pre-compiled middleware chain. Pre-cancelled requests return `error('Request cancelled.')` without executing any handler code.
115
- - **`drainGenerator()` cancellation check:** Checks `signal.aborted` before each `yield` iteration. Aborted generators trigger `gen.return()` for `finally{}` cleanup, preventing zombie generators from continuing.
116
- - **Signal propagation through the full pipeline:**
117
- - `RegistryDelegate.routeCall(ctx, name, args, sink, signal)`
118
- - `ToolBuilder.execute(ctx, args, sink, signal)`
119
- - `ToolRegistry.routeCall(ctx, name, args, sink, signal)`
120
- - `GroupedToolBuilder.execute(ctx, args, sink, signal)`
121
- - `_executePipeline(execCtx, ctx, args, sink, hooks, signal)`
122
- - `runChain(execCtx, resolved, ctx, args, sink, rethrow, signal)`
123
- - `drainGenerator(gen, sink, signal)`
124
- - **`contextFactory` passthrough:** Developers can extract `extra.signal` in `contextFactory` and expose it as `ctx.signal` for use in `fetch()`, Prisma, and other I/O operations.
125
- - **Loopback dispatcher propagation:** Prompts calling tools via `dispatchToolCall()` forward the signal to `registry.routeCall()`.
126
- - **Flat exposition support:** Signal propagated in both grouped and flat exposition modes.
127
-
128
- ### Documentation
129
-
130
- - **New "Cancellation" page (`docs/cancellation.md`):** Architecture diagram, Quick Start guide, generator cancellation, testing patterns, best practices (pass `ctx.signal` to I/O), and compatibility matrix.
131
- - **VitePress sidebar:** Added Cancellation under Production section.
132
- - **SEO:** 7 new FAQs for the Cancellation page with FAQPage + TechArticle JSON-LD structured data.
133
-
134
- ### Test Suite
135
-
136
- - **9 new tests** in `CancellationPropagation.test.ts`:
137
- - Signal via contextFactory (1 test)
138
- - Pre-execution abort — handler never called (1 test)
139
- - Zero overhead — no signal present (1 test)
140
- - Generator abort — mid-iteration cancellation (1 test)
141
- - Generator abort — pre-aborted signal (1 test)
142
- - Flat exposition mode — signal propagated (1 test)
143
- - Direct builder execute — 4th parameter (2 tests)
144
- - Middleware chain — signal during middleware (1 test)
145
- - **Test count:** 1,501 tests across 69 files, all passing.
146
-
147
- ## [1.6.2] - 2026-02-23
148
-
149
- ### 🧪 End-to-End Integration Test Suite
150
-
151
- Comprehensive integration test suite (`tests/integration/FullStack.test.ts`) covering **all modules working together** through the MCP Server mock — happy paths AND sad paths. Ensures the framework resolves developer mistakes gracefully without crashing.
152
-
153
- ### Added
154
-
155
- - **37 integration tests** in `FullStack.test.ts` organized across 22 `describe` blocks:
156
-
157
- **Happy paths (15 tests):**
158
- - Builder → Registry → Server → ContextFactory
159
- - Builder → Presenter → Server (auto-view composition)
160
- - Builder → Middleware → Debug Observability (cross-layer events)
161
- - Builder → Middleware → Tracing (OTel span lifecycle)
162
- - Builder → StateSync → Server (cache-control + invalidation)
163
- - PromptRegistry → Server (prompts/list + prompts/get)
164
- - Builder → Flat Exposition → Server (atomic tool projection)
165
- - Flat Exposition → Debug + Tracing (2 tests)
166
- - Full Stack — ALL modules in a single server attachment
167
- - Concurrent multi-tool calls (20 parallel + traced, 2 tests)
168
- - Presenter → Tracing → Server
169
- - Detach → Re-attach lifecycle
170
- - defineMiddleware → defineTool → Server
171
-
172
- **Sad paths (22 tests):**
173
- - **Routing Failures (4):** Unknown tool (`UNKNOWN_TOOL` + suggestions), unknown action, missing/null/empty discriminator, unknown flat tool name
174
- - **Validation Failures (3):** Wrong types, constraint violations (min/max/email), strict mode extra field rejection, flat mode validation
175
- - **Handler Exceptions (3):** Handler `throw` → `isError=true` (grouped + flat), soft fail vs hard fail tracing distinction (`UNSET` vs `ERROR` + `recordException`)
176
- - **Middleware Failures (3):** Middleware block + debug error event, middleware exception traced as system error, multi-middleware chain ordering (first blocker wins)
177
- - **Concurrent Mixed Results (1):** 5 simultaneous calls — 2 success + 1 validation error + 1 throw + 1 unknown action — isolated
178
- - **Debug + Tracing Error Correlation (2):** Debug error for unknown tool, traced validation error when both debug+tracing coexist
179
- - **defineTool Param Descriptor Errors (2):** Constraint violations via descriptors, shared param missing/empty
180
- - **StateSync Config Errors (2):** Invalid `cacheControl` directives rejected at attach time
181
- - **Detach Error Handling (2):** Post-detach calls return error, tools/list returns empty, double detach is idempotent
182
-
183
- - **Mock strategy:** Only the MCP Server is mocked — no internal framework mocking. Tests exercise the full pipeline (routing → validation → middleware → handler → observability → response).
184
-
185
- ### Test Suite
186
-
187
- - **1,492 tests** across 68 files, all passing.
188
-
189
- ## [1.6.1] - 2026-02-23
190
-
191
- ### 🛡️ XML Security & Error Protocol Hardening
192
-
193
- Comprehensive security audit of the XML error protocol. Prevents XML injection, hardens type safety, and upgrades the registry-level error to the structured `toolError()` protocol.
194
-
195
- ### Security
196
-
197
- - **XML injection prevention:** Introduced `escapeXml()` (element content — escapes `&` and `<`) and `escapeXmlAttr()` (attribute values — escapes all 5 XML special characters). Applied across `response.ts`, `ExecutionPipeline.ts`, `ValidationErrorFormatter.ts`, and `PromptExecutionPipeline.ts`.
198
- - **Dual escaping strategy:** Element content preserves `>` for LLM readability (`>= 1`, `Must be > 0`). Attribute values use strict escaping.
199
-
200
- ### Fixed
201
-
202
- - **Type safety in `parseDiscriminator`:** Replaced unsafe `as string` cast with runtime `typeof` check. Non-string discriminator values (numbers, booleans, objects) now return `MISSING_DISCRIMINATOR` instead of causing `TypeError: str.replace is not a function`.
203
- - **Structured `UNKNOWN_TOOL` error:** `ToolRegistry.routeCall()` now returns `toolError('UNKNOWN_TOOL', ...)` with structured XML (code, message, available tools, recovery hint) instead of a freeform `error()` string. Consistent with pipeline-level errors (`MISSING_DISCRIMINATOR`, `UNKNOWN_ACTION`).
204
-
205
- ### Documentation
206
-
207
- - **error-handling.md:** Added `UNKNOWN_TOOL` to the Unified XML Protocol table. Added XML Security tip callout.
208
- - **llms.txt:** Added XML security note with pipeline error codes. Added `unknown_tool` to tracing error classification.
209
-
210
- ### DX
211
-
212
- - **English error messages:** Translated remaining Portuguese error message in `defineTool.ts` to English.
213
-
214
- ### Test Suite
215
-
216
- - **1,389 tests** across 417 suites, all passing.
217
-
218
- ## [1.6.0] - 2026-02-23
219
-
220
- ### 🔗 MVA-Driven Prompts — `PromptMessage.fromView()`
221
-
222
- Bridge the Presenter layer into the Prompt Engine with zero duplication. `PromptMessage.fromView()` decomposes a `ResponseBuilder` into XML-tagged prompt messages (`<domain_rules>`, `<dataset>`, `<visual_context>`, `<system_guidance>`) — same source of truth as the Tool response.
223
-
224
- ### Added
225
-
226
- - **`PromptMessage.fromView(builder)`:** Static method that decomposes a `ResponseBuilder` into `PromptMessagePayload[]`. Extracts rules, validated data, UI blocks, hints, and action suggestions into semantically separated XML-tagged blocks optimized for frontier LLMs.
227
- - **`ResponseBuilder` introspection getters:** `getData()`, `getRules()`, `getUiBlocks()`, `getHints()`, `getSuggestions()` — read-only access to internal layers without calling `.build()`.
228
-
229
- ### Documentation
230
-
231
- - **`prompts.md`:** New H2 section "MVA-Driven Prompts — `fromView()`" with Before/After comparison, decomposition architecture diagram, XML tag table, composability example.
232
- - **`presenter.md`:** New section "Using Presenters in Prompts" with cross-reference to Prompt Engine docs. Added Prompt Engine link to Next Steps.
233
- - **`api-reference.md`:** New Prompt Engine section with `definePrompt`, `PromptMessage` (all methods), `PromptMessage.fromView()` decomposition table, `PromptRegistry` methods, and Prompt types.
234
- - **VitePress sidebar:** Prompts section expanded from 1 to 5 items. Reference section expanded from 1 to 12 anchor-linked entries.
235
- - **README.md:** Complete rewrite — engineering-focused documentation matching Prisma/tRPC style. Every section: 1-line technical description + code + output.
236
- - **llms.txt:** Prompt Engine and MVA-Driven Prompts sections with examples. Public API expanded with 11 Prompt entries and 5 Prompt types.
237
-
238
- ### Test Suite
239
-
240
- - **14 new tests** in `PromptMessageFromView.test.ts` covering rules decomposition, data extraction (JSON fencing), UI blocks, hints, suggestions, full composition, Presenter integration, and edge cases.
241
- - **Test count:** 1,356 tests across 61 files, all passing.
242
-
243
- ## [1.5.0] - 2026-02-23
244
-
245
- ### 💬 Prompt Engine — 100% MCP Spec Compliance
246
-
247
- Full implementation of MCP `prompts/list` and `prompts/get` handlers with `definePrompt()`, `PromptMessage`, `PromptRegistry`, schema-informed coercion, middleware, tag-based filtering, and lifecycle sync (`notifications/prompts/list_changed`).
248
-
249
- ### Added
250
-
251
- - **`definePrompt(name, config)`:** JSON-first prompt builder with flat schema constraint (primitives only — string, number, boolean, enum).
252
- - **`PromptMessage`:** Factory methods — `.system()`, `.user()`, `.assistant()`, `.image()`, `.audio()`, `.resource()`.
253
- - **`PromptRegistry<TContext>`:** Registration, tag-based RBAC filtering, `routeGet()` handler routing, `notifyChanged()` lifecycle sync, `attachToServer()`.
254
- - **Schema-informed coercion:** Automatic string → number/boolean conversion based on declared schema types.
255
- - **Flat schema constraint enforcement:** Nested objects/arrays rejected at definition time with actionable errors.
256
- - **Middleware support:** Same `defineMiddleware()` chain as Tools — auth, RBAC, context derivation.
257
-
258
- ## [1.4.0] - 2026-02-23
259
-
260
- ### 🔀 Tool Exposition Strategies — Flat vs Grouped Topology Compiler
261
-
262
- Two first-class exposition strategies for the same codebase: **flat** (one MCP tool per action — precision at action level) and **grouped** (one MCP tool per builder with discriminator enum — density at scale). Choose at attach time with `toolExposition: 'flat' | 'grouped'`. Same handlers, different wire format.
263
-
264
- ### Added
265
-
266
- - **`ExpositionCompiler`:** New compile-time topology compiler that transforms builder action graphs into either flat atomic tools or grouped discriminator tools. Builds an O(1) routing map for flat mode dispatch.
267
- - **`toolExposition` option in `AttachOptions`:** `'flat'` (default) expands each action into an independent MCP tool with isolated schema and annotations. `'grouped'` preserves the single-tool discriminator pattern.
268
- - **`actionSeparator` option in `AttachOptions`:** Controls flat tool naming convention (default `'_'`). `projects` + `list` → `projects_list`.
269
- - **MCP Annotation Refinement (`buildAtomicAnnotations`):** Annotations now follow correct MCP spec semantics:
270
- - Read-only actions → `{ readOnlyHint: true, destructiveHint: false }` (derived: read-only is never destructive)
271
- - Destructive actions → `{ destructiveHint: true }` (`readOnlyHint` omitted — spec default is `false`)
272
- - Normal actions → `{ destructiveHint: false }` (overrides spec default of `true` to prevent unnecessary safety warnings in Claude Desktop/Cursor)
273
- - `readOnlyHint: false` is never emitted (matches spec default)
274
- - **Flat mode description synthesis:** Auto-generated descriptions tagged with `[READ-ONLY]` or `[DESTRUCTIVE]` prefixes, plus origin trail `(builder → action)`.
275
- - **Flat mode StateSync integration:** Canonical dot-notation keys (`projects.create`) translate to/from flat wire names (`projects_create`) transparently.
276
-
277
- ### Documentation
278
- - **New "Tool Exposition" page:** Stripe/Vercel-quality guide covering both strategies as equal peers, real-world SaaS admin example (10-action grouped), token math comparison, MCP annotation semantics callout, O(1) dispatch explanation, and decision guide table.
279
- - **VitePress sidebar:** Added Tool Exposition under Core Concepts.
280
- - **API Reference:** Updated `AttachOptions` with `toolExposition` and `actionSeparator` fields, added `ToolExposition` and `ExpositionConfig` type sections.
281
- - **Routing page:** Cross-reference to Tool Exposition guide.
282
- - **README:** Tool Exposition row in capability matrix and Learn by Doing guides table.
283
- - **llms.txt:** Tool Exposition section with both strategies, MCP annotation semantics, and updated `AttachOptions` type.
284
-
285
- ### Test Suite
286
- - **48 new tests** across 2 new test files:
287
- - `ToolExposition.test.ts` — 21 tests covering flat compilation, grouped passthrough, annotation isolation, hierarchical group expansion, multi-builder merging, separator customization, single-action builders.
288
- - `ToolExpositionSadPath.test.ts` — 27 sad-path tests covering builder-with-no-actions, empty separator, name collisions, schema shadowing, empty iterables, incorrect tool naming, mode confusion, detach/re-attach, late registration, custom discriminators, exception handling.
289
- - **Test count:** 1,342 tests across 60 files, all passing.
290
-
291
- ## [1.3.0] - 2026-02-22
292
-
293
- ### 🔭 Native OpenTelemetry-Compatible Tracing
294
-
295
- Production-grade tracing for AI-native MCP servers. Every tool call creates **one span** with rich semantic attributes — zero dependencies on `@opentelemetry/api`, zero overhead when disabled. Uses structural subtyping: pass `trace.getTracer()` directly.
296
-
297
- ### Added
298
-
299
- - **`FusionTracer` / `FusionSpan` interfaces:** Structural subtyping contracts that match the real OpenTelemetry `Tracer` and `Span` — no `implements` or `import @opentelemetry/api` needed.
300
- - **`SpanStatusCode` constants:** Exported `UNSET` (0), `OK` (1), `ERROR` (2) matching OTel values.
301
- - **`.tracing(tracer)` on builders:** Per-tool tracing via fluent API on both `createTool()` and `defineTool()`.
302
- - **`enableTracing(tracer)` on `ToolRegistry`:** Propagate tracer to all registered builders.
303
- - **`AttachOptions.tracing`:** Pass tracer to `attachToServer()` for full server observability.
304
- - **Enterprise error classification:** 5 distinct `mcp.error_type` values (`missing_discriminator`, `unknown_action`, `validation_failed`, `handler_returned_error`, `system_error`) with correct `SpanStatusCode` mapping — AI errors → `UNSET` (no alert), system failures → `ERROR` (PagerDuty).
305
- - **`mcp.isError` attribute:** Consistent `boolean` on all 5 error paths for unified Datadog/Grafana filtering.
306
- - **Enterprise metadata attributes:** `mcp.tags` (tool tags for dashboard filtering), `mcp.description` (tool description), `mcp.response_size` (response text length for billing/quota).
307
- - **Pipeline span events:** `mcp.route`, `mcp.validate` (with `mcp.valid` and `mcp.durationMs`), `mcp.middleware` (with `mcp.chainLength`). Events are optional via `?.` for minimal tracers.
308
- - **Graceful error handling:** Handler exceptions are caught, span gets `SpanStatusCode.ERROR` + `recordException()`, but method returns error response (no MCP server crash).
309
- - **Leak-proof span lifecycle:** `finally { span.end() }` guarantees span closure on all paths including exceptions.
310
- - **Symmetric coexistence warning:** `enableDebug()` ↔ `enableTracing()` emit `console.warn` in either order when both are enabled.
311
- - **`runChain(rethrow)` parameter:** Optional flag (default `false`) allows traced path to receive raw handler exceptions for proper classification.
312
-
313
- ### Changed
314
-
315
- - **`runChain()` signature:** Added optional `rethrow` parameter (backward compatible, default `false`).
316
- - **`_executeTraced()` error path:** Returns graceful `error()` response instead of `throw` — prevents MCP server crashes while preserving `SpanStatusCode.ERROR` for ops alerting.
317
-
318
- ### Documentation
319
- - **New "Tracing" page:** Dedicated documentation page covering FusionTracer interface, error classification matrix, span attribute reference, pipeline events, context propagation limitation, and production setup example (OTLP/Jaeger).
320
- - **VitePress sidebar:** Added Tracing under Advanced Guides.
321
-
322
- ### Test Suite
323
- - **36 new tracing tests** in `Tracing.test.ts`:
324
- - Span lifecycle — creation, end, attributes (4 tests)
325
- - Span events — route, validate, middleware, order (5 tests)
326
- - Enterprise metadata — tags, description, response size (5 tests)
327
- - Error classification — OK, UNSET, ERROR with `mcp.isError` (5 tests)
328
- - Span leak prevention — finally guarantees (2 tests)
329
- - Zero overhead — fast path when disabled (2 tests)
330
- - Registry propagation — enableTracing() (2 tests)
331
- - Coexistence — debug + tracing symmetric warnings (3 tests)
332
- - addEvent optional, SpanStatusCode constants, defineTool compat (3 tests)
333
- - Multiple sequential calls, concurrent calls (2 tests)
334
- - Server attachment integration (1 test)
335
- - **Test count:** 116 tests across Tracing + DebugObserver + McpServerAdapter, all passing.
336
-
337
- ## [1.2.0] - 2026-02-22
338
-
339
- ### 🛡️ Agentic Error Presenter — LLM-Native Validation & Routing Errors
340
-
341
- Validation and routing errors are now **formatted for autonomous agents**, not humans. When the LLM sends invalid arguments, it receives structured, uppercase, actionable correction prompts — with the exact field names, what was sent, what was expected, and a direct instruction to retry. The framework switches from `.strip()` to `.strict()`, meaning unknown fields now trigger **explicit rejection with field names** instead of silent removal.
342
-
343
- ### Changed
344
-
345
- - **`.strip()` → `.strict()` in `ToolDefinitionCompiler.buildValidationSchema()`:** Unknown fields injected by the LLM are no longer silently discarded. They now trigger a validation error naming the unrecognized field(s) with a suggestion to check for typos. This gives the LLM a chance to self-correct instead of silently losing data.
346
- - **`ValidationErrorFormatter` upgraded:**
347
- - New header: `⚠️ VALIDATION FAILED — ACTION 'X'` (uppercased for LLM visual parsing).
348
- - Anti-apology footer: `💡 Fix the fields above and call the tool again. Do not explain the error.`
349
- - Actionable hints per field with `You sent:` values and expected types/formats.
350
- - Unrecognized key errors include `💡 Check for typos` suggestion.
351
- - **`ExecutionPipeline` routing errors:**
352
- - Missing discriminator: `❌ ROUTING ERROR: The required field 'action' is missing.` with available actions list and recovery hint.
353
- - Unknown action: `❌ UNKNOWN ACTION: The action 'x' does not exist.` with available actions list and recovery hint.
354
-
355
- ### Test Suite
356
- - **1,254 tests** across 57 files, all passing.
357
- - Updated assertions in 9 test files to match new error formats and `.strict()` behavior.
358
-
359
- ### 📡 Streaming Progress — End-to-End MCP Notification Wiring
360
-
361
- Generator handlers that `yield progress()` now **automatically** send `notifications/progress` to the MCP client — zero configuration required. The framework detects `progressToken` from the client's request `_meta` and wires the notifications transparently. When no token is present, progress events are silently consumed with **zero overhead**.
362
-
363
- ### Added
364
-
365
- - **MCP Progress Notification Wiring:** `ServerAttachment` now creates a `ProgressSink` from the MCP request `extra` object when the client includes `_meta.progressToken`. Each `yield progress(percent, message)` in a generator handler maps to `notifications/progress { progressToken, progress, total: 100, message }` on the wire. Fire-and-forget delivery — does not block the handler pipeline.
366
- - **`ProgressSink` threading through the full pipeline:** `ToolBuilder.execute()`, `ToolRegistry.routeCall()`, `GroupedToolBuilder.execute()`, and `runChain()` all accept an optional `ProgressSink` parameter, allowing direct injection for testing and custom pipelines.
367
- - **`McpRequestExtra` duck-typed interface:** New internal interface for extracting `_meta.progressToken` and `sendNotification` from the SDK's `extra` object without coupling to SDK internals.
368
- - **`createProgressSink()` factory:** New private helper in `ServerAttachment.ts` that maps `ProgressEvent` to MCP wire format. Returns `undefined` when no token is present (zero overhead).
369
- - **`isMcpExtra()` type guard:** Duck-type check for the MCP SDK's `extra` object.
370
- - **`RegistryDelegate.routeCall()` signature updated:** Now accepts optional `progressSink` parameter.
371
-
372
- ### Documentation
373
- - **Building Tools:** Streaming Progress section updated to explain automatic MCP notification wiring with wire format table.
374
- - **API Reference:** `ProgressSink` type, MCP Notification Wiring subsection, updated `routeCall()` signature, and `attachToServer()` progress comment added.
375
- - **Examples:** Streaming Progress example (§8) updated with a tip about automatic MCP notification wiring.
376
-
377
- ### Test Suite
378
- - **8 new tests** in `ProgressWiring.test.ts`:
379
- - `builder.execute()` with `progressSink` — 3 tests (forward, backward compat, debug path).
380
- - `registry.routeCall()` with `progressSink` — 1 test (full routing pipeline).
381
- - MCP ServerAttachment integration — 4 tests (with token, without token, non-MCP extra, numeric token).
382
- - **Test count:** 1,254 tests across 57 files, all passing.
383
-
384
- ## [1.1.0] - 2026-02-22
385
-
386
- ### 🔍 Dynamic Manifest — RBAC-Aware Server Capabilities via MCP Resources
387
-
388
- Expose a **live capabilities manifest** (`fusion://manifest.json`) as a native MCP Resource. Orchestrators, admin dashboards, and AI agents can discover every tool, action, and presenter registered on the server — dynamically filtered by the requesting user's role and permissions.
389
-
390
- ### Added
391
-
392
- - **Dynamic Manifest Resource:** New opt-in MCP Resource (`fusion://manifest.json`) that exposes the full server capabilities tree. Uses native MCP `resources/list` and `resources/read` protocol — no custom HTTP endpoints. Zero overhead when disabled.
393
- - **ManifestCompiler:** New `compileManifest()` function that extracts metadata from all registered `ToolBuilder` instances and produces a structured `ManifestPayload` with tools, actions, input schemas, and presenter references. `cloneManifest()` provides deep-clone isolation for RBAC filtering.
394
- - **IntrospectionResource:** New `registerIntrospectionResource()` function that registers `resources/list` and `resources/read` handlers on the low-level MCP Server. Supports custom URIs, RBAC filter callbacks, and context factory integration.
395
- - **RBAC Filtering:** Filter callback receives a deep clone of the manifest plus the session context (from `contextFactory`). Delete tools, actions, or presenters the user should not see. Each request gets a fresh clone — concurrent sessions with different roles never interfere.
396
- - **Presenter Introspection Accessors:** `getSchemaKeys()`, `getUiBlockTypes()`, and `hasContextualRules()` on the `Presenter` class — read-only accessors that extract metadata without executing `.make()`, no side effects, don't seal.
397
- - **`ActionMetadata` Presenter Fields:** Extended `ActionMetadata` with `presenterName`, `presenterSchemaKeys`, `presenterUiBlockTypes`, and `presenterHasContextualRules` for action-level presenter metadata.
398
- - **`ToolRegistry.getBuilders()`:** New method returning an iterable of all registered `ToolBuilder` instances for introspection.
399
- - **`AttachOptions.introspection`:** New `IntrospectionConfig<TContext>` option with `enabled`, `uri`, and `filter` fields.
400
- - **`AttachOptions.serverName`:** New option to set the manifest's server name (default: `'mcp-fusion-server'`).
401
-
402
- ### Documentation
403
- - **New "Dynamic Manifest" page:** Dedicated documentation page with full configuration guide, RBAC patterns, payload structure reference, architecture diagram, and real-world examples (multi-tenant RBAC, compliance audits, admin dashboards).
404
- - **SEO:** 8 new FAQs for the Dynamic Manifest page with full structured data (FAQPage + TechArticle JSON-LD).
405
-
406
- ### Test Suite
407
- - **50 new tests** across 2 new test files:
408
- - `Introspection.test.ts` — 31 tests covering ManifestCompiler, Presenter accessors, RBAC filtering, cloneManifest, ToolRegistry.getBuilders, ActionMetadata presenter fields.
409
- - `IntrospectionIntegration.test.ts` — 19 mock-based integration tests covering handler registration, resources/list and resources/read, RBAC with context factory, zero-overhead guarantee, custom URIs, concurrent reads, dynamic registry, and full payload structure.
410
- - **Test count:** 1,246 tests across 56 files, all passing.
411
-
412
- ## [1.0.0] - 2026-02-22
413
-
414
- ### 🎉 First Stable Release — MVA Architecture for AI-Native MCP Servers
415
-
416
- This is the first stable release of `mcp-fusion`, introducing **MVA (Model-View-Agent)** — a new architectural pattern created by Renato Marinho at Vinkius Labs that replaces MVC for the AI era.
417
-
418
- ### Highlights
419
-
420
- - **MVA Architecture:** The Presenter replaces the View with a deterministic perception layer — domain rules, rendered charts, action affordances, and cognitive guardrails. Every response is structured. Every action is explicit.
421
- - **Presenter Engine:** `createPresenter()` with Zod schema validation, system rules (static & dynamic), UI blocks (ECharts, Mermaid, Summary), suggested actions (Agentic HATEOAS), cognitive guardrails (`.agentLimit()`), and Presenter composition via `.embed()`.
422
- - **Action Consolidation:** 5,000+ operations behind ONE tool via `module.action` discriminator. 10x fewer tokens. Hierarchical groups with infinite nesting.
423
- - **Two Builder APIs:** `defineTool()` (JSON-first, zero Zod imports) and `createTool()` (full Zod power). Both produce identical runtime behavior.
424
- - **tRPC-style Middleware:** Pre-compiled at build time with `defineMiddleware()` for context derivation. Apply globally or per-group. Zero runtime allocation.
425
- - **Self-Healing Errors:** `toolError()` with structured recovery hints and suggested retry arguments. AI agents self-correct without human intervention.
426
- - **FusionClient:** tRPC-style end-to-end type safety with `createFusionClient<TRouter>()`. Full autocomplete, compile-time checking, zero code generation.
427
- - **State Sync:** RFC 7234-inspired cache signals with `cacheSignal()` and `invalidates()` for cross-domain causal invalidation. Prevents temporal blindness.
428
- - **Cognitive Guardrails:** `.agentLimit(n)` prevents context DDoS. Reduces token costs by up to 100x on large datasets.
429
- - **TOON Encoding:** `toonSuccess()` reduces token count by ~40% vs standard JSON while remaining LLM-parseable.
430
- - **Zero-Overhead Observability:** `createDebugObserver()` with typed events. Absolutely zero runtime cost when disabled.
431
- - **Result Monad:** `succeed()` / `fail()` for composable, type-safe error handling with TypeScript type narrowing.
432
- - **Streaming Progress:** Generator handlers with `yield progress()` for real-time updates.
433
- - **Introspection:** `getActionNames()`, `getActionMetadata()`, `previewPrompt()` for runtime inspection and documentation generation.
434
- - **Typed Handler Args:** `defineTool()` handlers receive fully-typed `args` inferred from params. No casts needed.
435
- - **InferRouter:** Compile-time router type extraction with `InferRouter<typeof registry>`.
436
- - **Freeze-After-Build:** `Object.freeze()` after `.buildToolDefinition()` ensures immutable, deterministic tool definitions.
437
- - **Zod .strip() Security:** Only declared fields reach the AI. Internal fields silently removed.
438
- - **Tag Filtering:** Role-based tool exposure per session without code changes.
439
- - **Validation Error Formatter:** LLM-friendly Zod error messages with actionable correction guidance.
440
-
441
- ### Documentation
442
- - **23 documentation pages** covering every feature with code examples and real-world patterns.
443
- - **AEOS-optimized SEO:** 130+ unique FAQs across all pages as JSON-LD structured data, optimized for AI engines (ChatGPT, Perplexity, Gemini, Google SGE).
444
- - **Per-page Open Graph, TechArticle, and FAQPage JSON-LD** via `transformHead` hook.
445
- - **Global SoftwareSourceCode JSON-LD** with full metadata.
446
- - **Comparison table** showing 20+ differentiators vs raw MCP.
447
-
448
- ### Test Suite
449
- - **842 tests** across 36 files, all passing.
450
- - Covers: invariant contracts, security vectors, adversarial inputs, schema collisions, concurrent stress, E2E integration, streaming, FusionClient contracts, and Presenter composition.
451
-
452
- ## [0.10.0] - 2026-02-22
453
-
454
- ### Added
455
- - **`InferRouter<typeof registry>` — Compile-Time Router Type Extraction (Task 2.1):**
456
- - New `createTypedRegistry<TContext>()` curried factory that creates a `ToolRegistry` while preserving builder types for compile-time inference.
457
- - New `InferRouter<T>` type utility that extracts a fully typed `RouterMap` from a `TypedToolRegistry`, producing `{ 'toolName.actionName': ArgsType }` entries with zero runtime cost.
458
- - New `TypedToolRegistry<TContext, TBuilders>` interface for type-safe registry wrapping.
459
- - `GroupedToolBuilder` now carries `TName` (literal tool name) and `TRouterMap` (accumulated action entries) as phantom generics — each `.action()` call widens the type with the new action's key and args.
460
- - `createTool()` now captures the tool name as a string literal type for inference.
461
- - 19 new tests covering runtime behavior + type-level inference verification.
462
-
463
- - **Typed Handler Args via Schema Inference (Task 2.2):**
464
- - **`defineTool()` path:** `ActionDef` is now generic over `TParams`, so when `params: { name: 'string' }` is specified, the handler receives `args: { name: string }` — no casts needed. Works with shared params too: `args: InferParams<TParams> & InferParams<TShared>`.
465
- - **`createTool()` path:** Already supported via typed overload — verified with new compile-time tests.
466
- - Removed legacy double-cast pattern `(args as Record<string, unknown>)['message'] as string` from existing tests — `args.message` now works directly.
467
- - 6 new type-level tests verifying both `defineTool()` and `createTool()` paths.
468
-
469
- ### Changed
470
- - **`GroupedToolBuilder` generics:** Expanded from `<TContext, TCommon>` to `<TContext, TCommon, TName, TRouterMap>`. Fully backward-compatible — all new generics have default values.
471
- - **`ActionDef` generics:** Expanded from `<TContext, TArgs>` to `<TContext, TSharedArgs, TParams>`. Handler args are now conditionally typed based on params presence.
472
- - **`ToolConfig.actions` / `GroupDef.actions`:** Changed from `Record<string, ActionDef>` to mapped types `{ [K in string]: ActionDef }` for per-action param inference.
473
- - **Test count:** 842 tests across 36 files, all passing.
474
-
475
-
476
- ## [0.9.1] - 2026-02-22
477
-
478
- ### Fixed
479
- - **Sub-path export:** Added `"./client"` entry point in `package.json` exports so that the documented import (`@vinkius-core/mcp-fusion/client`) works natively.
480
- - **Action Group Guard:** Added runtime guard in `defineTool()` throwing an error if both `actions` and `groups` are used simultaneously, aligning with `GroupedToolBuilder` mutual exclusivity.
481
- - **Dead-code JSDoc stub:** Removed a malformed `export function defineTool(...)` stub that was incorrectly embedded inside the `defineTool` JSDoc text.
482
- - **Type Safety & Strictness:** Resolved all remaining TypeScript lint errors across the core builders and schema generators (`no-explicit-any`, `strict-boolean-expressions`, and index signature properties). Removed `eslint-disable` escape hatches in favor of strict type inference using `infer` and pure TypeScript solutions.
483
-
484
- ### Added
485
- - **API Parity (`omitCommon`):** `ActionDef` and `GroupDef` now accept `omitCommon?: string[]`, propagating it through `defineTool()` to the internal builders to match the builder API capability.
486
-
487
- ## [0.9.0] - 2026-02-22
488
-
489
- ### Added
490
- - **`ValidationErrorFormatter`:** New pure-function module that translates raw Zod validation errors into LLM-friendly directive correction prompts. Instead of `"Validation failed: email: Invalid"`, the LLM now receives actionable guidance: `"❌ Validation failed for 'users/create': • email — Invalid email. You sent: 'bad'. Expected: a valid email address. 💡 Fix the fields above and call the action again."` Supports all major Zod issue codes: `invalid_type`, `invalid_string` (email, url, uuid, datetime, regex, ip), `too_small`/`too_big` (number, string, array, date bounds), `invalid_enum_value` (lists valid options), `invalid_literal`, `unrecognized_keys`, and `invalid_union`.
491
- - **`omitCommon()`:** Surgical omission of common schema fields per action or group. Fields omitted are excluded from the LLM-facing schema and runtime validation. Supports per-action (`omitCommon: ['field']`) and group-level (`g.omitCommon('field')`) with automatic merge and deduplication.
492
- - **`previewPrompt()`:** Build-time MCP payload preview with token estimate. Returns the full tool definition including generated description and schema, with an approximate token count for LLM context budgeting.
493
- - **22 new tests** for `ValidationErrorFormatter` (17 unit + 5 integration).
494
- - **18 new tests** for `omitCommon` covering flat/group/merge/edge cases.
495
- - **Test count:** 819 tests across 35 files, all passing.
496
-
497
- ### Changed
498
- - **`ExecutionPipeline.validateArgs()`:** Now delegates to `formatValidationError()` instead of raw `ZodIssue.message` joining. Backward-compatible — existing assertions on `'Validation failed'` still match.
499
- - **SRP refactoring — `SchemaGenerator`:** Decomposed the monolithic `generateInputSchema` (120 lines, 4 responsibilities) into 5 focused helpers: `addDiscriminatorProperty()`, `buildOmitSets()`, `collectCommonFields()`, `collectActionFields()`, `applyAnnotations()`.
500
- - **SRP refactoring — `ToolDefinitionCompiler`:** Extracted `applyCommonSchemaOmit()` — pure function for surgical Zod `.omit()` with empty-schema guard — from `buildValidationSchema()`.
501
- - **SRP refactoring — `ActionGroupBuilder`:** Extracted `mapConfigToActionFields()` — shared `ActionConfig → InternalAction` mapper used by both `GroupedToolBuilder.action()` and `ActionGroupBuilder.action()`, eliminating 6-field duplication.
502
- - **`InternalAction`:** Added `omitCommonFields?: readonly string[]` for runtime omission tracking.
503
- - **`ActionConfig`:** Added `omitCommon?: string[]` to the public API.
504
-
505
- ## [0.6.0] - 2026-02-21
506
-
507
- ### Added
508
- - **Strict TypeScript flags:** `noUncheckedIndexedAccess` and `noFallthroughCasesInSwitch` enabled in `tsconfig.json`.
509
- - **ESLint type-aware rules:** Added `no-floating-promises`, `no-misused-promises`, `await-thenable`, `require-await`, `no-unnecessary-condition`, `consistent-type-imports`, and `consistent-type-exports`. Upgraded `no-explicit-any` from `warn` to `error`.
510
- - **`createIcon()` factory function:** Creates immutable `Icon` instances.
511
- - **`createToolAnnotations()` factory function:** Creates immutable `ToolAnnotations` instances.
512
- - **`createAnnotations()` factory function:** Creates immutable `Annotations` instances.
513
- - **Edge-case test suite (`EdgeCases.test.ts`):** 37 new tests covering `getActionMetadata()`, group-level middleware chains, frozen guard on all config methods, error paths (non-Error throws, middleware errors), `ResponseHelper` empty-string fallback, `ConverterBase` null filtering, custom discriminator routing, and description generator edge cases.
514
- - **Enterprise-grade test suites:** Added `InvariantContracts.test.ts` (56 tests: determinism, execution isolation, context immutability, handler chaos, unicode/binary boundaries, re-entrancy, concurrent registry stress, API equivalence, FusionClient contracts), `DeepVerification.test.ts`, `LargeScaleScenarios.test.ts`, `SecurityDeep.test.ts` (15 attack vectors), `McpServerAdapter.test.ts` (duck-type detection, detach lifecycle), `StreamingProgress.test.ts`, `EndToEnd.test.ts` (full-stack integration), and `ToonDescription.test.ts`.
515
- - **Test coverage improved:** 773 tests across 33 files, 100% function coverage. Comprehensive invariant, security, and adversarial testing.
516
-
517
- ### Changed
518
- - **BREAKING:** `Icon`, `ToolAnnotations`, and `Annotations` converted from mutable classes to `readonly` interfaces with factory functions (`createIcon()`, `createToolAnnotations()`, `createAnnotations()`). Use factory functions instead of `new Icon()`, `new ToolAnnotations()`, `new Annotations()`.
519
- - **Converter API simplified:** `ConverterBase` abstract methods renamed from `convertFromSingle`/`convertToSingle` to `convertFrom`/`convertTo`. Domain-specific converter bases (`GroupConverterBase`, `ToolConverterBase`, etc.) no longer have redundant bridge methods — they directly extend `ConverterBase<DomainType, DtoType>`.
520
- - **`ConverterBase.filter()`** now uses `NonNullable<T>` type predicate for better type narrowing in batch operations.
521
- - **`BaseModel`** properties (`name`, `nameSeparator`) made `readonly`.
522
- - **`InternalAction`** and **`ActionMetadata`** properties made `readonly` for immutability.
523
- - **`ToolRegistry._builders`** map made `readonly`.
524
- - All `import type` declarations enforced across the codebase via ESLint auto-fix.
525
- - Removed unnecessary `async` from `ToolRegistry` detach handler (fixes `require-await`).
526
- - Removed unnecessary truthy check in `GroupedToolBuilder._buildValidationSchema` (fixes `no-unnecessary-condition`).
527
-
528
- ### Fixed
529
- - **Non-null assertions eliminated:** All `!` operators in `GroupedToolBuilder.ts` replaced with explicit guards and checks.
530
- - **`McpServerLike` typing:** Replaced `any` with `never[]` for duck-typing safety in `ToolRegistry`.
531
-
532
- ## [0.5.0] - 2026-02-21
533
-
534
- ### Added
535
- - **`ConverterBase<TSource, TTarget>`:** Generic base class for all bidirectional converters. Consolidates the batch conversion logic (`map` + null filtering) that was previously duplicated across `GroupConverterBase`, `ToolConverterBase`, `PromptConverterBase`, `ResourceConverterBase`, and `ToolAnnotationsConverterBase`. Domain-specific converters now extend this base via bridge methods, eliminating the DRY violation while maintaining full backward compatibility.
536
- - **`removeFromArray<T>()` utility:** Extracted duplicated `indexOf` + `splice` pattern into a reusable generic helper in `src/utils.ts`. Used by `GroupItem`, `Prompt`, and `Group`.
537
- - **ESLint integration:** Added `eslint.config.js` (flat config) with `typescript-eslint` for type-aware linting. `npm run lint` / `npm run lint:fix` scripts available.
538
- - **`JsonSchemaObject` interface:** Typed the `zodToJsonSchema` output in `SchemaGenerator.ts`, eliminating raw `as Record<string, unknown>` casts.
539
-
540
- ### Changed
541
- - **BREAKING:** Java-style naming convention removed — all classes renamed to idiomatic TypeScript:
542
- - `AbstractBase` → `BaseModel` (file: `BaseModel.ts`)
543
- - `AbstractLeaf` → `GroupItem` (file: `GroupItem.ts`)
544
- - `AbstractConverter` → `ConverterBase` (file: `ConverterBase.ts`)
545
- - `AbstractGroupConverter` → `GroupConverterBase`
546
- - `AbstractToolConverter` → `ToolConverterBase`
547
- - `AbstractPromptConverter` → `PromptConverterBase`
548
- - `AbstractResourceConverter` → `ResourceConverterBase`
549
- - `AbstractToolAnnotationsConverter` → `ToolAnnotationsConverterBase`
550
- - `addLeaf()` / `removeLeaf()` → `addChild()` / `removeChild()` (private methods in `Group`)
551
- - **BREAKING:** `ToolAnnotationsConverter` API normalized — method overloading removed. Use `convertFromToolAnnotation()` / `convertToToolAnnotation()` for single items, and `convertFromToolAnnotations()` / `convertToToolAnnotations()` for batch. Previous overloaded signatures no longer exist.
552
- - **BREAKING:** `ToolAnnotationsConverterBase` abstract methods renamed from `convertFromToolAnnotationsSingle` / `convertToToolAnnotationsSingle` to `convertFromToolAnnotation` / `convertToToolAnnotation`.
553
- - `success('')` now returns `'OK'` instead of an empty string — prevents confusing empty MCP responses.
554
-
555
- ### Fixed
556
- - **`getGroupSummaries` dead field:** Removed unused `description` field from the return type — only `name` and `actions` were consumed.
557
- - **Unused import:** Removed dead `z` import from `GroupedToolBuilder.ts`.
558
- - **`ToolRegistry` typing:** Typed `callHandler` request parameter instead of `any`.
559
-
560
- ### Removed
561
- - **BREAKING:** `hashCode()` and `equals()` methods removed from `BaseModel`. These were Java `Object` patterns with no runtime utility in TypeScript/JavaScript — use `===` for identity comparison.
562
- - **BREAKING:** `toString()` methods removed from all domain model classes (`Group`, `Tool`, `Prompt`, `PromptArgument`, `Resource`, `Icon`, `ToolAnnotations`, `Annotations`). These used the Java `ClassName [field=value]` format — use `JSON.stringify()` or structured logging instead.
563
- - Redundant null/undefined constructor guard removed from `BaseModel` — TypeScript strict mode handles this at compile time.
564
-
565
- ## [0.4.0] - 2026-02-20
566
-
567
- ### Changed
568
- - **BREAKING:** Domain model migrated from Java-style getter/setter methods to idiomatic TypeScript public fields. All `getX()`/`setX()` methods removed — use direct property access instead (e.g. `tool.name` instead of `tool.getName()`, `tool.title = 'Deploy'` instead of `tool.setTitle('Deploy')`).
569
- - **BREAKING:** `getParentGroups()` and `getParentGroupRoots()` removed from `GroupItem`. Use `instance.parentGroups` directly; for roots use `instance.parentGroups.map(g => g.getRoot())`.
570
- - **BREAKING:** `getChildrenGroups()`, `getChildrenTools()`, `getChildrenPrompts()`, `getChildrenResources()`, `getParent()`, `setParent()` removed from `Group`. Use `instance.childGroups`, `instance.childTools`, `instance.childPrompts`, `instance.childResources`, `instance.parent` directly.
571
- - **BREAKING:** `Annotations` constructor parameters are now optional: `new Annotations()` is valid. Previously all three were required.
572
- - `ToolAnnotations` empty constructor removed — class is now a plain data class with public fields.
573
-
574
- ### Fixed
575
- - **Comma operator anti-pattern:** Replaced obscure `indexOf === -1 && (push, true)` pattern with readable `includes()` + explicit return in `GroupItem.addParentGroup()` and `Prompt.addPromptArgument()`.
576
- - **Unused parameter removed:** `sb: string` parameter in `Group.getFullyQualifiedNameRecursive()` was a Java `StringBuilder` remnant — removed.
577
- - **Dead import removed:** Unused `import { z } from 'zod'` in `ToonDescriptionGenerator.ts`.
578
-
579
- ### Documentation
580
- - `docs/api-reference.md` rewritten for new public-field API with usage examples.
581
-
582
- ## [0.2.1] - 2026-02-17
583
-
584
- ### Fixed
585
- - **O(1) Action Routing:** Replaced `Array.find()` linear scan with `Map.get()` in `execute()`. The `_actionMap` is built once during `buildToolDefinition()` and reused across all invocations — fulfilling the README's O(1) performance promise.
586
-
587
- ### Added
588
- - **Build-Time Schema Collision Detection:** `SchemaGenerator` now calls `assertFieldCompatibility()` to detect incompatible field types across actions at build time. The 3-layer check hierarchy detects base type mismatches (e.g. `string` vs `number`), enum presence conflicts (e.g. `z.enum()` vs `z.string()`), and enum value-set differences — while correctly treating `integer` as compatible with `number`. Throws actionable errors with field name, action key, conflicting types, and guidance.
589
- - **`SchemaUtils.assertFieldCompatibility()`:** Extracted collision detection into `SchemaUtils` as a pure, reusable helper alongside the existing `getActionRequiredFields()`. Keeps `SchemaGenerator` focused on generation, not validation.
590
- - **`SchemaCollision.test.ts`:** 50 dedicated tests covering all primitive type pairs, enum conflicts, integer/number compatibility, nullable edge cases, commonSchema vs action conflicts, hierarchical groups, multi-action chains, error message quality, and runtime behavior after valid builds.
591
-
592
- ## [0.2.0] - 2026-02-12
593
-
594
- ### Changed
595
- - **BREAKING:** `zod` moved from `dependencies` to `peerDependencies` with range `^3.25.1 || ^4.0.0`. Projects using zod 4 no longer hit version conflicts.
596
- - **BREAKING:** `@modelcontextprotocol/sdk` moved from `dependencies` to `peerDependencies`. Projects already have it installed — no duplication.
597
-
598
- ### Fixed
599
- - GitHub URLs in `package.json` and `CONTRIBUTING.md` corrected from `vinkius-core` to `vinkius-labs`.
600
-
601
- ## [0.1.1] - 2026-02-12
602
-
603
- ### Added
604
- - Scaling guide (`docs/scaling.md`) — technical deep-dive into how grouping, tag filtering, TOON compression, schema unification, Zod `.strip()`, and structured errors prevent LLM hallucination at scale.
605
- - Link to scaling guide in README documentation table and Token Management section.
606
-
607
- ## [0.1.0] - 2026-02-12
608
-
609
- ### Added
610
- - Core framework with `Tool`, `Resource`, and `Prompt` abstractions.
611
- - `Group` class for logical organization of MCP capabilities.
612
- - Discriminator-based routing for efficient tool selection.
613
- - Strongly typed arguments and outputs using Zod.
614
- - Initial project configuration and CI/CD setup.
615
- - Basic documentation structure.
616
-