@eddyskywalker/dsh-chatgpt-subscription 0.88.0 → 0.88.2

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 (72) hide show
  1. package/lib/client.js +994 -274
  2. package/lib/client.js.map +1 -1
  3. package/lib/codemode.js +7 -5
  4. package/lib/index.js +1262 -928
  5. package/lib/{progress-updates-CSBYky9J.js → progress-updates-DwpfBXOx.js} +53 -17
  6. package/lib/progress-updates.js +1 -1
  7. package/lib/types/client/features/progress-updates/contracts.d.ts +9 -0
  8. package/lib/types/client/features/progress-updates/contracts.d.ts.map +1 -1
  9. package/lib/types/client/features/progress-updates/dashboard.d.ts +12 -0
  10. package/lib/types/client/features/progress-updates/dashboard.d.ts.map +1 -0
  11. package/lib/types/client/features/progress-updates/host-source.d.ts +7 -1
  12. package/lib/types/client/features/progress-updates/host-source.d.ts.map +1 -1
  13. package/lib/types/client/features/progress-updates/locales.d.ts +59 -2
  14. package/lib/types/client/features/progress-updates/locales.d.ts.map +1 -1
  15. package/lib/types/client/features/progress-updates/updates-panel.d.ts +7 -89
  16. package/lib/types/client/features/progress-updates/updates-panel.d.ts.map +1 -1
  17. package/lib/types/client/locales-ru/progress-updates.d.ts.map +1 -1
  18. package/lib/types/compat.d.ts +1 -1
  19. package/lib/types/host/common/session-effort-memory.d.ts +36 -0
  20. package/lib/types/host/common/session-effort-memory.d.ts.map +1 -0
  21. package/lib/types/host/providers/antigravity-acp/adapter.d.ts +5 -0
  22. package/lib/types/host/providers/antigravity-acp/adapter.d.ts.map +1 -1
  23. package/lib/types/host/providers/aws-quick/adapter.d.ts +2 -0
  24. package/lib/types/host/providers/aws-quick/adapter.d.ts.map +1 -1
  25. package/lib/types/host/providers/cline-pass/adapter.d.ts +2 -0
  26. package/lib/types/host/providers/cline-pass/adapter.d.ts.map +1 -1
  27. package/lib/types/host/providers/codex-chatgpt/adapter.d.ts +6 -0
  28. package/lib/types/host/providers/codex-chatgpt/adapter.d.ts.map +1 -1
  29. package/lib/types/host/providers/command-code/adapter.d.ts +2 -0
  30. package/lib/types/host/providers/command-code/adapter.d.ts.map +1 -1
  31. package/lib/types/host/providers/glm-coding-plan/adapter.d.ts +2 -0
  32. package/lib/types/host/providers/glm-coding-plan/adapter.d.ts.map +1 -1
  33. package/lib/types/host/providers/kimi-code/adapter.d.ts +6 -0
  34. package/lib/types/host/providers/kimi-code/adapter.d.ts.map +1 -1
  35. package/lib/types/host/providers/kimi-code/cache-wait.d.ts +23 -0
  36. package/lib/types/host/providers/kimi-code/cache-wait.d.ts.map +1 -1
  37. package/lib/types/host/providers/minimax-code/adapter.d.ts +2 -0
  38. package/lib/types/host/providers/minimax-code/adapter.d.ts.map +1 -1
  39. package/lib/types/host/providers/ollama/adapter.d.ts +5 -0
  40. package/lib/types/host/providers/ollama/adapter.d.ts.map +1 -1
  41. package/lib/types/host/providers/opencode-go/adapter.d.ts +2 -0
  42. package/lib/types/host/providers/opencode-go/adapter.d.ts.map +1 -1
  43. package/lib/types/host/providers/opencode-go/mapper.d.ts.map +1 -1
  44. package/lib/types/host/providers/opendesign/adapter.d.ts +6 -0
  45. package/lib/types/host/providers/opendesign/adapter.d.ts.map +1 -1
  46. package/lib/types/host/providers/qianwen-token-plan/adapter.d.ts +2 -0
  47. package/lib/types/host/providers/qianwen-token-plan/adapter.d.ts.map +1 -1
  48. package/lib/types/host/providers/qoder/adapter.d.ts +2 -0
  49. package/lib/types/host/providers/qoder/adapter.d.ts.map +1 -1
  50. package/lib/types/host/providers/relayone/adapter.d.ts +8 -0
  51. package/lib/types/host/providers/relayone/adapter.d.ts.map +1 -1
  52. package/lib/types/host/providers/step-code/adapter.d.ts +2 -0
  53. package/lib/types/host/providers/step-code/adapter.d.ts.map +1 -1
  54. package/lib/types/host/providers/workbuddy/adapter.d.ts +2 -0
  55. package/lib/types/host/providers/workbuddy/adapter.d.ts.map +1 -1
  56. package/lib/types/host/runtime/codemode/rules.d.ts.map +1 -1
  57. package/lib/types/host/runtime/deepseek-v41-flash/goal-intake.d.ts +79 -0
  58. package/lib/types/host/runtime/deepseek-v41-flash/goal-intake.d.ts.map +1 -0
  59. package/lib/types/host/runtime/deepseek-v41-flash/state-anchor.d.ts +1 -6
  60. package/lib/types/host/runtime/deepseek-v41-flash/state-anchor.d.ts.map +1 -1
  61. package/lib/types/host/runtime/open-models/state-anchor.d.ts +1 -0
  62. package/lib/types/host/runtime/open-models/state-anchor.d.ts.map +1 -1
  63. package/lib/types/host/runtime/progress-updates/index.d.ts +1 -1
  64. package/lib/types/host/runtime/progress-updates/index.d.ts.map +1 -1
  65. package/lib/types/host/runtime/progress-updates/nudge.d.ts +1 -1
  66. package/lib/types/host/runtime/progress-updates/routes.d.ts +3 -1
  67. package/lib/types/host/runtime/progress-updates/routes.d.ts.map +1 -1
  68. package/lib/types/host/runtime/progress-updates/store.d.ts +8 -1
  69. package/lib/types/host/runtime/progress-updates/store.d.ts.map +1 -1
  70. package/lib/types/index.d.ts +2 -2
  71. package/lib/types/index.d.ts.map +1 -1
  72. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -27301,6 +27301,25 @@ window.__ModuleLoader__.load({
27301
27301
  progressCollapse: "收起这条进展",
27302
27302
  progressEmptyTitle: "还没有进展更新",
27303
27303
  progressEmptyHint: "agent 开始多步任务后,会在这里汇报它进行到哪一步。",
27304
+ workspaceTitle: "工作脉络",
27305
+ tabUpdates: "进展",
27306
+ tabTasks: "任务",
27307
+ tabArchive: "归档",
27308
+ tasksEmpty: "当前会话还没有任务清单",
27309
+ tasksProgress: "任务完成 {n}%",
27310
+ tasksSummary: "已完成 {done} / {total} 项任务",
27311
+ tasksBreakdown: "{active} 项进行中 · {pending} 项待处理",
27312
+ archiveScale: "按 {n} 归档",
27313
+ archiveEmpty: "还没有可归档的进展",
27314
+ archiveCount: "{n} 条进展",
27315
+ filterPlaceholder: "搜索标题或正文",
27316
+ sourceFilter: "按来源筛选",
27317
+ sourceAll: "全部来源",
27318
+ exportMarkdown: "导出筛选结果为 Markdown",
27319
+ filterEmpty: "没有匹配的进展",
27320
+ filterEmptyHint: "换个关键词或清除来源筛选。",
27321
+ copyUpdate: "复制这条进展",
27322
+ copied: "已复制",
27304
27323
  rowPending: "进展更新",
27305
27324
  rowRunning: "进行中",
27306
27325
  rowDone: "已汇报",
@@ -27356,6 +27375,25 @@ window.__ModuleLoader__.load({
27356
27375
  progressCollapse: "Collapse this update",
27357
27376
  progressEmptyTitle: "No progress updates yet",
27358
27377
  progressEmptyHint: "Once the agent starts multi-step work, it reports how far it has got right here.",
27378
+ workspaceTitle: "Workstream",
27379
+ tabUpdates: "Updates",
27380
+ tabTasks: "Tasks",
27381
+ tabArchive: "Archive",
27382
+ tasksEmpty: "This session has no task list yet",
27383
+ tasksProgress: "{n}% of tasks complete",
27384
+ tasksSummary: "{done} of {total} tasks complete",
27385
+ tasksBreakdown: "{active} active · {pending} pending",
27386
+ archiveScale: "Group by {n}",
27387
+ archiveEmpty: "No updates to archive yet",
27388
+ archiveCount: "{n} updates",
27389
+ filterPlaceholder: "Search titles and details",
27390
+ sourceFilter: "Filter by source",
27391
+ sourceAll: "All sources",
27392
+ exportMarkdown: "Export filtered updates as Markdown",
27393
+ filterEmpty: "No matching updates",
27394
+ filterEmptyHint: "Try another keyword or clear the source filter.",
27395
+ copyUpdate: "Copy this update",
27396
+ copied: "Copied",
27359
27397
  rowPending: "Progress update",
27360
27398
  rowRunning: "Reporting",
27361
27399
  rowDone: "Reported",
@@ -28947,6 +28985,25 @@ window.__ModuleLoader__.load({
28947
28985
  progressCollapse: "Свернуть эту запись",
28948
28986
  progressEmptyTitle: "Записей о ходе работы пока нет",
28949
28987
  progressEmptyHint: "Когда агент начнёт многошаговую задачу, он будет сообщать здесь, на каком шаге находится.",
28988
+ workspaceTitle: "Ход работы",
28989
+ tabUpdates: "Обновления",
28990
+ tabTasks: "Задачи",
28991
+ tabArchive: "Архив",
28992
+ tasksEmpty: "В этом сеансе пока нет списка задач",
28993
+ tasksProgress: "Выполнено задач: {n}%",
28994
+ tasksSummary: "Выполнено {done} из {total} задач",
28995
+ tasksBreakdown: "В работе: {active} · Ожидают: {pending}",
28996
+ archiveScale: "Группировать по {n}",
28997
+ archiveEmpty: "Обновлений для архива пока нет",
28998
+ archiveCount: "Обновлений: {n}",
28999
+ filterPlaceholder: "Поиск по заголовкам и тексту",
29000
+ sourceFilter: "Фильтр по источнику",
29001
+ sourceAll: "Все источники",
29002
+ exportMarkdown: "Экспортировать отфильтрованные обновления в Markdown",
29003
+ filterEmpty: "Подходящих обновлений нет",
29004
+ filterEmptyHint: "Измените запрос или сбросьте фильтр источника.",
29005
+ copyUpdate: "Копировать это обновление",
29006
+ copied: "Скопировано",
28950
29007
  rowPending: "Ход работы",
28951
29008
  rowRunning: "Сообщает",
28952
29009
  rowDone: "Сообщено",
@@ -60969,136 +61026,45 @@ window.__ModuleLoader__.load({
60969
61026
  }) });
60970
61027
  }
60971
61028
  //#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) {
61029
+ //#region src/client/features/progress-updates/dashboard.tsx
61030
+ const PANEL_CSS = [
61031
+ ".pg-dashboard { container-type: inline-size; }",
61032
+ ".pg-dashboard button, .pg-dashboard input, .pg-dashboard select { font: inherit; }",
61033
+ ".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; }",
61034
+ ".pg-quiet-button { transition: background 120ms ease, color 120ms ease, border-color 120ms ease; }",
61035
+ ".pg-quiet-button:hover { background: var(--dsw-alias-fill-hover, rgb(127 127 127 / 12%)) !important; }",
61036
+ ".pg-update-card { transition: border-color 140ms ease, background 140ms ease; }",
61037
+ ".pg-update-card:hover { border-color: var(--dsw-alias-border-l1, rgb(127 127 127 / 28%)) !important; }",
61038
+ ".pg-scroll { scrollbar-width: thin; scrollbar-color: var(--dsw-alias-border-l1, #555) transparent; }",
61039
+ "@container (max-width: 390px) { .pg-overview-meta { display: none !important; } .pg-toolbar { grid-template-columns: 1fr !important; } .pg-source-filter { display: none !important; } }",
61040
+ "@media (prefers-reduced-motion: reduce) { .pg-dashboard * { transition: none !important; } }"
61041
+ ].join("\n");
61042
+ const colors = {
61043
+ primary: "var(--dsw-alias-label-primary, #e7e9ee)",
61044
+ secondary: "var(--dsw-alias-label-secondary, #a4a9b5)",
61045
+ tertiary: "var(--dsw-alias-label-tertiary, #777e8c)",
61046
+ brand: "var(--dsw-alias-brand-primary, #8b9dff)",
61047
+ success: "var(--dsw-alias-success-primary, #62c99b)",
61048
+ warning: "var(--dsw-alias-warning-primary, #e6b86a)",
61049
+ border: "var(--dsw-alias-border-l2, rgb(127 127 127 / 18%))",
61050
+ surface: "var(--dsw-alias-bg-layer-1, rgb(127 127 127 / 5%))",
61051
+ raised: "var(--dsw-alias-bg-layer-2, rgb(127 127 127 / 8%))"
61052
+ };
61053
+ function interpolate$1(template, params) {
61013
61054
  if (params === void 0) return template;
61014
61055
  let text = template;
61015
- for (const [name, value] of Object.entries(params)) text = text.replaceAll(`{${name}}`, String(value));
61056
+ for (const [key, value] of Object.entries(params)) text = text.replaceAll(`{${key}}`, String(value));
61016
61057
  return text;
61017
61058
  }
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
- */
61059
+ function translator(t) {
61060
+ return (key, params) => {
61061
+ return interpolate$1(t === void 0 ? zh$3[key] ?? key : t(key), params);
61062
+ };
61063
+ }
61064
+ function titleOf(update) {
61065
+ if (update.title !== void 0 && update.title.trim() !== "") return update.title;
61066
+ return update.message.split("\n").find((line) => line.trim() !== "") ?? "";
61067
+ }
61102
61068
  function clockOf(at) {
61103
61069
  if (!Number.isFinite(at)) return "";
61104
61070
  try {
@@ -61110,191 +61076,920 @@ window.__ModuleLoader__.load({
61110
61076
  return "";
61111
61077
  }
61112
61078
  }
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() !== "") ?? "";
61079
+ function dayOf(at) {
61080
+ try {
61081
+ return new Date(at).toLocaleDateString([], {
61082
+ month: "short",
61083
+ day: "numeric",
61084
+ weekday: "short"
61085
+ });
61086
+ } catch {
61087
+ return "";
61088
+ }
61121
61089
  }
61122
- /**
61123
- * 展开指示箭头,跟随展开状态旋转。
61124
- * @param props - 是否展开。
61125
- * @returns 装饰性箭头图标。
61126
- */
61127
- function Chevron$2({ expanded }) {
61090
+ function dateTimeOf(at) {
61091
+ try {
61092
+ return new Date(at).toISOString();
61093
+ } catch {
61094
+ return "";
61095
+ }
61096
+ }
61097
+ function Icon({ name, size = 14 }) {
61128
61098
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
61129
61099
  viewBox: "0 0 16 16",
61130
- width: "12",
61131
- height: "12",
61100
+ width: size,
61101
+ height: size,
61132
61102
  fill: "none",
61133
61103
  stroke: "currentColor",
61134
- strokeWidth: "1.4",
61104
+ strokeWidth: "1.35",
61135
61105
  strokeLinecap: "round",
61136
61106
  strokeLinejoin: "round",
61137
61107
  "aria-hidden": "true",
61108
+ children: {
61109
+ arrow: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 4 4 4-4 4" }),
61110
+ copy: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
61111
+ x: "5",
61112
+ y: "5",
61113
+ width: "7",
61114
+ height: "8",
61115
+ rx: "1.5"
61116
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 10V4a1 1 0 0 1 1-1h5" })] }),
61117
+ 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" })] }),
61118
+ search: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
61119
+ cx: "7",
61120
+ cy: "7",
61121
+ r: "4"
61122
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m10 10 3 3" })] }),
61123
+ task: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
61124
+ x: "3",
61125
+ y: "2.5",
61126
+ width: "10",
61127
+ height: "11",
61128
+ rx: "2"
61129
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m5.5 6 1.5 1.5 3-3M5.5 11h5" })] }),
61130
+ 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" }) }),
61131
+ archive: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
61132
+ x: "2.5",
61133
+ y: "3",
61134
+ width: "11",
61135
+ height: "3",
61136
+ rx: "1"
61137
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 6v6h8V6M6.5 9h3" })] })
61138
+ }[name]
61139
+ });
61140
+ }
61141
+ function QuietButton({ label, onClick, children, active = false, part }) {
61142
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
61143
+ type: "button",
61144
+ className: "pg-quiet-button",
61145
+ "data-dsh-part": part,
61146
+ "aria-label": label,
61147
+ title: label,
61148
+ onClick,
61138
61149
  style: {
61139
- flex: "0 0 auto",
61140
- marginTop: "3px",
61141
- transform: expanded ? "rotate(90deg)" : "none",
61142
- transition: "transform 120ms ease"
61150
+ display: "inline-flex",
61151
+ alignItems: "center",
61152
+ justifyContent: "center",
61153
+ gap: "5px",
61154
+ minHeight: "28px",
61155
+ padding: "4px 8px",
61156
+ border: `1px solid ${active ? colors.brand : colors.border}`,
61157
+ borderRadius: "7px",
61158
+ background: active ? "color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 12%, transparent)" : "transparent",
61159
+ color: active ? colors.brand : colors.secondary,
61160
+ cursor: "pointer",
61161
+ fontSize: "11px"
61143
61162
  },
61144
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 4 4 4-4 4" })
61163
+ children
61145
61164
  });
61146
61165
  }
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);
61166
+ function taskCounts(tasks) {
61167
+ return {
61168
+ completed: tasks.filter((task) => task.status === "completed").length,
61169
+ active: tasks.filter((task) => task.status === "in_progress").length,
61170
+ pending: tasks.filter((task) => task.status === "pending").length
61162
61171
  };
61172
+ }
61173
+ function TaskOverview({ tasks, t }) {
61174
+ const counts = taskCounts(tasks);
61175
+ const progress = tasks.length === 0 ? 0 : Math.round(counts.completed / tasks.length * 100);
61176
+ const radius = 25;
61177
+ const circumference = 2 * Math.PI * radius;
61178
+ if (tasks.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61179
+ "data-dsh-part": "tasks-empty",
61180
+ style: {
61181
+ padding: "28px 10px",
61182
+ textAlign: "center",
61183
+ color: colors.tertiary
61184
+ },
61185
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
61186
+ name: "task",
61187
+ size: 22
61188
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61189
+ style: { marginTop: "8px" },
61190
+ children: t("tasksEmpty")
61191
+ })]
61192
+ });
61193
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
61194
+ "data-dsh-part": "tasks-view",
61195
+ style: { padding: "4px 2px 18px" },
61196
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61197
+ style: {
61198
+ display: "flex",
61199
+ alignItems: "center",
61200
+ gap: "16px",
61201
+ padding: "12px",
61202
+ marginBottom: "12px",
61203
+ borderRadius: "12px",
61204
+ background: "linear-gradient(135deg, color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 10%, transparent), transparent)"
61205
+ },
61206
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61207
+ style: {
61208
+ position: "relative",
61209
+ width: "62px",
61210
+ height: "62px",
61211
+ flex: "0 0 auto"
61212
+ },
61213
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
61214
+ viewBox: "0 0 62 62",
61215
+ width: "62",
61216
+ height: "62",
61217
+ "aria-label": t("tasksProgress", { n: progress }),
61218
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
61219
+ cx: "31",
61220
+ cy: "31",
61221
+ r: radius,
61222
+ fill: "none",
61223
+ stroke: colors.border,
61224
+ strokeWidth: "5"
61225
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
61226
+ cx: "31",
61227
+ cy: "31",
61228
+ r: radius,
61229
+ fill: "none",
61230
+ stroke: colors.brand,
61231
+ strokeWidth: "5",
61232
+ strokeLinecap: "round",
61233
+ strokeDasharray: circumference,
61234
+ strokeDashoffset: circumference * (1 - progress / 100),
61235
+ transform: "rotate(-90 31 31)"
61236
+ })]
61237
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
61238
+ style: {
61239
+ position: "absolute",
61240
+ inset: "0",
61241
+ display: "grid",
61242
+ placeItems: "center",
61243
+ fontSize: "13px",
61244
+ fontWeight: 650,
61245
+ color: colors.primary
61246
+ },
61247
+ children: [progress, "%"]
61248
+ })]
61249
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61250
+ style: { minWidth: 0 },
61251
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61252
+ style: {
61253
+ color: colors.primary,
61254
+ fontSize: "14px",
61255
+ fontWeight: 600
61256
+ },
61257
+ children: t("tasksSummary", {
61258
+ done: counts.completed,
61259
+ total: tasks.length
61260
+ })
61261
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61262
+ style: {
61263
+ color: colors.secondary,
61264
+ fontSize: "11px",
61265
+ marginTop: "5px"
61266
+ },
61267
+ children: t("tasksBreakdown", {
61268
+ active: counts.active,
61269
+ pending: counts.pending
61270
+ })
61271
+ })]
61272
+ })]
61273
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
61274
+ style: {
61275
+ listStyle: "none",
61276
+ padding: 0,
61277
+ margin: 0,
61278
+ display: "grid",
61279
+ gap: "6px"
61280
+ },
61281
+ children: tasks.map((task) => {
61282
+ const done = task.status === "completed";
61283
+ const active = task.status === "in_progress";
61284
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
61285
+ "data-task-status": task.status,
61286
+ style: {
61287
+ display: "flex",
61288
+ gap: "10px",
61289
+ alignItems: "flex-start",
61290
+ padding: "9px 10px",
61291
+ borderRadius: "9px",
61292
+ background: active ? "color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 9%, transparent)" : "transparent",
61293
+ border: `1px solid ${active ? "color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 25%, transparent)" : "transparent"}`
61294
+ },
61295
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61296
+ "aria-hidden": "true",
61297
+ style: {
61298
+ flex: "0 0 auto",
61299
+ width: "15px",
61300
+ height: "15px",
61301
+ marginTop: "2px",
61302
+ borderRadius: "50%",
61303
+ display: "grid",
61304
+ placeItems: "center",
61305
+ border: `1.5px solid ${done ? colors.success : active ? colors.brand : colors.tertiary}`,
61306
+ background: done ? colors.success : "transparent",
61307
+ color: "#fff",
61308
+ fontSize: "10px"
61309
+ },
61310
+ children: done ? "✓" : active ? "•" : ""
61311
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61312
+ style: { minWidth: 0 },
61313
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61314
+ style: {
61315
+ color: done ? colors.tertiary : colors.primary,
61316
+ textDecoration: done ? "line-through" : "none",
61317
+ fontSize: "12px",
61318
+ lineHeight: 1.55,
61319
+ overflowWrap: "anywhere"
61320
+ },
61321
+ children: task.content
61322
+ }), active && task.activeForm !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61323
+ style: {
61324
+ color: colors.brand,
61325
+ fontSize: "11px",
61326
+ marginTop: "3px"
61327
+ },
61328
+ children: task.activeForm
61329
+ })]
61330
+ })]
61331
+ }, task.id);
61332
+ })
61333
+ })]
61334
+ });
61335
+ }
61336
+ function ArchiveView({ updates, t }) {
61337
+ const [scale, setScale] = (0, react.useState)(36e5);
61338
+ const groups = (0, react.useMemo)(() => {
61339
+ const buckets = /* @__PURE__ */ new Map();
61340
+ for (const update of updates) {
61341
+ const start = Math.floor(update.at / scale) * scale;
61342
+ const bucket = buckets.get(start);
61343
+ if (bucket === void 0) buckets.set(start, [update]);
61344
+ else bucket.push(update);
61345
+ }
61346
+ return [...buckets.entries()].sort((a, b) => b[0] - a[0]);
61347
+ }, [updates, scale]);
61348
+ const max = Math.max(1, ...groups.map(([, items]) => items.length));
61349
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
61350
+ "data-dsh-part": "archive-view",
61351
+ children: [
61352
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61353
+ style: {
61354
+ display: "flex",
61355
+ gap: "5px",
61356
+ marginBottom: "12px"
61357
+ },
61358
+ children: [
61359
+ 9e5,
61360
+ 36e5,
61361
+ 144e5
61362
+ ].map((value) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuietButton, {
61363
+ label: t("archiveScale", { n: value === 15 * 6e4 ? "15m" : value === 60 * 6e4 ? "1h" : "4h" }),
61364
+ active: scale === value,
61365
+ onClick: () => {
61366
+ setScale(value);
61367
+ },
61368
+ children: value === 15 * 6e4 ? "15m" : value === 60 * 6e4 ? "1h" : "4h"
61369
+ }, value))
61370
+ }),
61371
+ groups.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61372
+ style: {
61373
+ padding: "24px 8px",
61374
+ textAlign: "center",
61375
+ color: colors.tertiary
61376
+ },
61377
+ children: t("archiveEmpty")
61378
+ }) : null,
61379
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61380
+ style: {
61381
+ display: "grid",
61382
+ gap: "9px"
61383
+ },
61384
+ children: groups.map(([start, items]) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
61385
+ style: {
61386
+ borderRadius: "10px",
61387
+ background: colors.surface,
61388
+ border: `1px solid ${colors.border}`,
61389
+ overflow: "hidden"
61390
+ },
61391
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("summary", {
61392
+ style: {
61393
+ cursor: "pointer",
61394
+ padding: "10px 11px",
61395
+ listStyle: "none"
61396
+ },
61397
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61398
+ style: {
61399
+ display: "flex",
61400
+ justifyContent: "space-between",
61401
+ gap: "8px",
61402
+ color: colors.secondary,
61403
+ fontSize: "11px"
61404
+ },
61405
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
61406
+ dayOf(start),
61407
+ " · ",
61408
+ clockOf(start)
61409
+ ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("archiveCount", { n: items.length }) })]
61410
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61411
+ style: {
61412
+ height: "3px",
61413
+ marginTop: "9px",
61414
+ borderRadius: "2px",
61415
+ background: colors.border,
61416
+ overflow: "hidden"
61417
+ },
61418
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
61419
+ width: `${items.length / max * 100}%`,
61420
+ height: "100%",
61421
+ background: colors.brand
61422
+ } })
61423
+ })]
61424
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
61425
+ style: {
61426
+ listStyle: "none",
61427
+ margin: 0,
61428
+ padding: "0 11px 10px",
61429
+ display: "grid",
61430
+ gap: "6px"
61431
+ },
61432
+ children: items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
61433
+ style: {
61434
+ fontSize: "11px",
61435
+ color: colors.secondary,
61436
+ overflowWrap: "anywhere"
61437
+ },
61438
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
61439
+ style: {
61440
+ color: colors.tertiary,
61441
+ marginRight: "7px"
61442
+ },
61443
+ children: clockOf(item.at)
61444
+ }), titleOf(item)]
61445
+ }, item.id))
61446
+ })]
61447
+ }, start))
61448
+ })
61449
+ ]
61450
+ });
61451
+ }
61452
+ function updateMarkdown(update) {
61453
+ return `### ${titleOf(update)}\n\n${update.message}\n\n— ${dateTimeOf(update.at)}`;
61454
+ }
61455
+ async function copyText(text) {
61456
+ try {
61457
+ if (typeof navigator !== "undefined" && navigator.clipboard !== void 0) {
61458
+ await navigator.clipboard.writeText(text);
61459
+ return true;
61460
+ }
61461
+ } catch {
61462
+ return false;
61463
+ }
61464
+ return false;
61465
+ }
61466
+ function exportUpdates(updates) {
61467
+ try {
61468
+ const blob = new Blob([updates.map(updateMarkdown).join("\n\n---\n\n")], { type: "text/markdown;charset=utf-8" });
61469
+ const url = URL.createObjectURL(blob);
61470
+ const anchor = document.createElement("a");
61471
+ anchor.href = url;
61472
+ anchor.download = "progress-updates.md";
61473
+ anchor.click();
61474
+ setTimeout(() => {
61475
+ URL.revokeObjectURL(url);
61476
+ }, 0);
61477
+ } catch {}
61478
+ }
61479
+ function ProgressDashboard({ updates, tasks = [], t: copy }) {
61480
+ const t = translator(copy);
61481
+ const [tab, setTab] = (0, react.useState)("updates");
61482
+ const [query, setQuery] = (0, react.useState)("");
61483
+ const [source, setSource] = (0, react.useState)("");
61484
+ const [copiedId, setCopiedId] = (0, react.useState)();
61163
61485
  const latestId = updates.length > 0 ? updates[updates.length - 1].id : void 0;
61164
- /**
61165
- * 展开的进展集合 —— **不是**单个 id。
61166
- *
61167
- * 早先这里是单值 `expandedId`,于是展开下面那条会把上面那条关掉:用户想对照着
61168
- * 看两条进展时永远只能看到一条。展开是逐条的独立选择,所以用集合。
61169
- *
61170
- * 只写「显式展开过/收起过」的状态,不在渲染期推导:一条新进展到达时,把最新的
61171
- * 那条追加进集合(默认展开最新),但**不动**用户已经展开的其它条目。
61172
- */
61173
61486
  const [expandedIds, setExpandedIds] = (0, react.useState)(() => new Set(latestId === void 0 ? [] : [latestId]));
61174
61487
  (0, react.useEffect)(() => {
61175
61488
  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
- });
61489
+ setExpandedIds((current) => current.has(latestId) ? current : /* @__PURE__ */ new Set([...current, latestId]));
61182
61490
  }, [latestId]);
61183
- const idPrefix = (0, react.useId)();
61184
- if (updates.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61491
+ const sources = (0, react.useMemo)(() => [...new Set(updates.map((item) => item.source).filter((value) => value !== void 0 && value !== ""))], [updates]);
61492
+ const filtered = (0, react.useMemo)(() => {
61493
+ const needle = query.trim().toLocaleLowerCase();
61494
+ return updates.filter((item) => {
61495
+ if (source !== "" && item.source !== source) return false;
61496
+ if (needle === "") return true;
61497
+ return (titleOf(item) + "\n" + item.message).toLocaleLowerCase().includes(needle);
61498
+ });
61499
+ }, [
61500
+ updates,
61501
+ query,
61502
+ source
61503
+ ]);
61504
+ const counts = taskCounts(tasks);
61505
+ const latest = updates[updates.length - 1];
61506
+ const tabs = [
61507
+ {
61508
+ id: "updates",
61509
+ label: t("tabUpdates"),
61510
+ icon: "pulse",
61511
+ count: updates.length
61512
+ },
61513
+ {
61514
+ id: "tasks",
61515
+ label: t("tabTasks"),
61516
+ icon: "task",
61517
+ count: tasks.length
61518
+ },
61519
+ {
61520
+ id: "archive",
61521
+ label: t("tabArchive"),
61522
+ icon: "archive",
61523
+ count: void 0
61524
+ }
61525
+ ];
61526
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61527
+ className: "pg-dashboard pg-scroll",
61185
61528
  "data-dsh-plugin": "progress-updates",
61186
61529
  "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", {
61530
+ style: {
61531
+ height: "100%",
61532
+ minHeight: 0,
61533
+ overflowY: "auto",
61534
+ padding: "12px 12px 20px",
61535
+ color: colors.primary,
61536
+ fontSize: "12px"
61537
+ },
61538
+ children: [
61539
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: PANEL_CSS }),
61540
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
61541
+ style: { padding: "2px 2px 12px" },
61542
+ children: [
61543
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61544
+ style: {
61545
+ display: "flex",
61546
+ alignItems: "center",
61547
+ justifyContent: "space-between",
61548
+ gap: "8px"
61549
+ },
61550
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61551
+ style: {
61552
+ display: "flex",
61553
+ alignItems: "center",
61554
+ gap: "7px",
61555
+ color: colors.brand
61556
+ },
61557
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
61558
+ name: "pulse",
61559
+ size: 16
61560
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
61561
+ style: {
61562
+ fontSize: "13px",
61563
+ letterSpacing: ".02em"
61564
+ },
61565
+ children: t("workspaceTitle")
61566
+ })]
61567
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61568
+ className: "pg-overview-meta",
61569
+ "data-dsh-part": "updates-count",
61570
+ style: {
61571
+ color: colors.tertiary,
61572
+ fontSize: "10px"
61573
+ },
61574
+ children: t("progressCount", { n: updates.length })
61575
+ })]
61576
+ }),
61577
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61578
+ style: {
61579
+ marginTop: "9px",
61580
+ color: latest === void 0 ? colors.tertiary : colors.secondary,
61581
+ fontSize: "12px",
61582
+ lineHeight: 1.55,
61583
+ overflowWrap: "anywhere"
61584
+ },
61585
+ children: latest === void 0 ? t("progressEmptyHint") : titleOf(latest)
61586
+ }),
61587
+ tasks.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61588
+ style: {
61589
+ display: "flex",
61590
+ alignItems: "center",
61591
+ gap: "8px",
61592
+ marginTop: "10px"
61593
+ },
61594
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61595
+ style: {
61596
+ flex: 1,
61597
+ height: "3px",
61598
+ borderRadius: "2px",
61599
+ overflow: "hidden",
61600
+ background: colors.border
61601
+ },
61602
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
61603
+ width: `${counts.completed / tasks.length * 100}%`,
61604
+ height: "100%",
61605
+ background: `linear-gradient(90deg, ${colors.brand}, ${colors.success})`
61606
+ } })
61607
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
61608
+ style: {
61609
+ color: colors.tertiary,
61610
+ fontSize: "10px",
61611
+ whiteSpace: "nowrap"
61612
+ },
61613
+ children: [
61614
+ counts.completed,
61615
+ "/",
61616
+ tasks.length
61617
+ ]
61618
+ })]
61619
+ })
61620
+ ]
61621
+ }),
61622
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
61623
+ "aria-label": t("workspaceTitle"),
61193
61624
  style: {
61194
- fontSize: "12px",
61195
- fontWeight: 500
61625
+ display: "grid",
61626
+ gridTemplateColumns: "repeat(3, 1fr)",
61627
+ gap: "4px",
61628
+ padding: "3px",
61629
+ borderRadius: "10px",
61630
+ background: colors.surface,
61631
+ position: "sticky",
61632
+ top: "-12px",
61633
+ zIndex: 2,
61634
+ backdropFilter: "blur(12px)"
61196
61635
  },
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,
61636
+ children: tabs.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
61637
+ type: "button",
61638
+ "data-dsh-part": `tab-${item.id}`,
61639
+ "aria-pressed": tab === item.id,
61640
+ onClick: () => {
61641
+ setTab(item.id);
61642
+ },
61643
+ style: {
61644
+ display: "flex",
61645
+ alignItems: "center",
61646
+ justifyContent: "center",
61647
+ gap: "5px",
61648
+ padding: "7px 4px",
61649
+ border: "0",
61650
+ borderRadius: "8px",
61651
+ cursor: "pointer",
61652
+ background: tab === item.id ? colors.raised : "transparent",
61653
+ color: tab === item.id ? colors.brand : colors.tertiary,
61654
+ boxShadow: tab === item.id ? `inset 0 0 0 1px ${colors.border}` : "none",
61655
+ fontSize: "11px"
61656
+ },
61657
+ children: [
61658
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { name: item.icon }),
61659
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.label }),
61660
+ item.count !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61661
+ style: { opacity: .7 },
61662
+ children: item.count
61663
+ })
61664
+ ]
61665
+ }, item.id))
61666
+ }),
61667
+ tab === "updates" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61668
+ className: "pg-toolbar",
61669
+ style: {
61670
+ display: "grid",
61671
+ gridTemplateColumns: "1fr auto auto",
61672
+ gap: "6px",
61673
+ margin: "10px 0"
61674
+ },
61675
+ children: [
61676
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
61677
+ style: {
61678
+ display: "flex",
61679
+ alignItems: "center",
61680
+ gap: "6px",
61681
+ minWidth: 0,
61682
+ padding: "0 8px",
61683
+ border: `1px solid ${colors.border}`,
61684
+ borderRadius: "8px",
61685
+ color: colors.tertiary,
61686
+ background: colors.surface
61687
+ },
61688
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { name: "search" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
61689
+ "aria-label": t("filterPlaceholder"),
61690
+ value: query,
61691
+ onChange: (event) => {
61692
+ setQuery(event.target.value);
61693
+ },
61694
+ placeholder: t("filterPlaceholder"),
61695
+ style: {
61696
+ width: "100%",
61697
+ minWidth: 0,
61698
+ height: "30px",
61699
+ border: 0,
61700
+ outline: 0,
61701
+ background: "transparent",
61702
+ color: colors.primary,
61703
+ fontSize: "11px"
61704
+ }
61705
+ })]
61706
+ }),
61707
+ sources.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
61708
+ className: "pg-source-filter",
61709
+ "aria-label": t("sourceFilter"),
61710
+ value: source,
61711
+ onChange: (event) => {
61712
+ setSource(event.target.value);
61713
+ },
61714
+ style: {
61715
+ maxWidth: "92px",
61716
+ border: `1px solid ${colors.border}`,
61717
+ borderRadius: "8px",
61718
+ background: colors.surface,
61719
+ color: colors.secondary,
61720
+ fontSize: "11px",
61721
+ padding: "0 4px"
61722
+ },
61723
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
61724
+ value: "",
61725
+ children: t("sourceAll")
61726
+ }), sources.map((value) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
61727
+ value,
61728
+ children: value
61729
+ }, value))]
61730
+ }),
61731
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuietButton, {
61732
+ part: "export-updates",
61733
+ label: t("exportMarkdown"),
61238
61734
  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
- });
61735
+ exportUpdates(filtered);
61736
+ },
61737
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { name: "download" })
61738
+ })
61739
+ ]
61740
+ }), filtered.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61741
+ "data-dsh-part": "updates-empty",
61742
+ style: {
61743
+ padding: "28px 8px",
61744
+ textAlign: "center",
61745
+ color: colors.tertiary
61746
+ },
61747
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
61748
+ style: {
61749
+ display: "block",
61750
+ color: colors.secondary,
61751
+ fontWeight: 500,
61752
+ marginBottom: "5px"
61753
+ },
61754
+ children: updates.length === 0 ? t("progressEmptyTitle") : t("filterEmpty")
61755
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: updates.length === 0 ? t("progressEmptyHint") : t("filterEmptyHint") })]
61756
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
61757
+ "data-dsh-part": "updates-list",
61758
+ style: {
61759
+ listStyle: "none",
61760
+ margin: 0,
61761
+ padding: 0
61762
+ },
61763
+ children: filtered.map((update, index) => {
61764
+ const expanded = expandedIds.has(update.id);
61765
+ const latestRow = update.id === latestId;
61766
+ const bodyId = `pg-body-${index}`;
61767
+ const previous = filtered[index - 1];
61768
+ const newDay = previous === void 0 || dayOf(previous.at) !== dayOf(update.at);
61769
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
61770
+ "data-dsh-part": "update",
61771
+ "data-update-id": update.id,
61772
+ style: {
61773
+ position: "relative",
61774
+ paddingLeft: "24px",
61775
+ paddingBottom: "10px"
61245
61776
  },
61246
61777
  children: [
61247
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron$2, { expanded }),
61778
+ newDay && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61779
+ style: {
61780
+ margin: "4px 0 8px -24px",
61781
+ paddingLeft: "24px",
61782
+ color: colors.tertiary,
61783
+ fontSize: "10px",
61784
+ letterSpacing: ".03em"
61785
+ },
61786
+ children: dayOf(update.at)
61787
+ }),
61248
61788
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61249
- "data-dsh-part": "update-title",
61250
- style: titleStyle$1,
61251
- children: title
61789
+ "aria-hidden": "true",
61790
+ style: {
61791
+ position: "absolute",
61792
+ left: "6px",
61793
+ top: newDay ? "31px" : "7px",
61794
+ bottom: "-5px",
61795
+ width: "1px",
61796
+ background: colors.border
61797
+ }
61252
61798
  }),
61253
- latest && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61254
- "data-dsh-part": "update-badge",
61799
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61800
+ "aria-hidden": "true",
61255
61801
  style: {
61256
- ...metaStyle,
61257
- color: "var(--dsw-alias-brand-primary, #4d6bfe)"
61258
- },
61259
- children: translate("progressLatest")
61802
+ position: "absolute",
61803
+ left: "2px",
61804
+ top: newDay ? "35px" : "11px",
61805
+ width: "9px",
61806
+ height: "9px",
61807
+ borderRadius: "50%",
61808
+ background: latestRow ? colors.brand : colors.raised,
61809
+ border: `2px solid ${latestRow ? "color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 35%, transparent)" : colors.tertiary}`,
61810
+ boxShadow: latestRow ? `0 0 0 4px color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 10%, transparent)` : "none"
61811
+ }
61260
61812
  }),
61261
- clock !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
61262
- dateTime: new Date(update.at).toISOString(),
61263
- style: metaStyle,
61264
- children: clock
61813
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
61814
+ className: "pg-update-card",
61815
+ style: {
61816
+ border: `1px solid ${latestRow ? "color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 26%, transparent)" : colors.border}`,
61817
+ borderRadius: "11px",
61818
+ background: latestRow ? "linear-gradient(135deg, color-mix(in srgb, var(--dsw-alias-brand-primary, #8b9dff) 7%, transparent), transparent)" : colors.surface,
61819
+ overflow: "hidden"
61820
+ },
61821
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61822
+ style: {
61823
+ display: "flex",
61824
+ alignItems: "flex-start"
61825
+ },
61826
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
61827
+ type: "button",
61828
+ "data-dsh-part": "update-header",
61829
+ "aria-expanded": expanded,
61830
+ "aria-controls": bodyId,
61831
+ "aria-label": t(expanded ? "progressCollapse" : "progressExpand"),
61832
+ onClick: () => {
61833
+ setExpandedIds((current) => {
61834
+ const next = new Set(current);
61835
+ if (next.has(update.id)) next.delete(update.id);
61836
+ else next.add(update.id);
61837
+ return next;
61838
+ });
61839
+ },
61840
+ style: {
61841
+ flex: 1,
61842
+ minWidth: 0,
61843
+ display: "flex",
61844
+ alignItems: "flex-start",
61845
+ gap: "7px",
61846
+ padding: "10px 4px 10px 10px",
61847
+ border: 0,
61848
+ background: "transparent",
61849
+ color: "inherit",
61850
+ textAlign: "left",
61851
+ cursor: "pointer"
61852
+ },
61853
+ children: [
61854
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61855
+ style: {
61856
+ marginTop: "3px",
61857
+ color: colors.tertiary,
61858
+ transform: expanded ? "rotate(90deg)" : "none",
61859
+ transition: "transform 120ms ease"
61860
+ },
61861
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
61862
+ name: "arrow",
61863
+ size: 11
61864
+ })
61865
+ }),
61866
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61867
+ "data-dsh-part": "update-title",
61868
+ style: {
61869
+ flex: 1,
61870
+ minWidth: 0,
61871
+ fontWeight: latestRow ? 600 : 500,
61872
+ lineHeight: 1.5,
61873
+ overflowWrap: "anywhere"
61874
+ },
61875
+ children: titleOf(update)
61876
+ }),
61877
+ latestRow && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61878
+ "data-dsh-part": "update-badge",
61879
+ style: {
61880
+ color: colors.brand,
61881
+ fontSize: "9px",
61882
+ whiteSpace: "nowrap"
61883
+ },
61884
+ children: t("progressLatest")
61885
+ }),
61886
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
61887
+ dateTime: dateTimeOf(update.at),
61888
+ style: {
61889
+ color: colors.tertiary,
61890
+ fontSize: "10px",
61891
+ whiteSpace: "nowrap"
61892
+ },
61893
+ children: clockOf(update.at)
61894
+ })
61895
+ ]
61896
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
61897
+ type: "button",
61898
+ className: "pg-quiet-button",
61899
+ "data-dsh-part": "update-copy",
61900
+ "aria-label": t("copyUpdate"),
61901
+ title: t("copyUpdate"),
61902
+ onClick: () => {
61903
+ copyText(updateMarkdown(update)).then((ok) => {
61904
+ if (!ok) return;
61905
+ setCopiedId(update.id);
61906
+ setTimeout(() => {
61907
+ setCopiedId((current) => current === update.id ? void 0 : current);
61908
+ }, 1200);
61909
+ });
61910
+ },
61911
+ style: {
61912
+ alignSelf: "center",
61913
+ marginRight: "5px",
61914
+ padding: "5px",
61915
+ border: 0,
61916
+ borderRadius: "6px",
61917
+ background: "transparent",
61918
+ color: copiedId === update.id ? colors.success : colors.tertiary,
61919
+ cursor: "pointer"
61920
+ },
61921
+ children: copiedId === update.id ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
61922
+ style: { fontSize: "10px" },
61923
+ children: t("copied")
61924
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
61925
+ name: "copy",
61926
+ size: 12
61927
+ })
61928
+ })]
61929
+ }), expanded && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61930
+ id: bodyId,
61931
+ "data-dsh-part": "update-message",
61932
+ style: {
61933
+ padding: "0 12px 11px 30px",
61934
+ color: colors.secondary,
61935
+ fontSize: "12px",
61936
+ lineHeight: 1.65,
61937
+ overflowWrap: "anywhere"
61938
+ },
61939
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkdownLite, { text: update.message })
61940
+ })]
61265
61941
  })
61266
61942
  ]
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);
61943
+ }, update.id);
61944
+ })
61945
+ })] }),
61946
+ tab === "tasks" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61947
+ style: { marginTop: "10px" },
61948
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TaskOverview, {
61949
+ tasks,
61950
+ t
61951
+ })
61952
+ }),
61953
+ tab === "archive" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
61954
+ style: { marginTop: "10px" },
61955
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArchiveView, {
61956
+ updates,
61957
+ t
61958
+ })
61274
61959
  })
61275
- })]
61960
+ ]
61276
61961
  });
61277
61962
  }
61278
- /**
61279
- * 面板正文的槽位组件:把注入的数据源接到纯展示组件上。
61280
- *
61281
- * 用 `useSyncExternalStore` 订阅而不是直接读一次快照:轮询源每次拿到新进展都会
61282
- * 通知,这里自动重渲染;展示组件本身不关心数据是怎么来的。
61283
- * @param props - 框架注入的数据源与文案座位。
61284
- * @returns 进展面板。
61285
- */
61963
+ //#endregion
61964
+ //#region src/client/features/progress-updates/updates-panel.tsx
61965
+ /** 进展面板的数据源适配;视觉实现见 dashboard.tsx。 */
61966
+ function fallbackTranslate$2(key, params) {
61967
+ return interpolate(zh$3[key] ?? key, params);
61968
+ }
61969
+ function interpolate(template, params) {
61970
+ if (params === void 0) return template;
61971
+ let text = template;
61972
+ for (const [name, value] of Object.entries(params)) text = text.replaceAll(`{${name}}`, String(value));
61973
+ return text;
61974
+ }
61975
+ const EMPTY_UPDATES = Object.freeze([]);
61976
+ const EMPTY_TASKS = Object.freeze([]);
61977
+ const emptyTasks = () => EMPTY_TASKS;
61978
+ Object.freeze({
61979
+ getSnapshot: () => EMPTY_UPDATES,
61980
+ getTasksSnapshot: emptyTasks,
61981
+ subscribe: () => () => {}
61982
+ });
61286
61983
  function ProgressUpdatesTab(props) {
61287
61984
  const { source, t } = props;
61288
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProgressUpdatesPanel, {
61289
- updates: (0, react.useSyncExternalStore)(source.subscribe, source.getSnapshot, source.getSnapshot),
61985
+ const updates = (0, react.useSyncExternalStore)(source.subscribe, source.getSnapshot, source.getSnapshot);
61986
+ const readTasks = source.getTasksSnapshot ?? emptyTasks;
61987
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProgressDashboard, {
61988
+ updates,
61989
+ tasks: (0, react.useSyncExternalStore)(source.subscribe, readTasks, readTasks),
61290
61990
  t
61291
61991
  });
61292
61992
  }
61293
- /**
61294
- * 页签标题的槽位组件:标签条上显示的那几个字。
61295
- * @param props - 框架注入的文案座位。
61296
- * @returns 面板标题文本。
61297
- */
61298
61993
  function ProgressUpdatesTabTitle({ t }) {
61299
61994
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: t === void 0 ? fallbackTranslate$2("progressTitle") : t("progressTitle") });
61300
61995
  }
@@ -62335,6 +63030,16 @@ window.__ModuleLoader__.load({
62335
63030
  return typeof record.id === "string" && typeof record.message === "string" && typeof record.at === "number";
62336
63031
  });
62337
63032
  }
63033
+ function decodeTaskList(body) {
63034
+ if (typeof body !== "object" || body === null) return [];
63035
+ const tasks = body.tasks;
63036
+ if (!Array.isArray(tasks)) return [];
63037
+ return tasks.filter((item) => {
63038
+ if (typeof item !== "object" || item === null) return false;
63039
+ const record = item;
63040
+ return typeof record.id === "string" && typeof record.content === "string" && (record.status === "pending" || record.status === "in_progress" || record.status === "completed");
63041
+ });
63042
+ }
62338
63043
  /**
62339
63044
  * 拼出这次请求的地址。
62340
63045
  *
@@ -62368,6 +63073,14 @@ window.__ModuleLoader__.load({
62368
63073
  }
62369
63074
  return true;
62370
63075
  }
63076
+ function sameTasks(left, right) {
63077
+ if (left === right) return true;
63078
+ if (left.length !== right.length) return false;
63079
+ return left.every((item, index) => {
63080
+ const other = right[index];
63081
+ return item.id === other.id && item.content === other.content && item.status === other.status && item.activeForm === other.activeForm;
63082
+ });
63083
+ }
62371
63084
  /**
62372
63085
  * 起一个轮询数据源:真正发 `GET` 请求,把结果喂给面板。
62373
63086
  *
@@ -62387,8 +63100,10 @@ window.__ModuleLoader__.load({
62387
63100
  const timers = deps.timers ?? DEFAULT_TIMERS;
62388
63101
  const visible = deps.isVisible ?? isDocumentVisible;
62389
63102
  const decode = deps.decode ?? decodeUpdates;
63103
+ const decodeTasks = deps.decodeTasks ?? decodeTaskList;
62390
63104
  /** 最后一份**成功**快照;面板只认它。失败不会把它清空。 */
62391
63105
  let snapshot = [];
63106
+ let tasksSnapshot = [];
62392
63107
  /** 订阅者集合;空集 = 没人看 = 不轮询。 */
62393
63108
  const listeners = /* @__PURE__ */ new Set();
62394
63109
  /** 当前轮询定时器句柄。 */
@@ -62425,8 +63140,12 @@ window.__ModuleLoader__.load({
62425
63140
  if (!response.ok) throw new Error(`progress updates: HTTP ${response.status}`);
62426
63141
  const body = await response.json();
62427
63142
  const next = decode(body);
62428
- if (sameList(snapshot, next)) return;
62429
- snapshot = Object.freeze([...next]);
63143
+ const nextTasks = decodeTasks(body);
63144
+ const updatesChanged = !sameList(snapshot, next);
63145
+ const tasksChanged = !sameTasks(tasksSnapshot, nextTasks);
63146
+ if (!updatesChanged && !tasksChanged) return;
63147
+ if (updatesChanged) snapshot = Object.freeze([...next]);
63148
+ if (tasksChanged) tasksSnapshot = Object.freeze([...nextTasks]);
62430
63149
  notify();
62431
63150
  } catch (error) {
62432
63151
  deps.onError?.(error);
@@ -62492,6 +63211,7 @@ window.__ModuleLoader__.load({
62492
63211
  };
62493
63212
  return {
62494
63213
  getSnapshot: () => snapshot,
63214
+ getTasksSnapshot: () => tasksSnapshot,
62495
63215
  subscribe,
62496
63216
  stop: () => {
62497
63217
  stopped = true;