dsh-connect-lingxi 0.0.0-stage → 0.0.2
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.md +104 -2
- package/cordis.patch.yml +7 -0
- package/lib/client.js +1086 -0
- package/lib/index.d.ts +23 -0
- package/lib/index.js +3834 -0
- package/package.json +93 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 xinstart-1
|
|
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,105 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-connect-lingxi
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> 把 **WPS 灵犀(Lingxi Claw)** 接入 **DeepSeek Harness**:原生 `tools` / `tool_calls` /
|
|
4
|
+
> `reasoning_content` / `usage` 直通,14 个模型直接出现在 DSH 的模型选择器里。
|
|
5
|
+
> **v0.0.1 起**,插件详情页还会告诉你智点余额、快过期的临时积分、今天签没签到,
|
|
6
|
+
> 输入框左侧有一枚可点的读数。
|
|
7
|
+
|
|
8
|
+
## 它是什么
|
|
9
|
+
|
|
10
|
+
灵犀**没有开放平台 API**。本插件走的是灵犀桌面客户端自己使用的私有 app-server 协议
|
|
11
|
+
(`/api/aioffice/v1/cowork/sessions` → `/api/public/v1/credits/runs` →
|
|
12
|
+
`/api/public/v1/agent-runtime/chat/completions`),协议细节见 [`docs/PROTOCOL.md`](docs/PROTOCOL.md)。
|
|
13
|
+
|
|
14
|
+
与「问问 ima」那种模型通道不同,灵犀是**完整 agent 通道**:DSH 发过去的 tool 定义会
|
|
15
|
+
被灵犀执行,返回的 `tool_calls` 会回到 DSH —— 可以真正当 agent 后端用。
|
|
16
|
+
|
|
17
|
+
## 能力
|
|
18
|
+
|
|
19
|
+
- **14 个模型**:DeepSeek V4.1 Flash(1M 上下文,0.12x 倍率)、V4 Pro、Kimi-K3、
|
|
20
|
+
GLM-5.3 / 5.3-Flash、Qwen3.8-Max / Flash、minimax-M3、Doubao-Seed-2.1 Pro、
|
|
21
|
+
MiMo-V2.6 Pro、Auto / Pro / Max 模式。
|
|
22
|
+
- **原生工具调用**:上游返回的 `tool_calls` 直接进 DSH 的工具循环。
|
|
23
|
+
- **思考过程**:`reasoning_content` 独立通道,不混进正文。
|
|
24
|
+
- **动态模型目录**:登录后从 `/api/aioffice/v1/sessions/plans` 拉取账号真实目录,
|
|
25
|
+
跟随灵犀上下架;未登录时用静态兜底表。
|
|
26
|
+
- **凭证不出本机**:只存 DSH 凭据库(加密落盘),不进代码、不进仓库、不打日志。
|
|
27
|
+
- **智点余额**:设置卡片实时显示剩余额度。**新增**:还会单独算出「15 天内会过期」的
|
|
28
|
+
那部分——总额里看不出「有多少马上作废」,而那是真正该急着用的。
|
|
29
|
+
- **每日签到 / 一次性任务**(新):卡片上有签到按钮,点一下就领。已签到不会重复发写请求。
|
|
30
|
+
三个一次性任务**都能做**:专家模式与客户端由一次带 `client_type` / `session_mode`
|
|
31
|
+
的对话带出,群聊任务走「WS 使用信号 → 建群 → 立刻解散」——都靠
|
|
32
|
+
`execution_status` 生命周期上报,`docs/PROTOCOL.md` §13 有完整流程。
|
|
33
|
+
- **模型目录与倍率**(新):卡片列出每个模型的名称、倍率、上下文、思考/图片支持与启用状态。
|
|
34
|
+
- **输入框读数**(新):输入框左侧一枚胶囊(`灵犀 · 1,072`),点了弹出余额与到期提醒。
|
|
35
|
+
- **界面开关**(新):自动签到 / 胶囊 / 侧栏入口 / 刷新间隔(1·5·10·30·60 分钟),
|
|
36
|
+
点一下即生效,不走「保存」。
|
|
37
|
+
|
|
38
|
+
## 安装
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
dsh plugin --profile desktop add dsh-connect-lingxi
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
装完**重启 DSH**。
|
|
45
|
+
|
|
46
|
+
### 登录:不需要手粘 cookie
|
|
47
|
+
|
|
48
|
+
插件按「用户成本」从低到高自己找登录态:
|
|
49
|
+
|
|
50
|
+
1. **本机灵犀客户端**(`%APPDATA%\kdesk`)—— 装了并登录过,零交互。
|
|
51
|
+
2. **你日常的浏览器**(Edge / Chrome / Brave / 360)—— 在浏览器里用过灵犀网页版就够。
|
|
52
|
+
3. **点一下登录** —— 卡片上的「登录灵犀」拉起一个浏览器窗口,你自己登录,
|
|
53
|
+
插件只读登录后的 cookie。**从不接触密码。**
|
|
54
|
+
|
|
55
|
+
手粘 cookie 仍然保留,但只是**最后的兜底**,不是主路径。
|
|
56
|
+
|
|
57
|
+
> 如果插件提示「库被浏览器独占锁定」:那是浏览器正在运行,关掉它再刷新即可。
|
|
58
|
+
> 这与「没登录」是两件事,提示文案会分开说。
|
|
59
|
+
|
|
60
|
+
## 架构
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
DSH
|
|
64
|
+
└─ PiAiAdapter (@deepseek-ai/dsh-llm-pi-ai)
|
|
65
|
+
└─ pi-ai provider (openAICompletionsApi)
|
|
66
|
+
└─ http://127.0.0.1:<随机端口>/v1/chat/completions ← 本地 shim(仅回环)
|
|
67
|
+
└─ 灵犀三步握手 + SSE 翻译
|
|
68
|
+
|
|
69
|
+
浏览器(设置卡片 / 输入框胶囊)
|
|
70
|
+
├─ GET /plugins/dsh-connect-lingxi/status ← 已归一好的展示数据
|
|
71
|
+
└─ POST /plugins/dsh-connect-lingxi/action ← 白名单动作(refresh / 签到 / 领取 / 开关)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
shim 用 `node:http` 监听 `listen(0, "127.0.0.1")`——内核随机分配端口、只连回环,
|
|
75
|
+
不占固定端口、不对外暴露。宿主路由同样只接受回环 `Host`,cookie 永远不进页面。
|
|
76
|
+
|
|
77
|
+
## 与其它 provider 的关系
|
|
78
|
+
|
|
79
|
+
| 插件 | 定位 |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| `dsh-connect-lingxi`(本插件) | WPS 灵犀 → DSH,原生 agent 通道 + 智点/签到卡片 |
|
|
82
|
+
| `dsh-connect-workbuddy` | WorkBuddy → DSH,原生 agent 通道 + 账号池/积分/签到 |
|
|
83
|
+
| `@kevinfx/magpie-wps-lingxi` | 同一协议,但走 Magpie 网关(多一跳) |
|
|
84
|
+
|
|
85
|
+
本插件不依赖 Magpie。与 workbuddy 的功能差异见
|
|
86
|
+
[`docs/CHANGELOG-0.0.1.md`](docs/CHANGELOG-0.0.1.md#与-workbuddy-的差异有意为之)。
|
|
87
|
+
|
|
88
|
+
## 开发
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
node scripts/test-report.mjs # 逐文件跑测试,结论写进 test-report.txt
|
|
92
|
+
node node_modules/typescript/bin/tsc --noEmit -p tsconfig.json
|
|
93
|
+
node node_modules/tsdown/dist/run.mjs && node scripts/copy-client.mjs # = npm run build
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
- `src/client/bundle.js` 是**手写的经典脚本**(不是 TS、不进 bundler):
|
|
97
|
+
宿主用 `<script>` 加载它,`require('react')` 解析到宿主自己的 React。
|
|
98
|
+
被打包就会变成两份 React,hooks 立刻炸。
|
|
99
|
+
- 客户端槽位契约(哪个槽位用 `id`、哪个用 `key`、props 有哪些)见
|
|
100
|
+
[`docs/CLIENT-API.md`](docs/CLIENT-API.md)——全部从本机 DSH 的 asar 与三个
|
|
101
|
+
已在跑的同级插件产物里交叉验证过。
|
|
102
|
+
|
|
103
|
+
## 许可
|
|
104
|
+
|
|
105
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# dsh-connect-lingxi bundle patch: one row, dual-face (node half = the package's
|
|
2
|
+
# default export, browser half = ./client via the `dsh.client` declaration).
|
|
3
|
+
# The row name MUST equal the package name — the client-modules node half
|
|
4
|
+
# resolves `require.resolve('<row-name>/package.json')` to find the package.
|
|
5
|
+
- insert:
|
|
6
|
+
- id: dsh-connect-lingxi
|
|
7
|
+
name: 'dsh-connect-lingxi'
|