@fish-under-sea/dsh-visual-companion 0.1.4 → 0.1.6
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.en.md +163 -0
- package/README.md +163 -144
- package/bin/visual-companion.mjs +248 -248
- package/cordis.patch.yml +18 -18
- package/lib/index.js +335 -323
- package/lib/message.js +42 -42
- package/package.json +75 -74
package/README.en.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# @fish-under-sea/dsh-visual-companion
|
|
4
|
+
|
|
5
|
+
**Click on the page and move on — give your DSH session a visual companion: pick, annotate, submit, and the session continues on its own.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@fish-under-sea/dsh-visual-companion)
|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
[简体中文](README.md) · **English**
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
## What problem does this solve
|
|
18
|
+
|
|
19
|
+
When reviewing prototypes, comparing layouts, or picking options in a browser, two things get in the way:
|
|
20
|
+
|
|
21
|
+
1. **You have to switch back to the terminal and retype your choices**: "I pick B, and make the colors cooler" — the person reviewing the mockup shouldn't also be a typist;
|
|
22
|
+
2. **Or the opposite: every click wakes the assistant**: pick three options, interrupt the assistant three times — noisy and token-wasteful.
|
|
23
|
+
|
|
24
|
+
This plugin solves both: **picking stays completely silent** (only local page state changes), and **only pressing "Submit to assistant" wakes the session once**, delivering the full set of choices and notes in a single message.
|
|
25
|
+
|
|
26
|
+
## What you get
|
|
27
|
+
|
|
28
|
+
- **Silent picking**: clicking, unclicking, and typing notes never fire a request or wake the session;
|
|
29
|
+
- **One submit = one wake**: all selections plus notes are composed into a single user message, e.g.
|
|
30
|
+
`[Visual Companion] User picked 2 items on the page: A (single-column layout), C (hybrid). Note: more spacing. Synced to you — just keep going (no need to ask).`
|
|
31
|
+
- **Auto-continue**: the session receives the message and starts a new turn immediately, no retyping needed;
|
|
32
|
+
- **Adaptive UI**: single-select / multi-select (add `data-multiselect` to the container), note field, waiting screen; the submit bar hides automatically when there are no options on the page.
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
# Recommended: install from npm (--profile: desktop for the desktop app, web for the web app)
|
|
38
|
+
dsh plugin --profile <profile> add @fish-under-sea/dsh-visual-companion
|
|
39
|
+
|
|
40
|
+
# For source changes only: use link: (repo source is the install source; restart DSH to pick up changes)
|
|
41
|
+
dsh plugin --profile <profile> add "link:<repo-path>/packages/dsh-visual-companion"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Restart the profile's host** after installing (new plugin packages require a restart to enter the composition; afterwards, only changes to `cordis.patch.yml` content can be hot-reloaded).
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
This package consists of **two halves**, neither of which touches the model API:
|
|
49
|
+
|
|
50
|
+
- **Local service** (`bin/visual-companion.mjs`): zero-dependency HTTP server that renders pages, receives clicks, and writes `events.jsonl` and `pending.json`;
|
|
51
|
+
- **Host plugin** (`lib/index.js`): watches `state/pending.json` and, on each submit, delivers a user message to the target session and starts a new turn.
|
|
52
|
+
|
|
53
|
+
### Start the local service
|
|
54
|
+
|
|
55
|
+
A managed background task; the directory lives in a temporary location inside the workspace:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
node "$DSH_HOME/profiles/<profile>/node_modules/@fish-under-sea/dsh-visual-companion/bin/visual-companion.mjs" \
|
|
59
|
+
--dir "<workspace>/.dsh-visual" --port 0 --session "$DSH_SESSION_ID"
|
|
60
|
+
# → prints { url, port, key, screenDir, stateDir, pendingFile, session }
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Write a screen
|
|
64
|
+
|
|
65
|
+
Write HTML fragments into `<dir>/screen/` (use semantic filenames, don't reuse; write a full document — starting with `<!DOCTYPE` or `<html` — only when you need full page control).
|
|
66
|
+
|
|
67
|
+
### Open the page
|
|
68
|
+
|
|
69
|
+
Hand the `url` together with `?key=` to the user (in DSH, use `sidebar_open` to open it in the sidebar). Requests without the key are rejected with 403.
|
|
70
|
+
|
|
71
|
+
### Built-in styles
|
|
72
|
+
|
|
73
|
+
The service ships a framework stylesheet with these classes — just use them in your fragments:
|
|
74
|
+
|
|
75
|
+
| Purpose | Class |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| Options (single-select; add `data-multiselect` to the container for multi-select) | `.options` > `.option[data-choice]`, click calls `toggleSelect(this)`; `.cards` > `.card` works the same way |
|
|
78
|
+
| Visual blocks | `.mockup`, `.split`, `.pros-cons`, `.mock-nav`, `.mock-sidebar`, `.mock-content`, `.mock-button`, `.mock-input`, `.placeholder` |
|
|
79
|
+
| Text hierarchy | `h2` / `h3` / `.subtitle` / `.section` / `.label` |
|
|
80
|
+
|
|
81
|
+
### `visual_companion` tool
|
|
82
|
+
|
|
83
|
+
The plugin registers a `visual_companion` tool:
|
|
84
|
+
|
|
85
|
+
| Action | Parameters | Effect |
|
|
86
|
+
| --- | --- | --- |
|
|
87
|
+
| `arm` | `dir`, `session_id?` | Bind a directory and target session; `session_id` may be omitted (supplied later by `pending.json`) |
|
|
88
|
+
| `disarm` | — | Unbind and close the watcher |
|
|
89
|
+
| `status` | — | Binding state, wake count, last result, current `pending.json` |
|
|
90
|
+
| `wake` | `session_id`, `text` | Immediately probe the wake pipeline (bypasses the page) |
|
|
91
|
+
|
|
92
|
+
### On-disk files
|
|
93
|
+
|
|
94
|
+
All persisted files live in `<dir>/state/`:
|
|
95
|
+
|
|
96
|
+
| File | Content |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| `pending.json` | **Written only on submit**: `{type:"submit", selections:[{choice,text}], note, at, sessionId}` — the plugin watches this |
|
|
99
|
+
| `events.jsonl` | Appended per event: `click` is the picking process (no wake), `submit` is a full submission (wakes once) |
|
|
100
|
+
| `server-info` / `server-stopped` | Service startup info and shutdown reason |
|
|
101
|
+
|
|
102
|
+
### Slash command `/companion`
|
|
103
|
+
|
|
104
|
+
Type directly in a session:
|
|
105
|
+
|
|
106
|
+
```text
|
|
107
|
+
/companion [topic to review]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The plugin will: **①** start the local service in the background if it isn't running (zero dependencies, auto-assigned port); **②** hand the full URL with the session key to the current session's assistant, which opens it in the sidebar via `sidebar_open`; **③** have the assistant bind the watcher and write the first prototype screen into `screen/`. After that, just pick, write notes, and press "Submit to assistant".
|
|
111
|
+
|
|
112
|
+
> The command only handles "start the service + hand off" — what appears on the page is still decided by the assistant's HTML fragments. So it's more convenient than running `bin/visual-companion.mjs` by hand, but it won't decide what to show.
|
|
113
|
+
|
|
114
|
+
## Configuration
|
|
115
|
+
|
|
116
|
+
| Key | Default | Description |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| `watchDir` | `""` | When non-empty, **auto-binds** that directory on load (config hot-reload / restart won't drop the binding); leave empty to `arm` manually via `visual_companion` |
|
|
119
|
+
|
|
120
|
+
The target session is **not stored in config**: it comes from the `sessionId` written with each submit (set by the service's `--session` at startup), so the same service can serve different sessions and no machine-specific session id ends up in shared config.
|
|
121
|
+
|
|
122
|
+
Machine-specific absolute paths don't go into the shared bundle. To enable auto-binding, override with the same id in your own profile patch layer:
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
- id: visual-companion
|
|
126
|
+
name: '@fish-under-sea/dsh-visual-companion'
|
|
127
|
+
config:
|
|
128
|
+
watchDir: D:/some/workspace/.dsh-visual
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Compatibility and boundaries
|
|
132
|
+
|
|
133
|
+
Delivery tries each strategy in order (closest to the public surface first) and returns the one that actually succeeds:
|
|
134
|
+
|
|
135
|
+
1. `agent.followup(createUserMessage(...))` — the same public path used by slash-command user-message injection;
|
|
136
|
+
2. `agent.steer(...)` — when the target is currently running;
|
|
137
|
+
3. `ctx.subagents[Symbol.for('dsh.subagent.queuePrompt' | 'deliverPrompt')]` — the host-internal delivery hook for renewable subagents.
|
|
138
|
+
|
|
139
|
+
- **host-only**: a host plugin (no `dsh.client`, no browser half, no frontend build) plus a local service — a zero-dependency HTTP server that serves the interactive browser page. That page comes from the local service, and is **not** a DSH client plugin;
|
|
140
|
+
- Zero-dependency service (Node stdlib only), auto-assigned port, URL includes a session key; `--host 0.0.0.0 --url-host <hostname>` supports remote / container use, but **`?key=` must be preserved**;
|
|
141
|
+
- Service **auto-exits after 4 hours idle** (tunable via `--idle-minutes`); screen files are temporary artifacts, don't treat them as deliverables;
|
|
142
|
+
- Degradation chain: no Node → self-contained HTML + `present`; no sidebar browser → hand the full URL to the user to open manually; plugin not installed → manually read `events.jsonl` next turn;
|
|
143
|
+
- Requires Node `^22.19.0 || >=24`, DSH `>=0.2.0-rc.2`; no API key needed;
|
|
144
|
+
- **Binding is fault-tolerant** (since 0.1.5): when `<watchDir>/state` doesn't exist yet, it is **created recursively**; if watching fails (path is not a directory, insufficient permissions), only a warning is logged and the state stays honestly "unbound" — **the plugin loads normally**, the tool and `/companion` don't disappear together, and `visual_companion({action:"arm"})` can retry once fixed;
|
|
145
|
+
- **Known limitation**: host plugin code is not hot-reloaded — changing `lib/index.js` requires restarting the host; only `cordis.patch.yml` content changes can be hot-reloaded.
|
|
146
|
+
|
|
147
|
+
## Development and testing
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
# Fresh clone: run pnpm install in the package directory first (zero runtime deps, but tests need the 3 DSH packages declared as devDependencies)
|
|
151
|
+
node packages/dsh-visual-companion/test/visual-companion.test.mjs # message rendering + manifest contract + binding fault tolerance (10 cases)
|
|
152
|
+
pnpm pack # artifact check: files cover bin / lib / patch / README
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`lib/message.js` is a **zero-dependency pure function** (message rendering), so tests and callers can verify the copy without installing `@deepseek-ai/*`; only `lib/index.js` depends on host-provided `@deepseek-ai/dsh-llm`, `dsh-tools`, and `schemastery` (**optional peers at runtime**, provided by DSH; **the same packages are separately declared as `devDependencies` for testing**, so a fresh clone can run tests right after `pnpm install` — no manual stuffing of `node_modules` needed).
|
|
156
|
+
|
|
157
|
+
## Relationship with the umbrella package
|
|
158
|
+
|
|
159
|
+
This package is one member of the [`@fish-under-sea/dsh-fish`](https://github.com/Fish-under-sea/dsh-fish) umbrella package: the umbrella's bundle layer inserts this plugin line into the profile, so installing the umbrella is equivalent to installing all Fish-built plugins at once. Installing this package alone affects only this one entry.
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
MIT © Fish-under-sea
|
package/README.md
CHANGED
|
@@ -1,144 +1,163 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
# @fish-under-sea/dsh-visual-companion
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[](https://www.npmjs.com/package/@fish-under-sea/dsh-visual-companion)
|
|
8
|
-

|
|
9
|
-

|
|
10
|
-

|
|
11
|
-
](https://www.npmjs.com/package/@fish-under-sea/dsh-visual-companion)
|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
**简体中文** · [English](README.en.md)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
## 解决什么问题
|
|
18
|
+
|
|
19
|
+
用网页看原型、比布局、选方案时,最烦的两件事:
|
|
20
|
+
|
|
21
|
+
1. **看完还得回终端打字复述**:「我选 B,另外配色再冷一点」—— 看图的人不该兼职打字员;
|
|
22
|
+
2. **或者相反,点一下就唤醒一次**:连点三个选项,助手被打断三次,既吵又费 token。
|
|
23
|
+
|
|
24
|
+
本插件把两件事一起解决:**点选过程完全静默**(只改页面本地状态),**只有按下「提交给助手」才唤醒一次**,并把整组选择连同备注一次性送达。
|
|
25
|
+
|
|
26
|
+
## 效果
|
|
27
|
+
|
|
28
|
+
- **点选静默**:任意点选、取消、填备注都不发请求、不叫醒会话;
|
|
29
|
+
- **一次提交 = 一次唤醒**:整组选择 + 备注拼成一条用户消息,例如
|
|
30
|
+
`【视觉伴侣】用户在页面上选好了 2 项:A(单栏布局)、C(混合方案),备注:间距再大一点。已同步给你,直接往下走就行(不必再问他)。`
|
|
31
|
+
- **自动继续**:会话收到后直接起一轮接着干,不需要用户复述;
|
|
32
|
+
- **界面自适应**:单选 / 多选(容器加 `data-multiselect`)、备注框、等待屏;页面没有可选项时自动隐藏提交栏。
|
|
33
|
+
|
|
34
|
+
## 安装
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
# 推荐:从 npm 安装(--profile 后跟本机 profile 名:桌面版 desktop,Web 版 web)
|
|
38
|
+
dsh plugin --profile <profile> add @fish-under-sea/dsh-visual-companion
|
|
39
|
+
|
|
40
|
+
# 改源码时才用 link:(仓库源码即安装源,改完重启 DSH 即生效)
|
|
41
|
+
dsh plugin --profile <profile> add "link:<仓库路径>/packages/dsh-visual-companion"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
装完**重启该 profile 的宿主**(新插件包需要重启才进组合;之后只改 `cordis.patch.yml` 内容可热重载)。
|
|
45
|
+
|
|
46
|
+
## 使用
|
|
47
|
+
|
|
48
|
+
本包由**两部分**组成,都不接触模型 API:
|
|
49
|
+
|
|
50
|
+
- **本地服务**(`bin/visual-companion.mjs`):零依赖 HTTP 服务,负责渲染页面、接收点击、写 `events.jsonl` 与 `pending.json`;
|
|
51
|
+
- **宿主插件**(`lib/index.js`):观察 `state/pending.json`,一有提交就给目标会话投一条用户消息并起一轮。
|
|
52
|
+
|
|
53
|
+
### 起本地服务
|
|
54
|
+
|
|
55
|
+
受管后台任务;目录放工作区内的临时目录:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
node "$DSH_HOME/profiles/<profile>/node_modules/@fish-under-sea/dsh-visual-companion/bin/visual-companion.mjs" \
|
|
59
|
+
--dir "<工作区>/.dsh-visual" --port 0 --session "$DSH_SESSION_ID"
|
|
60
|
+
# → 打印 { url, port, key, screenDir, stateDir, pendingFile, session }
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 写屏
|
|
64
|
+
|
|
65
|
+
把 HTML 片段写到 `<dir>/screen/`(语义化文件名、别复用;需要完全控制页面时才写完整文档,即以 `<!DOCTYPE` / `<html` 开头)。
|
|
66
|
+
|
|
67
|
+
### 打开页面
|
|
68
|
+
|
|
69
|
+
把 `url` 连同 `?key=` 一起交给用户(DSH 里用 `sidebar_open` 开在右侧栏)。密钥缺失会被 403 拒绝。
|
|
70
|
+
|
|
71
|
+
### 框架样式
|
|
72
|
+
|
|
73
|
+
服务自带的框架样式提供这些类,写片段即可用:
|
|
74
|
+
|
|
75
|
+
| 用途 | 类 |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| 选项(单选 / 容器加 `data-multiselect` 变多选) | `.options` > `.option[data-choice]`,点击调 `toggleSelect(this)`;`.cards` > `.card` 同款 |
|
|
78
|
+
| 视觉块 | `.mockup`、`.split`、`.pros-cons`、`.mock-nav`、`.mock-sidebar`、`.mock-content`、`.mock-button`、`.mock-input`、`.placeholder` |
|
|
79
|
+
| 文字层级 | `h2` / `h3` / `.subtitle` / `.section` / `.label` |
|
|
80
|
+
|
|
81
|
+
### `visual_companion` 工具
|
|
82
|
+
|
|
83
|
+
插件注册一个工具 `visual_companion`:
|
|
84
|
+
|
|
85
|
+
| action | 参数 | 作用 |
|
|
86
|
+
| --- | --- | --- |
|
|
87
|
+
| `arm` | `dir`、`session_id?` | 绑定目录与目标会话;`session_id` 可省略(之后由 `pending.json` 自带) |
|
|
88
|
+
| `disarm` | — | 解绑并关闭观察器 |
|
|
89
|
+
| `status` | — | 绑定状态、唤醒次数、最近一次结果、当前 `pending.json` |
|
|
90
|
+
| `wake` | `session_id`、`text` | 立刻探测唤醒链路(不经过页面) |
|
|
91
|
+
|
|
92
|
+
### 落盘文件
|
|
93
|
+
|
|
94
|
+
落盘文件都在 `<dir>/state/`:
|
|
95
|
+
|
|
96
|
+
| 文件 | 内容 |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| `pending.json` | **只有提交才写**:`{type:"submit", selections:[{choice,text}], note, at, sessionId}`,插件观察它 |
|
|
99
|
+
| `events.jsonl` | 逐条追加:`click` 是点选过程(不唤醒),`submit` 是完整提交(唤醒一次) |
|
|
100
|
+
| `server-info` / `server-stopped` | 服务启动信息与退出原因 |
|
|
101
|
+
|
|
102
|
+
### 斜杠命令 `/companion`
|
|
103
|
+
|
|
104
|
+
在会话里直接输入:
|
|
105
|
+
|
|
106
|
+
```text
|
|
107
|
+
/companion [想看的主题]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
插件会:**①** 若本地服务没在跑就后台拉起它(零依赖、自动分配端口);**②** 把带会话密钥的完整 URL 交给当前会话的助手,让它用 `sidebar_open` 开在右侧栏;**③** 让助手绑好观察器并把第一屏原型写进 `screen/`。之后你只管点选 + 写备注 + 按「提交给助手」。
|
|
111
|
+
|
|
112
|
+
> 命令只负责「起服务 + 交接」,页面上该显示什么仍由助手写 HTML 片段决定 —— 所以它比手敲 `bin/visual-companion.mjs` 省事,但不会替你决定看什么。
|
|
113
|
+
|
|
114
|
+
## 配置
|
|
115
|
+
|
|
116
|
+
| 键 | 默认 | 说明 |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| `watchDir` | `""` | 非空则**加载即自动绑定**该目录(配置热重载 / 重启都不会掉绑定);留空则用 `visual_companion` 手动 `arm` |
|
|
119
|
+
|
|
120
|
+
目标会话**不写进配置**:它由每次提交写入的 `sessionId` 决定(服务启动时的 `--session`),所以同一个服务可以服务不同会话,配置里也不会留机器专属的会话 id。
|
|
121
|
+
|
|
122
|
+
机器相关的绝对路径不写进共享 bundle,需要自动绑定时在自己的 profile patch 层用同 id 覆盖:
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
- id: visual-companion
|
|
126
|
+
name: '@fish-under-sea/dsh-visual-companion'
|
|
127
|
+
config:
|
|
128
|
+
watchDir: D:/some/workspace/.dsh-visual
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## 兼容与边界
|
|
132
|
+
|
|
133
|
+
投递按「越接近公开面越优先」逐个降级,返回真正成功的那条:
|
|
134
|
+
|
|
135
|
+
1. `agent.followup(createUserMessage(...))` —— 与斜杠命令注入用户消息同一条路径;
|
|
136
|
+
2. `agent.steer(...)` —— 目标正在跑时;
|
|
137
|
+
3. `ctx.subagents[Symbol.for('dsh.subagent.queuePrompt' | 'deliverPrompt')]` —— 可续期子代理的宿主内部投递钩子。
|
|
138
|
+
|
|
139
|
+
- **host-only**:宿主插件(不声明 `dsh.client`、没有浏览器半区、没有前端构建)+ 本地服务(零依赖 HTTP 服务,提供带交互的浏览器页面)。那个页面由本地服务自己提供,**不是** DSH 客户端插件;
|
|
140
|
+
- 服务零依赖(只用 Node 标准库)、端口自动分配、URL 带会话密钥;`--host 0.0.0.0 --url-host <主机名>` 可用于远程 / 容器,但**必须保留 `?key=`**;
|
|
141
|
+
- 服务**闲置 4 小时自动退出**(`--idle-minutes` 可调),原型文件是临时产物,别当交付物;
|
|
142
|
+
- 降级链:无 Node → 自包含 HTML + `present`;无侧边栏浏览器 → 把完整 URL 交给用户手动打开;连插件都没装 → 下一轮手工读 `events.jsonl`;
|
|
143
|
+
- 需要 Node `^22.19.0 || >=24`、DSH `>=0.2.0-rc.2`;不需要任何 API key;
|
|
144
|
+
- **绑定是容错的**(0.1.5 起):`watchDir` 指向的 `<watchDir>/state` 还不存在时会**递归自建**;万一观察不了(路径不是目录、权限不足),只记一条告警并把状态如实留成「未绑定」——**插件照常加载**,工具与 `/companion` 不会一起消失,修好后 `visual_companion({action:"arm"})` 可重试;
|
|
145
|
+
- **已知限制**:宿主插件代码不热重载 —— 改 `lib/index.js` 后要重启宿主;只改 `cordis.patch.yml` 的内容可热重载。
|
|
146
|
+
|
|
147
|
+
## 开发与测试
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
# 全新 clone 需先在包目录 pnpm install(运行时零依赖,但测试需要 devDependencies 里的 3 个 DSH 包)
|
|
151
|
+
node packages/dsh-visual-companion/test/visual-companion.test.mjs # 语料渲染 + 清单契约 + 绑定容错(10 用例)
|
|
152
|
+
pnpm pack # 产物检查:files 覆盖 bin / lib / patch / README
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`lib/message.js` 是**零依赖纯函数**(语料渲染),所以测试与调用方不装 `@deepseek-ai/*` 也能验证文案;`lib/index.js` 才依赖宿主提供的 `@deepseek-ai/dsh-llm`、`dsh-tools`、`schemastery`(**运行时**是可选 peer,由 DSH 提供;**测试时**同一组包另以 `devDependencies` 声明,所以全新 clone 直接 `pnpm install` 就能跑测试,不必手工往 `node_modules` 里塞)。
|
|
156
|
+
|
|
157
|
+
## 与聚合包的关系
|
|
158
|
+
|
|
159
|
+
本包是 [`@fish-under-sea/dsh-fish`](https://github.com/Fish-under-sea/dsh-fish) 聚合包的成员之一:聚合包的 bundle 层会把这一行插进 profile,所以装聚合包等于装齐 Fish 自建插件。单独安装本包则只影响这一项。
|
|
160
|
+
|
|
161
|
+
## 许可
|
|
162
|
+
|
|
163
|
+
MIT © Fish-under-sea
|