dsh-agent-sdk-bridge 1.3.3 → 1.3.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/lib/index.js +23 -4
- package/package.json +1 -1
- package/src/minimax-cli.ts +26 -5
package/lib/index.js
CHANGED
|
@@ -6135,9 +6135,28 @@ const INSTALL_FLAGS = [
|
|
|
6135
6135
|
"https://registry.npmjs.org/",
|
|
6136
6136
|
"--foreground-scripts"
|
|
6137
6137
|
];
|
|
6138
|
-
|
|
6138
|
+
/**
|
|
6139
|
+
* The Node interpreter that can load the CLI's native SQLite module.
|
|
6140
|
+
*
|
|
6141
|
+
* `@minimax-ai/code` is installed globally by npm, so its `better-sqlite3`
|
|
6142
|
+
* build matches the Node npm used — the `node` on PATH. DSH's desktop host
|
|
6143
|
+
* runs Electron, whose NODE_MODULE_VERSION differs; spawning `process.execPath`
|
|
6144
|
+
* there makes `mcode acp` die before the ACP handshake ("ACP connection
|
|
6145
|
+
* closed"). Prefer the npm shim's sibling node.exe when present, otherwise
|
|
6146
|
+
* resolve `node` from PATH.
|
|
6147
|
+
*/
|
|
6148
|
+
function cliNodeCommand(shimDir) {
|
|
6149
|
+
if (process.versions.electron === void 0) return process.execPath;
|
|
6150
|
+
if (shimDir !== void 0) {
|
|
6151
|
+
const exe = process.platform === "win32" ? "node.exe" : "node";
|
|
6152
|
+
const local = join(shimDir, exe);
|
|
6153
|
+
if (existsSync(local)) return local;
|
|
6154
|
+
}
|
|
6155
|
+
return "node";
|
|
6156
|
+
}
|
|
6157
|
+
function fromJsEntry(path, nodeCommand = cliNodeCommand()) {
|
|
6139
6158
|
return {
|
|
6140
|
-
command:
|
|
6159
|
+
command: nodeCommand,
|
|
6141
6160
|
args: [path],
|
|
6142
6161
|
cliPath: path
|
|
6143
6162
|
};
|
|
@@ -6147,10 +6166,10 @@ function fromShim(shim) {
|
|
|
6147
6166
|
try {
|
|
6148
6167
|
const text = readFileSync(shim, "utf8");
|
|
6149
6168
|
const match = /["']([^"']*node_modules[\\/]@minimax-ai[\\/]code[\\/]cli\.js)["']/.exec(text);
|
|
6150
|
-
if (match !== null && existsSync(match[1])) return fromJsEntry(match[1]);
|
|
6169
|
+
if (match !== null && existsSync(match[1])) return fromJsEntry(match[1], cliNodeCommand(dirname(shim)));
|
|
6151
6170
|
} catch {}
|
|
6152
6171
|
const sibling = join(dirname(shim), "node_modules", "@minimax-ai", "code", "cli.js");
|
|
6153
|
-
if (existsSync(sibling)) return fromJsEntry(sibling);
|
|
6172
|
+
if (existsSync(sibling)) return fromJsEntry(sibling, cliNodeCommand(dirname(shim)));
|
|
6154
6173
|
return {
|
|
6155
6174
|
command: process.env.ComSpec ?? "cmd.exe",
|
|
6156
6175
|
args: [
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "dsh-agent-sdk-bridge",
|
|
3
3
|
"displayName": "Agent SDK Bridge",
|
|
4
4
|
"description": "DeepSeek Harness LLM adapter bridge for Qoder CN, Qoder International, Tencent CodeBuddy and MiniMax Code subscriptions. It reuses each provider's own SDK or official ACP server and CLI login, shows available quota, and exposes per-provider settings pages with independent international and mainland login regions.",
|
|
5
|
-
"version": "1.3.
|
|
5
|
+
"version": "1.3.4",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "k1-h2",
|
package/src/minimax-cli.ts
CHANGED
|
@@ -35,23 +35,44 @@ const INSTALL_FLAGS = [
|
|
|
35
35
|
'--foreground-scripts',
|
|
36
36
|
]
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* The Node interpreter that can load the CLI's native SQLite module.
|
|
40
|
+
*
|
|
41
|
+
* `@minimax-ai/code` is installed globally by npm, so its `better-sqlite3`
|
|
42
|
+
* build matches the Node npm used — the `node` on PATH. DSH's desktop host
|
|
43
|
+
* runs Electron, whose NODE_MODULE_VERSION differs; spawning `process.execPath`
|
|
44
|
+
* there makes `mcode acp` die before the ACP handshake ("ACP connection
|
|
45
|
+
* closed"). Prefer the npm shim's sibling node.exe when present, otherwise
|
|
46
|
+
* resolve `node` from PATH.
|
|
47
|
+
*/
|
|
48
|
+
function cliNodeCommand(shimDir?: string): string {
|
|
49
|
+
if (process.versions.electron === undefined) return process.execPath
|
|
50
|
+
if (shimDir !== undefined) {
|
|
51
|
+
const exe = process.platform === 'win32' ? 'node.exe' : 'node'
|
|
52
|
+
const local = join(shimDir, exe)
|
|
53
|
+
if (existsSync(local)) return local
|
|
54
|
+
}
|
|
55
|
+
return 'node'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function fromJsEntry(path: string, nodeCommand: string = cliNodeCommand()): MinimaxCliSpec {
|
|
59
|
+
return { command: nodeCommand, args: [path], cliPath: path }
|
|
40
60
|
}
|
|
41
61
|
|
|
42
62
|
function fromShim(shim: string): MinimaxCliSpec | undefined {
|
|
43
63
|
if (shim.endsWith('.cmd') || shim.endsWith('.bat')) {
|
|
44
64
|
// npm's Windows shim forwards to the package's cli.js. Reading it avoids a
|
|
45
|
-
// cmd.exe layer, which keeps ACP's stdio byte-clean
|
|
65
|
+
// cmd.exe layer, which keeps ACP's stdio byte-clean; the shim's own Node
|
|
66
|
+
// interpreter is kept so the native SQLite ABI still matches.
|
|
46
67
|
try {
|
|
47
68
|
const text = readFileSync(shim, 'utf8')
|
|
48
69
|
const match = /["']([^"']*node_modules[\\/]@minimax-ai[\\/]code[\\/]cli\.js)["']/.exec(text)
|
|
49
|
-
if (match !== null && existsSync(match[1])) return fromJsEntry(match[1])
|
|
70
|
+
if (match !== null && existsSync(match[1])) return fromJsEntry(match[1], cliNodeCommand(dirname(shim)))
|
|
50
71
|
} catch {
|
|
51
72
|
// Fall through to the sibling-package guess below.
|
|
52
73
|
}
|
|
53
74
|
const sibling = join(dirname(shim), 'node_modules', '@minimax-ai', 'code', 'cli.js')
|
|
54
|
-
if (existsSync(sibling)) return fromJsEntry(sibling)
|
|
75
|
+
if (existsSync(sibling)) return fromJsEntry(sibling, cliNodeCommand(dirname(shim)))
|
|
55
76
|
return {
|
|
56
77
|
command: process.env.ComSpec ?? 'cmd.exe',
|
|
57
78
|
args: ['/d', '/c', shim],
|