dsh-science-plugin 0.0.0-stage → 0.14.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/LICENSE +21 -0
- package/README.md +90 -2
- package/agents/_README.md +5 -0
- package/agents/analyst.md +27 -0
- package/agents/figure-expert.md +35 -0
- package/agents/literature-scout.md +32 -0
- package/agents/presentation.md +78 -0
- package/agents/reviewer.md +32 -0
- package/agents/simulator.md +30 -0
- package/agents/topic-designer.md +26 -0
- package/agents/trainer.md +36 -0
- package/agents/writer.md +44 -0
- package/assets/mascots/analyst.svg +33 -0
- package/assets/mascots/designer.svg +33 -0
- package/assets/mascots/figure.svg +35 -0
- package/assets/mascots/idle.svg +9 -0
- package/assets/mascots/lead.svg +33 -0
- package/assets/mascots/presentation.svg +40 -0
- package/assets/mascots/reviewer.svg +31 -0
- package/assets/mascots/scout.svg +31 -0
- package/assets/mascots/simulator.svg +33 -0
- package/assets/mascots/thinking.svg +23 -0
- package/assets/mascots/trainer.svg +32 -0
- package/assets/mascots/working.svg +9 -0
- package/assets/mascots/writer.svg +33 -0
- package/client/client.js +3425 -0
- package/client/client.js.map +7 -0
- package/cordis.patch.yml +10 -0
- package/docs/DEVLOG.md +864 -0
- package/docs/SPEC.md +452 -0
- package/docs/recipes/agent-teams-science.md +46 -0
- package/docs/research/2026-11-12-academic-figure-skill-/350/257/204/344/274/260.md +33 -0
- package/docs/research/2026-11-12-/347/224/237/347/211/251/347/247/221/347/240/224/350/203/275/345/212/233/344/270/216/345/267/245/344/275/234/345/217/260/351/233/206/346/210/220/350/260/203/347/240/224.md +169 -0
- package/docs/research/2026-11-12-/347/247/221/347/240/224/347/273/230/345/233/276/345/274/200/346/272/220/346/226/271/346/241/210/350/260/203/347/240/224.md +52 -0
- package/docs/research/2026-11-13-/345/257/271/350/257/235/351/251/261/345/212/250/347/247/221/347/240/224/345/267/245/344/275/234/345/217/260/344/272/247/345/223/201/347/255/226/347/225/245/350/260/203/347/240/224.md +319 -0
- package/docs/research/2026-11-13-/350/267/257/347/272/277B/346/212/200/346/234/257/345/217/257/350/241/214/346/200/247/344/270/216/344/275/216/347/274/272/351/231/267/350/256/276/350/256/241/350/260/203/347/240/224.md +65 -0
- package/docs/superpowers/specs/2026-11-12-/347/247/221/347/240/224/345/267/245/344/275/234/345/217/260/351/207/215/346/236/204/350/256/276/350/256/241.md +364 -0
- package/docs/superpowers/specs/2026-11-13-/345/257/271/350/257/235/344/274/230/345/205/210/347/247/221/347/240/224/345/215/241/347/211/207/345/267/245/344/275/234/345/217/260/351/207/215/346/236/204/350/256/276/350/256/241.md +607 -0
- package/icon.svg +6 -0
- package/lib/action-cards.js +194 -0
- package/lib/artifact-index.js +131 -0
- package/lib/blueprint.js +1487 -0
- package/lib/dag.js +69 -0
- package/lib/db.js +386 -0
- package/lib/figureqa.js +290 -0
- package/lib/figures.js +732 -0
- package/lib/httpdata-auth.js +91 -0
- package/lib/httpdata.js +863 -0
- package/lib/index.js +330 -0
- package/lib/lit.js +100 -0
- package/lib/paperspine.js +287 -0
- package/lib/project-adapter.js +259 -0
- package/lib/project-catalog.js +227 -0
- package/lib/project-context.js +282 -0
- package/lib/project-domain.js +849 -0
- package/lib/project-remote.js +348 -0
- package/lib/project-store.js +653 -0
- package/lib/rail-team.js +47 -0
- package/lib/resources.js +94 -0
- package/lib/reviewcov.js +238 -0
- package/lib/reviewer.js +638 -0
- package/lib/reviewruns.js +95 -0
- package/lib/roles.js +41 -0
- package/lib/router.js +133 -0
- package/lib/skeleton-context.js +181 -0
- package/lib/skillmenu.js +994 -0
- package/lib/ssh.js +637 -0
- package/lib/status.js +138 -0
- package/lib/store.js +50 -0
- package/lib/team.js +945 -0
- package/lib/vendor/ssh2.bundle.cjs +20124 -0
- package/lib/workspace-key.js +64 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +72 -4
- package/skills/sci-autoresearch/SKILL.md +41 -0
- package/skills/sci-figures/SKILL.md +91 -0
- package/skills/sci-figures/references/journal-requirements.md +22 -0
- package/skills/sci-figures/references/r-figures.md +106 -0
- package/skills/sci-figures/scripts/figure_export.py +45 -0
- package/skills/sci-figures/scripts/style_presets.py +82 -0
- package/skills/sci-hypothesis/SKILL.md +37 -0
- package/skills/sci-polish/SKILL.md +28 -0
- package/skills/sci-remote-jobs/SKILL.md +48 -0
- package/skills/sci-simulation/SKILL.md +70 -0
- package/skills/sci-simulation/references/tool-dossiers/_TEMPLATE.md +25 -0
- package/skills/sci-simulation/references/tool-dossiers/ase.md +42 -0
- package/skills/sci-simulation/references/tool-dossiers/gaussian.md +42 -0
- package/skills/sci-simulation/references/tool-dossiers/gromacs.md +37 -0
- package/skills/sci-simulation/references/tool-dossiers/lammps.md +34 -0
- package/skills/sci-simulation/references/tool-dossiers/quantum-espresso.md +34 -0
- package/skills/sci-simulation/references/universal-tool-onboarding.md +117 -0
- package/skills/sci-slides/SKILL.md +73 -0
- package/skills/sci-slides/scripts/make_deck.py +332 -0
- package/skills/sci-writing/SKILL.md +33 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// dsh-science — web 路由注册公共底座(鉴权 + webServer 懒注册)
|
|
2
|
+
// 与 lib/httpdata.js 的 tryRegister 同款模式抽出共用:webServer 服务可能在本插件挂载
|
|
3
|
+
// 之后才绑定(并发激活),按服务绑定事件重试;浏览器会话认证经 connection.requestRejection。
|
|
4
|
+
|
|
5
|
+
const WEB_SERVER_KEYS = ['webServer', 'httpServer']
|
|
6
|
+
|
|
7
|
+
function requestRejectionOf(ctx, req) {
|
|
8
|
+
try {
|
|
9
|
+
const conn = ctx.get('connection')
|
|
10
|
+
if (conn && typeof conn.requestRejection === 'function') return conn.requestRejection(req)
|
|
11
|
+
} catch {
|
|
12
|
+
/* ignore:回环地址本就仅本机可达 */
|
|
13
|
+
}
|
|
14
|
+
return undefined
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// L3:fail-closed 变体——connection 服务缺失时返回 401(写端点用),读端点保持旧行为。
|
|
18
|
+
function requestRejectionStrictOf(ctx, req) {
|
|
19
|
+
let conn = null
|
|
20
|
+
try {
|
|
21
|
+
conn = ctx.get('connection')
|
|
22
|
+
} catch {
|
|
23
|
+
conn = null
|
|
24
|
+
}
|
|
25
|
+
if (!conn || typeof conn.requestRejection !== 'function') return 401
|
|
26
|
+
const r = conn.requestRejection(req)
|
|
27
|
+
return r === undefined ? undefined : r
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 注册一组插件路由(全部带浏览器会话栅栏)。
|
|
32
|
+
* @param routes [{ path, method?, handler(req, res, url) }]
|
|
33
|
+
*/
|
|
34
|
+
export function registerStateRouteShared(ctx, routes) {
|
|
35
|
+
let registered = false
|
|
36
|
+
const tryRegister = () => {
|
|
37
|
+
if (registered) return
|
|
38
|
+
let server
|
|
39
|
+
try {
|
|
40
|
+
server = ctx.get(WEB_SERVER_KEYS[0]) || ctx.get(WEB_SERVER_KEYS[1])
|
|
41
|
+
} catch {
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
if (!server || typeof server.register !== 'function') return
|
|
45
|
+
for (const route of routes) {
|
|
46
|
+
const method = (route.method || 'GET').toUpperCase()
|
|
47
|
+
const fenceOf = route.failClosed ? requestRejectionStrictOf : requestRejectionOf
|
|
48
|
+
const wrapped = async (req, res) => {
|
|
49
|
+
const rejection = fenceOf(ctx, req)
|
|
50
|
+
if (rejection !== undefined) {
|
|
51
|
+
res.writeHead(rejection, { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store' })
|
|
52
|
+
res.end(JSON.stringify({ error: rejection === 401 ? 'unauthorized' : 'forbidden' }))
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
if (method === 'POST' && (req.method || '').toUpperCase() !== 'POST') {
|
|
56
|
+
res.writeHead(405, { 'content-type': 'application/json; charset=utf-8' })
|
|
57
|
+
res.end(JSON.stringify({ error: 'POST only' }))
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
let url
|
|
61
|
+
try {
|
|
62
|
+
url = new URL(req.url ?? '/', 'http://localhost')
|
|
63
|
+
} catch {
|
|
64
|
+
url = new URL('/', 'http://localhost')
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
await route.handler(req, res, url)
|
|
68
|
+
} catch (err) {
|
|
69
|
+
console.error(`[dsh-science route] ${route.path} handler failed: ${err && err.message}`)
|
|
70
|
+
if (!res.headersSent) {
|
|
71
|
+
res.writeHead(500, { 'content-type': 'application/json; charset=utf-8' })
|
|
72
|
+
res.end(JSON.stringify({ error: 'internal error' }))
|
|
73
|
+
} else {
|
|
74
|
+
try { res.end() } catch { /* ignore */ }
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
ctx.effect(() => server.register({ kind: 'exact', path: route.path, handler: wrapped }), `dsh-science: ${route.path}`)
|
|
79
|
+
}
|
|
80
|
+
registered = true
|
|
81
|
+
}
|
|
82
|
+
tryRegister()
|
|
83
|
+
try {
|
|
84
|
+
ctx.on('internal/service', (name) => {
|
|
85
|
+
if (WEB_SERVER_KEYS.includes(name)) tryRegister()
|
|
86
|
+
})
|
|
87
|
+
} catch {
|
|
88
|
+
/* ignore */
|
|
89
|
+
}
|
|
90
|
+
return () => { registered = false }
|
|
91
|
+
}
|