feat: unify provider check-in (WorkBuddy / Qoder CN / Trae CN) - #200
Merged
Merged
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
把签到从「WorkBuddy 专属」重构成「provider 通用能力」,并接入 Trae CN Work(参考 connectedGraph/trae2api-web 的
checkin_credits协议)。providers.CheckinPolicy/AccountCheckiner/CheckinResult:所有 provider 走同一个签到接口,runtime 用一条调度器按本地时间批量触发。accounts新增auto_checkin/checkin_time,并把 workbuddy 旧列数据迁移过来;新建账号不再写 workbuddy-only 列。DailyCheckin挂到AccountCheckiner。/admin/checkinendpoint,client 侧Client.Checkin通过 admin HTTP 调用。真实账号验收仍待完成。api.trae.cn的checkin_credits/status+checkin_credits/claim签到。credential()自动刷新过期 access token。Status="already";KindAuth→ 让 manager 走 re-login;disabled 时Status="skipped"。Checkin,region descriptor 挂Asia/Shanghai。requested → resolved。Test plan
go test ./internal/store ./internal/executor ./internal/gatewayfrontend && npm run synccli2api:checkin-dev以当前代码重建并 healthyRef
docs/PROVIDERS_TRAE_SOLO.md— Trae 协议事实docs/REFACTORING.md— 包边界基线