@xrn1997/dsh-session-delete 0.8.0 → 0.10.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.
- package/README.md +134 -173
- package/THIRD_PARTY_NOTICES.md +4 -2
- package/docs/DETAIL.md +1 -0
- package/docs/DETAIL.zh.md +1 -0
- package/docs/preview.svg +119 -0
- package/docs/preview.zh.svg +117 -0
- package/docs/screenshots/screenshot-01.png +0 -0
- package/lib/client.js +28630 -26493
- package/lib/index.js +2913 -1620
- package/lib/types/api/archive-rows.d.ts +7 -0
- package/lib/types/api/attachment-orphans.d.ts +3 -9
- package/lib/types/api/attachment.d.ts +4 -18
- package/lib/types/api/connection-route.d.ts +2 -6
- package/lib/types/api/route-table.d.ts +79 -31
- package/lib/types/api/trash-rows.d.ts +6 -22
- package/lib/types/client/api-base.d.ts +5 -12
- package/lib/types/client/archive-detail.d.ts +19 -0
- package/lib/types/client/archive-pane.d.ts +63 -0
- package/lib/types/client/archive-store.d.ts +10 -0
- package/lib/types/client/attachment-view.d.ts +3 -17
- package/lib/types/client/batch-bar.d.ts +4 -14
- package/lib/types/client/batch-confirm.d.ts +21 -17
- package/lib/types/client/batch-menu-item.d.ts +2 -10
- package/lib/types/client/batch-pick.d.ts +6 -13
- package/lib/types/client/batch-select.d.ts +10 -25
- package/lib/types/client/batch-selection-store.d.ts +21 -9
- package/lib/types/client/busy-gate.d.ts +2 -4
- package/lib/types/client/config-settings.d.ts +2 -3
- package/lib/types/client/confirm-dialog.d.ts +5 -8
- package/lib/types/client/context-menu-actions.d.ts +2 -8
- package/lib/types/client/context.d.ts +6 -15
- package/lib/types/client/copy.d.ts +86 -57
- package/lib/types/client/delete-confirm.d.ts +25 -13
- package/lib/types/client/delete-menu-item.d.ts +5 -9
- package/lib/types/client/detail-blocks.d.ts +5 -6
- package/lib/types/client/detail-ledger.d.ts +19 -0
- package/lib/types/client/detail-pane.d.ts +28 -0
- package/lib/types/client/host-archive-watch.d.ts +9 -0
- package/lib/types/client/host-rows.d.ts +32 -36
- package/lib/types/client/index.d.ts +5 -19
- package/lib/types/client/main-view.d.ts +25 -34
- package/lib/types/client/maintenance-parts.d.ts +2 -4
- package/lib/types/client/maintenance-settings.d.ts +3 -12
- package/lib/types/client/markdown.d.ts +4 -9
- package/lib/types/client/notice.d.ts +13 -0
- package/lib/types/client/orphan-maintenance.d.ts +8 -20
- package/lib/types/client/panel-tab.d.ts +39 -0
- package/lib/types/client/pending-open.d.ts +0 -1
- package/lib/types/client/plugin.d.ts +2 -4
- package/lib/types/client/prompt-rail.d.ts +1 -2
- package/lib/types/client/receipt.d.ts +14 -41
- package/lib/types/client/remote.d.ts +53 -88
- package/lib/types/client/scene.d.ts +41 -0
- package/lib/types/client/session-detail.d.ts +64 -0
- package/lib/types/client/session-list.d.ts +78 -0
- package/lib/types/client/session-live.d.ts +3 -13
- package/lib/types/client/settings-cards.d.ts +3 -6
- package/lib/types/client/settings-view.d.ts +1 -7
- package/lib/types/client/store.d.ts +6 -25
- package/lib/types/client/subagent-section.d.ts +36 -0
- package/lib/types/client/trash-confirm.d.ts +8 -9
- package/lib/types/client/trash-detail.d.ts +12 -66
- package/lib/types/client/trash-entry.d.ts +1 -1
- package/lib/types/client/trash-nav.d.ts +12 -18
- package/lib/types/client/trash-panel.d.ts +4 -6
- package/lib/types/client/trash-snapshot.d.ts +33 -41
- package/lib/types/client/trash-store.d.ts +12 -4
- package/lib/types/client/trash-tab.d.ts +22 -0
- package/lib/types/client/trash-view.d.ts +50 -50
- package/lib/types/client/ui/ErrorBoundary.d.ts +33 -0
- package/lib/types/client/ui/Modal.d.ts +3 -1
- package/lib/types/client/ui/Toast.d.ts +6 -3
- package/lib/types/client/ui/icons.d.ts +10 -4
- package/lib/types/client/undo-notices.d.ts +51 -20
- package/lib/types/client/undo-toast.d.ts +6 -9
- package/lib/types/client/use-archive-detail-reader.d.ts +27 -0
- package/lib/types/client/use-archive-panel-controller.d.ts +44 -0
- package/lib/types/client/use-archive-query.d.ts +31 -0
- package/lib/types/client/use-column-resize.d.ts +4 -11
- package/lib/types/client/use-detail-frame.d.ts +50 -0
- package/lib/types/client/use-detail-pager.d.ts +5 -13
- package/lib/types/client/use-detail-rail.d.ts +39 -0
- package/lib/types/client/use-detail-reader.d.ts +60 -0
- package/lib/types/client/use-gated-refresh.d.ts +27 -0
- package/lib/types/client/{use-trash-selection.d.ts → use-list-selection.d.ts} +16 -15
- package/lib/types/client/use-maintenance-section.d.ts +7 -12
- package/lib/types/client/use-maintenance.d.ts +11 -13
- package/lib/types/client/use-panel-child-view.d.ts +20 -0
- package/lib/types/client/use-panel-list-read.d.ts +51 -0
- package/lib/types/client/use-panel-selection.d.ts +36 -0
- package/lib/types/client/use-panel-tab.d.ts +134 -0
- package/lib/types/client/use-panel-width.d.ts +3 -11
- package/lib/types/client/use-prompt-rail.d.ts +8 -28
- package/lib/types/client/use-trash-detail-reader.d.ts +10 -23
- package/lib/types/client/use-trash-panel-controller.d.ts +17 -37
- package/lib/types/client/use-trash-query.d.ts +9 -25
- package/lib/types/client/use-write-progress.d.ts +26 -0
- package/lib/types/client/write-progress.d.ts +18 -0
- package/lib/types/client/write-seats.d.ts +64 -34
- package/lib/types/config.d.ts +8 -25
- package/lib/types/deps.d.ts +8 -10
- package/lib/types/domain/closure.d.ts +11 -30
- package/lib/types/errors.d.ts +21 -0
- package/lib/types/index.d.ts +9 -32
- package/lib/types/log/session-log.d.ts +42 -14
- package/lib/types/log/zstd-frames.d.ts +10 -25
- package/lib/types/ports/agent-handles.d.ts +10 -19
- package/lib/types/ports/attachments-port.d.ts +2 -6
- package/lib/types/ports/fs-port.d.ts +22 -24
- package/lib/types/ports/home.d.ts +7 -15
- package/lib/types/ports/host-port.d.ts +96 -59
- package/lib/types/ports/presence-port.d.ts +5 -12
- package/lib/types/remote/map-error.d.ts +4 -17
- package/lib/types/shared/apply-actions.d.ts +36 -0
- package/lib/types/shared/apply-values.d.ts +163 -0
- package/lib/types/shared/project-key.d.ts +5 -23
- package/lib/types/shared/session-path.d.ts +10 -0
- package/lib/types/shared/value-schema.d.ts +54 -0
- package/lib/types/shared/wire.d.ts +243 -197
- package/lib/types/trash/archive-detail.d.ts +16 -0
- package/lib/types/trash/attachments.d.ts +60 -43
- package/lib/types/trash/detail.d.ts +30 -26
- package/lib/types/trash/display-name.d.ts +2 -5
- package/lib/types/trash/entry.d.ts +22 -32
- package/lib/types/trash/groups.d.ts +17 -25
- package/lib/types/trash/ledger.d.ts +5 -9
- package/lib/types/trash/manifest.d.ts +4 -6
- package/lib/types/trash/projection-cache.d.ts +18 -0
- package/lib/types/trash/reconcile.d.ts +13 -23
- package/lib/types/trash/session-rows.d.ts +63 -0
- package/lib/types/trash/shrinking-view.d.ts +29 -0
- package/lib/types/trash/storage-manifest.d.ts +4 -7
- package/lib/types/trash/subagent-summary.d.ts +35 -0
- package/lib/types/verbs/batch-carried.d.ts +22 -2
- package/lib/types/verbs/batch.d.ts +39 -2
- package/lib/types/verbs/config.d.ts +3 -11
- package/lib/types/verbs/delete-session.d.ts +8 -13
- package/lib/types/verbs/empty-batch.d.ts +18 -0
- package/lib/types/verbs/live-admission.d.ts +3 -5
- package/lib/types/verbs/member-journal.d.ts +3 -7
- package/lib/types/verbs/member-presence.d.ts +7 -18
- package/lib/types/verbs/move-group.d.ts +2 -6
- package/lib/types/verbs/orphan-subagents.d.ts +23 -36
- package/lib/types/verbs/permanent-removal.d.ts +98 -81
- package/lib/types/verbs/restore-session.d.ts +10 -24
- package/lib/types/verbs/trash-scope.d.ts +21 -29
- package/lib/types/verbs/write-progress.d.ts +37 -0
- package/locale/en.json +7 -6
- package/locale/zh.json +2 -1
- package/package.json +135 -128
- package/lib/types/client/confirm-close.d.ts +0 -14
- package/lib/types/client/reset-client-state.d.ts +0 -1
- package/lib/types/client/write-settlement.d.ts +0 -66
- package/lib/types/client/write.d.ts +0 -66
- package/lib/types/verbs/errors.d.ts +0 -27
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** `GET /archive-list` 那一行的装配:registry 归档集 ∩ 会话语料 → `ArchiveListWire`。
|
|
2
|
+
* 与 `trash-rows.ts` 同层同责,但归档行念持久化日志字节与最后活动,回收站行念清册目录实测与删除时间
|
|
3
|
+
* ——两个 sizeBytes 不是一个数(ADR-0060 决定第 3 条)。
|
|
4
|
+
* 缺席口径住 `src/trash/session-rows.ts`;交集按 id 原样,ghost id 宁可少显示也不显示死行(ADR-0008)。 */
|
|
5
|
+
import type { CoreDeps } from '../deps.js';
|
|
6
|
+
import type { ArchiveListWire } from '../shared/wire.js';
|
|
7
|
+
export declare function assembleArchiveRows(deps: CoreDeps): Promise<ArchiveListWire>;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* 报告把扫描计划折成数量/字节 + 对象清单(`id`/`bytes`,供设置页预览缩略图;最多
|
|
5
|
-
* `src/config.ts` 的 `orphanPreviewLimit`(默认 200,ADR-0037),清理不受预览条数限制)。
|
|
6
|
-
* 扫描跳过(引用源或对象列表读不出)时**报告必须失败**——回一份 0 会让界面说"没有孤儿",
|
|
7
|
-
* 而这类失败恰恰是"不知道",不是"没有"。
|
|
8
|
-
* 清理是 `POST /attachment-clean`,由路由直接接到 `cleanOrphanImageAttachments`。
|
|
9
|
-
*/
|
|
1
|
+
/** 孤儿附件的报告段(`GET /attachment-orphans`):数量/字节 + 预览对象清单(条数由 `orphanPreviewLimit` 限)。
|
|
2
|
+
* 扫描跳过时**报告必须失败**——回 0 会让界面说「没有孤儿」,而这类失败是「不知道」。
|
|
3
|
+
* 清理走 `POST /attachment-clean`,路由直接接 `cleanOrphanImageAttachments`。 */
|
|
10
4
|
import { type AttachmentReadDeps } from '../trash/attachments.js';
|
|
11
5
|
import type { SessionDeleteConfig } from '../config.js';
|
|
12
6
|
import type { AttachmentOrphanReportWire } from '../shared/wire.js';
|
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 附件原始字节(`GET /attachment`,全仓唯一的二进制响应段)。
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* ② **kind 只认 image / file**:分别对应宿主附件库的 `objects`(图片)与 `file-objects`(普通文件);
|
|
8
|
-
* 不认 v2、tmp、cache,也不给"读任意文件"留入口。
|
|
9
|
-
* ③ **单文件 ≤ `maxAttachmentBytes`(默认 20 MiB,可配,ADR-0037)**:所有路径共用同一道
|
|
10
|
-
* `assertWithinLimit`;服务路径先按引用字节拦一道、再按实际字节复核,流式读在累计处停下。
|
|
11
|
-
* ④ **直接 fs 路径**按**魔数**给图片类型(PNG / JPEG / GIF / WebP),认不出就按下载处理
|
|
12
|
-
* (`application/octet-stream` + `attachment`),不猜、也不拿请求里的名字当类型来源;服务路径用
|
|
13
|
-
* 宿主归一化后的 `mediaType`(ADR-0035)。
|
|
14
|
-
*
|
|
15
|
-
* **读取优先走宿主 `attachments` 服务**(ADR-0035):`readImage` / `readFileStream` 会按记录里的
|
|
16
|
-
* 引用校验字节;`attachments` 缺席或请求里没有足够的引用元数据时,才退回直接 fs(旧宿主)。
|
|
17
|
-
* 两种"接不了这次读"(服务缺席 / 元数据不够)在调用方看来是同一个 `undefined`,不各写一条 fallback。
|
|
18
|
-
* 直接 fs 的路径仍只由 `attachmentPathOf(home, kind, id)` 推导。
|
|
19
|
-
*
|
|
20
|
-
* 请求本身不对(id/kind 形状)⇒ 400;对象不在 / 超限 / 读失败 ⇒ 200 + 信封(与其余段同一条错误面)。
|
|
3
|
+
* 寻址只认 sha256 id;kind 只认 image / file,不给「读任意文件」留入口。
|
|
4
|
+
* 所有路径共用一道 `maxAttachmentBytes` 闸;直接 fs 路径按魔数给图片类型,认不出按下载处理。
|
|
5
|
+
* 读取优先走宿主 `attachments` 服务(ADR-0035),缺席或元数据不够才退回直接 fs(旧宿主)。
|
|
6
|
+
* 请求本身不对 ⇒ 400;对象不在 / 超限 / 读失败 ⇒ 200 + 信封。
|
|
21
7
|
*/
|
|
22
8
|
import type { FsAttachmentPort } from '../ports/fs-port.js';
|
|
23
9
|
import type { SessionDeleteConfig } from '../config.js';
|
|
@@ -14,10 +14,6 @@ export interface ConnectionFetchServiceLike {
|
|
|
14
14
|
register(route: ConnectionFetchRouteLike): () => Promise<void>;
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* `connection` 是插件的硬依赖(web UI / 桌面端都装 `client-connection`);`fetch.register`
|
|
20
|
-
* 缺席属于宿主形状漂移,直接抛——静默返回空 disposer 会让插件「在但没有入口」。
|
|
21
|
-
* `dispatch` 与分发器同源。
|
|
22
|
-
*/
|
|
17
|
+
/** 注册全部段名 exact Fetch 路由,返回组合 disposer;`connection` 是硬依赖,`fetch.register` 缺席直接抛。
|
|
18
|
+
* 静默返回空 disposer 会让插件「在但没有入口」。 */
|
|
23
19
|
export declare function registerConnectionRoutes(service: ConnectionFetchServiceLike, dispatch: Dispatch): () => Promise<void>;
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
* 路由表(ADR-0004;deps 切片见 ADR-0032):段名 → { 方法, 纯度, 读面, body, deps 切片, 处理 }。一条记录,两个消费者。
|
|
3
|
-
*
|
|
4
|
-
* 一致性要求:
|
|
5
|
-
* - 该纯的判成写 ⇒ 探测/正文读/扫描被堵在串行链后;
|
|
6
|
-
* - 该写的判成纯 ⇒ 写动作绕开到达序链,与对账交错;
|
|
7
|
-
* - body 该读没读 ⇒ 下游拿到 null;读两遍 ⇒ 流已被消费;
|
|
8
|
-
* - 切片声明宽了 ⇒ 危险能力(删目录 / 时钟)漏进读段的 run;窄了 ⇒ 写段的处理编译不过。
|
|
9
|
-
*
|
|
10
|
-
* 这张表不放 shared/wire.ts:处理函数会 import 动词与 node:fs,而浏览器半要 import wire.ts。
|
|
11
|
-
* 段名、方法与请求体形状住 wire.ts(`ROUTES` 每项 `{ path, method, body }`,本表的 method / body 只投影、
|
|
12
|
-
* 不写第二份字面量);这张表只回答“怎么处理”。
|
|
13
|
-
*/
|
|
14
|
-
import { type ApplyAction, type RouteName } from '../shared/wire.js';
|
|
1
|
+
import { ROUTES, type ApplyAction, type RouteBody, type RouteName } from '../shared/wire.js';
|
|
15
2
|
import type { ConfigEditorLike, CoreDeps, DeleteDeps, RemovalDeps } from '../deps.js';
|
|
16
3
|
import type { AttachmentsPort } from '../ports/attachments-port.js';
|
|
17
4
|
import type { TrashEntry } from '../trash/entry.js';
|
|
18
5
|
/** 请求体:`json` 才读下来(GET 一律不读;读两遍会把流消费掉)。 */
|
|
19
6
|
export type BodyKind = 'none' | 'json';
|
|
7
|
+
/** 读的是 wire 那一格(`ROUTES.x.body`):无字段与查询串段不读,带 JSON 字段的段读一次。 */
|
|
8
|
+
export declare function bodyOf(route: {
|
|
9
|
+
readonly body: RouteBody;
|
|
10
|
+
}): BodyKind;
|
|
20
11
|
/** 到达序:`pure` 不进链;`chained` 进链;函数形式给 `/apply` 用(`count` 是纯读)。 */
|
|
21
12
|
export type Purity = 'pure' | 'chained' | ((body: JsonBody) => 'pure' | 'chained');
|
|
22
|
-
/** 清册读面:`none`
|
|
23
|
-
* 它与纯度是两条独立的轴:`count` 是 pure/不读,`detail` 是 pure/raw,`ping` 是 pure/不读。 */
|
|
13
|
+
/** 清册读面:`none` 不读、`list` 先对账、`raw` 索引快照;与纯度是两条独立的轴。 */
|
|
24
14
|
export type ReadKind = 'none' | 'list' | 'raw';
|
|
25
15
|
export type JsonBody = Record<string, unknown> | null;
|
|
26
16
|
/** 附件段的二进制落地:处理函数交回字节与安全头,分发器按它写 200(失败仍是 JSON 信封)。 */
|
|
@@ -34,10 +24,8 @@ export interface BinaryResponse {
|
|
|
34
24
|
export interface RouteRead {
|
|
35
25
|
rows(): Promise<readonly TrashEntry[]>;
|
|
36
26
|
}
|
|
37
|
-
/** deps 切片(ADR-0032
|
|
38
|
-
*
|
|
39
|
-
* configEditor + entry 两件(段的 run 里长出超面调用就是编译错;dispatch 也只按这一格注入,
|
|
40
|
-
* 运行期收窄住 `src/api/dispatch.ts` 的 `slicesOf`)。 */
|
|
27
|
+
/** deps 切片(ADR-0032):每段只声明自己要的那一面;段的 run 里长出超面调用是编译错。
|
|
28
|
+
* dispatch 也只按这一格注入(运行期收窄住 `src/api/dispatch.ts` 的 `slicesOf`)。 */
|
|
41
29
|
export type RouteSlice = 'core' | 'removal' | 'full' | 'attachment' | 'config';
|
|
42
30
|
/** 切片名 → 依赖面:{@link RouteSpec.run} 的 deps 参数类型与 `depsFor` 的返回类型都从这一格取。 */
|
|
43
31
|
export type SliceDeps = {
|
|
@@ -58,33 +46,93 @@ interface BaseRouteSpec<S extends RouteSlice> {
|
|
|
58
46
|
readonly method: 'GET' | 'POST';
|
|
59
47
|
readonly body: BodyKind;
|
|
60
48
|
readonly purity: Purity;
|
|
61
|
-
|
|
62
|
-
/** 同源取数闸(ADR-0033):只有能被别的页面渲染消费的段需要;判据住 `src/api/connection-route.ts`。
|
|
63
|
-
* 缺省不设闸——JSON 响应跨源读不到(没有 CORS),不需要它。 */
|
|
49
|
+
/** 同源取数闸(ADR-0033):只有能被别的页面渲染消费的段需要,判据住 `connection-route.ts`。 */
|
|
64
50
|
readonly fetchGate?: 'same-origin';
|
|
65
51
|
}
|
|
66
|
-
/** JSON
|
|
67
|
-
export interface
|
|
52
|
+
/** `read:'none'` 的 JSON 段:处理函数只拿请求体,签名里不摆 `RouteRead`。 */
|
|
53
|
+
export interface NoReadJsonRouteSpec<S extends RouteSlice = RouteSlice> extends BaseRouteSpec<S> {
|
|
54
|
+
readonly read: 'none';
|
|
68
55
|
readonly response: 'json';
|
|
69
56
|
/** 声明成函数属性而不是方法:方法签名是双变的,显式标注更宽的 deps 能绕过切片闸;属性按逆变校验。 */
|
|
57
|
+
readonly run: (deps: SliceDeps[S], body: JsonBody) => Promise<unknown>;
|
|
58
|
+
}
|
|
59
|
+
/** `read: 'list' | 'raw'` 的 JSON 段:处理函数拿请求体与读面;`query` 不在这里(段名表里只有二进制段需要查询串)。 */
|
|
60
|
+
export interface ReadJsonRouteSpec<S extends RouteSlice = RouteSlice> extends BaseRouteSpec<S> {
|
|
61
|
+
readonly read: 'list' | 'raw';
|
|
62
|
+
readonly response: 'json';
|
|
70
63
|
readonly run: (deps: SliceDeps[S], body: JsonBody, read: RouteRead) => Promise<unknown>;
|
|
71
64
|
}
|
|
65
|
+
/** JSON 段(两种读面的并集):`response` 是 `json` 的行都归它;按 `read` 再分成拿不拿读面两形。 */
|
|
66
|
+
export type JsonRouteSpec<S extends RouteSlice = RouteSlice> = NoReadJsonRouteSpec<S> | ReadJsonRouteSpec<S>;
|
|
72
67
|
/** 二进制段:只有 `/attachment`;处理函数直接拿查询串,交回字节与安全头。 */
|
|
73
68
|
export interface BinaryRouteSpec<S extends RouteSlice = RouteSlice> extends BaseRouteSpec<S> {
|
|
69
|
+
readonly read: 'none';
|
|
74
70
|
readonly response: 'binary';
|
|
75
71
|
readonly run: (deps: SliceDeps[S], query: URLSearchParams) => Promise<BinaryResponse>;
|
|
76
72
|
}
|
|
77
73
|
export type RouteSpec<S extends RouteSlice = RouteSlice> = JsonRouteSpec<S> | BinaryRouteSpec<S>;
|
|
78
|
-
/**
|
|
74
|
+
/** 各行的并集(表的值类型):每行由自己的 `slice` 与 `response` 字面量定型,`run` 的 deps 面随之收窄。 */
|
|
79
75
|
export type AnyRouteSpec = {
|
|
80
76
|
[S in RouteSlice]: RouteSpec<S>;
|
|
81
77
|
}[RouteSlice];
|
|
78
|
+
/** 行的决定半:只写 `slice` / 纯度 / 读面 / 处理;`method` 与 `body` 由 `defineRoute` 从段名表取。
|
|
79
|
+
* none 行的 `run` 可少写形参(探测段没有可读的入参)。 */
|
|
80
|
+
interface NoneJsonDecision<S extends RouteSlice> {
|
|
81
|
+
readonly slice: S;
|
|
82
|
+
readonly purity: Purity;
|
|
83
|
+
readonly read: 'none';
|
|
84
|
+
readonly response?: 'json';
|
|
85
|
+
readonly fetchGate?: 'same-origin';
|
|
86
|
+
readonly run: (deps: SliceDeps[S], body: JsonBody) => Promise<unknown>;
|
|
87
|
+
}
|
|
88
|
+
/** 读行:`run` 恰好三参——少接一个就是「带读面声明却拿不到读面」的死接线,多一个或少一个都判成 `never`。 */
|
|
89
|
+
type ReadJsonDecision<S extends RouteSlice, R extends (deps: SliceDeps[S], body: JsonBody, read: RouteRead) => Promise<unknown>> = {
|
|
90
|
+
readonly slice: S;
|
|
91
|
+
readonly purity: Purity;
|
|
92
|
+
readonly read: 'list' | 'raw';
|
|
93
|
+
readonly response?: 'json';
|
|
94
|
+
readonly fetchGate?: 'same-origin';
|
|
95
|
+
readonly run: R;
|
|
96
|
+
} & (Parameters<R>['length'] extends 3 ? unknown : {
|
|
97
|
+
readonly run: never;
|
|
98
|
+
});
|
|
99
|
+
/** 二进制行:`run` 恰好两参——`query` 是寻址入参,少接一个就只剩不会寻址的处理器。 */
|
|
100
|
+
type BinaryDecision<S extends RouteSlice, R extends (deps: SliceDeps[S], query: URLSearchParams) => Promise<BinaryResponse>> = {
|
|
101
|
+
readonly slice: S;
|
|
102
|
+
readonly purity: Purity;
|
|
103
|
+
readonly read: 'none';
|
|
104
|
+
readonly response: 'binary';
|
|
105
|
+
readonly fetchGate?: 'same-origin';
|
|
106
|
+
readonly run: R;
|
|
107
|
+
} & (Parameters<R>['length'] extends 2 ? unknown : {
|
|
108
|
+
readonly run: never;
|
|
109
|
+
});
|
|
110
|
+
/** 段名表的键:与 `RouteName`(每项的 `path`)是两个域,`defineRoute` 拿键去段名表取那一格。 */
|
|
111
|
+
type RouteKey = keyof typeof ROUTES;
|
|
112
|
+
/** 段名键 → 行的条目:`name` 是这条目自己的段名键,组装器按它派生键——键与段名同一个字面量,错不开。 */
|
|
113
|
+
type RouteEntry<N extends RouteKey> = {
|
|
114
|
+
readonly name: N;
|
|
115
|
+
readonly spec: AnyRouteSpec;
|
|
116
|
+
};
|
|
117
|
+
/** 一行路由 = 段名 + 决定半:`method` / `body` 从 `ROUTES[name]` 派生,纯度 / 读面 / 切片 / 处理由调用方给。
|
|
118
|
+
* 三个重载按 `read` 与 `response` 分派 `run` 的形;交回条目而不是裸行,行文里没有第二个可写错的段名。 */
|
|
119
|
+
export declare function defineRoute<N extends RouteKey, S extends RouteSlice>(name: N, decision: NoneJsonDecision<S>): RouteEntry<N>;
|
|
120
|
+
export declare function defineRoute<N extends RouteKey, S extends RouteSlice, R extends (deps: SliceDeps[S], body: JsonBody, read: RouteRead) => Promise<unknown>>(name: N, decision: ReadJsonDecision<S, R>): RouteEntry<N>;
|
|
121
|
+
export declare function defineRoute<N extends RouteKey, S extends RouteSlice, R extends (deps: SliceDeps[S], query: URLSearchParams) => Promise<BinaryResponse>>(name: N, decision: BinaryDecision<S, R>): RouteEntry<N>;
|
|
122
|
+
/** `/apply` 六个动作的静态纯度:动作名单由键派生,唯一识别器也只认这些键。
|
|
123
|
+
* 事实源是 `src/shared/apply-actions.ts` 的 `APPLY_ACTION_INDEX`,这里只投影;`satisfies` 是编译闸。 */
|
|
124
|
+
export declare const APPLY_ACTION_TABLE: {
|
|
125
|
+
delete: "chained";
|
|
126
|
+
restore: "chained";
|
|
127
|
+
purge: "chained";
|
|
128
|
+
count: "pure";
|
|
129
|
+
'orphan-clean': "chained";
|
|
130
|
+
unarchive: "chained";
|
|
131
|
+
};
|
|
82
132
|
export declare const APPLY_ACTIONS: readonly ApplyAction[];
|
|
83
|
-
/**
|
|
84
|
-
* 十个段名各一行。`Record<段名, AnyRouteSpec>` 是闸:`wire.ts` 加了段名而这里没加,编译不过;
|
|
85
|
-
* 每行的 `slice` 又把该行的 `run` 钉在自己那一格 deps 上(ADR-0032)。
|
|
86
|
-
*/
|
|
133
|
+
/** 段名表逐行:键由 `createRouteTable` 派生;`Record<段名, AnyRouteSpec>` 是闸,漏段编译不过。 */
|
|
87
134
|
export declare const ROUTE_TABLE: Record<RouteName, AnyRouteSpec>;
|
|
88
|
-
/** 段名 → 那一行;不认识的段名回 `undefined
|
|
135
|
+
/** 段名 → 那一行;不认识的段名回 `undefined`。必须问 `Object.hasOwn`:`constructor` 这类
|
|
136
|
+
* 原型属性名会从索引读里「查到」一个函数,把未知路径判成已知路由。 */
|
|
89
137
|
export declare function routeOf(rest: string): RouteSpec | undefined;
|
|
90
138
|
export {};
|
|
@@ -1,31 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `GET /list` 那一行的装配:清册行(`TrashEntry`)→ 线上那一行(`TrashRowWire`),外加组视图的几个只读数。
|
|
3
|
-
*
|
|
4
|
-
* 它从 `api/dispatch.ts` 里搬出来,因为路由层的事是**传输**(栅栏、方法、纯度、信封),而"一行里放什么"
|
|
5
|
-
* 是这一层的事。「折进谁、谁露面」那条判据读 `trash/groups.ts`(ADR-0001);一组会释放多少、盘上还剩谁
|
|
6
|
-
* 归 `verbs/permanent-removal.ts` 的只读计划 —— 这里只做装配,不再自己枚举盘上后代。
|
|
7
|
-
*/
|
|
1
|
+
/** `GET /list` 那一行的装配:清册行 → 线上行,外加组视图只读数;折进判据住 `trash/groups.ts`(ADR-0001)。 */
|
|
8
2
|
import type { CoreDeps } from '../deps.js';
|
|
9
3
|
import { type TrashEntry } from '../trash/entry.js';
|
|
10
4
|
import type { TrashRowWire } from '../shared/wire.js';
|
|
11
|
-
/**
|
|
12
|
-
* 其余缺席 = 这次没算,不是 0。 */
|
|
5
|
+
/** 行投影的只读数容器:`releaseBytes` 必填;其余缺席 = 这次没算,不是 0。 */
|
|
13
6
|
type TrashRowReadouts = {
|
|
14
7
|
readonly releaseBytes: number;
|
|
15
8
|
} & Partial<Pick<TrashRowWire, 'subagentCount' | 'subagentBytes' | 'strandedSubagents' | 'strandedBytes' | 'workspaceMissing'>>;
|
|
16
|
-
/**
|
|
17
|
-
* 清册那一行 → 线上那一行。清册字段走 `entryWire` 那份显式字面量(线上形状多一个必填字段时编译不过,
|
|
18
|
-
* `...row` 会把它带过去),这里只补 `/list` 的只读数。
|
|
19
|
-
*/
|
|
9
|
+
/** 清册行 → 线上行:清册字段走 `entryWire`(多一个必填字段会编译错),这里只补 `/list` 只读数。 */
|
|
20
10
|
export declare function toWire(row: TrashEntry, readouts: TrashRowReadouts): TrashRowWire;
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* 这些派生值只加在这次回信上,**不落清册**——清册该记的是文件里真有的事实,而"还剩几个孩子"
|
|
25
|
-
* "工作区还在不在"是随盘上随时变的读数。取数失败照抛(响亮失败,不端一份少了这栏的清单当没事发生)。
|
|
26
|
-
*
|
|
27
|
-
* 一组要释放多少、盘上还剩谁**只读计划一处算**(`planVisibleTrash`,与 purge 同一条口径);
|
|
28
|
-
* 这里不再自己枚举盘上后代,也不碰 `isLive`(活体准入只属于写动词)。
|
|
29
|
-
*/
|
|
11
|
+
/** 装配成「一行 = 一组」:孩子折进父行,父行不在时孩子自己占一行(否则看不见也清不掉)。
|
|
12
|
+
* 派生值只加在这次回信上、不落清册;取数失败照抛。
|
|
13
|
+
* 组释放量与盘上剩余只由 `planVisibleTrash` 一处算,不碰 `isLive`。 */
|
|
30
14
|
export declare function assembleTrashRows(deps: CoreDeps, rows: readonly TrashEntry[]): Promise<TrashRowWire[]>;
|
|
31
15
|
export {};
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 取数路径的挂载点:官方 `/api` 前缀 +
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* 反代根、而不是宿主。路由注册侧仍然必须写 `/api/...`(宿主 `connection.fetch.register` 用
|
|
8
|
-
* `endpointFromPath('/api', path)` 校验),所以本文件只给**浏览器半**投影一层挂载点前缀。
|
|
9
|
-
*
|
|
10
|
-
* 根部署(`http://host/`)下 `mountPathOf` 返回空串,拼出来的 URL 与旧版逐字相同;只有挂载部署才
|
|
11
|
-
* 多出 `/dsh` 这一段。目录取自 `new URL('.', baseURI)`:页面是 `/dsh/`、`/dsh/index.html` 都归到
|
|
12
|
-
* `/dsh/`;`about:blank` 这类不透明 base 退回根路径(此时相对地址本来也无法成立)。
|
|
2
|
+
* 取数路径的挂载点:官方 `/api` 前缀 + **当前文档所在目录**。宿主自己的客户端模块按 app-directory-relative
|
|
3
|
+
* 下发 bundle 与 chunk 描述符,浏览器在**自己的挂载点**下解析(`dsh-client-modules` README 原文:*"which a
|
|
4
|
+
* browser document resolves under its own mount"*);同一个部署可以被反代到 `/dsh/`,此时 `/api/...` 会打到反代根。
|
|
5
|
+
* 路由注册侧仍写 `/api/...`(宿主 `connection.fetch.register` 用 `endpointFromPath('/api', path)` 校验),
|
|
6
|
+
* 所以本文件只给浏览器半投影一层挂载点前缀。根部署下为空串;目录取自 `new URL('.', baseURI)`,不透明 base 退回根路径。
|
|
13
7
|
*/
|
|
14
|
-
/** `baseURI` 所在目录的路径,去掉尾斜杠;根路径回空串。 */
|
|
15
8
|
export declare function mountPathOf(baseURI: string): string;
|
|
16
9
|
/** 一段相对段名 → 宿主 `/api` 前缀 + 挂载点。`path` 以 `/` 开头,与 `ROUTES` 的形状一致。 */
|
|
17
10
|
export declare function apiPathOf(path: string, baseURI: string): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 归档详情投影:信息表恰五行(项目 / 日志末条 / 会话 id / 大小 / 状态),无「回收站目录」「原本归档」;
|
|
3
|
+
* 状态行认主体自己的归档态(wire 的 `archived`),不认导航道或旧快照。
|
|
4
|
+
*/
|
|
5
|
+
import type { Translate } from './copy.js';
|
|
6
|
+
import type { ArchiveDetailLike } from './remote.js';
|
|
7
|
+
import type { ArchiveDetailSubject } from './use-archive-detail-reader.js';
|
|
8
|
+
import { type DetailNav } from './session-detail.js';
|
|
9
|
+
import type { DetailFrame } from './use-detail-frame.js';
|
|
10
|
+
export interface ArchiveDetailProps {
|
|
11
|
+
frame: DetailFrame<ArchiveDetailSubject, ArchiveDetailLike>;
|
|
12
|
+
busy: boolean;
|
|
13
|
+
wide: boolean;
|
|
14
|
+
detailNav: DetailNav;
|
|
15
|
+
onRetry: () => void;
|
|
16
|
+
onBack: () => void;
|
|
17
|
+
t: Translate;
|
|
18
|
+
}
|
|
19
|
+
export declare function ArchiveDetail({ frame, busy, wide, detailNav, onRetry, onBack, t, }: ArchiveDetailProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 归档档的三个纯视图件(清单列 / 工具行 / 页脚)与 adapter:状态面来自 `useArchiveQuery`,
|
|
3
|
+
* 装配线住 `use-panel-tab.ts`、四格版面住 `panel-tab.tsx`;这里只回答归档档与回收站不同的那几格。
|
|
4
|
+
*/
|
|
5
|
+
import type { RefObject } from 'react';
|
|
6
|
+
import { type Translate } from './copy.js';
|
|
7
|
+
import type { ArchiveRowWire } from '../shared/wire.js';
|
|
8
|
+
import { type ProjectGroup } from './trash-view.js';
|
|
9
|
+
import { type ListDom } from './session-list.js';
|
|
10
|
+
import type { ArchiveDetailLike } from './remote.js';
|
|
11
|
+
import type { ArchiveDetailSubject } from './use-archive-detail-reader.js';
|
|
12
|
+
import type { ArchiveQuery } from './use-archive-query.js';
|
|
13
|
+
import type { ListSelection } from './use-list-selection.js';
|
|
14
|
+
import { type ArchivePanelController } from './use-archive-panel-controller.js';
|
|
15
|
+
import type { TrashNav } from './trash-nav.js';
|
|
16
|
+
import type { DelayedPrefetch } from './use-prefetch.js';
|
|
17
|
+
import { type PanelTabFrameLayout } from './panel-tab.js';
|
|
18
|
+
import { type PanelTab, type PanelTabAdapter, type PanelTabContext } from './use-panel-tab.js';
|
|
19
|
+
/** 这一档进 DOM 的身份:行身份是会话 id(回收站那边是条目 id)。 */
|
|
20
|
+
export declare const ARCHIVE_LIST_DOM: ListDom;
|
|
21
|
+
/** 行身份:模块级稳定引用(面板把导航接在这里)。 */
|
|
22
|
+
export declare const archiveRowIdOf: (row: ArchiveRowWire) => string;
|
|
23
|
+
export interface ArchiveListProps {
|
|
24
|
+
query: ArchiveQuery;
|
|
25
|
+
selection: ListSelection<ArchiveRowWire>;
|
|
26
|
+
groups: readonly ProjectGroup<ArchiveRowWire>[];
|
|
27
|
+
controller: Pick<ArchivePanelController, 'selectRow' | 'unarchive' | 'requestDeleteOne' | 'actionFailure' | 'busy'>;
|
|
28
|
+
prefetch: DelayedPrefetch<ArchiveRowWire>;
|
|
29
|
+
listRef: RefObject<HTMLDivElement>;
|
|
30
|
+
/** 键盘契约(导航状态住档的装配线,窄档下钻时清单卸载也不丢 Esc 与焦点交还)。 */
|
|
31
|
+
nav: TrashNav;
|
|
32
|
+
/** 当前活动行(选中优先,回落光标):只在非多选态参与 `aria-selected`。 */
|
|
33
|
+
activeId: string | null;
|
|
34
|
+
onRetry: () => void;
|
|
35
|
+
t: Translate;
|
|
36
|
+
}
|
|
37
|
+
export declare function ArchiveList({ query, selection, groups, controller, prefetch, listRef, nav, activeId, onRetry, t }: ArchiveListProps): import("react").JSX.Element;
|
|
38
|
+
export interface ArchiveToolbarProps {
|
|
39
|
+
selection: ListSelection<ArchiveRowWire>;
|
|
40
|
+
groups: readonly ProjectGroup<ArchiveRowWire>[];
|
|
41
|
+
t: Translate;
|
|
42
|
+
}
|
|
43
|
+
export declare function ArchiveToolbar({ selection, groups, t }: ArchiveToolbarProps): import("react").JSX.Element;
|
|
44
|
+
export interface ArchiveFooterProps {
|
|
45
|
+
selection: ListSelection<ArchiveRowWire>;
|
|
46
|
+
controller: Pick<ArchivePanelController, 'unarchive' | 'requestDeleteMany' | 'busy'>;
|
|
47
|
+
t: Translate;
|
|
48
|
+
}
|
|
49
|
+
/** 页脚随档位:多选态 = 「解除所选」(无确认框)/「删除所选」(实心红,确认框同批量删除)。
|
|
50
|
+
* 危险那颗必须是这一排的最后一个(整页唯一实心红的位置契约);勾中行读 `checkedRows` 派生,不从 groups 重算。 */
|
|
51
|
+
export declare function ArchiveFooter({ selection, controller, t }: ArchiveFooterProps): import("react").JSX.Element | null;
|
|
52
|
+
/** 归档档 adapter:两档差异里属于归档的那一半。 */
|
|
53
|
+
export declare const ARCHIVE_TAB_ADAPTER: PanelTabAdapter<ArchiveQuery, ArchiveRowWire, ArchiveDetailSubject, ArchiveDetailLike, ArchivePanelController>;
|
|
54
|
+
export type ArchivePanelTab = PanelTab<ArchiveQuery, ArchiveRowWire, ArchiveDetailSubject, ArchiveDetailLike, ArchivePanelController>;
|
|
55
|
+
export interface ArchiveTabViewProps {
|
|
56
|
+
readonly tab: ArchivePanelTab;
|
|
57
|
+
readonly layout: PanelTabFrameLayout;
|
|
58
|
+
readonly t: Translate;
|
|
59
|
+
}
|
|
60
|
+
/** 归档档的四格视图:清单列 / 工具行 / 页脚三件住本文件,详情 `ArchiveDetail` 原样转交;
|
|
61
|
+
* 四格容器与分栏/下钻分支由 `PanelTabFrame` 画(与回收站档同一份)。 */
|
|
62
|
+
export declare function ArchiveTabView({ tab, layout, t }: ArchiveTabViewProps): import("react").JSX.Element;
|
|
63
|
+
export declare function useArchiveTab(ctx: PanelTabContext): ArchivePanelTab;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ArchiveRevisionScene {
|
|
2
|
+
invalidate(): void;
|
|
3
|
+
use(): number;
|
|
4
|
+
reset(): void;
|
|
5
|
+
}
|
|
6
|
+
export declare function createArchiveRevisionScene(): ArchiveRevisionScene;
|
|
7
|
+
export declare function invalidateArchive(): void;
|
|
8
|
+
/** 供归档查询订阅(生产走 Provider 的那一份;测试无 Provider 回退默认场景)。 */
|
|
9
|
+
export declare function useArchiveRevision(): number;
|
|
10
|
+
export declare function resetArchiveStore(): void;
|
|
@@ -1,27 +1,13 @@
|
|
|
1
1
|
import { type TrashDetailAttachmentWire } from '../shared/wire.js';
|
|
2
2
|
import type { Translate } from './copy.js';
|
|
3
|
-
/**
|
|
4
|
-
* 一张附件的取数地址。**只从校验过的 id 与 kind 派生**:不接受路径、不接受任意查询串,
|
|
5
|
-
* 所以调用面把 URL 交给 `<img src>` / `<a href>` 时不存在"读任意文件"的入口。
|
|
6
|
-
*/
|
|
3
|
+
/** 取数地址只从校验过的 id 与 kind 派生:不接受路径与任意查询串,故不存在「读任意文件」的入口。 */
|
|
7
4
|
export declare function attachmentUrl(a: TrashDetailAttachmentWire): string;
|
|
8
5
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `align` 是这一行的对齐(默认 `end`,与用户气泡同侧):用户行靠右、助手行靠左,条跟着自己那条消息走。
|
|
12
|
-
* `failed` 按 `attachmentId` 记:同一个内容哈希在一段会话里可能被引用多次,裂一次就都不再画破图。
|
|
13
|
-
* 四个 `useState` 都在早退之前调用——附件从有到无时 hook 数量不变。
|
|
6
|
+
* 一条消息的全部附件,顺序照日志(用户先发图后发文件)。`align` 是这一行的对齐:用户行靠右、助手行靠左。
|
|
7
|
+
* `failed` 按 `attachmentId` 记:同一内容哈希可能被引用多次,裂一次就不再画破图。四个 `useState` 都在早退前调用。
|
|
14
8
|
*/
|
|
15
9
|
export declare function AttachmentStrip({ attachments, t, align, }: {
|
|
16
10
|
attachments: readonly TrashDetailAttachmentWire[];
|
|
17
11
|
t: Translate;
|
|
18
|
-
/** `end`(默认)= 靠右,用户气泡那一侧;`start` = 靠左,助手正文那一侧。 */
|
|
19
12
|
align?: 'start' | 'end';
|
|
20
13
|
}): import("react").JSX.Element | null;
|
|
21
|
-
/**
|
|
22
|
-
* 附件清理回执那一行提示(「N 个附件未能清理」/「附件未清理:原因」)。表现层只收一句已经拼好的话;
|
|
23
|
-
* 什么时候该有这句话、失败与跳过怎么拼,归接线的那一侧(判据住 `receipt.ts` 与 `use-trash-query.ts`)。
|
|
24
|
-
*/
|
|
25
|
-
export declare function AttachmentNotice({ message }: {
|
|
26
|
-
message: string | null;
|
|
27
|
-
}): import("react").JSX.Element | null;
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 批量删除的浮条:**多选模式内常驻**(0
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* 为什么单独一个文件而不是并进 `batch-select.tsx`:那份是"行开关控件",而浮条要点开确认框
|
|
8
|
-
* (要 import 它的现场)——两个方向合到一个文件上就是一圈。浮条住在
|
|
9
|
-
* `shell.overlay` 上,与单删的撤销提示/确认框同类(槽位原文:"a toast stack or a status pill
|
|
10
|
-
* all belong here")。
|
|
11
|
-
*
|
|
12
|
-
* 那个 K 是**勾选变化后防抖 300ms 的一次批量 count**(`/apply` 的 `action:'count'`,一组 id 一次),
|
|
13
|
-
* 并且带**最新票守卫**:在飞的旧响应不许盖掉新名单的读数(compare-and-set 住 `createLatestWins`,
|
|
14
|
-
* 防抖本身仍在下面这个 effect 里)。
|
|
15
|
-
* 读不到就整句不说——K 是合计,缺一条就是假数(「不许拿 0 冒充没有」)。
|
|
2
|
+
* 批量删除的浮条:**多选模式内常驻**(0 条也渲染),汇总「已选 N 条」+「含 K 个子会话」,
|
|
3
|
+
* 「查看已选」展开可滚动的标题清单。K 是勾选防抖 300ms 后的一次批量 count(`/apply` 的 action:count),
|
|
4
|
+
* 带最新票守卫;读数与它对应的名单绑在一起存,对不上就整句不说(不拿旧读数求新名单的和)。
|
|
5
|
+
* 整行点击守卫也挂在这棵常驻宿主上;浮条住 `shell.overlay`。
|
|
16
6
|
*/
|
|
17
7
|
import { type ReactElement } from 'react';
|
|
18
8
|
import { type Translate } from './copy.js';
|
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* 仍然各是各的——批量形的标题随条数、目标卡逐条列、执行是一次批量 `apply`、失败面按行回;
|
|
6
|
-
* 单删的 `busy` / 失败面没有被拖进来。卡片样式(`TARGET_CARD`)与 hint、子会话那两句**复用**单删的,
|
|
7
|
-
* 一句不造第二个键。
|
|
8
|
-
*
|
|
9
|
-
* 现场是模块级的(同 `delete-confirm.tsx` / `undo-notices.ts`):请求从浮条那颗按钮发来,确认框住在
|
|
10
|
-
* `shell.overlay` 上——它必须活在行开关那棵子树之外(槽位行随宿主重排而卸载,见 `delete-confirm.tsx` 头注)。
|
|
2
|
+
* 批量删除确认框:挂在 `shell.overlay` 上的宿主,加它读的请求现场(场景实例里的一份)。
|
|
3
|
+
* 页脚与关框规则共壳(`confirm-dialog.tsx`,ADR-0052),业务面各是各的;请求现场必须活在行开关那棵
|
|
4
|
+
* 子树之外(槽位行随宿主重排而卸载)。框不认识任何一方的选中集:执行后由发请求那一面交收缩钩子。
|
|
11
5
|
*/
|
|
12
6
|
import { type ReactElement } from 'react';
|
|
13
7
|
import { type Translate } from './copy.js';
|
|
14
8
|
import type { OneShotDeps } from './remote.js';
|
|
15
|
-
import {
|
|
9
|
+
import type { PickItem } from './batch-selection-store.js';
|
|
16
10
|
export interface BatchDeleteRequest {
|
|
17
11
|
/** 每次发布递增:换一批就重挂载,busy / 失败面不带着上一批的记忆。 */
|
|
18
12
|
seq: number;
|
|
19
13
|
items: readonly PickItem[];
|
|
14
|
+
/** 落地后收缩**发请求那一面**的选中集;被闸挡回的那一趟不调它——这一趟没跑,不许照着它动任何选中集。 */
|
|
15
|
+
shrinkSelection?: (failedSessionIds: readonly string[]) => void;
|
|
20
16
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/**
|
|
17
|
+
export interface BatchConfirmScene {
|
|
18
|
+
/** 请求确认这一批。空名单不发框;`shrinkSelection` 缺席 = 这一面没有要收缩的选中集。 */
|
|
19
|
+
request(items: readonly PickItem[], shrinkSelection?: (failedSessionIds: readonly string[]) => void): void;
|
|
20
|
+
/** 收起确认框。**带 expected 比较**:一次批量在飞时用户可能已发布了**下一批**请求(框按 seq 重挂载),
|
|
21
|
+
* 旧实例晚到的成功只许收自己那一批,不许把后来发布的那批一起清掉。 */
|
|
22
|
+
clear(expected?: BatchDeleteRequest): void;
|
|
23
|
+
/** 重试轮之后把现场收缩到失败名单。**带 expected 比较**:旧实例晚到的部分失败不许收缩后来发布的那一批。 */
|
|
24
|
+
shrinkToFailures(expected: BatchDeleteRequest, failedSessionIds: readonly string[]): void;
|
|
25
|
+
use(): BatchDeleteRequest | null;
|
|
26
|
+
reset(): void;
|
|
27
|
+
}
|
|
28
|
+
export declare function createBatchConfirmScene(): BatchConfirmScene;
|
|
29
|
+
export declare function requestDeleteBatch(items: readonly PickItem[], shrinkSelection?: (failedSessionIds: readonly string[]) => void): void;
|
|
30
|
+
export declare function clearDeleteBatchRequest(expected?: BatchDeleteRequest): void;
|
|
31
|
+
/** 供浮条与装配面订阅(生产走 Provider 的那一份;测试无 Provider 回退默认场景)。 */
|
|
25
32
|
export declare function useDeleteBatchRequest(): BatchDeleteRequest | null;
|
|
26
|
-
/** 测试专用:现场与 seq 归零,用例之间互不串味。 */
|
|
27
|
-
export declare function resetBatchConfirm(): void;
|
|
28
|
-
/** 常驻的批量确认框宿主。没有待确认的批量删除时什么都不渲染。 */
|
|
29
33
|
export declare function BatchConfirmHost({ deps, t, }: {
|
|
30
34
|
deps: OneShotDeps;
|
|
31
35
|
t?: Translate;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* 常驻勾选框被用户打回后,入口改成显式模式:按下这一行才进入多选态(再按一次退出),
|
|
5
|
-
* 模式内才渲染勾选框、才把整行点击变成"勾/取消"(守卫在 `host-rows.ts`)。
|
|
6
|
-
* 菜单的开关归 owner(与 `delete-menu-item.tsx` 同一条契约):按下后先切模式、再收菜单。
|
|
7
|
-
*
|
|
8
|
-
* 文案复用回收站工具栏那两句(`trash.toolbar.select` / `selectExit`)——同一个"多选/退出多选"
|
|
9
|
-
* 不造第二个键。
|
|
2
|
+
* 会话「⋯」菜单里的「多选」入口:按下才进入多选态(再按一次退出),菜单的开关归 owner——按下后先切模式、再收菜单。
|
|
3
|
+
* 文案复用清单那两句,不造第二个键。
|
|
10
4
|
*/
|
|
11
5
|
import type { ReactElement } from 'react';
|
|
12
6
|
import { type Translate } from './copy.js';
|
|
13
7
|
export interface BatchSelectMenuItemProps {
|
|
14
|
-
/** 菜单 owner 交下来的「收起菜单」;缺省不动,方便单独测这一行。 */
|
|
15
8
|
dismissMenu?: () => void;
|
|
16
|
-
/** 文案(缺省 = 内置 zh,见 `copy.ts`)。 */
|
|
17
9
|
t?: Translate;
|
|
18
10
|
}
|
|
19
11
|
export declare function BatchSelectMenuItem({ dismissMenu, t, }: BatchSelectMenuItemProps): ReactElement;
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import { type PickItem } from './batch-selection-store.js';
|
|
2
|
-
/**
|
|
2
|
+
/** 全选:按登记序追加当前可见行;已在名单里的由 `addPicks` 跳过,原有选中保持在前。 */
|
|
3
3
|
export declare function selectAllVisible(): void;
|
|
4
|
-
/**
|
|
5
|
-
* 同一个切换口该显示「全选」还是「取消全选」:
|
|
6
|
-
* - 有选中、且当前可见可选行全都选中 ⇒ 取消全选;
|
|
7
|
-
* - 有选中、但当前没有可见可选行(全折叠/过滤掉)⇒ 只能清空,也显示取消全选;
|
|
8
|
-
* - 其余(含 0 条)⇒ 全选。
|
|
9
|
-
*/
|
|
4
|
+
/** 切换口显示「全选」还是「取消全选」:有选中而没有可见行时也算「取消全选」(此时点它只能清空)。 */
|
|
10
5
|
export declare function areAllVisibleRowsSelected(rows: readonly PickItem[], picks: readonly PickItem[]): boolean;
|
|
11
6
|
/**
|
|
12
|
-
* 多选态内的整行点击守卫(document
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* 认行靠 `data-row-key="session:…"`——**这是本文件唯一一处 DOM 读**(ADR-0034):宿主将来改掉这个
|
|
17
|
-
* 属性,最差是模式内点行不生效,勾选框本身仍在。模式外不挂监听:这时点行必须还是宿主的"打开会话"。
|
|
7
|
+
* 多选态内的整行点击守卫(document 捕获阶段)。行里的按钮 / 链接 / 输入 / 菜单项一律放行;双击的第二下
|
|
8
|
+
* 与 dblclick 不翻转;模式外不挂监听(点行仍是宿主的「打开会话」)。
|
|
9
|
+
* 认行靠 `data-row-key="session:…"`——**本文件唯一一处 DOM 读**(ADR-0034):宿主改掉它是可接受的降级。
|
|
10
|
+
* **先查登记再吞事件**:没登记的行一个默认行为都不改(吞掉会让它们静默失效)。
|
|
18
11
|
*/
|
|
19
12
|
export declare function useSelectionRowClickGuard(): void;
|
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* 合并快照);"哪些行现在可见"住 `host-rows.ts`,"点行算不算选中"住 `batch-pick.ts`。四处隔着
|
|
8
|
-
* 槽位边界,只有模块级 store 能让他们看见同一份名单;本文件不持有任何现场。
|
|
9
|
-
*
|
|
10
|
-
* **为什么主勾选在行首**:宿主对行尾 `.rowActions` 是 `display:none`,只有 `row:hover` / 菜单打开
|
|
11
|
-
* 才出现(app.asar 0.2.0-rc.2 的 Rows 渲染);行首 16px 格在无状态点时是空的,模式内可见。
|
|
12
|
-
* 宿主在「有状态点(运行中/待确认/未读完成)」与归档行不渲染行首格 ⇒ 这些行走行尾悬停兜底,
|
|
13
|
-
* 但模式内**点整行**也能选(`batch-pick.ts` 的 `useSelectionRowClickGuard`),所以不依赖那颗小框。
|
|
14
|
-
* 两条勾选不会同时出现(`ui.css` 的 `:has` 兜底隐藏规则,靠宿主行的 `data-row-key`)。
|
|
2
|
+
* 宿主列表批量删除的**控件面**:行首勾选框、行尾兜底开关,以及计数问句 `fetchCounts`。
|
|
3
|
+
* 入口在「⋯」菜单:按下才进入多选模式,模式内才渲染勾选框并把整行点击变成勾/取消;退出模式清空名单。
|
|
4
|
+
* 选中集只住 `batch-selection-store.ts`;可见行住 `host-rows.ts`;点行算不算选中住 `batch-pick.ts`。
|
|
5
|
+
* **主勾选在行首**:宿主对行尾 `.rowActions` 是 `display:none`,只有行尾悬停/菜单打开才出现(app.asar 0.2.0-rc.2 的 `Rows` 渲染);
|
|
6
|
+
* 有状态点与归档行不渲染行首格,走行尾兜底(两条不会同时出现,靠 `ui.css` 的 `:has` 隐藏规则)。
|
|
15
7
|
*/
|
|
16
8
|
import type { ReactElement } from 'react';
|
|
17
9
|
import { type Translate } from './copy.js';
|
|
18
10
|
import { type SessionDeleteRemote } from './remote.js';
|
|
19
11
|
/**
|
|
20
12
|
* 一组会话的子会话计数(`/apply` 的 `action:'count'`,纯读、不进串行链)。
|
|
21
|
-
*
|
|
22
|
-
* **一条读不到就整份返回 null** ——界面上那两个数(浮条的 K、确认框的 K 与逐条 M)都是合计,
|
|
23
|
-
* 缺一条就是假数;「不许拿 0 冒充没有」。
|
|
13
|
+
* **一条读不到就整份返回 null**:界面上的合计缺一条就是假数(不许拿 0 冒充没有)。
|
|
24
14
|
*/
|
|
25
15
|
export declare function fetchCounts(deps: Pick<SessionDeleteRemote, 'applyOutcomes'>, ids: readonly string[]): Promise<Map<string, number> | null>;
|
|
26
16
|
export interface BatchPickCheckboxProps {
|
|
@@ -29,15 +19,11 @@ export interface BatchPickCheckboxProps {
|
|
|
29
19
|
title: string;
|
|
30
20
|
/** 运行态同样由 root hook 读:登记表里的 `live` 与行尾兜底保持同一口径。 */
|
|
31
21
|
live?: boolean;
|
|
32
|
-
/** 文案(缺省 = 内置 zh,见 `copy.ts`)。 */
|
|
33
22
|
t?: Translate;
|
|
34
23
|
}
|
|
35
24
|
/**
|
|
36
|
-
* 行首 16px
|
|
37
|
-
*
|
|
38
|
-
* 用的是回收站多选同款原生 `Checkbox`:它自己会 `stopPropagation`,所以点框不会顺带打开会话
|
|
39
|
-
* (行首格在宿主行那条 `onClick` 里面)。宿主对「有状态点」和归档行不渲染这一格,
|
|
40
|
-
* 那些行走 `BatchPickButton` 兜底;两条不会同时出现(见 `ui.css` 的兜底隐藏规则)。
|
|
25
|
+
* 行首 16px 格里的主勾选框:**只在多选模式内渲染**。原生 `Checkbox` 自己会 `stopPropagation`,
|
|
26
|
+
* 所以点框不会顺带打开会话;宿主对「有状态点」与归档行不渲染这一格,走 `BatchPickButton` 兜底。
|
|
41
27
|
*/
|
|
42
28
|
export declare function BatchPickCheckbox({ sessionId, title, live, t, }: BatchPickCheckboxProps): ReactElement | null;
|
|
43
29
|
export interface BatchPickButtonProps {
|
|
@@ -49,8 +35,7 @@ export interface BatchPickButtonProps {
|
|
|
49
35
|
t?: Translate;
|
|
50
36
|
}
|
|
51
37
|
/**
|
|
52
|
-
*
|
|
53
|
-
* 座位原文保证「排内点击不误开会话」(`rowActions`
|
|
54
|
-
* 自己 `stopPropagation`。行首那颗与这颗共用同一份选中集和同一句 aria 名字;模式内点整行也能选。
|
|
38
|
+
* 多选态里行尾悬停排的**兜底**勾选开关:只在宿主不渲染行首格的行上露头。
|
|
39
|
+
* 座位原文保证「排内点击不误开会话」(`rowActions` 那层自己挡住冒泡),所以这里不需要 `stopPropagation`。
|
|
55
40
|
*/
|
|
56
41
|
export declare function BatchPickButton({ sessionId, title, live, t, }: BatchPickButtonProps): ReactElement | null;
|