Commit Graph
205 Commits
Author SHA1 Message Date
Tam Nhu Tran ca58cb5a08 fix(cliproxy): harden quota guards and review follow-ups 2026-02-22 02:35:07 +07:00
Tam Nhu Tran d47620592d Merge remote-tracking branch 'origin/dev' into fix/548-claude-quota-balance
# Conflicts:
#	src/commands/cliproxy/help-subcommand.ts
#	src/commands/cliproxy/index.ts
#	src/commands/cliproxy/quota-subcommand.ts
2026-02-22 01:24:44 +07:00
Tam Nhu Tran 2385d9028a feat(cliproxy): add Claude quota windows and account failover 2026-02-22 01:19:02 +07:00
Tam Nhu Tran 343ec959fc fix(core): resolve edge cases and hardcoded drift 2026-02-21 10:32:19 +07:00
Tam Nhu Tran 8d2ec86155 refactor(core): centralize claude paths and command parsing 2026-02-21 01:31:16 +07:00
Tam Nhu Tran 8d9d4987dc feat(quota): add GitHub Copilot quota checks for ghcp and copilot 2026-02-20 22:32:27 +07:00
Kai (Tam Nhu) TranandGitHub e63292c793 Merge pull request #587 from kaitranntt/kai/feat/583-thinking-ux-dx
feat(thinking): complete thinking UX/DX for all providers
2026-02-19 16:32:05 +07:00
Tam Nhu Tran 954baecfe4 fix(thinking): handle clear no-op and tighten override coverage 2026-02-19 16:26:56 +07:00
Tam Nhu Tran 92e2ec111d fix(thinking): harden codex reasoning controls across cli and dashboard 2026-02-19 14:13:41 +07:00
Tam Nhu Tran 0bf00b23d9 fix(profile): close km legacy kimi compatibility gaps 2026-02-19 13:02:56 +07:00
Tam Nhu Tran dd38df6b8d fix(cliproxy): add kimi-k2 pricing and kimi catalog tests
Address review feedback from PR #585:
- Add missing kimi-k2 pricing entry ($0.60/$2.50, cache $0.15)
  to avoid fallback to unknown model pricing
- Add kimi provider tests to model-catalog.test.js verifying
  catalog structure, default model, and model IDs
2026-02-19 10:36:42 +07:00
Tam Nhu Tran 3767b95735 fix(cliproxy): add Kimi model catalog, sync, and pricing to dashboard
- Add kimi entry to UI model-catalogs.ts with K2.5, K2 Thinking, K2
  models and preset mappings so dashboard shows available models
- Add kimi to CHANNEL_TO_PROVIDER and SYNCABLE_PROVIDERS in
  catalog-cache.ts so models sync from upstream CLIProxyAPI
- Add kimi/moonshot to provider-editor ownerMap for model filtering
- Update Kimi model pricing to match official Kimi Platform rates:
  kimi-k2.5 ($0.60/$3.00), kimi-k2-thinking ($0.60/$2.50),
  kimi-k2-turbo-preview ($1.15/$8.00)
- Add missing kimi-k2.5 pricing entry

Closes #581
2026-02-19 10:28:40 +07:00
Tam Nhu Tran 90b8d04d71 refactor(cliproxy): use shared default port in management paths
- replace 8317 literals with CLIPROXY_DEFAULT_PORT constant

- keep http/https fallback behavior unchanged in runtime checks
2026-02-18 03:10:09 +07:00
Tam Nhu Tran 94b03c7f75 refactor(cliproxy): DRY provider lists into single source of truth
- unify CLIPROXY_SUPPORTED_PROVIDERS to import from CLIPROXY_PROVIDER_IDS
- replace 4 inline union types with CLIProxyProvider import
- replace hardcoded provider arrays in migration-manager and proxy-routes
- remove duplicate PROVIDER_DISPLAY_NAMES, use getProviderDisplayName()
- sync test now imports from ui/src/lib/provider-config instead of hardcoded array

Adding a new CLIProxy provider no longer requires updating 14+ hardcoded lists.
2026-02-17 17:02:45 +07:00
Tam Nhu Tran 0431adf306 fix(targets): close all remaining multi-target droid edge cases 2026-02-17 03:22:45 +07:00
Tam Nhu Tran 7d7054e2c0 feat(targets): add multi-target CLI adapter system (Droid support)
Implement target adapter pattern enabling CCS CLI to support multiple backend targets
(Claude, Droid) via pluggable adapters. Core additions:

- TargetAdapter interface for pluggable target implementations
- ClaudeAdapter and DroidAdapter concrete implementations
- Target registry (singleton Map-based storage)
- Target resolver with precedence: --target flag > per-profile config > busybox detection
- Droid config manager with atomic writes and file locking to ~/.factory/settings.json
- Droid binary detector to validate runtime environment
- Adapter dispatch integrated into ccs.ts main execution flow
- ccsd busybox alias for seamless Droid invocation
- --target flag documentation in help
- Session tracking enriched with target metadata
- Dashboard target badge for visual identification

Testing:
- 43 unit tests covering resolver, registry, config manager, and adapters
- Full coverage of target detection logic and edge cases

Documentation:
- Refactored system-architecture.md into modular docs/system-architecture/ subdirectory
- Updated code-standards.md with target adapter guidelines
- Updated codebase-summary.md with architecture overview
- Updated maintainability baseline (33.8% → 35.2%)

This establishes extensible foundation for multi-target support without breaking
existing Claude workflows. Droid adapter is production-ready but defaults to Claude
for backward compatibility.
2026-02-16 10:49:09 +07:00
Kai (Tam Nhu) TranandGitHub 16aeddfb11 Merge pull request #568 from kaitranntt/fix/555-cursor-e2e-recovery
feat(cursor): recover lost Cursor dashboard and model-mapping work
2026-02-14 17:50:57 +07:00
Tam Nhu Tran 4f086aa34a fix(cursor-settings): remove sync fs calls in settings sync
- switch cursor settings file reads/writes to fs.promises

- make settings sync and route handler async with awaited file ops

- restores maintainability baseline for synchronous fs references
2026-02-14 17:48:00 +07:00
Tam Nhu Tran 7b73658f87 feat(cursor): sync model mapping across config and raw settings
- add cursor model fields to unified config defaults and YAML comments

- expand Cursor model catalog/defaults and return configured current model

- keep cursor.settings.json env model fields in sync with config updates

- align unit tests for new model defaults and route merge behavior

Refs #555
2026-02-14 16:57:04 +07:00
Tam Nhu Tran 577991c282 fix(web-server): make kiro auth routes method-aware
- validate kiroMethod on /start and /start-url with clear errors

- route Kiro management start-url requests with upstream method query

- accept state-first responses and keep auth_url optional

- add start-url guard tests for Kiro social and aws-authcode paths

Refs #552

Refs #233
2026-02-14 13:33:48 +07:00
Tam Nhu Tran 826a42d8d6 fix(cliproxy): harden kiro device-code auth flow consistency 2026-02-14 10:55:14 +07:00
Kai (Tam Nhu) TranandGitHub 174a4c2777 Merge pull request #558 from kaitranntt/kai/fix/555-cursor-e2e
feat(cursor): complete end-to-end integration and dedicated dashboard UX
2026-02-14 09:03:09 +07:00
Tam Nhu Tran 9a76f866b0 fix(cursor): guard raw-settings save race and enforce daemon preconditions 2026-02-14 07:11:02 +07:00
Tam Nhu Tran b3d9dce6e1 fix(codex): reduce quota timeout flakes in dashboard 2026-02-14 06:23:31 +07:00
Tam Nhu Tran be9d7cf73e feat(cursor): complete daemon wiring and add dedicated dashboard page 2026-02-14 06:22:28 +07:00
Tam Nhu Tran 7bb9ceb4af fix(cliproxy): keep variant updates atomic and persisted
- require model when changing single-variant provider to avoid mixed config

- rewrite provider-specific core env when provider changes while preserving custom fields

- preserve custom composite settings path and return persisted composite PUT state
2026-02-13 06:19:12 +07:00
Tam Nhu Tran 1a23f912a4 fix(cliproxy): harden composite validation and runtime safeguards 2026-02-13 05:34:30 +07:00
Tam Nhu Tran 2816c6652d chore(merge): resolve conflicts with origin/dev 2026-02-12 16:25:25 +07:00
Kai (Tam Nhu) TranandGitHub a2520d2ed8 Merge pull request #543 from kaitranntt/kai/feat/538-stream-d-hardening
chore(hardening): add debt inventory and async I/O kickoff (stream D)
2026-02-12 16:21:18 +07:00
Tam Nhu Tran e914fe9778 fix(cliproxy): fix thinking off regression and composite error handling
- P1: Thinking "off" now fully disables all tier thinking
  When thinkingValue === 'off' AND no per-tier config, return early
  Preserves behavior for "off" with per-tier config (skips main, processes tiers)
  Fixes regression where tier defaults were applied despite explicit off setting

- P2: Handle composite-create thrown errors in POST route
  Wrap createCompositeVariant() in try/catch
  Returns 400 instead of generic 500 when function throws (e.g., legacy mode)
2026-02-12 13:34:17 +07:00
Tam Nhu Tran 924e3686c8 refactor(cliproxy): centralize provider capability registry 2026-02-12 12:59:17 +07:00
Tam Nhu Tran cefb564948 chore(hardening): add debt inventory and async io kickoff 2026-02-12 12:57:46 +07:00
Tam Nhu Tran a99180fa22 fix(cliproxy): restore POST tier validation and guard null payloads
- Add requireAllTiers parameter to validateCompositeTiers (default false)
- POST/create passes true to enforce all 3 tiers required
- PUT/update passes false (default) to allow partial updates
- Guard against null tier values that would throw at runtime
2026-02-12 11:45:20 +07:00
Tam Nhu Tran 61f46e738d fix(cliproxy): address 3 functional regressions in composite variants
P1 (Critical): Remote composite execution now correctly uses remote endpoint
- Reorder condition to check useRemoteProxy before isComposite
- Composite variants now work with remote CLIProxy instances

P2a (Medium): Tier deep-merge preserves optional fields during updates
- Use spread merge instead of ?? to preserve fallback/thinking/account

P2b (Medium): API accepts partial tier updates in PUT endpoint
- Skip validation for tiers not present in request
- Aligns with updateCompositeVariant's merge behavior
2026-02-12 11:22:43 +07:00
Tam Nhu Tran ef77607c41 fix(cliproxy): add circular fallback and empty model validation in API
- Validate fallback doesn't point to same provider+model (circular)
- Reject empty/whitespace model strings in composite tiers
- Add TODO comment for concurrent modification race condition
2026-02-12 11:02:11 +07:00
Tam Nhu Tran 4c002caee1 fix(cliproxy): address code review feedback (attempt 4/5)
- Add default_tier and provider validation in POST/PUT routes
- Extract shared validateCompositeTiers() helper for DRY
- Validate providers against CLIPROXY_SUPPORTED_PROVIDERS
2026-02-12 08:46:38 +07:00
Tam Nhu Tran 6cfbdd649b fix(cliproxy): address code review feedback (attempt 3/5)
- Allow partial composite updates in PUT endpoint (|| -> &&)
- Map service validation errors to 400 status, not 404
- Widen 4xx regex to cover full 400-499 range
2026-02-12 08:39:46 +07:00
Tam Nhu Tran ac574e0baf fix(cliproxy): address code review feedback (attempt 2/5)
- Add tiers shape validation in variant-routes POST/PUT endpoints
- Use process.exit(1) for blocked --config on composite variants
2026-02-12 08:26:03 +07:00
Tam Nhu Tran d7e0d1cacf fix(cursor): pass all args to handler, use getCursorConfig in routes
- Route all cursor args to handler for proper unknown-subcommand reporting
- Replace loadOrCreateUnifiedConfig + fallback with getCursorConfig()
2026-02-12 08:04:42 +07:00
Tam Nhu Tran 6af718626f fix(cursor): align daemon routes, add enabled field, handle bare command
- Change /start and /stop to /daemon/start and /daemon/stop matching copilot convention
- Add enabled field to CursorConfig for dashboard toggle parity
- Simplify getCursorConfig() to trust mergeWithDefaults()
- Handle bare 'ccs cursor' to show help instead of reserved-name error
2026-02-12 07:43:27 +07:00
Tam Nhu Tran 2ba826bb72 fix(cursor): use getCursorConfig(), fix help text and stub messages 2026-02-12 07:31:02 +07:00
Tam Nhu Tran 4ca4a9d2ab fix(cursor): add subcommand parity comment and raw settings TODO 2026-02-12 07:17:28 +07:00
Tam Nhu Tran 1e4cae3490 fix(cursor): clean up settings validation and route consistency 2026-02-12 04:27:53 +07:00
Tam Nhu Tran 1ebd9f43d6 feat(cliproxy): add dashboard CRUD for composite variants
- Extend create dialog with composite mode toggle and per-tier config tabs
- Add cliproxy-edit-dialog for modifying existing single and composite variants
- Add Edit action and composite type badge to variant table
- Extend API types with composite variant fields
- Update variant routes: GET (composite fields), POST (composite create), PUT (composite update)
2026-02-12 04:25:12 +07:00
Tam Nhu Tran b8aaa58d6e fix(cursor): address remaining PR #528 review feedback
- Add comment explaining whitelist merge pattern in PUT /settings
- Add comment for bare 'ccs cursor' fallthrough (differs from copilot)
- Add unit tests for cursor settings routes validation logic
  - Tests for null/non-object/array body rejection
  - Tests for port validation (integer, range 1-65535)
  - Tests for auto_start/ghost_mode boolean validation
  - Tests for whitelist merge (ignores unknown properties)
  - Tests for /settings/raw validation and file operations
  - Tests for mtime conflict detection

All web-server tests pass. Pre-existing test failures unrelated.
2026-02-12 04:17:34 +07:00
Tam Nhu Tran f5a912b114 fix(cursor): validate request body on settings endpoints
- Reject null/non-object bodies on PUT /settings with 400
- Validate settings field exists on PUT /settings/raw before write
- Use getCcsDir()-based path instead of hardcoded ~/.ccs/ in responses
2026-02-12 04:08:16 +07:00
Tam Nhu Tran d58e98815b fix(cursor): address PR #528 review feedback
- Replace non-null assertions with guard clauses in cursor-routes.ts
- Add port range validation (1-65535) in cursor-settings-routes.ts
2026-02-12 03:58:23 +07:00
Tam Nhu Tran 55bc53152c chore: merge dev into cursor-config branch
Brings in merged PRs #525 (protobuf) and #526 (auth) fixes.
Resolves stale cursor file copies by taking dev versions.
2026-02-12 03:54:15 +07:00
Tam Nhu Tran 7d9c538248 fix(glm): fix missed help text reference and glm-4.5-air pricing
- Update delegation help text from "GLM-4.6" to "GLM-5"
- Fix glm-4.5-air pricing to OpenRouter verified rates:
  input $0.20 -> $0.13, output $1.10 -> $0.85, cache $0.03 -> $0.025
2026-02-12 01:52:32 +07:00
Tam Nhu Tran 3e26dee013 feat(glm): update default model to GLM-5 and fix all GLM pricing
- Update default GLM model from glm-4.7 to glm-5 across configs, presets, help text, and fallbacks
- Add glm-5 pricing entry ($1.00/$3.20 per M tokens, OpenRouter verified)
- Fix incorrect glm-4.7 pricing: $0.60/$2.20 -> $0.40/$1.50 (OpenRouter verified)
- Fix incorrect glm-4.6 pricing: $0.60/$2.20 -> $0.35/$1.50 (OpenRouter verified)
- Fix incorrect glm-4.5 pricing: $0.60/$2.20 -> $0.35/$1.55 (OpenRouter verified)
- Keep all previous GLM model entries for backward compatibility

Closes #532
2026-02-12 01:43:59 +07:00