dsh-codearts-dock 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -46,19 +46,25 @@ window.__ModuleLoader__.load({
46
46
  const NAV_ICON = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAhdUlEQVR42l2aeZxcV3Xnzzn3bbV1VXf13upF6m5trcWWtRjjTdgWtsEmhhAGh8SEkAyBEMgwmSWQTCAZ+GRnkhD4AMnABAJxAAMONuANIS+yLNval5ZaavVSvVR3117v1XvvnjN/vKqWE/3Rn1JVvXr3nPs7y7vni/19NwGICAsoRADNgsLMCACCQggCAkKEAMwM0T9EAgARJkSFCgBYBAUUACOACCAiIgCIAIAAAAgCEBEIMJESYWZGImBGIAFCRARCAEFARGQEAIheg4p+DQEFSIABEEAQydBhEF0DIAAULY8AAIFBRCRaiAgjAiJEPwQIwoKIikhYAAABEJGFARCJRJrXNlcPACggzAJEyKwBgIiYGREFAEQwWtR1oxEJQQAQAViEog8QBUCQEQgAwWCQyGXRl6F5CQJGa4j+t+5LiJYlIohAooS1RBvCAgjStA+i70h0zRtWhRCts/lTACAtjws234kuBRQRQCBgZAACIUQtjMCREQgkHBjRHYhIQEAYBRGRQYAFAIlAZP13MdpCECFEYGDRSECEIMLS3Ae47vOmGf/hNSIiRreTSIogICKEBAjYdCK2fqPpMgUYXRxpQEgEGEQo2noBEWEARhAAJgQiasoOoXVXBBFAoegtij4SAGEAIQSSaFHY9B5KtN/S1CgRUaSudRsZRSKnReYJEgAQIiESAAILIAKCFmbh5qZp5kALgIhQFB0ooIAo8jJi5IDIVYgqujEhggCiaq46sqEpTAACDcAokXVCKCKw7nJCIiKlkAix6RsREdRNSUWeRWrFAogIAkaSBogUj4AQNny7N5saH2HPB0SD13cKBAAJEIBaKYBEtAi3BAAAwMzNHWhJhRAFBBhQEKipDMAoSwCgiFAkP2ntUJSk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44hQi8AEJRQRBWFSE1UkTAmFCJGWgoZoUSURygYpQzwj00gAKkED+/e1amGEkZVTNPM+AiCDRJgAgGBJxhRL15xGxKetwaCswNCAKt6QlpEghAjNDC68FBITwOrGGIhhBVLiuyXUgQJoIgyAQCTJwC55sjqvXrVCkpDW6hmYct74gACAGiKCs26DWQaZWqRZhZBASFfUab6A517MWIBGAoBgt9ra10UCt1a+jsCwABAQtqIqagAa2eNqIAYWW1rHJLbdoxuiN1kqUQU2XRXuCCCgoLb4MmSMsSCLO9w24Ir4h4lusLVATWxUBQGpCf/BGUI0izhEirkRhC0qG1nN6FFtIhIItyyliIQWbwFzUjAIiABpNthARgBENAUHQkYmtZNrihaQJgq/TsNLiYNcl18zTTT1whGW0dlwQkEAhEBCLAAsrpEgT0CxUEctIIE0T1xFlQoowiJZcKdKi0QTjmngEgTAyRai3NDEsWWdE5d+n2nXW8TomjU0Se/1TaW5OM8s2gV5QIgwi0AIwI9QKQSlUQE3CNGKkKSKUERFI1p8EsJn5qYXdCmALLEMSMpCQcB3/aAYRvCG1NW0QaFGb1wHbN+p+3VQERS1IXkQAmVqHkgiEgAqVodT1CI4YNkBEFYFtEReP0cqay4b/D2MSdw2tNvuhAAAAAElFTkSuQmCC'
47
47
 
48
48
  /** Localisation text, with an English fallback per key. */
49
- const balanceDismissals = new Map()
50
-
51
49
  const STRINGS = {
50
+ 'time.justNow': ['刚刚', 'Just now'],
51
+ 'time.minutesAgo': ['{count} 分钟前', '{count} min ago'],
52
+ 'time.hoursAgo': ['{count} 小时前', '{count} hr ago'],
53
+ 'time.daysAgo': ['{count} 天前', '{count} days ago'],
54
+ 'health.details': ['查看异常详情', 'View error details'],
55
+ 'presets.saveAs': ['保存为预设', 'Save as preset'],
56
+ 'presets.details': ['配置详情', 'Configuration details'],
57
+ 'backup.mode': ['备份操作', 'Backup action'],
58
+ 'backup.encrypt': ['加密备份', 'Encrypt backup'],
59
+ 'backup.encryptionRequired': ['含账号凭证,必须加密。', 'Credentials require encryption.'],
60
+ 'backup.paste': ['粘贴 JSON(高级)', 'Paste JSON (advanced)'],
61
+ 'backup.selected': ['已选择:{name}', 'Selected: {name}'],
62
+ 'backup.encrypted': ['加密备份', 'Encrypted backup'],
63
+ 'backup.plain': ['未加密备份', 'Unencrypted backup'],
64
+ 'backup.importHint': ['选择备份文件,再预览将恢复的配置。', 'Choose a backup file, then preview the changes.'],
65
+ 'backup.pasted': ['已粘贴备份内容', 'Backup contents pasted'],
52
66
  'health.updateHint': ['更新「{name}」:填写同一个 AK 和新的 SK,将更新已有账号。', 'Update {name}: enter the same AK and the new SK to update the existing account.'],
53
67
  "features.saved": ["已保存", "Saved"],
54
- "features.refresh": ["刷新", "Refresh"],
55
- "reminder.title": ["余额提醒", "Balance alerts"],
56
- "reminder.enabled": ["启用低余额提醒", "Enable low-balance alerts"],
57
- "reminder.threshold": ["提醒阈值(积分)", "Alert threshold (credits)"],
58
- "reminder.hint": ["低于阈值时积分胶囊变色。可用备用账号会在面板中列出,提醒可暂时忽略。", "The credit chip changes color below this threshold. Available backup accounts appear in the panel; alerts can be dismissed."],
59
- "reminder.low": ["当前账号余额偏低", "The current account has a low balance"],
60
- "reminder.backups": ["可用备用账号:{count} 个", "Available backup accounts: {count}"],
61
- "reminder.dismiss": ["暂时忽略", "Dismiss for now"],
62
68
  "health.available": ["可用", "Available"],
63
69
  "health.insufficient": ["余额不足", "Insufficient credits"],
64
70
  "health.credentials": ["凭证失效或权限不足", "Invalid credentials or permissions"],
@@ -88,10 +94,10 @@ window.__ModuleLoader__.load({
88
94
  "presets.noModels": ["这套预设没有可用模型", "No available models for this preset"],
89
95
  "presets.missing": ["部分模型已不在当前目录中,应用时只保留可用模型。", "Some models are no longer in the catalog; only available models will be applied."],
90
96
  "backup.title": ["配置备份与迁移", "Configuration backup and migration"],
91
- "backup.hint": ["包含模型选择、能力开关、推理强度、预设和提醒偏好。账号凭证可选,勾选后必须设置密码加密。", "Includes model selection, capabilities, reasoning, presets and alert preferences. Credentials are optional and require password encryption."],
97
+ "backup.hint": ["包含模型选择、能力开关、推理强度、预设和其他偏好。账号凭证可选,勾选后必须设置密码加密。", "Includes model selection, capabilities, reasoning, presets and other preferences. Credentials are optional and require password encryption."],
92
98
  "backup.export": ["导出配置", "Export configuration"],
93
99
  "backup.include": ["包含账号凭证(AK/SK)", "Include account credentials (AK/SK)"],
94
- "backup.exportPassword": ["加密密码(不含凭证时可留空)", "Encryption password (optional without credentials)"],
100
+ "backup.exportPassword": ["加密密码", "Encryption password"],
95
101
  "backup.confirmPassword": ["确认加密密码", "Confirm encryption password"],
96
102
  "backup.passwordHint": ["密码至少 8 位,两次输入需一致。请妥善保存密码。", "Use at least 8 characters and matching passwords. Keep the password safe."],
97
103
  "backup.download": ["下载备份", "Download backup"],
@@ -99,37 +105,15 @@ window.__ModuleLoader__.load({
99
105
  "backup.restore": ["恢复配置", "Restore configuration"],
100
106
  "backup.choose": ["选择备份文件", "Choose backup file"],
101
107
  "backup.content": ["备份内容(也可粘贴 JSON)", "Backup contents (or paste JSON)"],
102
- "backup.importPassword": ["解密密码(未加密文件可留空)", "Decryption password (blank for unencrypted files)"],
108
+ "backup.importPassword": ["解密密码", "Decryption password"],
103
109
  "backup.preview": ["读取并预览", "Read and preview"],
104
110
  "backup.summary": ["将更新 {settings} 项配置,新增 {added} 个账号,更新 {updated} 个账号。", "Updates {settings} settings, adds {added} accounts and updates {updated} accounts."],
105
- "backup.mergeHint": ["配置将以备份为准;账号按 AK 合并,不移除现有账号。自动签到开关也会随配置恢复。", "Settings follow the backup; accounts merge by AK without removing existing accounts. The auto-check-in preference is restored too."],
111
+ "backup.mergeHint": ["配置将以备份为准;账号按 AK 合并,不移除现有账号。", "Settings follow the backup; accounts merge by AK without removing existing accounts."],
106
112
  "backup.changes": ["查看将恢复的配置", "View settings to restore"],
107
113
  "backup.confirm": ["确认恢复", "Confirm restore"],
108
114
  "backup.restored": ["配置已恢复,新增 {added} 个账号,更新 {updated} 个账号。", "Restored; {added} accounts added and {updated} updated."],
109
115
  "backup.failed": ["备份操作失败", "Backup operation failed"],
110
116
  "backup.tooLarge": ["备份文件过大(最大 768 KB)", "Backup is too large (maximum 768 KB)"],
111
- "tab.usage": ["用量", "Usage"],
112
- "usage.title": ["本机用量记录", "Local usage history"],
113
- "usage.enabled": ["记录最近 200 次请求", "Record the latest 200 requests"],
114
- "usage.hint": ["仅保存在本机:模型、时间、耗时、Token 和结果。不记录对话、工具参数或凭证;关闭后停止记录,历史可清空。每次重试单独计数;不估算积分账单。", "Stored locally: model, time, duration, tokens and result. No conversations, tool arguments or credentials. Disable to stop recording or clear history. Retries count separately; credit charges are not estimated."],
115
- "usage.clear": ["清空记录", "Clear history"],
116
- "usage.clearConfirm": ["清空本机用量记录?此操作无法撤销。", "Clear local usage history? This cannot be undone."],
117
- "usage.cleared": ["用量记录已清空", "Usage history cleared"],
118
- "usage.today": ["今日请求(已保留记录)", "Today (retained records)"],
119
- "usage.successRate": ["今日成功率(不含取消)", "Today’s success rate (excluding cancellations)"],
120
- "usage.tokens": ["今日已上报 Token", "Today’s reported tokens"],
121
- "usage.search": ["按模型搜索记录", "Search records by model"],
122
- "usage.result": ["结果", "Result"],
123
- "usage.all": ["全部结果", "All results"],
124
- "usage.success": ["成功", "Success"],
125
- "usage.error": ["失败", "Failed"],
126
- "usage.aborted": ["已取消", "Cancelled"],
127
- "usage.time": ["时间", "Time"],
128
- "usage.model": ["模型", "Model"],
129
- "usage.duration": ["耗时", "Duration"],
130
- "usage.input": ["输入 Token", "Input tokens"],
131
- "usage.output": ["输出 Token", "Output tokens"],
132
- "usage.empty": ["暂无符合条件的记录", "No matching records"],
133
117
 
134
118
  'meta.title': ['码道连接器', 'CodeArts connector'],
135
119
  'meta.description': [
@@ -153,8 +137,17 @@ window.__ModuleLoader__.load({
153
137
  'models.noMatches': ['没有符合条件的模型', 'No matching models'],
154
138
  'models.clearFilters': ['清除筛选', 'Clear filters'],
155
139
  'models.about': ['目录说明与使用帮助', 'About the catalog'],
156
- 'models.clean': ['所有修改已保存', 'All changes saved'],
157
- 'models.unsaved': ['有未保存的修改', 'Unsaved changes'],
140
+ 'models.clean': ['模型配置已保存', 'Model settings saved'],
141
+ 'models.saveHint': ['置顶即时保存;启用、能力开关和推理强度需点击「保存模型配置」。', 'Pins save immediately. Save model settings to apply selection, capability and reasoning changes.'],
142
+ 'credit.lastResult': ['上次结果', 'Last result'],
143
+ 'credit.updated': ['积分更新时间', 'Credits updated'],
144
+ 'credit.refreshFailed': ['积分刷新失败,显示上次结果', 'Credits refresh failed; showing the last result'],
145
+ 'credit.unavailable': ['积分暂时无法读取,请重试', 'Credits are unavailable; please retry'],
146
+ 'chip.lastCredits': ['上次积分', 'Last credits'],
147
+ 'models.pin': ['置顶 {model}', 'Pin {model}'],
148
+ 'models.unpin': ['取消置顶 {model}', 'Unpin {model}'],
149
+ 'models.favoriteSaved': ['常用置顶已保存', 'Pinned models saved'],
150
+ 'models.unsaved': ['有未保存的模型配置', 'Unsaved model settings'],
158
151
  'models.needOne': ['请至少启用一个模型后保存', 'Enable at least one model to save'],
159
152
  'diag.details': ['技术详情', 'Technical details'],
160
153
  'diag.copy': ['复制脱敏诊断信息', 'Copy redacted diagnostics'],
@@ -235,7 +228,7 @@ window.__ModuleLoader__.load({
235
228
  'models.refreshed': ['已从上游重读模型目录', 'Catalog re-read from upstream'],
236
229
  'models.saved': ['已保存,模型选择器已更新', 'Saved; the model picker has been updated'],
237
230
  'models.savedReloadFailed': ['已保存,暂时无法重读模型目录。', 'Saved, but the catalog could not be reloaded.'],
238
- 'models.save': ['保存', 'Save'],
231
+ 'models.save': ['保存模型配置', 'Save model settings'],
239
232
  'models.discard': ['放弃修改', 'Discard'],
240
233
  'models.saveFailed': ['保存失败', 'Save failed'],
241
234
  'models.dirty': ['未保存', 'unsaved'],
@@ -297,6 +290,9 @@ window.__ModuleLoader__.load({
297
290
  'pool.renamePlaceholder': ['例如:个人 / 公司', 'e.g. personal / work'],
298
291
  'pool.renameFailed': ['改备注失败', 'Rename failed'],
299
292
  'pool.use': ['切换', 'Use'],
293
+ 'pool.switching': ['正在切换…', 'Switching…'],
294
+ 'pool.switched': ['已切换到「{account}」', 'Switched to {account}'],
295
+ 'pool.switchFailed': ['切换到「{account}」失败:{error}', 'Could not switch to {account}: {error}'],
300
296
  'pool.remove': ['移除', 'Remove'],
301
297
  'pool.removeConfirm': [
302
298
  '移除这个账号?它保存的 AK/SK 会从本机删除。',
@@ -336,7 +332,7 @@ window.__ModuleLoader__.load({
336
332
  'pool.added': ['已添加账号', 'Account added'],
337
333
  'pool.updated': ['已更新该账号的密钥', 'That account was updated'],
338
334
  'pool.importing': ['导入中…', 'Importing…'],
339
- 'pool.previewTotal': ['这个文件里有 {total} 个账号,确认后写入:', 'This file holds {total} accounts; confirm to write them:'],
335
+ 'pool.previewTotal': ['将导入以下 {count} 个账号,确认后写入:', 'The following {count} accounts will be imported after confirmation:'],
340
336
  'pool.importConfirm': ['导入 {count} 个', 'Import {count}'],
341
337
  'pool.cancel': ['取消', 'Cancel'],
342
338
  'pool.exportFailed': ['导出失败', 'Export failed'],
@@ -346,18 +342,12 @@ window.__ModuleLoader__.load({
346
342
  'pool.checkinDone': ['今日已签', 'Checked in'],
347
343
  'pool.checkinUnavailable': ['不可领取', 'Unavailable'],
348
344
  'pool.checkinNone': ['无活动', 'No campaign'],
349
- 'pool.autoTitle': ['每日自动签到', 'Daily auto check-in'],
350
345
  'pool.checkinAll': ['一键签到', 'Check in now'],
351
- 'pool.checkinAllHint': ['立刻为所有可签到的账号领取一次(不改变上面的每日开关)', 'Claim once for every account that can right now (the daily switch above is left as it is)'],
346
+ 'pool.checkinAllHint': ['立刻为所有可签到的账号领取一次', 'Claim once for every eligible account'],
352
347
  'pool.checkinClaiming': ['签到中…', 'Claiming…'],
353
348
  'pool.checkinNoneToday': ['今天已没有可领取的签到', 'Nothing left to claim today'],
354
349
  'pool.checkinResult': ['{claimed} 个账号已签到,{failed} 个失败', '{claimed} claimed, {failed} failed'],
355
350
  'pool.checkinFailed': ['签到失败', 'Check-in failed'],
356
- 'pool.autoToday': ['今天 {done}/{total}', '{done}/{total} today'],
357
- 'pool.autoRun': ['立刻签到一次', 'Check in now'],
358
- 'pool.autoRunning': ['签到中…', 'Checking in…'],
359
- 'pool.autoOff': ['已关闭', 'Off'],
360
- 'pool.result': ['{claimed} 个账号签到了,{failed} 个失败', '{claimed} checked in, {failed} failed'],
361
351
  'chip.loading': ['读取中…', 'Reading…'],
362
352
  'chip.credits': ['积分', 'credits'],
363
353
  'chip.panelTitle': ['码道账号与积分', 'CodeArts accounts and credits'],
@@ -439,6 +429,54 @@ window.__ModuleLoader__.load({
439
429
  }
440
430
  }
441
431
 
432
+ /** Relative labels stay short; the full local timestamp remains in the title. */
433
+ function relativeTime(ms, now = Date.now()) {
434
+ if (!Number.isFinite(ms) || ms <= 0) return '—'
435
+ const minutes = Math.floor(Math.max(0, now - ms) / 60000)
436
+ if (minutes < 1) return t('time.justNow')
437
+ if (minutes < 60) return t('time.minutesAgo').replace('{count}', minutes)
438
+ if (minutes < 1440) return t('time.hoursAgo').replace('{count}', Math.floor(minutes / 60))
439
+ return t('time.daysAgo').replace('{count}', Math.floor(minutes / 1440))
440
+ }
441
+
442
+ /** Keep only the last successful value for the same credential identity. */
443
+ function keepCredit(previous, next) {
444
+ if (!next) return next
445
+ if (next.credit && Number.isFinite(next.credit.remain)) {
446
+ return { ...next, creditCheckedAt: next.creditCheckedAt ?? Date.now(), creditStale: false }
447
+ }
448
+ const identity = (value) => value?.creditIdentity ?? value?.id ?? value?.accountId ?? value?.source
449
+ const key = identity(next)
450
+ if (key && key === identity(previous) && previous.credit) {
451
+ return { ...next, credit: previous.credit, creditCheckedAt: previous.creditCheckedAt, creditStale: true }
452
+ }
453
+ return { ...next, credit: null, creditCheckedAt: null, creditStale: false }
454
+ }
455
+
456
+ function mergeCredits(path, previous, next) {
457
+ if (path === '/account') return keepCredit(previous, next)
458
+ if (path === '/accounts') {
459
+ const old = new Map((previous?.accounts ?? []).map((account) => [account.id, account]))
460
+ return { ...next, accounts: (next.accounts ?? []).map((account) => keepCredit(old.get(account.id), account)) }
461
+ }
462
+ return next
463
+ }
464
+
465
+ function staleCredits(path, previous) {
466
+ if (!previous) return previous
467
+ if (path === '/account') return { ...previous, creditStale: !!previous.credit }
468
+ if (path === '/accounts') return { ...previous, accounts: previous.accounts.map((account) => ({ ...account, creditStale: !!account.credit })) }
469
+ return previous
470
+ }
471
+
472
+ function CreditStatus({ account, now = Date.now() }) {
473
+ if (!account?.creditStale) return null
474
+ return h('span', { className: 'dca-credit-status', title: t('credit.refreshFailed') },
475
+ t('credit.lastResult'),
476
+ account.creditCheckedAt ? h('time', { dateTime: new Date(account.creditCheckedAt).toISOString(), title: `${t('credit.updated')} ${formatTime(account.creditCheckedAt)}` }, ` · ${relativeTime(account.creditCheckedAt, now)}`) : null,
477
+ )
478
+ }
479
+
442
480
  /**
443
481
  * Render a credit balance.
444
482
  *
@@ -489,7 +527,8 @@ window.__ModuleLoader__.load({
489
527
  .dca-page,.dca-page *{box-sizing:border-box}
490
528
 
491
529
  /* ---- shared shell ------------------------------------------------------ */
492
- .dca-page{display:flex;flex-direction:column;gap:18px;color:var(--dsw-alias-label-primary,#e6e6e6);font-size:13px;line-height:1.6}
530
+ .dca-settings{container:dca-settings / inline-size;width:100%;min-width:0;max-width:100%}
531
+ .dca-page{min-width:0;max-width:100%;display:flex;flex-direction:column;gap:18px;color:var(--dsw-alias-label-primary,#e6e6e6);font-size:13px;line-height:1.6}
493
532
  .dca-head{display:flex;flex-direction:column;gap:4px}
494
533
  .dca-title{margin:0;font-size:16px;font-weight:500;line-height:24px}
495
534
  .dca-hint{margin:0;color:var(--dsw-alias-label-tertiary,#999);font-size:12px;line-height:18px}
@@ -498,9 +537,7 @@ window.__ModuleLoader__.load({
498
537
  border:1px solid var(--dsw-alias-border-l2,#36373b);
499
538
  border-radius:12px;background:var(--dsw-alias-bg-layer-3,#202126);
500
539
  padding:14px 16px;display:flex;flex-direction:column;gap:12px;
501
- transition:border-color .16s;
502
540
  }
503
- .dca-card:hover{border-color:var(--dsw-alias-label-dimmed,#777)}
504
541
 
505
542
  /* ---- account pool rows ------------------------------------------------
506
543
  One row per account, two lines each: identity on the first, what the account
@@ -543,6 +580,7 @@ window.__ModuleLoader__.load({
543
580
  min-width:0;overflow-wrap:anywhere;
544
581
  }
545
582
  .dca-pool-credits-row{
583
+ grid-area:credits;
546
584
  display:flex;flex-direction:row;flex-wrap:wrap;align-items:baseline;
547
585
  justify-content:flex-end;gap:0 6px;min-width:0;
548
586
  justify-self:end;text-align:right;font-variant-numeric:tabular-nums;
@@ -581,46 +619,11 @@ window.__ModuleLoader__.load({
581
619
  list-style:none;margin:0 0 8px;padding:0;
582
620
  max-height:180px;overflow-y:auto;
583
621
  }
584
- .dca-transfer-list label{
585
- display:flex;align-items:center;gap:6px;
622
+ .dca-transfer-list li{
586
623
  font-size:12px;color:var(--dsw-alias-label-primary,#e8e9ed);
587
- cursor:pointer;padding:2px 0;
624
+ padding:2px 0;overflow-wrap:anywhere;
588
625
  }
589
- .dca-transfer-list input[type="checkbox"]{flex:none;accent-color:var(--dsw-alias-brand-primary,#5686fe)}
590
626
  .dca-transfer-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap}
591
- /* The pool switches: a 38x22 track with a 16px knob that slides 16px. The input
592
- itself is present but invisible — it keeps the accessible role, the keyboard
593
- handling and the checked state, while the track and knob are drawn here. */
594
- .dca-sw{position:relative;display:inline-block;width:38px;height:22px;flex:none;cursor:pointer}
595
- .dca-sw input{position:absolute;opacity:0;width:0;height:0}
596
- .dca-sw-track{position:absolute;inset:0;border-radius:999px;background:var(--dsw-alias-border-l2,#3a3d45);transition:background .18s}
597
- .dca-sw-track::after{
598
- content:"";position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;
599
- background:#fff;transition:transform .18s;box-shadow:0 1px 3px rgba(0,0,0,.3);
600
- }
601
- .dca-sw input:checked + .dca-sw-track{background:var(--dsw-alias-brand-primary,#5686fe)}
602
- .dca-sw input:checked + .dca-sw-track::after{transform:translateX(16px)}
603
- .dca-sw input:disabled + .dca-sw-track{opacity:.4}
604
- .dca-sw input:focus-visible + .dca-sw-track{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:2px}
605
-
606
- .dca-modebar-label{font-size:13px;font-weight:600;line-height:20px}
607
-
608
- /* A plain row: no card, no border, no inset padding. It used to carry the
609
- padding and hairline of the card that wrapped it, and with the card gone those
610
- would leave a control floating under a stray rule. */
611
- .dca-switchrow{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
612
- /* The one-off claim is pushed to the row's end: the switch and its label are the
613
- preference on the left, the action on the right. */
614
- .dca-checkin-now{margin-inline-start:auto}
615
- .dca-switchrow input[type="checkbox"]{
616
- margin:0;flex:none;width:16px;height:16px;
617
- accent-color:var(--dsw-alias-brand-primary,#5686fe);
618
- cursor:pointer;
619
- }
620
- .dca-switchrow label{font-weight:600;font-size:13px;line-height:20px;cursor:pointer}
621
-
622
- /* A dashed strip for secondary tools: "these are utilities, not the table". */
623
-
624
627
  /* ---- model rows -------------------------------------------------------
625
628
  Line one: enable box, name, ratio, flags on the left; the row's own switches
626
629
  on the right. Line two: facts, indented to the name (22px = the box plus its
@@ -737,7 +740,7 @@ window.__ModuleLoader__.load({
737
740
  bg-layer-2, its facts on one 11px meta line, exactly like the reference. */
738
741
  /* One bordered box; its first and last rows receive their own corner radii so
739
742
  contextual row menus can extend beyond the table without being clipped. */
740
- .dca-model-page{min-height:100%;padding-bottom:60px}
743
+ .dca-model-page{min-height:100%;padding-bottom:60px;gap:12px}
741
744
  .dca-models{
742
745
  display:flex;flex-direction:column;
743
746
  border:1px solid var(--dsw-alias-border-l2,#36373b);
@@ -782,7 +785,7 @@ window.__ModuleLoader__.load({
782
785
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
783
786
  min-width:0;
784
787
  }
785
- .dca-model-name b{font-size:13px;font-weight:500}
788
+ .dca-model-name b{font-size:13px;font-weight:500;min-width:0;overflow:hidden;text-overflow:ellipsis}
786
789
  .dca-effort{display:inline-flex;align-items:center;gap:5px;cursor:pointer}
787
790
  /* A quiet pill, not a boxed form control: the row already carries two checkboxes,
788
791
  and a third bordered control would make a settings table look like a form. */
@@ -850,17 +853,17 @@ window.__ModuleLoader__.load({
850
853
  Not a <table> — the columns reflow to two lines on a narrow panel, which a
851
854
  table cannot do. */
852
855
  .dca-pool-table{
853
- box-sizing:border-box;container-type:inline-size;
856
+ box-sizing:border-box;
854
857
  border:1px solid var(--dsw-alias-border-l2,#3a3d45);
855
858
  border-radius:12px;
856
859
  background:var(--dsw-alias-bg-layer-2,#24262c);
857
860
  }
858
861
  .dca-pool-row{
859
862
  display:grid;
860
- grid-template-columns:minmax(0,1fr) minmax(0,auto) 160px;
863
+ grid-template-columns:minmax(0,1fr) minmax(140px,auto);
861
864
  grid-template-areas:
862
- "account account credits"
863
- "probe probe actions";
865
+ "account credits"
866
+ "probe actions";
864
867
  column-gap:12px;row-gap:4px;align-items:center;
865
868
  padding:10px 14px;
866
869
  border-top:1px solid var(--dsw-alias-border-l1,#2c2d31);
@@ -896,7 +899,7 @@ window.__ModuleLoader__.load({
896
899
  .dca-pool-card-title{margin:0;font-size:13px;font-weight:600;line-height:20px}
897
900
 
898
901
  .dca-pool-sub{display:block;font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary,#999)}
899
- .dca-pool-actions{display:flex;gap:6px;justify-content:flex-end;align-items:center}
902
+ .dca-pool-actions{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-end;align-items:center}
900
903
  .dca-btn-xs{
901
904
  box-sizing:border-box;appearance:none;font:inherit;font-size:12px;line-height:20px;font-weight:500;
902
905
  padding:3px 10px;border-radius:8px;cursor:pointer;white-space:nowrap;
@@ -932,8 +935,9 @@ window.__ModuleLoader__.load({
932
935
  .dca-model-meta{color:var(--dsw-alias-label-secondary,#b6b8be)}
933
936
  .dca-model-off .dca-model-controls,.dca-model-off .dca-effort{color:var(--dsw-alias-label-secondary,#b6b8be)}
934
937
  .dca-model-controls input:disabled,.dca-effort-select:disabled{opacity:.75}
935
- .dca-save-status{flex:1 1 180px;min-width:0;font-size:12px;color:var(--dsw-alias-label-secondary,#c6c9d0)}
936
- .dca-save-status-error{color:var(--dsw-alias-state-error-primary,#ef4444)}
938
+ .dca-save-feedback{display:flex;flex-direction:column;gap:4px;flex:1 1 180px;min-width:0;overflow-wrap:anywhere}
939
+ .dca-save-status{font-size:12px;color:var(--dsw-alias-label-secondary,#c6c9d0)}
940
+ .dca-pool-feedback{grid-column:1 / -1;min-width:0;overflow-wrap:anywhere}
937
941
  .dca-empty{padding:24px 16px;display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center}
938
942
  .dca-details > summary{cursor:pointer;font-size:12px;color:var(--dsw-alias-label-secondary,#c6c9d0);border-radius:4px}
939
943
  .dca-details[open] > summary{margin-bottom:12px}
@@ -960,8 +964,11 @@ window.__ModuleLoader__.load({
960
964
  .dca-summary-item p{overflow-wrap:anywhere}
961
965
  .dca-section-error{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
962
966
  .dca-section-error .dca-msg{flex:1;min-width:0}
963
- @media(max-width:640px){
967
+ @container dca-settings (max-width:640px){
964
968
  .dca-model-head{align-items:flex-start;gap:10px}
969
+ .dca-model-controls{flex:1 1 100%}
970
+ .dca-toolbar .dca-search{flex-basis:100%}
971
+ .dca-pool-col-actions{max-width:100%}
965
972
  .dca-model-controls{justify-content:flex-start;padding-inline-start:24px}
966
973
  .dca-model-actions{gap:8px}
967
974
  .dca-model-actions-buttons{margin-inline-start:auto}
@@ -969,19 +976,43 @@ window.__ModuleLoader__.load({
969
976
  .dca-pool-row{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"account credits" "probe actions";padding:10px}
970
977
  }
971
978
 
979
+ @container dca-settings (max-width:420px){
980
+ .dca-pool-row{grid-template-columns:minmax(0,1fr) minmax(60px,auto);grid-template-areas:"account credits" "probe probe" "actions actions";row-gap:8px}
981
+ .dca-pool-col-actions{justify-self:stretch}
982
+ .dca-pool-actions{justify-content:flex-start}
983
+ .dca-pool-row-head .dca-pool-col-actions{display:none}
984
+ .dca-pool-account-row{gap:4px 8px}
985
+ .dca-model-name{white-space:normal;flex-wrap:wrap;overflow-wrap:anywhere}
986
+ .dca-model-actions-buttons{width:100%}
987
+ .dca-form-field{max-width:100%}
988
+ .dca-preset-tools .dca-preset-row > .dca-input{flex-basis:100%}
989
+ }
990
+ .dca-pin{appearance:none;display:inline-flex;align-items:center;justify-content:center;flex:none;width:28px;height:28px;padding:4px;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--dsw-alias-label-tertiary,#999);cursor:pointer}
991
+ .dca-pin:hover{background:var(--dsw-alias-bg-layer-3,#202126);color:var(--dsw-alias-label-primary,#e6e6e6)}
992
+ .dca-pin-on{color:var(--dsw-alias-brand-primary,#5686fe)}
993
+ .dca-pin:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:2px}
994
+ .dca-pin:disabled{opacity:.5;cursor:default}
995
+ .dca-credit-status{display:block;flex-basis:100%;font-size:11px;line-height:16px;color:var(--dsw-alias-state-warn-primary,#d49937)}
996
+ .dca-pop-notice{margin:6px 0;font-size:12px;line-height:18px;color:var(--dsw-alias-state-warn-primary,#d49937)}
997
+ .dca-account-credits{font-size:16px;font-weight:600;line-height:22px}
998
+ .dca-account-error{max-width:100%;font-size:12px}
999
+ .dca-account-error > summary{color:var(--dsw-alias-state-error-primary,#ef4444)}
1000
+ .dca-account-error p{margin:6px 0 0;padding:8px 10px;border-inline-start:2px solid currentColor;overflow-wrap:anywhere;color:var(--dsw-alias-label-secondary,#b6b8be)}
1001
+ .dca-capability-filters{display:flex;align-items:center;gap:8px 14px;flex-wrap:wrap;font-size:12px}
1002
+ .dca-capability-filters label{cursor:pointer;min-height:28px}
1003
+ .dca-mode-switch{display:flex;flex-wrap:wrap;gap:4px;padding:4px;border-radius:9px;background:var(--dsw-alias-bg-layer-1,#17181b)}
1004
+ .dca-mode-switch .dca-filter{flex:1;min-height:32px}
1005
+ .dca-file-state{display:flex;flex-direction:column;gap:4px;font-size:12px;overflow-wrap:anywhere}
1006
+ .dca-feature-stack.dca-backup-form{padding-top:0}
1007
+ .dca-preset-tools{display:flex;flex-direction:column;gap:10px;min-width:0}
1008
+ .dca-pop-dot-warn{background:var(--dsw-alias-state-warn-primary,#d49937)}
1009
+
972
1010
  .dca-feature-stack{display:flex;flex-direction:column;gap:12px;min-width:0;padding-top:12px}
973
1011
  .dca-feature-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(210px,100%),1fr));gap:12px}
974
1012
  .dca-subtitle{font-size:13px;font-weight:600;margin:0}
975
1013
  .dca-preview-box{border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:8px;padding:12px;max-width:100%;overflow-wrap:anywhere}
976
1014
  .dca-health{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:11px;color:var(--dsw-alias-label-secondary,#b6b8be)}
977
1015
  .dca-health-bad{color:var(--dsw-alias-state-warn-primary,#d49937)}
978
- .dca-low-balance{color:var(--dsw-alias-state-warn-primary,#d49937)!important}
979
- .dca-balance-alert{padding:10px 12px;border:1px solid var(--dsw-alias-state-warn-primary,#d49937);border-radius:8px;font-size:12px;display:flex;flex-direction:column;gap:6px;overflow-wrap:anywhere}
980
- .dca-usage-table{overflow-x:auto;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:8px}
981
- .dca-usage-table table{width:100%;border-collapse:collapse;font-size:12px;text-align:left}
982
- .dca-usage-table th,.dca-usage-table td{padding:9px 10px;border-bottom:1px solid var(--dsw-alias-border-l2,#36373b);vertical-align:top;min-width:76px;overflow-wrap:anywhere}
983
- .dca-usage-table th{font-weight:500;color:var(--dsw-alias-label-secondary,#b6b8be)}
984
- .dca-usage-table tr:last-child td{border-bottom:0}
985
1016
  .dca-preset-preview{max-height:180px;overflow:auto;margin:0;padding-inline-start:20px}
986
1017
  .dca-preset-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
987
1018
  .dca-preset-row .dca-input{flex:1;min-width:min(180px,100%)}
@@ -1372,7 +1403,7 @@ window.__ModuleLoader__.load({
1372
1403
  h(
1373
1404
  'p',
1374
1405
  { className: 'dca-hint' },
1375
- t('pool.previewTotal').replace('{total}', preview.total),
1406
+ t('pool.previewTotal').replace('{count}', preview.accounts.length),
1376
1407
  ),
1377
1408
  h(
1378
1409
  'ul',
@@ -1381,13 +1412,7 @@ window.__ModuleLoader__.load({
1381
1412
  h(
1382
1413
  'li',
1383
1414
  { key: entry.index },
1384
- h(
1385
- 'label',
1386
- null,
1387
- h('input', { type: 'checkbox', checked: true, readOnly: true }),
1388
- ' ',
1389
- entry.label ?? entry.akMasked ?? `#${entry.index}`,
1390
- ),
1415
+ entry.label ?? entry.akMasked ?? `#${entry.index}`,
1391
1416
  ),
1392
1417
  ),
1393
1418
  ),
@@ -1423,20 +1448,16 @@ window.__ModuleLoader__.load({
1423
1448
  /**
1424
1449
  * The account pool.
1425
1450
  *
1426
- * Layout follows the reference card: a title row naming the account in use,
1427
- * the switch block above the table, then a two-line row per account, then
1428
- * the batch action. Check-in is ONE button for the whole table — never one
1429
- * control per account, which would make one daily bonus cost one click per
1430
- * account and report one outcome per account.
1451
+ * The header shows the account in use and one manual check-in action for
1452
+ * the whole pool. Two-line rows keep identity, balances and health aligned.
1431
1453
  */
1432
1454
  function AccountPool({
1433
1455
  pool,
1434
- busyId,
1456
+ rowAction,
1457
+ rowNotice,
1435
1458
  busy,
1436
1459
  onActivate,
1437
1460
  onRemove,
1438
- autoOn,
1439
- onToggleAuto,
1440
1461
  onCheckinAll,
1441
1462
  onRename,
1442
1463
  onExport,
@@ -1446,6 +1467,12 @@ window.__ModuleLoader__.load({
1446
1467
  /** Which row is being renamed, and its draft text. */
1447
1468
  const [editingId, setEditingId] = useState(null)
1448
1469
  const [draftLabel, setDraftLabel] = useState('')
1470
+ const [now, setNow] = useState(Date.now)
1471
+ useEffect(() => {
1472
+ const timer = setInterval(() => setNow(Date.now()), 30000)
1473
+ return () => clearInterval(timer)
1474
+ }, [])
1475
+
1449
1476
 
1450
1477
  const beginRename = useCallback((account) => {
1451
1478
  setEditingId(account.id)
@@ -1469,7 +1496,8 @@ window.__ModuleLoader__.load({
1469
1496
  await onRename(id, next)
1470
1497
  }, [draftLabel, onRename])
1471
1498
  const accounts = pool?.accounts ?? []
1472
- // `busy` is the KIND ('checkin' | 'auto' | null); most checks only care
1499
+ const busyId = rowAction?.id ?? null
1500
+ // `busy` is the KIND ('checkin' | 'test' | null); most checks only care
1473
1501
  // whether anything is running.
1474
1502
  const anyBusy = busy !== null && busy !== undefined && busy !== false
1475
1503
  // Something to claim right now? The button is disabled otherwise, so a
@@ -1493,38 +1521,13 @@ window.__ModuleLoader__.load({
1493
1521
  title: t('pool.exportHint'),
1494
1522
  }, t('pool.export')) : null,
1495
1523
  ),
1496
- ),
1497
-
1498
- // One switch, no card around it and no explanatory paragraph under it:
1499
- // the label says what it does, and the paragraph restated the same thing
1500
- // in a box that made a single control look like a section.
1501
- h(
1502
- 'div',
1503
- { className: 'dca-switchrow' },
1504
- h(
1505
- 'label',
1506
- { className: 'dca-sw' },
1507
- h('input', {
1508
- type: 'checkbox',
1509
- checked: autoOn === true,
1510
- disabled: anyBusy || busyId !== null,
1511
- 'aria-label': t('pool.autoTitle'),
1512
- onChange: () => onToggleAuto(autoOn !== true),
1513
- }),
1514
- h('span', { className: 'dca-sw-track' }),
1515
- ),
1516
- h('b', { className: 'dca-modebar-label' }, t('pool.autoTitle')),
1517
- // A one-off claim beside the standing switch, pushed to the row's end.
1518
- // The switch is a PREFERENCE and this is an ACTION: pressing it must
1519
- // claim now without opting anyone into daily automation, which is why
1520
- // it sends `now: true` rather than flipping `enabled`.
1521
1524
  accounts.length === 0
1522
1525
  ? null
1523
1526
  : h(
1524
1527
  'button',
1525
1528
  {
1526
1529
  type: 'button',
1527
- className: 'dca-btn dca-btn-xs dca-checkin-now',
1530
+ className: 'dca-btn dca-btn-xs',
1528
1531
  disabled: anyBusy || busyId !== null || !anyClaimable,
1529
1532
  title: anyClaimable
1530
1533
  ? t('pool.checkinAllHint')
@@ -1559,6 +1562,7 @@ window.__ModuleLoader__.load({
1559
1562
  {
1560
1563
  key: account.id,
1561
1564
  className: `dca-pool-row${account.active ? ' dca-pool-row-current' : ''}`,
1565
+ 'aria-busy': rowBusy,
1562
1566
  },
1563
1567
  h(
1564
1568
  'div',
@@ -1601,17 +1605,23 @@ window.__ModuleLoader__.load({
1601
1605
  { className: 'dca-pool-probe' },
1602
1606
  h('div', { className: `dca-health${account.health?.state && account.health.state !== 'available' ? ' dca-health-bad' : ''}` },
1603
1607
  h('span', null, t(`health.${account.health?.state ?? 'unknown'}`)),
1604
- account.health?.checkedAt ? h('span', null, `${t('health.checked')} ${formatTime(account.health.checkedAt)}`) : null,
1608
+ account.health?.checkedAt ? h('time', {
1609
+ dateTime: new Date(account.health.checkedAt).toISOString(),
1610
+ title: `${t('health.checked')} ${formatTime(account.health.checkedAt)}`,
1611
+ }, relativeTime(account.health.checkedAt, now)) : null,
1605
1612
  ),
1606
- account.error
1607
- ? h('span', { className: 'dca-msg-error' }, account.error)
1608
- : h('span', null, account.accountName ?? account.akMasked),
1613
+ h('span', null, account.accountName ?? account.akMasked),
1614
+ account.error ? h('details', { className: 'dca-details dca-account-error' },
1615
+ h('summary', null, t('health.details')),
1616
+ h('p', null, account.error),
1617
+ ) : null,
1609
1618
  ),
1610
1619
  ),
1611
1620
  h(
1612
1621
  'div',
1613
1622
  { className: 'dca-pool-credits-row' },
1614
- h('span', { className: account.lowBalance ? 'dca-low-balance' : undefined }, account.credit ? Number(account.credit.remain).toLocaleString() : '—'),
1623
+ h('span', { className: 'dca-account-credits' }, account.credit ? formatCredits(account.credit.remain) : '—'),
1624
+ h(CreditStatus, { account, now }),
1615
1625
  account.credit?.plan ? h('span', { className: 'dca-pool-sub' }, account.credit.plan) : null,
1616
1626
  // Warn about credits that lapse. The amount is real; the
1617
1627
  // deadline is not knowable from this gateway, so the chip
@@ -1649,7 +1659,7 @@ window.__ModuleLoader__.load({
1649
1659
  h(
1650
1660
  'div',
1651
1661
  { className: 'dca-pool-actions' },
1652
- h('button', { type: 'button', className: 'dca-btn-xs', disabled: rowBusy || anyBusy || busyId !== null, onClick: () => onCheck(account.id) }, rowBusy ? t('common.loading') : t('health.recheck')),
1662
+ h('button', { type: 'button', className: 'dca-btn-xs', disabled: rowBusy || anyBusy || busyId !== null, onClick: () => onCheck(account.id) }, rowBusy && rowAction.kind === 'check' ? t('common.loading') : t('health.recheck')),
1653
1663
  account.health?.state === 'credentials' ? h('button', { type: 'button', className: 'dca-btn-xs', disabled: rowBusy || anyBusy || busyId !== null, onClick: () => onUpdateCredentials(account) }, t('health.update')) : null,
1654
1664
  account.health?.state === 'insufficient' ? h('span', { className: 'dca-hint' }, t('health.switch')) : null,
1655
1665
  account.active
@@ -1660,9 +1670,10 @@ window.__ModuleLoader__.load({
1660
1670
  type: 'button',
1661
1671
  className: 'dca-btn-xs',
1662
1672
  disabled: rowBusy || anyBusy || busyId !== null,
1663
- onClick: () => onActivate(account.id),
1673
+ onClick: () => onActivate(account),
1674
+ 'aria-busy': rowBusy && rowAction.kind === 'activate',
1664
1675
  },
1665
- t('pool.use'),
1676
+ rowBusy && rowAction.kind === 'activate' ? t('pool.switching') : t('pool.use'),
1666
1677
  ),
1667
1678
  h('details', { className: 'dca-account-menu' },
1668
1679
  h('summary', {
@@ -1684,6 +1695,9 @@ window.__ModuleLoader__.load({
1684
1695
  ),
1685
1696
  ),
1686
1697
  ),
1698
+ rowNotice?.id === account.id
1699
+ ? h('div', { className: 'dca-pool-feedback' }, h(FeatureNotice, { notice: rowNotice }))
1700
+ : null,
1687
1701
  )
1688
1702
  }),
1689
1703
  ),
@@ -1693,9 +1707,10 @@ window.__ModuleLoader__.load({
1693
1707
 
1694
1708
  // ── credentials tab ────────────────────────────────────────────────────
1695
1709
 
1696
- function AccountTab({ status, pool, preferences, onChanged, onPreferencesSaved }) {
1710
+ function AccountTab({ status, pool, onChanged }) {
1697
1711
  const [busy, setBusy] = useState(null)
1698
- const [busyId, setBusyId] = useState(null)
1712
+ const [rowAction, setRowAction] = useState(null)
1713
+ const [rowNotice, setRowNotice] = useState(null)
1699
1714
  const [notice, setNotice] = useState(null)
1700
1715
  const [updateTarget, setUpdateTarget] = useState(null)
1701
1716
 
@@ -1737,42 +1752,37 @@ window.__ModuleLoader__.load({
1737
1752
  }, [report])
1738
1753
 
1739
1754
 
1740
- const activate = useCallback(async (id) => {
1741
- setBusyId(id)
1755
+ const activate = useCallback(async (account) => {
1756
+ setRowAction({ id: account.id, kind: 'activate' })
1757
+ setRowNotice(null); setNotice(null)
1742
1758
  try {
1743
- const result = await postRoute('/accounts/activate', { id })
1744
- if (!result.ok) report({ kind: 'error', text: result.error ?? t('common.retry') })
1759
+ const result = await postRoute('/accounts/activate', { id: account.id })
1760
+ if (!result.ok) throw new Error(result.error ?? t('common.retryHint'))
1745
1761
  await reload()
1762
+ setRowNotice({ id: account.id, kind: 'success', text: t('pool.switched').replace('{account}', account.label) })
1746
1763
  } catch (error) {
1747
- report({ kind: 'error', text: error.message })
1748
- } finally { setBusyId(null) }
1749
- }, [reload, report])
1764
+ setRowNotice({ id: account.id, kind: 'error', text: t('pool.switchFailed').replace('{account}', account.label).replace('{error}', error.message) })
1765
+ } finally { setRowAction(null) }
1766
+ }, [reload])
1750
1767
 
1751
1768
  const remove = useCallback(async (account) => {
1752
1769
  const ask = t('pool.removeConfirm')
1753
1770
  if (typeof window !== 'undefined' && typeof window.confirm === 'function' && !window.confirm(ask)) return
1754
- setBusyId(account.id)
1771
+ setRowAction({ id: account.id, kind: 'remove' }); setRowNotice(null)
1755
1772
  try {
1756
1773
  await postRoute('/accounts/remove', { id: account.id })
1757
1774
  report({ kind: 'success', text: t('pool.remove') })
1758
1775
  await reload()
1759
1776
  } catch (error) {
1760
1777
  report({ kind: 'error', text: error.message })
1761
- } finally { setBusyId(null) }
1778
+ } finally { setRowAction(null) }
1762
1779
  }, [reload, report])
1763
1780
 
1764
- /**
1765
- * Claim the daily bonus once, for every account that can.
1766
- *
1767
- * `now: true` is what makes this an ACTION rather than a preference: the
1768
- * host runs one sweep and leaves the standing daily switch exactly as the
1769
- * user set it. Sending `enabled: true` here would silently opt someone into
1770
- * daily automation from a button labelled "check in now".
1771
- */
1781
+ /** Claim once for the pool after an explicit click. */
1772
1782
  const checkinAll = useCallback(async () => {
1773
1783
  setBusy('checkin')
1774
1784
  try {
1775
- const result = await postRoute('/checkin/auto', { now: true })
1785
+ const result = await postRoute('/checkin/claim-all', {})
1776
1786
  const summary = result.summary
1777
1787
  if (summary) {
1778
1788
  report({
@@ -1803,24 +1813,6 @@ window.__ModuleLoader__.load({
1803
1813
  }
1804
1814
  }, [reload, report])
1805
1815
 
1806
- const toggleAuto = useCallback(async (enabled) => {
1807
- setBusy('auto')
1808
- try {
1809
- const result = await postRoute('/checkin/auto', { enabled })
1810
- if (result.summary) {
1811
- report({
1812
- kind: result.summary.failures.length === 0 ? 'success' : 'warn',
1813
- text: t('pool.result')
1814
- .replace('{claimed}', result.summary.claimed)
1815
- .replace('{failed}', result.summary.failures.length),
1816
- })
1817
- }
1818
- await reload()
1819
- } catch (error) {
1820
- report({ kind: 'error', text: error.message })
1821
- } finally { setBusy(null) }
1822
- }, [reload, report])
1823
-
1824
1816
  const test = useCallback(async () => {
1825
1817
  setBusy('test')
1826
1818
  setNotice(null)
@@ -1856,13 +1848,13 @@ window.__ModuleLoader__.load({
1856
1848
  }, [onChanged])
1857
1849
 
1858
1850
  const checkAccount = async (id) => {
1859
- setBusyId(id)
1851
+ setRowAction({ id, kind: 'check' }); setRowNotice(null)
1860
1852
  try {
1861
1853
  const result = await postRoute('/accounts/check', { id })
1862
1854
  if (!result.ok) throw new Error(result.error ?? t('common.retry'))
1863
1855
  report({ kind: result.account.health.state === 'available' ? 'success' : 'warn', text: `${result.account.label}:${t(`health.${result.account.health.state}`)}` })
1864
1856
  await reload()
1865
- } catch (error) { report({ kind: 'error', text: error.message }) } finally { setBusyId(null) }
1857
+ } catch (error) { report({ kind: 'error', text: error.message }) } finally { setRowAction(null) }
1866
1858
  }
1867
1859
  const accounts = pool?.accounts ?? []
1868
1860
  return h(
@@ -1894,15 +1886,14 @@ window.__ModuleLoader__.load({
1894
1886
  // table where the reference puts it.
1895
1887
  h(AccountPool, {
1896
1888
  pool,
1897
- busyId,
1889
+ rowAction,
1890
+ rowNotice,
1898
1891
  // The pool takes the raw kind, not a collapsed boolean: the check-in
1899
1892
  // button must know whether IT is the one running so it can show
1900
1893
  // 「签到中…」 — a boolean cannot express that.
1901
1894
  busy,
1902
1895
  onActivate: activate,
1903
1896
  onRemove: remove,
1904
- autoOn: pool?.autoCheckin === true,
1905
- onToggleAuto: toggleAuto,
1906
1897
  onCheckinAll: checkinAll,
1907
1898
  onRename: rename,
1908
1899
  onExport: doExport,
@@ -1911,7 +1902,6 @@ window.__ModuleLoader__.load({
1911
1902
  }),
1912
1903
 
1913
1904
  h(AccountTools, { onChanged, onResult: report, hasAccounts: pool ? accounts.length > 0 : null, updateTarget }),
1914
- preferences ? h(ReminderSettings, { preferences, onSaved: onPreferencesSaved }) : null,
1915
1905
  h(BackupTools, { onRestored: onChanged }),
1916
1906
 
1917
1907
  accounts.length === 0 || credential?.error
@@ -1950,57 +1940,50 @@ window.__ModuleLoader__.load({
1950
1940
  window.setTimeout(() => URL.revokeObjectURL(url), 1000)
1951
1941
  }
1952
1942
 
1953
- function ReminderSettings({ preferences, onSaved }) {
1954
- const [draft, setDraft] = useState(null)
1955
- const [busy, setBusy] = useState(false)
1956
- const [notice, setNotice] = useState(null)
1957
- const enabled = draft?.enabled ?? preferences.lowBalanceEnabled
1958
- const threshold = draft?.threshold ?? String(preferences.lowBalanceThreshold)
1959
- const dirty = enabled !== preferences.lowBalanceEnabled || threshold !== String(preferences.lowBalanceThreshold)
1960
- const valid = threshold.trim() !== '' && Number.isFinite(Number(threshold)) && Number(threshold) >= 0 && Number(threshold) <= 1e9
1961
- const update = (patch) => { setDraft({ enabled, threshold, ...patch }); setNotice(null) }
1962
- const save = async (event) => {
1963
- event.preventDefault()
1964
- if (!valid || busy) return
1965
- setBusy(true)
1966
- try {
1967
- const result = await postRoute('/preferences/save', { lowBalanceEnabled: enabled, lowBalanceThreshold: Number(threshold) })
1968
- if (!result.ok) throw new Error(result.error ?? t('common.retry'))
1969
- await onSaved()
1970
- setDraft(null)
1971
- setNotice({ kind: 'success', text: t('features.saved') })
1972
- } catch (error) { setNotice({ kind: 'error', text: error.message }) } finally { setBusy(false) }
1973
- }
1974
- return h('details', { className: 'dca-card dca-details' },
1975
- h('summary', null, t('reminder.title')),
1976
- h('form', { className: 'dca-feature-stack', onSubmit: save },
1977
- h('label', { className: 'dca-row' }, h('input', { type: 'checkbox', checked: enabled, disabled: busy, onChange: (event) => update({ enabled: event.target.checked }) }), t('reminder.enabled')),
1978
- h('label', { className: 'dca-form-field' }, t('reminder.threshold'), h('input', { className: 'dca-input', type: 'number', min: 0, max: 1e9, step: 'any', value: threshold, disabled: busy, onChange: (event) => update({ threshold: event.target.value }) })),
1979
- h('p', { className: 'dca-hint' }, t('reminder.hint')),
1980
- h(FeatureNotice, { notice }),
1981
- h('div', { className: 'dca-row' }, h('button', { type: 'submit', className: 'dca-btn', disabled: busy || !dirty || !valid }, busy ? t('account.saving') : t('models.save'))),
1982
- ),
1983
- )
1984
- }
1985
-
1986
1943
  function BackupTools({ onRestored }) {
1944
+ const [mode, setMode] = useState('export')
1987
1945
  const [includeCredentials, setIncludeCredentials] = useState(false)
1946
+ const [encryptExport, setEncryptExport] = useState(false)
1988
1947
  const [exportPassword, setExportPassword] = useState('')
1989
1948
  const [confirmation, setConfirmation] = useState('')
1990
1949
  const [text, setText] = useState('')
1950
+ const [fileName, setFileName] = useState('')
1991
1951
  const [password, setPassword] = useState('')
1992
1952
  const [preview, setPreview] = useState(null)
1993
1953
  const [busy, setBusy] = useState(null)
1994
1954
  const [notice, setNotice] = useState(null)
1995
1955
  const fileInput = useRef(null)
1956
+ const needsEncryption = includeCredentials || encryptExport
1996
1957
  const validPassword = exportPassword.length >= 8 && exportPassword.length <= 256 && exportPassword === confirmation
1958
+ let importFormat
1959
+ try { importFormat = JSON.parse(text)?.format } catch {}
1960
+ const encryptedImport = importFormat === 'dsh-connect-codearts-encrypted'
1961
+ const importLabel = encryptedImport ? 'backup.encrypted' : importFormat === 'dsh-connect-codearts-backup' ? 'backup.plain' : null
1962
+ const canInspect = text.trim() && (!encryptedImport || (password.length >= 8 && password.length <= 256))
1963
+ const changeMode = (next) => {
1964
+ if (busy || next === mode) return
1965
+ setMode(next); setNotice(null); setPreview(null)
1966
+ setExportPassword(''); setConfirmation(''); setPassword('')
1967
+ }
1968
+ const updateImport = (next, name = '') => {
1969
+ setText(next); setFileName(name); setPassword(''); setPreview(null); setNotice(null)
1970
+ }
1971
+ const selectFile = async (event) => {
1972
+ const file = event.target.files?.[0]; event.target.value = ''
1973
+ if (!file || busy) return
1974
+ setBusy('file'); setPreview(null); setNotice(null)
1975
+ updateImport('')
1976
+ try {
1977
+ if (file.size > 768 * 1024) throw new Error(t('backup.tooLarge'))
1978
+ updateImport(await file.text(), file.name)
1979
+ } catch (error) { setNotice({ kind: 'error', text: error.message }) } finally { setBusy(null) }
1980
+ }
1997
1981
  const exportBackup = async (event) => {
1998
1982
  event.preventDefault()
1999
- if (busy || ((includeCredentials || exportPassword) && !validPassword)) return
2000
- setBusy('export')
2001
- setNotice(null)
1983
+ if (busy || (needsEncryption && !validPassword)) return
1984
+ setBusy('export'); setNotice(null)
2002
1985
  try {
2003
- const result = await postRoute('/backup/export', { includeCredentials, password: exportPassword })
1986
+ const result = await postRoute('/backup/export', { includeCredentials, password: needsEncryption ? exportPassword : '' })
2004
1987
  if (!result.ok) throw new Error(result.error ?? t('backup.failed'))
2005
1988
  downloadJson(result.backup, `codearts-backup-${new Date().toISOString().slice(0, 10)}.json`)
2006
1989
  setExportPassword(''); setConfirmation('')
@@ -2008,10 +1991,10 @@ window.__ModuleLoader__.load({
2008
1991
  } catch (error) { setNotice({ kind: 'error', text: error.message }) } finally { setBusy(null) }
2009
1992
  }
2010
1993
  const inspect = async () => {
2011
- if (busy || !text.trim()) return
1994
+ if (busy || !canInspect) return
2012
1995
  setBusy('preview'); setNotice(null); setPreview(null)
2013
1996
  try {
2014
- const result = await postRoute('/backup/preview', { text, password })
1997
+ const result = await postRoute('/backup/preview', { text, password: encryptedImport ? password : '' })
2015
1998
  if (!result.ok) throw new Error(result.error ?? t('backup.failed'))
2016
1999
  setPreview(result)
2017
2000
  } catch (error) { setNotice({ kind: 'error', text: error.message }) } finally { setBusy(null) }
@@ -2020,9 +2003,9 @@ window.__ModuleLoader__.load({
2020
2003
  if (!preview || busy) return
2021
2004
  setBusy('restore'); setNotice(null)
2022
2005
  try {
2023
- const result = await postRoute('/backup/restore', { text, password })
2006
+ const result = await postRoute('/backup/restore', { text, password: encryptedImport ? password : '' })
2024
2007
  if (!result.ok) throw new Error(result.error ?? t('backup.failed'))
2025
- setText(''); setPassword(''); setPreview(null)
2008
+ updateImport('')
2026
2009
  await onRestored()
2027
2010
  setNotice({ kind: 'success', text: t('backup.restored').replace('{added}', result.added).replace('{updated}', result.updated) })
2028
2011
  } catch (error) { setNotice({ kind: 'error', text: error.message }) } finally { setBusy(null) }
@@ -2030,104 +2013,64 @@ window.__ModuleLoader__.load({
2030
2013
  return h('details', { className: 'dca-card dca-details' },
2031
2014
  h('summary', null, t('backup.title')),
2032
2015
  h('div', { className: 'dca-feature-stack' },
2033
- h('p', { className: 'dca-hint' }, t('backup.hint')),
2034
- h(FeatureNotice, { notice }),
2035
- h('form', { className: 'dca-feature-stack', onSubmit: exportBackup },
2036
- h('h3', { className: 'dca-subtitle' }, t('backup.export')),
2037
- h('label', { className: 'dca-row' }, h('input', { type: 'checkbox', checked: includeCredentials, disabled: busy !== null, onChange: (event) => setIncludeCredentials(event.target.checked) }), t('backup.include')),
2038
- h('div', { className: 'dca-feature-grid' },
2039
- h('label', { className: 'dca-form-field' }, t('backup.exportPassword'), h('input', { className: 'dca-input', type: 'password', autoComplete: 'new-password', maxLength: 256, value: exportPassword, disabled: busy !== null, onChange: (event) => setExportPassword(event.target.value) })),
2040
- h('label', { className: 'dca-form-field' }, t('backup.confirmPassword'), h('input', { className: 'dca-input', type: 'password', autoComplete: 'new-password', maxLength: 256, value: confirmation, disabled: busy !== null, onChange: (event) => setConfirmation(event.target.value) })),
2041
- ),
2042
- (includeCredentials || exportPassword) && !validPassword ? h('p', { className: 'dca-hint' }, t('backup.passwordHint')) : null,
2043
- h('div', { className: 'dca-row' }, h('button', { className: 'dca-btn', type: 'submit', disabled: busy !== null || ((includeCredentials || Boolean(exportPassword)) && !validPassword) }, busy === 'export' ? t('common.loading') : t('backup.download'))),
2016
+ h('div', { className: 'dca-mode-switch', role: 'group', 'aria-label': t('backup.mode') },
2017
+ ...['export', 'restore'].map((value) => h('button', {
2018
+ key: value, type: 'button', className: 'dca-filter', 'aria-pressed': mode === value,
2019
+ disabled: busy !== null, onClick: () => changeMode(value),
2020
+ }, t(`backup.${value}`))),
2044
2021
  ),
2045
- h('h3', { className: 'dca-subtitle' }, t('backup.restore')),
2046
- h('div', { className: 'dca-row' },
2047
- h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null, onClick: () => fileInput.current?.click() }, t('backup.choose')),
2048
- h('input', { ref: fileInput, type: 'file', accept: '.json,application/json', className: 'dca-file-input', disabled: busy !== null, onChange: async (event) => {
2049
- const file = event.target.files?.[0]; event.target.value = ''
2050
- if (!file) return
2051
- setPreview(null); setNotice(null)
2052
- try {
2053
- if (file.size > 768 * 1024) throw new Error(t('backup.tooLarge'))
2054
- setText(await file.text())
2055
- } catch (error) { setNotice({ kind: 'error', text: error.message }) }
2056
- } }),
2057
- ),
2058
- h('label', { className: 'dca-form-field' }, t('backup.content'), h('textarea', { className: 'dca-input', rows: 4, maxLength: 786432, value: text, disabled: busy !== null, onChange: (event) => { setText(event.target.value); setPreview(null) } })),
2059
- h('label', { className: 'dca-form-field' }, t('backup.importPassword'), h('input', { className: 'dca-input', type: 'password', autoComplete: 'off', maxLength: 256, value: password, disabled: busy !== null, onChange: (event) => { setPassword(event.target.value); setPreview(null) } })),
2060
- h('div', { className: 'dca-row' }, h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null || !text.trim(), onClick: inspect }, busy === 'preview' ? t('common.loading') : t('backup.preview'))),
2061
- preview ? h('div', { className: 'dca-feature-stack dca-preview-box', role: 'region', 'aria-label': t('backup.preview') },
2062
- h('p', null, t('backup.summary').replace('{settings}', preview.changes.length).replace('{added}', preview.accounts.added).replace('{updated}', preview.accounts.updated)),
2063
- h('p', { className: 'dca-hint' }, t('backup.mergeHint')),
2064
- h('details', { className: 'dca-details' }, h('summary', null, t('backup.changes')), h('pre', { className: 'dca-pre', tabIndex: 0 }, JSON.stringify(preview.preferences, null, 2))),
2022
+ h(FeatureNotice, { notice }),
2023
+ mode === 'export' ? h('form', { className: 'dca-feature-stack dca-backup-form', onSubmit: exportBackup },
2024
+ h('p', { className: 'dca-hint' }, t('backup.hint')),
2025
+ h('label', { className: 'dca-row' }, h('input', {
2026
+ type: 'checkbox', checked: includeCredentials, disabled: busy !== null,
2027
+ onChange: (event) => {
2028
+ setIncludeCredentials(event.target.checked)
2029
+ if (!event.target.checked && !encryptExport) { setExportPassword(''); setConfirmation('') }
2030
+ },
2031
+ }), t('backup.include')),
2032
+ includeCredentials ? h('p', { className: 'dca-hint' }, t('backup.encryptionRequired'))
2033
+ : h('label', { className: 'dca-row' }, h('input', {
2034
+ type: 'checkbox', checked: encryptExport, disabled: busy !== null,
2035
+ onChange: (event) => { setEncryptExport(event.target.checked); setExportPassword(''); setConfirmation('') },
2036
+ }), t('backup.encrypt')),
2037
+ needsEncryption ? h(React.Fragment, null,
2038
+ h('div', { className: 'dca-feature-grid' },
2039
+ h('label', { className: 'dca-form-field' }, t('backup.exportPassword'), h('input', { className: 'dca-input', type: 'password', autoComplete: 'new-password', maxLength: 256, value: exportPassword, disabled: busy !== null, onChange: (event) => setExportPassword(event.target.value) })),
2040
+ h('label', { className: 'dca-form-field' }, t('backup.confirmPassword'), h('input', { className: 'dca-input', type: 'password', autoComplete: 'new-password', maxLength: 256, value: confirmation, disabled: busy !== null, onChange: (event) => setConfirmation(event.target.value) })),
2041
+ ),
2042
+ !validPassword ? h('p', { className: 'dca-hint' }, t('backup.passwordHint')) : null,
2043
+ ) : null,
2044
+ h('div', { className: 'dca-row' }, h('button', { className: 'dca-btn', type: 'submit', disabled: busy !== null || (needsEncryption && !validPassword) }, busy === 'export' ? t('common.loading') : t('backup.download'))),
2045
+ ) : h('div', { className: 'dca-feature-stack dca-backup-form' },
2046
+ h('p', { className: 'dca-hint' }, t('backup.importHint')),
2065
2047
  h('div', { className: 'dca-row' },
2066
- h('button', { type: 'button', className: 'dca-btn dca-btn-primary', disabled: busy !== null, onClick: restore }, busy === 'restore' ? t('common.loading') : t('backup.confirm')),
2067
- h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null, onClick: () => { setPreview(null); setText(''); setPassword('') } }, t('pool.cancel')),
2048
+ h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null, onClick: () => fileInput.current?.click() }, busy === 'file' ? t('common.loading') : t('backup.choose')),
2049
+ h('input', { ref: fileInput, type: 'file', accept: '.json,application/json', className: 'dca-file-input', disabled: busy !== null, onChange: selectFile }),
2068
2050
  ),
2069
- ) : null,
2070
- ),
2071
- )
2072
- }
2073
-
2074
- function UsageTab({ usage, onRefresh, onPreferencesSaved }) {
2075
- const [busy, setBusy] = useState(null)
2076
- const [notice, setNotice] = useState(null)
2077
- const [query, setQuery] = useState('')
2078
- const [filter, setFilter] = useState('all')
2079
- const records = usage.records ?? []
2080
- const visible = records.filter((row) => (filter === 'all' || row.status === filter) && row.model.toLowerCase().includes(query.trim().toLowerCase()))
2081
- const today = records.filter((row) => new Date(row.at).toDateString() === new Date().toDateString())
2082
- const completed = today.filter((row) => row.status !== 'aborted')
2083
- const successRate = completed.length ? `${Math.round(completed.filter((row) => row.status === 'success').length / completed.length * 100)}%` : '—'
2084
- const action = async (kind) => {
2085
- if (busy) return
2086
- if (kind === 'clear' && !window.confirm(t('usage.clearConfirm'))) return
2087
- setBusy(kind); setNotice(null)
2088
- try {
2089
- if (kind === 'toggle') {
2090
- const result = await postRoute('/preferences/save', { usageEnabled: !usage.enabled })
2091
- if (!result.ok) throw new Error(result.error ?? t('common.retry'))
2092
- await onPreferencesSaved()
2093
- } else if (kind === 'clear') {
2094
- const result = await postRoute('/usage/clear', {})
2095
- if (!result.ok) throw new Error(result.error ?? t('common.retry'))
2096
- }
2097
- await onRefresh()
2098
- setNotice({ kind: 'success', text: t(kind === 'clear' ? 'usage.cleared' : 'features.saved') })
2099
- } catch (error) { setNotice({ kind: 'error', text: error.message }) } finally { setBusy(null) }
2100
- }
2101
- return h('div', { className: 'dca-page' },
2102
- h('div', { className: 'dca-pool-card-head' }, h('h2', { className: 'dca-title' }, t('usage.title')),
2103
- h('div', { className: 'dca-row' },
2104
- h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null, onClick: () => action('refresh') }, t('features.refresh')),
2105
- h('button', { type: 'button', className: 'dca-btn dca-danger', disabled: busy !== null || !records.length, onClick: () => action('clear') }, t('usage.clear')),
2106
- ),
2107
- ),
2108
- h('label', { className: 'dca-row' }, h('input', { type: 'checkbox', checked: usage.enabled === true, disabled: busy !== null, onChange: () => action('toggle') }), t('usage.enabled')),
2109
- h('p', { className: 'dca-hint' }, t('usage.hint')),
2110
- h(FeatureNotice, { notice }),
2111
- h('div', { className: 'dca-diagnostic-summary' },
2112
- h('div', { className: 'dca-summary-item' }, h('strong', null, t('usage.today')), h('span', { className: 'dca-num' }, String(today.length))),
2113
- h('div', { className: 'dca-summary-item' }, h('strong', null, t('usage.successRate')), h('span', { className: 'dca-num' }, successRate)),
2114
- h('div', { className: 'dca-summary-item' }, h('strong', null, t('usage.tokens')), h('span', { className: 'dca-num' }, `${today.reduce((sum, row) => sum + (row.inputTokens ?? 0) + (row.outputTokens ?? 0), 0)}`)),
2115
- ),
2116
- h('div', { className: 'dca-toolbar' },
2117
- h('input', { className: 'dca-input dca-search', type: 'search', value: query, 'aria-label': t('usage.search'), placeholder: t('usage.search'), onChange: (event) => setQuery(event.target.value) }),
2118
- h('select', { className: 'dca-input', value: filter, 'aria-label': t('usage.result'), onChange: (event) => setFilter(event.target.value) }, ...['all', 'success', 'error', 'aborted'].map((key) => h('option', { key, value: key }, t(`usage.${key}`)))),
2119
- ),
2120
- h('div', { className: 'dca-usage-table', role: 'region', tabIndex: 0, 'aria-label': t('usage.title') },
2121
- h('table', null,
2122
- h('thead', null, h('tr', null, ...['time', 'model', 'duration', 'input', 'output', 'result'].map((key) => h('th', { key, scope: 'col' }, t(`usage.${key}`))))),
2123
- h('tbody', null, ...visible.map((row) => h('tr', { key: row.id },
2124
- h('td', null, formatTime(row.at)), h('td', null, row.model), h('td', { className: 'dca-num' }, `${(row.durationMs / 1000).toFixed(1)}s`),
2125
- h('td', { className: 'dca-num' }, row.inputTokens ?? '—'), h('td', { className: 'dca-num' }, row.outputTokens ?? '—'),
2126
- h('td', null, t(`usage.${row.status}`)),
2127
- ))),
2051
+ text.trim() ? h('div', { className: 'dca-file-state', role: 'status' },
2052
+ h('span', null, fileName ? t('backup.selected').replace('{name}', fileName) : t('backup.pasted')),
2053
+ importLabel ? h('span', { className: 'dca-hint' }, t(importLabel)) : null,
2054
+ ) : null,
2055
+ h('details', { className: 'dca-details' }, h('summary', null, t('backup.paste')),
2056
+ h('label', { className: 'dca-form-field' }, t('backup.content'), h('textarea', {
2057
+ className: 'dca-input', rows: 4, maxLength: 786432, value: text, disabled: busy !== null,
2058
+ onChange: (event) => updateImport(event.target.value),
2059
+ })),
2060
+ ),
2061
+ encryptedImport ? h('label', { className: 'dca-form-field' }, t('backup.importPassword'), h('input', { className: 'dca-input', type: 'password', autoComplete: 'off', maxLength: 256, value: password, disabled: busy !== null, onChange: (event) => { setPassword(event.target.value); setPreview(null) } })) : null,
2062
+ h('div', { className: 'dca-row' }, h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null || !canInspect, onClick: inspect }, busy === 'preview' ? t('common.loading') : t('backup.preview'))),
2063
+ preview ? h('div', { className: 'dca-feature-stack dca-preview-box', role: 'region', 'aria-label': t('backup.preview') },
2064
+ h('p', null, t('backup.summary').replace('{settings}', preview.changes.length).replace('{added}', preview.accounts.added).replace('{updated}', preview.accounts.updated)),
2065
+ h('p', { className: 'dca-hint' }, t('backup.mergeHint')),
2066
+ h('details', { className: 'dca-details' }, h('summary', null, t('backup.changes')), h('pre', { className: 'dca-pre', tabIndex: 0 }, JSON.stringify(preview.preferences, null, 2))),
2067
+ h('div', { className: 'dca-row' },
2068
+ h('button', { type: 'button', className: 'dca-btn dca-btn-primary', disabled: busy !== null, onClick: restore }, busy === 'restore' ? t('common.loading') : t('backup.confirm')),
2069
+ h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null, onClick: () => updateImport('') }, t('pool.cancel')),
2070
+ ),
2071
+ ) : null,
2128
2072
  ),
2129
2073
  ),
2130
- !visible.length ? h('p', { className: 'dca-hint', role: 'status' }, t('usage.empty')) : null,
2131
2074
  )
2132
2075
  }
2133
2076
 
@@ -2160,7 +2103,12 @@ window.__ModuleLoader__.load({
2160
2103
  const [reasoningOnly, setReasoningOnly] = useState(false)
2161
2104
  const [presetId, setPresetId] = useState('')
2162
2105
  const [presetName, setPresetName] = useState('')
2106
+ const [presetEditorOpen, setPresetEditorOpen] = useState(false)
2163
2107
  const [presetPreview, setPresetPreview] = useState(null)
2108
+ const [savedFavorites, setSavedFavorites] = useState(null)
2109
+ useEffect(() => { setSavedFavorites(null) }, [models.favoriteModelIds])
2110
+ const favoriteIds = savedFavorites ?? models.favoriteModelIds ?? []
2111
+ const favorites = new Set(favoriteIds)
2164
2112
  const [savedPresets, setSavedPresets] = useState(null)
2165
2113
  useEffect(() => { setSavedPresets(null) }, [models.presets])
2166
2114
  const [notice, setNotice] = useState(null)
@@ -2207,6 +2155,21 @@ window.__ModuleLoader__.load({
2207
2155
  visibleModels.sort((left, right) => left.name.localeCompare(right.name))
2208
2156
  }
2209
2157
 
2158
+ // Preserve the chosen sort within the pinned and unpinned groups.
2159
+ visibleModels.sort((left, right) => Number(favorites.has(right.id)) - Number(favorites.has(left.id)))
2160
+ const toggleFavorite = async (id) => {
2161
+ if (busy) return
2162
+ setBusy('favorite'); setNotice(null)
2163
+ try {
2164
+ const next = favorites.has(id) ? favoriteIds.filter((entry) => entry !== id) : [...favoriteIds, id]
2165
+ const result = await postRoute('/preferences/save', { favoriteModelIds: next })
2166
+ if (!result.ok) throw new Error(result.error ?? t('common.retry'))
2167
+ setSavedFavorites(result.preferences.favoriteModelIds)
2168
+ setNotice({ kind: 'success', text: t('models.favoriteSaved') })
2169
+ await onRefresh()
2170
+ } catch (error) { setNotice({ kind: 'error', text: error.message }) } finally { setBusy(null) }
2171
+ }
2172
+
2210
2173
  const toggle = useCallback((id, next) => {
2211
2174
  setNotice(null)
2212
2175
  setEnabledIds((current) => {
@@ -2224,7 +2187,7 @@ window.__ModuleLoader__.load({
2224
2187
  }, [])
2225
2188
 
2226
2189
  const save = useCallback(async () => {
2227
- setBusy('save')
2190
+ setBusy('save'); setNotice(null)
2228
2191
  try {
2229
2192
  const payload = {
2230
2193
  // A draft that matches the whole roster is the same thing as "all",
@@ -2321,7 +2284,7 @@ window.__ModuleLoader__.load({
2321
2284
  try {
2322
2285
  const result = await postRoute('/presets', { action: 'save', name: presetName.trim(), enabledModelIds: selectedCount === list.length ? null : selectedIds, modelOverrides: snapshotOverrides() })
2323
2286
  if (!result.ok) throw new Error(result.error ?? t('common.retry'))
2324
- setSavedPresets(result.presets); setPresetName('')
2287
+ setSavedPresets(result.presets); setPresetName(''); setPresetEditorOpen(false)
2325
2288
  setNotice({ kind: 'success', text: t('features.saved') })
2326
2289
  } catch (error) { setNotice({ kind: 'error', text: error.message }) } finally { setBusy(null) }
2327
2290
  }
@@ -2339,7 +2302,7 @@ window.__ModuleLoader__.load({
2339
2302
  if (!previewIds.length || busy) return
2340
2303
  setEnabledIds(previewIds)
2341
2304
  setOverrides(Object.fromEntries(Object.entries(presetPreview.modelOverrides ?? {}).filter(([id]) => list.some((model) => model.id === id))))
2342
- setPresetPreview(null)
2305
+ setPresetPreview(null); setPresetId('')
2343
2306
  setNotice({ kind: 'success', text: t('presets.applied') })
2344
2307
  }
2345
2308
 
@@ -2376,6 +2339,7 @@ window.__ModuleLoader__.load({
2376
2339
  h('span', null, t('models.selectedCount').replace('{enabled}', selectedCount).replace('{total}', list.length)),
2377
2340
  h('span', null, `${t('models.refreshedAt')}:${formatTime(models?.refreshedAt)}`),
2378
2341
  ),
2342
+ h('p', { className: 'dca-hint' }, t('models.saveHint')),
2379
2343
  h('div', { className: 'dca-toolbar' },
2380
2344
  h('input', {
2381
2345
  type: 'search', className: 'dca-input dca-search', value: query,
@@ -2393,36 +2357,43 @@ window.__ModuleLoader__.load({
2393
2357
  }, ...[['default', 'models.sortDefault'], ['ratio', 'models.sortRatio'], ['name', 'models.sortName']].map(([value, key]) =>
2394
2358
  h('option', { key: value, value }, t(key)))),
2395
2359
  ),
2396
- h('div', { className: 'dca-row' },
2360
+ h('div', { className: 'dca-capability-filters' },
2397
2361
  h('label', { className: 'dca-row' }, h('input', { type: 'checkbox', checked: imagesOnly, onChange: (event) => setImagesOnly(event.target.checked) }), t('models.imagesOnly')),
2398
2362
  h('label', { className: 'dca-row' }, h('input', { type: 'checkbox', checked: reasoningOnly, onChange: (event) => setReasoningOnly(event.target.checked) }), t('models.reasoningOnly')),
2399
2363
  ),
2400
- h('details', { className: 'dca-card dca-details' },
2401
- h('summary', null, t('presets.title')),
2402
- h('div', { className: 'dca-feature-stack' },
2403
- h('div', { className: 'dca-preset-row' },
2404
- h('select', { className: 'dca-input', value: presetId, disabled: busy !== null, 'aria-label': t('presets.title'), onChange: (event) => { setPresetId(event.target.value); setPresetPreview(null) } },
2405
- h('option', { value: '' }, t('presets.choose')), ...presets.map((preset) => h('option', { key: preset.id, value: preset.id }, preset.name)),
2406
- ),
2407
- h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null || !selectedPreset, onClick: () => setPresetPreview(selectedPreset) }, t('presets.preview')),
2364
+ h('div', { className: 'dca-preset-tools' },
2365
+ h('div', { className: 'dca-preset-row' },
2366
+ h('select', {
2367
+ className: 'dca-input', value: presetId, disabled: busy !== null,
2368
+ 'aria-label': t('presets.title'), onChange: (event) => {
2369
+ const next = event.target.value
2370
+ setPresetId(next); setPresetPreview(presets.find((entry) => entry.id === next) ?? null)
2371
+ setPresetEditorOpen(false)
2372
+ },
2373
+ }, h('option', { value: '' }, t('presets.choose')), ...presets.map((preset) => h('option', { key: preset.id, value: preset.id }, preset.name))),
2374
+ h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null || !selectedCount,
2375
+ 'aria-expanded': presetEditorOpen, onClick: () => { setPresetEditorOpen((value) => !value); setPresetPreview(null); setPresetId('') },
2376
+ }, t('presets.saveAs')),
2377
+ ),
2378
+ presetEditorOpen ? h('form', { className: 'dca-preset-row', onSubmit: (event) => { event.preventDefault(); void savePreset() } },
2379
+ h('input', { className: 'dca-input', value: presetName, maxLength: 48, autoFocus: true, placeholder: t('presets.name'), 'aria-label': t('presets.name'), disabled: busy !== null, onChange: (event) => setPresetName(event.target.value) }),
2380
+ h('button', { type: 'submit', className: 'dca-btn', disabled: busy !== null || !presetName.trim() || !selectedCount }, t('presets.save')),
2381
+ h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null, onClick: () => setPresetEditorOpen(false) }, t('pool.cancel')),
2382
+ ) : null,
2383
+ presetPreview ? h('div', { className: 'dca-preview-box dca-feature-stack', role: 'region', 'aria-label': t('presets.preview') },
2384
+ h('p', { className: 'dca-hint' }, t('presets.previewHint').replace('{count}', previewIds.length)),
2385
+ !previewIds.length ? h('p', { className: 'dca-hint' }, t('presets.noModels')) : null,
2386
+ presetPreview.enabledModelIds && previewIds.length < presetPreview.enabledModelIds.length ? h('p', { className: 'dca-hint' }, t('presets.missing')) : null,
2387
+ h('ul', { className: 'dca-preset-preview' }, ...previewIds.map((id) => h('li', { key: id }, list.find((model) => model.id === id).name))),
2388
+ h('details', { className: 'dca-details' }, h('summary', null, t('presets.details')),
2389
+ h('pre', { className: 'dca-pre', tabIndex: 0 }, JSON.stringify(presetPreview.modelOverrides, null, 2)),
2408
2390
  selectedPreset && !selectedPreset.id.startsWith('builtin:') ? h('button', { type: 'button', className: 'dca-btn dca-danger', disabled: busy !== null, onClick: deletePreset }, t('presets.delete')) : null,
2409
2391
  ),
2410
- presetPreview ? h('div', { className: 'dca-preview-box dca-feature-stack' },
2411
- h('p', { className: 'dca-hint' }, t('presets.previewHint').replace('{count}', previewIds.length)),
2412
- !previewIds.length ? h('p', { className: 'dca-hint' }, t('presets.noModels')) : null,
2413
- presetPreview.enabledModelIds && previewIds.length < presetPreview.enabledModelIds.length ? h('p', { className: 'dca-hint' }, t('presets.missing')) : null,
2414
- h('ul', { className: 'dca-preset-preview' }, ...previewIds.map((id) => h('li', { key: id }, list.find((model) => model.id === id).name))),
2415
- h('details', { className: 'dca-details' }, h('summary', null, t('backup.changes')), h('pre', { className: 'dca-pre', tabIndex: 0 }, JSON.stringify(presetPreview.modelOverrides, null, 2))),
2416
- h('div', { className: 'dca-row' },
2417
- h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null || !previewIds.length, onClick: applyPreset }, t('presets.apply')),
2418
- h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null, onClick: () => setPresetPreview(null) }, t('pool.cancel')),
2419
- ),
2420
- ) : null,
2421
- h('div', { className: 'dca-preset-row' },
2422
- h('input', { className: 'dca-input', value: presetName, maxLength: 48, placeholder: t('presets.name'), 'aria-label': t('presets.name'), disabled: busy !== null, onChange: (event) => setPresetName(event.target.value) }),
2423
- h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null || !presetName.trim() || !selectedCount, onClick: savePreset }, t('presets.save')),
2392
+ h('div', { className: 'dca-row' },
2393
+ h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null || !previewIds.length, onClick: applyPreset }, t('presets.apply')),
2394
+ h('button', { type: 'button', className: 'dca-btn', disabled: busy !== null, onClick: () => { setPresetPreview(null); setPresetId('') } }, t('pool.cancel')),
2424
2395
  ),
2425
- ),
2396
+ ) : null,
2426
2397
  ),
2427
2398
  h('details', { className: 'dca-details' },
2428
2399
  h('summary', null, t('models.about')),
@@ -2470,6 +2441,14 @@ window.__ModuleLoader__.load({
2470
2441
  onChange: (event) => toggle(model.id, event.target.checked),
2471
2442
  }),
2472
2443
  h('b', null, model.name),
2444
+ h('button', {
2445
+ type: 'button', className: `dca-pin${favorites.has(model.id) ? ' dca-pin-on' : ''}`,
2446
+ disabled: busy !== null, 'aria-pressed': favorites.has(model.id),
2447
+ title: t(favorites.has(model.id) ? 'models.unpin' : 'models.pin').replace('{model}', model.name),
2448
+ 'aria-label': t(favorites.has(model.id) ? 'models.unpin' : 'models.pin').replace('{model}', model.name),
2449
+ onClick: () => void toggleFavorite(model.id),
2450
+ }, h('svg', { width: 15, height: 15, viewBox: '0 0 24 24', fill: favorites.has(model.id) ? 'currentColor' : 'none', stroke: 'currentColor', strokeWidth: 1.8, 'aria-hidden': true },
2451
+ h('path', { d: 'm12 3 2.8 5.7 6.3.9-4.6 4.5 1.1 6.3L12 17.4l-5.6 3 1.1-6.3L3 9.6l6.2-.9Z' }))),
2473
2452
  model.ratio
2474
2453
  ? h(
2475
2454
  'span',
@@ -2565,10 +2544,11 @@ window.__ModuleLoader__.load({
2565
2544
  h(
2566
2545
  'div',
2567
2546
  { className: 'dca-model-actions' },
2568
- h('span', {
2569
- className: `dca-save-status${notice?.kind === 'error' ? ' dca-save-status-error' : ''}`,
2570
- role: notice?.kind === 'error' ? 'alert' : 'status', 'aria-live': 'polite',
2571
- }, busy === 'save' ? t('account.saving') : (notice?.text ?? (selectedCount === 0 ? t('models.needOne') : t(dirty ? 'models.unsaved' : 'models.clean')))),
2547
+ h('div', { className: 'dca-save-feedback' },
2548
+ h('span', { className: 'dca-save-status', role: 'status', 'aria-live': 'polite' },
2549
+ busy === 'save' ? t('account.saving') : selectedCount === 0 ? t('models.needOne') : t(dirty ? 'models.unsaved' : 'models.clean')),
2550
+ h(FeatureNotice, { notice }),
2551
+ ),
2572
2552
  h(
2573
2553
  'div',
2574
2554
  { className: 'dca-model-actions-buttons' },
@@ -2744,10 +2724,11 @@ window.__ModuleLoader__.load({
2744
2724
  if (!value || (path !== '/account' && value.ok !== true)) {
2745
2725
  throw new Error(value?.error ?? t('common.retryHint'))
2746
2726
  }
2747
- setData((current) => ({ ...current, [path]: value }))
2727
+ setData((current) => ({ ...current, [path]: mergeCredits(path, current[path], value) }))
2748
2728
  return true
2749
2729
  } catch (error) {
2750
2730
  if (!controller.signal.aborted) {
2731
+ setData((current) => ({ ...current, [path]: staleCredits(path, current[path]) }))
2751
2732
  setErrors((current) => ({ ...current, [path]: `${path}:${error.message}` }))
2752
2733
  }
2753
2734
  return false
@@ -2757,15 +2738,8 @@ window.__ModuleLoader__.load({
2757
2738
  }, [])
2758
2739
 
2759
2740
  const loadAll = useCallback((background = false) => Promise.all(
2760
- ['/status', '/models', '/account', '/accounts', '/preferences', '/usage'].map((path) => loadRoute(path, background)),
2741
+ ['/status', '/models', '/account', '/accounts'].map((path) => loadRoute(path, background)),
2761
2742
  ), [loadRoute])
2762
- const loadPreferences = useCallback(async () => {
2763
- const result = await loadRoute('/preferences')
2764
- void loadRoute('/status', true)
2765
- void loadRoute('/accounts', true)
2766
- return result
2767
- }, [loadRoute])
2768
- const loadUsage = useCallback(() => loadRoute('/usage'), [loadRoute])
2769
2743
  const loadModels = useCallback(() => loadRoute('/models'), [loadRoute])
2770
2744
  const refreshModels = useCallback(() => {
2771
2745
  void loadRoute('/status', true)
@@ -2787,18 +2761,15 @@ window.__ModuleLoader__.load({
2787
2761
  const models = data['/models']
2788
2762
  const account = data['/account']
2789
2763
  const pool = data['/accounts']
2790
- const preferences = data['/preferences']?.preferences
2791
- const usage = data['/usage']
2792
2764
  const tabs = [
2793
- { id: 'account', paths: ['/accounts', '/preferences'], content: pool && h(AccountTab, { status, pool, preferences, onChanged: loadAll, onPreferencesSaved: loadPreferences }) },
2765
+ { id: 'account', paths: ['/accounts'], content: pool && h(AccountTab, { status, pool, onChanged: loadAll }) },
2794
2766
  { id: 'models', paths: ['/models'], content: models && h(ModelsTab, { models, onRefresh: refreshModels, onSaved: loadModels }) },
2795
- { id: 'usage', paths: ['/usage', '/preferences'], content: usage && h(UsageTab, { usage, onRefresh: loadUsage, onPreferencesSaved: loadPreferences }) },
2796
2767
  { id: 'diagnostics', paths: ['/status', '/account'], content: status && h(DiagnosticsTab, { status, account, accountError: errors['/account'] }) },
2797
2768
  ]
2798
2769
 
2799
2770
  return h(
2800
2771
  'div',
2801
- { className: 'dca-page' },
2772
+ { className: 'dca-page dca-settings' },
2802
2773
  h(
2803
2774
  'div',
2804
2775
  { role: 'tablist', className: 'dca-tabs', 'aria-label': t('nav.label') },
@@ -2891,22 +2862,25 @@ window.__ModuleLoader__.load({
2891
2862
  /**
2892
2863
  * Which colour the row's dot takes.
2893
2864
  *
2894
- * Green means "this account can serve a request right now", red means it
2895
- * cannot — a failed probe or a credential the gateway rejected. Amber is
2896
- * reserved for "usable but something to know" (nothing can be claimed, a
2897
- * balance lapsing), so the panel does not paint a healthy account as broken.
2865
+ * Red marks a known credential or balance problem. Amber marks a probe
2866
+ * error or unconfirmed health; healthy accounts need no extra status text.
2898
2867
  */
2899
2868
  function dotTone(account) {
2900
- if (account.error) return ' dca-pop-dot-bad'
2869
+ const state = account.health?.state
2870
+ if (state === 'credentials' || state === 'insufficient') return ' dca-pop-dot-bad'
2871
+ if (account.creditStale || account.error || (state && state !== 'available')) return ' dca-pop-dot-warn'
2901
2872
  return ' dca-pop-dot-ok'
2902
2873
  }
2903
2874
 
2904
2875
  function ComposerChip(props) {
2905
- const [usage, setUsage] = useState(null)
2876
+ const [accountInfo, setAccountInfo] = useState(null)
2906
2877
  const [open, setOpen] = useState(false)
2907
- const [, setDismissalVersion] = useState(0)
2908
2878
  const [busy, setBusy] = useState(false)
2909
2879
  const container = useRef(null)
2880
+ const loadSequence = useRef(0)
2881
+ const [now, setNow] = useState(Date.now())
2882
+ const [actionNotice, setActionNotice] = useState(null)
2883
+ const [switchingId, setSwitchingId] = useState(null)
2910
2884
  const openSettings = props?.openSettings
2911
2885
 
2912
2886
  // Only speak up when this session is actually pointed at a 码道 model.
@@ -2925,16 +2899,22 @@ window.__ModuleLoader__.load({
2925
2899
  const ownsSelection = selectedProvider === undefined || selectedProvider === PROVIDER_ID
2926
2900
 
2927
2901
  const load = useCallback(async () => {
2928
- // Two reads: `/account` is the serving credential and the balance the
2929
- // pill shows, `/accounts` is the pool the panel lists. Settled rather
2930
- // than all — a pool read failing must not blank a working pill.
2931
- const [accountR, poolR] = await Promise.allSettled([
2932
- getRoute('/account'),
2933
- getRoute('/accounts'),
2934
- ])
2935
- setUsage({
2936
- ...(accountR.status === 'fulfilled' ? accountR.value : { ok: false }),
2937
- pool: poolR.status === 'fulfilled' ? poolR.value : null,
2902
+ const sequence = ++loadSequence.current
2903
+ const [accountR, poolR] = await Promise.allSettled([getRoute('/account'), getRoute('/accounts')])
2904
+ if (sequence !== loadSequence.current) return
2905
+ setNow(Date.now())
2906
+ setAccountInfo((previous) => {
2907
+ const accountOk = accountR.status === 'fulfilled' && (accountR.value?.ok === true || accountR.value?.stage === 'credentials')
2908
+ const poolOk = poolR.status === 'fulfilled' && poolR.value?.ok === true && Array.isArray(poolR.value.accounts)
2909
+ const account = accountOk
2910
+ ? mergeCredits('/account', previous, accountR.value)
2911
+ : staleCredits('/account', previous) ?? { ok: false, stage: 'gateway' }
2912
+ return {
2913
+ ...account,
2914
+ pool: poolOk ? mergeCredits('/accounts', previous?.pool, poolR.value) : staleCredits('/accounts', previous?.pool),
2915
+ accountReadFailed: !accountOk || accountR.value?.ok !== true || !accountR.value?.credit,
2916
+ poolReadFailed: !poolOk,
2917
+ }
2938
2918
  })
2939
2919
  }, [])
2940
2920
 
@@ -2945,9 +2925,16 @@ window.__ModuleLoader__.load({
2945
2925
  if (!ownsSelection) return undefined
2946
2926
  void load()
2947
2927
  const timer = setInterval(() => void load(), 5 * 60 * 1000)
2948
- return () => clearInterval(timer)
2928
+ return () => { clearInterval(timer); loadSequence.current += 1 }
2949
2929
  }, [load, ownsSelection])
2950
2930
 
2931
+ useEffect(() => {
2932
+ if (!open) return undefined
2933
+ setNow(Date.now())
2934
+ const timer = setInterval(() => setNow(Date.now()), 30000)
2935
+ return () => clearInterval(timer)
2936
+ }, [open])
2937
+
2951
2938
  // Closing on an outside click keeps the panel from being modal: it is a
2952
2939
  // reading, not a task.
2953
2940
  useEffect(() => {
@@ -2967,7 +2954,7 @@ window.__ModuleLoader__.load({
2967
2954
  }, [open])
2968
2955
 
2969
2956
  const refresh = useCallback(async () => {
2970
- setBusy(true)
2957
+ setBusy(true); setActionNotice(null)
2971
2958
  try {
2972
2959
  await load()
2973
2960
  } finally {
@@ -2977,42 +2964,34 @@ window.__ModuleLoader__.load({
2977
2964
 
2978
2965
  /** Move the pool to another account; the panel's rows call this. */
2979
2966
  const activateAccount = useCallback(async (account) => {
2980
- setBusy(true)
2967
+ setBusy(true); setActionNotice(null); setSwitchingId(account.id)
2968
+ loadSequence.current += 1
2981
2969
  try {
2982
- await postRoute('/accounts/activate', { id: account.id })
2970
+ const result = await postRoute('/accounts/activate', { id: account.id })
2971
+ if (!result.ok) throw new Error(result.error ?? t('common.retry'))
2972
+ // The previous headline belongs to another account, even if the next read fails.
2973
+ setAccountInfo((previous) => previous ? { ...previous, credit: null, creditCheckedAt: null, creditStale: false, creditIdentity: null, accountId: account.id, source: undefined,
2974
+ pool: previous.pool ? { ...previous.pool, accounts: previous.pool.accounts.map((entry) => ({ ...entry, active: entry.id === account.id })) } : null,
2975
+ } : previous)
2983
2976
  await load()
2984
- } finally {
2985
- setBusy(false)
2986
- }
2977
+ setActionNotice({ kind: 'success', text: t('pool.switched').replace('{account}', account.label) })
2978
+ } catch (error) {
2979
+ setActionNotice({ kind: 'error', text: t('pool.switchFailed').replace('{account}', account.label).replace('{error}', error.message) })
2980
+ } finally { setBusy(false); setSwitchingId(null) }
2987
2981
  }, [load])
2988
2982
 
2989
- const accounts = usage?.pool?.accounts ?? []
2990
- const alertKey = `dca-balance-alert:${usage?.accountId ?? usage?.source ?? 'current'}:${usage?.lowBalanceThreshold ?? 500}`
2991
- let dismissed = (balanceDismissals.get(alertKey) ?? 0) > Date.now()
2992
- try { dismissed ||= Number(window.localStorage.getItem(alertKey)) > Date.now() } catch {}
2993
- useEffect(() => {
2994
- if (usage && usage.lowBalance === false) {
2995
- balanceDismissals.delete(alertKey)
2996
- try { window.localStorage.removeItem(alertKey) } catch {}
2997
- }
2998
- }, [alertKey, usage?.lowBalance])
2999
- const dismissAlert = () => {
3000
- balanceDismissals.set(alertKey, Date.now() + 86400000)
3001
- try { window.localStorage.setItem(alertKey, String(Date.now() + 86400000)) } catch {}
3002
- setDismissalVersion((value) => value + 1)
3003
- }
3004
- const lowBalance = usage?.lowBalance === true
3005
- const backupCount = accounts.filter((account) => !account.active && account.health?.state === 'available' && account.credit?.remain >= (usage?.lowBalanceThreshold ?? 500)).length
3006
-
2983
+ const accounts = accountInfo?.pool?.accounts ?? []
2984
+ const refreshing = busy && switchingId === null
2985
+ const refreshFailed = accountInfo?.accountReadFailed || accountInfo?.poolReadFailed || accountInfo?.creditStale || accounts.some((account) => account.creditStale)
3007
2986
  // Nothing to show until the Host answers, and nothing to show when no
3008
2987
  // credential is configured: an empty pill on every composer would be
3009
2988
  // noise for anyone not using this provider.
3010
- if (!usage || usage.composerChip === false) return null
2989
+ if (!accountInfo || accountInfo.composerChip === false) return null
3011
2990
  if (!ownsSelection) return null
3012
2991
  // With a 码道 model selected but no usable credential, saying nothing was
3013
2992
  // the worst option: the user picked this provider and the readout simply
3014
2993
  // is not there. Show the state and where to fix it instead.
3015
- const hasCredential = usage?.ok === true || usage?.source || usage?.account
2994
+ const hasCredential = accountInfo?.ok === true || accountInfo?.source || accountInfo?.account || accountInfo?.stage === 'gateway'
3016
2995
  if (!hasCredential) {
3017
2996
  const body = [
3018
2997
  h('span', { key: 'm', 'aria-hidden': true, className: 'dca-chip-mark' }, '◈'),
@@ -3029,7 +3008,7 @@ window.__ModuleLoader__.load({
3029
3008
  {
3030
3009
  type: 'button',
3031
3010
  className: 'dca-chip-trigger',
3032
- title: usage?.error ?? t('chip.noCredentialHint'),
3011
+ title: accountInfo?.error ?? t('chip.noCredentialHint'),
3033
3012
  onClick: openSettings,
3034
3013
  },
3035
3014
  ...body,
@@ -3037,10 +3016,10 @@ window.__ModuleLoader__.load({
3037
3016
  )
3038
3017
  }
3039
3018
 
3040
- const credits = usage.credit
3019
+ const credits = accountInfo.credit
3041
3020
  const label = credits
3042
- ? `${t('chip.credits')} ${credits.remain}`
3043
- : t('chip.loading')
3021
+ ? `${t(accountInfo.creditStale ? 'chip.lastCredits' : 'chip.credits')} ${formatCredits(credits.remain)}`
3022
+ : t('account.creditUnread')
3044
3023
 
3045
3024
  return h(
3046
3025
  'div',
@@ -3049,7 +3028,7 @@ window.__ModuleLoader__.load({
3049
3028
  'button',
3050
3029
  {
3051
3030
  type: 'button',
3052
- title: t('chip.panelTitle'),
3031
+ title: accountInfo.creditStale ? t('credit.refreshFailed') : t('chip.panelTitle'),
3053
3032
  'aria-haspopup': 'dialog',
3054
3033
  'aria-expanded': open,
3055
3034
  onClick: () => setOpen((value) => !value),
@@ -3057,7 +3036,7 @@ window.__ModuleLoader__.load({
3057
3036
  // compact controls, and a boxed pill among them reads as a form
3058
3037
  // field. Hover and focus come from the stylesheet, which inline
3059
3038
  // styles cannot express.
3060
- className: `dca-chip-trigger${open ? ' dca-chip-trigger-on' : ''}${lowBalance ? ' dca-low-balance' : ''}`,
3039
+ className: `dca-chip-trigger${open ? ' dca-chip-trigger-on' : ''}`,
3061
3040
  },
3062
3041
  h('span', { 'aria-hidden': true, className: 'dca-chip-mark' }, '◈'),
3063
3042
  h('span', null, label),
@@ -3087,7 +3066,7 @@ window.__ModuleLoader__.load({
3087
3066
  h(
3088
3067
  'svg',
3089
3068
  {
3090
- className: `dca-pop-refresh-icon${busy ? ' dca-pop-refresh-icon-spin' : ''}`,
3069
+ className: `dca-pop-refresh-icon${refreshing ? ' dca-pop-refresh-icon-spin' : ''}`,
3091
3070
  viewBox: '0 0 16 16',
3092
3071
  width: 12,
3093
3072
  height: 12,
@@ -3109,7 +3088,7 @@ window.__ModuleLoader__.load({
3109
3088
  strokeLinejoin: 'round',
3110
3089
  }),
3111
3090
  ),
3112
- t('chip.refresh'),
3091
+ refreshFailed ? t('common.retry') : t('chip.refresh'),
3113
3092
  ),
3114
3093
  h(
3115
3094
  'button',
@@ -3125,11 +3104,9 @@ window.__ModuleLoader__.load({
3125
3104
  t('chip.settings'),
3126
3105
  ),
3127
3106
  ),
3128
- lowBalance && !dismissed ? h('div', { className: 'dca-balance-alert', role: 'status' },
3129
- h('strong', null, t('reminder.low')),
3130
- h('span', null, t('reminder.backups').replace('{count}', backupCount)),
3131
- h('button', { type: 'button', className: 'dca-btn-xs', onClick: dismissAlert }, t('reminder.dismiss')),
3132
- ) : null,
3107
+ h(FeatureNotice, { notice: actionNotice }),
3108
+ refreshFailed ? h('p', { className: 'dca-pop-notice', role: 'status' }, accountInfo.credit || accounts.some((account) => account.credit) ? t('credit.refreshFailed') : t('credit.unavailable')) : null,
3109
+ h(CreditStatus, { account: accountInfo, now }),
3133
3110
  // One row per account, in a real table so the balances line up in a
3134
3111
  // single right-aligned column. The serving account is a row, not a
3135
3112
  // header: "which account" and "how many credits" are the same fact
@@ -3139,7 +3116,7 @@ window.__ModuleLoader__.load({
3139
3116
  ? h(
3140
3117
  'p',
3141
3118
  { className: 'dca-pop-empty' },
3142
- usage.credits ? formatBalance(usage.credits) : t('account.creditUnread'),
3119
+ accountInfo.credit ? formatBalance(accountInfo.credit) : t('account.creditUnread'),
3143
3120
  )
3144
3121
  : h(
3145
3122
  'table',
@@ -3175,6 +3152,7 @@ window.__ModuleLoader__.load({
3175
3152
  type: 'button',
3176
3153
  className: 'dca-pop-switch',
3177
3154
  disabled: busy || account.active,
3155
+ 'aria-busy': switchingId === account.id,
3178
3156
  title: t('chip.switchTo').replace('{account}', account.label),
3179
3157
  'aria-label': t('chip.switchTo').replace('{account}', account.label),
3180
3158
  onClick: () => void activateAccount(account),
@@ -3187,19 +3165,12 @@ window.__ModuleLoader__.load({
3187
3165
  'span',
3188
3166
  { className: 'dca-pop-who' },
3189
3167
  h('span', { className: 'dca-pop-name' }, account.label),
3190
- // The state goes UNDER the name, not beside it: a
3191
- // reason string ("约 21 小时后恢复") is long, and in a
3192
- // 248px panel it would squeeze the name to nothing.
3193
- account.active || account.error || account.checkin
3194
- ? h(
3195
- 'span',
3196
- { className: 'dca-pop-mark' },
3197
- account.active
3198
- ? h('span', { className: 'dca-pop-mark-current' }, t('chip.current'))
3199
- : null,
3200
- account.health ? h('span', { className: 'dca-pop-mark-reason' }, t(`health.${account.health.state}`)) : null,
3201
- account.error
3202
- ? h('span', { className: 'dca-pop-mark-reason' }, account.error)
3168
+ switchingId === account.id || account.active || account.error || (account.health?.state && account.health.state !== 'available')
3169
+ ? h('span', { className: 'dca-pop-mark' },
3170
+ switchingId === account.id ? h('span', { role: 'status' }, t('pool.switching')) : null,
3171
+ account.active ? h('span', { className: 'dca-pop-mark-current' }, t('chip.current')) : null,
3172
+ account.error || (account.health?.state && account.health.state !== 'available')
3173
+ ? h('span', { className: 'dca-pop-mark-reason', title: account.error || undefined }, t(`health.${account.health?.state && account.health.state !== 'available' ? account.health.state : 'unknown'}`))
3203
3174
  : null,
3204
3175
  )
3205
3176
  : null,
@@ -3208,8 +3179,9 @@ window.__ModuleLoader__.load({
3208
3179
  ),
3209
3180
  h(
3210
3181
  'td',
3211
- { className: `dca-pop-num${account.lowBalance ? ' dca-low-balance' : ''}` },
3182
+ { className: 'dca-pop-num' },
3212
3183
  account.credit ? formatCredits(account.credit.remain) : '—',
3184
+ h(CreditStatus, { account, now }),
3213
3185
  account.credit?.expiring > 0
3214
3186
  ? h(
3215
3187
  'span',