feat: replace CLI examples with full web-based demo apps#1
Open
Dhravya wants to merge 9 commits intovorflux/initial-examplesfrom
Open
feat: replace CLI examples with full web-based demo apps#1Dhravya wants to merge 9 commits intovorflux/initial-examplesfrom
Dhravya wants to merge 9 commits intovorflux/initial-examplesfrom
Conversation
Replace CLI-only examples with web-based demo apps. Remove: legal-docs-assistant, docs-answering-agent, customer-support-agent Update: root README with new example table
CRITICAL FIX - code-sandbox/api/execute: the heredoc-wrapped run script was being passed through JSON.stringify, which collapsed real newlines into literal \n escapes — bash never saw a valid heredoc terminator and every code execution failed with a syntax error. Build the script with real newlines and shell-quote it for 'bash -c'. SECURITY - code-sandbox/api/execute, research-assistant/api/ingest, and knowledge-base server.py all used a fixed heredoc delimiter, so user content containing that exact line could prematurely close the heredoc and inject shell input. Switched to per-request randomized delimiters (Math.random / secrets.token_hex) and extracted a shared writeFileViaHeredoc helper in research-assistant/lib/bash-utils.ts. - knowledge-base: replaced loose '/'-only title sanitization with a stricter sanitize_note_title() that rejects '..', '.', NUL/control chars, and shell metacharacters (mirrors code-sandbox's isSafeFilename). DEDUPLICATION - Extracted code-sandbox/lib/daytona.ts (getDaytona) and code-sandbox/lib/env.ts + research-assistant/lib/env.ts (requireEnv) to remove the repeated env-var-check boilerplate from every API route. - Centralized CONTAINER_TAG and MAX_AGENT_STEPS in research-assistant/lib/config.ts; added MAX_AGENT_STEPS = 10 constant in knowledge-base/server.py. CODE-SANDBOX CLEANUP - Removed the dead 'command' array; build the bash script directly. - Removed unused textareaRef in code-editor.tsx. - Hoisted SMFS_VERSION to a top-level constant; rewrote SMFS_INSTALL and STARTER_CODE using template literals. - Replaced fragile 'sleep 3' after 'smfs mount &' with a polling loop that waits for the FUSE mountpoint to become ready (mountpoint -q). - Extracted the SMFS limitation banner string and added a comment noting that beforeunload cleanup is unreliable and production deployments should rely on server-side TTL. - Dropped the unnecessary 'as HTMLFormElement' cast on form.requestSubmit. RESEARCH-ASSISTANT CLEANUP - Split handleUpload into pure helpers (uploadFiles, mergeUploadedFiles, formatUploadSummary) so the JSX-level callback is just orchestration. KNOWLEDGE-BASE CLEANUP - Hoisted the anthropic.Anthropic client to a module-level cached singleton instead of constructing one per chat request. - Split chat_stream into _build_tools, _messages_from_history, and _run_tool_calls helpers; added a comment explaining why the catch-all Exception handler exists in the SSE generator. - Extracted parseSSE async generator in static/app.js so sendMessage becomes a clean for-await loop. Replaced ad-hoc DOM-scraping in getFinalText() with explicit assistantText tracking. Replaced setTimeout(focus, 30) with requestAnimationFrame. - Pinned upper bounds in requirements.txt so the example doesn't break six months from now. OTHER - code-sandbox/.gitignore: ignore tsconfig.tsbuildinfo to match the research-assistant convention and root .gitignore.
- knowledge-base: switch from heredoc to printf '%s' for note writes (supermemory_bash SDK tokenizes << as two LT tokens) - research-assistant: add try/catch and empty file check in ingest route - research-assistant: remove error/global-error/not-found pages (unnecessary for demo, caused build issues in some environments)
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Web-Based SMFS Example Apps
Replaces the three CLI-only example scripts with full web-based demo applications.
New Examples
@supermemory/bash(TypeScript)streamText.supermemory-bash(Python)Removed
legal-docs-assistant/(CLI-only Python script)docs-answering-agent/(CLI-only TypeScript script)customer-support-agent/(CLI-only Python script)Key Features
streamText; FastAPI uses Server-Sent Events.printffor Python) prevent content injection. Strict filename sanitization.package.json/requirements.txt,.env.example, and comprehensive README.Architecture
Each app follows the same pattern:
supermemory-bash/@supermemory/bashinstance (or E2B sandbox with SMFS mount)Quality Loop
JSON.stringify-- fixedprintf)Testing
TypeScript Compilation
research-assistant/:npx tsc --noEmitpasses cleanlycode-sandbox/:npx tsc --noEmitpasses cleanly (verified after E2B swap)Python Syntax
knowledge-base/:python3 -m py_compile server.pypassesknowledge-base/:node --check static/app.jspassesNext.js Build
Compiled successfully)/_error: /500page due to non-standardNODE_ENVin the build environment -- this is a pre-existing Next.js 15 environment issue, not related to our codeCross-App Verification
.env.examplefiles present with correct variables (2 vars for research-assistant and knowledge-base, 3 for code-sandbox)Integration Testing (attempted -- timed out)
supermemory_bashSDK tokenizes<<as two separate LT tokens (not a heredoc operator), leading to theprintffix for the knowledge-base appSession Details
(aside)to your comment to have me ignore it.