@huanlin/dsh-plugin-interpreters 0.1.0 → 0.2.0
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.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://dshfind.com/zh/plugins/huanlinoto/dsh-plugin-interpreters"><img src="https://dshfind.com/api/card/huanlinoto/dsh-plugin-interpreters?lang=zh" alt="dsh-plugin-interpreters card"></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# dsh-interpreters
|
|
2
6
|
|
|
7
|
+
[](https://www.npmjs.com/package/@huanlin/dsh-plugin-interpreters)
|
|
8
|
+
|
|
3
9
|
DSH 插件:暴露 `run_python` 和 `run_node` 两个模型可调用工具,通过 stdin 执行代码并返回 stdout/stderr/exit code。在设置页「插件配置」分区提供配置卡片,让用户设置 Python 和 Node.js 解释器的可执行文件路径,工具描述中会告知模型解释器位置。
|
|
4
10
|
|
|
5
11
|
## 架构
|
|
@@ -41,6 +47,10 @@ src/
|
|
|
41
47
|
### 本地安装
|
|
42
48
|
|
|
43
49
|
```sh
|
|
50
|
+
# 从 npm 安装(推荐):
|
|
51
|
+
dsh plugin --profile web add @huanlin/dsh-plugin-interpreters
|
|
52
|
+
|
|
53
|
+
# 本地开发(热更新):
|
|
44
54
|
dsh plugin --profile web add "link:D:/Projects/deepseek-harness/dsh-interpreters"
|
|
45
55
|
```
|
|
46
56
|
|
package/lib/client.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({ id: "@huanlin/dsh-plugin-interpreters", factory: (require) => {
|
|
2
2
|
var module = { exports: {} }; var exports = module.exports;
|
|
3
3
|
"use strict";
|
|
4
|
+
var __create = Object.create;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
5
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
10
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
12
|
+
try {
|
|
13
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
throw mod = 0, e;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
9
18
|
var __export = (target, all) => {
|
|
10
19
|
for (var name in all)
|
|
11
20
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -18,9 +27,86 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
27
|
}
|
|
19
28
|
return to;
|
|
20
29
|
};
|
|
30
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
31
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
32
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
33
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
34
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
35
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
36
|
+
mod
|
|
37
|
+
));
|
|
21
38
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
39
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
23
40
|
|
|
41
|
+
// C:/Users/Administrator/.dsh/source/current/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.3.1/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js
|
|
42
|
+
var require_use_sync_external_store_with_selector_production_min = __commonJS({
|
|
43
|
+
"C:/Users/Administrator/.dsh/source/current/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.3.1/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js"(exports) {
|
|
44
|
+
"use strict";
|
|
45
|
+
var g = require("react");
|
|
46
|
+
function n(a, b) {
|
|
47
|
+
return a === b && (0 !== a || 1 / a === 1 / b) || a !== a && b !== b;
|
|
48
|
+
}
|
|
49
|
+
var p = "function" === typeof Object.is ? Object.is : n;
|
|
50
|
+
var q = g.useSyncExternalStore;
|
|
51
|
+
var r = g.useRef;
|
|
52
|
+
var t = g.useEffect;
|
|
53
|
+
var u = g.useMemo;
|
|
54
|
+
var v = g.useDebugValue;
|
|
55
|
+
exports.useSyncExternalStoreWithSelector = function(a, b, e, l, h) {
|
|
56
|
+
var c = r(null);
|
|
57
|
+
if (null === c.current) {
|
|
58
|
+
var f = { hasValue: false, value: null };
|
|
59
|
+
c.current = f;
|
|
60
|
+
} else f = c.current;
|
|
61
|
+
c = u(function() {
|
|
62
|
+
function a2(a3) {
|
|
63
|
+
if (!c2) {
|
|
64
|
+
c2 = true;
|
|
65
|
+
d2 = a3;
|
|
66
|
+
a3 = l(a3);
|
|
67
|
+
if (void 0 !== h && f.hasValue) {
|
|
68
|
+
var b2 = f.value;
|
|
69
|
+
if (h(b2, a3)) return k = b2;
|
|
70
|
+
}
|
|
71
|
+
return k = a3;
|
|
72
|
+
}
|
|
73
|
+
b2 = k;
|
|
74
|
+
if (p(d2, a3)) return b2;
|
|
75
|
+
var e2 = l(a3);
|
|
76
|
+
if (void 0 !== h && h(b2, e2)) return b2;
|
|
77
|
+
d2 = a3;
|
|
78
|
+
return k = e2;
|
|
79
|
+
}
|
|
80
|
+
var c2 = false, d2, k, m = void 0 === e ? null : e;
|
|
81
|
+
return [function() {
|
|
82
|
+
return a2(b());
|
|
83
|
+
}, null === m ? void 0 : function() {
|
|
84
|
+
return a2(m());
|
|
85
|
+
}];
|
|
86
|
+
}, [b, e, l, h]);
|
|
87
|
+
var d = q(a, c[0], c[1]);
|
|
88
|
+
t(function() {
|
|
89
|
+
f.hasValue = true;
|
|
90
|
+
f.value = d;
|
|
91
|
+
}, [d]);
|
|
92
|
+
v(d);
|
|
93
|
+
return d;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// C:/Users/Administrator/.dsh/source/current/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.3.1/node_modules/use-sync-external-store/with-selector.js
|
|
99
|
+
var require_with_selector = __commonJS({
|
|
100
|
+
"C:/Users/Administrator/.dsh/source/current/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.3.1/node_modules/use-sync-external-store/with-selector.js"(exports, module2) {
|
|
101
|
+
"use strict";
|
|
102
|
+
if (true) {
|
|
103
|
+
module2.exports = require_use_sync_external_store_with_selector_production_min();
|
|
104
|
+
} else {
|
|
105
|
+
module2.exports = null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
24
110
|
// src/client/index.ts
|
|
25
111
|
var index_exports = {};
|
|
26
112
|
__export(index_exports, {
|
|
@@ -28,7 +114,16 @@ __export(index_exports, {
|
|
|
28
114
|
inject: () => inject
|
|
29
115
|
});
|
|
30
116
|
module.exports = __toCommonJS(index_exports);
|
|
31
|
-
|
|
117
|
+
|
|
118
|
+
// src/client/bindSnapshotSelector.ts
|
|
119
|
+
var import_with_selector = __toESM(require_with_selector(), 1);
|
|
120
|
+
function bindSnapshotSelector(w) {
|
|
121
|
+
const subscribe = (fn) => w.subscribe(fn);
|
|
122
|
+
const getSnapshot = () => w.getSnapshot();
|
|
123
|
+
return function useSelector(sel, eq) {
|
|
124
|
+
return (0, import_with_selector.useSyncExternalStoreWithSelector)(subscribe, getSnapshot, void 0, sel, eq);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
32
127
|
|
|
33
128
|
// src/client/InterpretersCard.tsx
|
|
34
129
|
var import_react = require("react");
|
|
@@ -427,7 +522,7 @@ var inject = ["slots", "locale", "connection"];
|
|
|
427
522
|
function apply(ctx) {
|
|
428
523
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dsh-interpreters: dictionaries");
|
|
429
524
|
const controller = new InterpretersCardController();
|
|
430
|
-
const useSnapshot =
|
|
525
|
+
const useSnapshot = bindSnapshotSelector(controller.store);
|
|
431
526
|
ctx.effect(() => {
|
|
432
527
|
let pending = false;
|
|
433
528
|
const refresh = () => {
|
|
@@ -446,12 +541,23 @@ function apply(ctx) {
|
|
|
446
541
|
ctx.slots.inject("settings.plugin.item", function* () {
|
|
447
542
|
yield ctx.slots.register({
|
|
448
543
|
name: "settings.plugin.item",
|
|
449
|
-
|
|
450
|
-
order: 50,
|
|
451
|
-
// bash 0 / agent-loop 10 / web-search 20 / advisor 30 / interpreters 50
|
|
544
|
+
key: NS,
|
|
452
545
|
locale: NS,
|
|
453
546
|
inject: () => ({ controller, useSnapshot })
|
|
454
547
|
}, InterpretersCard);
|
|
455
548
|
});
|
|
456
549
|
}
|
|
550
|
+
/*! Bundled license information:
|
|
551
|
+
|
|
552
|
+
use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js:
|
|
553
|
+
(**
|
|
554
|
+
* @license React
|
|
555
|
+
* use-sync-external-store-with-selector.production.min.js
|
|
556
|
+
*
|
|
557
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
558
|
+
*
|
|
559
|
+
* This source code is licensed under the MIT license found in the
|
|
560
|
+
* LICENSE file in the root directory of this source tree.
|
|
561
|
+
*)
|
|
562
|
+
*/
|
|
457
563
|
return module.exports; } });
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
* @module dsh-interpreters/client/InterpretersCard
|
|
15
15
|
*/
|
|
16
16
|
import { type ReactNode } from 'react';
|
|
17
|
-
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
18
|
-
import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-web-react';
|
|
17
|
+
import type { InjectFace, PropsLocale, PropsRuntime, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots';
|
|
19
18
|
import { InterpretersCardController, type InterpretersCardState } from './store.ts';
|
|
20
19
|
import type { InterpretersKey } from './locales.ts';
|
|
21
20
|
/** Injected dependencies of {@link InterpretersCard} (slot `inject`). */
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HostObservable, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
/**
|
|
3
|
+
* Bind a bare observable source to a typed uSES selector hook.
|
|
4
|
+
* subscribe/getSnapshot are captured once per source into stable closures
|
|
5
|
+
* (also re-binds `this` for method-based sources), so components never
|
|
6
|
+
* resubscribe across renders. Equality defaults to Object.is.
|
|
7
|
+
* @param w - snapshot source (engine store, Session object, store instance).
|
|
8
|
+
* @returns the selector hook.
|
|
9
|
+
*/
|
|
10
|
+
export declare function bindSnapshotSelector<T>(w: HostObservable<T>): SnapshotSelectorHook<T>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* uSES bridge: turns any bare observable snapshot source into a typed
|
|
3
|
+
* selector hook. Inlined from dsh-client-ui-renderer/src/client/bind.ts
|
|
4
|
+
* (shell-only glue; business plugins depend on runtime + ui-slots only).
|
|
5
|
+
*
|
|
6
|
+
* @module dsh-interpreters/client/bindSnapshotSelector
|
|
7
|
+
*/
|
|
8
|
+
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector.js';
|
|
9
|
+
/**
|
|
10
|
+
* Bind a bare observable source to a typed uSES selector hook.
|
|
11
|
+
* subscribe/getSnapshot are captured once per source into stable closures
|
|
12
|
+
* (also re-binds `this` for method-based sources), so components never
|
|
13
|
+
* resubscribe across renders. Equality defaults to Object.is.
|
|
14
|
+
* @param w - snapshot source (engine store, Session object, store instance).
|
|
15
|
+
* @returns the selector hook.
|
|
16
|
+
*/
|
|
17
|
+
export function bindSnapshotSelector(w) {
|
|
18
|
+
const subscribe = (fn) => w.subscribe(fn);
|
|
19
|
+
const getSnapshot = () => w.getSnapshot();
|
|
20
|
+
return function useSelector(sel, eq) {
|
|
21
|
+
return useSyncExternalStoreWithSelector(subscribe, getSnapshot, undefined, sel, eq);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @module @huanlin/dsh-plugin-interpreters/client
|
|
17
17
|
*/
|
|
18
|
-
import { bindSnapshotSelector } from
|
|
18
|
+
import { bindSnapshotSelector } from "./bindSnapshotSelector.js";
|
|
19
19
|
import { InterpretersCard } from "./InterpretersCard.js";
|
|
20
20
|
import { InterpretersCardController, refreshIfLoaded } from "./store.js";
|
|
21
21
|
import { en, NS, zh } from "./locales.js";
|
|
@@ -63,8 +63,7 @@ export function apply(ctx) {
|
|
|
63
63
|
ctx.slots.inject('settings.plugin.item', function* () {
|
|
64
64
|
yield ctx.slots.register({
|
|
65
65
|
name: 'settings.plugin.item',
|
|
66
|
-
|
|
67
|
-
order: 50, // bash 0 / agent-loop 10 / web-search 20 / advisor 30 / interpreters 50
|
|
66
|
+
key: NS,
|
|
68
67
|
locale: NS,
|
|
69
68
|
inject: () => ({ controller, useSnapshot }),
|
|
70
69
|
}, InterpretersCard);
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huanlin/dsh-plugin-interpreters",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"keywords": [
|
|
7
|
+
"keywords": [
|
|
8
|
+
"dsh-plugin"
|
|
9
|
+
],
|
|
8
10
|
"description": "Exposes run_python and run_node tools with configurable interpreter paths; settings card (via /interpreters/api HTTP route) lets users set the executable locations.",
|
|
9
11
|
"type": "module",
|
|
10
12
|
"license": "AGPL-3.0",
|
|
@@ -40,12 +42,6 @@
|
|
|
40
42
|
"platform": "web"
|
|
41
43
|
}
|
|
42
44
|
},
|
|
43
|
-
"scripts": {
|
|
44
|
-
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
45
|
-
"test": "vitest run",
|
|
46
|
-
"test:watch": "vitest",
|
|
47
|
-
"build": "tsc -p tsconfig.build.json && node scripts/build-client.mjs && tsc -p tsconfig.json"
|
|
48
|
-
},
|
|
49
45
|
"peerDependencies": {
|
|
50
46
|
"@deepseek-ai/cordis": "^4.0.1-rc.1",
|
|
51
47
|
"@deepseek-ai/dsh-client-connection": "^0.0.1-rc.1",
|
|
@@ -54,7 +50,6 @@
|
|
|
54
50
|
"@deepseek-ai/dsh-client-ui-settings-plugins": "^0.0.1-rc.1",
|
|
55
51
|
"@deepseek-ai/dsh-client-ui-primitives": "^0.0.1-rc.1",
|
|
56
52
|
"@deepseek-ai/dsh-client-ui-slots": "^0.0.1-rc.1",
|
|
57
|
-
"@deepseek-ai/dsh-client-web-react": "^0.0.1-rc.1",
|
|
58
53
|
"@deepseek-ai/dsh-host-webserver": "^0.0.1-rc.1",
|
|
59
54
|
"@deepseek-ai/dsh-settings": "^0.0.1-rc.1",
|
|
60
55
|
"@deepseek-ai/dsh-tools": "^0.0.1-rc.1",
|
|
@@ -62,19 +57,42 @@
|
|
|
62
57
|
"schemastery": "^3.18.0"
|
|
63
58
|
},
|
|
64
59
|
"peerDependenciesMeta": {
|
|
65
|
-
"@deepseek-ai/cordis": {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"@deepseek-ai/dsh-client-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"@deepseek-ai/dsh-client-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"@deepseek-ai/dsh-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"
|
|
60
|
+
"@deepseek-ai/cordis": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"@deepseek-ai/dsh-client-connection": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"@deepseek-ai/dsh-client-locale": {
|
|
67
|
+
"optional": true
|
|
68
|
+
},
|
|
69
|
+
"@deepseek-ai/dsh-client-runtime": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
72
|
+
"@deepseek-ai/dsh-client-ui-settings-plugins": {
|
|
73
|
+
"optional": true
|
|
74
|
+
},
|
|
75
|
+
"@deepseek-ai/dsh-client-ui-primitives": {
|
|
76
|
+
"optional": true
|
|
77
|
+
},
|
|
78
|
+
"@deepseek-ai/dsh-client-ui-slots": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"@deepseek-ai/dsh-host-webserver": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"@deepseek-ai/dsh-settings": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
87
|
+
"@deepseek-ai/dsh-tools": {
|
|
88
|
+
"optional": true
|
|
89
|
+
},
|
|
90
|
+
"react": {
|
|
91
|
+
"optional": true
|
|
92
|
+
},
|
|
93
|
+
"schemastery": {
|
|
94
|
+
"optional": true
|
|
95
|
+
}
|
|
78
96
|
},
|
|
79
97
|
"devDependencies": {
|
|
80
98
|
"@deepseek-ai/cordis": "^4.0.1-rc.1",
|
|
@@ -84,7 +102,6 @@
|
|
|
84
102
|
"@deepseek-ai/dsh-client-ui-settings-plugins": "^0.0.1-rc.1",
|
|
85
103
|
"@deepseek-ai/dsh-client-ui-primitives": "^0.0.1-rc.1",
|
|
86
104
|
"@deepseek-ai/dsh-client-ui-slots": "^0.0.1-rc.1",
|
|
87
|
-
"@deepseek-ai/dsh-client-web-react": "^0.0.1-rc.1",
|
|
88
105
|
"@deepseek-ai/dsh-host-webserver": "^0.0.1-rc.1",
|
|
89
106
|
"@deepseek-ai/dsh-settings": "^0.0.1-rc.1",
|
|
90
107
|
"@deepseek-ai/dsh-tools": "^0.0.1-rc.1",
|
|
@@ -94,9 +111,16 @@
|
|
|
94
111
|
"lightningcss": "^1.29.2",
|
|
95
112
|
"tsdown": "^0.22.2",
|
|
96
113
|
"typescript": "^5.9.0",
|
|
114
|
+
"use-sync-external-store": "^1.2.0",
|
|
97
115
|
"vitest": "^3.2.0"
|
|
98
116
|
},
|
|
99
117
|
"engines": {
|
|
100
118
|
"node": ">=18.0.0"
|
|
119
|
+
},
|
|
120
|
+
"scripts": {
|
|
121
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
122
|
+
"test": "vitest run",
|
|
123
|
+
"test:watch": "vitest",
|
|
124
|
+
"build": "tsc -p tsconfig.build.json && node scripts/build-client.mjs && tsc -p tsconfig.json"
|
|
101
125
|
}
|
|
102
|
-
}
|
|
126
|
+
}
|