@fish-under-sea/dsh-visual-companion 0.1.7 → 1.0.0
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 +21 -0
- package/README.en.md +12 -146
- package/README.md +12 -146
- package/package.json +4 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Fish-under-sea
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
CHANGED
|
@@ -1,163 +1,29 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
1
|
# @fish-under-sea/dsh-visual-companion
|
|
4
2
|
|
|
5
|
-
**
|
|
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:
|
|
3
|
+
**1.0.0 · Visual Companion**
|
|
20
4
|
|
|
21
|
-
|
|
22
|
-
2. **Or the opposite: every click wakes the assistant**: pick three options, interrupt the assistant three times — noisy and token-wasteful.
|
|
5
|
+
[简体中文](README.md)
|
|
23
6
|
|
|
24
|
-
|
|
7
|
+
## Features
|
|
25
8
|
|
|
26
|
-
|
|
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.
|
|
9
|
+
Binds a visual-companion directory and delivers submitted selections and notes as a user message that wakes the target session; exposes arm, disarm, status and wake.
|
|
33
10
|
|
|
34
11
|
## Installation
|
|
35
12
|
|
|
36
13
|
```sh
|
|
37
|
-
|
|
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
|
|
14
|
+
dsh plugin --profile <profile> add @fish-under-sea/dsh-visual-companion@1.0.0
|
|
129
15
|
```
|
|
130
16
|
|
|
131
|
-
|
|
17
|
+
Also included in `@fish-under-sea/dsh-fish@1.0.0`. Do not expand duplicate rows through both aggregate and standalone bundles. Restart DSH after installation; use the desktop plugin manager when no CLI is available.
|
|
132
18
|
|
|
133
|
-
|
|
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
|
-
```
|
|
19
|
+
## Configuration and Safety
|
|
154
20
|
|
|
155
|
-
|
|
21
|
+
The bound directory contains state/pending.json. Selection alone does not send a message; submission wakes the session. Keep watchDir and session ids machine-local.
|
|
156
22
|
|
|
157
|
-
|
|
23
|
+
Node requirement: `^22.19.0 || >=24.0.0`. Host compatibility follows this package manifest; the aggregate does not override Host checks.
|
|
158
24
|
|
|
159
|
-
|
|
25
|
+
## Maintenance and Attribution
|
|
160
26
|
|
|
161
|
-
|
|
27
|
+
1.0.0 is a coordinated release number, not a claim that all latest upstream commits are merged. Historical documentation remains in Git; see [aggregate changelog](https://github.com/Fish-under-sea/dsh-fish/blob/main/CHANGELOG.en.md).
|
|
162
28
|
|
|
163
|
-
|
|
29
|
+
Fish-native plugin. License: MIT.
|
package/README.md
CHANGED
|
@@ -1,163 +1,29 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
1
|
# @fish-under-sea/dsh-visual-companion
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[](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
|
-
用网页看原型、比布局、选方案时,最烦的两件事:
|
|
3
|
+
**1.0.0 · 视觉伴侣**
|
|
20
4
|
|
|
21
|
-
|
|
22
|
-
2. **或者相反,点一下就唤醒一次**:连点三个选项,助手被打断三次,既吵又费 token。
|
|
5
|
+
[English](README.en.md)
|
|
23
6
|
|
|
24
|
-
|
|
7
|
+
## 功能
|
|
25
8
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- **点选静默**:任意点选、取消、填备注都不发请求、不叫醒会话;
|
|
29
|
-
- **一次提交 = 一次唤醒**:整组选择 + 备注拼成一条用户消息,例如
|
|
30
|
-
`【视觉伴侣】用户在页面上选好了 2 项:A(单栏布局)、C(混合方案),备注:间距再大一点。已同步给你,直接往下走就行(不必再问他)。`
|
|
31
|
-
- **自动继续**:会话收到后直接起一轮接着干,不需要用户复述;
|
|
32
|
-
- **界面自适应**:单选 / 多选(容器加 `data-multiselect`)、备注框、等待屏;页面没有可选项时自动隐藏提交栏。
|
|
9
|
+
绑定视觉伴侣目录,把网页上提交的选择和备注合并为用户消息并唤醒目标会话;提供 arm、disarm、status 和 wake。
|
|
33
10
|
|
|
34
11
|
## 安装
|
|
35
12
|
|
|
36
13
|
```sh
|
|
37
|
-
|
|
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
|
|
14
|
+
dsh plugin --profile <profile> add @fish-under-sea/dsh-visual-companion@1.0.0
|
|
129
15
|
```
|
|
130
16
|
|
|
131
|
-
|
|
17
|
+
也可安装聚合包 `@fish-under-sea/dsh-fish@1.0.0`。聚合与独立安装不要重复展开相同插件行;安装完成后重启 DSH。桌面环境无 CLI 时使用插件管理器。
|
|
132
18
|
|
|
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
|
-
```
|
|
19
|
+
## 配置与边界
|
|
154
20
|
|
|
155
|
-
|
|
21
|
+
绑定目录包含 state/pending.json。点选不逐次发送,提交才唤醒;watchDir 与会话 id 属于本机配置,不写入通用 bundle。
|
|
156
22
|
|
|
157
|
-
|
|
23
|
+
Node 要求: `^22.19.0 || >=24.0.0`. DSH 支持范围以本包声明为准;聚合包不覆盖宿主兼容性检查。
|
|
158
24
|
|
|
159
|
-
|
|
25
|
+
## 维护与来源
|
|
160
26
|
|
|
161
|
-
|
|
27
|
+
1.0.0 统一发布版本,不表示已合并上游所有最新提交。历史说明保留在 Git 历史中;聚合变更见 [聚合变更记录](https://github.com/Fish-under-sea/dsh-fish/blob/main/CHANGELOG.md).
|
|
162
28
|
|
|
163
|
-
|
|
29
|
+
Fish 原生插件。 许可证: MIT.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fish-under-sea/dsh-visual-companion",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "把「视觉伴侣页面上的提交」变成一条用户消息:用户在网页上点选、写备注、按提交,DSH 会话自动起一轮继续工作,不必回终端复述。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"lib",
|
|
16
16
|
"cordis.patch.yml",
|
|
17
17
|
"README.md",
|
|
18
|
-
"README.en.md"
|
|
18
|
+
"README.en.md",
|
|
19
|
+
"LICENSE"
|
|
19
20
|
],
|
|
20
21
|
"license": "MIT",
|
|
21
22
|
"publishConfig": {
|
|
@@ -73,4 +74,4 @@
|
|
|
73
74
|
"patch": "./cordis.patch.yml"
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
|
-
}
|
|
77
|
+
}
|