@xrn1997/dsh-session-delete 0.8.0 → 0.9.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 (91) hide show
  1. package/README.md +133 -173
  2. package/THIRD_PARTY_NOTICES.md +4 -2
  3. package/docs/DETAIL.md +1 -0
  4. package/docs/DETAIL.zh.md +1 -0
  5. package/docs/preview.svg +119 -0
  6. package/docs/preview.zh.svg +117 -0
  7. package/docs/screenshots/screenshot-01.png +0 -0
  8. package/lib/client.js +4244 -2086
  9. package/lib/index.js +1237 -336
  10. package/lib/types/api/archive-rows.d.ts +20 -0
  11. package/lib/types/api/connection-route.d.ts +1 -1
  12. package/lib/types/api/route-table.d.ts +100 -11
  13. package/lib/types/client/archive-detail.d.ts +27 -0
  14. package/lib/types/client/archive-pane.d.ts +60 -0
  15. package/lib/types/client/archive-store.d.ts +6 -0
  16. package/lib/types/client/attachment-view.d.ts +0 -7
  17. package/lib/types/client/batch-bar.d.ts +3 -2
  18. package/lib/types/client/batch-confirm.d.ts +13 -4
  19. package/lib/types/client/batch-menu-item.d.ts +1 -1
  20. package/lib/types/client/batch-pick.d.ts +2 -1
  21. package/lib/types/client/config-settings.d.ts +2 -2
  22. package/lib/types/client/confirm-dialog.d.ts +2 -2
  23. package/lib/types/client/copy.d.ts +53 -13
  24. package/lib/types/client/detail-ledger.d.ts +23 -0
  25. package/lib/types/client/detail-pane.d.ts +33 -0
  26. package/lib/types/client/host-archive-watch.d.ts +22 -0
  27. package/lib/types/client/host-rows.d.ts +7 -0
  28. package/lib/types/client/maintenance-parts.d.ts +4 -3
  29. package/lib/types/client/maintenance-settings.d.ts +4 -3
  30. package/lib/types/client/notice.d.ts +16 -0
  31. package/lib/types/client/orphan-maintenance.d.ts +1 -1
  32. package/lib/types/client/receipt.d.ts +4 -1
  33. package/lib/types/client/remote.d.ts +38 -7
  34. package/lib/types/client/session-detail.d.ts +94 -0
  35. package/lib/types/client/session-list.d.ts +112 -0
  36. package/lib/types/client/settings-cards.d.ts +1 -1
  37. package/lib/types/client/subagent-section.d.ts +45 -0
  38. package/lib/types/client/trash-confirm.d.ts +2 -1
  39. package/lib/types/client/trash-detail.d.ts +9 -60
  40. package/lib/types/client/trash-nav.d.ts +8 -7
  41. package/lib/types/client/trash-panel.d.ts +1 -1
  42. package/lib/types/client/trash-snapshot.d.ts +10 -23
  43. package/lib/types/client/trash-view.d.ts +39 -9
  44. package/lib/types/client/ui/ErrorBoundary.d.ts +32 -0
  45. package/lib/types/client/ui/icons.d.ts +10 -4
  46. package/lib/types/client/undo-notices.d.ts +23 -3
  47. package/lib/types/client/undo-toast.d.ts +4 -1
  48. package/lib/types/client/use-archive-detail-reader.d.ts +28 -0
  49. package/lib/types/client/use-archive-panel-controller.d.ts +73 -0
  50. package/lib/types/client/use-archive-query.d.ts +29 -0
  51. package/lib/types/client/use-detail-rail.d.ts +48 -0
  52. package/lib/types/client/use-detail-reader.d.ts +71 -0
  53. package/lib/types/client/use-gated-refresh.d.ts +27 -0
  54. package/lib/types/client/{use-trash-selection.d.ts → use-list-selection.d.ts} +16 -14
  55. package/lib/types/client/use-maintenance.d.ts +11 -7
  56. package/lib/types/client/use-panel-selection.d.ts +38 -0
  57. package/lib/types/client/use-prompt-rail.d.ts +1 -1
  58. package/lib/types/client/use-trash-detail-reader.d.ts +14 -20
  59. package/lib/types/client/use-trash-panel-controller.d.ts +17 -5
  60. package/lib/types/client/write-seats.d.ts +80 -8
  61. package/lib/types/deps.d.ts +7 -4
  62. package/lib/types/{verbs/errors.d.ts → errors.d.ts} +1 -1
  63. package/lib/types/index.d.ts +1 -1
  64. package/lib/types/log/session-log.d.ts +22 -2
  65. package/lib/types/log/zstd-frames.d.ts +8 -1
  66. package/lib/types/ports/fs-port.d.ts +16 -4
  67. package/lib/types/ports/host-port.d.ts +89 -5
  68. package/lib/types/shared/session-path.d.ts +35 -0
  69. package/lib/types/shared/wire.d.ts +205 -27
  70. package/lib/types/trash/archive-detail.d.ts +27 -0
  71. package/lib/types/trash/attachments.d.ts +4 -1
  72. package/lib/types/trash/detail.d.ts +24 -1
  73. package/lib/types/trash/entry.d.ts +23 -8
  74. package/lib/types/trash/groups.d.ts +1 -0
  75. package/lib/types/trash/ledger.d.ts +4 -2
  76. package/lib/types/trash/projection-cache.d.ts +24 -0
  77. package/lib/types/trash/reconcile.d.ts +5 -3
  78. package/lib/types/trash/session-rows.d.ts +83 -0
  79. package/lib/types/trash/shrinking-view.d.ts +30 -0
  80. package/lib/types/verbs/batch-carried.d.ts +4 -2
  81. package/lib/types/verbs/live-admission.d.ts +7 -2
  82. package/lib/types/verbs/member-journal.d.ts +1 -1
  83. package/lib/types/verbs/permanent-removal.d.ts +15 -5
  84. package/lib/types/verbs/restore-session.d.ts +6 -4
  85. package/lib/types/verbs/trash-scope.d.ts +14 -13
  86. package/locale/en.json +7 -6
  87. package/locale/zh.json +2 -1
  88. package/package.json +10 -4
  89. package/lib/types/client/confirm-close.d.ts +0 -14
  90. package/lib/types/client/write-settlement.d.ts +0 -66
  91. package/lib/types/client/write.d.ts +0 -66
@@ -1,8 +1,9 @@
1
1
  /**
2
- * 维护卡两段共用的两块皮:警告条外壳与失败块。
2
+ * 维护卡各段共用的两块皮:警告条外壳与失败块。
3
3
  *
4
- * 两段(孤儿会话 / 孤儿附件)在结构上只差正文:图标、底色、动作按钮与失败块的「原文 + 重试」
5
- * 都一样。收在这里,改布局或按钮材质时不必在同一条卡里改两遍;正文仍由各段自己给。
4
+ * 三段(孤儿会话 / 孤儿附件 / 投影缓存)在结构上只差正文:图标、底色、动作按钮与失败块的
5
+ * 「原文 + 重试」都一样。收在这里,改布局或按钮材质时不必逐段改;正文仍由各段自己给。
6
+ * 清理后的回执行不在本文件:它同时被回收站面板用到,住中立模块 `src/client/notice.tsx`。
6
7
  */
7
8
  import type { ReactElement, ReactNode } from 'react';
8
9
  import type { Translate } from './copy.js';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 插件设置页的「维护」卡(ADR-0021):那张槽位上的两张卡里,本文件只拥有下面这一张。
3
3
  *
4
- * 两段都是**手动**的:检查 → 预览 → 清理,没有挂载即扫、没有定时器。卡片的职责只有呈现:
4
+ * 三段都是**手动**的:检查 → 预览 → 清理,没有挂载即扫、没有定时器。卡片的职责只有呈现:
5
5
  * 状态那一行、检查按钮、以及各段自己的横幅 / 失败 / 提示 / 确认框;读数与动作全归
6
6
  * `src/client/use-maintenance.ts`。两张卡的先后与 `summary` 守卫在 `src/client/settings-cards.tsx`。
7
7
  *
@@ -9,13 +9,14 @@
9
9
  * `settingsCardShell` / `Button` / `Modal` / `fileSizeText`,所以同一张卡放在插件详情页的任意宽度下都成立。
10
10
  *
11
11
  * 孤儿会话段直接复用 `OrphanMaintenance`(警告条 / 失败 / 中性提示 / 预览确认的既有呈现);
12
- * 孤儿附件段是本文件里的 `AttachmentMaintenance`(横幅 + 失败 + 回执 + 缩略图预览与清理确认)。
12
+ * 孤儿附件段是本文件里的 `AttachmentMaintenance`(横幅 + 失败 + 回执 + 缩略图预览与清理确认);
13
+ * 投影缓存段是 `ProjectionMaintenance`(横幅 + 失败 + 回执 + 只按条数确认)。
13
14
  */
14
15
  import type { ReactElement } from 'react';
15
16
  import { type Translate } from './copy.js';
16
17
  import { type MaintenanceDeps } from './use-maintenance.js';
17
18
  export interface MaintenanceSettingsProps {
18
- /** 维护四件(读数与动作);可调项两件由占用者另发给「可调项」卡。 */
19
+ /** 维护六件(三段读数与动作);可调项两件由占用者另发给「可调项」卡。 */
19
20
  deps: MaintenanceDeps;
20
21
  /** 文案(缺省 = 内置 zh;宿主 locale 服务缺席时也是它,见 `copy.ts`)。 */
21
22
  t?: Translate;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 一段**状态回执行**:清理后的中性 / 成功 / 警告摘要。不是失败块,也不冒充检查状态;
3
+ * 没有话说时整块不画。`tone` 只决定图标与颜色,句子由调用方按自己的判据拼好。
4
+ *
5
+ * 它住在中立模块而不是维护卡里:回收站面板的附件清理提示与设置页维护卡的三段都用它,
6
+ * 面板不该为了一个回执行去 import 设置卡模块。
7
+ */
8
+ import type { ReactElement } from 'react';
9
+ export interface NoticeProps {
10
+ readonly message: string | null;
11
+ /** 旧面板块用过的下边距;设置页段内间距由父级 gap 给,默认不加。 */
12
+ readonly gapBelow?: boolean;
13
+ /** 默认 warning(附件失败 / 跳过、孤儿清理回执);纯成功回执用 success。 */
14
+ readonly tone?: 'warning' | 'success';
15
+ }
16
+ export declare function Notice({ message, gapBelow, tone }: NoticeProps): ReactElement | null;
@@ -20,7 +20,7 @@
20
20
  */
21
21
  import type { ReactElement } from 'react';
22
22
  import type { Translate } from './copy.js';
23
- import type { OrphanReportWire } from './remote.js';
23
+ import type { OrphanReportWire } from '../shared/wire.js';
24
24
  import type { MaintenanceSectionView } from './use-maintenance-section.js';
25
25
  export interface OrphanMaintenanceProps {
26
26
  /** 段视图:读数、提示、确认框、忙碌与四个动作都在它上面,本块不多要也不少读。 */
@@ -7,7 +7,7 @@ import { type ApplyAction, type ApplyOutcome, type ApplyValueByAction, type Atta
7
7
  *
8
8
  * 各 action 可能出现的 kind(类型面故意保持同一个联合,消费方按 action 自己收窄):
9
9
  * - delete / restore:`ok` / `already-gone` / `failed` / `missing`
10
- * - count / purge:`ok` / `failed` / `missing`
10
+ * - count / purge / unarchive:`ok` / `failed` / `missing`
11
11
  * - orphan-clean:`ok` / `neutral` / `failed` / `missing`
12
12
  * - 单条读法(`readSingleReceipt`):不含 `already-gone`;null 折成 `failed`
13
13
  */
@@ -83,6 +83,9 @@ export interface ReceiptSummary {
83
83
  * (回盘名单);purge / count / orphan-clean 没有可撤销的落地 id,恒为空。
84
84
  * 两个域不混在一个数组里靠调用方猜,也不各留一个永远为空的字段。 */
85
85
  readonly landedIds: readonly string[];
86
+ /** 落地条目里带**已归档**标记的那些(域同 `landedIds` 的 entry 域):已归档会话删除后
87
+ * 撤销是**回「归档」**不是回会话列表,撤销文案据此改口(ADR-0060 决定第 1 条)。 */
88
+ readonly landedArchivedIds: readonly string[];
86
89
  readonly anySuccess: boolean;
87
90
  /** purge / orphan-clean 的 `ok` 回执里那半份附件读数,**按批相加**(一段 `/apply` 可能带多条 ok)。
88
91
  * `skipped` 取第一条有的:它说的是"这一轮为什么没敢清",不是可累加的计数。
@@ -8,16 +8,16 @@
8
8
  * 段名或方法的第二份字面量,请求字段只由上面 interface 的签名决定(`body` 那一格是给 Node 半决定
9
9
  * 「要不要预读 JSON」的,见 `src/api/route-table.ts`)。取数地址(官方 `/api` 前缀 + 文档挂载点)归
10
10
  * `src/client/api-base.ts`(根部署下与旧版逐字相同)。
11
- * - 十段注册在宿主 `connection.fetch.register` 上,鉴权归宿主 `/api` bridge(ADR-0033);
11
+ * - 全部段名注册在宿主 `connection.fetch.register` 上,鉴权归宿主 `/api` bridge(ADR-0033);
12
12
  * 没有旧前缀 fallback——支持面是 web UI 与桌面端,二者的标准组合都装 `client-connection`。
13
13
  * 官方 remote.<namespace> 仍不可用(第三方拿不到 Typert 描述符的动态发现挂载点)。
14
14
  * - 写动作统一走 apply;`attachment` 是唯一二进制段,由 `src/client/attachment-view.tsx` 经同一投影
15
15
  * 拼地址,不经过本文件的 JSON 通道;`attachment-orphans`(纯读)与 `attachment-clean`(聚合写)是
16
- * 孤儿附件的两段。
16
+ * 孤儿附件的两段,`projection-orphans`(纯读)与 `projection-clean`(聚合写)是投影缓存的两段。
17
17
  * - 失败在线上是 {code,message,details?} 普通对象;本通道把它原样当数据交回,既不补标记位也不抛
18
18
  * (标记位判别 isDSHRemoteError 的家在 src/shared/wire.ts,读它的是 Node 半),这里不 import 任何宿主客户端包。
19
19
  */
20
- import { type ApplyAction, type ApplyOutcome, type ApplyValueByAction, type AttachmentCleanupWire, type AttachmentOrphanReportWire, type OrphanReportWire, type PurgeStatsWire, type RemoteFailure, type SessionDeleteConfigWire, type TrashDetailWire, type TrashRowWire } from '../shared/wire.js';
20
+ import { type ApplyAction, type ApplyOutcome, type ApplyValueByAction, type ArchiveDetailWire, type ArchiveListWire, type AttachmentCleanupWire, type AttachmentOrphanReportWire, type OrphanReportWire, type ProjectionCacheCleanupWire, type ProjectionCacheOrphanReportWire, type PurgeStatsWire, type RemoteFailure, type SessionDeleteConfigWire, type TrashDetailWire, type TrashRowWire } from '../shared/wire.js';
21
21
  /**
22
22
  * 回收站条目(`/list` 那一行)。**形状的家在 `shared/wire.ts`**(ADR-0003):这里只是别名,
23
23
  * 所以浏览器半不再自己抄一遍字段;下面几处"只读面"的镜像同理。
@@ -35,6 +35,11 @@ export type PurgeResultLike = PurgeStatsWire;
35
35
  * 它们的清册事实只能随详情过线(issue #7;单级判据现由 ADR-0055 的「沿用」节承接)。
36
36
  */
37
37
  export type TrashDetailLike = TrashDetailWire;
38
+ /** 归档清单(`ArchiveListWire`):形状的家同在 `shared/wire.ts`,这里只是别名。 */
39
+ export type ArchiveListLike = ArchiveListWire;
40
+ /** 归档单条详情(`ArchiveDetailWire`):基座 + sessionId,没有清册身份格(`entryId`);
41
+ * 子会话段是**只读投影**(宿主闭包 + 四路读数),与回收站那份不是同一来源。 */
42
+ export type ArchiveDetailLike = ArchiveDetailWire;
38
43
  /** 一次远程调用的落地面:要么值,要么失败——所有操作都交这一种形状,调用方只做状态检查。
39
44
  * 失败**不抛**:抛出来的失败面会让每个调用点再学一套 try/catch,也会让「返回的失败」与
40
45
  * 「抛出的失败」变成两种落地。 */
@@ -68,7 +73,17 @@ export interface SessionDeleteRemote {
68
73
  scanAttachmentOrphans(): Promise<RemoteOutcome<AttachmentOrphanReportWire>>;
69
74
  /** 聚合写:只删上一条报告那一刻无引用的图片对象,回 `AttachmentCleanupWire`。 */
70
75
  cleanAttachmentOrphans(): Promise<RemoteOutcome<AttachmentCleanupWire>>;
76
+ /** 纯读:宿主 `session_projcache` 里找不到会话痕迹的记录条数(判据住 `src/trash/projection-cache.ts`)。
77
+ * 读不出是失败,调用方不许把它折成"零条残留"。 */
78
+ scanProjectionCacheOrphans(): Promise<RemoteOutcome<ProjectionCacheOrphanReportWire>>;
79
+ /** 聚合写:现扫一遍,只删这一刻仍找不到会话痕迹的投影缓存记录,回 `ProjectionCacheCleanupWire`。 */
80
+ cleanProjectionCacheOrphans(): Promise<RemoteOutcome<ProjectionCacheCleanupWire>>;
71
81
  detail(entryId: string, before?: number): Promise<RemoteOutcome<TrashDetailLike>>;
82
+ /** 纯读:归档清单。`{ available: false }` 是成功信封里的显式「语料不可见」,不是失败。 */
83
+ archiveList(): Promise<RemoteOutcome<ArchiveListLike>>;
84
+ /** 纯读:归档单条详情(目标自己已归档,或是 `rootSessionId` 那条已归档会话的 subagent
85
+ * 闭包成员;寻址红线:只传 id)。 */
86
+ archiveDetail(sessionId: string, before?: number, rootSessionId?: string): Promise<RemoteOutcome<ArchiveDetailLike>>;
72
87
  /** 一组 id 上的同一个动作。顶层 `ok:false` 只表示**整次调用**没办成(路由自检、栅栏之外);
73
88
  * 单条动作的成败住在 `ApplyOutcome` 里——这是批量接口的判据,别在信封层找它。 */
74
89
  applyOutcomes(action: ApplyAction, ids: readonly string[]): Promise<RemoteOutcome<ApplyOutcome[]>>;
@@ -77,8 +92,26 @@ export interface SessionDeleteRemote {
77
92
  }
78
93
  /** 插件设置页「可调项」卡只要这两件。 */
79
94
  export type ConfigDeps = Pick<SessionDeleteRemote, 'config' | 'saveConfig'>;
80
- /** 需要那一段 `/apply` 的组件只要这一段 deps(单条非写调用见 {@link applyOne},写动作走 `./write.js` 的 `runWrite`)。 */
95
+ /** 需要那一段 `/apply` 的组件只要这一段 deps(单条非写调用见 {@link applyOne},写动作走 `./write-seats.ts` 的六个座位)。 */
81
96
  export type OneShotDeps = Pick<SessionDeleteRemote, 'applyOutcomes'>;
97
+ /** 一次普通请求的时长上限(探针另有更短的 5s 上限,见 {@link PROBE_TIMEOUT_MS})。 */
98
+ export declare const REQUEST_TIMEOUT_MS = 30000;
99
+ /** 聚合读 / 批量写 / 清空的时长上限:工作量按盘上全量数据线性变长(扫描所有日志、删几百个目录),
100
+ * 和一次单条读共用 30s 会把「宿主还在干活」误判成超时。 */
101
+ export declare const SLOW_REQUEST_TIMEOUT_MS = 120000;
102
+ /** 超时的固定中文原文:通道诊断是协议原文,不随 locale(见 `docs/architecture.md` §3)。 */
103
+ export declare const REQUEST_TIMEOUT_MESSAGE = "\u53D6\u6570\u901A\u9053\u8D85\u65F6\uFF1A\u5BBF\u4E3B\u6CA1\u6709\u5728\u65F6\u9650\u5185\u56DE\u5E94";
104
+ /** 调用方自己中止这一趟(探测的 5s 上限)时的原文:与宿主超时分开,诊断才能指对人。 */
105
+ export declare const CALLER_ABORT_MESSAGE = "\u53D6\u6570\u901A\u9053\u6253\u4E0D\u901A\uFF1A\u8BF7\u6C42\u5DF2\u88AB\u8C03\u7528\u65B9\u4E2D\u6B62";
106
+ /** 成功信封里的值形状不对时的固定中文原文(判形住 `src/shared/wire.ts` 的 `WIRE_VALUE_GUARDS`)。 */
107
+ export declare const CHANNEL_SHAPE_MESSAGE = "\u53D6\u6570\u901A\u9053\u56DE\u7684\u503C\u5F62\u72B6\u4E0D\u5BF9";
108
+ /** `createHttpRemote` 的可选覆盖。**生产调用方不传**:注册路径按段用
109
+ * {@link REQUEST_TIMEOUT_MS} / {@link SLOW_REQUEST_TIMEOUT_MS} 两档。
110
+ * 这一格存在是为了让「超时落失败面」这条支能在测试里真的跑到,而不必等 30/120 秒墙上时间。 */
111
+ export interface HttpRemoteOptions {
112
+ /** 同时覆盖普通与聚合两类上限;超时经 `AbortController` 打断 fetch。 */
113
+ readonly timeoutMs?: number;
114
+ }
82
115
  /**
83
116
  * 唯一生产 adapter:同源 fetch。**同源、带挂载点前缀**:不拼 host、不认 origin——页面本身就是从
84
117
  * 宿主页面加载的,同源是这条通道的全部前提;路径只由 `api-base.ts` 从 `document.baseURI` 的目录
@@ -86,7 +119,7 @@ export type OneShotDeps = Pick<SessionDeleteRemote, 'applyOutcomes'>;
86
119
  * 鉴权归宿主 `/api` bridge(ADR-0033)。所以这条通道**只对**宿主页面打开过、带宿主身份的客户端
87
120
  * 成立(凭据是那次访问换来的 cookie,不是插件自己的秘密)。
88
121
  */
89
- export declare function createHttpRemote(): SessionDeleteRemote;
122
+ export declare function createHttpRemote(options?: HttpRemoteOptions): SessionDeleteRemote;
90
123
  /** 探测默认上限:5s。超时经 `AbortController` 打断 fetch,`activate` 不会永远吊在一条半开连接上。 */
91
124
  export declare const PROBE_TIMEOUT_MS = 5000;
92
125
  /**
@@ -108,8 +141,6 @@ export interface ProbeOptions {
108
141
  * console 留下原因——入口不出现是有意的,但"为什么没出现"不能只活在脑子里。
109
142
  */
110
143
  export declare function probeChannel(deps: SessionDeleteRemote, options?: ProbeOptions): Promise<boolean>;
111
- /** `shared/wire.ts` 的 `ApplyOutcome`、扫描报告与附件回执从这里转出去——浏览器半只认 `remote.js` 这一扇门。 */
112
- export type { ApplyAction, ApplyOutcome, AttachmentCleanupWire, AttachmentOrphanReportWire, OrphanReportWire, } from '../shared/wire.js';
113
144
  /**
114
145
  * N=1 的成功支:`null` 已被 `receipt.ts` 的单条读法折成协议错,所以 `value` 必然非空。
115
146
  * 不再需要条件类型把 `delete` / `restore` 的 null 抠掉——那份判据只住回执读法一处。
@@ -0,0 +1,94 @@
1
+ /**
2
+ * 会话详情的**通用视图**(只画状态,不取数):状态壳(idle/loading/holding/failed/ready)、
3
+ * 会话信息表、计量行、四档工作步骤、提问轨、附件内联与分页按钮的唯一实现。
4
+ *
5
+ * 档差全在**三个投影口**里,不在这份代码里:
6
+ * - `head`:显示名与大小——**与选中行配对**(列表行给,详情不重算);
7
+ * - `infoRows`:信息表行集(回收站七行 / 归档五行,各档自己投影);
8
+ * - `subagents`:子会话段的徽标与段体(两档都传;没有孩子 ⇒ 缺席 = 不画,呈现归 `subagent-section.tsx`)。
9
+ *
10
+ * 三条界面约束(两档同守):
11
+ * - 动作留在清单行右侧;详情只负责看。
12
+ * - 正文是**块**:用户/助手文字常显;思考、工具、注入、系统消息、压缩摘要默认折叠,折叠头给
13
+ * 标签 + 首行摘要(工具另给状态)。注入也铺进正文——这是对宿主 Chat 的有意偏离(它隐藏普通注入,
14
+ * 而这里的目标是「删之前看全」);条数另进计量行。
15
+ * - 助手正文与思考走 Markdown,用户提问保持原话;工具参数/结果走等宽纯文本(限高可滚)。
16
+ */
17
+ import { type CSSProperties, type ReactNode, type RefObject } from 'react';
18
+ import { type Translate } from './copy.js';
19
+ import type { SessionDetailWire } from '../shared/wire.js';
20
+ import type { DetailState } from './use-detail-reader.js';
21
+ /** 分页这一块(在飞/失败 + 滚动容器)整体过手:两档详情投影各自转交,谁画正文谁拆开用。
22
+ * 四样东西是一个概念(分页读面)的四个格子,打包走一个名字,不再逐样穿透组件边界。 */
23
+ export interface DetailPager {
24
+ /** 更早一页正在读。 */
25
+ loadingOlder: boolean;
26
+ /** 更早一页读失败的原文;正文本身仍是 ready。 */
27
+ olderFailure: string | null;
28
+ onLoadOlder: () => void;
29
+ /** 详情栏的滚动容器;prepend 更早一页后按高度差补偿滚动位置。 */
30
+ scrollRef?: RefObject<HTMLDivElement | null>;
31
+ }
32
+ /** 详情的导航面(孩子视图的开与回):类型定义住在这里(视图定 prop 形状),
33
+ * 控制器 `import type` 它避免环。判据(谁在场、title 给什么)住控制器的 `detailNav` 派生。
34
+ *
35
+ * 孩子一律按 **id** 交接:这一面两档共用——回收站档的孩子是清册行、归档档的孩子是宿主闭包行,
36
+ * 两种行型不是两种身份。谁把这半行读数补回来归各自的控制台(判据住它那里的 `ADR-0055`)。 */
37
+ export interface DetailNav {
38
+ /** 只在主体是清单选中那条时交出(ADR-0055 沿用的单级判据,唯一实现)。 */
39
+ readonly onOpenChild?: (childId: string) => void;
40
+ /** 与 `onOpenChild` 同进同出的意图预取:hover/focus 子会话行时先把它的详情读进来。 */
41
+ readonly onPrefetchChild?: (childId: string) => void;
42
+ /** 孩子视图的返回目标;title 是原文(未命名兜底由视图按 t 处理)。 */
43
+ readonly parentContext?: {
44
+ readonly title: string;
45
+ readonly onBack: () => void;
46
+ };
47
+ }
48
+ /** 信息表的一行:标签 + 值(`title` 只在原文值得展开时给,不给就没有悬停提示;`code` 走等宽样式)。 */
49
+ export interface DetailInfoRow {
50
+ readonly label: string;
51
+ readonly value: string;
52
+ readonly title?: string;
53
+ readonly code?: boolean;
54
+ }
55
+ /** 子会话段的投影槽:徽标(头排)与段体(计量行之后)由各自档交来(两档共用 `subagent-section.tsx` 那一台);缺席整段不画。 */
56
+ export interface SubagentSectionProps {
57
+ readonly badge: ReactNode;
58
+ readonly body: ReactNode;
59
+ }
60
+ export interface SessionDetailProps<S, D extends SessionDetailWire> {
61
+ state: DetailState<S, D>;
62
+ /** 主体身份(换条复位滚动、body 重挂载的 key、保持提示的判据都按它)。 */
63
+ subjectId: string;
64
+ /** 标题与大小与**选中行**配对:列表行给 display name 与大小,详情不重算。 */
65
+ head: {
66
+ readonly displayName: string;
67
+ readonly sizeText: string | null;
68
+ };
69
+ infoRows: readonly DetailInfoRow[];
70
+ /** 两档都传(子会话段);没有孩子或缺席 ⇒ 不画。 */
71
+ subagents?: SubagentSectionProps;
72
+ busy: boolean;
73
+ wide: boolean;
74
+ onRetry: () => void;
75
+ onBack: () => void;
76
+ detailNav: DetailNav;
77
+ pager: DetailPager;
78
+ t: Translate;
79
+ }
80
+ /** 返回键排在标题之后:排在之前会把整条标题的起点往右挤(`docs/ui-spec.md` §2 ⑥)。
81
+ * 标题排按紧凑按钮(`ui.css` 的 `.sd-button-sm`)预留高度:宽档父详情没有返回键、孩子视图有,
82
+ * 不预留时下方会话信息会在父子切换时跳 6px。
83
+ *
84
+ * `position: sticky`:长会话读到中段时返回键仍在顶上(触屏没有 Esc 兜底,返回必须常驻)。
85
+ * 底色用宿主页面底色(`bg-base`)把滚过的正文盖住。 */
86
+ export declare const HEAD_MIN_HEIGHT = 28;
87
+ export declare const HEAD_PAD_BOTTOM = 6;
88
+ export declare const BLOCK_META: CSSProperties;
89
+ export declare const SECTION_LABEL: CSSProperties;
90
+ /** 日志里那两个时间戳缺省时的降级(`src/trash/detail.ts` 把初值写成 0,读不到就是 0)。 */
91
+ export declare function timeText(ms: number): string;
92
+ /** 空串不是名字:wire 用缺席表示没读到,清册字段仍可能是空串;行名与标题排共用这一条。 */
93
+ export declare function present(value: string | undefined): value is string;
94
+ export declare function SessionDetail<S, D extends SessionDetailWire>({ state, subjectId, head, infoRows, subagents, busy, wide, onRetry, onBack, detailNav, pager, t, }: SessionDetailProps<S, D>): import("react").JSX.Element;
@@ -0,0 +1,112 @@
1
+ /**
2
+ * 清单的**分组列**(通用;回收站档与归档档各交一份行视图):grid 容器与它的 ARIA、项目组的
3
+ * 组头、一行的壳与三格,外加非就绪那一档的三张卡(加载 / 打断块 / 空态)。DOM 只在这里拼一次。
4
+ *
5
+ * 三条规矩:
6
+ * - **只有真有行才挂 grid 与它的 aria**(ADR-0028):失败 / 加载 / 空是一块普通内容,不是
7
+ * 「空的 grid」;`aria-busy` 住在容器上(刷新中不是第四态,ADR-0048)。
8
+ * - **底色与 `aria-selected` 不是同一判据**:底色说的是「详情正画着这一条」,多选态只把
9
+ * `aria-selected` 让给勾选集,底色不退场(一次只给一种动作语义,但两者不许互相冒充)。
10
+ * - **行的 DOM id 在 DOM 这一侧编码**:id 里可能带空白/引号,直接拼进 HTML id 是非法值、
11
+ * `aria-activedescendant` 也会失配(issue #8 第 7 条);原始身份留在 `dom.idAttr`,焦点交还
12
+ * 按属性值比对(`useRowFocus`)。
13
+ *
14
+ * 视觉配方走 `trash-view.ts` 那三份(`CARD` / `ROW` / `ROW_SELECTED`);行与组的悬停、动作列
15
+ * 提亮、焦点环住在 `ui/layout.css` 的 `.sd-session-row` / `.sd-session-group-row` 上——两档吃同一份
16
+ * 类名。`data-dsh-session-delete` 上的档位名(`trash-*` / `archive-*`)是「这一行属于哪一档」的
17
+ * 身份,测试与 `useRowFocus` 靠它分辨在屏上的是哪一列。
18
+ */
19
+ import { type ReactNode, type RefObject } from 'react';
20
+ import { type ProjectGroup } from './trash-view.js';
21
+ import type { ListSelection } from './use-list-selection.js';
22
+ import type { TrashNav } from './trash-nav.js';
23
+ import type { DelayedPrefetch } from './use-prefetch.js';
24
+ import type { Translate } from './copy.js';
25
+ /** 一档清单进 DOM 的身份:档位名与行身份属性总是成对出现,两档各给一份常量(`useRowFocus` 也读它)。 */
26
+ export interface ListDom {
27
+ /** 档位名前缀:拼出容器与行、组头的 `data-dsh-session-delete` 值,以及 DOM id 的前缀
28
+ * (`sd-trash-` / `sd-archive-`)。 */
29
+ readonly kind: 'trash' | 'archive';
30
+ /** 行的原始身份写进哪个 DOM 属性(回收站 = `data-entry-id`,归档 = `data-session-id`):
31
+ * 两档的身份本来就是两种东西(条目 id / 会话 id),不混成一个名字。 */
32
+ readonly idAttr: string;
33
+ }
34
+ /**
35
+ * 把焦点交还给清单里的某一行(导航只拿这个动作,不认行选择器)。**按属性值自己比**,不把行 id
36
+ * 拼进选择器:id 只挡路径分隔符(`trash/entry.ts`),另一半是宿主给的目录名,带引号时选择器直接抛。
37
+ */
38
+ export declare function useRowFocus(listRef: RefObject<HTMLDivElement | null>, idAttr: string): (rowId: string) => void;
39
+ /**
40
+ * 一行的可见读数:调用方只交文案、数字与那一排动作,格子、ARIA、底色与指针接线由这里拼。
41
+ * 「勾上了没有」「是不是活动行」「tab 落点」不在这一份里——那是清单态,由本模块自己算。
42
+ */
43
+ export interface SessionRowView {
44
+ /** 行的原始身份(回收站 = 条目 id,归档 = 会话 id):DOM 属性、`aria-selected` 判定都走它。 */
45
+ readonly id: string;
46
+ readonly title: string;
47
+ /** 标题悬停的全文;`null` ⇒ 不挂 `title`(未命名行没有可展开的原文)。 */
48
+ readonly titleTip: string | null;
49
+ /** 第二行那句读数(时间 · 大小 · 计数),已按档拼好。 */
50
+ readonly meta: string;
51
+ readonly metaTip: string;
52
+ /** 多选态那颗勾选框的无障碍名(两档语序不同,各自给)。 */
53
+ readonly checkLabel: string;
54
+ /** 这一行动作的失败原文;没有就传 `null`。 */
55
+ readonly failure: string | null;
56
+ /** 行右那一排动作(多选态整排退场由本模块决定,调用方只管给)。 */
57
+ readonly actions: ReactNode;
58
+ /** 点行 = 选中看详情;多选态由本模块先拦成「勾 / 取消这一条」。 */
59
+ readonly onSelect: () => void;
60
+ }
61
+ export interface SessionListProps<R> {
62
+ listRef: RefObject<HTMLDivElement>;
63
+ /** 这一档进 DOM 的身份:档位名 + 行身份写进哪个属性(两档各给一份常量)。 */
64
+ dom: ListDom;
65
+ /** 就绪时 grid 的可访问名(`detail.list.label` / `archive.tab`)。 */
66
+ gridLabel: string;
67
+ /** 重读在飞 ⇒ 容器 `aria-busy`(不是第四态,ADR-0048)。 */
68
+ refreshing: boolean;
69
+ /** 非「有行」那一档的整块内容(加载 / 失败 / 语料缺席 / 空态):在场就不挂 grid。 */
70
+ notice: ReactNode;
71
+ groups: readonly ProjectGroup<R>[];
72
+ selection: ListSelection<R>;
73
+ /** 键盘契约与焦点意图(导航状态住面板)。 */
74
+ nav: TrashNav;
75
+ /** hover / focus 的延时预取:四件事的接线只在这一处。 */
76
+ prefetch: DelayedPrefetch<R>;
77
+ /** 当前活动行(选中行,或窄档方向键的光标):底色与 `aria-activedescendant` 读它。 */
78
+ activeId: string | null;
79
+ rowOf: (row: R) => SessionRowView;
80
+ t: Translate;
81
+ }
82
+ /**
83
+ * 分组列本体。`notice` 在场时容器仍渲染(`useRowFocus` 与滚动容器都要它),但 grid 的 role 与
84
+ * 那一串 aria 一律不挂。
85
+ */
86
+ export declare function SessionList<R>({ listRef, dom, gridLabel, refreshing, notice, groups, selection, nav, prefetch, activeId, rowOf, t, }: SessionListProps<R>): import("react").JSX.Element;
87
+ /** 加载那一拍:一句轻读数,不画骨架(清单还不知道有几条)。 */
88
+ export declare function ListLoading({ label }: {
89
+ label: string;
90
+ }): import("react").JSX.Element;
91
+ export interface ListNoticeProps {
92
+ /** 那句标题(`archive.readFailed` / `archive.corpusMissing.title` / `trash.readFailed`)。 */
93
+ title: string;
94
+ /** 标题下面那句:失败原文或语料缺席的提示。 */
95
+ detail: string;
96
+ /** 读数是失败来的 ⇒ 红色警告图标;只是「看不见」⇒ 低调灰(看不见 ≠ 没有,ADR-0019)。 */
97
+ tone: 'error' | 'muted';
98
+ onRetry: () => void;
99
+ retryLabel: string;
100
+ }
101
+ /**
102
+ * 打断块:图标 + 一句标题 + 原文/提示 + 重试。`CARD` 那一族是「要打断你视线的一块」,
103
+ * 带底色与边框才对,与清单行不是一套长相。
104
+ */
105
+ export declare function ListNotice({ title, detail, tone, onRetry, retryLabel }: ListNoticeProps): import("react").JSX.Element;
106
+ export interface ListEmptyProps {
107
+ icon: ReactNode;
108
+ title: string;
109
+ hint: string;
110
+ }
111
+ /** 空态:居中一块,图标 + 标题 + 一句提示。空清单是读数,不是失败。 */
112
+ export declare function ListEmpty({ icon, title, hint }: ListEmptyProps): import("react").JSX.Element;
@@ -9,7 +9,7 @@ import { type Translate } from './copy.js';
9
9
  import type { ConfigDeps } from './remote.js';
10
10
  import type { MaintenanceDeps } from './use-maintenance.js';
11
11
  export interface SettingsCardsProps {
12
- /** 维护四件 + 可调项两件;只造维护四件的测试替身会让「可调项」卡整体缺席。 */
12
+ /** 维护六件 + 可调项两件;只造维护六件的测试替身会让「可调项」卡整体缺席。 */
13
13
  deps: MaintenanceDeps & Partial<ConfigDeps>;
14
14
  /** 文案(缺省 = 内置 zh;宿主 locale 服务缺席时也是它,见 `copy.ts`)。 */
15
15
  t?: Translate;
@@ -0,0 +1,45 @@
1
+ import { type Translate } from './copy.js';
2
+ import { type SubagentSectionProps } from './session-detail.js';
3
+ /** 子会话行与摘要条共用的显示名:次序走 `preferredNameOf`(ADR-0058),空串走未命名兜底。 */
4
+ export declare function rowName(row: {
5
+ readonly label?: string;
6
+ readonly title: string;
7
+ }, t: Translate): string;
8
+ /**
9
+ * 一个孩子的**原始事实**(不是文案):显示名两档各自按名次序算好交进来(那是词汇表里的
10
+ * 「显示名次序」,不属于这一段),其余三样由这一段自己念成话。
11
+ */
12
+ export interface SubagentChild {
13
+ readonly id: string;
14
+ readonly name: string;
15
+ /** 已知字节数;`undefined` ⇒ 摆 `sizeAbsentText` 给的那句(不给就摆「—」)。 */
16
+ readonly sizeBytes: number | undefined;
17
+ /** 时间读数(回收站 = 删除时间,归档 = 最后活动);`undefined` ⇒ 这一格不画。 */
18
+ readonly at: number | undefined;
19
+ /** 有可打开的详情才可点;归档里未归档的孩子只读。 */
20
+ readonly navigable: boolean;
21
+ }
22
+ export interface SubagentSectionInput {
23
+ readonly subjectId: string;
24
+ /** 已列出来的孩子(被条数闸截断时就是前 N 条)。空表 ⇒ 整段不画。 */
25
+ readonly children: readonly SubagentChild[];
26
+ /** 孩子总数,只在被截断时给(`undefined` = 已列的就是全部):徽标与摘要条念它,
27
+ * 「已列 N / 共 M」也由它与 `children.length` 算出。写成 `number | undefined` 而不是可选键:
28
+ * 调用方交的就是「详情里那一格有没有读数」,两者在这里同义。 */
29
+ readonly total: number | undefined;
30
+ /** **全部**孩子的已知大小合计;`undefined` = 没有可信读数 ⇒ 摘要条不摆这一格。
31
+ * 合计的家在 Node 半:这里不拿已列的前 N 条求和,那是少报。 */
32
+ readonly totalSizeBytes: number | undefined;
33
+ /** 单行大小缺席时念什么(归档交自己键上的那句,与它的清单行同一个字符);不给 ⇒ 「—」。 */
34
+ readonly sizeAbsentText?: string;
35
+ /** 展开体里那句「它们跟谁走」;两档各自给(回收站=随组恢复/删除,归档=按自己的归档状态)。 */
36
+ readonly note: string;
37
+ readonly onOpenChild?: (id: string) => void;
38
+ readonly onPrefetchChild?: (id: string) => void;
39
+ readonly t: Translate;
40
+ }
41
+ /**
42
+ * 子会话段的两个槽:徽标(标题排)与段体(计量行之后)。没有孩子时返回 `undefined`,
43
+ * 调用方整段不画。
44
+ */
45
+ export declare function useSubagentSection(input: SubagentSectionInput): SubagentSectionProps | undefined;
@@ -1,5 +1,6 @@
1
1
  import { type Translate } from './copy.js';
2
- import type { OrphanReportWire, TrashEntryLike } from './remote.js';
2
+ import type { OrphanReportWire } from '../shared/wire.js';
3
+ import type { TrashEntryLike } from './remote.js';
3
4
  import type { PendingAction } from './use-trash-panel-controller.js';
4
5
  /**
5
6
  * 两种批量动作共用这一个确认框壳:`purge`(不可恢复)与 `restore`(加法,但一批条目多、去向是
@@ -1,68 +1,17 @@
1
1
  /**
2
- * 回收站详情块:只画状态,不取数。选中与孩子视图归面板控制器;账本、失败与重读归
3
- * `use-trash-detail-reader.ts`。
4
- *
5
- * 三条界面约束:
6
- * - 动作(恢复/彻底删除)留在清单行右侧;详情只负责看。
7
- * - 标题优先用清册标题,空串才回落到日志的 session/title。
8
- * - 正文是**块**:用户/助手文字常显;思考、工具、注入、系统消息、压缩摘要默认折叠,折叠头给
9
- * 标签 + 首行摘要(工具另给状态)。注入也铺进正文——这是对宿主 Chat 的有意偏离(它隐藏普通注入,
10
- * 而这里的目标是「删之前看全」);条数另进计量行。
11
- *
12
- * 助手正文与思考走 Markdown,用户提问保持原话;工具参数/结果走等宽纯文本(限高可滚)。
13
- * 附件随块位置渲染:用户气泡之上、助手正文之后、工具展开体末尾。
2
+ * 回收站详情块:`session-detail.tsx` 的**回收站投影**——显示名/大小与选中行配对、信息表七行
3
+ * (含「回收站目录」「原本归档」)、子会话段(徽标 + 段体)。取数与账本不在这(见
4
+ * `use-trash-detail-reader.ts`);通用的状态壳、正文块、工作步骤与分页住 `session-detail.tsx`。
14
5
  */
15
- import { type RefObject } from 'react';
16
- import { type Translate } from './copy.js';
6
+ import type { Translate } from './copy.js';
17
7
  import type { TrashEntryWire } from '../shared/wire.js';
18
8
  import type { TrashDetailLike } from './remote.js';
9
+ import { type DetailNav, type DetailPager } from './session-detail.js';
10
+ import type { DetailState } from './use-detail-reader.js';
19
11
  /** 详情主体只承诺清册那一行:孩子视图看的那条不在客户端清单里,没有只读数可配对
20
- * (孩子摘要随父详情过线,那一格的判据住 `src/client/remote.ts` 的 `TrashDetailLike`)。 */
21
- export type TrashDetailState = {
22
- kind: 'idle';
23
- } | {
24
- kind: 'loading';
25
- entry: TrashEntryWire;
26
- } | {
27
- kind: 'failed';
28
- entry: TrashEntryWire;
29
- message: string;
30
- }
31
- /** 换到没读过的条目时的「保持」:画的是上一条已就绪的详情,正文 `inert` + `aria-busy`;
32
- * 超过静默窗口才在标题排出提示(`HOLD_NOTICE_DELAY_MS`)。首次读数没有上一条可保持,走 `loading`。 */
33
- | {
34
- kind: 'holding';
35
- entry: TrashEntryWire;
36
- detail: TrashDetailLike;
37
- } | {
38
- kind: 'ready';
39
- entry: TrashEntryWire;
40
- detail: TrashDetailLike;
41
- };
42
- /** 分页这一块(在飞/失败 + 滚动容器)整体过手:`TrashDetail` 只转交,谁画正文谁拆开用。
43
- * 四样东西是一个概念(分页读面)的四个格子,打包走一个名字,不再逐样穿透组件边界。 */
44
- export interface DetailPager {
45
- /** 更早一页正在读。 */
46
- loadingOlder: boolean;
47
- /** 更早一页读失败的原文;正文本身仍是 ready。 */
48
- olderFailure: string | null;
49
- onLoadOlder: () => void;
50
- /** 详情栏的滚动容器;prepend 更早一页后按高度差补偿滚动位置。 */
51
- scrollRef?: RefObject<HTMLDivElement | null>;
52
- }
53
- /** 详情的导航面(孩子视图的开与回):类型定义住在这里(视图定 prop 形状),
54
- * 控制器 `import type` 它避免环。判据(谁在场、title 给什么)住控制器的 `detailNav` 派生。 */
55
- export interface DetailNav {
56
- /** 只在主体是清单选中那条时交出(ADR-0055 沿用的单级判据,唯一实现)。 */
57
- readonly onOpenChild?: (child: TrashEntryWire) => void;
58
- /** 与 `onOpenChild` 同进同出的意图预取:hover/focus 子会话行时先把它的详情读进来。 */
59
- readonly onPrefetchChild?: (child: TrashEntryWire) => void;
60
- /** 孩子视图的返回目标;title 是原文(未命名兜底由视图按 t 处理)。 */
61
- readonly parentContext?: {
62
- readonly title: string;
63
- readonly onBack: () => void;
64
- };
65
- }
12
+ * (孩子摘要随父详情过线,那一格的判据住 `src/client/remote.ts` 的 `TrashDetailLike`)。
13
+ * 形状与通用详情读路同为 `DetailState`(主体键 `subject`);两档不再各持一份可互转的副本。 */
14
+ export type TrashDetailState = DetailState<TrashEntryWire, TrashDetailLike>;
66
15
  export interface TrashDetailProps {
67
16
  state: TrashDetailState;
68
17
  /** 有写操作在飞(动作按钮住在清单行里,这里只用来把「重试」按住)。 */
@@ -1,5 +1,4 @@
1
1
  import type { KeyboardEvent as ReactKeyboardEvent, RefObject } from 'react';
2
- import type { TrashEntryLike } from './remote.js';
3
2
  /**
4
3
  * 导航要的面。`ordered` 是**屏幕上的顺序**(只含展开的组),由面板/选择面算好传进来——
5
4
  * 布局常量与本 module 无关。`drillEnabled` 是这一档支不支持整行下钻(窄档为真;宽档 Enter/Space
@@ -7,8 +6,10 @@ import type { TrashEntryLike } from './remote.js';
7
6
  * `select` 只移动选中(带 `drill` 才下钻),`back` 是控制器的回退动作(两程:先收孩子视图、
8
7
  * 再退下钻),`focusRow` 把焦点交给某一行。
9
8
  */
10
- export interface TrashNavInput {
11
- ordered: readonly TrashEntryLike[];
9
+ export interface TrashNavInput<R> {
10
+ ordered: readonly R[];
11
+ /** 行身份(回收站 = 条目 id,归档 = 会话 id):调用方给模块级稳定函数,别逐渲染换引用。 */
12
+ idOf: (row: R) => string;
12
13
  selectedId: string | null;
13
14
  selectMode: boolean;
14
15
  drillEnabled: boolean;
@@ -16,12 +17,12 @@ export interface TrashNavInput {
16
17
  /** 四个动作都是**属性声明**:它们被摘下来放进 `useTrashNav` 的输入或直接挂成事件处理器,
17
18
  * 实现体一个都不读 `this`。方法简写会带上隐式 `this: TrashNavInput`,`unbound-method`
18
19
  * 会把这种交接报成可疑;改属性只是让类型面说真话。 */
19
- select: (entry: TrashEntryLike, options?: {
20
+ select: (row: R, options?: {
20
21
  drill?: boolean;
21
22
  }) => Promise<void>;
22
- toggleCheck: (entryId: string) => void;
23
+ toggleCheck: (rowId: string) => void;
23
24
  back: () => void;
24
- focusRow: (entryId: string) => void;
25
+ focusRow: (rowId: string) => void;
25
26
  /** Esc 的作用域(面板根节点;生产入口必须传,测试可传空引用对象)。下钻时清单不在 DOM,
26
27
  * 但详情在面板里;**焦点在面板外**的 Esc 不归清单——否则在侧栏或别的面板按 Esc 会退出下钻,
27
28
  * 还会把焦点拽进回收站。根还没挂上时无从判断包含关系,Esc 不处理。 */
@@ -35,4 +36,4 @@ export interface TrashNav {
35
36
  /** 直接挂到清单容器的 `onKeyDown`:属性声明(见上)让「摘下来挂事件」不被误报。 */
36
37
  onListKeyDown: (event: ReactKeyboardEvent<HTMLElement>) => void;
37
38
  }
38
- export declare function useTrashNav(input: TrashNavInput): TrashNav;
39
+ export declare function useTrashNav<R>(input: TrashNavInput<R>): TrashNav;
@@ -4,7 +4,7 @@ import { type SessionDeleteRemote } from './remote.js';
4
4
  * **没有第二条路**:「恢复一条」也走 `apply`(N=1),面板不再同时吃
5
5
  * `applyOutcomes` 与一个便捷的 `restore`。无主子会话的检查/清理不在这里——它是插件设置页
6
6
  * 维护卡的手动动作(`use-maintenance.ts`),面板一次都不自动扫(ADR-0021)。 */
7
- export type TrashPanelDeps = Pick<SessionDeleteRemote, 'list' | 'detail' | 'applyOutcomes' | 'emptyTrash'>;
7
+ export type TrashPanelDeps = Pick<SessionDeleteRemote, 'list' | 'detail' | 'applyOutcomes' | 'emptyTrash' | 'archiveList' | 'archiveDetail'>;
8
8
  export interface TrashPanelProps {
9
9
  deps: TrashPanelDeps;
10
10
  /** 文案(缺省 = 内置 zh,见 `copy.ts`:这不是"忘了传",而是"这次没有 locale 服务")。 */