Commit Graph

14 Commits

Author SHA1 Message Date
ac29d26e12 rate limit the quota update: once every 2 min 2026-09-24 13:52:50 +00:00
a1fe7c7a87 Load tui plugin via direct src/tui.tsx file spec instead of repo root 2026-09-24 07:53:03 +00:00
cc7b9fc600 auto retry when receive 5xx error from server with isRetryable = true 2026-09-23 03:27:39 +00:00
ec7f32feea Make sync-models an interactive model picker 2026-09-22 12:15:39 +00:00
7e77c3c6fe Fix sidebar quota stuck on loading; forward upstream cost
Sidebar (src/tui.tsx):
- Read quota()/now() signals inside the returned JSX instead of hoisting
  quota() into a const above the return. The hoisted read subscribed once
  under a non-tracking Solid owner, freezing the panel after first paint;
  the slot handler re-runs on session change, which masked the bug as
  '/session fixes it'.
- Harden refreshQuota: whole refresh (key resolve + fetch) inside
  try/catch so any throw surfaces inline instead of wedging on loading.
  Defensive api.state access (non-array provider tolerated) and
  process.env access via safeEnv; key source tracked by name, never logged.
- Refresh triggers: keep session.idle, add session.status/session.updated/
  message.updated (debounced) plus refresh on sidebar session_id change.
- Debug-gated tui-quota trace lines to the shared debug file (silent
  unless debug is on); /cc-usage hardened the same way.

Provider cost (src/model.ts, src/usage.ts):
- Forward per-request USD from finish-step (usage.raw cost/market_cost/
  gateway_cost) and provider-metadata (gateway.cost/marketCost) into
  providerMetadata.commandcode.{cost,marketCost} on the terminal finish
  part and doGenerate result; also stash into usage.raw. A reported 0 is
  preserved; only undefined means absent.

Docs: README sidebar interval corrected (3 min, not 60 s) and trigger
list updated; AGENTS.md invariants 10 (cost) and 13 (Solid gotcha).
2026-09-22 08:39:15 +00:00
ef9a944924 add usage tracking to sidebar 2026-09-16 15:30:12 +00:00
a52efe1f70 add zdr and debug status to the sidebar 2026-09-16 14:34:49 +00:00
41fe0788a7 add /cc-zdr, /cc-debug, /cc-status slash commands 2026-09-16 14:11:07 +00:00
0872a2099b only send x-cmd-zdr when COMMANDCODE_ZDR=1 2026-09-15 10:16:14 +00:00
10aacc619b minor 2026-09-13 22:26:54 +07:00
ab760fb876 Replay assistant reasoning as a content part for DeepSeek thinking mode
Forward each assistant reasoning part to /alpha/generate as
{type:"reasoning", text, signature?} instead of dropping it. DeepSeek
thinking mode rejects any request carrying tools whose prior assistant
turns omit their reasoning, so multi-turn tool-call conversations 400'd.
Only real (non-empty) reasoning is forwarded; no fabricated injection.
Update README and AGENTS.md accordingly.
2026-09-10 22:40:50 +07:00
0b1f933ead Add opt-in file tracing for debugging
Introduce COMMANDCODE_DEBUG=1 (and COMMANDCODE_DEBUG_FILE) to append a
request/stream trace to a log file. Trace points cover HTTP attempts
(status, retry wait, elapsed), stream event payloads, terminal finish and
usage, and redacted error bodies. Silent and no file created by default.
2026-09-10 22:27:09 +07:00
Nguyen Hong Nhat
9bcb4b43e1 Add sync-models script, server.py reference proxy, and doc updates 2026-09-10 21:25:25 +07:00
e974a37475 Document provider usage and agent guidance 2026-09-10 20:39:12 +07:00