From b34e2cc4e3155483a5b6d68596d8be57b5dbd27d Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Thu, 28 May 2026 21:06:47 -0300 Subject: [PATCH] fix(mitm): align hookBufferUpdate caller type with sourceModel runtime (R4 #4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The local type annotation for `recordRequestStart` in `loadAgentBridgeHook` omitted `sourceModel`, but the call site at line 217-222 passes `sourceModel: this.extractSourceModel(body)` — which works at runtime (JavaScript ignores extra properties) but a future strict-mode caller relying on the narrower local type would silently drop the field. Add `sourceModel?: string | null` to the local recordRequestStart type to match the actual `agentBridgeHook.recordRequestStart` shape. --- src/mitm/handlers/base.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mitm/handlers/base.ts b/src/mitm/handlers/base.ts index 6b1e45023e..bb98a76706 100644 --- a/src/mitm/handlers/base.ts +++ b/src/mitm/handlers/base.ts @@ -53,6 +53,7 @@ async function loadAgentBridgeHook(): Promise<{ body: Buffer; agentId: AgentId; mappedModel: string; + sourceModel?: string | null; }) => Promise; recordRequestComplete?: ( intercepted: InterceptedRequest,