dsh-science-plugin 0.14.1 → 0.14.3
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 +26 -10
- package/client/client.js +153 -176
- package/client/client.js.map +2 -2
- package/cordis.patch.yml +6 -5
- package/lib/action-cards.js +7 -4
- package/lib/httpdata-auth.js +12 -21
- package/lib/httpdata.js +39 -44
- package/lib/index.js +1 -1
- package/lib/project-experts.js +94 -0
- package/lib/router.js +1 -1
- package/lib/skillmenu.js +85 -51
- package/lib/ssh.js +66 -20
- package/lib/team.js +19 -11
- package/package.json +7 -7
- package/skills/sci-hypothesis/SKILL.md +1 -1
- package/docs/DEVLOG.md +0 -864
- package/docs/SPEC.md +0 -452
- package/docs/research/2026-11-12-academic-figure-skill-/350/257/204/344/274/260.md +0 -33
- 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 +0 -52
- 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 +0 -319
- 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 +0 -65
- 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 +0 -364
- 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 +0 -607
package/lib/skillmenu.js
CHANGED
|
@@ -19,6 +19,8 @@ import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statS
|
|
|
19
19
|
import { execFile } from 'node:child_process'
|
|
20
20
|
import { join, resolve, sep, basename } from 'node:path'
|
|
21
21
|
import { dataDirOf, PKG_ROOT_OF } from './store.js'
|
|
22
|
+
import { expertDirectory, expertScope, expertConfig, globalExpertSkills } from './project-experts.js'
|
|
23
|
+
import { sessionIdOf } from './project-adapter.js'
|
|
22
24
|
import { ROLES } from './roles.js'
|
|
23
25
|
|
|
24
26
|
function log(msg) {
|
|
@@ -178,12 +180,12 @@ export const CATALOG = {
|
|
|
178
180
|
},
|
|
179
181
|
],
|
|
180
182
|
}// ---- 存储 ------------------------------------------------------------------
|
|
181
|
-
const roleSkillsRoot =
|
|
182
|
-
const stateFile =
|
|
183
|
+
const roleSkillsRoot = projectId => join(projectId ? expertDirectory(projectId) : dataDirOf(), 'role-skills')
|
|
184
|
+
const stateFile = projectId => join(projectId ? expertDirectory(projectId) : dataDirOf(), 'role-skills.json')
|
|
183
185
|
|
|
184
|
-
function loadState() {
|
|
186
|
+
function loadState(projectId) {
|
|
185
187
|
try {
|
|
186
|
-
const parsed = JSON.parse(readFileSync(stateFile(), 'utf8'))
|
|
188
|
+
const parsed = JSON.parse(readFileSync(stateFile(projectId), 'utf8'))
|
|
187
189
|
if (parsed && typeof parsed === 'object' && parsed.roles && typeof parsed.roles === 'object') {
|
|
188
190
|
// 归一化:roles 必须是对象;条目必须是对象(数组/字符串/ null 一律丢弃,防止调用方 TypeError)
|
|
189
191
|
if (Array.isArray(parsed.roles)) parsed.roles = {}
|
|
@@ -198,17 +200,17 @@ function loadState() {
|
|
|
198
200
|
return { version: VERSION, updatedAt: 0, roles: {} }
|
|
199
201
|
}
|
|
200
202
|
|
|
201
|
-
function saveState(state) {
|
|
203
|
+
function saveState(state, projectId) {
|
|
202
204
|
state.version = VERSION
|
|
203
205
|
state.updatedAt = Date.now()
|
|
204
206
|
const text = JSON.stringify(state, null, 2)
|
|
205
|
-
const tmp = `${stateFile()}.tmp`
|
|
207
|
+
const tmp = `${stateFile(projectId)}.tmp`
|
|
206
208
|
try {
|
|
207
209
|
writeFileSync(tmp, text, 'utf8')
|
|
208
|
-
renameSync(tmp, stateFile())
|
|
210
|
+
renameSync(tmp, stateFile(projectId))
|
|
209
211
|
} catch (err) {
|
|
210
212
|
log(`atomic persist fallback: ${err && err.message}`)
|
|
211
|
-
writeFileSync(stateFile(), text, 'utf8')
|
|
213
|
+
writeFileSync(stateFile(projectId), text, 'utf8')
|
|
212
214
|
}
|
|
213
215
|
return text
|
|
214
216
|
}
|
|
@@ -382,8 +384,8 @@ function rmRf(dir) {
|
|
|
382
384
|
}
|
|
383
385
|
|
|
384
386
|
// .staging 只作为临时克隆区:清空后把父目录也删掉,避免每次安装留一个空目录
|
|
385
|
-
function cleanupStagingRoot() {
|
|
386
|
-
const root = join(roleSkillsRoot(), '.staging')
|
|
387
|
+
function cleanupStagingRoot(projectId) {
|
|
388
|
+
const root = join(roleSkillsRoot(projectId), '.staging')
|
|
387
389
|
try {
|
|
388
390
|
if (existsSync(root) && readdirSync(root).length === 0) rmSync(root, { recursive: true, force: true })
|
|
389
391
|
} catch (err) {
|
|
@@ -439,7 +441,7 @@ function parseSkillMd(absPath, relPath) {
|
|
|
439
441
|
return { name: name || relPath, description: description || '(SKILL.md 无 description)', relPath }
|
|
440
442
|
}
|
|
441
443
|
|
|
442
|
-
function renderIndexMd(role, entries) {
|
|
444
|
+
function renderIndexMd(role, entries, projectId) {
|
|
443
445
|
const lines = [
|
|
444
446
|
`# ${role} 角色扩展技能库索引`,
|
|
445
447
|
'',
|
|
@@ -453,7 +455,7 @@ function renderIndexMd(role, entries) {
|
|
|
453
455
|
}
|
|
454
456
|
for (const entry of entries) {
|
|
455
457
|
const entryName = entry.name || '(未命名)'
|
|
456
|
-
const entryDir = typeof entry.dir === 'string' && entry.dir ? entry.dir : join(roleSkillsRoot(), role, entryName)
|
|
458
|
+
const entryDir = typeof entry.dir === 'string' && entry.dir ? entry.dir : join(roleSkillsRoot(projectId), role, entryName)
|
|
457
459
|
lines.push(`## ${entryName}`, '')
|
|
458
460
|
if (entry.warn) {
|
|
459
461
|
lines.push(`- ⚠ 状态:未发现 SKILL.md——该仓库不是标准 skill 结构,谨慎参考其内容。`)
|
|
@@ -470,17 +472,17 @@ function renderIndexMd(role, entries) {
|
|
|
470
472
|
return lines.join('\n')
|
|
471
473
|
}
|
|
472
474
|
|
|
473
|
-
function writeIndexForRole(role, state) {
|
|
475
|
+
function writeIndexForRole(role, state, projectId) {
|
|
474
476
|
const entries = Array.isArray(state.roles[role]) ? state.roles[role] : []
|
|
475
|
-
const dir = join(roleSkillsRoot(), role)
|
|
477
|
+
const dir = join(roleSkillsRoot(projectId), role)
|
|
476
478
|
mkdirSync(dir, { recursive: true })
|
|
477
|
-
writeFileSync(join(dir, 'INDEX.md'), renderIndexMd(role, entries), 'utf8')
|
|
479
|
+
writeFileSync(join(dir, 'INDEX.md'), renderIndexMd(role, entries, projectId), 'utf8')
|
|
478
480
|
}
|
|
479
481
|
|
|
480
482
|
// 安装入口(互斥队列内执行)。catalogId 与 repoUrl 二选一。
|
|
481
483
|
// cloneImpl 仅用于测试注入(签名同 gitClone:(url, dest) => Promise<{cloneMs}>)。
|
|
482
|
-
export async function installSkill({ role, catalogId, repoUrl, name, exec, cloneImpl }) {
|
|
483
|
-
if (!ROLES
|
|
484
|
+
export async function installSkill({ role, catalogId, repoUrl, name, exec, cloneImpl, projectId }) {
|
|
485
|
+
if (!Object.hasOwn(ROLES, role)) {
|
|
484
486
|
return { ok: false, error: `未知角色 ${role}(可用:${Object.keys(ROLES).join(' | ')})` }
|
|
485
487
|
}
|
|
486
488
|
if (catalogId && repoUrl) {
|
|
@@ -488,7 +490,7 @@ export async function installSkill({ role, catalogId, repoUrl, name, exec, clone
|
|
|
488
490
|
}
|
|
489
491
|
let wakeCtx = null
|
|
490
492
|
const out = await enqueue(async () => {
|
|
491
|
-
const state = loadState()
|
|
493
|
+
const state = loadState(projectId)
|
|
492
494
|
const roleEntries = Array.isArray(state.roles[role]) ? state.roles[role] : []
|
|
493
495
|
let repo = null
|
|
494
496
|
let subdir = ''
|
|
@@ -515,7 +517,7 @@ export async function installSkill({ role, catalogId, repoUrl, name, exec, clone
|
|
|
515
517
|
gitRef = item.gitRef
|
|
516
518
|
const exists = roleEntries.find((x) => x.name === installName)
|
|
517
519
|
if (exists) {
|
|
518
|
-
return { ok: false, error: `已安装:${installName}(${join(roleSkillsRoot(), role, installName)})。无需重复安装。` }
|
|
520
|
+
return { ok: false, error: `已安装:${installName}(${join(roleSkillsRoot(projectId), role, installName)})。无需重复安装。` }
|
|
519
521
|
}
|
|
520
522
|
} else if (repoUrl) {
|
|
521
523
|
const v = validateRepoUrl(repoUrl)
|
|
@@ -535,12 +537,12 @@ export async function installSkill({ role, catalogId, repoUrl, name, exec, clone
|
|
|
535
537
|
} else {
|
|
536
538
|
return { ok: false, error: '需要 repo_id(精选目录 id)或 repo_url(https github/gitlab 仓库)之一' }
|
|
537
539
|
}
|
|
538
|
-
const installDir = join(roleSkillsRoot(), role, installName)
|
|
540
|
+
const installDir = join(roleSkillsRoot(projectId), role, installName)
|
|
539
541
|
if (existsSync(installDir)) {
|
|
540
542
|
return { ok: false, error: `已安装:${installName}(${installDir})。无需重复安装。` }
|
|
541
543
|
}
|
|
542
544
|
// 克隆到同分区 staging(保证 rename 原子性),再拷贝 subdir 内容到安装目录
|
|
543
|
-
const staging = join(roleSkillsRoot(), '.staging', `${installName}-${Date.now().toString(36)}`)
|
|
545
|
+
const staging = join(roleSkillsRoot(projectId), '.staging', `${installName}-${Date.now().toString(36)}`)
|
|
544
546
|
mkdirSync(staging, { recursive: true })
|
|
545
547
|
let cloneMs = null
|
|
546
548
|
let clonedCommit = null
|
|
@@ -593,7 +595,7 @@ export async function installSkill({ role, catalogId, repoUrl, name, exec, clone
|
|
|
593
595
|
return { ok: false, error: String(err && err.message) }
|
|
594
596
|
} finally {
|
|
595
597
|
rmRf(staging)
|
|
596
|
-
cleanupStagingRoot()
|
|
598
|
+
cleanupStagingRoot(projectId)
|
|
597
599
|
}
|
|
598
600
|
// 结构发现:SKILL.md 扫描(子目录聚合仓库可发现多个技能)
|
|
599
601
|
const skills = discoverSkills(installDir, 3)
|
|
@@ -612,13 +614,13 @@ export async function installSkill({ role, catalogId, repoUrl, name, exec, clone
|
|
|
612
614
|
skills: skills.length > 0 ? skills : [{ name: installName, description: '(未发现 SKILL.md——非标准 skill 结构,INDEX 中仅登记路径)', relPath: '.' }],
|
|
613
615
|
}
|
|
614
616
|
state.roles[role] = [...roleEntries.filter((x) => x.name !== installName), entry]
|
|
615
|
-
const stateText = saveState(state)
|
|
617
|
+
const stateText = saveState(state, projectId)
|
|
616
618
|
try {
|
|
617
|
-
writeIndexForRole(role, state)
|
|
619
|
+
writeIndexForRole(role, state, projectId)
|
|
618
620
|
} catch (err) {
|
|
619
621
|
log(`INDEX.md write failed: ${err && err.message}`)
|
|
620
622
|
}
|
|
621
|
-
mirrorState(exec, stateText)
|
|
623
|
+
if (!projectId) mirrorState(exec, stateText)
|
|
622
624
|
log(`skill installed: ${role}/${installName} (${repo}${subdir ? ` @ ${subdir}` : ''}, ${entry.skills.length} skill(s)${entry.warn ? ', WARN no SKILL.md' : ''})`)
|
|
623
625
|
const out = {
|
|
624
626
|
ok: true,
|
|
@@ -626,7 +628,7 @@ export async function installSkill({ role, catalogId, repoUrl, name, exec, clone
|
|
|
626
628
|
name: installName,
|
|
627
629
|
dir: installDir,
|
|
628
630
|
cloneMs,
|
|
629
|
-
indexMd: join(roleSkillsRoot(), role, 'INDEX.md'),
|
|
631
|
+
indexMd: join(roleSkillsRoot(projectId), role, 'INDEX.md'),
|
|
630
632
|
skills: entry.skills.filter((s) => s && typeof s === 'object').map((s) => ({ name: s.name, description: s.description, path: s.relPath === '.' ? installDir : join(installDir, s.relPath) })),
|
|
631
633
|
warn: entry.warn,
|
|
632
634
|
note: entry.warn
|
|
@@ -658,32 +660,32 @@ export async function installSkill({ role, catalogId, repoUrl, name, exec, clone
|
|
|
658
660
|
}
|
|
659
661
|
|
|
660
662
|
// 删除入口(互斥队列内执行)
|
|
661
|
-
export async function removeSkill({ role, name, exec }) {
|
|
662
|
-
if (!ROLES
|
|
663
|
+
export async function removeSkill({ role, name, exec, projectId }) {
|
|
664
|
+
if (!Object.hasOwn(ROLES, role)) {
|
|
663
665
|
return { ok: false, error: `未知角色 ${role}` }
|
|
664
666
|
}
|
|
665
667
|
const n = sanitizeName(name)
|
|
666
668
|
if (n.error) return { ok: false, error: `name 非法:${n.error}` }
|
|
667
669
|
return enqueue(async () => {
|
|
668
|
-
const state = loadState()
|
|
670
|
+
const state = loadState(projectId)
|
|
669
671
|
const roleEntries = Array.isArray(state.roles[role]) ? state.roles[role] : []
|
|
670
672
|
const entry = roleEntries.find((x) => x.name === n.name)
|
|
671
673
|
if (!entry) {
|
|
672
674
|
const names = roleEntries.map((x) => x.name).join(' | ') || '(无)'
|
|
673
675
|
return { ok: false, error: `未安装:${n.name}(${role} 当前已安装:${names})` }
|
|
674
676
|
}
|
|
675
|
-
rmRf(join(roleSkillsRoot(), role, n.name))
|
|
677
|
+
rmRf(join(roleSkillsRoot(projectId), role, n.name))
|
|
676
678
|
state.roles[role] = roleEntries.filter((x) => x.name !== n.name)
|
|
677
679
|
if (state.roles[role].length === 0) delete state.roles[role]
|
|
678
|
-
const stateText = saveState(state)
|
|
680
|
+
const stateText = saveState(state, projectId)
|
|
679
681
|
try {
|
|
680
|
-
writeIndexForRole(role, state)
|
|
682
|
+
writeIndexForRole(role, state, projectId)
|
|
681
683
|
} catch (err) {
|
|
682
684
|
log(`INDEX.md rewrite after remove failed: ${err && err.message}`)
|
|
683
685
|
}
|
|
684
|
-
mirrorState(exec, stateText)
|
|
686
|
+
if (!projectId) mirrorState(exec, stateText)
|
|
685
687
|
log(`skill removed: ${role}/${n.name}`)
|
|
686
|
-
return { ok: true, role, name: n.name, indexMd: join(roleSkillsRoot(), role, 'INDEX.md') }
|
|
688
|
+
return { ok: true, role, name: n.name, indexMd: join(roleSkillsRoot(projectId), role, 'INDEX.md') }
|
|
687
689
|
})
|
|
688
690
|
}
|
|
689
691
|
|
|
@@ -754,8 +756,8 @@ const OPTIONAL_INTEGRATIONS = Object.freeze([
|
|
|
754
756
|
])
|
|
755
757
|
|
|
756
758
|
// 供 httpdata /state 快照使用(客户端技能库面板数据)
|
|
757
|
-
export function skillMenuSnapshot() {
|
|
758
|
-
const state = loadState()
|
|
759
|
+
export function skillMenuSnapshot(projectId) {
|
|
760
|
+
const state = loadState(projectId)
|
|
759
761
|
const catalog = Object.fromEntries(
|
|
760
762
|
Object.entries(CATALOG).map(([role, items]) => [
|
|
761
763
|
role,
|
|
@@ -798,13 +800,39 @@ export function skillMenuSnapshot() {
|
|
|
798
800
|
|
|
799
801
|
// spawnMember 集成用:成员提示词的「扩展技能库」段(该角色已安装技能索引)。
|
|
800
802
|
// 无已安装技能时返回 ''(提示词保持精简)。隔离关键:只有对应角色拿到该目录索引。
|
|
801
|
-
export function
|
|
802
|
-
|
|
803
|
+
export function legacyRoleSkills(role) {
|
|
804
|
+
return (loadState().roles[role] || []).filter(e => typeof e.name === 'string' && typeof e.dir === 'string')
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
export async function projectExpertInstructions(ctx, projectId, role) {
|
|
808
|
+
if (!projectId || !Object.hasOwn(ROLES, role)) return ''
|
|
809
|
+
const config = expertConfig(projectId)
|
|
810
|
+
if (!config.roles.includes(role)) return ''
|
|
811
|
+
const links = config.links[role] || []
|
|
812
|
+
const lines = []
|
|
813
|
+
let global = []
|
|
814
|
+
if (links.some(l => l.kind === 'global')) {
|
|
815
|
+
try { global = await globalExpertSkills(ctx) } catch (error) { log('global skill lookup failed: ' + error.message) }
|
|
816
|
+
}
|
|
817
|
+
for (const link of links) {
|
|
818
|
+
if (link.kind === 'global') {
|
|
819
|
+
const match = global.find(s => s.name === link.value && s.provider === link.provider && s.source === link.source)
|
|
820
|
+
if (match) lines.push(match.path ? '全局 Skill ' + match.name + ':按需读取 ' + match.path : '宿主 Skill ' + match.name + ':仅在来源与 ' + match.provider + ' 一致时调用。')
|
|
821
|
+
} else if (link.kind === 'legacy') {
|
|
822
|
+
const item = legacyRoleSkills(role).find(e => e.name === link.value)
|
|
823
|
+
if (item) lines.push('已关联的旧版技能:' + item.dir)
|
|
824
|
+
} else if (link.kind === 'plugin') lines.push('项目关联插件:' + link.value + '。可用工具以宿主当前启用的插件为准。')
|
|
825
|
+
}
|
|
826
|
+
return (lines.length ? '\n\n本项目为该专家选择的扩展:\n' + lines.join('\n') : '') + roleSkillSectionText(role, projectId)
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
export function roleSkillSectionText(role, projectId) {
|
|
830
|
+
const state = loadState(projectId)
|
|
803
831
|
const entries = Array.isArray(state.roles[role]) ? state.roles[role] : []
|
|
804
832
|
const lines = [
|
|
805
833
|
'## 扩展技能库(dsh-science 角色技能,仅你可用)',
|
|
806
|
-
`用户为本角色安装了以下开源技能(位于 ${roleSkillsRoot()}/${role}/,不在 DSH 全局技能注册表——只属于本插件本角色):`,
|
|
807
|
-
`- 技能索引(含每个技能的一句话与 SKILL.md 绝对路径):${join(roleSkillsRoot(), role, 'INDEX.md')}`,
|
|
834
|
+
`用户为本角色安装了以下开源技能(位于 ${roleSkillsRoot(projectId)}/${role}/,不在 DSH 全局技能注册表——只属于本插件本角色):`,
|
|
835
|
+
`- 技能索引(含每个技能的一句话与 SKILL.md 绝对路径):${join(roleSkillsRoot(projectId), role, 'INDEX.md')}`,
|
|
808
836
|
'- 使用方式:需要时先读索引,再按路径读取对应 SKILL.md 与其引用的资源文件;技能内容与你的角色铁律冲突时,以角色铁律为准。',
|
|
809
837
|
'- 新技能通知:若队长消息告知某路径新增了技能(含 SKILL.md 路径),直接读取该 SKILL.md 后即可使用,无需等待重启。',
|
|
810
838
|
]
|
|
@@ -842,6 +870,7 @@ function toolRender() {
|
|
|
842
870
|
}
|
|
843
871
|
|
|
844
872
|
export function registerSkillMenuTools(ctx, opts = {}) {
|
|
873
|
+
const projectOf = (exec, write = false) => expertScope(ctx, opts.store, sessionIdOf(exec), write).projectId
|
|
845
874
|
const mirror = opts.mirror
|
|
846
875
|
// M2(M2 安全审查):安装=引入外部指令内容进成员提示词(提示注入供应链)——
|
|
847
876
|
// 每次安装先经宿主审批卡向用户展示来源;删除不拦截(反向操作)。
|
|
@@ -877,12 +906,13 @@ export function registerSkillMenuTools(ctx, opts = {}) {
|
|
|
877
906
|
role: { type: 'string', description: `角色 id(必填):${Object.keys(ROLES).join(' | ')}` },
|
|
878
907
|
},
|
|
879
908
|
output: toolRender(),
|
|
880
|
-
async execute(args) {
|
|
909
|
+
async execute(args, exec) {
|
|
910
|
+
const projectId = projectOf(exec)
|
|
881
911
|
const role = String(args.role || '')
|
|
882
|
-
if (!ROLES
|
|
912
|
+
if (!Object.hasOwn(ROLES, role)) {
|
|
883
913
|
return { ok: false, error: `未知角色 ${role}(可用:${Object.keys(ROLES).join(' | ')})` }
|
|
884
914
|
}
|
|
885
|
-
const state = loadState()
|
|
915
|
+
const state = loadState(projectId)
|
|
886
916
|
const installedEntries = Array.isArray(state.roles[role]) ? state.roles[role] : []
|
|
887
917
|
const items = (CATALOG[role] || []).map((x) => {
|
|
888
918
|
const inst = installedEntries.find((e) => e.catalogId === x.id || e.name === x.id)
|
|
@@ -907,7 +937,7 @@ export function registerSkillMenuTools(ctx, opts = {}) {
|
|
|
907
937
|
catalog: items,
|
|
908
938
|
customInstalled: custom,
|
|
909
939
|
installedCount: installedEntries.length,
|
|
910
|
-
indexMd: join(roleSkillsRoot(), role, 'INDEX.md'),
|
|
940
|
+
indexMd: join(roleSkillsRoot(projectId), role, 'INDEX.md'),
|
|
911
941
|
installHint: 'sci_skill_install(role, repo_id) 安装精选目录项;或 sci_skill_install(role, repo_url=..., name=...) 安装自定义仓库(https github/gitlab)。',
|
|
912
942
|
}
|
|
913
943
|
},
|
|
@@ -917,7 +947,7 @@ export function registerSkillMenuTools(ctx, opts = {}) {
|
|
|
917
947
|
ctx.tools.register({
|
|
918
948
|
name: 'sci_skill_install',
|
|
919
949
|
description:
|
|
920
|
-
'
|
|
950
|
+
'为当前项目的指定角色安装一个开源 Skill 仓库,生成角色专用 INDEX.md。两种用法:① repo_id=精选目录 id(先 sci_skill_menu 查看);② repo_url=https://github.com/<owner>/<repo>(可加 name 指定目录名)。已安装会报「已安装」。',
|
|
921
951
|
parameters: {
|
|
922
952
|
role: { type: 'string', description: `角色 id(必填):${Object.keys(ROLES).join(' | ')}` },
|
|
923
953
|
repo_id: { type: 'string', description: '精选目录项 id(见 sci_skill_menu;与 repo_url 二选一)' },
|
|
@@ -926,7 +956,10 @@ export function registerSkillMenuTools(ctx, opts = {}) {
|
|
|
926
956
|
},
|
|
927
957
|
output: toolRender(),
|
|
928
958
|
async execute(args, exec) {
|
|
959
|
+
const projectId = projectOf(exec, true)
|
|
960
|
+
if (!expertConfig(projectId).roles.includes(args.role)) throw new Error('请先选择该项目专家')
|
|
929
961
|
const result = await installSkill({
|
|
962
|
+
projectId,
|
|
930
963
|
role: String(args.role || ''),
|
|
931
964
|
catalogId: args.repo_id ? String(args.repo_id) : null,
|
|
932
965
|
repoUrl: args.repo_url ? String(args.repo_url) : null,
|
|
@@ -948,7 +981,7 @@ export function registerSkillMenuTools(ctx, opts = {}) {
|
|
|
948
981
|
},
|
|
949
982
|
output: toolRender(),
|
|
950
983
|
async execute(args, exec) {
|
|
951
|
-
const result = await removeSkill({ role: String(args.role || ''), name: String(args.name || ''), exec: { ...exec, __sciSkillMirror: mirrorHook } })
|
|
984
|
+
const result = await removeSkill({ projectId: projectOf(exec, true), role: String(args.role || ''), name: String(args.name || ''), exec: { ...exec, __sciSkillMirror: mirrorHook } })
|
|
952
985
|
if (!result.ok) throw new Error(result.error || '删除失败')
|
|
953
986
|
return result
|
|
954
987
|
},
|
|
@@ -962,17 +995,18 @@ export function registerSkillMenuTools(ctx, opts = {}) {
|
|
|
962
995
|
role: { type: 'string', description: `角色 id(必填):${Object.keys(ROLES).join(' | ')}` },
|
|
963
996
|
},
|
|
964
997
|
output: toolRender(),
|
|
965
|
-
async execute(args) {
|
|
998
|
+
async execute(args, exec) {
|
|
999
|
+
const projectId = projectOf(exec)
|
|
966
1000
|
const role = String(args.role || '')
|
|
967
|
-
if (!ROLES
|
|
1001
|
+
if (!Object.hasOwn(ROLES, role)) {
|
|
968
1002
|
return { ok: false, error: `未知角色 ${role}(可用:${Object.keys(ROLES).join(' | ')})` }
|
|
969
1003
|
}
|
|
970
|
-
const state = loadState()
|
|
1004
|
+
const state = loadState(projectId)
|
|
971
1005
|
const entries = Array.isArray(state.roles[role]) ? state.roles[role] : []
|
|
972
1006
|
return {
|
|
973
1007
|
ok: true,
|
|
974
1008
|
role,
|
|
975
|
-
indexMd: join(roleSkillsRoot(), role, 'INDEX.md'),
|
|
1009
|
+
indexMd: join(roleSkillsRoot(projectId), role, 'INDEX.md'),
|
|
976
1010
|
count: entries.length,
|
|
977
1011
|
installed: entries.map((e) => ({
|
|
978
1012
|
name: e.name,
|
|
@@ -982,7 +1016,7 @@ export function registerSkillMenuTools(ctx, opts = {}) {
|
|
|
982
1016
|
license: e.license || null,
|
|
983
1017
|
installedAt: e.installedAt || 0,
|
|
984
1018
|
warn: e.warn === true,
|
|
985
|
-
skills: (Array.isArray(e.skills) ? e.skills : []).filter((s) => s && typeof s === 'object').map((s) => ({ name: s.name, description: s.description, path: s.relPath === '.' ? join(roleSkillsRoot(), role, e.name) : join(roleSkillsRoot(), role, e.name, s.relPath) })),
|
|
1019
|
+
skills: (Array.isArray(e.skills) ? e.skills : []).filter((s) => s && typeof s === 'object').map((s) => ({ name: s.name, description: s.description, path: s.relPath === '.' ? join(roleSkillsRoot(projectId), role, e.name) : join(roleSkillsRoot(projectId), role, e.name, s.relPath) })),
|
|
986
1020
|
})),
|
|
987
1021
|
}
|
|
988
1022
|
},
|
package/lib/ssh.js
CHANGED
|
@@ -57,11 +57,29 @@ function requireProfile(profiles, name) {
|
|
|
57
57
|
return profile
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
function normalizeHostFingerprint(value) {
|
|
61
|
+
if (typeof value !== 'string' || !/^SHA256:[A-Za-z0-9+/]{43}=?$/.test(value)) {
|
|
62
|
+
throw new Error('SSH 连接需要经管理员或可信控制台核对的主机指纹。请在 profile.hostFingerprint 填写 SHA256:… 并确认。')
|
|
63
|
+
}
|
|
64
|
+
const pin = value.replace(/=$/, '')
|
|
65
|
+
const digest = pin.slice(7)
|
|
66
|
+
if (Buffer.from(digest, 'base64').toString('base64').slice(0, -1) !== digest) {
|
|
67
|
+
throw new Error('SSH 主机指纹的 SHA256 编码无效。')
|
|
68
|
+
}
|
|
69
|
+
return pin
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function sameConnectionProfile(a, b) {
|
|
73
|
+
return b && ['host', 'port', 'username', 'auth', 'keyPath', 'credentialsRef', 'password', 'hostFingerprint']
|
|
74
|
+
.every(field => a[field] === b[field])
|
|
75
|
+
}
|
|
76
|
+
|
|
60
77
|
async function getClient(profileName, profile) {
|
|
61
78
|
const poolKey = sshProfilePoolKey(profileName)
|
|
79
|
+
const expected = normalizeHostFingerprint(profile.hostFingerprint)
|
|
62
80
|
if (clients.has(poolKey)) {
|
|
63
81
|
const entry = clients.get(poolKey)
|
|
64
|
-
if (
|
|
82
|
+
if (sameConnectionProfile(profile, entry.profile)) return entry
|
|
65
83
|
try { entry.client.end() } catch { /* ignore */ }
|
|
66
84
|
clients.delete(poolKey)
|
|
67
85
|
}
|
|
@@ -76,11 +94,17 @@ async function getClient(profileName, profile) {
|
|
|
76
94
|
throw importErr
|
|
77
95
|
}
|
|
78
96
|
const conn = new Client()
|
|
97
|
+
let keyRejected = false
|
|
79
98
|
const config = {
|
|
80
99
|
host: profile.host,
|
|
81
100
|
port: profile.port || 22,
|
|
82
101
|
username: profile.username,
|
|
83
102
|
readyTimeout: 15000,
|
|
103
|
+
hostVerifier(key) {
|
|
104
|
+
const actual = 'SHA256:' + createHash('sha256').update(key).digest('base64').replace(/=$/, '')
|
|
105
|
+
keyRejected = actual !== expected
|
|
106
|
+
return !keyRejected
|
|
107
|
+
},
|
|
84
108
|
}
|
|
85
109
|
const secret = (profile.credentialsRef && process.env[profile.credentialsRef]) || profile.password || ''
|
|
86
110
|
if (profile.auth === 'password') config.password = secret
|
|
@@ -89,27 +113,40 @@ async function getClient(profileName, profile) {
|
|
|
89
113
|
if (secret) config.passphrase = secret
|
|
90
114
|
} // 默认 agent
|
|
91
115
|
else {
|
|
92
|
-
// vendored bundle 同样导出 Client(agent 认证走同一模块)
|
|
93
|
-
const { default: { Client } } = await import(
|
|
94
|
-
pathToFileURL(join(PKG_ROOT_OF(), 'lib/vendor/ssh2.bundle.cjs')).href
|
|
95
|
-
)
|
|
96
116
|
const agentSock = process.env.SSH_AUTH_SOCK
|
|
97
117
|
if (agentSock) config.agent = agentSock
|
|
98
118
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
conn.on('error', reject)
|
|
102
|
-
conn.connect(config)
|
|
103
|
-
})
|
|
104
|
-
const sftp = await new Promise((resolve, reject) => {
|
|
105
|
-
conn.sftp((err, s) => (err ? reject(err) : resolve(s)))
|
|
106
|
-
})
|
|
107
|
-
const entry = { client: conn, sftp }
|
|
108
|
-
clients.set(poolKey, entry)
|
|
119
|
+
let entry
|
|
120
|
+
let closed = false
|
|
109
121
|
conn.on('close', () => {
|
|
122
|
+
closed = true
|
|
110
123
|
if (clients.get(poolKey) === entry) clients.delete(poolKey)
|
|
111
124
|
})
|
|
112
|
-
|
|
125
|
+
try {
|
|
126
|
+
await new Promise((resolve, reject) => {
|
|
127
|
+
conn.once('ready', resolve)
|
|
128
|
+
conn.on('error', reject)
|
|
129
|
+
conn.connect(config)
|
|
130
|
+
})
|
|
131
|
+
const sftp = await new Promise((resolve, reject) => {
|
|
132
|
+
conn.sftp((err, s) => (err ? reject(err) : resolve(s)))
|
|
133
|
+
})
|
|
134
|
+
if (closed || !sameConnectionProfile(profile, loadJson(profilesFile(), {})[profileName])) {
|
|
135
|
+
throw new Error('SSH 连接已关闭或配置已变更,请重试。')
|
|
136
|
+
}
|
|
137
|
+
const current = clients.get(poolKey)
|
|
138
|
+
if (current && sameConnectionProfile(profile, current.profile)) {
|
|
139
|
+
conn.end()
|
|
140
|
+
return current
|
|
141
|
+
}
|
|
142
|
+
entry = { client: conn, sftp, profile }
|
|
143
|
+
clients.set(poolKey, entry)
|
|
144
|
+
return entry
|
|
145
|
+
} catch (err) {
|
|
146
|
+
conn.end()
|
|
147
|
+
if (keyRejected) throw new Error('SSH 主机指纹与已确认的指纹不符,连接已拒绝。请通过可信渠道核对服务器身份。', { cause: err })
|
|
148
|
+
throw err
|
|
149
|
+
}
|
|
113
150
|
}
|
|
114
151
|
|
|
115
152
|
function execCmd(entry, command, timeoutMs = 30000) {
|
|
@@ -200,6 +237,10 @@ export function registerSshTools(ctx, opts = {}) {
|
|
|
200
237
|
}
|
|
201
238
|
if (exec.name === 'sci_ssh_profiles') {
|
|
202
239
|
const action = exec.arguments && exec.arguments.action
|
|
240
|
+
if (action === 'add' && exec.arguments.profile?.hostFingerprint) {
|
|
241
|
+
const p = exec.arguments.profile
|
|
242
|
+
return { kind: 'ask', reason: `确认信任 SSH 主机 ${p.host}:${p.port || 22} 的指纹 ${p.hostFingerprint}?请与管理员或可信控制台提供的指纹核对。` }
|
|
243
|
+
}
|
|
203
244
|
if (action === 'add' || action === 'remove' || action === 'import') {
|
|
204
245
|
return { kind: 'ask', reason: 'dsh-science: 修改 SSH profile 需要确认(主机/凭据)' }
|
|
205
246
|
}
|
|
@@ -208,13 +249,14 @@ export function registerSshTools(ctx, opts = {}) {
|
|
|
208
249
|
})
|
|
209
250
|
} catch (err) {
|
|
210
251
|
log(`pre-execute gate failed: ${err && err.message}`)
|
|
252
|
+
return
|
|
211
253
|
}
|
|
212
254
|
|
|
213
255
|
// -- profiles -------------------------------------------------------------
|
|
214
256
|
ctx.tools.register({
|
|
215
257
|
name: 'sci_ssh_profiles',
|
|
216
258
|
description:
|
|
217
|
-
'管理 SSH 主机 profile。动作:list / add(name, host, username, port?, auth: agent|key|password, keyPath?, credentialsRef?)/ remove / import
|
|
259
|
+
'管理 SSH 主机 profile。动作:list / add(name, host, username, port?, hostFingerprint?, auth: agent|key|password, keyPath?, credentialsRef?)/ remove / import。连接前须由用户通过可信渠道核对并确认 SHA256 主机指纹。密码或私钥口令使用环境变量 credentialsRef。',
|
|
218
260
|
parameters: {
|
|
219
261
|
action: { type: 'string', required: true, description: 'list | add | remove | import' },
|
|
220
262
|
name: { type: 'string' },
|
|
@@ -234,6 +276,7 @@ export function registerSshTools(ctx, opts = {}) {
|
|
|
234
276
|
name,
|
|
235
277
|
host: `${p.username}@${p.host}:${p.port || 22}`,
|
|
236
278
|
auth: p.auth,
|
|
279
|
+
hostFingerprint: p.hostFingerprint || null,
|
|
237
280
|
...(p.probedAt ? { probed: new Date(p.probedAt).toISOString() } : {}),
|
|
238
281
|
...(p.details ? { details: p.details } : {}),
|
|
239
282
|
})),
|
|
@@ -246,6 +289,7 @@ export function registerSshTools(ctx, opts = {}) {
|
|
|
246
289
|
host: p.host,
|
|
247
290
|
port: p.port || 22,
|
|
248
291
|
username: p.username,
|
|
292
|
+
...(p.hostFingerprint !== undefined ? { hostFingerprint: normalizeHostFingerprint(p.hostFingerprint) } : {}),
|
|
249
293
|
auth: p.auth || 'agent',
|
|
250
294
|
keyPath: p.keyPath,
|
|
251
295
|
credentialsRef: p.credentialsRef,
|
|
@@ -303,9 +347,11 @@ export function registerSshTools(ctx, opts = {}) {
|
|
|
303
347
|
details[key] = `ERROR: ${e.message}`
|
|
304
348
|
}
|
|
305
349
|
}
|
|
306
|
-
|
|
307
|
-
profile.
|
|
308
|
-
|
|
350
|
+
const latest = loadJson(profilesFile(), {})
|
|
351
|
+
if (!sameConnectionProfile(profile, latest[args.profile])) throw new Error('探测期间 SSH 配置已变更,请重试。')
|
|
352
|
+
latest[args.profile].details = details
|
|
353
|
+
latest[args.profile].probedAt = Date.now()
|
|
354
|
+
saveProfiles(latest)
|
|
309
355
|
return { ok: true, profile: args.profile, details }
|
|
310
356
|
},
|
|
311
357
|
})
|
package/lib/team.js
CHANGED
|
@@ -8,7 +8,8 @@ import { readFileSync, writeFileSync, renameSync } from 'node:fs'
|
|
|
8
8
|
import { join } from 'node:path'
|
|
9
9
|
import { dataDirOf, blockedGateOf } from './store.js'
|
|
10
10
|
import { normalizedBlockedBy } from './dag.js'
|
|
11
|
-
import {
|
|
11
|
+
import { expertConfig } from './project-experts.js'
|
|
12
|
+
import { ROLES, rolePrompt, roleLabel } from './roles.js'
|
|
12
13
|
import { alignTaskToResult, pruneTasksFromResults } from './blueprint.js'
|
|
13
14
|
import { readScope, blueprintViewOf, sessionIdOf } from './project-adapter.js'
|
|
14
15
|
import { resolveProjectContext } from './project-context.js'
|
|
@@ -17,7 +18,7 @@ import { ensureRouterSection } from './router.js'
|
|
|
17
18
|
// v0.9.0 角色级 skill 菜单:spawn 提示词末尾追加「扩展技能库」段(已安装技能 INDEX.md 路径清单)
|
|
18
19
|
// + simulator 专属的通用计算模拟规范(新工具上手 8 步规范绝对路径)。技能不进全局 registry,
|
|
19
20
|
// 只经这段提示词对对应角色成员生效(跨角色隔离),成员用读文件工具按需取用。
|
|
20
|
-
import {
|
|
21
|
+
import { projectExpertInstructions, universalOnboardingText, formatSkillWakeText, setMemberWakeHook } from './skillmenu.js'
|
|
21
22
|
|
|
22
23
|
function log(msg) {
|
|
23
24
|
console.log(`[dsh-science team] ${msg}`)
|
|
@@ -351,8 +352,13 @@ export function registerTeamTools(ctx, opts = {}) {
|
|
|
351
352
|
if (member.rootSessionId) return Boolean(ref.rootSessionId) && String(member.rootSessionId) === String(ref.rootSessionId)
|
|
352
353
|
return !ref.projectId && ref.relationship !== 'fork'
|
|
353
354
|
}
|
|
354
|
-
const wakeInScope = (ref) => (agent, memberName, text) =>
|
|
355
|
-
|
|
355
|
+
const wakeInScope = (ref) => async (agent, memberName, text) => {
|
|
356
|
+
const member = findMember(loadTeam(), ref.rootSessionId, memberName)
|
|
357
|
+
const config = expertConfig(ref.projectId)
|
|
358
|
+
if (member && config.configured && !config.roles.includes(member.role)) return { woken: false, error: '该角色已从项目专家移除' }
|
|
359
|
+
const extensions = member ? await projectExpertInstructions(ctx, ref.projectId, member.role) : ''
|
|
360
|
+
return wakeMember(ctx, agent, memberName, text + extensions, { rootSessionId: ref.rootSessionId, store })
|
|
361
|
+
}
|
|
356
362
|
|
|
357
363
|
// M1(M2 安全审查):调用者身份断言——队长=不在 roster 的调用者;成员=childId 命中 roster。
|
|
358
364
|
// 任务板是派单闸门与覆盖分析的执行事实源:成员只能推进自己名下任务到执行中/失败,
|
|
@@ -482,7 +488,9 @@ export function registerTeamTools(ctx, opts = {}) {
|
|
|
482
488
|
}
|
|
483
489
|
|
|
484
490
|
async function spawnMember(exec, role, nameOverride, ref) {
|
|
485
|
-
const
|
|
491
|
+
const config = expertConfig(ref?.projectId)
|
|
492
|
+
if (config.configured && !config.roles.includes(role)) throw new Error('请先在「项目专家」中添加此角色')
|
|
493
|
+
const def = Object.hasOwn(ROLES, role) && ROLES[role]
|
|
486
494
|
if (!def) throw new Error(`未知角色 ${role}。可用:${Object.keys(ROLES).join(' | ')}`)
|
|
487
495
|
const agent = exec && exec.agent
|
|
488
496
|
if (!agent) throw new Error('无法确定调用者(需要主会话)')
|
|
@@ -510,7 +518,7 @@ export function registerTeamTools(ctx, opts = {}) {
|
|
|
510
518
|
}
|
|
511
519
|
}
|
|
512
520
|
// childId 已被 HIGH-3 清理(会话失效):同一成员身份在本项目内重新激活,不需要改名。
|
|
513
|
-
const reactivated = await activateChild(def, role, name, agent, prompt)
|
|
521
|
+
const reactivated = await activateChild(def, role, name, agent, prompt, ref)
|
|
514
522
|
existing.childId = reactivated
|
|
515
523
|
existing.parentSessionId = (agent && (agent.id || agent.sessionId)) || null
|
|
516
524
|
if (!existing.projectId && ref.projectId) existing.projectId = String(ref.projectId)
|
|
@@ -519,7 +527,7 @@ export function registerTeamTools(ctx, opts = {}) {
|
|
|
519
527
|
log(`member re-activated: ${name}@${ref.rootSessionId} (${role}) childId=${reactivated}`)
|
|
520
528
|
return { ok: true, name, role, childId: reactivated, reused: true, reactivated: true }
|
|
521
529
|
}
|
|
522
|
-
const childId = await activateChild(def, role, name, agent, prompt)
|
|
530
|
+
const childId = await activateChild(def, role, name, agent, prompt, ref)
|
|
523
531
|
state.members.push({
|
|
524
532
|
name,
|
|
525
533
|
role,
|
|
@@ -537,10 +545,10 @@ export function registerTeamTools(ctx, opts = {}) {
|
|
|
537
545
|
return { ok: true, name, role, childId }
|
|
538
546
|
}
|
|
539
547
|
|
|
540
|
-
async function activateChild(def, role, name, agent, prompt) {
|
|
548
|
+
async function activateChild(def, role, name, agent, prompt, ref) {
|
|
541
549
|
// v0.9.0:团队协作规范之后追加 ① simulator 通用模拟规范(新工具 8 步上手)② 该角色已安装
|
|
542
550
|
// 扩展技能的 INDEX.md 索引段(无已安装技能时 roleSkillSectionText 返回 '',提示词保持精简)。
|
|
543
|
-
const fullPrompt = `${prompt}\n\n${teamProtocolText()}${universalOnboardingText(role)}${
|
|
551
|
+
const fullPrompt = `${prompt}\n\n${teamProtocolText()}${universalOnboardingText(role)}${await projectExpertInstructions(ctx, ref.projectId, role)}`
|
|
544
552
|
const childId = `sci-${name}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`
|
|
545
553
|
try {
|
|
546
554
|
const activation = await ctx.subagents.startActivation({
|
|
@@ -592,7 +600,7 @@ export function registerTeamTools(ctx, opts = {}) {
|
|
|
592
600
|
// -- 整队生成 ----------------------------------------------------------------
|
|
593
601
|
ctx.tools.register({
|
|
594
602
|
name: 'sci_team_spawn_all',
|
|
595
|
-
description:
|
|
603
|
+
description: '仅启动「项目专家」已选的角色。未选择时不启动成员。',
|
|
596
604
|
parameters: {},
|
|
597
605
|
output: {
|
|
598
606
|
schema: { type: 'object' },
|
|
@@ -602,7 +610,7 @@ export function registerTeamTools(ctx, opts = {}) {
|
|
|
602
610
|
assertLead(exec, '生成团队成员')
|
|
603
611
|
const ref = requireScope(exec)
|
|
604
612
|
const results = []
|
|
605
|
-
for (const role of
|
|
613
|
+
for (const role of expertConfig(ref.projectId).roles) {
|
|
606
614
|
try {
|
|
607
615
|
const def = ROLES[role]
|
|
608
616
|
const state = loadTeam()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-science-plugin",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"description": "Scientific workbench for DeepSeek Harness: publication figures, database connections, auto result review, SSH remote compute",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"assets",
|
|
14
14
|
"cordis.patch.yml",
|
|
15
15
|
"icon.svg",
|
|
16
|
-
"docs"
|
|
16
|
+
"docs/research/2026-11-12-生物科研能力与工作台集成调研.md",
|
|
17
|
+
"docs/recipes/agent-teams-science.md"
|
|
17
18
|
],
|
|
18
19
|
"exports": {
|
|
19
20
|
".": "./lib/index.js",
|
|
@@ -33,13 +34,12 @@
|
|
|
33
34
|
"@deepseek-ai/dsh-client-ui-layout",
|
|
34
35
|
"@deepseek-ai/dsh-client-ui-sidebar",
|
|
35
36
|
"@deepseek-ai/dsh-client-ui-sidebar-right",
|
|
36
|
-
"@deepseek-ai/dsh-client-ui-action-cards"
|
|
37
|
-
"@deepseek-ai/dsh-client-ui-slots"
|
|
37
|
+
"@deepseek-ai/dsh-client-ui-action-cards"
|
|
38
38
|
]
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
|
-
"dsh": ">=0.2.2-rc.3 <0.2.3-0"
|
|
42
|
+
"dsh": ">=0.2.2-rc.3 <0.2.3-0 || >=0.2.3-alpha.2 <0.2.4-0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"test": "node --test \"tests/*.test.mjs\"",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"url": "git+https://github.com/SPYfighting/dsh-science-plugin.git"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@deepseek-ai/dsh-action-cards": ">=0.2.2-rc.3 <0.2.3-0",
|
|
72
|
-
"@deepseek-ai/dsh-client-ui-action-cards": ">=0.2.2-rc.3 <0.2.3-0"
|
|
71
|
+
"@deepseek-ai/dsh-action-cards": ">=0.2.2-rc.3 <0.2.3-0 || >=0.2.3-alpha.2 <0.2.4-0",
|
|
72
|
+
"@deepseek-ai/dsh-client-ui-action-cards": ">=0.2.2-rc.3 <0.2.3-0 || >=0.2.3-alpha.2 <0.2.4-0"
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -33,5 +33,5 @@ description: 提出科研假设与研究课题思路。用户要 idea/课题/假
|
|
|
33
33
|
需要用户确认核心主张或 Result 时,不要自行替用户确认:
|
|
34
34
|
|
|
35
35
|
1. 先调用 `sci_blueprint_overview`,取项目的 `revision`、目标对象的 `revision` 与 `contentHash`。
|
|
36
|
-
2.
|
|
36
|
+
2. 在提供 `propose_action` 的 DSH 中调用该工具。在使用消息确认卡的 DSH 中,在回答末尾写一个语言标记为 `action-card` 的 JSON 代码块。两种方式都将 `action` 设为 `sci-paper-confirm`,填写非空的 `title` 和 `brief`,在 `details` 中填 `projectId`、`objectId`、`objectRevision`、`projectRevision`、`expectedHash`、`title`、`summary`。
|
|
37
37
|
3. 卡片只绑定用户提案时看到的那次对象修订与内容哈希;卡片发起后语义被修改,旧卡确认会被拒绝。修改意见回到对话说明,由你更新对象后重新发起。
|