@eddyskywalker/dsh-chatgpt-subscription 0.88.1 → 0.89.0

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.
Files changed (58) hide show
  1. package/README.md +1 -1
  2. package/lib/client.js +1061 -284
  3. package/lib/client.js.map +1 -1
  4. package/lib/codemode.js +1 -0
  5. package/lib/index.js +391 -67
  6. package/lib/{progress-updates-CSBYky9J.js → progress-updates-DwpfBXOx.js} +53 -17
  7. package/lib/progress-updates.js +1 -1
  8. package/lib/types/client/features/progress-updates/contracts.d.ts +9 -0
  9. package/lib/types/client/features/progress-updates/contracts.d.ts.map +1 -1
  10. package/lib/types/client/features/progress-updates/dashboard.d.ts +12 -0
  11. package/lib/types/client/features/progress-updates/dashboard.d.ts.map +1 -0
  12. package/lib/types/client/features/progress-updates/host-source.d.ts +7 -1
  13. package/lib/types/client/features/progress-updates/host-source.d.ts.map +1 -1
  14. package/lib/types/client/features/progress-updates/locales.d.ts +59 -2
  15. package/lib/types/client/features/progress-updates/locales.d.ts.map +1 -1
  16. package/lib/types/client/features/progress-updates/updates-panel.d.ts +7 -89
  17. package/lib/types/client/features/progress-updates/updates-panel.d.ts.map +1 -1
  18. package/lib/types/client/locales-ru/hub.d.ts.map +1 -1
  19. package/lib/types/client/locales-ru/progress-updates.d.ts.map +1 -1
  20. package/lib/types/client/providers/codex-chatgpt/CodexSubscriptionSection.d.ts +1 -1
  21. package/lib/types/client/providers/codex-chatgpt/CodexSubscriptionSection.d.ts.map +1 -1
  22. package/lib/types/client/providers/codex-chatgpt/api.d.ts +3 -1
  23. package/lib/types/client/providers/codex-chatgpt/api.d.ts.map +1 -1
  24. package/lib/types/client/providers/codex-chatgpt/locales.d.ts +9 -1
  25. package/lib/types/client/providers/codex-chatgpt/locales.d.ts.map +1 -1
  26. package/lib/types/client/providers/codex-chatgpt/styles.d.ts.map +1 -1
  27. package/lib/types/compat.d.ts +1 -1
  28. package/lib/types/host/common/account-pool.d.ts +3 -0
  29. package/lib/types/host/common/account-pool.d.ts.map +1 -1
  30. package/lib/types/host/providers/antigravity-acp/adapter.d.ts.map +1 -1
  31. package/lib/types/host/providers/antigravity-acp/binary.d.ts +1 -1
  32. package/lib/types/host/providers/antigravity-acp/binary.d.ts.map +1 -1
  33. package/lib/types/host/providers/antigravity-acp/errors.d.ts +4 -2
  34. package/lib/types/host/providers/antigravity-acp/errors.d.ts.map +1 -1
  35. package/lib/types/host/providers/codex-chatgpt/codex-account-pool.d.ts +2 -0
  36. package/lib/types/host/providers/codex-chatgpt/codex-account-pool.d.ts.map +1 -1
  37. package/lib/types/host/providers/codex-chatgpt/codex-file-import.d.ts +12 -0
  38. package/lib/types/host/providers/codex-chatgpt/codex-file-import.d.ts.map +1 -0
  39. package/lib/types/host/providers/codex-chatgpt/codex-identity.d.ts +1 -0
  40. package/lib/types/host/providers/codex-chatgpt/codex-identity.d.ts.map +1 -1
  41. package/lib/types/host/providers/codex-chatgpt/routes.d.ts.map +1 -1
  42. package/lib/types/host/providers/kimi-code/cache-wait.d.ts +23 -0
  43. package/lib/types/host/providers/kimi-code/cache-wait.d.ts.map +1 -1
  44. package/lib/types/host/providers/opencode-go/mapper.d.ts.map +1 -1
  45. package/lib/types/host/providers/opendesign/mapper.d.ts.map +1 -1
  46. package/lib/types/host/runtime/codemode/rules.d.ts.map +1 -1
  47. package/lib/types/host/runtime/progress-updates/index.d.ts +1 -1
  48. package/lib/types/host/runtime/progress-updates/index.d.ts.map +1 -1
  49. package/lib/types/host/runtime/progress-updates/nudge.d.ts +1 -1
  50. package/lib/types/host/runtime/progress-updates/routes.d.ts +3 -1
  51. package/lib/types/host/runtime/progress-updates/routes.d.ts.map +1 -1
  52. package/lib/types/host/runtime/progress-updates/store.d.ts +8 -1
  53. package/lib/types/host/runtime/progress-updates/store.d.ts.map +1 -1
  54. package/lib/types/index.d.ts +2 -2
  55. package/lib/types/index.d.ts.map +1 -1
  56. package/lib/types/shared/contracts.d.ts +6 -0
  57. package/lib/types/shared/contracts.d.ts.map +1 -1
  58. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -840,6 +840,10 @@ window.__ModuleLoader__.load({
840
840
  hubUpdateCommandLabel: "手动更新命令",
841
841
  localCodexLoginImport: "导入本机登录",
842
842
  localCodexLoginImporting: "导入中…",
843
+ credentialFileImport: "导入 CPA / sub2api",
844
+ credentialFileImporting: "导入中…",
845
+ credentialFileImportDetail: "从 CPA ZIP 或 sub2api JSON 文件导入 ChatGPT 账号",
846
+ credentialFileImportResult: "已导入 {count} 个 {format} 账号,跳过 {skipped} 个。",
843
847
  deviceCodeLogin: "设备代码登录",
844
848
  deviceCodeLoginStarting: "获取代码…",
845
849
  deviceCodeLoginDetail: "用设备代码添加账号",
@@ -1114,6 +1118,10 @@ window.__ModuleLoader__.load({
1114
1118
  hubUpdateCommandLabel: "Manual update command",
1115
1119
  localCodexLoginImport: "Import local sign-in",
1116
1120
  localCodexLoginImporting: "Importing…",
1121
+ credentialFileImport: "Import CPA / sub2api",
1122
+ credentialFileImporting: "Importing…",
1123
+ credentialFileImportDetail: "Import ChatGPT accounts from a CPA ZIP or sub2api JSON file",
1124
+ credentialFileImportResult: "Imported {count} {format} accounts; skipped {skipped}.",
1117
1125
  deviceCodeLogin: "Device-code sign-in",
1118
1126
  deviceCodeLoginStarting: "Requesting code…",
1119
1127
  deviceCodeLoginDetail: "Add account with device code",
@@ -2129,6 +2137,14 @@ window.__ModuleLoader__.load({
2129
2137
  adoptLocalLogin(source) {
2130
2138
  return post$9(`${ROUTE_PREFIX}/adopt`, { source });
2131
2139
  }
2140
+ /** Import a CPA ZIP or sub2api JSON file without exposing its credentials in a DTO. */
2141
+ importCredentialFile(file) {
2142
+ return request$6(`${ROUTE_PREFIX}/accounts/import`, {
2143
+ method: "POST",
2144
+ headers: { "content-type": "application/octet-stream" },
2145
+ body: file
2146
+ });
2147
+ }
2132
2148
  /** Forget every imported snapshot. The CLIs' own files are never touched. */
2133
2149
  disableAdoptedLocalLogins() {
2134
2150
  return post$9(`${ROUTE_PREFIX}/adopt/disable`, {});
@@ -3300,6 +3316,7 @@ window.__ModuleLoader__.load({
3300
3316
  function CodexSubscriptionSection({ t }) {
3301
3317
  const apiRef = (0, react.useRef)(new SubscriptionApi());
3302
3318
  const eventSourceRef = (0, react.useRef)(null);
3319
+ const credentialFileInputRef = (0, react.useRef)(null);
3303
3320
  /**
3304
3321
  * The flow the card knows it started.
3305
3322
  *
@@ -3326,6 +3343,7 @@ window.__ModuleLoader__.load({
3326
3343
  /** Ticked once a second, so the panel's countdown is a clock and not a snapshot. */
3327
3344
  const [now, setNow] = (0, react.useState)(() => Date.now());
3328
3345
  const [resetCreditNotice, setResetCreditNotice] = (0, react.useState)(null);
3346
+ const [credentialImportNotice, setCredentialImportNotice] = (0, react.useState)(null);
3329
3347
  const [connection, setConnection] = (0, react.useState)(null);
3330
3348
  const [contextDrafts, setContextDrafts] = (0, react.useState)({});
3331
3349
  const load = (0, react.useCallback)(async (quiet = false) => {
@@ -3689,6 +3707,18 @@ window.__ModuleLoader__.load({
3689
3707
  await load(true);
3690
3708
  });
3691
3709
  };
3710
+ const importCredentialFile = async (file) => {
3711
+ setCredentialImportNotice(null);
3712
+ await run("file-import", async () => {
3713
+ const result = await apiRef.current.importCredentialFile(file);
3714
+ setStatus(result.status);
3715
+ setCredentialImportNotice(formatPoolLabel(t("credentialFileImportResult"), {
3716
+ format: result.format === "cpa" ? "CPA" : "sub2api",
3717
+ count: result.imported,
3718
+ skipped: result.skipped
3719
+ }));
3720
+ });
3721
+ };
3692
3722
  const setRotationStrategy = async (strategy) => {
3693
3723
  await run("strategy", async () => {
3694
3724
  const next = await apiRef.current.accountAction("strategy", { strategy });
@@ -3785,7 +3815,7 @@ window.__ModuleLoader__.load({
3785
3815
  onSetStrategy: (strategy) => void setRotationStrategy(strategy),
3786
3816
  showQuota: true,
3787
3817
  renderLoginActions: () => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3788
- className: "dsha-account-add-actions",
3818
+ className: "dsha-account-add-actions dsh-codex-login-actions",
3789
3819
  children: [
3790
3820
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3791
3821
  className: "dsha-btn dsha-btn-primary",
@@ -3808,6 +3838,26 @@ window.__ModuleLoader__.load({
3808
3838
  title: t("localCodexLoginImport"),
3809
3839
  onClick: () => void importLocalSignIn(),
3810
3840
  children: busy === "adopt" ? t("localCodexLoginImporting") : t("localCodexLoginImport")
3841
+ }),
3842
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3843
+ ref: credentialFileInputRef,
3844
+ type: "file",
3845
+ hidden: true,
3846
+ accept: ".zip,.json,application/zip,application/json",
3847
+ "aria-label": t("credentialFileImportDetail"),
3848
+ onChange: (event) => {
3849
+ const file = event.currentTarget.files?.[0];
3850
+ event.currentTarget.value = "";
3851
+ if (file !== void 0) importCredentialFile(file);
3852
+ }
3853
+ }),
3854
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3855
+ className: "dsha-btn",
3856
+ disabled: busy !== null,
3857
+ "aria-label": t("credentialFileImportDetail"),
3858
+ title: t("credentialFileImportDetail"),
3859
+ onClick: () => credentialFileInputRef.current?.click(),
3860
+ children: busy === "file-import" ? t("credentialFileImporting") : t("credentialFileImport")
3811
3861
  })
3812
3862
  ]
3813
3863
  }),
@@ -3817,6 +3867,11 @@ window.__ModuleLoader__.load({
3817
3867
  entry.planLabel
3818
3868
  ] }) }),
3819
3869
  children: [
3870
+ credentialImportNotice !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3871
+ className: "dsh-codex-success",
3872
+ role: "status",
3873
+ children: credentialImportNotice
3874
+ }) : null,
3820
3875
  login?.active && deviceLogin === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3821
3876
  className: "dsha-muted",
3822
3877
  role: "status",
@@ -27301,6 +27356,25 @@ window.__ModuleLoader__.load({
27301
27356
  progressCollapse: "收起这条进展",
27302
27357
  progressEmptyTitle: "还没有进展更新",
27303
27358
  progressEmptyHint: "agent 开始多步任务后,会在这里汇报它进行到哪一步。",
27359
+ workspaceTitle: "工作脉络",
27360
+ tabUpdates: "进展",
27361
+ tabTasks: "任务",
27362
+ tabArchive: "归档",
27363
+ tasksEmpty: "当前会话还没有任务清单",
27364
+ tasksProgress: "任务完成 {n}%",
27365
+ tasksSummary: "已完成 {done} / {total} 项任务",
27366
+ tasksBreakdown: "{active} 项进行中 · {pending} 项待处理",
27367
+ archiveScale: "按 {n} 归档",
27368
+ archiveEmpty: "还没有可归档的进展",
27369
+ archiveCount: "{n} 条进展",
27370
+ filterPlaceholder: "搜索标题或正文",
27371
+ sourceFilter: "按来源筛选",
27372
+ sourceAll: "全部来源",
27373
+ exportMarkdown: "导出筛选结果为 Markdown",
27374
+ filterEmpty: "没有匹配的进展",
27375
+ filterEmptyHint: "换个关键词或清除来源筛选。",
27376
+ copyUpdate: "复制这条进展",
27377
+ copied: "已复制",
27304
27378
  rowPending: "进展更新",
27305
27379
  rowRunning: "进行中",
27306
27380
  rowDone: "已汇报",
@@ -27356,6 +27430,25 @@ window.__ModuleLoader__.load({
27356
27430
  progressCollapse: "Collapse this update",
27357
27431
  progressEmptyTitle: "No progress updates yet",
27358
27432
  progressEmptyHint: "Once the agent starts multi-step work, it reports how far it has got right here.",
27433
+ workspaceTitle: "Workstream",
27434
+ tabUpdates: "Updates",
27435
+ tabTasks: "Tasks",
27436
+ tabArchive: "Archive",
27437
+ tasksEmpty: "This session has no task list yet",
27438
+ tasksProgress: "{n}% of tasks complete",
27439
+ tasksSummary: "{done} of {total} tasks complete",
27440
+ tasksBreakdown: "{active} active · {pending} pending",
27441
+ archiveScale: "Group by {n}",
27442
+ archiveEmpty: "No updates to archive yet",
27443
+ archiveCount: "{n} updates",
27444
+ filterPlaceholder: "Search titles and details",
27445
+ sourceFilter: "Filter by source",
27446
+ sourceAll: "All sources",
27447
+ exportMarkdown: "Export filtered updates as Markdown",
27448
+ filterEmpty: "No matching updates",
27449
+ filterEmptyHint: "Try another keyword or clear the source filter.",
27450
+ copyUpdate: "Copy this update",
27451
+ copied: "Copied",
27359
27452
  rowPending: "Progress update",
27360
27453
  rowRunning: "Reporting",
27361
27454
  rowDone: "Reported",
@@ -28208,6 +28301,10 @@ window.__ModuleLoader__.load({
28208
28301
  hubUpdateCommandLabel: "Команда для ручного обновления",
28209
28302
  localCodexLoginImport: "Импорт локального входа",
28210
28303
  localCodexLoginImporting: "Импорт…",
28304
+ credentialFileImport: "Импорт CPA / sub2api",
28305
+ credentialFileImporting: "Импорт…",
28306
+ credentialFileImportDetail: "Импорт аккаунтов ChatGPT из CPA ZIP или sub2api JSON",
28307
+ credentialFileImportResult: "Импортировано аккаунтов {format}: {count}; пропущено: {skipped}.",
28211
28308
  deviceCodeLogin: "Вход по коду устройства",
28212
28309
  deviceCodeLoginStarting: "Получаем код…",
28213
28310
  deviceCodeLoginDetail: "Добавить аккаунт по коду устройства",
@@ -28947,6 +29044,25 @@ window.__ModuleLoader__.load({
28947
29044
  progressCollapse: "Свернуть эту запись",
28948
29045
  progressEmptyTitle: "Записей о ходе работы пока нет",
28949
29046
  progressEmptyHint: "Когда агент начнёт многошаговую задачу, он будет сообщать здесь, на каком шаге находится.",
29047
+ workspaceTitle: "Ход работы",
29048
+ tabUpdates: "Обновления",
29049
+ tabTasks: "Задачи",
29050
+ tabArchive: "Архив",
29051
+ tasksEmpty: "В этом сеансе пока нет списка задач",
29052
+ tasksProgress: "Выполнено задач: {n}%",
29053
+ tasksSummary: "Выполнено {done} из {total} задач",
29054
+ tasksBreakdown: "В работе: {active} · Ожидают: {pending}",
29055
+ archiveScale: "Группировать по {n}",
29056
+ archiveEmpty: "Обновлений для архива пока нет",
29057
+ archiveCount: "Обновлений: {n}",
29058
+ filterPlaceholder: "Поиск по заголовкам и тексту",
29059
+ sourceFilter: "Фильтр по источнику",
29060
+ sourceAll: "Все источники",
29061
+ exportMarkdown: "Экспортировать отфильтрованные обновления в Markdown",
29062
+ filterEmpty: "Подходящих обновлений нет",
29063
+ filterEmptyHint: "Измените запрос или сбросьте фильтр источника.",
29064
+ copyUpdate: "Копировать это обновление",
29065
+ copied: "Скопировано",
28950
29066
  rowPending: "Ход работы",
28951
29067
  rowRunning: "Сообщает",
28952
29068
  rowDone: "Сообщено",
@@ -29966,15 +30082,13 @@ window.__ModuleLoader__.load({
29966
30082
  const CSS$6 = `
29967
30083
  .dsh-codex-page{box-sizing:border-box;color:var(--dsw-alias-label-primary);display:flex;flex-direction:column;gap:20px;max-width:780px;min-width:0;padding:2px 0 30px}
29968
30084
  .dsh-codex-page *{box-sizing:border-box}
29969
- /* The pool card's login row holds three entries. They must stay on ONE line: a
29970
- wrapped row stops reading as a set of alternatives, and the third entry is the
29971
- one that gets pushed out. .dsha-btn carries white-space:nowrap, so shrinking
29972
- the row means letting the buttons shrink and ellipsizing the label inside —
29973
- the accessible name stays whole in aria-label/title, which is where the full
29974
- sentence lives. flex-basis 0 keeps the three of them sharing the width evenly
29975
- instead of the longest one claiming it. */
29976
- .dsh-codex-page :where(.dsha-account-add-actions){flex-wrap:nowrap;min-width:0}
29977
- .dsh-codex-page :where(.dsha-account-add-actions) > .dsha-btn{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis}
30085
+ .dsh-codex-page :where(.dsha-account-add-actions:not(.dsh-codex-login-actions)){flex-wrap:nowrap;min-width:0}
30086
+ .dsh-codex-page :where(.dsha-account-add-actions:not(.dsh-codex-login-actions)) > .dsha-btn{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis}
30087
+ /* Wrap the heading and actions as units when the full labels need more room. */
30088
+ .dsha-grouphead:has(> .dsh-codex-login-actions){flex-wrap:wrap;gap:6px 8px}
30089
+ .dsha-grouphead:has(> .dsh-codex-login-actions) > h3 > .dsha-muted{font-size:12px}
30090
+ .dsh-codex-page .dsh-codex-login-actions{gap:4px;max-width:100%}
30091
+ .dsh-codex-login-actions > .dsha-btn{font-size:12px;padding-inline:6px}
29978
30092
  .dsh-codex-title{font-size:15px;font-weight:650;line-height:1.4;margin:0 0 5px}
29979
30093
  .dsh-codex-intro,.dsh-codex-muted{color:var(--dsw-alias-label-secondary);font-size:13px;line-height:1.55;margin:0}
29980
30094
  .dsh-codex-group{border-top:0.5px solid var(--dsw-alias-border-l2);min-width:0}
@@ -60969,136 +61083,45 @@ window.__ModuleLoader__.load({
60969
61083
  }) });
60970
61084
  }
60971
61085
  //#endregion
60972
- //#region src/client/features/progress-updates/updates-panel.tsx
60973
- /**
60974
- * 进展更新面板:把 `progress_update` 工具产生的进展按时间顺序列出来。
60975
- *
60976
- * 交互照 Kimi Code:**最新一条默认展开,更早的自动收起,点标题可切换**。
60977
- * 每条只显示一行标题;展开时才渲染详情正文(保留换行,不做完整 Markdown
60978
- * 渲染 —— 契约里限定的就是「一段正文 + 少量 bullet」)。
60979
- *
60980
- * 数据源:纯展示组件只认一个 `updates` 数组 prop(见 {@link UpdatesPanelProps})。
60981
- * 真实的取数通道是宿主路由 `GET /api/dsh-progress-updates/updates?session=<id>`,
60982
- * 浏览器半边的轮询客户端在 `./host-source.ts`(`createHostProgressSource`),它
60983
- * 把结果包成 {@link ProgressSnapshotSource} 交给入口。{@link EMPTY_SOURCE} 只剩
60984
- * 两个用途:没有会话身份时的兜底,以及测试里的空快照参照。
60985
- *
60986
- * 文案全部走 locale(本插件 `dsh-progress-updates` 命名空间),文件里不出现
60987
- * 硬编码中文。
60988
- *
60989
- * @module @eddyskywalker/dsh-chatgpt-subscription/client/progress-updates/updates-panel
60990
- */
60991
- /**
60992
- * 兜底翻译:只在本组件被渲染在 slot 框架之外时用到(jsdom 测试、故事预览)。
60993
- * 走同一份 zh 字典,因此不存在第二套文案。框架内渲染时用注入的 `t` 座位,
60994
- * 这样第三方语言包也能生效。
60995
- * @param key - `dsh-progress-updates` 命名空间的键。
60996
- * @param params - `{name}` 模板参数。
60997
- * @returns 该键的文案;缺键时回退为键本身。
60998
- */
60999
- function fallbackTranslate$2(key, params) {
61000
- return interpolate(zh$3[key] ?? key, params);
61001
- }
61002
- /**
61003
- * 把 `{name}` 占位符换成实参。
61004
- *
61005
- * 单独成一个函数,是因为**两条取值路径都要用它**:没有 locale 服务的兜底字典,
61006
- * 和有服务时的当前语言字典。早先只有兜底那条做了替换,于是真实部署里
61007
- * 「共 {n} 条」原样上屏。
61008
- * @param template - 含占位符的模板。
61009
- * @param params - 各占位符的实参。
61010
- * @returns 替换后的文本;没有 params 时原样返回。
61011
- */
61012
- function interpolate(template, params) {
61086
+ //#region src/client/features/progress-updates/dashboard.tsx
61087
+ const PANEL_CSS = [
61088
+ ".pg-dashboard { container-type: inline-size; }",
61089
+ ".pg-dashboard button, .pg-dashboard input, .pg-dashboard select { font: inherit; }",
61090
+ ".pg-dashboard button:focus-visible, .pg-dashboard input:focus-visible, .pg-dashboard select:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary, #7c8cff); outline-offset: 2px; }",
61091
+ ".pg-quiet-button { transition: background 120ms ease, color 120ms ease, border-color 120ms ease; }",
61092
+ ".pg-quiet-button:hover { background: var(--dsw-alias-fill-hover, rgb(127 127 127 / 12%)) !important; }",
61093
+ ".pg-update-card { transition: border-color 140ms ease, background 140ms ease; }",
61094
+ ".pg-update-card:hover { border-color: var(--dsw-alias-border-l1, rgb(127 127 127 / 28%)) !important; }",
61095
+ ".pg-scroll { scrollbar-width: thin; scrollbar-color: var(--dsw-alias-border-l1, #555) transparent; }",
61096
+ "@container (max-width: 390px) { .pg-overview-meta { display: none !important; } .pg-toolbar { grid-template-columns: 1fr !important; } .pg-source-filter { display: none !important; } }",
61097
+ "@media (prefers-reduced-motion: reduce) { .pg-dashboard * { transition: none !important; } }"
61098
+ ].join("\n");
61099
+ const colors = {
61100
+ primary: "var(--dsw-alias-label-primary, #e7e9ee)",
61101
+ secondary: "var(--dsw-alias-label-secondary, #a4a9b5)",
61102
+ tertiary: "var(--dsw-alias-label-tertiary, #777e8c)",
61103
+ brand: "var(--dsw-alias-brand-primary, #8b9dff)",
61104
+ success: "var(--dsw-alias-success-primary, #62c99b)",
61105
+ warning: "var(--dsw-alias-warning-primary, #e6b86a)",
61106
+ border: "var(--dsw-alias-border-l2, rgb(127 127 127 / 18%))",
61107
+ surface: "var(--dsw-alias-bg-layer-1, rgb(127 127 127 / 5%))",
61108
+ raised: "var(--dsw-alias-bg-layer-2, rgb(127 127 127 / 8%))"
61109
+ };
61110
+ function interpolate$1(template, params) {
61013
61111
  if (params === void 0) return template;
61014
61112
  let text = template;
61015
- for (const [name, value] of Object.entries(params)) text = text.replaceAll(`{${name}}`, String(value));
61113
+ for (const [key, value] of Object.entries(params)) text = text.replaceAll(`{${key}}`, String(value));
61016
61114
  return text;
61017
61115
  }
61018
- /** 一份空进展快照。 */
61019
- const EMPTY_UPDATES = Object.freeze([]);
61020
- Object.freeze({
61021
- getSnapshot: () => EMPTY_UPDATES,
61022
- subscribe: () => () => {}
61023
- });
61024
- /** 面板容器样式。 */
61025
- const panelStyle = {
61026
- display: "flex",
61027
- flexDirection: "column",
61028
- gap: "8px",
61029
- padding: "10px 12px 16px",
61030
- minHeight: "0",
61031
- overflowY: "auto",
61032
- fontSize: "12px",
61033
- color: "var(--dsw-alias-label-primary, #1f2329)"
61034
- };
61035
- /** 一条进展的外框样式。 */
61036
- const rowStyle$1 = {
61037
- display: "flex",
61038
- flexDirection: "column",
61039
- gap: "6px",
61040
- border: "1px solid var(--dsw-alias-border-l2, rgb(0 0 0 / 10%))",
61041
- borderRadius: "8px",
61042
- background: "var(--dsw-alias-bg-layer-1, rgb(255 255 255 / 60%))",
61043
- padding: "8px 10px"
61044
- };
61045
- /** 行标题按钮样式(整行可点,去掉原生按钮外观)。 */
61046
- const headerStyle$1 = {
61047
- display: "flex",
61048
- alignItems: "flex-start",
61049
- gap: "8px",
61050
- width: "100%",
61051
- padding: "0",
61052
- border: "0",
61053
- background: "transparent",
61054
- color: "inherit",
61055
- font: "inherit",
61056
- textAlign: "left",
61057
- cursor: "pointer"
61058
- };
61059
- /** 标题文本样式。 */
61060
- const titleStyle$1 = {
61061
- flex: "1 1 auto",
61062
- minWidth: "0",
61063
- fontSize: "12px",
61064
- fontWeight: 500,
61065
- lineHeight: "1.5",
61066
- overflowWrap: "anywhere"
61067
- };
61068
- /** 时间戳/徽标的小字样式。 */
61069
- const metaStyle = {
61070
- flex: "0 0 auto",
61071
- fontSize: "11px",
61072
- lineHeight: "1.5",
61073
- color: "var(--dsw-alias-label-tertiary, #8a9099)"
61074
- };
61075
- /**
61076
- * 展开行正文的容器样式。
61077
- *
61078
- * 正文本身交给平台的 `MarkdownText` 渲染(GFM、列表、行内代码、表格、KaTeX 全都在
61079
- * 那一套里),这里只负责外边距、字号与颜色:`pre-wrap` 与手写解析都撤掉了,
61080
- * 因为 Markdown 的块级结构必须由渲染器产出的元素决定,纯文本的换行保留只会把
61081
- * 列表符号与星号原样显示出来。
61082
- */
61083
- const messageStyle$1 = {
61084
- margin: "2px 0 0",
61085
- fontSize: "13px",
61086
- lineHeight: "1.6",
61087
- color: "var(--dsw-alias-label-secondary, #5b6270)"
61088
- };
61089
- /** 空态容器样式。 */
61090
- const emptyStyle = {
61091
- display: "flex",
61092
- flexDirection: "column",
61093
- gap: "4px",
61094
- padding: "16px 4px",
61095
- color: "var(--dsw-alias-label-tertiary, #8a9099)"
61096
- };
61097
- /**
61098
- * 一天的短格式时间(HH:MM)。只输出数字与分隔符,与语言无关。
61099
- * @param at - Unix 毫秒时间戳。
61100
- * @returns 本地时区的 HH:MM;非法时间戳返回空串。
61101
- */
61116
+ function translator(t) {
61117
+ return (key, params) => {
61118
+ return interpolate$1(t === void 0 ? zh$3[key] ?? key : t(key), params);
61119
+ };
61120
+ }
61121
+ function titleOf(update) {
61122
+ if (update.title !== void 0 && update.title.trim() !== "") return update.title;
61123
+ return update.message.split("\n").find((line) => line.trim() !== "") ?? "";
61124
+ }
61102
61125
  function clockOf(at) {
61103
61126
  if (!Number.isFinite(at)) return "";
61104
61127
  try {
@@ -61110,191 +61133,920 @@ window.__ModuleLoader__.load({
61110
61133
  return "";
61111
61134
  }
61112
61135
  }
61113
- /**
61114
- * 标题行文本:没有 title 时用正文首行,保证每行都有一个可读标题。
61115
- * @param update - 一条进展。
61116
- * @returns 标题文本。
61117
- */
61118
- function titleOf(update) {
61119
- if (update.title !== void 0 && update.title.trim() !== "") return update.title;
61120
- return update.message.split("\n").find((line) => line.trim() !== "") ?? "";
61136
+ function dayOf(at) {
61137
+ try {
61138
+ return new Date(at).toLocaleDateString([], {
61139
+ month: "short",
61140
+ day: "numeric",
61141
+ weekday: "short"
61142
+ });
61143
+ } catch {
61144
+ return "";
61145
+ }
61121
61146
  }
61122
- /**
61123
- * 展开指示箭头,跟随展开状态旋转。
61124
- * @param props - 是否展开。
61125
- * @returns 装饰性箭头图标。
61126
- */
61127
- function Chevron$2({ expanded }) {
61147
+ function dateTimeOf(at) {
61148
+ try {
61149
+ return new Date(at).toISOString();
61150
+ } catch {
61151
+ return "";
61152
+ }
61153
+ }
61154
+ function Icon({ name, size = 14 }) {
61128
61155
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
61129
61156
  viewBox: "0 0 16 16",
61130
- width: "12",
61131
- height: "12",
61157
+ width: size,
61158
+ height: size,
61132
61159
  fill: "none",
61133
61160
  stroke: "currentColor",
61134
- strokeWidth: "1.4",
61161
+ strokeWidth: "1.35",
61135
61162
  strokeLinecap: "round",
61136
61163
  strokeLinejoin: "round",
61137
61164
  "aria-hidden": "true",
61165
+ children: {
61166
+ arrow: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 4 4 4-4 4" }),
61167
+ copy: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
61168
+ x: "5",
61169
+ y: "5",
61170
+ width: "7",
61171
+ height: "8",
61172
+ rx: "1.5"
61173
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 10V4a1 1 0 0 1 1-1h5" })] }),
61174
+ download: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 2v8m0 0 3-3m-3 3L5 7" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 12v2h10v-2" })] }),
61175
+ search: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
61176
+ cx: "7",
61177
+ cy: "7",
61178
+ r: "4"
61179
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m10 10 3 3" })] }),
61180
+ task: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
61181
+ x: "3",
61182
+ y: "2.5",
61183
+ width: "10",
61184
+ height: "11",
61185
+ rx: "2"
61186
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m5.5 6 1.5 1.5 3-3M5.5 11h5" })] }),
61187
+ pulse: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2 8h3l1.5-4 3 8 1.5-4h3" }) }),
61188
+ archive: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
61189
+ x: "2.5",
61190
+ y: "3",
61191
+ width: "11",
61192
+ height: "3",
61193
+ rx: "1"
61194
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 6v6h8V6M6.5 9h3" })] })
61195
+ }[name]
61196
+ });
61197
+ }
61198
+ function QuietButton({ label, onClick, children, active = false, part }) {
61199
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
61200
+ type: "button",
61201
+ className: "pg-quiet-button",
61202
+ "data-dsh-part": part,
61203
+ "aria-label": label,
61204
+ title: label,
61205
+ onClick,
61138
61206
  style: {
61139
- flex: "0 0 auto",
61140
- marginTop: "3px",
61141
- transform: expanded ? "rotate(90deg)" : "none",
61142
- transition: "transform 120ms ease"
61207
+ display: "inline-flex",
61208
+ alignItems: "center",
61209
+ justifyContent: "center",
61210
+ gap: "5px",
61211
+ minHeight: "28px",
61212
+ padding: "4px 8px",
61213
+ border: `1px solid ${active ? colors.brand : colors.border}`,
61214
+ borderRadius: "7px",
61215
+ background: active ? "color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 12%, transparent)" : "transparent",
61216
+ color: active ? colors.brand : colors.secondary,
61217
+ cursor: "pointer",
61218
+ fontSize: "11px"
61143
61219
  },
61144
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 4 4 4-4 4" })
61220
+ children
61145
61221
  });
61146
61222
  }
61147
- /**
61148
- * 侧栏进展面板(纯展示)。
61149
- * @param props - 进展数组与可选的注入文案座位。
61150
- * @returns 进展列表;没有进展时渲染占位空态。
61151
- */
61152
- function ProgressUpdatesPanel({ updates, t }) {
61153
- /**
61154
- * 翻译并**补齐占位符**。
61155
- *
61156
- * locale 服务交来的 `t` 只接受一个键、不做插值,所以参数必须在这一层补上:
61157
- * 直接把 `t(key)` 当作结果会留下原样的 `{n}`(线上真出现过「共 {n} 条」)。
61158
- * 先按当前语言的字典取值(没有 `t` 时才用兜底字典),再统一做一次替换。
61159
- */
61160
- const translate = (key, params) => {
61161
- return interpolate(t === void 0 ? zh$3[key] ?? key : t(key), params);
61223
+ function taskCounts(tasks) {
61224
+ return {
61225
+ completed: tasks.filter((task) => task.status === "completed").length,
61226
+ active: tasks.filter((task) => task.status === "in_progress").length,
61227
+ pending: tasks.filter((task) => task.status === "pending").length
61162
61228
  };
61229
+ }
61230
+ function TaskOverview({ tasks, t }) {
61231
+ const counts = taskCounts(tasks);
61232
+ const progress = tasks.length === 0 ? 0 : Math.round(counts.completed / tasks.length * 100);
61233
+ const radius = 25;
61234
+ const circumference = 2 * Math.PI * radius;
61235
+ if (tasks.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61236
+ "data-dsh-part": "tasks-empty",
61237
+ style: {
61238
+ padding: "28px 10px",
61239
+ textAlign: "center",
61240
+ color: colors.tertiary
61241
+ },
61242
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
61243
+ name: "task",
61244
+ size: 22
61245
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61246
+ style: { marginTop: "8px" },
61247
+ children: t("tasksEmpty")
61248
+ })]
61249
+ });
61250
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
61251
+ "data-dsh-part": "tasks-view",
61252
+ style: { padding: "4px 2px 18px" },
61253
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61254
+ style: {
61255
+ display: "flex",
61256
+ alignItems: "center",
61257
+ gap: "16px",
61258
+ padding: "12px",
61259
+ marginBottom: "12px",
61260
+ borderRadius: "12px",
61261
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 10%, transparent), transparent)"
61262
+ },
61263
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61264
+ style: {
61265
+ position: "relative",
61266
+ width: "62px",
61267
+ height: "62px",
61268
+ flex: "0 0 auto"
61269
+ },
61270
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
61271
+ viewBox: "0 0 62 62",
61272
+ width: "62",
61273
+ height: "62",
61274
+ "aria-label": t("tasksProgress", { n: progress }),
61275
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
61276
+ cx: "31",
61277
+ cy: "31",
61278
+ r: radius,
61279
+ fill: "none",
61280
+ stroke: colors.border,
61281
+ strokeWidth: "5"
61282
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
61283
+ cx: "31",
61284
+ cy: "31",
61285
+ r: radius,
61286
+ fill: "none",
61287
+ stroke: colors.brand,
61288
+ strokeWidth: "5",
61289
+ strokeLinecap: "round",
61290
+ strokeDasharray: circumference,
61291
+ strokeDashoffset: circumference * (1 - progress / 100),
61292
+ transform: "rotate(-90 31 31)"
61293
+ })]
61294
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
61295
+ style: {
61296
+ position: "absolute",
61297
+ inset: "0",
61298
+ display: "grid",
61299
+ placeItems: "center",
61300
+ fontSize: "13px",
61301
+ fontWeight: 650,
61302
+ color: colors.primary
61303
+ },
61304
+ children: [progress, "%"]
61305
+ })]
61306
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61307
+ style: { minWidth: 0 },
61308
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61309
+ style: {
61310
+ color: colors.primary,
61311
+ fontSize: "14px",
61312
+ fontWeight: 600
61313
+ },
61314
+ children: t("tasksSummary", {
61315
+ done: counts.completed,
61316
+ total: tasks.length
61317
+ })
61318
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61319
+ style: {
61320
+ color: colors.secondary,
61321
+ fontSize: "11px",
61322
+ marginTop: "5px"
61323
+ },
61324
+ children: t("tasksBreakdown", {
61325
+ active: counts.active,
61326
+ pending: counts.pending
61327
+ })
61328
+ })]
61329
+ })]
61330
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
61331
+ style: {
61332
+ listStyle: "none",
61333
+ padding: 0,
61334
+ margin: 0,
61335
+ display: "grid",
61336
+ gap: "6px"
61337
+ },
61338
+ children: tasks.map((task) => {
61339
+ const done = task.status === "completed";
61340
+ const active = task.status === "in_progress";
61341
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
61342
+ "data-task-status": task.status,
61343
+ style: {
61344
+ display: "flex",
61345
+ gap: "10px",
61346
+ alignItems: "flex-start",
61347
+ padding: "9px 10px",
61348
+ borderRadius: "9px",
61349
+ background: active ? "color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 9%, transparent)" : "transparent",
61350
+ border: `1px solid ${active ? "color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 25%, transparent)" : "transparent"}`
61351
+ },
61352
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61353
+ "aria-hidden": "true",
61354
+ style: {
61355
+ flex: "0 0 auto",
61356
+ width: "15px",
61357
+ height: "15px",
61358
+ marginTop: "2px",
61359
+ borderRadius: "50%",
61360
+ display: "grid",
61361
+ placeItems: "center",
61362
+ border: `1.5px solid ${done ? colors.success : active ? colors.brand : colors.tertiary}`,
61363
+ background: done ? colors.success : "transparent",
61364
+ color: "#fff",
61365
+ fontSize: "10px"
61366
+ },
61367
+ children: done ? "✓" : active ? "•" : ""
61368
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61369
+ style: { minWidth: 0 },
61370
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61371
+ style: {
61372
+ color: done ? colors.tertiary : colors.primary,
61373
+ textDecoration: done ? "line-through" : "none",
61374
+ fontSize: "12px",
61375
+ lineHeight: 1.55,
61376
+ overflowWrap: "anywhere"
61377
+ },
61378
+ children: task.content
61379
+ }), active && task.activeForm !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61380
+ style: {
61381
+ color: colors.brand,
61382
+ fontSize: "11px",
61383
+ marginTop: "3px"
61384
+ },
61385
+ children: task.activeForm
61386
+ })]
61387
+ })]
61388
+ }, task.id);
61389
+ })
61390
+ })]
61391
+ });
61392
+ }
61393
+ function ArchiveView({ updates, t }) {
61394
+ const [scale, setScale] = (0, react.useState)(36e5);
61395
+ const groups = (0, react.useMemo)(() => {
61396
+ const buckets = /* @__PURE__ */ new Map();
61397
+ for (const update of updates) {
61398
+ const start = Math.floor(update.at / scale) * scale;
61399
+ const bucket = buckets.get(start);
61400
+ if (bucket === void 0) buckets.set(start, [update]);
61401
+ else bucket.push(update);
61402
+ }
61403
+ return [...buckets.entries()].sort((a, b) => b[0] - a[0]);
61404
+ }, [updates, scale]);
61405
+ const max = Math.max(1, ...groups.map(([, items]) => items.length));
61406
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
61407
+ "data-dsh-part": "archive-view",
61408
+ children: [
61409
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61410
+ style: {
61411
+ display: "flex",
61412
+ gap: "5px",
61413
+ marginBottom: "12px"
61414
+ },
61415
+ children: [
61416
+ 9e5,
61417
+ 36e5,
61418
+ 144e5
61419
+ ].map((value) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuietButton, {
61420
+ label: t("archiveScale", { n: value === 15 * 6e4 ? "15m" : value === 60 * 6e4 ? "1h" : "4h" }),
61421
+ active: scale === value,
61422
+ onClick: () => {
61423
+ setScale(value);
61424
+ },
61425
+ children: value === 15 * 6e4 ? "15m" : value === 60 * 6e4 ? "1h" : "4h"
61426
+ }, value))
61427
+ }),
61428
+ groups.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61429
+ style: {
61430
+ padding: "24px 8px",
61431
+ textAlign: "center",
61432
+ color: colors.tertiary
61433
+ },
61434
+ children: t("archiveEmpty")
61435
+ }) : null,
61436
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61437
+ style: {
61438
+ display: "grid",
61439
+ gap: "9px"
61440
+ },
61441
+ children: groups.map(([start, items]) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
61442
+ style: {
61443
+ borderRadius: "10px",
61444
+ background: colors.surface,
61445
+ border: `1px solid ${colors.border}`,
61446
+ overflow: "hidden"
61447
+ },
61448
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("summary", {
61449
+ style: {
61450
+ cursor: "pointer",
61451
+ padding: "10px 11px",
61452
+ listStyle: "none"
61453
+ },
61454
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61455
+ style: {
61456
+ display: "flex",
61457
+ justifyContent: "space-between",
61458
+ gap: "8px",
61459
+ color: colors.secondary,
61460
+ fontSize: "11px"
61461
+ },
61462
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
61463
+ dayOf(start),
61464
+ " · ",
61465
+ clockOf(start)
61466
+ ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("archiveCount", { n: items.length }) })]
61467
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61468
+ style: {
61469
+ height: "3px",
61470
+ marginTop: "9px",
61471
+ borderRadius: "2px",
61472
+ background: colors.border,
61473
+ overflow: "hidden"
61474
+ },
61475
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
61476
+ width: `${items.length / max * 100}%`,
61477
+ height: "100%",
61478
+ background: colors.brand
61479
+ } })
61480
+ })]
61481
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
61482
+ style: {
61483
+ listStyle: "none",
61484
+ margin: 0,
61485
+ padding: "0 11px 10px",
61486
+ display: "grid",
61487
+ gap: "6px"
61488
+ },
61489
+ children: items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
61490
+ style: {
61491
+ fontSize: "11px",
61492
+ color: colors.secondary,
61493
+ overflowWrap: "anywhere"
61494
+ },
61495
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
61496
+ style: {
61497
+ color: colors.tertiary,
61498
+ marginRight: "7px"
61499
+ },
61500
+ children: clockOf(item.at)
61501
+ }), titleOf(item)]
61502
+ }, item.id))
61503
+ })]
61504
+ }, start))
61505
+ })
61506
+ ]
61507
+ });
61508
+ }
61509
+ function updateMarkdown(update) {
61510
+ return `### ${titleOf(update)}\n\n${update.message}\n\n— ${dateTimeOf(update.at)}`;
61511
+ }
61512
+ async function copyText(text) {
61513
+ try {
61514
+ if (typeof navigator !== "undefined" && navigator.clipboard !== void 0) {
61515
+ await navigator.clipboard.writeText(text);
61516
+ return true;
61517
+ }
61518
+ } catch {
61519
+ return false;
61520
+ }
61521
+ return false;
61522
+ }
61523
+ function exportUpdates(updates) {
61524
+ try {
61525
+ const blob = new Blob([updates.map(updateMarkdown).join("\n\n---\n\n")], { type: "text/markdown;charset=utf-8" });
61526
+ const url = URL.createObjectURL(blob);
61527
+ const anchor = document.createElement("a");
61528
+ anchor.href = url;
61529
+ anchor.download = "progress-updates.md";
61530
+ anchor.click();
61531
+ setTimeout(() => {
61532
+ URL.revokeObjectURL(url);
61533
+ }, 0);
61534
+ } catch {}
61535
+ }
61536
+ function ProgressDashboard({ updates, tasks = [], t: copy }) {
61537
+ const t = translator(copy);
61538
+ const [tab, setTab] = (0, react.useState)("updates");
61539
+ const [query, setQuery] = (0, react.useState)("");
61540
+ const [source, setSource] = (0, react.useState)("");
61541
+ const [copiedId, setCopiedId] = (0, react.useState)();
61163
61542
  const latestId = updates.length > 0 ? updates[updates.length - 1].id : void 0;
61164
- /**
61165
- * 展开的进展集合 —— **不是**单个 id。
61166
- *
61167
- * 早先这里是单值 `expandedId`,于是展开下面那条会把上面那条关掉:用户想对照着
61168
- * 看两条进展时永远只能看到一条。展开是逐条的独立选择,所以用集合。
61169
- *
61170
- * 只写「显式展开过/收起过」的状态,不在渲染期推导:一条新进展到达时,把最新的
61171
- * 那条追加进集合(默认展开最新),但**不动**用户已经展开的其它条目。
61172
- */
61173
61543
  const [expandedIds, setExpandedIds] = (0, react.useState)(() => new Set(latestId === void 0 ? [] : [latestId]));
61174
61544
  (0, react.useEffect)(() => {
61175
61545
  if (latestId === void 0) return;
61176
- setExpandedIds((current) => {
61177
- if (current.has(latestId)) return current;
61178
- const next = new Set(current);
61179
- next.add(latestId);
61180
- return next;
61181
- });
61546
+ setExpandedIds((current) => current.has(latestId) ? current : /* @__PURE__ */ new Set([...current, latestId]));
61182
61547
  }, [latestId]);
61183
- const idPrefix = (0, react.useId)();
61184
- if (updates.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61548
+ const sources = (0, react.useMemo)(() => [...new Set(updates.map((item) => item.source).filter((value) => value !== void 0 && value !== ""))], [updates]);
61549
+ const filtered = (0, react.useMemo)(() => {
61550
+ const needle = query.trim().toLocaleLowerCase();
61551
+ return updates.filter((item) => {
61552
+ if (source !== "" && item.source !== source) return false;
61553
+ if (needle === "") return true;
61554
+ return (titleOf(item) + "\n" + item.message).toLocaleLowerCase().includes(needle);
61555
+ });
61556
+ }, [
61557
+ updates,
61558
+ query,
61559
+ source
61560
+ ]);
61561
+ const counts = taskCounts(tasks);
61562
+ const latest = updates[updates.length - 1];
61563
+ const tabs = [
61564
+ {
61565
+ id: "updates",
61566
+ label: t("tabUpdates"),
61567
+ icon: "pulse",
61568
+ count: updates.length
61569
+ },
61570
+ {
61571
+ id: "tasks",
61572
+ label: t("tabTasks"),
61573
+ icon: "task",
61574
+ count: tasks.length
61575
+ },
61576
+ {
61577
+ id: "archive",
61578
+ label: t("tabArchive"),
61579
+ icon: "archive",
61580
+ count: void 0
61581
+ }
61582
+ ];
61583
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61584
+ className: "pg-dashboard pg-scroll",
61185
61585
  "data-dsh-plugin": "progress-updates",
61186
61586
  "data-dsh-part": "updates",
61187
- style: panelStyle,
61188
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61189
- "data-dsh-part": "updates-empty",
61190
- style: emptyStyle,
61191
- role: "status",
61192
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
61587
+ style: {
61588
+ height: "100%",
61589
+ minHeight: 0,
61590
+ overflowY: "auto",
61591
+ padding: "12px 12px 20px",
61592
+ color: colors.primary,
61593
+ fontSize: "12px"
61594
+ },
61595
+ children: [
61596
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: PANEL_CSS }),
61597
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
61598
+ style: { padding: "2px 2px 12px" },
61599
+ children: [
61600
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61601
+ style: {
61602
+ display: "flex",
61603
+ alignItems: "center",
61604
+ justifyContent: "space-between",
61605
+ gap: "8px"
61606
+ },
61607
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61608
+ style: {
61609
+ display: "flex",
61610
+ alignItems: "center",
61611
+ gap: "7px",
61612
+ color: colors.brand
61613
+ },
61614
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
61615
+ name: "pulse",
61616
+ size: 16
61617
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
61618
+ style: {
61619
+ fontSize: "13px",
61620
+ letterSpacing: ".02em"
61621
+ },
61622
+ children: t("workspaceTitle")
61623
+ })]
61624
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61625
+ className: "pg-overview-meta",
61626
+ "data-dsh-part": "updates-count",
61627
+ style: {
61628
+ color: colors.tertiary,
61629
+ fontSize: "10px"
61630
+ },
61631
+ children: t("progressCount", { n: updates.length })
61632
+ })]
61633
+ }),
61634
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61635
+ style: {
61636
+ marginTop: "9px",
61637
+ color: latest === void 0 ? colors.tertiary : colors.secondary,
61638
+ fontSize: "12px",
61639
+ lineHeight: 1.55,
61640
+ overflowWrap: "anywhere"
61641
+ },
61642
+ children: latest === void 0 ? t("progressEmptyHint") : titleOf(latest)
61643
+ }),
61644
+ tasks.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61645
+ style: {
61646
+ display: "flex",
61647
+ alignItems: "center",
61648
+ gap: "8px",
61649
+ marginTop: "10px"
61650
+ },
61651
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61652
+ style: {
61653
+ flex: 1,
61654
+ height: "3px",
61655
+ borderRadius: "2px",
61656
+ overflow: "hidden",
61657
+ background: colors.border
61658
+ },
61659
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
61660
+ width: `${counts.completed / tasks.length * 100}%`,
61661
+ height: "100%",
61662
+ background: `linear-gradient(90deg, ${colors.brand}, ${colors.success})`
61663
+ } })
61664
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
61665
+ style: {
61666
+ color: colors.tertiary,
61667
+ fontSize: "10px",
61668
+ whiteSpace: "nowrap"
61669
+ },
61670
+ children: [
61671
+ counts.completed,
61672
+ "/",
61673
+ tasks.length
61674
+ ]
61675
+ })]
61676
+ })
61677
+ ]
61678
+ }),
61679
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
61680
+ "aria-label": t("workspaceTitle"),
61193
61681
  style: {
61194
- fontSize: "12px",
61195
- fontWeight: 500
61682
+ display: "grid",
61683
+ gridTemplateColumns: "repeat(3, 1fr)",
61684
+ gap: "4px",
61685
+ padding: "3px",
61686
+ borderRadius: "10px",
61687
+ background: colors.surface,
61688
+ position: "sticky",
61689
+ top: "-12px",
61690
+ zIndex: 2,
61691
+ backdropFilter: "blur(12px)"
61196
61692
  },
61197
- children: translate("progressEmptyTitle")
61198
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: translate("progressEmptyHint") })]
61199
- })
61200
- });
61201
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61202
- "data-dsh-plugin": "progress-updates",
61203
- "data-dsh-part": "updates",
61204
- style: panelStyle,
61205
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61206
- "data-dsh-part": "updates-count",
61207
- style: metaStyle,
61208
- children: translate("progressCount", { n: updates.length })
61209
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
61210
- "data-dsh-part": "updates-list",
61211
- style: {
61212
- listStyle: "none",
61213
- margin: "0",
61214
- padding: "0",
61215
- display: "flex",
61216
- flexDirection: "column",
61217
- gap: "8px"
61218
- },
61219
- children: updates.map((update, index) => {
61220
- const expanded = expandedIds.has(update.id);
61221
- const latest = update.id === latestId;
61222
- const title = titleOf(update);
61223
- const bodyId = `${idPrefix}-${index}-body`;
61224
- const clock = clockOf(update.at);
61225
- const toggleLabel = translate(expanded ? "progressCollapse" : "progressExpand");
61226
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
61227
- "data-dsh-part": "update",
61228
- "data-update-id": update.id,
61229
- style: rowStyle$1,
61230
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
61231
- type: "button",
61232
- "data-dsh-part": "update-header",
61233
- "aria-expanded": expanded,
61234
- "aria-controls": bodyId,
61235
- "aria-label": toggleLabel,
61236
- title: toggleLabel,
61237
- style: headerStyle$1,
61693
+ children: tabs.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
61694
+ type: "button",
61695
+ "data-dsh-part": `tab-${item.id}`,
61696
+ "aria-pressed": tab === item.id,
61697
+ onClick: () => {
61698
+ setTab(item.id);
61699
+ },
61700
+ style: {
61701
+ display: "flex",
61702
+ alignItems: "center",
61703
+ justifyContent: "center",
61704
+ gap: "5px",
61705
+ padding: "7px 4px",
61706
+ border: "0",
61707
+ borderRadius: "8px",
61708
+ cursor: "pointer",
61709
+ background: tab === item.id ? colors.raised : "transparent",
61710
+ color: tab === item.id ? colors.brand : colors.tertiary,
61711
+ boxShadow: tab === item.id ? `inset 0 0 0 1px ${colors.border}` : "none",
61712
+ fontSize: "11px"
61713
+ },
61714
+ children: [
61715
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { name: item.icon }),
61716
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.label }),
61717
+ item.count !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61718
+ style: { opacity: .7 },
61719
+ children: item.count
61720
+ })
61721
+ ]
61722
+ }, item.id))
61723
+ }),
61724
+ tab === "updates" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61725
+ className: "pg-toolbar",
61726
+ style: {
61727
+ display: "grid",
61728
+ gridTemplateColumns: "1fr auto auto",
61729
+ gap: "6px",
61730
+ margin: "10px 0"
61731
+ },
61732
+ children: [
61733
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
61734
+ style: {
61735
+ display: "flex",
61736
+ alignItems: "center",
61737
+ gap: "6px",
61738
+ minWidth: 0,
61739
+ padding: "0 8px",
61740
+ border: `1px solid ${colors.border}`,
61741
+ borderRadius: "8px",
61742
+ color: colors.tertiary,
61743
+ background: colors.surface
61744
+ },
61745
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { name: "search" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
61746
+ "aria-label": t("filterPlaceholder"),
61747
+ value: query,
61748
+ onChange: (event) => {
61749
+ setQuery(event.target.value);
61750
+ },
61751
+ placeholder: t("filterPlaceholder"),
61752
+ style: {
61753
+ width: "100%",
61754
+ minWidth: 0,
61755
+ height: "30px",
61756
+ border: 0,
61757
+ outline: 0,
61758
+ background: "transparent",
61759
+ color: colors.primary,
61760
+ fontSize: "11px"
61761
+ }
61762
+ })]
61763
+ }),
61764
+ sources.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
61765
+ className: "pg-source-filter",
61766
+ "aria-label": t("sourceFilter"),
61767
+ value: source,
61768
+ onChange: (event) => {
61769
+ setSource(event.target.value);
61770
+ },
61771
+ style: {
61772
+ maxWidth: "92px",
61773
+ border: `1px solid ${colors.border}`,
61774
+ borderRadius: "8px",
61775
+ background: colors.surface,
61776
+ color: colors.secondary,
61777
+ fontSize: "11px",
61778
+ padding: "0 4px"
61779
+ },
61780
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
61781
+ value: "",
61782
+ children: t("sourceAll")
61783
+ }), sources.map((value) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
61784
+ value,
61785
+ children: value
61786
+ }, value))]
61787
+ }),
61788
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuietButton, {
61789
+ part: "export-updates",
61790
+ label: t("exportMarkdown"),
61238
61791
  onClick: () => {
61239
- setExpandedIds((current) => {
61240
- const next = new Set(current);
61241
- if (next.has(update.id)) next.delete(update.id);
61242
- else next.add(update.id);
61243
- return next;
61244
- });
61792
+ exportUpdates(filtered);
61793
+ },
61794
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { name: "download" })
61795
+ })
61796
+ ]
61797
+ }), filtered.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61798
+ "data-dsh-part": "updates-empty",
61799
+ style: {
61800
+ padding: "28px 8px",
61801
+ textAlign: "center",
61802
+ color: colors.tertiary
61803
+ },
61804
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
61805
+ style: {
61806
+ display: "block",
61807
+ color: colors.secondary,
61808
+ fontWeight: 500,
61809
+ marginBottom: "5px"
61810
+ },
61811
+ children: updates.length === 0 ? t("progressEmptyTitle") : t("filterEmpty")
61812
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: updates.length === 0 ? t("progressEmptyHint") : t("filterEmptyHint") })]
61813
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
61814
+ "data-dsh-part": "updates-list",
61815
+ style: {
61816
+ listStyle: "none",
61817
+ margin: 0,
61818
+ padding: 0
61819
+ },
61820
+ children: filtered.map((update, index) => {
61821
+ const expanded = expandedIds.has(update.id);
61822
+ const latestRow = update.id === latestId;
61823
+ const bodyId = `pg-body-${index}`;
61824
+ const previous = filtered[index - 1];
61825
+ const newDay = previous === void 0 || dayOf(previous.at) !== dayOf(update.at);
61826
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
61827
+ "data-dsh-part": "update",
61828
+ "data-update-id": update.id,
61829
+ style: {
61830
+ position: "relative",
61831
+ paddingLeft: "24px",
61832
+ paddingBottom: "10px"
61245
61833
  },
61246
61834
  children: [
61247
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron$2, { expanded }),
61835
+ newDay && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61836
+ style: {
61837
+ margin: "4px 0 8px -24px",
61838
+ paddingLeft: "24px",
61839
+ color: colors.tertiary,
61840
+ fontSize: "10px",
61841
+ letterSpacing: ".03em"
61842
+ },
61843
+ children: dayOf(update.at)
61844
+ }),
61248
61845
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61249
- "data-dsh-part": "update-title",
61250
- style: titleStyle$1,
61251
- children: title
61846
+ "aria-hidden": "true",
61847
+ style: {
61848
+ position: "absolute",
61849
+ left: "6px",
61850
+ top: newDay ? "31px" : "7px",
61851
+ bottom: "-5px",
61852
+ width: "1px",
61853
+ background: colors.border
61854
+ }
61252
61855
  }),
61253
- latest && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61254
- "data-dsh-part": "update-badge",
61856
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61857
+ "aria-hidden": "true",
61255
61858
  style: {
61256
- ...metaStyle,
61257
- color: "var(--dsw-alias-brand-primary, #4d6bfe)"
61258
- },
61259
- children: translate("progressLatest")
61859
+ position: "absolute",
61860
+ left: "2px",
61861
+ top: newDay ? "35px" : "11px",
61862
+ width: "9px",
61863
+ height: "9px",
61864
+ borderRadius: "50%",
61865
+ background: latestRow ? colors.brand : colors.raised,
61866
+ border: `2px solid ${latestRow ? "color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 35%, transparent)" : colors.tertiary}`,
61867
+ boxShadow: latestRow ? `0 0 0 4px color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 10%, transparent)` : "none"
61868
+ }
61260
61869
  }),
61261
- clock !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
61262
- dateTime: new Date(update.at).toISOString(),
61263
- style: metaStyle,
61264
- children: clock
61870
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
61871
+ className: "pg-update-card",
61872
+ style: {
61873
+ border: `1px solid ${latestRow ? "color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 26%, transparent)" : colors.border}`,
61874
+ borderRadius: "11px",
61875
+ background: latestRow ? "linear-gradient(135deg, color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 7%, transparent), transparent)" : colors.surface,
61876
+ overflow: "hidden"
61877
+ },
61878
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61879
+ style: {
61880
+ display: "flex",
61881
+ alignItems: "flex-start"
61882
+ },
61883
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
61884
+ type: "button",
61885
+ "data-dsh-part": "update-header",
61886
+ "aria-expanded": expanded,
61887
+ "aria-controls": bodyId,
61888
+ "aria-label": t(expanded ? "progressCollapse" : "progressExpand"),
61889
+ onClick: () => {
61890
+ setExpandedIds((current) => {
61891
+ const next = new Set(current);
61892
+ if (next.has(update.id)) next.delete(update.id);
61893
+ else next.add(update.id);
61894
+ return next;
61895
+ });
61896
+ },
61897
+ style: {
61898
+ flex: 1,
61899
+ minWidth: 0,
61900
+ display: "flex",
61901
+ alignItems: "flex-start",
61902
+ gap: "7px",
61903
+ padding: "10px 4px 10px 10px",
61904
+ border: 0,
61905
+ background: "transparent",
61906
+ color: "inherit",
61907
+ textAlign: "left",
61908
+ cursor: "pointer"
61909
+ },
61910
+ children: [
61911
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61912
+ style: {
61913
+ marginTop: "3px",
61914
+ color: colors.tertiary,
61915
+ transform: expanded ? "rotate(90deg)" : "none",
61916
+ transition: "transform 120ms ease"
61917
+ },
61918
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
61919
+ name: "arrow",
61920
+ size: 11
61921
+ })
61922
+ }),
61923
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61924
+ "data-dsh-part": "update-title",
61925
+ style: {
61926
+ flex: 1,
61927
+ minWidth: 0,
61928
+ fontWeight: latestRow ? 600 : 500,
61929
+ lineHeight: 1.5,
61930
+ overflowWrap: "anywhere"
61931
+ },
61932
+ children: titleOf(update)
61933
+ }),
61934
+ latestRow && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61935
+ "data-dsh-part": "update-badge",
61936
+ style: {
61937
+ color: colors.brand,
61938
+ fontSize: "9px",
61939
+ whiteSpace: "nowrap"
61940
+ },
61941
+ children: t("progressLatest")
61942
+ }),
61943
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
61944
+ dateTime: dateTimeOf(update.at),
61945
+ style: {
61946
+ color: colors.tertiary,
61947
+ fontSize: "10px",
61948
+ whiteSpace: "nowrap"
61949
+ },
61950
+ children: clockOf(update.at)
61951
+ })
61952
+ ]
61953
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
61954
+ type: "button",
61955
+ className: "pg-quiet-button",
61956
+ "data-dsh-part": "update-copy",
61957
+ "aria-label": t("copyUpdate"),
61958
+ title: t("copyUpdate"),
61959
+ onClick: () => {
61960
+ copyText(updateMarkdown(update)).then((ok) => {
61961
+ if (!ok) return;
61962
+ setCopiedId(update.id);
61963
+ setTimeout(() => {
61964
+ setCopiedId((current) => current === update.id ? void 0 : current);
61965
+ }, 1200);
61966
+ });
61967
+ },
61968
+ style: {
61969
+ alignSelf: "center",
61970
+ marginRight: "5px",
61971
+ padding: "5px",
61972
+ border: 0,
61973
+ borderRadius: "6px",
61974
+ background: "transparent",
61975
+ color: copiedId === update.id ? colors.success : colors.tertiary,
61976
+ cursor: "pointer"
61977
+ },
61978
+ children: copiedId === update.id ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61979
+ style: { fontSize: "10px" },
61980
+ children: t("copied")
61981
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
61982
+ name: "copy",
61983
+ size: 12
61984
+ })
61985
+ })]
61986
+ }), expanded && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61987
+ id: bodyId,
61988
+ "data-dsh-part": "update-message",
61989
+ style: {
61990
+ padding: "0 12px 11px 30px",
61991
+ color: colors.secondary,
61992
+ fontSize: "12px",
61993
+ lineHeight: 1.65,
61994
+ overflowWrap: "anywhere"
61995
+ },
61996
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkdownLite, { text: update.message })
61997
+ })]
61265
61998
  })
61266
61999
  ]
61267
- }), expanded && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61268
- id: bodyId,
61269
- "data-dsh-part": "update-message",
61270
- style: messageStyle$1,
61271
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkdownLite, { text: update.message })
61272
- })]
61273
- }, update.id);
62000
+ }, update.id);
62001
+ })
62002
+ })] }),
62003
+ tab === "tasks" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
62004
+ style: { marginTop: "10px" },
62005
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TaskOverview, {
62006
+ tasks,
62007
+ t
62008
+ })
62009
+ }),
62010
+ tab === "archive" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
62011
+ style: { marginTop: "10px" },
62012
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArchiveView, {
62013
+ updates,
62014
+ t
62015
+ })
61274
62016
  })
61275
- })]
62017
+ ]
61276
62018
  });
61277
62019
  }
61278
- /**
61279
- * 面板正文的槽位组件:把注入的数据源接到纯展示组件上。
61280
- *
61281
- * 用 `useSyncExternalStore` 订阅而不是直接读一次快照:轮询源每次拿到新进展都会
61282
- * 通知,这里自动重渲染;展示组件本身不关心数据是怎么来的。
61283
- * @param props - 框架注入的数据源与文案座位。
61284
- * @returns 进展面板。
61285
- */
62020
+ //#endregion
62021
+ //#region src/client/features/progress-updates/updates-panel.tsx
62022
+ /** 进展面板的数据源适配;视觉实现见 dashboard.tsx。 */
62023
+ function fallbackTranslate$2(key, params) {
62024
+ return interpolate(zh$3[key] ?? key, params);
62025
+ }
62026
+ function interpolate(template, params) {
62027
+ if (params === void 0) return template;
62028
+ let text = template;
62029
+ for (const [name, value] of Object.entries(params)) text = text.replaceAll(`{${name}}`, String(value));
62030
+ return text;
62031
+ }
62032
+ const EMPTY_UPDATES = Object.freeze([]);
62033
+ const EMPTY_TASKS = Object.freeze([]);
62034
+ const emptyTasks = () => EMPTY_TASKS;
62035
+ Object.freeze({
62036
+ getSnapshot: () => EMPTY_UPDATES,
62037
+ getTasksSnapshot: emptyTasks,
62038
+ subscribe: () => () => {}
62039
+ });
61286
62040
  function ProgressUpdatesTab(props) {
61287
62041
  const { source, t } = props;
61288
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProgressUpdatesPanel, {
61289
- updates: (0, react.useSyncExternalStore)(source.subscribe, source.getSnapshot, source.getSnapshot),
62042
+ const updates = (0, react.useSyncExternalStore)(source.subscribe, source.getSnapshot, source.getSnapshot);
62043
+ const readTasks = source.getTasksSnapshot ?? emptyTasks;
62044
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProgressDashboard, {
62045
+ updates,
62046
+ tasks: (0, react.useSyncExternalStore)(source.subscribe, readTasks, readTasks),
61290
62047
  t
61291
62048
  });
61292
62049
  }
61293
- /**
61294
- * 页签标题的槽位组件:标签条上显示的那几个字。
61295
- * @param props - 框架注入的文案座位。
61296
- * @returns 面板标题文本。
61297
- */
61298
62050
  function ProgressUpdatesTabTitle({ t }) {
61299
62051
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: t === void 0 ? fallbackTranslate$2("progressTitle") : t("progressTitle") });
61300
62052
  }
@@ -62335,6 +63087,16 @@ window.__ModuleLoader__.load({
62335
63087
  return typeof record.id === "string" && typeof record.message === "string" && typeof record.at === "number";
62336
63088
  });
62337
63089
  }
63090
+ function decodeTaskList(body) {
63091
+ if (typeof body !== "object" || body === null) return [];
63092
+ const tasks = body.tasks;
63093
+ if (!Array.isArray(tasks)) return [];
63094
+ return tasks.filter((item) => {
63095
+ if (typeof item !== "object" || item === null) return false;
63096
+ const record = item;
63097
+ return typeof record.id === "string" && typeof record.content === "string" && (record.status === "pending" || record.status === "in_progress" || record.status === "completed");
63098
+ });
63099
+ }
62338
63100
  /**
62339
63101
  * 拼出这次请求的地址。
62340
63102
  *
@@ -62368,6 +63130,14 @@ window.__ModuleLoader__.load({
62368
63130
  }
62369
63131
  return true;
62370
63132
  }
63133
+ function sameTasks(left, right) {
63134
+ if (left === right) return true;
63135
+ if (left.length !== right.length) return false;
63136
+ return left.every((item, index) => {
63137
+ const other = right[index];
63138
+ return item.id === other.id && item.content === other.content && item.status === other.status && item.activeForm === other.activeForm;
63139
+ });
63140
+ }
62371
63141
  /**
62372
63142
  * 起一个轮询数据源:真正发 `GET` 请求,把结果喂给面板。
62373
63143
  *
@@ -62387,8 +63157,10 @@ window.__ModuleLoader__.load({
62387
63157
  const timers = deps.timers ?? DEFAULT_TIMERS;
62388
63158
  const visible = deps.isVisible ?? isDocumentVisible;
62389
63159
  const decode = deps.decode ?? decodeUpdates;
63160
+ const decodeTasks = deps.decodeTasks ?? decodeTaskList;
62390
63161
  /** 最后一份**成功**快照;面板只认它。失败不会把它清空。 */
62391
63162
  let snapshot = [];
63163
+ let tasksSnapshot = [];
62392
63164
  /** 订阅者集合;空集 = 没人看 = 不轮询。 */
62393
63165
  const listeners = /* @__PURE__ */ new Set();
62394
63166
  /** 当前轮询定时器句柄。 */
@@ -62425,8 +63197,12 @@ window.__ModuleLoader__.load({
62425
63197
  if (!response.ok) throw new Error(`progress updates: HTTP ${response.status}`);
62426
63198
  const body = await response.json();
62427
63199
  const next = decode(body);
62428
- if (sameList(snapshot, next)) return;
62429
- snapshot = Object.freeze([...next]);
63200
+ const nextTasks = decodeTasks(body);
63201
+ const updatesChanged = !sameList(snapshot, next);
63202
+ const tasksChanged = !sameTasks(tasksSnapshot, nextTasks);
63203
+ if (!updatesChanged && !tasksChanged) return;
63204
+ if (updatesChanged) snapshot = Object.freeze([...next]);
63205
+ if (tasksChanged) tasksSnapshot = Object.freeze([...nextTasks]);
62430
63206
  notify();
62431
63207
  } catch (error) {
62432
63208
  deps.onError?.(error);
@@ -62492,6 +63268,7 @@ window.__ModuleLoader__.load({
62492
63268
  };
62493
63269
  return {
62494
63270
  getSnapshot: () => snapshot,
63271
+ getTasksSnapshot: () => tasksSnapshot,
62495
63272
  subscribe,
62496
63273
  stop: () => {
62497
63274
  stopped = true;