Skip to content

feat: unify provider check-in (WorkBuddy / Qoder CN / Trae CN) - #200

Merged
caigee-cmd merged 16 commits into
mainfrom
feat/provider-checkin
Sep 19, 2026
Merged

caigee-cmd merged 16 commits into
mainfrom
feat/provider-checkin

Conversation

@caigee-cmd

@caigee-cmd caigee-cmd commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Summary

把签到从「WorkBuddy 专属」重构成「provider 通用能力」,并接入 Trae CN Work(参考 connectedGraph/trae2api-webcheckin_credits 协议)。

  • 新增 providers.CheckinPolicy / AccountCheckiner / CheckinResult:所有 provider 走同一个签到接口,runtime 用一条调度器按本地时间批量触发。
  • Schema(migration 021)accounts 新增 auto_checkin / checkin_time,并把 workbuddy 旧列数据迁移过来;新建账号不再写 workbuddy-only 列。
  • WorkBuddy:把 DailyCheckin 挂到 AccountCheckiner
  • Qoder CN:worker 新增 /admin/checkin endpoint,client 侧 Client.Checkin 通过 admin HTTP 调用。真实账号验收仍待完成
  • Trae CN
    • 通过 api.trae.cncheckin_credits/status + checkin_credits/claim 签到。
    • 复用 credential() 自动刷新过期 access token。
    • 上游「今日已签到」→ Status="already"KindAuth → 让 manager 走 re-login;disabled 时 Status="skipped"
    • Adapter 注册 Checkin,region descriptor 挂 Asia/Shanghai
  • Console / 前端:每个 provider 有默认签到时间,账号可继承或覆盖;签到入口和历史留在账号卡片上,不另设导航。
  • WorkBuddy「丢弃系统提示词」开关从账号卡片移到新建 / 编辑。
  • 请求历史记录请求传入与实际上游的推理强度(migration 022);两者一致时只显示一档,不一致时用 requested → resolved

Test plan

  • go test ./internal/store ./internal/executor ./internal/gateway
  • frontend && npm run sync
  • 本地 Docker cli2api:checkin-dev 以当前代码重建并 healthy
  • CI
  • Qoder CN / Trae CN 真实账号验收(沿用 PLAN 待办)

Ref

  • docs/PROVIDERS_TRAE_SOLO.md — Trae 协议事实
  • docs/REFACTORING.md — 包边界基线

- Add generic providers.CheckinPolicy / AccountCheckiner / CheckinResult and
  a single runtime scheduler that runs daily at configured local times.
- Add auto_checkin / checkin_time columns on accounts (migration 021),
  migrating existing WorkBuddy settings; drop the workbuddy-only columns
  from the create path.
- WorkBuddy: move daily-checkin to the new AccountCheckiner surface.
- Qoder CN: implement worker /admin/checkin and route it through the
  client-side AccountCheckiner. Live account acceptance remains pending.
- Trae CN: implement checkin_credits status/claim through ug headers,
  mapping upstream "already checked in" to Status=already and auth-dead
  to re-login. Wire into the adapter and register Asia/Shanghai timezone.
- Console: expose per-provider default check-in time and per-account
  overrides; keep controls and history on the account card.
- Frontend: build synced into internal/webui/static.

Reference: connectedGraph/trae2api-web checkin_credits protocol.
- Drop the early-return that swapped the whole AccountCard for a skeleton
  while busyKind === 'refresh'. The card now stays mounted so the grid does
  not jump between heights when re-probing an account; the refresh button
  spinner is the only in-place indicator.
- Clamp lastError to three lines with line-clamp-3 so a long upstream
  message no longer stretches the card; the full text (plus error kind)
  surfaces through the existing Tooltip on hover.
- Drop the boxed runtime section (RuntimeMeter + inFlight / priority /
  restarts grid + priority meter). The meter is now a single horizontal
  strip with the state label, and the three numbers collapse into a
  compact mono readout in the footer (`12/4 · P50 · R0`). Priority is
  still editable through the existing edit modal.
- Merge auto-checkin and last-checkin rows into one line: label left,
  mono check-in time plus the auto-checkin switch right. The timezone
  tooltip moves onto the switch.
- Move WorkBuddy dropSystemPrompt out of a boxed row into a footer icon
  toggle so the provider-specific control does not stretch the card.
- Drop every per-section rounded border / tinted background. The card
  is one surface; only the footer keeps a top separator.
- Remove the fixed min-h-[280px] so the card takes its natural height,
  and slim AccountCardSkeleton to match the new layout (one strip, one
  quota block, one footer row).
- Merge the last-checkin label and auto-checkin switch into the runtime
  meter row so the card body is two lines (runtime + quota) instead of
  three. This removes the dead space between quota and checkin rows.
- Drop the unused checkinTimezone prop from AccountCard (EditAccountModal
  still consumes its own copy).
- Shrink Card.Content gap from 8px to 6px to match the tighter layout.
The mono stats line was visual noise — operators tune priority through
the edit modal and don't need the trio pinned on every card. The footer
now leads with the action icons only.
The previous one-line merge squeezed the runtime meter on narrow cards
(vertical "运行状态" wrap, collapsed segments). Revert to three clean
rows: runtime strip, last-checkin label, quota. The auto-checkin switch
and schedule time move into the footer next to the enabled switch, so
the toggle lives with the other operator controls instead of floating
in the body.
- Bump QuotaMeter from size=sm (4px) to size=md (8px) so the quota bar
  reads as a primary visual, matching the runtime strip weight.
- Add flex-nowrap + whitespace-nowrap to the footer's ml-auto block so
  the daily checkin label, schedule time, and switch stay on one line
  instead of wrapping onto separate rows.
- Remove the standalone "额度" Label so long unit strings (Trae's
  "entitlement_pack") no longer squeeze the meter into wrapping.
- On-card text collapses to a mono `已用 X / Y` short form; unit,
  remaining, add-on, and resource-package lines move into a Tooltip
  on hover so Trae cards stop overflowing.
- Override .account-meter grid-template-areas since the label slot is
  now empty.
Align the quota block with the reference trae2api-web layout: remaining
credits become the prominent number (with the unit as a small suffix),
while used / total collapse into a secondary mono readout on the same
row. This matches how operators actually read the card — "how much do I
have left" first, "how much have I burned" second.
Cards without checkin support (e.g. Devin) used to sit next to cards
with it (e.g. WorkBuddy) and the extra "last checkin" line pushed the
quota meter down, so the bars across cards did not line up. The checkin
row now lives as a slim strip directly above the footer action row;
Card.Content is always runtime + quota, so quota bars align across
cards regardless of provider.
Add the explicit "自动签到" / "auto checkin" label next to the schedule
time and switch so the right-hand cluster reads as one coherent unit
(last checkin on the left, auto-checkin control on the right).
Add providers.ResolvedChat so adapters can surface the clamped reasoning
level they actually sent upstream. ChatOutcome carries ReasoningLevel for
non-stream calls; ChatStream returns ResolvedChat alongside the response.

Executor logs the client-requested level once in Prepare and the resolved
level per successful attempt, so failover retries show one entry plus one
line per attempt.

Qoder surfaces the normalized client value because the worker applies its
own model policy; devin returns empty since it does not accept a reasoning
knob.
Keep the switch and explanation in create and edit only.
Persist both levels on request_logs, show one value when they match,
and use a light arrow when the upstream clamp differs.
Trae CN now declares check-in, so system settings may store its default time.
@caigee-cmd
caigee-cmd merged commit eeb0276 into main Sep 19, 2026
11 of 12 checks passed
@caigee-cmd
caigee-cmd deleted the feat/provider-checkin branch September 19, 2026 15:02
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