14 Commits

  • Fix Lit dependency duplication and update mini-lit to 0.2.0
    - Move lit from dependencies to peerDependencies in web-ui to prevent multiple Lit instances being loaded
    - Update mini-lit from 0.1.8/0.1.10 to 0.2.0 in root package.json and web-ui/package.json
    - Install @tailwindcss/vite in web-ui/example
    - Run biome formatting fixes across codebase
    
    This resolves HMR custom element re-registration errors caused by duplicate Lit registries.
  • Clean up TUI package and refactor component structure
    - Remove old TUI implementation and components (LoadingAnimation, MarkdownComponent, TextComponent, TextEditor, WhitespaceComponent)
    - Rename components-new to components with new API (Loader, Markdown, Text, Editor, Spacer)
    - Move Text and Input components to separate files in src/components/
    - Add render caching to Text component (similar to Markdown)
    - Add proper ANSI code handling in Text component using stripVTControlCharacters
    - Update coding-agent to use new TUI API (requires ProcessTerminal, uses custom Editor subclass for key handling)
    - Remove old test files, keep only chat-simple.ts and virtual-terminal.ts
    - Update README.md with new minimal API documentation
    - Switch from tsc to tsgo for type checking
    - Update package dependencies across monorepo
  • Add artifact message persistence for session reconstruction
    - Add ArtifactMessage type as core part of AppMessage union (not CustomMessages)
    - ArtifactsRuntimeProvider appends artifact messages on create/update/delete
    - MessageList filters out artifact messages (UI display only)
    - artifacts.ts reconstructFromMessages handles artifact messages
    - Export ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION from main index
    - Fix artifact creation bug: pass filename as title instead of mimeType
    
    Changes:
    - web-ui/src/components/Messages.ts: Add ArtifactMessage to BaseMessage union
    - web-ui/src/components/MessageList.ts: Skip artifact messages in render
    - web-ui/src/components/sandbox/ArtifactsRuntimeProvider.ts: Append messages, fix title parameter
    - web-ui/src/ChatPanel.ts: Pass agent.appendMessage callback
    - web-ui/src/tools/artifacts/artifacts.ts: Handle artifact messages in reconstructFromMessages
    - web-ui/src/index.ts: Export ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION
    - web-ui/example/src/custom-messages.ts: Update message transformer to filter artifacts
  • Refactor to Store-based architecture
    - Create base Store class with private backend and protected getBackend()
    - Add SettingsStore, ProviderKeysStore, SessionsStore
    - Each store defines its own schema via getConfig()
    - AppStorage now takes stores + backend in constructor
    - Remove SessionsRepository (logic moved to SessionsStore)
    - Update all consumers to use store API (storage.settings.get/set, storage.providerKeys.get/set)
    - Update example app to follow new pattern: create stores, gather configs, create backend, wire
    - Benefits: stores own their schema, no circular deps, cleaner separation
  • Implement unified storage architecture
    - Replace fragmented storage backends with single IndexedDBStorageBackend
    - Create multi-store StorageBackend interface (storeName parameter)
    - Remove old backends: IndexedDBBackend, LocalStorageBackend, SessionIndexedDBBackend, WebExtensionStorageBackend
    - Remove old repositories: ProviderKeysRepository, SessionRepository, SettingsRepository
    - Simplify AppStorage to directly expose storage methods (getSetting/setSetting, getProviderKey/setProviderKey)
    - Create SessionsRepository for session-specific operations
    - Update all consumers to use new simplified API
    - Update example app to use new storage architecture
    - Benefits: 10GB+ quota (vs 10MB chrome.storage), single database, consistent API
  • Fix SessionListDialog behavior and document PersistentStorageDialog bug
    - Fix SessionListDialog to not reload when user selects a session after deleting others
      - Track if dialog closed via selection vs other means
      - Only call delete callback if not closed via selection
      - Batch deletions to avoid reload on every delete
    - Comment out PersistentStorageDialog in both web-ui example and browser extension (TODO: fix)
    - Add Known Bugs section to both README.md files documenting PersistentStorageDialog issue
    - Clean up navigation tracking variable names in browser extension
  • Add custom message extension system with typed renderers and message transformer
    - Implement CustomMessages interface for type-safe message extension via declaration merging
    - Add MessageRenderer<T> with generic typing for custom message rendering
    - Add messageTransformer to Agent for filtering/transforming messages before LLM
    - Move message filtering from transports to Agent (separation of concerns)
    - Add message renderer registry with typed role support
    - Update web-ui example with SystemNotificationMessage demo
    - Add custom transformer that converts notifications to <system> tags
    - Add SessionListDialog onDelete callback for active session cleanup
    - Handle non-existent session IDs in URL (redirect to new session)
    - Update both web-ui example and browser extension with session fixes
  • Refactor agent architecture and add session storage
    Major architectural improvements:
    - Renamed AgentSession → Agent (state/ → agent/)
    - Removed id field from AgentState
    - Fixed transport abstraction to pass messages directly instead of using callbacks
    - Eliminated circular dependencies in transport creation
    
    Transport changes:
    - Changed signature: run(messages, userMessage, config, signal)
    - Removed getMessages callback from ProviderTransport and AppTransport
    - Transports now filter attachments internally
    
    Session storage:
    - Added SessionRepository with IndexedDB backend
    - Auto-save sessions after first exchange
    - Auto-generate titles from first user message
    - Session list dialog with search and delete
    - Persistent storage permission dialog
    - Browser extension now auto-loads last session
    
    UI improvements:
    - ChatPanel creates single AgentInterface instance in setAgent()
    - Added drag & drop file upload to MessageEditor
    - Fixed artifacts panel auto-opening on session load
    - Added "Drop files here" i18n strings
    - Changed "Continue Without Saving" → "Continue Anyway"
    
    Web example:
    - Complete rewrite of main.ts with clean architecture
    - Added check script to package.json
    - Session management with URL state
    - Editable session titles
    
    Browser extension:
    - Added full session storage support
    - History and new session buttons
    - Auto-load most recent session on open
    - Session titles in header
  • 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)