fix(tools): export the promptTemplate types from @supermemory/tools/ai-sdk - #1574
Open
Agnik47 wants to merge 1 commit into
Open
fix(tools): export the promptTemplate types from @supermemory/tools/ai-sdk#1574Agnik47 wants to merge 1 commit into
Agnik47 wants to merge 1 commit into
Conversation
…i-sdk
The documented custom prompt-template example does not compile:
import { withSupermemory, type MemoryPromptData } from "@supermemory/tools/ai-sdk"
// ^ TS2305: no exported member 'MemoryPromptData'
`src/ai-sdk.ts` re-exported only `withSupermemory` from `./vercel`, dropping
`MemoryPromptData`, `PromptTemplate` and `WithSupermemoryOptions`. `./vercel`
is not listed in the package's `exports` map, so those types were unreachable
from anywhere in the published package -- every `promptTemplate` snippet in
packages/tools/README.md and apps/docs/integrations/ai-sdk.mdx fails to
typecheck as written.
The sibling entry points already do this: `@supermemory/tools/mastra` and
`@supermemory/tools/voltagent` both export `PromptTemplate` and
`MemoryPromptData`. The AI SDK entry point was the only one that did not.
`promptTemplate` has been documented for the AI SDK since supermemoryai#660 and the type
has never been reachable from it.
Adds a regression test that imports the three types and exercises the
documented template, so the re-export cannot be dropped again without
`check-types` failing.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NhupP1YqDMS3K1xouqwUnf
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
The documented custom prompt-template example for the AI SDK integration does not compile:
packages/tools/src/ai-sdk.tsre-exported onlywithSupermemoryfrom./vercel, dropping the three types that entry point's own options object is built from:MemoryPromptData— TS2305PromptTemplate— TS2305WithSupermemoryOptions— TS2724./vercelis not listed in the package'sexportsmap, so there is nowhere else a consumer can reach them from. EverypromptTemplatesnippet that documents this entry point fails to typecheck as written:packages/tools/README.md:232apps/docs/integrations/ai-sdk.mdx:97packages/docs-test/tests/integrations/ai-sdk.ts:9The sibling entry points already export these —
@supermemory/tools/mastra(src/mastra/index.ts) and@supermemory/tools/voltagentboth listPromptTemplateandMemoryPromptData. The AI SDK entry point was the only one that did not.promptTemplatehas been documented for it since #660, and the type has never been reachable from it.Fix
Widen the existing re-export to cover the middleware's public types:
Type-only addition — no runtime change, no new API surface (all three are already exported from
./vercel).Regression test
packages/tools/src/ai-sdk-exports.test.tsimports the three types and exercises the documented template, so the re-export cannot be dropped again withoutcheck-typesfailing.Testing
tsc --noEmitinpackages/tools— before: 151 errors, 3 of them the ones a user hits when copying the documented example:test/, tracked inbun run check-typeshas never passed on main —@repo/webreports ~90 errors #1544 /@supermemory/toolsfailscheck-types: 31 errors intest/, including an import of a file that no longer exists #1545).vitest runover the pure unit suites inpackages/tools/src— 36/36 pass (ai-sdk-exports,tools-shared,tool-operations,shared/memory-client,claude-memory).src/tools.test.tsis excluded because it requires liveSUPERMEMORY_API_KEY/OPENAI_API_KEY.tsdownbuild — emitteddist/ai-sdk.d.tsnow carries the types:Note
CI's type-check job currently filters to
@supermemory/ai-sdkand@supermemory/memory-graph, so this guard won't run in CI until@supermemory/toolsis included there (#1436 moves in that direction). It does run under the package's ownbun run check-types.