Commit Graph

217 Commits

Author SHA1 Message Date
southseact-3d
25ee088d6c test: Add comprehensive test coverage for critical modules
- Add tests for chat/encryption.js: encryption/decryption, hashing, token generation
- Add tests for chat/tokenManager.js: JWT tokens, device fingerprints, cookie handling
- Add tests for chat/prompt-sanitizer.js: security patterns, attack detection, obfuscation
- Add tests for admin panel: session management, rate limiting, user/token management
- Add tests for OpenCode write tool: file creation, overwrites, nested directories
- Add tests for OpenCode todo tools: todo CRUD operations
- Add tests for Console billing/account/provider: schemas, validation, price utilities

These tests cover previously untested critical paths including:
- Authentication and security
- Payment processing validation
- Admin functionality
- Model routing and management
- Account management
2026-02-18 16:43:10 +00:00
southseact-3d
b635c80d51 Add back sections 2, 3, 4: Auto Model, Provider Limits, and supporting functionality
- 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
2026-02-18 16:39:08 +00:00
southseact-3d
ce81f1c999 feat: Add KILO_API_KEY to Docker configuration
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.
2026-02-18 16:24:23 +00:00
southseact-3d
81ff352966 feat: Add Kilo Gateway as AI provider
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
2026-02-18 16:22:34 +00:00
southseact-3d
828a9dad41 Remove separate chain concept - fallback is now determined by OpenCode models order
- 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
2026-02-18 16:18:31 +00:00
southseact-3d
4bb54d38ad Consolidate OpenCode Chain into OpenCode Models section
- 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
2026-02-18 15:28:04 +00:00
southseact-3d
b961c6e302 Fix remaining providerChain references to opencodeChain 2026-02-18 15:23:36 +00:00
southseact-3d
3ba9fab6ab Clean up model structure: OpenCode Models, Chain, and Public Models
- 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
2026-02-18 15:11:12 +00:00
southseact-3d
cc17079988 Fix model sections: separate Provider Models and Public-Facing Models
- 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
2026-02-18 14:38:19 +00:00
southseact-3d
7e5dc8b62d Add up/down reorder buttons and order numbers to public models
- 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
2026-02-18 14:08:21 +00:00
southseact-3d
0ce352ad8d feat(admin): Add token usage and remaining balance management options
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.
2026-02-18 10:40:10 +00:00
southseact-3d
44deabc2cf Add unified model chain system with public models and provider chain
- 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
2026-02-18 10:37:01 +00:00
southseact-3d
ae7fdaac6f fix: use currently selected model when redoing messages
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.
2026-02-17 20:01:36 +00:00
southseact-3d
d46515d49a fix: ignore body opencodeSessionId when session was reset
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.
2026-02-17 19:43:42 +00:00
southseact-3d
227794d463 fix: handle undo failures gracefully by resetting session
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.
2026-02-17 19:24:12 +00:00
southseact-3d
86bd6ff332 fix: reset opencode session when undoing failed messages
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.
2026-02-17 19:14:05 +00:00
southseact-3d
d4232d487d fix: skip opencode undo when message has zero output
Prevents error when undoing messages that produced no output.
Checks for reply, partialOutput, or done status before sending
/undo command to opencode.
2026-02-17 19:03:27 +00:00
southseact-3d
0e6d3eddb6 Fix: add missing getOpencodeSessionTokenUsage function to resolve redo button error 2026-02-17 18:44:30 +00:00
southseact-3d
0c954449d3 Fix Android app connectivity issues and add detailed logging
- 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.
2026-02-17 10:20:11 +00:00
southseact-3d
103951eb3c fix: skip undo in redo flow when no previous output exists
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.
2026-02-17 10:13:12 +00:00
Developer
669563b724 Fix: Remove port from backend URL
Backend is served at https://plugincompass.com (port 443) via reverse proxy,
not https://plugincompass.com:9445
2026-02-17 10:01:09 +00:00
Developer
eced327702 Fix capacitor build: Implement proper backend connectivity and authentication
- 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
2026-02-16 22:02:46 +00:00
Developer
3f6e649965 fix: skip undo for first build message to avoid exit code 1 error
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.
2026-02-16 21:11:10 +00:00
southseact-3d
f1f32a430c fix: Add Windows installer registry entries, launch after install, and app icon
- 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
2026-02-16 19:01:39 +00:00
southseact-3d
17568c405d Fix ReferenceError: Use process.env instead of env before initialization
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.
2026-02-16 18:37:47 +00:00
southseact-3d
d36505f104 Fix entrypoint: Copy custom-built opencode binary to persisted directory 2026-02-16 18:22:09 +00:00
southseact-3d
e0abc08bf0 Fix Dockerfile: Set OPENCODE_CHANNEL env var to avoid git branch detection 2026-02-16 18:12:47 +00:00
southseact-3d
85bb738ad9 Add debugging output to capture build errors 2026-02-16 16:58:09 +00:00
southseact-3d
5aa278f7ee Fix Dockerfile: Run build from correct directory with better error handling 2026-02-16 16:57:42 +00:00
southseact-3d
1465f3df41 Fix Dockerfile: Use multi-stage build for OpenCode
- 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
2026-02-16 16:47:55 +00:00
southseact-3d
49983fbc3c Build OpenCode from source in Docker and remove broken session token queries
- 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
2026-02-16 16:38:22 +00:00
southseact-3d
4af4dc114f fix 1 2026-02-16 15:56:52 +00:00
southseact-3d
c2e5980a8b added scroll to bottom template 2026-02-16 13:42:05 +00:00
southseact-3d
9a325df739 Fix Electron build publish config and remove release steps from workflows 2026-02-16 12:11:42 +00:00
southseact-3d
8d89250797 Fix OpenCode CLI workflow to only trigger on relevant paths 2026-02-16 12:07:12 +00:00
southseact-3d
d6e2af3a29 Rename to Plugin Compass, add mobile onboarding/signin, implement self-update for desktop, and fix workflow paths 2026-02-16 12:05:30 +00:00
southseact-3d
63698e1d19 Fix missing closing brace in OPENCODE_EXTRA_MCP_SERVERS if block 2026-02-16 12:03:49 +00:00
southseact-3d
df93012130 Fix Capacitor dependencies - use built-in HTTP instead of separate plugin 2026-02-16 09:46:35 +00:00
southseact-3d
14f0e18ad4 Fix workflow cache paths for missing package-lock files 2026-02-16 09:44:05 +00:00
southseact-3d
ca4bc9184d Convert Windows app to Electron and add Android Capacitor app with CI builds 2026-02-16 09:40:31 +00:00
Developer
14f59c2f56 Fix builder plan message display and error handling
- Strip double stars (**) and double hashtags (##) from plan message displayContent in both client and server
- Fix server restart error replacing plan message by skipping error state for plan messages
- Fix rate limiting regex pattern to use proper global flag
2026-02-16 08:40:58 +00:00
Developer
816e72fb03 fix: disable husky during CI build 2026-02-15 19:40:41 +00:00
southseact-3d
3e96a41e39 fix: prevent multiple HTTP requests for Chutes AI provider
Chutes AI counts each HTTP API request separately. The existing fix using
stepCountIs(1) only limited the Vercel AI SDK's internal loop, but the
outer while(true) loops in processor.ts and prompt.ts continued to make
additional HTTP requests after tool execution.

This fix:
- Returns singleStepTools flag from LLM.stream() to signal single-step mode
- Breaks out of processor.ts inner loop after one iteration for Chutes
- Breaks out of prompt.ts outer loop after one iteration for Chutes

This ensures only one HTTP request is made per user message for providers
like Chutes that bill per request.
2026-02-15 16:38:07 +00:00
southseact-3d
dafd3c796d Add admin token override feature for user accounts
- Add tokenOverride field to token usage bucket
- Create POST /api/admin/accounts/tokens endpoint for setting manual token limits
- Update admin accounts page to display token usage and override status
- Add 'Set Tokens' button to manually override user token limits for the month
- Override takes precedence over plan-based limits when set
2026-02-15 16:19:06 +00:00
southseact-3d
9973c3511c fix: remove message status chip for plan messages
Hide the status indicator (queued, running, done, etc.) from user messages
in the builder UI when the message is a plan message (OpenRouter/non-OpenCode
messages). Regular build messages still show their status as before.
2026-02-15 13:58:50 +00:00
Developer
04780632e8 fix: show undo/redo buttons when server restart error occurs 2026-02-15 12:50:56 +00:00
Developer
6bcdb2b739 Migrate test checkout page to inline Dodo Payments checkout with theme customization
- Replace modal-based checkout with true inline checkout embedded in page layout
- Implement split layout: payment form on left, package selection + order summary on right
- Add real-time order summary sync via checkout.breakdown events
- Apply comprehensive theme customization matching app design (Shopify green, proper colors)
- Add loading states and empty state for better UX
- Use ES modules with proper DodoPayments SDK import
2026-02-15 10:58:15 +00:00
Developer
cea30dc84c Fix admin test checkout email validation - ensure valid email format is sent to Dodo Payments 2026-02-14 21:36:55 +00:00
Developer
a6a5d8f7a0 Fix ReferenceError: handleAdminTopupOptions is not defined
- Added missing closing brace for handleTopupConfirm function
- Removed extra closing brace after handleAdminMe function
- Admin functions (handleAdminTopupOptions, handleAdminTopupCheckout, handleAdminTopupConfirm) were incorrectly nested inside handleTopupConfirm scope, making them inaccessible to the router
2026-02-14 20:38:22 +00:00
Developer
4fa0a1b737 Fix ReferenceError: handleAdminTopupOptions is not defined by removing unnecessary await 2026-02-13 19:43:11 +00:00