Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP
0
1---2title: MiniCPM5-2B Pi workspace experiment3emoji: 🥧4colorFrom: green5colorTo: blue6sdk: static7app_file: index.html8pinned: false9license: apache-2.010short_description: Browser coding agent with local folders and HTTP11models:12 - openbmb/MiniCPM5-2B13 - Mike0021/MiniCPM5-2B-ONNX14tags:15 - transformers.js16 - webgpu17 - agents18 - pi19 - just-bash20---21 22# Pi browser workspace experiment23 24An independent duplicate of [victor/MiniCPM5-2B-WebGPU-Pi](https://huggingface.co/spaces/victor/MiniCPM5-2B-WebGPU-Pi) at revision `959e272adeb7931e32d3eb2177dc1d5e96c3e967`. The original Space is unchanged.25 26## Local folder experiment27 28The demo remains the default. In the [standalone app](https://mike0021-minicpm5-2b-webgpu-pi-http.static.hf.space/), choose **Link a folder**. The selected folder replaces `/workspace` in the existing file panel and agent tools. Edits from Pi, the Shell, and the editor are staged. **Review & apply → Apply to folder** shows a diff and requests write permission before saving to disk. **Back to demo** restores the demo files and conversation; **Reconnect folder** resumes the local session, including staged edits saved separately in browser storage.29 30This uses the File System Access API, available in supported Chromium browsers. The Hugging Face iframe offers a link to the standalone app because cross-origin frames cannot request folder permissions. Safari and Firefox retain the existing Import/Export workflow for copies of individual files; they cannot save directly to a selected folder.31 32Files load on demand. **Refresh** reloads names and content from disk and starts a fresh chat; apply or discard staged edits first. Application compares each changed file with the version originally read and stops on conflicts. Multi-file application is not atomic: on a write failure, applied files are reported and the remaining changes stay staged. Avoid editing the same files in another program during Apply.33 34Current bounds: 1 MiB per file, 16 MiB staged content and 16 MiB read baselines, 5,000 indexed entries, depth 40. `.git`, `node_modules`, `.venv`, and `__pycache__` are excluded. Create/edit/delete/rename files and create directories are supported. Removing/renaming existing directories, symlinks, hard links, Unix permissions and timestamp changes are unsupported. Paths outside `/workspace` remain temporary virtual files. Local folder access does not provide Node, Python, npm or native programs. HTTP commands still send explicitly requested URLs/data to external servers.35 36Implementation: `app/src/local-folder.mjs`, `local-folder-ui.mjs`, and the existing worker/workspace modules. Tests: `cd app && npm test`; with the preview server on port 4193, run `node tests/local-folder-browser.mjs`. See [local-folder validation](validation/LOCAL-FOLDER.md).37 38## HTTP experiment39 40MiniCPM5-2B inference and just-bash run in a browser worker. This copy adds real `curl` requests through browser `fetch`, with no backend or proxy. The first model download is about 1.84 GB, verified and cached locally. WebGPU with shader-f16 is required for inference; the Shell can run HTTP commands without loading the model.41 42Try in Shell:43 44```bash45curl -fsS https://jsonplaceholder.typicode.com/todos/1 -o todo.json46jq '{id, title, completed}' todo.json47```48 49Or ask Pi: **Fetch https://jsonplaceholder.typicode.com/todos/1, save it as todo.json, and tell me its title and whether it is completed.**50 51Any HTTPS URL is allowed, including GitHub Gists; there is no host allowlist. GET, HEAD, and POST are enabled, with an 8-second deadline and 1 MiB response limit. Use `set -o pipefail` before pipelines to retain download failures.52 53Browser CORS applies. Redirects require the final URL directly: browsers hide redirect destinations, so this copy reports an error instead of silently returning empty output or following unchecked redirect schemes. Cookies are omitted. Explicit request URLs, headers, and bodies are sent to the destination; inference and workspace storage remain local. Node.js, Python, npm, and native programs remain unavailable.54 55Source is under `app/`. Rebuild with `cd app && npm ci && npm test && npm run build`, then `python3 scripts/stage.py`. The HTTP implementation is in `app/src/browser-http.mjs`; it uses just-bash's existing curl commands and custom transport hook. Tests and results are in `validation/`.56 57The small 4-bit model can make mistakes. Shell transport checks and actual-model trials are reported separately; they do not establish general agent reliability or physical-phone performance.58 59## Deployed results60 61The current [evaluation report](validation/REPORT.md) records 17 passing live shell checks, including previously unlisted hosts, and a successful real-model public Gist fetch. It also preserves the initial seven model trials (five fully passed; two partial results). Basic API fetching works well. Duplicate POSTs and excessive retries on blocked requests remain model limitations.62 