dsh-supercrew 0.1.4 → 0.1.5

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.
Files changed (3) hide show
  1. package/client.js +79 -0
  2. package/package.json +79 -69
  3. package/panel.mjs +9 -2
package/client.js ADDED
@@ -0,0 +1,79 @@
1
+ /**
2
+ * dsh-supercrew 的界面部分:会话头部一枚状态胶囊。
3
+ *
4
+ * 值来自看板的 /api/heartbeat(每 3 秒拉一次):
5
+ * 🟢 值守中 · 344 轮 它盯着,手上没活
6
+ * 🟡 正在干 TMWDxxxxxxxx 手上有一张单
7
+ * 🔴 值守掉线 心跳断了(或看板没起来)
8
+ * 点一下打开看板。
9
+ */
10
+ window.__ModuleLoader__.load({
11
+ id: 'dsh-supercrew',
12
+ factory(require) {
13
+ const React = require('react');
14
+ const h = React.createElement;
15
+
16
+ const PANEL = 'http://127.0.0.1:3090';
17
+ const POLL_MS = 3000;
18
+
19
+ function Capsule() {
20
+ const [hb, setHb] = React.useState(null);
21
+
22
+ React.useEffect(() => {
23
+ let alive = true;
24
+ const pull = async () => {
25
+ try {
26
+ const r = await fetch(`${PANEL}/api/heartbeat`, { cache: 'no-store' });
27
+ const j = await r.json();
28
+ if (alive) setHb(j);
29
+ } catch {
30
+ if (alive) setHb({ alive: false, offline: true });
31
+ }
32
+ };
33
+ pull();
34
+ const timer = setInterval(pull, POLL_MS);
35
+ return () => { alive = false; clearInterval(timer); };
36
+ }, []);
37
+
38
+ const offline = !hb || hb.alive === false;
39
+ const working = !offline && typeof hb.note === 'string' && /正在干|接管待办/.test(hb.note);
40
+ const color = offline ? '#e5484d' : (working ? '#f5a623' : '#2ecc71');
41
+ const text = offline
42
+ ? '值守掉线'
43
+ : (working ? hb.note : `值守中${hb.rounds ? ` · ${hb.rounds} 轮` : ''}`);
44
+
45
+ return h('button', {
46
+ type: 'button',
47
+ title: offline
48
+ ? `连不上看板(${PANEL})—— 点开看看`
49
+ : `团队系统:${hb.note || '值守中'}\n第 ${hb.rounds ?? 0} 轮 · ${hb.ageSec ?? '?'} 秒前扫过 · pid ${hb.pid ?? '?'}\n点开看板`,
50
+ onClick: () => window.open(`${PANEL}/`, '_blank'),
51
+ style: {
52
+ display: 'inline-flex', alignItems: 'center', gap: 6,
53
+ height: 26, padding: '0 10px', borderRadius: 999,
54
+ border: '1px solid rgba(127,127,127,0.28)',
55
+ background: 'rgba(127,127,127,0.10)',
56
+ color: 'inherit', fontSize: 12, lineHeight: 1,
57
+ cursor: 'pointer', whiteSpace: 'nowrap', maxWidth: 220,
58
+ overflow: 'hidden', textOverflow: 'ellipsis',
59
+ },
60
+ }, h('span', {
61
+ style: {
62
+ width: 7, height: 7, borderRadius: '50%',
63
+ background: color, flex: '0 0 auto',
64
+ },
65
+ }), text);
66
+ }
67
+
68
+ return {
69
+ inject: ['slots'],
70
+ apply(ctx) {
71
+ ctx.slots.inject('conversation.session.header.utilities', () => ctx.slots.register({
72
+ name: 'conversation.session.header.utilities',
73
+ id: 'supercrew-status',
74
+ order: 15,
75
+ }, Capsule));
76
+ },
77
+ };
78
+ },
79
+ });
package/package.json CHANGED
@@ -1,69 +1,79 @@
1
- {
2
- "name": "dsh-supercrew",
3
- "version": "0.1.4",
4
- "private": false,
5
- "type": "module",
6
- "description": "给 DeepSeek Harness 装一个团队:收需求 → 门卫判断 → 开工单 → 派独立 worker 干活 → 结果回报。模型可配(默认用你当前在用的,免费池当备选),不依赖 tmux。",
7
- "keywords": [
8
- "dsh",
9
- "dsh-plugin",
10
- "deepseek-harness",
11
- "agent",
12
- "orchestration",
13
- "multi-agent",
14
- "teams",
15
- "superagent",
16
- "task-queue"
17
- ],
18
- "license": "MIT",
19
- "author": "dafeiyu",
20
- "engines": {
21
- "node": ">=22.19.0",
22
- "dsh": ">=0.2.2-rc.1"
23
- },
24
- "main": "lib/index.js",
25
- "bin": {
26
- "supercrew": "./bin/supercrew.mjs"
27
- },
28
- "dsh": {
29
- "bundle": {
30
- "patch": "./cordis.patch.yml"
31
- }
32
- },
33
- "files": [
34
- "lib/",
35
- "bin/",
36
- "skills/",
37
- "panel.mjs",
38
- "crew.mjs",
39
- "crew-watch.mjs",
40
- "worker-models.yml",
41
- "cordis.patch.yml",
42
- "crew_guard.ps1",
43
- "README.md",
44
- "INSTALL.md",
45
- "DESIGN.md",
46
- "LICENSE",
47
- "selftest.mjs",
48
- "worker-brief.md"
49
- ],
50
- "publishConfig": {
51
- "access": "public"
52
- },
53
- "scripts": {
54
- "panel": "node panel.mjs",
55
- "watch": "node crew-watch.mjs loop",
56
- "selftest": "node selftest.mjs",
57
- "check": "node --check crew.mjs && node --check crew-watch.mjs && node --check panel.mjs && node --check lib/index.js && node --check lib/router.mjs && node --check bin/supercrew.mjs",
58
- "selftest:quick": "node selftest.mjs --quick",
59
- "work": "node crew.mjs work"
60
- },
61
- "repository": {
62
- "type": "git",
63
- "url": "https://github.com/wesqaz111/dsh-supercrew.git"
64
- },
65
- "homepage": "https://github.com/wesqaz111/dsh-supercrew#readme",
66
- "bugs": {
67
- "url": "https://github.com/wesqaz111/dsh-supercrew/issues"
68
- }
69
- }
1
+ {
2
+ "name": "dsh-supercrew",
3
+ "version": "0.1.5",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "给 DeepSeek Harness 装一个团队:收需求 → 门卫判断 → 开工单 → 派独立 worker 干活 → 结果回报。模型可配(默认用你当前在用的,免费池当备选),不依赖 tmux。",
7
+ "keywords": [
8
+ "dsh",
9
+ "dsh-plugin",
10
+ "deepseek-harness",
11
+ "agent",
12
+ "orchestration",
13
+ "multi-agent",
14
+ "teams",
15
+ "superagent",
16
+ "task-queue"
17
+ ],
18
+ "license": "MIT",
19
+ "author": "dafeiyu",
20
+ "engines": {
21
+ "node": ">=22.19.0",
22
+ "dsh": ">=0.2.2-rc.1"
23
+ },
24
+ "main": "lib/index.js",
25
+ "exports": {
26
+ ".": "./lib/index.js",
27
+ "./client": "./client.js"
28
+ },
29
+ "bin": {
30
+ "supercrew": "./bin/supercrew.mjs"
31
+ },
32
+ "dsh": {
33
+ "bundle": {
34
+ "patch": "./cordis.patch.yml"
35
+ },
36
+ "client": {
37
+ "platform": "web",
38
+ "immediately": true,
39
+ "inject": ["@deepseek-ai/dsh-client-ui-conversation"]
40
+ }
41
+ },
42
+ "files": [
43
+ "lib/",
44
+ "bin/",
45
+ "skills/",
46
+ "panel.mjs",
47
+ "crew.mjs",
48
+ "crew-watch.mjs",
49
+ "client.js",
50
+ "worker-models.yml",
51
+ "cordis.patch.yml",
52
+ "crew_guard.ps1",
53
+ "README.md",
54
+ "INSTALL.md",
55
+ "DESIGN.md",
56
+ "LICENSE",
57
+ "selftest.mjs",
58
+ "worker-brief.md"
59
+ ],
60
+ "publishConfig": {
61
+ "access": "public"
62
+ },
63
+ "scripts": {
64
+ "panel": "node panel.mjs",
65
+ "watch": "node crew-watch.mjs loop",
66
+ "selftest": "node selftest.mjs",
67
+ "check": "node --check crew.mjs && node --check crew-watch.mjs && node --check panel.mjs && node --check client.js && node --check lib/index.js && node --check lib/router.mjs && node --check bin/supercrew.mjs",
68
+ "selftest:quick": "node selftest.mjs --quick",
69
+ "work": "node crew.mjs work"
70
+ },
71
+ "repository": {
72
+ "type": "git",
73
+ "url": "https://github.com/wesqaz111/dsh-supercrew.git"
74
+ },
75
+ "homepage": "https://github.com/wesqaz111/dsh-supercrew#readme",
76
+ "bugs": {
77
+ "url": "https://github.com/wesqaz111/dsh-supercrew/issues"
78
+ }
79
+ }
package/panel.mjs CHANGED
@@ -355,12 +355,19 @@ if (_sp.get('open')) openDrawer(_sp.get('open'));
355
355
  const server = http.createServer(async (req, res) => {
356
356
  const url = new URL(req.url, 'http://x');
357
357
  const json = (o, code = 200) => {
358
- res.writeHead(code, { 'content-type': 'application/json; charset=utf-8' });
358
+ res.writeHead(code, {
359
+ 'content-type': 'application/json; charset=utf-8',
360
+ // DSH 页面跑在别的端口上,靠这行才读得到心跳(状态胶囊用)
361
+ 'access-control-allow-origin': '*',
362
+ });
359
363
  res.end(JSON.stringify(o));
360
364
  };
361
365
  try {
362
366
  if (req.method === 'GET' && (url.pathname === '/' || url.pathname === '/index.html')) {
363
- res.writeHead(200, { 'content-type': 'text/html; charset=utf-8' });
367
+ res.writeHead(200, {
368
+ 'content-type': 'text/html; charset=utf-8',
369
+ 'access-control-allow-origin': '*',
370
+ });
364
371
  return res.end(HTML);
365
372
  }
366
373