Public models are now display-only and don't require a Model ID:
- Removed Model ID input field from admin.html public models section
- Updated admin.js to not require or send Model ID for public models
- Updated server API to accept public models without Model ID
- Uses display label as the identifier for public models
- Only requires Model ID for OpenCode models (which need it for execution)
Public models are purely for user-facing display in the builder dropdown,
while OpenCode models form the actual execution fallback chain.
Implement provider preference feature for OpenRouter models:
1. Database Schema:
- Add ModelProviderPreferenceTable to store provider preferences per model
2. Console Core API:
- Add ProviderPreferenceSchema for validation
- Add setProviderPreference(), getProviderPreference(), deleteProviderPreference(), and listProviderPreferences() functions
3. Request Handler:
- Modify handler.ts to fetch provider preferences from database
- Pass provider preferences to OpenRouter in request body
4. Admin UI:
- Add provider preference dropdown for OpenRouter models in model-section.tsx
- Add 'Allow fallbacks' checkbox for fallback control
- Add corresponding CSS styles
5. CLI Config:
- Add providerPreference field to Provider model config schema
- Support configuring provider preferences via opencode.json
6. Provider SDK:
- Inject provider preferences into OpenRouter request body in fetch wrapper
This allows workspace admins to specify preferred providers for OpenRouter
models, ensuring models like Claude route through specific providers
(e.g., Anthropic direct) rather than third-party providers.
- Never use public model ID in opencode fallback chain
The opencode model selection is now independent of public models,
always using the opencodeModels array in order for fallback chain.
- Add zero output detection to trigger fallback
When a model returns empty output, it now triggers fallback to the
next model in the chain instead of returning empty results.
Fixes issues where:
1. Generic 'opencode' model ID from public models caused failures
2. Empty responses didn't trigger fallback to backup models
Users now use OpenCode Models (Fallback Chain) for model selection.
- Removed Auto Model for Hobby/Free Plan section from admin panel
- Removed OpenCode Ultimate Backup Model section from admin panel
- Updated server to use opencodeModels for free plan users
- Removed backup model fallback logic (opencodeModels chain handles this)
The populateOpencodeModelSelect() was called from loadConfigured() which
runs in parallel with loadAvailable() in init(). This caused a race condition
where the dropdown could be populated before state.available was set.
Fixed by moving the populateOpencodeModelSelect() call to after all loaders
complete in init(), ensuring state.available is populated first.
- Add OpenCode Models section with dropdown selection from available models
- Add Public Models section with manual model ID input
- Both sections have up/down ordering buttons for fallback chain priority
- OpenCode models used for execution fallback when rate limits/errors occur
- Public models displayed in builder dropdown for user selection
- Remove unified provider chain in favor of two separate lists
- Keep all existing functionality: Auto Model, Provider Limits, Icon Library, etc.
- Restored original admin.js with all functionality (2692 lines)
- Accounts, affiliates, withdrawals management restored
- All form handlers and API calls preserved
- Updated state to use opencodeModels instead of providerChain
- Updated element references for new OpenCode model structure
- Maintained all existing functionality while applying model changes
- Section 2: Auto Model for Hobby/Free Plan form and handlers
- Section 3: Provider Limits & Usage with configurable rate limits
- Added state management for planSettings and providerLimits
- Added API integration for plan-settings and provider-limits endpoints
- Added populateAutoModelSelect and updateLimitModelOptions functions
- Added renderProviderUsage to display usage data
Add Kilo Gateway API key support to Docker deployment:
- Add KILO_API_KEY environment variable to docker-compose.yml
- Add KILO_API_KEY to .env.example with documentation
This ensures the Kilo Gateway API key is properly passed through
to the Docker container when configured.
Add full support for Kilo Gateway AI provider across the codebase:
- Add custom loader for 'kilo' provider in provider.ts with API key detection
- Add auth CLI hint for Kilo Gateway in auth.ts
- Add Kilo to DEFAULT_PROVIDER_SEEDS in chat server.js
- Add Kilo to PLANNING_PROVIDERS for planning chain support
- Add Kilo provider configuration with baseURL and API key support
- Update admin env config to show Kilo API key status
Kilo Gateway provides access to 500+ AI models through a single
OpenAI-compatible endpoint at https://api.kilo.ai/api/gateway
- Removed opencodeChain variable entirely
- Removed chain form/list from admin UI
- Fallback now uses the order of models in the OpenCode models list
- Updated buildOpencodeAttemptChain to iterate through opencodeModels
- Removed chain-related API endpoints
- Simplified to just two lists: opencodeModels and publicModels
- Removed separate OpenCode Chain card
- Integrated chain functionality as subsection within OpenCode Models
- Chain form and list now appear below the models list
- Added styling to distinguish the chain subsection
- Simplified to 3 clear sections:
1. OpenCode Models: OpenCode dropdown + display name + order buttons
2. OpenCode Chain: Fallback chain with add form + order buttons
3. Public Models: Manual entry + order buttons (completely separate)
- New state variables: opencodeModels, opencodeChain, publicModels
- Clean API endpoints for chain operations
- Removed all confusing legacy code and naming
- Provider Models section: restored OpenCode integration with dropdown
- Public-Facing Models section: completely separate manual entry
- Provider Chain section: fallback chain with up/down buttons (unchanged)
- Added separate arrays: providerModels and publicModels
- Added reorder support for both provider and public models
- Updated server to handle providerModel type and reorder by type
- Add order number badge (#1, #2, #3) to each public model
- Add up/down arrow buttons to reorder models in the list
- Add persistPublicModelsOrder function to save reordered list
- Add server-side /api/admin/models/reorder endpoint
- Remove automatic alphabetical sorting to preserve custom order
- First model (#1) gets green background highlighting
Implements both Option A and B for admin token management:
- Option A (mode='remaining'): Set tokens remaining to use (calculates usage from limit)
- Option B (mode='usage'): Directly set tokens consumed
- Original mode='limit': Still sets token limit override
The admin UI now presents 3 modes via prompt dialog, and the API endpoint
handles each mode appropriately by updating the token usage bucket.
- Add publicModels and providerChain data structures for unified fallback
- Add two separate model adding sections in admin panel (public-facing and provider models)
- Add up/down buttons to reorder provider chain order
- Update server to use unified chain for all model fallbacks
- Auto-migrate legacy data on first load
- Update admin.js to handle new model structure and forms
When redoing a 'proceed with build' message, the system now uses the
currently selected model from the dropdown instead of the original
message's model. This allows users to switch models before redoing.
When session.opencodeSessionId is null (indicating the session was reset
due to corruption or undo failure), ignore any opencodeSessionId sent
in the request body. This prevents the client from reusing a corrupted
session that was previously reset on the server.
When opencode undo command fails:
1. Reset the opencode session (both IDs set to null)
2. Still remove the message from history
3. Return success instead of error
This prevents corrupted sessions from blocking subsequent operations.
When a message fails with zero output and error status, undoing it now
resets the opencode session to ensure the next message starts fresh.
This prevents corrupted session reuse that was causing subsequent failures.
Prevents error when undoing messages that produced no output.
Checks for reply, partialOutput, or done status before sending
/undo command to opencode.
- Add CORS headers to backend server to allow mobile app requests
- Implement request timeout (10s) in capacitor-bridge.js to prevent hanging
- Add comprehensive logging throughout authentication flow
- Add detailed error reporting in initApp for better debugging
- Log all API requests with request IDs for traceability
This fixes the 'Loading Plugin Compass...' infinite loop issue caused by
missing CORS headers and unhandled network timeouts.
When clicking redo on a message, the system would fail with 'Command exited with code 1'
if there were previous opencode messages but none of them produced any output. Now we
check if previous messages actually had output (reply or partialOutput) before
attempting to undo, preventing the error when there's nothing to undo.
Fixes issue where redo button fails when previous messages had no output.
- Update BACKEND_BASE_URL to plugincompass.com:9445
- Add comprehensive authentication system (login, signup, logout)
- Implement JWT token management with automatic refresh
- Add plugin/app management API (CRUD operations)
- Add session management for chat/builder
- Update mobile UI with real backend integration
- Add user account and usage tracking
- Enable plugin loading and editing from backend
- Fix module type for ES6 support
When clicking redo on the first build message, the system would fail with
'Command exited with code 1' because there was nothing to undo. Now we
detect if this is the first opencode message and skip the undo step,
proceeding directly to rebuilding.
Fixes issue where redo button fails on first message in builder.
- Added Plugin.png as app icon in windows-app/assets/
- Updated NSIS config with runAfterFinish to launch app after install
- Added installer.nsh for proper Windows registry entries
- Fixed icon paths to use PNG format
- App now properly registers in Windows Installed Apps
The debug logging added in commit dacde39 tried to access 'env' variable
before it was initialized at line 946. Changed to use process.env which
is always available.
- Added builder stage with all build dependencies
- Isolated build process to prevent failures in final stage
- Retry mechanism for bun install
- Copy only built binary to final image
- Dockerfile: Build OpenCode CLI from source during Docker build instead of downloading from GitHub releases
- Disabled GitHub Actions workflow that was failing to create releases
- Removed getOpencodeSessionTokenUsage function that tried non-existent CLI commands (session info/usage/show)
- Token tracking now relies on 3 layers: result extraction, streaming capture, and estimation