dsh-connect-minimaxcode 0.5.2 → 0.5.4
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 +23 -0
- package/README.md +23 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +67 -5
- package/package.json +16 -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,24 @@ 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.
|
|
300
|
+
- **The context window is declared as the gateway's real ceiling (1,000,000), not the 512,000 in the catalog.** Upstream's `limit.context` is the *default* window and the billing tier boundary (input above 512k costs more); the largest entry of `context_window_options` is the ceiling the gateway enforces. Measured on 2026-10-25: 946,206 tokens were served normally, 1,050,000 were refused (`invalid params, context window exceeds limit (2013)`). Declaring 512,000 meant every turn of a long conversation was reported as `pi-ai detected context overflow` — while the model had answered perfectly well and the reply was thrown away.
|
|
296
301
|
- **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
302
|
|
|
298
303
|
## Changelog
|
|
299
304
|
|
|
305
|
+
### 0.5.4 (2026-10-29)
|
|
306
|
+
|
|
307
|
+
- **Fixed long conversations being reported as context overflow**: upstream's `limit.context` (512,000) is the *default* window and the billing tier boundary, while the ceiling the gateway enforces is the 1,000,000 in `context_window_options`. Declaring 512,000 meant that once a conversation crossed that line, *every* turn was reported as `pi-ai detected context overflow` — even though the model answered normally and the reply was discarded. The window is now declared as the ceiling the gateway actually enforces.
|
|
308
|
+
- The built-in fallback roster (used when the catalog cannot be fetched) now declares 1,000,000 as well.
|
|
309
|
+
- Four new cases pin the window parsing: the largest of `context_window_options` wins, upstream's `limit.context` is the fallback, a malformed option list is ignored, and the fallback roster does not claim 512k.
|
|
310
|
+
|
|
311
|
+
### 0.5.3 (2026-10-25)
|
|
312
|
+
|
|
313
|
+
- **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.
|
|
314
|
+
- 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`.
|
|
315
|
+
- Measured against the live gateway: a 2×2 PNG sent to `M3.1-Flash` came back answered correctly (`inputTokens: 316`).
|
|
316
|
+
|
|
300
317
|
### 0.5.2 (2026-10-21)
|
|
301
318
|
|
|
302
319
|
- **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 +459,12 @@ dsh plugin --profile web exec dsh-workbuddy-connect status
|
|
|
442
459
|
|
|
443
460
|
> 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
461
|
|
|
462
|
+
## Contributors
|
|
463
|
+
|
|
464
|
+
- **[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.
|
|
465
|
+
- **[qzz19970504](https://github.com/qzz19970504)** — found and fixed the wiring gap that made every image upload fail ([#3](https://github.com/JeffTsuiCUG/dsh-connect-minimaxcode/pull/3)): the catalog declared the `image` modality, but the adapter never connected the host's durable attachment service, so pi-ai refused image requests before they were sent. The fix became 0.5.3.
|
|
466
|
+
- Plugin author: **[JeffTsuiCUG](https://github.com/JeffTsuiCUG)**
|
|
467
|
+
|
|
445
468
|
## Acknowledgements
|
|
446
469
|
|
|
447
470
|
- **[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,24 @@ OAuth 令牌有效期约 1 小时,由客户端自动续期。插件**只在自
|
|
|
299
302
|
- **自动签到默认关闭**,且只在服务端明确说「当天可领」时才发请求、每天至多一次。是否开启、以及这样做是否符合 MiniMax 的服务条款,请自行判断。
|
|
300
303
|
- **不提供设置界面卡片**。插件不在 DSH 设置页注册卡片;界面只在输入框工具行增加一枚胶囊(**仅选中本插件的模型时显示**),以及插件页面里的一张小卡片。
|
|
301
304
|
- **上游接口非公开**,MiniMax 客户端更新后可能失效。余额接口失效时胶囊会显示「积分不可用」,不会影响模型对话。
|
|
305
|
+
- **发图依赖宿主的附件服务**。模型目录声明了 `image` 模态(`M3`、`M3.1-Flash`),但把持久化附件读成请求字节是宿主的活儿:宿主没有附件服务时插件仍能加载并服务文本,只是带图的请求会被拒绝。
|
|
306
|
+
- **上下文窗口按网关的真实上限声明(1,000,000),不是目录里的 512,000**。上游 `limit.context` 是**默认档位与计费分界**(输入超过 512k 的部分按更高倍率计费),`context_window_options` 里最大的一档才是网关执行的硬上限。实测(2026-10-25):946,206 tokens 正常受理,1,050,000 被拒(`invalid params, context window exceeds limit (2013)`)。此前按 512,000 声明,长会话一旦过线就**每一轮**都被判成「上下文溢出」,模型其实答得好好的,回复却被丢掉(`pi-ai detected context overflow`)。
|
|
302
307
|
- **设备码流需要能访问 `account.minimax.cn`**,且授权时要在浏览器里能登录 MiniMax 账号。某些内网或受限网络下打不开授权页。
|
|
303
308
|
|
|
304
309
|
## 更新记录
|
|
305
310
|
|
|
311
|
+
### 0.5.4(2026-10-29)
|
|
312
|
+
|
|
313
|
+
- **修复长会话被误判为「上下文溢出」**:上游 `limit.context`(512,000)是**默认档位与计费分界**,网关实际执行的上限是 `context_window_options` 里的 1,000,000。此前按 512,000 声明,会话一旦超过这条线,**每一轮**都会被判定为 `pi-ai detected context overflow` —— 而模型其实正常答了,回复却被丢弃。现在按网关的真实上限声明窗口。
|
|
314
|
+
- 兜底名录(离线时的内置猜测)同步改为 1,000,000。
|
|
315
|
+
- 新增 4 个用例钉住窗口解析:取 `context_window_options` 的最大值、上游没给就回落 `limit.context`、非法列表被忽略、兜底名录的窗口不是 512k。
|
|
316
|
+
|
|
317
|
+
### 0.5.3(2026-10-25)
|
|
318
|
+
|
|
319
|
+
- **修复图片输入**:此前发图必然失败 —— `本轮运行失败 pi-ai image input requires the durable attachment service`(`UNSUPPORTED_CONTENT`)。模型目录一直把 `image` 写进模型的输入模态,但插件构造 `PiAiAdapter` 时没有给 `resolveAttachments` 与 `resolveImageAccess` 两个钩子,pi-ai 因此无法把持久化的附件引用变成请求字节,在发往网关之前就拒绝了调用。现在插件按需读取宿主的 `attachments` 服务,并用 `fs.processPathFromHostPath` 把附件的宿主路径映射进当前执行世界;宿主没有提供附件服务时这两个钩子为 `undefined`,纯文本调用不受影响。
|
|
320
|
+
- 新增 `tests/image-input.spec.ts`,钉住两个钩子的解析、路径映射,以及「宿主没有附件服务仍能加载」;`peerDependencies` 增加 `@deepseek-ai/dsh-attachment`。
|
|
321
|
+
- 实测:真实网关 + `M3.1-Flash` 发一张 2×2 PNG,回答正确(`inputTokens: 316`)。
|
|
322
|
+
|
|
306
323
|
### 0.5.2(2026-10-21)
|
|
307
324
|
|
|
308
325
|
- **插件页图标**:新增随包发布的 `icon.svg`(48×48,800 字节内),并在 `package.json` 里声明 `"icon": "./icon.svg"`。宿主会把它读成 data URL 画在插件页卡片上,不再是默认占位图。
|
|
@@ -448,6 +465,12 @@ dsh plugin --profile web exec dsh-workbuddy-connect status
|
|
|
448
465
|
|
|
449
466
|
> 该插件的版本需与你的 DSH 内核严格对应(不同内核线用不同版本),安装前请见其 README 的版本对应表。
|
|
450
467
|
|
|
468
|
+
## 贡献者
|
|
469
|
+
|
|
470
|
+
- **[eghrhegpe](https://github.com/eghrhegpe)** —— 提出了插件页图标与中英文文案的建议([#1](https://github.com/JeffTsuiCUG/dsh-connect-minimaxcode/issues/1))。这条建议促成了 0.5.2:插件页有了自己的 SVG 图标,标题与简介有了中英两版,界面文案也开始跟随宿主语言。
|
|
471
|
+
- **[qzz19970504](https://github.com/qzz19970504)** —— 定位并修复了「发图必然失败」的接线缺口([#3](https://github.com/JeffTsuiCUG/dsh-connect-minimaxcode/pull/3)):模型目录声明了 `image` 模态,但适配器没有把宿主的持久化附件服务接上,导致带图请求被 pi-ai 在发出前拒掉。该修复成为 0.5.3。
|
|
472
|
+
- 插件作者:**[JeffTsuiCUG](https://github.com/JeffTsuiCUG)**
|
|
473
|
+
|
|
451
474
|
## 致谢
|
|
452
475
|
|
|
453
476
|
- **[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. */
|
|
@@ -144,6 +145,11 @@ declare const MINIMAXCODE_PROVIDER_ID = "minimaxcode";
|
|
|
144
145
|
* when upstream retired `MiniMax-M2.7` and `MiniMax-M2.7-highspeed` and
|
|
145
146
|
* promoted the model previously served anonymously (internally "space bunny")
|
|
146
147
|
* as `MiniMax-M3.1-Flash`.
|
|
148
|
+
*
|
|
149
|
+
* The window is 1,000,000 rather than the 512,000 the upstream `limit` block
|
|
150
|
+
* reports: 512k is the billing tier boundary, and the gateway itself was
|
|
151
|
+
* measured serving 946,206 tokens before refusing ~1,050,000 with
|
|
152
|
+
* `invalid params, context window exceeds limit (2013)`.
|
|
147
153
|
*/
|
|
148
154
|
declare const FALLBACK_MODELS: readonly CatalogModel[];
|
|
149
155
|
/** Where the currently served list came from. */
|
|
@@ -911,6 +917,17 @@ interface AdapterOptions {
|
|
|
911
917
|
* transcript, so what is reported is what was actually billed.
|
|
912
918
|
*/
|
|
913
919
|
onUsage?: (model: string, usage: ModelUsage) => void;
|
|
920
|
+
/**
|
|
921
|
+
* Resolve the host's durable attachment service at request time.
|
|
922
|
+
*
|
|
923
|
+
* Required for image input: without it the pi-ai adapter rejects any message
|
|
924
|
+
* carrying an image with `UNSUPPORTED_CONTENT`, because it cannot turn a
|
|
925
|
+
* durable reference into request bytes. Optional here only so a host that
|
|
926
|
+
* provides no such service can still load this plugin and serve text.
|
|
927
|
+
*/
|
|
928
|
+
resolveAttachments?: PiAiAdapterOptions['resolveAttachments'];
|
|
929
|
+
/** Bridge one attachment into the current tool execution world. */
|
|
930
|
+
resolveImageAccess?: PiAiAdapterOptions['resolveImageAccess'];
|
|
914
931
|
}
|
|
915
932
|
/** What {@link createMinimaxCodeAdapter} hands back. */
|
|
916
933
|
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
|
|
@@ -238,11 +238,16 @@ const MINIMAXCODE_PROVIDER_ID = "minimaxcode";
|
|
|
238
238
|
* when upstream retired `MiniMax-M2.7` and `MiniMax-M2.7-highspeed` and
|
|
239
239
|
* promoted the model previously served anonymously (internally "space bunny")
|
|
240
240
|
* as `MiniMax-M3.1-Flash`.
|
|
241
|
+
*
|
|
242
|
+
* The window is 1,000,000 rather than the 512,000 the upstream `limit` block
|
|
243
|
+
* reports: 512k is the billing tier boundary, and the gateway itself was
|
|
244
|
+
* measured serving 946,206 tokens before refusing ~1,050,000 with
|
|
245
|
+
* `invalid params, context window exceeds limit (2013)`.
|
|
241
246
|
*/
|
|
242
247
|
const FALLBACK_MODELS = [{
|
|
243
248
|
id: "MiniMax-M3",
|
|
244
249
|
name: "M3",
|
|
245
|
-
contextWindow:
|
|
250
|
+
contextWindow: 1e6,
|
|
246
251
|
maxOutputTokens: 128e3,
|
|
247
252
|
toolCall: true,
|
|
248
253
|
reasoning: true,
|
|
@@ -255,7 +260,7 @@ const FALLBACK_MODELS = [{
|
|
|
255
260
|
}, {
|
|
256
261
|
id: "MiniMax-M3.1-Flash",
|
|
257
262
|
name: "M3.1-Flash",
|
|
258
|
-
contextWindow:
|
|
263
|
+
contextWindow: 1e6,
|
|
259
264
|
maxOutputTokens: 128e3,
|
|
260
265
|
toolCall: true,
|
|
261
266
|
reasoning: true,
|
|
@@ -278,12 +283,42 @@ function sameCatalog(a, b) {
|
|
|
278
283
|
function usable(id, raw) {
|
|
279
284
|
return id.length > 0 && id.startsWith("MiniMax-") && typeof raw === "object" && raw !== null;
|
|
280
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* The window the gateway actually enforces.
|
|
288
|
+
*
|
|
289
|
+
* Upstream reports two different numbers, and they mean different things:
|
|
290
|
+
* `limit.context` is the *default* window — the billing tier boundary, above
|
|
291
|
+
* which input costs more — while `context_window_options` lists every window
|
|
292
|
+
* the gateway will accept, the largest being the hard ceiling.
|
|
293
|
+
*
|
|
294
|
+
* Measured against the live gateway on 2026-10-25: a prompt of 946,206 tokens
|
|
295
|
+
* was served normally, and one of ~1,050,000 was refused with
|
|
296
|
+
* `invalid params, context window exceeds limit (2013)`. The ceiling is
|
|
297
|
+
* therefore the largest option, not `limit.context`.
|
|
298
|
+
*
|
|
299
|
+
* Declaring the default instead of the ceiling is not a cosmetic difference:
|
|
300
|
+
* the adapter compares the gateway's own token count against this number, so a
|
|
301
|
+
* conversation that runs past 512k is reported as a context overflow on every
|
|
302
|
+
* turn even though the gateway answers it perfectly well.
|
|
303
|
+
*
|
|
304
|
+
* @param raw - The upstream model entry.
|
|
305
|
+
* @param limit - The upstream `limit` block, already read.
|
|
306
|
+
* @returns The window to declare, in tokens.
|
|
307
|
+
*/
|
|
308
|
+
function readContextWindow(raw, limit) {
|
|
309
|
+
const options = raw.context_window_options;
|
|
310
|
+
if (Array.isArray(options)) {
|
|
311
|
+
const sizes = options.filter((value) => typeof value === "number" && Number.isInteger(value) && value > 0);
|
|
312
|
+
if (sizes.length > 0) return Math.max(...sizes);
|
|
313
|
+
}
|
|
314
|
+
return typeof limit.context === "number" ? limit.context : 2e5;
|
|
315
|
+
}
|
|
281
316
|
/** Read the fields the upstream sends, tolerating their absence. */
|
|
282
317
|
function readModel(id, raw) {
|
|
283
318
|
const limit = raw.limit ?? {};
|
|
284
319
|
const modalities = raw.modalities ?? {};
|
|
285
320
|
const input = Array.isArray(modalities.input) ? modalities.input.filter((m) => typeof m === "string") : ["text"];
|
|
286
|
-
const contextWindow =
|
|
321
|
+
const contextWindow = readContextWindow(raw, limit);
|
|
287
322
|
return {
|
|
288
323
|
id,
|
|
289
324
|
name: typeof raw.name === "string" ? raw.name : id,
|
|
@@ -613,7 +648,9 @@ function createMinimaxCodeAdapter(options) {
|
|
|
613
648
|
const inner = new PiAiAdapter({
|
|
614
649
|
profiles: () => profiles,
|
|
615
650
|
resolveApiKey: options.resolveApiKey,
|
|
616
|
-
auth: INERT_AUTH
|
|
651
|
+
auth: INERT_AUTH,
|
|
652
|
+
...options.resolveAttachments === void 0 ? {} : { resolveAttachments: options.resolveAttachments },
|
|
653
|
+
...options.resolveImageAccess === void 0 ? {} : { resolveImageAccess: options.resolveImageAccess }
|
|
617
654
|
});
|
|
618
655
|
return {
|
|
619
656
|
adapter: options.onUsage === void 0 ? inner : new MeteredAdapter(inner, options.onUsage),
|
|
@@ -623,6 +660,30 @@ function createMinimaxCodeAdapter(options) {
|
|
|
623
660
|
};
|
|
624
661
|
}
|
|
625
662
|
//#endregion
|
|
663
|
+
//#region src/image-input.ts
|
|
664
|
+
/**
|
|
665
|
+
* Build the two image-input hooks from the services the host provides.
|
|
666
|
+
*
|
|
667
|
+
* Both services are read per request through `ctx.get` rather than declared as
|
|
668
|
+
* startup injections: they may be provided after this plugin loads, and a host
|
|
669
|
+
* without them must still start and serve text. A host that provides no
|
|
670
|
+
* attachment store simply keeps refusing images, which is the old behaviour
|
|
671
|
+
* rather than a new failure.
|
|
672
|
+
*
|
|
673
|
+
* `resolveImageAccess` is what lets a model read the normalized image from a
|
|
674
|
+
* tool as well as see it inline. It degrades to `undefined` when the host
|
|
675
|
+
* exposes no host-path mapping, and the adapter then reports no local copy.
|
|
676
|
+
*
|
|
677
|
+
* @param ctx - the plugin fiber whose services are read.
|
|
678
|
+
* @returns The optional {@link AdapterOptions} hooks, ready to spread.
|
|
679
|
+
*/
|
|
680
|
+
function imageInputHooks(ctx) {
|
|
681
|
+
return {
|
|
682
|
+
resolveAttachments: () => ctx.get("attachments"),
|
|
683
|
+
resolveImageAccess: (attachments, ref) => resolveImageAttachmentAccess(attachments, (hostPath) => ctx.get("fs")?.processPathFromHostPath(hostPath), ref)
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
//#endregion
|
|
626
687
|
//#region src/status-route.ts
|
|
627
688
|
/** Route this plugin mounts, matching its settings card. */
|
|
628
689
|
const MINIMAX_STATUS_PATH = "/plugins/dsh-connect-minimaxcode/status";
|
|
@@ -2159,6 +2220,7 @@ function apply(ctx) {
|
|
|
2159
2220
|
region: () => region,
|
|
2160
2221
|
resolveApiKey: async () => (await readNow())?.token,
|
|
2161
2222
|
bearerToken: () => modelToken,
|
|
2223
|
+
...imageInputHooks(ctx),
|
|
2162
2224
|
onUsage: (model, usage) => {
|
|
2163
2225
|
meter.record(model, usage);
|
|
2164
2226
|
refreshCredits();
|
package/package.json
CHANGED
|
@@ -2,8 +2,22 @@
|
|
|
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.4",
|
|
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
|
+
{
|
|
17
|
+
"name": "qzz19970504",
|
|
18
|
+
"url": "https://github.com/qzz19970504"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
7
21
|
"license": "MIT",
|
|
8
22
|
"private": false,
|
|
9
23
|
"publishConfig": {
|
|
@@ -65,6 +79,7 @@
|
|
|
65
79
|
"peerDependencies": {
|
|
66
80
|
"@deepseek-ai/cordis": ">=4.0.4 <5.0.0",
|
|
67
81
|
"@deepseek-ai/dsh-atomic-write": ">=0.1.7-rc.1 <0.3.0-0",
|
|
82
|
+
"@deepseek-ai/dsh-attachment": ">=0.1.7-rc.1 <0.3.0-0",
|
|
68
83
|
"@deepseek-ai/dsh-home-paths": ">=0.1.7-rc.1 <0.3.0-0",
|
|
69
84
|
"@deepseek-ai/dsh-host-webserver": ">=0.1.7-rc.1 <0.3.0-0",
|
|
70
85
|
"@deepseek-ai/dsh-llm": ">=0.1.7-rc.1 <0.3.0-0",
|