@xrn1997/dsh-session-delete 0.3.1 → 0.4.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 (64) hide show
  1. package/README.md +20 -14
  2. package/lib/client.js +1686 -1053
  3. package/lib/index.js +1387 -771
  4. package/lib/types/api/attachment-orphans.d.ts +11 -0
  5. package/lib/types/api/attachment.d.ts +23 -0
  6. package/lib/types/api/dispatch.d.ts +9 -29
  7. package/lib/types/api/request-trust.d.ts +45 -0
  8. package/lib/types/api/route-table.d.ts +28 -14
  9. package/lib/types/client/attachment-view.d.ts +27 -0
  10. package/lib/types/client/batch-bar.d.ts +1 -1
  11. package/lib/types/client/batch-confirm.d.ts +2 -2
  12. package/lib/types/client/batch-menu-item.d.ts +1 -1
  13. package/lib/types/client/batch-select.d.ts +1 -1
  14. package/lib/types/client/confirm-close.d.ts +11 -0
  15. package/lib/types/client/copy.d.ts +48 -38
  16. package/lib/types/client/delete-confirm.d.ts +0 -2
  17. package/lib/types/client/main-view.d.ts +1 -1
  18. package/lib/types/client/maintenance-parts.d.ts +25 -0
  19. package/lib/types/client/maintenance-settings.d.ts +22 -0
  20. package/lib/types/client/markdown.d.ts +9 -1
  21. package/lib/types/client/orphan-maintenance.d.ts +29 -11
  22. package/lib/types/client/receipt.d.ts +42 -2
  23. package/lib/types/client/remote.d.ts +32 -48
  24. package/lib/types/client/trash-confirm.d.ts +2 -15
  25. package/lib/types/client/trash-panel.d.ts +4 -3
  26. package/lib/types/client/ui/Checkbox.d.ts +1 -1
  27. package/lib/types/client/ui/Modal.d.ts +2 -2
  28. package/lib/types/client/ui/icons.d.ts +6 -11
  29. package/lib/types/client/ui/top-layer.d.ts +10 -0
  30. package/lib/types/client/undo-notices.d.ts +52 -0
  31. package/lib/types/client/undo-toast.d.ts +5 -59
  32. package/lib/types/client/use-column-resize.d.ts +9 -20
  33. package/lib/types/client/use-maintenance.d.ts +45 -0
  34. package/lib/types/client/use-panel-width.d.ts +1 -1
  35. package/lib/types/client/use-trash-panel-controller.d.ts +24 -7
  36. package/lib/types/client/use-trash-query.d.ts +35 -32
  37. package/lib/types/client/write-seats.d.ts +5 -13
  38. package/lib/types/client/write-settlement.d.ts +10 -16
  39. package/lib/types/client/write.d.ts +8 -5
  40. package/lib/types/deps.d.ts +18 -7
  41. package/lib/types/index.d.ts +6 -2
  42. package/lib/types/log/session-log.d.ts +4 -3
  43. package/lib/types/log/zstd-frames.d.ts +14 -8
  44. package/lib/types/ports/agent-handles.d.ts +1 -1
  45. package/lib/types/ports/connection-port.d.ts +33 -0
  46. package/lib/types/ports/fs-port.d.ts +13 -1
  47. package/lib/types/ports/host-port.d.ts +17 -45
  48. package/lib/types/ports/presence-port.d.ts +22 -0
  49. package/lib/types/shared/wire.d.ts +70 -26
  50. package/lib/types/trash/attachments.d.ts +85 -0
  51. package/lib/types/trash/detail.d.ts +28 -8
  52. package/lib/types/trash/entry.d.ts +3 -3
  53. package/lib/types/trash/groups.d.ts +4 -11
  54. package/lib/types/trash/storage-manifest.d.ts +1 -1
  55. package/lib/types/verbs/delete-session.d.ts +2 -2
  56. package/lib/types/verbs/errors.d.ts +2 -0
  57. package/lib/types/verbs/live-admission.d.ts +4 -7
  58. package/lib/types/verbs/member-journal.d.ts +3 -4
  59. package/lib/types/verbs/member-presence.d.ts +14 -37
  60. package/lib/types/verbs/orphan-subagents.d.ts +9 -8
  61. package/lib/types/verbs/permanent-removal.d.ts +24 -18
  62. package/lib/types/verbs/purge-trash.d.ts +8 -3
  63. package/lib/types/verbs/restore-session.d.ts +7 -13
  64. package/package.json +2 -1
@@ -1,5 +1,6 @@
1
1
  import type { TrashEntry } from '../trash/entry.js';
2
- import type { CoreDeps } from '../deps.js';
2
+ import type { RemovalDeps } from '../deps.js';
3
+ import type { AttachmentCleanupWire } from '../shared/wire.js';
3
4
  /**
4
5
  * 彻底删除:从回收站里**真的**抹掉一条(或整组、或整站),并连带那些"还留在盘上、没被带走"的后代。
5
6
  *
@@ -12,11 +13,14 @@ import type { CoreDeps } from '../deps.js';
12
13
  * 再摘账本、最后删目录"的顺序都住 `verbs/permanent-removal.ts`——计划只读,执行器只写,计划就是
13
14
  * 执行前的闸(别在这里再长出一段手写步骤)。
14
15
  *
15
- * **这条动词不做回滚**:目录删掉就没有"退回去"这回事(2026-10-19 `f2a7757`:删到一半失败时已删目录不回滚;
16
+ * **这条动词不做回滚**:目录删掉就没有"退回去"这回事(删到一半失败时已删目录不回滚;
16
17
  * 带部分计数的 `details` 回执只属于 `orphan-clean`,purge 的 `removed` / `freedBytes` 仍只在成功回执里给)。
17
18
  * 对应地,`kind:'trash'` 的计划失败时执行器只抛那一步的 `io` 与原文、不带 details。
19
+ *
20
+ * 回执里的 `attachments` 原样来自执行器:独占图片在会话目录删完之后才清,附件失败只计数、不改
21
+ * `removed` / `freedBytes`(`skipped` = 有候选或剩余引用源读不出、这一轮部分或整体没清,原因上屏)。
18
22
  */
19
- export declare function purgeTrash(deps: CoreDeps): (
23
+ export declare function purgeTrash(deps: RemovalDeps): (
20
24
  /** 这一组(只读);`undefined` = 清空。批量层由 `batch-carried.ts` 的 `claimOf` 给出,直调者
21
25
  * 按 `trash/groups.ts` 的 `groupOf` 自己算;ghost 父的组只有孩子(不含 `requestedId`),照样清
22
26
  * 这一组。 */
@@ -27,4 +31,5 @@ rows: readonly TrashEntry[],
27
31
  requestedId?: string) => Promise<{
28
32
  removed: number;
29
33
  freedBytes: number;
34
+ attachments: AttachmentCleanupWire;
30
35
  }>;
@@ -2,21 +2,15 @@ import { type TrashEntry } from '../trash/entry.js';
2
2
  import { type HostIdentityPort } from '../ports/host-port.js';
3
3
  import type { CoreDeps } from '../deps.js';
4
4
  /**
5
- * 恢复 = 把删除那次**按原路退回**,而且按组走:当年是按组一起搬进来的(父 + 它在盘上的孩子),
6
- * 只回父就会在回收站里留下一堆点不到的孩子行——清单只列父行,那些行既看不见也清不掉。
5
+ * 恢复:把删除那次按原路退回,并按组走。
7
6
  *
8
- * 三段与删除对称(成员循环与整组回滚的实现住 `verbs/move-group.ts`):
9
- * ① **预检整组**(一个字节都不写):每个成员的回收站目录与项目目录都得在。缺席的判据与原来一致
10
- * (回收站目录不在 = `trash-empty`;原项目目录不在 = `project-missing`,且绝不静默建目录)。
11
- * 预检在写之前,是为了不让"父已经回到 `sessions/`、孩子因为项目目录没了而回不去"这种半组留在外面。
12
- * **工作区账本不在这条硬前提里**:宿主的「删除工作区」只删注册、保留日志,记下的工作区没了就按
13
- * 「未分组」收(判据在 {@link attachableWorkspaceId}),照旧回盘——恢复是加法,不该因为一个可选的账目而失败。
14
- * ② **逐个恢复**,顺序与删除相反:文件先回来 → 挂账本 →(旧清单迁移)取消归档 → 摘清册行。
15
- * ③ 中途失败时 journal 把这个成员自己退回回收站;**已经恢复完的**兄弟由整组 catch 按相反顺序一起退回。
7
+ * 三段:
8
+ * 1. 预检整组(不写盘):每个成员的回收站目录与原项目目录都必须在;工作区账本缺席不算硬失败,
9
+ * 恢复后归入「未分组」。预检在任何写之前,避免留下半组。
10
+ * 2. 逐个恢复:文件先回来 → 挂账本 →(旧条目)取消归档 → 摘清册行。
11
+ * 3. 中途失败由 journal 回滚当前成员;已恢复的兄弟由整组按相反顺序退回。
16
12
  *
17
- * **通告不在这里**:一次批量只该拉一遍宿主会话表、只发一次 `api-session/added`(2026-10-17 那次
18
- * "恢复很慢"就是逐条发)。通告归 `verbs/batch.ts`(ADR-0002),所以这个动词的 interface 是
19
- * "一个条目 id + 这一组进、回收站那一行出",没有批量专用的开关。
13
+ * 通告不在本文件:批量层在批尾一次 `announceRestored(ids)`(ADR-0002)。
20
14
  */
21
15
  export declare function restoreSession(deps: CoreDeps): (entryId: string,
22
16
  /** 这一组(只读):批量层由 `batch-carried.ts` 的 `claimOf` 给出,直调者按 `trash/groups.ts`
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@xrn1997/dsh-session-delete",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "在 DeepSeek Harness 里删除会话:删除=移入回收站(可恢复),另设显式彻底删除",
5
5
  "type": "module",
6
+ "packageManager": "pnpm@11.25.0",
6
7
  "main": "lib/index.js",
7
8
  "types": "lib/types/index.d.ts",
8
9
  "exports": {