@philomelcc/dsh-workbench 0.0.0-stage → 0.1.1
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 +25 -2
- package/client.js +1284 -0
- package/cordis.patch.yml +3 -0
- package/icon.svg +6 -0
- package/index.js +41 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +39 -4
package/cordis.patch.yml
ADDED
package/icon.svg
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
2
|
+
<rect x="10" y="10" width="20" height="20" rx="5" fill="none" stroke="#8a94a3" stroke-width="3.5"/>
|
|
3
|
+
<rect x="34" y="10" width="20" height="20" rx="5" fill="none" stroke="#8a94a3" stroke-width="3.5"/>
|
|
4
|
+
<rect x="10" y="34" width="20" height="20" rx="5" fill="none" stroke="#8a94a3" stroke-width="3.5"/>
|
|
5
|
+
<rect x="34" y="34" width="20" height="20" rx="5" fill="none" stroke="#8a94a3" stroke-width="3.5"/>
|
|
6
|
+
</svg>
|
package/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host half of the workbench shell.
|
|
3
|
+
*
|
|
4
|
+
* The workbench's value lives in the Client half (module API + overview page).
|
|
5
|
+
* The only Host duty is the one-click restart endpoint, which stops the running
|
|
6
|
+
* web host in a detached process and lets the scheduled task relaunch it, so the
|
|
7
|
+
* current page simply reconnects.
|
|
8
|
+
*/
|
|
9
|
+
import { execSync } from 'node:child_process';
|
|
10
|
+
|
|
11
|
+
export const inject = ['webServer'];
|
|
12
|
+
|
|
13
|
+
export function apply(ctx) {
|
|
14
|
+
ctx.effect(() => ctx.webServer.register({
|
|
15
|
+
kind: 'exact',
|
|
16
|
+
path: '/wb/workbench/restart',
|
|
17
|
+
async handler(req, res) {
|
|
18
|
+
const remote = req.socket && req.socket.remoteAddress ? req.socket.remoteAddress : '';
|
|
19
|
+
const local = remote === '127.0.0.1' || remote === '::1' || remote === '::ffff:127.0.0.1';
|
|
20
|
+
if (!local) {
|
|
21
|
+
res.writeHead(403, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
22
|
+
res.end('restart is local-only\n');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// 只接受 POST:GET 不应该触发重启。
|
|
26
|
+
if (req.method !== 'POST') {
|
|
27
|
+
res.writeHead(405, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
28
|
+
res.end('method not allowed\n');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// 先看 3080 是否在跑,再决定要不要让 ensure 脚本拉起。
|
|
32
|
+
// 响应先到达页面,然后本进程退出,由每 5 分钟一次的 ensure 任务重新拉起。
|
|
33
|
+
res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8' });
|
|
34
|
+
res.end(JSON.stringify({ ok: true, restarting: true, etaSeconds: 300 }));
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
try { execSync('schtasks /run /tn philomel-dsh-web', { windowsHide: true, stdio: 'ignore' }); } catch (_e) {}
|
|
37
|
+
process.exit(0);
|
|
38
|
+
}, 300);
|
|
39
|
+
},
|
|
40
|
+
}), 'workbench: restart route');
|
|
41
|
+
}
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@philomelcc/dsh-workbench",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Workbench shell for DeepSeek Harness: a view/page module API, shared UI primitives and a top-bar switcher.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "philomelcc",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/philomelcc/dsh-workbench.git",
|
|
11
|
+
"directory": "packages/workbench"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/philomelcc/dsh-workbench#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/philomelcc/dsh-workbench/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": ["dsh", "deepseek-harness", "workbench", "plugin", "web-ui"],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": "./index.js",
|
|
20
|
+
"./client": "./client.js",
|
|
21
|
+
"./locale/*.json": "./locale/*.json",
|
|
22
|
+
"./icon": "./icon.svg"
|
|
23
|
+
},
|
|
24
|
+
"files": ["index.js", "client.js", "cordis.patch.yml", "locale/*.json", "icon.svg"],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public",
|
|
27
|
+
"registry": "https://registry.npmjs.org/"
|
|
28
|
+
},
|
|
29
|
+
"dsh": {
|
|
30
|
+
"bundle": { "patch": "./cordis.patch.yml" },
|
|
31
|
+
"client": {
|
|
32
|
+
"platform": "web",
|
|
33
|
+
"inject": [
|
|
34
|
+
"@deepseek-ai/dsh-client-ui-layout",
|
|
35
|
+
"@deepseek-ai/dsh-client-ui-sidebar",
|
|
36
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
37
|
+
"@deepseek-ai/dsh-client-ui-chat"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|