@huanlin/dsh-focus-chat 0.1.23
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 +73 -0
- package/README.zh.md +71 -0
- package/cordis.patch.yml +7 -0
- package/lib/client.js +6051 -0
- package/lib/index.js +6 -0
- package/lib/types/client/apply.d.ts +12 -0
- package/lib/types/client/contract/props.d.ts +78 -0
- package/lib/types/client/index.d.ts +10 -0
- package/lib/types/client/locales.d.ts +437 -0
- package/lib/types/client/model/feedback-controller.d.ts +161 -0
- package/lib/types/client/model/flow.d.ts +76 -0
- package/lib/types/client/model/index.d.ts +5 -0
- package/lib/types/client/model/text.d.ts +42 -0
- package/lib/types/client/model/todo.d.ts +38 -0
- package/lib/types/client/model/tools.d.ts +35 -0
- package/lib/types/client/model/turn-slice.d.ts +38 -0
- package/lib/types/client/model/types.d.ts +289 -0
- package/lib/types/client/view/FocusView.d.ts +9 -0
- package/lib/types/client/view/chrome/ImageLightbox.d.ts +26 -0
- package/lib/types/client/view/chrome/MessageActions.d.ts +24 -0
- package/lib/types/client/view/chrome/MessageFeedbackActions.d.ts +46 -0
- package/lib/types/client/view/chrome/MessageImage.d.ts +46 -0
- package/lib/types/client/view/chrome/NavRail.d.ts +21 -0
- package/lib/types/client/view/chrome/ReferenceIcon.d.ts +17 -0
- package/lib/types/client/view/chrome/RunningStatus.d.ts +7 -0
- package/lib/types/client/view/chrome/TurnNavigator.d.ts +14 -0
- package/lib/types/client/view/helpers/format.d.ts +30 -0
- package/lib/types/client/view/helpers/icons.d.ts +9 -0
- package/lib/types/client/view/helpers/image-labels.d.ts +13 -0
- package/lib/types/client/view/helpers/message.d.ts +13 -0
- package/lib/types/client/view/helpers/terminal.d.ts +20 -0
- package/lib/types/client/view/rows/CommandRow.d.ts +12 -0
- package/lib/types/client/view/rows/CompactionRow.d.ts +24 -0
- package/lib/types/client/view/rows/ContextRow.d.ts +22 -0
- package/lib/types/client/view/rows/FlowRow.d.ts +20 -0
- package/lib/types/client/view/rows/RemoteTurnRow.d.ts +33 -0
- package/lib/types/client/view/rows/RetryRow.d.ts +10 -0
- package/lib/types/client/view/rows/SystemPromptRow.d.ts +12 -0
- package/lib/types/client/view/rows/ThinkRow.d.ts +16 -0
- package/lib/types/client/view/rows/ToolCallRow.d.ts +8 -0
- package/lib/types/client/view/rows/ToolGroupRow.d.ts +11 -0
- package/lib/types/client/view/rows/TurnFoldRow.d.ts +27 -0
- package/lib/types/client/view/rows/TurnTailRow.d.ts +16 -0
- package/lib/types/client/view/rows/TurnUsageDisclosure.d.ts +9 -0
- package/lib/types/client/view/rows/UserBubble.d.ts +18 -0
- package/lib/types/client/view/rows/group-title.d.ts +32 -0
- package/lib/types/client/view/rows/produced-fit.d.ts +14 -0
- package/lib/types/host/rpc.d.ts +63 -0
- package/lib/types/host/turn-index.d.ts +40 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/protocol.d.ts +94 -0
- package/package.json +109 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# dsh-focus-chat
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@huanlin/dsh-focus-chat)
|
|
4
|
+
|
|
5
|
+
English | [中文](README.zh.md)
|
|
6
|
+
|
|
7
|
+
A plugin for the dsh web GUI that adds a **focus chat** tab — a condensed, Claude Code–style way to read a conversation.
|
|
8
|
+
|
|
9
|
+
## Screenshots
|
|
10
|
+
|
|
11
|
+
| Off — the normal chat view | On — the focus chat view |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
|  |  |
|
|
14
|
+
|
|
15
|
+
Instead of watching every step live, one assistant turn collapses into a single summary line:
|
|
16
|
+
|
|
17
|
+
> Thought for 36s, loaded 3 context items, ran 2 shell commands, edited 8 files, read 17 files, listed 18 directories
|
|
18
|
+
|
|
19
|
+
…and the whole turn can fold into one `Worked for Xm Ys` line. Click any line to expand the full detail — tool cards, thinking, context injections, produced files, copy/fork actions — all drawn the same way as the normal chat rows. Your mid-turn interjections split the fold into per-stretch lines, each carrying its own duration, and a stopped turn reads `Stopped after X` instead of "worked". A background-task settlement — a tool-jobs `notice` injection like `bash pnpm install [status: completed]` — classifies into the summary line's `N background jobs` segment instead of riding it as a verbatim `injected …` account; expanding the line still shows the full notice body. File operations (edits / reads) never carry a failure tally on the summary line — `edited N files` reads the outcome — only command execution and other tools annotate failures.
|
|
20
|
+
|
|
21
|
+
Switch to it whenever you want the "what happened?" view, and flip back for the full transcript.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
# Install from npm (requires dsh >= 0.1.2-alpha.1)
|
|
27
|
+
dsh plugin --profile web add @huanlin/dsh-focus-chat
|
|
28
|
+
# Restart dsh web; the tab mounts automatically
|
|
29
|
+
dsh web
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Then open the Focus chat tab in any conversation.
|
|
33
|
+
|
|
34
|
+
Notes:
|
|
35
|
+
|
|
36
|
+
- `dsh plugin` behaves like adding a dependency to your web profile. A bundle plugin is loaded once its full package name appears in the profile's `dsh.profile.bundles` list (adds automatically on recent dsh builds; add it manually if your build does not); the bundle patch applies on the next boot.
|
|
37
|
+
- With the repo source-launched CLI, run the args through the bin directly (`node --import tsx/esm apps/cli/src/bin.ts ...`).
|
|
38
|
+
|
|
39
|
+
## Why a separate tab, and not a patch into the chat view?
|
|
40
|
+
|
|
41
|
+
Short answer: the chat view's internals aren't open to third-party plugins — by design — and this plugin deliberately never touches dsh's own source. Concretely:
|
|
42
|
+
|
|
43
|
+
- **Keyed slots are owned, not shared.** The chat's rows render through slots like `conversation.chat.node`, `tool.call.toolview`, and `conversation.chat.turnTail`. Those slots are declared by the chat entries themselves, and the slot system rejects a second declaration at load time — the conflict *is* the design speaking. A plugin cannot insert its own rows into the chat transcript, and cannot even *declare* the chat's own slots.
|
|
44
|
+
- **Plugins can't reuse the chat's renderer code.** Importing values from another plugin package across the bundle boundary is forbidden (the bundle purity gate), so there's no way to borrow the chat's components — every row has to be drawn from the shared primitives and the public snapshot.
|
|
45
|
+
- **The only legal insertion point is the `conversation.view` list slot** — the whole message surface. That's why the plugin ships its own complete view instead of changing how the chat view displays.
|
|
46
|
+
|
|
47
|
+
If you want the chat view itself to behave differently, that's an in-repo change to the chat package — exactly what this plugin avoids.
|
|
48
|
+
|
|
49
|
+
## What's missing
|
|
50
|
+
|
|
51
|
+
Focus chat is a faithful reading surface, not a second chat view:
|
|
52
|
+
|
|
53
|
+
- **No Inspect / details-panel deep links.** The chat's Inspect affordance needs internals plugins can't touch. The tool cards render the same content, just without the jump-to-details button.
|
|
54
|
+
- **Third-party tool-card extensions don't render here.** Cards that other plugins add to the chat view won't appear in the focus view; the built-in card renderers are used instead.
|
|
55
|
+
- **Folding is per consecutive tool-run.** Any visible content between two runs (a reply, a command, your interjection) keeps them separate.
|
|
56
|
+
- **Inline file links need the optional file-mentions service** — the same off switch the chat view uses.
|
|
57
|
+
|
|
58
|
+
## Development
|
|
59
|
+
|
|
60
|
+
> This build targets the dsh v0.1.2-alpha.1 client surface. The new `@deepseek-ai/*` packages it needs are not on npm yet: after `yarn install`, junction/symlink each `@deepseek-ai/dsh-*` entry in `node_modules` to the matching `packages/<group>/<pkg>` directory of a built dsh checkout — that supplies both the types and the runtime for `yarn typecheck` / `yarn test`.
|
|
61
|
+
|
|
62
|
+
- `yarn run build` — builds the browser bundle and the Node half.
|
|
63
|
+
- `src/client/focus-model.ts` — the pure logic (folding, merging, row models); `src/client/FocusView.tsx` — the view.
|
|
64
|
+
- `yarn test` — behavior tests; `yarn run typecheck` — type gate.
|
|
65
|
+
- A `--dev` `dsh web` server hot-reloads rebuilt bundles — `yarn run build` alone is usually enough to see changes.
|
|
66
|
+
|
|
67
|
+
## Model Experience
|
|
68
|
+
|
|
69
|
+
None. The view is a pure client derivation over the already-logged conversation snapshot; nothing here reaches a model request.
|
|
70
|
+
|
|
71
|
+
#### KV Cache effect
|
|
72
|
+
|
|
73
|
+
None; this package neither assembles nor sends provider requests.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# dsh-focus-chat
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@huanlin/dsh-focus-chat)
|
|
4
|
+
|
|
5
|
+
[English](README.md) | 中文
|
|
6
|
+
|
|
7
|
+
一个给 dsh Web GUI 的插件,加了一个 **聚焦对话** 标签页——用 Claude Code 的方式精简地读对话。
|
|
8
|
+
|
|
9
|
+
## 截图
|
|
10
|
+
|
|
11
|
+
| 关闭——普通聊天视图 | 开启——聚焦对话视图 |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
|  |  |
|
|
14
|
+
|
|
15
|
+
不再一步步盯着过程,一个助手回合会收成一条摘要行:
|
|
16
|
+
|
|
17
|
+
> 思考了 36 秒,载入了 3 项上下文,运行了 2 个命令,编辑了 8 次,读取了 17 个文件,列出了 18 个目录
|
|
18
|
+
|
|
19
|
+
整回合还能再收成一条 `工作了 X 分 Y 秒` 行。点任何一行都能展开成完整细节——工具卡片、思考、上下文注入、产物、复制/fork 操作——全部和普通聊天行同款画法。中途插话会把折叠按段切开,每段带自己的时长;被停止的回合显示 `用户 X 后停止` 而不是"工作了"。后台任务的结算通知(tool-jobs 的 `bash pnpm install [status: completed]` 这类 `notice` 注入)会归入摘要行的 `后台任务 N 个` 段,而不是原样写一条 `注入了 …`;展开该行仍能看到完整的通知正文。文件操作(编辑/读写)的失败不会写进摘要行——`edited N files` 读的是结果,只有命令和其他工具才带失败标注。
|
|
20
|
+
|
|
21
|
+
想看"刚才到底发生了什么"就切过来,想看完整过程就切回聊天视图。
|
|
22
|
+
|
|
23
|
+
## 安装
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
# 从 npm 安装(需要 dsh >= 0.1.0-rc.6)
|
|
27
|
+
dsh plugin --profile web add @huanlin/dsh-focus-chat
|
|
28
|
+
# 重启 dsh web,标签页自动挂载
|
|
29
|
+
dsh web
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
然后打开任意对话里的 聚焦对话 标签页。
|
|
33
|
+
|
|
34
|
+
说明:
|
|
35
|
+
|
|
36
|
+
- `dsh plugin` 相当于给 web profile 加一个依赖。bundle 型插件需要在 profile 的 `dsh.profile.bundles` 里出现它的完整包名才会被加载(新版本 dsh 会自动加;如果你的版本没加,请手动补上);bundle patch 在下次启动时生效。
|
|
37
|
+
- 用仓库源码启动的 CLI 时,请直接调用 bin(`node --import tsx/esm apps/cli/src/bin.ts ...`)。
|
|
38
|
+
|
|
39
|
+
## 为什么要单独一个标签页?为什么不直接改聊天视图?
|
|
40
|
+
|
|
41
|
+
一句话:聊天视图的内部对第三方插件是封闭的——这是设计如此——而且这个插件刻意不碰 dsh 自己的源码。具体来说:
|
|
42
|
+
|
|
43
|
+
- **键控槽位是独占的,不是共享的。**聊天的行通过 `conversation.chat.node`、`tool.call.toolview`、`conversation.chat.turnTail` 这类槽位渲染。这些槽位由聊天入口自己声明,槽位系统在加载期拒绝重复声明——冲突本身就是设计在说话。插件既不能往聊天对话流里插自己的行,甚至连声明聊天自己的槽位都不行。
|
|
44
|
+
- **插件不能复用聊天的渲染代码。**跨 bundle 边界导入另一个插件包的值是被禁止的(bundle purity 门禁),所以没有任何办法借用聊天的组件——每一行都只能用共享原语和公开快照自己画。
|
|
45
|
+
- **唯一合法的插入点是 `conversation.view` 列表槽**——整个消息界面。这就是为什么插件自带一整个视图,而不是去改聊天视图的显示方式。
|
|
46
|
+
|
|
47
|
+
想让聊天视图本身换个行为,那是聊天包仓库内的改动——正是这个插件要避免的。
|
|
48
|
+
|
|
49
|
+
## 缺什么
|
|
50
|
+
|
|
51
|
+
聚焦对话是忠实的阅读界面,不是第二个聊天视图:
|
|
52
|
+
|
|
53
|
+
- **没有 Inspect / 详情面板深链。**聊天的 Inspect 入口依赖插件够不到的内部机制;工具卡片内容一样,只是没有"跳去详情"的按钮。
|
|
54
|
+
- **别的插件给聊天加的工具卡片扩展在这里不渲染。**聚焦视图用内置的卡片渲染。
|
|
55
|
+
- **折叠按连续工具轮次。**两段之间有任何可见内容(回复、命令、你的插话)就保持分开。
|
|
56
|
+
- **行内文件链接依赖可选的文件提及服务**——和聊天视图同一个开关。
|
|
57
|
+
|
|
58
|
+
## 开发
|
|
59
|
+
|
|
60
|
+
- `yarn run build` — 产出浏览器 bundle 和 Node 半边。
|
|
61
|
+
- `src/client/focus-model.ts` — 纯逻辑(折叠、合并、行模型);`src/client/FocusView.tsx` — 视图。
|
|
62
|
+
- `yarn test` — 行为测试;`yarn run typecheck` — 类型门禁。
|
|
63
|
+
- `--dev` 的 `dsh web` 会自动热加载重建的 bundle——改完 `yarn run build` 一般就能看到效果。
|
|
64
|
+
|
|
65
|
+
## 模型体验
|
|
66
|
+
|
|
67
|
+
无。该视图是对已记录对话快照的纯客户端派生,这里没有任何内容进入模型请求。
|
|
68
|
+
|
|
69
|
+
#### KV Cache 影响
|
|
70
|
+
|
|
71
|
+
无;该包既不组装也不发送提供方请求。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# The dsh-focus-chat bundle patch: one browser plugin row added to the web
|
|
2
|
+
# profile composition. Applied after the web-app bundle's own patch layer;
|
|
3
|
+
# the row joins the dshClient roster, so the modules node half serves
|
|
4
|
+
# lib/client.js into the boot graph and the browser shows the 聚焦 tab.
|
|
5
|
+
- insert:
|
|
6
|
+
- id: ui-focus
|
|
7
|
+
name: '@huanlin/dsh-focus-chat'
|