@xrn1997/dsh-session-delete 0.11.0 → 0.13.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 (85) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +20 -19
  3. package/THIRD_PARTY_NOTICES.md +2 -2
  4. package/cordis.patch.yml +7 -7
  5. package/docs/DETAIL.md +1 -1
  6. package/docs/DETAIL.zh.md +1 -1
  7. package/docs/screenshots/screenshot-01.png +0 -0
  8. package/docs/screenshots/screenshot-02.png +0 -0
  9. package/lib/client.js +4295 -2160
  10. package/lib/index.js +1273 -243
  11. package/lib/types/api/archive-rows.d.ts +1 -1
  12. package/lib/types/api/project-ranks.d.ts +3 -0
  13. package/lib/types/api/route-table.d.ts +2 -1
  14. package/lib/types/api/search.d.ts +7 -0
  15. package/lib/types/api/trash-rows.d.ts +1 -1
  16. package/lib/types/client/archive-detail.d.ts +7 -2
  17. package/lib/types/client/archive-pane.d.ts +26 -7
  18. package/lib/types/client/archive-store.d.ts +2 -0
  19. package/lib/types/client/attachment-view.d.ts +1 -1
  20. package/lib/types/client/batch-bar.d.ts +1 -1
  21. package/lib/types/client/batch-select.d.ts +2 -2
  22. package/lib/types/client/batch-selection-store.d.ts +7 -8
  23. package/lib/types/client/confirm-dialog.d.ts +6 -2
  24. package/lib/types/client/context.d.ts +11 -3
  25. package/lib/types/client/copy.d.ts +58 -23
  26. package/lib/types/client/delete-action.d.ts +23 -0
  27. package/lib/types/client/delete-menu-item.d.ts +3 -3
  28. package/lib/types/client/drop-machine.d.ts +1 -1
  29. package/lib/types/client/markdown.d.ts +1 -1
  30. package/lib/types/client/panel-tab.d.ts +25 -3
  31. package/lib/types/client/receipt.d.ts +1 -1
  32. package/lib/types/client/remote.d.ts +23 -2
  33. package/lib/types/client/scene.d.ts +5 -7
  34. package/lib/types/client/search-box.d.ts +24 -0
  35. package/lib/types/client/search-preview.d.ts +46 -0
  36. package/lib/types/client/search-results.d.ts +62 -0
  37. package/lib/types/client/search-text.d.ts +13 -0
  38. package/lib/types/client/session-detail.d.ts +17 -1
  39. package/lib/types/client/subagent-section.d.ts +2 -2
  40. package/lib/types/client/trash-detail.d.ts +7 -2
  41. package/lib/types/client/trash-drop.d.ts +3 -3
  42. package/lib/types/client/trash-entry.d.ts +1 -1
  43. package/lib/types/client/trash-store.d.ts +2 -0
  44. package/lib/types/client/trash-tab.d.ts +21 -1
  45. package/lib/types/client/trash-view.d.ts +7 -6
  46. package/lib/types/client/ui/Modal.d.ts +5 -4
  47. package/lib/types/client/ui/Toast.d.ts +13 -3
  48. package/lib/types/client/ui/anchor-fit.d.ts +42 -0
  49. package/lib/types/client/ui/icons.d.ts +13 -2
  50. package/lib/types/client/undo-notices.d.ts +26 -28
  51. package/lib/types/client/undo-toast.d.ts +0 -6
  52. package/lib/types/client/use-archive-panel-controller.d.ts +5 -6
  53. package/lib/types/client/use-detail-rail.d.ts +2 -0
  54. package/lib/types/client/use-gated-refresh.d.ts +7 -1
  55. package/lib/types/client/use-panel-tab.d.ts +1 -1
  56. package/lib/types/client/use-search-view.d.ts +59 -0
  57. package/lib/types/client/use-search.d.ts +62 -0
  58. package/lib/types/client/use-trash-panel-controller.d.ts +6 -0
  59. package/lib/types/client/view-switches.d.ts +29 -0
  60. package/lib/types/client/write-seats.d.ts +21 -13
  61. package/lib/types/log/session-log.d.ts +4 -1
  62. package/lib/types/ports/agent-handles.d.ts +3 -2
  63. package/lib/types/ports/home.d.ts +1 -1
  64. package/lib/types/ports/host-port.d.ts +7 -2
  65. package/lib/types/shared/wire.d.ts +142 -3
  66. package/lib/types/trash/attachments.d.ts +5 -1
  67. package/lib/types/trash/content-text.d.ts +10 -0
  68. package/lib/types/trash/groups.d.ts +18 -6
  69. package/lib/types/trash/search-corpus.d.ts +40 -0
  70. package/lib/types/trash/search-text.d.ts +43 -0
  71. package/lib/types/trash/shrinking-view.d.ts +6 -4
  72. package/lib/types/verbs/batch.d.ts +10 -7
  73. package/lib/types/verbs/delete-session.d.ts +1 -1
  74. package/lib/types/verbs/member-journal.d.ts +1 -1
  75. package/lib/types/verbs/move-directory.d.ts +10 -0
  76. package/lib/types/verbs/orphan-subagents.d.ts +2 -2
  77. package/lib/types/verbs/permanent-removal.d.ts +23 -7
  78. package/lib/types/verbs/restore-session.d.ts +3 -3
  79. package/lib/types/verbs/search.d.ts +53 -0
  80. package/lib/types/verbs/trash-scope.d.ts +5 -1
  81. package/locale/en.json +1 -1
  82. package/locale/zh.json +1 -1
  83. package/package.json +2 -2
  84. package/lib/types/client/batch-confirm.d.ts +0 -36
  85. package/lib/types/client/delete-confirm.d.ts +0 -52
@@ -1,5 +1,5 @@
1
1
  /** `GET /archive-list` 那一行的装配:registry 归档集 ∩ 会话语料 → `ArchiveListWire`。
2
- * 与 `trash-rows.ts` 同层同责,但归档行念持久化日志字节与最后活动,回收站行念清册目录实测与删除时间
2
+ * 与 `trash-rows.ts` 同层同责,但归档行念持久化日志字节与最后活动,回收站行念清册目录实测与移入回收站时间
3
3
  * ——两个 sizeBytes 不是一个数(ADR-0060 决定第 3 条)。
4
4
  * 缺席口径住 `src/trash/session-rows.ts`;交集按 id 原样,ghost id 宁可少显示也不显示死行(ADR-0008)。 */
5
5
  import type { CoreDeps } from '../deps.js';
@@ -0,0 +1,3 @@
1
+ /** 宿主工作区显示顺序 → 项目目录名的位置表:回收站与归档两档清单共用这一份(重复目录取最先出现的)。 */
2
+ import type { HostIdentityPort } from '../ports/host-port.js';
3
+ export declare function projectRankTableOf(host: Pick<HostIdentityPort, 'projectOrder'>): Promise<ReadonlyMap<string, number>>;
@@ -129,7 +129,8 @@ export declare const APPLY_ACTION_TABLE: {
129
129
  'orphan-clean': "chained";
130
130
  unarchive: "chained";
131
131
  };
132
- export declare const APPLY_ACTIONS: readonly ApplyAction[];
132
+ /** 本表自认的动作序(与 `shared/apply-actions.ts` 的规范序等值,由 `apply-actions-matrix.test` 双向钉住;不另起同名导出)。 */
133
+ export declare const ROUTE_APPLY_ACTIONS: readonly ApplyAction[];
133
134
  /** 段名表逐行:键由 `createRouteTable` 派生;`Record<段名, AnyRouteSpec>` 是闸,漏段编译不过。 */
134
135
  export declare const ROUTE_TABLE: Record<RouteName, AnyRouteSpec>;
135
136
  /** 段名 → 那一行;不认识的段名回 `undefined`。必须问 `Object.hasOwn`:`constructor` 这类
@@ -0,0 +1,7 @@
1
+ import { type SearchBodyFields, type SearchPreviewBodyFields } from '../shared/wire.js';
2
+ import type { SearchPreviewRequest, SearchRequest } from '../verbs/search.js';
3
+ export type { SearchPreviewRequest, SearchRequest };
4
+ /** 检索两段的请求体解析:形状已由通用解析手保证,这里只查语义。 */
5
+ export declare function searchBodyOf(fields: SearchBodyFields): SearchRequest;
6
+ /** 预览两段的请求体解析:`rowId` 非空与 `messageIndex` 非负整数由字段组保证。 */
7
+ export declare function searchPreviewBodyOf(fields: SearchPreviewBodyFields): SearchPreviewRequest;
@@ -5,7 +5,7 @@ import type { TrashRowWire } from '../shared/wire.js';
5
5
  /** 行投影的只读数容器:`releaseBytes` 必填;其余缺席 = 这次没算,不是 0。 */
6
6
  type TrashRowReadouts = {
7
7
  readonly releaseBytes: number;
8
- } & Partial<Pick<TrashRowWire, 'subagentCount' | 'subagentBytes' | 'strandedSubagents' | 'strandedBytes' | 'workspaceMissing'>>;
8
+ } & Partial<Pick<TrashRowWire, 'subagentCount' | 'subagentBytes' | 'strandedSubagents' | 'strandedBytes' | 'workspaceMissing' | 'projectRank'>>;
9
9
  /** 清册行 → 线上行:清册字段走 `entryWire`(多一个必填字段会编译错),这里只补 `/list` 只读数。 */
10
10
  export declare function toWire(row: TrashEntry, readouts: TrashRowReadouts): TrashRowWire;
11
11
  /** 装配成「一行 = 一组」:孩子折进父行,父行不在时孩子自己占一行(否则看不见也清不掉)。
@@ -5,7 +5,7 @@
5
5
  import type { Translate } from './copy.js';
6
6
  import type { ArchiveDetailLike } from './remote.js';
7
7
  import type { ArchiveDetailSubject } from './use-archive-detail-reader.js';
8
- import { type DetailNav } from './session-detail.js';
8
+ import { type DetailJump, type DetailNav } from './session-detail.js';
9
9
  import type { DetailFrame } from './use-detail-frame.js';
10
10
  export interface ArchiveDetailProps {
11
11
  frame: DetailFrame<ArchiveDetailSubject, ArchiveDetailLike>;
@@ -14,6 +14,11 @@ export interface ArchiveDetailProps {
14
14
  detailNav: DetailNav;
15
15
  onRetry: () => void;
16
16
  onBack: () => void;
17
+ /** 检索跳转目标(命中块的时间与查询串):给了就对齐到命中块(只对齐、不画落地框)。 */
18
+ jump?: DetailJump | undefined;
19
+ onJumpDone?: (() => void) | undefined;
20
+ /** 详情头的一条明确提示(例:还原孩子视图时那一层已经不在)。 */
21
+ notice?: string | null;
17
22
  t: Translate;
18
23
  }
19
- export declare function ArchiveDetail({ frame, busy, wide, detailNav, onRetry, onBack, t, }: ArchiveDetailProps): import("react").JSX.Element;
24
+ export declare function ArchiveDetail({ frame, busy, wide, detailNav, onRetry, onBack, jump, onJumpDone, notice, t, }: ArchiveDetailProps): import("react").JSX.Element;
@@ -2,7 +2,7 @@
2
2
  * 归档档的三个纯视图件(清单列 / 工具行 / 页脚)与 adapter:状态面来自 `useArchiveQuery`,
3
3
  * 装配线住 `use-panel-tab.ts`、四格版面住 `panel-tab.tsx`;这里只回答归档档与回收站不同的那几格。
4
4
  */
5
- import type { RefObject } from 'react';
5
+ import { type MutableRefObject, type RefObject } from 'react';
6
6
  import { type Translate } from './copy.js';
7
7
  import type { ArchiveRowWire } from '../shared/wire.js';
8
8
  import { type ProjectGroup } from './trash-view.js';
@@ -16,6 +16,8 @@ import type { TrashNav } from './trash-nav.js';
16
16
  import type { DelayedPrefetch } from './use-prefetch.js';
17
17
  import { type PanelTabFrameLayout } from './panel-tab.js';
18
18
  import { type PanelTab, type PanelTabAdapter, type PanelTabContext } from './use-panel-tab.js';
19
+ import { type SearchInputRef } from './search-box.js';
20
+ import type { PanelTabDeps } from './use-panel-tab.js';
19
21
  /** 这一档进 DOM 的身份:行身份是会话 id(回收站那边是条目 id)。 */
20
22
  export declare const ARCHIVE_LIST_DOM: ListDom;
21
23
  /** 行身份:模块级稳定引用(面板把导航接在这里)。 */
@@ -24,7 +26,7 @@ export interface ArchiveListProps {
24
26
  query: ArchiveQuery;
25
27
  selection: ListSelection<ArchiveRowWire>;
26
28
  groups: readonly ProjectGroup<ArchiveRowWire>[];
27
- controller: Pick<ArchivePanelController, 'selectRow' | 'unarchive' | 'requestDeleteOne' | 'actionFailure' | 'busy'>;
29
+ controller: Pick<ArchivePanelController, 'selectRow' | 'unarchive' | 'deleteOne' | 'actionFailure' | 'busy'>;
28
30
  prefetch: DelayedPrefetch<ArchiveRowWire>;
29
31
  listRef: RefObject<HTMLDivElement>;
30
32
  /** 键盘契约(导航状态住档的装配线,窄档下钻时清单卸载也不丢 Esc 与焦点交还)。 */
@@ -38,26 +40,43 @@ export declare function ArchiveList({ query, selection, groups, controller, pref
38
40
  export interface ArchiveToolbarProps {
39
41
  selection: ListSelection<ArchiveRowWire>;
40
42
  groups: readonly ProjectGroup<ArchiveRowWire>[];
43
+ searchQuery: string;
44
+ onSearchQuery: (next: string) => void;
45
+ searchInputRef: SearchInputRef;
41
46
  t: Translate;
42
47
  }
43
- export declare function ArchiveToolbar({ selection, groups, t }: ArchiveToolbarProps): import("react").JSX.Element;
48
+ /** 工具行的**内容**(三件),容器归 `PanelTabFrame`(`toolbarAttr="archive-toolbar"`)与回收站档同一份。
49
+ * 不在这里再包一层:自宽 flex 包裹作为帧工具行的 flex item 会按内容宽收缩,检索框拿不到自己的
50
+ * 240px basis、两颗开关被压窄并左移(2026-12-02 真机反馈的「走形」)。 */
51
+ export declare function ArchiveToolbar({ selection, groups, searchQuery, onSearchQuery, searchInputRef, t }: ArchiveToolbarProps): import("react").JSX.Element;
44
52
  export interface ArchiveFooterProps {
45
53
  selection: ListSelection<ArchiveRowWire>;
46
- controller: Pick<ArchivePanelController, 'unarchive' | 'requestDeleteMany' | 'busy'>;
54
+ controller: Pick<ArchivePanelController, 'unarchive' | 'deleteMany' | 'busy'>;
47
55
  t: Translate;
48
56
  }
49
- /** 页脚随档位:多选态 = 「解除所选」(无确认框)/「删除所选」(实心红,确认框同批量删除)。
50
- * 危险那颗必须是这一排的最后一个(整页唯一实心红的位置契约);勾中行读 `checkedRows` 派生,不从 groups 重算。 */
57
+ /** 页脚随档位:多选态 = 「解除所选」(无确认框)/「移入回收站所选」(普通主按钮,可恢复动作不用实心红)。
58
+ * 勾中行读 `checkedRows` 派生,不从 groups 重算。 */
51
59
  export declare function ArchiveFooter({ selection, controller, t }: ArchiveFooterProps): import("react").JSX.Element | null;
52
60
  /** 归档档 adapter:两档差异里属于归档的那一半。 */
53
61
  export declare const ARCHIVE_TAB_ADAPTER: PanelTabAdapter<ArchiveQuery, ArchiveRowWire, ArchiveDetailSubject, ArchiveDetailLike, ArchivePanelController>;
54
62
  export type ArchivePanelTab = PanelTab<ArchiveQuery, ArchiveRowWire, ArchiveDetailSubject, ArchiveDetailLike, ArchivePanelController>;
63
+ /** 进入检索前的视图态(归档没有独立 drilled 位:选中即窄档下钻,孩子视图 id 一并存)。 */
64
+ export interface ArchiveSearchView {
65
+ readonly row: ArchiveRowWire | null;
66
+ readonly childSessionId: string | null;
67
+ }
55
68
  export interface ArchiveTabViewProps {
56
69
  readonly tab: ArchivePanelTab;
57
70
  readonly layout: PanelTabFrameLayout;
71
+ readonly deps: PanelTabDeps;
72
+ readonly searchQuery: string;
73
+ readonly onSearchQuery: (next: string) => void;
74
+ readonly searchInputRef: SearchInputRef;
75
+ /** 面板壳持有的还原点:切档往返时视图会卸载,本地 ref 活不过去。 */
76
+ readonly searchRestoreRef: MutableRefObject<ArchiveSearchView | null>;
58
77
  readonly t: Translate;
59
78
  }
60
79
  /** 归档档的四格视图:清单列 / 工具行 / 页脚三件住本文件,详情 `ArchiveDetail` 原样转交;
61
80
  * 四格容器与分栏/下钻分支由 `PanelTabFrame` 画(与回收站档同一份)。 */
62
- export declare function ArchiveTabView({ tab, layout, t }: ArchiveTabViewProps): import("react").JSX.Element;
81
+ export declare function ArchiveTabView({ tab, layout, deps, searchQuery, onSearchQuery, searchInputRef, searchRestoreRef, t, }: ArchiveTabViewProps): import("react").JSX.Element;
63
82
  export declare function useArchiveTab(ctx: PanelTabContext): ArchivePanelTab;
@@ -1,5 +1,7 @@
1
1
  export interface ArchiveRevisionScene {
2
2
  invalidate(): void;
3
+ /** 当前修订号(当场读;显式 reload 用来同步消费当拍已达修订)。 */
4
+ read(): number;
3
5
  use(): number;
4
6
  reset(): void;
5
7
  }
@@ -4,7 +4,7 @@ import type { Translate } from './copy.js';
4
4
  export declare function attachmentUrl(a: TrashDetailAttachmentWire): string;
5
5
  /**
6
6
  * 一条消息的全部附件,顺序照日志(用户先发图后发文件)。`align` 是这一行的对齐:用户行靠右、助手行靠左。
7
- * `failed` 按 `attachmentId` 记:同一内容哈希可能被引用多次,裂一次就不再画破图。四个 `useState` 都在早退前调用。
7
+ * `failed` 按 `attachmentId` 记:同一内容哈希可能被引用多次,裂一次就不再画破图。
8
8
  */
9
9
  export declare function AttachmentStrip({ attachments, t, align, }: {
10
10
  attachments: readonly TrashDetailAttachmentWire[];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 批量删除的浮条:**多选模式内常驻**(0 条也渲染),汇总「已选 N 条」+「含 K 个子会话」,
2
+ * 批量移入回收站的浮条:**多选模式内常驻**(0 条也渲染),汇总「已选 N 条」+「含 K 个子会话」,
3
3
  * 「查看已选」展开可滚动的标题清单。K 是勾选防抖 300ms 后的一次批量 count(`/apply` 的 action:count),
4
4
  * 带最新票守卫;读数与它对应的名单绑在一起存,对不上就整句不说(不拿旧读数求新名单的和)。
5
5
  * 整行点击守卫也挂在这棵常驻宿主上;浮条住 `shell.overlay`。
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 宿主列表批量删除的**控件面**:行首勾选框、行尾兜底开关,以及计数问句 `fetchCounts`。
2
+ * 宿主列表批量移入回收站的**控件面**:行首勾选框、行尾兜底开关,以及计数问句 `fetchCounts`。
3
3
  * 入口在「⋯」菜单:按下才进入多选模式,模式内才渲染勾选框并把整行点击变成勾/取消;退出模式清空名单。
4
4
  * 选中集只住 `batch-selection-store.ts`;可见行住 `host-rows.ts`;点行算不算选中住 `batch-pick.ts`。
5
5
  * **主勾选在行首**:宿主对行尾 `.rowActions` 是 `display:none`,只有行尾悬停/菜单打开才出现(app.asar 0.2.0-rc.2 的 `Rows` 渲染);
@@ -29,7 +29,7 @@ export declare function BatchPickCheckbox({ sessionId, title, live, t, }: BatchP
29
29
  export interface BatchPickButtonProps {
30
30
  sessionId: string;
31
31
  title: string;
32
- /** 会话在跑:置灰 + 悬停原因(与单删菜单行同款——级联遇在跑成员整组拒绝,先说清再让人点不动)。 */
32
+ /** 会话在跑:置灰 + 悬停原因(与单条移入的菜单行同款——级联遇在跑成员整组拒绝,先说清再让人点不动)。 */
33
33
  live?: boolean;
34
34
  /** 文案(缺省 = 内置 zh,见 `copy.ts`:这不是"忘了传",而是"这次没有 locale 服务")。 */
35
35
  t?: Translate;
@@ -1,9 +1,7 @@
1
- export interface PickItem {
2
- /** 宿主槽位投影的会话 id,原样透给 `applyOutcomes('delete', …)`。 */
3
- readonly sessionId: string;
4
- /** 删除那一刻的会话名(投影的 `displayTitle`):只用于文案与确认框,不参与请求。 */
5
- readonly title: string;
6
- }
1
+ import type { TrashMoveTarget } from './write-seats.js';
2
+ /** 选中集一条 = 一条待移入回收站的会话:与 `write-seats.ts` 的 `TrashMoveTarget` 同一形状、同一义,
3
+ * `title` 是移入回收站那一刻的显示名(投影的 `displayTitle`),只用于已选清单与撤销/失败原文,不参与请求。 */
4
+ export type PickItem = TrashMoveTarget;
7
5
  export interface SelectionState {
8
6
  readonly selecting: boolean;
9
7
  readonly picks: readonly PickItem[];
@@ -27,7 +25,8 @@ export interface BatchSelectionScene {
27
25
  clear(): void;
28
26
  /** 只追加还没选过的条目;原有选中在前、新条目按传入序接在后面。 */
29
27
  add(items: readonly PickItem[]): void;
30
- shrinkToFailures(failedSessionIds: readonly string[]): void;
28
+ /** 按本批失败名单收缩选中集;传入 `submittedSessionIds` 时只剔除本批成功项,保留失败项及在飞期间新勾选的会话。 */
29
+ shrinkToFailures(failedSessionIds: readonly string[], submittedSessionIds?: readonly string[]): void;
31
30
  reset(): void;
32
31
  }
33
32
  export declare function createBatchSelectionScene(): BatchSelectionScene;
@@ -42,5 +41,5 @@ export declare function togglePick(item: PickItem): void;
42
41
  export declare function toggleRangePick(item: PickItem, rows: readonly PickItem[]): void;
43
42
  export declare function clearPicks(): void;
44
43
  export declare function addPicks(items: readonly PickItem[]): void;
45
- export declare function shrinkPicksToFailures(failedSessionIds: readonly string[]): void;
44
+ export declare function shrinkPicksToFailures(failedSessionIds: readonly string[], submittedSessionIds?: readonly string[]): void;
46
45
  export declare function resetSelection(): void;
@@ -1,6 +1,10 @@
1
1
  /**
2
- * 六个确认框共用的**一个壳**:`Modal` + 标题 + 关闭钮 + 「取消(描边) / 确认(主按钮)」页脚。
2
+ * 回收站与维护卡各确认框共用的**一个壳**:`Modal` + 标题 + 关闭钮 + 「取消(描边) / 确认(主按钮)」页脚。
3
3
  * 共用的只有页脚与关框规则(在飞时取消与关闭都按住),业务面各框自持;裁决见 ADR-0052。
4
+ *
5
+ * **初始焦点在取消上**(`data-modal-autofocus`):这些框全是危险动作(彻底删除 / 清空回收站 /
6
+ * 孤儿清理),指南 `dialog` 要求破坏性确认把自动焦点给安全动作;不给标记的话 `Modal` 会落到
7
+ * 首个可聚焦元素——header 那颗关闭钮,而忙碌档里它正是 `aria-disabled` 的死键。
4
8
  */
5
9
  import { type ReactNode } from 'react';
6
10
  export interface ConfirmDialogProps {
@@ -11,7 +15,7 @@ export interface ConfirmDialogProps {
11
15
  readonly busy: boolean;
12
16
  readonly onCancel: () => void;
13
17
  readonly onConfirm: () => void;
14
- /** 危险层级:实心红主按钮;缺省是普通 primary(与「移入回收站」同款)。 */
18
+ /** 危险层级:实心红主按钮;缺省是普通 primary。 */
15
19
  readonly danger?: boolean;
16
20
  /** 忙碌面的动作文案:busy 时主按钮换 `.sd-spinner` + 这句(缺省时维持现状,只置灰)。 */
17
21
  readonly busyLabel?: string;
@@ -1,5 +1,12 @@
1
1
  /** 宿主**浏览器侧** ctx 的本地窄镜像(只声明用到的成员 + 一次强转;不装宿主类型包、不做 `declare module`)。
2
- * 单独一个文件是因为 `index.tsx` 与 `copy.ts` 都用它,放进入口会绕出循环导入。 */
2
+ * 单独一个文件是因为 `index.tsx` 与 `copy.ts` 都用它,放进入口会绕出循环导入。
3
+ *
4
+ * **成员可缺性表**(缺 `effect` 时各调用面的去处,别把守卫当冗余删掉)。`effect` 按**防御性判空**可缺:
5
+ * 测试窄 ctx 与宿主换代都可能没有这一格,本镜像不按某一代宿主的实测成员面断言它必有。
6
+ * - `copy.ts` 的 `createTranslate`、`context-menu-actions.tsx` 的 `installSessionMenus`:注册照旧,只缺
7
+ * 卸载撤销,各告警一句。代价是受约束的:字典重挂撞名会退回内置 zh、菜单可能与数据动作双轨并存。
8
+ * - `index.tsx` 的三个结构性副作用、`main-view.ts` 的重开取消、`host-archive-watch.ts` 的迟到观察:跳过
9
+ * 不装——监听类副作用缺撤销就是泄漏,宁可不装。 */
3
10
  /** 一个槽位注册项。`label` 允许是 thunk——宿主 `resolveSlotLabel` 的 JSDoc 原文即 "thunks follow the active
4
11
  * locale",面板行名要随语言走就得走这条。 */
5
12
  export interface SlotRegistration {
@@ -21,6 +28,7 @@ export interface ClientContextLike {
21
28
  get?(name: string): unknown;
22
29
  /** 可选服务迟到时的安装面(服务就绪才回调,缺席就一直等)。**缺省调用**:老宿主上没有这个方法。 */
23
30
  inject?(deps: readonly string[], callback: (child: ClientContextLike) => unknown): unknown;
24
- /** 挂一个随本插件卸载而撤销的副作用;属性声明(测试当成员读),实现不读 `this`。 */
25
- effect: (execute: () => unknown, label?: string) => unknown;
31
+ /** 挂一个随本插件卸载而撤销的副作用;属性声明(测试当成员读),实现不读 `this`。
32
+ * **可缺(防御性判空)**:测试窄 ctx 与宿主换代都可能没有这一格,各调用面的去处见文件头的可缺性表。 */
33
+ effect?: (execute: () => unknown, label?: string) => unknown;
26
34
  }
@@ -14,16 +14,18 @@ declare const ZH: {
14
14
  readonly 'common.ago': "{n}{unit}前";
15
15
  readonly 'common.retry': "重试";
16
16
  readonly 'common.renderFailed': "这一块暂时显示不出来(其余部分照常)";
17
+ readonly 'toast.region': "通知";
18
+ readonly 'toast.close': "关闭通知";
17
19
  readonly 'panel.tabs.label': "面板档位";
18
20
  readonly 'trash.title': "回收站";
19
21
  readonly 'trash.loading': "正在读回收站…";
20
22
  readonly 'trash.readFailed': "回收站读不到";
21
23
  readonly 'trash.empty.title': "回收站是空的";
22
- readonly 'trash.empty.hint': "在会话条目的「…」菜单里选「删除」,会话会先进到这里,随时可以恢复。";
24
+ readonly 'trash.empty.hint': "在会话条目的「…」菜单里选「移入回收站」,会话会先进到这里,随时可以恢复。";
23
25
  readonly 'trash.summary': "{count} 个会话 · 可释放 {size}";
24
26
  readonly 'trash.project.unknown': "未记录项目";
25
- readonly 'trash.row.deletedNow': "刚刚删除";
26
- readonly 'trash.row.deletedAgo': "删除于 {n}{unit}前";
27
+ readonly 'trash.row.deletedNow': "刚刚移入回收站";
28
+ readonly 'trash.row.deletedAgo': "{n}{unit}前移入回收站";
27
29
  readonly 'trash.row.subagents': "含 {n} 个子会话";
28
30
  readonly 'trash.row.strandedSubagents': "盘上还剩 {n} 个子会话";
29
31
  readonly 'trash.row.workspaceGone': "原工作区已不存在,恢复后归入未分组";
@@ -39,7 +41,7 @@ declare const ZH: {
39
41
  readonly 'trash.emptyAll': "清空回收站…";
40
42
  readonly 'trash.confirm.all': "清空回收站?";
41
43
  readonly 'trash.confirm.one': "彻底删除 1 个会话?";
42
- readonly 'trash.confirm.one.meta': "{project} · 删除于 {at} · {size}";
44
+ readonly 'trash.confirm.one.meta': "{project} · 移入回收站于 {at} · {size}";
43
45
  readonly 'trash.confirm.body': "这会从回收站移除文件,{strong}。只清理会话独占的图片附件副本(共享副本保留);这些会话自己的投影缓存记录也会一并清理,其他会话的缓存与你磁盘上的原图不受影响。";
44
46
  readonly 'trash.confirm.body.strong': "之后没有任何副本可以恢复";
45
47
  readonly 'trash.confirm.purge': "彻底删除";
@@ -60,6 +62,42 @@ declare const ZH: {
60
62
  readonly 'trash.confirm.restore': "恢复 {count} 个会话?";
61
63
  readonly 'trash.confirm.restore.body': "这一批会回到它们各自的原项目目录,恢复到会话列表里。";
62
64
  readonly 'trash.confirm.restoreNow': "恢复";
65
+ readonly 'search.placeholder': "搜索标题与正文";
66
+ readonly 'search.clear': "清除检索";
67
+ readonly 'search.summary': "{sessions} 个会话 · {hits} 处命中";
68
+ readonly 'search.titleSection': "标题命中";
69
+ readonly 'search.bodySection': "正文命中";
70
+ readonly 'search.tag.title': "标题";
71
+ readonly 'search.tag.child': "子会话";
72
+ readonly 'search.hit.count': "已加载 {count} 处";
73
+ readonly 'search.loading': "正在检索…";
74
+ readonly 'search.results.label': "检索结果";
75
+ readonly 'search.scanning': "仍在检索 {done} / {total} 个会话…";
76
+ readonly 'search.loadMore': "继续检索";
77
+ readonly 'search.childMissing': "这条命中所在的子会话不在父会话详情里(可能超出摘要上限或已被移走)。";
78
+ readonly 'search.pagingFailed': "继续检索失败:{message}";
79
+ readonly 'search.incomplete': "检索期间语料发生变化,结果可能不完整。";
80
+ readonly 'search.incomplete.retry': "重新检索";
81
+ readonly 'search.skipped': "{count} 个会话未参与检索";
82
+ readonly 'search.skipped.withReasons': "{count} 个会话未参与检索({reasons})";
83
+ readonly 'search.skipped.unreadable': "读不出日志";
84
+ readonly 'search.skipped.tooLarge': "日志太大";
85
+ readonly 'search.empty.title': "没有找到「{query}」";
86
+ readonly 'search.empty.hint': "换个词试试,或清除检索回到清单。正文检索只包含用户与助手的文字。";
87
+ readonly 'search.failed': "检索失败";
88
+ readonly 'search.listNotReady': "清单还没读出来,检索结果暂时无法对齐到行;稍后重试,或先清空检索。";
89
+ readonly 'search.preview.position': "命中预览 · 第 {index} / {count} 处";
90
+ readonly 'search.preview.prev': "上一处";
91
+ readonly 'search.preview.next': "下一处";
92
+ readonly 'search.preview.openDetail': "在完整详情中打开";
93
+ readonly 'search.preview.fromChild': "这条命中来自子会话(正文取自子会话日志)";
94
+ readonly 'search.preview.truncated': "已截断";
95
+ readonly 'search.preview.restore': "恢复这条会话";
96
+ readonly 'search.preview.unarchive': "解除归档";
97
+ readonly 'search.preview.moveToTrash': "移入回收站";
98
+ readonly 'search.preview.purge': "彻底删除…";
99
+ readonly 'search.preview.roleUser': "你";
100
+ readonly 'search.preview.roleAssistant': "助手";
63
101
  readonly 'trash.orphans.banner': "回收站之外发现 {count} 个无主子会话";
64
102
  readonly 'trash.orphans.meta': "共 {size},来自 {parents} 个失踪的父会话";
65
103
  readonly 'trash.orphans.open': "查看并清理";
@@ -157,11 +195,11 @@ declare const ZH: {
157
195
  readonly 'archive.row.created': "创建于";
158
196
  readonly 'archive.row.timeAbsent': "时间未知";
159
197
  readonly 'archive.row.unarchive': "解除归档";
160
- readonly 'archive.row.delete': "删除";
198
+ readonly 'archive.row.delete': "移入回收站";
161
199
  readonly 'archive.row.subagent': "子代理";
162
- readonly 'archive.row.deleteHint': "删除后进入回收站,可恢复。";
200
+ readonly 'archive.row.deleteHint': "移入回收站后可恢复。";
163
201
  readonly 'archive.select.unarchive': "解除所选 {count} 条";
164
- readonly 'archive.select.delete': "删除所选 {count} 条";
202
+ readonly 'archive.select.delete': "移入回收站所选 {count} 条";
165
203
  readonly 'archive.size.absent': "—";
166
204
  readonly 'archive.detail.lastEvent': "日志末条";
167
205
  readonly 'archive.detail.statusLabel': "状态";
@@ -187,6 +225,7 @@ declare const ZH: {
187
225
  readonly 'detail.block.status.error': "失败";
188
226
  readonly 'detail.block.status.unfinished': "未完成";
189
227
  readonly 'detail.block.truncated': "已截断";
228
+ readonly 'detail.jump.missing': "命中在更早一页";
190
229
  readonly 'detail.loadOlder': "加载更早";
191
230
  readonly 'detail.loadOlder.loading': "正在加载更早…";
192
231
  /** 提问轨(详情右缘那道常驻刻度):一句用户提问一格,点一格跳到那句。 */
@@ -230,7 +269,7 @@ declare const ZH: {
230
269
  readonly 'detail.attachment.saveFailed': "保存失败:{message}";
231
270
  readonly 'detail.back': "← 返回清单";
232
271
  readonly 'detail.subagents.label': "子会话";
233
- readonly 'detail.subagents.note': "随本条一起恢复或删除";
272
+ readonly 'detail.subagents.note': "随本条一起恢复或彻底删除";
234
273
  readonly 'detail.subagents.expand': "展开子会话列表";
235
274
  readonly 'detail.subagents.collapse': "收起子会话列表";
236
275
  readonly 'detail.subagents.jump': "展开并跳到子会话段";
@@ -240,17 +279,13 @@ declare const ZH: {
240
279
  readonly 'detail.list.label': "回收站清单";
241
280
  readonly 'detail.role.user': "你";
242
281
  readonly 'detail.role.assistant': "助手";
243
- readonly 'menu.delete': "删除";
244
- readonly 'menu.live': "会话正在运行,先停止再删除";
245
- readonly 'drop.refuseLive': "运行中的会话不能删除";
246
- readonly 'drop.release': "松手删除";
247
- readonly 'drop.deleting': "正在删除…";
248
- readonly 'menu.deleteLive': "删除(运行中)";
249
- readonly 'dialog.title': "删除这个会话?";
250
- readonly 'dialog.subagents': "含 {n} 个子会话,将一起移入回收站。";
251
- readonly 'dialog.hint': "会话会移入回收站,之后可以随时恢复。彻底删除是回收站里的另一个动作。";
252
- readonly 'dialog.confirm': "移入回收站";
253
- readonly 'batch.row.pick': "勾选「{title}」以批量删除";
282
+ readonly 'menu.delete': "移入回收站";
283
+ readonly 'menu.live': "会话正在运行,先停止再移入回收站";
284
+ readonly 'drop.refuseLive': "运行中的会话不能移入回收站";
285
+ readonly 'drop.release': "松手移入回收站";
286
+ readonly 'drop.deleting': "正在移入回收站…";
287
+ readonly 'menu.deleteLive': "移入回收站(运行中)";
288
+ readonly 'batch.row.pick': "勾选「{title}」以批量移入回收站";
254
289
  readonly 'batch.bar.count': "已选 {n} 条";
255
290
  readonly 'batch.bar.pickHint': "点击会话行选择";
256
291
  readonly 'batch.bar.kids': "含 {k} 个子会话,跟着整组走";
@@ -260,10 +295,8 @@ declare const ZH: {
260
295
  readonly 'batch.bar.selectAll': "全选";
261
296
  readonly 'batch.bar.selectNone': "取消全选";
262
297
  readonly 'batch.run': "移入回收站 {n} 条";
263
- readonly 'dialog.batch.title': "删除这些 {n} 个会话?";
264
- readonly 'dialog.batch.retry': "重试这 {n} 条";
265
298
  readonly 'undo.movedBatch': "{n} 条会话已移入回收站";
266
- readonly 'progress.action.delete': "正在删除";
299
+ readonly 'progress.action.delete': "正在移入回收站";
267
300
  readonly 'progress.action.restore': "正在恢复";
268
301
  readonly 'progress.action.purge': "正在彻底删除";
269
302
  readonly 'progress.action.unarchive': "正在解除归档";
@@ -284,6 +317,7 @@ declare const ZH: {
284
317
  readonly 'undo.session': "会话";
285
318
  readonly 'undo.undo': "撤销";
286
319
  readonly 'undo.failedBatch': "{n} 条会话未能撤销:{reasons}";
320
+ readonly 'undo.partialFailure': "{n} 条未能移入回收站:{reasons}";
287
321
  };
288
322
  export type CopyKey = keyof typeof ZH;
289
323
  export type CopyParams = Readonly<Record<string, string | number>>;
@@ -295,7 +329,8 @@ export declare const zhTranslate: Translate;
295
329
  *
296
330
  * **空值判据同时认 `undefined` 与 `null`**:宿主 `ctx.get` 可以回 null,只判 undefined 会让 `service.register`
297
331
  * 抛错——而本函数跑在任何槽位注册之前,抛出去等于整个客户端条目从页面消失。注册 / 绑定失败同样退回 zh。
298
- * 注册必须挂在 `ctx.effect` 上:`register` 返回的 disposer 是官方契约,且同一命名空间同一语言只能注册一次。
332
+ * `register` 返回的 disposer 是官方契约(同一命名空间同一语言只能注册一次),随插件卸载摘除归 `effect`;
333
+ * 缺那一格时注册照旧、只缺撤销——重挂撞名是缺 `effect` 的受约束代价(见 `context.ts` 头注的可缺性表)。
299
334
  */
300
335
  export declare function createTranslate(ctx: ClientContextLike): Translate;
301
336
  /**
@@ -0,0 +1,23 @@
1
+ import type { OneShotDeps } from './remote.js';
2
+ import { type TrashMoveTarget } from './write-seats.js';
3
+ export interface DeleteActionRequest extends TrashMoveTarget {
4
+ readonly seq: number;
5
+ }
6
+ export interface DeleteActionScene {
7
+ request(input: TrashMoveTarget): void;
8
+ clear(expected: DeleteActionRequest): void;
9
+ use(): DeleteActionRequest | null;
10
+ reset(): void;
11
+ }
12
+ export declare function createDeleteActionScene(): DeleteActionScene;
13
+ export declare function requestDelete(input: TrashMoveTarget): void;
14
+ export declare function useDeleteActionRequest(): DeleteActionRequest | null;
15
+ /**
16
+ * 菜单「移入回收站」的常驻动作宿主(挂 `shell.overlay`,不画界面):
17
+ * - 按 `handledRef` 认同一个请求对象引用,挡住 React StrictMode 对同一请求的二次 effect;
18
+ * - 按 `inFlightRef` 维护跨 tick 的单会话单飞,同一会话在飞时再点菜单不发第二趟写;
19
+ * - 错误兜底 + finally 清请求,防止 unhandled rejection 或请求悬挂。
20
+ */
21
+ export declare function DeleteActionHost({ deps }: {
22
+ deps: OneShotDeps;
23
+ }): null;
@@ -1,12 +1,12 @@
1
1
  import { type Translate } from './copy.js';
2
2
  export interface DeleteMenuItemProps {
3
- /** 槽位投影的会话 id,原样透给删除写入(段名与动作住 `shared/wire.ts`)。 */
3
+ /** 槽位投影的会话 id,原样透给移入回收站的写入(段名与动作住 `shared/wire.ts`)。 */
4
4
  sessionId: string;
5
- /** 槽位投影的 `displayTitle`:只用于确认框与提示文案,不参与任何请求。 */
5
+ /** 槽位投影的 `displayTitle`:只用于撤销提示文案,不参与任何请求。 */
6
6
  title: string;
7
7
  /** 会话在跑:这一行置灰,并把原因摆在行上。 */
8
8
  live?: boolean;
9
- /** 上方那条发丝线;缺省 true。多选入口排在删除前面时由它带线。 */
9
+ /** 上方那条发丝线;缺省 true。多选入口排在「移入回收站」前面时由它带线。 */
10
10
  separatorBefore?: boolean;
11
11
  /** 菜单 owner 交下来的「收起菜单」(槽位契约:开合归 owner)。按下时**先发请求、再收菜单**;缺省不动。 */
12
12
  dismissMenu?: () => void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 拖放目标状态机(`docs/ui-spec.md` §1、`ADR-0071`):
2
+ * 拖放目标状态机(`docs/ui-spec.md` §1;判定住 `ADR-0071`,移入回收站的即执行口径统一见 `ADR-0072`):
3
3
  * 4 个驻留态 × `sourceOk` 正交维度,**拒收是动效不是状态**——`dropBlocked` / `writeRejected`
4
4
  * 只置 `shake` 视图位(带原因文案),驻留态照常走;`shakeEnd` 清尾巴(胶囊自灭 1.6s 由调用方计时)。
5
5
  * 纯模块零 DOM:`trash-entry.tsx` 负责把 DOM 事件翻译成这里的事件、把 view 投影成 attr 与胶囊。
@@ -2,7 +2,7 @@ import type { Translate } from './copy.js';
2
2
  import './ui/styles.js';
3
3
  /**
4
4
  * `memo` 是必需的而不是优化:`react-markdown@10.1.0` 里**一处 memoization 都没有**,面板任何一次重渲
5
- * (悬停、↑↓、「刚刚删除」那句要读 `Date.now()`)都会走到这里 ⇒ 不按住就是每条助手回复每拍重解析一遍。
5
+ * (悬停、↑↓、「刚刚移入回收站」那句要读 `Date.now()`)都会走到这里 ⇒ 不按住就是每条助手回复每拍重解析一遍。
6
6
  * 按住条件是 `text` 与探针 `probe`(按当前 locale 现算的译文,专给 comparator 当「换语言了没」的读数;
7
7
  * 「借哪句」的知识住 `copy.ts` 的 `localeProbe`,调用方一律 `probe={localeProbe(t)}`)。
8
8
  */
@@ -1,13 +1,32 @@
1
1
  /**
2
2
  * 一档的**四格版面**:工具行 / 清单 / 详情 / 页脚。两档共用容器与分栏/下钻分支,视图件只交四个槽位与
3
3
  * 三格布局事实。版面判据住 `docs/ui-spec.md` §3:工具行住在 body **之外**(长清单滚到底也不滚走);
4
- * 两栏成立时清单可拖定宽、详情吃余下,否则铺满。返回 **fragment**(不新增 DOM 容器)。
4
+ * 两栏成立时清单可拖定宽、详情吃余下,否则铺满。工具行**不是常驻格**:清单没有行时整条不画
5
+ * ({@link toolbarVisible}),视图交 `null`,本组件连容器一起不渲染。返回 **fragment**(不新增 DOM 容器)。
5
6
  */
6
7
  import type { ReactNode, RefObject } from 'react';
7
8
  import type { Translate } from './copy.js';
8
9
  import type { ListDom } from './session-list.js';
9
10
  import type { ColumnResizeHandleProps } from './use-column-resize.js';
10
11
  import type { DetailRail } from './use-detail-rail.js';
12
+ /** 工具行出场判据的三个事实:清单这一帧有没有行、是否在多选态、有没有检索词。 */
13
+ export interface ToolbarVisibility {
14
+ /** 清单这一帧有行(`ready` 且非空)——空表 / 读失败 / 语料不可见 / 首读在飞都没有可操作的东西。 */
15
+ readonly hasRows: boolean;
16
+ readonly selectMode: boolean;
17
+ readonly searchQuery: string;
18
+ }
19
+ /**
20
+ * 工具行的出场判据(两档共用,视图在交槽位前先问一次):清单**没有行**时整条工具行退场——
21
+ * 检索框、折叠与多选一起,连容器都不画。清单没有行还摆出整行,只会让宽档(此时不分栏)的
22
+ * 检索框按整块面板铺开,而折叠与多选本来也无事可做。
23
+ *
24
+ * 两个例外,各是一条出口:
25
+ * - **多选态**:清单被清空或读失败后「退出多选」仍要能点——退出入口只在工具行里(回收站档页脚此时也已退场);
26
+ * - **带检索词**:切档保留检索词,检索在填词那一刻已经跑起来;检索框是唯一可见的清空入口
27
+ * (结果区只有焦点在里面时的 Esc),藏掉它会把「切档 + 新档首读」变成一个没有出口的结果页。
28
+ */
29
+ export declare function toolbarVisible({ hasRows, selectMode, searchQuery }: ToolbarVisibility): boolean;
11
30
  /** 详情格的槽位:外壳由帧统一画,调用方只交外壳要的四格(档位、滚动容器、轨接线、正文)。 */
12
31
  export interface PanelTabDetail {
13
32
  readonly kind: ListDom['kind'];
@@ -27,9 +46,12 @@ export interface PanelTabFrameProps {
27
46
  readonly detailMounted: boolean;
28
47
  readonly listWidth: number;
29
48
  readonly handleProps: ColumnResizeHandleProps;
30
- /** 工具行的 DOM 身份(回收站档带 `trash-toolbar`,归档档的标识挂在它自己的工具行里)。 */
49
+ /** 工具行的 DOM 身份(回收站档 `trash-toolbar`、归档档 `archive-toolbar`):两档都交给帧这一层带,
50
+ * 档自己的视图件只交内容——再包一层自宽 flex 会按内容宽收缩,把检索框与视图开关压窄。 */
31
51
  readonly toolbarAttr?: string;
32
- readonly toolbar: ReactNode;
52
+ /** 工具行内容;`null` = 这一帧不画工具行({@link toolbarVisible} 判为退场)——容器一并省掉,
53
+ * 不留一条空行。 */
54
+ readonly toolbar: ReactNode | null;
33
55
  readonly list: ReactNode;
34
56
  readonly detail: PanelTabDetail;
35
57
  readonly footer: ReactNode;
@@ -68,7 +68,7 @@ export interface ReceiptSummary {
68
68
  /** 带**已归档**标记的落地条目(entry 域):撤销回「归档」而非会话列表,撤销文案据此改口(ADR-0060)。 */
69
69
  readonly landedArchivedIds: readonly string[];
70
70
  readonly anySuccess: boolean;
71
- /** purge / orphan-clean 的附件读数,按批相加;`skipped` 取第一条有的(不是可累加计数)。没有读数时缺席——不拿零冒充「清过」。 */
71
+ /** purge / orphan-clean 的附件读数,按批相加(成功回执 + 失败条 `details` 的同一格);`skipped` 按出现序分段去重后用 `ATTACHMENT_SKIPPED_SEPARATOR` 拼接。没有读数时缺席——不拿零冒充「清过」。 */
72
72
  readonly attachmentCleanup?: AttachmentCleanupWire;
73
73
  }
74
74
  /** 摘要派生的两样产物:聚合摘要与逐条失败原文(失败表只挂在成功支上,摘要不另存)。 */
@@ -1,4 +1,4 @@
1
- import { type ApplyAction, type ApplyOutcome, type ApplyValueByAction, type ArchiveDetailWire, type ArchiveListWire, type AttachmentCleanupWire, type AttachmentOrphanReportWire, type OrphanReportWire, type ProjectionCacheCleanupWire, type ProjectionCacheOrphanReportWire, type PurgeStatsWire, type RemoteFailure, type SessionDeleteConfigWire, type TrashDetailWire, type TrashRowWire, type WriteProgressWire } from '../shared/wire.js';
1
+ import { type ApplyAction, type ApplyOutcome, type ApplyValueByAction, type ArchiveDetailWire, type ArchiveListWire, type AttachmentCleanupWire, type AttachmentOrphanReportWire, type OrphanReportWire, type ProjectionCacheCleanupWire, type ProjectionCacheOrphanReportWire, type PurgeStatsWire, type RemoteFailure, type SearchPageWire, type SearchPreviewWire, type SearchScopeWire, type SessionDeleteConfigWire, type TrashDetailWire, type TrashRowWire, type WriteProgressWire } from '../shared/wire.js';
2
2
  /** 下面这些只读面都是 `shared/wire.ts` 的别名:形状的家只在那边(ADR-0003)。 */
3
3
  export type TrashEntryLike = TrashRowWire;
4
4
  export type PurgeResultLike = PurgeStatsWire;
@@ -8,6 +8,10 @@ export type TrashDetailLike = TrashDetailWire;
8
8
  export type ArchiveListLike = ArchiveListWire;
9
9
  /** 归档单条详情:基座 + sessionId,无 `entryId`;子会话段是只读投影,来源与回收站不同。 */
10
10
  export type ArchiveDetailLike = ArchiveDetailWire;
11
+ /** 检索一页:标题命中(首页即给全)+ 正文命中一页 + 续扫游标。 */
12
+ export type SearchPageLike = SearchPageWire;
13
+ /** 一条正文命中的窗口(前邻 / 命中 / 后邻)与本会话内命中序号。 */
14
+ export type SearchPreviewLike = SearchPreviewWire;
11
15
  /** 信封与失败形状的家在 `shared/wire.js`:浏览器半不补标记位、不抛失败(异常 → 失败面是 Node 半的活)。 */
12
16
  export type RemoteOutcome<T> = {
13
17
  ok: true;
@@ -39,6 +43,19 @@ export interface SessionDeleteRemote {
39
43
  archiveList(): Promise<RemoteOutcome<ArchiveListLike>>;
40
44
  /** 纯读:归档单条详情(subagent 闭包成员也行;寻址红线:只传 id)。 */
41
45
  archiveDetail(sessionId: string, before?: number, rootSessionId?: string): Promise<RemoteOutcome<ArchiveDetailLike>>;
46
+ /** 纯读:按查询串扫一档语料(`scope` 只用来选段名,见实现处的投影);`cursor` 缺省是首页,`null` 即扫完。 */
47
+ search(input: {
48
+ readonly scope: SearchScopeWire;
49
+ readonly query: string;
50
+ readonly cursor?: string;
51
+ }, signal?: AbortSignal): Promise<RemoteOutcome<SearchPageLike>>;
52
+ /** 纯读:一条正文命中的窗口;只服务正文命中,标题命中走 `detail`。 */
53
+ searchPreview(input: {
54
+ readonly scope: SearchScopeWire;
55
+ readonly query: string;
56
+ readonly rowId: string;
57
+ readonly messageIndex: number;
58
+ }, signal?: AbortSignal): Promise<RemoteOutcome<SearchPreviewLike>>;
42
59
  /** 一组 id 上的同一动作:顶层 `ok:false` 只表示整次调用没办成,单条成败住在 `ApplyOutcome` 里。 */
43
60
  applyOutcomes(action: ApplyAction, ids: readonly string[]): Promise<RemoteOutcome<ApplyOutcome[]>>;
44
61
  emptyTrash(): Promise<RemoteOutcome<PurgeResultLike>>;
@@ -74,7 +91,7 @@ export interface HttpRemoteOptions {
74
91
  * 鉴权归宿主 `/api` bridge(ADR-0033),凭据是宿主页面访问换来的 cookie,不是插件自己的秘密。
75
92
  */
76
93
  export declare function createHttpRemote(options?: HttpRemoteOptions): SessionDeleteRemote;
77
- /** 探测默认上限:5s。超时经 `AbortController` 打断 fetch,`activate` 不会永远吊在一条半开连接上。 */
94
+ /** 探测默认上限:5s。超时信号由 `AbortSignal.timeout` 产生,取数面把它转发给 fetch,`activate` 不会永远吊在一条半开连接上。 */
78
95
  export declare const PROBE_TIMEOUT_MS = 5000;
79
96
  /** 探测的可选覆盖:**生产不传**(只用 {@link PROBE_TIMEOUT_MS});存在只为让「超时算探测不过」在测试里跑到。 */
80
97
  export interface ProbeOptions {
@@ -83,6 +100,10 @@ export interface ProbeOptions {
83
100
  /**
84
101
  * 探测唯一通道:一次 `GET /ping` 回成功信封(`pong`)才注册入口;401/403 与任何失败都不装禁用态。
85
102
  * 往返有 5s 上限,超时与网络失败同样是「这一代不可用」,不自动重试(刷新才会再探);失败在 console 留原因。
103
+ *
104
+ * 上限用 `AbortSignal.timeout`(平台原语,2022 年起 widely available):这里没有「取消这一趟」的第二
105
+ * 个入口——探测是单发、无人回撤,`clearTimeout` 那一支也就没有必要。调用方 signal 仍由
106
+ * `requestOutcome` 转发(见那里的 relayAbort),两者互不替代。
86
107
  */
87
108
  export declare function probeChannel(deps: SessionDeleteRemote, options?: ProbeOptions): Promise<boolean>;
88
109
  /** N=1 的成功支:`value` 必然非空(null 已由 `readSingleReceipt` 折成协议错);成败只认 `RemoteOutcome.ok`(ADR-0053)。 */