Skip to content
PaulKinlanPublic

About

Cowork-like experience in the browser using filesystem api

Resources

Stars

79 stars

Watchers

0 watching

Forks

Latest commit

 

History

294 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Co-do

An AI file manager that runs entirely in your browser. Pick a local folder, connect the AI provider of your choice, and let the agent read, search, edit and transform your files — with every action gated by permissions you control. Live at co-do.xyz (Cloudflare Workers).

Quickstart

git clone https://github.com/PaulKinlan/Co-do && cd Co-do
npm install
npm run dev            # http://localhost:3000
  1. Open Co-do in Chrome/Edge, click AI Provider and add an API key (or a local Ollama / LM Studio endpoint).
  2. Click Select Folder and grant access to a directory.
  3. Ask for something: "Find where API keys are stored and add a comment explaining it".
  4. Review the inline diff in the approval dialog and approve or deny.
  5. Press Ctrl/⌘ + K to search the folder locally (opt-in, on-device index).

Highlights

  • Bring your own model — Anthropic, OpenAI, Google, OpenRouter, or any OpenAI-compatible / local endpoint. Provider SDKs are code-split and the CSP is locked to the active provider.
  • Inline diff approval — write_file, create_file and edit_file show a unified before/after diff (line numbers, +/− stats, new-file badge) right inside the "Ask Before Execute" dialog, rendered with DOM/textContent only (no innerHTML) and WCAG-AA colours in light and dark mode.
  • Local Folder Search — opt-in, 100% client-side semantic + keyword index of the opened folder stored in IndexedDB. Zero uploads, zero model download (deterministic hashed TF + trigram embeddings behind a pluggable provider). Available as a Ctrl/⌘+K quick panel and as the permission-gated search_folder_semantic agent tool. → docs/local-folder-search.md
  • WebCodecs media fast path — common ffmpeg trim / remux / transcode / scale jobs between MP4, MOV, WebM and MKV run hardware-accelerated through WebCodecs + mediabunny without instantiating the ~31 MB FFmpeg WASM core; anything else falls back to FFmpeg automatically. → docs/webcodecs-fast-path.md
  • 41 sandboxed WebAssembly tools — text, data, crypto, code, compression, SQLite and media tools running in isolated Web Workers, chainable with the Unix-style pipe tool. Upload your own WASI tools as ZIPs.
  • Private by design — files and keys stay in the browser; only the AI provider you chose is reachable (dynamic per-request CSP with a visual firewall). Installable PWA with offline support.

Architecture

flowchart LR
  User(["User"]) --> UI["UI (ui.ts)<br/>chat · Ctrl/⌘K search · approval dialog"]
  UI --> AI["AI SDK streamText<br/>(code-split provider)"]
  AI -->|tool calls| Perm{"Permission check<br/>always / ask / never"}
  Perm -->|ask| Dialog["Approval dialog<br/>+ inline unified diff"]
  Perm --> FS["File tools<br/>File System Access API"]
  Perm --> Search["search_folder_semantic"]
  Perm --> WASM["WASM tools<br/>(Web Workers)"]
  Search --> Index[("Local vector index<br/>IndexedDB")]
  WASM --> Media{"ffmpeg args<br/>fast-path planner"}
  Media -->|supported| WC["WebCodecs + mediabunny"]
  Media -->|fallback| FF["FFmpeg WASM"]
  AI <-->|HTTPS, CSP-locked| Provider[("AI provider")]
  Edge["Cloudflare Worker<br/>dynamic CSP + assets"] -.serves.-> UI
Loading

More detail: Security · docs/WASM-SANDBOXING-ANALYSIS.md · docs/worker-csp-isolation.md · docs/models-csp-report.md · docs/WASM-TOOLS-PLAN.md · PWA-SETUP.md

Features

Core Features

  • File System Access: Native browser integration with your local file system using the File System Access API
  • AI-Powered: Use Anthropic Claude, OpenAI GPT, Google Gemini, OpenRouter, or OpenAI-compatible / local endpoints (Ollama, LM Studio, Cloudflare AI Gateway, self-hosted proxies) to interact with your files
  • Multi-Provider Support: Configure multiple AI providers and switch between them seamlessly, including custom API base URLs and custom model IDs
  • Real-time Streaming: AI responses stream in real-time as they're generated
  • Granular Permissions: Control which operations the AI can perform (always allow, ask, or never allow)
  • Inline Diff Approval: See exactly which lines a write/edit will add or remove before approving it
  • Local Folder Search: Opt-in on-device semantic + keyword search (Ctrl/⌘+K and search_folder_semantic)
  • Client-Side Only: Your API key and files never leave your browser (except for AI model API calls)
  • Multi-Conversation: Maintain multiple concurrent conversations with persistent history stored in IndexedDB
  • 41 Built-in WebAssembly Tools: Text processing, crypto, data format conversion, code minification, media processing, and more — all running sandboxed in Web Workers
  • Pipe Command Chaining: Chain tools together Unix-style — output of one command feeds into the next
  • Custom WASM Tool Upload: Install your own WebAssembly tools via ZIP packages

Progressive Web App (PWA)

  • Installable: Install Co-do on your device like a native app
  • Offline Support: Core app functionality works without internet connection
  • Automatic Updates: Get notified when new versions are available with changelog links
  • App Shortcuts: Quick access to workspace via home screen shortcuts

Security & Privacy

  • Dynamic CSP: Content Security Policy headers are generated per-request based on the selected AI provider, ensuring network access is limited to only the active provider's API endpoint
  • Directory Sandboxing: File operations are restricted to the user-selected directory
  • WebAssembly Sandboxing: WASM tools execute in isolated Web Workers with no DOM access, no network access, and configurable memory limits. Binary data (images, compressed files) flows through the pipeline without corruption
  • Markdown Sandboxing: AI responses are rendered inside sandboxed <iframe> elements to prevent XSS
  • API Key Security: Keys are stored in browser IndexedDB and only transmitted to the selected AI provider — no server-side storage
  • Permission Controls: Granular per-tool permission levels (always/ask/never) for both file operations and WASM tools
  • Ask Before Execute: Destructive operations can require explicit user approval, with an XSS-safe inline unified diff for file writes and edits

UI Features

  • Voice Input: Real-time voice transcription using Web Speech API — click the microphone button to dictate prompts
  • Quick Search (Ctrl/⌘+K): Keyboard-driven local folder search panel; picking a result inserts a path:start-end reference into the prompt
  • Dark Mode Support: Automatic theme switching based on system preferences
  • Responsive Design: Works on desktop, tablet, and mobile devices
  • Toast Notifications: Non-intrusive feedback for operations
  • Desktop Notifications: Native browser notifications when AI tasks finish or permission approval is needed while the tab is in the background (opt-in via settings)
  • View Transitions: Smooth visual transitions between UI states using the View Transitions API
  • Markdown Rendering: AI responses render as formatted markdown in sandboxed iframes
  • File System Observer: Real-time file change detection (Chrome 129+)
  • Conversation Tabs: Switch between multiple conversations with tab-based navigation
  • Workspace Switcher: View and switch between all your workspaces from the sidebar — each workspace maintains its own conversations and file context

Browser Support

Co-do requires the File System Access API, which is currently available in:

  • Chrome 86+ (Recommended: Chrome 140+)
  • Edge 86+
  • Other Chromium-based browsers

Safari has limited support for the File System Access API.

Voice Input Support

The voice transcription feature uses the Web Speech API (Speech Recognition), which is available in:

  • Chrome 25+ (Desktop and Android)
  • Edge 79+
  • Safari 14.1+ (with limitations)

If your browser doesn't support voice recognition, the microphone button will be automatically hidden.

Getting Started

Development

npm run dev       # Vite dev server at http://localhost:3000 (with dynamic CSP middleware)
npm run cf:dev    # Local Cloudflare Workers preview via Wrangler

Open http://localhost:3000 in your browser for Vite HMR development, or run npm run build:cf && npm run cf:dev to preview the exact Cloudflare Workers runtime locally.

Building

npm run build           # Full build (WASM + TypeScript + Vite)
npm run build:web-only  # Build without recompiling C/WASM tools
npm run build:cf        # Production build for Cloudflare Workers (splits >25 MiB assets)

The built files will be in the dist directory.

Deployment (Cloudflare Workers)

Co-do runs on Cloudflare Workers with Workers Static Assets (wrangler.jsonc), serving https://co-do.xyz:

  • Worker-first routing (run_worker_first: true): Every request passes through server/main.ts before fetching static files from env.ASSETS, so dynamic per-provider Content-Security-Policy headers, security headers, cache directives, and /api/health are enforced consistently at the edge.
  • Large WASM asset chunking: npm run build:cf sets CLOUDFLARE_BUILD=1, which splits static assets over 24 MiB (such as the ~31 MiB ffmpeg-core.wasm binary) into 16 MiB .part0/.part1 files to stay within Cloudflare Workers Assets' 25 MiB per-file limit. server/main.ts transparently streams and reassembles chunked binaries on demand.
  • Health endpoint: GET /api/health returns { "status": "ok", "service": "co-do", "runtime": "cloudflare-workers", "timestamp": "..." }.
npm run build:cf                  # Type-check client + worker and build dist/ for Cloudflare
npx wrangler deploy --dry-run     # Verify Worker bundle & static asset upload manifest
npm run cf:deploy                 # Build and deploy to Cloudflare Workers (co-do.xyz)

Testing

npm run test:unit           # Run Vitest unit tests (Worker, CSP, providers, models, tools)
npm test                    # Run all Playwright tests
npm run test:visual         # Visual regression tests only
npm run test:accessibility  # Accessibility tests only
npm run test:ui             # Interactive Playwright test mode

PWA Setup

Co-do is a Progressive Web App that can be installed on your device:

  1. Generate Icons: Open generate-icons.html in Chrome to create PWA icons
  2. Save Icons: Download and save icon-192.png and icon-512.png to the public/ directory
  3. Deploy: Build and deploy the app to a HTTPS server
  4. Install: Click the install icon in Chrome's address bar or use the browser menu

For detailed PWA setup instructions, see PWA-SETUP.md.

Usage

  1. Select an AI Provider: Choose between Anthropic, OpenAI, Google, OpenRouter, or OpenAI-Compatible / Local
  2. Enter API Key (or Custom Endpoint): Your API key is stored locally in IndexedDB and only sent to the selected AI provider; optional custom base URLs (e.g., Ollama on http://localhost:11434/v1 or Cloudflare AI Gateway over https://) are supported
  3. Choose a Model: Select a built-in model or enter a custom model ID
  4. Select a Folder: Click "Select Folder" to choose a directory on your local machine
  5. Set Permissions: Configure which file operations the AI can perform
  6. Start Chatting: Ask the AI to help you with your files!

Example Prompts

  • "List all JavaScript files in this directory"
  • "Create a README.md file with a description of this project"
  • "Find all TODO comments in my code"
  • "Rename all .txt files to .md"
  • "Update the version number in package.json to 2.0.0"
  • "Show me the first 20 lines of main.ts"
  • "Compare the differences between old.js and new.js"
  • "Search for 'TODO' in all files"
  • "Create a new directory called 'backup'"
  • "Show me the directory structure as a tree"
  • "Where do we handle authentication? Use the local folder search"
  • "Trim video.mp4 to the first 10 seconds and save it as clip.webm"

Available Tools

File Operation Tools (21 tools)

The AI has access to these file operations, each with configurable permissions:

Basic File Operations

  • open_file: Open and read file contents
  • create_file: Create a new file with content (approval dialog previews it as a new-file diff)
  • write_file: Write or update file contents (full overwrite; approval dialog shows a before/after diff)
  • edit_file: Efficiently edit a file using search/replace or line-based operations (approval dialog previews the exact unified diff before anything is written)
  • rename_file: Rename a file
  • move_file: Move a file to a different location
  • delete_file: Delete a file (use with caution!)
  • cp: Copy a file to a new location

Directory Operations

  • list_files: List all files in the directory
  • mkdir: Create a new directory

File Reading Tools

  • cat: Display file contents (alias for open_file)
  • read_file_content: Read actual file content for AI analysis
  • head_file: Read the first N lines of a file
  • tail_file: Read the last N lines of a file
  • get_file_metadata: Get file size, type, and last modified date

Search

  • search_folder_semantic: Opt-in, on-device semantic + keyword search over the opened folder (returns paths, line ranges and snippets). See docs/local-folder-search.md

Text Processing & Pipe Tools

  • grep: Search for text patterns in files (supports case-insensitive search)
  • wc: Count lines, words, and characters in a file
  • sort: Sort lines in a file
  • uniq: Filter duplicate consecutive lines
  • pipe: Chain multiple commands together (see Pipe Command Chaining below)

Built-in WebAssembly Tools (41 tools)

Co-do ships with 41 WASM tools compiled to WebAssembly and executed in sandboxed Web Workers. These tools are organized by category:

Crypto & Encoding (6 tools)

  • base64: Encode/decode Base64 data
  • md5sum: Calculate MD5 checksums
  • sha256sum: Calculate SHA-256 hashes
  • sha512sum: Calculate SHA-512 hashes
  • xxd: Create hex dumps or reverse hex to text
  • uuid: Generate random UUID v4 identifiers

Text Processing (12 tools)

  • wc: Count lines, words, and characters
  • head: Output first N lines
  • tail: Output last N lines
  • cut: Extract columns/fields using delimiters
  • sort: Sort lines alphabetically or numerically
  • uniq: Filter adjacent duplicate lines
  • tr: Translate or delete characters
  • grep: Pattern matching with case-insensitive and inverted search
  • sed: Stream editor with s/pattern/replacement/ syntax
  • awk: Field extraction and pattern processing
  • diff: Compare two texts and show differences
  • patch: Apply diffs to text

Data Format Tools (6 tools)

  • toml2json: Convert TOML to JSON
  • csvtool: Process CSV (convert to JSON, extract columns, filter rows)
  • markdown: Convert Markdown to HTML
  • jwt: Decode and inspect JWT tokens
  • xmllint: Validate and format XML
  • yq: Query YAML with jq-like syntax

File Utilities (6 tools)

  • file: Determine file type from content (magic numbers)
  • du: Calculate and format file sizes
  • stat: Display formatted file information
  • tree: Display directory structure as a tree
  • touch: Create or update file timestamps
  • truncate: Truncate text to a specific length

Code & Minification (5 tools)

  • shfmt: Format shell scripts
  • minify: Minify JavaScript
  • terser: Advanced JavaScript minification
  • csso: Minify CSS
  • html-minifier: Minify HTML

Search (1 tool)

  • fzf: Fuzzy find matching items from a list

Compression (1 tool)

  • gzip: Compress/decompress data using gzip format

Database (1 tool)

  • sqlite3: Execute SQL queries on in-memory SQLite databases

Media Processing (1 tool)

  • ffmpeg: Process audio and video — transcoding, trimming, format conversion, and more (downloaded on demand, ~31 MB). Supported MP4/MOV/WebM/MKV trim, remux, transcode and scale jobs take a hardware-accelerated WebCodecs + mediabunny fast path that skips loading the FFmpeg WASM core; pass engine: "ffmpeg" to force FFmpeg. See docs/webcodecs-fast-path.md

Custom WASM Tools

You can install your own WebAssembly tools by uploading a ZIP package containing:

  • manifest.json — Tool definition (name, parameters, execution config)
  • tool.wasm — Compiled WASI binary

Custom tools are stored in IndexedDB and have their own permission controls. WASM tools that declare pipeable: true in their manifest automatically participate in pipe chains.

Pipe Command Chaining

The pipe tool chains commands together Unix-style, where the output of each command becomes the input to the next. Only the final output is returned to the AI, keeping conversations efficient.

Example: Read a file, filter import lines, and sort them:

pipe: [
  { tool: "cat", args: { path: "src/main.ts" } },
  { tool: "grep", args: { pattern: "^import" } },
  { tool: "sort", args: {} }
]

Both built-in file tools and WASM tools can participate in pipe chains. Pipeable WASM tools automatically receive stdin from the previous command mapped to their first text parameter.

AI Providers

Co-do supports five AI provider integrations. Provider SDKs are loaded via dynamic import(), so only the selected provider's code is ever fetched by the browser. Any provider can also be paired with an optional validated custom endpoint origin (https:// or loopback http://).

Anthropic (Claude)

  • Claude Sonnet 5.5 (Recommended)
  • Claude Opus 5.5 (Flagship)
  • Claude Opus 5
  • Claude Haiku 5.5 (Fast)
  • Claude Fable 5.2 (Extended)

OpenAI (GPT)

  • GPT-6.2 Astra (Flagship)
  • GPT-6.2 Sol (Balanced)
  • GPT-6.1 Terra (Visual & Fast)
  • GPT-6 Luna (High Efficiency)
  • GPT-5.4 Turbo (Fast)
  • GPT-5 / GPT-5 Mini / GPT-5 Nano

Google (Gemini)

  • Gemini 4 Carbon (Flagship)
  • Gemini 4 Hydrogen (Balanced)
  • Gemini 4 Neon (Fast Agents)
  • Gemini 4 Argon (Efficient)
  • Gemini 3.8 Pro / Gemini 3.8 Flash
  • Gemini 3.5 Flash-Lite (Ultra-Fast)

OpenRouter

  • Claude Sonnet 5.5 / Claude Opus 5.5 (Anthropic)
  • GPT-6.2 Astra / GPT-6.2 Sol (OpenAI)
  • Gemini 4 Carbon / Gemini 3.8 Flash (Google)
  • DeepSeek V4.1 Flash
  • Llama 4 Scout
  • Qwen 3.8 27B

OpenAI-Compatible / Local

Connect to Ollama (http://localhost:11434/v1), LM Studio, Cloudflare AI Gateway, or any self-hosted OpenAI-compatible server with preset or custom model IDs:

  • Llama 3.3
  • Qwen 3.8
  • DeepSeek R1
  • GPT-OSS 20B
  • Gemma 4 26B

Security

Co-do implements multiple layers of security to keep your data safe:

Content Security Policy (CSP)

  • Dynamic per-request CSP: Generated at the edge by the Cloudflare Worker (server/main.ts + server/csp.ts) based on the active provider (co-do-provider cookie, header, or query parameter) and optional validated custom endpoint (co-do-endpoint, restricted to https:// or loopback http://). When no provider is configured, connect-src locks down to 'self' only.
  • CSP Violation Monitoring: Real-time detection of blocked requests via SecurityPolicyViolationEvent, PerformanceObserver (Resource Timing API), and ReportingObserver (Chrome 140+). Violations trigger toast notifications and are logged to the Network & Security panel.
  • Visual Firewall: Shield icon in the header with a status dot (green = locked to provider, red = no external access) and a violation badge counter. Click to open the full network log with CSP state banner and request history.
  • Isolated WASM Compilation: worker-src 'self' restricts Worker scripts to same-origin, and 'wasm-unsafe-eval' is only granted in script-src on the WASM worker script itself — never on the main document.
  • Clickjacking & MIME Protection: frame-ancestors 'none', X-Frame-Options: DENY, X-Content-Type-Options: nosniff, Referrer-Policy: strict-origin-when-cross-origin, and Permissions-Policy.
  • Safe Caching for Dynamic CSP: HTML responses use Cache-Control: private, no-cache and Vary: Cookie (and the WASM worker script uses private, max-age=31536000, immutable with Vary: Cookie) so shared caches never serve one user's provider CSP to another.
  • Per-Provider Code Splitting: Only the selected provider's SDK chunk is fetched (Vite code-splitting), complementing the dynamic CSP.

API Key Security

  • API keys stored in IndexedDB (migrated from localStorage for better isolation)
  • Keys only transmitted to the selected AI provider's API endpoint
  • No server-side storage or logging — Co-do is entirely client-side
  • Multiple provider configurations supported, each stored independently

Permission Controls

  • Granular control over 21 built-in tools (always/ask/never)
  • Write/create/edit approvals include an inline unified diff (DOM + textContent only, so file content can never become markup)
  • Separate permission levels for each WASM custom tool
  • Batch permission dialog with 50ms debounce for multi-tool operations
  • Destructive operations default to "ask" for explicit approval

Sandboxing

  • Directory Sandboxing: All file operations are restricted to the user-selected directory — no access outside it
  • Markdown Sandboxing: AI responses are rendered in sandboxed <iframe srcdoc> elements to prevent XSS from AI-generated content
  • WebAssembly Sandboxing: WASM tools run in isolated Web Workers (see below)

WebAssembly Sandbox Security

WASM tools execute in isolated Web Workers with multiple security boundaries:

  1. Process Isolation: Each WASM execution runs in a dedicated Worker thread, separate from the main application
  2. True Termination: Runaway or malicious modules can be forcefully terminated via Worker.terminate()
  3. Memory Limits: Configurable memory bounds per tool (default: 32MB, max: 256MB)
  4. Network Blocking: WASI socket syscalls return EPERM (permission denied) — WASM tools cannot make network requests
  5. No DOM Access: Workers cannot access the main thread's DOM, window, or application globals
  6. CSP Enforcement: Workers inherit the page's Content Security Policy, blocking unauthorized network requests
  7. Timeout Enforcement: Long-running executions are automatically terminated after the configured timeout (default: 30 seconds)
  8. Virtual File System: File access is mediated through a VFS layer that enforces the manifest's fileAccess declaration (none/read/write/readwrite)
  9. Manifest Validation: Tool manifests are validated against a Zod schema before installation — malformed packages are rejected

Execution modes:

  • Worker mode (default): Full process isolation with true termination support
  • Main-thread mode (fallback): Used when Workers are unavailable; supports file access via the VFS but timeout uses Promise.race() which cannot forcefully stop execution

For detailed security analysis, see docs/WASM-SANDBOXING-ANALYSIS.md.

Architecture

  • Cloudflare Workers + Static Assets: Edge runtime (server/main.ts) serving the built Vite app via env.ASSETS with dynamic per-request CSP, security headers, /api/health, and streaming reassembly for chunked WASM binaries
  • Vite: Build tool and development server with dynamic CSP plugin, WASM content-hashing/chunking, and version tracking
  • TypeScript: Type-safe code with strict mode (target ES2022) for both browser (tsconfig.json) and Worker (tsconfig.worker.json)
  • Vercel AI SDK: Multi-provider AI integration with streaming and tool calling
  • File System Access API: Native file system integration with persistent directory handles
  • IndexedDB: Persistent storage for provider configurations, conversations, WASM tools, and directory handles
  • Service Worker: PWA offline support and asset caching
  • Web Workers: Isolated WASM execution environment with true termination
  • WebAssembly + WASI: Custom tool runtime with virtual file system and sandboxed syscalls
  • Modern CSS: CSS custom properties for dark mode theming, no frameworks
  • View Transitions API: Smooth UI state transitions
  • Web Speech API: Voice input transcription
  • WebCodecs + mediabunny: Hardware-accelerated media fast path ahead of FFmpeg WASM
  • Local vector index: idb-vector-style cosine store over IndexedDB for opt-in folder search
  • Dynamic Code Splitting: Per-provider SDK chunks loaded on demand

Data Flow

User Input → AI (streamText with tools) → Tool Execution → Streaming Response
                                              ↓
                                    Permission Check → File System / WASM Worker
                                              ↓
                                    Tool Result Cache (>2KB) → Summary to AI, Full content to UI

IndexedDB Stores

Co-do uses IndexedDB (database: co-do-db, version 7) with these object stores:

  • provider-configs: AI provider API keys and model selections (supports multiple configs)
  • workspaces: Bookmarkable workspace entries, each linking a UUID to a FileSystemDirectoryHandle
  • directory-handles: Legacy store (migrated to workspaces in v5)
  • conversations: Chat history with tool activity records, scoped to workspaces via workspaceId
  • wasm-tools: Installed WASM tool binaries and manifests
  • skills: Skill metadata index (v6)
  • folder-index: Opt-in Local Folder Search chunks + embeddings, scoped per workspace (v7)

Development

Project Structure

Co-do/
├── src/
│   ├── main.ts               # Entry point, PWA init, version checking
│   ├── ui.ts                  # UI manager, event handlers, conversations
│   ├── ai.ts                  # AI SDK integration (streaming, multi-provider)
│   ├── tools.ts               # 21 built-in tools + pipe command
│   ├── file-edits.ts          # Pure edit application (shared by edit_file + diff preview)
│   ├── diff-preview.ts        # Inline unified diff model + XSS-safe DOM renderer
│   ├── folder-search-ui.ts    # Ctrl/⌘+K Local Folder Search panel
│   ├── folder-search/         # On-device index: embedding, vector store, indexer, service
│   ├── pipeable.ts            # Self-registering pipeable command registry
│   ├── fileSystem.ts          # File System Access API wrapper
│   ├── preferences.ts         # Tool permissions and user settings
│   ├── storage.ts             # IndexedDB manager (configs, conversations, WASM tools)
│   ├── diff.ts                # Unified diff generation (LCS algorithm)
│   ├── markdown.ts            # Markdown rendering in sandboxed iframes
│   ├── toasts.ts              # Toast notification system
│   ├── notifications.ts       # Native browser notifications (Notifications API)
│   ├── viewTransitions.ts     # View Transitions API integration
│   ├── provider-registry.ts   # Provider cookie management + CSP coordination
│   ├── network-monitor.ts     # CSP violation monitoring + network request logger
│   ├── tool-response-format.ts # Pure functions for tool response formatting
│   ├── toolResultCache.ts     # Caching for large tool outputs
│   ├── styles.css             # CSS with custom properties for dark mode
│   └── wasm-tools/            # WebAssembly custom tools system
│       ├── manager.ts         # Central tool orchestrator
│       ├── runtime.ts         # WASI runtime (main-thread fallback)
│       ├── wasm-worker.ts     # Worker-based WASM runtime
│       ├── adapters/          # ffmpeg adapter + WebCodecs/mediabunny fast path
│       ├── worker-manager.ts  # Worker lifecycle and pooling
│       ├── vfs.ts             # Virtual file system for WASM
│       ├── loader.ts          # ZIP package loader and validator
│       ├── registry.ts        # Built-in tool configuration (41 tools)
│       ├── types.ts           # TypeScript interfaces and Zod schemas
│       ├── worker-types.ts    # Worker message protocol types
│       └── index.ts           # Public API exports
├── server/
│   ├── main.ts                # Cloudflare Workers entrypoint (dynamic CSP, headers, chunked WASM, /api/health)
│   ├── providers.ts           # Provider registry, cookie parsing, and custom endpoint validation
│   └── csp.ts                 # Dynamic CSP header generation
├── tests/
│   ├── visual/                # Visual regression tests (screenshots)
│   ├── accessibility/         # WCAG 2.1 Level AA compliance tests
│   ├── unit/                  # Unit tests (Vitest: Worker, CSP, models/providers, tools)
│   └── helpers/               # Test utilities and DOM inspector
├── docs/
│   ├── local-folder-search.md      # On-device semantic search design
│   ├── webcodecs-fast-path.md      # WebCodecs + mediabunny media fast path
│   ├── WASM-SANDBOXING-ANALYSIS.md  # Security deep-dive
│   ├── WASM-TOOLS-PLAN.md          # Implementation architecture
│   ├── WASM-TOOLS-LIST.md          # Catalog of 80+ potential WASM tools
│   ├── models-csp-report.md        # CSP strategy documentation
│   └── worker-csp-isolation.md     # Worker isolation details
├── public/
│   ├── manifest.json          # PWA manifest
│   ├── sw.js                  # Service worker
│   ├── icon.svg               # App icon (SVG)
│   ├── icon-192.png           # PWA icon (192px)
│   └── icon-512.png           # PWA icon (512px)
├── wasm-tools/
│   ├── src/                   # C/WASI source for built-in tools
│   ├── manifests/             # Tool manifest definitions (JSON)
│   ├── build.sh               # Build script (requires wasi-sdk)
│   ├── README.md              # WASM tools development guide
│   └── LIBRARIES.md           # Library references
├── index.html                 # HTML entry point
├── vite.config.ts             # Vite config with CSP, WASM hashing/chunking, and version plugins
├── wrangler.jsonc             # Cloudflare Workers & Static Assets configuration (co-do.xyz)
├── playwright.config.ts       # Playwright test configuration
├── tsconfig.json              # Client TypeScript configuration
├── tsconfig.worker.json       # Cloudflare Worker TypeScript configuration
└── package.json               # Dependencies and scripts

Commands

npm install                    # Install dependencies
npm run dev                    # Start Vite development server (port 3000)
npm run build                  # Full build (WASM + TypeScript + Vite)
npm run build:web-only         # Build without WASM compilation
npm run build:cf               # Build for Cloudflare Workers (with >25 MiB asset splitting)
npm run cf:dev                 # Run locally in Cloudflare Workers runtime (Wrangler)
npm run cf:deploy              # Build and deploy to Cloudflare Workers (co-do.xyz)
npx wrangler deploy --dry-run  # Validate Cloudflare Workers bundle without deploying
npm run preview                # Preview production Vite build
npm run type-check             # Run TypeScript type checking (client + Worker)
npm run test:unit              # Run unit tests (Vitest)
npm run test:unit:watch        # Run unit tests in watch mode
npm test                       # Run all Playwright tests
npm run test:visual            # Visual regression tests only
npm run test:accessibility     # Accessibility tests only
npm run test:visual:update     # Update visual baseline screenshots
npm run test:ui                # Interactive Playwright UI mode
npm run test:debug             # Debug mode with Playwright Inspector
npm run test:headed            # Run tests with browser visible
npm run test:report            # View HTML test report
npm run wasm:build             # Build all WASM tools from source
npm run wasm:build:native      # Build native-only WASM tools

Changelog

See CHANGELOG.md for version history and updates.

License

MIT

Acknowledgments

Inspired by Anthropic's Co-work project.

About

Cowork-like experience in the browser using filesystem api

Resources

Stars

79 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages