mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 06:04:40 +00:00
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)
90 lines
No EOL
2.6 KiB
Markdown
90 lines
No EOL
2.6 KiB
Markdown
# Pi Monorepo
|
|
|
|
A collection of tools for managing LLM deployments and building AI agents.
|
|
|
|
## Packages
|
|
|
|
- **[@mariozechner/pi-ai](packages/ai)** - Unified multi-provider LLM API
|
|
- **[@mariozechner/pi-web-ui](packages/web-ui)** - Web components for building AI chat interfaces
|
|
- **[@mariozechner/pi-browser-extension](packages/browser-extension)** - Browser extension for AI assistance
|
|
- **[@mariozechner/pi-proxy](packages/proxy)** - CORS proxy for browser-based LLM API calls
|
|
- **[@mariozechner/pi-tui](packages/tui)** - Terminal UI library with differential rendering
|
|
- **[@mariozechner/pi-agent](packages/agent)** - General-purpose agent with tool calling and session persistence
|
|
- **[@mariozechner/pi](packages/pods)** - CLI for managing vLLM deployments on GPU pods
|
|
|
|
## Development
|
|
|
|
This is a monorepo using npm workspaces for package management and a dual TypeScript configuration for development and building.
|
|
|
|
### Common Commands
|
|
|
|
```bash
|
|
# Install all dependencies
|
|
npm install
|
|
|
|
# Build all packages (required for publishing to NPM)
|
|
npm run build
|
|
|
|
# Clean out dist/ folders in all packages
|
|
npm run clean
|
|
|
|
# Run linting, formatting, and tsc typechecking (no build needed)
|
|
npm run check
|
|
|
|
# Run directly with tsx during development (no build needed)
|
|
cd packages/pods && npx tsx src/cli.ts
|
|
cd packages/agent && npx tsx src/cli.ts
|
|
```
|
|
|
|
### Package Dependencies
|
|
|
|
The packages have the following dependency structure:
|
|
|
|
`pi-tui` -> `pi-agent` -> `pi`
|
|
|
|
When new packages are added, the must be inserted in the correct order in the `build` script in `package.json`.
|
|
|
|
### TypeScript Configuration
|
|
|
|
The monorepo uses a dual TypeScript configuration approach:
|
|
- **Root `tsconfig.json`**: Contains path mappings for all packages, used for type checking and development with `tsx`
|
|
- **Package `tsconfig.build.json`**: Clean build configuration with `rootDir` and `outDir`, used for production builds
|
|
|
|
This setup allows:
|
|
- Type checking without building (`npm run check` works immediately)
|
|
- Running source files directly with `tsx` during development
|
|
- Clean, organized build outputs for publishing
|
|
|
|
### Versioning
|
|
|
|
All packages use **lockstep versioning** - they share the same version number:
|
|
|
|
```bash
|
|
# Bump patch version (0.5.0 -> 0.5.1)
|
|
npm run version:patch
|
|
|
|
# Bump minor version (0.5.0 -> 0.6.0)
|
|
npm run version:minor
|
|
|
|
# Bump major version (0.5.0 -> 1.0.0)
|
|
npm run version:major
|
|
```
|
|
|
|
These commands automatically:
|
|
1. Update all package versions
|
|
2. Sync inter-package dependency versions
|
|
3. Update package-lock.json
|
|
|
|
### Publishing
|
|
|
|
```bash
|
|
# Dry run to see what would be published
|
|
npm run publish:dry
|
|
|
|
# Publish all packages to npm
|
|
npm run publish
|
|
```
|
|
|
|
## License
|
|
|
|
MIT |