@xrn1997/dsh-session-delete 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/README.md +134 -173
  2. package/THIRD_PARTY_NOTICES.md +4 -2
  3. package/docs/DETAIL.md +1 -0
  4. package/docs/DETAIL.zh.md +1 -0
  5. package/docs/preview.svg +119 -0
  6. package/docs/preview.zh.svg +117 -0
  7. package/docs/screenshots/screenshot-01.png +0 -0
  8. package/lib/client.js +28630 -26493
  9. package/lib/index.js +2913 -1620
  10. package/lib/types/api/archive-rows.d.ts +7 -0
  11. package/lib/types/api/attachment-orphans.d.ts +3 -9
  12. package/lib/types/api/attachment.d.ts +4 -18
  13. package/lib/types/api/connection-route.d.ts +2 -6
  14. package/lib/types/api/route-table.d.ts +79 -31
  15. package/lib/types/api/trash-rows.d.ts +6 -22
  16. package/lib/types/client/api-base.d.ts +5 -12
  17. package/lib/types/client/archive-detail.d.ts +19 -0
  18. package/lib/types/client/archive-pane.d.ts +63 -0
  19. package/lib/types/client/archive-store.d.ts +10 -0
  20. package/lib/types/client/attachment-view.d.ts +3 -17
  21. package/lib/types/client/batch-bar.d.ts +4 -14
  22. package/lib/types/client/batch-confirm.d.ts +21 -17
  23. package/lib/types/client/batch-menu-item.d.ts +2 -10
  24. package/lib/types/client/batch-pick.d.ts +6 -13
  25. package/lib/types/client/batch-select.d.ts +10 -25
  26. package/lib/types/client/batch-selection-store.d.ts +21 -9
  27. package/lib/types/client/busy-gate.d.ts +2 -4
  28. package/lib/types/client/config-settings.d.ts +2 -3
  29. package/lib/types/client/confirm-dialog.d.ts +5 -8
  30. package/lib/types/client/context-menu-actions.d.ts +2 -8
  31. package/lib/types/client/context.d.ts +6 -15
  32. package/lib/types/client/copy.d.ts +86 -57
  33. package/lib/types/client/delete-confirm.d.ts +25 -13
  34. package/lib/types/client/delete-menu-item.d.ts +5 -9
  35. package/lib/types/client/detail-blocks.d.ts +5 -6
  36. package/lib/types/client/detail-ledger.d.ts +19 -0
  37. package/lib/types/client/detail-pane.d.ts +28 -0
  38. package/lib/types/client/host-archive-watch.d.ts +9 -0
  39. package/lib/types/client/host-rows.d.ts +32 -36
  40. package/lib/types/client/index.d.ts +5 -19
  41. package/lib/types/client/main-view.d.ts +25 -34
  42. package/lib/types/client/maintenance-parts.d.ts +2 -4
  43. package/lib/types/client/maintenance-settings.d.ts +3 -12
  44. package/lib/types/client/markdown.d.ts +4 -9
  45. package/lib/types/client/notice.d.ts +13 -0
  46. package/lib/types/client/orphan-maintenance.d.ts +8 -20
  47. package/lib/types/client/panel-tab.d.ts +39 -0
  48. package/lib/types/client/pending-open.d.ts +0 -1
  49. package/lib/types/client/plugin.d.ts +2 -4
  50. package/lib/types/client/prompt-rail.d.ts +1 -2
  51. package/lib/types/client/receipt.d.ts +14 -41
  52. package/lib/types/client/remote.d.ts +53 -88
  53. package/lib/types/client/scene.d.ts +41 -0
  54. package/lib/types/client/session-detail.d.ts +64 -0
  55. package/lib/types/client/session-list.d.ts +78 -0
  56. package/lib/types/client/session-live.d.ts +3 -13
  57. package/lib/types/client/settings-cards.d.ts +3 -6
  58. package/lib/types/client/settings-view.d.ts +1 -7
  59. package/lib/types/client/store.d.ts +6 -25
  60. package/lib/types/client/subagent-section.d.ts +36 -0
  61. package/lib/types/client/trash-confirm.d.ts +8 -9
  62. package/lib/types/client/trash-detail.d.ts +12 -66
  63. package/lib/types/client/trash-entry.d.ts +1 -1
  64. package/lib/types/client/trash-nav.d.ts +12 -18
  65. package/lib/types/client/trash-panel.d.ts +4 -6
  66. package/lib/types/client/trash-snapshot.d.ts +33 -41
  67. package/lib/types/client/trash-store.d.ts +12 -4
  68. package/lib/types/client/trash-tab.d.ts +22 -0
  69. package/lib/types/client/trash-view.d.ts +50 -50
  70. package/lib/types/client/ui/ErrorBoundary.d.ts +33 -0
  71. package/lib/types/client/ui/Modal.d.ts +3 -1
  72. package/lib/types/client/ui/Toast.d.ts +6 -3
  73. package/lib/types/client/ui/icons.d.ts +10 -4
  74. package/lib/types/client/undo-notices.d.ts +51 -20
  75. package/lib/types/client/undo-toast.d.ts +6 -9
  76. package/lib/types/client/use-archive-detail-reader.d.ts +27 -0
  77. package/lib/types/client/use-archive-panel-controller.d.ts +44 -0
  78. package/lib/types/client/use-archive-query.d.ts +31 -0
  79. package/lib/types/client/use-column-resize.d.ts +4 -11
  80. package/lib/types/client/use-detail-frame.d.ts +50 -0
  81. package/lib/types/client/use-detail-pager.d.ts +5 -13
  82. package/lib/types/client/use-detail-rail.d.ts +39 -0
  83. package/lib/types/client/use-detail-reader.d.ts +60 -0
  84. package/lib/types/client/use-gated-refresh.d.ts +27 -0
  85. package/lib/types/client/{use-trash-selection.d.ts → use-list-selection.d.ts} +16 -15
  86. package/lib/types/client/use-maintenance-section.d.ts +7 -12
  87. package/lib/types/client/use-maintenance.d.ts +11 -13
  88. package/lib/types/client/use-panel-child-view.d.ts +20 -0
  89. package/lib/types/client/use-panel-list-read.d.ts +51 -0
  90. package/lib/types/client/use-panel-selection.d.ts +36 -0
  91. package/lib/types/client/use-panel-tab.d.ts +134 -0
  92. package/lib/types/client/use-panel-width.d.ts +3 -11
  93. package/lib/types/client/use-prompt-rail.d.ts +8 -28
  94. package/lib/types/client/use-trash-detail-reader.d.ts +10 -23
  95. package/lib/types/client/use-trash-panel-controller.d.ts +17 -37
  96. package/lib/types/client/use-trash-query.d.ts +9 -25
  97. package/lib/types/client/use-write-progress.d.ts +26 -0
  98. package/lib/types/client/write-progress.d.ts +18 -0
  99. package/lib/types/client/write-seats.d.ts +64 -34
  100. package/lib/types/config.d.ts +8 -25
  101. package/lib/types/deps.d.ts +8 -10
  102. package/lib/types/domain/closure.d.ts +11 -30
  103. package/lib/types/errors.d.ts +21 -0
  104. package/lib/types/index.d.ts +9 -32
  105. package/lib/types/log/session-log.d.ts +42 -14
  106. package/lib/types/log/zstd-frames.d.ts +10 -25
  107. package/lib/types/ports/agent-handles.d.ts +10 -19
  108. package/lib/types/ports/attachments-port.d.ts +2 -6
  109. package/lib/types/ports/fs-port.d.ts +22 -24
  110. package/lib/types/ports/home.d.ts +7 -15
  111. package/lib/types/ports/host-port.d.ts +96 -59
  112. package/lib/types/ports/presence-port.d.ts +5 -12
  113. package/lib/types/remote/map-error.d.ts +4 -17
  114. package/lib/types/shared/apply-actions.d.ts +36 -0
  115. package/lib/types/shared/apply-values.d.ts +163 -0
  116. package/lib/types/shared/project-key.d.ts +5 -23
  117. package/lib/types/shared/session-path.d.ts +10 -0
  118. package/lib/types/shared/value-schema.d.ts +54 -0
  119. package/lib/types/shared/wire.d.ts +243 -197
  120. package/lib/types/trash/archive-detail.d.ts +16 -0
  121. package/lib/types/trash/attachments.d.ts +60 -43
  122. package/lib/types/trash/detail.d.ts +30 -26
  123. package/lib/types/trash/display-name.d.ts +2 -5
  124. package/lib/types/trash/entry.d.ts +22 -32
  125. package/lib/types/trash/groups.d.ts +17 -25
  126. package/lib/types/trash/ledger.d.ts +5 -9
  127. package/lib/types/trash/manifest.d.ts +4 -6
  128. package/lib/types/trash/projection-cache.d.ts +18 -0
  129. package/lib/types/trash/reconcile.d.ts +13 -23
  130. package/lib/types/trash/session-rows.d.ts +63 -0
  131. package/lib/types/trash/shrinking-view.d.ts +29 -0
  132. package/lib/types/trash/storage-manifest.d.ts +4 -7
  133. package/lib/types/trash/subagent-summary.d.ts +35 -0
  134. package/lib/types/verbs/batch-carried.d.ts +22 -2
  135. package/lib/types/verbs/batch.d.ts +39 -2
  136. package/lib/types/verbs/config.d.ts +3 -11
  137. package/lib/types/verbs/delete-session.d.ts +8 -13
  138. package/lib/types/verbs/empty-batch.d.ts +18 -0
  139. package/lib/types/verbs/live-admission.d.ts +3 -5
  140. package/lib/types/verbs/member-journal.d.ts +3 -7
  141. package/lib/types/verbs/member-presence.d.ts +7 -18
  142. package/lib/types/verbs/move-group.d.ts +2 -6
  143. package/lib/types/verbs/orphan-subagents.d.ts +23 -36
  144. package/lib/types/verbs/permanent-removal.d.ts +98 -81
  145. package/lib/types/verbs/restore-session.d.ts +10 -24
  146. package/lib/types/verbs/trash-scope.d.ts +21 -29
  147. package/lib/types/verbs/write-progress.d.ts +37 -0
  148. package/locale/en.json +7 -6
  149. package/locale/zh.json +2 -1
  150. package/package.json +135 -128
  151. package/lib/types/client/confirm-close.d.ts +0 -14
  152. package/lib/types/client/reset-client-state.d.ts +0 -1
  153. package/lib/types/client/write-settlement.d.ts +0 -66
  154. package/lib/types/client/write.d.ts +0 -66
  155. package/lib/types/verbs/errors.d.ts +0 -27
package/package.json CHANGED
@@ -1,128 +1,135 @@
1
- {
2
- "name": "@xrn1997/dsh-session-delete",
3
- "version": "0.8.0",
4
- "description": "在 DeepSeek Harness 里删除会话:删除=移入回收站(可恢复),另设显式彻底删除",
5
- "type": "module",
6
- "packageManager": "pnpm@11.25.0",
7
- "main": "lib/index.js",
8
- "types": "lib/types/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./lib/types/index.d.ts",
12
- "default": "./lib/index.js"
13
- },
14
- "./client": {
15
- "types": "./lib/types/client/index.d.ts",
16
- "default": "./lib/client.js"
17
- },
18
- "./locale/*.json": "./locale/*.json",
19
- "./package.json": "./package.json"
20
- },
21
- "icon": "./icon.svg",
22
- "files": [
23
- "lib/index.js",
24
- "lib/client.js",
25
- "lib/types/**/*.d.ts",
26
- "locale",
27
- "icon.svg",
28
- "cordis.patch.yml",
29
- "README.md",
30
- "LICENSE",
31
- "THIRD_PARTY_NOTICES.md",
32
- "docs/screenshots"
33
- ],
34
- "engines": {
35
- "node": ">=24",
36
- "dsh": ">=0.1.7-rc.2 <0.3.0-0"
37
- },
38
- "scripts": {
39
- "build": "tsdown && tsc -p tsconfig.build.json",
40
- "typecheck": "tsc --noEmit",
41
- "lint": "eslint .",
42
- "test": "vitest run",
43
- "test:watch": "vitest",
44
- "pack:dry": "npm pack --dry-run --ignore-scripts",
45
- "prepack": "npm run build",
46
- "gates": "pnpm typecheck && pnpm lint && pnpm test && pnpm build && pnpm run pack:dry"
47
- },
48
- "peerDependencies": {
49
- "react": "^18.3.1",
50
- "react-dom": "18.3.1"
51
- },
52
- "peerDependenciesMeta": {
53
- "react": {
54
- "optional": true
55
- },
56
- "react-dom": {
57
- "optional": true
58
- }
59
- },
60
- "devDependencies": {
61
- "@deepseek-ai/cordis": "^4.0.4",
62
- "@eslint/js": "^10.0.1",
63
- "@testing-library/dom": "^10.4.2",
64
- "@testing-library/jest-dom": "^6.10.0",
65
- "@testing-library/react": "^16.3.3",
66
- "@types/node": "24.19.0",
67
- "@types/react": "18.3.31",
68
- "@types/react-dom": "18.3.5",
69
- "@types/semver": "^7.8.0",
70
- "eslint": "^10.14.0",
71
- "eslint-plugin-react-hooks": "^7.1.1",
72
- "globals": "^17.13.0",
73
- "jsdom": "^26.1.0",
74
- "react": "^18.3.1",
75
- "react-dom": "18.3.1",
76
- "react-markdown": "^10.1.0",
77
- "remark-gfm": "^4.0.1",
78
- "semver": "^7.8.5",
79
- "tsdown": "0.23.0",
80
- "typescript": "5.9.3",
81
- "typescript-eslint": "^8.72.1",
82
- "vitest": "3.2.7"
83
- },
84
- "dsh": {
85
- "manifestVersion": 1,
86
- "bundle": {
87
- "patch": "./cordis.patch.yml"
88
- },
89
- "client": {
90
- "inject": [
91
- "@deepseek-ai/dsh-client-locale",
92
- "@deepseek-ai/dsh-client-ui-context-menu"
93
- ],
94
- "platform": "web"
95
- }
96
- },
97
- "xrn1997": {
98
- "dshReleases": {
99
- "0.2.0-rc.2": "compatible",
100
- "0.2.1-rc.1": "compatible",
101
- "0.2.1-rc.2": "compatible",
102
- "0.2.1-rc.3": "compatible",
103
- "0.2.1-rc.5": "compatible",
104
- "0.2.2-rc.1": "compatible"
105
- }
106
- },
107
- "publishConfig": {
108
- "access": "public"
109
- },
110
- "repository": {
111
- "type": "git",
112
- "url": "git+https://github.com/xrn1997/dsh-session-delete.git"
113
- },
114
- "homepage": "https://github.com/xrn1997/dsh-session-delete#readme",
115
- "bugs": {
116
- "url": "https://github.com/xrn1997/dsh-session-delete/issues"
117
- },
118
- "keywords": [
119
- "dsh",
120
- "deepseek-harness",
121
- "plugin",
122
- "session",
123
- "trash",
124
- "delete"
125
- ],
126
- "author": "xrn1997",
127
- "license": "Apache-2.0"
128
- }
1
+ {
2
+ "name": "@xrn1997/dsh-session-delete",
3
+ "version": "0.10.0",
4
+ "description": "在 DeepSeek Harness 里删除会话:删除=移入回收站(可恢复),另设显式彻底删除",
5
+ "type": "module",
6
+ "packageManager": "pnpm@11.25.0",
7
+ "main": "lib/index.js",
8
+ "types": "lib/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./lib/types/index.d.ts",
12
+ "default": "./lib/index.js"
13
+ },
14
+ "./client": {
15
+ "types": "./lib/types/client/index.d.ts",
16
+ "default": "./lib/client.js"
17
+ },
18
+ "./locale/*.json": "./locale/*.json",
19
+ "./package.json": "./package.json"
20
+ },
21
+ "icon": "./icon.svg",
22
+ "files": [
23
+ "lib/index.js",
24
+ "lib/client.js",
25
+ "lib/types/**/*.d.ts",
26
+ "locale",
27
+ "icon.svg",
28
+ "cordis.patch.yml",
29
+ "README.md",
30
+ "LICENSE",
31
+ "THIRD_PARTY_NOTICES.md",
32
+ "docs/screenshots",
33
+ "docs/DETAIL.zh.md",
34
+ "docs/DETAIL.md",
35
+ "docs/preview.zh.svg",
36
+ "docs/preview.svg"
37
+ ],
38
+ "engines": {
39
+ "node": ">=24",
40
+ "dsh": ">=0.1.7-rc.2 <0.3.0-0"
41
+ },
42
+ "scripts": {
43
+ "build": "tsdown && tsc -p tsconfig.build.json",
44
+ "typecheck": "tsc --noEmit",
45
+ "lint": "eslint .",
46
+ "test": "vitest run",
47
+ "test:watch": "vitest",
48
+ "pack:dry": "node scripts/verify-pack.mjs",
49
+ "prepack": "npm run build",
50
+ "gates": "pnpm typecheck && pnpm lint && pnpm test && pnpm build && pnpm run pack:dry"
51
+ },
52
+ "peerDependencies": {
53
+ "react": "^18.3.1",
54
+ "react-dom": "18.3.1"
55
+ },
56
+ "peerDependenciesMeta": {
57
+ "react": {
58
+ "optional": true
59
+ },
60
+ "react-dom": {
61
+ "optional": true
62
+ }
63
+ },
64
+ "devDependencies": {
65
+ "@deepseek-ai/cordis": "^4.0.4",
66
+ "@eslint/js": "^10.0.1",
67
+ "@testing-library/dom": "^10.4.2",
68
+ "@testing-library/jest-dom": "^6.10.0",
69
+ "@testing-library/react": "^16.3.3",
70
+ "@types/node": "24.19.0",
71
+ "@types/react": "18.3.31",
72
+ "@types/react-dom": "18.3.5",
73
+ "@types/semver": "^7.8.0",
74
+ "eslint": "^10.14.0",
75
+ "eslint-plugin-react-hooks": "^7.1.1",
76
+ "globals": "^17.13.0",
77
+ "jsdom": "^26.1.0",
78
+ "react": "^18.3.1",
79
+ "react-dom": "18.3.1",
80
+ "react-markdown": "^10.1.0",
81
+ "remark-gfm": "^4.0.1",
82
+ "semver": "^7.8.5",
83
+ "tsdown": "0.23.0",
84
+ "typescript": "5.9.3",
85
+ "typescript-eslint": "^8.72.1",
86
+ "vitest": "3.2.7"
87
+ },
88
+ "dsh": {
89
+ "manifestVersion": 1,
90
+ "bundle": {
91
+ "patch": "./cordis.patch.yml"
92
+ },
93
+ "client": {
94
+ "inject": [
95
+ "@deepseek-ai/dsh-client-locale",
96
+ "@deepseek-ai/dsh-client-ui-context-menu"
97
+ ],
98
+ "platform": "web"
99
+ }
100
+ },
101
+ "xrn1997": {
102
+ "dshReleases": {
103
+ "0.2.0-rc.2": "compatible",
104
+ "0.2.1-rc.1": "compatible",
105
+ "0.2.1-rc.2": "compatible",
106
+ "0.2.1-rc.3": "compatible",
107
+ "0.2.1-rc.5": "compatible",
108
+ "0.2.2-rc.1": "compatible",
109
+ "0.2.2-rc.2": "compatible",
110
+ "0.2.2-rc.3": "compatible",
111
+ "0.2.2-rc.5": "compatible"
112
+ }
113
+ },
114
+ "publishConfig": {
115
+ "access": "public"
116
+ },
117
+ "repository": {
118
+ "type": "git",
119
+ "url": "git+https://github.com/xrn1997/dsh-session-delete.git"
120
+ },
121
+ "homepage": "https://github.com/xrn1997/dsh-session-delete#readme",
122
+ "bugs": {
123
+ "url": "https://github.com/xrn1997/dsh-session-delete/issues"
124
+ },
125
+ "keywords": [
126
+ "dsh",
127
+ "deepseek-harness",
128
+ "plugin",
129
+ "session",
130
+ "trash",
131
+ "delete"
132
+ ],
133
+ "author": "xrn1997",
134
+ "license": "Apache-2.0"
135
+ }
@@ -1,14 +0,0 @@
1
- /** 写入在飞时,确认框的关闭/取消都拦住:一次批量在飞时关掉框,用户会以为"没动",而它其实正在动。
2
- * 各张确认框(单删 / 批量删除 / 回收站恢复与彻底删除 / 孤儿会话清理 / 孤儿附件清理)共用这一条规则;
3
- * `Modal` 的遮罩 / X / Esc 都走同一个 `onClose`。
4
- *
5
- * 返回的 `closeDisabled` 与 `close` 同源:取消键的置灰读数也从这里取,各组件不再各写一遍
6
- * `disabled={busy}`——否则"拦住"这件事会有两个判据。 */
7
- export interface IdleClose {
8
- /** 属性声明而不是方法简写:实现体不读 `this`,调用方会把 `close` 摘下来直接交给 `Modal`/
9
- * `Button`(`onClose={close}`);方法简写会给它隐式 `this: IdleClose`,`unbound-method`
10
- * 就会把这种正常交接报成可疑。形状仍是同一个函数,零运行时改动。 */
11
- close: () => void;
12
- readonly closeDisabled: boolean;
13
- }
14
- export declare function useIdleClose(busy: boolean, onClose: () => void): IdleClose;
@@ -1 +0,0 @@
1
- export declare function resetClientState(): void;
@@ -1,66 +0,0 @@
1
- /**
2
- * 一次逐条 `/apply` 写入成功后的**收尾顺序**,按 action 各一条固定序列。
3
- *
4
- * 调用方只交呈现材质(`WritePresentation`),顺序与 `anySuccess` 门只住这里;`runWrite` 在拿到
5
- * `WriteSuccess` 后、`refresh` 前调一次。为什么按 action 收成一处见 ADR-0013。
6
- *
7
- * 四条判据:
8
- * - **跨槽位在信封成功时就跑**:`afterDelete` / `afterRestore` 与 `invalidate` 不管逐条成败都跑
9
- * (回滚失败可能留下半套,回收站清单不能继续摆旧行);呈现钩子(发布/熄灭撤销、遗忘主视图、
10
- * 清详情账本)只在至少一条落地(`anySuccess`)时跑——没有落点的撤销是假动作。delete 的撤销
11
- * 另要求落地名单非空:全部被同批前一条带走时没有可撤销的条目。
12
- * - **面板恢复用 `panelSeat: true` 明说**(「缺席」不再承载语义):外部恢复(撤销横幅)由 settlement
13
- * 调 `afterRestore` 重开;面板恢复自带「回来」的结算,只 `forgetMainView`、不重开、不抢焦点。
14
- * 判据住 `src/client/main-view.ts` 的 `forgetMainView`。
15
- * - **撤销名单由摘要给、座位发布**:delete 支从 `summary.landedIds`(域是条目 id)取名单、用
16
- * `summary.successIds.length` 作条数,组成 `{ entryIds, n }` 交给座位,座位只决定发布哪一形
17
- * (单条带标题、批量带条数)——那句文案与它的键住 `undo-toast.tsx` 与 `copy.ts`;purge 支在
18
- * `anySuccess` 时熄灭指向这些条目的横幅——留着就是一条注定失败的「撤销」。
19
- * - **`count` 不结算**;`orphan-clean` 没有跨槽位收尾(维护卡的 `use-maintenance.ts` 清完自己重查)。
20
- * 不直接读 DOM、不问宿主:主视图收尾只经 `main-view.ts` 的 `afterDelete` / `afterRestore`
21
- * (服务缺席或抛错都静默退回);重读仍归各调用方的 `refresh`(面板那侧的最新票在 `use-trash-query.ts`)。
22
- */
23
- import type { ApplyAction } from '../shared/wire.js';
24
- import type { ReceiptSummary } from './receipt.js';
25
- /** 一次写入里与渲染无关的那部分:动作、请求 id、以及唯一的那份回执摘要。 */
26
- export interface SettledFacts<A extends ApplyAction> {
27
- readonly action: A;
28
- readonly ids: readonly string[];
29
- readonly summary: ReceiptSummary;
30
- }
31
- /**
32
- * 按 action 切开的一族呈现材质:每个座位只能拿到自己动作那几手,形状对不上的钩子在类型面就不存在。
33
- * - `delete` 的 `publishUndo` 存在即「这个座位要发撤销横幅」;它拿到的是 settlement 从摘要取出并组好的落地名单。
34
- * - `restore` 的 `panelSeat: true` 才是「面板已替这条完成『回来』的结算」,不再靠缺席某个钩子暗示。
35
- * - `count` / `orphan-clean` 没有呈现材质(用 `noPresentation`)。
36
- * 钩子都是同步的:settlement 在 `refresh` 前一次跑完,不 await。
37
- */
38
- export type WritePresentationByAction = {
39
- delete: {
40
- /** 外部写入座位:让回收站面板重读。面板写不传(自己的清单重读 `reload` 不走这条通告)。 */
41
- invalidate?(): void;
42
- /** 撤销发布:settlement 从回执摘要取出落地条目 id 与请求名单、组好形之后交来;名单**非空**——
43
- * 全被同批前一条带走时没有落点,settlement 不发布没有可撤销动作的横幅。座位只决定发布哪一形与那一形带的标题。 */
44
- publishUndo?(landed: {
45
- readonly entryIds: readonly [string, ...string[]];
46
- readonly n: number;
47
- }): void;
48
- };
49
- restore: {
50
- invalidate?(): void;
51
- /** 面板恢复座位:true = 面板已替这条完成「回来」的结算,只遗忘、不重开、不抢焦点。 */
52
- panelSeat?: true;
53
- dismissUndo?(entryIds: readonly string[]): void;
54
- forgetTrashDetails?(entryIds: readonly string[]): void;
55
- };
56
- purge: {
57
- dismissUndo?(entryIds: readonly string[]): void;
58
- forgetTrashDetails?(entryIds: readonly string[]): void;
59
- };
60
- count: Record<string, never>;
61
- 'orphan-clean': Record<string, never>;
62
- };
63
- export type WritePresentation<A extends ApplyAction> = WritePresentationByAction[A];
64
- /** 没有呈现材质的座位用它:抛掉按 action 的联合,调用点不用各自造一个空对象字面量。 */
65
- export declare function noPresentation<A extends ApplyAction>(action: A): WritePresentation<A>;
66
- export declare function settleWrite<A extends ApplyAction>(success: SettledFacts<A>, presentation: WritePresentation<A>): void;
@@ -1,66 +0,0 @@
1
- /**
2
- * 一次逐条 `/apply` 写入的**唯一生命周期**:apply → 解信封 → `readReceipt` → 回执摘要 → settlement → refresh。
3
- *
4
- * 收尾顺序与 `anySuccess` 门住 `src/client/write-settlement.ts`(为什么按 action 收见 ADR-0013);
5
- * 这里只管时机、信封判读、整趟的闸与 `refresh` 的交法。清空回收站是聚合回执(`/empty`),收尾仍住
6
- * `use-trash-query.ts` 的 `emptyTrash`。
7
- *
8
- * 五条判据:
9
- * - `ok` 只说**信封**成不成;逐条成败在 `failures` 里,调用方自己决定怎么上屏。
10
- * - 顶层失败把同一句原文铺到每个 id,不结算;`refresh` 照样交(成败都在 outcome 里)。
11
- * - **信封成功就结算**(逐条全失败也跑:批量写入的失效通告不能漏);`anySuccess` 与落地名单由
12
- * `receipt.ts` 的回执摘要算好,settlement 按它上闸。调用方只交呈现材质,再按 `outcome` 决定是否真的重读。
13
- * 结算在 `refresh` 之前:列表重读看得到收尾后的现场。
14
- * - `single: true` 时把 N=1 模式交给 `receipt.ts` 的读法;单条 null 在那一处折成 failed,
15
- * 这里不再重复守卫。
16
- * - **闸包住整趟**:给了 `gate` 就把 apply → settle → refresh 一起包进去——refresh 落在闸外时,
17
- * 旧清单还在屏上,同一个动作能被再点一次;调用方不再自己 `around`。同一枚闸已有任务在飞时
18
- * 这一趟**不跑**(连点不发第二条),交回 `{ kind: 'blocked' }`:座位照它收「这一趟没跑」,
19
- * 不伪造 outcome。
20
- */
21
- import type { BusyGate, GateRun } from './busy-gate.js';
22
- import type { OneShotDeps } from './remote.js';
23
- import { type SettledFacts, type WritePresentation } from './write-settlement.js';
24
- import type { ApplyAction, RemoteFailure } from '../shared/wire.js';
25
- export type WriteSuccess<A extends ApplyAction> = SettledFacts<A> & {
26
- readonly ok: true;
27
- /** 逐条失败原文(failed / neutral / missing),按 id。这是失败表的**唯一落点**:
28
- * 摘要只带聚合与落地 id,不再复制一份逐条原文。 */
29
- readonly failures: ReadonlyMap<string, string>;
30
- };
31
- export interface WriteFailure<A extends ApplyAction> {
32
- readonly ok: false;
33
- readonly action: A;
34
- readonly ids: readonly string[];
35
- readonly failure: RemoteFailure;
36
- /** 顶层失败时同一句原文铺到每个请求 id。 */
37
- readonly failures: ReadonlyMap<string, string>;
38
- }
39
- export type WriteOutcome<A extends ApplyAction> = WriteSuccess<A> | WriteFailure<A>;
40
- export interface WriteInput<A extends ApplyAction> {
41
- readonly deps: OneShotDeps;
42
- readonly action: A;
43
- readonly ids: readonly string[];
44
- /** 单条写入面:把 N=1 模式交给 receipt 读法(null 折成协议错)。 */
45
- readonly single?: boolean | undefined;
46
- /** restore 的 already-gone 回执不带行,它的 sessionId 只能由调用方从当前清单里查。 */
47
- readonly sessionIdOfEntry?: (entryId: string) => string | undefined;
48
- /** 信封成功时交给 settlement 的呈现材质(摘要里的成功名单可能为空);按 action 的收尾顺序住 `write-settlement.ts`。 */
49
- readonly presentation?: WritePresentation<A>;
50
- /** 这一趟的闸:给了就把 apply → settle → refresh 整趟包进 busy。refresh 不许落在闸外。 */
51
- readonly gate?: BusyGate;
52
- /** 写完(顶层失败或信封成功,无论逐条成败)后的重读策略;成败与 `anySuccess` 都在 outcome 里,
53
- * 是否真的重读由调用方决定。 */
54
- readonly refresh?: (outcome: WriteOutcome<A>) => void | Promise<void>;
55
- }
56
- /** 签名上的分岔就是判据:**没传闸 ⇒ 这一趟一定跑**,回真结果;**传了闸 ⇒ 可能被同一枚闸的在飞那一趟
57
- * 挡回**,那时这一趟什么都没做、回 `{ kind: 'blocked' }`。`runWrite` 不替调用方编造成果——挡回来的
58
- * 那趟怎么收尾归座位与界面(判据住 `busy-gate.ts`)。第二支把 `gate` 钉成 `undefined`:
59
- * `BusyGate | undefined` 这类"可能真有闸"的输入不许落到「一定跑完」那一支,否则类型会把挡回漏成
60
- * `WriteOutcome`。 */
61
- export declare function runWrite<A extends ApplyAction>(input: WriteInput<A> & {
62
- readonly gate: BusyGate;
63
- }): Promise<GateRun<WriteOutcome<A>>>;
64
- export declare function runWrite<A extends ApplyAction>(input: WriteInput<A> & {
65
- readonly gate?: undefined;
66
- }): Promise<WriteOutcome<A>>;
@@ -1,27 +0,0 @@
1
- /** 失败的**结构与措辞**。码本身、码的前缀读法与动词词表都住在 `shared/wire.ts`(ADR-0003):
2
- * 浏览器半也要认它们,它们属于两半共同的契约,不属于 Node 半。这里只做动词抛错与回滚措辞。 */
3
- import { type RouteCode, type VerbCode } from '../shared/wire.js';
4
- /** 一次失败的**结构**:码、上屏原文、可选 cause(`map-error` 沿 cause 链认宿主类型化错误)、
5
- * 可选的结构化附带物(对齐官方 `rpcErrorSchema` 的第三件 `details`)。 */
6
- export interface VerbError extends Error {
7
- code: string;
8
- details?: Record<string, unknown>;
9
- cause?: unknown;
10
- }
11
- export declare function verbError(code: VerbCode, message: string, cause?: unknown, details?: Record<string, unknown>): VerbError;
12
- /** `trash-empty` 的原文:有具体条目就点名那个 id,拿不到时只报通用那句。 */
13
- export declare function trashEmpty(entryId?: string): VerbError;
14
- /** 路由自检用的失败:带 HTTP 状态语义,**不**冒充五个动词码。 */
15
- export declare function routeError(code: RouteCode, httpStatus: number, message: string): VerbError & {
16
- httpStatus: number;
17
- };
18
- /** 一条回滚步骤失败的**标签句**:label 说的是"这一步在退什么",原文带出**那一步抛的东西**
19
- * (`Error` 取 message,其余一律 `String()`;对象带 `message` 的差异归 `map-error.messageOf` 管)。
20
- * 调用方不许另抄这份格式——那样 details 里的句子会随各处 catch 变形,界面上就变成"同一个失败三个说法"。 */
21
- export declare function rollbackReason(label: string, error: unknown): string;
22
- /** 原错误保留,回滚失败作为 `details.rollbackFailures` 上线;码仍按原错误的动词码,
23
- * 没有可继承的就落 io。**内层的回滚失败要并进来**:一个成员自己退失败、兄弟也退失败时,
24
- * 两份失败都得在 details 里,消息也不能出现第二个「回滚未完成」。
25
- * **原错误 details 的其余键原样保留**:孤儿清理的部分回执(`removed` / `freedBytes` /
26
- * `failedSessionId`)就挂在它上面,整份替换会把已经发生的删除报成 0。 */
27
- export declare function withRollbackFailures(error: unknown, failures: readonly string[]): VerbError;