From ed15364eb306534b4ef8a2c597997fa4fee7e439 Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Tue, 18 Aug 2026 08:14:07 -0700 Subject: [PATCH] feat(sdk-playground): reflect SDK-owned memory block in debug view Update the playground to display the current deduplicated replacement block produced by the SDK middleware instead of a browser-side seen-facts delta. Add memory-dedupe helper and ignore local tsbuildinfo. Co-Authored-By: Claude Opus 4.8 --- apps/sdk-playground/.gitignore | 1 + apps/sdk-playground/src/app/page.tsx | 15 ++-- apps/sdk-playground/src/lib/context-api.ts | 27 ++++--- apps/sdk-playground/src/lib/memory-dedupe.ts | 74 ++++++++++++++++++++ 4 files changed, 105 insertions(+), 12 deletions(-) create mode 100644 apps/sdk-playground/src/lib/memory-dedupe.ts diff --git a/apps/sdk-playground/.gitignore b/apps/sdk-playground/.gitignore index 023805e0..ffdcb86e 100644 --- a/apps/sdk-playground/.gitignore +++ b/apps/sdk-playground/.gitignore @@ -3,3 +3,4 @@ .env.local node_modules python/.venv +*.tsbuildinfo diff --git a/apps/sdk-playground/src/app/page.tsx b/apps/sdk-playground/src/app/page.tsx index 8b6d103e..9dfcba7b 100644 --- a/apps/sdk-playground/src/app/page.tsx +++ b/apps/sdk-playground/src/app/page.tsx @@ -48,6 +48,8 @@ export default function AgentPlaygroundPage() { ) const keysReady = supermemoryApiKey.trim().length > 0 && openaiApiKey.trim().length > 0 + const chatReady = + keysReady || (hasSupermemoryKey && hasOpenAiKey) const [sdkId, setSdkId] = useState("ts-ai-sdk-middleware") const [containerTag, setContainerTag] = useState("sdk-playground") @@ -99,7 +101,7 @@ export default function AgentPlaygroundPage() { }, [refreshMeta]) const send = async () => { - if (!input.trim() || loading || !selectedSdk?.available || !keysReady) return + if (!input.trim() || loading || !selectedSdk?.available || !chatReady) return const userMessage: UserOrAssistantMessage = { kind: "user", @@ -484,9 +486,9 @@ export default function AgentPlaygroundPage() { send() } }} - disabled={loading || !input.trim() || !selectedSdk?.available || !keysReady} + disabled={loading || !selectedSdk?.available || !chatReady} placeholder={ - keysReady + chatReady ? "Message the agent…" : "Enter API keys above to chat…" } @@ -495,7 +497,12 @@ export default function AgentPlaygroundPage() {