@xrn1997/dsh-session-delete 0.9.0 → 0.11.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 +40 -39
- package/lib/client.js +28235 -27782
- package/lib/index.js +2090 -1698
- package/lib/types/api/archive-rows.d.ts +4 -17
- 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 +18 -59
- 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 +6 -14
- package/lib/types/client/archive-pane.d.ts +27 -24
- package/lib/types/client/archive-store.d.ts +7 -3
- package/lib/types/client/attachment-view.d.ts +3 -10
- package/lib/types/client/batch-bar.d.ts +4 -15
- package/lib/types/client/batch-confirm.d.ts +17 -22
- package/lib/types/client/batch-menu-item.d.ts +2 -10
- package/lib/types/client/batch-pick.d.ts +8 -14
- package/lib/types/client/batch-select.d.ts +11 -26
- package/lib/types/client/batch-selection-store.d.ts +25 -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 +4 -7
- 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 +36 -44
- 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 +6 -10
- package/lib/types/client/detail-pane.d.ts +5 -10
- package/lib/types/client/drop-machine.d.ts +34 -0
- package/lib/types/client/host-archive-watch.d.ts +5 -18
- package/lib/types/client/host-rows.d.ts +31 -42
- 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 -5
- package/lib/types/client/maintenance-settings.d.ts +3 -13
- package/lib/types/client/markdown.d.ts +4 -9
- package/lib/types/client/notice.d.ts +2 -5
- package/lib/types/client/orphan-maintenance.d.ts +7 -19
- 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 +13 -43
- package/lib/types/client/remote.d.ts +32 -98
- package/lib/types/client/scene.d.ts +41 -0
- package/lib/types/client/session-detail.d.ts +11 -41
- package/lib/types/client/session-list.d.ts +10 -44
- 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 +4 -13
- package/lib/types/client/trash-confirm.d.ts +7 -9
- package/lib/types/client/trash-detail.d.ts +9 -12
- package/lib/types/client/trash-drop.d.ts +33 -0
- package/lib/types/client/trash-entry.d.ts +8 -2
- package/lib/types/client/trash-nav.d.ts +4 -11
- package/lib/types/client/trash-panel.d.ts +4 -6
- package/lib/types/client/trash-snapshot.d.ts +27 -22
- 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 +19 -49
- package/lib/types/client/ui/Checkbox.d.ts +5 -2
- package/lib/types/client/ui/ErrorBoundary.d.ts +2 -1
- 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 +16 -8
- package/lib/types/client/undo-notices.d.ts +45 -30
- package/lib/types/client/undo-toast.d.ts +6 -12
- package/lib/types/client/use-archive-detail-reader.d.ts +2 -3
- package/lib/types/client/use-archive-panel-controller.d.ts +9 -38
- package/lib/types/client/use-archive-query.d.ts +2 -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 +5 -14
- package/lib/types/client/use-detail-reader.d.ts +5 -16
- package/lib/types/client/use-gated-refresh.d.ts +3 -3
- package/lib/types/client/use-list-selection.d.ts +5 -3
- package/lib/types/client/use-maintenance-section.d.ts +7 -12
- package/lib/types/client/use-maintenance.d.ts +7 -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 +1 -3
- 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 +3 -10
- package/lib/types/client/use-trash-panel-controller.d.ts +14 -46
- 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 +33 -75
- package/lib/types/config.d.ts +8 -25
- package/lib/types/deps.d.ts +6 -11
- package/lib/types/domain/closure.d.ts +11 -30
- package/lib/types/errors.d.ts +6 -12
- package/lib/types/index.d.ts +9 -32
- package/lib/types/log/session-log.d.ts +33 -25
- package/lib/types/log/zstd-frames.d.ts +7 -29
- 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 +17 -31
- package/lib/types/ports/home.d.ts +7 -15
- package/lib/types/ports/host-port.d.ts +51 -98
- 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 +8 -33
- package/lib/types/shared/value-schema.d.ts +54 -0
- package/lib/types/shared/wire.d.ts +117 -249
- package/lib/types/trash/archive-detail.d.ts +9 -20
- package/lib/types/trash/attachments.d.ts +60 -46
- package/lib/types/trash/detail.d.ts +17 -36
- package/lib/types/trash/display-name.d.ts +2 -5
- package/lib/types/trash/entry.d.ts +19 -44
- package/lib/types/trash/groups.d.ts +17 -26
- package/lib/types/trash/ledger.d.ts +5 -11
- package/lib/types/trash/manifest.d.ts +4 -6
- package/lib/types/trash/projection-cache.d.ts +5 -11
- package/lib/types/trash/reconcile.d.ts +11 -23
- package/lib/types/trash/session-rows.d.ts +15 -35
- package/lib/types/trash/shrinking-view.d.ts +10 -11
- 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 -4
- 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 -10
- 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 +91 -84
- package/lib/types/verbs/restore-session.d.ts +10 -26
- package/lib/types/verbs/trash-scope.d.ts +21 -30
- package/lib/types/verbs/write-progress.d.ts +37 -0
- package/package.json +135 -134
- package/lib/types/client/reset-client-state.d.ts +0 -1
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* `sessionPersistence.sizeBytes`(宿主持久化日志工件字节)与「最后活动」,回收站行念清册
|
|
6
|
-
* 的目录实测与删除时间——**两个 sizeBytes 不是一个数**(ADR-0060 决定第 3 条)。
|
|
7
|
-
*
|
|
8
|
-
* 四路读面(标题 / 活动 / 大小 / label)的缺席口径住 `src/trash/session-rows.ts`,这一层只管
|
|
9
|
-
* 「哪一批 id、哪些格要过线」:
|
|
10
|
-
* - `sessionQuery` 缺席 ⇒ `{ available: false }`(显式的「语料不可见」,不是空列表);
|
|
11
|
-
* - 大小读面抛错 ⇒ 整档 `io`(`sizeFailure: 'throw'`,不拿 0 冒充没有大小);
|
|
12
|
-
* - label 那格只随**子会话行**过线(普通行的 `labelOf` 念的是标题那一路,不是 descriptor label)。
|
|
13
|
-
*
|
|
14
|
-
* 交集按 **id 原样**(与 `isArchived` 的精确判据一致):ghost id(归档集里有、语料已无记录)
|
|
15
|
-
* 宁可少显示也不显示死行——删除不改 `archivedSessionIds`(ADR-0008),回收站里那条也靠这道
|
|
16
|
-
* 交集自动消失。
|
|
17
|
-
*/
|
|
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)。 */
|
|
18
5
|
import type { CoreDeps } from '../deps.js';
|
|
19
6
|
import type { ArchiveListWire } from '../shared/wire.js';
|
|
20
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,32 +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 /
|
|
12
|
-
* body 由 `defineRoute` 从段名表那一格派生、不写第二份字面量;字段组描述 `BODY_GROUPS` 由本表的
|
|
13
|
-
* 通用解析手消费);这张表只回答“怎么处理”。
|
|
14
|
-
*/
|
|
15
1
|
import { ROUTES, type ApplyAction, type RouteBody, type RouteName } from '../shared/wire.js';
|
|
16
2
|
import type { ConfigEditorLike, CoreDeps, DeleteDeps, RemovalDeps } from '../deps.js';
|
|
17
3
|
import type { AttachmentsPort } from '../ports/attachments-port.js';
|
|
18
4
|
import type { TrashEntry } from '../trash/entry.js';
|
|
19
5
|
/** 请求体:`json` 才读下来(GET 一律不读;读两遍会把流消费掉)。 */
|
|
20
6
|
export type BodyKind = 'none' | 'json';
|
|
21
|
-
/** 读的是 wire 那一格(`ROUTES.x.body
|
|
22
|
-
* 带 JSON 字段的段(config / entry / apply / sessionId)读一次。`defineRoute` 据此填行的 `body`。 */
|
|
7
|
+
/** 读的是 wire 那一格(`ROUTES.x.body`):无字段与查询串段不读,带 JSON 字段的段读一次。 */
|
|
23
8
|
export declare function bodyOf(route: {
|
|
24
9
|
readonly body: RouteBody;
|
|
25
10
|
}): BodyKind;
|
|
26
11
|
/** 到达序:`pure` 不进链;`chained` 进链;函数形式给 `/apply` 用(`count` 是纯读)。 */
|
|
27
12
|
export type Purity = 'pure' | 'chained' | ((body: JsonBody) => 'pure' | 'chained');
|
|
28
|
-
/** 清册读面:`none`
|
|
29
|
-
* 它与纯度是两条独立的轴:`count` 是 pure/不读,`detail` 是 pure/raw,`ping` 是 pure/不读。 */
|
|
13
|
+
/** 清册读面:`none` 不读、`list` 先对账、`raw` 索引快照;与纯度是两条独立的轴。 */
|
|
30
14
|
export type ReadKind = 'none' | 'list' | 'raw';
|
|
31
15
|
export type JsonBody = Record<string, unknown> | null;
|
|
32
16
|
/** 附件段的二进制落地:处理函数交回字节与安全头,分发器按它写 200(失败仍是 JSON 信封)。 */
|
|
@@ -40,10 +24,8 @@ export interface BinaryResponse {
|
|
|
40
24
|
export interface RouteRead {
|
|
41
25
|
rows(): Promise<readonly TrashEntry[]>;
|
|
42
26
|
}
|
|
43
|
-
/** deps 切片(ADR-0032
|
|
44
|
-
*
|
|
45
|
-
* configEditor + entry 两件(段的 run 里长出超面调用就是编译错;dispatch 也只按这一格注入,
|
|
46
|
-
* 运行期收窄住 `src/api/dispatch.ts` 的 `slicesOf`)。 */
|
|
27
|
+
/** deps 切片(ADR-0032):每段只声明自己要的那一面;段的 run 里长出超面调用是编译错。
|
|
28
|
+
* dispatch 也只按这一格注入(运行期收窄住 `src/api/dispatch.ts` 的 `slicesOf`)。 */
|
|
47
29
|
export type RouteSlice = 'core' | 'removal' | 'full' | 'attachment' | 'config';
|
|
48
30
|
/** 切片名 → 依赖面:{@link RouteSpec.run} 的 deps 参数类型与 `depsFor` 的返回类型都从这一格取。 */
|
|
49
31
|
export type SliceDeps = {
|
|
@@ -64,12 +46,10 @@ interface BaseRouteSpec<S extends RouteSlice> {
|
|
|
64
46
|
readonly method: 'GET' | 'POST';
|
|
65
47
|
readonly body: BodyKind;
|
|
66
48
|
readonly purity: Purity;
|
|
67
|
-
/** 同源取数闸(ADR-0033
|
|
68
|
-
* 缺省不设闸——JSON 响应跨源读不到(没有 CORS),不需要它。 */
|
|
49
|
+
/** 同源取数闸(ADR-0033):只有能被别的页面渲染消费的段需要,判据住 `connection-route.ts`。 */
|
|
69
50
|
readonly fetchGate?: 'same-origin';
|
|
70
51
|
}
|
|
71
|
-
/** `read:
|
|
72
|
-
* (none 行想看读面是编译错,不是运行期才炸的拒约)。 */
|
|
52
|
+
/** `read:'none'` 的 JSON 段:处理函数只拿请求体,签名里不摆 `RouteRead`。 */
|
|
73
53
|
export interface NoReadJsonRouteSpec<S extends RouteSlice = RouteSlice> extends BaseRouteSpec<S> {
|
|
74
54
|
readonly read: 'none';
|
|
75
55
|
readonly response: 'json';
|
|
@@ -80,7 +60,6 @@ export interface NoReadJsonRouteSpec<S extends RouteSlice = RouteSlice> extends
|
|
|
80
60
|
export interface ReadJsonRouteSpec<S extends RouteSlice = RouteSlice> extends BaseRouteSpec<S> {
|
|
81
61
|
readonly read: 'list' | 'raw';
|
|
82
62
|
readonly response: 'json';
|
|
83
|
-
/** 声明成函数属性而不是方法:方法签名是双变的,显式标注更宽的 deps 能绕过切片闸;属性按逆变校验。 */
|
|
84
63
|
readonly run: (deps: SliceDeps[S], body: JsonBody, read: RouteRead) => Promise<unknown>;
|
|
85
64
|
}
|
|
86
65
|
/** JSON 段(两种读面的并集):`response` 是 `json` 的行都归它;按 `read` 再分成拿不拿读面两形。 */
|
|
@@ -96,9 +75,8 @@ export type RouteSpec<S extends RouteSlice = RouteSlice> = JsonRouteSpec<S> | Bi
|
|
|
96
75
|
export type AnyRouteSpec = {
|
|
97
76
|
[S in RouteSlice]: RouteSpec<S>;
|
|
98
77
|
}[RouteSlice];
|
|
99
|
-
/**
|
|
100
|
-
*
|
|
101
|
-
* 多余属性)。none 行的 `run` 允许少写形参(探测段没有可读的入参,`/ping` 连请求体都不消费)。 */
|
|
78
|
+
/** 行的决定半:只写 `slice` / 纯度 / 读面 / 处理;`method` 与 `body` 由 `defineRoute` 从段名表取。
|
|
79
|
+
* none 行的 `run` 可少写形参(探测段没有可读的入参)。 */
|
|
102
80
|
interface NoneJsonDecision<S extends RouteSlice> {
|
|
103
81
|
readonly slice: S;
|
|
104
82
|
readonly purity: Purity;
|
|
@@ -107,10 +85,7 @@ interface NoneJsonDecision<S extends RouteSlice> {
|
|
|
107
85
|
readonly fetchGate?: 'same-origin';
|
|
108
86
|
readonly run: (deps: SliceDeps[S], body: JsonBody) => Promise<unknown>;
|
|
109
87
|
}
|
|
110
|
-
/**
|
|
111
|
-
* `run` 却少接一个形参就是「带读面声明却拿不到读面」的死接线——按 `R` 数形参,少一个、多一个
|
|
112
|
-
* 都把 `run` 判成 `never`(编译错)。`R` 只从 `run` 推断,形参的上下文类型取 `R` 的约束
|
|
113
|
-
* (标准三参形),行体照常按它写。 */
|
|
88
|
+
/** 读行:`run` 恰好三参——少接一个就是「带读面声明却拿不到读面」的死接线,多一个或少一个都判成 `never`。 */
|
|
114
89
|
type ReadJsonDecision<S extends RouteSlice, R extends (deps: SliceDeps[S], body: JsonBody, read: RouteRead) => Promise<unknown>> = {
|
|
115
90
|
readonly slice: S;
|
|
116
91
|
readonly purity: Purity;
|
|
@@ -121,8 +96,7 @@ type ReadJsonDecision<S extends RouteSlice, R extends (deps: SliceDeps[S], body:
|
|
|
121
96
|
} & (Parameters<R>['length'] extends 3 ? unknown : {
|
|
122
97
|
readonly run: never;
|
|
123
98
|
});
|
|
124
|
-
/**
|
|
125
|
-
* 少接一个就只剩一个不会寻址的处理器。 */
|
|
99
|
+
/** 二进制行:`run` 恰好两参——`query` 是寻址入参,少接一个就只剩不会寻址的处理器。 */
|
|
126
100
|
type BinaryDecision<S extends RouteSlice, R extends (deps: SliceDeps[S], query: URLSearchParams) => Promise<BinaryResponse>> = {
|
|
127
101
|
readonly slice: S;
|
|
128
102
|
readonly purity: Purity;
|
|
@@ -133,29 +107,20 @@ type BinaryDecision<S extends RouteSlice, R extends (deps: SliceDeps[S], query:
|
|
|
133
107
|
} & (Parameters<R>['length'] extends 2 ? unknown : {
|
|
134
108
|
readonly run: never;
|
|
135
109
|
});
|
|
136
|
-
/**
|
|
137
|
-
* 线上段名是它的 `path`,`defineRoute` 拿键去段名表取那一格。 */
|
|
110
|
+
/** 段名表的键:与 `RouteName`(每项的 `path`)是两个域,`defineRoute` 拿键去段名表取那一格。 */
|
|
138
111
|
type RouteKey = keyof typeof ROUTES;
|
|
139
112
|
/** 段名键 → 行的条目:`name` 是这条目自己的段名键,组装器按它派生键——键与段名同一个字面量,错不开。 */
|
|
140
113
|
type RouteEntry<N extends RouteKey> = {
|
|
141
114
|
readonly name: N;
|
|
142
115
|
readonly spec: AnyRouteSpec;
|
|
143
116
|
};
|
|
144
|
-
/**
|
|
145
|
-
*
|
|
146
|
-
* 纯度 / 读面 / 切片 / 处理由调用方给。三个重载按 `read` 与 `response` 分派 `run` 的形:
|
|
147
|
-
* none 的 JSON 行只拿请求体(拿不到 `RouteRead`),`list` / `raw` 行多拿读面(恰好三参),
|
|
148
|
-
* 二进制行拿查询串(恰好两参)——`read` 与 `response` 的组合三选一,坏组合没有重载收。
|
|
149
|
-
* 交回条目(段名 + 行)而不是裸行:`createRouteTable` 按 `name` 派生键,行文里没有第二个可写错的段名。
|
|
150
|
-
*/
|
|
117
|
+
/** 一行路由 = 段名 + 决定半:`method` / `body` 从 `ROUTES[name]` 派生,纯度 / 读面 / 切片 / 处理由调用方给。
|
|
118
|
+
* 三个重载按 `read` 与 `response` 分派 `run` 的形;交回条目而不是裸行,行文里没有第二个可写错的段名。 */
|
|
151
119
|
export declare function defineRoute<N extends RouteKey, S extends RouteSlice>(name: N, decision: NoneJsonDecision<S>): RouteEntry<N>;
|
|
152
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>;
|
|
153
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>;
|
|
154
|
-
/**
|
|
155
|
-
*
|
|
156
|
-
* 唯一识别器(`actionOf`)也只认这些键——新增动作必须同时给出纯度,漏了编译不过;
|
|
157
|
-
* 新加一个纯读动作也不会再静默落进 `chained`。
|
|
158
|
-
*/
|
|
122
|
+
/** `/apply` 六个动作的静态纯度:动作名单由键派生,唯一识别器也只认这些键。
|
|
123
|
+
* 事实源是 `src/shared/apply-actions.ts` 的 `APPLY_ACTION_INDEX`,这里只投影;`satisfies` 是编译闸。 */
|
|
159
124
|
export declare const APPLY_ACTION_TABLE: {
|
|
160
125
|
delete: "chained";
|
|
161
126
|
restore: "chained";
|
|
@@ -165,15 +130,9 @@ export declare const APPLY_ACTION_TABLE: {
|
|
|
165
130
|
unarchive: "chained";
|
|
166
131
|
};
|
|
167
132
|
export declare const APPLY_ACTIONS: readonly ApplyAction[];
|
|
168
|
-
/**
|
|
169
|
-
* 段名表逐行:键是段名(`createRouteTable` 按条目的段名派生成 `ROUTES[name].path`,行文里不手写键),
|
|
170
|
-
* 值经 `defineRoute` 构造。`Record<段名, AnyRouteSpec>` 是闸:`wire.ts` 加了段名而这里没加,编译不过;
|
|
171
|
-
* 每行的 `slice` 又把该行的 `run` 钉在自己那一格 deps 上(ADR-0032)。
|
|
172
|
-
*/
|
|
133
|
+
/** 段名表逐行:键由 `createRouteTable` 派生;`Record<段名, AnyRouteSpec>` 是闸,漏段编译不过。 */
|
|
173
134
|
export declare const ROUTE_TABLE: Record<RouteName, AnyRouteSpec>;
|
|
174
|
-
/** 段名 → 那一行;不认识的段名回 `undefined
|
|
175
|
-
*
|
|
176
|
-
* `Record` 的索引读里"查到"一个函数,把未知路径判成已知路由(随后以 405 / 处理期炸开的形态出现)。
|
|
177
|
-
* 这里只认表自身的键——表是 `Object.fromEntries` 建出来的,自有键恰好就是段名。 */
|
|
135
|
+
/** 段名 → 那一行;不认识的段名回 `undefined`。必须问 `Object.hasOwn`:`constructor` 这类
|
|
136
|
+
* 原型属性名会从索引读里「查到」一个函数,把未知路径判成已知路由。 */
|
|
178
137
|
export declare function routeOf(rest: string): RouteSpec | undefined;
|
|
179
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;
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* 子会话段与回收站共用同一套呈现(数据来自宿主闭包,见 `src/trash/archive-detail.ts`)。
|
|
5
|
-
*
|
|
6
|
-
* 标题与大小与**选中行**配对:显示名走 `displayNameOf`(label 优先),大小只摆信息表那一行
|
|
7
|
-
* (行的 `sizeBytes`,缺席显式「—」;计量行不重复)——详情只给正文与日志读数,不重算这两格。
|
|
8
|
-
* 状态行认**主体自己的归档态**(不认导航道):已归档主体(清单行、以及清单不可见时被打开的
|
|
9
|
-
* 已归档孩子)说「已归档」;未归档孩子说「随归档父会话查看」。
|
|
2
|
+
* 归档详情投影:信息表恰五行(项目 / 日志末条 / 会话 id / 大小 / 状态),无「回收站目录」「原本归档」;
|
|
3
|
+
* 状态行认主体自己的归档态(wire 的 `archived`),不认导航道或旧快照。
|
|
10
4
|
*/
|
|
11
5
|
import type { Translate } from './copy.js';
|
|
12
6
|
import type { ArchiveDetailLike } from './remote.js';
|
|
13
|
-
import type { DetailState } from './use-detail-reader.js';
|
|
14
7
|
import type { ArchiveDetailSubject } from './use-archive-detail-reader.js';
|
|
15
|
-
import { type DetailNav
|
|
8
|
+
import { type DetailNav } from './session-detail.js';
|
|
9
|
+
import type { DetailFrame } from './use-detail-frame.js';
|
|
16
10
|
export interface ArchiveDetailProps {
|
|
17
|
-
|
|
11
|
+
frame: DetailFrame<ArchiveDetailSubject, ArchiveDetailLike>;
|
|
18
12
|
busy: boolean;
|
|
19
13
|
wide: boolean;
|
|
20
|
-
/** 与回收站档同一面导航(按会话 id 交接,`DetailNav`);孩子视图由 `parentContext` 在场判定。 */
|
|
21
14
|
detailNav: DetailNav;
|
|
22
15
|
onRetry: () => void;
|
|
23
16
|
onBack: () => void;
|
|
24
|
-
pager: DetailPager;
|
|
25
17
|
t: Translate;
|
|
26
18
|
}
|
|
27
|
-
export declare function ArchiveDetail({
|
|
19
|
+
export declare function ArchiveDetail({ frame, busy, wide, detailNav, onRetry, onBack, t, }: ArchiveDetailProps): import("react").JSX.Element;
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 归档档的三个纯视图件(清单列 / 工具行 /
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* 清单的 DOM 不在这里拼——grid、组头、行壳与那三张状态卡都由 `src/client/session-list.tsx` 的
|
|
6
|
-
* `SessionList` 交出,这一档只交**行读数**与**那一排动作**。
|
|
7
|
-
*
|
|
8
|
-
* 行语义(docs/ui-spec.md §3.1):显示名(`displayNameOf`,label 优先)+ 最后活动/创建于 + 大小
|
|
9
|
-
* (缺席显式「—」)+ 行右两枚图标按钮(解除归档 / 删除,均带 `aria-label`、不写 emoji);行点击 =
|
|
10
|
-
* 选中看详情(不做原生打开);孤儿子会话照常显示并带「子代理」标签。
|
|
11
|
-
*
|
|
12
|
-
* 「最后活动」与「创建于」是归档档自己的口径(`updatedAtSource`),与回收站的「删除于」不是同一句;
|
|
13
|
-
* 数据标签按档不同,界面语言按档相同(ADR-0060 边界)。
|
|
2
|
+
* 归档档的三个纯视图件(清单列 / 工具行 / 页脚)与 adapter:状态面来自 `useArchiveQuery`,
|
|
3
|
+
* 装配线住 `use-panel-tab.ts`、四格版面住 `panel-tab.tsx`;这里只回答归档档与回收站不同的那几格。
|
|
14
4
|
*/
|
|
15
5
|
import type { RefObject } from 'react';
|
|
16
6
|
import { type Translate } from './copy.js';
|
|
17
7
|
import type { ArchiveRowWire } from '../shared/wire.js';
|
|
18
8
|
import { type ProjectGroup } from './trash-view.js';
|
|
19
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';
|
|
20
12
|
import type { ArchiveQuery } from './use-archive-query.js';
|
|
21
13
|
import type { ListSelection } from './use-list-selection.js';
|
|
22
|
-
import type
|
|
14
|
+
import { type ArchivePanelController } from './use-archive-panel-controller.js';
|
|
23
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';
|
|
24
19
|
/** 这一档进 DOM 的身份:行身份是会话 id(回收站那边是条目 id)。 */
|
|
25
20
|
export declare const ARCHIVE_LIST_DOM: ListDom;
|
|
26
21
|
/** 行身份:模块级稳定引用(面板把导航接在这里)。 */
|
|
@@ -29,32 +24,40 @@ export interface ArchiveListProps {
|
|
|
29
24
|
query: ArchiveQuery;
|
|
30
25
|
selection: ListSelection<ArchiveRowWire>;
|
|
31
26
|
groups: readonly ProjectGroup<ArchiveRowWire>[];
|
|
32
|
-
controller: Pick<ArchivePanelController, 'selectRow' | '
|
|
33
|
-
|
|
27
|
+
controller: Pick<ArchivePanelController, 'selectRow' | 'unarchive' | 'requestDeleteOne' | 'actionFailure' | 'busy'>;
|
|
28
|
+
prefetch: DelayedPrefetch<ArchiveRowWire>;
|
|
34
29
|
listRef: RefObject<HTMLDivElement>;
|
|
35
|
-
/**
|
|
30
|
+
/** 键盘契约(导航状态住档的装配线,窄档下钻时清单卸载也不丢 Esc 与焦点交还)。 */
|
|
36
31
|
nav: TrashNav;
|
|
37
|
-
/**
|
|
38
|
-
* 光标与活动行都住控制器(`activeId` / `selectRow`),清单不再自己回报光标。 */
|
|
32
|
+
/** 当前活动行(选中优先,回落光标):只在非多选态参与 `aria-selected`。 */
|
|
39
33
|
activeId: string | null;
|
|
40
34
|
onRetry: () => void;
|
|
41
35
|
t: Translate;
|
|
42
36
|
}
|
|
43
|
-
|
|
44
|
-
export declare function ArchiveList({ query, selection, groups, controller, listRef, nav, activeId, onRetry, t }: ArchiveListProps): import("react").JSX.Element;
|
|
37
|
+
export declare function ArchiveList({ query, selection, groups, controller, prefetch, listRef, nav, activeId, onRetry, t }: ArchiveListProps): import("react").JSX.Element;
|
|
45
38
|
export interface ArchiveToolbarProps {
|
|
46
39
|
selection: ListSelection<ArchiveRowWire>;
|
|
47
40
|
groups: readonly ProjectGroup<ArchiveRowWire>[];
|
|
48
41
|
t: Translate;
|
|
49
42
|
}
|
|
50
|
-
/** 工具行随档位:全部折叠 / 多选(归档档自己的选择面)。 */
|
|
51
43
|
export declare function ArchiveToolbar({ selection, groups, t }: ArchiveToolbarProps): import("react").JSX.Element;
|
|
52
44
|
export interface ArchiveFooterProps {
|
|
53
45
|
selection: ListSelection<ArchiveRowWire>;
|
|
54
46
|
controller: Pick<ArchivePanelController, 'unarchive' | 'requestDeleteMany' | 'busy'>;
|
|
55
47
|
t: Translate;
|
|
56
48
|
}
|
|
57
|
-
/** 页脚随档位:多选态 =
|
|
58
|
-
*
|
|
59
|
-
* 勾中的行读选择面那一份派生(`checkedRows`,含折叠组),不在这里从 groups 重算。 */
|
|
49
|
+
/** 页脚随档位:多选态 = 「解除所选」(无确认框)/「删除所选」(实心红,确认框同批量删除)。
|
|
50
|
+
* 危险那颗必须是这一排的最后一个(整页唯一实心红的位置契约);勾中行读 `checkedRows` 派生,不从 groups 重算。 */
|
|
60
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;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
export interface ArchiveRevisionScene {
|
|
2
|
+
invalidate(): void;
|
|
3
|
+
use(): number;
|
|
4
|
+
reset(): void;
|
|
5
|
+
}
|
|
6
|
+
export declare function createArchiveRevisionScene(): ArchiveRevisionScene;
|
|
2
7
|
export declare function invalidateArchive(): void;
|
|
3
|
-
/**
|
|
8
|
+
/** 供归档查询订阅(生产走 Provider 的那一份;测试无 Provider 回退默认场景)。 */
|
|
4
9
|
export declare function useArchiveRevision(): number;
|
|
5
|
-
/** 测试专用:修订号归零(订阅者随组件卸载自行退订)。 */
|
|
6
10
|
export declare function resetArchiveStore(): void;
|
|
@@ -1,20 +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;
|
|
@@ -1,19 +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
|
-
* 新读还在窗口里)就整句不说——拿旧读数求新名单的和,会把新增那条按 0 算出一个偏小的假数。
|
|
16
|
-
* 读不到也整句不说——K 是合计,缺一条就是假数(「不许拿 0 冒充没有」)。
|
|
2
|
+
* 批量删除的浮条:**多选模式内常驻**(0 条也渲染),汇总「已选 N 条」+「含 K 个子会话」,
|
|
3
|
+
* 「查看已选」展开可滚动的标题清单。K 是勾选防抖 300ms 后的一次批量 count(`/apply` 的 action:count),
|
|
4
|
+
* 带最新票守卫;读数与它对应的名单绑在一起存,对不上就整句不说(不拿旧读数求新名单的和)。
|
|
5
|
+
* 整行点击守卫也挂在这棵常驻宿主上;浮条住 `shell.overlay`。
|
|
17
6
|
*/
|
|
18
7
|
import { type ReactElement } from 'react';
|
|
19
8
|
import { type Translate } from './copy.js';
|
|
@@ -1,16 +1,7 @@
|
|
|
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` 头注)。
|
|
11
|
-
*
|
|
12
|
-
* 这张框不认识任何一方的选中集:宿主浮条与回收站面板的归档档都发请求进来,**执行后怎么收缩自己的
|
|
13
|
-
* 勾选由发请求那一面交钩子**(`shrinkSelection`)。框自己只收缩请求现场(重试轮只发失败 id)。
|
|
2
|
+
* 批量删除确认框:挂在 `shell.overlay` 上的宿主,加它读的请求现场(场景实例里的一份)。
|
|
3
|
+
* 页脚与关框规则共壳(`confirm-dialog.tsx`,ADR-0052),业务面各是各的;请求现场必须活在行开关那棵
|
|
4
|
+
* 子树之外(槽位行随宿主重排而卸载)。框不认识任何一方的选中集:执行后由发请求那一面交收缩钩子。
|
|
14
5
|
*/
|
|
15
6
|
import { type ReactElement } from 'react';
|
|
16
7
|
import { type Translate } from './copy.js';
|
|
@@ -20,21 +11,25 @@ export interface BatchDeleteRequest {
|
|
|
20
11
|
/** 每次发布递增:换一批就重挂载,busy / 失败面不带着上一批的记忆。 */
|
|
21
12
|
seq: number;
|
|
22
13
|
items: readonly PickItem[];
|
|
23
|
-
/**
|
|
24
|
-
* 被闸挡回的那一趟不调它——这一趟没跑,不许照着它动任何选中集。 */
|
|
14
|
+
/** 落地后收缩**发请求那一面**的选中集;被闸挡回的那一趟不调它——这一趟没跑,不许照着它动任何选中集。 */
|
|
25
15
|
shrinkSelection?: (failedSessionIds: readonly string[]) => void;
|
|
26
16
|
}
|
|
27
|
-
|
|
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;
|
|
28
29
|
export declare function requestDeleteBatch(items: readonly PickItem[], shrinkSelection?: (failedSessionIds: readonly string[]) => void): void;
|
|
29
|
-
/** 收起确认框(用户点「取消」/「关闭」、或整批成功后收工)。
|
|
30
|
-
* **带 expected 比较**:一次批量在飞时用户可能已经发布了**下一批**请求(框按 seq 重挂载)。
|
|
31
|
-
* 旧实例晚到的成功只许收自己那一批,不许把后来发布的那批一起清掉。 */
|
|
32
30
|
export declare function clearDeleteBatchRequest(expected?: BatchDeleteRequest): void;
|
|
33
|
-
/**
|
|
31
|
+
/** 供浮条与装配面订阅(生产走 Provider 的那一份;测试无 Provider 回退默认场景)。 */
|
|
34
32
|
export declare function useDeleteBatchRequest(): BatchDeleteRequest | null;
|
|
35
|
-
/** 测试专用:现场与 seq 归零,用例之间互不串味。 */
|
|
36
|
-
export declare function resetBatchConfirm(): void;
|
|
37
|
-
/** 常驻的批量确认框宿主。没有待确认的批量删除时什么都不渲染。 */
|
|
38
33
|
export declare function BatchConfirmHost({ deps, t, }: {
|
|
39
34
|
deps: OneShotDeps;
|
|
40
35
|
t?: Translate;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* 常驻勾选框被用户打回后,入口改成显式模式:按下这一行才进入多选态(再按一次退出),
|
|
5
|
-
* 模式内才渲染勾选框、才把整行点击变成"勾/取消"(守卫在 `host-rows.ts`)。
|
|
6
|
-
* 菜单的开关归 owner(与 `delete-menu-item.tsx` 同一条契约):按下后先切模式、再收菜单。
|
|
7
|
-
*
|
|
8
|
-
* 文案复用清单那两句(`list.select.enter` / `list.select.exit`)——同一个"多选/退出多选"
|
|
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,20 +1,14 @@
|
|
|
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
|
+
/** Shift+点的范围勾选:以最近一次翻转的那条为锚,按屏幕可见行序勾上整段(锚点语义住选中集现场)。 */
|
|
5
|
+
export declare function rangePick(item: PickItem): void;
|
|
6
|
+
/** 切换口显示「全选」还是「取消全选」:有选中而没有可见行时也算「取消全选」(此时点它只能清空)。 */
|
|
10
7
|
export declare function areAllVisibleRowsSelected(rows: readonly PickItem[], picks: readonly PickItem[]): boolean;
|
|
11
8
|
/**
|
|
12
|
-
* 多选态内的整行点击守卫(document
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* 认行靠 `data-row-key="session:…"`——**这是本文件唯一一处 DOM 读**(ADR-0034):宿主将来改掉这个
|
|
17
|
-
* 属性,最差是模式内点行不生效,勾选框本身仍在。**先查登记再吞事件**:没登记的行(别的列表 / 本插件
|
|
18
|
-
* 没接管的会话行)一个默认行为都不改。模式外不挂监听:这时点行必须还是宿主的"打开会话"。
|
|
9
|
+
* 多选态内的整行点击守卫(document 捕获阶段)。行里的按钮 / 链接 / 输入 / 菜单项一律放行;双击的第二下
|
|
10
|
+
* 与 dblclick 不翻转;模式外不挂监听(点行仍是宿主的「打开会话」)。
|
|
11
|
+
* 认行靠 `data-row-key="session:…"`(ADR-0034 的受约束偏离):宿主改掉它是可接受的降级。
|
|
12
|
+
* **先查登记再吞事件**:没登记的行一个默认行为都不改(吞掉会让它们静默失效)。
|
|
19
13
|
*/
|
|
20
14
|
export declare function useSelectionRowClickGuard(): void;
|