Skip to content

Vercel AI SDK backfilling#769

Open
sreedharsreeram wants to merge 13 commits intomainfrom
back-filling-vercel
Open

Vercel AI SDK backfilling#769
sreedharsreeram wants to merge 13 commits intomainfrom
back-filling-vercel

Conversation

@sreedharsreeram
Copy link
Copy Markdown
Contributor

No description provided.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 6, 2026

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 730a790 Commit Preview URL

Branch Preview URL
Apr 02 2026, 10:51 PM

Copy link
Copy Markdown
Member

@MaheshtheDev MaheshtheDev left a comment

Choose a reason for hiding this comment

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

@sreedharsreeram please update the package version and update the documentation for this packages with these new tools

Copy link
Copy Markdown
Contributor Author

sreedharsreeram commented Mar 9, 2026


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.

Copy link
Copy Markdown
Contributor Author

@sreedharsreeram please update the package version and update the documentation for this packages with these new tools

​Done! Please review

Copy link
Copy Markdown
Member

@sreedharsreeram please fix merge conflicts

@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 2/5 - Changes Needed

Not safe to merge — the new withSupermemory signature in packages/tools/src/vercel/index.ts introduces a breaking API change by inserting conversationId as a required positional parameter between containerTag and options, which means all existing callers silently pass their options object as the conversationId string argument with no type error at the call site. This PR does deliver meaningful new functionality — hybrid and document-based RAG search modes, four new AI SDK tool factories, and updated documentation — but the backward-incompatible signature change without a major version bump or deprecation path is a correctness issue that will silently corrupt behavior for existing consumers.

Key Findings:

  • In packages/tools/src/vercel/index.ts, inserting conversationId as a required positional parameter between containerTag and options is a breaking change: existing callers using withSupermemory(model, containerTag, options) will silently pass their options object as conversationId, causing runtime misbehavior (wrong conversationId, options ignored) with no TypeScript error at the call site depending on overload resolution.
  • The new SearchMode type ('memories' | 'hybrid' | 'documents') and searchLimit addition to SupermemoryBaseOptions in types.ts appear well-scoped, but the routing logic in buildMemoriesText that switches on searchMode should be verified to handle undefined/default cases gracefully to avoid silent fallthrough.
  • The PR bumps to v1.5.0 (minor version), but introducing a positional parameter break in a public API warrants a major version bump under semver — shipping this as a minor version understates the compatibility impact for downstream consumers.
Files requiring special attention
  • packages/tools/src/vercel/index.ts
  • packages/tools/src/memory-client.ts
  • packages/tools/src/types.ts

Copy link
Copy Markdown

@entelligence-ai-pr-reviews entelligence-ai-pr-reviews bot left a comment

Choose a reason for hiding this comment

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

🔍 Duplicate Code Detected

Found 2 duplicate function(s) in this PR. Consider consolidating to reduce code duplication.

@claude
Copy link
Copy Markdown

claude bot commented Apr 1, 2026

Claude finished @sreedharsreeram's task in 1m 25s —— View job


PR Review Complete

  • Fetch PR diff and analyze changes
  • Review existing comments to avoid duplicates
  • Check critical files for bugs, security issues, and breaking changes
  • Submit review with findings

Summary: This PR adds hybrid/documents search modes for RAG applications. The concerns raised by earlier reviewers have been addressed:

  • ReferenceError bug — Fixed. rawSearchResults is now declared at function scope.
  • Breaking API change — Not an issue. conversationId remains optional; there's just a new validation when addMemory: "always".
  • Documentation — Updated correctly.

Score: 9/10 — Ready to ship.

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Overview: Adds hybrid/documents search modes for RAG and makes conversationId a required parameter.

Issues found:

  1. Critical: ReferenceError in memory-client.ts:329memoriesResponse is referenced outside its scope. When useHybridSearch is true (hybrid/documents mode), this will throw a ReferenceError at runtime since memoriesResponse is only defined in the else branch.

  2. Documentation mismatch — All README examples use the old 3-argument signature withSupermemory(model, containerTag, options) but the API now requires 4 arguments with conversationId as required positional parameter.

  3. Breaking change flagged by other reviewers — The withSupermemory signature change from (model, containerTag, options?) to (model, containerTag, conversationId, options?) is a breaking change that should warrant a major version bump (2.0.0), not minor (1.5.0).

Score: 5/10

The hybrid search feature looks well-designed, but the ReferenceError will crash any usage of hybrid/documents mode. This needs to be fixed before merge.

Prefix unused variables with underscore and fix formatting in memory-client.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 1/5 - Blocking Issues

Not safe to merge — the withSupermemory function signature change in packages/tools/src/vercel/index.ts introduces a silent, destructive breaking change: promoting conversationId to a required positional 3rd argument means all existing callers using the 3-arg form withSupermemory(model, tag, options) will silently pass their WrapVercelLanguageModelOptions object as the conversationId string parameter, corrupting the conversation ID with [object Object] and discarding all option overrides without any error or warning. The PR does add valuable SearchMode and searchLimit capabilities with a sensible hybrid/documents branch in buildMemoriesText, but the API breakage is critical enough to block merge. This same concern was flagged in a previous unresolved review comment and remains unaddressed, confirming the issue is known but not fixed.

Key Findings:

  • In packages/tools/src/vercel/index.ts, inserting conversationId: string as the 3rd positional argument between containerTag and options is a breaking API change: callers on the prior 3-arg signature will pass their options object where a string is expected, silently coercing it to [object Object] as the conversationId and losing all option configuration with no runtime error.
  • The breaking change is doubly dangerous because TypeScript may not catch it at call sites if conversationId can accept any or if the options object is typed loosely, meaning the corruption can reach production silently across all existing integrations.
  • A pre-existing unresolved review comment from a prior review cycle explicitly called out this same conversationId positional-argument breakage in withSupermemory, and the issue has not been resolved before this re-review, indicating the risk is acknowledged but the fix (e.g., keeping conversationId inside WrapVercelLanguageModelOptions or making it optional with a default) has not been applied.
Files requiring special attention
  • packages/tools/src/vercel/index.ts
  • packages/tools/src/memory-client.ts
  • packages/tools/src/types.ts

@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 1/5 - Blocking Issues

Not safe to merge — this PR introduces two critical runtime-breaking bugs that will cause immediate failures in production. In memory-client.ts, memoriesResponse is declared with const inside an else block, making it inaccessible in the subsequent promptData construction when the if (useHybridSearch && queryText) branch executes, which will throw a ReferenceError at runtime. Simultaneously, in vercel/index.ts, inserting conversationId as a new required positional parameter between containerTag and options silently breaks every existing caller of withSupermemory(model, containerTag, options) — their options object is now consumed as conversationId, causing type mismatches and incorrect behavior with no compile-time error for JavaScript callers. While the PR's goal of adding hybrid search capabilities and a SearchMode union type is a meaningful feature addition, these two defects must be resolved before any merge can be considered.

Key Findings:

  • In memory-client.ts, memoriesResponse declared with const inside the else block is out of scope when the hybrid search if branch runs, causing a guaranteed ReferenceError: memoriesResponse is not defined crash on any call that takes the hybrid search path.
  • In vercel/index.ts, adding conversationId as a positional parameter between containerTag and options is a breaking API change — all existing callers invoking withSupermemory(model, containerTag, options) will silently pass their options object as the conversationId string argument, leading to wrong behavior and hard-to-debug runtime errors.
  • Both bugs are in the core execution paths of the new feature, meaning the hybrid search functionality is effectively non-functional and the Vercel middleware refactor is backwards-incompatible as written.
  • 4 previous unresolved comment(s) likely resolved in latest diff (score-only signal; thread status unchanged)
Files requiring special attention
  • packages/tools/src/shared/memory-client.ts
  • packages/tools/src/vercel/index.ts

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Overview: Adds hybrid/documents search modes for RAG and makes conversationId a required parameter.

Issues found:

  1. Critical: ReferenceError in memory-client.ts:335memoriesResponse is referenced outside its scope. When useHybridSearch is true (hybrid/documents mode), this will throw a ReferenceError at runtime since memoriesResponse is only defined in the else block at line 274.

  2. Documentation mismatch — All README examples (lines 193, 220) use the signature without the now-required conversationId field. Since options is now required with conversationId: string, examples like withSupermemory(openai("gpt-4"), "user-123", { mode: "full" }) will fail TypeScript compilation.

  3. Breaking change — Making options required and conversationId required within it is a breaking change. TypeScript will catch this at compile time (not a silent failure), but it warrants a major version bump (2.0.0) rather than minor (1.5.0).

Score: 4/10

The hybrid search feature is well-designed, but the ReferenceError will crash any usage of hybrid/documents mode. This must be fixed before merge.

@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 1/5 - Blocking Issues

Not safe to merge — this PR contains a confirmed runtime ReferenceError in memory-client.ts where memoriesResponse is declared inside an else block but referenced at line 328 outside that block, meaning the hybrid search code path crashes unconditionally. Beyond this new critical bug, four unresolved correctness issues in packages/tools/src/vercel/index.ts document that promoting conversationId to a required positional parameter between containerTag and options constitutes a breaking API change that will silently break all existing callers without a major version bump. The PR does introduce genuinely useful functionality — hybrid search mode, configurable searchLimit, and SearchMode typing — but the scope of breakage makes this unshippable in its current state.

Key Findings:

  • memoriesResponse is scoped inside the else branch in buildMemoriesText (or equivalent function in memory-client.ts) but read unconditionally at line 328 after the if/else block, producing a ReferenceError at runtime on every hybrid search invocation — the core new feature of this PR is broken.
  • In packages/tools/src/vercel/index.ts, conversationId was removed from WrapVercelLanguageModelOptions and made a required positional 3rd argument to withSupermemory, breaking all existing callers using the previous 2-arg or options-bag form without a corresponding major version change to signal the breaking API contract.
  • The duplicate unresolved comments about withSupermemory's signature change indicate this breaking change concern was raised in a previous review cycle and was never resolved, suggesting the author has not addressed reviewer feedback on a correctness-critical issue.
  • Releasing as 1.5.0 (minor bump) is inconsistent with the breaking signature change to withSupermemory, which requires a major version bump under semver; downstream consumers relying on automated updates could have their builds broken silently.
  • 2 previous unresolved comment(s) likely resolved in latest diff (score-only signal; thread status unchanged)
Files requiring special attention
  • packages/tools/src/shared/memory-client.ts
  • packages/tools/src/vercel/index.ts
  • packages/tools/src/shared/types.ts

sreedharsreeram and others added 2 commits March 31, 2026 19:24
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 4/5 - Mostly Safe

Likely safe but review recommended — this PR introduces SearchMode typing and supermemoryHybridSearch in memory-client.ts with a clear branching strategy in buildMemoriesText, and the automated review found no flagged issues across the 6 reviewed files. The refactoring of conversationId to optional and the addition of formatSearchResults as a helper appear well-scoped, though 2 of 8 changed files were not reviewed, leaving a small blind spot. The PR is largely clean and achieves its stated goal of hybrid search support without introducing obvious regressions.

Key Findings:

  • No automated review comments were generated across 6 of 8 reviewed files, suggesting the core logic in memory-client.ts, types.ts, and the Vercel middleware refactor is structurally sound.
  • The branching in buildMemoriesText between profile-based and hybrid search paths is a meaningful control-flow change — while no bugs were flagged, this kind of conditional dispatch warrants human review to confirm edge cases (e.g., when searchMode defaults or is undefined) are handled correctly.
  • 2 files out of 8 changed were not covered by the automated review, meaning there is incomplete visibility into the full scope of changes — this is a minor but real gap in confidence.
  • Making conversationId optional is a subtle interface contract change that could silently affect downstream consumers if they relied on it being required — worth confirming no callers are broken.
Files requiring special attention
  • memory-client.ts
  • types.ts

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Overview: Adds hybrid/documents search modes for RAG and makes conversationId required.

Good news: The ReferenceError bug flagged by earlier reviewers has been fixed in this version. The code now properly declares rawSearchResults at function scope (line 216), avoiding the scoping issue where memoriesResponse was referenced outside its else block.

Issues found:

  1. Documentation examples missing required field — All new examples in README.md and user-profiles.mdx are missing the now-required conversationId field. Users following the docs will get TypeScript errors. See inline comments for suggested fixes.

  2. Breaking API change — Making options required and conversationId required within it changes the public API signature from withSupermemory(model, tag, options?) to withSupermemory(model, tag, options) where options must include conversationId. This is technically a breaking change that would warrant a major version bump (2.0.0) under strict semver. However, TypeScript will catch this at compile time (not a silent failure), so the impact is manageable.

Score: 8/10

The hybrid search feature is well-implemented and the previous scoping bug has been fixed. The only blocking issues are the documentation examples that won't compile. Once those are updated, this is good to ship.

@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 4/5 - Mostly Safe

Safe to merge — the PR cleanly introduces hybrid RAG search support through well-scoped additions to SupermemoryBaseOptions and a new supermemoryHybridSearch function targeting /v4/search, with no review comments flagging logic bugs, security issues, or correctness concerns. The SearchMode type union and the branching logic in buildMemoriesText appear straightforward and the version bump to v1.5.0 is appropriate for the new public API surface. No issues were identified across the 6 reviewed files, and the 2 unreviewed files represent a minor coverage gap that doesn't appear to involve critical paths based on the PR summary.

Key Findings:

  • The new SearchMode type ('memories' | 'hybrid' | 'documents') and optional searchMode/searchLimit fields on SupermemoryBaseOptions are additive and backward-compatible, posing no regression risk to existing consumers.
  • supermemoryHybridSearch introduces a new /v4/search endpoint integration; no review comments flagged missing error handling or auth issues in this function, suggesting it follows the existing client patterns correctly.
  • Two of eight changed files were not reviewed, which represents a minor blind spot — if these files contain the tool registration or export surface, they could harbor integration issues not caught by the automated review.
  • The PR is purely additive with a minor version bump, which appropriately signals non-breaking changes to downstream consumers of @supermemory/tools.
Files requiring special attention
  • packages/tools/src/shared/memory-client.ts
  • packages/tools/src/shared/types.ts

sreedharsreeram and others added 2 commits March 31, 2026 21:12
Break long conditionals across multiple lines and use single quotes
for string containing escaped double quotes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Overview: Adds hybrid/documents search modes for RAG, enabling search across both memories AND document chunks via a new /v4/search endpoint.

Issues found: None — the concerns raised by earlier reviewers have been addressed in this version.

Clarifications on previous review concerns:

  1. ReferenceError (FIXED): The memoriesResponse scoping bug flagged in earlier reviews has been fixed. The code now properly declares rawSearchResults at function scope (memory-client.ts:216-219), so it's always accessible regardless of which branch executes.

  2. Breaking API change (NOT an issue): The withSupermemory signature remains (model, containerTag, options?) with conversationId staying optional inside options. The only change is a new runtime validation: if addMemory: "always" is set, then conversationId is now required (vercel/index.ts:131-134). This is a stricter validation for a specific use case, not a positional argument change.

  3. Documentation examples (CORRECT): The hybrid search examples in README.md and user-profiles.mdx don't have addMemory: "always", so they correctly omit conversationId. Only examples that persist conversations need it.

What's well done:

  • Clean separation between hybrid search path and legacy profile search path
  • Proper error handling in both supermemoryHybridSearch and supermemoryProfileSearch
  • Good use of TypeScript types for SearchMode and SearchResultItem
  • Clear JSDoc documentation throughout

Score: 9/10

This is ready to ship. The hybrid search feature is well-implemented and the earlier scoping bug has been properly resolved.

@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 4/5 - Mostly Safe

Safe to merge — this PR cleanly introduces hybrid search support via a new supermemoryHybridSearch function targeting /v4/search and adds the SearchMode type alongside searchLimit to SupermemoryBaseOptions, with no critical issues identified in the review. The branching logic in buildMemoriesText for hybrid vs. legacy flow appears well-scoped, and the new exports in the index are consistent with existing patterns. The PR achieves its stated goal of hybrid search support and conversation scoping improvements without introducing obvious logic bugs or security concerns. Minor attention may be warranted on the searchLimit default behavior and whether supermemoryHybridSearch handles error responses consistently with the existing search path.

Key Findings:

  • The new supermemoryHybridSearch function in memory-client.ts correctly targets the /v4/search endpoint and integrates with the existing buildMemoriesText branching logic, suggesting a thoughtful design rather than a bolted-on addition.
  • The SearchMode type ('memories' | 'hybrid' | 'documents') is appropriately typed as a union rather than an unconstrained string, reducing the surface area for runtime errors from invalid mode values.
  • No null/undefined guard issues or missing validation were flagged across the reviewed files, and the export surface in the index file appears to be consistent with how existing tools are exposed.
  • Documentation updates appear to accompany the code changes, which is a positive signal for maintainability, though the completeness of docs for searchLimit default behavior was not fully verifiable from the review coverage.
Files requiring special attention
  • memory-client.ts
  • types.ts

@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 4/5 - Mostly Safe

Safe to merge — this PR cleanly introduces hybrid search (RAG) capability and conversation-scoped memory enforcement to @supermemory/tools v1.5.0 with no identified logic bugs, security concerns, or runtime issues. The new SearchMode type, supermemoryHybridSearch function, and SearchResultItem/SearchResponse interfaces appear to be well-scoped additions. No review comments were generated across the reviewed files, suggesting the implementation is structurally sound, though 4 of 10 changed files were not reviewed, leaving a small blind spot.

Key Findings:

  • supermemoryHybridSearch and the refactored buildMemoriesText in memory-client.ts introduce new code paths (hybrid/document search) that were not flagged for issues, suggesting the branching logic is straightforward and consistent with existing patterns.
  • The new SearchMode type ('memories' | 'hybrid' | 'documents') and searchLimit option added to SupermemoryBaseOptions in types.ts are additive and non-breaking changes, which reduces regression risk for existing consumers.
  • Coverage was 6/10 changed files — the 4 unreviewed files (likely documentation and/or test files) represent a minor blind spot but do not constitute a blocking concern given the nature of the PR.
  • No pre-existing unresolved comments were identified, meaning this PR does not compound any outstanding technical debt.
Files requiring special attention
  • memory-client.ts
  • types.ts

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Overview: Adds hybrid/documents search modes for RAG via a new /v4/search endpoint, enabling search across both memories AND document chunks.

Issues found: None — this looks good to ship.

Clarifications on previous review concerns:

  1. ReferenceError (FIXED): The scoping bug where memoriesResponse was referenced outside its else block has been properly fixed. The code now declares rawSearchResults at function scope (memory-client.ts:216-219), so it's always accessible regardless of which branch executes.

  2. Breaking API change (NOT an issue): The withSupermemory signature remains (model, containerTag, options?) with conversationId staying optional inside WrapVercelLanguageModelOptions (vercel/index.ts:17). The only change is a new runtime validation: if addMemory: "always" is set, then conversationId is required (vercel/index.ts:131-138). This is defensive programming — TypeScript will catch it at compile time if you have proper types, and runtime throws a clear error message. This is not a breaking change for existing callers.

  3. Documentation (CORRECT): The hybrid search examples correctly omit conversationId when not using addMemory: "always". Examples that do use addMemory: "always" now include conversationId.

What's well done:

  • Clean separation between hybrid search path and legacy profile search path in buildMemoriesText
  • Proper error handling in both supermemoryHybridSearch and supermemoryProfileSearch
  • Good TypeScript types for SearchMode and SearchResultItem
  • Clear JSDoc documentation throughout
  • Appropriate minor version bump (1.5.0) for additive, non-breaking features

Score: 9/10

@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 4/5 - Mostly Safe

Likely safe but review recommended — this PR introduces supermemoryHybridSearch, the SearchMode union type, and searchMode/searchLimit fields on SupermemoryBaseOptions cleanly, with no critical issues flagged by automated review. The new /v4/search endpoint integration appears straightforward, and the conversationId enforcement aligns with the stated v1.5.0 goals. However, only 6 of 10 changed files were reviewed, meaning portions of the implementation — potentially including the Vercel AI SDK adapter wiring and documentation updates — were not fully analyzed, leaving a residual gap in confidence.

Key Findings:

  • No logic bugs, null-pointer risks, or security issues were identified in the reviewed files; the SearchResultItem/SearchResponse interfaces provide typed boundaries around the /v4/search response, reducing runtime surprises.
  • The searchMode field defaults and searchLimit optionality were not flagged as problematic, but the absence of validation (e.g., guarding against invalid SearchMode strings at runtime if values come from external config) is worth a quick manual check.
  • 4 of 10 changed files went unreviewed, including likely the Vercel AI SDK backfill adapter itself — the primary feature of this PR — meaning the automated analysis has limited visibility into the core integration path.
  • Documentation-only files (READMEs, changelogs) appear to be part of the diff; these carry no runtime risk but should be spot-checked to ensure version numbers and API signatures match the actual implementation.
Files requiring special attention
  • packages/tools/src/shared/memory-client.ts
  • packages/tools/src/shared/types.ts
  • packages/tools/src/vercel-ai/index.ts

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