Skip to content

fix: deduplicate @supermemory/ai-sdk into @supermemory/tools/ai-sdk#1251

Open
rajarshidattapy wants to merge 4 commits into
supermemoryai:mainfrom
rajarshidattapy:refactor/ai-sdk-reexport-tools
Open

fix: deduplicate @supermemory/ai-sdk into @supermemory/tools/ai-sdk#1251
rajarshidattapy wants to merge 4 commits into
supermemoryai:mainfrom
rajarshidattapy:refactor/ai-sdk-reexport-tools

Conversation

@rajarshidattapy

Copy link
Copy Markdown
Contributor

What & why

Closes #1247.

packages/ai-sdk reimplemented what packages/tools/src/ai-sdk.ts already provides, and every fix landed in the latter missed it. Rather than porting the three fixes and waiting for the next drift, this makes @supermemory/ai-sdk a thin re-export of @supermemory/tools/ai-sdk — one implementation, one set of semantics.

The three divergences from the issue are resolved by inheritance rather than by patch:

# Divergence Now
1 containerTags silently dropped when projectId is also set getContainerTags() throws (#1214)
2 Raw JSON Schema "type": "number" rejects limit: "5" z.coerce.number() coerces it (#1202)
3 No config → containerTags === undefinedunscoped reads/writes Defaults to ["sm_project_default"]

Changes

  • packages/ai-sdk/src/tools.ts and tools.test.ts deleted; src/index.ts is now export * from "@supermemory/tools/ai-sdk" with a @deprecated JSDoc. Coverage for this code already lives in packages/tools (tools-shared.ts / tools.test.ts).
  • packages/ai-sdk/package.json: 1.0.82.0.0; dependencies reduced to @supermemory/tools plus @ai-sdk/provider (satisfies the tools peer dep).
  • turbo.json: check-types now dependsOn: ["^build"]. Required — tsc resolves @supermemory/tools/ai-sdk through its exports map into dist/, so the dependency must be built first, and CI runs check-types --filter='@supermemory/ai-sdk'.
  • .github/workflows/publish-ai-sdk.yml: build step now runs turbo run build --filter='@supermemory/ai-sdk' from the repo root, so @supermemory/tools is built before the re-export's .d.ts is generated.
  • README: deprecation banner pointing at @supermemory/tools/ai-sdk and listing the behavior changes.

Breaking changes

Major bump to 2.0.0, as the issue anticipated. Existing @supermemory/ai-sdk users are affected in three ways:

  • Passing both projectId and containerTags now throws instead of ignoring containerTags.
  • Calls with no config are now scoped to ["sm_project_default"]. Previously they searched and wrote across every project. Anyone depending on that must now pass containerTags explicitly. This is the fix, but it will change what existing calls read and write.
  • supermemoryTools() now returns the full @supermemory/tools set (getProfile, documentList, documentAdd, documentDelete, memoryForget) alongside searchMemories and addMemory. Additive, but it widens what a model can call if you spread the whole object into tools.

Follow-up for a maintainer with publish rights: run npm deprecate @supermemory/ai-sdk — that's a registry action, not something this PR can do.

Verification

turbo run build check-types --filter='@supermemory/ai-sdk' passes; dist/index.js is a single re-export line. Biome clean on the changed sources.

One thing worth mentioning in the PR thread if you want to be a good citizen: building packages/tools on Windows makes tsdown's exports: true rewrite its own package.json with backslash paths ("./openai\index"). Pre-existing, unrelated to #1247 — I reverted the file, but it's a real trap for Windows contributors.

…#1247) — the ! marks the breaking default-scope change.
Comment thread packages/tools/package.json Outdated
@rajarshidattapy

Copy link
Copy Markdown
Contributor Author

@ishaanxgupta can you check this?

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.

@supermemory/ai-sdk has drifted from @supermemory/tools and is missing its container-scoping and coercion fixes

1 participant