@deepseek-ai/dsh-client-ui-tool 0.0.1-rc.1
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/LICENSE +28 -0
- package/README.i18n.yaml +6 -0
- package/README.md +49 -0
- package/README.zh.md +49 -0
- package/lib/client.js +1614 -0
- package/lib/index.js +6 -0
- package/lib/invariant.js +23 -0
- package/lib/types/client/apply.d.ts +10 -0
- package/lib/types/client/contract/slots.d.ts +35 -0
- package/lib/types/client/index.d.ts +4 -0
- package/lib/types/client/locale.d.ts +3 -0
- package/lib/types/client/tool/ToolCallTree.d.ts +9 -0
- package/lib/types/client/tool/ToolDetails.d.ts +16 -0
- package/lib/types/client/tool/components/ToolRow.d.ts +79 -0
- package/lib/types/client/tool/models/diff-card-model.d.ts +58 -0
- package/lib/types/client/tool/models/read-card-model.d.ts +60 -0
- package/lib/types/client/tool/models/search-card-model.d.ts +89 -0
- package/lib/types/client/tool/models/terminal-card-model.d.ts +71 -0
- package/lib/types/client/tool/models/tool-call-model.d.ts +65 -0
- package/lib/types/client/tool/models/web-card-model.d.ts +39 -0
- package/lib/types/client/tool/toolviews/GenericToolCard.d.ts +7 -0
- package/lib/types/client/tool/toolviews/ask-question-row.d.ts +23 -0
- package/lib/types/client/tool/toolviews/bash-sample.d.ts +26 -0
- package/lib/types/client/tool/toolviews/file-mutation-row.d.ts +31 -0
- package/lib/types/client/tool/toolviews/plan-summary.d.ts +48 -0
- package/lib/types/client/tool/toolviews/read-row.d.ts +26 -0
- package/lib/types/client/tool/toolviews/search-row.d.ts +31 -0
- package/lib/types/client/tool/toolviews/todo-row.d.ts +25 -0
- package/lib/types/client/tool/toolviews/web-row.d.ts +26 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/invariant.d.ts +16 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, DeepSeek
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/client/ui-tool/README.md
|
|
5
|
+
README.md: 8255aee4292ea821962477a7108b40cf3b937981
|
|
6
|
+
README.zh.md: 2bc5859f592efb6ac4b67157be09a3c09afb691c
|
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @deepseek-ai/dsh-client-ui-tool
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
Client Tool presentation plugin. `ui-conversation` dispatches each ordered `tool-call` Conversation Node through the matching key of `conversation.chat.node`; this package renders its root and Code Dispatch children, then dispatches every atomic call through the keyed `tool.call.toolview` slot. Unregistered Tool names use the generic card.
|
|
6
|
+
|
|
7
|
+
Business UI packages register only their wire Tool names and atomic views. They do not pair Session events, rebuild the transcript, or own root/subcall topology. The Runtime remains authoritative for call/result pairing, lifecycle, and recursive `subCalls` projection; the conversation view remains authoritative for ChatFlow placement.
|
|
8
|
+
|
|
9
|
+
## Rendering contract
|
|
10
|
+
|
|
11
|
+
`ToolCallTree` receives one root `ToolCallBlock` that already contains recursive `subCalls`, selection state, the session `cwd`, and Host callbacks for opening files and inspecting calls. It recursively walks the standard call blocks and sends the root and children at every depth through the same atomic dispatch path, without subscribing to a separate parent-to-children map.
|
|
12
|
+
|
|
13
|
+
Each root and child wrapper preserves the `data-chat-anchor-key="call:<id>"` and `data-chat-call-id` DOM contract used for paging and selection.
|
|
14
|
+
|
|
15
|
+
The package also fills `conversation.details.tool` with `ToolDetails`. The row and details renderers share the same pure card models for `terminal`, `read`, `diff`, `search`, and `web` render intents. Unknown intent tags and malformed wire card data fall back to flattened Tool result text.
|
|
16
|
+
|
|
17
|
+
Generic rows classify known Tool names into search, read, shell, write, edit, code, or generic variants. Running, successful, failed, and interrupted lifecycle states come only from the frozen call/result slice. File paths resolve against the session `cwd` only when the user invokes the Host open-file callback; presentation code does not read Session services.
|
|
18
|
+
|
|
19
|
+
## Atomic Tool views
|
|
20
|
+
|
|
21
|
+
An owning business package registers its wire Tool name into `tool.call.toolview`:
|
|
22
|
+
|
|
23
|
+
```ts ignore-check
|
|
24
|
+
ctx.slots.inject('tool.call.toolview', () =>
|
|
25
|
+
ctx.slots.register({
|
|
26
|
+
name: 'tool.call.toolview',
|
|
27
|
+
key: '<wire tool name>',
|
|
28
|
+
}, BusinessToolRow))
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The owner payload is `ToolCallOwnerProps`: `callId`, `toolName`, the frozen `block`, optional `cwd`, and plain `openFile`/`inspect` callbacks. The registration receives the normal session slot runtime share. It does not receive React nodes, Runtime services, or root/subcall knowledge.
|
|
32
|
+
|
|
33
|
+
This package currently owns the generic fallback and the built-in bash/pwsh, read, write/edit, grep/glob, web, todo, question, and Code Dispatch presentations. `ui-skill` demonstrates a business-owned registration for `skill`.
|
|
34
|
+
|
|
35
|
+
Card-specific limits and fallback rules remain in the owning [terminal](../../../.agents/notes/implemented/feature/2026-07-28-web-terminal-card.md), [diff](../../../.agents/notes/implemented/feature/2026-07-30-web-diff-card.md), [read](../../../.agents/notes/implemented/feature/2026-07-30-web-read-card-frontend.md), [search](../../../.agents/notes/implemented/feature/2026-07-30-web-search-card.md), and [web](../../../.agents/notes/implemented/feature/2026-07-30-web-result-card-frontend.md) notes.
|
|
36
|
+
|
|
37
|
+
## Model Experience
|
|
38
|
+
|
|
39
|
+
None, as this package renders already logged Tool calls and results without altering model requests, Tool execution, or session events.
|
|
40
|
+
|
|
41
|
+
#### KV Cache effect
|
|
42
|
+
|
|
43
|
+
None. The package is client-only presentation.
|
|
44
|
+
|
|
45
|
+
## Known Limitations and Deferred Work
|
|
46
|
+
|
|
47
|
+
- The Host excludes `run_code` from Code Mode program bindings, so production events produce one dispatch level; the recursive Runtime/UI contract supports nesting.
|
|
48
|
+
- First-party Tool views are colocated here and can move to their owning business packages independently through the keyed slot.
|
|
49
|
+
- Tool copy reuses the `ui-conversation` locale namespace.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @deepseek-ai/dsh-client-ui-tool
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
Client Tool 展示插件。`ui-conversation` 通过 `conversation.chat.node` 的同名 key 分发每个已排序的 `tool-call` Conversation Node;本包渲染其中的 root 及其 Code Dispatch 子调用,并把每个原子调用通过 keyed slot `tool.call.toolview` 分发。没有注册的 Tool 名称使用通用卡片。
|
|
6
|
+
|
|
7
|
+
业务 UI 包只注册 wire Tool 名称和原子视图,不配对 Session Event、不重建 transcript,也不拥有 root/subcall 拓扑。Runtime 继续负责 call/result 配对、生命周期和递归 `subCalls` 投影;conversation view 继续负责 ChatFlow 位置。
|
|
8
|
+
|
|
9
|
+
## 渲染约定
|
|
10
|
+
|
|
11
|
+
`ToolCallTree` 接收一个已经包含递归 `subCalls` 的 root `ToolCallBlock`、selection 状态、会话 `cwd`,以及用于打开文件和检查调用的 Host 回调。它递归遍历标准 call block,让 root 与任意深度的 child 经过同一条原子分发路径,不再订阅独立的 parent-to-children map。
|
|
12
|
+
|
|
13
|
+
每个 root 和 child wrapper 都保留 `data-chat-anchor-key="call:<id>"` 与 `data-chat-call-id` DOM 约定,供分页和 selection 使用。
|
|
14
|
+
|
|
15
|
+
本包还通过 `ToolDetails` 填充 `conversation.details.tool`。行 renderer 与详情 renderer 为 `terminal`、`read`、`diff`、`search` 和 `web` render intent 共用同一组纯 card model。本版本不认识的 intent 标签和格式错误的 wire card 数据都会回退为压平的 Tool result 文本。
|
|
16
|
+
|
|
17
|
+
通用行把已知 Tool 名称归类为 search、read、shell、write、edit、code 或 generic 变体。运行中、成功、失败和中断状态只来自冻结的 call/result slice。只有用户调用 Host 打开文件回调时,文件路径才相对会话 `cwd` 解析;展示代码不读取 Session service。
|
|
18
|
+
|
|
19
|
+
## 原子 Tool 视图
|
|
20
|
+
|
|
21
|
+
业务所有方把自己的 wire Tool 名称注册进 `tool.call.toolview`:
|
|
22
|
+
|
|
23
|
+
```ts ignore-check
|
|
24
|
+
ctx.slots.inject('tool.call.toolview', () =>
|
|
25
|
+
ctx.slots.register({
|
|
26
|
+
name: 'tool.call.toolview',
|
|
27
|
+
key: '<wire tool name>',
|
|
28
|
+
}, BusinessToolRow))
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
owner 载荷为 `ToolCallOwnerProps`:`callId`、`toolName`、冻结的 `block`、可选 `cwd`,以及普通的 `openFile`/`inspect` 回调。注册项会收到正常的 Session slot runtime share,但不会收到 React node、Runtime service 或 root/subcall 知识。
|
|
32
|
+
|
|
33
|
+
本包当前拥有 generic fallback,以及 bash/pwsh、read、write/edit、grep/glob、web、todo、question 和 Code Dispatch 的内置展示。`ui-skill` 展示了业务包如何拥有 `skill` 注册。
|
|
34
|
+
|
|
35
|
+
各类卡片的上限与 fallback 规则仍由对应的 [terminal](../../../.agents/notes/implemented/feature/2026-07-28-web-terminal-card.md)、[diff](../../../.agents/notes/implemented/feature/2026-07-30-web-diff-card.md)、[read](../../../.agents/notes/implemented/feature/2026-07-30-web-read-card-frontend.md)、[search](../../../.agents/notes/implemented/feature/2026-07-30-web-search-card.md) 和 [web](../../../.agents/notes/implemented/feature/2026-07-30-web-result-card-frontend.md) Note 负责。
|
|
36
|
+
|
|
37
|
+
## 模型体验
|
|
38
|
+
|
|
39
|
+
无,因为本包只渲染已经记录的 Tool 调用和结果,不改变模型请求、Tool 执行或 Session Event。
|
|
40
|
+
|
|
41
|
+
#### KV Cache 影响
|
|
42
|
+
|
|
43
|
+
无。本包只负责 Client 展示。
|
|
44
|
+
|
|
45
|
+
## 已知限制与后续工作
|
|
46
|
+
|
|
47
|
+
- Host 不把 `run_code` 暴露为 Code Mode 程序 binding,因此生产事件只产生一层分发;递归的运行时/UI 约定支持嵌套。
|
|
48
|
+
- 第一方 Tool 视图集中在本包,可以通过 keyed slot 独立迁回各自业务包。
|
|
49
|
+
- Tool 文案复用 `ui-conversation` locale namespace。
|