@xrn1997/dsh-session-delete 0.6.1 → 0.8.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 (69) hide show
  1. package/README.md +18 -10
  2. package/THIRD_PARTY_NOTICES.md +179 -0
  3. package/cordis.patch.yml +1 -1
  4. package/docs/screenshots/screenshot-01.png +0 -0
  5. package/docs/screenshots/screenshot-02.png +0 -0
  6. package/docs/screenshots/screenshot-03.png +0 -0
  7. package/icon.svg +24 -18
  8. package/lib/client.js +3117 -1324
  9. package/lib/index.js +593 -254
  10. package/lib/types/api/attachment.d.ts +2 -2
  11. package/lib/types/api/connection-route.d.ts +1 -1
  12. package/lib/types/api/dispatch.d.ts +1 -1
  13. package/lib/types/api/route-table.d.ts +14 -9
  14. package/lib/types/client/batch-bar.d.ts +2 -4
  15. package/lib/types/client/batch-confirm.d.ts +6 -7
  16. package/lib/types/client/busy-gate.d.ts +12 -5
  17. package/lib/types/client/config-settings.d.ts +13 -0
  18. package/lib/types/client/confirm-dialog.d.ts +23 -0
  19. package/lib/types/client/context-menu-actions.d.ts +11 -5
  20. package/lib/types/client/context.d.ts +3 -0
  21. package/lib/types/client/copy.d.ts +46 -7
  22. package/lib/types/client/delete-confirm.d.ts +2 -2
  23. package/lib/types/client/delete-menu-item.d.ts +2 -2
  24. package/lib/types/client/detail-blocks.d.ts +25 -0
  25. package/lib/types/client/index.d.ts +3 -2
  26. package/lib/types/client/maintenance-settings.d.ts +6 -7
  27. package/lib/types/client/plugin.d.ts +6 -0
  28. package/lib/types/client/prompt-rail.d.ts +22 -0
  29. package/lib/types/client/remote.d.ts +64 -87
  30. package/lib/types/client/reset-client-state.d.ts +1 -0
  31. package/lib/types/client/session-live.d.ts +31 -0
  32. package/lib/types/client/settings-cards.d.ts +19 -0
  33. package/lib/types/client/settings-view.d.ts +9 -0
  34. package/lib/types/client/trash-detail.d.ts +14 -4
  35. package/lib/types/client/trash-snapshot.d.ts +51 -0
  36. package/lib/types/client/trash-view.d.ts +33 -6
  37. package/lib/types/client/ui/icons.d.ts +23 -7
  38. package/lib/types/client/ui/recipe.d.ts +2 -0
  39. package/lib/types/client/ui/styles.d.ts +2 -0
  40. package/lib/types/client/undo-notices.d.ts +4 -4
  41. package/lib/types/client/undo-toast.d.ts +1 -2
  42. package/lib/types/client/use-detail-pager.d.ts +37 -0
  43. package/lib/types/client/use-maintenance-section.d.ts +29 -18
  44. package/lib/types/client/use-maintenance.d.ts +14 -5
  45. package/lib/types/client/use-prefetch.d.ts +14 -0
  46. package/lib/types/client/use-prompt-rail.d.ts +60 -0
  47. package/lib/types/client/use-trash-detail-reader.d.ts +33 -0
  48. package/lib/types/client/use-trash-panel-controller.d.ts +6 -4
  49. package/lib/types/client/use-trash-query.d.ts +14 -7
  50. package/lib/types/client/write-seats.d.ts +17 -17
  51. package/lib/types/client/write-settlement.d.ts +3 -3
  52. package/lib/types/client/write.d.ts +9 -7
  53. package/lib/types/config.d.ts +10 -11
  54. package/lib/types/deps.d.ts +11 -3
  55. package/lib/types/index.d.ts +3 -1
  56. package/lib/types/log/session-log.d.ts +2 -0
  57. package/lib/types/ports/agent-handles.d.ts +10 -2
  58. package/lib/types/ports/fs-port.d.ts +23 -2
  59. package/lib/types/ports/host-port.d.ts +18 -10
  60. package/lib/types/shared/project-key.d.ts +28 -0
  61. package/lib/types/shared/wire.d.ts +92 -24
  62. package/lib/types/trash/attachments.d.ts +3 -3
  63. package/lib/types/trash/detail.d.ts +4 -2
  64. package/lib/types/trash/display-name.d.ts +16 -0
  65. package/lib/types/trash/entry.d.ts +4 -2
  66. package/lib/types/verbs/config.d.ts +25 -0
  67. package/locale/en.json +1 -1
  68. package/locale/zh.json +6 -6
  69. package/package.json +20 -14
@@ -19,13 +19,13 @@
19
19
  *
20
20
  * 请求本身不对(id/kind 形状)⇒ 400;对象不在 / 超限 / 读失败 ⇒ 200 + 信封(与其余段同一条错误面)。
21
21
  */
22
- import type { FsPort } from '../ports/fs-port.js';
22
+ import type { FsAttachmentPort } from '../ports/fs-port.js';
23
23
  import type { SessionDeleteConfig } from '../config.js';
24
24
  import type { AttachmentsPort } from '../ports/attachments-port.js';
25
25
  import type { BinaryResponse } from './route-table.js';
26
26
  /** 读附件只需要 stat + read、宿主 `attachments` 读面与响应上限;执行面(removeDir/removeFile)不给。 */
27
27
  export interface AttachmentReadPorts {
28
- fs: Pick<FsPort, 'statFile' | 'readFile'>;
28
+ fs: FsAttachmentPort;
29
29
  home: string;
30
30
  attachments: AttachmentsPort;
31
31
  config: Pick<SessionDeleteConfig, 'maxAttachmentBytes'>;
@@ -15,7 +15,7 @@ export interface ConnectionFetchServiceLike {
15
15
  };
16
16
  }
17
17
  /**
18
- * 注册九段 exact Fetch 路由。返回一个组合 disposer;调用方把它挂在自己的 effect 上。
18
+ * 注册十段 exact Fetch 路由。返回一个组合 disposer;调用方把它挂在自己的 effect 上。
19
19
  * `connection` 是插件的硬依赖(web UI / 桌面端都装 `client-connection`);`fetch.register`
20
20
  * 缺席属于宿主形状漂移,直接抛——静默返回空 disposer 会让插件「在但没有入口」。
21
21
  * `dispatch` 与分发器同源。
@@ -18,7 +18,7 @@ export type ApiResult = {
18
18
  };
19
19
  /** 段名的 404 与方法的 405 只在这里判一次;空段名按插件前缀显示,避免 404 原文出现一个空串。 */
20
20
  export declare function resolveRoute(method: string, rest: string): RouteSpec;
21
- /** 四格只建一次:收窄对象在 dispatcher 构造期固定,请求路径只做引用选择。 */
21
+ /** 五格只建一次:收窄对象在 dispatcher 构造期固定,请求路径只做引用选择。 */
22
22
  export declare function slicesOf(full: DeleteDeps): SliceDeps;
23
23
  /** 分发函数:查段 → 方法闸 → 读面 → 处理。 */
24
24
  export type Dispatch = (input: ApiInput) => Promise<ApiResult>;
@@ -8,11 +8,11 @@
8
8
  * - 切片声明宽了 ⇒ 危险能力(删目录 / 时钟)漏进读段的 run;窄了 ⇒ 写段的处理编译不过。
9
9
  *
10
10
  * 这张表不放 shared/wire.ts:处理函数会 import 动词与 node:fs,而浏览器半要 import wire.ts。
11
- * 段名、方法与动作仍住 wire.ts(`ROUTES` 每项 `{ path, method }`,本表的 method 只投影、不写第二份字面量);
12
- * 这张表只回答“怎么处理”。
11
+ * 段名、方法与请求体形状住 wire.ts(`ROUTES` 每项 `{ path, method, body }`,本表的 method / body 只投影、
12
+ * 不写第二份字面量);这张表只回答“怎么处理”。
13
13
  */
14
14
  import { type ApplyAction, type RouteName } from '../shared/wire.js';
15
- import type { CoreDeps, DeleteDeps, RemovalDeps } from '../deps.js';
15
+ import type { ConfigEditorLike, CoreDeps, DeleteDeps, RemovalDeps } from '../deps.js';
16
16
  import type { AttachmentsPort } from '../ports/attachments-port.js';
17
17
  import type { TrashEntry } from '../trash/entry.js';
18
18
  /** 请求体:`json` 才读下来(GET 一律不读;读两遍会把流消费掉)。 */
@@ -35,9 +35,10 @@ export interface RouteRead {
35
35
  rows(): Promise<readonly TrashEntry[]>;
36
36
  }
37
37
  /** deps 切片(ADR-0032):每一段只声明自己要的那一面。读与探测五段拿基础面,`attachment` 段另多一条
38
- * 宿主 `attachments` 读面,两个删盘段多删除能力,`/apply` 是唯一拿全量面的行——段的 run 里长出超面
39
- * 调用就是编译错,dispatch 也只按这一格注入(运行期收窄住 `src/api/dispatch.ts` 的 `slicesOf`)。 */
40
- export type RouteSlice = 'core' | 'removal' | 'full' | 'attachment';
38
+ * 宿主 `attachments` 读面,两个删盘段多删除能力,`/apply` 是唯一拿全量面的行,`/config` 只多
39
+ * configEditor + entry 两件(段的 run 里长出超面调用就是编译错;dispatch 也只按这一格注入,
40
+ * 运行期收窄住 `src/api/dispatch.ts` 的 `slicesOf`)。 */
41
+ export type RouteSlice = 'core' | 'removal' | 'full' | 'attachment' | 'config';
41
42
  /** 切片名 → 依赖面:{@link RouteSpec.run} 的 deps 参数类型与 `depsFor` 的返回类型都从这一格取。 */
42
43
  export type SliceDeps = {
43
44
  core: CoreDeps;
@@ -46,6 +47,10 @@ export type SliceDeps = {
46
47
  attachment: CoreDeps & {
47
48
  readonly attachments: AttachmentsPort;
48
49
  };
50
+ config: CoreDeps & {
51
+ readonly configEditor?: ConfigEditorLike;
52
+ readonly entry?: unknown;
53
+ };
49
54
  };
50
55
  interface BaseRouteSpec<S extends RouteSlice> {
51
56
  /** 这一行吃哪一格 deps:dispatch 按它注入,`run` 的 deps 参数类型也跟着它走。 */
@@ -58,7 +63,7 @@ interface BaseRouteSpec<S extends RouteSlice> {
58
63
  * 缺省不设闸——JSON 响应跨源读不到(没有 CORS),不需要它。 */
59
64
  readonly fetchGate?: 'same-origin';
60
65
  }
61
- /** JSON 段:处理函数拿请求体与读面;`query` 不在这里(九行里只有二进制段需要查询串)。 */
66
+ /** JSON 段:处理函数拿请求体与读面;`query` 不在这里(十行里只有二进制段需要查询串)。 */
62
67
  export interface JsonRouteSpec<S extends RouteSlice = RouteSlice> extends BaseRouteSpec<S> {
63
68
  readonly response: 'json';
64
69
  /** 声明成函数属性而不是方法:方法签名是双变的,显式标注更宽的 deps 能绕过切片闸;属性按逆变校验。 */
@@ -70,13 +75,13 @@ export interface BinaryRouteSpec<S extends RouteSlice = RouteSlice> extends Base
70
75
  readonly run: (deps: SliceDeps[S], query: URLSearchParams) => Promise<BinaryResponse>;
71
76
  }
72
77
  export type RouteSpec<S extends RouteSlice = RouteSlice> = JsonRouteSpec<S> | BinaryRouteSpec<S>;
73
- /** 九行的并集(表的值类型):每行由自己的 `slice` 与 `response` 字面量定型,`run` 的 deps 面随之收窄。 */
78
+ /** 十行的并集(表的值类型):每行由自己的 `slice` 与 `response` 字面量定型,`run` 的 deps 面随之收窄。 */
74
79
  export type AnyRouteSpec = {
75
80
  [S in RouteSlice]: RouteSpec<S>;
76
81
  }[RouteSlice];
77
82
  export declare const APPLY_ACTIONS: readonly ApplyAction[];
78
83
  /**
79
- * 九个段名各一行。`Record<段名, AnyRouteSpec>` 是闸:`wire.ts` 加了段名而这里没加,编译不过;
84
+ * 十个段名各一行。`Record<段名, AnyRouteSpec>` 是闸:`wire.ts` 加了段名而这里没加,编译不过;
80
85
  * 每行的 `slice` 又把该行的 `run` 钉在自己那一格 deps 上(ADR-0032)。
81
86
  */
82
87
  export declare const ROUTE_TABLE: Record<RouteName, AnyRouteSpec>;
@@ -16,10 +16,8 @@
16
16
  */
17
17
  import { type ReactElement } from 'react';
18
18
  import { type Translate } from './copy.js';
19
- import type { SessionDeleteRemote } from './remote.js';
20
- /** 浮条只需要那一个批量口(计数);执行归确认框。 */
21
- export type BatchBarDeps = Pick<SessionDeleteRemote, 'applyOutcomes'>;
19
+ import type { OneShotDeps } from './remote.js';
22
20
  export declare function BatchBar({ deps, t, }: {
23
- deps: BatchBarDeps;
21
+ deps: OneShotDeps;
24
22
  t?: Translate;
25
23
  }): ReactElement | null;
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * 批量删除的确认框——挂在 `shell.overlay` 上的宿主,加它读的那个模块级现场。
3
3
  *
4
- * 为什么又开一个文件而不是把 `delete-confirm.tsx` 撑大:单删那张框是**已交付的面**(docs/ui-spec.md 状态 ②,
5
- * 用例钉着),批量形与它只有三件不同——标题随条数、目标卡逐条列、执行是一次批量 `apply`。共用一个壳
6
- * 意味着单删的 `busy` / 失败面要跟着学批量形,那是拿已交付的行为去换省一个文件。卡片样式(`TARGET_CARD`)
7
- * 与 hint、子会话那两句**复用**单删的,一句不造第二个键。
4
+ * 与单删那张框的关系:**页脚与关框规则共壳**(`confirm-dialog.tsx`,裁决见 ADR-0052),业务面
5
+ * 仍然各是各的——批量形的标题随条数、目标卡逐条列、执行是一次批量 `apply`、失败面按行回;
6
+ * 单删的 `busy` / 失败面没有被拖进来。卡片样式(`TARGET_CARD`)与 hint、子会话那两句**复用**单删的,
7
+ * 一句不造第二个键。
8
8
  *
9
9
  * 现场是模块级的(同 `delete-confirm.tsx` / `undo-notices.ts`):请求从浮条那颗按钮发来,确认框住在
10
10
  * `shell.overlay` 上——它必须活在行开关那棵子树之外(槽位行随宿主重排而卸载,见 `delete-confirm.tsx` 头注)。
11
11
  */
12
12
  import { type ReactElement } from 'react';
13
13
  import { type Translate } from './copy.js';
14
- import type { SessionDeleteRemote } from './remote.js';
14
+ import type { OneShotDeps } from './remote.js';
15
15
  import { type PickItem } from './batch-selection-store.js';
16
16
  export interface BatchDeleteRequest {
17
17
  /** 每次发布递增:换一批就重挂载,busy / 失败面不带着上一批的记忆。 */
@@ -25,9 +25,8 @@ export declare function clearDeleteBatchRequest(): void;
25
25
  export declare function useDeleteBatchRequest(): BatchDeleteRequest | null;
26
26
  /** 测试专用:现场与 seq 归零,用例之间互不串味。 */
27
27
  export declare function resetBatchConfirm(): void;
28
- export type BatchConfirmDeps = Pick<SessionDeleteRemote, 'applyOutcomes'>;
29
28
  /** 常驻的批量确认框宿主。没有待确认的批量删除时什么都不渲染。 */
30
29
  export declare function BatchConfirmHost({ deps, t, }: {
31
- deps: BatchConfirmDeps;
30
+ deps: OneShotDeps;
32
31
  t?: Translate;
33
32
  }): ReactElement | null;
@@ -1,10 +1,17 @@
1
+ /** 一次过闸的落地面:**没跑**与**跑了**在类型面就是两支,不靠 `undefined` 兼职。 */
2
+ export type GateRun<T> = {
3
+ readonly kind: 'blocked';
4
+ } | {
5
+ readonly kind: 'ran';
6
+ readonly value: T;
7
+ };
1
8
  export interface BusyGate {
2
9
  readonly busy: boolean;
3
10
  /** 把一次任务整个包进「这一趟还算忙」;落地与抛错都放回 false。
4
- * 同一枚闸已有任务在飞时这一次**不执行**(同步判重),立即回 `undefined`。类型里带上 `undefined`
5
- * 不是将就,是判据:挡回的那一趟什么都没跑,把它伪装成一枚 `T` 就是把「没跑」当成「跑完且结果是
6
- * 那个值」——消费返回值的调用方(写入座位、清空)会照着编出失败原文或宣布成功。怎么收尾由调用方
7
- * 定:这一趟的界面后果归在飞的那一趟,挡回来的那一份什么都不该改。 */
8
- around: <T>(task: () => Promise<T>) => Promise<T | undefined>;
11
+ * 同一枚闸已有任务在飞时这一次**不执行**(同步判重),立即回 `{ kind: 'blocked' }`。
12
+ * 挡回的那一趟什么都没跑——把它伪装成一枚 `T` 就是把「没跑」当成「跑完且结果是那个值」,
13
+ * 消费返回值的调用方(写入座位、清空)会照着编出失败原文或宣布成功。挡回来那一份的界面后果
14
+ * 归在飞的那一趟,调用方按 `kind` 分派,写不出「拿没跑当跑完」。 */
15
+ around: <T>(task: () => Promise<T>) => Promise<GateRun<T>>;
9
16
  }
10
17
  export declare function useBusyGate(): BusyGate;
@@ -0,0 +1,13 @@
1
+ import type { ReactElement } from 'react';
2
+ import { type Translate } from './copy.js';
3
+ import type { ConfigDeps } from './remote.js';
4
+ export interface ConfigSettingsProps {
5
+ /** 整套 remote 的切片;测试可以只给维护那四件(缺这两件时本卡不渲染)。 */
6
+ readonly deps: Partial<ConfigDeps>;
7
+ readonly t?: Translate;
8
+ }
9
+ /**
10
+ * 卡片入口:两个方法都在才渲染。`useMaintenance` 与 `MaintenanceSettings` 的测试替身只造维护四件,
11
+ * 所以在那些用例里本卡整体缺席——不让"没给配置 deps"变成一次假渲染。
12
+ */
13
+ export declare function ConfigSettings({ deps, t }: ConfigSettingsProps): ReactElement | null;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * 六个确认框共用的**一个壳**:`Modal` + 标题 + 关闭钮 + 「取消(描边) / 确认(主按钮)」页脚。
3
+ *
4
+ * 共用的只有**页脚与关框规则**(`useIdleClose`:在飞时取消与关闭都按住),不共用业务:每个框的
5
+ * 标题、正文、列什么、确认键文案与危险层级都由调用方交,各框自己的状态机与失败面一行业没少。
6
+ * 曾经在 `batch-confirm.tsx` 的头注里否过一次共壳——那时否的是把单删的 `busy` / 失败面拖进批量形;
7
+ * 这里共的是页脚这一层,裁决见 ADR-0052。
8
+ */
9
+ import type { ReactNode } from 'react';
10
+ export interface ConfirmDialogProps {
11
+ readonly title: string;
12
+ readonly closeLabel: string;
13
+ readonly cancelLabel: string;
14
+ readonly confirmLabel: string;
15
+ /** 在飞:取消 / 关闭与确认键一起按住。 */
16
+ readonly busy: boolean;
17
+ readonly onCancel: () => void;
18
+ readonly onConfirm: () => void;
19
+ /** 危险层级:实心红主按钮;缺省是普通 primary(与「移入回收站」同款)。 */
20
+ readonly danger?: boolean;
21
+ readonly children?: ReactNode;
22
+ }
23
+ export declare function ConfirmDialog({ title, closeLabel, cancelLabel, confirmLabel, busy, onCancel, onConfirm, danger, children, }: ConfirmDialogProps): ReactNode;
@@ -1,4 +1,8 @@
1
+ import type { ClientContextLike } from './context.js';
1
2
  import type { Translate } from './copy.js';
3
+ import { type SessionsStateLike } from './session-live.js';
4
+ /** legacy 菜单槽:只在 contextMenus 不可用时注册(0.2.2+ 的内置动作已迁到数据动作)。 */
5
+ export declare const SESSION_MENU_SLOT = "sidebar.workspaces.session.menu.item";
2
6
  interface MenuTarget {
3
7
  readonly sessionId: string;
4
8
  readonly displayTitle: string;
@@ -19,11 +23,6 @@ export interface ObservableSnapshotLike<T> {
19
23
  getSnapshot(): T;
20
24
  subscribe(listener: () => void): () => void;
21
25
  }
22
- interface SessionsStateLike {
23
- byId?: Record<string, {
24
- running?: boolean;
25
- } | undefined>;
26
- }
27
26
  export interface SessionsServiceLike {
28
27
  list?: ObservableSnapshotLike<SessionsStateLike>;
29
28
  }
@@ -44,4 +43,11 @@ export declare const ICON_DELETE = "xrn1997.session-delete.delete";
44
43
  * 所以它们与 Archive 一起排掉 legacy 组件行,恢复「归档在多选/删除之前」。
45
44
  */
46
45
  export declare function createSessionMenuContribution(t: Translate, sessionList?: ObservableSnapshotLike<SessionsStateLike>): MenuContributionLike;
46
+ /** 菜单槽注入的 `useMenuOpenState`:官方 `menuOpenStateFactory` 交回一对开合状态(asar @46195835)。 */
47
+ export type UseMenuOpenState = () => readonly [boolean, (open: boolean) => void];
48
+ /**
49
+ * 注册菜单两行:数据动作可用就走数据动作(+ 两个 icon key),否则注册 legacy 槽位行并等
50
+ * `contextMenus` 迟到。`index.tsx` 的贡献表只留一行调用。
51
+ */
52
+ export declare function installSessionMenus(client: ClientContextLike, t: Translate): void;
47
53
  export {};
@@ -26,6 +26,9 @@ export interface ClientContextLike {
26
26
  slots: SlotsLike;
27
27
  /** 可选服务的读面(宿主自己的写法:`ctx.get('…')?.…`)。**缺省调用**:老宿主上没有这个方法。 */
28
28
  get?(name: string): unknown;
29
+ /** 可选服务迟到时的安装面(`ctx.inject(['…'], child => …)`):服务就绪才回调,缺席就一直等。
30
+ * **缺省调用**:老宿主上没有这个方法。 */
31
+ inject?(deps: readonly string[], callback: (child: ClientContextLike) => unknown): unknown;
29
32
  /** 挂一个随本插件卸载而撤销的副作用(返回的清理函数由框架接管)。
30
33
  * 属性声明:测试会把它当成员读(`expect(ctx.effect).not.toHaveBeenCalled()`),实现不读 `this`。 */
31
34
  effect: (execute: () => unknown, label?: string) => unknown;
@@ -25,6 +25,7 @@ declare const ZH: {
25
25
  readonly 'trash.empty.hint': "在会话条目的「…」菜单里选「删除」,会话会先进到这里,随时可以恢复。";
26
26
  readonly 'trash.summary': "{count} 个会话 · 可释放 {size}";
27
27
  readonly 'trash.group.count': "{count} 个会话";
28
+ readonly 'trash.group.ungrouped': "未分组";
28
29
  readonly 'trash.project.unknown': "未记录项目";
29
30
  readonly 'trash.row.deletedNow': "刚刚删除";
30
31
  readonly 'trash.row.deletedAgo': "删除于 {n}{unit}前";
@@ -37,7 +38,8 @@ declare const ZH: {
37
38
  readonly 'trash.unit.months': "个月";
38
39
  readonly 'trash.unit.years': "年";
39
40
  readonly 'trash.row.restore': "恢复";
40
- readonly 'trash.row.purge': "彻底删除…";
41
+ readonly 'trash.row.purge': "彻底删除";
42
+ readonly 'trash.row.purgeOne': "彻底删除「{title}」";
41
43
  readonly 'trash.footer.note': "回收站本体在宿主数据根下的 {dir} 里,不自动过期;清空后不可恢复。";
42
44
  readonly 'trash.emptyAll': "清空回收站…";
43
45
  readonly 'trash.confirm.all': "清空回收站?";
@@ -77,6 +79,22 @@ declare const ZH: {
77
79
  readonly 'trash.attachments.skipped': "附件未清理:{reason}";
78
80
  readonly 'trash.attachments.skippedPartial': "部分附件未清理:{reason}(已清理 {removed} 个)";
79
81
  readonly 'trash.attachments.alsoFailed': ";另有 {count} 个附件删除失败";
82
+ readonly 'config.title': "可调项";
83
+ readonly 'config.hint': "保存后插件会重启;本页用保存回执回填,重开本页会重新读取。也可以直接改 profile 的 cordis.patch.yml。";
84
+ readonly 'config.orphanPreviewLimit': "孤儿附件预览条数";
85
+ readonly 'config.maxAttachmentBytes': "附件单次响应上限";
86
+ readonly 'config.maxJsonRefBytes': "附件引用扫描的单 JSON 上限";
87
+ readonly 'config.unit.items': "条";
88
+ readonly 'config.unit.bytes': "字节";
89
+ readonly 'config.loading': "正在读当前值…";
90
+ readonly 'config.loadFailed': "读取失败:{message}";
91
+ readonly 'config.save': "保存";
92
+ readonly 'config.saving': "保存中…";
93
+ readonly 'config.saved': "已保存;插件正在重启。";
94
+ readonly 'config.saveFailed': "保存失败:{message}";
95
+ readonly 'config.retry': "重试";
96
+ readonly 'config.invalid': "需为 {min}–{max} 的整数";
97
+ readonly 'config.unchanged': "没有改动";
80
98
  readonly 'maintenance.title': "维护";
81
99
  readonly 'maintenance.orphans.title': "孤儿会话";
82
100
  readonly 'maintenance.orphans.hint': "父会话已不在会话列表或回收站里的子会话。检查只读,不会自动运行。";
@@ -105,8 +123,6 @@ declare const ZH: {
105
123
  readonly 'detail.noBody': "这条会话没有可显示的内容";
106
124
  readonly 'detail.field.created': "创建";
107
125
  readonly 'detail.field.lastActivity': "最后活动";
108
- readonly 'detail.field.deletedAt': "删除于";
109
- readonly 'detail.deletedAt.combined': "{relative}({absolute})";
110
126
  readonly 'detail.field.span': "活跃跨度";
111
127
  readonly 'detail.field.size': "大小";
112
128
  readonly 'detail.field.turns': "轮数";
@@ -138,8 +154,24 @@ declare const ZH: {
138
154
  readonly 'detail.block.truncated': "已截断";
139
155
  readonly 'detail.loadOlder': "加载更早";
140
156
  readonly 'detail.loadOlder.loading': "正在加载更早…";
141
- readonly 'detail.expandAll': "全部展开";
142
- readonly 'detail.collapseAll': "全部折叠";
157
+ /** 提问轨(详情右缘那道常驻刻度):一句用户提问一格,点一格跳到那句。 */
158
+ readonly 'detail.rail.label': "提问导航";
159
+ readonly 'detail.rail.jump': "跳到第 {n} 句提问:{preview}";
160
+ readonly 'detail.rail.jumpUntitled': "跳到第 {n} 句提问";
161
+ readonly 'detail.rail.position': "第 {n} / {total} 句";
162
+ readonly 'detail.rail.hint': "点一下跳到这一句";
163
+ readonly 'detail.rail.hintPending': "点一下跳到这一句,会先补页";
164
+ readonly 'detail.rail.tooFar': "这句离现在太远,先点更近的一条。";
165
+ readonly 'detail.viewMode.label': "工作步骤展示";
166
+ readonly 'detail.viewMode.compact': "简洁";
167
+ readonly 'detail.viewMode.standard': "标准";
168
+ readonly 'detail.viewMode.detailed': "详细";
169
+ readonly 'detail.viewMode.verbose': "完全展开";
170
+ readonly 'detail.compact.empty': "这段会话只有过程内容;切到「标准」可以看到。";
171
+ readonly 'detail.compact.pageOnly': "这一页只有过程内容;点「加载更早」继续往前看。";
172
+ readonly 'detail.process.header': "工作步骤";
173
+ readonly 'detail.process.step': "{n} 步";
174
+ readonly 'detail.process.steps': "{n} 步";
143
175
  readonly 'detail.injection.runtimeContext': "运行上下文";
144
176
  readonly 'detail.injection.timeContext': "时间上下文";
145
177
  readonly 'detail.injection.agentInstructions': "Agent 指令";
@@ -162,7 +194,12 @@ declare const ZH: {
162
194
  readonly 'detail.attachment.saving': "保存中…";
163
195
  readonly 'detail.attachment.saveFailed': "保存失败:{message}";
164
196
  readonly 'detail.back': "← 返回清单";
165
- readonly 'detail.subagents.header': "子会话({n}) · {size}";
197
+ readonly 'detail.subagents.label': "子会话";
198
+ readonly 'detail.subagents.note': "随本条一起恢复或删除";
199
+ readonly 'detail.subagents.expand': "展开子会话列表";
200
+ readonly 'detail.subagents.collapse': "收起子会话列表";
201
+ readonly 'detail.subagents.jump': "展开并跳到子会话段";
202
+ readonly 'detail.subagents.open': "查看子会话详情";
166
203
  readonly 'detail.subagents.truncated': "仅列出前 {shown} 条,共 {total} 条";
167
204
  readonly 'detail.backToParent': "← 返回父会话";
168
205
  readonly 'detail.list.label': "回收站清单";
@@ -240,12 +277,14 @@ export declare function localeProbe(t: Translate): string;
240
277
  */
241
278
  export declare function splitOn(sentence: string, inner: string): [string, string, string];
242
279
  /**
243
- * 绝对时间那一句串。清单行的 `title`、确认框里的meta、详情的元信息三处要的是同一个写法,
280
+ * 绝对时间那一句串。清单行的 `title`、确认框里的meta、详情的会话信息三处要的是同一个写法,
244
281
  * 各自 `new Date(...).toLocaleString()` 一遍迟早会漂成两种样子。
245
282
  */
246
283
  export declare function absoluteText(at: number): string;
247
284
  /** 单位词本身(调用方把它填进各自语言的整句模板里,语序由各语言自己钉)。 */
248
285
  export declare function unitWord(unit: RelativeTimeUnit, t: Translate): string;
286
+ /** 「工作步骤 N 步」:英文 n=1 要单数、中文两条同形;选哪条键只住这里,调用方只报数。 */
287
+ export declare function stepsText(n: number, t: Translate): string;
249
288
  /** 「7分钟前」这类**不带谓语**的相对短语;`now` 桶不套模板——"刚刚前"不是话。 */
250
289
  export declare function agoText(at: number, now: number, t: Translate): string;
251
290
  export {};
@@ -1,5 +1,5 @@
1
1
  import { type Translate } from './copy.js';
2
- import { type DeleteConfirmDeps } from './remote.js';
2
+ import { type OneShotDeps } from './remote.js';
3
3
  /**
4
4
  * 被操作对象那张卡。`Modal`(`ui/Modal.tsx`,照官方抄的)的 `.sd-modal-body` 不设字号也不给层级 ⇒ 裸摆一行会话标题会和下面那句
5
5
  * 提示**同字同色**,读不出"这才是要被删的东西"。配方与「彻底删除」框里那张摘要卡同一套(宿主设置面
@@ -35,6 +35,6 @@ export declare function resetDeleteRequest(): void;
35
35
  * pill all belong here"):没有待确认的删除时什么都不渲染。
36
36
  */
37
37
  export declare function DeleteConfirmHost({ deps, t }: {
38
- deps: DeleteConfirmDeps;
38
+ deps: OneShotDeps;
39
39
  t?: Translate;
40
40
  }): import("react").JSX.Element | null;
@@ -6,10 +6,10 @@ export interface DeleteMenuItemProps {
6
6
  title: string;
7
7
  /** 会话在跑:这一行置灰,并把原因摆在行上。 */
8
8
  live?: boolean;
9
- /** 上方那条发丝线;缺省 true。多选入口排在删除前面时由它带线,删除行改成 false(`index.tsx`)。 */
9
+ /** 上方那条发丝线;缺省 true。多选入口排在删除前面时由它带线,删除行改成 false(`context-menu-actions.tsx`)。 */
10
10
  separatorBefore?: boolean;
11
11
  /**
12
- * 菜单 owner 交下来的「收起菜单」——槽位注入的 `useMenuOpenState`(`index.tsx` 的 `DeleteRow` 接住)。
12
+ * 菜单 owner 交下来的「收起菜单」——槽位注入的 `useMenuOpenState`(`context-menu-actions.tsx` 的 `DeleteRow` 接住)。
13
13
  * 「关不关菜单是 owner 的决定」是官方对该槽位的契约;按下这一行时**先发请求、再收菜单**。
14
14
  * 缺省不动,方便单独测这一行。
15
15
  */
@@ -0,0 +1,25 @@
1
+ /**
2
+ * 详情正文的**块视图词汇**:哪些块算过程内容、标准档怎么把连续过程块收成一组。
3
+ * 折叠状态与分页不在这里——这里只回答「这一页的块怎么读」。
4
+ */
5
+ import type { TrashDetailBlockWire, TrashDetailInjectionBlockWire, TrashDetailTextBlockWire, TrashDetailToolBlockWire } from '../shared/wire.js';
6
+ /** 除用户与助手之外的块:思考、工具、注入、系统消息、压缩摘要——详情按过程内容对待。
7
+ * 文本块是一个 `kind` 联合的接口,`Exclude` 摘不掉其中两个成员;这里按 `kind` 收窄后并上另两种块。 */
8
+ export type DisclosureBlockWire = (TrashDetailTextBlockWire & {
9
+ kind: 'reasoning' | 'system' | 'compaction';
10
+ }) | TrashDetailInjectionBlockWire | TrashDetailToolBlockWire;
11
+ export declare function isDisclosureBlock(block: TrashDetailBlockWire): block is DisclosureBlockWire;
12
+ /** 这一批块里有没有对话内容(用户或助手);简洁档靠它决定还要不要继续往前翻。 */
13
+ export declare function hasDialogue(blocks: readonly TrashDetailBlockWire[]): boolean;
14
+ /** 标准档的线程单元:对话块照原位;**连续的**过程块收成一组。
15
+ * 组的 `id` 取它**后面那条对话块**的 id(没有对话块就 `after:end`)——prepend 更早一页只会
16
+ * 往组头添过程块,组的结束边界不变,已展开的组不会因为合并而收回。 */
17
+ export type ThreadItem = {
18
+ readonly kind: 'block';
19
+ readonly block: TrashDetailBlockWire;
20
+ } | {
21
+ readonly kind: 'process';
22
+ readonly id: string;
23
+ readonly blocks: readonly DisclosureBlockWire[];
24
+ };
25
+ export declare function threadItems(blocks: readonly TrashDetailBlockWire[]): ThreadItem[];
@@ -6,8 +6,9 @@ export declare const name = "@xrn1997/dsh-session-delete/client";
6
6
  * **`locale` 也不在这里**:宿主自己的 `ui-sidebar` 是硬注入它的,但那是"宿主知道自己那一代"的前提;
7
7
  * 本插件要跨代活着 ⇒ 走 `ctx.get('locale')` 可选读,缺席时降级到内置 zh 文案(见 `copy.ts` 头注)。
8
8
  * 写进 inject 就等于"这一代没有 locale 就不让整个客户端条目激活",而那等于宿主进程死。
9
- * **`contextMenus` 同理**:0.2.2+ 用 `ctx.get('contextMenus')` 探测,包本身在 package.json 的
10
- * `dsh.client.inject` 里排到前面;旧宿主没有这个服务时回退 legacy 槽位。
9
+ * **`contextMenus` 同理**:0.2.2+ 用 `ctx.get('contextMenus')` 探测,服务比本条目晚到时按
10
+ * `ctx.inject(['contextMenus'])` 的 scoped 等待切过去;旧宿主没有这个服务时回调不来,legacy 槽位留着。
11
+ * 条目自己的 `inject` 仍然只有 `slots`——把可能迟到的服务写进去等于让整个客户端条目 pending。
11
12
  */
12
13
  export declare const inject: string[];
13
14
  /**
@@ -1,12 +1,12 @@
1
1
  /**
2
- * 插件设置页的「维护」卡(`plugins.bundle.config` 的占用者)。
2
+ * 插件设置页的「维护」卡(ADR-0021):那张槽位上的两张卡里,本文件只拥有下面这一张。
3
3
  *
4
- * 两张段都是**手动**的:检查 → 预览 → 清理,没有挂载即扫、没有定时器。卡片的职责只有呈现:
4
+ * 两段都是**手动**的:检查 → 预览 → 清理,没有挂载即扫、没有定时器。卡片的职责只有呈现:
5
5
  * 状态那一行、检查按钮、以及各段自己的横幅 / 失败 / 提示 / 确认框;读数与动作全归
6
- * `src/client/use-maintenance.ts`。
6
+ * `src/client/use-maintenance.ts`。两张卡的先后与 `summary` 守卫在 `src/client/settings-cards.tsx`。
7
7
  *
8
8
  * 与回收站面板的区别:这里没有面板高度、没有清单与详情两栏、没有全局闸。控件只用
9
- * `CARD` / `Button` / `Modal` / `fileSizeText`,所以同一张卡放在插件详情页的任意宽度下都成立。
9
+ * `settingsCardShell` / `Button` / `Modal` / `fileSizeText`,所以同一张卡放在插件详情页的任意宽度下都成立。
10
10
  *
11
11
  * 孤儿会话段直接复用 `OrphanMaintenance`(警告条 / 失败 / 中性提示 / 预览确认的既有呈现);
12
12
  * 孤儿附件段是本文件里的 `AttachmentMaintenance`(横幅 + 失败 + 回执 + 缩略图预览与清理确认)。
@@ -15,10 +15,9 @@ import type { ReactElement } from 'react';
15
15
  import { type Translate } from './copy.js';
16
16
  import { type MaintenanceDeps } from './use-maintenance.js';
17
17
  export interface MaintenanceSettingsProps {
18
+ /** 维护四件(读数与动作);可调项两件由占用者另发给「可调项」卡。 */
18
19
  deps: MaintenanceDeps;
19
20
  /** 文案(缺省 = 内置 zh;宿主 locale 服务缺席时也是它,见 `copy.ts`)。 */
20
21
  t?: Translate;
21
- /** 宿主 `plugins.bundle.config` 的视图:`summary` 是插件行的一行摘要,本卡只属于详情页。 */
22
- view?: 'summary' | 'page';
23
22
  }
24
- export declare function MaintenanceSettings({ deps, t, view }: MaintenanceSettingsProps): ReactElement | null;
23
+ export declare function MaintenanceSettings({ deps, t }: MaintenanceSettingsProps): ReactElement;
@@ -0,0 +1,6 @@
1
+ /** 本插件在宿主注册面里的包名:槽位 id 与插件设置页 key 都长在它上面(`${PLUGIN_ID}.trash` 这类)。 */
2
+ export declare const PLUGIN_ID = "@xrn1997/dsh-session-delete";
3
+ /** 同一身份的点号写法:宿主的 `contextMenu.icon` key 与 `contextMenus` 贡献 id 用它。
4
+ * 这些名字由宿主按字面派发(key 撞上别人已占的那一格会顶掉占用者),所以它必须是本插件专属的;
5
+ * 点号形式与包名同源,改名时与 {@link PLUGIN_ID} 一起改,不在调用点另写一份字面量。 */
6
+ export declare const PLUGIN_KEY_PREFIX = "xrn1997.session-delete";
@@ -0,0 +1,22 @@
1
+ import { type Translate } from './copy.js';
2
+ import type { PromptRailNotice } from './use-prompt-rail.js';
3
+ import type { TrashDetailPromptWire } from '../shared/wire.js';
4
+ /** 轨宽(px):刻度与焦点环都按它排;面板的右槽宽度从它派生(`RAIL_GUTTER`)。 */
5
+ export declare const RAIL_WIDTH = 30;
6
+ export interface PromptRailProps {
7
+ readonly prompts: readonly TrashDetailPromptWire[];
8
+ /** 已加载的块 id:未加载的刻度更短更淡,预览卡里也明说「会先补页」。 */
9
+ readonly loadedIds: ReadonlySet<string>;
10
+ readonly activeId: string | null;
11
+ readonly busyId: string | null;
12
+ /** 跳转收手时的说明(目前只有「太远」一种)。 */
13
+ readonly notice: PromptRailNotice | null;
14
+ readonly onJump: (id: string) => void;
15
+ /** 右缘的定位表达式(`max(14px, calc(100% - <正文列宽>px))`):由面板从 `DETAIL_TEXT_MAX_WIDTH`
16
+ * 算好交进来,样式表不重抄列宽。 */
17
+ readonly right: string;
18
+ /** 详情保持期:轨跟着上一条的帧一起顶住,但整条不可交互(不把人补到别人的游标上)。 */
19
+ readonly disabled?: boolean;
20
+ readonly t: Translate;
21
+ }
22
+ export declare function PromptRail({ prompts, loadedIds, activeId, busyId, notice, onJump, right, disabled, t }: PromptRailProps): import("react").JSX.Element | null;