mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 08:04:44 +00:00
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)
This commit is contained in:
parent
66f092c0c6
commit
0496651308
31 changed files with 1141 additions and 488 deletions
|
|
@ -17,23 +17,28 @@ export {
|
|||
type SandboxUrlProvider,
|
||||
} from "./components/SandboxedIframe.js";
|
||||
export { StreamingMessageContainer } from "./components/StreamingMessageContainer.js";
|
||||
export { ApiKeysDialog } from "./dialogs/ApiKeysDialog.js";
|
||||
export { ApiKeyPromptDialog } from "./dialogs/ApiKeyPromptDialog.js";
|
||||
export { AttachmentOverlay } from "./dialogs/AttachmentOverlay.js";
|
||||
// Dialogs
|
||||
export { ModelSelector } from "./dialogs/ModelSelector.js";
|
||||
export { ApiKeysTab, ProxyTab, SettingsDialog, SettingsTab } from "./dialogs/SettingsDialog.js";
|
||||
export type { AgentSessionState, ThinkingLevel } from "./state/agent-session.js";
|
||||
// State management
|
||||
export { AgentSession } from "./state/agent-session.js";
|
||||
export type { KeyStore } from "./state/key-store.js";
|
||||
export { getKeyStore, LocalStorageKeyStore, setKeyStore } from "./state/key-store.js";
|
||||
export type { StorageAdapter } from "./state/storage-adapter.js";
|
||||
export { ChromeStorageAdapter, LocalStorageAdapter } from "./state/storage-adapter.js";
|
||||
|
||||
// Transports
|
||||
export { DirectTransport } from "./state/transports/DirectTransport.js";
|
||||
export { ProxyTransport } from "./state/transports/ProxyTransport.js";
|
||||
export { AppTransport } from "./state/transports/AppTransport.js";
|
||||
export { ProviderTransport } from "./state/transports/ProviderTransport.js";
|
||||
export type { ProxyAssistantMessageEvent } from "./state/transports/proxy-types.js";
|
||||
export type { AgentRunConfig, AgentTransport } from "./state/transports/types.js";
|
||||
// Storage
|
||||
export { AppStorage, getAppStorage, initAppStorage, setAppStorage } from "./storage/app-storage.js";
|
||||
export { ChromeStorageBackend } from "./storage/backends/chrome-storage-backend.js";
|
||||
export { IndexedDBBackend } from "./storage/backends/indexeddb-backend.js";
|
||||
export { LocalStorageBackend } from "./storage/backends/local-storage-backend.js";
|
||||
export { ProviderKeysRepository } from "./storage/repositories/provider-keys-repository.js";
|
||||
export { SettingsRepository } from "./storage/repositories/settings-repository.js";
|
||||
export type { AppStorageConfig, StorageBackend } from "./storage/types.js";
|
||||
// Artifacts
|
||||
export { ArtifactElement } from "./tools/artifacts/ArtifactElement.js";
|
||||
export { type Artifact, ArtifactsPanel, type ArtifactsParams } from "./tools/artifacts/artifacts.js";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue