✨ feat(client): 清理入口移到插件页,不再藏在组件行里
This commit is contained in:
@@ -30,7 +30,7 @@ DSH 原本只能归档会话——归档只是把会话从列表里移开,日
|
||||
|
||||
### 2. 清理临时文件
|
||||
|
||||
**设置 → 插件 → 会话彻底删除**(点会话彻底删除那一行右侧的配置按钮),清理 spill 后端留下的**孤儿**目录。判定偏保守:
|
||||
**设置 → 插件 → 会话彻底删除**(打开插件页就能看到,不必再点进「包含的组件」里那一行),清理 spill 后端留下的**孤儿**目录。判定偏保守:
|
||||
|
||||
1. 目录名必须精确等于 `session-<sha256(会话 id) 前 12 位>`——这是 spill 后端唯一会生成的形状;
|
||||
2. 该名字不属于任何已知会话(`sessionQuery.listSessions()` 已经把存量会话与内存中正在运行的会话合并成同一份语料,所以「已知」只需要一个来源);
|
||||
@@ -39,7 +39,13 @@ DSH 原本只能归档会话——归档只是把会话从列表里移开,日
|
||||
|
||||
结果直接显示在该页(清理了几个目录、几个文件、释放多少空间),可反复点击。
|
||||
|
||||
这个页面占的是 `plugins.row.config` 槽位——和官方插件「终端」的配置页是同一个位置。注册了这个槽位的 key(`<包名>#<行 id>`)之后,插件行就会长出配置入口,所以本插件不声明 `Config` 也能有自己的页面。
|
||||
这块清理占的是 `plugins.bundle.config` 槽位,key 就是本包的**包名**(`@dsh-plugin/session-delete`)。它渲染在插件页的**描述与「包含的组件」之间**,所以打开插件页即可看到,不用再点一次。
|
||||
|
||||
没有用行级槽位 `plugins.row.config`(key 形如 `<包名>#<行 id>`):它只会在「包含的组件」那一行上多长出一个「配置」入口,把本插件唯一的控件藏到二级页面里。本插件页顶部是 DSH 自己渲染的插件标题与描述,所以这块配置不再重复标题,直接讲清理这件事本身。
|
||||
|
||||
### 关于「包含的组件」
|
||||
|
||||
插件页下方的「包含的组件 / 组件」是 **DSH 插件页固定渲染**的:`ui-plugin-manager` 无条件列出这个 bundle 在 `cordis.patch.yml` 里声明的**每一行**(行 id、运行状态、单独开关),没有"跳过"的口子。任何 bundle 都至少要声明一行才能挂上宿主半,所以这一节必然出现——本插件就是这一行。它也不是纯冗余:它标出运行状态、允许单独关掉这个组件。插件侧没法隐藏它,但插件的功能不再挂在它下面——清理入口已经在页面本身上了。
|
||||
|
||||
## 行为与边界
|
||||
|
||||
|
||||
@@ -8,11 +8,14 @@
|
||||
*
|
||||
* The temporary-file sweep is the plugin's other operation, and it lives on
|
||||
* this plugin's own page under Settings → Plugins: the entry registers into
|
||||
* `plugins.row.config` under the `<package name>#<row id>` key the manager
|
||||
* dispatches, which also gives the row its configure control. That is the same
|
||||
* seat a bundled plugin's configuration form occupies, so the plugin's only
|
||||
* control sits beside everything else the manager says about it instead of
|
||||
* taking a row in General settings.
|
||||
* `plugins.bundle.config` under this package's name, the page-level seat the
|
||||
* manager renders on a bundle's page between its description and its rows.
|
||||
*
|
||||
* That page-level seat is deliberate, not the row-level `plugins.row.config`
|
||||
* one. The row seat grows a configure control on the row listed under
|
||||
* 「包含的组件」 and nothing else, so it parks this plugin's one and only control
|
||||
* one click deeper than the page the user just opened; the page seat puts it
|
||||
* where the page is read.
|
||||
*
|
||||
* Two client-authoring rules shape this file:
|
||||
*
|
||||
@@ -44,15 +47,13 @@ window.__ModuleLoader__.load({
|
||||
/** Between the shipped `archive` (100) and `pin` (200) hover buttons. */
|
||||
const ROW_ACTION_ORDER = 150
|
||||
/**
|
||||
* The key `plugins.row.config` is dispatched under: the manager composes it
|
||||
* as `<package name>#<row id>`, with the row id read from this bundle's own
|
||||
* patch. Both halves are literals from `package.json` and
|
||||
* `cordis.patch.yml`; a typo costs the configure control silently, so they
|
||||
* are the only two places renaming has to reach.
|
||||
* The key `plugins.bundle.config` is dispatched under: the manager keys a
|
||||
* bundle's own configuration by its npm package name and renders the entry
|
||||
* on that bundle's page, between the description and the rows. The value is
|
||||
* the literal from `package.json` — a typo costs the section silently, so
|
||||
* it is the only place renaming has to reach.
|
||||
*/
|
||||
const PACKAGE = '@dsh-plugin/session-delete'
|
||||
const ROW_ID = 'session-delete'
|
||||
const CONFIG_KEY = `${PACKAGE}#${ROW_ID}`
|
||||
const TOOLTIP_DELAY_MS = 500
|
||||
const TOOLTIP_GAP = 8
|
||||
/** Document base captured at bundle registration, before any routing. */
|
||||
@@ -331,12 +332,12 @@ window.__ModuleLoader__.load({
|
||||
* This plugin's page under Settings → Plugins: sweep spilled tool output
|
||||
* whose conversation no longer exists.
|
||||
*
|
||||
* The owner asks every `plugins.row.config` entry for two views. `summary`
|
||||
* is the one-liner on the row, and this plugin's manifest description
|
||||
* already fills that seat, so `summary` renders nothing and the page keeps
|
||||
* the text the manager read from `locale/*.json`. `page` is the section the
|
||||
* manager renders with its own heading, breadcrumb, and title; copy,
|
||||
* control, and result belong to this entry.
|
||||
* The owner dispatches the `page` view only: a bundle's configuration has
|
||||
* no one-line form, because the page header already prints this package's
|
||||
* title and description from the manifest. So the section opens with the
|
||||
* operation's own name and the rule it applies — what the header cannot say
|
||||
* — and the guard below keeps rendering nothing if a `summary` view ever
|
||||
* arrives.
|
||||
*/
|
||||
function TempCleanupPanel(props) {
|
||||
const t = translate(props.t)
|
||||
@@ -650,12 +651,13 @@ window.__ModuleLoader__.load({
|
||||
}),
|
||||
}, DeleteSessionDialog))
|
||||
|
||||
// The cleanup control belongs on this plugin's own page: registering
|
||||
// this cell key is what makes the row grow a configure control, and the
|
||||
// manager renders the entry for both its summary and page views.
|
||||
ctx.slots.inject('plugins.row.config', () => ctx.slots.register({
|
||||
name: 'plugins.row.config',
|
||||
key: CONFIG_KEY,
|
||||
// The cleanup control belongs on this plugin's own page itself, not
|
||||
// behind the component row listed under 「包含的组件」:
|
||||
// `plugins.bundle.config` keyed by this package's name is the seat the
|
||||
// manager renders between the page's description and its rows.
|
||||
ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register({
|
||||
name: 'plugins.bundle.config',
|
||||
key: PACKAGE,
|
||||
locale: NS,
|
||||
inject: () => ({ cleanOrphans }),
|
||||
}, TempCleanupPanel))
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@dsh-plugin/session-delete",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"description": "Permanently delete a conversation: stop it, remove its session log, subagent logs, and spilled tool output, and drop every registry reference. The plugin's own page under Settings → Plugins can sweep orphaned temporary files.",
|
||||
|
||||
Reference in New Issue
Block a user