Commit Graph

11 Commits

  • Add Anthropic prompt caching, pluggable storage, and CORS proxy support
    Storage Architecture:
    - New pluggable storage system with backends (LocalStorage, ChromeStorage, IndexedDB)
    - SettingsRepository for app settings (proxy config, etc.)
    - ProviderKeysRepository for API key management
    - AppStorage with global accessors (getAppStorage, setAppStorage, initAppStorage)
    
    Transport Refactoring:
    - Renamed DirectTransport → ProviderTransport (calls LLM providers with optional CORS proxy)
    - Renamed ProxyTransport → AppTransport (uses app server with user auth)
    - Updated TransportMode: "direct" → "provider", "proxy" → "app"
    
    CORS Proxy Integration:
    - ProviderTransport checks proxy.enabled/proxy.url from storage
    - When enabled, modifies model baseUrl to route through proxy: {proxyUrl}/?url={originalBaseUrl}
    - ProviderKeyInput test function also honors proxy settings
    - Settings dialog with Proxy tab (Switch toggle, URL input, explanatory description)
    
    Anthropic Prompt Caching:
    - System prompt cached with cache_control markers (both OAuth and regular API keys)
    - Last user message cached to cache conversation history
    - Saves 90% on input tokens for cached content (10x cost reduction)
    
    Settings Dialog Improvements:
    - Configurable tab system with SettingsTab base class
    - ApiKeysTab and ProxyTab as custom elements
    - Switch toggle for proxy enable (instead of Checkbox)
    - Explanatory paragraphs for each tab
    - ApiKeyPromptDialog reuses ProviderKeyInput component
    
    Removed:
    - Deprecated ApiKeysDialog (replaced by ProviderKeyInput in SettingsDialog)
    - Old storage-adapter and key-store (replaced by new storage architecture)
  • Integrate JailJS for CSP-restricted execution in browser extension
    Major changes:
    - Migrate browser-extension to use web-ui package (85% code reduction)
    - Add JailJS content script with ES6+ transform support
    - Expose DOM constructors (Event, KeyboardEvent, etc.) to JailJS
    - Support top-level await by wrapping code in async IIFE
    - Add returnFile() support in JailJS execution
    - Refactor KeyStore into pluggable storage-adapter pattern
    - Make ChatPanel configurable with sandboxUrlProvider and additionalTools
    - Update jailjs to 0.1.1
    
    Files deleted (33 duplicate files):
    - All browser-extension components, dialogs, state, tools, utils
    - Now using web-ui versions via @mariozechner/pi-web-ui
    
    Files added:
    - packages/browser-extension/src/content.ts (JailJS content script)
    - packages/web-ui/src/state/storage-adapter.ts
    - packages/web-ui/src/state/key-store.ts
    
    Browser extension now has only 5 source files (down from 38).
  • feat: add cross-browser extension with AI reading assistant
    - Create Pi Reader browser extension for Chrome/Firefox
    - Chrome uses Side Panel API, Firefox uses Sidebar Action API
    - Supports both browsers with separate manifests and unified codebase
    - Built with mini-lit components and Tailwind CSS v4
    - Features model selection dialog with Ollama support
    - Hot reload development server watches both browser builds
    - Add useDefineForClassFields: false to fix LitElement reactivity
  • feat(ai): Rename package to @mariozechner/pi-ai and improve documentation
    - Changed package name from @mariozechner/ai to @mariozechner/pi-ai
    - Fixed generate-models.ts to fetch from models.dev API instead of local file
    - Completely rewrote README with practical examples:
      - Image input with base64 encoding
      - Proper tool calling with context management
      - Streaming with completion indicators
      - Abort signal usage
      - Provider-specific options (reasoning/thinking)
      - Custom model definitions for local/self-hosted LLMs
      - Environment variables explanation
    - Bumped version to 0.5.9 and published
  • feat(ai): Create unified AI package with OpenAI, Anthropic, and Gemini support
    - Set up @mariozechner/ai package structure following monorepo patterns
    - Install OpenAI, Anthropic, and Google Gemini SDK dependencies
    - Document comprehensive API investigation for all three providers
    - Design minimal unified API with streaming-first architecture
    - Add models.dev integration for pricing and capabilities
    - Implement automatic caching strategy for all providers
    - Update project documentation with package creation guide
  • Fix npm publishing warnings and clean up package.json files
    - Fixed repository URLs to use git+https:// format
    - Removed tsconfig.tsbuildinfo from clean scripts
    - Updated README with clearer build instructions and dependency order
    - Fixed bin paths to reference dist/cli.js correctly
    - Ready for npm publishing with no warnings
  • Initial monorepo setup with npm workspaces and dual TypeScript configuration
    - Set up npm workspaces for three packages: pi-tui, pi-agent, and pi (pods)
    - Implemented dual TypeScript configuration:
      - Root tsconfig.json with path mappings for development and type checking
      - Package-specific tsconfig.build.json for clean production builds
    - Configured lockstep versioning with sync script for inter-package dependencies
    - Added comprehensive documentation for development and publishing workflows
    - All packages at version 0.5.0 ready for npm publishing