dsh-connect-minimaxcode 0.5.2 → 0.5.3
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 +15 -0
- package/README.md +15 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +29 -2
- package/package.json +12 -1
package/README.en.md
CHANGED
|
@@ -50,6 +50,7 @@ Another implementation in the same direction is **[dingminhua/dsh-connect-workbu
|
|
|
50
50
|
- **Read-mostly**: apart from "refreshing an expired desktop app login state" and the sign-in you start yourself, the plugin does not write to or modify any MiniMax file
|
|
51
51
|
- **Follows the selected model**: the balance sits in the **composer tool row beside the model picker**, and is drawn **only while a MiniMax model is selected** — picking another connector's model hides it entirely instead of misleading you with MiniMax's balance
|
|
52
52
|
- **An icon and two languages of its own**: a 48×48 SVG ships with the package, so the plugin page no longer shows the default placeholder; the title and the introduction come in Chinese and English, and the interface follows the host's language
|
|
53
|
+
- **Image input**: models whose catalog entry declares the `image` input modality (`M3`, `M3.1-Flash`) take pictures directly; the host's attachment service reads the image into request bytes, and the plugin only has to connect the durable reference to it
|
|
53
54
|
|
|
54
55
|
## Prerequisites
|
|
55
56
|
|
|
@@ -60,6 +61,8 @@ Either:
|
|
|
60
61
|
|
|
61
62
|
Plus DSH desktop (built-in core `>=0.2.1-rc.2 <0.3.0`, see `engines.dsh` in `package.json`; tested on `0.2.1-rc.2`) or the Web profile.
|
|
62
63
|
|
|
64
|
+
> **Sending a picture needs the host's attachment service**: the plugin does not read images itself — the host's durable attachment service turns a stored reference into request bytes, and the plugin only connects the two. On a host without that service the plugin still loads and text still works; only image requests are refused (`pi-ai image input requires the durable attachment service`).
|
|
65
|
+
|
|
63
66
|
## Installation
|
|
64
67
|
|
|
65
68
|
**Option 1: install from the Git repository** (recommended, gets the latest code)
|
|
@@ -293,10 +296,17 @@ The OAuth token is valid for about an hour and is refreshed automatically by the
|
|
|
293
296
|
- **The automatic claim is off by default**, and it only asks when the server explicitly says the day can be claimed, at most once a day. Whether to turn it on, and whether that is within MiniMax's terms of service, is your call.
|
|
294
297
|
- **No settings card is provided**. The plugin does not register a card on the DSH settings page; the interface it adds is a single pill in the composer tool row (**drawn only while this plugin's model is selected**) and a small card on the plugin page.
|
|
295
298
|
- **The upstream APIs are non-public** and may stop working when MiniMax updates its client. If the balance API breaks, the pill shows "credits unavailable", which does not affect model traffic.
|
|
299
|
+
- **Image input depends on the host's attachment service.** The catalog declares the `image` modality (`M3`, `M3.1-Flash`), but turning a durable attachment into request bytes is the host's job: without that service the plugin still loads and serves text, and only image requests are refused.
|
|
296
300
|
- **The device code flow needs `account.minimax.cn` to be reachable**, and the browser that authorizes it has to be able to sign in to a MiniMax account. On some restricted networks the authorization page cannot be opened.
|
|
297
301
|
|
|
298
302
|
## Changelog
|
|
299
303
|
|
|
304
|
+
### 0.5.3 (2026-10-25)
|
|
305
|
+
|
|
306
|
+
- **Fixed image input**: an upload used to fail every time — `pi-ai image input requires the durable attachment service` (`UNSUPPORTED_CONTENT`). The catalog always declared `image` among a model's input modalities, but the plugin built its `PiAiAdapter` without `resolveAttachments` or `resolveImageAccess`, so pi-ai had no way to turn a durable attachment reference into request bytes and refused the call before it reached the gateway. The plugin now reads the host's `attachments` service on demand and maps an attachment's host path into the current execution world with `fs.processPathFromHostPath`; a host that offers no attachment service gets `undefined` for both hooks, and text-only calls are unchanged.
|
|
307
|
+
- New `tests/image-input.spec.ts` pins how both hooks resolve, the path mapping, and the "no attachment service still loads" case; `peerDependencies` gains `@deepseek-ai/dsh-attachment`.
|
|
308
|
+
- Measured against the live gateway: a 2×2 PNG sent to `M3.1-Flash` came back answered correctly (`inputTokens: 316`).
|
|
309
|
+
|
|
300
310
|
### 0.5.2 (2026-10-21)
|
|
301
311
|
|
|
302
312
|
- **An icon for the plugin page**: a new `icon.svg` (48×48, under 800 bytes) ships with the package, declared as `"icon": "./icon.svg"` in `package.json`. The host reads it as a data URL and draws it on the plugin page instead of the default placeholder.
|
|
@@ -442,6 +452,11 @@ dsh plugin --profile web exec dsh-workbuddy-connect status
|
|
|
442
452
|
|
|
443
453
|
> This plugin's version must match your DSH core exactly (each core line uses a different version); see the version table in its README before installing.
|
|
444
454
|
|
|
455
|
+
## Contributors
|
|
456
|
+
|
|
457
|
+
- **[eghrhegpe](https://github.com/eghrhegpe)** — raised the request for a plugin-page icon and Chinese/English copy ([#1](https://github.com/JeffTsuiCUG/dsh-connect-minimaxcode/issues/1)). It became 0.5.2: the plugin page has its own SVG artwork, the title and the introduction come in both languages, and the interface follows the host's language.
|
|
458
|
+
- Plugin author: **[JeffTsuiCUG](https://github.com/JeffTsuiCUG)**
|
|
459
|
+
|
|
445
460
|
## Acknowledgements
|
|
446
461
|
|
|
447
462
|
- **[corrinehu/dsh-workbuddy-connect](https://github.com/corrinehu/dsh-workbuddy-connect)** — **the inspiration for this plugin**. The overall idea of "reuse the desktop app's local login state and bring the already-signed-in model into DSH" was established first by that project, and this plugin follows the same approach; the read-only reuse of credentials was designed with it in mind.
|
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
- **只读为主**:除「续期已过期的桌面 App 登录态」和「你自己发起的登录」外,不写入、不修改 MiniMax 的任何文件
|
|
51
51
|
- **跟随所选模型**:余额显示在**输入框工具行(模型选择器旁)**,且**只在选中 MiniMax 模型时出现** —— 切到其他反代插件的模型就整体隐藏,不会拿着 MiniMax 的余额误导你
|
|
52
52
|
- **插件页有自己的图标与中英文**:随包发布一张 48×48 的 SVG,插件页不再显示默认占位图;标题与简介按宿主语言给中英文两版,界面文案也跟着宿主语言走
|
|
53
|
+
- **能看图**:模型目录里声明了 `image` 输入模态的模型(`M3`、`M3.1-Flash`)可以直接发图;图片由宿主的附件服务读成请求字节,插件只负责把持久化的附件引用接上去
|
|
53
54
|
|
|
54
55
|
## 前置条件
|
|
55
56
|
|
|
@@ -60,6 +61,8 @@
|
|
|
60
61
|
|
|
61
62
|
另外需要 DSH 桌面版(内置内核 `>=0.2.1-rc.2 <0.3.0`,见 `package.json` 的 `engines.dsh`;实测 `0.2.1-rc.2`)或 Web profile。
|
|
62
63
|
|
|
64
|
+
> **发图需要宿主提供附件服务**:图片不是插件自己读的,而是由宿主的持久化附件服务读成请求字节,插件只负责把附件引用接上去。宿主没有附件服务时,插件照常加载、文本照常对话,只是发图会被拒绝(`pi-ai image input requires the durable attachment service`)。
|
|
65
|
+
|
|
63
66
|
## 安装
|
|
64
67
|
|
|
65
68
|
**方式一:从 Git 仓库安装**(推荐,拿到最新代码)
|
|
@@ -299,10 +302,17 @@ OAuth 令牌有效期约 1 小时,由客户端自动续期。插件**只在自
|
|
|
299
302
|
- **自动签到默认关闭**,且只在服务端明确说「当天可领」时才发请求、每天至多一次。是否开启、以及这样做是否符合 MiniMax 的服务条款,请自行判断。
|
|
300
303
|
- **不提供设置界面卡片**。插件不在 DSH 设置页注册卡片;界面只在输入框工具行增加一枚胶囊(**仅选中本插件的模型时显示**),以及插件页面里的一张小卡片。
|
|
301
304
|
- **上游接口非公开**,MiniMax 客户端更新后可能失效。余额接口失效时胶囊会显示「积分不可用」,不会影响模型对话。
|
|
305
|
+
- **发图依赖宿主的附件服务**。模型目录声明了 `image` 模态(`M3`、`M3.1-Flash`),但把持久化附件读成请求字节是宿主的活儿:宿主没有附件服务时插件仍能加载并服务文本,只是带图的请求会被拒绝。
|
|
302
306
|
- **设备码流需要能访问 `account.minimax.cn`**,且授权时要在浏览器里能登录 MiniMax 账号。某些内网或受限网络下打不开授权页。
|
|
303
307
|
|
|
304
308
|
## 更新记录
|
|
305
309
|
|
|
310
|
+
### 0.5.3(2026-10-25)
|
|
311
|
+
|
|
312
|
+
- **修复图片输入**:此前发图必然失败 —— `本轮运行失败 pi-ai image input requires the durable attachment service`(`UNSUPPORTED_CONTENT`)。模型目录一直把 `image` 写进模型的输入模态,但插件构造 `PiAiAdapter` 时没有给 `resolveAttachments` 与 `resolveImageAccess` 两个钩子,pi-ai 因此无法把持久化的附件引用变成请求字节,在发往网关之前就拒绝了调用。现在插件按需读取宿主的 `attachments` 服务,并用 `fs.processPathFromHostPath` 把附件的宿主路径映射进当前执行世界;宿主没有提供附件服务时这两个钩子为 `undefined`,纯文本调用不受影响。
|
|
313
|
+
- 新增 `tests/image-input.spec.ts`,钉住两个钩子的解析、路径映射,以及「宿主没有附件服务仍能加载」;`peerDependencies` 增加 `@deepseek-ai/dsh-attachment`。
|
|
314
|
+
- 实测:真实网关 + `M3.1-Flash` 发一张 2×2 PNG,回答正确(`inputTokens: 316`)。
|
|
315
|
+
|
|
306
316
|
### 0.5.2(2026-10-21)
|
|
307
317
|
|
|
308
318
|
- **插件页图标**:新增随包发布的 `icon.svg`(48×48,800 字节内),并在 `package.json` 里声明 `"icon": "./icon.svg"`。宿主会把它读成 data URL 画在插件页卡片上,不再是默认占位图。
|
|
@@ -448,6 +458,11 @@ dsh plugin --profile web exec dsh-workbuddy-connect status
|
|
|
448
458
|
|
|
449
459
|
> 该插件的版本需与你的 DSH 内核严格对应(不同内核线用不同版本),安装前请见其 README 的版本对应表。
|
|
450
460
|
|
|
461
|
+
## 贡献者
|
|
462
|
+
|
|
463
|
+
- **[eghrhegpe](https://github.com/eghrhegpe)** —— 提出了插件页图标与中英文文案的建议([#1](https://github.com/JeffTsuiCUG/dsh-connect-minimaxcode/issues/1))。这条建议促成了 0.5.2:插件页有了自己的 SVG 图标,标题与简介有了中英两版,界面文案也开始跟随宿主语言。
|
|
464
|
+
- 插件作者:**[JeffTsuiCUG](https://github.com/JeffTsuiCUG)**
|
|
465
|
+
|
|
451
466
|
## 致谢
|
|
452
467
|
|
|
453
468
|
- **[corrinehu/dsh-workbuddy-connect](https://github.com/corrinehu/dsh-workbuddy-connect)** — **本插件的灵感来源**。「复用桌面 App 本机登录态、把已登录模型接进 DSH」的整体思路由该项目最早确立,本插件沿用同一做法;凭据只读复用的设计也参照于此。
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "@earendil-works/pi-ai";
|
|
2
2
|
import { LlmAdapter } from "@deepseek-ai/dsh-llm";
|
|
3
|
+
import { PiAiAdapterOptions } from "@deepseek-ai/dsh-llm-pi-ai";
|
|
3
4
|
import { Context } from "@deepseek-ai/cordis";
|
|
4
5
|
//#region src/auth.d.ts
|
|
5
6
|
/** File the desktop app writes its runtime auth context into. */
|
|
@@ -911,6 +912,17 @@ interface AdapterOptions {
|
|
|
911
912
|
* transcript, so what is reported is what was actually billed.
|
|
912
913
|
*/
|
|
913
914
|
onUsage?: (model: string, usage: ModelUsage) => void;
|
|
915
|
+
/**
|
|
916
|
+
* Resolve the host's durable attachment service at request time.
|
|
917
|
+
*
|
|
918
|
+
* Required for image input: without it the pi-ai adapter rejects any message
|
|
919
|
+
* carrying an image with `UNSUPPORTED_CONTENT`, because it cannot turn a
|
|
920
|
+
* durable reference into request bytes. Optional here only so a host that
|
|
921
|
+
* provides no such service can still load this plugin and serve text.
|
|
922
|
+
*/
|
|
923
|
+
resolveAttachments?: PiAiAdapterOptions['resolveAttachments'];
|
|
924
|
+
/** Bridge one attachment into the current tool execution world. */
|
|
925
|
+
resolveImageAccess?: PiAiAdapterOptions['resolveImageAccess'];
|
|
914
926
|
}
|
|
915
927
|
/** What {@link createMinimaxCodeAdapter} hands back. */
|
|
916
928
|
interface AdapterBundle {
|
package/lib/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { homedir } from "node:os";
|
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { createProvider } from "@earendil-works/pi-ai";
|
|
6
6
|
import { anthropicMessagesApi } from "@earendil-works/pi-ai/api/anthropic-messages.lazy";
|
|
7
|
-
import { LlmAdapter, resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
|
|
7
|
+
import { LlmAdapter, resolveImageAttachmentAccess, resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
|
|
8
8
|
import { PiAiAdapter } from "@deepseek-ai/dsh-llm-pi-ai";
|
|
9
9
|
import { createHash, randomBytes } from "node:crypto";
|
|
10
10
|
//#region src/auth.ts
|
|
@@ -613,7 +613,9 @@ function createMinimaxCodeAdapter(options) {
|
|
|
613
613
|
const inner = new PiAiAdapter({
|
|
614
614
|
profiles: () => profiles,
|
|
615
615
|
resolveApiKey: options.resolveApiKey,
|
|
616
|
-
auth: INERT_AUTH
|
|
616
|
+
auth: INERT_AUTH,
|
|
617
|
+
...options.resolveAttachments === void 0 ? {} : { resolveAttachments: options.resolveAttachments },
|
|
618
|
+
...options.resolveImageAccess === void 0 ? {} : { resolveImageAccess: options.resolveImageAccess }
|
|
617
619
|
});
|
|
618
620
|
return {
|
|
619
621
|
adapter: options.onUsage === void 0 ? inner : new MeteredAdapter(inner, options.onUsage),
|
|
@@ -623,6 +625,30 @@ function createMinimaxCodeAdapter(options) {
|
|
|
623
625
|
};
|
|
624
626
|
}
|
|
625
627
|
//#endregion
|
|
628
|
+
//#region src/image-input.ts
|
|
629
|
+
/**
|
|
630
|
+
* Build the two image-input hooks from the services the host provides.
|
|
631
|
+
*
|
|
632
|
+
* Both services are read per request through `ctx.get` rather than declared as
|
|
633
|
+
* startup injections: they may be provided after this plugin loads, and a host
|
|
634
|
+
* without them must still start and serve text. A host that provides no
|
|
635
|
+
* attachment store simply keeps refusing images, which is the old behaviour
|
|
636
|
+
* rather than a new failure.
|
|
637
|
+
*
|
|
638
|
+
* `resolveImageAccess` is what lets a model read the normalized image from a
|
|
639
|
+
* tool as well as see it inline. It degrades to `undefined` when the host
|
|
640
|
+
* exposes no host-path mapping, and the adapter then reports no local copy.
|
|
641
|
+
*
|
|
642
|
+
* @param ctx - the plugin fiber whose services are read.
|
|
643
|
+
* @returns The optional {@link AdapterOptions} hooks, ready to spread.
|
|
644
|
+
*/
|
|
645
|
+
function imageInputHooks(ctx) {
|
|
646
|
+
return {
|
|
647
|
+
resolveAttachments: () => ctx.get("attachments"),
|
|
648
|
+
resolveImageAccess: (attachments, ref) => resolveImageAttachmentAccess(attachments, (hostPath) => ctx.get("fs")?.processPathFromHostPath(hostPath), ref)
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
//#endregion
|
|
626
652
|
//#region src/status-route.ts
|
|
627
653
|
/** Route this plugin mounts, matching its settings card. */
|
|
628
654
|
const MINIMAX_STATUS_PATH = "/plugins/dsh-connect-minimaxcode/status";
|
|
@@ -2159,6 +2185,7 @@ function apply(ctx) {
|
|
|
2159
2185
|
region: () => region,
|
|
2160
2186
|
resolveApiKey: async () => (await readNow())?.token,
|
|
2161
2187
|
bearerToken: () => modelToken,
|
|
2188
|
+
...imageInputHooks(ctx),
|
|
2162
2189
|
onUsage: (model, usage) => {
|
|
2163
2190
|
meter.record(model, usage);
|
|
2164
2191
|
refreshCredits();
|
package/package.json
CHANGED
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
"name": "dsh-connect-minimaxcode",
|
|
3
3
|
"displayName": "DSH Connect MiniMax Code",
|
|
4
4
|
"description": "把本机已登录的 MiniMax Code 桌面 App 模型接入 DeepSeek Harness:零配置、Anthropic Messages 兼容、动态模型目录,并显示积分余额与到期 — bring MiniMax Code desktop app models into DSH with a dynamic model catalog and a credit balance with expiry details.",
|
|
5
|
-
"version": "0.5.
|
|
5
|
+
"version": "0.5.3",
|
|
6
6
|
"author": "JeffTsuiCUG",
|
|
7
|
+
"contributors": [
|
|
8
|
+
{
|
|
9
|
+
"name": "JeffTsuiCUG",
|
|
10
|
+
"url": "https://github.com/JeffTsuiCUG"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "eghrhegpe",
|
|
14
|
+
"url": "https://github.com/eghrhegpe"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
7
17
|
"license": "MIT",
|
|
8
18
|
"private": false,
|
|
9
19
|
"publishConfig": {
|
|
@@ -65,6 +75,7 @@
|
|
|
65
75
|
"peerDependencies": {
|
|
66
76
|
"@deepseek-ai/cordis": ">=4.0.4 <5.0.0",
|
|
67
77
|
"@deepseek-ai/dsh-atomic-write": ">=0.1.7-rc.1 <0.3.0-0",
|
|
78
|
+
"@deepseek-ai/dsh-attachment": ">=0.1.7-rc.1 <0.3.0-0",
|
|
68
79
|
"@deepseek-ai/dsh-home-paths": ">=0.1.7-rc.1 <0.3.0-0",
|
|
69
80
|
"@deepseek-ai/dsh-host-webserver": ">=0.1.7-rc.1 <0.3.0-0",
|
|
70
81
|
"@deepseek-ai/dsh-llm": ">=0.1.7-rc.1 <0.3.0-0",
|