Duck-type defineTool/GrantStore across @intx interface versions - #33
Merged
Conversation
…llow-up) Consumers with a newer @intx/agent (static definitions on defineTool options) or @intx/authz (collectGrantsInChain on GrantStore) than this package's own pinned dependency were failing to typecheck the raw source pulled in transitively through the resident distiller's export of the memory tool factories. Both fixes bind the object to a named const before handing it to the typed API instead of a fresh literal, so normal structural (duck-typed) assignment applies rather than TypeScript's excess-property check on literals — the object satisfies either interface shape, and an older caller simply never reads the extra field.
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.
Follow-up to #31. Consuming this package as a git dependency in a monorepo whose vendored
@intx/agent/@intx/authzare ahead of the last npm publish this package depends on (0.2.2) surfaced two real typecheck failures once the resident distiller's export graph pulledtools/install.tsandports/writable-grant-store.tsinto that consumer's compile:defineTool's options in the newer interface add a staticdefinitionsfield; this package's pinned version predates it.GrantStorein the newer interface addscollectGrantsInChain; this package's pinned version predates it.Both fixes bind the object to a named
constbefore passing it to the typed API instead of a fresh object literal, so normal structural (duck-typed) parameter/return assignment applies instead of TypeScript's excess-property check on literals. The object satisfies either interface shape at compile time; at runtime an older caller simply never reads the extra field. No behavior change —bun test(401 pass) andtsc --noEmitboth still green against this package's own pinned dependencies.