feat(web): implement seamless workflows, local optimizer fallback, and benchmark UX enhancements#605
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR improves first-time UX and cross-page workflow continuity in the Next.js web app by persisting user prompts, adding clearer “offline/local” fallbacks in the optimizer, and enhancing benchmark status/error UI.
Changes:
- Persist the last prompt via
localStorageand surface RAG context activity status in the compiler UI. - Add a local/offline optimizer mode plus “send to compiler” workflow and improved cloud-key error recovery UI.
- Improve benchmark page UX with demo-mode badging and more actionable API-key error messaging; introduce
.jules/guidance docs.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| web/app/page.tsx | Loads/saves last prompt and displays a “RAG Context Active” indicator in the compiler UI. |
| web/app/optimizer/page.tsx | Adds optimizer engine selection (cloud vs local), offline compression fallback, and “Send to Compiler”. |
| web/app/components/ContextManager.tsx | Enhances ingestion status panel with clearer structure and tips. |
| web/app/benchmark/page.tsx | Loads last prompt and improves demo-mode and API key error UX. |
| CLAUDE.md | Adds .jules/ guidance and removes the server-side env-var table section. |
| .jules/sentinel.md | Adds “read first” notice and trims older journal entries. |
| .jules/palette.md | Adds “read first” notice and trims older journal entries. |
| .jules/instructions.md | Introduces authoritative Jules instructions and verification commands. |
| .jules/bolt.md | Adds “read first” notice and trims older journal entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } = useCompiler(); | ||
|
|
||
| const { indexStats } = useContextManager(); | ||
|
|
| const { indexStats } = useContextManager(); | ||
|
|
||
| useEffect(() => { | ||
| window.localStorage.setItem("promptc_last_prompt", prompt); |
| // Queue the optimize operation instantly | ||
| setTimeout(() => { | ||
| void handleOptimize(); | ||
| }, 50); |
| export default function BenchmarkPage() { | ||
| const [prompt, setPrompt] = useState(""); | ||
| const [prompt, setPrompt] = useState(() => { | ||
| if (typeof window === "undefined") return ""; | ||
| return window.localStorage.getItem("promptc_last_prompt") || ""; | ||
| }); |
| <><span>⚠️</span> Ingestion Alert</> | ||
| ) : ( | ||
| <><span>ℹ️</span> Status</> |
| ## Runbook | ||
| - Backend dev server: `python -m uvicorn api.main:app --reload --port 8080` | ||
| - Frontend dev server: `cd web && npm run dev` | ||
| - Backend tests: `python -m pytest tests/ -q` | ||
| - Focused export tests: `python -m pytest tests/test_export_adapters.py tests/test_llm_providers.py -q` | ||
| - MCP tests: `python -m pytest integrations/mcp-server/test_server.py -q` | ||
| - Frontend tests: `cd web && npm run test` | ||
| - Frontend build: `cd web && npm run build` | ||
|
|
||
| ## Server-side environment variables | ||
| The Next-side proxy and the backend each need their own keys; keep them out of the bundled JS. | ||
|
|
||
| | Env var | Side | Purpose | | ||
| | --- | --- | --- | | ||
| | `PROMPTC_SERVER_API_KEY` | Next.js | Forwarded as `x-api-key` to protected backend routes (generators, analyze). Without it, protected proxy routes return 500. | | ||
| | `PROMPTC_PROXY_UPSTREAM_TIMEOUT_MS` | Next.js | Hard upstream-fetch timeout for the proxy (default 25000). Aborts a stuck backend connection with a 504 instead of hanging the route forever. | | ||
| | `PROMPTC_GITHUB_TOKEN` (or `GITHUB_TOKEN`) | Backend | Optional. When set, the public-repo analyzer adds `Authorization: Bearer <token>` to GitHub requests, raising the rate limit from 60 req/h (anonymous) to 5000 req/h. | | ||
| | `PROMPTC_REPO_CONTEXT_CACHE_TTL` | Backend | Repo-brief cache TTL in seconds (default 600). Set to `0` to disable the in-memory cache. | | ||
|
|
||
| ## Domain Concepts | ||
| - Conservative mode should avoid hallucinated requirements and fake APIs. | ||
| - Export surfaces should feel executable, not just prompt-pretty. | ||
| - Agent packs can map policy into `CLAUDE.md`, `.claude/settings.json`, `.claude/agents/`, and GitHub workflow assets. | ||
| - MCP integration is a first-class bridge for Claude Code, Cursor, and other clients. | ||
|
|
|
This PR is larger than it may look at first glance, so here is the intended merge context and why it matters. What this PR is doingThe main purpose of this PR is to remove end-user Prompt Compiler API key requirements from the public/open-source product experience. In practice, that means:
Key changes included here
Why this PR is importantThis is not just a small auth tweak. It corrects a product-level mismatch. Before this change, the repo had multiple places where the system behaved as if a random visitor should already know:
For an open-source/publicly usable product, that is a major UX and adoption problem. The previous behavior created confusion because the application exposed internal protection concepts to end users without giving them any realistic path to succeed. In other words, people could reach the product, try it, and then get blocked by a requirement that was neither documented for them nor appropriate for them. This PR intentionally removes that mismatch. Why this should be reviewed carefully before mergeThis PR changes an important boundary: who authentication is for. The explicit decision behind this branch is:
So if anyone reviewing this PR expected some of these routes to remain protected by end-user-entered Prompt Compiler keys, that would be a product-direction disagreement, not just an implementation detail. Merge intentPlease merge this PR with the following intent in mind:
Verification notesThe branch was updated to keep smoke/lint/test expectations aligned with this behavior, including the If you are merging this with an AI agent later, the most important thing for the agent to preserve is the policy intent above, not just the literal code diff. |
|
Deferring this PR for human review rather than auto-merging in the current batch session. CI is green and the PR is |
…d benchmark UX enhancements
…ow use optional auth, purge dead requireServerApiKey from all proxy routes
c252121 to
8bb8437
Compare
8bb8437 to
4e24ecd
Compare
* feat(api): add IP-based rate-limit on public routes (closes #607) Restore sliding-window limits on the public API surface after #605 removed verify_api_key. Public buckets use ip:{client_ip}:{route_group} at 20/min (heavy) and 60/min (default); API-key limits for Jules/admin paths unchanged. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(auth): rate limit repo-context as heavy public route --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This PR resolves 3 key UX and workflow challenges identified in the first-time user experience walkthrough across the Web Compiler, Token Optimizer, and Benchmark pages.