Skip to content

v0.13.2 — cswap accounts, vendor/model menus, /status usage fixes - #216

Merged
firstintent merged 15 commits into
mainfrom
dev
Nov 8, 2026
Merged

firstintent merged 15 commits into
mainfrom
dev

Conversation

@firstintent

@firstintent firstintent commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Release v0.13.2: the dev cycle since v0.13.1.

  • #229 optional cswap account selection for local Claude sessions
  • #236 show and switch a running session's account in place (web composer + IM /account)
  • #233 separate vendor and model menus; defaults name their concrete id
  • #234 account usage asked concurrently and outside the gateway lock
  • #231 IM /status usage row no longer frozen on a stale account snapshot
  • #232 live context percentage on team topology rows
  • #230 chat file links open in preview; code blocks keep a copy icon
  • #235 tests no longer write the real model catalog

Versions: workspace crates, @ccteam/ccteam-ui, engine pins and the embedded plugin tarball at 0.13.2.

Local validation: make gate green; plugin npm test 287 passed.

🤖 Generated with Claude Code

randd1024 and others added 15 commits November 4, 2026 08:51
…witches

The IM `⚡ 用量` row froze on a days-old snapshot of a since-replaced
claude account (docs-local/issues/#231). claude's `get_usage` now also
computes `behaviors` by scanning the account's local transcript history
(~3.9s on this host vs ~1ms without), past ccteam's 3s live-read and 2s
release-capture deadlines, so every capture returned None and the card
fell back to the last snapshot that ever succeeded.

- claude: ask `get_usage` with `skip_behaviors: true` (ccteam never reads
  behaviors; older CLIs ignore the field).
- AccountUsage::has_window is the one "is this an observation" rule for
  the claude/codex/grok parsers and the usage catalog: a tier-only answer
  can no longer overwrite a real one.
- codex: place each window by its declared length (windowDurationMins /
  window_minutes) instead of position — a weekly-only plan's week was
  rendered as `5h 89%`; accept float percentages; a windowless limit
  bucket (`premium`) no longer displaces the snapshot with windows.
- /status asks the focused resident session first, so the card reports
  the account that session spends from, not whichever live session sorts
  first (processes can disagree across a login switch).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each topology row now carries `ctx N%` — how full the session's context
window is right now (docs-local/issues/#232). The graph already joins
every resident session's live statusline for model/effort; `context_pct`
comes from the same `ThreadStatus.context`, so it costs no extra I/O and
tracks a long turn's growth (claude refreshes it mid-turn).

Only resident sessions have a live window: released nodes stay `—`
rather than paying a per-node transcript tail read on a fleet-wide,
polled snapshot or passing an old number off as current. A window with
unknown occupancy reports nothing, never 0%.

The `⚠` threshold is shared with the chat footer (`CTX_WARN_PCT`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ide the model menu (#229)

Owner report: with cswap installed, a per-user web login still got
"No cswap accounts are assigned to this identity". Only the admin token
resolves to Operator; every personal-link login is a Tenant that needs an
explicit `cswap_account_grants` entry, and nothing could write one (a
tenant cannot even discover the ids first), so the feature was dead for
all personal logins and the picker blamed cswap for it.

- Admin-only GET/PUT /api/v1/users/{id}/cswap-accounts (inside the
  existing admin `/users*` family). Grants accept only the 64-hex stable
  account id, never a slot, alias or `*`; deleting a user drops its grant.
- Settings → Admin → Users gains a per-user Claude account editor that
  also lists grants cswap no longer reports so they can be revoked.
- Discovery returns `reason: "not_granted"` and the picker says who can
  grant access instead of "cswap unavailable".
- The account picker leaves the model menu and becomes its own composer
  button + drop-up beside it. On phones the row already overflowed at
  390px (send at 428px); HITL/account go icon-only, effort hides and the
  model label ellipsizes so mic + send stay on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner decision 2026-11-06: per-account grants are dropped. The default
login is already the box owner's subscription and every identity that can
start a Claude session spends it, so a grant gated nothing the default
path did not already expose.

Removes config.yaml cswap_account_grants, identity::can_use_cswap_account,
the gateway CswapAccountDenied / cswap_account_access / authorize_cswap_account
checks, the admin GET/PUT /api/v1/users/{id}/cswap-accounts routes, the
Settings grant editor and the not_granted discovery reason. Keeps the
local-Claude-stream-json-only guard, the web-token gate, label redaction,
the discovery cache and isolated-profile drift refusal.

Refs: docs-local/issues/#229

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adapters record vendor model catalogs under ccteam_root_from_env(), which
falls back to the real ~/.ccteam when CCTEAM_HOME is unset. The kimi and
opencode ACP tests, codex's scripted-peer tests and the remote claude
stream-json tests pinned neither HOME nor CCTEAM_HOME, so their fixtures
(gpt-5, kimi-k2-0905-preview, tokenopen/gpt-5.5, fake-model) overwrote
the owner's catalog and surfaced as composer model rows.

Each file now pins both to one process-wide temp dir from its shared
entry point (install_fake / spawn_scripted_peer / write_fake). Verified:
a full workspace test run leaves ~/.ccteam/model-catalog.json untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st cswap accounts by number, name and quota (#229, #233)

Owner 2026-11-08: vendor and model become two dropdowns, a fresh composer
opens on claude · opus · high, every "default" model row shows the
concrete id, and the cswap account list shows only number, name and
quota — no email domain.

- Composer: a vendor button + menu beside a model button whose menu holds
  only that vendor's models, effort and protocol. Claude starts on opus at
  high; another vendor starts on its own default. The Home draft key moves
  to v2 so a stored old default does not pin the previous pick.
- Vendor default ids: model-catalog.json gains `default_model`, recorded
  only for a fresh session that requested no model — claude's first
  API-reported model, codex's thread/start `model` (honours config.toml),
  the ACP session/new current model (grok/kimi/opencode/dsh), Pi's
  get_state. /api/v1/models exposes it; the default row and the model
  button read that id (else 默认). A model-list refresh keeps it.
- cswap accounts: label is the alias, else the email's local part. Rows
  carry five_hour_pct / seven_day_pct / usage_status straight from
  `cswap list --json` (lastGoodUsage marked as last), sorted by slot, in
  aligned `#slot name | 5h | 7d` columns; Max plans show 7d only. The menu
  re-reads on every open; the session chip reads `#slot name`. Nothing is
  fetched or switched outside cswap, and machines without cswap keep
  default login only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lock (#234)

Owner report: after a session ran for ~4 days, command replies became
noticeably slow. Daemon logs pin it on IM /status: it held the
daemon-wide gateway lock while asking every live Claude session for
account usage one after another, 3 s timeout each. Once claude's
get_usage slowed (it scanned 7 days of transcripts, 849 MB here), every
ask timed out and one card cost 3 s x live sessions — 30 s median, 57 s
max on 2026-11-04 — stalling web, IM and MCP behind the lock for 9-18
minutes a day. b9cd61f removed claude's slow scan; this removes the
structural defect so a busy or stuck vendor cannot bring it back.

- One reader for all four surfaces (IM /status, MCP status usage, the
  hook phase, GET /api/v1/usage): Gateway::account_usage_probes captures
  adapter + thread handles under the lock; AccountUsageProbes::resolve
  asks them concurrently against one 1 s deadline (first answer in caller
  order still wins, so /status keeps preferring its focus), records live
  answers and falls back to the last recorded observation.
- The MCP, hook and web callers drop the lock before resolving. /status
  joins the shared IM entry, which prefetches the focus vendor's usage
  with the lock dropped and parks it for the normal handle_message render
  (vendor-checked, 10 s TTL); any other caller resolves inline, bounded.
- The inline IM handle_message lock is now instrumented, so a long hold
  logs `gateway mutex held too long` (the #234 holds never did).

Regression test (red on the previous code: "asks ran one after another:
1.80s"): three non-answering sessions resolve together, the shared /status
leaves the lock free while asking, and a stuck vendor costs one deadline.
perf-gate: status p95 31 ms, session list 42 ms, lock hold p99 0.22 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A session picked an account at creation and then neither showed it in
the composer nor could change it: launches passed `--no-share-history`,
so each account's profile held the sid's transcript privately and any
other account would have started the conversation over.

- Launch accounts with cswap's shared history (`--share-history`, its
  default since 1.0): every profile reads `~/.claude/projects`, while
  credentials stay per account. Discovery requires the flag.
- New `PUT /api/v1/sessions/{sid}/claude-account` (`null` = default
  login): rebinds the SAME sid and releases a resident process through
  the idle-release path; the next message resumes under the new account.
  Refused while a turn runs, a decision is pending, background work runs
  or a pre-restart body lives (409), and while the transcript is still
  private to the current account's profile (422). Serialized with
  lock-free resumes through the per-sid spawn claim.
- The relay refuses `--resume` when the prepared profile cannot see the
  transcript (cswap deferred sharing) instead of silently starting
  fresh, and every relay refusal now reaches the spawn error through a
  launch-directory failure file (stderr is discarded).
- Unconfirmed bindings read the shared history for recovery/titles.
- Web: the session composer carries the account button; default login
  names its current cswap account (`Default · #2 cloud`); picking
  switches in place. Hidden without cswap unless the session is bound.

Docs: usage/README/orchestration describe in-session switching.
Refs: docs-local/issues/#236, #229.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IM had no way to see which Claude account a session runs on or to move
it, while the web composer could.

- `/account` (bare): the current session's account — a default-login
  session names the cswap account that login is right now — and every
  cswap account with its 5h / 7d quota; Telegram gets one button per
  account (`act:account:<slot>` / `act:account:default`).
- `/account <n|#n|name|default>` switches through the same
  `switch_claude_account_shared` door as the web picker: the next
  message continues the same sid on the new account. Refusals (mid-turn,
  pending decision, history still private) reply with the reason.
- `/status` names a bound account on the identity line (no cswap call).
- A button standing for a shared-entry command (`/account`, `/status`)
  now enters through the shared entry, in the daemon and in
  `handle_message_shared`, instead of running inline under the lock.
- Web and IM share one `CswapAccountService` (the gateway's), so cswap
  discovery has a single cache.

Refs: docs-local/issues/#236.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ship the dev cycle since v0.13.1: optional cswap account selection for
local Claude sessions and in-place account switching for running ones
(web composer + IM /account), separate vendor and model menus, account
usage asked outside the gateway lock, an unfrozen /status usage row,
live context on topology rows, and chat file previews with code copy.

Keep workspace crates, the DSH plugin, engine pins and the embedded
plugin tarball at 0.13.2. Engine platform packages are stamped from the
tag by the packaging workflow.

Requirement: docs-local/issues/#229-#236; owner explicitly requested v0.13.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@firstintent firstintent changed the title fix(web): open chat documents in preview and expose code copy icons v0.13.2 — cswap accounts, vendor/model menus, /status usage fixes Nov 8, 2026
@firstintent
firstintent marked this pull request as ready for review November 8, 2026 12:55
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-08T12:55:11.071879Z
We couldn’t complete this review. Comment @codex review to try again.
ddb7278 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@firstintent
firstintent merged commit e13ea77 into main Nov 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant