Commit Graph
3811 Commits
Author SHA1 Message Date
Kai (Tam Nhu) TranandGitHub b4d55d0fda refactor: structural maintainability batch (#1171)
refactor: structural maintainability batch (#1135)
2026-05-03 12:24:52 -04:00
Tam Nhu Tran b6a49eeab7 fix(config/loader): break runtime cycle from normalizers to channels-runtime
The normalizers extraction in #1168 introduced a circular module-load
chain that crashed the built CLI:

  ccs.js -> errors -> services/logging -> log-config -> config-loader-facade
   -> unified-config-loader -> loader/normalizers -> channels/official-channels-runtime
   -> utils/claude-detector -> utils/shell-executor -> utils/websearch-manager
   -> utils/websearch/hook-env -> utils/websearch/trace
   -> services/logging (mid-load - createLogger undefined) -> CRASH

normalizers only needed three pure helpers from official-channels-runtime
(isOfficialChannelId, normalizeOfficialChannelIds, resolveLegacyDiscord
Selection) but pulled in the whole file's claude-detector / shell-
executor / websearch chain.

Fix: extract those three helpers + OFFICIAL_CHANNEL_IDS into a leaf
module src/channels/official-channels-ids.ts with no runtime deps.
Update normalizers.ts and config-getters.ts to import from the leaf.
official-channels-runtime.ts re-exports from the leaf for callers that
still want the bundled API.

Also revert the over-eager facade-import migration in
src/utils/config-manager.ts (it was importing from config-loader-facade
which re-exports from itself, creating a direct cycle).

Verified: dist/ccs.js boots cleanly (--version returns); test:all
1828/1828 pass; typecheck/lint/format clean.

Refs #1135
2026-05-03 12:20:32 -04:00
Tam Nhu Tran 164dcabd20 Merge remote-tracking branch 'origin/dev' into kai/refactor/1135-structural-maintainability 2026-05-03 12:00:48 -04:00
Kai (Tam Nhu) TranandGitHub 33de23c647 refactor(dispatcher): extract concerns from ccs.ts (#1167)
refactor(dispatcher): extract concerns from ccs.ts (#1165)
2026-05-03 11:57:26 -04:00
Tam Nhu Tran 70b5dc247f refactor: merge facade adoption from #1169 into ccs.ts dispatcher 2026-05-03 11:56:38 -04:00
Kai (Tam Nhu) TranandGitHub f7b854047e refactor(cliproxy/executor): extract concerns from index.ts (#1166)
refactor(cliproxy/executor): extract concerns from index.ts (#1162)
2026-05-03 11:54:58 -04:00
Tam Nhu Tran 05e1c35203 refactor: merge facade adoption from #1169 into executor extraction 2026-05-03 11:54:04 -04:00
Kai (Tam Nhu) TranandGitHub df8efc985e refactor(config): adopt config-loader-facade across codebase (#1169)
refactor(config): adopt config-loader-facade across codebase (#1161)
2026-05-03 11:51:14 -04:00
Kai (Tam Nhu) TranandGitHub 2408987859 refactor(config/loader): split unified-config-loader.ts (#1168)
refactor(config/loader): split unified-config-loader.ts (#1164)
2026-05-03 11:50:56 -04:00
Tam Nhu Tran 4f6e61739c refactor(config): adopt config-loader-facade across the codebase
Issue #1161. Sweeps 127 files to import from
src/config/config-loader-facade.ts instead of unified-config-loader or
utils/config-manager directly.

WRITE callers (32 files): replaced raw saveUnifiedConfig /
mutateUnifiedConfig / updateUnifiedConfig calls with the facade's
cache-coherent wrappers saveConfig / mutateConfig / updateConfig. This
fixes a latent stale-cache window where direct writes through the
underlying loader bypassed the facade's memoization.

READ callers (95 files): mechanical import-path migration only —
function names unchanged because the facade re-exports them. No
behavior change.

Also updated:
- tests/unit/utils/browser/browser-setup.test.ts (DI interface rename)
- src/management/checks/image-analysis-check.ts (dynamic import rename)
- src/web-server/health-service.ts (dynamic require rename)
- src/ccs.ts (path prefix fix from sweep script)

After sweep: zero raw write callers remain outside src/config/. Direct
imports of config-manager remain only for symbols not in the facade
(getConfigPath, getCcsDirSource, etc). Behavior unchanged; full suite
passes 1824/1824.

Out of scope: switching loadOrCreateUnifiedConfig() callers to
getCachedConfig() — needs per-callsite cache-safety analysis. Tracked
as follow-up.

Refs #1161
2026-05-03 01:42:53 -04:00
Tam Nhu Tran f3e79fd4e8 refactor(config/loader): extract defaults-merger, config-getters, polish orchestrator
Phases 4-6 of #1164. Final extractions and orchestrator cleanup:

- src/config/loader/defaults-merger.ts (323 LOC):
  mergeWithDefaults — pure transform that fills defaults across browser,
  websearch, dashboard auth, image analysis, logging, cursor, continuity,
  official channels.
- src/config/loader/config-getters.ts (339 LOC):
  getWebSearchConfig, getGlobalEnvConfig, getContinuityInheritanceMap,
  getCliproxySafetyConfig, getThinkingConfig, getOfficialChannelsConfig,
  isDashboardAuthEnabled, getDashboardAuthConfig, getBrowserConfig,
  getImageAnalysisConfig, getLoggingConfig, getCursorConfig,
  GeminiWebSearchInfo. Lazy require('../unified-config-loader') call-time
  resolution preserves spy-based test compatibility while breaking the
  config-getters -> orchestrator cycle.
- unified-config-loader.ts: rewritten as 268-LOC orchestrator. Hosts core
  load/save/mutate logic + re-exports of all moved symbols for backwards
  compat with codebase imports.

Forward-reference callbacks in io-locks.ts kept as-is — defaults-merger
and normalizers don't import from io-locks (no cycle), but simplifying
io-locks's internal callback API risks lock-semantics regression.
Deferred per KISS.

unified-config-loader.ts: 1508 -> 268 LOC (-1240, -82%). Behavior
unchanged; full suite passes 1824/1824.

Refs #1164
2026-05-03 01:04:57 -04:00
Tam Nhu Tran 315ae19387 refactor(config/loader): extract io-locks, normalizers, yaml-serializer
Phases 1-3 of #1164. Pure code-motion split of unified-config-loader.ts
(1508 LOC) into focused modules:

- src/config/loader/io-locks.ts (301 LOC):
  Path constants, lock primitives (acquireLock, releaseLock,
  processExists), hasUnifiedConfig, hasLegacyConfig, getConfigFormat,
  sleepSync, withConfigWriteLock, loadUnifiedConfigWithLockHeld,
  writeUnifiedConfigWithLockHeld.
- src/config/loader/normalizers.ts (228 LOC):
  Browser config normalizers, session affinity TTL,
  validateCompositeVariants, continuity normalizers,
  normalizeOfficialChannelsConfig, LegacyDiscordChannelsConfig.
- src/config/loader/yaml-serializer.ts (349 LOC):
  generateYamlHeader, generateYamlWithComments.

unified-config-loader.ts: 1508 -> 827 LOC (-681). Orchestrator
re-exports moved symbols for backwards compat.

Forward-reference workaround: loadUnifiedConfigWithLockHeld and
writeUnifiedConfigWithLockHeld take mergeWithDefaults / serializer
callbacks as parameters to avoid circular imports. Phases 4-5 can
replace with direct imports once those modules extract their
dependencies.

Behavior unchanged; full suite passes 1824/1824.

Refs #1164
2026-05-03 00:28:22 -04:00
Tam Nhu Tran 0910a75850 refactor(dispatcher): extract per-profile flows from ccs.ts
Phases 5+6 of #1165. Final big extraction: collapses the 6-branch
profileInfo.type switch in main() into a single dispatchProfile call.

- src/dispatcher/dispatcher-context.ts (40 LOC): ProfileDispatchContext type
- src/dispatcher/flows/cliproxy-flow.ts (211 LOC)
- src/dispatcher/flows/copilot-flow.ts (66 LOC)
- src/dispatcher/flows/cursor-flow.ts (54 LOC)
- src/dispatcher/flows/settings-flow.ts (400 LOC)
- src/dispatcher/flows/settings-image-analysis-prep.ts (126 LOC):
  split out per plan to keep settings-flow control flow whole
- src/dispatcher/flows/account-flow.ts (63 LOC)
- src/dispatcher/flows/default-flow.ts (136 LOC)
- src/dispatcher/target-executor.ts (+38 LOC): dispatchProfile switch

settings-flow stays at 400 LOC — flow control (3 pre-flight blocks +
env construction + 2 dispatch paths) is maximally cohesive. Further
splitting would fragment dispatch logic per plan note.

process.exit parity preserved exactly (cliproxy non-claude path uses
process.exitCode=1; return; others use process.exit(1)).

ccs.ts: 1040 -> 170 LOC (-870). Full reduction across phases 1-6:
1775 -> 170 (-1605, -90%). main() body now ~100 LOC of awaited phase
calls. Behavior unchanged; full suite passes 1824/1824.

Refs #1165
2026-05-02 23:52:25 -04:00
Tam Nhu Tran a807de6f4c refactor(dispatcher): extract profile and target detection from ccs.ts
Phase 4 of #1165. Extracts the largest remaining concern in main():
profile detection, target resolution, Claude CLI detection, adapter
lookup, compatibility preflight, binary detection, droid prune, and
per-target arg normalization.

- src/dispatcher/profile-resolver.ts (358 LOC):
  resolveProfileAndTarget + ProfileResolutionContext / ResolvedProfile
  types. Includes droid + codex per-target arg normalization (cohesive
  with profile resolution; splitting would create incomplete extraction).
- 7 unit tests covering default, gemini, codex, unknown profile, droid,
  and compatibility preflight runs.

Compatibility preflight duplication between this phase and the settings
flow (Phase E) is preserved exactly per plan risk note 5 — do not dedupe
in this PR. Module is 358 LOC (over 300 ideal) — kept whole because the
profile resolution + per-target normalization form a single dependency
chain.

ccs.ts: 1262 -> 1040 LOC (-222). Behavior unchanged; full suite passes
1824/1824.

Refs #1165
2026-05-02 23:41:48 -04:00
Tam Nhu Tran 0cf4ad7b48 refactor(dispatcher): extract bootstrap and pre-dispatch handlers from ccs.ts
Phases 2+3 of #1165. Extracts main() bootstrap + pre-dispatch handler
chain into focused dispatcher modules:

- src/dispatcher/cli-argument-parser.ts (+138 LOC):
  bootstrapAndParseEarlyCli + DispatcherBootstrap. Encapsulates UI init,
  --config-dir parse/validate, cloud-sync warnings, completion command
  short-circuit, legacy cursor arg normalization, browser launch flag
  resolution, and native codex passthrough escape.
- src/dispatcher/pre-dispatch.ts (155 LOC):
  runPreDispatchHandlers. Wraps update check, root command router,
  provider help shortcut, copilot/cursor subcommand routing, first-time
  install hint. Returns boolean consumed signal.
- New tests: 12 + 7 covering both modules.

Adapter registration intentionally stays in main() — singleton wiring
with no arg dependency; folding it into bootstrap would conflate
concerns. ccs.ts: 1475 -> 1262 LOC (-213). Behavior unchanged; full
suite passes 1824/1824.

Refs #1165
2026-05-02 23:27:05 -04:00
Tam Nhu Tran f759cfeaaa refactor(dispatcher): scaffold src/dispatcher/ and extract pure helpers from ccs.ts
Phase 1 of #1165. Pure code-motion: moves top-level helpers out of the
1775-LOC CLI entry point into focused dispatcher modules. Zero
behavior change, zero main() changes.

- src/dispatcher/cli-argument-parser.ts (199 LOC):
  DetectedProfile, RuntimeReasoningResolution, NATIVE_CLAUDE_EFFORT
  constants, detectProfile, normalizeLegacyCursorArgs,
  printCursorLegacySubcommandDeprecation, resolveRuntimeReasoningFlags,
  normalizeCodexRuntimeReasoningOverride,
  exitWithRuntimeReasoningFlagError, normalizeNativeClaudeEffortArgs,
  shouldNormalizeNativeClaudeEffort,
  shouldPassthroughNativeCodexFlagCommand,
  getNativeCodexPassthroughArgs.
- src/dispatcher/environment-builder.ts (125 LOC):
  resolveCodexRuntimeConfigOverrides, refreshUpdateCache,
  showCachedUpdateNotification, resolveNativeClaudeLaunchArgs.
- src/dispatcher/target-executor.ts (56 LOC):
  ProfileError, execNativeCodexFlagCommand.

ccs.ts: 1775 -> 1475 LOC (-300). Cleaned up 8 now-orphaned imports.
Behavior unchanged; full suite passes 1824/1824.

Refs #1165
2026-05-02 22:49:45 -04:00
Tam Nhu Tran 09268e7e33 refactor(cliproxy/executor): extract model-warnings + claude-launcher and polish orchestrator
Phases 08+09+10 of #1162. Final extractions and orchestrator cleanup:

- src/cliproxy/executor/model-warnings.ts (80 LOC):
  warnBrokenModels — handles composite + simple paths, broken-model
  notification with replacement suggestions.
- src/cliproxy/executor/claude-launcher.ts (161 LOC):
  launchClaude — final args assembly (web search, image analysis, browser
  tool args), trace context env, Windows shell escaping, spawn,
  quota monitor wiring, cleanup handlers.
- New tests: 227 + 217 LOC.
- index.ts cleanup: numbered section comments through orchestrator,
  removed ~17 now-unused imports, re-export block preserved.

index.ts: 665 -> 550 LOC. Final reduction across all 10 phases:
1428 -> 550 (-878, -61%). Behavior unchanged; full suite passes
1824/1824. The remaining 550 LOC is the natural orchestrator floor —
further extraction would require a 15-field context struct, which is
manufactured complexity rather than genuine separation of concerns.

Closes phases 02-10 of #1162.

Refs #1162
2026-05-02 22:39:13 -04:00
Tam Nhu Tran 8b39d8a25f refactor(cliproxy/executor): extract proxy-chain-builder from index.ts
Phase 07 of #1162. Splits tool-sanitization + codex-reasoning proxy spawn
out of the orchestrator:

- src/cliproxy/executor/proxy-chain-builder.ts (185 LOC):
  buildProxyChain + ProxyChainContext / ProxyChainResult types.
  DI escape hatch (_ToolSanitizationProxy / _CodexReasoningProxy) for
  testability without refactoring the proxy classes (Bun module cache
  blocks mock.module of already-loaded modules).
- 9 unit tests covering codex-only, tool-san only, both-together,
  spawn failure swallowing, env propagation.

index.ts: 716 -> 665 LOC (-51). HTTPS tunnel kept inline because
tunnelPort is needed by image-analysis resolution before first-pass
buildClaudeEnvironment — folding it in would also require moving image
analysis. Two-pass buildClaudeEnvironment dance preserved exactly.
Behavior unchanged; full suite passes 1824/1824.

Refs #1162
2026-05-02 22:32:37 -04:00
Tam Nhu Tran 8b7e7f4847 refactor(cliproxy/executor): extract auth-coordinator from index.ts
Phase 06 of #1162. Splits the largest remaining concern out of the
orchestrator into a focused module:

- src/cliproxy/executor/auth-coordinator.ts (397 LOC):
  handleLogout, handleImport, resolveSkipLocalAuth, runAntigravityGate,
  ensureProviderAuthentication, runPreflightQuotaCheck,
  runAccountSafetyGuards, ensureModelConfiguration,
  ensureProviderSettingsFile. Preserves load-bearing ordering of
  antigravity gate -> auth -> token refresh -> quota check.
- 36 unit tests covering --auth/--logout/--import early exit,
  antigravity gate refusal/acceptance, OAuth trigger paths, composite
  providers, remote-proxy skipLocalAuth.

index.ts: 895 -> 716 LOC (-179). Behavior unchanged; full suite passes
1824/1824. Module is 397 LOC (over the <200 ideal) — kept whole because
the auth ordering contract should not be split across files.

Refs #1162
2026-05-02 22:03:46 -04:00
Tam Nhu Tran bc48613bbd refactor(cliproxy/executor): extract browser-setup and account-resolution
Phases 04+05 of #1162. Splits two more concerns out of the orchestrator:

- src/cliproxy/executor/browser-launch-setup.ts (118 LOC):
  resolveBrowserLaunchFlags + resolveBrowserRuntime. Encapsulates browser
  flag resolution, attach config, blocked-override warning, and runtime
  setup including MCP sync.
- src/cliproxy/executor/account-resolution.ts (197 LOC):
  resolveRuntimeQuotaMonitorProviders, resolveAccounts (--accounts /
  --use / --nickname / OAuth ban-risk warn / default touch),
  applyAccountSafetyGuards, touchDefaultAccount.
- New tests: 184 + 430 LOC covering both modules.

index.ts: 1045 -> 895 LOC (-150). resolveRuntimeQuotaMonitorProviders
re-exported from index.ts for __testExports backwards compat. Behavior
unchanged; full suite passes 1824/1824.

Refs #1162
2026-05-02 21:47:54 -04:00
Tam Nhu Tran 968681f261 refactor(cliproxy/executor): extract proxy-resolver from index.ts
Phase 03 of #1162. Splits proxy + binary resolution out of the orchestrator
into a focused module:

- src/cliproxy/executor/proxy-resolver.ts (196 LOC):
  ResolvedProxy + ResolveExecutorProxyContext interfaces, resolveExecutorProxy
  function. Encapsulates proxy config resolution, port mutation, remote
  reachability check, fallback prompt, local backend selection, and
  binary acquisition.
- src/cliproxy/executor/__tests__/proxy-resolver.test.ts: 10 unit tests
  covering local/remote/fallback paths.

index.ts: 1168 -> 1045 LOC (-123). Removes 9 now-unused imports. Browser
flag handling intentionally left in index.ts for Phase 04. Behavior
unchanged; full suite passes 1824/1824.

Refs #1162
2026-05-02 21:38:38 -04:00
github-actions[bot] 0e83c916f9 chore(release): 7.76.0-dev.2 2026-05-02 21:20:28 -04:00
Tam Nhu Tran 19d24954be refactor(cliproxy/executor): extract arg-parser from index.ts
Phases 01+02 of #1162. Splits executor flag parsing/validation out of the
1428-LOC orchestrator into a focused module:

New files:
- src/cliproxy/executor/arg-parser.ts (~500 LOC):
  readOptionValue, hasGitLabTokenLoginFlag, getGitLabTokenLoginFlagName,
  CCS_FLAGS + filterCcsFlags, ParsedExecutorFlags + parseExecutorFlags,
  validateFlagCombinations (process.exit semantics preserved for parity).
- src/cliproxy/executor/__tests__/arg-parser.test.ts: 45 unit tests.
- src/cliproxy/executor/__tests__/index-characterization.test.ts:
  TDD baseline (16 pass + 7 skipped scenarios at the spawn/dynamic-import
  boundary; mock simplification deferred to a follow-up phase).

index.ts: 1428 -> 1175 LOC (-253). Re-exports preserved at module bottom
for backwards compatibility. Behavior unchanged; full test suite passes
(1824/1824).

Refs #1162
2026-05-02 21:17:07 -04:00
walker1211andGitHub 11b12f146d fix(analytics): cache native Codex usage scans
Cache parsed native Codex rollout usage entries per file fingerprint to avoid repeated full-history JSONL parsing on dashboard refreshes.

Add regression coverage for cache reuse, invalid cache fallback, cliproxy cache separation, and scoped cache fixtures.
2026-05-02 21:16:07 -04:00
github-actions[bot] 74898210f9 chore(release): 7.76.0-dev.1 2026-05-01 02:23:06 -04:00
Kai (Tam Nhu) TranandGitHub 50b0ffba75 fix(cliproxy): refresh upstream model and quota surfaces (#1158)
* fix(cliproxy): refresh upstream model and quota surfaces

* test(cliproxy): cover codex legacy model fallback
2026-05-01 02:19:31 -04:00
semantic-release-bot 66865127d7 chore(release): 7.76.0 [skip ci]
## [7.76.0](https://github.com/kaitranntt/ccs/compare/v7.75.0...v7.76.0) (2026-05-01)

### Features

* add native Claude effort override ([e5fe86f](https://github.com/kaitranntt/ccs/commit/e5fe86f520f313632a8627ca70f551dd5bcb665b))
* **auth,commands:** instrument oauth handler, profile registry, and doctor pipeline ([bf87594](https://github.com/kaitranntt/ccs/commit/bf8759460df0828ddec1138866dae3ef86ff2a42)), closes [#1141](https://github.com/kaitranntt/ccs/issues/1141) [#1138](https://github.com/kaitranntt/ccs/issues/1138)
* **logging:** add structured contract, ALS context, stage helpers, and redaction coverage ([7a22e89](https://github.com/kaitranntt/ccs/commit/7a22e89046ecb4af79291ecd3b4c885275ab5787)), closes [#1141](https://github.com/kaitranntt/ccs/issues/1141) [#1138](https://github.com/kaitranntt/ccs/issues/1138)
* **providers:** instrument copilot, cursor, and glmt across daemons and executors ([1ff4329](https://github.com/kaitranntt/ccs/commit/1ff4329ee4b58e68648cd1f331f3dd64d4eb10df)), closes [#1141](https://github.com/kaitranntt/ccs/issues/1141) [#1138](https://github.com/kaitranntt/ccs/issues/1138)
* **proxy,cli:** emit lifecycle stages with x-ccs-request-id propagation ([4700727](https://github.com/kaitranntt/ccs/commit/47007279156545f81c615824065a0094aafa07d0)), closes [#1141](https://github.com/kaitranntt/ccs/issues/1141) [#1138](https://github.com/kaitranntt/ccs/issues/1138)
* **targets,management:** instrument adapter spawn lifecycle and instance manager ([8afee34](https://github.com/kaitranntt/ccs/commit/8afee344e1b1e8f45d029affc011e229e069b949)), closes [#1141](https://github.com/kaitranntt/ccs/issues/1141) [#1138](https://github.com/kaitranntt/ccs/issues/1138)
* **ui:** align logs page visual language with dashboard markers ([e04598e](https://github.com/kaitranntt/ccs/commit/e04598eef777746d1898d6ddc22eb527c9badcd3)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1141](https://github.com/kaitranntt/ccs/issues/1141) [#1142](https://github.com/kaitranntt/ccs/issues/1142)
* **ui:** hide dashboard self-polling internals via default filter ([4a77251](https://github.com/kaitranntt/ccs/commit/4a772510215a0e8081853eee6c32d1cb8e47ec9b)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1141](https://github.com/kaitranntt/ccs/issues/1141) [#1142](https://github.com/kaitranntt/ccs/issues/1142)
* **ui:** redesign dashboard logs page with virtualized 3-pane shell ([ae3240d](https://github.com/kaitranntt/ccs/commit/ae3240d4c8ae540cfcd354a662eaf0a7979a1ded)), closes [#1141](https://github.com/kaitranntt/ccs/issues/1141) [#1142](https://github.com/kaitranntt/ccs/issues/1142) [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1141](https://github.com/kaitranntt/ccs/issues/1141)
* **ui:** show split Claude quota bars ([a8b686d](https://github.com/kaitranntt/ccs/commit/a8b686d643f38bf11efb83f1753442783ebed2c9))

### Bug Fixes

* address red-team review findings — cache aliasing, jitter cap, cause shadowing ([9bb1bdb](https://github.com/kaitranntt/ccs/commit/9bb1bdbad960140db177e1cec6a30ea56b97263e))
* **ci:** align release sync with protected dev checks ([0381fa9](https://github.com/kaitranntt/ccs/commit/0381fa9b52cc6ffb49c91b528de0f9ed7c182b9f))
* **ci:** align stable release runner ([4458774](https://github.com/kaitranntt/ccs/commit/4458774d5c0413b70001402100c366f6fc87ade2))
* **ci:** invoke semantic-release through bun x ([63a10e0](https://github.com/kaitranntt/ccs/commit/63a10e0e8d7f62e209828e41194ad16cf86fbc5c))
* **cliproxy:** clear stale cleanup timer and fix session/tunnel edge cases ([20c2005](https://github.com/kaitranntt/ccs/commit/20c2005df965e34f68af36734008ee043857db28))
* **cliproxy:** correct relative import paths in colocated tests ([273214d](https://github.com/kaitranntt/ccs/commit/273214d1665f367a03490ec600cc52dc70058ca1))
* **cliproxy:** exclude colocated tests from tsconfig and eslint ([c3c8cb7](https://github.com/kaitranntt/ccs/commit/c3c8cb7a8276a001c7d9603fade5484f94d5fad3))
* **cliproxy:** fix base-config-loader __dirname path and stale mock.module paths ([31dc186](https://github.com/kaitranntt/ccs/commit/31dc18657ce7140a7ef02c6219e61b859c110039))
* **cliproxy:** handle all invalid prefixes and reverse-order collisions ([6633bf4](https://github.com/kaitranntt/ccs/commit/6633bf456bcb9095a59e05e08741810af6030f39))
* **cliproxy:** sanitize invalid tool name chars and disambiguate collisions ([218d0cf](https://github.com/kaitranntt/ccs/commit/218d0cf6c63e2d4a5e0b56a5ae061de4b6e861dc))
* **cliproxy:** update remaining stale imports in non-colocated tests ([2c817fa](https://github.com/kaitranntt/ccs/commit/2c817fae484b762a62a79737efb4c84a91c87988))
* **config-facade:** mtime-based staleness detection for cache ([1e5580a](https://github.com/kaitranntt/ccs/commit/1e5580a30ae4c2eef64975b688b13440cb2d3b07))
* **proxy:** avoid leaking tool_result image URLs ([83c16e2](https://github.com/kaitranntt/ccs/commit/83c16e216a2be549306434a1afa317844337b607))
* **proxy:** shape direct OpenAI reasoning chat payloads ([d9ace60](https://github.com/kaitranntt/ccs/commit/d9ace607e58caafd71224e02ed9f297b7dcacecb))
* **proxy:** stringify tool_result images for OpenAI upstreams ([f6bb31c](https://github.com/kaitranntt/ccs/commit/f6bb31c95657d219373ec09009e0f7bed991c439))
* remove raw write re-exports from facade (cache bypass) ([6d266fc](https://github.com/kaitranntt/ccs/commit/6d266fc7e89d7e7ddee3ec4235152e9a9bcaba0d)), closes [#1150](https://github.com/kaitranntt/ccs/issues/1150)
* round 2 red-team fixes — onRetry safety, validation, barrel ([18e865e](https://github.com/kaitranntt/ccs/commit/18e865ea364de0f7c811d447bacaf644d98f10d2))
* round 3 red-team — test false-positive, dead code, ([b8ed36e](https://github.com/kaitranntt/ccs/commit/b8ed36e3705f9e6795a99864610727026be5fc52))
* **ui:** align logs row and detail panel via shared accessors ([d5b14be](https://github.com/kaitranntt/ccs/commit/d5b14bec1c48b2f97c2fbadcc39124c5c54ddec8)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1141](https://github.com/kaitranntt/ccs/issues/1141) [#1142](https://github.com/kaitranntt/ccs/issues/1142)
* **ui:** coalesce leaves only when truly adjacent in original stream ([871b682](https://github.com/kaitranntt/ccs/commit/871b6826f786b08f89caa86f7aff439594c9fdf7)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1151](https://github.com/kaitranntt/ccs/issues/1151)
* **ui:** drop dedicated stage column; render stage chip inline in message ([7f086c8](https://github.com/kaitranntt/ccs/commit/7f086c8685cf1ec3f4dd44bedc96fbd5c6928164))
* **ui:** import MouseEvent type explicitly in logs-row ([6f1396c](https://github.com/kaitranntt/ccs/commit/6f1396cf1e99dfac460040b0a6a3f5d7f72bec5d)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1151](https://github.com/kaitranntt/ccs/issues/1151)
* **ui:** improve split quota bar readability ([476c6d8](https://github.com/kaitranntt/ccs/commit/476c6d827fbdbca8d8aa8535c9b6c894bb84dd1c))
* **ui:** include message in coalesce key so distinct entries stay visible ([a465e3f](https://github.com/kaitranntt/ccs/commit/a465e3fec184464042c8ae8d5e16e9045ef56e52)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1151](https://github.com/kaitranntt/ccs/issues/1151)
* **ui:** include source in trace child coalesce key ([75cdc02](https://github.com/kaitranntt/ccs/commit/75cdc02c1f4a9881b1d64e8d6608da15d74d6378)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1151](https://github.com/kaitranntt/ccs/issues/1151)
* **ui:** include stage in leaf coalesce key ([e7058b6](https://github.com/kaitranntt/ccs/commit/e7058b6b6da82a1bc54fa43f437e53748ba78c20)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1151](https://github.com/kaitranntt/ccs/issues/1151)
* **ui:** make logs row keyboard-accessible without nested interactive markup ([b7cfbd1](https://github.com/kaitranntt/ccs/commit/b7cfbd14e2c7057270f3e8b482c73208fcb1ca47)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1151](https://github.com/kaitranntt/ccs/issues/1151)
* **ui:** make trace chevron actually collapse auto-expanded traces ([04ddc33](https://github.com/kaitranntt/ccs/commit/04ddc33518d43302e650283a3d7be43cf616dd9d)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1151](https://github.com/kaitranntt/ccs/issues/1151)
* **ui:** only show "Copied" feedback when clipboard write succeeds ([39ec84a](https://github.com/kaitranntt/ccs/commit/39ec84a8a9a78489565c27e1e599d8383291400a)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1151](https://github.com/kaitranntt/ccs/issues/1151)
* **ui:** remove intra-trace coalescing — preserve every stage for inspection ([2ddc5d5](https://github.com/kaitranntt/ccs/commit/2ddc5d5afd4cdb2e6a063180f47469a5298460fc)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1151](https://github.com/kaitranntt/ccs/issues/1151)
* **ui:** reserve leading chevron column so trace and leaf rows align ([0dfb7b8](https://github.com/kaitranntt/ccs/commit/0dfb7b85833aec6b26e0ae02452ecc19a9494629)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138)
* **ui:** reserve stage column on every row for consistent alignment ([40cc62a](https://github.com/kaitranntt/ccs/commit/40cc62a67f03a86f163d679ae15ef0df78e6e248)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1151](https://github.com/kaitranntt/ccs/issues/1151)

### Documentation

* **config-facade:** clarify cache coherence contract ([2290a1d](https://github.com/kaitranntt/ccs/commit/2290a1dc5a575c0875524571c64ee24968851855)), closes [#1150](https://github.com/kaitranntt/ccs/issues/1150)
* **logging:** add structured contract reference and bump Node engines to 18+ ([c0c856a](https://github.com/kaitranntt/ccs/commit/c0c856af988277d2d79b869e1be98c5261d8c7c0)), closes [#1141](https://github.com/kaitranntt/ccs/issues/1141) [#1138](https://github.com/kaitranntt/ccs/issues/1138)

### Code Refactoring

* **cliproxy:** flatten module structure and colocate tests ([#1135](https://github.com/kaitranntt/ccs/issues/1135)) ([1c72b4b](https://github.com/kaitranntt/ccs/commit/1c72b4b8d5bf783bc3c6306d687065ac8eac9922))
* **config:** add config-loader-facade with memoization ([1e9a7f3](https://github.com/kaitranntt/ccs/commit/1e9a7f3fa01e40ab569932e66ce37f8653bf8c97))
* **config:** reorganize unified-config-types into schemas directory ([51df0ee](https://github.com/kaitranntt/ccs/commit/51df0ee55b52ecc858544ec8d8ff7e7932db0f11))
* **errors:** add RetryableError and retry-strategy utility ([d089ab0](https://github.com/kaitranntt/ccs/commit/d089ab06c2c007e4a46173efcac9ea9ff23f0bb5))
* extract plugin path normalizer ([3330229](https://github.com/kaitranntt/ccs/commit/333022968689a5584347c1fa66cdf18ee0a3a7b4))

### Tests

* include colocated cliproxy tests in buckets ([33a1553](https://github.com/kaitranntt/ccs/commit/33a1553431afdcca1a5c1fca54aff8da8d8bb05e))
* **logging:** add cross-stage requestId correlation integration test in slow bucket ([c0a019b](https://github.com/kaitranntt/ccs/commit/c0a019bf7e83287dddfb333633941d3142541778)), closes [#1141](https://github.com/kaitranntt/ccs/issues/1141) [#1138](https://github.com/kaitranntt/ccs/issues/1138)
* **proxy:** assert tool_result image URLs stay redacted ([2c0f9c4](https://github.com/kaitranntt/ccs/commit/2c0f9c41ff1fff94c35e93535b9a8343ef7ce953))
* **ui:** cover logs page redesign with virtuoso-mocked render ([a10e570](https://github.com/kaitranntt/ccs/commit/a10e570310c2655553cd62dae1bf6d84478f8090)), closes [#1142](https://github.com/kaitranntt/ccs/issues/1142) [#1138](https://github.com/kaitranntt/ccs/issues/1138)
* **ui:** cover trace-coalesce, leaf-coalesce, and stage-hint helpers ([6ada2b2](https://github.com/kaitranntt/ccs/commit/6ada2b243e339067071fe1c00d41a57581c3e403)), closes [#1138](https://github.com/kaitranntt/ccs/issues/1138) [#1151](https://github.com/kaitranntt/ccs/issues/1151)
2026-05-01 01:15:14 -04:00
Kai (Tam Nhu) TranandGitHub a621cf3de7 Merge pull request #1156 from kaitranntt/dev
fix(ci): restore stable release semantic-release invocation
2026-05-01 01:12:17 -04:00
github-actions[bot] 4885a4647f chore(release): 7.75.0-dev.12 2026-05-01 01:02:53 -04:00
Tam Nhu Tran 63a10e0e8d fix(ci): invoke semantic-release through bun x 2026-05-01 00:55:53 -04:00
Kai (Tam Nhu) TranandGitHub 241ec16719 Merge pull request #1155 from kaitranntt/dev
feat: promote dev to main
2026-05-01 00:51:07 -04:00
github-actions[bot] 6035f6354d chore(release): 7.75.0-dev.11 2026-04-30 22:46:19 -04:00
Kai (Tam Nhu) TranandGitHub 0b31d0ac2f Merge pull request #1154 from kaitranntt/kai/feat/1153-effort-session-override
feat: add native Claude effort override
2026-04-30 22:42:49 -04:00
Tam Nhu Tran e5fe86f520 feat: add native Claude effort override 2026-04-30 22:36:47 -04:00
github-actions[bot] ec9d0982d8 chore(release): 7.75.0-dev.10 2026-04-30 17:18:53 -04:00
Kai (Tam Nhu) TranandGitHub bbf121d808 Merge pull request #1152 from kaitranntt/kai/feat/1138-logging-revamp
feat(logs): structured logging contract and dashboard logs page redesign (#1138)
2026-04-30 17:14:33 -04:00
Tam Nhu Tran 7bc1fbddb5 chore(pr): add force-UI evidence for integration PR #1152
Three light-theme captures of the merged integration branch (backend
#1141 + UI #1142 + final-touches #1151) at the dev-merge commit:

1. 01-overview-mock.png — full logs page with ?mock=logs:
   LOGS.STREAM marker, Live activity title, ENTRIES/TRACES/ERRORS
   stat strip, trace grouping with inline stage chips, populated
   detail panel showing all structured fields.
2. 02-real-backend-clean.png — real backend with default
   Hide-dashboard-internals filter active: clean empty state.
3. 03-mobile.png — 390x844 responsive layout.
2026-04-30 17:01:40 -04:00
Tam Nhu Tran 7f086c8685 fix(ui): drop dedicated stage column; render stage chip inline in message
Adding a separate STAGE column squeezed MESSAGE to 0px at the
default 22/52/26 panel split — fixed columns + gaps totalled more
than the list panel's available width.

Render the stage chip inline at the start of the MESSAGE column when
present, restoring the original 7-column grid. The bot's earlier
"extra cell mismatch" complaint is still satisfied because there's
no longer a row-only cell missing from the header.

Also tighten three fixed columns to give MESSAGE more breathing room
even on narrower saved panel layouts:
- Module 140 -> 120
- Latency 72 -> 64
- Request 112 -> 100
2026-04-30 16:59:02 -04:00
Tam Nhu Tran 3b15082ea4 Merge remote-tracking branch 'origin/dev' into kai/feat/1138-logging-revamp 2026-04-30 16:47:28 -04:00
Kai (Tam Nhu) TranandGitHub 92761903eb Merge pull request #1151 from kaitranntt/kai/feat/1138-final-touches
feat(ui): logs page final-touches audit fixes (#1138)
2026-04-30 16:44:36 -04:00
Tam Nhu Tran e7058b6b6d fix(ui): include stage in leaf coalesce key
PR-Agent flagged that the leaf coalesceKey omitted `stage`, so two
adjacent no-requestId logs differing only by stage (e.g. one logging
`route` and the next `dispatch`) would merge into a single `×2`
row, hiding a distinct entry.

Add `stage` to the coalesce tuple. New unit test asserts that two
leaves identical except for stage stay as separate rows.

Refs #1138, #1151
2026-04-30 16:31:31 -04:00
Tam Nhu Tran 2ddc5d5afd fix(ui): remove intra-trace coalescing — preserve every stage for inspection
PR-Agent flagged that the trace-child coalesce was hiding legitimate
repeated stage emissions: a request that retries an upstream call or
emits the same stage twice for any reason would show only the first
occurrence behind a `×N` badge, with subsequent attempts no longer
selectable or inspectable.

The original noise problem motivating intra-trace coalesce was the
149-stage `web-server:http` self-polling trace, but that's already
hidden by default via the `hideDashboardInternals` filter. Users who
opt in to see internals are deliberately debugging the dashboard and
SHOULD see all 149 stages — collapsing them defeats the opt-in.

Drop `coalesceChildren` entirely. Trace children render uncoalesced
so retries, duplicated stages, and multi-attempt traces stay
individually inspectable. Standalone-leaf coalesce stays — that's
the actual user-facing dedup the PR was about.

Tests: drop the 7 `coalesceChildren` cases; keep 16 covering
`deriveStageHint` and `deriveTraceGroups`.

Refs #1138, #1151
2026-04-30 16:28:42 -04:00
github-actions[bot] 9ce485e8d0 chore(release): 7.75.0-dev.9 2026-04-30 16:24:24 -04:00
Tam Nhu Tran 6ada2b243e test(ui): cover trace-coalesce, leaf-coalesce, and stage-hint helpers
PR-Agent flagged "No relevant tests" each round. Add 23 unit tests
covering the pure-function surface introduced by this PR:

- deriveStageHint — explicit stage wins, fallback to last .-segment
  of event, 12-char cap, undefined when nothing meaningful.
- coalesceChildren — empty input, single child, adjacent identical
  collapse, distinct messages stay separate (round-1 fix), distinct
  sources stay separate (round-2 fix), distinct stages stay separate,
  interleaving breaks the run.
- deriveTraceGroups — empty input, lone leaf, requestId grouping,
  ts-asc child sort, group ts pinned to oldest child, adjacent leaf
  coalesce with collapsedRange, leaves split by trace stay distinct
  (round-3 fix), distinct messages stay distinct, reverse-chronological
  display sort, max-level + total-latency aggregates, original-input
  adjacency preserved despite display sort.

Refactor: coalesceChildren extracted from logs-trace-row.tsx into
derive-trace-groups.ts so it's testable as a pure function without
React rendering.

Refs #1138, #1151
2026-04-30 16:24:19 -04:00
Kai (Tam Nhu) TranandGitHub 769ebbd43b Merge pull request #1150 from kaitranntt/kai/refactor/1135-structural-maintainability
refactor: Phase 2 structural maintainability (#1135)
2026-04-30 16:20:30 -04:00
Tam Nhu Tran 40cc62a67f fix(ui): reserve stage column on every row for consistent alignment
PR-Agent flagged that trace child rows rendered an extra stage-hint
cell while the header grid template only had 7 columns. Result: every
expanded child shifted module/message/latency/request rightward, and
the stage chip overlapped its neighbour in the trace timeline.

Add a dedicated 72px "Stage" column to the header grid template and
to every row variant. Standalone leaves and trace heads render an
empty span at the same width; trace children with stage hints render
the chip in that slot. Column edges now match across all row types.

Refs #1138, #1151
2026-04-30 16:09:50 -04:00
Tam Nhu Tran 04ddc33518 fix(ui): make trace chevron actually collapse auto-expanded traces
The first click on a trace's chevron did nothing visible when the
trace's child was the currently-selected entry. Root cause: `toggle`
only checked the `expanded` set; auto-expand kept re-injecting the
requestId so the row stayed open even after the user added it to
`expanded` (and oscillating subsequent clicks).

Replace the single `expanded` set with a tristate driven by two
sets — `userExpanded` (explicitly opened) and `userCollapsed`
(explicitly closed). Auto-expand only fires when the id is in
neither, so a click on an auto-expanded chevron now writes the
collapse intent to `userCollapsed` and the row collapses on the
first click.

Refs #1138, #1151
2026-04-30 15:58:48 -04:00
Tam Nhu Tran 1e5580a30a fix(config-facade): mtime-based staleness detection for cache
getCachedConfig() now checks config file mtime on each call.
If external code writes via unified-config-loader directly,
the facade detects the file change and re-reads from disk
automatically. Resolves PR-Agent "Stale Cache" finding.
2026-04-30 15:56:50 -04:00
Tam Nhu Tran 871b6826f7 fix(ui): coalesce leaves only when truly adjacent in original stream
PR-Agent flagged that the previous derive-trace-groups split entries
into trace and leaf buckets *before* coalescing leaves. That meant two
identical no-requestId entries separated by other rows in the real
stream would still merge into a single `×N` row, hiding signal.

Walk `entries` in input order with single-pass coalescing: a leaf
only extends the previous leaf when no other entry (trace child or
otherwise) appeared between them. Trace children still gather across
interleaving since they're identified by `requestId`. Group children
get sorted ts-ascending for trace-timeline display, with the group's
positional ts pinned to the oldest child for the reverse-chrono
display sort.

Refs #1138, #1151
2026-04-30 15:45:02 -04:00
Tam Nhu Tran 6f1396cf1e fix(ui): import MouseEvent type explicitly in logs-row
PR-Agent flagged that `React.MouseEvent` referenced an unimported
`React` namespace; in stricter TypeScript builds this would fail
typecheck. Import the type alias from `react` directly.

Refs #1138, #1151
2026-04-30 15:44:36 -04:00