Skip to content

fix(tools): export the promptTemplate types from @supermemory/tools/ai-sdk - #1574

Open
Agnik47 wants to merge 1 commit into
supermemoryai:mainfrom
Agnik47:fix/ai-sdk-prompt-template-types
Open

fix(tools): export the promptTemplate types from @supermemory/tools/ai-sdk#1574
Agnik47 wants to merge 1 commit into
supermemoryai:mainfrom
Agnik47:fix/ai-sdk-prompt-template-types

Conversation

@Agnik47

@Agnik47 Agnik47 commented Aug 21, 2026

Copy link
Copy Markdown

Problem

The documented custom prompt-template example for the AI SDK integration does not compile:

import { withSupermemory, type MemoryPromptData } from "@supermemory/tools/ai-sdk"
// TS2305: Module '"@supermemory/tools/ai-sdk"' has no exported member 'MemoryPromptData'.

packages/tools/src/ai-sdk.ts re-exported only withSupermemory from ./vercel, dropping the three types that entry point's own options object is built from:

  • MemoryPromptData — TS2305
  • PromptTemplate — TS2305
  • WithSupermemoryOptions — TS2724

./vercel is not listed in the package's exports map, so there is nowhere else a consumer can reach them from. Every promptTemplate snippet that documents this entry point fails to typecheck as written:

  • packages/tools/README.md:232
  • apps/docs/integrations/ai-sdk.mdx:97
  • packages/docs-test/tests/integrations/ai-sdk.ts:9

The sibling entry points already export these — @supermemory/tools/mastra (src/mastra/index.ts) and @supermemory/tools/voltagent both list PromptTemplate and MemoryPromptData. The AI SDK entry point was the only one that did not. promptTemplate has 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:

export {
	withSupermemory,
	type WithSupermemoryOptions,
	type PromptTemplate,
	type MemoryPromptData,
} from "./vercel"

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.ts imports the three types and exercises the documented template, so the re-export cannot be dropped again without check-types failing.

Testing

  • tsc --noEmit in packages/tools — before: 151 errors, 3 of them the ones a user hits when copying the documented example:
    src/ai-sdk-exports.test.ts(3,7): error TS2305: Module '"./ai-sdk"' has no exported member 'MemoryPromptData'.
    src/ai-sdk-exports.test.ts(4,7): error TS2305: Module '"./ai-sdk"' has no exported member 'PromptTemplate'.
    src/ai-sdk-exports.test.ts(5,7): error TS2724: '"./ai-sdk"' has no exported member named 'WithSupermemoryOptions'.
    
    After: 148 errors, none from the touched files. The remaining 148 are pre-existing and unrelated (zod v3/v4 resolution plus test/, tracked in bun run check-types has never passed on main — @repo/web reports ~90 errors #1544 / @supermemory/tools fails check-types: 31 errors in test/, including an import of a file that no longer exists #1545).
  • vitest run over the pure unit suites in packages/tools/src — 36/36 pass (ai-sdk-exports, tools-shared, tool-operations, shared/memory-client, claude-memory). src/tools.test.ts is excluded because it requires live SUPERMEMORY_API_KEY / OPENAI_API_KEY.
  • tsdown build — emitted dist/ai-sdk.d.ts now carries the types:
    export { type MemoryPromptData, type PromptTemplate, type WrapVercelLanguageModelOptions as WithSupermemoryOptions, ... }
    
  • Biome — clean on both files.

Note

CI's type-check job currently filters to @supermemory/ai-sdk and @supermemory/memory-graph, so this guard won't run in CI until @supermemory/tools is included there (#1436 moves in that direction). It does run under the package's own bun run check-types.

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant