Skip to content

fix(ai-sdk): align ReflectBasedOn types with OpenAPI spec#1163

Merged
nicoloboschi merged 1 commit intomainfrom
fix/ai-sdk-reflect-type-drift
Apr 20, 2026
Merged

fix(ai-sdk): align ReflectBasedOn types with OpenAPI spec#1163
nicoloboschi merged 1 commit intomainfrom
fix/ai-sdk-reflect-type-drift

Conversation

@nicoloboschi
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes ReflectBasedOn.mental_models inline type from {id, name, content?} to {id, text, context?} to match ReflectMentalModel in the OpenAPI spec and @vectorize-io/hindsight-client
  • Adds missing name field to ReflectBasedOn.directives to match ReflectDirective in the OpenAPI spec

This eliminates the need for as unknown as HindsightClient cast when calling createHindsightTools(), and fixes runtime undefined when consumers access mental_models[].text.

Fixes #1133

Test plan

  • npm run build passes in hindsight-integrations/ai-sdk
  • Lint passes
  • Verify createHindsightTools({ client }) compiles without cast when client is a HindsightClient from @vectorize-io/hindsight-client

ReflectBasedOn.mental_models used {id, name, content?} but the server
emits {id, text, context?}. ReflectBasedOn.directives was missing the
name field. This caused type incompatibility with HindsightClient from
@vectorize-io/hindsight-client, requiring an unsafe cast.
@nicoloboschi nicoloboschi merged commit 3d6b380 into main Apr 20, 2026
43 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant