The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
fix(ts-sdk): externalize all peerDependencies in tsup config (#4408)
Kartikffd1b969165c
diff --git a/mem0-ts/src/oss/tests/memory.add.test.ts b/mem0-ts/src/oss/tests/memory.add.test.tsindex 9d2126ebd..af135ed09 100644--- a/mem0-ts/src/oss/tests/memory.add.test.ts+++ b/mem0-ts/src/oss/tests/memory.add.test.ts@@ -58,7 +58,11 @@ function createMemory(overrides: Partial<MemoryConfig> = {}): Memory {},vectorStore: {provider: "memory",- config: { collectionName: `test-add-${Date.now()}`, dimension: 1536 },+ config: {+ collectionName: `test-add-${Date.now()}`,+ dimension: 1536,+ dbPath: ":memory:",+ },},llm: {provider: "openai",diff --git a/mem0-ts/src/oss/tests/memory.crud.test.ts b/mem0-ts/src/oss/tests/memory.crud.test.tsindex b594572b5..212d9f7ff 100644--- a/mem0-ts/src/oss/tests/memory.crud.test.ts+++ b/mem0-ts/src/oss/tests/memory.crud.test.ts@@ -61,6 +61,7 @@ function createMemory(): Memory {config: {collectionName: `test-crud-${Date.now()}-${Math.random()}`,dimension: 1536,+ dbPath: ":memory:",},},llm: {diff --git a/mem0-ts/src/oss/tests/tsup-externals.test.ts b/mem0-ts/src/oss/tests/tsup-externals.test.tsnew file mode 100644index 000000000..9206aa27d--- /dev/null+++ b/mem0-ts/src/oss/tests/tsup-externals.test.ts@@ -0,0 +1,51 @@+import * as fs from "fs";+import * as path from "path";++/**+ * Drift-prevention test: ensures every peerDependency in package.json+ * is listed in tsup.config.ts's external array so tsup never bundles+ * optional provider SDKs into the dist output.+ */+describe("tsup.config.ts externals", () => {+ let peerDeps: string[];+ let directDeps: string[];+ let externalDeps: string[];++ beforeAll(() => {+ const pkgPath = path.resolve(__dirname, "../../../package.json");+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));+ // Filter out @types/* packages — they are type-only and not bundled at runtime+ peerDeps = Object.keys(pkg.peerDependencies || {}).filter(+ (dep) => !dep.startsWith("@types/"),+ );+ directDeps = Object.keys(pkg.dependencies || {});++ const tsupConfigPath = path.resolve(__dirname, "../../../tsup.config.ts");+ const tsupContent = fs.readFileSync(tsupConfigPath, "utf-8");++ // Extract strings from the external array (supports double, single, and backtick quotes)+ const externalMatch = tsupContent.match(+ /const external\s*=\s*\[([\s\S]*?)\];/,+ );+ if (!externalMatch) {+ throw new Error("Could not find external array in tsup.config.ts");+ }+ const matches = externalMatch[1].match(/["'`]([^"'`]+)["'`]/g);+ externalDeps = (matches || []).map((m) => m.replace(/["'`]/g, ""));+ });++ it("should have every peerDependency in the external array", () => {+ const missing = peerDeps.filter((dep) => !externalDeps.includes(dep));+ expect(missing).toEqual([]);+ });++ it("should not have stale entries that are not in package.json", () => {+ const allDeps = [...peerDeps, ...directDeps];+ const stale = externalDeps.filter((dep) => !allDeps.includes(dep));+ expect(stale).toEqual([]);+ });++ it("should have peerDependencies defined in package.json", () => {+ expect(peerDeps.length).toBeGreaterThan(0);+ });+});diff --git a/mem0-ts/tsup.config.ts b/mem0-ts/tsup.config.tsindex d5f94125a..8c09ae586 100644--- a/mem0-ts/tsup.config.ts+++ b/mem0-ts/tsup.config.ts@@ -10,6 +10,16 @@ const external = ["better-sqlite3","@qdrant/js-client-rest","redis",+ "ollama",+ "@google/genai",+ "@mistralai/mistralai",+ "neo4j-driver",+ "@supabase/supabase-js",+ "@azure/search-documents",+ "@azure/identity",+ "cloudflare",+ "@cloudflare/workers-types",+ "@langchain/core",];export default defineConfig([