dsh-share-chat 0.0.0-stage → 0.3.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/CHANGELOG.md ADDED
@@ -0,0 +1,56 @@
1
+ # 更新记录
2
+
3
+ ## 0.3.0
4
+
5
+ - 仓库整理:移除小游戏的移植层与部署脚手架(运行时动态执行模块源码的加载器、以及向本机回环发起 HTTP 的部署脚本)。
6
+ 它们不属于插件运行时,却会被 dsh.so 的安全扫描判为 critical / warning;部署方式改为 docs/GAME.md 里的文字说明
7
+
8
+ - **包名改为 `dsh-share-chat`**(去掉 `@local/`,发布到 npm);`cordis.patch.yml` 的 row 名与 client 模块 id 一并修改
9
+ - 老用户从 `@local/dsh-share-chat` 迁移:先移除旧包,再 `dsh plugin add dsh-share-chat`
10
+
11
+ - **新增会议**:聊天页顶栏 `📹 开会`,新建/加入房间,最多 6 人音视频 + 屏幕共享
12
+ - 纯浏览器 WebRTC 网状直连,relay 只转发信令(SSE 长连接)与成员状态,**无时长限制**
13
+ - 工具栏:麦克风、摄像头、共享屏幕、复制房间号、离开;窗口可拖可缩放,`Esc` 离开
14
+ - STUN 用 Cloudflare / Google 公共节点;对称 NAT 下可能需要 TURN(后续在服务器加 coturn)
15
+ - relay 端:新增 `POST /api/meet/rooms`、`/join`、`/state`、`/signal`、`/leave` 与 `GET …/events`(SSE)
16
+
17
+ ## 0.2.2
18
+
19
+ - 合并 0.1.6 的文件缩略图/卡片实现到 0.2 的新界面:图片、视频、音频内联,其它文件显示类型图标 + 类型 + 大小
20
+ - README 重写:三种不需要 Git 的安装方式(tgz / 本地文件夹 / npm),以及「为什么 git 地址必须装 Git」
21
+ - 新增 `docs/INSTALL.md`(安装与排错)、`docs/GAME.md`(小游戏移植与部署)、`CHANGELOG.md`
22
+ - 新增 `game-host/`(小游戏浏览器移植层)与 `tools/`(部署脚本 + nginx 片段)
23
+ - `docs/DETAIL.md` 补充小游戏、窗口尺寸设置与 50 MB 上限
24
+
25
+ ## 0.2.1
26
+
27
+ - **界面重做**:整套样式改为注入一张 `<style>` + `--dsw-alias-*` 主题 token,亮色/暗色跟随 DSH
28
+ - 登录页:居中卡片、分段 tab、带标签输入框、聚焦光圈
29
+ - 聊天:头像、好友列表的最后一条摘要、双向气泡、时间戳、空状态
30
+ - 输入区:圆角输入框、表情/附件在框内、发送按钮禁用态
31
+ - 快照卡片、分享条(带预览)、设置页(预设卡片)
32
+ - 窄屏(≤720px)媒体查询
33
+ - 修复:文件消息的缩略图/卡片合并了 0.1.6 的实现(图片/视频/音频内联,其它显示类型图标)
34
+
35
+ ## 0.2.0
36
+
37
+ - 首次引入 0.2 系列界面(注入 CSS、class 化组件),功能与 0.1.9 一致
38
+
39
+ ## 0.1.9
40
+
41
+ - 小游戏窗口改为**原生 DOM 挂到 `document.body`**(`z-index: 2147483647`),绕开 DSH 面板的 stacking context 与裁切
42
+ - 窗口标题栏加点击诊断(`x,y → 命中区域`),`Esc` 关闭
43
+
44
+ ## 0.1.8
45
+
46
+ - 点击问题排查版:窗口 `z-index` 提到最大、加 `pointer-events: auto`
47
+
48
+ ## 0.1.7
49
+
50
+ - 小游戏窗口从全屏遮罩改为**右下角浮动窗口**:可拖标题栏、拉右下角改大小,尺寸存 localStorage
51
+ - 新增 **设置 → 社交小游戏**:预设(340×600 / 390×760 / 480×900)+ 自定义宽高 + 恢复默认
52
+
53
+ ## 0.1.6
54
+
55
+ - 文件消息支持任意类型(≤50 MB):图片/视频/音频内联,其它文件显示类型图标与大小
56
+ - 上传失败文案由 8 MB 更正为 50 MB
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 zhanghao
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.md CHANGED
@@ -1,3 +1,150 @@
1
- # Temporary Holding Version
1
+ # 社交 · dsh-share-chat
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 在 DSH 里和好友聊天,并把手上的对话一键分享给对方——不是截图,是带工具调用和回复的结构化快照。
4
+ 消息不经过任何模型,**不消耗 token**;内容存在你自己的 relay 服务器上。
5
+
6
+ 还内置了「鱼塘摸鱼」小游戏:点聊天页顶栏的 `🎮 摸鱼` 就能在 DSH 里玩,窗口大小可在 **设置 → 社交小游戏** 里调。
7
+
8
+ > 当前版本 **0.3.0**(npm 包名 `dsh-share-chat`)。更新记录见 [CHANGELOG.md](CHANGELOG.md)。
9
+
10
+ ## 特性
11
+
12
+ - **一对一手动好友**:输入对方 ID 即互为好友,没有申请/同意流程
13
+ - **文字 / 表情 / 图片 / 视频 / 音频 / 任意文件**:图片视频直接内嵌,其它文件带类型图标和大小(单件上限 50 MB,服务端决定)
14
+ - **对话快照**:「分享这一轮」把最后一轮的提问、工具调用、回复打包成卡片,对方点开就能看;不含思考过程和运行时注入的上下文
15
+ - **音视频会议**:点 `📹 开会`,新建房间或输房间号加入;≤6 人,音频+视频+屏幕共享,点对点直连、无时长限制
16
+ - **内置小游戏**:「鱼塘摸鱼」的浏览器移植版,iframe 原样嵌进来,账号/存档还是游戏自己那套
17
+ - **跟随 DSH 主题**:整套界面只用 `--dsw-alias-*` token,亮色/暗色自动适配
18
+ - 5 秒轮询,无 WebSocket;掉线后下一次轮询自动恢复
19
+
20
+ ## 安装
21
+
22
+ > **不需要安装 Git。** 下面的三种方式都不走 git;只有把 `git+https://…` 这种地址丢给 DSH 时,pnpm 才会去调本机的 `git`,机器上没有就会报 `ERR_PNPM_GIT_RESOLVE_FAILED`。
23
+
24
+ ### 方式 A:npm(推荐,一条命令)
25
+
26
+ ```bash
27
+ dsh plugin add dsh-share-chat
28
+ ```
29
+
30
+ 走 npm registry,不需要 Git;升级就是 `dsh plugin add dsh-share-chat@最新版本`。
31
+
32
+ ### 方式 B:tgz 安装包
33
+
34
+ ```bash
35
+ dsh plugin add https://xdxy-pet.com/dl/dsh-share-chat-0.3.0.tgz
36
+ ```
37
+
38
+ 装完刷新页面,左侧栏出现 **社交**(若在「更多」里,点图钉固定)。
39
+
40
+ ### 方式 C:本地文件夹
41
+
42
+ 1. 下载本仓库 ZIP 解压到任意位置,例如 `D:\plugins\dsh-share-chat`
43
+ 2. DSH → 左侧栏 **插件** → **添加插件** → 选这个文件夹
44
+ 3. 刷新页面
45
+
46
+ 缺点是没有任何版本追踪,换版本要重新选一次文件夹。
47
+
48
+ ### 方式 D:从仓库/本地装(Git 或文件夹)
49
+
50
+ ```bash
51
+ # 发布者:去掉 package.json 里的 "private": true,并把 name 改成可发布的包名
52
+ npm publish
53
+ # 使用者
54
+ dsh plugin add <包名>
55
+ ```
56
+
57
+ ### 为什么别人的插件不需要 Git
58
+
59
+ DSH 用 pnpm 管插件:
60
+
61
+ | 安装源 | 需要 Git? |
62
+ |---|---|
63
+ | npm 包名(registry) | 不需要,纯 HTTPS 下载 |
64
+ | `https://…/xxx.tgz` | 不需要 |
65
+ | 本地文件夹 `file:` | 不需要 |
66
+ | `git+https://…` / `github:user/repo` / `git+ssh://…` | **需要**,pnpm 要 `git ls-remote` 和 `git clone` |
67
+
68
+ 别人能用得更省事,通常只是因为他们把包装到了 npm,或者发的是 tgz。
69
+ 本插件是 `private` 包、只发了仓库,所以直接用仓库地址装才会卡在 git 上。
70
+
71
+ 更细的安装/排错说明见 [docs/INSTALL.md](docs/INSTALL.md)。
72
+
73
+ ## 第一次使用
74
+
75
+ 1. 左侧栏 → **社交**
76
+ 2. 点 **注册**,填:
77
+ - **服务器地址**:已预填 https://xdxy-pet.com/relay ,不用改
78
+ - **邀请码**:找发插件的人要
79
+ - **账号名**:2–20 位,中文可以
80
+ - **密码**:至少 6 位,**一定要设**(账号在服务器上,换电脑换端口都只认密码)
81
+ 3. 进去后在左栏输入对方 ID 加好友(对方那边会自动出现你)
82
+ 4. 选一个好友开始聊:`Enter` 发送,`Shift+Enter` 换行
83
+
84
+ 老账号没设过密码的,点登录页的「没设过密码?」,用邀请码补一个;也保留 token 登录兜底。
85
+
86
+ ## 分享一段对话
87
+
88
+ 在会话里点 **社交** 标签页(跟「对话」「轨迹」那一排),顶部点 **🐟 分享这一轮**:
89
+
90
+ 1. 出现预览,逐行列出将要发出去的内容
91
+ 2. 选好友 → 发送
92
+
93
+ 包含:你的提问、工具调用(压成一行)、我的回复;**不包含**思考过程与运行时上下文(`<system-reminder>`、时间戳、工作目录等)。
94
+ 只取最后一轮,每段最多 1500 字,最多 8 段。
95
+
96
+ ## 音视频会议
97
+
98
+ - 聊天页顶栏 **📹 开会**:`+ 新建会议` 拿到 6 位房间号,或输入房间号加入;`📋` 复制房间号发给好友
99
+ - 右上角是参会人视频格,底部工具栏:`🎤` 麦克风、`🎥` 摄像头、`🖥` 共享屏幕、`📋` 房间号、`🚪` 离开
100
+ - 窗口可拖标题栏移动、右下角改大小,`Esc` 离开
101
+ - **没有时长限制**:媒体是浏览器之间 P2P 直连,relay 只转发 SDP/ICE,不经过服务器带宽
102
+ - 需要的只是摄像头/麦克风权限(DSH 在本机 `127.0.0.1` 上,属于安全上下文,能正常授权)
103
+ - 对称 NAT / CGNAT 环境下可能连不通,界面会标 `⚠ 可能需要对端 TURN`;彻底解决要在服务器上加 coturn(见 docs/MEETING.md)
104
+
105
+ ## 内置小游戏
106
+
107
+ - 入口:聊天页顶栏 **🎮 摸鱼**
108
+ - 窗口:右下角浮动窗,拖标题栏移动、拉右下角改大小
109
+ - 默认尺寸:**设置 → 社交小游戏**(预设 340×600 / 390×760 / 480×900,也可自定义)
110
+ - 游戏本体部署在 `https://xdxy-pet.com/game/`,和鱼塘的 `/api/fish/` 同源
111
+
112
+ 移植层和部署脚本**不放在插件仓库里**(它们会触发 dsh.so 的安全扫描),部署方式见 [docs/GAME.md](docs/GAME.md)。
113
+
114
+ ## 更新 / 卸载
115
+
116
+ - 更新:换一个更新的 tgz 地址重新 `dsh plugin add`(或插件页里的更新)
117
+ - 卸载:DSH → 插件 → 找到「社交」→ 停用或移除
118
+
119
+ ## 数据流向与隐私
120
+
121
+ - 聊天 / 好友 / 消息 / 快照 → 你自己的 relay(默认 `https://xdxy-pet.com/relay`,登录页可改)
122
+ - 小游戏 → `https://xdxy-pet.com/game/` + `https://xdxy-pet.com/api/fish/`(同一台服务器,游戏自己的账号体系)
123
+ - Host 侧(`index.js`)只在本机回环地址上开两条**只读**的会话调试路由,公网部署直接 403
124
+ - relay 明文存储:消息与快照是 JSON 文件,快照 7 天过期;浏览器 localStorage 里存 bearer token,共用电脑注意退出
125
+
126
+ ## 目录结构
127
+
128
+ ```
129
+ client.js 浏览器半(DSH Web 插件,React + 注入的 CSS)
130
+ index.js Host 半(只读会话路由,loopback only)
131
+ cordis.patch.yml bundle 补丁:插一行 share-chat
132
+ locale/ 中英文标题与描述
133
+ docs/DETAIL.md 插件详情页长文
134
+ docs/INSTALL.md 安装与排错
135
+ docs/GAME.md 小游戏移植与部署
136
+ cli/ 给 agent 用的命令行客户端(chat / chat-mcp)
137
+ ```
138
+
139
+ ## 已知限制
140
+
141
+ - 只分享**最后一轮**;每段最多 1500 字、最多 8 段
142
+ - 分享过滤是黑名单(key 名 + 节点 kind),不保证 100% 不漏,发送前请过一眼预览
143
+ - 没有群聊、已读回执、撤回、语音、好友申请
144
+ - 消息 5 秒轮询,不是实时推送
145
+ - 小游戏在网页端没有微信登录、没有激励视频(广告接口降级为「不可用」)、没有游戏圈
146
+ - 游戏账号与聊天账号是两套,暂未打通
147
+
148
+ ## License
149
+
150
+ MIT
@@ -0,0 +1,225 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * chat-mcp —— 把 relay 的收发消息暴露成 MCP 工具,给 WorkBuddy / Claude Desktop 等用
4
+ *
5
+ * 协议:JSON-RPC over stdio,按行分隔。不依赖 MCP SDK,只用 Node 内置模块。
6
+ * 凭据:复用 CLI 的 ~/.dsh-chat/config.json(先跑一次 `node chat.mjs login`)
7
+ * 也可以用环境变量 DSH_CHAT_SERVER / DSH_CHAT_TOKEN 覆盖。
8
+ */
9
+ import { readFileSync } from 'node:fs'
10
+ import path from 'node:path'
11
+ import os from 'node:os'
12
+
13
+ const CONFIG_FILE = path.join(os.homedir(), '.dsh-chat', 'config.json')
14
+ const PROTOCOL = '2024-11-05'
15
+ const NAME = 'dsh-chat'
16
+ const VERSION = '0.1.0'
17
+
18
+ function loadConfig() {
19
+ try {
20
+ return JSON.parse(readFileSync(CONFIG_FILE, 'utf8'))
21
+ } catch {
22
+ return {}
23
+ }
24
+ }
25
+
26
+ const cfg = loadConfig()
27
+ const server = String(process.env.DSH_CHAT_SERVER || cfg.server || 'https://xdxy-pet.com/relay').replace(/\/+$/, '')
28
+ const token = process.env.DSH_CHAT_TOKEN || cfg.token || ''
29
+ const me = cfg.id || ''
30
+
31
+ async function api(method, p, body) {
32
+ const headers = {}
33
+ if (body !== undefined) headers['content-type'] = 'application/json'
34
+ if (token) headers.authorization = 'Bearer ' + token
35
+ const res = await fetch(server + p, {
36
+ method,
37
+ headers,
38
+ body: body === undefined ? undefined : JSON.stringify(body),
39
+ })
40
+ let data = null
41
+ try {
42
+ data = await res.json()
43
+ } catch {}
44
+ if (!res.ok) {
45
+ const err = new Error((data && data.error) || 'http-' + res.status)
46
+ err.code = (data && data.error) || 'http-' + res.status
47
+ throw err
48
+ }
49
+ return data
50
+ }
51
+
52
+ // ── 工具实现 ────────────────────────────────────────────
53
+
54
+ const TOOLS = [
55
+ {
56
+ name: 'chat_friends',
57
+ description: '列出当前账号的好友。返回每个好友的账号 id 与显示名。',
58
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false },
59
+ },
60
+ {
61
+ name: 'chat_read',
62
+ description:
63
+ '读取新消息(只返回上次读取之后的新消息)。用于看同事有没有找你。消息里的 kind=snapshot 表示对方分享了 DSH 对话快照,快照内容会一并取回。',
64
+ inputSchema: {
65
+ type: 'object',
66
+ properties: {
67
+ all: { type: 'boolean', description: '忽略本地光标,从头读取全部消息' },
68
+ with: { type: 'string', description: '只看与某个账号的往来' },
69
+ },
70
+ additionalProperties: false,
71
+ },
72
+ },
73
+ {
74
+ name: 'chat_send',
75
+ description: '给一个好友发一条文字消息。只在用户明确要求时调用,不要自动发送。',
76
+ inputSchema: {
77
+ type: 'object',
78
+ properties: {
79
+ to: { type: 'string', description: '对方的账号 id' },
80
+ text: { type: 'string', description: '消息内容' },
81
+ },
82
+ required: ['to', 'text'],
83
+ additionalProperties: false,
84
+ },
85
+ },
86
+ {
87
+ name: 'chat_add_friend',
88
+ description: '添加好友(对方会自动反向添加)。',
89
+ inputSchema: {
90
+ type: 'object',
91
+ properties: { id: { type: 'string', description: '对方的账号 id' } },
92
+ required: ['id'],
93
+ additionalProperties: false,
94
+ },
95
+ },
96
+ ]
97
+
98
+ async function callTool(name, args) {
99
+ if (!token) {
100
+ return {
101
+ isError: true,
102
+ text: '还没登录。先在终端跑一次:node chat.mjs login <你的账号>',
103
+ }
104
+ }
105
+ if (name === 'chat_friends') {
106
+ const r = await api('GET', '/api/friends')
107
+ if (!r.friends.length) return { text: '还没有好友。可以用 chat_add_friend 加。' }
108
+ return { text: r.friends.map((f) => `${f.id}(${f.displayName || f.id})`).join('\n') }
109
+ }
110
+ if (name === 'chat_read') {
111
+ const since = args.all ? 0 : cfg.cursor || 0
112
+ const r = await api('GET', '/api/messages?since=' + since)
113
+ let msgs = r.messages || []
114
+ if (args.with) msgs = msgs.filter((m) => m.from === args.with || m.to === args.with)
115
+ msgs.sort((a, b) => a.seq - b.seq)
116
+ if (!msgs.length) return { text: '没有新消息。' }
117
+ const out = []
118
+ for (const m of msgs) {
119
+ const who = m.from === me ? '我' : m.from
120
+ const body = m.body || {}
121
+ if (body.kind === 'snapshot') {
122
+ let snapText = '(快照内容取不到,可能已过期)'
123
+ try {
124
+ const s = await api('GET', '/api/snapshots/' + encodeURIComponent(body.snapshotId))
125
+ const blocks = (s.snapshot && s.snapshot.blocks) || []
126
+ snapText =
127
+ '【' + ((s.snapshot && s.snapshot.title) || '对话快照') + '】\n' +
128
+ blocks
129
+ .map((b) => {
130
+ const tag = b.t === 'user' ? '用户' : b.t === 'tool' ? b.name || '工具' : '助手'
131
+ return `[${tag}] ${String(b.text || '').replace(/\s+/g, ' ').trim()}`
132
+ })
133
+ .join('\n')
134
+ } catch {}
135
+ out.push(`[${new Date(m.at).toLocaleTimeString('zh-CN')}] ${who} 分享了快照:\n${snapText}`)
136
+ } else {
137
+ out.push(`[${new Date(m.at).toLocaleTimeString('zh-CN')}] ${who}: ${body.text || ''}`)
138
+ }
139
+ }
140
+ return { text: out.join('\n') }
141
+ }
142
+ if (name === 'chat_send') {
143
+ if (!args.to || !args.text) return { isError: true, text: 'to 和 text 都不能为空' }
144
+ const r = await api('POST', '/api/messages', { to: args.to, text: args.text })
145
+ return { text: `已发送给 ${args.to}(seq=${r.seq})` }
146
+ }
147
+ if (name === 'chat_add_friend') {
148
+ await api('POST', '/api/friends', { id: args.id })
149
+ return { text: `已添加 ${args.id} 为好友` }
150
+ }
151
+ return { isError: true, text: '未知工具:' + name }
152
+ }
153
+
154
+ // ── JSON-RPC over stdio ─────────────────────────────────
155
+
156
+ function send(obj) {
157
+ process.stdout.write(JSON.stringify(obj) + '\n')
158
+ }
159
+
160
+ function reply(id, result) {
161
+ send({ jsonrpc: '2.0', id, result })
162
+ }
163
+
164
+ function replyError(id, code, message) {
165
+ send({ jsonrpc: '2.0', id, error: { code, message } })
166
+ }
167
+
168
+ async function handle(msg) {
169
+ const { id, method, params } = msg
170
+ if (method === 'initialize') {
171
+ reply(id, {
172
+ protocolVersion: PROTOCOL,
173
+ capabilities: { tools: {} },
174
+ serverInfo: { name: NAME, version: VERSION },
175
+ })
176
+ return
177
+ }
178
+ if (method === 'notifications/initialized') return
179
+ if (method === 'ping') {
180
+ reply(id, {})
181
+ return
182
+ }
183
+ if (method === 'tools/list') {
184
+ reply(id, { tools: TOOLS })
185
+ return
186
+ }
187
+ if (method === 'tools/call') {
188
+ const name = params && params.name
189
+ const args = (params && params.arguments) || {}
190
+ try {
191
+ const out = await callTool(name, args)
192
+ reply(id, {
193
+ content: [{ type: 'text', text: out.text }],
194
+ isError: !!out.isError,
195
+ })
196
+ } catch (e) {
197
+ reply(id, {
198
+ content: [{ type: 'text', text: '失败:' + ((e && (e.code || e.message)) || e) }],
199
+ isError: true,
200
+ })
201
+ }
202
+ return
203
+ }
204
+ if (id !== undefined) replyError(id, -32601, 'Method not found: ' + method)
205
+ }
206
+
207
+ let buf = ''
208
+ process.stdin.setEncoding('utf8')
209
+ process.stdin.on('data', (chunk) => {
210
+ buf += chunk
211
+ let idx
212
+ while ((idx = buf.indexOf('\n')) !== -1) {
213
+ const line = buf.slice(0, idx).trim()
214
+ buf = buf.slice(idx + 1)
215
+ if (!line) continue
216
+ let msg
217
+ try {
218
+ msg = JSON.parse(line)
219
+ } catch {
220
+ continue
221
+ }
222
+ handle(msg).catch(() => {})
223
+ }
224
+ })
225
+ process.stdin.on('end', () => process.exit(0))
package/cli/chat.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+ rem chat 的 Windows 启动器:把本文件所在目录放进 PATH,就能直接打 chat
3
+ node "%~dp0chat.mjs" %*