dsh-more 0.1.1 → 0.1.3
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.
- package/README.md +23 -6
- package/README.zh-CN.md +36 -6
- package/cordis.patch.yml +2 -0
- package/dist/client.js +380 -16
- package/dist/fast-mode.js +34 -0
- package/dist/index.js +222 -57
- package/dist/types/generated/host-settings-schema.d.ts +23 -19
- package/dist/types/generated/patch-catalog.d.ts +16 -0
- package/dist/types/kernel/client/activation.d.ts +2 -2
- package/dist/types/kernel/host/settings.d.ts +7 -3
- package/dist/types/patches/fast-mode/host/settings.d.ts +6 -0
- package/dist/types/patches/model-capabilities/client/index.d.ts +1 -1
- package/dist/types/patches/projectless-tasks/client/groups.d.ts +1 -1
- package/dist/types/patches/terminal-clipboard/client/clipboard.d.ts +5 -0
- package/dist/types/patches/terminal-clipboard/client/index.d.ts +2 -0
- package/dist/types/patches/terminal-clipboard/client/terminal.d.ts +17 -0
- package/dist/types/patches/terminal-clipboard/host/index.d.ts +2 -0
- package/dist/types/patches/terminal-clipboard/shared.d.ts +1 -0
- package/dist/types/patches/terminal-host-stats/client/bar.d.ts +5 -0
- package/dist/types/patches/terminal-host-stats/client/index.d.ts +2 -0
- package/dist/types/patches/terminal-host-stats/client/monitor.d.ts +2 -0
- package/dist/types/patches/terminal-host-stats/host/disks.d.ts +8 -0
- package/dist/types/patches/terminal-host-stats/host/index.d.ts +2 -0
- package/dist/types/patches/terminal-host-stats/host/sample.d.ts +16 -0
- package/dist/types/patches/terminal-host-stats/shared.d.ts +16 -0
- package/dist/types/platform/dsh/client/runtime.d.ts +5 -2
- package/dist/types/platform/dsh/client/settings.d.ts +15 -1
- package/docs/desktop-compatibility.md +82 -0
- package/dsh.plugin.json +2 -2
- package/package.json +70 -61
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Practical, independently switchable patches for missing context and history cont
|
|
|
6
6
|
|
|
7
7
|
`dsh-more` integrates with the existing DSH interface instead of adding a separate management dashboard. Its current patch set can edit a user message and restart from that point, remove one message while preserving the surrounding context, and permanently delete a session while leaving native archive behavior intact.
|
|
8
8
|
|
|
9
|
-
> **Compatibility:** development
|
|
9
|
+
> **Compatibility:** the development/test baseline is DeepSeek Harness `0.2.1-rc.2`. All patches and existing peer ranges are preserved. Type, feature and isolated Host checks pass against the target RC; Windows path/build/script fixes are not a claim of Windows Desktop end-to-end verification. Node.js 24+ is recommended; the package engine also allows Node.js 22.19+.
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
@@ -16,6 +16,10 @@ Practical, independently switchable patches for missing context and history cont
|
|
|
16
16
|
| Delete one message | User- and assistant-message action rows | Removes the selected model-surface node, expands only when tool call/result pairing requires it, rebuilds the surviving context, and opens a child session | On |
|
|
17
17
|
| Permanently delete session | Separate item beside the native Archive action | Stops and unloads the target session, removes its exact JSONL persistence directory, detaches it from workspaces, and synchronizes the lists incrementally | On |
|
|
18
18
|
| Model capabilities | Settings → Models → Model capabilities | Configure image support, selectable thinking types and parameter formats per model | On |
|
|
19
|
+
| Fast mode | Composer toolbar and `/fast` | Toggle faster model service for the current session (may consume quota faster) | On |
|
|
20
|
+
| Markdown export | Conversation toolbar / More menu | Export messages and tool results with Windows-safe download filenames | On |
|
|
21
|
+
| Automatic titles | After the first request | Generate a title using the current model, preserving manual names | On |
|
|
22
|
+
| Independent tasks and grouping | Workspace picker / session menu | Create an independent task with its draft intact; group sessions without changing their working directories | On |
|
|
19
23
|
|
|
20
24
|
Patch switches live under **Settings → Plugins → Plugin configuration → DSH More** and take effect without rebuilding the plugin.
|
|
21
25
|
|
|
@@ -24,11 +28,24 @@ Patch switches live under **Settings → Plugins → Plugin configuration → DS
|
|
|
24
28
|
### Requirements
|
|
25
29
|
|
|
26
30
|
- Node.js `>= 24`
|
|
27
|
-
- A working `dsh` CLI and a Web profile
|
|
31
|
+
- A working `dsh` CLI and a Web or Desktop profile on DeepSeek Harness `0.2.1-rc.2`
|
|
28
32
|
- Access to the npm registry that publishes `dsh-more`
|
|
29
33
|
|
|
30
34
|
pnpm is needed only when installing or developing from source. For a published release, use the DSH plugin command so the package is installed into the selected DSH profile; do not install it globally with `npm install -g`.
|
|
31
35
|
|
|
36
|
+
### Windows: install this unreleased fix
|
|
37
|
+
|
|
38
|
+
The existing npm release is not this working-tree fix. Build a tarball with `pnpm install --frozen-lockfile`, `pnpm run check`, `pnpm run test:runtime`, then `npm pack`, or copy the resulting tarball from another machine.
|
|
39
|
+
|
|
40
|
+
For Desktop, initialize the app once, fully quit it, and use the **Desktop-supplied `dsh` command** (verify `Get-Command dsh` and `dsh --version`) to run:
|
|
41
|
+
|
|
42
|
+
```powershell
|
|
43
|
+
dsh plugin --profile desktop add "C:\Downloads\dsh-more-0.1.1.tgz"
|
|
44
|
+
dsh plugin --profile desktop list dsh-more --depth 0
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The generic npm CLI rejects the reserved Desktop profile; use the installed Desktop carrier instead of replacing its profile. For a browser Web service, use `--profile web` and restart the original `dsh web`. Web and Desktop profiles are separate. Reopen Desktop / reload the browser and check all DSH More switches. Quote paths containing spaces or non-ASCII characters. Windows Desktop manual acceptance is still required; see the [compatibility record](./docs/desktop-compatibility.md).
|
|
48
|
+
|
|
32
49
|
### Install the latest release from npm
|
|
33
50
|
|
|
34
51
|
```sh
|
|
@@ -235,14 +252,14 @@ Generated source, `dist/`, and tarballs are not committed. `prepack` runs the co
|
|
|
235
252
|
|
|
236
253
|
### Dependency updates
|
|
237
254
|
|
|
238
|
-
`package.json`
|
|
255
|
+
`package.json` declares compatible Host peer ranges, but pins the DSH development SDK to `0.2.1-rc.2` (with Cordis 4.0.5, Schemastery 3.18.5 and Zod 4.4.3). `pnpm-lock.yaml` preserves the verified graph. When changing the SDK baseline, update these pins together, reinstall, and validate:
|
|
239
256
|
|
|
240
257
|
```sh
|
|
241
258
|
pnpm update
|
|
242
259
|
pnpm run check
|
|
243
260
|
```
|
|
244
261
|
|
|
245
|
-
|
|
262
|
+
DSH Host peers use `^0.1.5-rc.2 || ^0.2.0-rc.2 || ^0.2.1-alpha.5`. The `^0.2.1-alpha.5` range includes `0.2.1-rc.2` on the same version tuple, without bypassing compatibility checks. Prereleases on other version tuples still require verification.
|
|
246
263
|
|
|
247
264
|
### Verification scope
|
|
248
265
|
|
|
@@ -254,9 +271,9 @@ The repository does not currently contain a full browser end-to-end suite agains
|
|
|
254
271
|
|
|
255
272
|
See the [desktop verification record](./docs/desktop-compatibility.md) for the actual macOS `0.1.7-rc.2` window checks. The desktop adapter navigates through `uiWorkspace.openSession()`, reads current selection from `retainedBy.mainView`, and temporarily retains newly created Sessions until their drafts can be transferred. Independent tasks, edit/delete handoffs, and current-session deletion share this adapter.
|
|
256
273
|
|
|
257
|
-
Development
|
|
274
|
+
Development uses the pinned `0.2.1-rc.2` SDK; Host peer ranges preserve existing RC/alpha compatibility. The removed `webRuntime` service is no longer required; requests use the authenticated Connection Fetch registry. Settings adapters support ConfigForms/SettingsForms and the previous APIs. The adapters and tests cover the current session format, message provenance, `main.conversation` slot, and JSONL persistence snapshots and location capability. For an existing local linked install, rebuild, restart DSH, and reload the page to load both the new Host and Client.
|
|
258
275
|
|
|
259
|
-
- The current
|
|
276
|
+
- The current test baseline is DSH `0.2.1-rc.2`; future pre-release API or DOM changes can require adapter updates. Run `pnpm run test:runtime` for isolated RC Host integration checks (temporary profile and fake model; no user history or credentials).
|
|
260
277
|
- In-product DSH More copy is currently primarily Simplified Chinese, although native Copy/Archive selectors recognize both Chinese and English labels.
|
|
261
278
|
- Message actions operate only on ordinary user messages and assistant messages still present in the current model surface; editing requires a completed owning turn.
|
|
262
279
|
- Permanent deletion requires a `jsonl` backend with a valid location capability. Its current `locate` hook is internal; the adapter checks its presence and result. Tests cover plain and Zstandard-compressed session files.
|
package/README.zh-CN.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
`dsh-more` 不创建平行的“管理中心”,而是把能力直接嵌入 DSH 现有界面。当前补丁可以编辑用户消息并从该处重新开始、在保留前后上下文的前提下删除单条消息,以及在不改变原生归档语义的情况下永久删除会话。
|
|
8
8
|
|
|
9
|
-
> **兼容性:**
|
|
9
|
+
> **兼容性:** 开发与测试基线为 DeepSeek Harness `0.2.1-rc.2`。保留全部补丁及已有 peer 兼容范围,已通过目标 RC 的类型、功能和隔离 Host 验收;Windows 路径、构建与脚本兼容修复不等同于 Windows Desktop 实机逐项验收。推荐 Node.js 24+;包引擎也允许 Node.js 22.19+。
|
|
10
10
|
|
|
11
11
|
## 功能概览
|
|
12
12
|
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
| 永久删除会话 | 原生“归档会话”旁的独立菜单项 | 停止并卸载目标会话,移除其精确 JSONL 持久化目录,从 Workspace 脱离并增量同步列表 | 开启 |
|
|
18
18
|
| 模型能力配置 | 设置 → 模型 → 模型能力 | 按模型配置识图、可选思考类型及接口参数格式,不自动猜测能力 | 开启 |
|
|
19
19
|
| 加速 | 输入框工具栏与 `/fast` 命令 | 开关当前会话的加速。响应更快,但会更快消耗额度 | 开启 |
|
|
20
|
+
| Markdown 导出 | 会话工具栏 / 更多操作 | 导出消息与工具结果,下载文件名兼容 Windows | 开启 |
|
|
21
|
+
| 自动标题 | 新会话首次需求后 | 用当前模型生成标题,保留手动命名 | 开启 |
|
|
22
|
+
| 独立任务与手动归组 | 工作区下拉框 / 会话菜单 | 保留草稿创建独立任务;归组不改变工作目录 | 开启 |
|
|
20
23
|
|
|
21
24
|
补丁开关位于 **设置 → 插件 → 插件配置 → DSH More**,修改后实时生效,无需重新构建插件。
|
|
22
25
|
|
|
@@ -25,11 +28,38 @@
|
|
|
25
28
|
### 环境要求
|
|
26
29
|
|
|
27
30
|
- Node.js `>= 24`
|
|
28
|
-
- 可正常使用的 `dsh` CLI
|
|
31
|
+
- 可正常使用的 `dsh` CLI,以及 DeepSeek Harness `0.2.1-rc.2` 的 Web 或 Desktop profile
|
|
29
32
|
- 能访问发布 `dsh-more` 的 npm registry
|
|
30
33
|
|
|
31
34
|
只有从源码安装或参与开发时才需要 pnpm。安装已发布版本时,应通过 DSH 插件命令把包加入指定 profile;不要使用 `npm install -g` 全局安装。
|
|
32
35
|
|
|
36
|
+
### Windows 安装本次修复(尚未发布到 npm)
|
|
37
|
+
|
|
38
|
+
不要把 npm 上的旧包当成本次修复版。可将本仓库构建的 `dsh-more-0.1.1.tgz` 复制到 Windows 后安装;也可在 Windows 源码目录执行:
|
|
39
|
+
|
|
40
|
+
```powershell
|
|
41
|
+
node --version
|
|
42
|
+
pnpm install --frozen-lockfile
|
|
43
|
+
pnpm run check
|
|
44
|
+
pnpm run test:runtime
|
|
45
|
+
npm pack
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- **桌面应用**:先启动 Desktop 一次完成初始化,再完整退出。使用 **Desktop 安装附带的 `dsh` 命令**,确认 `dsh --version` 为 `0.2.1-rc.2`,然后安装到 `desktop` profile:
|
|
49
|
+
|
|
50
|
+
```powershell
|
|
51
|
+
Get-Command dsh | Select-Object Source
|
|
52
|
+
dsh --version
|
|
53
|
+
dsh plugin --profile desktop add "C:\Downloads\dsh-more-0.1.1.tgz"
|
|
54
|
+
dsh plugin --profile desktop list dsh-more --depth 0
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
若提示 desktop 由 Electron 专属管理,说明调用的是 npm 安装的通用 CLI,而非 Desktop 的配套命令;请切换命令来源,不要重建或覆盖 Desktop profile。
|
|
58
|
+
|
|
59
|
+
- **浏览器 Web 服务**:改用 `dsh plugin --profile web add "C:\Downloads\dsh-more-0.1.1.tgz"`,之后重启原来的 `dsh web`。
|
|
60
|
+
|
|
61
|
+
安装后重新打开 Desktop / 刷新 Web 页面,在 **设置 → 插件 → 插件配置 → DSH More** 确认所有补丁开关。Web 与 Desktop 是不同 profile,安装到 web 不会自动影响桌面应用。路径含空格或中文时务必加引号。本次没有修改用户 DSH 安装或会话,也没有发布 npm;Windows 实机逐项验收仍需执行,见[兼容记录](./docs/desktop-compatibility.md)。
|
|
62
|
+
|
|
33
63
|
### 从 npm 安装最新版
|
|
34
64
|
|
|
35
65
|
```sh
|
|
@@ -236,14 +266,14 @@ pnpm run package # 构建并生成 npm tarball
|
|
|
236
266
|
|
|
237
267
|
### 依赖更新
|
|
238
268
|
|
|
239
|
-
`package.json`
|
|
269
|
+
`package.json` 的宿主 peer 使用兼容范围;DSH 开发 SDK 则固定为 `0.2.1-rc.2`,并同步固定 Cordis 4.0.5、Schemastery 3.18.5 与 Zod 4.4.3,避免不同版本类型混用。`pnpm-lock.yaml` 保留已验证依赖图。更换 SDK 基线时应一起更新这些固定版本,重新安装并验证:
|
|
240
270
|
|
|
241
271
|
```sh
|
|
242
272
|
pnpm update
|
|
243
273
|
pnpm run check
|
|
244
274
|
```
|
|
245
275
|
|
|
246
|
-
DSH
|
|
276
|
+
宿主 DSH peer 使用 `^0.1.5-rc.2 || ^0.2.0-rc.2 || ^0.2.1-alpha.5`。其中 `^0.2.1-alpha.5` 包含同一版本基线的 `0.2.1-rc.2`,不需要禁用版本检查;不同版本基线的预发布版仍需重新验证。
|
|
247
277
|
|
|
248
278
|
### 验证范围
|
|
249
279
|
|
|
@@ -255,9 +285,9 @@ DSH 的 `^0.1.5-rc.2` 接受后续 `0.1.x` 正式版本和 `0.1.5` 的更新 RC
|
|
|
255
285
|
|
|
256
286
|
官方 macOS 桌面端 `0.1.7-rc.2` 的实际窗口验证记录见 [桌面端兼容检查](./docs/desktop-compatibility.md)。新版使用 `uiWorkspace.openSession()` 导航,以 `retainedBy.mainView` 识别当前会话;创建后通过临时 Session reference 等待草稿可用,完成交接后释放。独立任务、消息编辑/删除后的跳转和当前会话删除共用该适配。
|
|
257
287
|
|
|
258
|
-
|
|
288
|
+
开发 SDK 固定在 `0.2.1-rc.2`;宿主 peer 保留已有 RC/alpha 兼容范围。插件不再强依赖已移除的 `webRuntime`,请求走受认证的 Connection Fetch registry;设置层同时兼容 ConfigForms/SettingsForms 与旧接口。已适配新版会话格式、消息来源字段、`main.conversation` 插槽,以及 JSONL 后端的持久化快照和定位能力。已有本地链接安装在重新构建后,需要重启 DSH 并刷新页面以加载新的 Host 和 Client。
|
|
259
289
|
|
|
260
|
-
-
|
|
290
|
+
- 当前测试基线为 DSH `0.2.1-rc.2`;后续预发布 API 或 DOM 变化仍可能要求更新 adapter。`pnpm run test:runtime` 会用临时 profile 和模型替身运行隔离 RC Host 验收,不使用用户历史或密钥。
|
|
261
291
|
- DSH More 的产品内文案目前以简体中文为主;对 DSH 原生 Copy/Archive 元素的定位同时识别中英文标签。
|
|
262
292
|
- 消息操作只面向仍在当前 model surface 中的普通用户消息和助手消息;编辑要求所属轮次已经完成。
|
|
263
293
|
- 永久删除只支持提供有效定位能力的 `jsonl` 后端;当前后端的 `locate` 为内部接口,调用前会检查能力及返回值,测试覆盖普通和 Zstandard 压缩会话文件。
|
package/cordis.patch.yml
CHANGED
package/dist/client.js
CHANGED
|
@@ -47,7 +47,9 @@ var PATCH_CATALOG = [
|
|
|
47
47
|
{ "id": "model-capabilities", "name": "\u6A21\u578B\u80FD\u529B\u914D\u7F6E", "description": "\u5728\u6A21\u578B\u914D\u7F6E\u9875\u8BBE\u7F6E\u6BCF\u4E2A\u6A21\u578B\u7684\u8BC6\u56FE\u80FD\u529B\u3001\u53EF\u9009\u601D\u8003\u7C7B\u578B\u4E0E\u601D\u8003\u53C2\u6570\u683C\u5F0F", "defaultEnabled": true, "order": 500, "clientKind": "standalone" },
|
|
48
48
|
{ "id": "fast-mode", "name": "\u52A0\u901F", "description": "\u5728\u8F93\u5165\u6846\u548C /fast \u547D\u4EE4\u4E2D\u5F00\u5173\u52A0\u901F\u3002\u54CD\u5E94\u66F4\u5FEB\uFF0C\u4F46\u4F1A\u66F4\u5FEB\u6D88\u8017\u989D\u5EA6", "defaultEnabled": true, "order": 550, "clientKind": "standalone" },
|
|
49
49
|
{ "id": "session-auto-title", "name": "\u4F1A\u8BDD\u81EA\u52A8\u547D\u540D", "description": "\u65B0\u4F1A\u8BDD\u9996\u6761\u9700\u6C42\u540E\uFF0C\u4F7F\u7528\u5F53\u524D\u6A21\u578B\u751F\u6210\u300C\u7C7B\u578B \xB7 \u5177\u4F53\u4EFB\u52A1\u300D\u6807\u9898\uFF1B\u4FDD\u7559\u624B\u52A8\u547D\u540D\uFF0C\u5931\u8D25\u65F6\u4FDD\u7559\u539F\u6709\u6807\u9898", "defaultEnabled": true, "order": 600, "clientKind": "standalone" },
|
|
50
|
-
{ "id": "projectless-tasks", "name": "\u72EC\u7ACB\u4EFB\u52A1", "description": "\u5728\u5DE5\u4F5C\u533A\u4E0B\u62C9\u6846\u521B\u5EFA\u72EC\u7ACB\u4EFB\u52A1\u5E76\u4FDD\u7559\u8349\u7A3F\uFF0C\u4E5F\u53EF\u5C06\u672A\u5206\u7EC4\u4F1A\u8BDD\u79FB\u5165\u5DE5\u4F5C\u533A\u5217\u8868", "defaultEnabled": true, "order": 700, "clientKind": "standalone" }
|
|
50
|
+
{ "id": "projectless-tasks", "name": "\u72EC\u7ACB\u4EFB\u52A1", "description": "\u5728\u5DE5\u4F5C\u533A\u4E0B\u62C9\u6846\u521B\u5EFA\u72EC\u7ACB\u4EFB\u52A1\u5E76\u4FDD\u7559\u8349\u7A3F\uFF0C\u4E5F\u53EF\u5C06\u672A\u5206\u7EC4\u4F1A\u8BDD\u79FB\u5165\u5DE5\u4F5C\u533A\u5217\u8868", "defaultEnabled": true, "order": 700, "clientKind": "standalone" },
|
|
51
|
+
{ "id": "terminal-clipboard", "name": "\u7EC8\u7AEF\u590D\u5236\u7C98\u8D34", "description": "\u53F3\u4FA7\u7EC8\u7AEF\u9009\u4E2D\u81EA\u52A8\u590D\u5236\u3002Ctrl+C \u590D\u5236\u9009\u533A\uFF0C\u65E0\u9009\u533A\u65F6\u4E2D\u65AD\u547D\u4EE4\u3002Ctrl+V \u6216\u53F3\u952E\u7C98\u8D34\u7EAF\u6587\u672C\uFF0C\u81EA\u52A8\u6E05\u9664\u7EC8\u7AEF\u989C\u8272\u63A7\u5236\u7801\u3002", "defaultEnabled": true, "order": 800, "clientKind": "standalone" },
|
|
52
|
+
{ "id": "terminal-host-stats", "name": "\u7EC8\u7AEF\u4E3B\u673A\u72B6\u6001", "description": "\u5728\u53F3\u4FA7\u7EC8\u7AEF\u9876\u90E8\u663E\u793A\u4E3B\u673A CPU\u3001\u5185\u5B58\u3001\u78C1\u76D8\u53EF\u7528\u7A7A\u95F4\u548C\u5B9E\u65F6\u8BFB\u5199\u901F\u7387", "defaultEnabled": true, "order": 810, "clientKind": "standalone" }
|
|
51
53
|
];
|
|
52
54
|
var DEFAULT_PATCH_SETTINGS = {
|
|
53
55
|
"message-edit": true,
|
|
@@ -57,7 +59,9 @@ var DEFAULT_PATCH_SETTINGS = {
|
|
|
57
59
|
"model-capabilities": true,
|
|
58
60
|
"fast-mode": true,
|
|
59
61
|
"session-auto-title": true,
|
|
60
|
-
"projectless-tasks": true
|
|
62
|
+
"projectless-tasks": true,
|
|
63
|
+
"terminal-clipboard": true,
|
|
64
|
+
"terminal-host-stats": true
|
|
61
65
|
};
|
|
62
66
|
function decodePatchSettings(value) {
|
|
63
67
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
@@ -152,7 +156,8 @@ function apiErrorText(error) {
|
|
|
152
156
|
|
|
153
157
|
// src/platform/dsh/client/runtime.ts
|
|
154
158
|
function currentSessionId(list) {
|
|
155
|
-
|
|
159
|
+
const legacy = list;
|
|
160
|
+
if (legacy.current !== void 0) return legacy.current;
|
|
156
161
|
return Object.values(list.byId).find((row) => {
|
|
157
162
|
const retained = row.retainedBy;
|
|
158
163
|
return (retained?.mainView ?? 0) > 0;
|
|
@@ -619,9 +624,9 @@ function installSessionDeleteMenuItems(onDelete) {
|
|
|
619
624
|
flush();
|
|
620
625
|
const observer = new MutationObserver((records) => {
|
|
621
626
|
let removedKnownItem = false;
|
|
622
|
-
for (const
|
|
623
|
-
|
|
624
|
-
if (
|
|
627
|
+
for (const record2 of records) {
|
|
628
|
+
record2.addedNodes.forEach(collectButtons);
|
|
629
|
+
if (record2.removedNodes.length > 0 && deleteItems.size > 0) removedKnownItem = true;
|
|
625
630
|
}
|
|
626
631
|
if (pendingButtons.size > 0 || removedKnownItem) schedule();
|
|
627
632
|
});
|
|
@@ -781,7 +786,8 @@ var CONVERSATION_MARKDOWN_EXPORT_PATCH_ID = "conversation-markdown-export";
|
|
|
781
786
|
|
|
782
787
|
// src/patches/conversation-markdown-export/client/filename.ts
|
|
783
788
|
function safeStem(value) {
|
|
784
|
-
|
|
789
|
+
const stem = [...value.normalize("NFKC").replace(/[\u0000-\u001f\u007f/\\?%*:|"<>]+/g, "-").replace(/\s+/g, " ").replace(/^[.\s-]+|[.\s-]+$/g, "")].slice(0, 80).join("").replace(/[.\s]+$/g, "");
|
|
790
|
+
return /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?: *[.]| *$)/i.test(stem) ? `_${stem}` : stem;
|
|
785
791
|
}
|
|
786
792
|
function markdownFilename(title, sessionId) {
|
|
787
793
|
const fallback = safeStem(`dsh-conversation-${sessionId}`) || "dsh-conversation";
|
|
@@ -1709,10 +1715,11 @@ var clientPatch4 = {
|
|
|
1709
1715
|
name: "fast",
|
|
1710
1716
|
label: () => "\u52A0\u901F",
|
|
1711
1717
|
description: () => "\u5F00\u542F\u6216\u5173\u95ED\u5F53\u524D\u4F1A\u8BDD\u7684\u52A0\u901F\u3002\u54CD\u5E94\u66F4\u5FEB\uFF0C\u4F46\u4F1A\u66F4\u5FEB\u6D88\u8017\u989D\u5EA6",
|
|
1712
|
-
available: (session) => sessions?.subagentAddress?.(session.sessionId) === void 0,
|
|
1718
|
+
available: (session) => activation.getSnapshot()[FAST_MODE_PATCH_ID] && sessions?.subagentAddress?.(session.sessionId) === void 0,
|
|
1713
1719
|
ui: {
|
|
1714
1720
|
kind: "action",
|
|
1715
1721
|
run: (session) => {
|
|
1722
|
+
if (!activation.getSnapshot()[FAST_MODE_PATCH_ID]) return;
|
|
1716
1723
|
void toggleFastMode(ctx, String(session.sessionId));
|
|
1717
1724
|
}
|
|
1718
1725
|
}
|
|
@@ -2457,9 +2464,365 @@ var clientPatch6 = {
|
|
|
2457
2464
|
}
|
|
2458
2465
|
};
|
|
2459
2466
|
|
|
2467
|
+
// src/patches/terminal-clipboard/shared.ts
|
|
2468
|
+
var TERMINAL_CLIPBOARD_PATCH_ID = "terminal-clipboard";
|
|
2469
|
+
|
|
2470
|
+
// src/patches/terminal-clipboard/client/terminal.ts
|
|
2471
|
+
function record(value) {
|
|
2472
|
+
return value !== null && typeof value === "object" ? value : void 0;
|
|
2473
|
+
}
|
|
2474
|
+
function terminal(value, root) {
|
|
2475
|
+
const candidate = record(value);
|
|
2476
|
+
if (candidate?.element !== root || !candidate.textarea || candidate.textarea !== root.querySelector("textarea.xterm-helper-textarea")) return;
|
|
2477
|
+
if (!record(candidate.options) || typeof candidate.getSelection !== "function" || typeof candidate.paste !== "function" || typeof candidate.focus !== "function") return;
|
|
2478
|
+
return candidate;
|
|
2479
|
+
}
|
|
2480
|
+
function resolveTerminal(root) {
|
|
2481
|
+
for (let node = root, depth = 0; node && depth < 4; node = node.parentElement, depth++) {
|
|
2482
|
+
const key = Object.keys(node).find((key2) => key2.startsWith("__reactFiber$"));
|
|
2483
|
+
if (!key) continue;
|
|
2484
|
+
let fiber = record(node[key]);
|
|
2485
|
+
for (let level = 0; fiber && level < 12; level++, fiber = record(fiber.return)) {
|
|
2486
|
+
for (const version of [fiber, record(fiber.alternate)]) {
|
|
2487
|
+
let hook = record(version?.memoizedState);
|
|
2488
|
+
for (let index = 0; hook && index < 32; index++, hook = record(hook.next)) {
|
|
2489
|
+
const found = terminal(record(hook.memoizedState)?.current, root);
|
|
2490
|
+
if (found) return found;
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
// src/patches/terminal-clipboard/client/clipboard.ts
|
|
2498
|
+
function pasteText(term, text) {
|
|
2499
|
+
const plain = text.replace(/(?:\x1b\[|\x9b)[\d:;]*m/g, "").replace(/(?:\x1b\]|\x9d)(?:[45]|1\d|10[45]|11\d)(?:;[^\x00-\x1f\x7f-\x9f]*)?(?:\x07|\x1b\\|\x9c)/g, "");
|
|
2500
|
+
if (plain) term.paste(plain);
|
|
2501
|
+
}
|
|
2502
|
+
function installTerminalClipboard(doc, resolve = resolveTerminal) {
|
|
2503
|
+
let active = true;
|
|
2504
|
+
let gesture;
|
|
2505
|
+
let pasteRevision = 0;
|
|
2506
|
+
let notice;
|
|
2507
|
+
let noticeTimer;
|
|
2508
|
+
const clipboard = doc.defaultView?.navigator.clipboard;
|
|
2509
|
+
const macShortcuts = /^(Mac|iPhone|iPad|iPod)/.test(doc.defaultView?.navigator.platform ?? "");
|
|
2510
|
+
const rootAt = (target) => {
|
|
2511
|
+
if (!(target instanceof Element)) return;
|
|
2512
|
+
return target.closest(".xterm") ?? void 0;
|
|
2513
|
+
};
|
|
2514
|
+
const report = (action) => {
|
|
2515
|
+
if (!active) return;
|
|
2516
|
+
notice?.remove();
|
|
2517
|
+
clearTimeout(noticeTimer);
|
|
2518
|
+
notice = doc.createElement("div");
|
|
2519
|
+
notice.setAttribute("role", "status");
|
|
2520
|
+
notice.setAttribute("data-dshmore-terminal-notice", "");
|
|
2521
|
+
notice.textContent = "\u7EC8\u7AEF" + action + "\u5931\u8D25\uFF1A\u8BF7\u5141\u8BB8\u526A\u8D34\u677F\u8BBF\u95EE\uFF0C\u6216\u7528 Shift+\u53F3\u952E\u6253\u5F00\u539F\u751F\u83DC\u5355\uFF1B\u4E5F\u53EF\u4F7F\u7528 macOS \u7684 \u2318C/\u2318V \u6216\u7CFB\u7EDF\u539F\u751F\u7C98\u8D34\u5FEB\u6377\u952E\u3002";
|
|
2522
|
+
notice.style.cssText = "position:fixed;bottom:24px;right:24px;z-index:10000;max-width:360px;padding:12px 16px;border-radius:8px;background:#252525;color:#fff;font-size:13px;box-shadow:0 4px 20px #0005";
|
|
2523
|
+
doc.body.append(notice);
|
|
2524
|
+
noticeTimer = setTimeout(() => {
|
|
2525
|
+
notice?.remove();
|
|
2526
|
+
notice = void 0;
|
|
2527
|
+
}, 6e3);
|
|
2528
|
+
};
|
|
2529
|
+
const copy = async (text) => {
|
|
2530
|
+
if (!text || !active) return;
|
|
2531
|
+
try {
|
|
2532
|
+
if (!clipboard?.writeText) throw new Error("Clipboard unavailable");
|
|
2533
|
+
await clipboard.writeText(text);
|
|
2534
|
+
} catch {
|
|
2535
|
+
report("\u590D\u5236");
|
|
2536
|
+
}
|
|
2537
|
+
};
|
|
2538
|
+
const paste = async (root, term) => {
|
|
2539
|
+
const revision = ++pasteRevision;
|
|
2540
|
+
if (term.options.disableStdin) return;
|
|
2541
|
+
term.focus();
|
|
2542
|
+
try {
|
|
2543
|
+
if (!clipboard?.readText) throw new Error("Clipboard unavailable");
|
|
2544
|
+
const text = await clipboard.readText();
|
|
2545
|
+
if (!active || revision !== pasteRevision || !root.isConnected || resolve(root) !== term || term.options.disableStdin || !root.contains(doc.activeElement)) return;
|
|
2546
|
+
pasteText(term, text);
|
|
2547
|
+
} catch {
|
|
2548
|
+
report("\u7C98\u8D34");
|
|
2549
|
+
}
|
|
2550
|
+
};
|
|
2551
|
+
const consume = (event) => {
|
|
2552
|
+
event.preventDefault();
|
|
2553
|
+
event.stopImmediatePropagation();
|
|
2554
|
+
};
|
|
2555
|
+
const nativePaste = (event) => {
|
|
2556
|
+
const root = rootAt(event.target);
|
|
2557
|
+
const term = root && resolve(root);
|
|
2558
|
+
if (!term || term.options.disableStdin || !event.clipboardData) return;
|
|
2559
|
+
consume(event);
|
|
2560
|
+
pasteRevision++;
|
|
2561
|
+
pasteText(term, event.clipboardData.getData("text/plain"));
|
|
2562
|
+
};
|
|
2563
|
+
const contextmenu = (event) => {
|
|
2564
|
+
if (event.shiftKey) return;
|
|
2565
|
+
const root = rootAt(event.target);
|
|
2566
|
+
const term = root && resolve(root);
|
|
2567
|
+
if (!root || !term || term.options.disableStdin) return;
|
|
2568
|
+
consume(event);
|
|
2569
|
+
void paste(root, term);
|
|
2570
|
+
};
|
|
2571
|
+
const keydown = (event) => {
|
|
2572
|
+
if (event.isComposing || event.altKey) return;
|
|
2573
|
+
const root = rootAt(event.target);
|
|
2574
|
+
const term = root && resolve(root);
|
|
2575
|
+
if (!root || !term) return;
|
|
2576
|
+
const key = event.key.toLowerCase();
|
|
2577
|
+
if (key === "c" && (event.ctrlKey || event.metaKey)) {
|
|
2578
|
+
const selection = term.getSelection();
|
|
2579
|
+
if (!selection) return;
|
|
2580
|
+
if (event.metaKey && !event.ctrlKey) return;
|
|
2581
|
+
consume(event);
|
|
2582
|
+
if (!event.repeat) void copy(selection);
|
|
2583
|
+
} else if (key === "v" && event.ctrlKey && !event.metaKey || key === "insert" && event.shiftKey && !event.ctrlKey && !event.metaKey) {
|
|
2584
|
+
if (term.options.disableStdin) return;
|
|
2585
|
+
if (key === "v" && !event.shiftKey && !macShortcuts && !event.repeat) {
|
|
2586
|
+
event.stopImmediatePropagation();
|
|
2587
|
+
return;
|
|
2588
|
+
}
|
|
2589
|
+
consume(event);
|
|
2590
|
+
if (!event.repeat) void paste(root, term);
|
|
2591
|
+
}
|
|
2592
|
+
};
|
|
2593
|
+
const mousedown = (event) => {
|
|
2594
|
+
gesture = void 0;
|
|
2595
|
+
if (event.button !== 0 || event.ctrlKey || event.metaKey || event.altKey) return;
|
|
2596
|
+
const root = rootAt(event.target);
|
|
2597
|
+
const term = root && resolve(root);
|
|
2598
|
+
if (root && term) gesture = { root, before: term.getSelection() };
|
|
2599
|
+
};
|
|
2600
|
+
const mouseup = (event) => {
|
|
2601
|
+
const started = gesture;
|
|
2602
|
+
gesture = void 0;
|
|
2603
|
+
if (event.button !== 0 || !started) return;
|
|
2604
|
+
queueMicrotask(() => {
|
|
2605
|
+
if (!active || !started.root.isConnected) return;
|
|
2606
|
+
const text = resolve(started.root)?.getSelection();
|
|
2607
|
+
if (text && text !== started.before) void copy(text);
|
|
2608
|
+
});
|
|
2609
|
+
};
|
|
2610
|
+
const blur = () => {
|
|
2611
|
+
gesture = void 0;
|
|
2612
|
+
pasteRevision++;
|
|
2613
|
+
};
|
|
2614
|
+
doc.addEventListener("contextmenu", contextmenu, true);
|
|
2615
|
+
doc.addEventListener("paste", nativePaste, true);
|
|
2616
|
+
doc.addEventListener("keydown", keydown, true);
|
|
2617
|
+
doc.addEventListener("mousedown", mousedown, true);
|
|
2618
|
+
doc.addEventListener("mouseup", mouseup, true);
|
|
2619
|
+
doc.defaultView?.addEventListener("blur", blur);
|
|
2620
|
+
return () => {
|
|
2621
|
+
active = false;
|
|
2622
|
+
blur();
|
|
2623
|
+
doc.removeEventListener("contextmenu", contextmenu, true);
|
|
2624
|
+
doc.removeEventListener("paste", nativePaste, true);
|
|
2625
|
+
doc.removeEventListener("keydown", keydown, true);
|
|
2626
|
+
doc.removeEventListener("mousedown", mousedown, true);
|
|
2627
|
+
doc.removeEventListener("mouseup", mouseup, true);
|
|
2628
|
+
doc.defaultView?.removeEventListener("blur", blur);
|
|
2629
|
+
clearTimeout(noticeTimer);
|
|
2630
|
+
notice?.remove();
|
|
2631
|
+
};
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
// src/patches/terminal-clipboard/client/index.ts
|
|
2635
|
+
var clientPatch7 = {
|
|
2636
|
+
id: TERMINAL_CLIPBOARD_PATCH_ID,
|
|
2637
|
+
install: (ctx, activation) => {
|
|
2638
|
+
ctx.effect(() => {
|
|
2639
|
+
let dispose;
|
|
2640
|
+
const sync = () => {
|
|
2641
|
+
if (activation.getSnapshot()[TERMINAL_CLIPBOARD_PATCH_ID]) {
|
|
2642
|
+
dispose ??= installTerminalClipboard(document);
|
|
2643
|
+
} else {
|
|
2644
|
+
dispose?.();
|
|
2645
|
+
dispose = void 0;
|
|
2646
|
+
}
|
|
2647
|
+
};
|
|
2648
|
+
const unsubscribe = activation.subscribe(sync);
|
|
2649
|
+
sync();
|
|
2650
|
+
return () => {
|
|
2651
|
+
unsubscribe();
|
|
2652
|
+
dispose?.();
|
|
2653
|
+
};
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2656
|
+
};
|
|
2657
|
+
|
|
2658
|
+
// src/patches/terminal-host-stats/shared.ts
|
|
2659
|
+
var TERMINAL_HOST_STATS_ID = "terminal-host-stats";
|
|
2660
|
+
|
|
2661
|
+
// src/patches/terminal-host-stats/client/bar.ts
|
|
2662
|
+
var units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
|
|
2663
|
+
function unit(bytes) {
|
|
2664
|
+
return Math.min(units.length - 1, Math.max(0, Math.floor(Math.log2(Math.max(1, bytes)) / 10)));
|
|
2665
|
+
}
|
|
2666
|
+
function amount(bytes, index) {
|
|
2667
|
+
return Number((bytes / 1024 ** index).toFixed(1)).toString();
|
|
2668
|
+
}
|
|
2669
|
+
function capacity(value, total) {
|
|
2670
|
+
const index = unit(total);
|
|
2671
|
+
const valueUnit = unit(value);
|
|
2672
|
+
if (value > 0 && valueUnit < index) {
|
|
2673
|
+
return amount(value, valueUnit) + " " + units[valueUnit] + "/" + amount(total, index) + " " + units[index];
|
|
2674
|
+
}
|
|
2675
|
+
return amount(value, index) + "/" + amount(total, index) + " " + units[index];
|
|
2676
|
+
}
|
|
2677
|
+
function rate(bytes) {
|
|
2678
|
+
const index = unit(bytes);
|
|
2679
|
+
return amount(bytes, index) + " " + units[index] + "/s";
|
|
2680
|
+
}
|
|
2681
|
+
function createBar(doc) {
|
|
2682
|
+
const node = doc.createElement("div");
|
|
2683
|
+
node.className = "dshmore-host-stats";
|
|
2684
|
+
node.setAttribute("role", "group");
|
|
2685
|
+
node.setAttribute("aria-label", "\u7EC8\u7AEF\u4E3B\u673A\u72B6\u6001");
|
|
2686
|
+
node.style.cssText = "display:flex;flex:none;order:-1;flex-wrap:wrap;align-items:center;gap:3px 14px;padding:4px 10px 6px;border-bottom:1px solid var(--dsw-alias-border-primary, #8884);font-size:11px;line-height:1.5;font-variant-numeric:tabular-nums";
|
|
2687
|
+
const fields = [
|
|
2688
|
+
["CPU", "\u6240\u6709\u903B\u8F91\u6838\u5FC3\u7684\u5E73\u5747\u4F7F\u7528\u7387"],
|
|
2689
|
+
["\u5185\u5B58", "\u4E3B\u673A\u5DF2\u7528 / \u603B\u7269\u7406\u5185\u5B58"],
|
|
2690
|
+
["\u78C1\u76D8\u53EF\u7528", "\u4E3B\u673A\u4E3B\u76EE\u5F55\u6240\u5728\u5377\u7684\u53EF\u7528 / \u603B\u7A7A\u95F4"],
|
|
2691
|
+
["\u8BFB", "\u4E3B\u673A\u78C1\u76D8\u6BCF\u79D2\u8BFB\u53D6\u7684\u5B57\u8282\u6570"],
|
|
2692
|
+
["\u5199", "\u4E3B\u673A\u78C1\u76D8\u6BCF\u79D2\u5199\u5165\u7684\u5B57\u8282\u6570"]
|
|
2693
|
+
];
|
|
2694
|
+
const values = fields.map(([label, hint]) => {
|
|
2695
|
+
const cell = doc.createElement("span");
|
|
2696
|
+
cell.title = hint;
|
|
2697
|
+
cell.style.whiteSpace = "nowrap";
|
|
2698
|
+
const key = doc.createElement("span");
|
|
2699
|
+
key.style.color = "var(--dsw-alias-label-secondary, inherit)";
|
|
2700
|
+
key.textContent = label + " ";
|
|
2701
|
+
const value = doc.createTextNode("\u2014");
|
|
2702
|
+
cell.append(key, value);
|
|
2703
|
+
node.append(cell);
|
|
2704
|
+
return value;
|
|
2705
|
+
});
|
|
2706
|
+
function render(stats, failed = false) {
|
|
2707
|
+
node.title = failed ? "\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\u4E3B\u673A\u72B6\u6001\uFF0C\u5C06\u81EA\u52A8\u91CD\u8BD5" : "\u7EC8\u7AEF\u4E3B\u673A\u72B6\u6001 \xB7 \u2014 \u8868\u793A\u7B49\u5F85\u91C7\u6837\u6216\u7CFB\u7EDF\u672A\u63D0\u4F9B\u6B64\u6307\u6807";
|
|
2708
|
+
const display = [
|
|
2709
|
+
stats?.cpuPercent != null ? stats.cpuPercent + "%" : "\u2014",
|
|
2710
|
+
stats?.memory ? capacity(stats.memory.used, stats.memory.total) : "\u2014",
|
|
2711
|
+
stats?.disk ? capacity(stats.disk.available, stats.disk.total) : "\u2014",
|
|
2712
|
+
stats?.io ? rate(stats.io.read) : "\u2014",
|
|
2713
|
+
stats?.io ? rate(stats.io.write) : "\u2014"
|
|
2714
|
+
];
|
|
2715
|
+
values.forEach((value, i) => {
|
|
2716
|
+
if (value.data !== display[i]) value.data = display[i];
|
|
2717
|
+
});
|
|
2718
|
+
}
|
|
2719
|
+
render(null);
|
|
2720
|
+
return { node, render };
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
// src/patches/terminal-host-stats/client/monitor.ts
|
|
2724
|
+
var selector = "[data-sidebar-terminal]";
|
|
2725
|
+
function installMonitor(doc, sample) {
|
|
2726
|
+
const bars = /* @__PURE__ */ new Map();
|
|
2727
|
+
const visible = /* @__PURE__ */ new Set();
|
|
2728
|
+
let disposed = false;
|
|
2729
|
+
let pending = false;
|
|
2730
|
+
let timer;
|
|
2731
|
+
const active = () => !disposed && !doc.hidden && visible.size > 0;
|
|
2732
|
+
const update = async () => {
|
|
2733
|
+
timer = void 0;
|
|
2734
|
+
if (!active() || pending) return;
|
|
2735
|
+
pending = true;
|
|
2736
|
+
let stats = null;
|
|
2737
|
+
try {
|
|
2738
|
+
stats = await sample();
|
|
2739
|
+
} catch {
|
|
2740
|
+
}
|
|
2741
|
+
pending = false;
|
|
2742
|
+
if (!active()) return;
|
|
2743
|
+
for (const root of visible) bars.get(root)?.render(stats, stats === null);
|
|
2744
|
+
timer = setTimeout(update, 2e3);
|
|
2745
|
+
};
|
|
2746
|
+
const sync = () => {
|
|
2747
|
+
if (!active()) {
|
|
2748
|
+
clearTimeout(timer);
|
|
2749
|
+
timer = void 0;
|
|
2750
|
+
} else if (!pending && timer === void 0) void update();
|
|
2751
|
+
};
|
|
2752
|
+
const visibility = new IntersectionObserver((entries) => {
|
|
2753
|
+
for (const entry of entries) {
|
|
2754
|
+
if (bars.has(entry.target) && entry.isIntersecting) visible.add(entry.target);
|
|
2755
|
+
else visible.delete(entry.target);
|
|
2756
|
+
}
|
|
2757
|
+
sync();
|
|
2758
|
+
});
|
|
2759
|
+
const attach = (root) => {
|
|
2760
|
+
if (bars.has(root) || !root.isConnected) return;
|
|
2761
|
+
const bar = createBar(doc);
|
|
2762
|
+
bars.set(root, bar);
|
|
2763
|
+
root.prepend(bar.node);
|
|
2764
|
+
visibility.observe(root);
|
|
2765
|
+
};
|
|
2766
|
+
const discover = (element) => {
|
|
2767
|
+
if (element.matches(selector)) attach(element);
|
|
2768
|
+
else element.querySelectorAll(selector).forEach(attach);
|
|
2769
|
+
};
|
|
2770
|
+
const observer = new MutationObserver((records) => {
|
|
2771
|
+
for (const [root, bar] of bars) {
|
|
2772
|
+
if (root.isConnected) continue;
|
|
2773
|
+
visibility.unobserve(root);
|
|
2774
|
+
visible.delete(root);
|
|
2775
|
+
bars.delete(root);
|
|
2776
|
+
bar.node.remove();
|
|
2777
|
+
}
|
|
2778
|
+
for (const record2 of records) {
|
|
2779
|
+
if (record2.target instanceof Element && record2.target.closest(selector)) continue;
|
|
2780
|
+
for (const added of record2.addedNodes) if (added instanceof Element) discover(added);
|
|
2781
|
+
}
|
|
2782
|
+
sync();
|
|
2783
|
+
});
|
|
2784
|
+
discover(doc.body);
|
|
2785
|
+
observer.observe(doc.body, { childList: true, subtree: true });
|
|
2786
|
+
doc.addEventListener("visibilitychange", sync);
|
|
2787
|
+
return () => {
|
|
2788
|
+
disposed = true;
|
|
2789
|
+
clearTimeout(timer);
|
|
2790
|
+
doc.removeEventListener("visibilitychange", sync);
|
|
2791
|
+
observer.disconnect();
|
|
2792
|
+
visibility.disconnect();
|
|
2793
|
+
for (const bar of bars.values()) bar.node.remove();
|
|
2794
|
+
bars.clear();
|
|
2795
|
+
visible.clear();
|
|
2796
|
+
};
|
|
2797
|
+
}
|
|
2798
|
+
|
|
2799
|
+
// src/patches/terminal-host-stats/client/index.ts
|
|
2800
|
+
var clientPatch8 = {
|
|
2801
|
+
id: TERMINAL_HOST_STATS_ID,
|
|
2802
|
+
install: (ctx, activation) => {
|
|
2803
|
+
ctx.effect(() => {
|
|
2804
|
+
let dispose;
|
|
2805
|
+
const sync = () => {
|
|
2806
|
+
if (activation.getSnapshot()[TERMINAL_HOST_STATS_ID]) {
|
|
2807
|
+
dispose ??= installMonitor(document, () => callPatchApi(TERMINAL_HOST_STATS_ID, "sample", {}));
|
|
2808
|
+
} else {
|
|
2809
|
+
dispose?.();
|
|
2810
|
+
dispose = void 0;
|
|
2811
|
+
}
|
|
2812
|
+
};
|
|
2813
|
+
const unsubscribe = activation.subscribe(sync);
|
|
2814
|
+
sync();
|
|
2815
|
+
return () => {
|
|
2816
|
+
unsubscribe();
|
|
2817
|
+
dispose?.();
|
|
2818
|
+
};
|
|
2819
|
+
});
|
|
2820
|
+
}
|
|
2821
|
+
};
|
|
2822
|
+
|
|
2460
2823
|
// src/generated/client-registry.ts
|
|
2461
2824
|
var MESSAGE_ACTION_PATCHES = [{ id: "message-edit", order: 100, useActions: useMessageActions }, { id: "message-delete", order: 200, useActions: useMessageActions2 }];
|
|
2462
|
-
var CLIENT_PATCHES = [clientPatch, clientPatch2, clientPatch3, clientPatch4, clientPatch5, clientPatch6];
|
|
2825
|
+
var CLIENT_PATCHES = [clientPatch, clientPatch2, clientPatch3, clientPatch4, clientPatch5, clientPatch6, clientPatch7, clientPatch8];
|
|
2463
2826
|
|
|
2464
2827
|
// src/kernel/client/activation.ts
|
|
2465
2828
|
var ClientPatchActivation = class {
|
|
@@ -2570,7 +2933,8 @@ function installPatchConfigCard(ctx, activation) {
|
|
|
2570
2933
|
}, () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PatchConfigCard, { activation, initiallyOpen: true }) })));
|
|
2571
2934
|
return;
|
|
2572
2935
|
}
|
|
2573
|
-
|
|
2936
|
+
const legacy = ctx.slots;
|
|
2937
|
+
legacy.inject("settings.plugin.item", () => legacy.register({
|
|
2574
2938
|
name: "settings.plugin.item",
|
|
2575
2939
|
key: PATCH_SETTINGS_NAMESPACE,
|
|
2576
2940
|
priority: 90
|
|
@@ -2719,8 +3083,8 @@ function trajectorySourceSeq(row) {
|
|
|
2719
3083
|
return Number.isSafeInteger(seq) && seq >= 0 ? seq : void 0;
|
|
2720
3084
|
}
|
|
2721
3085
|
function useMessageTargets(props, hiddenSeqs, hiddenTrajectoryKeys, active = true) {
|
|
2722
|
-
const
|
|
2723
|
-
const surface = props.useChat(
|
|
3086
|
+
const selector2 = (0, import_react14.useMemo)(() => createMessageSurfaceSelector(active), [active, props.sessionId]);
|
|
3087
|
+
const surface = props.useChat(selector2);
|
|
2724
3088
|
const surfaceRef = (0, import_react14.useRef)(surface);
|
|
2725
3089
|
const hiddenSeqsRef = (0, import_react14.useRef)(hiddenSeqs);
|
|
2726
3090
|
const hiddenTrajectoryKeysRef = (0, import_react14.useRef)(hiddenTrajectoryKeys);
|
|
@@ -2832,12 +3196,12 @@ function useMessageTargets(props, hiddenSeqs, hiddenTrajectoryKeys, active = tru
|
|
|
2832
3196
|
};
|
|
2833
3197
|
requestFullScanRef.current = requestFullScan;
|
|
2834
3198
|
const observer = new MutationObserver((records) => {
|
|
2835
|
-
for (const
|
|
2836
|
-
if (
|
|
3199
|
+
for (const record2 of records) {
|
|
3200
|
+
if (record2.removedNodes.length > 0) {
|
|
2837
3201
|
pruneDisconnected = true;
|
|
2838
|
-
collectRows(
|
|
3202
|
+
collectRows(record2.target);
|
|
2839
3203
|
}
|
|
2840
|
-
|
|
3204
|
+
record2.addedNodes.forEach(collectRows);
|
|
2841
3205
|
}
|
|
2842
3206
|
if (pendingChatRows.size > 0 || pendingTrajectoryRows.size > 0 || pruneDisconnected) schedule();
|
|
2843
3207
|
});
|