Skip to content

feat(ai-sdk): re-export 7-tool surface - #1433

Open
Dhravya wants to merge 2 commits into
feat/tools-seven-tool-parityfrom
feat/ai-sdk-tool-reexports
Open

feat(ai-sdk): re-export 7-tool surface#1433
Dhravya wants to merge 2 commits into
feat/tools-seven-tool-parityfrom
feat/ai-sdk-tool-reexports

Conversation

@Dhravya

@Dhravya Dhravya commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Re-export full tool set from @supermemory/tools/ai-sdk
  • Add unit tests for tool re-exports

Stacked on #1432

Test plan

  • bun run test:unit in packages/ai-sdk

Made with Cursor

…ools

Thin @supermemory/ai-sdk package now mirrors the canonical 7-tool surface
with updated tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
@claude

claude Bot commented Aug 8, 2026

Copy link
Copy Markdown

Claude finished @Dhravya's task in 1m 11s —— View job


Reviewing PR #1433

  • Fetch and analyze PR diff
  • Review changed files for bugs and security issues
  • Check surrounding code context
  • Submit review feedback

Overview: This PR replaces inline tool implementations in @supermemory/ai-sdk with re-exports from @supermemory/tools/ai-sdk, adding 5 new tools to the surface.

Issues found:

Cursor Bugbot correctly identified that includeFullDocs is accepted in the searchMemories schema but not passed to client.search() in packages/tools/src/ai-sdk.ts:59-65. I verified this — the parameter is destructured on line 55 but never used. This bug exists in the base branch (feat/tools-seven-tool-parity) and should be fixed in PR #1432, not here. This PR simply re-exports whatever the shared package provides.

The other review comments are style/linting concerns (type assertions in tests), not bugs that would cause production incidents.

Score: 8/10

The code change is straightforward and the test coverage looks good. The re-export itself is correct. Fix the includeFullDocs bug in the base PR (#1432) before merging this stack.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9c3f84b. Configure here.

export {
supermemoryTools,
searchMemoriesTool,
addMemoryTool,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Search ignores includeFullDocs

Medium Severity

Replacing the inline tools with re-exports from @supermemory/tools/ai-sdk changes searchMemories: the tool schema still accepts includeFullDocs, but the shared implementation never passes it to client.search, unlike the removed @supermemory/ai-sdk code that forwarded it to search. Callers and models cannot control full-document inclusion in results.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9c3f84b. Configure here.

Comment on lines +12 to +13
const testApiKey = process.env.SUPERMEMORY_API_KEY as string
const testOpenAIKey = process.env.OPENAI_API_KEY as string

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variables testApiKey and testOpenAIKey use type assertions (as string) to cast string | undefined to string. According to the style guide rule on Type assertions and casting, unnecessary type assertions should be avoided and type annotations should be used instead of assertions for object literals. While this is not an object literal, the spirit of the rule is to prefer type annotations over assertions. More importantly, using as string here is unsafe — it suppresses the undefined possibility without a runtime check. Consider using a non-null assertion only after a guard, or restructuring so the type is narrowed properly (e.g., via a runtime check before assignment).

Suggested change
const testApiKey = process.env.SUPERMEMORY_API_KEY as string
const testOpenAIKey = process.env.OPENAI_API_KEY as string
const testApiKey = process.env.SUPERMEMORY_API_KEY ?? (() => { throw new Error("SUPERMEMORY_API_KEY is not set") })()
const testOpenAIKey = process.env.OPENAI_API_KEY ?? (() => { throw new Error("OPENAI_API_KEY is not set") })()

Spotted by Graphite (based on custom rule: TypeScript style guide (Google))

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@Dhravya
Dhravya force-pushed the feat/ai-sdk-tool-reexports branch from acb8dc0 to 9c3f84b Compare August 8, 2026 02:47
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-mcp b69a28d Aug 18 2026, 03:28 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app b69a28d Commit Preview URL

Branch Preview URL
Aug 18 2026, 03:29 PM

Dhravya commented Aug 8, 2026

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label Main to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview: This PR replaces inline tool implementations in @supermemory/ai-sdk with re-exports from @supermemory/tools/ai-sdk, adding 5 new tools to the surface.

Issues found:

Cursor Bugbot correctly identified that includeFullDocs is accepted in the searchMemories schema but not passed to client.search() in packages/tools/src/ai-sdk.ts:59-65. I verified this — the parameter is destructured on line 55 but never used. This bug exists in the base branch (feat/tools-seven-tool-parity) and should be fixed in PR #1432, not here.

The re-export itself is correct — this PR simply surfaces whatever the shared package provides.

Score: 8/10

The code change is straightforward and the test coverage looks good. Fix the includeFullDocs bug in the base PR before merging this stack.

Comment on lines +5 to +17
export {
supermemoryTools,
searchMemoriesTool,
addMemoryTool,
getProfileTool,
documentListTool,
documentDeleteTool,
documentAddTool,
memoryForgetTool,
getContainerTags,
} from "@supermemory/tools/ai-sdk"

export type { SupermemoryToolsConfig } from "@supermemory/tools"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The re-export from '@supermemory/tools/ai-sdk' introduces TypeScript type errors because the tool definitions in @supermemory/tools use Zod schemas that are incompatible with the AI SDK's FlexibleSchema type. Until @supermemory/tools fixes its type issues, consider keeping the original implementation inline in this file (using jsonSchema() wrappers from 'ai' as was done before) rather than delegating to @supermemory/tools/ai-sdk. Alternatively, add explicit type casts or use 'as any' temporarily, but the proper fix is to ensure @supermemory/tools/src/ai-sdk.ts uses jsonSchema() from 'ai' to wrap schemas instead of raw Zod schemas, and ensures execute() return types and tool() call signatures match what AI SDK v5 expects (including totalTokens and state fields).

Spotted by Graphite (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

2 participants