fix(delegate): accept pi-ai 0.84 ProviderHeaders (null-valued headers filtered) - #26
Merged
Merged
Conversation
… filtered before fetch)
pi-ai 0.84 widened ProviderHeaders from Record<string, string> to
Record<string, string | null>. callVisionModel and callWithRetryAndFallback
now accept the canonical ProviderHeaders type; the single header-merge site
filters null values ("unset") before fetch's HeadersInit, which rejects null.
Regression test pins both the filtering and the widened signature.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
pi-ai 0.84 widened
ProviderHeadersfromRecord<string, string>toRecord<string, string | null>. vision's delegate passesauth.headers(typedProviderHeaders | undefined) intocallVisionModel/callWithRetryAndFallback, whose params still declaredRecord<string, string> | undefined— a hard typecheck failure for any consumer compiling against pi-ai 0.84 (found via armory-fleet's pi 0.84.4 alignment, where vision 0.5.2 is the only red in the suite).vision ships raw
.ts, soskipLibCheckcannot mask this — downstream typechecks compile these lines directly.Fix
ProviderHeaders | undefined(type imported from pi-ai, which vision already depends on)nullvalues beforefetch— null means "unset" in the widened type, andfetch'sHeadersInitrejects null values, so this is the semantic fix, not just a type patchVerification
pnpm typecheckgreenpnpm test:run354/354 (new test RED before fix on both axes — runtime assert + TS2322 on the null literal — then GREEN after)