Add optional local-folder workspace with staged review and apply
Browse filesFiles changed (34)
- README.md+17-3
- app/index.html+10
- app/package-lock.json+1
- app/package.json+1
- app/src/agent.worker.mjs+51-5
- app/src/local-folder-ui.mjsAdded+141
- app/src/local-folder.mjsAdded+265
- app/src/main.mjs+44-6
- app/src/storage.mjs+4-4
- app/src/style.css+23
- app/src/workspace.mjs+5-3
- app/tests/local-folder-browser.mjsAdded+88
- app/tests/local-folder.test.mjsAdded+125
- assets/agent.worker-B7d5sboN.jsDeleted
- assets/agent.worker-DAy1yjYb.jsDeleted
- assets/agent.worker-DONV7yi_.jsDeleted
- assets/agent.worker-CS8jL-AS.js → assets/agent.worker-Dng_UV-X.jsRenamed
- assets/agent.worker-euGpP_Md.jsDeleted
- assets/index-B--sYzmA.jsDeleted
- assets/index-BzGjruQ9.jsDeleted
- assets/index-CLisF1Ml.cssDeleted-1
- assets/index-D2Hvfy3l.jsDeleted
- assets/index-A7Nq9zGD.js → assets/index-DUQ_UspG.jsRenamed
- assets/index-DnXFGQ8z.jsDeleted
- assets/index-Bl39c3Js.css → assets/index-Uy7sEXBC.cssRenamed+1-1
- assets/index-wZi62oe2.jsDeleted
- index.html+12-2
- licenses/dependencies.txt+196
- scripts/stage.py+1-1
- validation/LOCAL-FOLDER.mdAdded+12
- validation/local-folder-browser-390.pngAdded
- validation/local-folder-browser-review.pngAdded
- validation/local-folder-browser.jsonAdded+16
- validation/local-folder-native.pngAdded
123451 unmodified line789101112135 unmodified lines19202122232425262728---title: MiniCPM5-2B Pi HTTP experimentemoji: 🥧colorFrom: greencolorTo: blue1 unmodified lineapp_file: index.htmlpinned: falselicense: apache-2.0short_description: Browser coding agent with HTTP requests (experimental)models:- openbmb/MiniCPM5-2B- Mike0021/MiniCPM5-2B-ONNX5 unmodified lines- just-bash---# Pi browser HTTP experimentAn 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.MiniCPM5-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.Try in Shell:123451 unmodified line789101112135 unmodified lines192021222324252627282930313233343536373839404142---title: MiniCPM5-2B Pi workspace experimentemoji: 🥧colorFrom: greencolorTo: blue1 unmodified lineapp_file: index.htmlpinned: falselicense: apache-2.0short_description: Browser coding agent with local folders and HTTPmodels:- openbmb/MiniCPM5-2B- Mike0021/MiniCPM5-2B-ONNX5 unmodified lines- just-bash---# Pi browser workspace experimentAn 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.## Local folder experimentThe demo remains the default. In the [standalone app](https://mike0021-minicpm5-2b-webgpu-pi-http.static.hf.space/), choose **Open local 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.This 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.Files 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.Current 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.Implementation: `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).## HTTP experimentMiniCPM5-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.Try in Shell:
52 unmodified lines5354555657589 unmodified lines68697071727352 unmodified lines<div id="column-resizer" class="column-resizer" role="separator" tabindex="0" aria-label="Resize chat and workspace" aria-orientation="vertical" aria-controls="conversation-panel workspace-panel" aria-valuemin="0" aria-valuemax="100" aria-valuenow="55" title="Drag to resize · Arrow keys to adjust · Double-click or Enter to reset"></div><aside id="workspace-panel" class="workspace" aria-label="Workspace"><div class="workspace-heading"><h2>Workspace</h2><div><button id="add-file" class="quiet">+ File</button><label class="button quiet" for="upload">Import</label><input id="upload" type="file" multiple hidden><button id="export" class="quiet">Export</button></div></div><div class="file-area"><nav id="files" aria-label="Files"></nav><div class="editor-area"><div class="editor-heading"><span class="editor-file"><span id="filetype"></span><span id="filename">Select a file</span></span><button id="save" class="quiet" disabled>Save</button></div><label for="editor" class="sr-only">File contents</label><div class="editor-input"><pre id="editor-highlight" aria-hidden="true"></pre><textarea id="editor" wrap="off" autocomplete="off" autocapitalize="off" spellcheck="false" disabled placeholder="Select a file to inspect or edit it."></textarea></div></div></div><details class="terminal" open><summary>Shell <span>just-bash</span></summary>9 unmodified lines<p class="workspace-note">HTTP: curl can request any HTTPS URL. Browser CORS applies. <a href="./http-help.html" target="_blank" rel="noopener">HTTP help ↗</a></p></aside></main><dialog id="model-dialog" aria-labelledby="model-title" aria-describedby="model-description"><div class="setup-paws" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i><i></i></div><div class="setup-cat" aria-hidden="true"><span class="setup-cat-tail"></span><img src="./modal-cat-v1.png" width="1254" height="1254" alt="" draggable="false" loading="eager" fetchpriority="high" decoding="async"><span class="setup-cat-eyelids"></span></div>52 unmodified lines53545556575859606162639 unmodified lines737475767778798081828352 unmodified lines<div id="column-resizer" class="column-resizer" role="separator" tabindex="0" aria-label="Resize chat and workspace" aria-orientation="vertical" aria-controls="conversation-panel workspace-panel" aria-valuemin="0" aria-valuemax="100" aria-valuenow="55" title="Drag to resize · Arrow keys to adjust · Double-click or Enter to reset"></div><aside id="workspace-panel" class="workspace" aria-label="Workspace"><div class="workspace-heading"><h2>Workspace</h2><div><button id="add-file" class="quiet">+ File</button><label class="button quiet" for="upload">Import</label><input id="upload" type="file" multiple hidden><button id="export" class="quiet">Export</button></div></div><div class="folder-controls"><button id="open-folder" type="button" class="quiet">Open local folder</button><button id="reconnect-folder" type="button" class="quiet" hidden>Reconnect folder</button></div><div id="local-folder-bar" hidden><strong id="local-folder-name"></strong><span id="local-folder-hint" role="status"></span><div class="folder-actions"><button id="review-changes" type="button">Review & apply</button><button id="refresh-folder" type="button" class="quiet" title="Reload files from disk and start a fresh chat">Refresh</button><button id="disconnect-folder" type="button" class="quiet">Back to demo</button></div></div><div class="file-area"><nav id="files" aria-label="Files"></nav><div class="editor-area"><div class="editor-heading"><span class="editor-file"><span id="filetype"></span><span id="filename">Select a file</span></span><button id="save" class="quiet" disabled>Save</button></div><label for="editor" class="sr-only">File contents</label><div class="editor-input"><pre id="editor-highlight" aria-hidden="true"></pre><textarea id="editor" wrap="off" autocomplete="off" autocapitalize="off" spellcheck="false" disabled placeholder="Select a file to inspect or edit it."></textarea></div></div></div><details class="terminal" open><summary>Shell <span>just-bash</span></summary>9 unmodified lines<p class="workspace-note">HTTP: curl can request any HTTPS URL. Browser CORS applies. <a href="./http-help.html" target="_blank" rel="noopener">HTTP help ↗</a></p></aside></main><dialog id="local-review" aria-labelledby="review-title" aria-describedby="review-description"><div class="review-heading"><h2 id="review-title">Review local changes</h2><button id="review-close" type="button" aria-label="Close change review">×</button></div><p id="review-description"></p><div id="review-files"></div><p id="review-error" role="alert"></p><div class="review-actions"><button id="review-discard" type="button">Discard changes</button><button id="review-apply" type="button" class="primary">Apply to folder</button></div></dialog><dialog id="model-dialog" aria-labelledby="model-title" aria-describedby="model-description"><div class="setup-paws" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i><i></i></div><div class="setup-cat" aria-hidden="true"><span class="setup-cat-tail"></span><img src="./modal-cat-v1.png" width="1254" height="1254" alt="" draggable="false" loading="eager" fetchpriority="high" decoding="async"><span class="setup-cat-eyelids"></span></div>
16 unmodified lines17181920212216 unmodified lines"@xterm/addon-unicode-graphemes": "0.4.0","@xterm/xterm": "6.0.0","buffer": "6.0.3","events": "3.3.0","hash-wasm": "4.12.0","just-bash": "3.4.2",16 unmodified lines1718192021222316 unmodified lines"@xterm/addon-unicode-graphemes": "0.4.0","@xterm/xterm": "6.0.0","buffer": "6.0.3","diff": "8.0.4","events": "3.3.0","hash-wasm": "4.12.0","just-bash": "3.4.2",
35 unmodified lines36373839404135 unmodified lines"@xterm/addon-unicode-graphemes": "0.4.0","@xterm/xterm": "6.0.0","buffer": "6.0.3","events": "3.3.0","hash-wasm": "4.12.0","just-bash": "3.4.2",35 unmodified lines3637383940414235 unmodified lines"@xterm/addon-unicode-graphemes": "0.4.0","@xterm/xterm": "6.0.0","buffer": "6.0.3","diff": "8.0.4","events": "3.3.0","hash-wasm": "4.12.0","just-bash": "3.4.2",
2 unmodified lines34567891011126 unmodified lines1920212223242526272829303132333437 unmodified lines727374757677784 unmodified lines8384858687886 unmodified lines95969798991002 unmodified linesimport { createWorkspace, initialFiles, legacyProductsCsv, legacyProductsJson, legacyCostProductsJson, legacySalesCsv, legacyWorkspaceReadme, legacyProfitReadme } from './workspace.mjs';import { openStorage } from './storage.mjs';import { isModelCached } from './download.mjs';const emit = data => postMessage(data);const inference = createInference(emit);let workspace, agent, storage, busy = false, operation, turnCount = 0;const systemPrompt = `You are Pi, a coding assistant powered by MiniCPM5-2B, a language model from OpenBMB.The model, inference, tools, and workspace run entirely in the user's browser. Workspace files are stored in this browser, not on the user's operating-system filesystem.Use your tools to inspect and change actual files. Never claim a command ran or a file changed without a successful tool result.6 unmodified linesInterpret short follow-ups using the conversation and inspect the relevant files when needed.Inspect files before editing them. After changing files, verify the result with a tool. Finish with a short factual answer.`;async function snapshot() { return { version: 1, demoVersion: 4, files: await workspace.snapshot(), entries: await workspace.serialize(), messages: agent.state.messages }; }async function persist() {const state = await snapshot();try { await storage?.save(state); } catch (e) { emit({ type: 'persistence_error', error: 'Changes are in memory, but browser storage failed: ' + e.message }); }emit({ type: 'workspace', files: state.files });return state;}const initialized = (async () => {let saved;try { storage = await openStorage(); saved = await storage.load(); }catch (e) { emit({ type: 'persistence_error', error: 'Workspace saving is unavailable: ' + e.message }); }workspace = createWorkspace(saved?.files, saved?.entries);await workspace.ready;37 unmodified linestry { await storage?.save(state); }catch (e) { emit({ type: 'persistence_error', error: 'Changes are in memory, but browser storage failed: ' + e.message }); }}emit({ type: 'initialized', ...state });})();onmessage = async ({ data }) => {4 unmodified linesif (action === 'stop') { operation?.abort(); agent.abort(); inference.stop(); return reply(true); }if (action === 'snapshot') return reply(await snapshot());if (action === 'cache_status') return reply(await isModelCached());if (busy) throw Error('Wait for the current operation or stop it first.');busy = true; operation = new AbortController(); emit({ type: 'busy', action, cachedOnly: args.cachedOnly === true });try {6 unmodified lines} else if (action === 'write') { await workspace.write(args.path, args.content); value = await persist(); }else if (action === 'new_chat') { agent.reset(); value = await persist(); }else if (action === 'read') value = await workspace.read(args.path);else throw Error('Unknown action: ' + action);reply(value);} finally { busy = false; operation = undefined; emit({ type: 'idle' }); }2 unmodified lines345678910111213146 unmodified lines212223242526272829303132333435363738394041424344454647484937 unmodified lines878889909192934 unmodified lines98991001011021031041056 unmodified lines1121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451462 unmodified linesimport { createWorkspace, initialFiles, legacyProductsCsv, legacyProductsJson, legacyCostProductsJson, legacySalesCsv, legacyWorkspaceReadme, legacyProfitReadme } from './workspace.mjs';import { openStorage } from './storage.mjs';import { isModelCached } from './download.mjs';import { LocalFolderFs, displayText } from './local-folder.mjs';const emit = data => postMessage(data);const inference = createInference(emit);let workspace, agent, storage, busy = false, operation, turnCount = 0;let demoWorkspace, demoMessages, savedLocal;const systemPrompt = `You are Pi, a coding assistant powered by MiniCPM5-2B, a language model from OpenBMB.The model, inference, tools, and workspace run entirely in the user's browser. Workspace files are stored in this browser, not on the user's operating-system filesystem.Use your tools to inspect and change actual files. Never claim a command ran or a file changed without a successful tool result.6 unmodified linesInterpret short follow-ups using the conversation and inspect the relevant files when needed.Inspect files before editing them. After changing files, verify the result with a tool. Finish with a short factual answer.`;const localPrompt = systemPrompt.replace("Workspace files are stored in this browser, not on the user's operating-system filesystem.",'The user selected a real local folder mounted at /workspace. Reads use that folder; all writes, edits and deletions are staged in this browser. Only the user can apply staged changes to disk with Review & apply. Say edits are staged, never claim they are saved to disk. Files outside /workspace are temporary virtual files. Files are limited to 1 MiB, 16 MiB total loaded; .git, node_modules, .venv and __pycache__ are excluded. Unix permissions, links and renaming/removing existing directories are unsupported.');async function snapshot() { return { version: 1, demoVersion: 4, files: await workspace.snapshot(), entries: await workspace.serialize(), messages: agent.state.messages,localFolder: workspace.localFolder ? await workspace.localFolder.status() : null }; }async function persist() {const state = await snapshot();try {if (workspace.localFolder) {savedLocal = { handle: workspace.localFolder.handle, patches: await workspace.localFolder.patches(), messages: state.messages };await storage?.save(savedLocal, 'local-folder');} else await storage?.save(state);} catch (e) { emit({ type: 'persistence_error', error: 'Changes are in memory, but browser storage failed: ' + e.message }); }emit({ type: 'workspace', files: state.files, localFolder: state.localFolder });return state;}function switchWorkspace(next, messages = []) {workspace = next;agent.reset(); agent.state.messages = messages; agent.state.tools = next.tools;agent.state.systemPrompt = next.localFolder ? localPrompt : systemPrompt;}const initialized = (async () => {let saved;try { storage = await openStorage(); saved = await storage.load(); savedLocal = await storage.load('local-folder'); }catch (e) { emit({ type: 'persistence_error', error: 'Workspace saving is unavailable: ' + e.message }); }workspace = createWorkspace(saved?.files, saved?.entries);await workspace.ready;37 unmodified linestry { await storage?.save(state); }catch (e) { emit({ type: 'persistence_error', error: 'Changes are in memory, but browser storage failed: ' + e.message }); }}emit({ type: 'initialized', ...state, savedLocal: savedLocal ? { handle: savedLocal.handle, count: savedLocal.patches.length } : null });})();onmessage = async ({ data }) => {4 unmodified linesif (action === 'stop') { operation?.abort(); agent.abort(); inference.stop(); return reply(true); }if (action === 'snapshot') return reply(await snapshot());if (action === 'cache_status') return reply(await isModelCached());if (action === 'preview') return reply(workspace.localFolder? displayText(await workspace.bash.fs.readFileBuffer(args.path)) : await workspace.read(args.path));if (busy) throw Error('Wait for the current operation or stop it first.');busy = true; operation = new AbortController(); emit({ type: 'busy', action, cachedOnly: args.cachedOnly === true });try {6 unmodified lines} else if (action === 'write') { await workspace.write(args.path, args.content); value = await persist(); }else if (action === 'new_chat') { agent.reset(); value = await persist(); }else if (action === 'read') value = await workspace.read(args.path);else if (action === 'local_open') {if (workspace.localFolder) throw Error('Return to the demo before opening another local folder.');const restore = args.restore && savedLocal && await args.handle.isSameEntry(savedLocal.handle);const folder = await LocalFolderFs.open(args.handle, { signal: operation.signal, patches: restore ? savedLocal.patches : [] });const next = createWorkspace({}, undefined, folder); await next.ready;await persist(); demoWorkspace = workspace; demoMessages = agent.state.messages;switchWorkspace(next, restore ? savedLocal.messages : []);value = await persist();} else if (action === 'local_close') {if (!workspace.localFolder) throw Error('No local folder is open.');await persist(); switchWorkspace(demoWorkspace, demoMessages);demoWorkspace = demoMessages = undefined;value = await persist();} else if (action === 'local_changes') {if (!workspace.localFolder) throw Error('No local folder is open.');value = await workspace.localFolder.patches();} else if (action === 'local_apply') {if (!workspace.localFolder) throw Error('No local folder is open.');try { value = { applied: await workspace.localFolder.apply(operation.signal) }; }finally { await persist(); }} else if (action === 'local_refresh' || action === 'local_discard') {const folder = workspace.localFolder;if (!folder) throw Error('No local folder is open.');if (action === 'local_refresh' && (await folder.patches()).length) throw Error('Apply or discard staged edits before refreshing.');const fresh = await LocalFolderFs.open(folder.handle, { signal: operation.signal });const next = createWorkspace({}, undefined, fresh); await next.ready;// A fresh conversation avoids stale tool results after external changes.switchWorkspace(next); value = await persist();}else throw Error('Unknown action: ' + action);reply(value);} finally { busy = false; operation = undefined; emit({ type: 'idle' }); }
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141import { createTwoFilesPatch } from 'diff';
const $ = selector => document.querySelector(selector);const text = value => { if (value === null) return ''; const decoded = new TextDecoder('utf-8', { fatal: true }).decode(Uint8Array.from(atob(value), c => c.charCodeAt(0))); if (decoded.includes('\0')) throw Error('Binary file'); return decoded;};
export function createLocalFolderUI({ rpc, notice, canSwitch, onSwitch }) { let handle, saved, current, busy = false, opening = false, reviewPatches = []; const dialog = $('#local-review'); const embedded = window.self !== window.top; const supported = typeof window.showDirectoryPicker === 'function'; function controls() { $('#open-folder').hidden = Boolean(current); $('#reconnect-folder').hidden = Boolean(current) || !saved; $('#local-folder-bar').hidden = !current; for (const id of ['open-folder', 'reconnect-folder', 'review-changes', 'refresh-folder', 'disconnect-folder']) $('#' + id).disabled = busy || opening; $('#review-changes').disabled ||= !current?.count; $('#refresh-folder').disabled ||= Boolean(current?.count); $('#review-apply').disabled = busy || !reviewPatches.length; $('#review-discard').disabled = busy || !reviewPatches.length; $('#review-close').disabled = busy; if (current) { $('#local-folder-name').textContent = current.name; $('#local-folder-hint').textContent = current.count ? `${current.count} staged change${current.count === 1 ? '' : 's'} · original files unchanged until Apply` : 'Local folder · edits are staged until you apply them'; $('#review-changes').textContent = current.count ? `Review & apply (${current.count})` : 'Review & apply'; } $('#export').textContent = current ? 'Export changes' : 'Export'; $('#save').textContent = current ? 'Stage edit' : 'Save'; } function available() { if (embedded) { $('#open-tab').href = new URL('?local-folder', location.href).href; $('#open-tab').hidden = false; notice('Open the workspace in a new tab, then choose Open local folder. Browsers cannot grant folder access inside this embedded Space.'); return false; } if (!supported) { notice('Direct local-folder access needs a supported browser, such as Chrome or Edge. In this browser, use Import and Export to work with copies of your files.'); return false; } return true; } async function connect(restore) { if (!available() || busy || opening) return; try { canSwitch(); opening = true; controls(); // Invoke the picker/permission request directly from the click, before // waiting for the worker: these APIs require transient user activation. let next; if (restore) { next = saved.handle; if (await next.requestPermission({ mode: 'read' }) !== 'granted') throw Error('Folder access was not granted.'); } else { if (saved?.count && !window.confirm('Opening another folder replaces the saved staged edits for the previous folder. Reconnect to review them first, or continue?')) return; next = await window.showDirectoryPicker({ id: 'pi-workspace', mode: 'read' }); } const state = await rpc('local_open', { handle: next, restore }); handle = next; saved = { handle: next, count: state.localFolder.count }; onSwitch(state); notice(`Opened ${next.name}. Review & apply writes staged changes to disk. Files load on demand; Refresh picks up external edits.`); } catch (error) { if (error.name !== 'AbortError') notice(error.message); } finally { opening = false; controls(); } } $('#open-folder').onclick = () => connect(false); $('#reconnect-folder').onclick = () => connect(true); $('#disconnect-folder').onclick = async () => { try { canSwitch(); saved = { handle, count: current.count }; const state = await rpc('local_close'); onSwitch(state); notice('Demo workspace restored. Reconnect to continue with your local folder and staged edits.'); } catch (error) { notice(error.message); } }; $('#refresh-folder').onclick = async () => { try { canSwitch(); onSwitch(await rpc('local_refresh')); notice('Folder refreshed from disk. Started a new chat with the current files.'); } catch (error) { notice(error.message); } }; function renderReview(patches) { reviewPatches = patches; $('#review-files').replaceChildren(); $('#review-error').textContent = ''; $('#review-description').textContent = `Review changes to ${current.name}. Applying writes them to your local folder.`; for (const patch of patches) { const details = document.createElement('details'), title = document.createElement('summary'), pre = document.createElement('pre'); const kind = patch.kind === 'directory' ? 'New folder' : patch.after === null ? 'Delete' : patch.before === null ? 'Create' : 'Edit'; title.textContent = `${kind} · ${patch.path.slice(1)}`; details.append(title); details.open = patches.length < 5; if (patch.kind !== 'directory') { try { const before = text(patch.before), after = text(patch.after); if (before.length + after.length > 160_000) pre.textContent = 'Large text change. Inspect the file in the editor before applying.'; else { const diff = createTwoFilesPatch(patch.path, patch.path, before, after, 'on disk when read', 'staged', { context: 3 }); for (const line of diff.split('\n')) { const span = document.createElement('span'); span.textContent = line + '\n'; if (line.startsWith('+')) span.className = 'diff-add'; if (line.startsWith('-')) span.className = 'diff-remove'; pre.append(span); } } } catch { pre.textContent = `Binary file · ${patch.before === null ? 0 : atob(patch.before).length} → ${patch.after === null ? 0 : atob(patch.after).length} bytes`; } details.append(pre); } $('#review-files').append(details); } controls(); } $('#review-changes').onclick = async () => { try { canSwitch(); renderReview(await rpc('local_changes')); dialog.showModal(); } catch (error) { notice(error.message); } }; $('#review-close').onclick = () => dialog.close(); dialog.addEventListener('cancel', event => { if (busy) event.preventDefault(); }); $('#review-apply').onclick = async () => { try { // Only this user gesture requests write access. The worker never prompts. if (await handle.requestPermission({ mode: 'readwrite' }) !== 'granted') throw Error('Write access was not granted. Changes are still staged.'); const result = await rpc('local_apply'); dialog.close(); notice(`Applied ${result.applied} change${result.applied === 1 ? '' : 's'} to ${handle.name}.`); } catch (error) { // Application can partially succeed; refresh the review to show only the remaining edits. try { renderReview(await rpc('local_changes')); } catch {} $('#review-error').textContent = error.message; } }; $('#review-discard').onclick = async () => { if (!window.confirm('Discard all staged changes and reload files from disk? Your local files will not be changed.')) return; try { onSwitch(await rpc('local_discard')); dialog.close(); notice('Staged edits discarded. Folder refreshed and chat reset.'); } catch (error) { $('#review-error').textContent = error.message; } }; window.addEventListener('beforeunload', event => { if (current?.count) { event.preventDefault(); event.returnValue = ''; } }); if (new URLSearchParams(location.search).has('local-folder')) notice('Choose Open local folder to select the project you want Pi to work on.'); return { setBusy(value) { busy = value; controls(); }, setState(value) { current = value; if (saved && value) saved.count = value.count; controls(); }, restore(value) { saved = value; controls(); }, get active() { return Boolean(current); }, };}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265import { InMemoryFs, MountableFs } from 'just-bash/browser';
// Only enumerate names at connection time. File bytes are loaded on demand,// into a bounded staging filesystem; only Apply can write to the real handle.export const LOCAL_FILE_LIMIT = 1024 ** 2;const TOTAL_LIMIT = 16 * LOCAL_FILE_LIMIT;const SKIP = new Set(['.git', 'node_modules', '.venv', '__pycache__']);const same = (a, b) => a?.length === b?.length && (a == null || a.every((v, i) => v === b[i]));export function encodeBytes(bytes) { if (bytes == null) return null; let text = ''; for (let i = 0; i < bytes.length; i += 32768) text += String.fromCharCode(...bytes.subarray(i, i + 32768)); return btoa(text);}export const decodeBytes = text => text == null ? null : Uint8Array.from(atob(text), c => c.charCodeAt(0));export function displayText(bytes) { if (bytes == null) return ''; const text = new TextDecoder('utf-8', { fatal: true }).decode(bytes); if (text.includes('\0')) throw Error('This is a binary file. The editor supports UTF-8 text.'); return text;}const unsupported = () => { throw Error('ENOTSUP: Local folders do not support Unix permissions, timestamps, or links.'); };
export class LocalFolderFs { constructor(handle) { this.handle = handle; this.memory = new InMemoryFs({}, { maxTotalBytes: TOTAL_LIMIT }); this.original = new Map([['/', { kind: 'directory', handle }]]); this.baselines = new Map(); this.dirty = new Set(); this.skipped = 0; this.baselineBytes = 0; } static async open(handle, { signal, patches = [] } = {}) { if (handle?.kind !== 'directory') throw Error('Select a folder.'); const fs = new LocalFolderFs(handle); let count = 0; async function walk(dir, prefix, depth) { if (depth > 40) throw Error('This folder is too deeply nested. Choose a smaller project folder.'); for await (const [name, child] of dir.entries()) { signal?.throwIfAborted(); if (SKIP.has(name)) { fs.skipped++; continue; } if (++count > 5000) throw Error('This folder contains more than 5,000 entries. Choose a smaller project folder.'); const path = prefix + '/' + name; fs.original.set(path, { kind: child.kind, handle: child }); if (child.kind === 'directory') { await fs.memory.mkdir(path, { recursive: true }); await walk(child, path, depth + 1); } else fs.memory.writeFileLazy(path, () => fs.loadOriginal(path)); } } await walk(handle, '', 0); for (const patch of patches) { const path = fs.path(patch.path); if (path === '/') throw Error('Invalid saved local-folder change.'); const before = decodeBytes(patch.before); fs.baselineBytes += before?.length ?? 0; if (fs.baselineBytes > TOTAL_LIMIT) throw Error('Saved changes exceed the 16 MiB local-folder limit.'); fs.baselines.set(path, before); fs.dirty.add(path); if (patch.kind === 'directory') await fs.memory.mkdir(path, { recursive: true }); else if (patch.after === null) await fs.memory.rm(path, { force: true }); else { await fs.memory.mkdir(fs.parent(path), { recursive: true }); await fs.memory.writeFile(path, decodeBytes(patch.after)); } } return fs; } path(value) { if (typeof value !== 'string' || value.includes('\0')) throw Error('Invalid file path.'); const path = this.memory.resolvePath('/', value); if (path.split('/').some(part => SKIP.has(part))) throw Error('This folder is excluded: .git, node_modules, .venv, and __pycache__.'); return path; } parent(path) { return path.slice(0, path.lastIndexOf('/')) || '/'; } async diskBytes(path) { const handle = await this.diskEntry(path); if (!handle) return null; if (handle.kind !== 'file') throw Error('A folder now occupies ' + path + '. No file was overwritten.'); const file = await handle.getFile(); if (file.size > LOCAL_FILE_LIMIT) throw Error(path + ' is larger than the 1 MiB per-file limit.'); return new Uint8Array(await file.arrayBuffer()); } async diskEntry(path) { let dir = this.handle; const parts = this.path(path).split('/').filter(Boolean); if (!parts.length) return dir; try { for (const part of parts.slice(0, -1)) dir = await dir.getDirectoryHandle(part); try { return await dir.getFileHandle(parts.at(-1)); } catch (e) { if (e.name !== 'TypeMismatchError') throw e; return await dir.getDirectoryHandle(parts.at(-1)); } } catch (e) { if (e.name === 'NotFoundError') return null; throw e; } } async loadOriginal(path) { const bytes = await this.diskBytes(path); if (!bytes) throw Error('ENOENT: File was removed from disk: ' + path + '. Refresh the folder.'); // Preserve the version actually read, even if the host file later changes. if (!this.baselines.has(path)) { if (this.baselineBytes + bytes.length > TOTAL_LIMIT) throw Error('Local file reads reached the 16 MiB session limit. Apply or discard changes, then Refresh.'); this.baselines.set(path, bytes); this.baselineBytes += bytes.length; } return bytes; } async baseline(path) { if (!this.baselines.has(path)) this.baselines.set(path, this.original.get(path)?.kind === 'file' ? await this.loadOriginal(path) : null); } async readFile(path, options) { return this.memory.readFile(this.path(path), options); } async readFileBuffer(path) { return this.memory.readFileBuffer(this.path(path)); } async readFileBytes(path) { return this.memory.readFileBytes(this.path(path)); } async exists(path) { return this.memory.exists(this.path(path)); } async stat(value) { const path = this.path(value), entry = this.original.get(path); // InMemoryFs.stat materializes lazy files. Avoid that for ls/find/indexing. if (entry?.kind === 'file' && !this.dirty.has(path) && !this.baselines.has(path)) { const file = await entry.handle.getFile(); return { isFile: true, isDirectory: false, isSymbolicLink: false, mode: 0o644, size: file.size, mtime: new Date(file.lastModified) }; } return this.memory.stat(path); } async lstat(path) { return this.stat(path); } async realpath(path) { return this.memory.realpath(this.path(path)); } resolvePath(base, path) { return this.memory.resolvePath(base, path); } getAllPaths() { return this.memory.getAllPaths(); } async readdir(path) { return this.memory.readdir(this.path(path)); } async readdirWithFileTypes(path) { return this.memory.readdirWithFileTypes(this.path(path)); } async mkdir(value, options) { const path = this.path(value), previous = new Set(this.getAllPaths()); await this.memory.mkdir(path, options); for (const created of this.getAllPaths()) if (!previous.has(created)) { this.dirty.add(created); this.baselines.set(created, null); } } async writeFile(value, content, options) { const path = this.path(value); if (path === '/') throw Error('EISDIR: Cannot replace the selected folder.'); // Decode using just-bash's encoding semantics before enforcing byte limits. const temporary = new InMemoryFs({}, { maxTotalBytes: LOCAL_FILE_LIMIT }); await temporary.writeFile('/data', content, options); const bytes = await temporary.readFileBuffer('/data'); if (bytes.length > LOCAL_FILE_LIMIT) throw Error('Local files are limited to 1 MiB.'); if (!await this.memory.exists(this.parent(path))) throw Error('ENOENT: Parent folder does not exist: ' + this.parent(path)); await this.baseline(path); await this.memory.writeFile(path, bytes); this.dirty.add(path); } async appendFile(path, content, options) { const old = await this.exists(path) ? await this.readFileBuffer(path) : new Uint8Array(); const temporary = new InMemoryFs({ '/data': old }, { maxTotalBytes: LOCAL_FILE_LIMIT }); await temporary.appendFile('/data', content, options); await this.writeFile(path, await temporary.readFileBuffer('/data')); } async rm(value, options) { const path = this.path(value); if (path === '/') throw Error('Cannot remove the selected local folder.'); if (!await this.exists(path)) return this.memory.rm(path, options); if ((await this.stat(path)).isDirectory) { if (this.original.has(path)) throw Error('Removing or renaming existing local folders is not supported. Remove individual files instead.'); for (const p of this.getAllPaths().filter(p => p.startsWith(path + '/'))) { if (this.original.has(p)) throw Error('This folder contains existing local files.'); } const removed = this.getAllPaths().filter(p => p === path || p.startsWith(path + '/')); await this.memory.rm(path, options); for (const p of removed) { this.dirty.delete(p); this.baselines.delete(p); } } else { await this.baseline(path); await this.memory.rm(path, options); this.dirty.add(path); } } async cp(source, destination, options) { const src = this.path(source); let dest = this.path(destination); if (await this.exists(dest) && (await this.stat(dest)).isDirectory) dest += '/' + src.split('/').at(-1); if (src === dest || dest.startsWith(src + '/')) throw Error('Cannot copy a path into itself.'); if ((await this.stat(src)).isDirectory) { if (!options?.recursive) throw Error('EISDIR: Use cp -r to copy a directory.'); await this.mkdir(dest, { recursive: true }); for (const name of await this.readdir(src)) await this.cp(src + '/' + name, dest + '/' + name, options); } else await this.writeFile(dest, await this.readFileBuffer(src)); } async mv(src, dest) { if ((await this.stat(src)).isDirectory) throw Error('Renaming local folders is not supported.'); await this.cp(src, dest); await this.rm(src); } chmod = unsupported; symlink = unsupported; link = unsupported; readlink = unsupported; utimes = unsupported;
async patches() { const patches = []; for (const path of [...this.dirty].sort()) { const before = this.baselines.get(path) ?? null; const exists = await this.exists(path); const kind = exists && (await this.memory.stat(path)).isDirectory ? 'directory' : 'file'; const after = exists && kind === 'file' ? await this.readFileBuffer(path) : null; if (kind === 'file' && same(before, after)) continue; patches.push({ path, kind, before: encodeBytes(before), after: encodeBytes(after) }); } return patches; } async listing() { const files = Object.create(null); for (const path of this.getAllPaths()) { const entry = this.original.get(path); if (entry?.kind === 'file' || (!entry && (await this.memory.stat(path)).isFile)) files['/workspace' + path] = null; } return files; } async status() { return { name: this.handle.name, count: (await this.patches()).length, skipped: this.skipped }; } async apply(signal) { const patches = await this.patches(); // Preflight the entire set before touching disk. Check again per file to // catch edits made during application. File System Access has no multi-file transaction. const check = async patch => { const actual = await this.diskEntry(patch.path); if (patch.kind === 'directory') { if (actual) throw Error('Conflict: ' + patch.path + ' was created on disk.'); } else if (!same(await this.diskBytes(patch.path), decodeBytes(patch.before))) { throw Error('Conflict: ' + patch.path + ' changed on disk. Nothing will overwrite it. Discard staged edits and refresh to read the new version.'); } }; for (const patch of patches) { signal?.throwIfAborted(); await check(patch); } let applied = 0; try { for (const patch of patches) { signal?.throwIfAborted(); await check(patch); const parts = patch.path.split('/').filter(Boolean); let dir = this.handle; for (const part of parts.slice(0, -1)) dir = await dir.getDirectoryHandle(part); const name = parts.at(-1); if (patch.kind === 'directory') { const handle = await dir.getDirectoryHandle(name, { create: true }); this.original.set(patch.path, { kind: 'directory', handle }); } else if (patch.after === null) { await dir.removeEntry(name); this.original.delete(patch.path); this.baselineBytes -= this.baselines.get(patch.path)?.length ?? 0; this.baselines.delete(patch.path); } else { const handle = await dir.getFileHandle(name, { create: true }); let stream; try { stream = await handle.createWritable(); await stream.write(decodeBytes(patch.after)); signal?.throwIfAborted(); await stream.close(); } catch (e) { await stream?.abort().catch(() => {}); // create:true creates an empty entry before createWritable runs. // If writing failed, remove only our still-empty new entry. if (patch.before === null) { try { if ((await handle.getFile()).size === 0 && await handle.isSameEntry(await dir.getFileHandle(name))) await dir.removeEntry(name); } catch {} } throw e; } this.original.set(patch.path, { kind: 'file', handle }); this.baselineBytes += decodeBytes(patch.after).length - (this.baselines.get(patch.path)?.length ?? 0); this.baselines.set(patch.path, decodeBytes(patch.after)); } this.dirty.delete(patch.path); applied++; } } catch (error) { throw Error(`${applied} of ${patches.length} changes applied. Remaining changes are still staged. ${error.message}`); } return applied; } mount() { return new MountableFs({ mounts: [{ mountPoint: '/workspace', filesystem: this }] }); }}6 unmodified lines7891011121 unmodified line14151617181911 unmodified lines31323334353618 unmodified lines55565758596061625 unmodified lines6869707172737432 unmodified lines1071081091101111124 unmodified lines117118119120121122123124121 unmodified lines2462472482492502512522536 unmodified linesimport { createFileIcon } from './file-icons.mjs';import { createEditorUI } from './editor-ui.mjs';import { createColumnResizer } from './column-resizer.mjs';const $ = selector => document.querySelector(selector);createColumnResizer($('main'), $('#column-resizer'));1 unmodified lineconst pending = new Map();let nextId = 1, busy = false, loaded = false, selected, dirty = false, files = {}, messages = [], readyResolve;let pendingReadPath;const ready = new Promise(resolve => { readyResolve = resolve; });const diagnostics = { events: [], generations: [], runtimeSamples: [], device: null, contextUsage: restoredContextUsage([]) };const runtimeMeter = createRuntimeMeter($('#runtime-meter'));11 unmodified linesif (busy) throw Error('Wait for Pi to finish or stop the current task first.');return rpc('shell', { command });} });function rpc(action, args) {return new Promise((resolve, reject) => {const id = nextId++; pending.set(id, { resolve, reject }); worker.postMessage({ id, action, args });18 unmodified lines$('#stop').hidden = !busy;for (const id of ['#new-chat', '#add-file', '#upload']) $(id).disabled = busy;shellUI.setBusy(busy);$('#save').disabled = busy || !selected || !dirty;$('#editor').disabled = busy || !selected;}function renderFiles() {terminalUI.setFiles(files);5 unmodified linesbutton.title = file; button.classList.toggle('selected', file === selected);button.onclick = () => selectFile(file); $('#files').append(button);}if (selected && !dirty) editorUI.setFile(selected, files[selected] ?? '');}function selectFile(file) {pendingReadPath = undefined;32 unmodified linesconst request = pending.get(data.id); pending.delete(data.id);if (data.error) request?.reject(Object.assign(Error(data.error), { name: data.errorName || 'Error', code: data.errorCode })); else request?.resolve(data.value);} else if (data.type === 'initialized') {files = data.files; messages = data.messages; renderFiles(); renderMessages();updateContextUsage(restoredContextUsage(messages));if (files['/workspace/README.md']) selectFile('/workspace/README.md');4 unmodified linesif (data.action === 'load') $('#load').textContent = 'Loading…';busy = true; $('#activity').textContent = data.action === 'prompt' ? 'Pi is working…' : data.action === 'load' ? (data.cachedOnly ? 'Loading local model…' : 'Loading model…') : 'Working…'; controls();} else if (data.type === 'idle') {busy = false; $('#progress').hidden = true; $('#activity').textContent = loaded ? 'Ready · running on your device' : 'Files and chat are saved on this device.'; controls();} else if (data.type === 'workspace') { files = data.files; renderFiles(); followReadFile(); }else if (data.type === 'device') { diagnostics.device = data.device; }else if (data.type === 'load_progress') {$('#progress').hidden = false;121 unmodified lines$('#upload').value = '';});$('#export').onclick = guarded(async () => {const state = await rpc('snapshot'), url = URL.createObjectURL(new Blob([JSON.stringify(state, null, 2)], { type: 'application/json' }));const a = document.createElement('a'); a.href = url; a.download = 'pi-workspace.json'; a.click(); setTimeout(() => URL.revokeObjectURL(url), 1000);});// Browser verification exercises the same worker and real Pi / WebGPU paths as the UI.window.browserPi = { ready, load, prompt, rpc, diagnostics, terminal: terminalUI, runtimeMeter, get loaded() { return loaded; }, get busy() { return busy; } };6 unmodified lines789101112131 unmodified line1516171819202111 unmodified lines3334353637383940414243444546474849505152535418 unmodified lines7374757677787980815 unmodified lines8788899091929394959697989910010110210310410510610710810911032 unmodified lines1431441451461471481494 unmodified lines154155156157158159160161121 unmodified lines2832842852862872882892902916 unmodified linesimport { createFileIcon } from './file-icons.mjs';import { createEditorUI } from './editor-ui.mjs';import { createColumnResizer } from './column-resizer.mjs';import { createLocalFolderUI } from './local-folder-ui.mjs';const $ = selector => document.querySelector(selector);createColumnResizer($('main'), $('#column-resizer'));1 unmodified lineconst pending = new Map();let nextId = 1, busy = false, loaded = false, selected, dirty = false, files = {}, messages = [], readyResolve;let pendingReadPath;let previewVersion = 0, previewReady = true;const ready = new Promise(resolve => { readyResolve = resolve; });const diagnostics = { events: [], generations: [], runtimeSamples: [], device: null, contextUsage: restoredContextUsage([]) };const runtimeMeter = createRuntimeMeter($('#runtime-meter'));11 unmodified linesif (busy) throw Error('Wait for Pi to finish or stop the current task first.');return rpc('shell', { command });} });const localUI = createLocalFolderUI({ rpc, notice,canSwitch() {if (busy) throw Error('Wait for Pi to finish or stop the current task first.');if (dirty) throw Error('Save or stage the open file first.');},onSwitch(state) {pendingReadPath = undefined; selected = undefined; dirty = false; previewVersion++; previewReady = false;files = state.files; messages = state.messages; localUI.setState(state.localFolder);$('#filename').textContent = 'Select a file'; $('#filetype').replaceChildren(); editorUI.setFile('', '');terminalUI.setMessages(messages, { reset: true }); updateContextUsage(restoredContextUsage(messages));$('#shell-clear').click(); renderFiles();const file = Object.hasOwn(files, '/workspace/README.md') ? '/workspace/README.md' : Object.keys(files).sort()[0];if (file) selectFile(file);controls();},});function rpc(action, args) {return new Promise((resolve, reject) => {const id = nextId++; pending.set(id, { resolve, reject }); worker.postMessage({ id, action, args });18 unmodified lines$('#stop').hidden = !busy;for (const id of ['#new-chat', '#add-file', '#upload']) $(id).disabled = busy;shellUI.setBusy(busy);localUI.setBusy(busy);$('#save').disabled = busy || !selected || !dirty;$('#editor').disabled = busy || !selected || !previewReady;}function renderFiles() {terminalUI.setFiles(files);5 unmodified linesbutton.title = file; button.classList.toggle('selected', file === selected);button.onclick = () => selectFile(file); $('#files').append(button);}if (selected && !Object.hasOwn(files, selected) && !dirty) {selected = undefined; previewVersion++; previewReady = false;$('#filename').textContent = 'Select a file'; $('#filetype').replaceChildren(); editorUI.setFile('', ''); controls();}if (selected && !dirty) {if (files[selected] === null) loadPreview(selected);else { previewReady = true; editorUI.setFile(selected, files[selected] ?? ''); }}}async function loadPreview(file) {const version = ++previewVersion;previewReady = false; editorUI.setFile(file, ''); controls();try {const content = await rpc('preview', { path: file });if (version !== previewVersion || file !== selected || dirty) return;editorUI.setFile(file, content); previewReady = true;} catch (error) { if (version === previewVersion) notice(error.message); }finally { if (version === previewVersion) controls(); }}function selectFile(file) {pendingReadPath = undefined;32 unmodified linesconst request = pending.get(data.id); pending.delete(data.id);if (data.error) request?.reject(Object.assign(Error(data.error), { name: data.errorName || 'Error', code: data.errorCode })); else request?.resolve(data.value);} else if (data.type === 'initialized') {localUI.restore(data.savedLocal); localUI.setState(data.localFolder);files = data.files; messages = data.messages; renderFiles(); renderMessages();updateContextUsage(restoredContextUsage(messages));if (files['/workspace/README.md']) selectFile('/workspace/README.md');4 unmodified linesif (data.action === 'load') $('#load').textContent = 'Loading…';busy = true; $('#activity').textContent = data.action === 'prompt' ? 'Pi is working…' : data.action === 'load' ? (data.cachedOnly ? 'Loading local model…' : 'Loading model…') : 'Working…'; controls();} else if (data.type === 'idle') {busy = false; $('#progress').hidden = true; $('#activity').textContent = localUI.active ? 'Local folder · review & apply to save changes to disk' : loaded ? 'Ready · running on your device' : 'Files and chat are saved on this device.'; controls();} else if (data.type === 'workspace') { files = data.files; localUI.setState(data.localFolder); renderFiles(); followReadFile(); }else if (data.type === 'device') { diagnostics.device = data.device; }else if (data.type === 'load_progress') {$('#progress').hidden = false;121 unmodified lines$('#upload').value = '';});$('#export').onclick = guarded(async () => {const state = localUI.active ? { version: 1, patches: await rpc('local_changes') } : await rpc('snapshot');const url = URL.createObjectURL(new Blob([JSON.stringify(state, null, 2)], { type: 'application/json' }));const a = document.createElement('a'); a.href = url; a.download = localUI.active ? 'pi-staged-changes.json' : 'pi-workspace.json'; a.click(); setTimeout(() => URL.revokeObjectURL(url), 1000);});// Browser verification exercises the same worker and real Pi / WebGPU paths as the UI.window.browserPi = { ready, load, prompt, rpc, diagnostics, terminal: terminalUI, runtimeMeter, get loaded() { return loaded; }, get busy() { return busy; } };
4 unmodified lines56789101112131415161718194 unmodified linesrequest.onsuccess = () => resolve(request.result); request.onerror = () => reject(request.error);});return {async load() {return new Promise((resolve, reject) => {const request = db.transaction('state').objectStore('state').get('current');request.onsuccess = () => resolve(request.result); request.onerror = () => reject(request.error);});},async save(value) {return new Promise((resolve, reject) => {const tx = db.transaction('state', 'readwrite'); tx.objectStore('state').put(value, 'current');tx.oncomplete = resolve; tx.onerror = () => reject(tx.error); tx.onabort = () => reject(tx.error);});},4 unmodified lines56789101112131415161718194 unmodified linesrequest.onsuccess = () => resolve(request.result); request.onerror = () => reject(request.error);});return {async load(key = 'current') {return new Promise((resolve, reject) => {const request = db.transaction('state').objectStore('state').get(key);request.onsuccess = () => resolve(request.result); request.onerror = () => reject(request.error);});},async save(value, key = 'current') {return new Promise((resolve, reject) => {const tx = db.transaction('state', 'readwrite'); tx.objectStore('state').put(value, key);tx.oncomplete = resolve; tx.onerror = () => reject(tx.error); tx.onabort = () => reject(tx.error);});},
175 unmodified lines176177178179180181175 unmodified lines.workspace-heading { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 5px 10px; }.workspace-heading h2 { margin: 0; font-size: 12px; font-weight: 600; }.workspace-heading > div { display: flex; gap: 0; }.button { display: inline-block; }.file-area { display: grid; grid-template-columns: 140px minmax(0, 1fr); flex: 1; min-height: 180px; }#files { overflow: auto; padding: 5px 4px; }175 unmodified lines176177178179180181182183184185186187188189190191192193194195196197198199200201202203204175 unmodified lines.workspace-heading { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 5px 10px; }.workspace-heading h2 { margin: 0; font-size: 12px; font-weight: 600; }.workspace-heading > div { display: flex; gap: 0; }.workspace-heading { flex-wrap: wrap; }.folder-controls { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px 7px; }.folder-controls:has(> button:not([hidden])) { min-height: 30px; }.folder-controls:not(:has(> button:not([hidden]))) { display: none; }#open-folder { color: var(--accent, #8abeb7); background: #8abeb710; }#local-folder-bar { margin: 0 8px 8px; padding: 10px; border-radius: 10px; background: #8abeb710; font-size: 11px; }#local-folder-name { display: block; color: var(--accent, #8abeb7); overflow-wrap: anywhere; }#local-folder-hint { display: block; margin: 4px 0 8px; color: var(--muted); line-height: 1.5; }.folder-actions { display: flex; gap: 5px; flex-wrap: wrap; }.folder-actions button { font-size: 11px; padding: 6px 9px; }#local-review { box-sizing: border-box; width: min(820px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 20px; border: 1px solid #8abeb740; border-radius: 18px; background: var(--bg, #18181e); color: var(--text); }#local-review::backdrop { background: #0009; backdrop-filter: blur(4px); }.review-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }.review-heading h2 { margin: 0; font-size: 20px; }#review-close { font-size: 24px; padding: 2px 10px; }#review-description { color: var(--muted); font-size: 13px; line-height: 1.5; }#review-files { max-height: 55dvh; overflow: auto; }#review-files details { border: 1px solid #ffffff18; border-radius: 8px; margin: 8px 0; overflow: hidden; }#review-files summary { padding: 10px; cursor: pointer; font: 12px ui-monospace, monospace; overflow-wrap: anywhere; }#review-files pre { overflow: auto; margin: 0; padding: 10px; background: #0003; font: 12px/1.55 ui-monospace, monospace; tab-size: 2; }.diff-add { color: #98dfb4; } .diff-remove { color: #f2a6a6; }#review-error { color: #f2a6a6; font-size: 13px; line-height: 1.5; }.review-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 16px; }.button { display: inline-block; }.file-area { display: grid; grid-template-columns: 140px minmax(0, 1fr); flex: 1; min-height: 180px; }#files { overflow: auto; padding: 5px 4px; }
30 unmodified lines3132333435363738394039 unmodified lines8081828384854 unmodified lines9091929394958 unmodified lines10410510610710830 unmodified linesconst limitText = text => text.length > 6000 ? text.slice(0, 6000) + '\n[Output truncated at 6,000 characters; use head, grep, or a narrower query.]' : text;const result = (text, details = {}) => ({ content: [{ type: 'text', text: limitText(text) }], details });export function createWorkspace(files = initialFiles, entries) {if (entries) files = Object.fromEntries(entries.filter(([, entry]) => entry.type === 'file').map(([path, entry]) => [path,{ mode: entry.mode, content: Uint8Array.from(atob(entry.base64), c => c.charCodeAt(0)) }]));const bash = new Bash({ files, cwd: '/workspace', executionLimitProfile: 'hardened', fetch: createBrowserFetch(),executionLimits: { maxExecutionTimeMs: 10_000, maxCommandCount: 3000,maxFileSystemBytes: 16 * 1024 ** 2, maxOutputSize: 256 * 1024, maxSourceBytes: 128 * 1024 },});39 unmodified lines},}];async function snapshot() {const files = {};for (const file of bash.fs.getAllPaths().sort()) {// Persist real files across the virtual FS, excluding built-in executable stubs.4 unmodified linesreturn files;}async function serialize() {const entries = [];for (const file of bash.fs.getAllPaths().sort()) {if (['/bin', '/usr/bin', '/dev', '/proc'].some(root => file === root || file.startsWith(root + '/'))) continue;8 unmodified lines}return entries;}return { bash, tools, ready, write, snapshot, serialize, read: file => bash.fs.readFile(path(file)) };}30 unmodified lines3132333435363738394039 unmodified lines808182838485864 unmodified lines919293949596978 unmodified lines10610710810911030 unmodified linesconst limitText = text => text.length > 6000 ? text.slice(0, 6000) + '\n[Output truncated at 6,000 characters; use head, grep, or a narrower query.]' : text;const result = (text, details = {}) => ({ content: [{ type: 'text', text: limitText(text) }], details });export function createWorkspace(files = initialFiles, entries, localFolder) {if (entries) files = Object.fromEntries(entries.filter(([, entry]) => entry.type === 'file').map(([path, entry]) => [path,{ mode: entry.mode, content: Uint8Array.from(atob(entry.base64), c => c.charCodeAt(0)) }]));const bash = new Bash({ ...(localFolder ? { fs: localFolder.mount() } : { files }), cwd: '/workspace', executionLimitProfile: 'hardened', fetch: createBrowserFetch(),executionLimits: { maxExecutionTimeMs: 10_000, maxCommandCount: 3000,maxFileSystemBytes: 16 * 1024 ** 2, maxOutputSize: 256 * 1024, maxSourceBytes: 128 * 1024 },});39 unmodified lines},}];async function snapshot() {if (localFolder) return localFolder.listing();const files = {};for (const file of bash.fs.getAllPaths().sort()) {// Persist real files across the virtual FS, excluding built-in executable stubs.4 unmodified linesreturn files;}async function serialize() {if (localFolder) return null; // Local file bytes are never included in demo snapshots.const entries = [];for (const file of bash.fs.getAllPaths().sort()) {if (['/bin', '/usr/bin', '/dev', '/proc'].some(root => file === root || file.startsWith(root + '/'))) continue;8 unmodified lines}return entries;}return { bash, tools, ready, write, snapshot, serialize, localFolder, read: file => bash.fs.readFile(path(file)) };}
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788import { chromium, webkit } from 'playwright';import assert from 'node:assert/strict';import fs from 'node:fs/promises';const url = process.argv[2] || 'http://127.0.0.1:4193/';const label = process.argv[3] || 'local-folder-browser';const result = { url, date: new Date().toISOString(), checks: [], errors: [], picker: 'Test supplies a real OPFS directory handle; native OS picker covered separately.' };const browser = await chromium.launch({ executablePath: '/usr/bin/chromium', headless: true });const context = await browser.newContext({ viewport: { width: 1440, height: 1000 } });const page = await context.newPage();page.on('pageerror', e => result.errors.push(e.message));const idle = () => page.waitForFunction(() => window.browserPi && !window.browserPi.busy);const rpc = (action, args) => page.evaluate(({ action, args }) => window.browserPi.rpc(action, args), { action, args });const disk = name => page.evaluate(async name => (await (await window.testFolder.getFileHandle(name)).getFile()).text(), name);async function open() { await page.goto(url); await page.waitForFunction(() => window.browserPi); await page.evaluate(() => window.browserPi.ready); await idle(); }try { await open(); const demo = await rpc('snapshot'); await page.evaluate(async () => { const root = await navigator.storage.getDirectory(); window.testFolder = await root.getDirectoryHandle('project-fixture', { create: true }); const write = async (name, text) => { const s = await (await window.testFolder.getFileHandle(name, { create: true })).createWritable(); await s.write(text); await s.close(); }; await write('README.md', '# Local fixture\n'); await write('count.txt', '1\n'); const modules = await window.testFolder.getDirectoryHandle('node_modules', { create: true }); const ignored = await (await modules.getFileHandle('ignored.js', { create: true })).createWritable(); await ignored.write('ignore'); await ignored.close(); window.pickerCalls = 0; window.showDirectoryPicker = async () => { window.pickerCalls++; window.pickerGesture = navigator.userActivation.isActive; return window.testFolder; }; }); await page.locator('#open-folder').click(); await page.waitForFunction(() => document.querySelector('#editor').value === '# Local fixture\n'); await idle(); assert.equal(await page.evaluate(() => window.pickerGesture), true); assert.equal((await rpc('snapshot')).entries, null); assert.equal(await page.locator('#files').innerText(), 'README.md\ncount.txt'); result.checks.push('Real directory handle crosses worker boundary; picker called with user activation; existing editor/tree reused; excluded directories omitted'); await page.locator('#editor').fill('# Edited local fixture\n'); await page.locator('#save').click(); await idle(); assert.equal(await disk('README.md'), '# Local fixture\n'); await page.locator('#review-changes').click(); await page.locator('#local-review').waitFor({ state: 'visible' }); assert.match(await page.locator('#review-files').innerText(), /\+# Edited local fixture/); await page.screenshot({ path: `../validation/${label}-review.png` }); await page.locator('#review-apply').click(); await page.locator('#local-review').waitFor({ state: 'hidden' }); await idle(); assert.equal(await disk('README.md'), '# Edited local fixture\n'); result.checks.push('Editor changes are staged; readable diff reviewed; Apply writes through the browser API'); const shell = await rpc('shell', { command: "printf 'new file\\n' > added.txt; printf '2\\n' > count.txt" }); assert.equal(shell.exitCode, 0, shell.stderr); await idle(); assert.equal(await disk('count.txt'), '1\n'); await page.locator('#disconnect-folder').click(); await page.locator('#open-folder').waitFor({ state: 'visible' }); await idle(); assert.deepEqual((await rpc('snapshot')).files, demo.files); assert.deepEqual((await rpc('snapshot')).messages, demo.messages); await page.reload(); await page.waitForFunction(() => window.browserPi); await page.evaluate(() => window.browserPi.ready); await page.locator('#reconnect-folder').click(); await page.locator('#local-folder-bar').waitFor({ state: 'visible' }); await idle(); const staged = await rpc('local_changes'); assert.equal(staged.length, 2); await page.evaluate(async () => { window.testFolder = await (await navigator.storage.getDirectory()).getDirectoryHandle('project-fixture'); }); assert.equal(await rpc('read', { path: '/workspace/added.txt' }), 'new file\n'); await idle(); result.checks.push('Back to demo restores original files/chat; reload + reconnect restores handle, staged edits and local chat from separate IndexedDB record'); await page.evaluate(async () => { const s = await (await window.testFolder.getFileHandle('count.txt')).createWritable(); await s.write('9\n'); await s.close(); }); await page.locator('#review-changes').click(); await page.locator('#review-apply').click(); await page.waitForFunction(() => document.querySelector('#review-error').textContent.includes('Conflict')); assert.equal(await disk('count.txt'), '9\n'); assert.equal(await page.evaluate(async () => { try { await window.testFolder.getFileHandle('added.txt'); return true; } catch { return false; } }), false); page.once('dialog', d => d.accept()); await page.locator('#review-discard').click(); await page.locator('#local-review').waitFor({ state: 'hidden' }); await idle(); assert.equal((await rpc('local_changes')).length, 0); result.checks.push('External edit blocks the whole apply before any disk mutation; Discard leaves external contents intact'); for (const width of [1440, 390, 320]) { await page.setViewportSize({ width, height: width === 1440 ? 1000 : 844 }); assert(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)); await page.locator('#local-folder-bar').scrollIntoViewIfNeeded(); await page.screenshot({ path: `../validation/${label}-${width}.png`, fullPage: true }); } result.checks.push('Folder controls and editor fit 1440, 390 and 320px layouts'); await page.locator('#disconnect-folder').click(); await idle(); await page.evaluate(() => { window.showDirectoryPicker = async () => { throw new DOMException('Cancelled', 'AbortError'); }; }); await page.locator('#open-folder').click(); await idle(); assert.deepEqual((await rpc('snapshot')).files, demo.files); result.checks.push('Cancelling picker preserves the demo workspace'); // True cross-origin embedding, not a replaced window.top property. const embed = await context.newPage(); await context.grantPermissions(['local-network-access']); const parent = url.startsWith('http:') ? 'http://localhost:4193/embed-fixture' : 'https://embed.example/'; await embed.route(parent, route => route.fulfill({ contentType: 'text/html', body: `<iframe src="${url}" style="width:100%;height:900px"></iframe>` })); await embed.goto(parent); const frame = embed.frameLocator('iframe'); await frame.locator('#open-folder').click(); assert.match(await frame.locator('#notice').innerText(), /new tab/); await frame.locator('#open-tab').waitFor({ state: 'visible' }); await embed.close(); result.checks.push('Cross-origin iframe offers direct app tab instead of a blocked native picker'); assert.deepEqual(result.errors, []); result.passed = true;} catch (e) { result.failure = e.stack; await page.screenshot({ path: `../validation/${label}-failure.png`, fullPage: true }); throw e; }finally { await fs.writeFile(`../validation/${label}.json`, JSON.stringify(result, null, 2)); await browser.close(); console.log(JSON.stringify(result, null, 2)); }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125import test from 'node:test';import assert from 'node:assert/strict';import fs from 'node:fs/promises';import os from 'node:os';import path from 'node:path';import { LocalFolderFs, displayText } from '../src/local-folder.mjs';import { createWorkspace } from '../src/workspace.mjs';
// OS-backed handle fixture for adapter semantics. Actual browser handle cloning,// permissions, picker UX, and IndexedDB are covered by the browser suite.async function fixture(t, initial = { 'README.md': '# Local project\n', 'src/app.js': 'export const answer = 1;\n' }) { const root = await fs.mkdtemp(path.join(os.tmpdir(), 'pi-folder-test-')); t.after(() => fs.rm(root, { recursive: true, force: true })); for (const [name, data] of Object.entries(initial)) { await fs.mkdir(path.dirname(path.join(root, name)), { recursive: true }); await fs.writeFile(path.join(root, name), data); } let reads = 0, failWrite = false; const handle = (p, kind) => ({ kind, name: path.basename(p), async *entries() { for (const item of await fs.readdir(p, { withFileTypes: true })) yield [item.name, handle(path.join(p, item.name), item.isDirectory() ? 'directory' : 'file')]; }, async getFile() { const stat = await fs.stat(p); return { size: stat.size, lastModified: stat.mtimeMs, async arrayBuffer() { reads++; return new Uint8Array(await fs.readFile(p)).buffer; } }; }, fixturePath: p, async isSameEntry(other) { return other.fixturePath === p; }, async createWritable() { if (failWrite) throw new DOMException('Write denied', 'NotAllowedError'); let bytes; return { async write(data) { bytes = data; }, async close() { await fs.writeFile(p, bytes); }, async abort() {} }; }, async removeEntry(name) { await fs.rm(path.join(p, name)); }, }); // Install traversal separately so each handle closes over its own path. function make(p, kind) { const h = handle(p, kind); const child = async (name, wanted, create) => { assert(!name.includes('/') && name !== '..'); const target = path.join(p, name); let stat; try { stat = await fs.stat(target); } catch (e) { if (e.code !== 'ENOENT') throw e; if (!create) throw new DOMException('Missing', 'NotFoundError'); if (wanted === 'directory') await fs.mkdir(target); else await fs.writeFile(target, ''); stat = await fs.stat(target); } if (stat.isDirectory() !== (wanted === 'directory')) throw new DOMException('Wrong kind', 'TypeMismatchError'); return make(target, wanted); }; h.getDirectoryHandle = (name, { create = false } = {}) => child(name, 'directory', create); h.getFileHandle = (name, { create = false } = {}) => child(name, 'file', create); h.entries = async function* () { for (const item of await fs.readdir(p, { withFileTypes: true })) yield [item.name, make(path.join(p, item.name), item.isDirectory() ? 'directory' : 'file')]; }; return h; } const directory = make(root, 'directory'); return { root, directory, get reads() { return reads; }, denyWrites() { failWrite = true; }, read: name => fs.readFile(path.join(root, name), 'utf8'), write: (name, text) => fs.writeFile(path.join(root, name), text) };}
test('Local folder: indexing/listing/stat do not read file bytes; workspace snapshots stay metadata-only', async t => { const disk = await fixture(t, { 'a.txt': 'hello', 'large.bin': Buffer.alloc(2 * 1024 ** 2), 'node_modules/ignore.js': 'ignored' }); const local = await LocalFolderFs.open(disk.directory), workspace = createWorkspace({}, undefined, local); await workspace.ready; assert.equal(disk.reads, 0); assert.deepEqual(Object.keys(await workspace.snapshot()), ['/workspace/a.txt', '/workspace/large.bin']); assert.equal(await workspace.serialize(), null); const listing = await workspace.bash.exec('ls -l /workspace'); assert.equal(listing.exitCode, 0, listing.stderr); assert.equal(disk.reads, 0); assert.equal(local.skipped, 1); assert.equal(await workspace.read('a.txt'), 'hello'); assert.equal(disk.reads, 1); await assert.rejects(workspace.read('large.bin'), /1 MiB/);});test('Local folder: real Bash and agent tools stage edits, mkdir, copy, rename, delete; Apply writes only staged paths', async t => { const disk = await fixture(t); const local = await LocalFolderFs.open(disk.directory), workspace = createWorkspace({}, undefined, local); await workspace.ready; await workspace.tools.find(t => t.name === 'edit').execute('', { path: 'src/app.js', oldText: '= 1', newText: '= 2' }); const result = await workspace.bash.exec("mkdir -p reports/nested; printf 'ok\\n' > reports/nested/result.txt; cp README.md copy.md; mv copy.md moved.md; rm README.md"); assert.equal(result.exitCode, 0, result.stderr); assert.equal(await disk.read('src/app.js'), 'export const answer = 1;\n'); assert.equal(await disk.read('README.md'), '# Local project\n'); const patches = await local.patches(); assert.equal(patches.length, 6); assert.equal(await local.apply(), 6); assert.equal(await disk.read('src/app.js'), 'export const answer = 2;\n'); assert.equal(await disk.read('moved.md'), '# Local project\n'); assert.equal(await disk.read('reports/nested/result.txt'), 'ok\n'); await assert.rejects(disk.read('README.md'), { code: 'ENOENT' }); assert.equal((await local.patches()).length, 0);});test('Local folder: conflicts preflight all writes, including same-size edits, creations and deletions', async t => { const disk = await fixture(t); const local = await LocalFolderFs.open(disk.directory); await local.writeFile('/README.md', 'changed'); await local.writeFile('/src/app.js', 'staged'); await disk.write('src/app.js', 'export const answer = 9;\n'); await assert.rejects(local.apply(), /Conflict/); assert.equal(await disk.read('README.md'), '# Local project\n'); assert.equal(await disk.read('src/app.js'), 'export const answer = 9;\n'); const fresh = await LocalFolderFs.open(disk.directory); await fresh.writeFile('/new.txt', 'staged'); await disk.write('new.txt', 'external'); await assert.rejects(fresh.apply(), /Conflict/); assert.equal(await disk.read('new.txt'), 'external'); const deleted = await LocalFolderFs.open(disk.directory); await deleted.rm('/README.md'); await disk.write('README.md', 'other editor'); await assert.rejects(deleted.apply(), /Conflict/); assert.equal(await disk.read('README.md'), 'other editor');});test('Local folder: staged patches restore with the original baseline, not a newly changed disk file', async t => { const disk = await fixture(t), local = await LocalFolderFs.open(disk.directory); await local.writeFile('/src/app.js', 'staged'); await local.mkdir('/new'); await local.writeFile('/new/file', 'new'); const patches = await local.patches(); await disk.write('src/app.js', 'external'); const restored = await LocalFolderFs.open(disk.directory, { patches }); assert.equal(await restored.readFile('/src/app.js'), 'staged'); assert.equal(await restored.readFile('/new/file'), 'new'); await assert.rejects(restored.apply(), /Conflict/);});test('Local folder: failed or cancelled application retains pending edits', async t => { const disk = await fixture(t), local = await LocalFolderFs.open(disk.directory); await local.writeFile('/README.md', 'staged'); await assert.rejects(local.apply(AbortSignal.abort()), { name: 'AbortError' }); disk.denyWrites(); await assert.rejects(local.apply(), /0 of 1 changes applied/); assert.equal((await local.patches()).length, 1); assert.equal(await disk.read('README.md'), '# Local project\n'); const newFile = await LocalFolderFs.open(disk.directory); await newFile.writeFile('/new.txt', 'staged'); await assert.rejects(newFile.apply(), /0 of 1/); await assert.rejects(disk.read('new.txt'), { code: 'ENOENT' }); assert.equal((await newFile.patches()).length, 1);});test('Local folder: unsupported operations, excludes, binary editor and traversal do not touch disk', async t => { const disk = await fixture(t), local = await LocalFolderFs.open(disk.directory), workspace = createWorkspace({}, undefined, local); await workspace.ready; for (const method of ['chmod', 'symlink', 'link', 'utimes']) assert.throws(() => local[method]('/README.md', 0o777), /ENOTSUP/); await assert.rejects(local.rm('/src', { recursive: true }), /not supported/); await assert.rejects(local.writeFile('/.git/config', 'oops'), /excluded/); assert.throws(() => displayText(new Uint8Array([0, 1])), /binary/); await workspace.write('../outside.txt', 'virtual only'); assert.deepEqual(await local.patches(), []); await assert.rejects(disk.read('outside.txt'), { code: 'ENOENT' });});1:root{font-synthesis:none;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;color:var(--text);background:var(--background);--background:#18181e;--surface:#1e1e24;--panel:#22222b;--control:#282832;--hover:#343541;--selected:#3a3a4a;--line:#393942;--line-strong:#50505c;--text:#d4d4d4;--muted:#b0b0bd;--accent:#8abeb7;--surface-inset:8px;--radius-small:8px;--radius:calc(var(--radius-small) + var(--surface-inset));--radius-large:calc(var(--radius) + var(--surface-inset));--content-width:1800px;--content-gutter:14px;--header-inset:12px;--header-control-height:32px;--header-height:calc(var(--header-control-height) + 2 * var(--surface-inset));scrollbar-color:var(--line-strong) var(--background);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:13px}*{box-sizing:border-box}body{margin:0}button,input,textarea{font:inherit;color:inherit}::selection{background:var(--selected);color:var(--text)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}button,.button{cursor:pointer;border-radius:var(--radius-small);background:var(--control);min-height:28px;color:inherit;white-space:nowrap;border:1px solid #0000;padding:5px 9px;font-size:12px;line-height:1.4}button:hover,.button:hover{background:var(--hover)}button:disabled{opacity:.45;cursor:default}.primary{background:var(--hover);color:var(--text)}.primary:hover{background:var(--selected)}#send.has-input:not(:disabled){color:#18181e;background:#fff}#send.has-input:not(:disabled):hover{background:#e8e8ed}.quiet{background:0 0;border-color:#0000;font-size:11px}textarea,input{outline:none}textarea:focus,input:focus{box-shadow:inset 0 0 0 1px var(--accent)}button:focus-visible,.button:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px}[hidden]{display:none!important}header{width:calc(100% - 2 * var(--content-gutter));max-width:calc(var(--content-width) - 2 * var(--content-gutter));height:var(--header-height);margin:var(--header-inset) auto 0;padding:var(--surface-inset);justify-content:space-between;align-items:center;gap:var(--surface-inset) 16px;background:var(--surface);border-radius:var(--radius);grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);display:grid;position:relative;overflow:hidden}.brand{color:inherit;align-items:center;gap:8px;font-size:15px;font-weight:600;text-decoration:none;display:flex}.pi-logo{flex:none;width:18px;height:18px;display:block}.brand{justify-self:start;padding:0 4px}.runtime-meter{--runtime-padding:10px;width:max-content;max-width:100%;height:var(--header-control-height);padding:5px var(--runtime-padding);border-radius:var(--radius-small);background:var(--control);white-space:nowrap;justify-self:center;align-items:center;font-size:11px;transition:width .22s cubic-bezier(.2,.8,.2,1);display:flex;overflow:clip}.runtime-content{flex:none;align-items:center;gap:8px;width:max-content;height:100%;display:flex}.runtime-location{flex:none;align-items:center;gap:6px;display:flex}.runtime-dot{background:var(--muted);border-radius:50%;width:5px;height:5px}.runtime-meter[data-state=generating] .runtime-dot,.runtime-meter[data-state=tool] .runtime-dot{background:var(--accent)}.runtime-meter[data-state=error] .runtime-dot{background:#d98c8c}.runtime-divider{background:var(--line);flex:0 0 1px;align-self:stretch;margin:2px 0}.runtime-sparkline{color:var(--accent);flex:none}.runtime-value{color:var(--muted);font-variant-numeric:tabular-nums;flex:none}.runtime-meter[data-state=generating] .runtime-value{color:var(--accent)}@media (prefers-reduced-motion:reduce){.runtime-meter{transition:none}}main{--conversation-min:420px;--workspace-min:370px;grid-template-columns:minmax(var(--conversation-min), var(--conversation-width,1.20482fr)) 0 minmax(var(--workspace-min), 1fr);height:calc(100dvh - var(--header-height) - var(--header-inset));max-width:var(--content-width);margin:auto;display:grid}.column-resizer{left:calc(-1 * var(--content-gutter));z-index:2;width:var(--content-gutter);cursor:col-resize;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;outline:none;justify-content:center;align-items:center;margin:12px 0 8px;display:flex;position:relative}.column-resizer:after{content:"";background:var(--line-strong);border-radius:999px;flex:none;width:3px;height:44px;transition:background-color .12s}.column-resizer:hover:after{background:var(--text)}.column-resizer:focus-visible:after{background:var(--accent);outline:2px solid var(--accent);outline-offset:4px}.is-resizing-columns,.is-resizing-columns *{cursor:col-resize!important;-webkit-user-select:none!important;user-select:none!important}.is-resizing-columns .column-resizer:after{background:var(--accent)}@media (prefers-reduced-motion:reduce){.column-resizer:after{transition:none}}@media (forced-colors:active){.column-resizer:after{background:buttontext}}.conversation{min-width:0;min-height:0;padding:12px var(--content-gutter) 8px;flex-direction:column;display:flex}.model-panel{background:var(--surface);margin-left:auto}.model-heading{justify-content:space-between;align-items:center;gap:8px;display:flex}.model-heading>div{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.model-heading strong{font-size:12px;font-weight:600}.header-model-source{color:inherit;white-space:nowrap;border-radius:3px;flex:none;align-items:center;gap:6px;text-decoration:none;display:inline-flex}.header-model-source img{border-radius:50%;flex:none;width:16px;height:16px;display:block}.header-model-source:hover{color:var(--accent)}.header-model-source:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.badge{border-radius:var(--radius-small);background:var(--control);color:var(--muted);padding:3px 7px;font-size:10px}#load{min-width:90px;height:var(--header-control-height);flex-shrink:0}#load.is-loaded{opacity:1;min-width:0;height:28px;min-height:28px;color:var(--accent);background:#25312f;border-radius:6px;justify-content:center;align-items:center;gap:6px;padding:4px 8px;display:inline-flex}#load.is-loaded:before{content:"";background:currentColor;border-radius:50%;flex:none;width:5px;height:5px}progress{width:100%;height:5px;accent-color:var(--accent);margin-top:8px}header #progress{bottom:3px;left:var(--radius);width:calc(100% - 2 * var(--radius));appearance:none;background:var(--line);--progress-fade:clamp(24px, 5vw, 72px);--progress-mask:linear-gradient(90deg, transparent 2px, #000 var(--progress-fade), #000 calc(100% - var(--progress-fade)), transparent calc(100% - 2px));height:2px;-webkit-mask-image:var(--progress-mask);mask-image:var(--progress-mask);-webkit-mask-image:var(--progress-mask);border:0;border-radius:999px;margin:0;position:absolute;overflow:hidden}header #progress::-webkit-progress-bar{background:var(--line);border-radius:999px}header #progress::-webkit-progress-value{background:var(--accent);border-radius:999px}header #progress::-moz-progress-bar{background:var(--accent);border-radius:999px}header #progress:indeterminate{background:linear-gradient(90deg, transparent, var(--accent), transparent) 0 0 / 35% 100% no-repeat var(--line);animation:1.4s ease-in-out infinite alternate header-progress}header #progress:indeterminate::-webkit-progress-bar{background:0 0}header #progress:indeterminate::-webkit-progress-value{background:0 0}header #progress:indeterminate::-moz-progress-bar{background:0 0}@keyframes header-progress{0%{background-position:0 0}to{background-position:100% 0}}@media (prefers-reduced-motion:reduce){header #progress:indeterminate{background-position:50% 0;animation:none}}.muted{color:var(--muted);margin-top:4px;font-size:11px}.muted:empty{display:none}.terminal-panel{background:var(--background);border-radius:var(--radius-large);border:1px solid #0000;flex-direction:column;flex:1;min-height:0;padding:8px;display:flex}@media (width>=851px){.terminal-panel{padding-right:0}}#pi-terminal{isolation:isolate;background:var(--background);flex:1;min-width:0;min-height:120px;position:relative;overflow:hidden}#pi-terminal .pi-terminal-mount,#pi-terminal .xterm{height:100%}#pi-terminal .xterm-viewport{background-color:var(--background)!important}#pi-terminal textarea:focus{box-shadow:none}.terminal-paws{pointer-events:none;-webkit-user-select:none;user-select:none;position:absolute;overflow:hidden}.terminal-paws i{background:var(--muted);opacity:0;width:24px;height:24px;position:absolute;transform:rotate(28deg);-webkit-mask:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20fill='black'%3e%3cpath%20d='M2%207h4v5H2zM7%202h4v6H7zM13%202h4v6h-4zM18%207h4v5h-4zM8%2012h8v2h3v6h-4v-1H9v1H5v-6h3z'/%3e%3c/g%3e%3c/svg%3e") 50%/contain no-repeat;mask:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20fill='black'%3e%3cpath%20d='M2%207h4v5H2zM7%202h4v6H7zM13%202h4v6h-4zM18%207h4v5h-4zM8%2012h8v2h3v6h-4v-1H9v1H5v-6h3z'/%3e%3c/g%3e%3c/svg%3e") 50%/contain no-repeat}.terminal-paws:not([hidden]) i{animation:3.2s ease-in-out both terminal-paw;animation-delay:var(--delay)}.terminal-paws i:first-child{left:calc(18% + var(--trail-shift));--delay:0s;top:85%}.terminal-paws i:nth-child(2){left:calc(26% + var(--trail-shift));--delay:.65s;top:78%}.terminal-paws i:nth-child(3){left:calc(27% + var(--trail-shift));--delay:1.3s;top:68%}.terminal-paws i:nth-child(4){left:calc(35% + var(--trail-shift));--delay:1.95s;top:61%}.terminal-paws i:nth-child(5){left:calc(36% + var(--trail-shift));--delay:2.6s;top:51%}.terminal-paws i:nth-child(6){left:calc(44% + var(--trail-shift));--delay:3.25s;top:44%}@keyframes terminal-paw{0%,to{opacity:0}15%,40%{opacity:.14}}@media (width<=600px){.terminal-paws i{width:18px;height:18px}}@media (prefers-reduced-motion:reduce){.terminal-paws{display:none}}.empty-mascot{pointer-events:none;flex-direction:column;align-items:flex-end;gap:10px;width:196px;max-width:calc(100% - 24px);display:flex;position:absolute;right:12px}.mascot-cat{pointer-events:auto;cursor:pointer;mix-blend-mode:lighten;background:0 0;border:0;border-radius:0;flex:none;min-height:0;padding:0;line-height:0;display:block;position:relative;transform:translate(0,0)}.mascot-cat:hover{background:0 0}.mascot-cat,.setup-cat{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;outline:none}.mascot-cat,.mascot-cat *,.setup-cat,.setup-cat *{-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.mascot-cat>*,.setup-cat>*{pointer-events:none}.empty-mascot img{object-fit:contain;width:100%;height:100%;image-rendering:pixelated;-webkit-user-select:none;user-select:none;display:block}.mascot-eyelids{opacity:0;position:absolute;inset:0}.mascot-eyelids:before,.mascot-eyelids:after{content:"";background:linear-gradient(to bottom, #f6f0e1 70%, var(--background) 70%, var(--background) 86%, #f6f0e1 86%);width:7%;height:7.4%;position:absolute;top:39.3%}.mascot-eyelids:before{left:28.5%}.mascot-eyelids:after{left:54%}.mascot-suggestion{pointer-events:auto;color:#24242c;text-align:left;white-space:normal;background:#f5efdf;border:0;border-radius:8px;padding:10px 12px;font:12px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace;position:relative;box-shadow:0 3px #0c0c10}.mascot-suggestion:after{content:"";background:inherit;clip-path:polygon(0 0,100% 0,100% 50%,50% 50%,50% 100%,0 100%);width:12px;height:8px;position:absolute;bottom:-8px;right:52px}.mascot-suggestion:hover{background:#fffaf0}.terminal-controls{justify-content:flex-end;align-items:center;gap:8px;padding-top:4px;display:flex}.terminal-controls,.terminal-panel>footer{cursor:text}#new-chat{margin-right:auto}#newline:not(:hover){background:0 0}#notice{border-radius:var(--radius-small);background:var(--control);margin:6px 0;padding:8px 10px;font-size:12px}footer{color:var(--muted);justify-content:space-between;align-items:center;gap:8px;padding-top:8px;font-size:10px;display:flex}.workspace{min-width:0;min-height:0;margin:12px var(--content-gutter) 8px 0;background:var(--panel);border-radius:20px;flex-direction:column;display:flex;overflow:hidden}.workspace-heading{justify-content:space-between;align-items:center;min-height:40px;padding:5px 10px;display:flex}.workspace-heading h2{margin:0;font-size:12px;font-weight:600}.workspace-heading>div{gap:0;display:flex}.button{display:inline-block}.file-area{flex:1;grid-template-columns:140px minmax(0,1fr);min-height:180px;display:grid}#files{padding:5px 4px;overflow:auto}#files button{border-radius:var(--radius-small);text-align:left;white-space:normal;overflow-wrap:anywhere;background:0 0;border:none;align-items:center;gap:6px;width:100%;padding:5px 7px;font-family:ui-monospace,monospace;font-size:11px;line-height:1.45;display:flex}.file-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.file-icon{background-color:var(--file-color);width:16px;height:16px;-webkit-mask:var(--file-icon) center / 90% 90% no-repeat;mask:var(--file-icon) center / 90% 90% no-repeat;-webkit-mask:var(--file-icon) center / 90% 90% no-repeat;flex:0 0 16px;display:inline-block}.editor-file{align-items:center;gap:6px;min-width:0;display:flex}#filetype{flex:none;display:flex}#filetype:empty{display:none}@media (forced-colors:active){.file-icon{background-color:canvastext}}#files button:hover{background:var(--hover)}#files button.selected{background:var(--selected);color:var(--text)}.editor-area{border-radius:var(--radius);background:var(--surface);flex-direction:column;min-width:0;min-height:0;margin:0 8px 8px 0;display:flex;overflow:hidden}.editor-heading{background:#282832;justify-content:space-between;align-items:center;gap:6px;height:32px;padding:0 6px 0 10px;transition:background-color .14s,box-shadow .14s;display:flex}.editor-area:focus-within .editor-heading{background:#30323a;box-shadow:inset 0 -1px #8abeb74d}@media (prefers-reduced-motion:reduce){.editor-heading{transition:none}}@media (forced-colors:active){.editor-area:focus-within .editor-heading{outline-offset:-1px;outline:1px solid highlight}}#filename{text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,monospace;font-size:11px;overflow:hidden}.editor-heading{flex-shrink:0}.editor-input{flex:1;min-width:0;min-height:140px;position:relative;overflow:hidden}#editor,#editor-highlight{width:100%;height:100%;color:var(--text);font-variant-ligatures:none;letter-spacing:normal;tab-size:2;white-space:pre;overflow-wrap:normal;border:0;border-radius:0;margin:0;padding:10px 12px;font:12px/1.6 ui-monospace,SFMono-Regular,Consolas,monospace;position:absolute;top:0;left:0}#editor{resize:none;caret-color:var(--text);background:0 0;overflow:auto}#editor-highlight{visibility:hidden;pointer-events:none;overflow:hidden}.is-highlighted #editor-highlight{visibility:visible}.is-highlighted #editor{color:#0000}.is-highlighted #editor::selection{color:#0000}#editor::selection{background:#8abeb740}#editor:focus{box-shadow:none}#editor-highlight .token{font-style:normal;font-weight:400}#editor-highlight .token.comment,#editor-highlight .token.prolog,#editor-highlight .token.doctype{color:#9292a3}#editor-highlight .token.punctuation{color:#b0b0bd}#editor-highlight .token.tag,#editor-highlight .token.deleted{color:#e29a9a}#editor-highlight .token.keyword,#editor-highlight .token.selector,#editor-highlight .token.important{color:#c4a7d5}#editor-highlight .token.string,#editor-highlight .token.attr-value,#editor-highlight .token.inserted{color:#b5bd68}#editor-highlight .token.function,#editor-highlight .token.builtin,#editor-highlight .token.class-name{color:#8abeb7}#editor-highlight .token.attr-name,#editor-highlight .token.property,#editor-highlight .token.variable{color:#9db9d4}#editor-highlight .token.number,#editor-highlight .token.boolean,#editor-highlight .token.constant,#editor-highlight .token.operator,#editor-highlight .token.entity,#editor-highlight .token.url{color:#f0c674}@media (forced-colors:active){.is-highlighted #editor-highlight{visibility:hidden}.is-highlighted #editor{color:canvastext}.is-highlighted #editor::selection{color:canvastext}}.workspace>.terminal{border-radius:var(--radius);background:var(--background);flex-shrink:0;margin:0 8px;padding:0 8px 8px}.terminal summary{cursor:pointer;padding:6px 0;font-size:11px;font-weight:500}.terminal summary span{float:right;color:var(--muted);font-size:10px;font-weight:400}.shell-toolbar{color:var(--accent);justify-content:space-between;align-items:center;font:11px/1.5 ui-monospace,monospace;display:flex}.shell-toolbar button{color:var(--muted)}#terminal-output{resize:vertical;scrollbar-width:thin;overflow-wrap:anywhere;height:132px;min-height:84px;max-height:min(480px,45dvh);margin:0 0 6px;padding:2px 0;font:12px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;overflow:auto}#terminal-output:focus-visible{outline:1px solid var(--accent);outline-offset:2px;border-radius:var(--radius-small)}.shell-empty{color:var(--muted);flex-direction:column;gap:4px;padding:8px 2px;display:flex}.shell-empty strong{color:var(--text);font-weight:500}.shell-empty code{color:var(--accent)}.shell-entry{border-radius:var(--radius-small);background:var(--surface);margin-bottom:6px;padding:8px}.shell-entry:last-child{margin-bottom:0}.shell-entry-heading{align-items:baseline;gap:8px;display:flex}.shell-entry pre{font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.shell-code{flex:1;min-width:0}.shell-status{color:var(--muted);flex-shrink:0;font-size:10px}.shell-status.success{color:#b5bd68}.shell-status.error,.shell-stderr{color:#e29a9a}.shell-entry .shell-stdout,.shell-entry .shell-stderr{margin:6px 0 0 16px}#shell-form{border-radius:var(--radius-small);background:var(--control);align-items:flex-start;gap:8px;padding:4px;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;display:flex}#shell-form:focus-within{box-shadow:0 0 0 1px var(--accent)}.shell-prompt{color:var(--accent);flex-shrink:0}#shell-form>.shell-prompt{padding-top:6px;line-height:20px}.shell-input{flex:1;min-width:0;position:relative}#command,#command-highlight{font-variant-ligatures:none;letter-spacing:normal;tab-size:2;white-space:pre-wrap;overflow-wrap:anywhere;border:0;border-radius:0;width:100%;margin:0;padding:6px 0;font:12px/20px ui-monospace,SFMono-Regular,Consolas,monospace}#command-highlight{pointer-events:none;position:absolute;inset:0;overflow:hidden}#command{resize:none;color:#0000;min-height:32px;max-height:104px;caret-color:var(--text);scrollbar-width:thin;background:0 0;display:block;position:relative}#command:focus{box-shadow:none}#command::selection{color:#0000;background:#8abeb740}#command::placeholder{color:var(--muted)}#shell-run{border-radius:4px;min-height:32px}#shell-hint{color:var(--muted);flex-wrap:wrap;justify-content:space-between;gap:2px 12px;padding-top:5px;font-size:10px;line-height:1.5;display:flex}.shell-code .token,#command-highlight .token{font-style:normal;font-weight:400}.shell-code .token.comment,#command-highlight .token.comment{color:#aaaab7}.shell-code .token.string,#command-highlight .token.string{color:#b5bd68}.shell-code .token.function,.shell-code .token.builtin,#command-highlight .token.function,#command-highlight .token.builtin{color:#8abeb7}.shell-code .token.variable,.shell-code .token.assign-left,#command-highlight .token.variable,#command-highlight .token.assign-left{color:#c4a7d5}.shell-code .token.keyword,.shell-code .token.operator,.shell-code .token.number,#command-highlight .token.keyword,#command-highlight .token.operator,#command-highlight .token.number{color:#f0c674}.shell-code .token.parameter,#command-highlight .token.parameter{color:#9db9d4}@media (forced-colors:active){#command-highlight{display:none}#command{color:canvastext}#command::selection{color:canvastext}}.workspace-note{color:var(--muted);margin:6px 10px;font-size:10px;line-height:1.45}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border:0;width:1px;height:1px;padding:0;position:absolute;overflow:hidden}#open-tab{color:var(--accent);white-space:normal;margin-top:8px;font-size:12px;text-decoration:none}#model-dialog{--dialog-inset:24px;--cat-size:152px;--cat-rise:calc(var(--cat-size) * .58);width:min(460px,100% - 32px);max-height:calc(100dvh - 32px - var(--cat-rise));padding:var(--dialog-inset);border-radius:calc(var(--radius-small) + var(--dialog-inset));background:var(--surface);color:var(--text);transform:translateY(calc(var(--cat-rise) / 2));border:0;overflow:visible;box-shadow:0 24px 80px #0008}#model-dialog[open]{flex-direction:column;display:flex}.setup-paws{--modal-half:min(230px, calc(50vw - 16px));left:50%;top:calc(50% - var(--cat-rise) / 2);pointer-events:none;-webkit-user-select:none;user-select:none;z-index:-1;width:100vw;height:100dvh;position:absolute;overflow:hidden;transform:translate(-50%,-50%)}.setup-paws i{background:var(--muted);opacity:0;width:28px;height:28px;transform:rotate(var(--angle));position:absolute;-webkit-mask:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20fill='black'%3e%3cpath%20d='M2%207h4v5H2zM7%202h4v6H7zM13%202h4v6h-4zM18%207h4v5h-4zM8%2012h8v2h3v6h-4v-1H9v1H5v-6h3z'/%3e%3c/g%3e%3c/svg%3e") 50%/contain no-repeat;mask:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20fill='black'%3e%3cpath%20d='M2%207h4v5H2zM7%202h4v6H7zM13%202h4v6h-4zM18%207h4v5h-4zM8%2012h8v2h3v6h-4v-1H9v1H5v-6h3z'/%3e%3c/g%3e%3c/svg%3e") 50%/contain no-repeat}#model-dialog[open] .setup-paws i{animation:10s ease-in-out infinite setup-paw;animation-delay:var(--delay);animation-play-state:var(--cat-play-state,running)}.setup-paws i:first-child{left:calc(50% - var(--modal-half) - clamp(48px, 9vw, 136px));--angle:-34deg;--delay:-1s;top:68%}.setup-paws i:nth-child(2){left:calc(50% - var(--modal-half) - clamp(30px, 6vw, 88px));--angle:-24deg;--delay:-.3s;top:60%}.setup-paws i:nth-child(3){left:calc(50% - var(--modal-half) - clamp(45px, 8vw, 120px));--angle:-12deg;--delay:.4s;top:52%}.setup-paws i:nth-child(4){left:calc(50% + var(--modal-half) + clamp(25px, 4vw, 64px));--angle:28deg;--delay:4s;top:46%}.setup-paws i:nth-child(5){left:calc(50% + var(--modal-half) + clamp(50px, 8vw, 120px));--angle:35deg;--delay:4.7s;top:38%}.setup-paws i:nth-child(6){left:calc(50% + var(--modal-half) + clamp(35px, 7vw, 100px));--angle:25deg;--delay:5.4s;top:30%}@keyframes setup-paw{0%,5%,38%,to{opacity:0}14%,24%{opacity:.16}}@media (width<=600px){.setup-paws i{width:18px;height:18px}.setup-paws i:first-child{--angle:65deg;top:22px;left:8%}.setup-paws i:nth-child(2){--angle:75deg;top:14px;left:19%}.setup-paws i:nth-child(3){--angle:65deg;top:22px;left:30%}.setup-paws i:nth-child(n+4){display:none}}@media (prefers-reduced-motion:reduce){#model-dialog[open] .setup-paws i{animation:none}.setup-paws i:first-child,.setup-paws i:nth-child(2){opacity:.1}}.setup-cat{top:calc(-1 * var(--cat-rise));right:var(--dialog-inset);width:var(--cat-size);height:calc(var(--cat-size) * .66);pointer-events:auto;cursor:pointer;touch-action:manipulation;-webkit-user-select:none;user-select:none;position:absolute;overflow:hidden}.setup-cat img,.setup-cat-tail,.setup-cat-eyelids{top:calc(var(--cat-size) * -.23);width:100%;height:auto;image-rendering:pixelated;opacity:0;display:block;position:absolute;left:0}.setup-cat img{clip-path:inset(0 22% 0 0)}.setup-cat-tail{aspect-ratio:1;background:var(--cat-sprite) 0 0 / 100% 100% no-repeat;clip-path:polygon(78% 40%,100% 40%,100% 82%,77% 82%,77% 77%,78% 77%);transform-origin:78% 80%}.setup-cat.is-ready img,.setup-cat.is-ready .setup-cat-tail{opacity:1}.setup-cat-eyelids{aspect-ratio:1}.setup-cat-eyelids:before,.setup-cat-eyelids:after{content:"";background:linear-gradient(#080709,#080709) 50% 80%/78% 14% no-repeat,#f6efdf;width:8.4%;height:8.7%;position:absolute;top:55.6%}.setup-cat-eyelids:before{left:28%}.setup-cat-eyelids:after{left:54.3%}#model-dialog[open] .setup-cat.is-ready .setup-cat-tail{animation:9s ease-in-out infinite setup-tail-swish;animation-play-state:var(--cat-play-state,running)}#model-dialog[open] .setup-cat.is-ready .setup-cat-eyelids{animation:7.4s step-end infinite setup-cat-blink;animation-play-state:var(--cat-play-state,running)}@keyframes setup-cat-blink{0%,45%,to{opacity:0}43%{opacity:1}}@keyframes setup-tail-swish{0%,24%,50%,to{transform:rotate(0)}33%{transform:rotate(-4deg)}41%{transform:rotate(2.5deg)}46%{transform:rotate(-.6deg)}}@media (prefers-reduced-motion:reduce){#model-dialog[open] .setup-cat.is-ready .setup-cat-tail,#model-dialog[open] .setup-cat.is-ready .setup-cat-eyelids{animation:none}}.setup-heading{flex-shrink:0;align-items:flex-start;gap:8px;display:flex}#model-cancel{width:32px;height:32px;min-height:32px;color:var(--muted);background:0 0;flex:none;place-items:center;padding:0;display:grid}#model-cancel:hover:not(:disabled){background:var(--control);color:var(--text)}.setup-body{min-height:0;overflow:auto}#model-dialog::backdrop{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#08080dbd}#model-title{letter-spacing:-.5px;flex:1;min-width:0;margin:0 0 8px;font-size:27px;font-weight:650;line-height:1.2}#model-description{color:var(--muted);margin:0;line-height:1.6}.setup-runtime{grid-template-columns:minmax(max-content,1fr) 1fr 1.2fr;gap:8px;margin:18px 0;display:grid}.setup-runtime>div{border-radius:var(--radius-small);background:var(--control);padding:10px}.setup-runtime dt{color:var(--accent);font-size:12px;font-weight:600}.setup-runtime dd{margin:5px 0 0;font-size:11px;line-height:1.5}.setup-model{align-items:center;gap:6px;display:flex}.model-org{border-radius:50%;flex:none;display:inline-flex}.model-org img{border-radius:inherit;width:18px;height:18px;display:block}.model-source{color:inherit;-webkit-text-decoration-color:var(--muted);text-decoration-color:var(--muted);text-underline-offset:3px;white-space:nowrap}.model-source:hover{color:var(--accent)}.setup-model a:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:3px}.setup-facts{border-radius:var(--radius-small);background:var(--panel);flex-direction:column;gap:5px;margin:18px 0;padding:12px;line-height:1.45;display:flex}.setup-facts strong{font-size:12px;font-weight:600}.setup-facts span,.setup-label{color:var(--muted);font-size:11px;line-height:1.5}.setup-label{margin:16px 0 6px}#model-preview{white-space:pre-wrap;overflow-wrap:anywhere;border-radius:var(--radius-small);background:var(--control);max-height:84px;padding:10px 12px;font-size:12px;line-height:1.5;overflow:auto}#model-error{border-radius:var(--radius-small);overflow-wrap:anywhere;background:#3c2828;padding:10px 12px;line-height:1.5}#model-open-tab{color:var(--accent);white-space:normal;text-decoration:none}.setup-credits{color:var(--muted);flex-wrap:wrap;align-items:center;gap:6px 10px;margin:18px 0;font-size:11px;line-height:1.6;display:flex}.setup-credits a{color:inherit;white-space:nowrap;align-items:center;gap:4px;text-decoration:none;display:inline-flex}.setup-credits a:hover{color:var(--text);text-underline-offset:3px;text-decoration:underline}.setup-credits a:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:3px}.setup-credits img,.setup-credits svg{object-fit:contain;flex:none;width:14px;height:14px}.setup-credits .credit-pi{padding:2px}.setup-actions{flex-shrink:0;padding-top:4px;display:flex}.setup-actions button{width:100%;min-height:44px;padding:10px 16px}#model-confirm{color:#18181e;background:#fff;font-size:14px;font-weight:600}#model-confirm:hover{background:#e8e8ed}@media (width<=420px){#model-dialog{--dialog-inset:16px;--cat-size:116px}#model-title{font-size:24px}.setup-runtime{grid-template-columns:1fr;gap:5px;margin:14px 0}.setup-runtime>div{align-items:baseline;gap:12px;padding:8px 10px;display:flex}.setup-runtime dt{flex:0 0 64px}.setup-runtime dd{margin:0}.setup-facts{margin:14px 0}.setup-credits{margin:12px 0}}@media (width>=851px) and (width<=1000px){header{grid-template-columns:auto minmax(0,1fr) auto}}@media (height<=620px){#model-dialog{--cat-size:72px}.setup-runtime,.setup-facts{margin:12px 0}}@media (width<=420px) and (height<=620px){.setup-runtime{grid-template-columns:minmax(0,1fr) max-content}.setup-runtime>div:first-child{grid-column:1/-1}.setup-runtime>div:not(:first-child){padding:6px 10px;display:block}.setup-runtime>div:not(:first-child) dd{margin-top:2px}}@media (width<=850px){:root{--header-height:calc(2 * var(--header-control-height) + 3 * var(--surface-inset));--header-inset:10px;--content-gutter:10px}header{grid-template-columns:auto minmax(0,1fr);grid-template-rows:repeat(2, var(--header-control-height));gap:var(--surface-inset);grid-template-areas:"brand runtime""model model"}.brand{grid-area:brand;justify-self:start}.runtime-meter{grid-area:runtime;justify-self:end}.model-panel{grid-area:model;margin:0}main{flex-direction:column;height:auto;display:flex}.column-resizer{display:none}.conversation{height:calc(100dvh - var(--header-height) - var(--header-inset));min-height:320px;padding:10px var(--content-gutter)}.workspace{min-height:520px;margin:0 var(--content-gutter) 10px}.file-area{grid-template-columns:115px minmax(0,1fr);min-height:280px}h1{font-size:20px}.badge,footer{font-size:9px}}@media (pointer:coarse){:root{--header-control-height:38px}button,.button,#files button{min-height:38px}.editor-heading{min-height:40px}.terminal summary{padding-top:11px;padding-bottom:11px}#command,#command-highlight,#pi-terminal .xterm-helper-textarea{font-size:16px}}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}1:root{font-synthesis:none;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;color:var(--text);background:var(--background);--background:#18181e;--surface:#1e1e24;--panel:#22222b;--control:#282832;--hover:#343541;--selected:#3a3a4a;--line:#393942;--line-strong:#50505c;--text:#d4d4d4;--muted:#b0b0bd;--accent:#8abeb7;--surface-inset:8px;--radius-small:8px;--radius:calc(var(--radius-small) + var(--surface-inset));--radius-large:calc(var(--radius) + var(--surface-inset));--content-width:1800px;--content-gutter:14px;--header-inset:12px;--header-control-height:32px;--header-height:calc(var(--header-control-height) + 2 * var(--surface-inset));scrollbar-color:var(--line-strong) var(--background);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:13px}*{box-sizing:border-box}body{margin:0}button,input,textarea{font:inherit;color:inherit}::selection{background:var(--selected);color:var(--text)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}button,.button{cursor:pointer;border-radius:var(--radius-small);background:var(--control);min-height:28px;color:inherit;white-space:nowrap;border:1px solid #0000;padding:5px 9px;font-size:12px;line-height:1.4}button:hover,.button:hover{background:var(--hover)}button:disabled{opacity:.45;cursor:default}.primary{background:var(--hover);color:var(--text)}.primary:hover{background:var(--selected)}#send.has-input:not(:disabled){color:#18181e;background:#fff}#send.has-input:not(:disabled):hover{background:#e8e8ed}.quiet{background:0 0;border-color:#0000;font-size:11px}textarea,input{outline:none}textarea:focus,input:focus{box-shadow:inset 0 0 0 1px var(--accent)}button:focus-visible,.button:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px}[hidden]{display:none!important}header{width:calc(100% - 2 * var(--content-gutter));max-width:calc(var(--content-width) - 2 * var(--content-gutter));height:var(--header-height);margin:var(--header-inset) auto 0;padding:var(--surface-inset);justify-content:space-between;align-items:center;gap:var(--surface-inset) 16px;background:var(--surface);border-radius:var(--radius);grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);display:grid;position:relative;overflow:hidden}.brand{color:inherit;align-items:center;gap:8px;font-size:15px;font-weight:600;text-decoration:none;display:flex}.pi-logo{flex:none;width:18px;height:18px;display:block}.brand{justify-self:start;padding:0 4px}.runtime-meter{--runtime-padding:10px;width:max-content;max-width:100%;height:var(--header-control-height);padding:5px var(--runtime-padding);border-radius:var(--radius-small);background:var(--control);white-space:nowrap;justify-self:center;align-items:center;font-size:11px;transition:width .22s cubic-bezier(.2,.8,.2,1);display:flex;overflow:clip}.runtime-content{flex:none;align-items:center;gap:8px;width:max-content;height:100%;display:flex}.runtime-location{flex:none;align-items:center;gap:6px;display:flex}.runtime-dot{background:var(--muted);border-radius:50%;width:5px;height:5px}.runtime-meter[data-state=generating] .runtime-dot,.runtime-meter[data-state=tool] .runtime-dot{background:var(--accent)}.runtime-meter[data-state=error] .runtime-dot{background:#d98c8c}.runtime-divider{background:var(--line);flex:0 0 1px;align-self:stretch;margin:2px 0}.runtime-sparkline{color:var(--accent);flex:none}.runtime-value{color:var(--muted);font-variant-numeric:tabular-nums;flex:none}.runtime-meter[data-state=generating] .runtime-value{color:var(--accent)}@media (prefers-reduced-motion:reduce){.runtime-meter{transition:none}}main{--conversation-min:420px;--workspace-min:370px;grid-template-columns:minmax(var(--conversation-min), var(--conversation-width,1.20482fr)) 0 minmax(var(--workspace-min), 1fr);height:calc(100dvh - var(--header-height) - var(--header-inset));max-width:var(--content-width);margin:auto;display:grid}.column-resizer{left:calc(-1 * var(--content-gutter));z-index:2;width:var(--content-gutter);cursor:col-resize;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;outline:none;justify-content:center;align-items:center;margin:12px 0 8px;display:flex;position:relative}.column-resizer:after{content:"";background:var(--line-strong);border-radius:999px;flex:none;width:3px;height:44px;transition:background-color .12s}.column-resizer:hover:after{background:var(--text)}.column-resizer:focus-visible:after{background:var(--accent);outline:2px solid var(--accent);outline-offset:4px}.is-resizing-columns,.is-resizing-columns *{cursor:col-resize!important;-webkit-user-select:none!important;user-select:none!important}.is-resizing-columns .column-resizer:after{background:var(--accent)}@media (prefers-reduced-motion:reduce){.column-resizer:after{transition:none}}@media (forced-colors:active){.column-resizer:after{background:buttontext}}.conversation{min-width:0;min-height:0;padding:12px var(--content-gutter) 8px;flex-direction:column;display:flex}.model-panel{background:var(--surface);margin-left:auto}.model-heading{justify-content:space-between;align-items:center;gap:8px;display:flex}.model-heading>div{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.model-heading strong{font-size:12px;font-weight:600}.header-model-source{color:inherit;white-space:nowrap;border-radius:3px;flex:none;align-items:center;gap:6px;text-decoration:none;display:inline-flex}.header-model-source img{border-radius:50%;flex:none;width:16px;height:16px;display:block}.header-model-source:hover{color:var(--accent)}.header-model-source:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.badge{border-radius:var(--radius-small);background:var(--control);color:var(--muted);padding:3px 7px;font-size:10px}#load{min-width:90px;height:var(--header-control-height);flex-shrink:0}#load.is-loaded{opacity:1;min-width:0;height:28px;min-height:28px;color:var(--accent);background:#25312f;border-radius:6px;justify-content:center;align-items:center;gap:6px;padding:4px 8px;display:inline-flex}#load.is-loaded:before{content:"";background:currentColor;border-radius:50%;flex:none;width:5px;height:5px}progress{width:100%;height:5px;accent-color:var(--accent);margin-top:8px}header #progress{bottom:3px;left:var(--radius);width:calc(100% - 2 * var(--radius));appearance:none;background:var(--line);--progress-fade:clamp(24px, 5vw, 72px);--progress-mask:linear-gradient(90deg, transparent 2px, #000 var(--progress-fade), #000 calc(100% - var(--progress-fade)), transparent calc(100% - 2px));height:2px;-webkit-mask-image:var(--progress-mask);mask-image:var(--progress-mask);-webkit-mask-image:var(--progress-mask);border:0;border-radius:999px;margin:0;position:absolute;overflow:hidden}header #progress::-webkit-progress-bar{background:var(--line);border-radius:999px}header #progress::-webkit-progress-value{background:var(--accent);border-radius:999px}header #progress::-moz-progress-bar{background:var(--accent);border-radius:999px}header #progress:indeterminate{background:linear-gradient(90deg, transparent, var(--accent), transparent) 0 0 / 35% 100% no-repeat var(--line);animation:1.4s ease-in-out infinite alternate header-progress}header #progress:indeterminate::-webkit-progress-bar{background:0 0}header #progress:indeterminate::-webkit-progress-value{background:0 0}header #progress:indeterminate::-moz-progress-bar{background:0 0}@keyframes header-progress{0%{background-position:0 0}to{background-position:100% 0}}@media (prefers-reduced-motion:reduce){header #progress:indeterminate{background-position:50% 0;animation:none}}.muted{color:var(--muted);margin-top:4px;font-size:11px}.muted:empty{display:none}.terminal-panel{background:var(--background);border-radius:var(--radius-large);border:1px solid #0000;flex-direction:column;flex:1;min-height:0;padding:8px;display:flex}@media (width>=851px){.terminal-panel{padding-right:0}}#pi-terminal{isolation:isolate;background:var(--background);flex:1;min-width:0;min-height:120px;position:relative;overflow:hidden}#pi-terminal .pi-terminal-mount,#pi-terminal .xterm{height:100%}#pi-terminal .xterm-viewport{background-color:var(--background)!important}#pi-terminal textarea:focus{box-shadow:none}.terminal-paws{pointer-events:none;-webkit-user-select:none;user-select:none;position:absolute;overflow:hidden}.terminal-paws i{background:var(--muted);opacity:0;width:24px;height:24px;position:absolute;transform:rotate(28deg);-webkit-mask:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20fill='black'%3e%3cpath%20d='M2%207h4v5H2zM7%202h4v6H7zM13%202h4v6h-4zM18%207h4v5h-4zM8%2012h8v2h3v6h-4v-1H9v1H5v-6h3z'/%3e%3c/g%3e%3c/svg%3e") 50%/contain no-repeat;mask:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20fill='black'%3e%3cpath%20d='M2%207h4v5H2zM7%202h4v6H7zM13%202h4v6h-4zM18%207h4v5h-4zM8%2012h8v2h3v6h-4v-1H9v1H5v-6h3z'/%3e%3c/g%3e%3c/svg%3e") 50%/contain no-repeat}.terminal-paws:not([hidden]) i{animation:3.2s ease-in-out both terminal-paw;animation-delay:var(--delay)}.terminal-paws i:first-child{left:calc(18% + var(--trail-shift));--delay:0s;top:85%}.terminal-paws i:nth-child(2){left:calc(26% + var(--trail-shift));--delay:.65s;top:78%}.terminal-paws i:nth-child(3){left:calc(27% + var(--trail-shift));--delay:1.3s;top:68%}.terminal-paws i:nth-child(4){left:calc(35% + var(--trail-shift));--delay:1.95s;top:61%}.terminal-paws i:nth-child(5){left:calc(36% + var(--trail-shift));--delay:2.6s;top:51%}.terminal-paws i:nth-child(6){left:calc(44% + var(--trail-shift));--delay:3.25s;top:44%}@keyframes terminal-paw{0%,to{opacity:0}15%,40%{opacity:.14}}@media (width<=600px){.terminal-paws i{width:18px;height:18px}}@media (prefers-reduced-motion:reduce){.terminal-paws{display:none}}.empty-mascot{pointer-events:none;flex-direction:column;align-items:flex-end;gap:10px;width:196px;max-width:calc(100% - 24px);display:flex;position:absolute;right:12px}.mascot-cat{pointer-events:auto;cursor:pointer;background:0 0;border:0;border-radius:0;flex:none;min-height:0;padding:0;line-height:0;display:block;position:relative}.mascot-cat:hover{background:0 0}.mascot-cat,.setup-cat{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;outline:none}.mascot-cat,.mascot-cat *,.setup-cat,.setup-cat *{-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.mascot-cat>*,.setup-cat>*{pointer-events:none}.empty-mascot img{object-fit:contain;width:100%;height:100%;image-rendering:pixelated;-webkit-user-select:none;user-select:none;clip-path:polygon(16.906% 6.22%,26.077% 6.22%,26.077% 9.729%,30.861% 9.729%,30.861% 14.274%,35.407% 14.274%,35.407% 20.175%,56.539% 20.175%,56.539% 14.274%,61.404% 14.274%,61.404% 9.729%,65.71% 9.729%,65.71% 6.22%,75.04% 6.22%,75.04% 44.498%,68.82% 44.498%,68.82% 48.166%,75.04% 48.166%,75.04% 52.073%,68.82% 52.073%,68.82% 57.576%,65.152% 57.576%,65.152% 61.324%,68.979% 61.324%,68.979% 67.225%,73.285% 67.225%,73.285% 77.033%,77.671% 77.033%,77.671% 55.742%,81.818% 55.742%,81.818% 51.595%,91.228% 51.595%,91.228% 63.397%,86.124% 63.397%,86.124% 85.566%,81.579% 85.566%,81.579% 92.265%,25.04% 92.265%,25.04% 85.566%,28.07% 85.566%,28.07% 57.576%,19.856% 57.576%,19.856% 52.073%,12.52% 52.073%,12.52% 48.166%,19.856% 48.166%,19.856% 44.498%,12.52% 44.498%,12.52% 41.467%,16.906% 41.467%);display:block}.mascot-eyelids{opacity:0;position:absolute;inset:0}.mascot-eyelids:before,.mascot-eyelids:after{content:"";background:linear-gradient(to bottom, #f6f0e1 70%, var(--background) 70%, var(--background) 86%, #f6f0e1 86%);width:7%;height:7.4%;position:absolute;top:39.3%}.mascot-eyelids:before{left:28.5%}.mascot-eyelids:after{left:54%}.mascot-suggestion{pointer-events:auto;color:#24242c;text-align:left;white-space:normal;background:#f5efdf;border:0;border-radius:8px;padding:10px 12px;font:12px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace;position:relative;box-shadow:0 3px #0c0c10}.mascot-suggestion:after{content:"";background:inherit;clip-path:polygon(0 0,100% 0,100% 50%,50% 50%,50% 100%,0 100%);width:12px;height:8px;position:absolute;bottom:-8px;right:52px}.mascot-suggestion:hover{background:#fffaf0}.terminal-controls{justify-content:flex-end;align-items:center;gap:8px;padding-top:4px;display:flex}.terminal-controls,.terminal-panel>footer{cursor:text}#new-chat{margin-right:auto}#newline:not(:hover){background:0 0}#notice{border-radius:var(--radius-small);background:var(--control);margin:6px 0;padding:8px 10px;font-size:12px}footer{color:var(--muted);justify-content:space-between;align-items:center;gap:8px;padding-top:8px;font-size:10px;display:flex}.workspace{min-width:0;min-height:0;margin:12px var(--content-gutter) 8px 0;background:var(--panel);border-radius:20px;flex-direction:column;display:flex;overflow:hidden}.workspace-heading{justify-content:space-between;align-items:center;min-height:40px;padding:5px 10px;display:flex}.workspace-heading h2{margin:0;font-size:12px;font-weight:600}.workspace-heading>div{gap:0;display:flex}.button{display:inline-block}.file-area{flex:1;grid-template-columns:140px minmax(0,1fr);min-height:180px;display:grid}#files{padding:5px 4px;overflow:auto}#files button{border-radius:var(--radius-small);text-align:left;white-space:normal;overflow-wrap:anywhere;background:0 0;border:none;align-items:center;gap:6px;width:100%;padding:5px 7px;font-family:ui-monospace,monospace;font-size:11px;line-height:1.45;display:flex}.file-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.file-icon{background-color:var(--file-color);width:16px;height:16px;-webkit-mask:var(--file-icon) center / 90% 90% no-repeat;mask:var(--file-icon) center / 90% 90% no-repeat;-webkit-mask:var(--file-icon) center / 90% 90% no-repeat;flex:0 0 16px;display:inline-block}.editor-file{align-items:center;gap:6px;min-width:0;display:flex}#filetype{flex:none;display:flex}#filetype:empty{display:none}@media (forced-colors:active){.file-icon{background-color:canvastext}}#files button:hover{background:var(--hover)}#files button.selected{background:var(--selected);color:var(--text)}.editor-area{border-radius:var(--radius);background:var(--surface);flex-direction:column;min-width:0;min-height:0;margin:0 8px 8px 0;display:flex;overflow:hidden}.editor-heading{background:#282832;justify-content:space-between;align-items:center;gap:6px;height:32px;padding:0 6px 0 10px;transition:background-color .14s,box-shadow .14s;display:flex}.editor-area:focus-within .editor-heading{background:#30323a;box-shadow:inset 0 -1px #8abeb74d}@media (prefers-reduced-motion:reduce){.editor-heading{transition:none}}@media (forced-colors:active){.editor-area:focus-within .editor-heading{outline-offset:-1px;outline:1px solid highlight}}#filename{text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,monospace;font-size:11px;overflow:hidden}.editor-heading{flex-shrink:0}.editor-input{flex:1;min-width:0;min-height:140px;position:relative;overflow:hidden}#editor,#editor-highlight{width:100%;height:100%;color:var(--text);font-variant-ligatures:none;letter-spacing:normal;tab-size:2;white-space:pre;overflow-wrap:normal;border:0;border-radius:0;margin:0;padding:10px 12px;font:12px/1.6 ui-monospace,SFMono-Regular,Consolas,monospace;position:absolute;top:0;left:0}#editor{resize:none;caret-color:var(--text);background:0 0;overflow:auto}#editor-highlight{visibility:hidden;pointer-events:none;overflow:hidden}.is-highlighted #editor-highlight{visibility:visible}.is-highlighted #editor{color:#0000}.is-highlighted #editor::selection{color:#0000}#editor::selection{background:#8abeb740}#editor:focus{box-shadow:none}#editor-highlight .token{font-style:normal;font-weight:400}#editor-highlight .token.comment,#editor-highlight .token.prolog,#editor-highlight .token.doctype{color:#9292a3}#editor-highlight .token.punctuation{color:#b0b0bd}#editor-highlight .token.tag,#editor-highlight .token.deleted{color:#e29a9a}#editor-highlight .token.keyword,#editor-highlight .token.selector,#editor-highlight .token.important{color:#c4a7d5}#editor-highlight .token.string,#editor-highlight .token.attr-value,#editor-highlight .token.inserted{color:#b5bd68}#editor-highlight .token.function,#editor-highlight .token.builtin,#editor-highlight .token.class-name{color:#8abeb7}#editor-highlight .token.attr-name,#editor-highlight .token.property,#editor-highlight .token.variable{color:#9db9d4}#editor-highlight .token.number,#editor-highlight .token.boolean,#editor-highlight .token.constant,#editor-highlight .token.operator,#editor-highlight .token.entity,#editor-highlight .token.url{color:#f0c674}@media (forced-colors:active){.is-highlighted #editor-highlight{visibility:hidden}.is-highlighted #editor{color:canvastext}.is-highlighted #editor::selection{color:canvastext}}.workspace>.terminal{border-radius:var(--radius);background:var(--background);flex-shrink:0;margin:0 8px;padding:0 8px 8px}.terminal summary{cursor:pointer;padding:6px 0;font-size:11px;font-weight:500}.terminal summary span{float:right;color:var(--muted);font-size:10px;font-weight:400}.shell-toolbar{color:var(--accent);justify-content:space-between;align-items:center;font:11px/1.5 ui-monospace,monospace;display:flex}.shell-toolbar button{color:var(--muted)}#terminal-output{resize:vertical;scrollbar-width:thin;overflow-wrap:anywhere;height:132px;min-height:84px;max-height:min(480px,45dvh);margin:0 0 6px;padding:2px 0;font:12px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;overflow:auto}#terminal-output:focus-visible{outline:1px solid var(--accent);outline-offset:2px;border-radius:var(--radius-small)}.shell-empty{color:var(--muted);flex-direction:column;gap:4px;padding:8px 2px;display:flex}.shell-empty strong{color:var(--text);font-weight:500}.shell-empty code{color:var(--accent)}.shell-entry{border-radius:var(--radius-small);background:var(--surface);margin-bottom:6px;padding:8px}.shell-entry:last-child{margin-bottom:0}.shell-entry-heading{align-items:baseline;gap:8px;display:flex}.shell-entry pre{font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.shell-code{flex:1;min-width:0}.shell-status{color:var(--muted);flex-shrink:0;font-size:10px}.shell-status.success{color:#b5bd68}.shell-status.error,.shell-stderr{color:#e29a9a}.shell-entry .shell-stdout,.shell-entry .shell-stderr{margin:6px 0 0 16px}#shell-form{border-radius:var(--radius-small);background:var(--control);align-items:flex-start;gap:8px;padding:4px;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;display:flex}#shell-form:focus-within{box-shadow:0 0 0 1px var(--accent)}.shell-prompt{color:var(--accent);flex-shrink:0}#shell-form>.shell-prompt{padding-top:6px;line-height:20px}.shell-input{flex:1;min-width:0;position:relative}#command,#command-highlight{font-variant-ligatures:none;letter-spacing:normal;tab-size:2;white-space:pre-wrap;overflow-wrap:anywhere;border:0;border-radius:0;width:100%;margin:0;padding:6px 0;font:12px/20px ui-monospace,SFMono-Regular,Consolas,monospace}#command-highlight{pointer-events:none;position:absolute;inset:0;overflow:hidden}#command{resize:none;color:#0000;min-height:32px;max-height:104px;caret-color:var(--text);scrollbar-width:thin;background:0 0;display:block;position:relative}#command:focus{box-shadow:none}#command::selection{color:#0000;background:#8abeb740}#command::placeholder{color:var(--muted)}#shell-run{border-radius:4px;min-height:32px}#shell-hint{color:var(--muted);flex-wrap:wrap;justify-content:space-between;gap:2px 12px;padding-top:5px;font-size:10px;line-height:1.5;display:flex}.shell-code .token,#command-highlight .token{font-style:normal;font-weight:400}.shell-code .token.comment,#command-highlight .token.comment{color:#aaaab7}.shell-code .token.string,#command-highlight .token.string{color:#b5bd68}.shell-code .token.function,.shell-code .token.builtin,#command-highlight .token.function,#command-highlight .token.builtin{color:#8abeb7}.shell-code .token.variable,.shell-code .token.assign-left,#command-highlight .token.variable,#command-highlight .token.assign-left{color:#c4a7d5}.shell-code .token.keyword,.shell-code .token.operator,.shell-code .token.number,#command-highlight .token.keyword,#command-highlight .token.operator,#command-highlight .token.number{color:#f0c674}.shell-code .token.parameter,#command-highlight .token.parameter{color:#9db9d4}@media (forced-colors:active){#command-highlight{display:none}#command{color:canvastext}#command::selection{color:canvastext}}.workspace-note{color:var(--muted);margin:6px 10px;font-size:10px;line-height:1.45}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border:0;width:1px;height:1px;padding:0;position:absolute;overflow:hidden}#open-tab{color:var(--accent);white-space:normal;margin-top:8px;font-size:12px;text-decoration:none}#model-dialog{--dialog-inset:24px;--cat-size:152px;--cat-rise:calc(var(--cat-size) * .58);width:min(460px,100% - 32px);max-height:calc(100dvh - 32px - var(--cat-rise));padding:var(--dialog-inset);border-radius:calc(var(--radius-small) + var(--dialog-inset));background:var(--surface);color:var(--text);transform:translateY(calc(var(--cat-rise) / 2));border:0;overflow:visible;box-shadow:0 24px 80px #0008}#model-dialog[open]{flex-direction:column;display:flex}.setup-paws{--modal-half:min(230px, calc(50vw - 16px));left:50%;top:calc(50% - var(--cat-rise) / 2);pointer-events:none;-webkit-user-select:none;user-select:none;z-index:-1;width:100vw;height:100dvh;position:absolute;overflow:hidden;transform:translate(-50%,-50%)}.setup-paws i{background:var(--muted);opacity:0;width:28px;height:28px;transform:rotate(var(--angle));position:absolute;-webkit-mask:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20fill='black'%3e%3cpath%20d='M2%207h4v5H2zM7%202h4v6H7zM13%202h4v6h-4zM18%207h4v5h-4zM8%2012h8v2h3v6h-4v-1H9v1H5v-6h3z'/%3e%3c/g%3e%3c/svg%3e") 50%/contain no-repeat;mask:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20fill='black'%3e%3cpath%20d='M2%207h4v5H2zM7%202h4v6H7zM13%202h4v6h-4zM18%207h4v5h-4zM8%2012h8v2h3v6h-4v-1H9v1H5v-6h3z'/%3e%3c/g%3e%3c/svg%3e") 50%/contain no-repeat}#model-dialog[open] .setup-paws i{animation:10s ease-in-out infinite setup-paw;animation-delay:var(--delay);animation-play-state:var(--cat-play-state,running)}.setup-paws i:first-child{left:calc(50% - var(--modal-half) - clamp(48px, 9vw, 136px));--angle:-34deg;--delay:-1s;top:68%}.setup-paws i:nth-child(2){left:calc(50% - var(--modal-half) - clamp(30px, 6vw, 88px));--angle:-24deg;--delay:-.3s;top:60%}.setup-paws i:nth-child(3){left:calc(50% - var(--modal-half) - clamp(45px, 8vw, 120px));--angle:-12deg;--delay:.4s;top:52%}.setup-paws i:nth-child(4){left:calc(50% + var(--modal-half) + clamp(25px, 4vw, 64px));--angle:28deg;--delay:4s;top:46%}.setup-paws i:nth-child(5){left:calc(50% + var(--modal-half) + clamp(50px, 8vw, 120px));--angle:35deg;--delay:4.7s;top:38%}.setup-paws i:nth-child(6){left:calc(50% + var(--modal-half) + clamp(35px, 7vw, 100px));--angle:25deg;--delay:5.4s;top:30%}@keyframes setup-paw{0%,5%,38%,to{opacity:0}14%,24%{opacity:.16}}@media (width<=600px){.setup-paws i{width:18px;height:18px}.setup-paws i:first-child{--angle:65deg;top:22px;left:8%}.setup-paws i:nth-child(2){--angle:75deg;top:14px;left:19%}.setup-paws i:nth-child(3){--angle:65deg;top:22px;left:30%}.setup-paws i:nth-child(n+4){display:none}}@media (prefers-reduced-motion:reduce){#model-dialog[open] .setup-paws i{animation:none}.setup-paws i:first-child,.setup-paws i:nth-child(2){opacity:.1}}.setup-cat{top:calc(-1 * var(--cat-rise));right:var(--dialog-inset);width:var(--cat-size);height:calc(var(--cat-size) * .66);pointer-events:auto;cursor:pointer;touch-action:manipulation;-webkit-user-select:none;user-select:none;position:absolute;overflow:hidden}.setup-cat img,.setup-cat-tail,.setup-cat-eyelids{top:calc(var(--cat-size) * -.23);width:100%;height:auto;image-rendering:pixelated;opacity:0;display:block;position:absolute;left:0}.setup-cat img{clip-path:inset(0 22% 0 0)}.setup-cat-tail{aspect-ratio:1;background:var(--cat-sprite) 0 0 / 100% 100% no-repeat;clip-path:polygon(78% 40%,100% 40%,100% 82%,77% 82%,77% 77%,78% 77%);transform-origin:78% 80%}.setup-cat.is-ready img,.setup-cat.is-ready .setup-cat-tail{opacity:1}.setup-cat-eyelids{aspect-ratio:1}.setup-cat-eyelids:before,.setup-cat-eyelids:after{content:"";background:linear-gradient(#080709,#080709) 50% 80%/78% 14% no-repeat,#f6efdf;width:8.4%;height:8.7%;position:absolute;top:55.6%}.setup-cat-eyelids:before{left:28%}.setup-cat-eyelids:after{left:54.3%}#model-dialog[open] .setup-cat.is-ready .setup-cat-tail{animation:9s ease-in-out infinite setup-tail-swish;animation-play-state:var(--cat-play-state,running)}#model-dialog[open] .setup-cat.is-ready .setup-cat-eyelids{animation:7.4s step-end infinite setup-cat-blink;animation-play-state:var(--cat-play-state,running)}@keyframes setup-cat-blink{0%,45%,to{opacity:0}43%{opacity:1}}@keyframes setup-tail-swish{0%,24%,50%,to{transform:rotate(0)}33%{transform:rotate(-4deg)}41%{transform:rotate(2.5deg)}46%{transform:rotate(-.6deg)}}@media (prefers-reduced-motion:reduce){#model-dialog[open] .setup-cat.is-ready .setup-cat-tail,#model-dialog[open] .setup-cat.is-ready .setup-cat-eyelids{animation:none}}.setup-heading{flex-shrink:0;align-items:flex-start;gap:8px;display:flex}#model-cancel{width:32px;height:32px;min-height:32px;color:var(--muted);background:0 0;flex:none;place-items:center;padding:0;display:grid}#model-cancel:hover:not(:disabled){background:var(--control);color:var(--text)}.setup-body{min-height:0;overflow:auto}#model-dialog::backdrop{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#08080dbd}#model-title{letter-spacing:-.5px;flex:1;min-width:0;margin:0 0 8px;font-size:27px;font-weight:650;line-height:1.2}#model-description{color:var(--muted);margin:0;line-height:1.6}.setup-runtime{grid-template-columns:minmax(max-content,1fr) 1fr 1.2fr;gap:8px;margin:18px 0;display:grid}.setup-runtime>div{border-radius:var(--radius-small);background:var(--control);padding:10px}.setup-runtime dt{color:var(--accent);font-size:12px;font-weight:600}.setup-runtime dd{margin:5px 0 0;font-size:11px;line-height:1.5}.setup-model{align-items:center;gap:6px;display:flex}.model-org{border-radius:50%;flex:none;display:inline-flex}.model-org img{border-radius:inherit;width:18px;height:18px;display:block}.model-source{color:inherit;-webkit-text-decoration-color:var(--muted);text-decoration-color:var(--muted);text-underline-offset:3px;white-space:nowrap}.model-source:hover{color:var(--accent)}.setup-model a:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:3px}.setup-facts{border-radius:var(--radius-small);background:var(--panel);flex-direction:column;gap:5px;margin:18px 0;padding:12px;line-height:1.45;display:flex}.setup-facts strong{font-size:12px;font-weight:600}.setup-facts span,.setup-label{color:var(--muted);font-size:11px;line-height:1.5}.setup-label{margin:16px 0 6px}#model-preview{white-space:pre-wrap;overflow-wrap:anywhere;border-radius:var(--radius-small);background:var(--control);max-height:84px;padding:10px 12px;font-size:12px;line-height:1.5;overflow:auto}#model-error{border-radius:var(--radius-small);overflow-wrap:anywhere;background:#3c2828;padding:10px 12px;line-height:1.5}#model-open-tab{color:var(--accent);white-space:normal;text-decoration:none}.setup-credits{color:var(--muted);flex-wrap:wrap;align-items:center;gap:6px 10px;margin:18px 0;font-size:11px;line-height:1.6;display:flex}.setup-credits a{color:inherit;white-space:nowrap;align-items:center;gap:4px;text-decoration:none;display:inline-flex}.setup-credits a:hover{color:var(--text);text-underline-offset:3px;text-decoration:underline}.setup-credits a:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:3px}.setup-credits img,.setup-credits svg{object-fit:contain;flex:none;width:14px;height:14px}.setup-credits .credit-pi{padding:2px}.setup-actions{flex-shrink:0;padding-top:4px;display:flex}.setup-actions button{width:100%;min-height:44px;padding:10px 16px}#model-confirm{color:#18181e;background:#fff;font-size:14px;font-weight:600}#model-confirm:hover{background:#e8e8ed}@media (width<=420px){#model-dialog{--dialog-inset:16px;--cat-size:116px}#model-title{font-size:24px}.setup-runtime{grid-template-columns:1fr;gap:5px;margin:14px 0}.setup-runtime>div{align-items:baseline;gap:12px;padding:8px 10px;display:flex}.setup-runtime dt{flex:0 0 64px}.setup-runtime dd{margin:0}.setup-facts{margin:14px 0}.setup-credits{margin:12px 0}}@media (width>=851px) and (width<=1000px){header{grid-template-columns:auto minmax(0,1fr) auto}}@media (height<=620px){#model-dialog{--cat-size:72px}.setup-runtime,.setup-facts{margin:12px 0}}@media (width<=420px) and (height<=620px){.setup-runtime{grid-template-columns:minmax(0,1fr) max-content}.setup-runtime>div:first-child{grid-column:1/-1}.setup-runtime>div:not(:first-child){padding:6px 10px;display:block}.setup-runtime>div:not(:first-child) dd{margin-top:2px}}@media (width<=850px){:root{--header-height:calc(2 * var(--header-control-height) + 3 * var(--surface-inset));--header-inset:10px;--content-gutter:10px}header{grid-template-columns:auto minmax(0,1fr);grid-template-rows:repeat(2, var(--header-control-height));gap:var(--surface-inset);grid-template-areas:"brand runtime""model model"}.brand{grid-area:brand;justify-self:start}.runtime-meter{grid-area:runtime;justify-self:end}.model-panel{grid-area:model;margin:0}main{flex-direction:column;height:auto;display:flex}.column-resizer{display:none}.conversation{height:calc(100dvh - var(--header-height) - var(--header-inset));min-height:320px;padding:10px var(--content-gutter)}.workspace{min-height:520px;margin:0 var(--content-gutter) 10px}.file-area{grid-template-columns:115px minmax(0,1fr);min-height:280px}h1{font-size:20px}.badge,footer{font-size:9px}}@media (pointer:coarse){:root{--header-control-height:38px}button,.button,#files button{min-height:38px}.editor-heading{min-height:40px}.terminal summary{padding-top:11px;padding-bottom:11px}#command,#command-highlight,#pi-terminal .xterm-helper-textarea{font-size:16px}}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}1:root{font-synthesis:none;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;color:var(--text);background:var(--background);--background:#18181e;--surface:#1e1e24;--panel:#22222b;--control:#282832;--hover:#343541;--selected:#3a3a4a;--line:#393942;--line-strong:#50505c;--text:#d4d4d4;--muted:#b0b0bd;--accent:#8abeb7;--surface-inset:8px;--radius-small:8px;--radius:calc(var(--radius-small) + var(--surface-inset));--radius-large:calc(var(--radius) + var(--surface-inset));--content-width:1800px;--content-gutter:14px;--header-inset:12px;--header-control-height:32px;--header-height:calc(var(--header-control-height) + 2 * var(--surface-inset));scrollbar-color:var(--line-strong) var(--background);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:13px}*{box-sizing:border-box}body{margin:0}button,input,textarea{font:inherit;color:inherit}::selection{background:var(--selected);color:var(--text)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}button,.button{cursor:pointer;border-radius:var(--radius-small);background:var(--control);min-height:28px;color:inherit;white-space:nowrap;border:1px solid #0000;padding:5px 9px;font-size:12px;line-height:1.4}button:hover,.button:hover{background:var(--hover)}button:disabled{opacity:.45;cursor:default}.primary{background:var(--hover);color:var(--text)}.primary:hover{background:var(--selected)}#send.has-input:not(:disabled){color:#18181e;background:#fff}#send.has-input:not(:disabled):hover{background:#e8e8ed}.quiet{background:0 0;border-color:#0000;font-size:11px}textarea,input{outline:none}textarea:focus,input:focus{box-shadow:inset 0 0 0 1px var(--accent)}button:focus-visible,.button:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:2px}[hidden]{display:none!important}header{width:calc(100% - 2 * var(--content-gutter));max-width:calc(var(--content-width) - 2 * var(--content-gutter));height:var(--header-height);margin:var(--header-inset) auto 0;padding:var(--surface-inset);justify-content:space-between;align-items:center;gap:var(--surface-inset) 16px;background:var(--surface);border-radius:var(--radius);grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);display:grid;position:relative;overflow:hidden}.brand{color:inherit;align-items:center;gap:8px;font-size:15px;font-weight:600;text-decoration:none;display:flex}.pi-logo{flex:none;width:18px;height:18px;display:block}.brand{justify-self:start;padding:0 4px}.runtime-meter{--runtime-padding:10px;width:max-content;max-width:100%;height:var(--header-control-height);padding:5px var(--runtime-padding);border-radius:var(--radius-small);background:var(--control);white-space:nowrap;justify-self:center;align-items:center;font-size:11px;transition:width .22s cubic-bezier(.2,.8,.2,1);display:flex;overflow:clip}.runtime-content{flex:none;align-items:center;gap:8px;width:max-content;height:100%;display:flex}.runtime-location{flex:none;align-items:center;gap:6px;display:flex}.runtime-dot{background:var(--muted);border-radius:50%;width:5px;height:5px}.runtime-meter[data-state=generating] .runtime-dot,.runtime-meter[data-state=tool] .runtime-dot{background:var(--accent)}.runtime-meter[data-state=error] .runtime-dot{background:#d98c8c}.runtime-divider{background:var(--line);flex:0 0 1px;align-self:stretch;margin:2px 0}.runtime-sparkline{color:var(--accent);flex:none}.runtime-value{color:var(--muted);font-variant-numeric:tabular-nums;flex:none}.runtime-meter[data-state=generating] .runtime-value{color:var(--accent)}@media (prefers-reduced-motion:reduce){.runtime-meter{transition:none}}main{--conversation-min:420px;--workspace-min:370px;grid-template-columns:minmax(var(--conversation-min), var(--conversation-width,1.20482fr)) 0 minmax(var(--workspace-min), 1fr);height:calc(100dvh - var(--header-height) - var(--header-inset));max-width:var(--content-width);margin:auto;display:grid}.column-resizer{left:calc(-1 * var(--content-gutter));z-index:2;width:var(--content-gutter);cursor:col-resize;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;outline:none;justify-content:center;align-items:center;margin:12px 0 8px;display:flex;position:relative}.column-resizer:after{content:"";background:var(--line-strong);border-radius:999px;flex:none;width:3px;height:44px;transition:background-color .12s}.column-resizer:hover:after{background:var(--text)}.column-resizer:focus-visible:after{background:var(--accent);outline:2px solid var(--accent);outline-offset:4px}.is-resizing-columns,.is-resizing-columns *{cursor:col-resize!important;-webkit-user-select:none!important;user-select:none!important}.is-resizing-columns .column-resizer:after{background:var(--accent)}@media (prefers-reduced-motion:reduce){.column-resizer:after{transition:none}}@media (forced-colors:active){.column-resizer:after{background:buttontext}}.conversation{min-width:0;min-height:0;padding:12px var(--content-gutter) 8px;flex-direction:column;display:flex}.model-panel{background:var(--surface);margin-left:auto}.model-heading{justify-content:space-between;align-items:center;gap:8px;display:flex}.model-heading>div{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.model-heading strong{font-size:12px;font-weight:600}.header-model-source{color:inherit;white-space:nowrap;border-radius:3px;flex:none;align-items:center;gap:6px;text-decoration:none;display:inline-flex}.header-model-source img{border-radius:50%;flex:none;width:16px;height:16px;display:block}.header-model-source:hover{color:var(--accent)}.header-model-source:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.badge{border-radius:var(--radius-small);background:var(--control);color:var(--muted);padding:3px 7px;font-size:10px}#load{min-width:90px;height:var(--header-control-height);flex-shrink:0}#load.is-loaded{opacity:1;min-width:0;height:28px;min-height:28px;color:var(--accent);background:#25312f;border-radius:6px;justify-content:center;align-items:center;gap:6px;padding:4px 8px;display:inline-flex}#load.is-loaded:before{content:"";background:currentColor;border-radius:50%;flex:none;width:5px;height:5px}progress{width:100%;height:5px;accent-color:var(--accent);margin-top:8px}header #progress{bottom:3px;left:var(--radius);width:calc(100% - 2 * var(--radius));appearance:none;background:var(--line);--progress-fade:clamp(24px, 5vw, 72px);--progress-mask:linear-gradient(90deg, transparent 2px, #000 var(--progress-fade), #000 calc(100% - var(--progress-fade)), transparent calc(100% - 2px));height:2px;-webkit-mask-image:var(--progress-mask);mask-image:var(--progress-mask);-webkit-mask-image:var(--progress-mask);border:0;border-radius:999px;margin:0;position:absolute;overflow:hidden}header #progress::-webkit-progress-bar{background:var(--line);border-radius:999px}header #progress::-webkit-progress-value{background:var(--accent);border-radius:999px}header #progress::-moz-progress-bar{background:var(--accent);border-radius:999px}header #progress:indeterminate{background:linear-gradient(90deg, transparent, var(--accent), transparent) 0 0 / 35% 100% no-repeat var(--line);animation:1.4s ease-in-out infinite alternate header-progress}header #progress:indeterminate::-webkit-progress-bar{background:0 0}header #progress:indeterminate::-webkit-progress-value{background:0 0}header #progress:indeterminate::-moz-progress-bar{background:0 0}@keyframes header-progress{0%{background-position:0 0}to{background-position:100% 0}}@media (prefers-reduced-motion:reduce){header #progress:indeterminate{background-position:50% 0;animation:none}}.muted{color:var(--muted);margin-top:4px;font-size:11px}.muted:empty{display:none}.terminal-panel{background:var(--background);border-radius:var(--radius-large);border:1px solid #0000;flex-direction:column;flex:1;min-height:0;padding:8px;display:flex}@media (width>=851px){.terminal-panel{padding-right:0}}#pi-terminal{isolation:isolate;background:var(--background);flex:1;min-width:0;min-height:120px;position:relative;overflow:hidden}#pi-terminal .pi-terminal-mount,#pi-terminal .xterm{height:100%}#pi-terminal .xterm-viewport{background-color:var(--background)!important}#pi-terminal textarea:focus{box-shadow:none}.terminal-paws{pointer-events:none;-webkit-user-select:none;user-select:none;position:absolute;overflow:hidden}.terminal-paws i{background:var(--muted);opacity:0;width:24px;height:24px;position:absolute;transform:rotate(28deg);-webkit-mask:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20fill='black'%3e%3cpath%20d='M2%207h4v5H2zM7%202h4v6H7zM13%202h4v6h-4zM18%207h4v5h-4zM8%2012h8v2h3v6h-4v-1H9v1H5v-6h3z'/%3e%3c/g%3e%3c/svg%3e") 50%/contain no-repeat;mask:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20fill='black'%3e%3cpath%20d='M2%207h4v5H2zM7%202h4v6H7zM13%202h4v6h-4zM18%207h4v5h-4zM8%2012h8v2h3v6h-4v-1H9v1H5v-6h3z'/%3e%3c/g%3e%3c/svg%3e") 50%/contain no-repeat}.terminal-paws:not([hidden]) i{animation:3.2s ease-in-out both terminal-paw;animation-delay:var(--delay)}.terminal-paws i:first-child{left:calc(18% + var(--trail-shift));--delay:0s;top:85%}.terminal-paws i:nth-child(2){left:calc(26% + var(--trail-shift));--delay:.65s;top:78%}.terminal-paws i:nth-child(3){left:calc(27% + var(--trail-shift));--delay:1.3s;top:68%}.terminal-paws i:nth-child(4){left:calc(35% + var(--trail-shift));--delay:1.95s;top:61%}.terminal-paws i:nth-child(5){left:calc(36% + var(--trail-shift));--delay:2.6s;top:51%}.terminal-paws i:nth-child(6){left:calc(44% + var(--trail-shift));--delay:3.25s;top:44%}@keyframes terminal-paw{0%,to{opacity:0}15%,40%{opacity:.14}}@media (width<=600px){.terminal-paws i{width:18px;height:18px}}@media (prefers-reduced-motion:reduce){.terminal-paws{display:none}}.empty-mascot{pointer-events:none;flex-direction:column;align-items:flex-end;gap:10px;width:196px;max-width:calc(100% - 24px);display:flex;position:absolute;right:12px}.mascot-cat{pointer-events:auto;cursor:pointer;background:0 0;border:0;border-radius:0;flex:none;min-height:0;padding:0;line-height:0;display:block;position:relative}.mascot-cat:hover{background:0 0}.mascot-cat,.setup-cat{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;outline:none}.mascot-cat,.mascot-cat *,.setup-cat,.setup-cat *{-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.mascot-cat>*,.setup-cat>*{pointer-events:none}.empty-mascot img{object-fit:contain;width:100%;height:100%;image-rendering:pixelated;-webkit-user-select:none;user-select:none;clip-path:polygon(16.906% 6.22%,26.077% 6.22%,26.077% 9.729%,30.861% 9.729%,30.861% 14.274%,35.407% 14.274%,35.407% 20.175%,56.539% 20.175%,56.539% 14.274%,61.404% 14.274%,61.404% 9.729%,65.71% 9.729%,65.71% 6.22%,75.04% 6.22%,75.04% 44.498%,68.82% 44.498%,68.82% 48.166%,75.04% 48.166%,75.04% 52.073%,68.82% 52.073%,68.82% 57.576%,65.152% 57.576%,65.152% 61.324%,68.979% 61.324%,68.979% 67.225%,73.285% 67.225%,73.285% 77.033%,77.671% 77.033%,77.671% 55.742%,81.818% 55.742%,81.818% 51.595%,91.228% 51.595%,91.228% 63.397%,86.124% 63.397%,86.124% 85.566%,81.579% 85.566%,81.579% 92.265%,25.04% 92.265%,25.04% 85.566%,28.07% 85.566%,28.07% 57.576%,19.856% 57.576%,19.856% 52.073%,12.52% 52.073%,12.52% 48.166%,19.856% 48.166%,19.856% 44.498%,12.52% 44.498%,12.52% 41.467%,16.906% 41.467%);display:block}.mascot-eyelids{opacity:0;position:absolute;inset:0}.mascot-eyelids:before,.mascot-eyelids:after{content:"";background:linear-gradient(to bottom, #f6f0e1 70%, var(--background) 70%, var(--background) 86%, #f6f0e1 86%);width:7%;height:7.4%;position:absolute;top:39.3%}.mascot-eyelids:before{left:28.5%}.mascot-eyelids:after{left:54%}.mascot-suggestion{pointer-events:auto;color:#24242c;text-align:left;white-space:normal;background:#f5efdf;border:0;border-radius:8px;padding:10px 12px;font:12px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace;position:relative;box-shadow:0 3px #0c0c10}.mascot-suggestion:after{content:"";background:inherit;clip-path:polygon(0 0,100% 0,100% 50%,50% 50%,50% 100%,0 100%);width:12px;height:8px;position:absolute;bottom:-8px;right:52px}.mascot-suggestion:hover{background:#fffaf0}.terminal-controls{justify-content:flex-end;align-items:center;gap:8px;padding-top:4px;display:flex}.terminal-controls,.terminal-panel>footer{cursor:text}#new-chat{margin-right:auto}#newline:not(:hover){background:0 0}#notice{border-radius:var(--radius-small);background:var(--control);margin:6px 0;padding:8px 10px;font-size:12px}footer{color:var(--muted);justify-content:space-between;align-items:center;gap:8px;padding-top:8px;font-size:10px;display:flex}.workspace{min-width:0;min-height:0;margin:12px var(--content-gutter) 8px 0;background:var(--panel);border-radius:20px;flex-direction:column;display:flex;overflow:hidden}.workspace-heading{justify-content:space-between;align-items:center;min-height:40px;padding:5px 10px;display:flex}.workspace-heading h2{margin:0;font-size:12px;font-weight:600}.workspace-heading>div{gap:0;display:flex}.workspace-heading{flex-wrap:wrap}.folder-controls{flex-wrap:wrap;gap:4px;padding:0 10px 7px;display:flex}.folder-controls:has(>button:not([hidden])){min-height:30px}.folder-controls:not(:has(>button:not([hidden]))){display:none}#open-folder{color:var(--accent,#8abeb7);background:#8abeb710}#local-folder-bar{background:#8abeb710;border-radius:10px;margin:0 8px 8px;padding:10px;font-size:11px}#local-folder-name{color:var(--accent,#8abeb7);overflow-wrap:anywhere;display:block}#local-folder-hint{color:var(--muted);margin:4px 0 8px;line-height:1.5;display:block}.folder-actions{flex-wrap:wrap;gap:5px;display:flex}.folder-actions button{padding:6px 9px;font-size:11px}#local-review{box-sizing:border-box;background:var(--bg,#18181e);width:min(820px,100vw - 24px);max-height:calc(100dvh - 32px);color:var(--text);border:1px solid #8abeb740;border-radius:18px;padding:20px}#local-review::backdrop{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#0009}.review-heading{justify-content:space-between;align-items:center;gap:12px;display:flex}.review-heading h2{margin:0;font-size:20px}#review-close{padding:2px 10px;font-size:24px}#review-description{color:var(--muted);font-size:13px;line-height:1.5}#review-files{max-height:55dvh;overflow:auto}#review-files details{border:1px solid #ffffff18;border-radius:8px;margin:8px 0;overflow:hidden}#review-files summary{cursor:pointer;overflow-wrap:anywhere;padding:10px;font:12px ui-monospace,monospace}#review-files pre{tab-size:2;background:#0003;margin:0;padding:10px;font:12px/1.55 ui-monospace,monospace;overflow:auto}.diff-add{color:#98dfb4}.diff-remove{color:#f2a6a6}#review-error{color:#f2a6a6;font-size:13px;line-height:1.5}.review-actions{flex-wrap:wrap;justify-content:flex-end;gap:8px;margin-top:16px;display:flex}.button{display:inline-block}.file-area{flex:1;grid-template-columns:140px minmax(0,1fr);min-height:180px;display:grid}#files{padding:5px 4px;overflow:auto}#files button{border-radius:var(--radius-small);text-align:left;white-space:normal;overflow-wrap:anywhere;background:0 0;border:none;align-items:center;gap:6px;width:100%;padding:5px 7px;font-family:ui-monospace,monospace;font-size:11px;line-height:1.45;display:flex}.file-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.file-icon{background-color:var(--file-color);width:16px;height:16px;-webkit-mask:var(--file-icon) center / 90% 90% no-repeat;mask:var(--file-icon) center / 90% 90% no-repeat;-webkit-mask:var(--file-icon) center / 90% 90% no-repeat;flex:0 0 16px;display:inline-block}.editor-file{align-items:center;gap:6px;min-width:0;display:flex}#filetype{flex:none;display:flex}#filetype:empty{display:none}@media (forced-colors:active){.file-icon{background-color:canvastext}}#files button:hover{background:var(--hover)}#files button.selected{background:var(--selected);color:var(--text)}.editor-area{border-radius:var(--radius);background:var(--surface);flex-direction:column;min-width:0;min-height:0;margin:0 8px 8px 0;display:flex;overflow:hidden}.editor-heading{background:#282832;justify-content:space-between;align-items:center;gap:6px;height:32px;padding:0 6px 0 10px;transition:background-color .14s,box-shadow .14s;display:flex}.editor-area:focus-within .editor-heading{background:#30323a;box-shadow:inset 0 -1px #8abeb74d}@media (prefers-reduced-motion:reduce){.editor-heading{transition:none}}@media (forced-colors:active){.editor-area:focus-within .editor-heading{outline-offset:-1px;outline:1px solid highlight}}#filename{text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,monospace;font-size:11px;overflow:hidden}.editor-heading{flex-shrink:0}.editor-input{flex:1;min-width:0;min-height:140px;position:relative;overflow:hidden}#editor,#editor-highlight{width:100%;height:100%;color:var(--text);font-variant-ligatures:none;letter-spacing:normal;tab-size:2;white-space:pre;overflow-wrap:normal;border:0;border-radius:0;margin:0;padding:10px 12px;font:12px/1.6 ui-monospace,SFMono-Regular,Consolas,monospace;position:absolute;top:0;left:0}#editor{resize:none;caret-color:var(--text);background:0 0;overflow:auto}#editor-highlight{visibility:hidden;pointer-events:none;overflow:hidden}.is-highlighted #editor-highlight{visibility:visible}.is-highlighted #editor{color:#0000}.is-highlighted #editor::selection{color:#0000}#editor::selection{background:#8abeb740}#editor:focus{box-shadow:none}#editor-highlight .token{font-style:normal;font-weight:400}#editor-highlight .token.comment,#editor-highlight .token.prolog,#editor-highlight .token.doctype{color:#9292a3}#editor-highlight .token.punctuation{color:#b0b0bd}#editor-highlight .token.tag,#editor-highlight .token.deleted{color:#e29a9a}#editor-highlight .token.keyword,#editor-highlight .token.selector,#editor-highlight .token.important{color:#c4a7d5}#editor-highlight .token.string,#editor-highlight .token.attr-value,#editor-highlight .token.inserted{color:#b5bd68}#editor-highlight .token.function,#editor-highlight .token.builtin,#editor-highlight .token.class-name{color:#8abeb7}#editor-highlight .token.attr-name,#editor-highlight .token.property,#editor-highlight .token.variable{color:#9db9d4}#editor-highlight .token.number,#editor-highlight .token.boolean,#editor-highlight .token.constant,#editor-highlight .token.operator,#editor-highlight .token.entity,#editor-highlight .token.url{color:#f0c674}@media (forced-colors:active){.is-highlighted #editor-highlight{visibility:hidden}.is-highlighted #editor{color:canvastext}.is-highlighted #editor::selection{color:canvastext}}.workspace>.terminal{border-radius:var(--radius);background:var(--background);flex-shrink:0;margin:0 8px;padding:0 8px 8px}.terminal summary{cursor:pointer;padding:6px 0;font-size:11px;font-weight:500}.terminal summary span{float:right;color:var(--muted);font-size:10px;font-weight:400}.shell-toolbar{color:var(--accent);justify-content:space-between;align-items:center;font:11px/1.5 ui-monospace,monospace;display:flex}.shell-toolbar button{color:var(--muted)}#terminal-output{resize:vertical;scrollbar-width:thin;overflow-wrap:anywhere;height:132px;min-height:84px;max-height:min(480px,45dvh);margin:0 0 6px;padding:2px 0;font:12px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;overflow:auto}#terminal-output:focus-visible{outline:1px solid var(--accent);outline-offset:2px;border-radius:var(--radius-small)}.shell-empty{color:var(--muted);flex-direction:column;gap:4px;padding:8px 2px;display:flex}.shell-empty strong{color:var(--text);font-weight:500}.shell-empty code{color:var(--accent)}.shell-entry{border-radius:var(--radius-small);background:var(--surface);margin-bottom:6px;padding:8px}.shell-entry:last-child{margin-bottom:0}.shell-entry-heading{align-items:baseline;gap:8px;display:flex}.shell-entry pre{font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.shell-code{flex:1;min-width:0}.shell-status{color:var(--muted);flex-shrink:0;font-size:10px}.shell-status.success{color:#b5bd68}.shell-status.error,.shell-stderr{color:#e29a9a}.shell-entry .shell-stdout,.shell-entry .shell-stderr{margin:6px 0 0 16px}#shell-form{border-radius:var(--radius-small);background:var(--control);align-items:flex-start;gap:8px;padding:4px;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;display:flex}#shell-form:focus-within{box-shadow:0 0 0 1px var(--accent)}.shell-prompt{color:var(--accent);flex-shrink:0}#shell-form>.shell-prompt{padding-top:6px;line-height:20px}.shell-input{flex:1;min-width:0;position:relative}#command,#command-highlight{font-variant-ligatures:none;letter-spacing:normal;tab-size:2;white-space:pre-wrap;overflow-wrap:anywhere;border:0;border-radius:0;width:100%;margin:0;padding:6px 0;font:12px/20px ui-monospace,SFMono-Regular,Consolas,monospace}#command-highlight{pointer-events:none;position:absolute;inset:0;overflow:hidden}#command{resize:none;color:#0000;min-height:32px;max-height:104px;caret-color:var(--text);scrollbar-width:thin;background:0 0;display:block;position:relative}#command:focus{box-shadow:none}#command::selection{color:#0000;background:#8abeb740}#command::placeholder{color:var(--muted)}#shell-run{border-radius:4px;min-height:32px}#shell-hint{color:var(--muted);flex-wrap:wrap;justify-content:space-between;gap:2px 12px;padding-top:5px;font-size:10px;line-height:1.5;display:flex}.shell-code .token,#command-highlight .token{font-style:normal;font-weight:400}.shell-code .token.comment,#command-highlight .token.comment{color:#aaaab7}.shell-code .token.string,#command-highlight .token.string{color:#b5bd68}.shell-code .token.function,.shell-code .token.builtin,#command-highlight .token.function,#command-highlight .token.builtin{color:#8abeb7}.shell-code .token.variable,.shell-code .token.assign-left,#command-highlight .token.variable,#command-highlight .token.assign-left{color:#c4a7d5}.shell-code .token.keyword,.shell-code .token.operator,.shell-code .token.number,#command-highlight .token.keyword,#command-highlight .token.operator,#command-highlight .token.number{color:#f0c674}.shell-code .token.parameter,#command-highlight .token.parameter{color:#9db9d4}@media (forced-colors:active){#command-highlight{display:none}#command{color:canvastext}#command::selection{color:canvastext}}.workspace-note{color:var(--muted);margin:6px 10px;font-size:10px;line-height:1.45}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border:0;width:1px;height:1px;padding:0;position:absolute;overflow:hidden}#open-tab{color:var(--accent);white-space:normal;margin-top:8px;font-size:12px;text-decoration:none}#model-dialog{--dialog-inset:24px;--cat-size:152px;--cat-rise:calc(var(--cat-size) * .58);width:min(460px,100% - 32px);max-height:calc(100dvh - 32px - var(--cat-rise));padding:var(--dialog-inset);border-radius:calc(var(--radius-small) + var(--dialog-inset));background:var(--surface);color:var(--text);transform:translateY(calc(var(--cat-rise) / 2));border:0;overflow:visible;box-shadow:0 24px 80px #0008}#model-dialog[open]{flex-direction:column;display:flex}.setup-paws{--modal-half:min(230px, calc(50vw - 16px));left:50%;top:calc(50% - var(--cat-rise) / 2);pointer-events:none;-webkit-user-select:none;user-select:none;z-index:-1;width:100vw;height:100dvh;position:absolute;overflow:hidden;transform:translate(-50%,-50%)}.setup-paws i{background:var(--muted);opacity:0;width:28px;height:28px;transform:rotate(var(--angle));position:absolute;-webkit-mask:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20fill='black'%3e%3cpath%20d='M2%207h4v5H2zM7%202h4v6H7zM13%202h4v6h-4zM18%207h4v5h-4zM8%2012h8v2h3v6h-4v-1H9v1H5v-6h3z'/%3e%3c/g%3e%3c/svg%3e") 50%/contain no-repeat;mask:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20fill='black'%3e%3cpath%20d='M2%207h4v5H2zM7%202h4v6H7zM13%202h4v6h-4zM18%207h4v5h-4zM8%2012h8v2h3v6h-4v-1H9v1H5v-6h3z'/%3e%3c/g%3e%3c/svg%3e") 50%/contain no-repeat}#model-dialog[open] .setup-paws i{animation:10s ease-in-out infinite setup-paw;animation-delay:var(--delay);animation-play-state:var(--cat-play-state,running)}.setup-paws i:first-child{left:calc(50% - var(--modal-half) - clamp(48px, 9vw, 136px));--angle:-34deg;--delay:-1s;top:68%}.setup-paws i:nth-child(2){left:calc(50% - var(--modal-half) - clamp(30px, 6vw, 88px));--angle:-24deg;--delay:-.3s;top:60%}.setup-paws i:nth-child(3){left:calc(50% - var(--modal-half) - clamp(45px, 8vw, 120px));--angle:-12deg;--delay:.4s;top:52%}.setup-paws i:nth-child(4){left:calc(50% + var(--modal-half) + clamp(25px, 4vw, 64px));--angle:28deg;--delay:4s;top:46%}.setup-paws i:nth-child(5){left:calc(50% + var(--modal-half) + clamp(50px, 8vw, 120px));--angle:35deg;--delay:4.7s;top:38%}.setup-paws i:nth-child(6){left:calc(50% + var(--modal-half) + clamp(35px, 7vw, 100px));--angle:25deg;--delay:5.4s;top:30%}@keyframes setup-paw{0%,5%,38%,to{opacity:0}14%,24%{opacity:.16}}@media (width<=600px){.setup-paws i{width:18px;height:18px}.setup-paws i:first-child{--angle:65deg;top:22px;left:8%}.setup-paws i:nth-child(2){--angle:75deg;top:14px;left:19%}.setup-paws i:nth-child(3){--angle:65deg;top:22px;left:30%}.setup-paws i:nth-child(n+4){display:none}}@media (prefers-reduced-motion:reduce){#model-dialog[open] .setup-paws i{animation:none}.setup-paws i:first-child,.setup-paws i:nth-child(2){opacity:.1}}.setup-cat{top:calc(-1 * var(--cat-rise));right:var(--dialog-inset);width:var(--cat-size);height:calc(var(--cat-size) * .66);pointer-events:auto;cursor:pointer;touch-action:manipulation;-webkit-user-select:none;user-select:none;position:absolute;overflow:hidden}.setup-cat img,.setup-cat-tail,.setup-cat-eyelids{top:calc(var(--cat-size) * -.23);width:100%;height:auto;image-rendering:pixelated;opacity:0;display:block;position:absolute;left:0}.setup-cat img{clip-path:inset(0 22% 0 0)}.setup-cat-tail{aspect-ratio:1;background:var(--cat-sprite) 0 0 / 100% 100% no-repeat;clip-path:polygon(78% 40%,100% 40%,100% 82%,77% 82%,77% 77%,78% 77%);transform-origin:78% 80%}.setup-cat.is-ready img,.setup-cat.is-ready .setup-cat-tail{opacity:1}.setup-cat-eyelids{aspect-ratio:1}.setup-cat-eyelids:before,.setup-cat-eyelids:after{content:"";background:linear-gradient(#080709,#080709) 50% 80%/78% 14% no-repeat,#f6efdf;width:8.4%;height:8.7%;position:absolute;top:55.6%}.setup-cat-eyelids:before{left:28%}.setup-cat-eyelids:after{left:54.3%}#model-dialog[open] .setup-cat.is-ready .setup-cat-tail{animation:9s ease-in-out infinite setup-tail-swish;animation-play-state:var(--cat-play-state,running)}#model-dialog[open] .setup-cat.is-ready .setup-cat-eyelids{animation:7.4s step-end infinite setup-cat-blink;animation-play-state:var(--cat-play-state,running)}@keyframes setup-cat-blink{0%,45%,to{opacity:0}43%{opacity:1}}@keyframes setup-tail-swish{0%,24%,50%,to{transform:rotate(0)}33%{transform:rotate(-4deg)}41%{transform:rotate(2.5deg)}46%{transform:rotate(-.6deg)}}@media (prefers-reduced-motion:reduce){#model-dialog[open] .setup-cat.is-ready .setup-cat-tail,#model-dialog[open] .setup-cat.is-ready .setup-cat-eyelids{animation:none}}.setup-heading{flex-shrink:0;align-items:flex-start;gap:8px;display:flex}#model-cancel{width:32px;height:32px;min-height:32px;color:var(--muted);background:0 0;flex:none;place-items:center;padding:0;display:grid}#model-cancel:hover:not(:disabled){background:var(--control);color:var(--text)}.setup-body{min-height:0;overflow:auto}#model-dialog::backdrop{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#08080dbd}#model-title{letter-spacing:-.5px;flex:1;min-width:0;margin:0 0 8px;font-size:27px;font-weight:650;line-height:1.2}#model-description{color:var(--muted);margin:0;line-height:1.6}.setup-runtime{grid-template-columns:minmax(max-content,1fr) 1fr 1.2fr;gap:8px;margin:18px 0;display:grid}.setup-runtime>div{border-radius:var(--radius-small);background:var(--control);padding:10px}.setup-runtime dt{color:var(--accent);font-size:12px;font-weight:600}.setup-runtime dd{margin:5px 0 0;font-size:11px;line-height:1.5}.setup-model{align-items:center;gap:6px;display:flex}.model-org{border-radius:50%;flex:none;display:inline-flex}.model-org img{border-radius:inherit;width:18px;height:18px;display:block}.model-source{color:inherit;-webkit-text-decoration-color:var(--muted);text-decoration-color:var(--muted);text-underline-offset:3px;white-space:nowrap}.model-source:hover{color:var(--accent)}.setup-model a:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:3px}.setup-facts{border-radius:var(--radius-small);background:var(--panel);flex-direction:column;gap:5px;margin:18px 0;padding:12px;line-height:1.45;display:flex}.setup-facts strong{font-size:12px;font-weight:600}.setup-facts span,.setup-label{color:var(--muted);font-size:11px;line-height:1.5}.setup-label{margin:16px 0 6px}#model-preview{white-space:pre-wrap;overflow-wrap:anywhere;border-radius:var(--radius-small);background:var(--control);max-height:84px;padding:10px 12px;font-size:12px;line-height:1.5;overflow:auto}#model-error{border-radius:var(--radius-small);overflow-wrap:anywhere;background:#3c2828;padding:10px 12px;line-height:1.5}#model-open-tab{color:var(--accent);white-space:normal;text-decoration:none}.setup-credits{color:var(--muted);flex-wrap:wrap;align-items:center;gap:6px 10px;margin:18px 0;font-size:11px;line-height:1.6;display:flex}.setup-credits a{color:inherit;white-space:nowrap;align-items:center;gap:4px;text-decoration:none;display:inline-flex}.setup-credits a:hover{color:var(--text);text-underline-offset:3px;text-decoration:underline}.setup-credits a:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:3px}.setup-credits img,.setup-credits svg{object-fit:contain;flex:none;width:14px;height:14px}.setup-credits .credit-pi{padding:2px}.setup-actions{flex-shrink:0;padding-top:4px;display:flex}.setup-actions button{width:100%;min-height:44px;padding:10px 16px}#model-confirm{color:#18181e;background:#fff;font-size:14px;font-weight:600}#model-confirm:hover{background:#e8e8ed}@media (width<=420px){#model-dialog{--dialog-inset:16px;--cat-size:116px}#model-title{font-size:24px}.setup-runtime{grid-template-columns:1fr;gap:5px;margin:14px 0}.setup-runtime>div{align-items:baseline;gap:12px;padding:8px 10px;display:flex}.setup-runtime dt{flex:0 0 64px}.setup-runtime dd{margin:0}.setup-facts{margin:14px 0}.setup-credits{margin:12px 0}}@media (width>=851px) and (width<=1000px){header{grid-template-columns:auto minmax(0,1fr) auto}}@media (height<=620px){#model-dialog{--cat-size:72px}.setup-runtime,.setup-facts{margin:12px 0}}@media (width<=420px) and (height<=620px){.setup-runtime{grid-template-columns:minmax(0,1fr) max-content}.setup-runtime>div:first-child{grid-column:1/-1}.setup-runtime>div:not(:first-child){padding:6px 10px;display:block}.setup-runtime>div:not(:first-child) dd{margin-top:2px}}@media (width<=850px){:root{--header-height:calc(2 * var(--header-control-height) + 3 * var(--surface-inset));--header-inset:10px;--content-gutter:10px}header{grid-template-columns:auto minmax(0,1fr);grid-template-rows:repeat(2, var(--header-control-height));gap:var(--surface-inset);grid-template-areas:"brand runtime""model model"}.brand{grid-area:brand;justify-self:start}.runtime-meter{grid-area:runtime;justify-self:end}.model-panel{grid-area:model;margin:0}main{flex-direction:column;height:auto;display:flex}.column-resizer{display:none}.conversation{height:calc(100dvh - var(--header-height) - var(--header-inset));min-height:320px;padding:10px var(--content-gutter)}.workspace{min-height:520px;margin:0 var(--content-gutter) 10px}.file-area{grid-template-columns:115px minmax(0,1fr);min-height:280px}h1{font-size:20px}.badge,footer{font-size:9px}}@media (pointer:coarse){:root{--header-control-height:38px}button,.button,#files button{min-height:38px}.editor-heading{min-height:40px}.terminal summary{padding-top:11px;padding-bottom:11px}#command,#command-highlight,#pi-terminal .xterm-helper-textarea{font-size:16px}}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}
20 unmodified lines212223242526272826 unmodified lines5556575859609 unmodified lines70717273747520 unmodified lines<meta name="twitter:image" content="https://huggingface.co/spaces/Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP/resolve/main/social-thumbnail-v3.png"><meta name="twitter:image:alt" content="A coding agent running entirely in your browser, above the Pi terminal and its pixel cat mascot."><title>Pi · Coding agent in your browser</title><script type="module" crossorigin src="./assets/index-B--sYzmA.js"></script><link rel="stylesheet" crossorigin href="./assets/index-Bl39c3Js.css"></head><body><header><a class="brand" href="./" aria-label="Pi"><svg class="pi-logo" viewBox="165.29 165.29 469.43 469.43" width="18" height="18" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z"/><path fill="currentColor" d="M517.36 400H634.72V634.72H517.36Z"/></svg></a>26 unmodified lines<div id="column-resizer" class="column-resizer" role="separator" tabindex="0" aria-label="Resize chat and workspace" aria-orientation="vertical" aria-controls="conversation-panel workspace-panel" aria-valuemin="0" aria-valuemax="100" aria-valuenow="55" title="Drag to resize · Arrow keys to adjust · Double-click or Enter to reset"></div><aside id="workspace-panel" class="workspace" aria-label="Workspace"><div class="workspace-heading"><h2>Workspace</h2><div><button id="add-file" class="quiet">+ File</button><label class="button quiet" for="upload">Import</label><input id="upload" type="file" multiple hidden><button id="export" class="quiet">Export</button></div></div><div class="file-area"><nav id="files" aria-label="Files"></nav><div class="editor-area"><div class="editor-heading"><span class="editor-file"><span id="filetype"></span><span id="filename">Select a file</span></span><button id="save" class="quiet" disabled>Save</button></div><label for="editor" class="sr-only">File contents</label><div class="editor-input"><pre id="editor-highlight" aria-hidden="true"></pre><textarea id="editor" wrap="off" autocomplete="off" autocapitalize="off" spellcheck="false" disabled placeholder="Select a file to inspect or edit it."></textarea></div></div></div><details class="terminal" open><summary>Shell <span>just-bash</span></summary>9 unmodified lines<p class="workspace-note">HTTP: curl can request any HTTPS URL. Browser CORS applies. <a href="./http-help.html" target="_blank" rel="noopener">HTTP help ↗</a></p></aside></main><dialog id="model-dialog" aria-labelledby="model-title" aria-describedby="model-description"><div class="setup-paws" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i><i></i></div><div class="setup-cat" aria-hidden="true"><span class="setup-cat-tail"></span><img src="./modal-cat-v1.png" width="1254" height="1254" alt="" draggable="false" loading="eager" fetchpriority="high" decoding="async"><span class="setup-cat-eyelids"></span></div>20 unmodified lines212223242526272826 unmodified lines55565758596061626364659 unmodified lines757677787980818283848520 unmodified lines<meta name="twitter:image" content="https://huggingface.co/spaces/Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP/resolve/main/social-thumbnail-v3.png"><meta name="twitter:image:alt" content="A coding agent running entirely in your browser, above the Pi terminal and its pixel cat mascot."><title>Pi · Coding agent in your browser</title><script type="module" crossorigin src="./assets/index-DUQ_UspG.js"></script><link rel="stylesheet" crossorigin href="./assets/index-Uy7sEXBC.css"></head><body><header><a class="brand" href="./" aria-label="Pi"><svg class="pi-logo" viewBox="165.29 165.29 469.43 469.43" width="18" height="18" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z"/><path fill="currentColor" d="M517.36 400H634.72V634.72H517.36Z"/></svg></a>26 unmodified lines<div id="column-resizer" class="column-resizer" role="separator" tabindex="0" aria-label="Resize chat and workspace" aria-orientation="vertical" aria-controls="conversation-panel workspace-panel" aria-valuemin="0" aria-valuemax="100" aria-valuenow="55" title="Drag to resize · Arrow keys to adjust · Double-click or Enter to reset"></div><aside id="workspace-panel" class="workspace" aria-label="Workspace"><div class="workspace-heading"><h2>Workspace</h2><div><button id="add-file" class="quiet">+ File</button><label class="button quiet" for="upload">Import</label><input id="upload" type="file" multiple hidden><button id="export" class="quiet">Export</button></div></div><div class="folder-controls"><button id="open-folder" type="button" class="quiet">Open local folder</button><button id="reconnect-folder" type="button" class="quiet" hidden>Reconnect folder</button></div><div id="local-folder-bar" hidden><strong id="local-folder-name"></strong><span id="local-folder-hint" role="status"></span><div class="folder-actions"><button id="review-changes" type="button">Review & apply</button><button id="refresh-folder" type="button" class="quiet" title="Reload files from disk and start a fresh chat">Refresh</button><button id="disconnect-folder" type="button" class="quiet">Back to demo</button></div></div><div class="file-area"><nav id="files" aria-label="Files"></nav><div class="editor-area"><div class="editor-heading"><span class="editor-file"><span id="filetype"></span><span id="filename">Select a file</span></span><button id="save" class="quiet" disabled>Save</button></div><label for="editor" class="sr-only">File contents</label><div class="editor-input"><pre id="editor-highlight" aria-hidden="true"></pre><textarea id="editor" wrap="off" autocomplete="off" autocapitalize="off" spellcheck="false" disabled placeholder="Select a file to inspect or edit it."></textarea></div></div></div><details class="terminal" open><summary>Shell <span>just-bash</span></summary>9 unmodified lines<p class="workspace-note">HTTP: curl can request any HTTPS URL. Browser CORS applies. <a href="./http-help.html" target="_blank" rel="noopener">HTTP help ↗</a></p></aside></main><dialog id="local-review" aria-labelledby="review-title" aria-describedby="review-description"><div class="review-heading"><h2 id="review-title">Review local changes</h2><button id="review-close" type="button" aria-label="Close change review">×</button></div><p id="review-description"></p><div id="review-files"></div><p id="review-error" role="alert"></p><div class="review-actions"><button id="review-discard" type="button">Discard changes</button><button id="review-apply" type="button" class="primary">Apply to folder</button></div></dialog><dialog id="model-dialog" aria-labelledby="model-title" aria-describedby="model-description"><div class="setup-paws" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i><i></i></div><div class="setup-cat" aria-hidden="true"><span class="setup-cat-tail"></span><img src="./modal-cat-v1.png" width="1254" height="1254" alt="" draggable="false" loading="eager" fetchpriority="high" decoding="async"><span class="setup-cat-eyelids"></span></div>
12764 unmodified lines12765127661276712768127691277012764 unmodified lines----------------------------------------object-keys@1.1.1 (MIT)12764 unmodified lines1276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612764 unmodified lines----------------------------------------node-gyp-build@4.8.4 (MIT)The MIT License (MIT)Copyright (c) 2017 Mathias BuusPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.----------------------------------------node-liblzma@2.2.0 (LGPL-3.0)GNU LESSER GENERAL PUBLIC LICENSEVersion 3, 29 June 2007Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>Everyone is permitted to copy and distribute verbatim copiesof this license document, but changing it is not allowed.This version of the GNU Lesser General Public License incorporatesthe terms and conditions of version 3 of the GNU General PublicLicense, supplemented by the additional permissions listed below.0. Additional Definitions.As used herein, "this License" refers to version 3 of the GNU LesserGeneral Public License, and the "GNU GPL" refers to version 3 of the GNUGeneral Public License."The Library" refers to a covered work governed by this License,other than an Application or a Combined Work as defined below.An "Application" is any work that makes use of an interface providedby the Library, but which is not otherwise based on the Library.Defining a subclass of a class defined by the Library is deemed a modeof using an interface provided by the Library.A "Combined Work" is a work produced by combining or linking anApplication with the Library. The particular version of the Librarywith which the Combined Work was made is also called the "LinkedVersion".The "Minimal Corresponding Source" for a Combined Work means theCorresponding Source for the Combined Work, excluding any source codefor portions of the Combined Work that, considered in isolation, arebased on the Application, and not on the Linked Version.The "Corresponding Application Code" for a Combined Work means theobject code and/or source code for the Application, including any dataand utility programs needed for reproducing the Combined Work from theApplication, but excluding the System Libraries of the Combined Work.1. Exception to Section 3 of the GNU GPL.You may convey a covered work under sections 3 and 4 of this Licensewithout being bound by section 3 of the GNU GPL.2. Conveying Modified Versions.If you modify a copy of the Library, and, in your modifications, afacility refers to a function or data to be supplied by an Applicationthat uses the facility (other than as an argument passed when thefacility is invoked), then you may convey a copy of the modifiedversion:a) under this License, provided that you make a good faith effort toensure that, in the event an Application does not supply thefunction or data, the facility still operates, and performswhatever part of its purpose remains meaningful, orb) under the GNU GPL, with none of the additional permissions ofthis License applicable to that copy.3. Object Code Incorporating Material from Library Header Files.The object code form of an Application may incorporate material froma header file that is part of the Library. You may convey such objectcode under terms of your choice, provided that, if the incorporatedmaterial is not limited to numerical parameters, data structurelayouts and accessors, or small macros, inline functions and templates(ten or fewer lines in length), you do both of the following:a) Give prominent notice with each copy of the object code that theLibrary is used in it and that the Library and its use arecovered by this License.b) Accompany the object code with a copy of the GNU GPL and this licensedocument.4. Combined Works.You may convey a Combined Work under terms of your choice that,taken together, effectively do not restrict modification of theportions of the Library contained in the Combined Work and reverseengineering for debugging such modifications, if you also do each ofthe following:a) Give prominent notice with each copy of the Combined Work thatthe Library is used in it and that the Library and its use arecovered by this License.b) Accompany the Combined Work with a copy of the GNU GPL and this licensedocument.c) For a Combined Work that displays copyright notices duringexecution, include the copyright notice for the Library amongthese notices, as well as a reference directing the user to thecopies of the GNU GPL and this license document.d) Do one of the following:0) Convey the Minimal Corresponding Source under the terms of thisLicense, and the Corresponding Application Code in a formsuitable for, and under terms that permit, the user torecombine or relink the Application with a modified version ofthe Linked Version to produce a modified Combined Work, in themanner specified by section 6 of the GNU GPL for conveyingCorresponding Source.1) Use a suitable shared library mechanism for linking with theLibrary. A suitable mechanism is one that (a) uses at run timea copy of the Library already present on the user's computersystem, and (b) will operate properly with a modified versionof the Library that is interface-compatible with the LinkedVersion.e) Provide Installation Information, but only if you would otherwisebe required to provide such information under section 6 of theGNU GPL, and only to the extent that such information isnecessary to install and execute a modified version of theCombined Work produced by recombining or relinking theApplication with a modified version of the Linked Version. (Ifyou use option 4d0, the Installation Information must accompanythe Minimal Corresponding Source and Corresponding ApplicationCode. If you use option 4d1, you must provide the InstallationInformation in the manner specified by section 6 of the GNU GPLfor conveying Corresponding Source.)5. Combined Libraries.You may place library facilities that are a work based on theLibrary side by side in a single library together with other libraryfacilities that are not Applications and are not covered by thisLicense, and convey such a combined library under terms of yourchoice, if you do both of the following:a) Accompany the combined library with a copy of the same work basedon the Library, uncombined with any other library facilities,conveyed under the terms of this License.b) Give prominent notice with the combined library that part of itis a work based on the Library, and explaining where to find theaccompanying uncombined form of the same work.6. Revised Versions of the GNU Lesser General Public License.The Free Software Foundation may publish revised and/or new versionsof the GNU Lesser General Public License from time to time. Such newversions will be similar in spirit to the present version, but maydiffer in detail to address new problems or concerns.Each version is given a distinguishing version number. If theLibrary as you received it specifies that a certain numbered versionof the GNU Lesser General Public License "or any later version"applies to it, you have the option of following the terms andconditions either of that published version or of any later versionpublished by the Free Software Foundation. If the Library as youreceived it does not specify a version number of the GNU LesserGeneral Public License, you may choose any version of the GNU LesserGeneral Public License ever published by the Free Software Foundation.If the Library as you received it specifies that a proxy can decidewhether future versions of the GNU Lesser General Public License shallapply, that proxy's public statement of acceptance of any version ispermanent authorization for you to choose that version for theLibrary.----------------------------------------object-keys@1.1.1 (MIT)
11 unmodified lines1213141516171811 unmodified lines(out / 'validation').mkdir()for path in (root / 'validation').glob('*'):# Keep temporary failures and screenshots containing HTTP echo metadata local.if path.is_file() and path.name in ['source.json', 'deployment.json', 'http-shell-live.json', 'http-agent-live.json', 'http-final-smoke.json', 'http-embedded.json', 'http-any-https.json', 'REPORT.md', 'http-desktop.png', 'http-mobile.png', 'http-agent-fetch-count-write.png']:destination = out / 'validation' / path.nameif path.suffix == '.json':data = path.read_text()11 unmodified lines1213141516171811 unmodified lines(out / 'validation').mkdir()for path in (root / 'validation').glob('*'):# Keep temporary failures and screenshots containing HTTP echo metadata local.if path.is_file() and path.name in ['source.json', 'deployment.json', 'http-shell-live.json', 'http-agent-live.json', 'http-final-smoke.json', 'http-embedded.json', 'http-any-https.json', 'REPORT.md', 'http-desktop.png', 'http-mobile.png', 'http-agent-fetch-count-write.png', 'LOCAL-FOLDER.md', 'local-folder-browser.json', 'local-folder-live.json', 'local-folder-agent-live.json', 'local-folder-native.png', 'local-folder-browser-review.png', 'local-folder-browser-390.png']:destination = out / 'validation' / path.nameif path.suffix == '.json':data = path.read_text()
123456789101112# Local folder validation
September 16, 2026. Duplicate only: `Mike0021/MiniCPM5-2B-WebGPU-Pi-HTTP`.
- Production build and 28 unit tests passed. Six new OS-backed adapter tests cover lazy reads, shell/tool writes, file creation/copy/rename/delete, directory creation, restored baselines, conflicts, cancellation, write failure, unsupported operations and virtual paths outside the mount. Failed creation also removes its still-empty placeholder.- Browser integration passed in Chromium 152 using real OPFS directory handles through the real worker and IndexedDB. Only the picker is replaced in this suite. Checks cover user activation, staging/diff/application, demo restoration, reload/reconnect, external conflicts, discard, picker cancellation, iframe fallback, and 1440/390/320px layouts. `local-folder-browser.json` records results.- Separately, a headed Chromium 152 test on an isolated X display used the **native OS directory picker**, selected a real test directory, accepted Chromium's read permission, edited README.md, reviewed its diff, then accepted write permission. Node read the host file and confirmed `# Native edited\n` on disk. This was not OPFS or a mock picker. Earlier test attempts accidentally denied the read permission with a forwarded Enter key; clicking the chooser's Open button and then Allow completed the native flow.- WebKit 26 at 390px correctly reports that direct folder access is unsupported and keeps all three demo files available. This is a WebKit engine test, not a physical Safari/iPhone test.
Native reproduction: open the standalone app in Chrome, select a small disposable project with Open local folder, allow read access, edit a file and Stage edit. Verify the original file is unchanged. Open Review & apply, inspect the diff, click Apply to folder, allow write access, and verify the file on disk. Back to demo restores the original demo; reload then Reconnect folder restores the local session. Change a previously read file externally before applying a staged edit to check conflict handling.
These checks validate the adapter and UI. They are not a general model reliability benchmark. Multi-file application has no OS transaction and can partially succeed; errors retain pending changes and report the count applied.12345678910111213141516{ "url": "http://<redacted IP>:4193/", "date": "2026-09-16T14:16:47.286Z", "checks": [ "Real directory handle crosses worker boundary; picker called with user activation; existing editor/tree reused; excluded directories omitted", "Editor changes are staged; readable diff reviewed; Apply writes through the browser API", "Back to demo restores original files/chat; reload + reconnect restores handle, staged edits and local chat from separate IndexedDB record", "External edit blocks the whole apply before any disk mutation; Discard leaves external contents intact", "Folder controls and editor fit 1440, 390 and 320px layouts", "Cancelling picker preserves the demo workspace", "Cross-origin iframe offers direct app tab instead of a blocked native picker" ], "errors": [], "picker": "Test supplies a real OPFS directory handle; native OS picker covered separately.", "passed": true}README.md+17-3
app/index.html+10
app/package-lock.json+1
app/package.json+1
app/src/agent.worker.mjs+51-5
app/src/local-folder-ui.mjsAdded+141
app/src/local-folder.mjsAdded+265
app/src/main.mjs+44-6
app/src/storage.mjs+4-4
app/src/style.css+23
app/src/workspace.mjs+5-3
app/tests/local-folder-browser.mjsAdded+88
app/tests/local-folder.test.mjsAdded+125
assets/agent.worker-B7d5sboN.jsDeleted
assets/agent.worker-DAy1yjYb.jsDeleted
assets/agent.worker-DONV7yi_.jsDeleted
assets/agent.worker-CS8jL-AS.js → assets/agent.worker-Dng_UV-X.jsRenamed
assets/agent.worker-euGpP_Md.jsDeleted
assets/index-B--sYzmA.jsDeleted
assets/index-BzGjruQ9.jsDeleted
assets/index-CLisF1Ml.cssDeleted-1
assets/index-D2Hvfy3l.jsDeleted
assets/index-A7Nq9zGD.js → assets/index-DUQ_UspG.jsRenamed
assets/index-DnXFGQ8z.jsDeleted
assets/index-Bl39c3Js.css → assets/index-Uy7sEXBC.cssRenamed+1-1
assets/index-wZi62oe2.jsDeleted
index.html+12-2
licenses/dependencies.txt+196
scripts/stage.py+1-1
validation/LOCAL-FOLDER.mdAdded+12
validation/local-folder-browser-390.pngAdded

Large File Pointer Details
- SHA256: 14c9e9d7b77b38db406a4622514365c67d749d49182db7a2c42c484649c0dbe1
- Pointer size: 130 Bytes
- Size of remote file: 80.2 kB
validation/local-folder-browser-review.pngAdded

Large File Pointer Details
- SHA256: 4475037df68600147417b62dc0e94f6aca52871b87f028ca1627a2f7c7ff7e48
- Pointer size: 131 Bytes
- Size of remote file: 123 kB
validation/local-folder-browser.jsonAdded+16
validation/local-folder-native.pngAdded

Large File Pointer Details
- SHA256: 09a13bc9dea3d6b56435820dbb9cecba462d84d44622ca20c687c1756c287977
- Pointer size: 130 Bytes
- Size of remote file: 79.4 kB